@lumpcode/recipes 0.3.1 → 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,5 +1,5 @@
1
1
  import { CommandDescriptor, MaybePromise, PostCommandExecFn, Step } from '@lumpcode/core';
2
- import { LumpVariables, PostSetupWorkspaceFnInput, PostTeardownWorkspaceFn, 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;
@@ -103,9 +103,12 @@ type DoneBacklogItem<T extends BaseBacklogItem = BaseBacklogItem> = T & {
103
103
 
104
104
  type FolderBacklogContextsOptions<Item extends BaseBacklogItem = BaseBacklogItem> = {
105
105
  backlogItemsDir: string;
106
+ /** When true, umbrella parents with tickets are emitted for wrap-up (featureBacklog). */
107
+ includeUmbrellaParents?: boolean;
106
108
  /**
107
109
  * `folderName` is the path relative to `todo/`: the item folder, or
108
- * `<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).
109
112
  */
110
113
  parseItem?: (item: BaseBacklogItem, folderName: string, raw: unknown) => Item;
111
114
  parseContext?: (item: Item, folderName: string) => MaybePromise$1<{
@@ -113,9 +116,22 @@ type FolderBacklogContextsOptions<Item extends BaseBacklogItem = BaseBacklogItem
113
116
  ignored?: boolean;
114
117
  }>;
115
118
  };
116
- /** Path relative to `todo/`, using `/` so it is stable in context variables. */
117
- declare function listTodoRelativeDirs(todoDir: string): Promise<string[]>;
118
- 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>;
119
135
 
120
136
  /** Moves a finished backlog item folder from todo/ to the same relative path under completed/. */
121
137
  declare function folderSetTaskDoneStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(input: {
@@ -185,6 +201,8 @@ type BacklogItemResolution<StageName extends string> = {
185
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>>> = {
186
202
  configUrl: string | URL;
187
203
  backlogItemsDir?: string;
204
+ /** When true, umbrella parents with tickets are emitted for wrap-up (featureBacklog). */
205
+ includeUmbrellaParents?: boolean;
188
206
  stages: Stages;
189
207
  parseItem?: (item: BaseBacklogItem, folderName: string, raw: unknown) => Item;
190
208
  resolveItem(input: {
@@ -203,41 +221,75 @@ declare const BACKLOG_ITEM_DIR_VAR = "BACKLOG_ITEM_DIR";
203
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>;
204
222
  declare const backlogRecipe: typeof backlog;
205
223
 
206
- type FeatureBacklogWorkflow = 'tdd' | 'directImpl' | 'manual';
207
- 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"];
208
232
  type FeatureBacklogItem = BaseBacklogItem & {
209
- manualReq?: boolean;
210
233
  workflow?: FeatureBacklogWorkflow;
234
+ manual?: boolean;
211
235
  completedAt?: string;
212
236
  /** Path relative to `backlogItems/todo/`; tickets live at `<parent>/tickets/<name>`. */
213
237
  todoRelativeDir: string;
214
238
  /** Parent todo folder name when this item is a ticket. */
215
239
  parentName?: string;
216
240
  };
217
- type FeatureBacklogStage = 'makeReq' | 'makeTestPlan' | 'testImpl' | 'implementation' | 'directImpl';
241
+ type FeatureBacklogStage = 'req' | 'testPlan' | 'testImpl' | 'impl' | 'directImpl' | 'completion';
218
242
  type FeatureBacklogContextVariables = {
219
243
  TASK_NAME: string;
220
244
  TASK: string;
221
245
  BACKLOG_ITEMS_DIR: string;
222
246
  BACKLOG_ITEM_DIR: string;
223
247
  BACKLOG_STAGE: FeatureBacklogStage;
248
+ WORKFLOW?: string;
224
249
  REQ_FILE?: string;
225
250
  TEST_PLAN_FILE?: string;
226
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
+ };
227
256
  type FeatureBacklogOptions<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = {
228
257
  configUrl: string | URL;
229
258
  implValidateCommand?: ValidationCommandFn<V, SV> | string;
230
259
  backlogItemsDir?: string;
231
- } & Omit<LumpJsConfig<V, SV>, 'contextListJson' | 'contextMatchFn' | 'getContextListFn' | 'prompt' | 'steps'>;
232
- declare const FEATURE_BACKLOG_WORKFLOWS: readonly ["tdd", "directImpl", "manual"];
233
- 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
+
234
273
  declare function resolveFeatureBacklogItem(input: {
235
274
  item: FeatureBacklogItem;
236
275
  paths: BacklogPaths;
237
276
  projectRoot: string;
238
277
  discoveryBranch: string;
278
+ primaryDiscoveryBranch: string;
279
+ itemDiscoveryBranchPrefix: string;
239
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
+
240
292
  declare const featureBacklog: <V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(options: FeatureBacklogOptions<V, SV>) => LumpJsConfig<V, SV>;
241
293
 
242
- export { BACKLOG_ITEMS_DIR_VAR, BACKLOG_ITEM_DIR_VAR, BACKLOG_STAGE_VAR, BACKLOG_TASK_NAME_VAR, BACKLOG_TASK_VAR, FEATURE_BACKLOG_WORKFLOWS, OPEN_PR_PROVIDERS, abstractionBacklog, abstractionFinder, backlog, backlogRecipe, defineRecipe, ephemeralContextListFn, featureBacklog, folderBacklogContexts, folderSetTaskDoneStep, getRecursiveSteps, listTodoRelativeDirs, lumpPathAndName, normalizeMaybePromGetter, openPrPostTeardown, parseFeatureWorkflow, projectRootFromConfigUrl, requireArtifactStep, resolveBacklogPaths, resolveFeatureBacklogItem, resolveImplValidateCommand, retryUntilGreen, setTaskDoneStep, shellCommand, validateBaseBacklogItem, ymlBacklogContexts };
243
- export type { AbstractionBacklogOptions, AbstractionFinderOptions, AbstractionFinderScanCommand, BacklogItemResolution, BacklogOptions, BacklogPaths, BacklogStageDefinition, BaseBacklogItem, DoneBacklogItem, EphemeralContextListFnOptions, FeatureBacklogContextVariables, FeatureBacklogItem, FeatureBacklogOptions, FeatureBacklogRunnableWorkflow, FeatureBacklogStage, FeatureBacklogWorkflow, FolderBacklogContextsOptions, GetFirstStepsInput, GetRecursiveStepsOptions, ImplValidateCommand, IsValidationCommandResultOkInput, MaybePromGetter, OpenPrPostTeardownOptions, OpenPrProvider, 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 };