Skip to content

feat(cli): rich ask list command with --json output#50

Merged
amondnet merged 9 commits into
mainfrom
47-track-rich-list-command-20260409
Apr 9, 2026
Merged

feat(cli): rich ask list command with --json output#50
amondnet merged 9 commits into
mainfrom
47-track-rich-list-command-20260409

Conversation

@amondnet

@amondnet amondnet commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Promotes ask list to a top-level command with a rich table view and a --json flag. The legacy ask docs list continues to work as a deprecated wrapper for one release cycle. Surfaces intent-skills entries (no filesystem copy) alongside docs entries by driving listing off .ask/ask.lock instead of the filesystem scan.

Closes #47

Architecture

Three-layer split under packages/cli/src/list/:

  • Model (model.ts): Zod schema shared between renderer and JSON output
  • Aggregator (aggregate.ts): reads listDocs (lock-backed) + detects name conflicts
  • Renderer (render.ts): text rendering with display/table.ts and display/tree.ts helpers ported from @tanstack/intent (MIT attribution in header)

listDocs in storage.ts now reads .ask/ask.lock as source of truth, enriched with format/source/location/skills. generateAgentsMd filters to format === 'docs' so intent-skills don't leak into the docs marker block.

Key Changes

  • New: `packages/cli/src/display/{table,tree}.ts` — pure format helpers + consola emitters
  • New: `packages/cli/src/list/{model,aggregate,render}.ts`
  • Changed: `packages/cli/src/storage.ts` `listDocs` is lock-backed and richer
  • Changed: `packages/cli/src/index.ts` `ask list` top-level + deprecated `ask docs list` wrapper via shared `runList`
  • Changed: `packages/cli/src/agents.ts` filters to docs-only
  • New: `packages/cli/src/agents-intent.ts` exports `readIntentSkillsMap`

Verification Checklist

  • All 10 plan tasks completed (T-1 through T-10)
  • `bun run --cwd packages/cli lint` passes
  • `bun run --cwd packages/cli test` passes (309/309)
  • `bun run build` (root turbo) passes
  • `ask list` renders table with Name/Version/Format/Source/Items/Location
  • `ask docs list` emits deprecation warning + same body
  • `ask list --json` emits valid ListModelSchema JSON
  • `intent-skills` entries appear in list with zero filesystem files
  • Docs-only `agents.ts` filter tested
  • CLAUDE.md gotcha added (bun test env scrubbing)

Test plan

  • Unit tests for display helpers (13 tests)
  • Unit tests for ListModel schema round-trip (4 tests)
  • Unit tests for listDocs with github/npm tarball/npm installPath/intent-skills/sort (5 tests)
  • Unit tests for aggregator with 4 scenarios + conflict detection (9 tests)
  • Unit tests for renderer with 4 scenarios (5 tests)
  • Integration tests spawning compiled CLI: `ask list`, `ask docs list`, `ask list --json` (3 tests)
  • Regression: all existing tests (agents, storage, ignore-lifecycle) updated to seed lock

Summary by cubic

Adds a top-level ask list with a rich table and optional --json output, driven by .ask/ask.lock so it lists both docs and intent-skills. ask docs list is deprecated and kept for one release. Implements #47.

  • New Features

    • Lock-backed listing via listDocs, including format, source, location, and itemCount or skills.
    • Rich text output with totals, a table (Name, Version, Format, Source, Items, Location), and an intent-skills tree when present.
    • --json emits ListModelSchema-valid JSON for automation.
    • Conflict detection for duplicate names with different versions.
    • Display helpers ported to packages/cli/src/display/{table,tree}.ts (from @tanstack/intent) with consola emitters.
  • Migration

    • Use ask list instead of ask docs list (wrapper warns and forwards; removal next release).
    • For scripts, use ask list --json and validate with ListModelSchema.

Written for commit e0ce16f. Summary will update on new commits.

Port printTable/printSkillTree from @tanstack/intent (MIT) into
packages/cli/src/display/ as formatTable/formatSkillTree (pure) with
thin consola-backed emitters. These will back the rich ask list
output. Includes unit tests covering empty/single/multi cases.

Refs rich-list-command-20260409 T-2, T-3
Defines the typed contract shared by the upcoming text renderer and
JSON emitter. Entries carry name/version/format/source/location with
optional itemCount (docs) or skills (intent-skills). Includes
round-trip tests and negative cases.

Refs rich-list-command-20260409 T-4
Reads .ask/ask.lock as source of truth so intent-skills entries (no
filesystem copy) appear alongside docs entries. Adds readIntentSkillsMap
helper for grouping AGENTS.md intent-skills entries by package. Updates
generateAgentsMd to filter to docs-only so intent-skills entries are
not duplicated in the docs marker block. Tests cover docs/github,
npm-tarball vs installPath, intent-skills with zero filesystem files,
and deterministic sort order.

Refs rich-list-command-20260409 T-5
buildListModel reads listDocs and shapes the entries into a schema-typed
ListModel. detectConflicts is a pure helper over entries, sorted for
deterministic output. Tests cover docs-only, intent-only, mixed, and
unit cases for conflict detection.

Refs rich-list-command-20260409 T-6
formatList returns a deterministic string (header, table, skill tree,
conflicts, warnings), with renderList as a thin consola wrapper. The
legacy empty message is preserved byte-for-byte so existing contracts
stay stable. Tests cover empty/docs-only/intent-only/mixed/conflict
scenarios.

Refs rich-list-command-20260409 T-7
Adds the new ask list top-level command backed by buildListModel +
renderList with a --json flag emitting a ListModelSchema-valid JSON
document. The legacy ask docs list wrapper prints a deprecation warning
and forwards to the shared runList helper so existing automation keeps
working for one release cycle. Integration tests spawn the compiled
CLI against a seeded fixture and cover:

  1. ask list → rich table
  2. ask docs list → same body + deprecation warning
  3. ask list --json → JSON parses against ListModelSchema

The child process env is scrubbed to PATH/HOME/NO_COLOR/FORCE_COLOR
because bun test leaks BUN_* variables that put consola into a
silent mode on macOS.

Refs rich-list-command-20260409 T-8, T-9
Records the rich-list-command-20260409 contract change (ask list
canonical, ask docs list deprecated) and the bun:test child_process
env scrubbing requirement discovered while wiring the CLI integration
test.

Refs rich-list-command-20260409 T-10
@amondnet amondnet linked an issue Apr 9, 2026 that may be closed by this pull request
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Apr 9, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ask-registry with  Cloudflare Pages  Cloudflare Pages

Latest commit: e0ce16f
Status:⚡️  Build in progress...

View logs

@codecov

codecov Bot commented Apr 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.08746% with 34 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/display/tree.ts 83.11% 13 Missing ⚠️
packages/cli/src/display/table.ts 70.00% 9 Missing ⚠️
packages/cli/src/list/render.ts 91.56% 7 Missing ⚠️
packages/cli/src/storage.ts 91.22% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 4 files (changes from recent commits).

Requires human review: Refactors core documentation discovery logic to be lock-backed and restructures the list command. Large change set with architectural implications requires human review.

@dosubot dosubot Bot added status:in-progress Currently being worked on type/feature New feature labels Apr 9, 2026
@amondnet amondnet merged commit feb2ba3 into main Apr 9, 2026
4 of 5 checks passed
@amondnet amondnet deleted the 47-track-rich-list-command-20260409 branch April 9, 2026 16:26
This was referenced Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files. status:in-progress Currently being worked on type/feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

track: rich-list-command-20260409

1 participant