opensddrag 0.1.2 → 0.2.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.
@@ -0,0 +1,94 @@
1
+ import { harnessChecklistBlock } from "./_shared.js";
2
+
3
+ export const specSkill = {
4
+ name: "opensddrag-spec",
5
+ description:
6
+ "Write capability specs with SHALL/MUST requirements and WHEN/THEN scenarios",
7
+ body: (slug, note) => `# OpenSddRag — Spec
8
+ ${note}## When to use
9
+ After a proposal exists, to formalize each capability into a spec artifact with SHALL/MUST
10
+ requirements and WHEN/THEN scenarios. Each capability in the proposal gets its own spec.
11
+
12
+ ## Inputs
13
+ $ARGUMENTS = change name. If not provided, list proposals and ask which one.
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1 — Read the proposal
18
+ \`list_artifacts(type="proposal", project_slug="${slug}")\`
19
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
20
+
21
+ ### Step 2 — Identify capabilities
22
+ Parse "## Capabilities". Every capability in "New Capabilities" and "Modified Capabilities" needs a spec.
23
+ - **New capability** → full spec (Purpose + Requirements + Scenarios).
24
+ - **Modified capability** → check for an existing main spec: \`search_semantic(query="<capability> spec", project_slug="${slug}", limit=3)\`.
25
+ - If a main spec exists → create a DELTA spec (ADDED/MODIFIED/REMOVED/RENAMED).
26
+ - If no main spec → create BOTH the main spec (is_delta=false) and the delta spec (is_delta=true).
27
+
28
+ ### Step 3 — Write spec content for each capability
29
+
30
+ Full spec structure (new capabilities):
31
+ \`\`\`markdown
32
+ # <capability> Specification
33
+
34
+ ## Purpose
35
+ [High-level description]
36
+
37
+ ## Requirements
38
+
39
+ ### Requirement: REQ-001 <Name>
40
+ [Description using SHALL/MUST language]
41
+
42
+ #### Scenario: <Happy path>
43
+ - **WHEN** [condition]
44
+ - **THEN** [expected outcome]
45
+
46
+ #### Scenario: <Edge case>
47
+ - **WHEN** [edge condition]
48
+ - **THEN** [expected outcome]
49
+ \`\`\`
50
+
51
+ Delta spec structure (modified capabilities):
52
+ \`\`\`markdown
53
+ # <capability> Specification — Delta
54
+
55
+ ## ADDED Requirements
56
+ ### Requirement: <New name>
57
+ [Full requirement with scenarios]
58
+
59
+ ## MODIFIED Requirements
60
+ ### Requirement: <Existing name>
61
+ [Full updated text with all scenarios]
62
+
63
+ ## REMOVED Requirements
64
+ ### Requirement: <Removed name>
65
+ **Reason:** [why] · **Migration:** [how consumers migrate]
66
+
67
+ ## RENAMED Requirements
68
+ - FROM: \`### Requirement: Old Name\`
69
+ - TO: \`### Requirement: New Name\`
70
+ \`\`\`
71
+
72
+ ### Step 4 — Save each spec
73
+ \`create_artifact(name="<change-name>-<capability>-spec", type="spec", content="<full spec markdown>", metadata={"change_name": "<change-name>", "capability": "<capability>", "is_delta": true|false}, project_slug="${slug}")\`
74
+
75
+ ### Step 5 — Link each spec to the proposal
76
+ \`link_artifacts(source_name="<spec>", target_name="<change-name>-proposal", relationship_type="implements", project_slug="${slug}")\`
77
+
78
+ ### Step 6 — Validate each spec
79
+ \`validate_artifact(name="<spec>", project_slug="${slug}")\` — fix any validation errors before continuing.
80
+
81
+ ${harnessChecklistBlock(slug, "on_spec", "Saving specs to the database")}
82
+ ### Step 7 — Record the action
83
+ \`record_trace(action="spec", result_summary="Created specs for: <capability-list>", project_slug="${slug}")\`
84
+
85
+ ## Output
86
+ - One spec artifact per capability (full and/or delta) linked to the proposal.
87
+ - **Unlocks:** /opsr:design once all capabilities have specs.
88
+
89
+ ## Important rules
90
+ - Every requirement MUST have at least one WHEN/THEN scenario.
91
+ - Delta specs MUST carry metadata.is_delta=true so /opsr:sync can merge them later.
92
+ - Run the harness checklist (on_spec) before declaring specs done.
93
+ `,
94
+ };
@@ -0,0 +1,66 @@
1
+ export const statusSkill = {
2
+ name: "opensddrag-status",
3
+ description: "Show current state of all in-progress changes",
4
+ body: (slug, note) => `# OpenSddRag — Status
5
+ ${note}## When to use
6
+ To show the current state of all in-progress changes for this project: artifact completion,
7
+ task progress, and recent activity. Reads from the MCP server — no local files involved.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = optional change name to show details for a single change. If absent, show all.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Load working context
15
+ \`get_working_context(project_slug="${slug}")\`
16
+ This also surfaces any \`trigger="always"\` harness rules — read them first.
17
+
18
+ ### Step 2 — List artifacts by type and status
19
+ \`list_artifacts(type="proposal", status="active", project_slug="${slug}")\`
20
+ \`list_artifacts(type="proposal", status="draft", project_slug="${slug}")\`
21
+ \`list_artifacts(type="spec", status="active", project_slug="${slug}")\`
22
+ \`list_artifacts(type="design", status="active", project_slug="${slug}")\`
23
+ \`list_artifacts(type="task", status="active", project_slug="${slug}")\`
24
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
25
+
26
+ ### Step 3 — Recall recent activity
27
+ \`recall_episodes(query="recent actions in this project", project_slug="${slug}", limit=5)\`
28
+
29
+ ### Step 4 — Present a structured status
30
+ For each active change, show:
31
+ \`\`\`
32
+ ## Change: <change-name>
33
+ | Artifact | Status |
34
+ |----------|--------|
35
+ | Proposal | ✓ done |
36
+ | Specs | ✓ 2/2 |
37
+ | Design | ✓ done |
38
+ | Tasks | 3/5 done |
39
+
40
+ Current task: <task-name>
41
+ Next step: /opsr:apply <change-name>
42
+ \`\`\`
43
+ Then show recent activity (last 5 episodes) and a suggested next command based on the state.
44
+
45
+ ### Step 5 — Suggest the next command
46
+ Map the change's state to the next action:
47
+ - proposal only → /opsr:spec
48
+ - specs but no design → /opsr:design
49
+ - design but no tasks → /opsr:tasks
50
+ - tasks with drafts remaining → /opsr:apply
51
+ - all tasks archived → /opsr:verify then /opsr:archive
52
+
53
+ ## Reading the working context
54
+ \`get_working_context\` returns \`current_task\` and the ordered \`tasks\` list — use them to compute
55
+ "N/M done" and to name the in-flight task. It also returns always-trigger harness rules; show
56
+ those at the top so the user starts every session aware of the project's constraints.
57
+
58
+ ## Output
59
+ - A per-change status table, recent activity, and the recommended next command.
60
+
61
+ ## Important rules
62
+ - Read-only — never modify artifacts from status.
63
+ - If a specific change is requested, scope all lists to that change via metadata.change_name.
64
+ - Always surface always-trigger harness rules from the working context.
65
+ `,
66
+ };
@@ -0,0 +1,65 @@
1
+ export const syncSkill = {
2
+ name: "opensddrag-sync",
3
+ description: "Merge delta specs back into main capability specs",
4
+ body: (slug, note) => `# OpenSddRag — Sync
5
+ ${note}## When to use
6
+ To merge delta specs (ADDED/MODIFIED/REMOVED/RENAMED) into the main specs stored in the database.
7
+ Delta specs are created by /opsr:spec for MODIFIED capabilities. Runs automatically during /opsr:archive.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = change name.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Find delta specs for this change
15
+ \`list_artifacts(type="spec", project_slug="${slug}")\`
16
+ Filter where metadata.change_name = "<change-name>" AND metadata.is_delta = true.
17
+
18
+ ### Step 2 — For each delta, find the main spec
19
+ \`search_semantic(query="<capability> spec", project_slug="${slug}", limit=5)\`
20
+ Find the spec for the same capability where metadata.is_delta = false (or unset).
21
+
22
+ ### Step 3 — Apply delta operations to the main spec
23
+ \`read_artifact(name="<delta-spec>", project_slug="${slug}")\`
24
+ \`read_artifact(name="<main-spec>", project_slug="${slug}")\`
25
+ Apply each delta section:
26
+ - **## ADDED Requirements** → confirm the requirement does NOT exist, then append it (with scenarios).
27
+ - **## MODIFIED Requirements** → find by name and apply ONLY the changed parts (partial update, not wholesale replace).
28
+ - **## REMOVED Requirements** → remove the requirement block; note the Reason/Migration in a comment.
29
+ - **## RENAMED Requirements** → change the heading FROM the old name TO the new name.
30
+
31
+ ### Step 4 — Save the updated main spec
32
+ \`update_artifact(name="<main-spec>", content="<merged spec content>", project_slug="${slug}")\`
33
+
34
+ ### Step 5 — Archive the delta spec
35
+ \`update_artifact(name="<delta-spec>", status="archived", metadata={"synced_at": "<ISO timestamp>", "merged_into": "<main-spec>"}, project_slug="${slug}")\`
36
+
37
+ ### Step 6 — Record the sync
38
+ \`record_trace(action="sync", result_summary="Synced delta for capability: <capability> into main spec", project_slug="${slug}")\`
39
+ Tell the user which capabilities were updated.
40
+
41
+ ## Worked example — a MODIFIED merge
42
+ Delta says:
43
+ \`\`\`markdown
44
+ ## MODIFIED Requirements
45
+ ### Requirement: REQ-002 Token issuance
46
+ [adds a new scenario for refresh tokens]
47
+ \`\`\`
48
+ Main spec already has REQ-002 with two scenarios. Correct merge = keep the existing two scenarios
49
+ and APPEND the new refresh-token scenario under the same requirement heading. Do NOT replace the
50
+ whole REQ-002 block — that would silently drop the original scenarios.
51
+
52
+ ## When NOT to sync
53
+ - The delta is still being edited (run /opsr:spec to completion first).
54
+ - No main spec exists yet for the capability — then there is nothing to merge into; the delta
55
+ IS the spec until a main is created.
56
+
57
+ ## Output
58
+ - Main spec artifacts updated to reflect all deltas; delta specs archived with a merge pointer.
59
+
60
+ ## Important rules
61
+ - MODIFIED requirements get partial, intelligent merges — never blind whole-section replacement.
62
+ - Always archive the delta after merging so it is not re-applied.
63
+ - Preserve REMOVED requirements' Reason/Migration as a note for future readers.
64
+ `,
65
+ };
@@ -0,0 +1,70 @@
1
+ export const tasksSkill = {
2
+ name: "opensddrag-tasks",
3
+ description: "Break a design into atomic, verifiable implementation tasks",
4
+ body: (slug, note) => `# OpenSddRag — Tasks
5
+ ${note}## When to use
6
+ After the design exists, to decompose specs + design into atomic, verifiable task artifacts.
7
+ Each task maps to one or more spec requirements (REQ-NNN) and is completable in under 4 hours.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = change name.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Read all planning artifacts
15
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
16
+ \`read_artifact(name="<change-name>-design", project_slug="${slug}")\`
17
+ \`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`
18
+ Read each linked spec artifact.
19
+
20
+ ### Step 2 — Plan task groups
21
+ Group tasks by logical phase. Each task MUST have:
22
+ - A clear **Goal** (what it accomplishes).
23
+ - **Acceptance criteria** referencing spec REQ-NNN items (not vague).
24
+ - **Dependencies** on other tasks (if any).
25
+ - Estimated effort: < 4 hours.
26
+
27
+ ### Step 3 — Create each task artifact
28
+ Name each as \`<change-name>-task-<group>-<N>\`:
29
+ \`create_artifact(name="<change-name>-task-<group>-<N>", type="task", content="## Goal\\n<what this task accomplishes>\\n\\n## Acceptance Criteria\\n- [ ] REQ-NNN: <criterion>\\n- [ ] <criterion>\\n\\n## Dependencies\\n- <other task name or 'none'>", metadata={"change_name": "<change-name>", "group": "<group>", "order": <N>}, project_slug="${slug}")\`
30
+
31
+ ### Step 4 — Link each task to its spec(s)
32
+ \`link_artifacts(source_name="<task-name>", target_name="<spec-name>", relationship_type="implements", project_slug="${slug}")\`
33
+
34
+ ### Step 5 — Update working context with the task list
35
+ \`update_working_context(context={"change_name": "<change-name>", "tasks": ["<task-1>", "<task-2>", "..."], "current_task": null}, project_slug="${slug}")\`
36
+
37
+ ### Step 6 — Record and show next steps
38
+ \`record_trace(action="tasks", result_summary="Created <N> tasks for <change-name>", project_slug="${slug}")\`
39
+ Show the full task list with names and goals, then tell the user:
40
+ "Tasks saved. Run /opsr:apply <change-name> to start implementing."
41
+
42
+ ## Example task artifact
43
+ \`\`\`markdown
44
+ ## Goal
45
+ Add a POST /sessions endpoint that issues a JWT for valid credentials.
46
+
47
+ ## Acceptance Criteria
48
+ - [ ] REQ-002: Endpoint returns 200 + token for valid credentials
49
+ - [ ] REQ-003: Endpoint returns 401 for invalid credentials
50
+ - [ ] Unit tests cover both scenarios
51
+
52
+ ## Dependencies
53
+ - <change>-task-db-1 (users table migration)
54
+ \`\`\`
55
+
56
+ Ordering tip: number tasks within a group (\`-task-<group>-<N>\`) so /opsr:apply can walk them
57
+ in dependency order. Put migrations and shared scaffolding first, feature work next, tests last
58
+ (or alongside, if the team writes tests with the code).
59
+
60
+ ## Output
61
+ - One task artifact per unit of work, each linked to its spec(s).
62
+ - Working context updated with the ordered task list.
63
+ - **Unlocks:** /opsr:apply.
64
+
65
+ ## Important rules
66
+ - Acceptance criteria MUST reference concrete REQ-NNN items — never "implement the feature".
67
+ - Keep each task < 4 hours; split anything larger.
68
+ - Tasks are individual database artifacts — NOT a single markdown checklist file.
69
+ `,
70
+ };
@@ -0,0 +1,74 @@
1
+ import { harnessChecklistBlock } from "./_shared.js";
2
+
3
+ export const verifySkill = {
4
+ name: "opensddrag-verify",
5
+ description:
6
+ "Validate implementation against spec requirements and design decisions",
7
+ body: (slug, note) => `# OpenSddRag — Verify
8
+ ${note}## When to use
9
+ After all tasks are implemented, to validate the implementation against spec requirements and
10
+ design decisions. Read-only — produces a structured report and modifies no artifacts.
11
+
12
+ ## Inputs
13
+ $ARGUMENTS = change name.
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1 — Load all artifacts
18
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
19
+ \`read_artifact(name="<change-name>-design", project_slug="${slug}")\`
20
+ \`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`
21
+ Read each linked spec and task artifact.
22
+
23
+ ### Step 2 — Verify COMPLETENESS
24
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
25
+ - If pending tasks exist → **CRITICAL: Tasks not complete**.
26
+ Extract every REQ-NNN from the specs and search the codebase for implementation evidence.
27
+ - If a requirement has no evidence → **CRITICAL: Requirement not implemented**.
28
+
29
+ ### Step 3 — Verify CORRECTNESS
30
+ For each spec scenario (WHEN/THEN), search for test coverage or implementation of the condition.
31
+ - If a scenario has no coverage → **WARNING: Scenario not covered**.
32
+
33
+ ### Step 4 — Verify COHERENCE
34
+ Extract decisions from the design's "## Decisions" section. For each:
35
+ - Check the implementation follows the chosen approach.
36
+ - If it deviates → **SUGGESTION: Possible deviation from design**.
37
+
38
+ ${harnessChecklistBlock(slug, "on_verify", "Declaring verification complete")}
39
+ ### Step 5 — Generate the report
40
+ \`\`\`
41
+ ## Verification Report: <change-name>
42
+
43
+ ### Summary
44
+ | Dimension | Status |
45
+ |--------------|--------|
46
+ | Completeness | ✓/✗ |
47
+ | Correctness | ✓/✗ |
48
+ | Coherence | ✓/✗ |
49
+
50
+ ### CRITICAL Issues
51
+ - [Issue]
52
+
53
+ ### WARNING Issues
54
+ - [Issue]
55
+
56
+ ### SUGGESTIONS
57
+ - [Issue]
58
+
59
+ ### Assessment
60
+ [READY TO ARCHIVE | ISSUES MUST BE FIXED BEFORE ARCHIVING]
61
+ \`\`\`
62
+
63
+ ### Step 6 — Record the verification
64
+ \`record_trace(action="verify", result_summary="Verification: <PASS/FAIL> — <N> critical, <N> warnings", project_slug="${slug}")\`
65
+
66
+ ## Output
67
+ - A structured verification report (CRITICAL / WARNING / SUGGESTION). No artifacts are modified.
68
+
69
+ ## Important rules
70
+ - This phase is READ-ONLY for artifacts — never change task or spec status here.
71
+ - Run the harness checklist (on_verify) before declaring verification complete.
72
+ - A change is not ready to archive while any CRITICAL issue remains.
73
+ `,
74
+ };