Skip to content

feat: AXI_DEBUG=1 prints the forwarded calcom argv to stderr - #14

Merged
simkimsia merged 1 commit into
mainfrom
feat/axi-debug
Oct 7, 2026
Merged

simkimsia merged 1 commit into
mainfrom
feat/axi-debug

Conversation

@simkimsia

Copy link
Copy Markdown
Owner

Intent

Implement calcom-axi#13: add an AXI_DEBUG=1 convention so triage can see the exact calcom argv calcom-axi forwarded. This comes from the axi-playbook inherited-gap rule: gh-axi#163 was closed as a vendor bug because the plain-CLI repro was retyped by hand, while the wrapper's own argv translation caused it (fixed in gh-axi#188).

Decisions:

  • The spawner (src/calcom.ts run) is the only place that prints, one stderr line per vendor call, prefixed [axi-debug]. stdout stays clean TOON so agents parsing output are unaffected.
  • Only AXI_DEBUG exactly "1" enables it; any other value (including 0) stays silent.
  • Args are shell-quoted only when needed so the line can be pasted and rerun as-is.
  • --api-key values are masked in both forms even though calcom-axi does not forward that flag today. Credentials normally travel via CAL_API_KEY in the environment, which is never printed.
  • The shipped skill gap template gains the two inherited-gap questions from axi-playbook process.md (plain CLI result with the forwarded argv; shape args, map error, or document), plus a one-line pointer to AXI_DEBUG. README and AGENTS.md document the variable.
  • PR body must keep 'Closes feat: AXI_DEBUG=1 prints forwarded vendor argv to stderr #13'.

What Changed

  • src/calcom.ts: when AXI_DEBUG is exactly 1, run writes one [axi-debug] calcom ... line to stderr per vendor call, before spawning calcom. The line comes from the new debugLine, which shell-quotes only the args that need it so the line can be pasted and rerun as-is. It masks --api-key values in both the --api-key <v> and --api-key=<v> forms. Any other value of AXI_DEBUG, including 0, prints nothing. stdout stays clean TOON. Tests in test/calcom.test.ts cover quoting, masking and env gating.
  • skills/calcom-axi/SKILL.md: the fallback steps now point to AXI_DEBUG=1 for seeing the exact calcom command. The gap-report template gets the two inherited-gap questions: the plain CLI result with the forwarded argv, and whether the axi should shape the args, map the error or document the limit.
  • README.md and AGENTS.md document the AXI_DEBUG variable.

Closes #13

🤖 Generated with Claude Code

Risk Assessment

✅ Low: The change adds opt-in debug output to stderr. It is gated on AXI_DEBUG being exactly "1" in the only spawner (run). Args are shell-quoted only when needed, --api-key values are masked in both forms, stdout is untouched, and the docs and skill-template additions match every stated intent decision.

Testing

I built calcom-axi in the worktree and ran it as an end user would, with a disposable fake calcom (which logs the argv it receives) on a temp PATH and an isolated HOME. All eight live CLI scenarios passed: - one stderr debug line per calcom call, with stdout unchanged - only the exact value "1" enables it - the quoted line reproduces the same argv when pasted back into a shell - the credential is never printed - the line still appears when calcom fails - a rejected flag produces no line The --api-key masking requirement can't be reached through the CLI because calcom-axi never forwards that flag. A targeted unit test covers it, but I am reporting it as untested live. I removed dist, node_modules and the temp directory afterwards. This is a CLI-only change, so the evidence is a transcript, not screenshots.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
AXI_DEBUG=1 calcom-axi whoami prints [axi-debug] calcom me show --json on stderr and leaves stdout as clean TOON ✅ pass live axi-debug-transcript.txt S1
An argument containing a space and an apostrophe is shell-quoted; other arguments stay unquoted ✅ pass live axi-debug-transcript.txt S2
Pasting the printed debug line into a shell sends calcom exactly the argv calcom-axi sent ✅ pass live axi-debug-transcript.txt S3 (MATCH)
AXI_DEBUG unset, 0, true, ' 1', 1x or yes: stderr stays empty and stdout matches the debug run ✅ pass live axi-debug-transcript.txt S4
The CAL_API_KEY credential never appears in debug output ✅ pass live axi-debug-transcript.txt S5 (0 matches)
When calcom fails, the debug line still prints and the structured error stays on stdout with exit 1 ✅ pass live axi-debug-transcript.txt S6
Bare calcom-axi (dashboard) prints one debug line per calcom call (two) ✅ pass live axi-debug-transcript.txt S7
A rejected flag exits 2 before any calcom call, with no debug line; the --version fast path is unaffected ✅ pass live axi-debug-transcript.txt S8, S9
--api-key values are masked in both forms (--api-key X and --api-key=X) ⏸️ untested no The earlier payload has no live result for this scenario. No calcom-axi command forwards --api-key (credentials go through CAL_API_KEY), so the end-user CLI can't reach the masking path. Only a unit t…
Evidence: CLI transcript of all AXI_DEBUG scenarios
\### S1: AXI_DEBUG=1 calcom-axi whoami (stdout and stderr captured separately)
exit=0
--- stdout:
user:
  id: 1
  username: tester
  name: Test User
  email: t@example.com
  timezone: UTC
  weekStart: ""
  defaultScheduleId: none
--- stderr:
[axi-debug] calcom me show --json

\### S2: AXI_DEBUG=1 bookings with an argument needing quoting
exit=0
--- stdout:
bookings: 0 bookings (status: past, attendee: o'brien test@example.com)
help[1]:
  Drop `--status` to search every status
--- stderr:
[axi-debug] calcom bookings list --take 5 --status past --attendee-email 'o'\''brien test@example.com' --sort-start desc --json

\### S3: paste the debug line back into a shell; compare argv received by calcom
pasted: calcom bookings list --take 5 --status past --attendee-email 'o'\''brien test@example.com' --sort-start desc --json
argv from axi:   ["bookings","list","--take","5","--status","past","--attendee-email","o'brien test@example.com","--sort-start","desc","--json"]
argv from paste: ["bookings","list","--take","5","--status","past","--attendee-email","o'brien test@example.com","--sort-start","desc","--json"]
MATCH

\### S4: AXI_DEBUG unset / 0 / true / ' 1' / 1x — stderr must be empty
AXI_DEBUG=[UNSET] exit=0 stderr_bytes=0 stdout_same_as_S1=yes
AXI_DEBUG=[0] exit=0 stderr_bytes=0 stdout_same_as_S1=yes
AXI_DEBUG=[true] exit=0 stderr_bytes=0 stdout_same_as_S1=yes
AXI_DEBUG=[ 1] exit=0 stderr_bytes=0 stdout_same_as_S1=yes
AXI_DEBUG=[1x] exit=0 stderr_bytes=0 stdout_same_as_S1=yes
AXI_DEBUG=[yes] exit=0 stderr_bytes=0 stdout_same_as_S1=yes

\### S5: credential never printed (CAL_API_KEY in env)
/var/folders/bx/jqvbf88s0n741xh9d47878qc0000gn/T/tmp.LraRf1gfZG/err2:0
/var/folders/bx/jqvbf88s0n741xh9d47878qc0000gn/T/tmp.LraRf1gfZG/err1:0

\### S6: vendor failure path still prints argv, error stays structured on stdout
exit=1
--- stdout:
error: "API Error (500): boom"
code: UNKNOWN
help[1]: "Rerun the same command with plain `calcom` to see its full output, then report the gap at https://github.com/simkimsia/calcom-axi/issues"
--- stderr:
[axi-debug] calcom agenda --take 10 --json

\### S7: one line per vendor call — bare calcom-axi (dashboard)
exit=0
--- stderr:
[axi-debug] calcom me show --json
[axi-debug] calcom agenda --take 3 --json
calls logged by fake calcom:       11

\### S8: --version fast path unaffected
0.1.1

\### S9: rejected flag fails before any calcom call, no debug line
exit=2
error: unknown flag --bogus for `bookings`
code: VALIDATION_ERROR
help[1]: Run `calcom-axi bookings --help` for accepted flags
stderr:
Evidence: Paste-and-rerun check
[axi-debug] calcom bookings list --take 5 --status past --attendee-email 'o'\''brien test@example.com' --sort-start desc --json
argv from axi: ["bookings","list","--take","5","--status","past","--attendee-email","o'brien test@example.com","--sort-start","desc","--json"]
argv from paste: [same]
MATCH
Evidence: Targeted debugLine unit test run

 ✓ test/calcom.test.ts (8 tests) 4ms

 Test Files  1 passed (1)
      Tests  8 passed (8)
   Start at  04:45:13
   Duration  521ms (transform 300ms, setup 0ms, collect 299ms, tests 4ms, environment 0ms, prepare 63ms)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
AXI_DEBUG=1 calcom-axi whoami prints [axi-debug] calcom me show --json on stderr and leaves stdout as clean TOON ✅ pass live axi-debug-transcript.txt S1
An argument containing a space and an apostrophe is shell-quoted; other arguments stay unquoted ✅ pass live axi-debug-transcript.txt S2
Pasting the printed debug line into a shell sends calcom exactly the argv calcom-axi sent ✅ pass live axi-debug-transcript.txt S3 (MATCH)
AXI_DEBUG unset, 0, true, ' 1', 1x or yes: stderr stays empty and stdout matches the debug run ✅ pass live axi-debug-transcript.txt S4
The CAL_API_KEY credential never appears in debug output ✅ pass live axi-debug-transcript.txt S5 (0 matches)
When calcom fails, the debug line still prints and the structured error stays on stdout with exit 1 ✅ pass live axi-debug-transcript.txt S6
Bare calcom-axi (dashboard) prints one debug line per calcom call (two) ✅ pass live axi-debug-transcript.txt S7
A rejected flag exits 2 before any calcom call, with no debug line; the --version fast path is unaffected ✅ pass live axi-debug-transcript.txt S8, S9
--api-key values are masked in both forms (--api-key X and --api-key=X) ⏸️ untested no The earlier payload has no live result for this scenario. No calcom-axi command forwards --api-key (credentials go through CAL_API_KEY), so the end-user CLI can't reach the masking path. Only a unit t…
  • pnpm install --frozen-lockfile &amp;&amp; pnpm build (worktree-local), then ran node dist/bin/calcom-axi.js with a throwaway fake calcom first on a temp PATH, using a temp HOME and a fake CAL_API_KEY
  • AXI_DEBUG=1 calcom-axi whoami with stdout and stderr captured separately
  • AXI_DEBUG=1 calcom-axi bookings --status past --attendee-email &#34;o&#39;brien test@example.com&#34; --limit 5, then pasted the printed line into sh -c and compared the argv the fake calcom received both times
  • calcom-axi whoami with AXI_DEBUG unset, 0, true, 1, 1x and yes: checked stderr is empty and stdout matches the debug run
  • grep for the CAL_API_KEY value in the debug stderr
  • FAKE_FAIL=1 AXI_DEBUG=1 calcom-axi agenda (calcom exits non-zero)
  • AXI_DEBUG=1 calcom-axi (dashboard, two calcom calls)
  • AXI_DEBUG=1 calcom-axi --version (fast path)
  • AXI_DEBUG=1 calcom-axi bookings --bogus (flag rejected before any calcom call)
  • pnpm exec vitest run test/calcom.test.ts (debugLine masking of both --api-key forms)
✅ **Document** - passed

✅ No issues found.

⚠️ **Lint** - 1 info
  • ℹ️ src/calcom.ts - Could not run the TypeScript type check: node_modules isn't installed in this worktree, so tsc isn't available, and installing dependencies was out of scope for this pass. Prettier --check passes on all changed files.
✅ **Push** - passed

✅ No issues found.

Triage needs the exact command calcom-axi ran, so a plain-CLI repro
tests the axi's translation instead of one retyped by hand. The spawner
prints one shell-quoted line per call with --api-key values masked;
stdout stays TOON. The skill's gap template gains the two
inherited-gap questions from axi-playbook process.md.

Closes #13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@simkimsia
simkimsia merged commit 9c1d55c into main Oct 7, 2026
2 checks passed
@simkimsia
simkimsia deleted the feat/axi-debug branch October 7, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: AXI_DEBUG=1 prints forwarded vendor argv to stderr

1 participant