Skip to content

Add disco llm command for LLM coding agents#118

Open
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
emanuelefaja:feat/llm-command
Open

Add disco llm command for LLM coding agents#118
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
emanuelefaja:feat/llm-command

Conversation

@emanuelefaja
Copy link
Copy Markdown

Closes #115.

What

New top-level disco llm command that emits a single markdown bundle (narrative + auto-generated command reference) suitable for piping into a coding agent's skill file. One invocation gives an LLM the full surface of the CLI.

disco llm                       # print to stdout
disco llm --save                # write ./DISCO.md
disco llm --install claude      # ~/.claude/skills/disco/SKILL.md
disco llm --install codex       # ~/.codex/skills/disco/SKILL.md
disco llm --install all         # both of the above
disco llm --install <t> --force # overwrite existing
disco llm --url                 # print https://disco.cloud/llms.txt

Why bundle the narrative instead of fetching llms.txt at runtime

Three reasons:

  1. Offline failure — the CLI is used on dev machines that aren't always online; runtime fetch breaks the command.
  2. Version drift — the hosted llms.txt evolves; an installed CLI version may have features the hosted text doesn't describe (or vice versa). Bundling guarantees the narrative matches the command reference (which is generated from the same binary).
  3. Latency — extra HTTP hop on every invocation, including when an LLM is just trying to install the skill once.

--url is the escape hatch for users who want the latest hosted copy verbatim.

Refresh mechanism: scripts/sync-llms-narrative.js curls disco.cloud/llms.txt and writes src/llm/narrative.ts. RELEASE.md instructs running npm run sync:llms-narrative before tagging a release.

Why the command reference is auto-generated

The command-reference section walks this.config.commands at runtime — every command, flag, arg, and example comes from oclif's loaded metadata. New commands appear in the dump automatically with no manual update; the reference can never drift from the installed binary.

Install target scope (v1)

Two user-global skill targets — both clean, conflict-free, project-state untouched:

target path
claude ~/.claude/skills/disco/SKILL.md
codex ~/.codex/skills/disco/SKILL.md
all both of the above

--install always requires an explicit value (Flags.string with enum claude|codex|all). If a target file already exists, the command errors and prints the path; --force overrides. With --install all, existence is checked across all targets before any write, so a partial-state failure isn't possible.

Deferred to a follow-up:

  • Cursor (.cursor/rules/disco.mdc) — project-scope-only convention; --save already covers project-scoped use.
  • AGENTS.md — file likely already exists in the user's project; needs merge/append logic, not a simple write.
  • Continue.dev, Windsurf, Aider — fewer users; can add when demand surfaces.

Files

NEW src/commands/llm.ts
NEW src/llm/render.ts (pure render functions)
NEW src/llm/narrative.ts (8KB snapshot of llms.txt, auto-generated)
NEW scripts/sync-llms-narrative.js
NEW test/commands/llm.test.ts (12 tests)
EDIT package.json (+ sync:llms-narrative script)
EDIT RELEASE.md (pre-tag refresh step)

Test plan

  • npm run build — clean
  • npm test — 12 new tests passing; existing tests untouched
  • npm run lint — no errors in new files
  • disco llm — narrative + 65 command sections, sorted, hidden + llm itself filtered out
  • disco llm --url — prints exactly the URL
  • disco llm --save — writes ./DISCO.md; matches stdout
  • disco llm --install all (via HOME=$(mktemp -d)) — both files written with YAML frontmatter
  • disco llm --install claude against existing file — errors with path; --force overwrites
  • disco llm --install bogus — oclif rejects with valid-options error
  • disco llm --save --url — oclif rejects (mutually exclusive)

Emits a single markdown bundle (narrative + auto-generated command
reference) suitable for piping into a skill file. Supports `--save`
to write `./DISCO.md`, `--install <claude|codex|all>` to install as
an agent skill at the user-global path, and `--url` to print the
hosted llms.txt URL.

The narrative is bundled at build time from disco.cloud/llms.txt
(refreshed via `npm run sync:llms-narrative`); the command reference
is generated at runtime from `this.config.commands` so it always
matches the installed binary.

Closes letsdiscodev#115
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.

implement "disco llm"?

1 participant