Skip to content

fix(sdk): warn for silently dropped skill, command, and hook options - #8

Merged
jal-co merged 1 commit into
jal-co:mainfrom
arielarevalo:fix/unsupported-option-warnings
Sep 10, 2026
Merged

jal-co merged 1 commit into
jal-co:mainfrom
arielarevalo:fix/unsupported-option-warnings

Conversation

@arielarevalo

@arielarevalo arielarevalo commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Emitters now record an unsupported-option warning for each declared optional field they drop because their native format has no field for it. This covers allowedTools, disableModelInvocation, license, and metadata on skills, allowedTools, argumentHint, and passthrough frontmatter on commands, and the powershell hook command variant on Claude, Codex, and Gemini. Output files are unchanged. The build still degrades, and warnings[] now reports the loss.

Why

src/warnings.ts:6-9 states the contract: the build "emits a structured BuildWarning instead of throwing or silently dropping it". The commands docs page already promised this behavior: "the command body still emits and the build reports a warning for the unsupported option". #6 applied the pattern to one case, the Codex subagent frontmatter, and #5 lists two of the cases here under "Related". This change applies the same pattern to the remaining option-level drops.

How

Each dropped field warns through the repo's two existing idioms. Options that repeat across harnesses get one helper each in src/harnesses/shared.ts, in the same shape as warnAsync and warnEvent in src/harnesses/hooks.ts, and each emit site guards explicitly, in the same style as the subagent warnings in the Codex emitter (#6). The Pi, Cursor, and Windsurf emitters now accept the ctx parameter that Harness.emit already declares, which is why nothing there could warn before. warnPowershell sits beside the existing warnAsync. The type doc comments and the skills, commands, and hooks docs pages now state per harness what is emitted and what warns. The hooks docs example also used unix: where the type declares bash:, fixed in passing.

Four adjacent silent drops stay untouched on purpose, because each needs a decision rather than a warning. Claude Code natively accepts skill license, metadata, and disable-model-invocation in SKILL.md, so the right fix there is emission. Copilot prompt files have a native tools list, same reasoning. Codex skill metadata may belong in agents/openai.yaml. Cursor drops the required command description, and a warning there would fire on every Cursor build. I can file or fix those separately.

Warning pattern

The hand-written shape is deliberate, to respect the existing idioms above and the documented split in src/emit.ts: feature gating is central, and option warnings come from the emitter through ctx.warn. The alternative is to centralize: extend the per-feature supports map to option level and let emitFor derive these warnings. That would also surface per-option support in supportMatrix(). Value-level cases such as the powershell variant and event mapping do not fit a boolean matrix, so some hand-written warnings would remain either way. If you prefer the central direction, I can open a separate issue for it, and this PR keeps the current pattern in the meantime.

Testing

pnpm turbo typecheck test lint build passes. A new table test, test/unsupported-option-warnings.test.ts, builds one plugin with every optional field set and asserts the exact per-harness feature.option warning set. It also asserts that files still emit minus the fields, that Copilot emits powershell natively as windows, that empty values warn nothing, and that a plugin with no optional fields builds warning-free on all eight harnesses.

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

@arielarevalo is attempting to deploy a commit to the agent-plugin-sdk Team on Vercel.

A member of the Team first needs to authorize it.

Emitters now record an unsupported-option warning for declared optional fields their native format cannot carry, instead of dropping them silently. Same contract as the Codex subagent warnings (jal-co#6). Output files are unchanged.
@arielarevalo
arielarevalo force-pushed the fix/unsupported-option-warnings branch from 6b24bdc to 8793c7d Compare September 1, 2026 18:08
@jal-co
jal-co merged commit 63cee1a into jal-co:main Sep 10, 2026
3 of 4 checks passed
@arielarevalo
arielarevalo deleted the fix/unsupported-option-warnings branch September 13, 2026 21:41
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.

2 participants