@llm4ts/shell 0.5.0 → 0.6.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.
Files changed (168) hide show
  1. package/dist/Cli.d.ts +2 -2
  2. package/dist/Cli.d.ts.map +1 -1
  3. package/dist/Cli.js +8 -4
  4. package/dist/Cli.js.map +1 -1
  5. package/dist/FlowCatalog.d.ts.map +1 -1
  6. package/dist/FlowCatalog.js +6 -2
  7. package/dist/FlowCatalog.js.map +1 -1
  8. package/flows/fixtures/scaffolds/kafka-streams-service/README.md +12 -0
  9. package/flows/fixtures/scaffolds/kafka-streams-service/pom.xml +49 -0
  10. package/flows/fixtures/scaffolds/kafka-streams-service/scripts/replay.sh +10 -0
  11. package/flows/fixtures/scaffolds/kafka-streams-service/src/main/java/com/meridian/scaffold/Application.java +29 -0
  12. package/flows/fixtures/scaffolds/kafka-streams-service/src/test/java/com/meridian/scaffold/ApplicationTests.java +21 -0
  13. package/flows/fixtures/scaffolds/kafka-streams-service/src/test/resources/features/.gitkeep +0 -0
  14. package/flows/fixtures/scaffolds/nextjs-spa/README.md +6 -0
  15. package/flows/fixtures/scaffolds/nextjs-spa/app/layout.js +11 -0
  16. package/flows/fixtures/scaffolds/nextjs-spa/app/page.js +7 -0
  17. package/flows/fixtures/scaffolds/nextjs-spa/docs/specs/.gitkeep +0 -0
  18. package/flows/fixtures/scaffolds/nextjs-spa/features/.gitkeep +0 -0
  19. package/flows/fixtures/scaffolds/nextjs-spa/next.config.js +7 -0
  20. package/flows/fixtures/scaffolds/nextjs-spa/package.json +15 -0
  21. package/flows/fixtures/scaffolds/nextjs-spa/tests/smoke.test.js +6 -0
  22. package/flows/fixtures/scaffolds/spring-bff/README.md +9 -0
  23. package/flows/fixtures/scaffolds/spring-bff/frontend/app/layout.js +11 -0
  24. package/flows/fixtures/scaffolds/spring-bff/frontend/app/page.js +7 -0
  25. package/flows/fixtures/scaffolds/spring-bff/frontend/next.config.js +7 -0
  26. package/flows/fixtures/scaffolds/spring-bff/frontend/package.json +15 -0
  27. package/flows/fixtures/scaffolds/spring-bff/frontend/tests/smoke.test.js +6 -0
  28. package/flows/fixtures/scaffolds/spring-bff/pom.xml +57 -0
  29. package/flows/fixtures/scaffolds/spring-bff/scripts/test.sh +6 -0
  30. package/flows/fixtures/scaffolds/spring-bff/src/main/java/com/meridian/bff/Application.java +12 -0
  31. package/flows/fixtures/scaffolds/spring-bff/src/main/resources/application.yaml +12 -0
  32. package/flows/fixtures/scaffolds/spring-bff/src/test/java/com/meridian/bff/ApplicationTests.java +12 -0
  33. package/flows/fixtures/scaffolds/spring-bff/src/test/resources/features/.gitkeep +0 -0
  34. package/flows/fixtures/scaffolds/spring-boot-service/README.md +7 -0
  35. package/flows/fixtures/scaffolds/spring-boot-service/pom.xml +53 -0
  36. package/flows/fixtures/scaffolds/spring-boot-service/scripts/replay.sh +9 -0
  37. package/flows/fixtures/scaffolds/spring-boot-service/src/main/java/com/meridian/scaffold/Application.java +12 -0
  38. package/flows/fixtures/scaffolds/spring-boot-service/src/main/resources/application.yaml +12 -0
  39. package/flows/fixtures/scaffolds/spring-boot-service/src/test/java/com/meridian/scaffold/ApplicationTests.java +12 -0
  40. package/flows/fixtures/scaffolds/spring-boot-service/src/test/resources/features/.gitkeep +0 -0
  41. package/flows/implement.js +29 -0
  42. package/flows/issue-pr.js +71 -0
  43. package/flows/judge-suite.js +48 -0
  44. package/flows/local.js +40 -0
  45. package/flows/modernize-bench.js +263 -0
  46. package/flows/modernize-extract.js +454 -0
  47. package/flows/modernize-implement.js +249 -0
  48. package/flows/modernize-review.js +237 -0
  49. package/flows/modernize-seed.js +189 -0
  50. package/flows/modernize-survey.js +0 -0
  51. package/flows/modernize-verify.js +435 -0
  52. package/flows/packs/ace-integration/lessons.md +6 -0
  53. package/flows/packs/ace-integration/pack.md +29 -0
  54. package/flows/packs/ace-integration/prompts/analysis.md +21 -0
  55. package/flows/packs/ace-integration/prompts/bdd.md +13 -0
  56. package/flows/packs/ace-integration/prompts/implement.md +17 -0
  57. package/flows/packs/ace-integration/prompts/plan.md +12 -0
  58. package/flows/packs/ace-integration/prompts/review.md +17 -0
  59. package/flows/packs/ace-integration/prompts/spec.md +29 -0
  60. package/flows/packs/ace-integration/reviewers/routing-fidelity.md +19 -0
  61. package/flows/packs/ace-integration/reviewers/traceability.md +13 -0
  62. package/flows/packs/ace-kafka/lessons.md +6 -0
  63. package/flows/packs/ace-kafka/pack.md +36 -0
  64. package/flows/packs/ace-kafka/prompts/analysis.md +21 -0
  65. package/flows/packs/ace-kafka/prompts/bdd.md +13 -0
  66. package/flows/packs/ace-kafka/prompts/implement.md +34 -0
  67. package/flows/packs/ace-kafka/prompts/plan.md +12 -0
  68. package/flows/packs/ace-kafka/prompts/review.md +17 -0
  69. package/flows/packs/ace-kafka/prompts/spec.md +31 -0
  70. package/flows/packs/ace-kafka/prompts/vectors.md +21 -0
  71. package/flows/packs/ace-kafka/reviewers/event-contracts.md +9 -0
  72. package/flows/packs/ace-kafka/reviewers/routing-fidelity.md +19 -0
  73. package/flows/packs/ace-kafka/reviewers/traceability.md +13 -0
  74. package/flows/packs/cobol-kafka/lessons.md +3 -0
  75. package/flows/packs/cobol-kafka/pack.md +51 -0
  76. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-001-record-to-event.md +7 -0
  77. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-002-job-step-topology.md +6 -0
  78. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-003-checkpoint-idempotence.md +7 -0
  79. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-004-eod-totals-window.md +7 -0
  80. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-005-reject-topic.md +6 -0
  81. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-006-keyed-state-store.md +7 -0
  82. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-007-outbox.md +7 -0
  83. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-008-partition-key.md +7 -0
  84. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-009-batch-window-cutoff.md +7 -0
  85. package/flows/packs/cobol-kafka/patterns/PAT-STREAM-010-replay-backfill.md +7 -0
  86. package/flows/packs/cobol-kafka/prompts/analysis.md +23 -0
  87. package/flows/packs/cobol-kafka/prompts/bdd.md +15 -0
  88. package/flows/packs/cobol-kafka/prompts/implement.md +47 -0
  89. package/flows/packs/cobol-kafka/prompts/plan.md +13 -0
  90. package/flows/packs/cobol-kafka/prompts/review.md +17 -0
  91. package/flows/packs/cobol-kafka/prompts/spec.md +28 -0
  92. package/flows/packs/cobol-kafka/prompts/vectors.md +21 -0
  93. package/flows/packs/cobol-kafka/reviewers/cobol-fidelity.md +16 -0
  94. package/flows/packs/cobol-kafka/reviewers/pattern-conformance.md +10 -0
  95. package/flows/packs/cobol-kafka/reviewers/traceability.md +13 -0
  96. package/flows/packs/cobol-springboot/lessons.md +3 -0
  97. package/flows/packs/cobol-springboot/pack.md +51 -0
  98. package/flows/packs/cobol-springboot/prompts/analysis.md +23 -0
  99. package/flows/packs/cobol-springboot/prompts/bdd.md +15 -0
  100. package/flows/packs/cobol-springboot/prompts/implement.md +31 -0
  101. package/flows/packs/cobol-springboot/prompts/plan.md +13 -0
  102. package/flows/packs/cobol-springboot/prompts/review.md +17 -0
  103. package/flows/packs/cobol-springboot/prompts/spec.md +28 -0
  104. package/flows/packs/cobol-springboot/prompts/vectors.md +22 -0
  105. package/flows/packs/cobol-springboot/reviewers/cobol-fidelity.md +16 -0
  106. package/flows/packs/cobol-springboot/reviewers/pattern-conformance.md +10 -0
  107. package/flows/packs/cobol-springboot/reviewers/traceability.md +13 -0
  108. package/flows/packs/jsp-bff-nextjs/lessons.md +6 -0
  109. package/flows/packs/jsp-bff-nextjs/pack.md +30 -0
  110. package/flows/packs/jsp-bff-nextjs/prompts/analysis.md +20 -0
  111. package/flows/packs/jsp-bff-nextjs/prompts/bdd.md +10 -0
  112. package/flows/packs/jsp-bff-nextjs/prompts/implement.md +17 -0
  113. package/flows/packs/jsp-bff-nextjs/prompts/plan.md +12 -0
  114. package/flows/packs/jsp-bff-nextjs/prompts/review.md +16 -0
  115. package/flows/packs/jsp-bff-nextjs/prompts/spec.md +27 -0
  116. package/flows/packs/jsp-bff-nextjs/reviewers/bff-boundary.md +18 -0
  117. package/flows/packs/jsp-bff-nextjs/reviewers/traceability.md +13 -0
  118. package/flows/packs/jsp-nextjs/lessons.md +6 -0
  119. package/flows/packs/jsp-nextjs/pack.md +29 -0
  120. package/flows/packs/jsp-nextjs/prompts/analysis.md +21 -0
  121. package/flows/packs/jsp-nextjs/prompts/bdd.md +12 -0
  122. package/flows/packs/jsp-nextjs/prompts/implement.md +17 -0
  123. package/flows/packs/jsp-nextjs/prompts/plan.md +14 -0
  124. package/flows/packs/jsp-nextjs/prompts/review.md +16 -0
  125. package/flows/packs/jsp-nextjs/prompts/spec.md +26 -0
  126. package/flows/packs/jsp-nextjs/reviewers/traceability.md +13 -0
  127. package/flows/packs/jsp-nextjs/reviewers/ux-fidelity.md +16 -0
  128. package/flows/patterns/PAT-COBOL-001-comp3-money.md +7 -0
  129. package/flows/patterns/PAT-COBOL-002-redefines.md +7 -0
  130. package/flows/patterns/PAT-COBOL-003-88-levels.md +7 -0
  131. package/flows/patterns/PAT-COBOL-004-perform-thru.md +7 -0
  132. package/flows/patterns/PAT-COBOL-005-file-status.md +6 -0
  133. package/flows/patterns/PAT-COBOL-006-sqlcode.md +7 -0
  134. package/flows/patterns/PAT-COBOL-007-validation-order.md +7 -0
  135. package/flows/patterns/PAT-COBOL-008-zoned-decimal.md +6 -0
  136. package/flows/patterns/PAT-COBOL-009-occurs-table.md +6 -0
  137. package/flows/patterns/PAT-COBOL-010-copybook-record.md +7 -0
  138. package/flows/patterns/PAT-COBOL-011-batch-counters.md +6 -0
  139. package/flows/patterns/PAT-COBOL-012-commit-frequency.md +7 -0
  140. package/flows/patterns/PAT-COBOL-013-abend.md +6 -0
  141. package/flows/patterns/PAT-COBOL-014-reject-file.md +6 -0
  142. package/flows/patterns/PAT-COBOL-015-accept-date.md +6 -0
  143. package/flows/patterns/PAT-COBOL-016-string-building.md +6 -0
  144. package/flows/patterns/PAT-COBOL-017-cursor-loop.md +6 -0
  145. package/flows/patterns/PAT-COBOL-018-yn-switches.md +6 -0
  146. package/flows/patterns/PAT-COBOL-019-shared-accumulators.md +6 -0
  147. package/flows/patterns/PAT-COBOL-020-tiered-fees.md +7 -0
  148. package/flows/patterns/PAT-COBOL-021-overdraft-floor.md +7 -0
  149. package/flows/patterns/PAT-COBOL-022-jcl-job-net.md +6 -0
  150. package/flows/patterns/PAT-COBOL-023-sort-step.md +6 -0
  151. package/flows/patterns/PAT-COBOL-024-fixed-width-records.md +6 -0
  152. package/flows/patterns/PAT-COBOL-025-audit-rows.md +6 -0
  153. package/flows/sdd.js +114 -0
  154. package/package.json +5 -4
  155. package/src/Cli.ts +13 -4
  156. package/src/FlowCatalog.ts +8 -2
  157. package/flows/implement.ts +0 -38
  158. package/flows/issue-pr.ts +0 -108
  159. package/flows/judge-suite.ts +0 -63
  160. package/flows/local.ts +0 -59
  161. package/flows/modernize-bench.ts +0 -362
  162. package/flows/modernize-extract.ts +0 -633
  163. package/flows/modernize-implement.ts +0 -333
  164. package/flows/modernize-review.ts +0 -343
  165. package/flows/modernize-seed.ts +0 -259
  166. package/flows/modernize-survey.ts +0 -0
  167. package/flows/modernize-verify.ts +0 -611
  168. package/flows/sdd.ts +0 -181
package/flows/sdd.ts DELETED
@@ -1,181 +0,0 @@
1
- // Spec-driven development: write a specification, encode it as red tests, implement to green.
2
- import { join } from "node:path"
3
- import * as Effect from "effect/Effect"
4
- import { makeChat } from "@llm4ts/flow/Chat"
5
- import { FlowAborted } from "@llm4ts/flow/FlowError"
6
- import { Plan, defaultPlanPath } from "@llm4ts/flow/Plan"
7
- import { implementTaskLoop, stage } from "@llm4ts/flow/PlanExecution"
8
- import { defaultPlanInstructions, planFrom, writeBrief } from "@llm4ts/flow/Planner"
9
- import { makePlanStore } from "@llm4ts/flow/Persistence"
10
- import {
11
- lintCommand,
12
- minimalReviewers,
13
- reviewAndFixLoop,
14
- type ReviewResult
15
- } from "@llm4ts/flow/Review"
16
- import { asReadOnly, coderFromEnv, gemini, withModel } from "@llm4ts/runner/Connectors"
17
- import { resolveFlowInput } from "@llm4ts/runner/FlowArgs"
18
- import { runFlowMain, runNode } from "@llm4ts/runner/FlowRunner"
19
- import { nodePlainFileStore } from "@llm4ts/runner/NodePlainFileStore"
20
- import { nodeProcessExecutor } from "@llm4ts/runner/NodeProcessExecutor"
21
-
22
- const proModel = process.env.LLM4TS_REASONING_MODEL ?? "gemini-3-pro-preview"
23
- const flashModel = process.env.LLM4TS_CODER_MODEL ?? "gemini-2.5-flash"
24
-
25
- const specInstructions = [
26
- "Turn the change request into a precise repository specification with context, goals,",
27
- "non-goals, and a numbered list of testable Given/When/Then acceptance criteria.",
28
- "Explore the repository as needed. Return Markdown prose, not a task list."
29
- ].join("\n")
30
-
31
- const planInstructions = [
32
- defaultPlanInstructions,
33
- "",
34
- "The request below is a specification with numbered acceptance criteria.",
35
- "The first task must encode those criteria as tests without changing production code.",
36
- "Every later task implements production behavior toward making those tests pass."
37
- ].join("\n")
38
-
39
- const verificationFailure = (result: ReviewResult): FlowAborted =>
40
- FlowAborted.make({
41
- message: [
42
- "acceptance criteria not met:",
43
- ...result.issues.map((issue) => `${issue.title}\n${issue.description}`)
44
- ].join("\n\n")
45
- })
46
-
47
- const program = Effect.gen(function* () {
48
- const input = yield* resolveFlowInput(
49
- "Add due dates, mark overdue items in list output, and show items due today."
50
- )
51
- const explicitCoder = process.env.LLM4TS_CODER?.trim()
52
- const coder =
53
- explicitCoder === undefined || explicitCoder.length === 0
54
- ? withModel(gemini, flashModel)
55
- : coderFromEnv(process.env)
56
- const reasoning =
57
- explicitCoder === undefined || explicitCoder.length === 0
58
- ? asReadOnly(withModel(gemini, proModel))
59
- : asReadOnly(coder)
60
- const reviewer =
61
- explicitCoder === undefined || explicitCoder.length === 0
62
- ? asReadOnly(withModel(gemini, flashModel))
63
- : asReadOnly(coder)
64
- const store = makePlanStore(nodePlainFileStore)
65
- const planPath = join(input.workDir, defaultPlanPath(input.prompt))
66
-
67
- yield* runNode(
68
- {
69
- workDir: input.workDir,
70
- workspace: input.workspace,
71
- userPrompt: input.prompt,
72
- coder,
73
- reasoning,
74
- reviewers: [reviewer],
75
- environment: process.env
76
- },
77
- (context) =>
78
- Effect.gen(function* () {
79
- const plan = yield* stage(
80
- context.events,
81
- "specification and plan",
82
- store.recoverOrCreate(
83
- planPath,
84
- Effect.gen(function* () {
85
- const spec = yield* writeBrief(context.reasoning, input.prompt, specInstructions)
86
- const planned = yield* planFrom(context.reasoning, spec, planInstructions)
87
- return Plan.make({ ...planned, brief: spec })
88
- })
89
- )
90
- )
91
- const spec =
92
- plan.brief === undefined || plan.brief.length === 0
93
- ? yield* writeBrief(context.reasoning, input.prompt, specInstructions)
94
- : plan.brief
95
- const planWithSpec =
96
- plan.brief === undefined || plan.brief.length === 0
97
- ? Plan.make({ ...plan, brief: spec })
98
- : plan
99
- if (planWithSpec !== plan) {
100
- yield* store.save(planPath, planWithSpec)
101
- }
102
-
103
- yield* stage(context.events, "branch", context.git.checkoutOrCreate(planWithSpec.epicId))
104
- const specPath = join(input.workDir, `specs/${planWithSpec.epicId}.md`)
105
- yield* stage(
106
- context.events,
107
- "commit specification",
108
- nodePlainFileStore
109
- .read(specPath)
110
- .pipe(
111
- Effect.flatMap((existing) =>
112
- existing === undefined
113
- ? nodePlainFileStore
114
- .writeAtomic(specPath, `${spec}\n`)
115
- .pipe(
116
- Effect.andThen(
117
- context.git.commitAll(`${planWithSpec.epicId}: specification`)
118
- ),
119
- Effect.asVoid
120
- )
121
- : Effect.void
122
- )
123
- )
124
- )
125
-
126
- const coderChat = yield* makeChat(context.coder, {
127
- system:
128
- "Implement one task at a time. The committed specification is the contract; do not weaken its tests."
129
- })
130
- const testGate = lintCommand(
131
- nodeProcessExecutor,
132
- context.events,
133
- ["mvn", "-q", "test"],
134
- input.workDir
135
- )
136
- const compileGate = lintCommand(
137
- nodeProcessExecutor,
138
- context.events,
139
- ["mvn", "-q", "test-compile"],
140
- input.workDir
141
- )
142
- const firstTitle = planWithSpec.tasks[0]?.title
143
-
144
- yield* implementTaskLoop(store, context.events, planPath, planWithSpec, (task) =>
145
- Effect.gen(function* () {
146
- const testsTask = task.title === firstTitle
147
- yield* coderChat.ask(planWithSpec.taskPrompt(task))
148
- yield* reviewAndFixLoop({
149
- reviewers: minimalReviewers,
150
- reviewerService: context.reviewers[0] ?? context.reasoning,
151
- coder: coderChat,
152
- taskTitle: task.title,
153
- currentDiff: context.git.diffAll,
154
- events: context.events,
155
- lint: testsTask ? compileGate : testGate,
156
- parallelism: 1
157
- })
158
- if (testsTask) {
159
- const red = yield* testGate
160
- if (red.isClean) {
161
- return yield* FlowAborted.make({
162
- message:
163
- "the new tests pass before implementation; the specification is not encoded by a red test"
164
- })
165
- }
166
- }
167
- yield* context.git.commitAll(`${planWithSpec.epicId}: ${task.title}`)
168
- })
169
- )
170
- yield* stage(
171
- context.events,
172
- "verify acceptance criteria",
173
- Effect.flatMap(testGate, (result) =>
174
- result.isClean ? Effect.void : Effect.fail(verificationFailure(result))
175
- )
176
- )
177
- })
178
- )
179
- })
180
-
181
- runFlowMain(program)