feat: ai-friendly root-cms client CLI commands and agent skill#1299
Merged
Conversation
Adds CLI commands designed for AI coding agents to interact with the
RootCMSClient programmatically:
- `root-cms client.call <method> [jsonArgs]` invokes any public method
with a JSON array of positional args and prints a JSON result envelope
({"ok":true,"result":...} / {"ok":false,"error":...}). Firestore
Timestamp/GeoPoint/DocumentReference values round-trip as plain JSON.
- `root-cms client.methods [--json] [--types]` lists every public method
with its TypeScript signature and description (plus referenced type
defs) for API discovery.
- `root-cms skill.install [dir]` installs the bundled `root-cms-cli`
agent skill into a local skills dir (default `.claude/skills`).
The method/type catalog is parsed from the generated client.d.ts so it
always matches the real API; private methods are excluded. The decorative
CLI banner is suppressed for `client.*` so stdout stays clean JSON.
Also refactors the duplicated convertFirestoreTypes helper into utils.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
|
Nice; looks good. Regarding the local skills directory maybe we could try to have it detect the right dir; for example VS Code uses |
Member
Author
|
@jeremydw how do you propose the "detect" mechanism would work? i.e. the agent checks to see if certain folders already exists? |
Instead of defaulting to `.claude/skills`, `root-cms skill.install` now stays agnostic of any particular AI provider: - Detects any existing `.<provider>/skills` directory in the project (e.g. `.claude/skills`, `.agent/skills`, `.cursor/skills`) and installs into all of them. - Otherwise seeds `skills/` under a known agent config dir that exists (`.claude`, `.agent`). - Otherwise falls back to a neutral `.agent/skills`. An explicit `[dir]` argument still overrides detection. Already-installed targets are skipped (unless `--force`) instead of erroring, so multi-dir installs don't abort partway. Adds detectSkillsDirs() unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Yup - the latest commit has what I was thinking! |
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
Exposes the
RootCMSClientto AI coding agents (and scripts) through theroot-cmsCLI, plus a downloadable skill that teaches agents how to use it.New commands
root-cms client.call <method> [jsonArgs]— invokes any public method onRootCMSClient. Args are a JSON array of positional arguments matching the method's TypeScript signature. Output is a single-line JSON envelope on stdout:jsonArgsfor zero-arg methods; pass-to read args from stdin (stdin is only read when explicitly requested, so no hangs).Timestamp/GeoPoint/DocumentReferenceround-trip as{_seconds,_nanoseconds}/{_latitude,_longitude}/{_referencePath}in both args and results.root-cms client.methods [--json] [--types]— lists all public methods with their TS signatures and JSDoc descriptions for discovery;--typesalso emits the referenced interface/type definitions.root-cms skill.install [dir]— installs the bundledroot-cms-cliagent skill into a local skills directory (default.claude/skills). Supports a custom dir and--force.How it works
The method/type catalog is parsed from the generated
dist/core/client.d.ts, so it always matches the real API. Private methods are excluded. The decorative CLI banner is suppressed forclient.*commands to keep stdout as clean JSON.Also refactors the duplicated
convertFirestoreTypeshelper intocli/utils.ts.Downloadable skill
skills/root-cms-cli/SKILL.mdteaches the discover-then-call workflow, arg encoding, the result envelope, and write-safety guidance. It ships with the npm package (skills/**/*added tofiles) and installs viaroot-cms skill.install.Testing
pnpm build:coresucceeds;.d.tsgeneration passes.cli/client-reflect.test.ts(private exclusion, multi-line signatures, zero-arg methods, type extraction).client.methods(text +--json --types),client.callerror/exit-code paths, and allskill.installscenarios (default, custom dir, duplicate error,--force).Not exercised: a successful
client.callrequires a real Root.js project (root.config.ts) + Firebase credentials, which the repo root lacks — plumbing was verified up to config load.🤖 Generated with Claude Code