@applica-software-guru/sdd 1.0.3 → 1.3.1

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,11 @@
1
+ /**
2
+ * Returns the path to the bundled skills directory inside the CLI package.
3
+ * Works both in development (monorepo) and when installed globally.
4
+ */
5
+ export declare function getSkillsSourceDir(): string;
6
+ /**
7
+ * Copies all bundled skill files into <projectDir>/.claude/skills/.
8
+ * Safe to call on existing projects — overwrites with the latest version.
9
+ */
10
+ export declare function installSkills(projectDir: string): boolean;
11
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAOzD"}
package/dist/skills.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSkillsSourceDir = getSkillsSourceDir;
4
+ exports.installSkills = installSkills;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ /**
8
+ * Returns the path to the bundled skills directory inside the CLI package.
9
+ * Works both in development (monorepo) and when installed globally.
10
+ */
11
+ function getSkillsSourceDir() {
12
+ // __filename → <cli-pkg>/dist/skills.js → go up two levels to <cli-pkg>/
13
+ const cliPkgDir = (0, node_path_1.resolve)((0, node_path_1.dirname)(__filename), '..');
14
+ return (0, node_path_1.join)(cliPkgDir, 'skills');
15
+ }
16
+ /**
17
+ * Copies all bundled skill files into <projectDir>/.claude/skills/.
18
+ * Safe to call on existing projects — overwrites with the latest version.
19
+ */
20
+ function installSkills(projectDir) {
21
+ const src = getSkillsSourceDir();
22
+ if (!(0, node_fs_1.existsSync)(src))
23
+ return false;
24
+ const dest = (0, node_path_1.join)(projectDir, '.claude', 'skills');
25
+ (0, node_fs_1.cpSync)(src, dest, { recursive: true, force: true });
26
+ return true;
27
+ }
28
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":";;AAOA,gDAIC;AAMD,sCAOC;AAxBD,qCAA6C;AAC7C,yCAAmD;AAEnD;;;GAGG;AACH,SAAgB,kBAAkB;IAChC,yEAAyE;IACzE,MAAM,SAAS,GAAG,IAAA,mBAAO,EAAC,IAAA,mBAAO,EAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,OAAO,IAAA,gBAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,UAAkB;IAC9C,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IACjC,IAAI,CAAC,IAAA,oBAAU,EAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAEnC,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnD,IAAA,gBAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/sdd",
3
- "version": "1.0.3",
3
+ "version": "1.3.1",
4
4
  "description": "CLI for Story Driven Development",
5
5
  "author": "Bruno Fortunato <bruno.fortunato@applica.guru>",
6
6
  "main": "dist/index.js",
@@ -8,10 +8,12 @@
8
8
  "sdd": "./dist/index.js"
9
9
  },
10
10
  "scripts": {
11
+ "prebuild": "node -e \"require('fs').cpSync('../skill', 'skills', {recursive: true, force: true})\"",
11
12
  "build": "tsc"
12
13
  },
13
14
  "dependencies": {
14
15
  "@applica-software-guru/sdd-core": "^1.0.0",
16
+ "@applica-software-guru/sdd-ui": "^1.0.0",
15
17
  "@inquirer/prompts": "^7.0.0",
16
18
  "chalk": "^4.1.2",
17
19
  "cli-table3": "^0.6.5",
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: sdd
3
+ description: >
4
+ Story Driven Development workflow. Use when working in a project
5
+ with .sdd/config.yaml, or when the user mentions SDD, sdd sync,
6
+ story driven development, or spec-driven development.
7
+ license: MIT
8
+ compatibility: Requires sdd CLI (npm i -g @applica-software-guru/sdd)
9
+ allowed-tools: Bash(sdd:*) Read Glob Grep
10
+ metadata:
11
+ author: applica-software-guru
12
+ version: "1.0"
13
+ ---
14
+
15
+ # SDD — Story Driven Development
16
+
17
+ ## Detection
18
+
19
+ This project uses SDD if `.sdd/config.yaml` exists in the project root.
20
+
21
+ ## Workflow
22
+
23
+ Follow this loop every time you work on an SDD project:
24
+
25
+ 1. Run `sdd bug open` — check if there are open bugs to fix first
26
+ 2. If there are open bugs, fix the code/docs, then run `sdd mark-bug-resolved`
27
+ 3. Run `sdd cr pending` — check if there are change requests to process
28
+ 4. If there are pending CRs, apply them to the docs, then run `sdd mark-cr-applied`
29
+ 5. Run `sdd sync` to see what needs to be implemented
30
+ 6. Read the documentation files listed in the sync output
31
+ 7. Implement what each file describes, writing code inside `code/`
32
+ 8. After implementing, mark files as synced:
33
+
34
+ ```
35
+ sdd mark-synced product/features/auth.md
36
+ ```
37
+
38
+ Or mark all pending files at once:
39
+
40
+ ```
41
+ sdd mark-synced
42
+ ```
43
+
44
+ 9. **Commit immediately after mark-synced** — this is mandatory:
45
+
46
+ ```
47
+ git add -A && git commit -m "sdd sync: <brief description of what was implemented>"
48
+ ```
49
+
50
+ Do NOT skip this step. Every mark-synced must be followed by a git commit.
51
+
52
+ ### Removing a feature
53
+
54
+ If a documentation file has `status: deleted`, it means that feature should be removed.
55
+ Delete the related code in `code/`, then run `sdd mark-synced <file>` (the doc file will be removed automatically), then commit.
56
+
57
+ ## Available commands
58
+
59
+ - `sdd status` — See all documentation files and their state (new/changed/deleted/synced)
60
+ - `sdd diff` — See what changed since last sync
61
+ - `sdd sync` — Get the sync prompt for pending files (includes git diff for changed files)
62
+ - `sdd validate` — Check for broken references and issues
63
+ - `sdd mark-synced [files...]` — Mark specific files (or all) as synced
64
+ - `sdd cr list` — List all change requests with their status
65
+ - `sdd cr pending` — Show draft change requests to process
66
+ - `sdd mark-cr-applied [files...]` — Mark change requests as applied
67
+ - `sdd bug list` — List all bugs with their status
68
+ - `sdd bug open` — Show open bugs to fix
69
+ - `sdd mark-bug-resolved [files...]` — Mark bugs as resolved
70
+
71
+ ## Rules
72
+
73
+ 1. **Always commit after mark-synced** — run `git add -A && git commit -m "sdd sync: ..."` immediately after `sdd mark-synced`. Never leave synced files uncommitted.
74
+ 2. Before running `sdd sync`, check for open bugs with `sdd bug open` and pending change requests with `sdd cr pending`
75
+ 3. If there are pending CRs, apply them to the docs first, then mark them with `sdd mark-cr-applied`
76
+ 4. Only implement what the sync prompt asks for
77
+ 5. All generated code goes inside `code/`
78
+ 6. Respect all constraints in `## Agent Notes` sections (if present)
79
+ 7. Do not edit files inside `.sdd/` manually
80
+
81
+ ## Project structure
82
+
83
+ - `product/` — What to build (vision, users, features)
84
+ - `system/` — How to build it (entities, architecture, tech stack, interfaces)
85
+ - `code/` — All generated source code goes here
86
+ - `change-requests/` — Change requests to the documentation
87
+ - `bugs/` — Bug reports
88
+ - `.sdd/` — Project config and sync state (do not edit)
89
+
90
+ ## References
91
+
92
+ For detailed information on specific topics, see:
93
+
94
+ - [File format and status lifecycle](references/file-format.md)
95
+ - [Change Requests workflow](references/change-requests.md)
96
+ - [Bug workflow](references/bugs.md)
97
+ - [UI Component workflow](../sdd-ui/SKILL.md)
@@ -0,0 +1,29 @@
1
+ # Bugs
2
+
3
+ Bugs are markdown files in `bugs/` that describe problems found in the codebase.
4
+
5
+ ## Bug format
6
+
7
+ ```yaml
8
+ ---
9
+ title: "Login fails with empty password"
10
+ status: open
11
+ author: "user"
12
+ created-at: "2025-01-01T00:00:00.000Z"
13
+ ---
14
+ ```
15
+
16
+ - **status**: `open` (needs fixing) or `resolved` (already fixed)
17
+
18
+ ## Bug workflow
19
+
20
+ 1. Check for open bugs: `sdd bug open`
21
+ 2. Read each open bug and fix the code and/or documentation
22
+ 3. After fixing a bug, mark it: `sdd mark-bug-resolved bugs/BUG-001.md`
23
+ 4. Commit the fix
24
+
25
+ ## Bug commands
26
+
27
+ - `sdd bug list` — See all bugs and their status
28
+ - `sdd bug open` — Show only open bugs to fix
29
+ - `sdd mark-bug-resolved [files...]` — Mark bugs as resolved after fixing
@@ -0,0 +1,29 @@
1
+ # Change Requests
2
+
3
+ Change Requests (CRs) are markdown files in `change-requests/` that describe modifications to the documentation.
4
+
5
+ ## CR format
6
+
7
+ ```yaml
8
+ ---
9
+ title: "Add authentication feature"
10
+ status: draft
11
+ author: "user"
12
+ created-at: "2025-01-01T00:00:00.000Z"
13
+ ---
14
+ ```
15
+
16
+ - **status**: `draft` (pending) or `applied` (already processed)
17
+
18
+ ## CR workflow
19
+
20
+ 1. Check for pending CRs: `sdd cr pending`
21
+ 2. Read each pending CR and apply the described changes to the documentation files (marking them as `new`, `changed`, or `deleted`)
22
+ 3. After applying a CR to the docs, mark it: `sdd mark-cr-applied change-requests/CR-001.md`
23
+ 4. Then run `sdd sync` to implement the code changes
24
+
25
+ ## CR commands
26
+
27
+ - `sdd cr list` — See all change requests and their status
28
+ - `sdd cr pending` — Show only draft CRs to process
29
+ - `sdd mark-cr-applied [files...]` — Mark CRs as applied after updating the docs
@@ -0,0 +1,65 @@
1
+ # File Format and Status Lifecycle
2
+
3
+ ## YAML Frontmatter
4
+
5
+ Every `.md` file in `product/` and `system/` must start with this YAML frontmatter:
6
+
7
+ ```yaml
8
+ ---
9
+ title: "File title"
10
+ status: new
11
+ author: ""
12
+ last-modified: "2025-01-01T00:00:00.000Z"
13
+ version: "1.0"
14
+ ---
15
+ ```
16
+
17
+ ## Status values
18
+
19
+ - **`new`** — new file, needs to be implemented
20
+ - **`changed`** — modified since last sync, code needs updating
21
+ - **`deleted`** — feature to be removed, agent should delete related code
22
+ - **`synced`** — already implemented, up to date
23
+
24
+ ## Version
25
+
26
+ Patch-bump on each edit: 1.0 → 1.1 → 1.2
27
+
28
+ ## Last-modified
29
+
30
+ ISO 8601 datetime, updated on each edit.
31
+
32
+ ## How sync works
33
+
34
+ `sdd sync` generates a structured prompt for the agent based on pending files:
35
+
36
+ - **`new` files**: the agent reads the full documentation and implements it from scratch
37
+ - **`changed` files**: SDD uses `git diff` to compute what changed in the documentation since the last commit, and includes the diff in the sync prompt — this way the agent sees exactly what was modified and can update only the affected code
38
+ - **`deleted` files**: the agent removes the related code
39
+
40
+ This is why **committing after every mark-synced is mandatory** — the git history is what SDD uses to detect changes.
41
+
42
+ ## UX and screenshots
43
+
44
+ When a feature has UX mockups or screenshots, place them next to the feature doc:
45
+
46
+ - **Simple feature** (no screenshots): `product/features/auth.md`
47
+ - **Feature with screenshots**: use a folder with `index.md`:
48
+
49
+ ```
50
+ product/features/auth/
51
+ index.md ← feature doc
52
+ login.png ← screenshot
53
+ register.png ← screenshot
54
+ ```
55
+
56
+ Reference images in the markdown with relative paths:
57
+
58
+ ```markdown
59
+ ## UX
60
+
61
+ ![Login screen](login.png)
62
+ ![Register screen](register.png)
63
+ ```
64
+
65
+ Both formats work — use a folder only when you have screenshots or multiple files for a feature.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: sdd-ui
3
+ description: >
4
+ UI Component Editor workflow. Use when the user wants to implement a React component
5
+ from a screenshot in an SDD project, iterating visually with live preview.
6
+ license: MIT
7
+ compatibility: >
8
+ Requires sdd CLI (npm i -g @applica-software-guru/sdd).
9
+ Requires Playwright MCP configured in Claude Code
10
+ (e.g. @playwright/mcp or @executeautomation/playwright-mcp).
11
+ allowed-tools: Bash(sdd:*) Read Glob Grep Edit Write mcp__playwright__screenshot mcp__playwright__navigate mcp__playwright__click
12
+ metadata:
13
+ author: applica-software-guru
14
+ version: "1.1"
15
+ ---
16
+
17
+ # SDD UI — Visual Component Editor
18
+
19
+ ## Purpose
20
+
21
+ Use this workflow when implementing a React component from a screenshot reference in an SDD project.
22
+ The split-panel editor shows the spec screenshot on the left and the live component on the right,
23
+ so you can iterate visually until they match.
24
+
25
+ ## Prerequisites
26
+
27
+ - `sdd` CLI installed globally
28
+ - Playwright MCP configured in Claude Code settings
29
+ - e.g. `@playwright/mcp` or `@executeautomation/playwright-mcp`
30
+ - If not configured, inform the user and stop — visual feedback won't work without it
31
+
32
+ ## Workflow
33
+
34
+ ### Step 1 — Read the spec
35
+
36
+ Read the SDD feature file to understand what the component should look like and do.
37
+ Look for any screenshot paths referenced in the feature doc.
38
+
39
+ ### Step 2 — Launch the editor
40
+
41
+ ```bash
42
+ # Single screenshot — detached (recommended when run by an agent)
43
+ sdd ui launch-editor LoginForm \
44
+ --screenshot product/features/auth/login.png \
45
+ --detach
46
+
47
+ # Multiple screenshots (e.g. desktop + mobile)
48
+ sdd ui launch-editor LoginForm \
49
+ --screenshot product/features/auth/login-desktop.png \
50
+ --screenshot product/features/auth/login-mobile.png \
51
+ --detach
52
+ ```
53
+
54
+ The command will:
55
+ - Scaffold `code/components/LoginForm.tsx` if it doesn't exist
56
+ - Print the exact component file path to edit
57
+ - Start the editor at `http://localhost:5174`
58
+
59
+ With `--detach` the process runs in background and the terminal is immediately free.
60
+ Without `--detach` it runs in foreground (use Ctrl+C to stop).
61
+
62
+ With multiple screenshots, the left panel shows a tab per screenshot.
63
+ With a single screenshot, no tab bar is shown.
64
+
65
+ ### Step 3 — Implement the component
66
+
67
+ Edit the file printed by `sdd ui launch-editor` (e.g. `code/components/LoginForm.tsx`).
68
+
69
+ Write a React component that matches the screenshot. Use standard HTML/CSS or inline styles —
70
+ no external UI library unless the project already uses one.
71
+
72
+ Vite HMR will update the right panel automatically on every save.
73
+
74
+ ### Step 4 — Visual check with Playwright
75
+
76
+ After each save, screenshot the live preview and compare it with the spec:
77
+
78
+ ```
79
+ mcp__playwright__navigate http://localhost:5174
80
+ mcp__playwright__screenshot
81
+ ```
82
+
83
+ The left panel already shows the spec screenshot for direct comparison.
84
+ Note differences in layout, spacing, typography, colors, and component structure.
85
+
86
+ ### Step 5 — Iterate
87
+
88
+ Edit component → Playwright screenshot → compare → repeat until the preview matches the spec.
89
+
90
+ ### Step 6 — Finalize
91
+
92
+ ```bash
93
+ sdd ui stop
94
+ sdd mark-synced product/features/auth/login.md
95
+ git add -A && git commit -m "sdd sync: implement LoginForm component"
96
+ ```
97
+
98
+ ## Notes
99
+
100
+ - The component file is permanent — it lives in `code/components/` and is part of your project
101
+ - Port `5174` by default (not `5173`) to avoid conflicts with the user's app dev server
102
+ - If the component needs props, scaffold it with hardcoded sample data for the preview
103
+
104
+ ## Troubleshooting
105
+
106
+ **Playwright MCP not configured:**
107
+ Stop and ask the user to add it to their Claude Code MCP settings before continuing.
108
+
109
+ **Component import fails in preview:**
110
+ Check that the component file has a valid default export and no TypeScript errors.
111
+
112
+ **Port already in use:**
113
+ `sdd ui launch-editor LoginForm --screenshot login.png --port 5175`
@@ -0,0 +1,108 @@
1
+ import { Command } from "commander";
2
+ import { SDD, SKILL_ADAPTERS } from "@applica-software-guru/sdd-core";
3
+ import { heading, info, success, warning } from "../ui/format.js";
4
+
5
+ function parseAgents(value: string): string[] {
6
+ return value
7
+ .split(",")
8
+ .map((v) => v.trim().toLowerCase())
9
+ .filter(Boolean);
10
+ }
11
+
12
+ export function registerAdapters(program: Command): void {
13
+ const adapters = program
14
+ .command("adapters")
15
+ .description("Manage AI agent skill adapters");
16
+
17
+ adapters
18
+ .command("list")
19
+ .description("List supported adapters with mode and target file paths")
20
+ .action(() => {
21
+ console.log(heading("Supported Adapters"));
22
+ for (const adapter of SKILL_ADAPTERS) {
23
+ console.log(info(`${adapter.id} (${adapter.mode})`));
24
+ for (const skill of adapter.skills) {
25
+ console.log(` ${skill.skillId}:`);
26
+ for (const path of skill.paths) {
27
+ console.log(` - ${path}`);
28
+ }
29
+ }
30
+ }
31
+ console.log("");
32
+ });
33
+
34
+ adapters
35
+ .command("sync")
36
+ .description("Create or update skill adapters for supported agents")
37
+ .option(
38
+ "--agents <list>",
39
+ "Comma-separated adapter ids (for example: claude,copilot,cursor)",
40
+ )
41
+ .option("--all", "Configure all supported adapters")
42
+ .option("--dry-run", "Show what would change without writing files")
43
+ .option("--force", "Overwrite existing adapter files when content differs")
44
+ .action(
45
+ async (options: {
46
+ agents?: string;
47
+ all?: boolean;
48
+ dryRun?: boolean;
49
+ force?: boolean;
50
+ }) => {
51
+ const sdd = new SDD({ root: process.cwd() });
52
+ const supported = sdd.supportedAdapters();
53
+ const selectedAgents =
54
+ options.all || !options.agents
55
+ ? undefined
56
+ : parseAgents(options.agents);
57
+
58
+ if (selectedAgents && selectedAgents.length === 0) {
59
+ console.log(warning("No valid adapter id was provided."));
60
+ console.log(info(`Supported adapters: ${supported.join(", ")}`));
61
+ return;
62
+ }
63
+
64
+ const result = await sdd.syncAdapters({
65
+ agents: selectedAgents,
66
+ dryRun: options.dryRun,
67
+ force: options.force,
68
+ });
69
+
70
+ const allChanges = [...result.canonical, ...result.adapters];
71
+ const created = allChanges.filter((c) => c.action === "created");
72
+ const updated = allChanges.filter((c) => c.action === "updated");
73
+ const skipped = allChanges.filter((c) => c.action === "skipped");
74
+
75
+ console.log(heading("Adapters Sync"));
76
+ console.log(info(`Selected: ${result.selectedAgents.join(", ")}`));
77
+ if (options.dryRun) {
78
+ console.log(info("Dry run mode enabled. No files were written."));
79
+ }
80
+ console.log("");
81
+
82
+ for (const change of created) {
83
+ console.log(success(change.path));
84
+ }
85
+ for (const change of updated) {
86
+ console.log(success(`${change.path} (updated)`));
87
+ }
88
+ for (const change of skipped) {
89
+ const reason = change.reason ? ` — ${change.reason}` : "";
90
+ console.log(warning(`${change.path}${reason}`));
91
+ }
92
+
93
+ console.log("");
94
+ console.log(
95
+ info(
96
+ `Created: ${created.length} Updated: ${updated.length} Skipped: ${skipped.length}`,
97
+ ),
98
+ );
99
+ console.log(info(`Supported adapters: ${supported.join(", ")}`));
100
+ console.log(
101
+ info(
102
+ "Run `sdd adapters list` to inspect adapter modes and target paths.",
103
+ ),
104
+ );
105
+ console.log("");
106
+ },
107
+ );
108
+ }