@lumpcode/recipes 0.0.12

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.
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Lumpcode contributors
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # @lumpcode/recipes
2
+
3
+ Lumpcode **recipes** and **kit** helpers for authoring lump configs without boilerplate.
4
+
5
+ Private monorepo workspace for now (same rollout path as `@lumpcode/cli-utils`).
6
+
7
+ ## Recipes
8
+
9
+ | Recipe | Export | Use when |
10
+ |--------|--------|----------|
11
+ | **backlog** | `backlog` | Generic YAML backlog with a typed stage map and per-item stage resolution |
12
+ | **featureBacklog** | `featureBacklog` | Feature items with PRD → test plan → test implementation → implementation |
13
+ | **abstractionFinder** | `abstractionFinder` | Ephemeral contexts that scan for duplicated CLI utils and append one backlog item + PRD per run |
14
+ | **abstractionBacklog** | `abstractionBacklog` | YAML backlog items with PRDs — implement abstraction with verify-until-green, then move item to DONE |
15
+
16
+ ## Kit
17
+
18
+ Flat helpers under `src/kit/` (re-exported from the package root):
19
+
20
+ - `backlog` recipe helpers — `resolveBacklogPaths`, `validateBaseBacklogItem`, `requireArtifactStep`, `projectRootFromConfigUrl`
21
+ - `getRecursiveSteps` — agent step(s) + validation command, retry until pass
22
+ - `retryUntilGreen` — opinionated wrapper over `getRecursiveSteps` with default fix prompt
23
+ - `ephemeralContextListFn` — N fresh synthetic contexts per run (`contextCount`, index-aware names)
24
+ - `ymlBacklogContexts` — `getContextListFn` from a YAML backlog file with optional per-item parsing
25
+ - `setTaskDoneStep` — move finished item from BACKLOG to DONE after a context completes
26
+ - `resolveImplValidateCommand` — string, descriptor, or fn → `ValidationCommandFn`
27
+ - `shellCommand` — `sh -c` helper for validation commands
28
+
29
+ ## Generic backlog stage map
30
+
31
+ Consumers declare every legal stage key and how each stage completes:
32
+
33
+ ```ts
34
+ import { backlog } from '@lumpcode/recipes';
35
+
36
+ export default backlog({
37
+ configUrl: import.meta.url,
38
+ stages: {
39
+ draft: { steps: [{ promptTemplate: 'Draft docs.' }], completion: 'keepPending' },
40
+ ship: { steps: [{ promptTemplate: 'Ship it.' }], completion: 'moveToDone' },
41
+ },
42
+ resolveItem({ item }) {
43
+ return item.task.includes('draft')
44
+ ? { stage: 'draft' }
45
+ : { stage: 'ship' };
46
+ },
47
+ });
48
+ ```
49
+
50
+ `resolveItem` returns `{ stage, contextName?, variables?, additionalDependsOnContexts? }` or `{ ignored: true }`. Terminal stages with `completion: 'moveToDone'` append `setTaskDoneStep`.
51
+
52
+ ## Examples
53
+
54
+ ### featureBacklog
55
+
56
+ ```ts
57
+ // .lumpcode/lumps/backlog/config.ts
58
+ import { LumpJsConfig } from '@lumpcode/cli-types';
59
+ import { featureBacklog } from '@lumpcode/recipes';
60
+
61
+ export default {
62
+ ...featureBacklog({
63
+ baseBranch: 'dev',
64
+ command: 'cursor',
65
+ configUrl: import.meta.url,
66
+ registerCommands: ['cursor'],
67
+ maximumNumberOfConcurrentBranches: 5,
68
+ verbose: true,
69
+ keepHistory: true,
70
+ lumpVariables: { model: 'composer-2.5' },
71
+ discoveryBranch: 'dev',
72
+ implValidateCommand: [
73
+ 'npm run build -w=@lumpcode/cli',
74
+ 'npm run test -w=@lumpcode/cli',
75
+ ].join(' && '),
76
+ }),
77
+ } satisfies LumpJsConfig;
78
+ ```
79
+
80
+ ### abstractionFinder + abstractionBacklog
81
+
82
+ Two-lump pipeline: finder tops up the implementer backlog; implementer runs items that already have PRDs.
83
+
84
+ ```ts
85
+ // .lumpcode/lumps/abstractionFinder/config.ts
86
+ import { LumpJsConfig } from '@lumpcode/cli-types';
87
+ import { abstractionFinder } from '@lumpcode/recipes';
88
+
89
+ export default {
90
+ ...abstractionFinder({
91
+ maxPendingAbstractions: 5,
92
+ scanDirectories: ['packages/apps/cli'],
93
+ backlogFilePath: '.lumpcode/lumps/abstractionImplementer/BACKLOG.yml',
94
+ doneFilePath: '.lumpcode/lumps/abstractionImplementer/DONE.yml',
95
+ prdDirPath: '.lumpcode/lumps/abstractionImplementer/prds',
96
+ command: 'cursor',
97
+ lumpVariables: { model: 'composer-2.5' },
98
+ discoveryBranch: 'dev',
99
+ }),
100
+ } satisfies LumpJsConfig;
101
+ ```
102
+
103
+ ```ts
104
+ // .lumpcode/lumps/abstractionImplementer/config.ts
105
+ import { LumpJsConfig } from '@lumpcode/cli-types';
106
+ import { abstractionBacklog } from '@lumpcode/recipes';
107
+
108
+ export default {
109
+ ...abstractionBacklog({
110
+ baseBranch: 'dev',
111
+ command: 'cursor',
112
+ configUrl: import.meta.url,
113
+ registerCommands: ['cursor'],
114
+ maximumNumberOfConcurrentBranches: 3,
115
+ verbose: true,
116
+ keepHistory: true,
117
+ lumpVariables: { model: 'composer-2.5' },
118
+ discoveryBranch: 'dev',
119
+ }),
120
+ } satisfies LumpJsConfig;
121
+ ```
122
+
123
+ ### Custom config with kit helpers
124
+
125
+ ```ts
126
+ import { defineConfig } from '@lumpcode/cli-types';
127
+ import { retryUntilGreen, shellCommand } from '@lumpcode/recipes';
128
+
129
+ export default defineConfig({
130
+ command: 'cursor',
131
+ steps: retryUntilGreen({
132
+ steps: [{ promptTemplate: 'Refactor duplicated helpers in src/.' }],
133
+ validationCommandFn: () => shellCommand('npm test && npm run build'),
134
+ }),
135
+ });
136
+ ```
137
+
138
+ ## Build
139
+
140
+ From the monorepo root:
141
+
142
+ ```bash
143
+ npm run build -w=@lumpcode/core
144
+ npm run build -w=@lumpcode/cli-types
145
+ npm run build -w=@lumpcode/cli-utils
146
+ npm run build -w=@lumpcode/recipes
147
+ ```
148
+
149
+ ## Test
150
+
151
+ ```bash
152
+ npm run test -w=@lumpcode/recipes
153
+ ```