@wkronmiller/lisa 0.1.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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +407 -0
  3. package/bin/lisa-runtime.js +8797 -0
  4. package/bin/lisa.js +21 -0
  5. package/completion.ts +58 -0
  6. package/install.ps1 +51 -0
  7. package/install.sh +93 -0
  8. package/lisa.ts +6 -0
  9. package/package.json +66 -0
  10. package/skills/README.md +28 -0
  11. package/skills/claude-code/CLAUDE.md +151 -0
  12. package/skills/codex/AGENTS.md +151 -0
  13. package/skills/gemini/GEMINI.md +151 -0
  14. package/skills/opencode/AGENTS.md +152 -0
  15. package/src/cli.ts +85 -0
  16. package/src/harness/base-adapter.ts +47 -0
  17. package/src/harness/claude-code.ts +106 -0
  18. package/src/harness/codex.ts +80 -0
  19. package/src/harness/command.ts +173 -0
  20. package/src/harness/gemini.ts +74 -0
  21. package/src/harness/opencode.ts +84 -0
  22. package/src/harness/registry.ts +29 -0
  23. package/src/harness/runner.ts +19 -0
  24. package/src/harness/types.ts +73 -0
  25. package/src/output-mode.ts +32 -0
  26. package/src/skill/artifacts.ts +174 -0
  27. package/src/skill/cli.ts +29 -0
  28. package/src/skill/install.ts +317 -0
  29. package/src/spec/agent-guidance.ts +466 -0
  30. package/src/spec/cli.ts +151 -0
  31. package/src/spec/commands/check.ts +1 -0
  32. package/src/spec/commands/config.ts +146 -0
  33. package/src/spec/commands/diff.ts +1 -0
  34. package/src/spec/commands/generate.ts +1 -0
  35. package/src/spec/commands/guide.ts +1 -0
  36. package/src/spec/commands/harness-list.ts +36 -0
  37. package/src/spec/commands/implement.ts +1 -0
  38. package/src/spec/commands/import.ts +1 -0
  39. package/src/spec/commands/init.ts +1 -0
  40. package/src/spec/commands/status.ts +87 -0
  41. package/src/spec/config.ts +63 -0
  42. package/src/spec/diff.ts +791 -0
  43. package/src/spec/extensions/benchmark.ts +347 -0
  44. package/src/spec/extensions/registry.ts +59 -0
  45. package/src/spec/extensions/types.ts +56 -0
  46. package/src/spec/grammar/index.ts +14 -0
  47. package/src/spec/grammar/parser.ts +443 -0
  48. package/src/spec/grammar/types.ts +70 -0
  49. package/src/spec/grammar/validator.ts +104 -0
  50. package/src/spec/loader.ts +174 -0
  51. package/src/spec/local-config.ts +59 -0
  52. package/src/spec/parser.ts +226 -0
  53. package/src/spec/path-utils.ts +73 -0
  54. package/src/spec/planner.ts +299 -0
  55. package/src/spec/prompt-renderer.ts +318 -0
  56. package/src/spec/skill-content.ts +119 -0
  57. package/src/spec/types.ts +239 -0
  58. package/src/spec/validator.ts +443 -0
  59. package/src/spec/workflows/check.ts +1534 -0
  60. package/src/spec/workflows/diff.ts +209 -0
  61. package/src/spec/workflows/generate.ts +1270 -0
  62. package/src/spec/workflows/guide.ts +190 -0
  63. package/src/spec/workflows/implement.ts +797 -0
  64. package/src/spec/workflows/import.ts +986 -0
  65. package/src/spec/workflows/init.ts +548 -0
  66. package/src/spec/workflows/status.ts +22 -0
  67. package/src/spec/workspace.ts +541 -0
  68. package/uninstall.ps1 +21 -0
  69. package/uninstall.sh +22 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Th0rgal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,407 @@
1
+ # Lisa
2
+
3
+ Lisa is a spec-driven agent orchestration CLI.
4
+
5
+ It turns markdown specs into implementation work, runs a selected coding harness, and checks for drift between specs, code, tests, and benchmark budgets.
6
+
7
+ ## What it does
8
+
9
+ - Treats `active` specs in `.specs/` as the source of truth for intended behavior
10
+ - Uses Git diffs on specs to decide what implementation work needs to happen
11
+ - Runs a single writer harness for implementation and isolated verifier audits during checks
12
+ - Prefers deterministic evidence first: code paths, test paths, test commands, benchmark commands
13
+ - Supports multiple harness adapters behind one CLI surface
14
+
15
+ ## Install
16
+
17
+ Lisa currently installs via the repository `install.sh` script.
18
+
19
+ Requirements:
20
+
21
+ - [Bun](https://bun.sh/)
22
+
23
+ Optional for agent-backed workflows:
24
+
25
+ - A supported harness CLI: `opencode`, `claude`, `codex`, or `gemini`
26
+
27
+ ```bash
28
+ git clone https://github.com/wkronmiller/lisa
29
+ cd lisa
30
+ ./install.sh
31
+ ```
32
+
33
+ The installer runs `bun install`, links the `lisa` command locally, and surfaces harness warnings when supported CLIs are missing.
34
+
35
+ ## Quick start
36
+
37
+ ```bash
38
+ # initialize a workspace in your repo
39
+ lisa spec init
40
+
41
+ # inspect workspace and harness availability
42
+ lisa spec status
43
+
44
+ # install Lisa guidance into local harness configs
45
+ lisa skill install --local
46
+
47
+ # see installed harness adapters
48
+ lisa spec harness list
49
+
50
+ # create or reuse a seed spec for your coding agent
51
+ lisa spec guide backend checkout-flow
52
+
53
+ # create a new spec
54
+ lisa spec generate backend checkout-flow
55
+
56
+ # inspect the spec delta and derived implementation plan
57
+ lisa spec diff
58
+
59
+ # implement changed specs
60
+ lisa spec implement
61
+
62
+ # verify changed specs or all specs
63
+ lisa spec check --changed
64
+ lisa spec check --all
65
+ ```
66
+
67
+ ## Core workflow
68
+
69
+ ```text
70
+ specs -> git diff -> structured deltas -> plan -> single writer harness -> tests/benchmarks -> parallel read-only verification -> reports
71
+ ```
72
+
73
+ Typical loop:
74
+
75
+ 1. Run `lisa skill install --local` when you want repo-local harness guidance installed automatically.
76
+ 2. Run `lisa spec guide backend <name>` when you want a draft seed spec and harness-specific next steps.
77
+ 3. Write or update a spec under `.specs/backend/` or `.specs/frontend/`.
78
+ 4. Run `lisa spec implement` to turn the spec delta into code and test changes.
79
+ 5. Run `lisa spec check --changed` or `lisa spec check --all` to verify conformance.
80
+
81
+ ## Spec layout
82
+
83
+ ```text
84
+ .specs/
85
+ project.md # optional global project descriptor
86
+ config.yaml
87
+ backend/
88
+ <spec-name>.md
89
+ <spec-name>.bench.<environment>.md
90
+ frontend/
91
+ <spec-name>.md
92
+ <spec-name>.bench.<environment>.md
93
+ environments/
94
+ <environment>.yaml
95
+ ```
96
+
97
+ - `project.md` is an optional global project descriptor (see below)
98
+ - Base behavioral specs live in `.specs/backend/` and `.specs/frontend/`
99
+ - Benchmark sidecars live next to their base spec
100
+ - Environment definitions live in `.specs/environments/`
101
+ - Runtime artifacts and reports are written under `.lisa/`
102
+
103
+ ## Project descriptor
104
+
105
+ `.specs/project.md` is an optional file that declares project-level defaults. When present, its content is included as harness context for all stages (`generate`, `implement`, `check`, `import`), so the harness knows the project stack instead of guessing.
106
+
107
+ ```md
108
+ ---
109
+ language: java
110
+ runtime: jdk21
111
+ framework: spring-boot
112
+ default_code_paths:
113
+ - src/main/java/**
114
+ default_test_paths:
115
+ - src/test/java/**
116
+ default_test_commands:
117
+ - ./gradlew test
118
+ build_commands:
119
+ - ./gradlew build
120
+ ---
121
+
122
+ # My Service
123
+
124
+ A Spring Boot REST API for order management.
125
+
126
+ ## Conventions
127
+ - Source code follows standard Maven/Gradle layout.
128
+ - Tests use JUnit 5 and Mockito.
129
+ - Integration tests live in `src/test/java/**/integration/`.
130
+ ```
131
+
132
+ The frontmatter fields provide structured defaults that individual specs can override. The markdown body is freeform and can describe conventions, patterns, or anything else the harness should know.
133
+
134
+ When a spec declares its own `code_paths`, `test_paths`, or `test_commands`, those values take precedence over the project-level defaults.
135
+
136
+ `lisa spec init` scaffolds a `project.md` template when creating a new workspace.
137
+
138
+ ## Spec format
139
+
140
+ Base specs are markdown with YAML frontmatter.
141
+
142
+ ```md
143
+ ---
144
+ id: frontend.checkout-flow
145
+ status: active
146
+ code_paths:
147
+ - src/components/checkout/**
148
+ - src/services/orders/**
149
+ test_paths:
150
+ - tests/checkout/**
151
+ test_commands:
152
+ - npm run test -- checkout
153
+ context_paths:
154
+ - docs/checkout-flow.md
155
+ - src/services/payments/types.ts
156
+ owners:
157
+ - payments-team
158
+ ---
159
+
160
+ # Summary
161
+ Enable customers to complete purchase with payment and address validation.
162
+
163
+ ## Use Cases
164
+ - Customer reviews cart and enters shipping address.
165
+ - Customer selects a payment method.
166
+ - System processes payment and creates an order.
167
+
168
+ ## Invariants
169
+ - No order is created until payment is captured.
170
+ - Retries never double-charge the customer.
171
+
172
+ ## Failure Modes
173
+ - Invalid addresses are rejected before payment.
174
+ - Payment retries do not create duplicate orders.
175
+
176
+ ## Acceptance Criteria
177
+ - Given valid address and payment, an order is created.
178
+ - Given payment decline, the customer can retry with another card.
179
+
180
+ ## Out of Scope
181
+ - International shipping.
182
+ ```
183
+
184
+ Required sections for active base specs:
185
+
186
+ - frontmatter with `id`, `status`, `code_paths`, and `test_commands` or `test_paths`
187
+ - optional `context_paths` in frontmatter: additional files passed to the harness as context during `generate`, `implement`, and `check` stages
188
+ - `# Summary`
189
+ - `## Use Cases`
190
+ - `## Invariants`
191
+ - `## Acceptance Criteria`
192
+ - `## Out of Scope`
193
+
194
+ `lisa spec generate` also includes `## Failure Modes`, and that section is used by planning workflows, but it is not currently required by the validator.
195
+
196
+ Status values:
197
+
198
+ - `draft`: imported, not yet authoritative
199
+ - `active`: source of truth and enforced
200
+ - `deprecated`: kept for history, not enforced for new work
201
+
202
+ ## Benchmark sidecars
203
+
204
+ Use a sidecar spec when a feature has performance requirements.
205
+
206
+ ```md
207
+ ---
208
+ id: frontend.checkout-flow.bench.ci-perf
209
+ kind: benchmark
210
+ extends: frontend.checkout-flow
211
+ status: active
212
+ required: true
213
+ environment: ci-perf
214
+ command: npm run bench:checkout -- --profile ci-perf --output json
215
+ baseline: origin/main
216
+ noise_tolerance_pct: 5
217
+ metrics:
218
+ page_load_ms: "<= 2000"
219
+ checkout_completion_ms: "<= 5000"
220
+ error_rate_pct: "<= 0.1"
221
+ ---
222
+
223
+ # Scenario
224
+ Checkout flow under expected concurrent load.
225
+ ```
226
+
227
+ `lisa spec check` runs the benchmark command and enforces declared thresholds for sidecars marked `required: true`.
228
+
229
+ `baseline` is a label used during verification. Lisa does not check out and run the baseline revision automatically; the benchmark command must emit baseline metrics if you want relative regression checks enforced.
230
+
231
+ ## Commands
232
+
233
+ | Command | Purpose |
234
+ | --- | --- |
235
+ | `lisa skill install --global` | Install Lisa guidance into global harness config roots |
236
+ | `lisa skill install --local` | Install Lisa guidance into the current repository |
237
+ | `lisa spec init` | Scaffold a `.specs` workspace |
238
+ | `lisa spec status` | Show workspace and harness status |
239
+ | `lisa spec harness list` | List registered harness adapters and capabilities |
240
+ | `lisa spec guide [backend|frontend] [name]` | Create or reuse a draft seed spec and point to the right harness skill |
241
+ | `lisa spec generate [backend|frontend] [name]` | Draft a spec with preview and approval |
242
+ | `lisa spec diff` | Show changed spec deltas and the derived plan |
243
+ | `lisa spec implement` | Apply code and test changes from changed specs |
244
+ | `lisa spec check --changed` | Verify only impacted specs |
245
+ | `lisa spec check --all` | Scan every base spec and verify active ones |
246
+ | `lisa spec import <path...>` | Draft specs from existing code paths |
247
+ | `lisa skill install --global|--local` | Install checked-in Lisa skill artifacts for supported harnesses |
248
+
249
+ ## Harness model
250
+
251
+ Lisa keeps the core workflow harness-agnostic.
252
+
253
+ Built-in adapters:
254
+
255
+ - `opencode`
256
+ - `codex`
257
+ - `claude-code`
258
+ - `gemini`
259
+
260
+ Harness selection lives in `.specs/config.yaml` and can be overridden by CLI flags.
261
+
262
+ ## Coding agent skills
263
+
264
+ Checked-in Lisa skill artifacts live under `skills/`:
265
+
266
+ - `skills/codex/AGENTS.md`
267
+ - `skills/opencode/AGENTS.md`
268
+ - `skills/claude-code/CLAUDE.md`
269
+ - `skills/gemini/GEMINI.md`
270
+
271
+ Install them with:
272
+
273
+ ```bash
274
+ lisa skill install --local
275
+ lisa skill install --global
276
+ ```
277
+
278
+ Install targets:
279
+
280
+ - Local: `AGENTS.md` for Codex, `.opencode/skills/lisa/SKILL.md` for OpenCode, `CLAUDE.md` for Claude Code, `GEMINI.md` for Gemini CLI
281
+ - Global: `${CODEX_HOME:-~/.codex}/AGENTS.md`, `${XDG_CONFIG_HOME:-~/.config}/opencode/skills/lisa/SKILL.md`, `~/.claude/CLAUDE.md`, `~/.gemini/GEMINI.md`
282
+
283
+ Keep these files aligned with the current CLI surface, supported harness adapters, install destinations, and `.specs/` layout whenever Lisa workflows change.
284
+
285
+ Install those checked-in skills into supported harnesses with:
286
+
287
+ ```bash
288
+ lisa skill install --local
289
+ lisa skill install --global
290
+ ```
291
+
292
+ Install targets:
293
+
294
+ - Codex: `AGENTS.md` locally, `${CODEX_HOME:-~/.codex}/AGENTS.md` globally
295
+ - Claude Code: `CLAUDE.md` locally, `~/.claude/CLAUDE.md` globally
296
+ - Gemini CLI: `GEMINI.md` locally, `~/.gemini/GEMINI.md` globally
297
+ - OpenCode: `.opencode/skills/lisa/SKILL.md` locally, `${XDG_CONFIG_HOME:-~/.config}/opencode/skills/lisa/SKILL.md` globally
298
+
299
+ Set `LISA_OUTPUT_MODE=interactive` or `LISA_OUTPUT_MODE=concise` to override Lisa's help and installer output mode.
300
+
301
+ `lisa spec guide` uses those checked-in skill artifacts to point a coding agent at the right harness-specific guidance before you return to `lisa spec diff`, `lisa spec implement`, and `lisa spec check`. In repos that do not keep checked-in `skills/` files yet, Lisa materializes the built-in skill under `.lisa/skills/` for the selected harness.
302
+
303
+ Optional managed agent guidance can be enabled in `.specs/config.yaml`:
304
+
305
+ ```yaml
306
+ agent_guidance:
307
+ enabled: true
308
+ target: docs/lisa-guidance.md
309
+ ```
310
+
311
+ When enabled, successful `lisa spec generate`, `lisa spec implement`, and `lisa spec import` runs refresh only the Lisa-managed block in the target file with the current command surface, skill artifact paths, and active-spec pointers. Avoid targeting `AGENTS.md`, `CLAUDE.md`, or `GEMINI.md` once those files have diverged from Lisa's bundled root guidance, because Lisa only rewrites those root targets when they still match the bundled artifact exactly or already contain a Lisa-managed block.
312
+
313
+ Example:
314
+
315
+ ```yaml
316
+ default_stage_profiles:
317
+ generate: planner
318
+ implement: implementer
319
+ check: verifier
320
+ import: importer
321
+
322
+ profiles:
323
+ planner:
324
+ harness: opencode
325
+ allow_edits: false
326
+ implementer:
327
+ harness: opencode
328
+ allow_edits: true
329
+ verifier:
330
+ harness: opencode
331
+ allow_edits: false
332
+ importer:
333
+ harness: opencode
334
+ allow_edits: false
335
+
336
+ harnesses:
337
+ opencode:
338
+ command: opencode
339
+ args: []
340
+ codex:
341
+ command: codex
342
+ args: []
343
+ claude-code:
344
+ command: claude
345
+ args: []
346
+ gemini:
347
+ command: gemini
348
+ args: []
349
+ ```
350
+
351
+ ## Reports and outputs
352
+
353
+ `lisa spec check` writes:
354
+
355
+ - `.lisa/spec-report.json`
356
+ - `.lisa/spec-report.md`
357
+ - `.lisa/check/<spec-id>.json` for per-spec details
358
+
359
+ Possible verification verdicts:
360
+
361
+ - `PASS`
362
+ - `FAIL`
363
+ - `UNSURE`
364
+ - `SKIPPED`
365
+
366
+ ## Development
367
+
368
+ ```bash
369
+ bun install
370
+ bun test ./tests
371
+ bun build lisa.ts --outfile bin/lisa-runtime.js --target bun
372
+ ```
373
+
374
+ Package scripts:
375
+
376
+ - `bun run start`
377
+ - `bun run test`
378
+ - `bun run build`
379
+ - `bun run install-local`
380
+
381
+ ## Project status
382
+
383
+ Lisa is usable today and, based on the current feature set, roughly `80%` complete.
384
+
385
+ Implemented:
386
+
387
+ - spec parsing and validation
388
+ - Git-backed spec diff and planning
389
+ - spec generation, implementation, verification, import, and harness listing
390
+ - benchmark sidecars and environment-based checks
391
+ - parallel snapshot-isolated verifier audits
392
+ - built-in `opencode`, `codex`, `claude-code`, and `gemini` adapters
393
+
394
+ Still rough:
395
+
396
+ - `lisa spec status` is useful but not very deep
397
+ - structured-output handling is not fully consistent across adapters
398
+ - edge-case coverage around adapter failures and benchmark parsing can be improved
399
+ - draft-to-active review flow after import is still lightweight
400
+
401
+ ## Design reference
402
+
403
+ Current design and workflow guidance lives in `AGENTS.md` and the self-hosted specs under `.specs/backend/`.
404
+
405
+ ## License
406
+
407
+ MIT