[Feature]: Add --json output to preset info and extension info with fully-expanded per-contribution detail (per-pack detail view; complements list --json summary counts)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, python
- 领域
- cli, documentation, testing
调研方向
从 preset info --json 和 extension info --json CLI 入口开始,然后跟踪 composition/collect.mjs::parseProvidesEntries 和 ::parseHookDeclarations 中现有的规范化过程;查看 extensions/__init__.py:622-626 以了解仅替换行为。将输出与配套的 list --json 和 artifact info --json 契约进行比较。指定的扩展 schema、稳定 ID、规范化、错误、测试和 CLI 参考文档全部完成后,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Problem Statement
Today specify preset info <id> and specify extension info <id> emit only text. speckit-wizard-canvas reads the raw preset.yml / extension.yml files with js-yaml and re-normalizes the shape itself in composition/collect.mjs::parseProvidesEntries and ::parseHookDeclarations — including strategy inference from shorthand keys (replaces vs. wraps vs. prepends vs. appends), hook-phase normalization (phase vs. trigger, command vs. targetCommand), and script-runtime inference by globbing scripts/{bash,powershell,python}/*.{sh,ps1,py}. All of this is server-side data being reconstructed on the client.
Downstream consumers need the structured shape returned by the CLI itself so they can stop reconstructing it.
How this differs from the companion preset list --json / extension list --json issue. The list variant operates on the collection of installed packs and returns a JSON array, one row per pack, where provides is just integer counts ({ commands: 4, templates: 2, scripts: 1, hooks: 3 }) — a summary/catalog view suitable for "here's every preset the project has". info operates on one pack, addressed by id, and returns a single JSON object where provides is fully expanded — every command, template, script, and hook enumerated with its full per-contribution schema (id, name, description, artifact, optional, handoffs, strategy, sourcePath, runtimes, etc.). A wizard rendering "here's what speckit.git contributes to my project" needs the info detail; list's counts are not enough. Both surfaces are required; neither is a subset of the other.
Proposed Solution
Add --json to both info commands. Output shape:
{
"id": "…", "name": "…", "description": "…", "version": "…",
"author": "…", "priority": 100, "enabled": true, "source": { "…": "…" },
"commands": [
{ "id": "…", "name": "speckit.plan", "description": "…",
"artifact": "specs/{feature}/plan.md", "optional": false,
"handoffs": [ { "to": "speckit.tasks", "when": "…", "message": "…" } ],
"strategy": "wrap",
"source": { "layer": "preset", "presetId": "…" },
"sourcePath": "commands/speckit.plan.md" }
],
"templates": [
{ "id": "…", "name": "…", "description": "…",
"strategy": "replace",
"source": { "…": "…" }, "sourcePath": "templates/…" }
],
"scripts": [
{ "id": "…", "name": "…", "description": "…",
"strategy": "replace",
"source": { "…": "…" }, "sourcePath": "scripts/bash/…",
"runtimes": ["bash", "powershell", "python"] }
],
"hooks": [
{ "id": "…", "name": "…", "description": "…",
"trigger": "before_speckit.plan", "targetCommand": "speckit.git.checklist",
"sourcePath": "commands/speckit.git.checklist.md",
"optional": false, "priority": 10 }
]
}
Notes:
- Preset objects omit
hooks. - Extension
commands/templates/scriptsentries omitstrategy(they are alwaysreplace, per the replace-only rule enforced atextensions/__init__.py:622-626). idvalues use the stable-id scheme from the companion "stable id / lookupId" issue; theidon a per-contribution entry is what the companionspecify artifact info --jsonstack'slookupIdpoints at.artifact,optional,handoffson commands come from the companion "artifact/optional/handoffs" issue.runtimeson scripts comes directly from the manifest (extensions post-#4010; add the same field to preset script entries for parity).- All shorthand-key normalization (
replaces/wraps/prepends/appends→strategy: "replace"|"wrap"|"prepend"|"append") is done server-side.
Alternatives Considered
- Fold everything into the companion
specify artifact info --jsoncommand. Rejected —artifact infois per-artifact (walks one composition stack across all installed packs);info --jsonis per-source (walks one preset/extension across all its contributions). Both are needed and neither is a subset of the other. - Fold everything into the companion
preset list --json/extension list --json. Rejected — that surface is per-collection with summary counts;infois per-pack with full expansion. Different shape, different call pattern, different use cases (see Problem Statement). - Emit YAML. Rejected — the whole point is to let the wizard drop
js-yaml. - Leave hook-phase / strategy shorthand un-normalized. Rejected — every consumer would reproduce the client-side logic from
composition/collect.mjsand drift over time.
Component
Specify CLI (initialization, commands)
AI Agent (if applicable)
Not applicable
Use Cases
speckit-wizard-canvasdeletescomposition/collect.mjs::parseProvidesEntriesand::parseHookDeclarations, replacing them withJSON.parse(execFileSync("specify", ["preset", "info", "<id>", "--json"]))/specify extension info <id> --json. This is the change that removes thejs-yamldependency.- An IDE plugin renders hover-cards on command names by looking up the
commands[]entry (description,artifact,handoffs). - A pre-commit check walks
extension info --json'shooks[]to warn when two extensions register the sametriggerat the samepriority.
Acceptance Criteria
-
specify preset info <id> --jsonandspecify extension info <id> --jsonemit a single JSON object with top-level fields matching the companionlist --jsonissue (id,name,description,version,author,priority,enabled,source) plus fully-expandedcommands,templates,scriptsarrays (andhooksfor extensions) — not integer counts. - Command entries include
artifact,optional,handoffs(from the companion command-fields issue). - Script entries include
runtimesfor both presets and extensions. - Preset command/template/script entries include
strategy; extension entries omit it (or set to"replace"for informational purposes). - Shorthand keys (
replaces/wraps/prepends/appends) are normalized server-side intostrategy. - Hook entries include
trigger,targetCommand,sourcePath,optional,priority—phase/commandshorthand normalized. - All
idvalues follow the stable-id scheme and are stable across reinstalls, matching thelookupIdvalues emitted byspecify artifact info --json. - Unknown id → non-zero exit + stderr JSON error.
- Tests: schema round-trip, strategy normalization (all four shorthand forms), hook shorthand normalization, extension replace-only enforcement, handoffs frontmatter-merge, and
idcross-reference withspecify artifact info --jsonoutput. - Docs:
preset info/extension infosections in the CLI reference show the--jsonshape and normalization rules, plus a note contrastinginfo --json(per-pack, full expansion) withlist --json(per-collection, count summary).
Additional Context
Direct replacement for plugins/spec-kit-copilot-wizard/extensions/speckit-wizard-canvas/composition/collect.mjs::parseProvidesEntries and ::parseHookDeclarations in github/spec-kit-copilot. Depends on the companion "artifact/optional/handoffs" and "stable id / lookupId" issues; benefits from the companion "structured source provenance" issue.
- 主要语言
- Python
- 星标
- 138k
- 派生
- 12.4k
- 平均合并
- 3 天 4 小时
- 30 天内合并 PR
- 154
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/spec-kit 的其他 Issue
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 74/100
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 84/100
-
enhancement needs-triage triage-can-wait
难度 2/5 1-3 小时 新手友好度 76/100
相似的 Issue
-
essnmx good first issue
难度 1/5 1 小时以内 新手友好度 95/100
-
难度 2/5 1-3 小时 新手友好度 65/100
syfoud/Simulated_Scepter#174 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Giskard-AI/giskard-oss#2840 · 1 条评论 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success 未关闭area: repo bug perceived difficulty: 2
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
yeti-platform/yeti#1380 ·