Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openspec/changes/add-dcp-config/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Check for `.opencode/dcp.jsonc` first, then `.opencode/dcp.json`. If neither exi

### D4: Return single `ScaffoldResult`

`ScaffoldDCP()` returns `(ScaffoldResult, error)` with the same `Path`/`Action` shape used by `Scaffold()`. Actions: "created" (fresh), "skipped" (already has protectTags), "updated" (merged protectTags into existing file). This aligns with **Observable Quality** — consistent, machine-parseable output.
`ScaffoldDCP()` returns `(ScaffoldResult, error)` with the same `Path`/`Action` shape used by `Scaffold()`. Actions: "created" (fresh), "skipped" (already has protectTags), "overwritten" (replaced file with canonical config). This aligns with **Observable Quality** — consistent, machine-parseable output.

### D5: DCP config content matches replicator's own `.opencode/dcp.jsonc`

Expand Down Expand Up @@ -75,7 +75,7 @@ The doctor check uses the same `strings.Contains` approach as `ScaffoldDCP()` fo

### D10: Update strategy replaces file content entirely

When `ScaffoldDCP()` encounters an existing config file without `protectTags`, the "updated" action replaces the entire file with the canonical DCP config content (from D5). This is simpler and safer than attempting to merge into an arbitrary JSONC structure, which could produce invalid JSON. The trade-off is that user customizations beyond `protectTags` are lost — but DCP configs are typically simple, and the non-goal of "supporting custom DCP config beyond `protectTags: true`" makes this acceptable.
When `ScaffoldDCP()` encounters an existing config file without `protectTags`, the "overwritten" action replaces the entire file with the canonical DCP config content (from D5). This is simpler and safer than attempting to merge into an arbitrary JSONC structure, which could produce invalid JSON. The trade-off is that user customizations beyond `protectTags` are lost — but DCP configs are typically simple, and the non-goal of "supporting custom DCP config beyond `protectTags: true`" makes this acceptable.

### D11: Both files exist — prefer `.jsonc`

Expand Down
2 changes: 1 addition & 1 deletion openspec/changes/add-dcp-config/proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The function is independently callable — it does not require `Scaffold()` to r

**Assessment**: PASS

`ScaffoldDCP()` returns a `ScaffoldResult` with `Path` and `Action` fields (created/skipped/updated), matching the existing pattern used by `Scaffold()`. The init command renders these results using the same styled output. The DCP config file uses the standard JSON schema reference for validation.
`ScaffoldDCP()` returns a `ScaffoldResult` with `Path` and `Action` fields (created/skipped/overwritten), matching the existing pattern used by `Scaffold()`. The init command renders these results using the same styled output. The DCP config file uses the standard JSON schema reference for validation.

### IV. Testability

Expand Down
6 changes: 3 additions & 3 deletions openspec/changes/add-dcp-config/specs/scaffold-dcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The `agentkit` package MUST export a `ScaffoldDCP(targetDir string) (ScaffoldRes

- **GIVEN** a target directory with `.opencode/dcp.jsonc` that does not contain `"protectTags"`
- **WHEN** `ScaffoldDCP(targetDir)` is called
- **THEN** the file MUST be replaced with the canonical DCP config content (including `protectTags: true`), and the result action MUST be "updated"
- **THEN** the file MUST be replaced with the canonical DCP config content (including `protectTags: true`), and the result action MUST be "overwritten"

#### Scenario: Both `.dcp.jsonc` and `.dcp.json` exist

Expand All @@ -43,7 +43,7 @@ The scaffolded `.opencode/dcp.jsonc` MUST contain:

### Requirement: Init command integration

The `replicator init` command MUST call `ScaffoldDCP()` after `Scaffold()` and render the DCP result using the same styled output (green for created, dim for skipped, yellow for updated).
The `replicator init` command MUST call `ScaffoldDCP()` after `Scaffold()` and render the DCP result using the same styled output (green for created, dim for skipped, yellow for overwritten).

#### Scenario: `replicator init` on a fresh directory

Expand All @@ -59,7 +59,7 @@ The `replicator init` command MUST call `ScaffoldDCP()` after `Scaffold()` and r

### Requirement: ScaffoldDCP result shape

`ScaffoldDCP()` MUST return `(ScaffoldResult, error)` where `ScaffoldResult` has `Path` (string) and `Action` (string) fields. The `Action` field MUST be one of: "created", "skipped", "updated".
`ScaffoldDCP()` MUST return `(ScaffoldResult, error)` where `ScaffoldResult` has `Path` (string) and `Action` (string) fields. The `Action` field MUST be one of: "created", "skipped", "overwritten".

### Requirement: `.opencode/` directory creation

Expand Down