dev-harness-cli 1.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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +299 -0
  3. package/adapters/amazon-q/README.md +23 -0
  4. package/adapters/antigravity/README.md +22 -0
  5. package/adapters/claude-code/README.md +30 -0
  6. package/adapters/cline/README.md +23 -0
  7. package/adapters/codex/README.md +31 -0
  8. package/adapters/copilot/README.md +23 -0
  9. package/adapters/cursor/README.md +29 -0
  10. package/adapters/gemini/README.md +23 -0
  11. package/adapters/generic/README.md +40 -0
  12. package/adapters/hermes/README.md +31 -0
  13. package/adapters/hermes/SKILL.md +89 -0
  14. package/adapters/hermes/scripts/init.mjs +27 -0
  15. package/adapters/hermes/scripts/phase.mjs +27 -0
  16. package/adapters/hermes/scripts/validate.mjs +27 -0
  17. package/adapters/kilo-code/README.md +23 -0
  18. package/adapters/openclaw/README.md +22 -0
  19. package/adapters/pi/README.md +22 -0
  20. package/adapters/roo/README.md +23 -0
  21. package/adapters/windsurf/README.md +23 -0
  22. package/cli/commands/checkpoint.mjs +94 -0
  23. package/cli/commands/config.mjs +268 -0
  24. package/cli/commands/contract.mjs +155 -0
  25. package/cli/commands/detect-tool.mjs +112 -0
  26. package/cli/commands/init.mjs +351 -0
  27. package/cli/commands/learn.mjs +47 -0
  28. package/cli/commands/pause.mjs +34 -0
  29. package/cli/commands/phase.mjs +182 -0
  30. package/cli/commands/resume.mjs +33 -0
  31. package/cli/commands/rollback.mjs +261 -0
  32. package/cli/commands/set-mode.mjs +75 -0
  33. package/cli/commands/status.mjs +168 -0
  34. package/cli/commands/validate.mjs +118 -0
  35. package/cli/commands/worktree.mjs +298 -0
  36. package/cli/harness-dev.mjs +88 -0
  37. package/cli/lib/args.mjs +111 -0
  38. package/cli/lib/command-helpers.mjs +50 -0
  39. package/cli/lib/config-registry.mjs +329 -0
  40. package/cli/lib/constants.mjs +30 -0
  41. package/cli/lib/contract.mjs +306 -0
  42. package/cli/lib/detect-stack.mjs +235 -0
  43. package/cli/lib/errors.mjs +71 -0
  44. package/cli/lib/file-io.mjs +90 -0
  45. package/cli/lib/gates.mjs +492 -0
  46. package/cli/lib/git.mjs +144 -0
  47. package/cli/lib/help.mjs +246 -0
  48. package/cli/lib/modes.mjs +92 -0
  49. package/cli/lib/output.mjs +49 -0
  50. package/cli/lib/paths.mjs +75 -0
  51. package/cli/lib/phases.mjs +58 -0
  52. package/cli/lib/platform.mjs +78 -0
  53. package/cli/lib/progress.mjs +357 -0
  54. package/cli/lib/ralph-inner.mjs +314 -0
  55. package/cli/lib/ralph-outer.mjs +249 -0
  56. package/cli/lib/ralph-output.mjs +178 -0
  57. package/cli/lib/scaffold.mjs +431 -0
  58. package/cli/lib/schemas/stacks.json +477 -0
  59. package/cli/lib/state.mjs +333 -0
  60. package/cli/lib/templates.mjs +264 -0
  61. package/cli/lib/tool-registry.mjs +218 -0
  62. package/cli/lib/validate-schema.mjs +131 -0
  63. package/cli/lib/vars.mjs +114 -0
  64. package/package.json +50 -0
  65. package/schema/harness-config.schema.json +127 -0
  66. package/templates/AGENTS.md +63 -0
  67. package/templates/ci/github-actions.yml +78 -0
  68. package/templates/ci/gitlab-ci.yml +59 -0
  69. package/templates/docs/agents/evaluator.md +14 -0
  70. package/templates/docs/agents/generator.md +13 -0
  71. package/templates/docs/agents/planner.md +13 -0
  72. package/templates/docs/agents/simplifier.md +13 -0
  73. package/templates/docs/phases/build.md +41 -0
  74. package/templates/docs/phases/define.md +51 -0
  75. package/templates/docs/phases/plan.md +36 -0
  76. package/templates/docs/phases/review.md +42 -0
  77. package/templates/docs/phases/ship.md +43 -0
  78. package/templates/docs/phases/simplify.md +40 -0
  79. package/templates/docs/phases/verify.md +38 -0
  80. package/templates/evaluator-rubric.md +28 -0
  81. package/templates/init.ps1 +97 -0
  82. package/templates/init.sh +102 -0
  83. package/templates/sprint-contract.md +31 -0
@@ -0,0 +1,431 @@
1
+ /**
2
+ * scaffold — Stack-specific scaffolding assets.
3
+ *
4
+ * Extracted from init.mjs: config file stubs, version file stubs,
5
+ * gitignore patterns, and extra-file generators. Pure data + helpers,
6
+ * no I/O. init.mjs imports these to assemble the scaffold.
7
+ *
8
+ * Usage:
9
+ * import { getExtraFiles, getConfigFileContent, getGitignoreContent } from "../lib/scaffold.mjs";
10
+ */
11
+
12
+ // ── Stack-specific extra assets ──────────────────────────────────────────────
13
+
14
+ // Agent-tool file generation is now handled by cli/lib/tool-registry.mjs.
15
+ // Tool-specific files (CLAUDE.md, .cursorrules, etc.) are generated from
16
+ // the already-rendered AGENTS.md content + an optional header — no separate
17
+ // templates needed. See tool-registry.mjs for the full tool map.
18
+ //
19
+ // Re-exported for backward compatibility (init.mjs imports from scaffold.mjs):
20
+ export { KNOWN_TOOLS as KNOWN_AGENT_TOOLS, getToolFile as getAdapterFile } from './tool-registry.mjs';
21
+
22
+ /** Config file stub content per stack (minimal starter). */
23
+ export const STACK_CONFIG_STUBS = {
24
+ python: `[build-system]
25
+ requires = ["setuptools>=64", "wheel"]
26
+ build-backend = "setuptools.backends._legacy:_Backend"
27
+
28
+ [project]
29
+ name = "my-project"
30
+ version = "0.1.0"
31
+ description = ""
32
+ requires-python = ">=3.11"
33
+ `,
34
+ node: `{
35
+ "name": "my-project",
36
+ "version": "0.1.0",
37
+ "description": "",
38
+ "type": "module",
39
+ "scripts": {
40
+ "build": "echo build",
41
+ "test": "echo test"
42
+ },
43
+ "license": "MIT"
44
+ }
45
+ `,
46
+ go: `module my-project
47
+
48
+ go 1.22
49
+ `,
50
+ rust: `[package]
51
+ name = "my-project"
52
+ version = "0.1.0"
53
+ edition = "2021"
54
+ `,
55
+ c: `cmake_minimum_required(VERSION 3.16)
56
+ project(my-project C)
57
+ add_executable(my-project main.c)
58
+ `,
59
+ cpp: `cmake_minimum_required(VERSION 3.16)
60
+ project(my-project CXX)
61
+ add_executable(my-project main.cpp)
62
+ `,
63
+ java: `<?xml version="1.0" encoding="UTF-8"?>
64
+ <project xmlns="http://maven.apache.org/POM/4.0.0"
65
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
67
+ <modelVersion>4.0.0</modelVersion>
68
+ <groupId>com.mycompany</groupId>
69
+ <artifactId>my-project</artifactId>
70
+ <version>0.1.0</version>
71
+ <properties>
72
+ <maven.compiler.source>21</maven.compiler.source>
73
+ <maven.compiler.target>21</maven.compiler.target>
74
+ </properties>
75
+ </project>
76
+ `,
77
+ kotlin: `plugins {
78
+ kotlin("jvm") version "2.0.0"
79
+ application
80
+ }
81
+ application {
82
+ mainClass = "MainKt"
83
+ }
84
+ repositories { mavenCentral() }
85
+ dependencies { implementation(kotlin("stdlib")) }
86
+ `,
87
+ dotnet: null,
88
+ matlab: null,
89
+ vhdl: `-- VHDL project stub`,
90
+ verilog: `// Verilog project stub`,
91
+ generic: `# Generic project — no config file template`,
92
+ };
93
+
94
+ /** Version file content per stack. */
95
+ export const STACK_VERSION_STUBS = {
96
+ python: '3.11\n',
97
+ node: '18\n',
98
+ go: '1.22\n',
99
+ rust: 'stable\n',
100
+ java: '21\n',
101
+ kotlin: '21\n',
102
+ dotnet: '8.0\n',
103
+ matlab: '',
104
+ c: '',
105
+ cpp: '',
106
+ vhdl: '',
107
+ verilog: '',
108
+ generic: '',
109
+ };
110
+
111
+ /** .gitignore patterns per stack. */
112
+ export const GITIGNORE_PATTERNS = {
113
+ python: `# Python
114
+ __pycache__/
115
+ *.py[cod]
116
+ *.egg-info/
117
+ dist/
118
+ build/
119
+ .venv/
120
+ venv/
121
+ *.egg
122
+ .pytest_cache/
123
+ .mypy_cache/
124
+ .ruff_cache/
125
+ .tox/
126
+ `,
127
+ node: `# Node
128
+ node_modules/
129
+ dist/
130
+ build/
131
+ .next/
132
+ *.log
133
+ .env
134
+ .env.local
135
+ `,
136
+ go: `# Go
137
+ *.exe
138
+ *.test
139
+ *.out
140
+ vendor/
141
+ `,
142
+ rust: `# Rust
143
+ target/
144
+ Cargo.lock
145
+ **/*.rs.bk
146
+ `,
147
+ java: `# Java
148
+ *.class
149
+ *.jar
150
+ *.war
151
+ target/
152
+ build/
153
+ .gradle/
154
+ */build/
155
+ !gradle/wrapper/gradle-wrapper.jar
156
+ `,
157
+ kotlin: `# Kotlin
158
+ *.class
159
+ *.jar
160
+ build/
161
+ .gradle/
162
+ */build/
163
+ !gradle/wrapper/gradle-wrapper.jar
164
+ `,
165
+ dotnet: `# .NET
166
+ bin/
167
+ obj/
168
+ *.user
169
+ *.suo
170
+ *.cache
171
+ *.log
172
+ *.nupkg
173
+ `,
174
+ matlab: `# MATLAB
175
+ *.asv
176
+ *.m~
177
+ *.mat
178
+ slprj/
179
+ simulink/
180
+ `,
181
+ c: `# C
182
+ build/
183
+ *.o
184
+ *.obj
185
+ *.exe
186
+ `,
187
+ cpp: `# C++
188
+ build/
189
+ *.o
190
+ *.obj
191
+ *.exe
192
+ `,
193
+ vhdl: `# VHDL
194
+ *.o
195
+ *.cf
196
+ work/
197
+ `,
198
+ verilog: `# Verilog
199
+ *.o
200
+ *.vcd
201
+ *.lxt
202
+ work/
203
+ `,
204
+ generic: `# Generic
205
+ *.log
206
+ *.bak
207
+ *.swp
208
+ .DS_Store
209
+ `,
210
+ };
211
+
212
+ // ── Extra scaffolding files (not covered by templates) ───────────────────────
213
+
214
+ /**
215
+ * Inline content for files beyond the 5 template-based ones.
216
+ * Key is relative output path, value is file content.
217
+ */
218
+ export function getExtraFiles(stack) {
219
+ return {
220
+ 'feature_list.json': JSON.stringify({
221
+ version: '0.1',
222
+ features: [
223
+ {
224
+ id: 'feature-001',
225
+ name: 'Feature 1',
226
+ description: 'Replace with actual feature description',
227
+ passes: false,
228
+ tasks: [
229
+ { id: 'task-001', description: 'First task', status: 'pending' },
230
+ ],
231
+ },
232
+ ],
233
+ }, null, 2) + '\n',
234
+
235
+ 'feature-list.schema.json': JSON.stringify({
236
+ $schema: 'http://json-schema.org/draft-07/schema#',
237
+ title: 'Feature List',
238
+ type: 'object',
239
+ required: ['version', 'features'],
240
+ properties: {
241
+ version: { type: 'string' },
242
+ features: {
243
+ type: 'array',
244
+ items: {
245
+ type: 'object',
246
+ required: ['id', 'name', 'passes', 'tasks'],
247
+ properties: {
248
+ id: { type: 'string' },
249
+ name: { type: 'string' },
250
+ passes: { type: 'boolean' },
251
+ tasks: {
252
+ type: 'array',
253
+ items: {
254
+ type: 'object',
255
+ required: ['id', 'description', 'status'],
256
+ properties: {
257
+ id: { type: 'string' },
258
+ description: { type: 'string' },
259
+ status: { type: 'string', enum: ['pending', 'in_progress', 'complete', 'blocked'] },
260
+ },
261
+ },
262
+ },
263
+ },
264
+ },
265
+ },
266
+ },
267
+ }, null, 2) + '\n',
268
+
269
+ 'session-handoff.md': `# Session Handoff
270
+
271
+ ## Context
272
+
273
+ <!-- What are we building? What phase are we in? -->
274
+
275
+ ## Current State
276
+
277
+ - **Phase:**
278
+ - **Mode:** copilot
279
+ - **Current Feature:**
280
+ - **Outcome of last session:**
281
+
282
+ ## Next Actions
283
+
284
+ 1. ...
285
+ 2. ...
286
+ 3. ...
287
+
288
+ ## Open Questions
289
+
290
+ - ...
291
+
292
+ ## Decisions Made
293
+
294
+ | Decision | Rationale |
295
+ |----------|-----------|
296
+ | ... | ... |
297
+ `,
298
+
299
+ 'clean-state-checklist.md': `# Clean State Checklist
300
+
301
+ Run this before starting any phase to ensure deterministic state.
302
+
303
+ ## Git
304
+
305
+ - [ ] Working tree clean (\`git status --porcelain\` empty)
306
+ - [ ] On correct branch (not detached HEAD)
307
+ - [ ] No pending rebase/merge/cherry-pick
308
+
309
+ ## Harness
310
+
311
+ - [ ] \`harness-config.json\` exists and valid
312
+ - [ ] Current phase matches what we're about to run
313
+ - [ ] \`progress.md\` has latest Session State
314
+ - [ ] \`feature_list.json\` up-to-date
315
+
316
+ ## Environment
317
+
318
+ - [ ] Dependencies installed
319
+ - [ ] Required services running
320
+ - [ ] No stale background processes
321
+ `,
322
+
323
+ 'ARCHITECTURE.md': `# Architecture
324
+
325
+ ## Module Structure
326
+
327
+ \`\`\`
328
+ src/
329
+ ...
330
+ \`\`\`
331
+ `,
332
+
333
+ 'CONSTRAINTS.md': `# Constraints
334
+
335
+ ## Technical
336
+
337
+ - **Language:** ${stack}
338
+ - **Platform:** <!-- target platform -->
339
+ - **Dependencies:** <!-- key dependency constraints -->
340
+
341
+ ## Process
342
+
343
+ - Commits must be atomic (one concern per commit)
344
+ - All code reviewed before merging
345
+ - Tests must pass before shipping
346
+
347
+ ## Design
348
+
349
+ - Favor simplicity over generality
350
+ - Explicit over implicit
351
+ - Fail fast, fail loud
352
+ `,
353
+
354
+ 'DECISIONS.md': `# Decisions
355
+
356
+ <!-- Record architectural and design decisions here. Use the format below. -->
357
+
358
+ ## YYYY-MM-DD: Title
359
+
360
+ **Status:** proposed | accepted | deprecated | superseded
361
+
362
+ **Context:** Why was this decision needed?
363
+
364
+ **Decision:** What was chosen?
365
+
366
+ **Consequences:** What trade-offs were accepted?
367
+
368
+ ---
369
+
370
+ | Date | Decision | Status |
371
+ |------|----------|--------|
372
+ | | | |
373
+ `,
374
+
375
+ 'docs/api-patterns.md': `# API Patterns
376
+
377
+ ## Conventions
378
+
379
+ <!-- Document API conventions: URL structure, auth, error format, pagination -->
380
+
381
+ ## Endpoints
382
+
383
+ | Method | Path | Description |
384
+ |--------|------|-------------|
385
+ | GET | /api/v1/... | ... |
386
+ | POST | /api/v1/... | ... |
387
+
388
+ ## Error Format
389
+
390
+ \`\`\`json
391
+ {
392
+ "error": {
393
+ "code": "ERROR_CODE",
394
+ "message": "Human-readable description"
395
+ }
396
+ }
397
+ \`\`\`
398
+ `,
399
+ };
400
+ }
401
+
402
+ /**
403
+ * Return the stack config file stub content, or null if unknown.
404
+ */
405
+ export function getConfigFileContent(stack) {
406
+ return STACK_CONFIG_STUBS[stack] || null;
407
+ }
408
+
409
+ /**
410
+ * Return the stack version file content, or null.
411
+ */
412
+ export function getVersionFileContent(stack) {
413
+ return STACK_VERSION_STUBS[stack] || null;
414
+ }
415
+
416
+ /**
417
+ * Return .gitignore content for the given stack.
418
+ */
419
+ export function getGitignoreContent(stack) {
420
+ return `# Harness scaffold
421
+ harness-config.json
422
+ feature_list.json
423
+ feature-list.schema.json
424
+ progress.md
425
+
426
+ ${GITIGNORE_PATTERNS[stack] || GITIGNORE_PATTERNS.generic}
427
+ # OS
428
+ .DS_Store
429
+ Thumbs.db
430
+ `;
431
+ }