Upgrade exemplar to multi-resource stencil with full test coverage - #3
Merged
Merged
Conversation
The v0.2 stencil (JSONPlaceholder) was a read-only blog API with no auth,
no pagination, and no business rules. It couldn't teach the scaffolder
what an A+ CLI looks like. v0.3 replaces it with examples/exemplar-cli/,
a hand-crafted fictional API structurally inspired by google/agents-cli:
- bin/<api>-cli.mjs is a thin dispatcher
- lib/{api,auth,output,config,env,args,help}.mjs holds shared machinery
- commands/<resource>.mjs files: one per resource, default-export the registry
- skills/<api>-cli-{workflow,auth,resources,knowledge}/SKILL.md (modular)
- A first-class `login` command with --status
- Cursor pagination, idempotency-key, --if-match, multipart upload all
wired in the stencil so generated CLIs inherit the patterns
Other changes:
- Collapse 3 skills (clify-scaffold, clify-validate, clify-sync) into 1.
Validate and sync were thin wrappers around binary verbs an agent can
call directly. The lone `clify` skill is 105 lines (down from 151) with
6 phases; per-step detail moved to references/scaffold-pipeline.md.
- New `clify eval <case>` verb plus an evals/ harness with the inaugural
zoho-inventory case. Deterministic graders run today; LLM-as-judge is
stubbed for a follow-up.
- validate.mjs now scans bin/ + lib/ + commands/ for source conventions
(BASE_URL, FormData, idempotency-key) and looks for the workflow skill
at skills/<pkg.name>-workflow/SKILL.md, falling back to the legacy path.
- JSONPlaceholder moved to examples/legacy/ with a README explaining its
status. Scaffold-init now copies from examples/exemplar-cli/.
Verification: 15/15 host tests, 33/33 exemplar tests, 21/21 validate gate
checks, scaffold-init round-trip clean, eval verb works end-to-end.
https://claude.ai/code/session_016WbCqoWpJ77he4VQbLSySe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the single-endpoint JSONPlaceholder exemplar with a comprehensive, production-ready stencil (
exemplar-cli) that demonstrates all patterns clify-generated CLIs must support. The new exemplar is structurally inspired by google/agents-cli and includes three resources (items, item-variants, orders) exercising pagination, idempotency, multipart uploads, and auth.Key Changes
New exemplar structure (
examples/exemplar-cli/):<resource> <action>)commands/lib/logincommand with--statusskills/<cli>-<role>/Comprehensive test suite:
--version,--help, error semanticsnpm testThree-resource API surface:
items: list (cursor pagination), get, create (idempotency), update, deleteitem-variants: sub-resource flattened to two-level nestingorders: list, get, create (idempotency), upload (multipart)Knowledge base (
knowledge/):Eval harness (
evals/):.clify.jsonfields, auth schemeUpdated documentation:
references/scaffold-pipeline.md: in-depth per-phase referenceskills/clify-scaffold/→skills/clify/with lean summaryclify-validateandclify-syncskills (functionality preserved in core)references/conventions.mdto reference exemplar-cliBackward compatibility:
examples/legacy/jsonplaceholder-cli/lib/+commands/)Notable Implementation Details
httpmodule (zero dependencies)lib/auth.mjs— scaffolder swapsschemeand matching branch for target API:idand:itemIdplaceholders with proper URL encodingpaginate()) handles cursor, page, offset, and Link header strategies--fileflag and read file from disk.clify.jsoncaptures auth scheme, API name, docs URL, content hash, and node version requirementhttps://claude.ai/code/session_016WbCqoWpJ77he4VQbLSySe