Repository navigation
feat(logs): add --search and --cursor to logs:get --type server - #273
Conversation
logs:get declares --search (trimmed, at most 256 characters through the shared withinLength check, the logs service limit) and --cursor (opaque, trimmed). Both are server-only: the window rule becomes onlyWithServer, which takes any catalog flag, so --type deployment or live with either exits 2 before any log read. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
ServerLogsApi.page reads one page with sortDirection=asc, sending search and cursor only when given, and returns the logs with the server's pageInfo. ServerLogsApi.pages follows pageInfo.newestCursor with the same window and search, and stops when the server reports nothing newer, sends no pageInfo (a logs service without CL-7180), an empty page or no cursor, or after MAX_PAGES requests. A page that fails rejects the walk after the pages already read. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… cursor logs:get --type server now walks ServerLogsApi.pages with the resolved window, --search and --cursor, printing each page as it arrives, so a window past one page is printed in full and in order without holding it in memory. The single windowed read, its 5000-line cap notice and SERVER_LOGS_PAGE_CAP are gone. Every server-log request now carries sortDirection=asc. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…page cap When the walk stops after MAX_PAGES pages with the last page still reporting newer logs, logs:get prints a yellow notice and a ready-to-run command that resumes from that page's newest cursor. The window is printed as absolute ISO times, never the relative --since/--until the user typed: re-resolving a relative --since on resume would move the start past the cursor and silently skip the logs in between. Search and cursor are single-quoted for a POSIX shell. nextCursorOf is the one rule for "this page leads to another", shared by the walk and the hint. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
logs:get --type server now runs inside the same onInterrupt wrapper as the deployment and live follows. Ctrl-C lets the page in flight finish printing, requests no further page, prints "Stopped following the logs." and the resume command from the last printed page's newest cursor, and exits 3 with the listener released. untilInterrupted takes the extra lines to print after the stop line. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
LOGS_ERROR_MESSAGES rewords the four codes the logs service added with CL-7180. INVALID_CURSOR says the cursor did not come from logs:get and to run again without --cursor. SEARCH_TOO_LONG repeats the 256-character limit. INVALID_SOURCE and INVALID_SORT_DIRECTION can only follow a CLI bug, since the CLI never sends source and always sends asc, so they ask for an update. The field-keyed body the real service sends is covered on the wire. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
An empty --search result now reads 'No server logs matched "<text>" between <start> and <end>.' instead of the generic no-logs line, so an empty result is not mistaken for an empty window. .talismanrc: refreshed the checksums of the three test files this branch changed (logs-get.test.ts, get.test.ts, resources.test.ts). #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
README carries the regenerated logs:get usage with --search and --cursor. AGENTS.md describes the walk: oldest-first pages over newestCursor, nextCursorOf as the one continuation rule, the MAX_PAGES end, the resume command with an absolute window, and Ctrl-C during the walk exiting 3. .talismanrc: refreshed the README.md and AGENTS.md checksums and added src/logs/logs.inputs.test.ts. Talisman flags words like key, password and --var in them; none holds a secret. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… them A logs service without CL-7180 returns no pageInfo and drops search and cursor, so --search would print every log in the window as if it matched and --cursor would start the window over. ServerLogsApi.page now exits 1 with "The Launch API in this region does not support --search or --cursor for server logs yet." when either was sent and no pageInfo came back. A plain window still works against either service. .talismanrc: refreshed the logs-get.test.ts checksum. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Reviewed the whole PR: 0 high, 1 medium (inline).
Cross-repo (CL-7693): the harness cases in contentfly-dev-workspace#159 match the flags and output here (--search, --cursor, Resume with:, Stopped after). Merge this PR first; #159's cases skip cleanly where CL-7180 isn't deployed.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
Address review (dhruv-parekh-cs): a logs service before CL-7180 caps a window at its newest 5000 lines and sends no pageInfo, so the walk ends after one page and nextCursorOf gives no resume command. The truncation went silent. logs:get --type server now prints the old notice, "Showing the newest 5000 server log lines in this window. Narrow --since/--until to see earlier ones.", when the last page has no pageInfo and holds exactly SERVER_LOGS_PAGE_CAP lines. With CL-7180 deployed pageInfo is always present and the resume command covers truncation. .talismanrc: refreshed the checksums of get.test.ts and logs-get.test.ts. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Brings in launch:secrets (#275). The only conflict was .talismanrc: the README.md and src/resources.test.ts entries now carry the checksums of the merged files. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Review round 1, handled. Fixed
Also on the branch: v2-dev was merged in (b29c21c) to clear the conflict with #275 (launch:secrets). The only conflict was the README.md and src/resources.test.ts checksums in Disputed: none. Left for a human: none. — Claude Code |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
dhruv-parekh-cs
left a comment
There was a problem hiding this comment.
Re-review since ec8c3e5 (92592d3, the 5000-line notice for a logs service without page info; the v2-dev merge itself not reviewed): no high or medium issues.
Cross-repo (CL-7693): contentfly-dev-workspace#159's no-match search case expects wording this CLI doesn't print; flagged there. Merge order as stated: this PR first, then #159.
— 🤖 launch-pr-review-agent (Claude)
Generated by Claude Code
Ticket: https://contentstack.atlassian.net/browse/CL-7693 (follows CL-7171 / #269; the backend is CL-7180)
What
--search <text>and--cursor <cursor>onlaunch:logs:get --type server.--type deploymentorlivethe command exits 2 before reading any logs.--searchis trimmed and capped at 256 characters, the logs service's own limit.--cursoris opaque; the CLI never parses it.sortDirection=asc), followspageInfo.newestCursorwith the same window and search, and prints each page as it arrives.MAX_PAGES(100) pages.Resume with: csdx launch:logs:get … --cursor '<cursor>'.--since/--untilare always the run's absolute window. A relative--sincewould be recalculated on resume, move the start past the cursor, and silently skip the logs in between.INVALID_CURSOR,SEARCH_TOO_LONG,INVALID_SOURCEandINVALID_SORT_DIRECTION, including the field-keyed error body the real service sends.--searchor--cursorwas sent and the response has nopageInfo, the command exits 1 instead of printing unfiltered logs as matches or restarting the window. A plain window still works against either service.No server logs matched "<text>" between ….AGENTS.mddocuments the cursor walk.Decisions:
--searchwith--type liveis refused rather than filtered on the client.Tests
MAX_PAGESboundary (proved by mutating<to<=)INVALID_CURSORnpm test: 3446 passed.npm run lintis clean..talismanrcchecksums are refreshed for the touched test files and docs.cases/89-logs-get.shis in contentstack/contentfly-dev-workspace#159. The search and cursor cases need CL-7180 deployed to the target environment. It's still Ready to Deploy in Jira, and on an environment without it they skip.#claude_code#
🤖 Generated with Claude Code