Skip to content

feat: creative-agent docs polish + CLI warns on removed flags#844

Merged
bokelley merged 3 commits into
mainfrom
bokelley/review-scope3-pr100
Apr 23, 2026
Merged

feat: creative-agent docs polish + CLI warns on removed flags#844
bokelley merged 3 commits into
mainfrom
bokelley/review-scope3-pr100

Conversation

@bokelley

@bokelley bokelley commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Bundles two small, thematically related improvements that surfaced from reviewing scope3data/agentic-adapters#100 (AudioStack creative transformer):

Docs (closes #838, #839, #840) — The typed buildCreativeResponse/buildCreativeMultiResponse helpers and audioAsset({...}) factory already shipped. Integrators weren't finding them.

  • scripts/generate-agent-docs.tsTOOL_GOTCHAS data map drives **Watch out:** blocks below the Response section for build_creative, preview_creative, list_creative_formats. Easy to extend per tool.
  • docs/llms.txt regenerated.
  • skills/build-creative-agent/SKILL.md — cross-cutting pitfalls mention audioAsset, asset-values lists the audio shape, and a new #### Audio creative-template (TTS / mix / master) subsection covers type: 'audio', renders: [{ role, duration_seconds }], async render pipelines, and a handler using buildCreativeResponse + audioAsset.

CLI (closes #842)--platform-type was removed in 5.1 but the CLI was silently dropping it. Third-party CI scripts that still pass it believe they're filtering agent selection when they aren't.

  • bin/adcp.jsstoryboard run and its comply alias now emit a stderr warning naming the flag, removal version, and migration path. Suppressed under --json. Detection covers --flag value and --flag=value forms.
  • REMOVED_FLAGS is a single data map for future deprecations.
  • test/lib/cli-removed-flags.test.js — 5 spawn-based tests.

Out of scope

Test plan

  • npm run generate-agent-docs — idempotent ("up to date" on second run)
  • npm run typecheck — clean
  • node --test test/lib/cli-removed-flags.test.js — 5/5 pass
  • Manual: adcp storyboard run test-mcp --platform-type creative_transformer --dry-run capability_discovery emits the expected warning
  • Manual: same command with --json keeps stdout pure JSON
  • Read-through of regenerated docs/llms.txt and SKILL.md — new content reads cleanly

🤖 Generated with Claude Code

bokelley and others added 2 commits April 23, 2026 13:18
…eative-template example

Discoverability fix for existing SDK surface (factories and response
helpers already shipped; integrators weren't finding them).

- scripts/generate-agent-docs.ts: TOOL_GOTCHAS data map drives new
  'Watch out:' blocks on build_creative, preview_creative, and
  list_creative_formats. Points at the compile-time-safe response
  helpers and flags the audio-formats renders gap.
- skills/build-creative-agent/SKILL.md: cross-cutting pitfalls now name
  audioAsset and spell out that platform-native top-level fields are
  invalid. New Audio subsection under creative-template covering
  type: 'audio', renders with duration_seconds, async render pipelines,
  and a handler using buildCreativeResponse + audioAsset.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
--platform-type was removed from the SDK in 5.1; comply() throws when
it's passed programmatically, but the CLI was capturing and dropping
it silently. Third-party CI scripts that still pass it believe they're
filtering agent selection when they aren't.

storyboard run and its comply alias now emit a stderr warning naming
the flag, removal version, and migration path. Suppressed under --json.
Detection covers both space-separated and equals forms.

REMOVED_FLAGS is a single data map for future deprecations.

Closes #842. (#841 deferred pending convention RFC — see issue thread.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley bokelley changed the title docs(creative-agent): build_creative callouts + audio creative-template example docs(creative-agent) + cli: build_creative callouts, audio example, removed-flag warnings Apr 23, 2026
@bokelley bokelley changed the title docs(creative-agent) + cli: build_creative callouts, audio example, removed-flag warnings feat: creative-agent docs polish + CLI warns on removed flags Apr 23, 2026
… stale-gotcha guard

Addresses three reviewer findings on PR #844:

- tests hit live network: CLI tests passed --dry-run + storyboard id,
  but runFullAssessment doesn't short-circuit on --dry-run. Rewrote
  the suite to call with no agent arg so handleStoryboardRun exits at
  the Usage check (exit 2) before any network call. Added 10s
  spawnSync timeouts so a future regression fails fast instead of
  hanging. Added a test that asserts the warning is advisory (doesn't
  alter exit status).

- --json suppressed the stderr warning: wrong contract. stderr
  doesn't pollute stdout JSON, and CI scripts running under --json
  are precisely where the warning needs to land. Removed the
  jsonOutput guard; flipped the test accordingly.

- stale-gotcha guard: a tool rename would silently drop the
  "Watch out:" block from llms.txt. Generator now fails with a named
  error if any TOOL_GOTCHAS key doesn't resolve to a tool in the
  schema index.

Also:
- Prefix changed from "[warn]" to "DEPRECATED:" for consistency with
  the existing comply-alias deprecation banner at bin/adcp.js:995.
- Skill: split long cross-cutting-pitfalls bullet into shape-rules +
  asset-factory-rules. Split audio code block into format-decl and
  handler, so the import isn't visually nested inside a listCreativeFormats
  literal. Added third delta note ("inputs are text assets keyed by
  asset_id — read .content not .text") and a pointer to the webhooks
  section for async render pipelines. Fixed pre-existing TextAsset
  shape doc (was "{ text: string }", schema says { content: string }).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley

Copy link
Copy Markdown
Contributor Author

Expert reviews addressed in bdbfded. Ran three experts in parallel: code-reviewer, docs-expert, dx-expert.

Fixed (all three reviewers converged):

  • [code-reviewer blocker] CLI tests were hitting the live network because `runFullAssessment` doesn't honor `--dry-run`. Rewrote tests to call with no agent arg → exits at Usage check (2) before any network call. Added 10s `spawnSync` timeouts. Added an advisory-exit test.
  • [code-reviewer + dx-expert blocker] `--json` suppressed the stderr warning — wrong call. stderr doesn't pollute stdout JSON, and `--json` mode in CI is precisely where the warning needs to land. Removed the `jsonOutput` guard; flipped the test.
  • [code-reviewer] Generator now fails loud if any `TOOL_GOTCHAS` key doesn't resolve to a real tool. A tool rename would otherwise silently drop its "Watch out:" block from llms.txt.
  • [code-reviewer + dx-expert] Warning prefix `[warn]` → `DEPRECATED:` for consistency with the existing comply-alias banner (`bin/adcp.js:995`).

Fixed (docs-expert):

  • Split the long cross-cutting pitfalls bullet into two (shape-rules + asset-factory-rules).
  • Split audio code block into two fenced blocks (format decl, then handler with the `import`) so the import isn't visually nested inside a `listCreativeFormats` literal.
  • Added third delta note to the audio subsection: "Inputs are text assets keyed by `asset_id` — read `.content`, not `.text`."
  • Added pointer from the async-renders paragraph to the Webhooks section for the task-worker / `creative_review` pattern.
  • Fixed pre-existing text-asset shape doc (was `{ text: string }`, schema says `{ content: string }`).

Deferred with notes:

  • `--strict-flags` exit mode (dx-expert nice-to-have): sensible next PR, doesn't belong in this one.
  • Widen `warnRemovedFlags` to other command dispatchers (`storyboard list/show/step`, top-level `adcp <protocol>`): `--platform-type` was specifically a compliance-run flag; widening risks spurious warnings. Can revisit when a second removed flag lands.
  • `audioRender` / `displayRender` render helpers (dx-expert nice-to-have): separate SDK PR — worth opening as a follow-up issue.
  • Runtime hint when a `build_creative` response has top-level `tag_url`/`creative_id`/`media_type` and no `creative_manifest` (dx-expert): separate validator PR.

Tests: 6/6 pass, ~3s total. Typecheck clean. Generator idempotent.

@bokelley bokelley merged commit 9e588bf into main Apr 23, 2026
9 checks passed
bokelley added a commit that referenced this pull request Apr 23, 2026
…hape-drift hint (#848)

* feat(sdk): displayRender + parameterizedRender factories for Format.renders[]

Closes #846. Fixes spec-non-conformant audio guidance shipped in #844.

Format.renders[] items have a oneOf — each entry must satisfy either
`dimensions` (width + height required) OR `parameters_from_format_id: true`.
A render with only `{ role }` or `{ role, duration_seconds }` fails that
oneOf. The audio example in the skill from #844 was wrong on this point.

- src/lib/utils/format-render-builders.ts: typed factories matching the
  two valid branches. displayRender({ role, dimensions }) for W×H
  formats; parameterizedRender({ role }) for audio and template formats
  (auto-injects parameters_from_format_id: true).
- src/lib/index.ts: export the factories and their shape types.
  FormatRender namespace NOT exported — name collision with the
  existing v3 structural interface in utils/format-renders.
- skills/build-creative-agent/SKILL.md: audio subsection now uses
  parameterizedRender; duration/codec go in format_id.parameters via
  accepts_parameters. Display example updated to use displayRender.
- scripts/generate-agent-docs.ts: TOOL_GOTCHAS.list_creative_formats
  points at the factories and corrects the audio guidance.
- docs/llms.txt regenerated.

Tests: 4/4 pass — injection correctness, non-pixel units, oneOf
invariant guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(cli): --strict-flags to fail CI when removed flags are passed

Closes #847. Non-breaking extension of the #844 warning helper.

By default, removed-flag detection is advisory — stderr warns, exit
status reflects the underlying command. CI pipelines that want to
catch stale scripts as build-breakers now opt in with --strict-flags:
if any flag from REMOVED_FLAGS is present, the run exits 2 after
printing a pointed error that names every offender.

- bin/adcp.js: warnRemovedFlags() returns the list of found flags.
  handleStoryboardRun checks args.includes('--strict-flags') and
  exits 2 when found.length > 0.
- test/lib/cli-removed-flags.test.js: 2 new tests — hard-exit on
  strict + removed, no-op on strict alone.

Tests: 8/8 pass. Rest of test suite unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(testing): actionable hint for build_creative platform-native response drift

Closes #845.

When a build_creative response ships { tag_url, creative_id, media_type }
at the top level without { creative_manifest }, the storyboard runner's
schema error ("/ must have required property 'creative_manifest'") is
accurate but not actionable. A developer staring at that line doesn't
see "oh, I had the shape inverted."

detectShapeDriftHint() recognizes this pattern and attaches an
actionable fix-recipe to ValidationResult.warning that names
buildCreativeResponse/buildCreativeMultiResponse, points at
@adcp/client/server, and references the build-creative-agent skill's
creative-template section.

- src/lib/testing/storyboard/validations.ts: detectShapeDriftHint()
  runs alongside the existing strict-verdict composition. Hint
  reaches ValidationResult.warning on both Zod-pass and Zod-fail
  branches (platform-native shape fails Zod; hint is the same).
- test/lib/shape-drift-hint.test.js: 6 tests covering positive
  detection (full drift, partial drift), negative (correct shape,
  empty payload), and other-tool isolation.

Motivating case: scope3 agentic-adapters#100. Intentionally scoped to
build_creative today — the detector is a switch on taskName, easy to
extend as new drift patterns surface in real integrations.

Tests: 6/6 pass. Full related suite 34/34.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: add changeset for creative-agent follow-ups

Covers #845 (shape-drift hint), #846 (render factories +
audio-example correction), #847 (--strict-flags CLI). Minor bump —
new public SDK exports (displayRender, parameterizedRender) and a
new CLI flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* style: prettier fix on cli-removed-flags test

* fix: address expert review — FormatRender namespace, strict-flags on step, tighter hint, CLI docs

DX-expert + code-reviewer feedback on #848.

- docs/CLI.md: remove three occurrences of the removed --platform-type /
  --list-platform-types flags that would have sent readers straight
  into the new --strict-flags exit path. Add --strict-flags to the
  recommended CI example. Document the 5.1 removal explicitly.
- FormatRender namespace (const) now exports FormatRender.display /
  .parameterized / .template for one-dot autocomplete. Reachable via the
  same name as the v3 structural type (FormatRenderEntry — renamed; the
  old FormatRender type alias stays in utils/format-renders with a
  @deprecated tag for anyone importing the sub-module directly).
- templateRender alias for parameterizedRender — matches creative-template
  specialism terminology. Both exported; pick either.
- RenderItem discriminated union export (DimensionsRender | ParameterizedRender)
  for consumers building renders[] arrays by hand.
- detectShapeDriftHint tightened: 2 sentences, dropped SKILL pointer
  (a dev hitting this is in their terminal looking for the fix).
- enforceStrictFlags factored out of handleStoryboardRun; storyboard step
  now shares it, so --platform-type on `adcp storyboard step` warns and
  honors --strict-flags too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
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.

cli: warn on removed flags instead of silently ignoring (e.g. --platform-type) docs: audio creative-template example in build-creative-agent skill

2 participants