@akjamie/agentic-sdlc 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/assets/commands/asdlc-apply.md +24 -0
- package/assets/commands/asdlc-approve.md +21 -0
- package/assets/commands/asdlc-archive.md +21 -0
- package/assets/commands/asdlc-doctor.md +24 -0
- package/assets/commands/asdlc-lint.md +30 -0
- package/assets/commands/asdlc-new.md +29 -0
- package/assets/commands/asdlc-pr.md +25 -0
- package/assets/commands/asdlc-status.md +23 -0
- package/assets/commands/asdlc-test.md +20 -0
- package/assets/commands/asdlc-verify.md +29 -0
- package/assets/skills/asdlc-new/SKILL.md +15 -1
- package/package.json +1 -1
- package/src/assess/rules/builtin.js +1 -1
- package/src/cli.js +1 -1
- package/src/commands/doctor.js +32 -4
- package/src/commands/init.js +5 -55
- package/src/commands/lint.js +9 -2
- package/src/commands/skills.js +7 -19
- package/src/commands/status.js +169 -8
- package/src/commands/update.js +4 -3
- package/src/lib/paths.js +1 -0
- package/src/lib/tools.js +313 -0
package/README.md
CHANGED
|
@@ -148,6 +148,9 @@ Enterprise teams rely on deterministic code, not agent compliance or prompt enth
|
|
|
148
148
|
|
|
149
149
|
## 🚀 Quickstart: 5-Minute Walkthrough
|
|
150
150
|
|
|
151
|
+
> 🧭 **New to Agentic SDLC?**
|
|
152
|
+
> Follow our hands-on [**30-Minute Getting Started Guide (docs/getting-started.md)**](docs/getting-started.md) for a step-by-step walkthrough with copy-paste examples, AI grilling guidance, and expected CLI outputs from zero install to your first verified Spec PR!
|
|
153
|
+
|
|
151
154
|
### 1. Installation
|
|
152
155
|
|
|
153
156
|
```bash
|
|
@@ -277,7 +280,7 @@ flowchart TD
|
|
|
277
280
|
```bash
|
|
278
281
|
asdlc init [--ci jenkins|github] # Scaffold repository with OpenSpec, Graphify, and skills
|
|
279
282
|
asdlc new "<intent>" # Scaffold change with AST explore + grill-me interview
|
|
280
|
-
asdlc lint <ID> # Validate BDD scenarios, AC rules, and coverage
|
|
283
|
+
asdlc lint <ID> # Validate BDD scenarios, AC rules, and coverage (docs/spec-format.md)
|
|
281
284
|
asdlc pr <ID> <target-branch> # Smart PR creator (auto-handles Spec PR vs Impl PR)
|
|
282
285
|
asdlc approve <ID> # Record approvedSha and transition to ready_for_impl
|
|
283
286
|
asdlc apply <ID> # Guarded implementation launcher (checks approvedSha)
|
|
@@ -309,13 +312,30 @@ node --test test/simulation.test.js
|
|
|
309
312
|
|
|
310
313
|
---
|
|
311
314
|
|
|
315
|
+
## 📚 Documentation Center
|
|
316
|
+
|
|
317
|
+
Explore the complete documentation in the [`docs/`](docs/) directory:
|
|
318
|
+
|
|
319
|
+
- ⏱️ [**30-Minute Getting Started Guide**](docs/getting-started.md): Frictionless step-by-step tutorial from install to first Spec PR.
|
|
320
|
+
- 📐 [**Spec Format & Lint Reference**](docs/spec-format.md): Human-readable guide to R0–R8 lint rules with pass/fail examples.
|
|
321
|
+
- 🌐 [**Quickstart Guide (Bilingual)**](docs/quickstart.md): End-to-end walkthrough covering the complete 7-stage lifecycle.
|
|
322
|
+
- 🏛️ [**System Architecture & Whitepaper**](docs/about.md): Why Agentic SDLC, L0–L3 governance, and cryptographic anti-tamper proofs.
|
|
323
|
+
- 🩺 [**Environment Doctor Manual**](docs/doctor.md): Diagnostic reference for all 12 health checks and `--fix` automated healing.
|
|
324
|
+
- ⌨️ [**CLI Command Reference**](docs/usage.md): Full flag, option, and exit code reference for all `asdlc` commands.
|
|
325
|
+
- 📖 [**Standard Glossary**](docs/glossary.md): Authoritative lexicon for living specs, spec SHAs, and architectural god nodes.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
312
329
|
## 🤝 Community & Contributing
|
|
313
|
-
|
|
330
|
+
|
|
314
331
|
We welcome contributions from developers, architects, and researchers advancing the state of Agentic Software Engineering!
|
|
315
|
-
|
|
332
|
+
|
|
316
333
|
- **Contributing Guide**: Check out [CONTRIBUTING.md](CONTRIBUTING.md) for local setup, development conventions, and PR expectations.
|
|
334
|
+
- **Specification & Linting Reference**: Read [docs/spec-format.md](docs/spec-format.md) for R0–R8 pass/fail examples, BDD rules, and troubleshooting remedies.
|
|
335
|
+
- **IDE Slash-Command Parity**: First-class slash commands (`/asdlc-*`) across Claude Code, OpenCode, Pi, Antigravity, GitHub Copilot, Cursor, Trae, and Windsurf (see [docs/usage.md](docs/usage.md)).
|
|
317
336
|
- **Architectural Specs**: Read [docs/architecture.md](docs/architecture.md) for deep dives on the 3-plane model.
|
|
318
|
-
- **Enterprise Blueprint**: Browse [docs/blueprint.
|
|
337
|
+
- **Enterprise Blueprint**: Browse [docs/blueprint.md](docs/blueprint.md) (or [Chinese version](docs/blueprint.zh.md)) for enterprise deployment patterns.
|
|
338
|
+
- **Documentation Index**: See [docs/README.md](docs/README.md) for the active documentation catalog.
|
|
319
339
|
|
|
320
340
|
---
|
|
321
341
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-apply
|
|
3
|
+
description: "Stage 5: Guarded task-level TDD implementation loop"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-apply - Guarded Implementation Launcher
|
|
7
|
+
|
|
8
|
+
Launch task-level Test-Driven Development (TDD) loop from `tasks.md`.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc apply <CHANGE_ID> [--auto-pr] [--target-branch <branch>]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. **Approval Guard**: Enforces that the spec has been approved and `approvedSha` is locked (or L0/L1 single-PR mode).
|
|
19
|
+
2. **Task-Level TDD Loop**:
|
|
20
|
+
- RED: Author failing unit/integration tests mapped to requirement ACs.
|
|
21
|
+
- GREEN: Implement minimal production code to pass the tests.
|
|
22
|
+
- REFACTOR: Clean code structure without altering behavior.
|
|
23
|
+
- EVIDENCE: Record passing test evidence.
|
|
24
|
+
3. **Anti-Hallucination & Anti-Drift Guard**: Prevents modifying locked specification paths during code implementation.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-approve
|
|
3
|
+
description: "Stage 4: Lock approvedSha and transition change to READY_FOR_IMPL"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-approve - Approve Spec & Cryptographic Lock
|
|
7
|
+
|
|
8
|
+
Lock the approved specification state and unlock implementation for the change.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc approve <CHANGE_ID>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. Evaluates human lead approval (or PR merge commit on target branch).
|
|
19
|
+
2. Computes and locks cryptographic `approvedSha` for the spec files.
|
|
20
|
+
3. Stamps `review.md` with `verdict: APPROVE` and `specSha`.
|
|
21
|
+
4. Transitions change state to `READY_FOR_IMPL`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-archive
|
|
3
|
+
description: "Stage 7: Sync spec deltas to living specs, archive change directory, and refresh codebase graph"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-archive - Sync & Archive Verified Change
|
|
7
|
+
|
|
8
|
+
Archive a verified change after implementation PR merge.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc archive <CHANGE_ID>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. Merges spec deltas into canonical `openspec/specs/` living specifications.
|
|
19
|
+
2. Moves change directory to `openspec/changes/archive/<slug>/`.
|
|
20
|
+
3. Rebuilds Graphify AST knowledge graph.
|
|
21
|
+
4. Refreshes `AGENTS.md` system status.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-doctor
|
|
3
|
+
description: "Diagnose repository health, toolchain integrity, and per-tool skill/command status"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-doctor - Diagnostic Health Check
|
|
7
|
+
|
|
8
|
+
Verify environment, toolchain health, git hooks, managed schema integrity, and IDE agent tool readiness.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc doctor [--fix] [--global]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Checks Performed
|
|
17
|
+
|
|
18
|
+
1. Node version compatibility (`>= 20.19.0`).
|
|
19
|
+
2. Pinned OpenSpec version availability.
|
|
20
|
+
3. Graphify AST toolchain availability.
|
|
21
|
+
4. Managed schema installation and absence of committed overrides.
|
|
22
|
+
5. Repository configuration and `.githooks` integration.
|
|
23
|
+
6. `AGENTS.md` routing table and system status freshness.
|
|
24
|
+
7. Per-tool skill and slash command parity across detected IDE tools (Claude, OpenCode, Pi, Antigravity, GitHub Copilot, Cursor, etc.).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-lint
|
|
3
|
+
description: "Stage 3: Deterministic spec lint gate (R0-R8 BDD rules, scenario coverage, and test mappings)"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-lint - Deterministic Spec Quality Gate
|
|
7
|
+
|
|
8
|
+
Verify that the active specification meets enterprise BDD, traceability, and review standards before creating a Pull Request.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc lint <CHANGE_ID> [--json]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Checks Performed
|
|
17
|
+
|
|
18
|
+
1. **Artifact Completeness**: `proposal.md`, `specs/**/*.md`, and `design.md` (for UI/external API changes).
|
|
19
|
+
2. **Deterministic Rules (R0–R8)**:
|
|
20
|
+
- `R0-no-requirements`: Explicit requirement headers.
|
|
21
|
+
- `R1-purpose`: Capability purpose length >= 50 characters.
|
|
22
|
+
- `R2-normative`: RFC-2119 `SHALL` / `MUST` invariant statements.
|
|
23
|
+
- `R3-scenario`: Concrete observable BDD scenarios.
|
|
24
|
+
- `R4-when / R4-then / R4-given`: Bold Gherkin clauses.
|
|
25
|
+
- `R5-ac & R5-scenario-coverage`: Traceable checkboxes covering all scenarios (`count(ACs) >= count(Scenarios)`).
|
|
26
|
+
- `R6-ac-test`: Every AC maps to a test file (`(test: <path>)`).
|
|
27
|
+
- `R7-test-strategy`: Multi-tiered test pyramid section.
|
|
28
|
+
- `R8-removed-reason`: Explicit rationale for deprecations / removals.
|
|
29
|
+
|
|
30
|
+
See `docs/spec-format.md` for worked pass/fail examples and 1-minute remedies.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-new
|
|
3
|
+
description: "Stage 1/2: Start a new spec-driven change: ground in codebase graph, run grill-me, author proposal and specs"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-new - Start a New Spec-Driven Change
|
|
7
|
+
|
|
8
|
+
Start a new spec-driven change in the repository using the Agentic SDLC workflow.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc new "<requirement>" [--batch-grill] [--no-grill]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Workflow Sequence
|
|
17
|
+
|
|
18
|
+
1. **Scaffold Change & Ground in Graph**:
|
|
19
|
+
- Derives a clean kebab-case change slug from intent or ticket ID.
|
|
20
|
+
- Refreshes the Graphify AST knowledge graph and generates `explore.md`.
|
|
21
|
+
- Seeds `clarifications.md` and `proposal.md`.
|
|
22
|
+
2. **High-Signal Grilling Interview (Stage 2)**:
|
|
23
|
+
- Settle architectural decisions and trade-offs in `clarifications.md`.
|
|
24
|
+
- Stop questioning as soon as the author reaches consensus or forks hit zero.
|
|
25
|
+
3. **Specification Delta Authoring**:
|
|
26
|
+
- Author capability spec deltas under `specs/<capability>/spec.md` with RFC-2119 BDD requirements.
|
|
27
|
+
- If UI or external APIs are involved, author `design.md`.
|
|
28
|
+
4. **Pre-flight Lint**:
|
|
29
|
+
- Run `asdlc lint <CHANGE_ID>` to verify that all BDD rules (R0–R8) pass with 0 blockers.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-pr
|
|
3
|
+
description: "Stage 3.5: Open a Spec or Implementation PR with automated title, body, and governance labels"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-pr - Open Spec or Implementation Pull Request
|
|
7
|
+
|
|
8
|
+
Push your branch and automatically create a Pull Request with governance labels on GitHub or GitLab.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc pr <CHANGE_ID> <target-branch>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. **Pre-flight Gate Audit**:
|
|
19
|
+
- For Spec PRs: runs `asdlc lint` (must pass with 0 blockers).
|
|
20
|
+
- For Implementation PRs: runs `asdlc verify` (must pass all quality gates).
|
|
21
|
+
2. **Git Push**: Automatically pushes `spec/<CHANGE_ID>` or implementation branch to origin.
|
|
22
|
+
3. **PR Metadata Extraction**: Automatically populates Title and Description from `proposal.md`.
|
|
23
|
+
4. **Governance Labels**:
|
|
24
|
+
- Spec PR -> `asdlc:spec-review` (triggers automated CI AI Spec Review).
|
|
25
|
+
- Impl PR -> `asdlc:impl-review` (triggers automated CI AI Impl Review).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-status
|
|
3
|
+
description: "Show lifecycle state, active artifacts, next actionable command, or portfolio overview"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-status - Change & Portfolio Status Overview
|
|
7
|
+
|
|
8
|
+
Inspect the active change state or get an overview of all in-flight changes across the repository.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Portfolio overview (lists all active changes in flight)
|
|
14
|
+
asdlc status [--json]
|
|
15
|
+
|
|
16
|
+
# Single change status
|
|
17
|
+
asdlc status <CHANGE_ID> [--json]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Output
|
|
21
|
+
|
|
22
|
+
- In portfolio mode: outputs compact single-line table with `CHANGE`, `LEVEL`, `STAGE`, and `NEXT COMMAND` (strictly excludes archived changes).
|
|
23
|
+
- In single-change mode: outputs completed artifacts, stage progression, and next exact command.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-test
|
|
3
|
+
description: "Stage 5.5: Execute real test runners mapped to Acceptance Criteria annotations"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-test - Run Mapped Acceptance Criteria Tests
|
|
7
|
+
|
|
8
|
+
Execute project test suites referenced by spec acceptance criteria lines `(test: <path>)`.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc test <CHANGE_ID> [--json]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
1. Parses all `(test: <path>)` annotations across the change's capability specs.
|
|
19
|
+
2. Resolves test runners (e.g. Node `--test`, Jest, Pytest, Go test, Cargo test).
|
|
20
|
+
3. Executes target test files and reports individual test execution status.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: asdlc-verify
|
|
3
|
+
description: "Stage 6: Verify implementation against all 12 enterprise quality gates"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /asdlc-verify - Enterprise Quality Gates Audit
|
|
7
|
+
|
|
8
|
+
Audit the implementation diff against all 12 deterministic quality gates before merging to main.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
asdlc verify <CHANGE_ID> [--repo <name>] [--json]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## The 12 Quality Gates
|
|
17
|
+
|
|
18
|
+
1. `level-integrity`: Validates declared risk level matches change topology.
|
|
19
|
+
2. `pr-type`: Classifies PR type (normal vs. spec vs. impl).
|
|
20
|
+
3. `artifacts`: Ensures proposal, tasks, and spec deltas are present.
|
|
21
|
+
4. `approved-spec`: Verifies spec PR was approved on protected branch.
|
|
22
|
+
5. `spec-tamper`: Enforces that locked spec files were not modified during implementation.
|
|
23
|
+
6. `flow-state`: Validates `READY_FOR_IMPL` transition.
|
|
24
|
+
7. `risk-escape`: Detects unannounced API/DDL escalations.
|
|
25
|
+
8. `human-gate`: Validates mandatory Tech Lead approval for L2/L3 changes.
|
|
26
|
+
9. `tasks-complete`: Verifies all tasks in `tasks.md` are checked off.
|
|
27
|
+
10. `test-presence`: Enforces that source code changes are paired with test changes.
|
|
28
|
+
11. `tdd-evidence`: Verifies red-green-refactor execution log.
|
|
29
|
+
12. `BDD + acceptance criteria`: Deterministic R0–R8 quality lint clean.
|
|
@@ -11,8 +11,22 @@ This skill executes **Stage 2 (New)** of the Agentic SDLC. It transforms a natur
|
|
|
11
11
|
|
|
12
12
|
## Workflow Sequence
|
|
13
13
|
|
|
14
|
+
### Step 0: Input Grounding & Ticket Resolution (Anti-Hallucination Guard)
|
|
15
|
+
When the user invokes `/asdlc:new` or provides a task, check if it references a ticket ID or link (e.g. Jira key `PROJ-123`, Jira URL, GitHub Issue `#42`, or internal company tracker link):
|
|
16
|
+
|
|
17
|
+
1. **Attempt Tool/Skill Resolution**:
|
|
18
|
+
- If you have an applicable skill, MCP tool, or CLI available (e.g. Jira skill, GitHub MCP, `gh issue view`), use it to retrieve the ticket title, description, and acceptance criteria.
|
|
19
|
+
2. **Handle Inaccessible / Unresolvable Tickets (Mandatory Pause)**:
|
|
20
|
+
- If the ticket link or ID cannot be read or accessed (e.g. no integration tool installed, unauthorized/VPN required, 404 not found, or network error):
|
|
21
|
+
- 🛑 **PAUSE IMMEDIATELY**: Do NOT proceed to scaffold or write specs.
|
|
22
|
+
- ❌ **DO NOT GUESS OR INVENT REQUIREMENTS**: Hallucinating specifications without verified ground truth is strictly prohibited.
|
|
23
|
+
- ❓ **ASK THE USER DIRECTLY**: Halt and prompt the user:
|
|
24
|
+
> *"I see you referenced ticket/link `<ID/URL>`, but I'm unable to access your issue tracker directly. To ensure the specifications are trustworthy and accurate, could you please paste the ticket title, description, and any acceptance criteria here?"*
|
|
25
|
+
3. **Proceed with Grounded Context**:
|
|
26
|
+
- Once the user supplies the ticket details or confirms the requirement in plain language, proceed to Step 1 using that grounded requirement text. (If ticket acceptance criteria were retrieved or pasted, carry them forward into `clarifications.md` in Step 3).
|
|
27
|
+
|
|
14
28
|
### Step 1: Scaffold Change & Refresh Graph
|
|
15
|
-
When the
|
|
29
|
+
When the grounded requirement is established:
|
|
16
30
|
|
|
17
31
|
```powershell
|
|
18
32
|
asdlc new "<requirement>" [--batch-grill] [--no-grill]
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -59,7 +59,7 @@ The flow:
|
|
|
59
59
|
asdlc archive <ID> finish: archive change + sync living specs to openspec/specs/
|
|
60
60
|
|
|
61
61
|
Navigation, health & maintenance:
|
|
62
|
-
asdlc status
|
|
62
|
+
asdlc status [ID] where a change is in the 7 stages (or portfolio overview if omitted)
|
|
63
63
|
asdlc doctor environment + repo setup health
|
|
64
64
|
asdlc update update repo state: skills, AST knowledge graph (KB) & AGENTS.md
|
|
65
65
|
asdlc upgrade [--global] upgrade asdlc CLI, openspec, graphify & managed schema
|
package/src/commands/doctor.js
CHANGED
|
@@ -8,6 +8,7 @@ import { refreshAgents } from '../lib/agents.js';
|
|
|
8
8
|
import { readYaml } from '../lib/yaml.js';
|
|
9
9
|
import { git } from '../lib/git.js';
|
|
10
10
|
import { log, dim } from '../lib/log.js';
|
|
11
|
+
import { detectTools, checkToolHealth, installSkills, installCommands } from '../lib/tools.js';
|
|
11
12
|
|
|
12
13
|
// Environment + setup health. Exit non-zero only on a critical failure
|
|
13
14
|
// (no OpenSpec project, or the managed schema is not installed / is overridden).
|
|
@@ -34,6 +35,12 @@ export function doctor(opts = {}) {
|
|
|
34
35
|
const schemaV = readInstalledVersion();
|
|
35
36
|
add('managed schema', schemaV ? 'pass' : 'fail', schemaV ? `v${schemaV} (bundled v${builtinSchemaVersion()})` : 'not installed (run `asdlc init` or `asdlc upgrade`)');
|
|
36
37
|
|
|
38
|
+
let gi = null;
|
|
39
|
+
let ignored = false;
|
|
40
|
+
let hooksPath = null;
|
|
41
|
+
let hasRouting = false;
|
|
42
|
+
let detectedTools = [];
|
|
43
|
+
|
|
37
44
|
// If in global mode or not in a repository workspace, check global skills and skip repo-specific checks
|
|
38
45
|
if (isGlobal || (!isRepo && !hasProject)) {
|
|
39
46
|
const globalSkills = path.join(process.env.HOME || process.env.USERPROFILE || '', '.agents', 'skills');
|
|
@@ -52,20 +59,32 @@ export function doctor(opts = {}) {
|
|
|
52
59
|
if (exists(cfgPath)) { try { cfgSchema = (readYaml(cfgPath) ?? {}).schema ?? null; } catch { /* ignore */ } }
|
|
53
60
|
add('repo config schema', cfgSchema === 'agentic-repo-change' ? 'pass' : 'warn', cfgSchema ?? 'unset');
|
|
54
61
|
|
|
55
|
-
let hooksPath = null;
|
|
56
62
|
try { hooksPath = git(['config', '--get', 'core.hooksPath'], repoRoot, { allowFail: true }); } catch { /* ignore */ }
|
|
57
63
|
add('.githooks', hooksPath === '.githooks' ? 'pass' : 'warn', hooksPath === '.githooks' ? 'core.hooksPath=.githooks' : `core.hooksPath=${hooksPath ?? 'unset'}`);
|
|
58
64
|
|
|
59
65
|
const agents = path.join(repoRoot, 'AGENTS.md');
|
|
60
|
-
|
|
66
|
+
hasRouting = exists(agents) && readText(agents).includes('<!-- asdlc:routing -->');
|
|
61
67
|
add('AGENTS.md routing', hasRouting ? 'pass' : 'warn', hasRouting ? '' : 'missing (run `asdlc init`)');
|
|
62
68
|
|
|
63
69
|
const gstatus = graphStatus(repoRoot);
|
|
64
70
|
add('knowledge graph', gstatus === 'fresh' ? 'pass' : 'warn', gstatus);
|
|
65
71
|
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
gi = path.join(repoRoot, '.gitignore');
|
|
73
|
+
ignored = exists(gi) && readText(gi).split(/\r?\n/).some((l) => l.trim() === GITIGNORE_LINE);
|
|
68
74
|
add('graphify-out ignored', ignored ? 'pass' : 'warn', ignored ? '' : `add ${GITIGNORE_LINE} to .gitignore`);
|
|
75
|
+
|
|
76
|
+
// 3) Agent Tools & Slash-Command Parity Checks
|
|
77
|
+
detectedTools = detectTools(repoRoot);
|
|
78
|
+
if (detectedTools.length === 0) {
|
|
79
|
+
add('agent tools', 'pass', 'none detected (.agents used as default)');
|
|
80
|
+
} else {
|
|
81
|
+
for (const toolId of detectedTools) {
|
|
82
|
+
const health = checkToolHealth(repoRoot, toolId);
|
|
83
|
+
if (health) {
|
|
84
|
+
add(`tool: ${health.name}`, health.status, health.detail);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
69
88
|
}
|
|
70
89
|
|
|
71
90
|
let failed = 0;
|
|
@@ -121,6 +140,15 @@ export function doctor(opts = {}) {
|
|
|
121
140
|
if (g.installed) log.ok('fixed: installed graphify CLI');
|
|
122
141
|
} catch (e) { log.warn(`fix failed for graphify: ${e.message}`); }
|
|
123
142
|
}
|
|
143
|
+
|
|
144
|
+
// 7. Tool skills & slash commands remediation
|
|
145
|
+
if (detectedTools && detectedTools.length > 0) {
|
|
146
|
+
try {
|
|
147
|
+
installSkills(repoRoot, detectedTools);
|
|
148
|
+
installCommands(repoRoot, detectedTools);
|
|
149
|
+
log.ok('fixed: synchronized skills and commands for detected tools');
|
|
150
|
+
} catch (e) { log.warn(`fix failed for tool parity: ${e.message}`); }
|
|
151
|
+
}
|
|
124
152
|
log.info('');
|
|
125
153
|
}
|
|
126
154
|
|
package/src/commands/init.js
CHANGED
|
@@ -8,30 +8,9 @@ import { git } from '../lib/git.js';
|
|
|
8
8
|
import { ensureGraphify, buildGraph, ensureGitignore } from '../lib/graphify.js';
|
|
9
9
|
import { refreshAgents } from '../lib/agents.js';
|
|
10
10
|
import { ensureRemoteLabels } from './pr.js';
|
|
11
|
+
import { detectTools, installSkills, installCommands } from '../lib/tools.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
// wire OpenSpec's own agent commands/skills (we do NOT invent our own).
|
|
14
|
-
const TOOL_DIRS = {
|
|
15
|
-
'.opencode': 'opencode',
|
|
16
|
-
'.claude': 'claude',
|
|
17
|
-
'.codex': 'codex',
|
|
18
|
-
'.pi': 'pi',
|
|
19
|
-
'.dsh': 'dsh',
|
|
20
|
-
'.cursor': 'cursor',
|
|
21
|
-
'.gemini': 'gemini',
|
|
22
|
-
'.qwen': 'qwen',
|
|
23
|
-
'.trae': 'trae',
|
|
24
|
-
'.zed': 'zed',
|
|
25
|
-
'.windsurf': 'windsurf',
|
|
26
|
-
'.devin': 'devin',
|
|
27
|
-
'.agents': 'agents',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function detectTools(repoRoot) {
|
|
31
|
-
return Object.entries(TOOL_DIRS)
|
|
32
|
-
.filter(([dir]) => exists(path.join(repoRoot, dir)))
|
|
33
|
-
.map(([, id]) => id);
|
|
34
|
-
}
|
|
13
|
+
export { detectTools, installSkills, installCommands };
|
|
35
14
|
|
|
36
15
|
export function initRepo(opts = {}) {
|
|
37
16
|
const repoRoot = path.resolve(opts.repoRoot ?? process.cwd());
|
|
@@ -115,11 +94,12 @@ export function initRepo(opts = {}) {
|
|
|
115
94
|
}
|
|
116
95
|
}
|
|
117
96
|
|
|
118
|
-
// 4.5) Bundled Agent Skills: install out-of-the-box skills
|
|
119
|
-
// into
|
|
97
|
+
// 4.5) Bundled Agent Skills & Slash Commands: install out-of-the-box skills and
|
|
98
|
+
// slash command parity into detected agent tools (.claude, .opencode, .pi, .agents, .github, etc.)
|
|
120
99
|
const explicitTools = opts.tools ? opts.tools.split(',').map((s) => s.trim().toLowerCase()) : [];
|
|
121
100
|
const allTools = [...new Set([...detectTools(repoRoot), ...explicitTools])];
|
|
122
101
|
installSkills(repoRoot, allTools);
|
|
102
|
+
installCommands(repoRoot, allTools);
|
|
123
103
|
|
|
124
104
|
// 5) AGENTS.md: the routing layer the agentic IDE reads (workflow + system
|
|
125
105
|
// status derived from the graph). Written after the graph so status has nodes.
|
|
@@ -135,36 +115,6 @@ export function initRepo(opts = {}) {
|
|
|
135
115
|
return repoRoot;
|
|
136
116
|
}
|
|
137
117
|
|
|
138
|
-
// All supported tools and their skills directory name (tools that use a 'skills/' subdir convention)
|
|
139
|
-
const TOOL_SKILLS_DIRS = {
|
|
140
|
-
claude: '.claude',
|
|
141
|
-
opencode: '.opencode',
|
|
142
|
-
pi: '.pi',
|
|
143
|
-
dsh: '.dsh',
|
|
144
|
-
cursor: '.cursor',
|
|
145
|
-
gemini: '.gemini',
|
|
146
|
-
windsurf: '.windsurf',
|
|
147
|
-
trae: '.trae',
|
|
148
|
-
codex: '.codex',
|
|
149
|
-
zed: '.zed',
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export function installSkills(repoRoot, tools = []) {
|
|
153
|
-
if (!exists(skillsAssetDir)) return;
|
|
154
|
-
const targetDirs = ['.agents'];
|
|
155
|
-
for (const t of tools) {
|
|
156
|
-
const key = String(t).toLowerCase().replace(/^\./, '');
|
|
157
|
-
if (TOOL_SKILLS_DIRS[key]) targetDirs.push(TOOL_SKILLS_DIRS[key]);
|
|
158
|
-
else if (key) targetDirs.push(`.${key}`);
|
|
159
|
-
}
|
|
160
|
-
const count = listDir(skillsAssetDir).filter((d) => d.isDirectory()).length;
|
|
161
|
-
for (const dir of new Set(targetDirs)) {
|
|
162
|
-
const dest = path.join(repoRoot, dir, 'skills');
|
|
163
|
-
copyTree(skillsAssetDir, dest);
|
|
164
|
-
log.ok(`installed bundled skills (${count} skills) -> ${dir}/skills/`);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
118
|
export function installHooks(repoRoot) {
|
|
169
119
|
if (!exists(githooksAssetDir)) return;
|
|
170
120
|
const dest = path.join(repoRoot, '.githooks');
|
package/src/commands/lint.js
CHANGED
|
@@ -109,8 +109,15 @@ export function runLint(changeId, opts = {}) {
|
|
|
109
109
|
for (const fnd of lintSpecText(readText(path.join(cdir, 'specs', file)), { rules })) findings.push({ ...fnd, file });
|
|
110
110
|
}
|
|
111
111
|
const blockers = countBlockers(findings);
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
let bddDetail = blockers === 0 ? `${findings.length} advisory finding(s)` : `${blockers} blocker(s)`;
|
|
113
|
+
if (blockers > 0) {
|
|
114
|
+
const list = findings
|
|
115
|
+
.map((f) => `${f.code}: ${f.message}${f.location ? ` (${f.location})` : ''}`)
|
|
116
|
+
.slice(0, 5);
|
|
117
|
+
const overflow = findings.length > 5 ? ` (+${findings.length - 5} more)` : '';
|
|
118
|
+
bddDetail = `${blockers} blocker(s) [${list.join('; ')}${overflow}] (see docs/spec-format.md)`;
|
|
119
|
+
}
|
|
120
|
+
add('BDD + acceptance criteria', blockers === 0 ? 'pass' : 'fail', bddDetail);
|
|
114
121
|
|
|
115
122
|
return finish(results, { json: opts.json, changeId });
|
|
116
123
|
}
|
package/src/commands/skills.js
CHANGED
|
@@ -7,19 +7,7 @@ import { detectTools, installSkills } from './init.js';
|
|
|
7
7
|
import { fail } from '../lib/errors.js';
|
|
8
8
|
import { log } from '../lib/log.js';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
const GLOBAL_TOOL_DIRS = {
|
|
12
|
-
agents: '.agents',
|
|
13
|
-
opencode: '.opencode',
|
|
14
|
-
pi: '.pi',
|
|
15
|
-
dsh: '.dsh',
|
|
16
|
-
claude: '.claude',
|
|
17
|
-
cursor: '.cursor',
|
|
18
|
-
codex: '.codex',
|
|
19
|
-
trae: '.trae',
|
|
20
|
-
zed: '.zed',
|
|
21
|
-
gemini: '.gemini',
|
|
22
|
-
};
|
|
10
|
+
import { TOOL_REGISTRY, getToolDefinition } from '../lib/tools.js';
|
|
23
11
|
|
|
24
12
|
/**
|
|
25
13
|
* Parse YAML frontmatter from a SKILL.md file
|
|
@@ -84,18 +72,18 @@ export function installGlobalSkills(opts = {}) {
|
|
|
84
72
|
const requested = opts.tools.split(',').map((t) => t.trim().toLowerCase());
|
|
85
73
|
for (const tool of requested) {
|
|
86
74
|
if (tool === 'all') {
|
|
87
|
-
Object.values(
|
|
75
|
+
Object.values(TOOL_REGISTRY).forEach((t) => targets.add(t.detectDir));
|
|
88
76
|
} else {
|
|
89
|
-
const
|
|
90
|
-
targets.add(
|
|
77
|
+
const def = getToolDefinition(tool);
|
|
78
|
+
targets.add(def ? def.detectDir : `.${tool.replace(/^\./, '')}`);
|
|
91
79
|
}
|
|
92
80
|
}
|
|
93
81
|
} else {
|
|
94
82
|
// If no explicit tools given, always install to .agents (universal)
|
|
95
83
|
// plus any detected tool directories present in home
|
|
96
|
-
for (const
|
|
97
|
-
if (exists(path.join(home,
|
|
98
|
-
targets.add(
|
|
84
|
+
for (const tool of Object.values(TOOL_REGISTRY)) {
|
|
85
|
+
if (exists(path.join(home, tool.detectDir))) {
|
|
86
|
+
targets.add(tool.detectDir);
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
89
|
}
|
package/src/commands/status.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { exists, readText, walkFiles } from '../lib/fs.js';
|
|
3
|
-
import { changeDir } from '../lib/paths.js';
|
|
2
|
+
import { exists, readText, walkFiles, listDir } from '../lib/fs.js';
|
|
3
|
+
import { changeDir, openspecDir, CHANGES_DIR } from '../lib/paths.js';
|
|
4
4
|
import { requireRepo, toChangeSlug } from '../lib/cliutil.js';
|
|
5
5
|
import { lastCommitTouching } from '../lib/git.js';
|
|
6
6
|
import { verdictOf } from './lint.js';
|
|
7
7
|
import { countUncheckedTasks } from './verify.js';
|
|
8
8
|
import { log } from '../lib/log.js';
|
|
9
|
+
import { isSinglePrLevel } from '../lib/level.js';
|
|
9
10
|
|
|
10
11
|
// "Where am I?" for a change - a read-only view of the 7 stages from the working
|
|
11
12
|
// tree + git. Useful for humans and for an agent deciding the next command.
|
|
@@ -16,6 +17,14 @@ export function statusChange(changeId, opts = {}) {
|
|
|
16
17
|
const cdir = changeDir(repoRoot, slug);
|
|
17
18
|
|
|
18
19
|
if (!exists(cdir)) {
|
|
20
|
+
if (opts.json) {
|
|
21
|
+
log.plain(JSON.stringify({
|
|
22
|
+
change: slug,
|
|
23
|
+
exists: false,
|
|
24
|
+
next: `asdlc new ${changeId}`
|
|
25
|
+
}, null, 2));
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
19
28
|
log.plain(`change: ${slug}`);
|
|
20
29
|
log.plain(' (not created)');
|
|
21
30
|
log.plain(`next: asdlc new ${changeId}`);
|
|
@@ -31,6 +40,11 @@ export function statusChange(changeId, opts = {}) {
|
|
|
31
40
|
const approvedSha = lastCommitTouching(repoRoot, branch, locked);
|
|
32
41
|
const unchecked = has('tasks.md') ? countUncheckedTasks(readText(path.join(cdir, 'tasks.md'))) : null;
|
|
33
42
|
|
|
43
|
+
const metaPath = path.join(cdir, '.openspec.yaml');
|
|
44
|
+
let metaText = exists(metaPath) ? readText(metaPath) : '';
|
|
45
|
+
const levelMatch = metaText.match(/^\s*level:\s*['"]?([^\s'"]+)['"]?\s*$/m);
|
|
46
|
+
const level = levelMatch ? levelMatch[1].toUpperCase() : 'L1';
|
|
47
|
+
|
|
34
48
|
const stage = [
|
|
35
49
|
['1 explore (draft)', has('explore.md')],
|
|
36
50
|
['2 proposal.md', has('proposal.md')],
|
|
@@ -39,27 +53,174 @@ export function statusChange(changeId, opts = {}) {
|
|
|
39
53
|
['4 tasks complete', unchecked === 0],
|
|
40
54
|
];
|
|
41
55
|
|
|
42
|
-
log.plain(`change: ${slug}`);
|
|
43
|
-
for (const [name, ok] of stage) log.plain(` [${ok ? 'x' : ' '}] ${name}`);
|
|
44
|
-
|
|
45
56
|
let next;
|
|
46
57
|
if (!has('explore.md') && !has('proposal.md')) next = `asdlc new ${changeId}`;
|
|
47
58
|
else if (!has('proposal.md') || specFiles.length === 0) next = 'author proposal.md + specs/**';
|
|
48
59
|
else if (!approvedSha) next = `run: asdlc lint ${changeId} && asdlc pr ${changeId} (CI handles AI review on PR; once merged run: asdlc approve ${changeId})`;
|
|
49
60
|
else if (unchecked !== 0) next = `asdlc apply ${changeId}, then complete tasks in tasks.md`;
|
|
50
61
|
else next = `asdlc verify ${changeId}`;
|
|
62
|
+
|
|
63
|
+
if (opts.json) {
|
|
64
|
+
log.plain(JSON.stringify({
|
|
65
|
+
change: slug,
|
|
66
|
+
exists: true,
|
|
67
|
+
level,
|
|
68
|
+
stage: stage.map(([name, ok]) => ({ name, ok })),
|
|
69
|
+
next
|
|
70
|
+
}, null, 2));
|
|
71
|
+
return 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
log.plain(`change: ${slug}`);
|
|
75
|
+
for (const [name, ok] of stage) log.plain(` [${ok ? 'x' : ' '}] ${name}`);
|
|
51
76
|
log.plain('');
|
|
52
77
|
log.plain(`next: ${next}`);
|
|
53
78
|
return 0;
|
|
54
79
|
}
|
|
55
80
|
|
|
81
|
+
// Portfolio overview across all active (in-flight) changes.
|
|
82
|
+
// Deliberately excludes completed/archived changes to keep output compact and scannable.
|
|
83
|
+
export function statusPortfolio(opts = {}) {
|
|
84
|
+
const repoRoot = requireRepo(opts);
|
|
85
|
+
const branch = opts.protectedBranch ?? 'origin/main';
|
|
86
|
+
const cdirRoot = path.join(openspecDir(repoRoot), CHANGES_DIR);
|
|
87
|
+
|
|
88
|
+
if (!exists(cdirRoot)) {
|
|
89
|
+
if (opts.json) {
|
|
90
|
+
log.plain(JSON.stringify({ total: 0, active: [] }, null, 2));
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
log.plain('No active changes in flight.');
|
|
94
|
+
log.plain('Run: asdlc new "<requirement>"');
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const entries = listDir(cdirRoot).filter((e) => e.isDirectory() && e.name !== 'archive');
|
|
99
|
+
const active = [];
|
|
100
|
+
|
|
101
|
+
for (const entry of entries) {
|
|
102
|
+
const slug = entry.name;
|
|
103
|
+
const cdir = path.join(cdirRoot, slug);
|
|
104
|
+
|
|
105
|
+
// Skip archived changes
|
|
106
|
+
const metaPath = path.join(cdir, '.openspec.yaml');
|
|
107
|
+
let metaText = exists(metaPath) ? readText(metaPath) : '';
|
|
108
|
+
if (/status:\s*['"]?archived['"]?/i.test(metaText)) continue;
|
|
109
|
+
|
|
110
|
+
const has = (f) => exists(path.join(cdir, f));
|
|
111
|
+
const specFiles = exists(path.join(cdir, 'specs'))
|
|
112
|
+
? walkFiles(path.join(cdir, 'specs')).filter((f) => f.endsWith('spec.md')) : [];
|
|
113
|
+
|
|
114
|
+
const levelMatch = metaText.match(/^\s*level:\s*['"]?([^\s'"]+)['"]?\s*$/m);
|
|
115
|
+
const level = levelMatch ? levelMatch[1].toUpperCase() : 'L1';
|
|
116
|
+
|
|
117
|
+
const reqMatch = metaText.match(/^\s*requirement:\s*([^\r\n]+)/m);
|
|
118
|
+
let requirement = reqMatch ? reqMatch[1].trim() : null;
|
|
119
|
+
if (requirement?.startsWith('"') && requirement?.endsWith('"')) {
|
|
120
|
+
try { requirement = JSON.parse(requirement); } catch { /* keep raw */ }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const locked = [`openspec/changes/${slug}/proposal.md`, `openspec/changes/${slug}/specs`];
|
|
124
|
+
const approvedSha = lastCommitTouching(repoRoot, branch, locked);
|
|
125
|
+
const unchecked = has('tasks.md') ? countUncheckedTasks(readText(path.join(cdir, 'tasks.md'))) : null;
|
|
126
|
+
const isSinglePr = isSinglePrLevel(level);
|
|
127
|
+
const statusMatch = metaText.match(/^\s*status:\s*['"]?([^\s'"]+)['"]?\s*$/m);
|
|
128
|
+
const recordedStatus = statusMatch ? statusMatch[1].toLowerCase() : null;
|
|
129
|
+
|
|
130
|
+
let stage = '';
|
|
131
|
+
let next = '';
|
|
132
|
+
|
|
133
|
+
if (!has('explore.md') && !has('proposal.md')) {
|
|
134
|
+
stage = 'Draft (Explore)';
|
|
135
|
+
next = `asdlc new ${slug}`;
|
|
136
|
+
} else if (!has('proposal.md') || specFiles.length === 0) {
|
|
137
|
+
stage = 'Drafting Specs';
|
|
138
|
+
next = `author proposal.md + specs/**`;
|
|
139
|
+
} else if (isSinglePr) {
|
|
140
|
+
if (unchecked === null) {
|
|
141
|
+
stage = 'Ready for Impl';
|
|
142
|
+
next = `asdlc apply ${slug}`;
|
|
143
|
+
} else if (unchecked > 0) {
|
|
144
|
+
stage = `Implementing (${unchecked} left)`;
|
|
145
|
+
next = `asdlc apply ${slug}`;
|
|
146
|
+
} else {
|
|
147
|
+
stage = 'Ready to Verify';
|
|
148
|
+
next = `asdlc verify ${slug}`;
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
// Spec-first mode (L2 / L3)
|
|
152
|
+
if (!approvedSha && recordedStatus !== 'ready_for_impl') {
|
|
153
|
+
stage = 'Spec Review';
|
|
154
|
+
next = `asdlc lint ${slug} && asdlc pr ${slug}`;
|
|
155
|
+
} else if (unchecked === null) {
|
|
156
|
+
stage = 'Spec Approved';
|
|
157
|
+
next = `asdlc apply ${slug}`;
|
|
158
|
+
} else if (unchecked > 0) {
|
|
159
|
+
stage = `Implementing (${unchecked} left)`;
|
|
160
|
+
next = `asdlc apply ${slug}`;
|
|
161
|
+
} else {
|
|
162
|
+
stage = 'Ready to Verify';
|
|
163
|
+
next = `asdlc verify ${slug}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
active.push({
|
|
168
|
+
slug,
|
|
169
|
+
level,
|
|
170
|
+
stage,
|
|
171
|
+
next,
|
|
172
|
+
requirement
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
active.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
177
|
+
|
|
178
|
+
if (active.length === 0) {
|
|
179
|
+
if (opts.json) {
|
|
180
|
+
log.plain(JSON.stringify({ total: 0, active: [] }, null, 2));
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
log.plain('No active changes in flight.');
|
|
184
|
+
log.plain('Run: asdlc new "<requirement>"');
|
|
185
|
+
return 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (opts.json) {
|
|
189
|
+
log.plain(JSON.stringify({
|
|
190
|
+
total: active.length,
|
|
191
|
+
active
|
|
192
|
+
}, null, 2));
|
|
193
|
+
return 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Render clean, compact table
|
|
197
|
+
log.plain(`Active changes (${active.length} in flight):\n`);
|
|
198
|
+
|
|
199
|
+
const colSlug = Math.max(6, ...active.map((a) => a.slug.length));
|
|
200
|
+
const colLevel = 5;
|
|
201
|
+
const colStage = Math.max(5, ...active.map((a) => a.stage.length));
|
|
202
|
+
|
|
203
|
+
const pad = (str, len) => str + ' '.repeat(Math.max(0, len - str.length));
|
|
204
|
+
|
|
205
|
+
log.plain(` ${pad('CHANGE', colSlug)} ${pad('LEVEL', colLevel)} ${pad('STAGE', colStage)} NEXT COMMAND`);
|
|
206
|
+
log.plain(` ${'-'.repeat(colSlug)} ${'-'.repeat(colLevel)} ${'-'.repeat(colStage)} ${'-'.repeat(24)}`);
|
|
207
|
+
|
|
208
|
+
for (const a of active) {
|
|
209
|
+
log.plain(` ${pad(a.slug, colSlug)} ${pad(a.level, colLevel)} ${pad(a.stage, colStage)} ${a.next}`);
|
|
210
|
+
}
|
|
211
|
+
log.plain('');
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
56
215
|
export function register(program) {
|
|
57
216
|
program
|
|
58
|
-
.command('status
|
|
59
|
-
.description('show where a change is in the 7 stages + the next command')
|
|
217
|
+
.command('status [changeId]')
|
|
218
|
+
.description('show where a change is in the 7 stages + the next command (or portfolio overview if omitted)')
|
|
60
219
|
.option('--protected-branch <ref>', 'branch the approved spec must be merged into', 'origin/main')
|
|
61
220
|
.option('--repo-root <path>')
|
|
221
|
+
.option('--json', 'output machine-readable JSON')
|
|
62
222
|
.action((changeId, opts) => {
|
|
63
|
-
process.exitCode = statusChange(changeId, opts);
|
|
223
|
+
process.exitCode = changeId ? statusChange(changeId, opts) : statusPortfolio(opts);
|
|
64
224
|
});
|
|
65
225
|
}
|
|
226
|
+
|
package/src/commands/update.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { exists } from '../lib/fs.js';
|
|
3
3
|
import { resolveRepoRoot, openspecDir, OPENSPEC_DIR } from '../lib/paths.js';
|
|
4
4
|
import { log } from '../lib/log.js';
|
|
5
|
-
import { detectTools, installSkills, installHooks } from './init.js';
|
|
5
|
+
import { detectTools, installSkills, installCommands, installHooks } from './init.js';
|
|
6
6
|
import { ensureGraphify, buildGraph, ensureGitignore } from '../lib/graphify.js';
|
|
7
7
|
import { refreshAgents } from '../lib/agents.js';
|
|
8
8
|
|
|
@@ -38,11 +38,12 @@ export function updateRepo(opts = {}) {
|
|
|
38
38
|
log.info(`Repository: ${repoRoot}`);
|
|
39
39
|
log.info('');
|
|
40
40
|
|
|
41
|
-
// 1) Skills refresh
|
|
41
|
+
// 1) Skills & slash commands refresh
|
|
42
42
|
if (opts.skills !== false) {
|
|
43
|
-
log.step('refreshing bundled agent skills in repository...');
|
|
43
|
+
log.step('refreshing bundled agent skills and slash commands in repository...');
|
|
44
44
|
const tools = detectTools(repoRoot);
|
|
45
45
|
installSkills(repoRoot, tools);
|
|
46
|
+
installCommands(repoRoot, tools);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// 2) Codebase AST knowledge graph (KB / graphify)
|
package/src/lib/paths.js
CHANGED
|
@@ -11,6 +11,7 @@ export const ciAssetDir = path.join(assetsDir, 'ci');
|
|
|
11
11
|
export const githooksAssetDir = path.join(assetsDir, 'githooks');
|
|
12
12
|
export const policyAssetFile = path.join(assetsDir, 'policy', 'policy.yaml');
|
|
13
13
|
export const skillsAssetDir = path.join(assetsDir, 'skills');
|
|
14
|
+
export const commandsAssetDir = path.join(assetsDir, 'commands');
|
|
14
15
|
|
|
15
16
|
// The BU-managed OpenSpec schema: installed ONCE per machine into OpenSpec's
|
|
16
17
|
// global schemas dir. Repos carry NO copy and must not override it.
|
package/src/lib/tools.js
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { exists, listDir, copyTree, ensureDir, readText, writeText } from './fs.js';
|
|
3
|
+
import { skillsAssetDir, commandsAssetDir } from './paths.js';
|
|
4
|
+
import { log } from './log.js';
|
|
5
|
+
|
|
6
|
+
export const TOOL_REGISTRY = {
|
|
7
|
+
claude: {
|
|
8
|
+
id: 'claude',
|
|
9
|
+
name: 'Claude Code',
|
|
10
|
+
tier: 1,
|
|
11
|
+
detectDir: '.claude',
|
|
12
|
+
skillsDir: '.claude/skills',
|
|
13
|
+
commandsDir: '.claude/commands',
|
|
14
|
+
commandExt: '.md',
|
|
15
|
+
commandFormat: 'markdown',
|
|
16
|
+
},
|
|
17
|
+
opencode: {
|
|
18
|
+
id: 'opencode',
|
|
19
|
+
name: 'OpenCode',
|
|
20
|
+
tier: 1,
|
|
21
|
+
detectDir: '.opencode',
|
|
22
|
+
skillsDir: '.opencode/skills',
|
|
23
|
+
commandsDir: '.opencode/commands',
|
|
24
|
+
commandExt: '.md',
|
|
25
|
+
commandFormat: 'markdown',
|
|
26
|
+
},
|
|
27
|
+
pi: {
|
|
28
|
+
id: 'pi',
|
|
29
|
+
name: 'Pi (oh-my-pi)',
|
|
30
|
+
tier: 1,
|
|
31
|
+
detectDir: '.pi',
|
|
32
|
+
skillsDir: '.pi/skills',
|
|
33
|
+
commandsDir: '.pi/prompts',
|
|
34
|
+
commandExt: '.md',
|
|
35
|
+
commandFormat: 'markdown',
|
|
36
|
+
},
|
|
37
|
+
antigravity: {
|
|
38
|
+
id: 'antigravity',
|
|
39
|
+
name: 'Google Antigravity',
|
|
40
|
+
tier: 1,
|
|
41
|
+
detectDir: '.agents',
|
|
42
|
+
detectAliases: ['.antigravity'],
|
|
43
|
+
skillsDir: '.agents/skills',
|
|
44
|
+
commandsDir: '.agents/workflows',
|
|
45
|
+
commandExt: '.md',
|
|
46
|
+
commandFormat: 'markdown',
|
|
47
|
+
},
|
|
48
|
+
'github-copilot': {
|
|
49
|
+
id: 'github-copilot',
|
|
50
|
+
name: 'GitHub Copilot',
|
|
51
|
+
tier: 1,
|
|
52
|
+
detectDir: '.github',
|
|
53
|
+
skillsDir: '.github/skills',
|
|
54
|
+
commandsDir: '.github/prompts',
|
|
55
|
+
commandExt: '.prompt.md',
|
|
56
|
+
commandFormat: 'prompt-md',
|
|
57
|
+
},
|
|
58
|
+
cursor: {
|
|
59
|
+
id: 'cursor',
|
|
60
|
+
name: 'Cursor',
|
|
61
|
+
tier: 2,
|
|
62
|
+
detectDir: '.cursor',
|
|
63
|
+
skillsDir: '.cursor/skills',
|
|
64
|
+
commandsDir: '.cursor/commands',
|
|
65
|
+
commandExt: '.md',
|
|
66
|
+
commandFormat: 'markdown',
|
|
67
|
+
},
|
|
68
|
+
trae: {
|
|
69
|
+
id: 'trae',
|
|
70
|
+
name: 'Trae',
|
|
71
|
+
tier: 2,
|
|
72
|
+
detectDir: '.trae',
|
|
73
|
+
skillsDir: '.trae/skills',
|
|
74
|
+
commandsDir: '.trae/commands',
|
|
75
|
+
commandExt: '.md',
|
|
76
|
+
commandFormat: 'markdown',
|
|
77
|
+
},
|
|
78
|
+
windsurf: {
|
|
79
|
+
id: 'windsurf',
|
|
80
|
+
name: 'Windsurf / Devin Desktop',
|
|
81
|
+
tier: 2,
|
|
82
|
+
detectDir: '.windsurf',
|
|
83
|
+
detectAliases: ['.devin'],
|
|
84
|
+
skillsDir: '.windsurf/skills',
|
|
85
|
+
commandsDir: '.windsurf/workflows',
|
|
86
|
+
commandExt: '.md',
|
|
87
|
+
commandFormat: 'markdown',
|
|
88
|
+
},
|
|
89
|
+
gemini: {
|
|
90
|
+
id: 'gemini',
|
|
91
|
+
name: 'Gemini CLI',
|
|
92
|
+
tier: 2,
|
|
93
|
+
detectDir: '.gemini',
|
|
94
|
+
skillsDir: '.gemini/skills',
|
|
95
|
+
commandsDir: '.gemini/commands/asdlc',
|
|
96
|
+
commandExt: '.toml',
|
|
97
|
+
commandFormat: 'toml',
|
|
98
|
+
},
|
|
99
|
+
codex: {
|
|
100
|
+
id: 'codex',
|
|
101
|
+
name: 'Codex',
|
|
102
|
+
tier: 2,
|
|
103
|
+
detectDir: '.codex',
|
|
104
|
+
skillsDir: '.codex/skills',
|
|
105
|
+
commandsDir: '.codex/commands',
|
|
106
|
+
commandExt: '.md',
|
|
107
|
+
commandFormat: 'markdown',
|
|
108
|
+
},
|
|
109
|
+
zed: {
|
|
110
|
+
id: 'zed',
|
|
111
|
+
name: 'Zed',
|
|
112
|
+
tier: 2,
|
|
113
|
+
detectDir: '.zed',
|
|
114
|
+
skillsDir: '.zed/skills',
|
|
115
|
+
commandsDir: '.zed/commands',
|
|
116
|
+
commandExt: '.md',
|
|
117
|
+
commandFormat: 'markdown',
|
|
118
|
+
},
|
|
119
|
+
dsh: {
|
|
120
|
+
id: 'dsh',
|
|
121
|
+
name: 'DSH Agent',
|
|
122
|
+
tier: 2,
|
|
123
|
+
detectDir: '.dsh',
|
|
124
|
+
skillsDir: '.dsh/skills',
|
|
125
|
+
commandsDir: '.dsh/commands',
|
|
126
|
+
commandExt: '.md',
|
|
127
|
+
commandFormat: 'markdown',
|
|
128
|
+
},
|
|
129
|
+
agents: {
|
|
130
|
+
id: 'agents',
|
|
131
|
+
name: 'Generic Agents',
|
|
132
|
+
tier: 2,
|
|
133
|
+
detectDir: '.agents',
|
|
134
|
+
skillsDir: '.agents/skills',
|
|
135
|
+
commandsDir: '.agents/workflows',
|
|
136
|
+
commandExt: '.md',
|
|
137
|
+
commandFormat: 'markdown',
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Detect AI agent tools configured in this repository
|
|
143
|
+
*/
|
|
144
|
+
export function detectTools(repoRoot) {
|
|
145
|
+
const detected = new Set();
|
|
146
|
+
for (const tool of Object.values(TOOL_REGISTRY)) {
|
|
147
|
+
if (exists(path.join(repoRoot, tool.detectDir))) {
|
|
148
|
+
detected.add(tool.id);
|
|
149
|
+
}
|
|
150
|
+
if (tool.detectAliases) {
|
|
151
|
+
for (const alias of tool.detectAliases) {
|
|
152
|
+
if (exists(path.join(repoRoot, alias))) {
|
|
153
|
+
detected.add(tool.id);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return Array.from(detected);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Resolve tool definition by ID, alias, or directory name
|
|
163
|
+
*/
|
|
164
|
+
export function getToolDefinition(toolIdentifier) {
|
|
165
|
+
if (!toolIdentifier) return null;
|
|
166
|
+
const clean = String(toolIdentifier).toLowerCase().replace(/^\./, '');
|
|
167
|
+
if (TOOL_REGISTRY[clean]) return TOOL_REGISTRY[clean];
|
|
168
|
+
|
|
169
|
+
for (const tool of Object.values(TOOL_REGISTRY)) {
|
|
170
|
+
if (tool.detectDir === `.${clean}` || (tool.detectAliases && tool.detectAliases.includes(`.${clean}`))) {
|
|
171
|
+
return tool;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Install bundled skills into all detected or specified agent tools
|
|
179
|
+
*/
|
|
180
|
+
export function installSkills(repoRoot, tools = []) {
|
|
181
|
+
if (!exists(skillsAssetDir)) return;
|
|
182
|
+
const count = listDir(skillsAssetDir).filter((d) => d.isDirectory()).length;
|
|
183
|
+
const targetDirs = new Set(['.agents/skills']);
|
|
184
|
+
|
|
185
|
+
// If user has an explicit .antigravity folder, copy skills there too
|
|
186
|
+
if (exists(path.join(repoRoot, '.antigravity'))) {
|
|
187
|
+
targetDirs.add('.antigravity/skills');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
for (const t of tools) {
|
|
191
|
+
const def = getToolDefinition(t);
|
|
192
|
+
if (def) {
|
|
193
|
+
targetDirs.add(def.skillsDir);
|
|
194
|
+
if (def.detectAliases) {
|
|
195
|
+
for (const alias of def.detectAliases) {
|
|
196
|
+
if (exists(path.join(repoRoot, alias))) {
|
|
197
|
+
targetDirs.add(path.join(alias, 'skills').replace(/\\/g, '/'));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
const clean = String(t).toLowerCase().replace(/^\./, '');
|
|
203
|
+
if (clean) targetDirs.add(`.${clean}/skills`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
for (const dir of targetDirs) {
|
|
208
|
+
const dest = path.join(repoRoot, dir);
|
|
209
|
+
copyTree(skillsAssetDir, dest);
|
|
210
|
+
log.ok(`installed bundled skills (${count} skills) -> ${dir}/`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Format markdown command template for a specific tool format
|
|
216
|
+
*/
|
|
217
|
+
function formatCommandContent(baseContent, baseName, format) {
|
|
218
|
+
if (format === 'prompt-md') {
|
|
219
|
+
// GitHub Copilot uses .prompt.md with standard YAML frontmatter
|
|
220
|
+
return baseContent;
|
|
221
|
+
}
|
|
222
|
+
if (format === 'toml') {
|
|
223
|
+
// Gemini CLI uses TOML command definitions
|
|
224
|
+
const descMatch = baseContent.match(/^description:\s*["']?([\s\S]*?)["']?$/m);
|
|
225
|
+
const desc = descMatch ? descMatch[1].trim() : `Execute ${baseName}`;
|
|
226
|
+
const cleanBody = baseContent.replace(/^---[\s\S]*?---\r?\n/, '').trim();
|
|
227
|
+
return `description = "${desc.replace(/"/g, '\\"')}"\n\nprompt = """\n${cleanBody}\n"""\n`;
|
|
228
|
+
}
|
|
229
|
+
return baseContent;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Install slash commands and workflows across detected or specified tools
|
|
234
|
+
*/
|
|
235
|
+
export function installCommands(repoRoot, tools = []) {
|
|
236
|
+
if (!exists(commandsAssetDir)) return;
|
|
237
|
+
const commandFiles = listDir(commandsAssetDir).filter((f) => !f.isDirectory() && f.name.endsWith('.md'));
|
|
238
|
+
if (commandFiles.length === 0) return;
|
|
239
|
+
|
|
240
|
+
const targetTools = new Set(['agents']);
|
|
241
|
+
for (const t of tools) {
|
|
242
|
+
const def = getToolDefinition(t);
|
|
243
|
+
if (def) targetTools.add(def.id);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Also check if .antigravity exists on disk
|
|
247
|
+
const hasAntigravityAlias = exists(path.join(repoRoot, '.antigravity'));
|
|
248
|
+
|
|
249
|
+
for (const toolId of targetTools) {
|
|
250
|
+
const def = TOOL_REGISTRY[toolId];
|
|
251
|
+
if (!def) continue;
|
|
252
|
+
|
|
253
|
+
const destDir = path.join(repoRoot, def.commandsDir);
|
|
254
|
+
ensureDir(destDir);
|
|
255
|
+
|
|
256
|
+
for (const cmdFile of commandFiles) {
|
|
257
|
+
const baseName = cmdFile.name.replace(/\.md$/, '');
|
|
258
|
+
const rawContent = readText(path.join(commandsAssetDir, cmdFile.name));
|
|
259
|
+
const targetContent = formatCommandContent(rawContent, baseName, def.commandFormat);
|
|
260
|
+
const targetFileName = `${baseName}${def.commandExt}`;
|
|
261
|
+
writeText(path.join(destDir, targetFileName), targetContent);
|
|
262
|
+
}
|
|
263
|
+
log.ok(`installed slash commands (${commandFiles.length} commands) -> ${def.commandsDir}/`);
|
|
264
|
+
|
|
265
|
+
// If antigravity alias folder exists, mirror workflows there too
|
|
266
|
+
if (toolId === 'antigravity' && hasAntigravityAlias) {
|
|
267
|
+
const aliasDir = path.join(repoRoot, '.antigravity', 'workflows');
|
|
268
|
+
ensureDir(aliasDir);
|
|
269
|
+
for (const cmdFile of commandFiles) {
|
|
270
|
+
const rawContent = readText(path.join(commandsAssetDir, cmdFile.name));
|
|
271
|
+
writeText(path.join(aliasDir, cmdFile.name), rawContent);
|
|
272
|
+
}
|
|
273
|
+
log.ok(`installed slash commands (${commandFiles.length} commands) -> .antigravity/workflows/`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Audit tool health for asdlc doctor
|
|
280
|
+
*/
|
|
281
|
+
export function checkToolHealth(repoRoot, toolId) {
|
|
282
|
+
const def = TOOL_REGISTRY[toolId];
|
|
283
|
+
if (!def) return null;
|
|
284
|
+
|
|
285
|
+
const skillsPath = path.join(repoRoot, def.skillsDir);
|
|
286
|
+
const commandsPath = path.join(repoRoot, def.commandsDir);
|
|
287
|
+
|
|
288
|
+
const skillsOk = exists(skillsPath) && listDir(skillsPath).length > 0;
|
|
289
|
+
const commandsOk = exists(commandsPath) && listDir(commandsPath).length > 0;
|
|
290
|
+
|
|
291
|
+
let status = 'pass';
|
|
292
|
+
let detail = `skills + commands installed (${def.commandsDir})`;
|
|
293
|
+
|
|
294
|
+
if (!skillsOk && !commandsOk) {
|
|
295
|
+
status = 'warn';
|
|
296
|
+
detail = 'missing skills and commands (run `asdlc init`)';
|
|
297
|
+
} else if (!skillsOk) {
|
|
298
|
+
status = 'warn';
|
|
299
|
+
detail = `missing skills in ${def.skillsDir} (run 'asdlc init')`;
|
|
300
|
+
} else if (!commandsOk) {
|
|
301
|
+
status = 'warn';
|
|
302
|
+
detail = `missing commands in ${def.commandsDir} (run 'asdlc init')`;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return {
|
|
306
|
+
id: def.id,
|
|
307
|
+
name: def.name,
|
|
308
|
+
status,
|
|
309
|
+
detail,
|
|
310
|
+
skillsOk,
|
|
311
|
+
commandsOk,
|
|
312
|
+
};
|
|
313
|
+
}
|