Cover CLI help safety and card handle lookup#245
Conversation
|
@naturedesk is attempting to deploy a commit to the Vezures Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughCLI help metadata now documents updated profile flags and handle-based card lookup. Tests cover signer-independent help output and resolving ChangesCLI command behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b6f60e2830
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let pty: IPty; | ||
| try { | ||
| fixNodePtyHelperPermissions(); | ||
| const { spawn: spawnPty } = await import("node-pty"); |
There was a problem hiding this comment.
Keep node-pty imports at module scope
For files under this SDK, sdk/typescript/AGENTS.md says, “Always use top-level imports. Never use dynamic import() inside functions.” This new function-scoped import runs on the normal PTY launch path for tinyplace codex/claude, so it violates the repository’s required import discipline; please keep node-pty loading at module scope or refactor the fallback without adding an in-function dynamic import.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
sdk/typescript/src/cli/harness-wrapper.ts (1)
266-266: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDynamic
import()inside a function violates coding guidelines.The guideline for
**/*.{js,jsx,ts,tsx}states: "Always use top-level imports. Never use dynamicimport()inside functions." While the PR objective intentionally lazy-loadsnode-ptyandtui.tsalready uses the same pattern, this is still a guideline violation.An alternative that satisfies both the lazy-loading requirement and the guideline: use the existing
requireForHarness(fromcreateRequireat line 55) instead of dynamicimport(). The guideline prohibits dynamicimport()specifically, notrequire():♻️ Suggested refactor using existing `createRequire`
try { fixNodePtyHelperPermissions(); - const { spawn: spawnPty } = await import("node-pty"); + const { spawn: spawnPty } = requireForHarness("node-pty") as typeof import("node-pty"); pty = spawnPty(launch.command, launch.args, {This keeps the load lazy (only triggered when
runPtyAgentis called), avoids dynamicimport(), and reuses infrastructure already in the file. If the team considers this an accepted exception (given thetui.tsprecedent), please document it.As per coding guidelines:
**/*.{js,jsx,ts,tsx}: Always use top-level imports. Never use dynamicimport()inside functions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@sdk/typescript/src/cli/harness-wrapper.ts` at line 266, Replace the dynamic import inside runPtyAgent with the existing requireForHarness loader, while preserving lazy loading of node-pty and the existing spawnPty alias. Reuse the file’s createRequire-based infrastructure rather than adding a new loader or top-level import.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@sdk/typescript/src/cli/harness-wrapper.ts`:
- Line 266: Replace the dynamic import inside runPtyAgent with the existing
requireForHarness loader, while preserving lazy loading of node-pty and the
existing spawnPty alias. Reuse the file’s createRequire-based infrastructure
rather than adding a new loader or top-level import.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 31ac3e68-d42a-45f9-85b0-e24458d977cc
📒 Files selected for processing (3)
sdk/typescript/src/cli/commands.tssdk/typescript/src/cli/harness-wrapper.tssdk/typescript/tests/cli.test.ts
Summary
publish-card --helpandraw publish-card --helpshort-circuit without touching network/signing pathsraw card @handleresolves the handle before querying the GraphQL agent cardcard,publish-card, andcard-update, including that full-card JSON belongs in--datanode-ptyin the harness wrapper so non-PTY CLI tests/imports do not fail when the native module is absent; the existing pipe fallback still handles unavailable PTY at runtimeVerification
./node_modules/.bin/vitest run tests/cli.test.ts./node_modules/.bin/tsc --noEmitNotes
Current
origin/mainalready had the core behavior fixes for #216/#217; this PR locks them with tests and clears up the help surface. The hosted/a2a/@handleand/a2a/@handle/skill.mdbehavior from #216 still requires backend/docs-hosting work outside this checkout.Refs #216
Refs #217
Summary by CodeRabbit
New Features
@handleor an agent ID.@handleautomatically resolve to the corresponding agent ID.Improvements