@xenonbyte/da-vinci-workflow 0.1.2

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 (48) hide show
  1. package/README.md +306 -0
  2. package/SKILL.md +377 -0
  3. package/agents/openai.yaml +7 -0
  4. package/bin/da-vinci.js +8 -0
  5. package/commands/claude/da-vinci.md +23 -0
  6. package/commands/claude/dv/breakdown.md +21 -0
  7. package/commands/claude/dv/build.md +17 -0
  8. package/commands/claude/dv/design.md +20 -0
  9. package/commands/claude/dv/tasks.md +19 -0
  10. package/commands/claude/dv/verify.md +16 -0
  11. package/commands/codex/prompts/da-vinci.md +24 -0
  12. package/commands/codex/prompts/dv-breakdown.md +19 -0
  13. package/commands/codex/prompts/dv-build.md +13 -0
  14. package/commands/codex/prompts/dv-design.md +14 -0
  15. package/commands/codex/prompts/dv-tasks.md +16 -0
  16. package/commands/codex/prompts/dv-verify.md +15 -0
  17. package/commands/gemini/da-vinci.toml +26 -0
  18. package/commands/gemini/dv/breakdown.toml +19 -0
  19. package/commands/gemini/dv/build.toml +13 -0
  20. package/commands/gemini/dv/design.toml +14 -0
  21. package/commands/gemini/dv/tasks.toml +13 -0
  22. package/commands/gemini/dv/verify.toml +15 -0
  23. package/docs/workflow-examples.md +104 -0
  24. package/examples/greenfield-spec-markupflow/README.md +40 -0
  25. package/examples/greenfield-spec-markupflow/design-brief.md +24 -0
  26. package/examples/greenfield-spec-markupflow/design-registry.md +15 -0
  27. package/examples/greenfield-spec-markupflow/design.md +32 -0
  28. package/examples/greenfield-spec-markupflow/page-map.md +19 -0
  29. package/examples/greenfield-spec-markupflow/pencil-bindings.md +13 -0
  30. package/examples/greenfield-spec-markupflow/pencil-design.md +29 -0
  31. package/examples/greenfield-spec-markupflow/proposal.md +33 -0
  32. package/examples/greenfield-spec-markupflow/site/index.html +192 -0
  33. package/examples/greenfield-spec-markupflow/site/product-detail.html +165 -0
  34. package/examples/greenfield-spec-markupflow/specs/marketing-site/spec.md +37 -0
  35. package/examples/greenfield-spec-markupflow/tasks.md +28 -0
  36. package/examples/greenfield-spec-markupflow/verification.md +37 -0
  37. package/lib/cli.js +100 -0
  38. package/lib/install.js +286 -0
  39. package/package.json +31 -0
  40. package/references/artifact-templates.md +364 -0
  41. package/references/checkpoints.md +141 -0
  42. package/references/design-inputs.md +55 -0
  43. package/references/modes.md +84 -0
  44. package/references/page-mapping.md +47 -0
  45. package/references/pencil-design-to-code.md +64 -0
  46. package/references/platform-adapters.md +66 -0
  47. package/scripts/postinstall.js +9 -0
  48. package/scripts/validate-assets.js +9 -0
package/lib/install.js ADDED
@@ -0,0 +1,286 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const os = require("os");
4
+
5
+ const REPO_ROOT = path.resolve(__dirname, "..");
6
+ const PACKAGE_JSON = require(path.join(REPO_ROOT, "package.json"));
7
+ const VERSION = PACKAGE_JSON.version;
8
+
9
+ const REQUIRED_FILES = [
10
+ "SKILL.md",
11
+ "README.md",
12
+ "agents/openai.yaml",
13
+ "commands/claude/da-vinci.md",
14
+ "commands/claude/dv/breakdown.md",
15
+ "commands/claude/dv/build.md",
16
+ "commands/claude/dv/design.md",
17
+ "commands/claude/dv/tasks.md",
18
+ "commands/claude/dv/verify.md",
19
+ "commands/codex/prompts/da-vinci.md",
20
+ "commands/codex/prompts/dv-breakdown.md",
21
+ "commands/codex/prompts/dv-build.md",
22
+ "commands/codex/prompts/dv-design.md",
23
+ "commands/codex/prompts/dv-tasks.md",
24
+ "commands/codex/prompts/dv-verify.md",
25
+ "commands/gemini/da-vinci.toml",
26
+ "commands/gemini/dv/breakdown.toml",
27
+ "commands/gemini/dv/build.toml",
28
+ "commands/gemini/dv/design.toml",
29
+ "commands/gemini/dv/tasks.toml",
30
+ "commands/gemini/dv/verify.toml",
31
+ "references/artifact-templates.md",
32
+ "references/checkpoints.md",
33
+ "references/design-inputs.md",
34
+ "references/modes.md",
35
+ "references/page-mapping.md",
36
+ "references/pencil-design-to-code.md",
37
+ "references/platform-adapters.md"
38
+ ];
39
+
40
+ function resolveHome(homeDir) {
41
+ return homeDir || process.env.HOME || os.homedir();
42
+ }
43
+
44
+ function parsePlatforms(raw) {
45
+ if (!raw || raw === "all") {
46
+ return ["codex", "claude", "gemini"];
47
+ }
48
+
49
+ const platforms = raw
50
+ .split(",")
51
+ .map((value) => value.trim())
52
+ .filter(Boolean);
53
+
54
+ const unique = [...new Set(platforms)];
55
+ const invalid = unique.filter((value) => !["codex", "claude", "gemini"].includes(value));
56
+
57
+ if (invalid.length > 0) {
58
+ throw new Error(`Unsupported platform value: ${invalid.join(", ")}`);
59
+ }
60
+
61
+ return unique;
62
+ }
63
+
64
+ function ensureDir(targetPath) {
65
+ fs.mkdirSync(targetPath, { recursive: true });
66
+ }
67
+
68
+ function copyFile(sourcePath, targetPath) {
69
+ ensureDir(path.dirname(targetPath));
70
+ fs.copyFileSync(sourcePath, targetPath);
71
+ }
72
+
73
+ function copyDir(sourceDir, targetDir) {
74
+ ensureDir(path.dirname(targetDir));
75
+ fs.rmSync(targetDir, { recursive: true, force: true });
76
+ fs.cpSync(sourceDir, targetDir, { recursive: true });
77
+ }
78
+
79
+ function copyNamedFiles(sourceDir, targetDir, fileNames) {
80
+ ensureDir(targetDir);
81
+ for (const fileName of fileNames) {
82
+ copyFile(path.join(sourceDir, fileName), path.join(targetDir, fileName));
83
+ }
84
+ }
85
+
86
+ function removePath(targetPath) {
87
+ fs.rmSync(targetPath, { recursive: true, force: true });
88
+ }
89
+
90
+ function tryRemoveEmptyDir(targetPath) {
91
+ try {
92
+ fs.rmdirSync(targetPath);
93
+ } catch (error) {
94
+ if (error && error.code !== "ENOTEMPTY" && error.code !== "ENOENT") {
95
+ throw error;
96
+ }
97
+ }
98
+ }
99
+
100
+ function listFiles(dirPath) {
101
+ return fs.readdirSync(dirPath, { withFileTypes: true }).flatMap((entry) => {
102
+ const fullPath = path.join(dirPath, entry.name);
103
+ if (entry.isDirectory()) {
104
+ return listFiles(fullPath);
105
+ }
106
+ return [fullPath];
107
+ });
108
+ }
109
+
110
+ function installCodex(homeDir) {
111
+ const promptsTarget = path.join(homeDir, ".codex", "prompts");
112
+ const skillTarget = path.join(homeDir, ".codex", "skills", "da-vinci");
113
+ const promptsSource = path.join(REPO_ROOT, "commands", "codex", "prompts");
114
+
115
+ ensureDir(promptsTarget);
116
+ for (const filePath of listFiles(promptsSource)) {
117
+ copyFile(filePath, path.join(promptsTarget, path.basename(filePath)));
118
+ }
119
+
120
+ ensureDir(skillTarget);
121
+ copyFile(path.join(REPO_ROOT, "SKILL.md"), path.join(skillTarget, "SKILL.md"));
122
+ copyDir(path.join(REPO_ROOT, "agents"), path.join(skillTarget, "agents"));
123
+ copyDir(path.join(REPO_ROOT, "references"), path.join(skillTarget, "references"));
124
+ copyDir(path.join(REPO_ROOT, "docs"), path.join(skillTarget, "docs"));
125
+ copyDir(path.join(REPO_ROOT, "examples"), path.join(skillTarget, "examples"));
126
+ }
127
+
128
+ function uninstallCodex(homeDir) {
129
+ const promptsTarget = path.join(homeDir, ".codex", "prompts");
130
+ const skillTarget = path.join(homeDir, ".codex", "skills", "da-vinci");
131
+ const promptFiles = [
132
+ "da-vinci.md",
133
+ "dv-breakdown.md",
134
+ "dv-build.md",
135
+ "dv-design.md",
136
+ "dv-tasks.md",
137
+ "dv-verify.md"
138
+ ];
139
+
140
+ for (const fileName of promptFiles) {
141
+ removePath(path.join(promptsTarget, fileName));
142
+ }
143
+
144
+ removePath(skillTarget);
145
+ }
146
+
147
+ function installClaude(homeDir) {
148
+ const commandsTarget = path.join(homeDir, ".claude", "commands");
149
+ const dvTarget = path.join(commandsTarget, "dv");
150
+ ensureDir(commandsTarget);
151
+ copyFile(
152
+ path.join(REPO_ROOT, "commands", "claude", "da-vinci.md"),
153
+ path.join(commandsTarget, "da-vinci.md")
154
+ );
155
+ copyNamedFiles(path.join(REPO_ROOT, "commands", "claude", "dv"), dvTarget, [
156
+ "breakdown.md",
157
+ "build.md",
158
+ "design.md",
159
+ "tasks.md",
160
+ "verify.md"
161
+ ]);
162
+ }
163
+
164
+ function uninstallClaude(homeDir) {
165
+ const commandsTarget = path.join(homeDir, ".claude", "commands");
166
+ removePath(path.join(commandsTarget, "da-vinci.md"));
167
+ removePath(path.join(commandsTarget, "dv", "breakdown.md"));
168
+ removePath(path.join(commandsTarget, "dv", "build.md"));
169
+ removePath(path.join(commandsTarget, "dv", "design.md"));
170
+ removePath(path.join(commandsTarget, "dv", "tasks.md"));
171
+ removePath(path.join(commandsTarget, "dv", "verify.md"));
172
+ tryRemoveEmptyDir(path.join(commandsTarget, "dv"));
173
+ }
174
+
175
+ function installGemini(homeDir) {
176
+ const commandsTarget = path.join(homeDir, ".gemini", "commands");
177
+ const dvTarget = path.join(commandsTarget, "dv");
178
+ ensureDir(commandsTarget);
179
+ copyFile(
180
+ path.join(REPO_ROOT, "commands", "gemini", "da-vinci.toml"),
181
+ path.join(commandsTarget, "da-vinci.toml")
182
+ );
183
+ copyNamedFiles(path.join(REPO_ROOT, "commands", "gemini", "dv"), dvTarget, [
184
+ "breakdown.toml",
185
+ "build.toml",
186
+ "design.toml",
187
+ "tasks.toml",
188
+ "verify.toml"
189
+ ]);
190
+ }
191
+
192
+ function uninstallGemini(homeDir) {
193
+ const commandsTarget = path.join(homeDir, ".gemini", "commands");
194
+ removePath(path.join(commandsTarget, "da-vinci.toml"));
195
+ removePath(path.join(commandsTarget, "dv", "breakdown.toml"));
196
+ removePath(path.join(commandsTarget, "dv", "build.toml"));
197
+ removePath(path.join(commandsTarget, "dv", "design.toml"));
198
+ removePath(path.join(commandsTarget, "dv", "tasks.toml"));
199
+ removePath(path.join(commandsTarget, "dv", "verify.toml"));
200
+ tryRemoveEmptyDir(path.join(commandsTarget, "dv"));
201
+ }
202
+
203
+ const INSTALLERS = {
204
+ codex: installCodex,
205
+ claude: installClaude,
206
+ gemini: installGemini
207
+ };
208
+
209
+ const UNINSTALLERS = {
210
+ codex: uninstallCodex,
211
+ claude: uninstallClaude,
212
+ gemini: uninstallGemini
213
+ };
214
+
215
+ function installPlatforms(platforms, options = {}) {
216
+ const homeDir = resolveHome(options.homeDir);
217
+ const selectedPlatforms = parsePlatforms(platforms);
218
+
219
+ for (const platform of selectedPlatforms) {
220
+ INSTALLERS[platform](homeDir);
221
+ }
222
+
223
+ return {
224
+ version: VERSION,
225
+ homeDir,
226
+ platforms: selectedPlatforms
227
+ };
228
+ }
229
+
230
+ function uninstallPlatforms(platforms, options = {}) {
231
+ const homeDir = resolveHome(options.homeDir);
232
+ const selectedPlatforms = parsePlatforms(platforms);
233
+
234
+ for (const platform of selectedPlatforms) {
235
+ UNINSTALLERS[platform](homeDir);
236
+ }
237
+
238
+ return {
239
+ version: VERSION,
240
+ homeDir,
241
+ platforms: selectedPlatforms
242
+ };
243
+ }
244
+
245
+ function getStatus(options = {}) {
246
+ const homeDir = resolveHome(options.homeDir);
247
+ return {
248
+ version: VERSION,
249
+ homeDir,
250
+ codex: {
251
+ prompt: fs.existsSync(path.join(homeDir, ".codex", "prompts", "da-vinci.md")),
252
+ skill: fs.existsSync(path.join(homeDir, ".codex", "skills", "da-vinci", "SKILL.md"))
253
+ },
254
+ claude: {
255
+ command: fs.existsSync(path.join(homeDir, ".claude", "commands", "da-vinci.md")),
256
+ actionSet: fs.existsSync(path.join(homeDir, ".claude", "commands", "dv", "design.md"))
257
+ },
258
+ gemini: {
259
+ command: fs.existsSync(path.join(homeDir, ".gemini", "commands", "da-vinci.toml")),
260
+ actionSet: fs.existsSync(path.join(homeDir, ".gemini", "commands", "dv", "design.toml"))
261
+ }
262
+ };
263
+ }
264
+
265
+ function validateAssets() {
266
+ const missing = REQUIRED_FILES.filter((relativePath) => {
267
+ return !fs.existsSync(path.join(REPO_ROOT, relativePath));
268
+ });
269
+
270
+ if (missing.length > 0) {
271
+ throw new Error(`Missing required assets:\n${missing.join("\n")}`);
272
+ }
273
+
274
+ return {
275
+ version: VERSION,
276
+ requiredAssets: REQUIRED_FILES.length
277
+ };
278
+ }
279
+
280
+ module.exports = {
281
+ VERSION,
282
+ installPlatforms,
283
+ uninstallPlatforms,
284
+ getStatus,
285
+ validateAssets
286
+ };
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@xenonbyte/da-vinci-workflow",
3
+ "version": "0.1.2",
4
+ "description": "Requirement-to-design-to-code workflow skill for Codex, Claude, and Gemini",
5
+ "bin": {
6
+ "da-vinci": "bin/da-vinci.js"
7
+ },
8
+ "files": [
9
+ "SKILL.md",
10
+ "README.md",
11
+ "agents",
12
+ "commands",
13
+ "references",
14
+ "docs",
15
+ "examples",
16
+ "bin",
17
+ "lib",
18
+ "scripts",
19
+ ".npmrc"
20
+ ],
21
+ "scripts": {
22
+ "postinstall": "node scripts/postinstall.js",
23
+ "validate-assets": "node scripts/validate-assets.js"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ }
31
+ }
@@ -0,0 +1,364 @@
1
+ # Artifact Templates
2
+
3
+ Use these templates as the default artifact shapes for Da Vinci.
4
+
5
+ Keep headings stable unless the project requires a different schema.
6
+
7
+ ## `brainstorm.md`
8
+
9
+ Use this structure:
10
+
11
+ ```md
12
+ # Brainstorm
13
+
14
+ ## Inputs
15
+ - Raw user ideas
16
+ - Repeated themes
17
+
18
+ ## Product Direction
19
+ - Stable goals
20
+ - Open questions
21
+
22
+ ## Candidate Pages
23
+ - Candidate page list
24
+
25
+ ## Candidate Flows
26
+ - Candidate user flows
27
+
28
+ ## Risks And Unknowns
29
+ - Ambiguities
30
+ - Conflicts
31
+ - Deferred ideas
32
+ ```
33
+
34
+ Use this artifact only when ideas are still being synthesized.
35
+
36
+ ## `project-inventory.md`
37
+
38
+ Use this structure:
39
+
40
+ ```md
41
+ # Project Inventory
42
+
43
+ ## Current Product
44
+ - Product summary
45
+
46
+ ## Routes And Pages
47
+ - Route
48
+ - Page purpose
49
+
50
+ ## UI Regions
51
+ - Shared layout regions
52
+ - Repeated page patterns
53
+
54
+ ## Technical Constraints
55
+ - Existing stack
56
+ - Existing design system
57
+
58
+ ## Redesign Impact
59
+ - Preserve
60
+ - Replace
61
+ - Review later
62
+ ```
63
+
64
+ Use this artifact when redesign starts from an existing codebase.
65
+
66
+ ## `design-brief.md`
67
+
68
+ Use this structure:
69
+
70
+ ```md
71
+ # Design Brief
72
+
73
+ ## Product Form Factor
74
+ - desktop software
75
+ - web app
76
+ - tablet
77
+ - mobile app
78
+
79
+ ## Visual Direction
80
+ - tone
81
+ - density
82
+ - visual references
83
+
84
+ ## Brand Constraints
85
+ - existing brand
86
+ - color direction
87
+ - typography constraints
88
+
89
+ ## Layout Priorities
90
+ - desktop-first or mobile-first
91
+ - workspace density
92
+ - responsiveness expectations
93
+
94
+ ## Notes
95
+ - explicit user preferences
96
+ - inferred preferences
97
+ ```
98
+
99
+ Use this artifact whenever the project is new or the design direction is not obvious from the existing product.
100
+
101
+ ## `design-registry.md`
102
+
103
+ Use this structure:
104
+
105
+ ```md
106
+ # Design Registry
107
+
108
+ ## Active Design Sources
109
+ - `.pen` file path
110
+ - status
111
+ - purpose
112
+
113
+ ## Preferred Design Source
114
+ - Which `.pen` file is authoritative
115
+
116
+ ## Historical Or Secondary Sources
117
+ - Legacy files
118
+ - Alternate explorations
119
+
120
+ ## Notes
121
+ - Why a source is active
122
+ - Whether a source is safe to iterate
123
+ ```
124
+
125
+ Use this artifact whenever a project can have one or more Pencil sources.
126
+
127
+ ## `page-map.md`
128
+
129
+ Use this structure:
130
+
131
+ ```md
132
+ # Page Map
133
+
134
+ ## Canonical Pages
135
+ - Page name
136
+ - Route or identifier
137
+ - Purpose
138
+
139
+ ## States Per Page
140
+ - Empty
141
+ - Loading
142
+ - Success
143
+ - Error
144
+ - Restricted
145
+
146
+ ## Shared Sections
147
+ - Header
148
+ - Sidebar
149
+ - Footer
150
+ - Shared workspace regions
151
+
152
+ ## Page Priority
153
+ - Core pages
154
+ - Supporting pages
155
+ ```
156
+
157
+ Use this artifact for every mode. It is the canonical page list.
158
+
159
+ ## `proposal.md`
160
+
161
+ Use this structure:
162
+
163
+ ```md
164
+ # Proposal
165
+
166
+ ## Change
167
+ - Name:
168
+ - Owner:
169
+ - Date:
170
+
171
+ ## Goal
172
+ - What this change must achieve
173
+
174
+ ## Non-Goals
175
+ - What this change will not cover
176
+
177
+ ## User Value
178
+ - Why this matters
179
+
180
+ ## Scope
181
+ - Pages
182
+ - Flows
183
+ - Integrations
184
+
185
+ ## Risks
186
+ - Security
187
+ - Migration
188
+ - Delivery
189
+
190
+ ## Success Criteria
191
+ - Observable outcomes
192
+ ```
193
+
194
+ ## `specs/<capability>/spec.md`
195
+
196
+ Use this structure:
197
+
198
+ ```md
199
+ # Spec
200
+
201
+ ## Capability
202
+ - Name
203
+
204
+ ## Behavior
205
+ - Core behavior rules
206
+
207
+ ## States
208
+ - Empty
209
+ - Loading
210
+ - Success
211
+ - Error
212
+ - Restricted
213
+
214
+ ## Inputs
215
+ - User inputs
216
+ - External inputs
217
+
218
+ ## Outputs
219
+ - User-visible results
220
+ - System-visible results
221
+
222
+ ## Acceptance
223
+ - Clear testable conditions
224
+
225
+ ## Edge Cases
226
+ - Failure paths
227
+ - Boundary conditions
228
+ ```
229
+
230
+ Write behavior in direct, testable language.
231
+
232
+ ## `design.md`
233
+
234
+ Use this structure:
235
+
236
+ ```md
237
+ # Design
238
+
239
+ ## Page Map
240
+ - Pages and sections
241
+
242
+ ## Interaction Model
243
+ - Primary actions
244
+ - Secondary actions
245
+ - State transitions
246
+
247
+ ## Layout Strategy
248
+ - Major regions
249
+ - Responsive notes
250
+
251
+ ## Component Strategy
252
+ - Reusable blocks
253
+ - Page-specific blocks
254
+
255
+ ## Content Notes
256
+ - Key text
257
+ - Priority order
258
+
259
+ ## Open Questions
260
+ - Unresolved design decisions
261
+ ```
262
+
263
+ ## `pencil-design.md`
264
+
265
+ Use this structure:
266
+
267
+ ```md
268
+ # Pencil Design
269
+
270
+ ## Source
271
+ - `.pen` file path
272
+ - Active pages
273
+
274
+ ## Page Mapping
275
+ - Requirement -> Pencil page
276
+
277
+ ## Screens
278
+ - Screen name
279
+ - Purpose
280
+ - Notes
281
+
282
+ ## States Represented
283
+ - Which states are drawn
284
+ - Which states still need design coverage
285
+
286
+ ## Screenshots
287
+ - Reference image paths or exported nodes
288
+
289
+ ## Implementation Notes
290
+ - Important layout or styling constraints to preserve in code
291
+ ```
292
+
293
+ ## `tasks.md`
294
+
295
+ Use this structure:
296
+
297
+ ```md
298
+ # Tasks
299
+
300
+ ## 1. Setup
301
+ - [ ] Project or page setup
302
+
303
+ ## 2. UI Structure
304
+ - [ ] Implement major sections from Pencil
305
+
306
+ ## 3. Behavior
307
+ - [ ] Implement states and interactions from spec
308
+
309
+ ## 4. Integration
310
+ - [ ] Wire required data or services
311
+
312
+ ## 5. Verification
313
+ - [ ] Check requirement coverage
314
+ - [ ] Check Pencil coverage
315
+ ```
316
+
317
+ Prefer top-level task groups. They are required for execution checkpoints.
318
+
319
+ ## `pencil-bindings.md`
320
+
321
+ Use this structure:
322
+
323
+ ```md
324
+ # Pencil Bindings
325
+
326
+ ## Source
327
+ - `.pen` file path
328
+
329
+ ## Bindings
330
+ - implementation page or route -> Pencil page or screen
331
+
332
+ ## Shared Bindings
333
+ - shared layout or component -> Pencil region
334
+
335
+ ## Notes
336
+ - intentional deviations
337
+ - pages without Pencil coverage yet
338
+ ```
339
+
340
+ Use this artifact whenever implementation must trace back to Pencil pages.
341
+
342
+ ## `verification.md`
343
+
344
+ Use this structure:
345
+
346
+ ```md
347
+ # Verification
348
+
349
+ ## Requirement Coverage
350
+ - Covered items
351
+ - Missing items
352
+
353
+ ## Pencil Coverage
354
+ - Matched sections
355
+ - Design drift
356
+
357
+ ## Behavior Drift
358
+ - Scope expansions
359
+ - Missing states
360
+
361
+ ## Outcome
362
+ - PASS / WARN / BLOCK
363
+ - Next action
364
+ ```