@lumpcode/cli-types 0.0.16 → 0.1.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 (2) hide show
  1. package/dist/index.d.ts +74 -33
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { LumpVariables, BranchFn, StepVariables, CommandFn, SetupFn, TeardownFn, PromptFnInput, MaybePromise, PostCommandExecFn, Step, PromptFn, CodeBasePath, Maybe, Context, RunLumpInput, GetContextListFn, GitAddCommandFn, GitCommitCommandFn, GitCommitMessageFn, GitPushCommandFn } from '@lumpcode/core';
2
- export { AsyncFnSuccess, BranchFn, CodeBasePath, CommandFn, Context, ContextList, ContextRunState, ContextStatus, ExtractSuccess, GetContextListFn, GetContextListFnInput, GetContextListFnOutput, GitAddCommandFn, GitCommitCommandFn, GitCommitMessageFn, GitPushCommandFn, LumpVariables, Maybe, MaybePromise, PostCommandExecFn, PromptFn, PromptFnInput, SetupFn, Step, StepVariables, Steps, TeardownFn } from '@lumpcode/core';
1
+ import { LumpVariables, BranchFn, StepVariables, CommandFn, SetupFn, TeardownFn, ContextList, MaybePromise, PromptFnInput, PostCommandExecFn, Step, PromptFn, CodeBasePath, Maybe, Context, GetContextListFnOutput, RunLumpInput, GitAddCommandFn, GitCommitCommandFn, GitCommitMessageFn, GitPushCommandFn } from '@lumpcode/core';
2
+ export { AsyncFnSuccess, BranchFn, CodeBasePath, CommandFn, Context, ContextList, ContextRunState, ContextStatus, ExtractSuccess, GetContextListFnOutput, GitAddCommandFn, GitCommitCommandFn, GitCommitMessageFn, GitPushCommandFn, LumpVariables, Maybe, MaybePromise, PostCommandExecFn, PromptFn, PromptFnInput, SetupFn, Step, StepVariables, Steps, TeardownFn } from '@lumpcode/core';
3
+ import * as z from 'zod';
3
4
 
4
5
  declare function defineBranchFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<BranchFn<V>>): BranchFn<V>;
5
6
 
@@ -17,6 +18,13 @@ declare function defineCommandSetup<V extends LumpVariables = LumpVariables>(fn:
17
18
 
18
19
  declare function defineCommandTeardown<V extends LumpVariables = LumpVariables>(fn: NoInfer<TeardownFn<V>>): TeardownFn<V>;
19
20
 
21
+ type BaseBranchFnInput = {
22
+ effectiveDiscoveryBranch: string;
23
+ /** Pre-status raw list from the context source (not todo-filtered). */
24
+ contexts: ContextList;
25
+ };
26
+ type BaseBranchFn = (input: BaseBranchFnInput) => MaybePromise<string>;
27
+
20
28
  type FilePath = string;
21
29
 
22
30
  type FilePathOrString = FilePath | string;
@@ -43,6 +51,7 @@ type ContextMatchFn<V extends LumpVariables = LumpVariables> = (params: {
43
51
  codeBasePath: CodeBasePath;
44
52
  codeBasePaths: CodeBasePath[];
45
53
  lumpVariables: V;
54
+ discoveryBranch: string;
46
55
  }) => MaybePromise<Maybe<{
47
56
  contextName: Context['name'];
48
57
  filePathVariableName: string;
@@ -52,17 +61,38 @@ type ContextMatchFn<V extends LumpVariables = LumpVariables> = (params: {
52
61
 
53
62
  type ContextOptionsFn = (contextWithoutOptions: Omit<Context, 'options'>) => MaybePromise<Maybe<Context['options']>>;
54
63
 
64
+ /**
65
+ * Author-facing CLI context list fn. Requires concrete `discoveryBranch`.
66
+ * At the run boundary, CLI adapts this to core `GetContextListFn` (no discovery field).
67
+ */
68
+ type GetContextListFnInput<V extends LumpVariables = LumpVariables> = {
69
+ codeBasePaths: CodeBasePath[];
70
+ lumpVariables: V;
71
+ discoveryBranch: string;
72
+ };
73
+ type GetContextListFn<V extends LumpVariables = LumpVariables> = (params: GetContextListFnInput<V>) => GetContextListFnOutput;
74
+
55
75
  type LumpJsConfigSoloStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = LumpJsConfigStep<V, SV> | LumpJsConfigStep<V, SV>['promptTemplate'] | LumpJsConfigStep<V, SV>['promptFn'];
56
76
  type LumpJsConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = MergeObjs<Omit<{
57
77
  [K in keyof RunLumpInput<V, SV>]?: NonNullable<RunLumpInput<V, SV>[K]> extends Function ? (RunLumpInput<V, SV>[K] | FilePath) : RunLumpInput<V, SV>[K];
58
- }, 'gitCommitMessageFn' | 'projectRoot' | 'branchFn' | 'baseBranch' | 'setupWorkspaceFn' | 'teardownWorkspaceFn' | 'gitAddCommandFn' | 'gitCommitCommandFn' | 'gitPushCommandFn'>, {
59
- baseBranch?: RunLumpInput<V, SV>['baseBranch'];
60
- /** Which integration line this lump is discovered and scheduled on (defaults to primary branch from local.json). */
78
+ }, 'gitCommitMessageFn' | 'projectRoot' | 'branchFn' | 'baseBranch' | 'setupWorkspaceFn' | 'teardownWorkspaceFn' | 'gitAddCommandFn' | 'gitCommitCommandFn' | 'gitPushCommandFn' | 'getContextListFn' | 'refreshRemoteTrackingRefsFn'>, {
79
+ /**
80
+ * Execution integration branch. Exact string, `BaseBranchFn`, or FilePath to a module.
81
+ * Omit → concrete effective discovery branch. Pattern strings are rejected at resolve.
82
+ */
83
+ baseBranch?: string | BaseBranchFn | FilePath;
84
+ /** Which integration line this lump is discovered and scheduled on (defaults to primary). Exact or git-glob. */
61
85
  discoveryBranch?: string;
86
+ /**
87
+ * Discovery rules (exact and/or git-glob). Mutually exclusive with `discoveryBranch`.
88
+ */
89
+ discoveryBranches?: string[];
62
90
  command?: LumpJsConfigStep<V, SV>['command'];
63
91
  contextListJson?: FilePath | Record<string, string>;
64
92
  contextMatchFn?: FilePath | ContextMatchFn<V>;
65
93
  contextOptionsFn?: FilePath | ContextOptionsFn;
94
+ /** Author context list fn (CLI shape with required `discoveryBranch`). */
95
+ getContextListFn?: FilePath | GetContextListFn<V>;
66
96
  disabled?: boolean | (() => MaybePromise<boolean>) | FilePath;
67
97
  maximumNumberOfConcurrentBranches?: number;
68
98
  prompt?: LumpJsConfigSoloStep<V, SV>;
@@ -112,6 +142,39 @@ type LumpJsonConfig<V extends LumpVariables = LumpVariables, SV extends StepVari
112
142
  steps?: (LumpJsonConfigStep<V, SV> | string)[];
113
143
  };
114
144
 
145
+ declare const resolvedProjectLocalConfigSchema: z.ZodObject<{
146
+ verbose: z.ZodOptional<z.ZodBoolean>;
147
+ command: z.ZodOptional<z.ZodString>;
148
+ maximumNumberOfConcurrentBranches: z.ZodOptional<z.ZodNumber>;
149
+ keepHistory: z.ZodOptional<z.ZodBoolean>;
150
+ primaryBranch: z.ZodOptional<z.ZodString>;
151
+ projectBaseBranch: z.ZodOptional<z.ZodString>;
152
+ primaryBranches: z.ZodOptional<z.ZodArray<z.ZodString>>;
153
+ projectName: z.ZodString;
154
+ mode: z.ZodEnum<{
155
+ shared: "shared";
156
+ dedicated: "dedicated";
157
+ }>;
158
+ workspaceStrategy: z.ZodEnum<{
159
+ checkout: "checkout";
160
+ worktree: "worktree";
161
+ }>;
162
+ disabled: z.ZodOptional<z.ZodBoolean>;
163
+ maxParallelRun: z.ZodOptional<z.ZodNumber>;
164
+ }, z.core.$strict>;
165
+ type ResolvedProjectLocalConfig = z.infer<typeof resolvedProjectLocalConfigSchema>;
166
+
167
+ /**
168
+ * Shape of `.lumpcode/local.json` — Pick from resolved config.
169
+ * `mode` is required on the file schema; other keys optional.
170
+ */
171
+ type LocalJsonConfig = Pick<ResolvedProjectLocalConfig, 'mode' | 'workspaceStrategy' | 'disabled' | 'maxParallelRun' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory' | 'verbose'>;
172
+
173
+ /**
174
+ * Shape of `.lumpcode/local.json` — alias of {@link LocalJsonConfig}.
175
+ */
176
+ type LocalConfig = LocalJsonConfig;
177
+
115
178
  /**
116
179
  * Describes how Lumpcode runs lumps against the user's git working copy.
117
180
  *
@@ -124,37 +187,15 @@ type LumpJsonConfig<V extends LumpVariables = LumpVariables, SV extends StepVari
124
187
  type Mode = 'shared' | 'dedicated';
125
188
 
126
189
  /**
127
- * How Lumpcode prepares the per-lump git workspace inside the preflight repo root.
128
- *
129
- * - `checkout`: switch the main worktree to a fresh lump branch (default).
130
- * - `worktree`: add a linked worktree under `.lumpcode/worktrees/<branch>/`.
190
+ * Shape of `.lumpcode/project.json` Pick from resolved config.
191
+ * `projectName` is required on the file schema; other keys optional.
131
192
  */
132
- type WorkspaceStrategy = 'checkout' | 'worktree';
193
+ type ProjectJsonConfig = Pick<ResolvedProjectLocalConfig, 'projectName' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory'>;
133
194
 
134
195
  /**
135
- * Shape of `.lumpcode/local.json` — gitignored, per-machine configuration that
136
- * tells Lumpcode where and how to run lumps from this checkout.
196
+ * Shape of `.lumpcode/project.json` — alias of {@link ProjectJsonConfig}.
137
197
  */
138
- interface LocalConfig {
139
- mode: Mode;
140
- /** Required when `primaryBranches` is omitted or empty. Primary integration branch for this install. */
141
- primaryBranch?: string;
142
- /**
143
- * @deprecated Use `primaryBranch` instead.
144
- * Legacy alias kept for existing `.lumpcode/local.json` files.
145
- */
146
- projectBaseBranch?: string;
147
- /** When non-empty, wins over singular `primaryBranch` for the effective primary-branch list. Dedicated daemon scans these lines. */
148
- primaryBranches?: string[];
149
- workspaceStrategy?: WorkspaceStrategy;
150
- /** When `true`, the background daemon skips every lump on this machine (`lumpcode start`). */
151
- disabled?: boolean;
152
- }
153
-
154
- interface ProjectConfig {
155
- projectName?: string;
156
- maximumNumberOfConcurrentBranches?: number;
157
- }
198
+ type ProjectConfig = ProjectJsonConfig;
158
199
 
159
200
  export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommandFn, defineGitCommitCommandFn, defineGitCommitMessageFn, defineGitPushCommandFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
160
- export type { CommandModule, CommandTag, ContextMatchFn, ContextOptionsFn, FilePath, FilePathOrString, LocalConfig, LumpJsConfig, LumpJsConfigPostCommandExecFn, LumpJsConfigStep, LumpJsConfigSteps, LumpJsConfigStepsFn, LumpJsConfigStepsItem, LumpJsonConfig, LumpJsonConfigStep, MergeObjs, Mode, ProjectConfig, StepFn };
201
+ export type { BaseBranchFn, BaseBranchFnInput, CommandModule, CommandTag, ContextMatchFn, ContextOptionsFn, FilePath, FilePathOrString, GetContextListFn, GetContextListFnInput, LocalConfig, LumpJsConfig, LumpJsConfigPostCommandExecFn, LumpJsConfigStep, LumpJsConfigSteps, LumpJsConfigStepsFn, LumpJsConfigStepsItem, LumpJsonConfig, LumpJsonConfigStep, MergeObjs, Mode, ProjectConfig, StepFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumpcode/cli-types",
3
- "version": "0.0.16",
3
+ "version": "0.1.1",
4
4
  "description": "Types and defineX helpers for Lumpcode CLI lump config and command modules",
5
5
  "keywords": [
6
6
  "lumpcode",
@@ -37,7 +37,7 @@
37
37
  "build": "rollup -c"
38
38
  },
39
39
  "dependencies": {
40
- "@lumpcode/core": "^0.0.16"
40
+ "@lumpcode/core": "^0.1.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rollup/plugin-commonjs": "^28.0.1",