@lumpcode/cli-types 0.1.1 → 0.3.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.cjs CHANGED
@@ -36,15 +36,13 @@ function defineGetContextListFn(fn) {
36
36
  return fn;
37
37
  }
38
38
 
39
- const defineGitAddCommandFn = (identity);
40
-
41
- const defineGitCommitCommandFn = (identity);
39
+ const defineGitAddCommitFn = (identity);
42
40
 
43
41
  function defineGitCommitMessageFn(fn) {
44
42
  return fn;
45
43
  }
46
44
 
47
- const defineGitPushCommandFn = (identity);
45
+ const defineGitPushFn = (identity);
48
46
 
49
47
  function definePostCommandExecFn(fn) {
50
48
  return fn;
@@ -75,10 +73,9 @@ exports.defineConfig = defineConfig;
75
73
  exports.defineContextMatchFn = defineContextMatchFn;
76
74
  exports.defineContextOptionsFn = defineContextOptionsFn;
77
75
  exports.defineGetContextListFn = defineGetContextListFn;
78
- exports.defineGitAddCommandFn = defineGitAddCommandFn;
79
- exports.defineGitCommitCommandFn = defineGitCommitCommandFn;
76
+ exports.defineGitAddCommitFn = defineGitAddCommitFn;
80
77
  exports.defineGitCommitMessageFn = defineGitCommitMessageFn;
81
- exports.defineGitPushCommandFn = defineGitPushCommandFn;
78
+ exports.defineGitPushFn = defineGitPushFn;
82
79
  exports.definePostCommandExecFn = definePostCommandExecFn;
83
80
  exports.definePromptFn = definePromptFn;
84
81
  exports.defineSetupFn = defineSetupFn;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { LumpVariables, BranchFn, StepVariables, CommandFn, SetupFn, TeardownFn, ContextList, MaybePromise, PromptFnInput, PostCommandExecFn, Step, PromptFn, CodeBasePath, Maybe, Context, GetContextListFnOutput, RunLumpInput, GitAddCommitFn, GitCommitMessageFn, GitPushFn } from '@lumpcode/core';
2
+ export { AsyncFnSuccess, BranchFn, CodeBasePath, CommandFn, Context, ContextList, ContextRunState, ContextStatus, ExtractSuccess, GetContextListFnOutput, GitAddCommitFn, GitCommitMessageFn, GitPushFn, LumpVariables, Maybe, MaybePromise, PostCommandExecFn, PromptFn, PromptFnInput, SetupFn, Step, StepVariables, Steps, TeardownFn } from '@lumpcode/core';
3
3
  import * as z from 'zod';
4
4
 
5
5
  declare function defineBranchFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<BranchFn<V>>): BranchFn<V>;
@@ -72,10 +72,38 @@ type GetContextListFnInput<V extends LumpVariables = LumpVariables> = {
72
72
  };
73
73
  type GetContextListFn<V extends LumpVariables = LumpVariables> = (params: GetContextListFnInput<V>) => GetContextListFnOutput;
74
74
 
75
+ /**
76
+ * How Lumpcode prepares the per-lump git workspace inside the preflight repo root.
77
+ *
78
+ * - `checkout`: switch the main worktree to a fresh lump branch (default).
79
+ * - `worktree`: add a linked worktree under `.lumpcode/worktrees/<branch>/`.
80
+ */
81
+ type WorkspaceStrategy = 'checkout' | 'worktree';
82
+
83
+ type PostSetupWorkspaceFnInput<V extends LumpVariables = LumpVariables> = {
84
+ baseBranch: string;
85
+ branchName: string;
86
+ contextList: ContextList;
87
+ /** Branch workspace. Already prepared on a real run. Read-only. */
88
+ workspacePath: string;
89
+ executionWorkspacePath: string;
90
+ workspaceStrategy: WorkspaceStrategy;
91
+ projectRoot: string;
92
+ lumpVariables: V;
93
+ };
94
+
95
+ type PostSetupWorkspaceFn<V extends LumpVariables = LumpVariables> = (input: PostSetupWorkspaceFnInput<V>) => MaybePromise<{
96
+ command?: string;
97
+ } | void>;
98
+
99
+ type PostTeardownWorkspaceFn<V extends LumpVariables = LumpVariables> = (input: PostSetupWorkspaceFnInput<V>) => MaybePromise<{
100
+ command?: string;
101
+ } | void>;
102
+
75
103
  type LumpJsConfigSoloStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = LumpJsConfigStep<V, SV> | LumpJsConfigStep<V, SV>['promptTemplate'] | LumpJsConfigStep<V, SV>['promptFn'];
76
104
  type LumpJsConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = MergeObjs<Omit<{
77
105
  [K in keyof RunLumpInput<V, SV>]?: NonNullable<RunLumpInput<V, SV>[K]> extends Function ? (RunLumpInput<V, SV>[K] | FilePath) : RunLumpInput<V, SV>[K];
78
- }, 'gitCommitMessageFn' | 'projectRoot' | 'branchFn' | 'baseBranch' | 'setupWorkspaceFn' | 'teardownWorkspaceFn' | 'gitAddCommandFn' | 'gitCommitCommandFn' | 'gitPushCommandFn' | 'getContextListFn' | 'refreshRemoteTrackingRefsFn'>, {
106
+ }, 'gitCommitMessageFn' | 'projectRoot' | 'branchFn' | 'baseBranch' | 'setupWorkspaceFn' | 'teardownWorkspaceFn' | 'gitAddCommitFn' | 'gitPushFn' | 'getContextListFn' | 'refreshRemoteTrackingRefsFn'>, {
79
107
  /**
80
108
  * Execution integration branch. Exact string, `BaseBranchFn`, or FilePath to a module.
81
109
  * Omit → concrete effective discovery branch. Pattern strings are rejected at resolve.
@@ -100,6 +128,20 @@ type LumpJsConfig<V extends LumpVariables = LumpVariables, SV extends StepVariab
100
128
  registerCommands?: string[];
101
129
  keepHistory?: boolean;
102
130
  verbose?: boolean;
131
+ /**
132
+ * After generated checkout/worktree setup. Mutually exclusive with
133
+ * `postSetupWorkspaceCommand`.
134
+ */
135
+ postSetupWorkspaceFn?: FilePath | PostSetupWorkspaceFn<V>;
136
+ /** Shell fragment in the branch workspace. Mutually exclusive with `postSetupWorkspaceFn`. */
137
+ postSetupWorkspaceCommand?: string;
138
+ /**
139
+ * Before generated workspace teardown. Mutually exclusive with
140
+ * `postTeardownWorkspaceCommand`.
141
+ */
142
+ postTeardownWorkspaceFn?: FilePath | PostTeardownWorkspaceFn<V>;
143
+ /** Shell fragment in the branch workspace. Mutually exclusive with `postTeardownWorkspaceFn`. */
144
+ postTeardownWorkspaceCommand?: string;
103
145
  }>;
104
146
 
105
147
  declare function defineConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(config: NoInfer<LumpJsConfig<V, SV>>): LumpJsConfig<V, SV>;
@@ -110,13 +152,11 @@ declare const defineContextOptionsFn: (e: ContextOptionsFn) => ContextOptionsFn;
110
152
 
111
153
  declare function defineGetContextListFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<GetContextListFn<V>>): GetContextListFn<V>;
112
154
 
113
- declare const defineGitAddCommandFn: (e: GitAddCommandFn) => GitAddCommandFn;
114
-
115
- declare const defineGitCommitCommandFn: (e: GitCommitCommandFn) => GitCommitCommandFn;
155
+ declare const defineGitAddCommitFn: (e: GitAddCommitFn) => GitAddCommitFn;
116
156
 
117
157
  declare function defineGitCommitMessageFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<GitCommitMessageFn<V>>): GitCommitMessageFn<V>;
118
158
 
119
- declare const defineGitPushCommandFn: (e: GitPushCommandFn) => GitPushCommandFn;
159
+ declare const defineGitPushFn: (e: GitPushFn) => GitPushFn;
120
160
 
121
161
  declare function definePostCommandExecFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(fn: NoInfer<LumpJsConfigPostCommandExecFn<V, SV>>): LumpJsConfigPostCommandExecFn<V, SV>;
122
162
 
@@ -144,6 +184,7 @@ type LumpJsonConfig<V extends LumpVariables = LumpVariables, SV extends StepVari
144
184
 
145
185
  declare const resolvedProjectLocalConfigSchema: z.ZodObject<{
146
186
  verbose: z.ZodOptional<z.ZodBoolean>;
187
+ refreshCommand: z.ZodOptional<z.ZodString>;
147
188
  command: z.ZodOptional<z.ZodString>;
148
189
  maximumNumberOfConcurrentBranches: z.ZodOptional<z.ZodNumber>;
149
190
  keepHistory: z.ZodOptional<z.ZodBoolean>;
@@ -168,7 +209,7 @@ type ResolvedProjectLocalConfig = z.infer<typeof resolvedProjectLocalConfigSchem
168
209
  * Shape of `.lumpcode/local.json` — Pick from resolved config.
169
210
  * `mode` is required on the file schema; other keys optional.
170
211
  */
171
- type LocalJsonConfig = Pick<ResolvedProjectLocalConfig, 'mode' | 'workspaceStrategy' | 'disabled' | 'maxParallelRun' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory' | 'verbose'>;
212
+ type LocalJsonConfig = Pick<ResolvedProjectLocalConfig, 'mode' | 'workspaceStrategy' | 'disabled' | 'maxParallelRun' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory' | 'verbose' | 'refreshCommand'>;
172
213
 
173
214
  /**
174
215
  * Shape of `.lumpcode/local.json` — alias of {@link LocalJsonConfig}.
@@ -190,12 +231,12 @@ type Mode = 'shared' | 'dedicated';
190
231
  * Shape of `.lumpcode/project.json` — Pick from resolved config.
191
232
  * `projectName` is required on the file schema; other keys optional.
192
233
  */
193
- type ProjectJsonConfig = Pick<ResolvedProjectLocalConfig, 'projectName' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory'>;
234
+ type ProjectJsonConfig = Pick<ResolvedProjectLocalConfig, 'projectName' | 'primaryBranch' | 'primaryBranches' | 'projectBaseBranch' | 'command' | 'maximumNumberOfConcurrentBranches' | 'keepHistory' | 'refreshCommand'>;
194
235
 
195
236
  /**
196
237
  * Shape of `.lumpcode/project.json` — alias of {@link ProjectJsonConfig}.
197
238
  */
198
239
  type ProjectConfig = ProjectJsonConfig;
199
240
 
200
- export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommandFn, defineGitCommitCommandFn, defineGitCommitMessageFn, defineGitPushCommandFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
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 };
241
+ export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommitFn, defineGitCommitMessageFn, defineGitPushFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
242
+ export type { BaseBranchFn, BaseBranchFnInput, CommandModule, CommandTag, ContextMatchFn, ContextOptionsFn, FilePath, FilePathOrString, GetContextListFn, GetContextListFnInput, LocalConfig, LumpJsConfig, LumpJsConfigPostCommandExecFn, LumpJsConfigStep, LumpJsConfigSteps, LumpJsConfigStepsFn, LumpJsConfigStepsItem, LumpJsonConfig, LumpJsonConfigStep, MergeObjs, Mode, PostSetupWorkspaceFn, PostSetupWorkspaceFnInput, PostTeardownWorkspaceFn, ProjectConfig, StepFn };
package/dist/index.js CHANGED
@@ -34,15 +34,13 @@ function defineGetContextListFn(fn) {
34
34
  return fn;
35
35
  }
36
36
 
37
- const defineGitAddCommandFn = (identity);
38
-
39
- const defineGitCommitCommandFn = (identity);
37
+ const defineGitAddCommitFn = (identity);
40
38
 
41
39
  function defineGitCommitMessageFn(fn) {
42
40
  return fn;
43
41
  }
44
42
 
45
- const defineGitPushCommandFn = (identity);
43
+ const defineGitPushFn = (identity);
46
44
 
47
45
  function definePostCommandExecFn(fn) {
48
46
  return fn;
@@ -64,4 +62,4 @@ function defineTeardownFn(fn) {
64
62
  return fn;
65
63
  }
66
64
 
67
- export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommandFn, defineGitCommitCommandFn, defineGitCommitMessageFn, defineGitPushCommandFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
65
+ export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommitFn, defineGitCommitMessageFn, defineGitPushFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumpcode/cli-types",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
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.1.1"
40
+ "@lumpcode/core": "^0.3.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rollup/plugin-commonjs": "^28.0.1",