sdd-mcp-server 4.0.0 → 5.0.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.
Files changed (73) hide show
  1. package/README.md +18 -35
  2. package/dist/adapters/cli/SDDToolAdapter.d.ts +2 -5
  3. package/dist/adapters/cli/SDDToolAdapter.js +48 -92
  4. package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
  5. package/dist/application/services/ContextCompactionService.d.ts +10 -3
  6. package/dist/application/services/ContextCompactionService.js +139 -35
  7. package/dist/application/services/ContextCompactionService.js.map +1 -1
  8. package/dist/application/services/ProjectService.js +3 -3
  9. package/dist/application/services/ProjectService.js.map +1 -1
  10. package/dist/application/services/SpecPathResolver.js +1 -1
  11. package/dist/application/services/SpecPathResolver.js.map +1 -1
  12. package/dist/application/services/WorkflowEngineService.d.ts +160 -50
  13. package/dist/application/services/WorkflowEngineService.js +1404 -429
  14. package/dist/application/services/WorkflowEngineService.js.map +1 -1
  15. package/dist/application/services/WorkflowErrors.d.ts +16 -0
  16. package/dist/application/services/WorkflowErrors.js +53 -0
  17. package/dist/application/services/WorkflowErrors.js.map +1 -0
  18. package/dist/application/services/WorkflowValidationService.d.ts +25 -46
  19. package/dist/application/services/WorkflowValidationService.js +284 -627
  20. package/dist/application/services/WorkflowValidationService.js.map +1 -1
  21. package/dist/cli/install-skills.js.map +1 -1
  22. package/dist/cli/install-target.d.ts +4 -1
  23. package/dist/cli/install-target.js +4 -0
  24. package/dist/cli/install-target.js.map +1 -1
  25. package/dist/cli/tool-support/claude-code.js +7 -3
  26. package/dist/cli/tool-support/claude-code.js.map +1 -1
  27. package/dist/cli/tool-support/codex.js +6 -2
  28. package/dist/cli/tool-support/codex.js.map +1 -1
  29. package/dist/cli/tool-support/mcp-registration.d.ts +22 -0
  30. package/dist/cli/tool-support/mcp-registration.js +275 -0
  31. package/dist/cli/tool-support/mcp-registration.js.map +1 -0
  32. package/dist/cli/tool-support/omp.js +6 -2
  33. package/dist/cli/tool-support/omp.js.map +1 -1
  34. package/dist/cli/tool-support/root-guidance.js +2 -2
  35. package/dist/cli/tool-support/root-guidance.js.map +1 -1
  36. package/dist/cli/tool-support/target-installer.d.ts +2 -2
  37. package/dist/cli/tool-support/target-installer.js +9 -3
  38. package/dist/cli/tool-support/target-installer.js.map +1 -1
  39. package/dist/cli/utils/preserving-writer.d.ts +35 -1
  40. package/dist/cli/utils/preserving-writer.js +479 -108
  41. package/dist/cli/utils/preserving-writer.js.map +1 -1
  42. package/dist/domain/types.d.ts +52 -7
  43. package/dist/domain/types.js +5 -4
  44. package/dist/domain/types.js.map +1 -1
  45. package/dist/infrastructure/mcp/MCPServer.js +13 -13
  46. package/dist/infrastructure/mcp/MCPServer.js.map +1 -1
  47. package/dist/infrastructure/mcp/ToolRegistry.d.ts +5 -1
  48. package/dist/infrastructure/mcp/ToolRegistry.js +11 -4
  49. package/dist/infrastructure/mcp/ToolRegistry.js.map +1 -1
  50. package/dist/infrastructure/mcp/sddToolDefinitions.js +76 -90
  51. package/dist/infrastructure/mcp/sddToolDefinitions.js.map +1 -1
  52. package/dist/infrastructure/schemas/project.schema.d.ts +2 -2
  53. package/dist/infrastructure/schemas/project.schema.js +2 -2
  54. package/dist/infrastructure/schemas/project.schema.js.map +1 -1
  55. package/dist/shared/version.d.ts +3 -0
  56. package/dist/shared/version.js +4 -0
  57. package/dist/shared/version.js.map +1 -0
  58. package/dist/utils/atomicWrite.js +20 -5
  59. package/dist/utils/atomicWrite.js.map +1 -1
  60. package/dist/utils/withFilesystemLock.d.ts +22 -0
  61. package/dist/utils/withFilesystemLock.js +219 -0
  62. package/dist/utils/withFilesystemLock.js.map +1 -0
  63. package/package.json +4 -2
  64. package/skills/sdd-design/REFERENCE.md +16 -0
  65. package/skills/sdd-design/SKILL.md +22 -13
  66. package/skills/sdd-implement/REFERENCE.md +4 -0
  67. package/skills/sdd-implement/SKILL.md +20 -16
  68. package/skills/sdd-requirements/REFERENCE.md +15 -7
  69. package/skills/sdd-requirements/SKILL.md +30 -22
  70. package/skills/sdd-tasks/REFERENCE.md +9 -9
  71. package/skills/sdd-tasks/SKILL.md +27 -15
  72. package/templates/CLAUDE.md +6 -12
  73. package/templates/codex-AGENTS.md +7 -9
@@ -6,34 +6,42 @@ disable-model-invocation: true
6
6
 
7
7
  # SDD Requirements
8
8
 
9
- ## Prerequisites
10
-
11
- - The feature must exist through `sdd-init`.
12
- - Check its durable phase with `sdd-status`.
13
- - Read the feature description and relevant steering. Ask only for material information that cannot be derived.
14
-
15
- ## Workflow
16
-
17
- 1. Identify users, goals, in-scope behavior, exclusions, constraints, assumptions, dependencies, and measurable success.
18
- 2. Write independently testable functional and non-functional requirements using EARS:
19
- - ubiquitous: `The system SHALL ...`
20
- - event: `WHEN ... THEN the system SHALL ...`
21
- - state: `WHILE ... THE system SHALL ...`
22
- - optional: `WHERE ... THE system SHALL ...`
23
- - unwanted behavior: `IF ... THEN the system SHALL ...`
24
- 3. Give every requirement a stable ID and specific acceptance criteria. Replace ambiguous words such as “fast”, “appropriate”, “should”, or “may” with observable bounds.
25
- 4. Include security, privacy, accessibility, compatibility, error, and performance requirements only where relevant; do not invent scope.
26
- 5. Check completeness, consistency, feasibility, traceability, and testability; use `sdd-validate-gap` when existing code is in scope.
27
- 6. Write `.spec/specs/{feature}/requirements.md`. Request requirements approval only after the artifact is complete; never self-approve silently.
9
+ The user invokes this Skill; all MCP calls below are internal. Never ask the user to call a backend tool or expose revision, hash, fingerprint, or backend JSON except in explicit debug output.
10
+
11
+ ## Resolve and Restore
12
+
13
+ 1. Internally read status before doing method work.
14
+ 2. With a supplied missing feature, internally initialize it from the user's name and complete goal. If clarification is required, present the structured questions, collect answers, and retry initialization. Use the returned canonical feature name.
15
+ 3. With no supplied name: ask for a name and goal when no feature exists; resume the sole incomplete feature; when several are incomplete, list them and ask the user to select. Never infer identity from process memory.
16
+ 4. Load compact approved context. For a failed or unapproved requirements revision, load that draft only with full mode and explicit unapproved inclusion.
17
+ 5. If status reports an observed artifact identity for an orphan or manual edit, read that exact requirements file before revising. Never acknowledge its hash without inspecting and deliberately incorporating or replacing its content.
18
+
19
+ If durable state reports a conflict or host permission failure, present an actionable blocker and make no artifact change.
20
+
21
+ ## Method and Artifact Contract
22
+
23
+ 1. Identify users, goals, scope, exclusions, constraints, assumptions, dependencies, and measurable success.
24
+ 2. Write independently testable EARS requirements. Every requirement uses a unique `### FR-N: ...` or `### NFR-N: ...` section and same-line metadata labels:
25
+ - `**Objective:** ...`
26
+ - `**EARS Specification:** ... SHALL ...`
27
+ - `**Acceptance Criteria:** 1. ...` with at least one numbered item on the same line.
28
+ 3. Replace ambiguous words with observable bounds. Include security, privacy, accessibility, compatibility, errors, and performance only when relevant.
29
+ 4. Check completeness, consistency, feasibility, traceability, and testability; run gap analysis internally when existing code is in scope.
30
+
31
+ Internally submit the complete Markdown with the exact revision and artifact identity last observed. Submission, not direct file editing, is the canonical write. Present the saved path and a concise validation result. A failed validation is a durable draft: revise it using the observed draft content and identity; do not request approval.
32
+
33
+ ## Human Gate
34
+
35
+ When validation passes, ask one explicit question: **“Approve these requirements?”** Only an unambiguous affirmative answer in this Skill flow permits the internal approval call for the exact reviewed revision and artifact. Never self-approve or treat host tool permission as approval. After approval, reread status and report the persisted outcome.
28
36
 
29
37
  ## Specialist Delegation
30
38
 
31
- Target renderers provide the `planner` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only the goal, verified context, constraints, open decisions, and output contract. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If the advisor or routed model is unavailable, record one fallback and continue in the parent without retrying or selecting a generic child. Where a native per-turn model override applies, execute in this turn.
39
+ Target renderers provide the `planner` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only the goal, verified context, constraints, open decisions, and output contract. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If unavailable, record one fallback and continue in the parent without retrying or selecting a generic child.
32
40
 
33
41
  ## Output
34
42
 
35
- Return the saved path, key scope decisions, validation evidence, and approval as the next action.
43
+ Return the canonical saved path, key scope decisions, concise validation evidence, the approval question or persisted approval, and durable blockers. Do not present raw MCP operations as next steps.
36
44
 
37
45
  ## Optional Reference
38
46
 
39
- Read [REFERENCE.md](REFERENCE.md) only for EARS examples, document structure, or the extended quality checklist.
47
+ Read [REFERENCE.md](REFERENCE.md) only for EARS examples, exact document shape, or the extended quality checklist.
@@ -5,17 +5,17 @@ Read only for formatting and decomposition help.
5
5
  ## Task Template
6
6
 
7
7
  ```markdown
8
- ### N.M Outcome
9
- Affected artifacts:
10
- Requirements/design traceability:
11
- Dependencies:
12
- RED: focused failing behavior test and command
13
- GREEN: smallest complete behavior
14
- REFACTOR: bounded cleanup
15
- Acceptance criteria:
16
- Verification:
8
+ ### 1.1 Observable outcome
9
+ **Covers:** FR-1, NFR-1, D-1
10
+ **Dependencies:** none
11
+ **TDD:** required
12
+ **Affected artifacts:** src/example.ts, src/example.test.ts
13
+ **Acceptance criteria:** The stated behavior and failure boundary are observable.
14
+ **Verification:** Run the focused test, then the affected checks.
17
15
  ```
18
16
 
17
+ Use comma-separated values for `Covers`, `Dependencies`, and `Affected artifacts`; use literal `none` for an empty set. For non-behavioral work, write `**TDD:** not-applicable — <specific reason>`.
18
+
19
19
  ## Decomposition
20
20
 
21
21
  Prefer a vertical behavior slice over separate “write all tests” and “write all code” phases. Split when a task has distinct observable outcomes, ownership boundaries, or independently verifiable failure modes. Merge tasks that would otherwise require a serial handoff with no standalone value. Mark concurrency only when slices do not edit the same contract or require one another's output.
@@ -6,30 +6,42 @@ disable-model-invocation: true
6
6
 
7
7
  # SDD Tasks
8
8
 
9
- ## Prerequisites
9
+ The user invokes this Skill; backend lifecycle calls are internal. Never tell the user to call a raw MCP tool or expose revision, hash, fingerprint, or backend JSON except in explicit debug output.
10
10
 
11
- - Resolve the feature with `sdd-status`.
12
- - Design must be generated and approved. Stop rather than planning from an unapproved draft.
13
- - Read the approved requirements and design, including interfaces, dependencies, risks, and acceptance criteria.
11
+ ## Resolve and Restore
14
12
 
15
- ## Workflow
13
+ 1. Internally resolve status. If no feature name is supplied, resume the sole incomplete feature or ask the user to select when several exist.
14
+ 2. Design and requirements must be approved. If durable status says otherwise, present the persisted blocker and make no file change.
15
+ 3. Load the latest approved compact context before method work. Load an unapproved tasks draft only with full mode and explicit unapproved inclusion.
16
+ 4. The saved test-case-review choice is authoritative. Ask once only when status has no choice; reuse it on every revision.
17
+ 5. If status reports an observed artifact identity for an orphan or manual edit, read that exact tasks file before revising. Never acknowledge its hash without inspecting and deliberately incorporating or replacing its content.
16
18
 
17
- 1. Map every design component and requirement to implementation and verification work.
18
- 2. Split work into small, ordered slices that each produce observable value. State affected artifacts, dependencies, and acceptance criteria.
19
- 3. For behavioral work, make RED → GREEN → REFACTOR explicit: first a focused failing test, then minimal implementation, then cleanup with the test green.
20
- 4. Cover happy paths, boundaries, errors, state transitions, security controls, migration, and integration where applicable. Do not impose a test ratio when the architecture calls for a different mix.
21
- 5. Mark genuinely independent slices so they may run concurrently; never invent parallelism or a serial specialist.
22
- 6. Ask whether the optional test case review checkpoint is required. If enabled, record behavior/edge/error cases and require `sdd-review-test-cases` before tasks approval.
23
- 7. Write `.spec/specs/{feature}/tasks.md`. Request tasks approval only after dependencies, traceability, and completion criteria are validated.
19
+ If the runtime is unavailable because of host permission, report an actionable reload/trust or policy blocker; never substitute manual backend instructions.
20
+
21
+ ## Method and Artifact Contract
22
+
23
+ 1. Map every requirement and design decision to small, ordered implementation and verification slices.
24
+ 2. Use unique `### N.M ...` task sections with same-line labels `**Covers:**`, `**Dependencies:**`, `**TDD:**`, `**Affected artifacts:**`, `**Acceptance criteria:**`, and `**Verification:**`.
25
+ 3. `Covers`, dependencies, and affected artifacts are comma-separated; an empty set is exactly `none`. Dependencies name existing task IDs and must be acyclic.
26
+ 4. `TDD` is exactly `required` or `not-applicable — <reason>`. Behavioral work uses RED → GREEN → REFACTOR and covers relevant boundaries, errors, transitions, security, migration, and integration.
27
+ 5. Mark concurrency only for genuinely independent slices.
28
+
29
+ Internally submit complete Markdown with the exact revision and artifact identity last observed and the persisted review choice. Submission is the canonical write. Present the saved path and concise validation outcome. A failed validation remains a durable draft to revise and cannot advance.
30
+
31
+ ## Human Gates
32
+
33
+ If test-case review is required, present the concrete behavior, boundary, and error cases. Only explicit confirmation records the internal checkpoint for the exact tasks revision and artifact. This is separate from approval.
34
+
35
+ After validation and any required review, ask **“Approve these implementation tasks?”** Only an unambiguous affirmative answer in this Skill flow permits internal approval of the exact reviewed artifact. Never self-approve. Reread status after each checkpoint and approval.
24
36
 
25
37
  ## Specialist Delegation
26
38
 
27
- Target renderers provide the `planner` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only approved design decisions, constraints, dependencies, and task output contract. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If the advisor or routed model is unavailable, record one fallback and continue in the parent without retrying or selecting a generic child. Where a native per-turn model override applies, execute in this turn.
39
+ Target renderers provide the `planner` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only approved decisions, constraints, dependencies, and the task contract. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If unavailable, record one fallback and continue in the parent without retrying or selecting a generic child.
28
40
 
29
41
  ## Output
30
42
 
31
- Return the saved path, requirement/design traceability, checkpoint choice, validation evidence, and approval as the next action.
43
+ Return the canonical saved path, traceability, saved checkpoint choice, concise validation evidence, the current human decision, and durable blockers. Do not present raw MCP operations as next steps.
32
44
 
33
45
  ## Optional Reference
34
46
 
35
- Read [REFERENCE.md](REFERENCE.md) only for task templates, sizing heuristics, dependency diagrams, or the extended checklist.
47
+ Read [REFERENCE.md](REFERENCE.md) only for the exact task template, sizing heuristics, dependency diagrams, or extended checklist.
@@ -1,24 +1,18 @@
1
1
  # CLAUDE.md — Spec-Driven Development
2
2
 
3
- This project uses `sdd-mcp-server` with manual-only skills and the canonical v4 MCP runtime.
3
+ This project uses `sdd-mcp-server` with manual-only Skills and its hidden governed runtime.
4
4
 
5
- ## Development paths
5
+ ## Start
6
6
 
7
- ### Simple task
7
+ After installation, reload Claude Code and accept the project MCP trust prompt. Invoke `/simple-task` for a small feature, bug fix, or focused enhancement.
8
8
 
9
- Invoke `/simple-task` for a small feature, bug fix, or focused enhancement.
10
-
11
- ### Formal SDD
12
-
13
- For work requiring approved requirements, design, and TDD tasks:
9
+ For formal work, invoke only the phase Skills:
14
10
 
15
11
  ```text
16
- sdd-init → /sdd-requirements → sdd-approve → /sdd-design → sdd-approve → /sdd-tasks → optional test review → sdd-approve → /sdd-implement
12
+ /sdd-requirements <feature-name> → explicit approval → /sdd-design → explicit approval → /sdd-tasks → optional explicit test review → explicit approval → /sdd-implement
17
13
  ```
18
14
 
19
- Use the installed `sdd-*` MCP tools for state changes and compact context by default. Feature-scoped calls use `featureName`, not `projectId`.
20
-
21
- For continuation, call `sdd-context-load` with `featureName`; retain the returned `fingerprint` and send it as `ifNoneMatch` on the next identical request. A `not-modified` result means the prior payload remains current and must not be requested or repeated again.
15
+ Each Skill restores durable status and approved compact context, performs validation and persistence internally, and asks for any required human decision. Do not ask the user to call MCP tools or paste workflow JSON. A cloned project still requires the host's project trust; organization or project deny rules may override local permissions.
22
16
 
23
17
  ## Model execution
24
18
 
@@ -1,20 +1,18 @@
1
1
  # AGENTS.md — Spec-Driven Development (SDD)
2
2
 
3
- This project uses the SDD workflow powered by `sdd-mcp-server`.
3
+ This project uses `sdd-mcp-server` with manual-only Skills and its hidden governed runtime.
4
4
 
5
- ## Development Paths
5
+ ## Start
6
6
 
7
- ### Simple Tasks
8
- For small features, bug fixes, and quick enhancements — just start coding with best practices.
7
+ After installation, reload Codex and accept project trust when prompted. Use `$simple-task` for a small feature, bug fix, or focused enhancement.
9
8
 
10
- ### Full SDD Workflow
11
- For complex features requiring formal specification:
9
+ For formal work, invoke only:
12
10
 
13
- ```
14
- Initialize → Requirements → Design → Tasks → Implement
11
+ ```text
12
+ $sdd-requirements <feature-name> → explicit approval → $sdd-design → explicit approval → $sdd-tasks → optional explicit test review → explicit approval → $sdd-implement
15
13
  ```
16
14
 
17
- Each phase builds on the previous and requires review before proceeding.
15
+ Each Skill restores durable status and approved compact context, performs validation and persistence internally, and asks for required human decisions. Do not ask the user to call MCP tools or paste workflow JSON.
18
16
 
19
17
  ## Installed Components
20
18