@lumpcode/recipes 0.3.0 → 0.4.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.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,20 @@
1
1
  import { CommandDescriptor, MaybePromise, PostCommandExecFn, Step } from '@lumpcode/core';
2
- import { LumpVariables, GetContextListFnInput, GetContextListFn, StepVariables, CommandFn, LumpJsConfig, LumpJsConfigSteps, MaybePromise as MaybePromise$1, Context } from '@lumpcode/cli-utils';
2
+ import { LumpVariables, PostSetupWorkspaceFnInput, PostTeardownWorkspaceFn, GetContextListFnInput, GetContextListFn, StepVariables, CommandFn, LumpJsConfig, LumpJsConfigSteps, MaybePromise as MaybePromise$1, Context, PromptFn } from '@lumpcode/cli-utils';
3
3
 
4
4
  /** Run a shell script via `sh -c` (portable on Unix-like systems and Git Bash on Windows). */
5
5
  declare function shellCommand(script: string): CommandDescriptor;
6
6
 
7
+ declare const OPEN_PR_PROVIDERS: readonly ["github"];
8
+ type OpenPrProvider = (typeof OPEN_PR_PROVIDERS)[number];
9
+ type OpenPrPostTeardownOptions<V extends LumpVariables = LumpVariables> = {
10
+ provider: OpenPrProvider;
11
+ /** Overrides the lump name parsed from `lump/<lumpName>/…` branches. */
12
+ lumpName?: string;
13
+ title?: (input: PostSetupWorkspaceFnInput<V>) => string;
14
+ body?: (input: PostSetupWorkspaceFnInput<V>) => string;
15
+ };
16
+ declare function openPrPostTeardown<V extends LumpVariables = LumpVariables>(options: OpenPrPostTeardownOptions<V>): PostTeardownWorkspaceFn<V>;
17
+
7
18
  type MaybePromGetter<T, P = void> = T | ((input: P) => MaybePromise<T>);
8
19
  declare function normalizeMaybePromGetter<T, P = void>(maybePromGetter: MaybePromGetter<T, P>): (input: P) => MaybePromise<T>;
9
20
  declare function normalizeMaybePromGetter<T, P = void>(maybePromGetter: MaybePromGetter<T, P> | undefined, defaultValue: T): (input?: P) => MaybePromise<T>;
@@ -92,9 +103,12 @@ type DoneBacklogItem<T extends BaseBacklogItem = BaseBacklogItem> = T & {
92
103
 
93
104
  type FolderBacklogContextsOptions<Item extends BaseBacklogItem = BaseBacklogItem> = {
94
105
  backlogItemsDir: string;
106
+ /** When true, umbrella parents with tickets are emitted for wrap-up (featureBacklog). */
107
+ includeUmbrellaParents?: boolean;
95
108
  /**
96
109
  * `folderName` is the path relative to `todo/`: the item folder, or
97
- * `<parent>/tickets/<ticket>` when the parent has a `tickets/` directory.
110
+ * `<parent>/tickets/<ticket>` when the parent is an umbrella
111
+ * (`tickets/` exists or completed tickets exist).
98
112
  */
99
113
  parseItem?: (item: BaseBacklogItem, folderName: string, raw: unknown) => Item;
100
114
  parseContext?: (item: Item, folderName: string) => MaybePromise$1<{
@@ -102,9 +116,22 @@ type FolderBacklogContextsOptions<Item extends BaseBacklogItem = BaseBacklogItem
102
116
  ignored?: boolean;
103
117
  }>;
104
118
  };
105
- /** Path relative to `todo/`, using `/` so it is stable in context variables. */
106
- declare function listTodoRelativeDirs(todoDir: string): Promise<string[]>;
107
- declare function folderBacklogContexts<Item extends BaseBacklogItem = BaseBacklogItem, V extends LumpVariables = LumpVariables>({ backlogItemsDir, parseItem, parseContext, }: FolderBacklogContextsOptions<Item>): GetContextListFn<V>;
119
+ type ListTodoRelativeDirsOptions = {
120
+ includeUmbrellaParents?: boolean;
121
+ };
122
+ /** Live and completed ticket folder names for an umbrella parent, sorted uniquely. */
123
+ declare function listUmbrellaTicketNames(input: {
124
+ todoDir: string;
125
+ parentName: string;
126
+ }): Promise<string[]>;
127
+ /**
128
+ * Path relative to `todo/`, using `/` so it is stable in context variables.
129
+ * A top-level folder is an umbrella (never itself an item) when it has live
130
+ * tickets, a leftover `tickets/` directory, or tickets already under
131
+ * sibling `completed/<name>/tickets/`.
132
+ */
133
+ declare function listTodoRelativeDirs(todoDir: string, options?: ListTodoRelativeDirsOptions): Promise<string[]>;
134
+ declare function folderBacklogContexts<Item extends BaseBacklogItem = BaseBacklogItem, V extends LumpVariables = LumpVariables>({ backlogItemsDir, includeUmbrellaParents, parseItem, parseContext, }: FolderBacklogContextsOptions<Item>): GetContextListFn<V>;
108
135
 
109
136
  /** Moves a finished backlog item folder from todo/ to the same relative path under completed/. */
110
137
  declare function folderSetTaskDoneStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(input: {
@@ -174,6 +201,8 @@ type BacklogItemResolution<StageName extends string> = {
174
201
  type BacklogOptions<Item extends BaseBacklogItem, V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables, Stages extends Record<string, BacklogStageDefinition<V, SV>> = Record<string, BacklogStageDefinition<V, SV>>> = {
175
202
  configUrl: string | URL;
176
203
  backlogItemsDir?: string;
204
+ /** When true, umbrella parents with tickets are emitted for wrap-up (featureBacklog). */
205
+ includeUmbrellaParents?: boolean;
177
206
  stages: Stages;
178
207
  parseItem?: (item: BaseBacklogItem, folderName: string, raw: unknown) => Item;
179
208
  resolveItem(input: {
@@ -192,41 +221,75 @@ declare const BACKLOG_ITEM_DIR_VAR = "BACKLOG_ITEM_DIR";
192
221
  declare function backlog<Item extends BaseBacklogItem, V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables, Stages extends Record<string, BacklogStageDefinition<V, SV>> = Record<string, BacklogStageDefinition<V, SV>>>(options: BacklogOptions<Item, V, SV, Stages>): LumpJsConfig<V, SV>;
193
222
  declare const backlogRecipe: typeof backlog;
194
223
 
195
- type FeatureBacklogWorkflow = 'tdd' | 'directImpl' | 'manual';
196
- type FeatureBacklogRunnableWorkflow = Exclude<FeatureBacklogWorkflow, 'manual'>;
224
+ declare const FEATURE_BACKLOG_WORKFLOW_STAGES: readonly ["req", "testPlan", "testImpl", "impl", "directImpl"];
225
+ type FeatureBacklogWorkflowStage = (typeof FEATURE_BACKLOG_WORKFLOW_STAGES)[number];
226
+ type FeatureBacklogWorkflow = readonly FeatureBacklogWorkflowStage[];
227
+ type FeatureBacklogTerminalStage = 'impl' | 'directImpl';
228
+ declare const DEFAULT_FEATURE_BACKLOG_WORKFLOW: readonly ["req", "testPlan", "testImpl"];
229
+ declare const DEFAULT_PRIMARY_DISCOVERY_BRANCH = "dev";
230
+ declare const DEFAULT_ITEM_DISCOVERY_BRANCH_PREFIX = "feature";
231
+ declare const FEATURE_BACKLOG_RESERVED_NAME_SUFFIXES: readonly ["_req", "_testPlan", "_testImpl"];
197
232
  type FeatureBacklogItem = BaseBacklogItem & {
198
- manualReq?: boolean;
199
233
  workflow?: FeatureBacklogWorkflow;
234
+ manual?: boolean;
200
235
  completedAt?: string;
201
236
  /** Path relative to `backlogItems/todo/`; tickets live at `<parent>/tickets/<name>`. */
202
237
  todoRelativeDir: string;
203
238
  /** Parent todo folder name when this item is a ticket. */
204
239
  parentName?: string;
205
240
  };
206
- type FeatureBacklogStage = 'makeReq' | 'makeTestPlan' | 'testImpl' | 'implementation' | 'directImpl';
241
+ type FeatureBacklogStage = 'req' | 'testPlan' | 'testImpl' | 'impl' | 'directImpl' | 'completion';
207
242
  type FeatureBacklogContextVariables = {
208
243
  TASK_NAME: string;
209
244
  TASK: string;
210
245
  BACKLOG_ITEMS_DIR: string;
211
246
  BACKLOG_ITEM_DIR: string;
212
247
  BACKLOG_STAGE: FeatureBacklogStage;
248
+ WORKFLOW?: string;
213
249
  REQ_FILE?: string;
214
250
  TEST_PLAN_FILE?: string;
215
251
  };
252
+ type FeatureBacklogPromptStage = Exclude<FeatureBacklogStage, 'completion'>;
253
+ type FeatureBacklogPromptFns<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = {
254
+ [K in FeatureBacklogPromptStage]?: PromptFn<V, SV>;
255
+ };
216
256
  type FeatureBacklogOptions<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = {
217
257
  configUrl: string | URL;
218
258
  implValidateCommand?: ValidationCommandFn<V, SV> | string;
219
259
  backlogItemsDir?: string;
220
- } & Omit<LumpJsConfig<V, SV>, 'contextListJson' | 'contextMatchFn' | 'getContextListFn' | 'prompt' | 'steps'>;
221
- declare const FEATURE_BACKLOG_WORKFLOWS: readonly ["tdd", "directImpl", "manual"];
222
- declare function parseFeatureWorkflow(itemName: string, raw: unknown): FeatureBacklogWorkflow | undefined;
260
+ primaryDiscoveryBranch?: string;
261
+ itemDiscoveryBranchPrefix?: string;
262
+ promptFns?: FeatureBacklogPromptFns<V, SV>;
263
+ } & Omit<LumpJsConfig<V, SV>, 'contextListJson' | 'contextMatchFn' | 'getContextListFn' | 'prompt' | 'steps' | 'discoveryBranch' | 'discoveryBranches'>;
264
+
265
+ declare function resolveFeatureBacklogDiscoveryOptions(options: {
266
+ primaryDiscoveryBranch?: string;
267
+ itemDiscoveryBranchPrefix?: string;
268
+ }): {
269
+ primaryDiscoveryBranch: string;
270
+ itemDiscoveryBranchPrefix: string;
271
+ };
272
+
223
273
  declare function resolveFeatureBacklogItem(input: {
224
274
  item: FeatureBacklogItem;
225
275
  paths: BacklogPaths;
226
276
  projectRoot: string;
227
277
  discoveryBranch: string;
278
+ primaryDiscoveryBranch: string;
279
+ itemDiscoveryBranchPrefix: string;
228
280
  }): Promise<BacklogItemResolution<FeatureBacklogStage>>;
281
+
282
+ declare function parseFeatureWorkflow(itemName: string, raw: unknown): FeatureBacklogWorkflow | undefined;
283
+
284
+ declare const defaultReqPrompt: PromptFn;
285
+ declare function defaultReqFixPrompt(prevValidateCommandResult?: string | null): PromptFn;
286
+ declare const defaultTestPlanPrompt: PromptFn;
287
+ declare function defaultTestPlanFixPrompt(prevValidateCommandResult?: string | null): PromptFn;
288
+ declare const defaultTestImplPrompt: PromptFn;
289
+ declare const defaultImplPrompt: PromptFn;
290
+ declare const defaultDirectImplPrompt: PromptFn;
291
+
229
292
  declare const featureBacklog: <V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(options: FeatureBacklogOptions<V, SV>) => LumpJsConfig<V, SV>;
230
293
 
231
- export { BACKLOG_ITEMS_DIR_VAR, BACKLOG_ITEM_DIR_VAR, BACKLOG_STAGE_VAR, BACKLOG_TASK_NAME_VAR, BACKLOG_TASK_VAR, FEATURE_BACKLOG_WORKFLOWS, abstractionBacklog, abstractionFinder, backlog, backlogRecipe, defineRecipe, ephemeralContextListFn, featureBacklog, folderBacklogContexts, folderSetTaskDoneStep, getRecursiveSteps, listTodoRelativeDirs, lumpPathAndName, normalizeMaybePromGetter, parseFeatureWorkflow, projectRootFromConfigUrl, requireArtifactStep, resolveBacklogPaths, resolveFeatureBacklogItem, resolveImplValidateCommand, retryUntilGreen, setTaskDoneStep, shellCommand, validateBaseBacklogItem, ymlBacklogContexts };
232
- export type { AbstractionBacklogOptions, AbstractionFinderOptions, AbstractionFinderScanCommand, BacklogItemResolution, BacklogOptions, BacklogPaths, BacklogStageDefinition, BaseBacklogItem, DoneBacklogItem, EphemeralContextListFnOptions, FeatureBacklogContextVariables, FeatureBacklogItem, FeatureBacklogOptions, FeatureBacklogRunnableWorkflow, FeatureBacklogStage, FeatureBacklogWorkflow, FolderBacklogContextsOptions, GetFirstStepsInput, GetRecursiveStepsOptions, ImplValidateCommand, IsValidationCommandResultOkInput, MaybePromGetter, Recipe, RetryUntilGreenInput, StepIndex, ValidationCommandFn, ValidationCommandFnInput, YmlBacklogContextsOptions };
294
+ export { BACKLOG_ITEMS_DIR_VAR, BACKLOG_ITEM_DIR_VAR, BACKLOG_STAGE_VAR, BACKLOG_TASK_NAME_VAR, BACKLOG_TASK_VAR, DEFAULT_FEATURE_BACKLOG_WORKFLOW, DEFAULT_ITEM_DISCOVERY_BRANCH_PREFIX, DEFAULT_PRIMARY_DISCOVERY_BRANCH, FEATURE_BACKLOG_RESERVED_NAME_SUFFIXES, FEATURE_BACKLOG_WORKFLOW_STAGES, OPEN_PR_PROVIDERS, abstractionBacklog, abstractionFinder, backlog, backlogRecipe, defaultDirectImplPrompt, defaultImplPrompt, defaultReqFixPrompt, defaultReqPrompt, defaultTestImplPrompt, defaultTestPlanFixPrompt, defaultTestPlanPrompt, defineRecipe, ephemeralContextListFn, featureBacklog, folderBacklogContexts, folderSetTaskDoneStep, getRecursiveSteps, listTodoRelativeDirs, listUmbrellaTicketNames, lumpPathAndName, normalizeMaybePromGetter, openPrPostTeardown, parseFeatureWorkflow, projectRootFromConfigUrl, requireArtifactStep, resolveBacklogPaths, resolveFeatureBacklogDiscoveryOptions, resolveFeatureBacklogItem, resolveImplValidateCommand, retryUntilGreen, setTaskDoneStep, shellCommand, validateBaseBacklogItem, ymlBacklogContexts };
295
+ export type { AbstractionBacklogOptions, AbstractionFinderOptions, AbstractionFinderScanCommand, BacklogItemResolution, BacklogOptions, BacklogPaths, BacklogStageDefinition, BaseBacklogItem, DoneBacklogItem, EphemeralContextListFnOptions, FeatureBacklogContextVariables, FeatureBacklogItem, FeatureBacklogOptions, FeatureBacklogPromptFns, FeatureBacklogPromptStage, FeatureBacklogStage, FeatureBacklogTerminalStage, FeatureBacklogWorkflow, FeatureBacklogWorkflowStage, FolderBacklogContextsOptions, GetFirstStepsInput, GetRecursiveStepsOptions, ImplValidateCommand, IsValidationCommandResultOkInput, ListTodoRelativeDirsOptions, MaybePromGetter, OpenPrPostTeardownOptions, OpenPrProvider, Recipe, RetryUntilGreenInput, StepIndex, ValidationCommandFn, ValidationCommandFnInput, YmlBacklogContextsOptions };