@lumpcode/cli-types 0.0.12 → 0.0.14

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/README.md CHANGED
@@ -10,6 +10,8 @@ TypeScript types and small `defineX` identity helpers for authoring **Lumpcode**
10
10
  npm install --save-dev @lumpcode/cli-types
11
11
  ```
12
12
 
13
+ > Prefer [`@lumpcode/cli-utils`](https://www.npmjs.com/package/@lumpcode/cli-utils) for new authoring work (same `define*` helpers plus runtime utils and cursor/copilot preset variable contracts). This package stays soft-aligned: `defineConfig` / `defineStep` / hook helpers accept the same `<V, SV>` (or lump-only `<V>`) signatures.
14
+
13
15
  ## Usage
14
16
 
15
17
  `config.ts` (or `config.js`):
@@ -24,6 +26,8 @@ export default defineConfig({
24
26
  });
25
27
  ```
26
28
 
29
+ With refined bags: `defineConfig<V, SV>({ … })` — `V` / `SV` default to unbound `LumpVariables` / `StepVariables` so untyped configs keep working.
30
+
27
31
  Command module (`.lumpcode/commands/my-agent.ts` or `.js`):
28
32
 
29
33
  ```ts
package/dist/index.cjs CHANGED
@@ -1,42 +1,70 @@
1
1
  'use strict';
2
2
 
3
- const identity = (e) => e;
3
+ function defineBranchFn(fn) {
4
+ return fn;
5
+ }
4
6
 
5
- const defineBranchFn = (identity);
7
+ function defineCommand(fn) {
8
+ return fn;
9
+ }
6
10
 
7
- const defineCommand = (identity);
11
+ function defineCommandModule(module) {
12
+ return module;
13
+ }
8
14
 
9
- const defineCommandModule = (identity);
15
+ function defineCommandSetup(fn) {
16
+ return fn;
17
+ }
10
18
 
11
- const defineCommandSetup = (identity);
19
+ function defineCommandTeardown(fn) {
20
+ return fn;
21
+ }
12
22
 
13
- const defineCommandTeardown = (identity);
23
+ function defineConfig(config) {
24
+ return config;
25
+ }
14
26
 
15
- const defineConfig = identity;
27
+ function defineContextMatchFn(fn) {
28
+ return fn;
29
+ }
16
30
 
17
- const defineContextMatchFn = (identity);
31
+ const identity = (e) => e;
18
32
 
19
33
  const defineContextOptionsFn = (identity);
20
34
 
21
- const defineGetContextListFn = (identity);
35
+ function defineGetContextListFn(fn) {
36
+ return fn;
37
+ }
22
38
 
23
39
  const defineGitAddCommandFn = (identity);
24
40
 
25
41
  const defineGitCommitCommandFn = (identity);
26
42
 
27
- const defineGitCommitMessageFn = (identity);
43
+ function defineGitCommitMessageFn(fn) {
44
+ return fn;
45
+ }
28
46
 
29
47
  const defineGitPushCommandFn = (identity);
30
48
 
31
- const definePostCommandExecFn = (identity);
49
+ function definePostCommandExecFn(fn) {
50
+ return fn;
51
+ }
32
52
 
33
- const definePromptFn = (identity);
53
+ function definePromptFn(fn) {
54
+ return fn;
55
+ }
34
56
 
35
- const defineStep = (identity);
57
+ function defineStep(step) {
58
+ return step;
59
+ }
36
60
 
37
- const defineSetupFn = (identity);
61
+ function defineSetupFn(fn) {
62
+ return fn;
63
+ }
38
64
 
39
- const defineTeardownFn = (identity);
65
+ function defineTeardownFn(fn) {
66
+ return fn;
67
+ }
40
68
 
41
69
  exports.defineBranchFn = defineBranchFn;
42
70
  exports.defineCommand = defineCommand;
package/dist/index.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- import { BranchFn, CommandFn, SetupFn, TeardownFn, Step, PromptFn, PostCommandExecFn, CodeBasePath, MaybePromise, Maybe, Context, PromptFnInput, LumpVariables, RunLumpInput, GetContextListFn, GitAddCommandFn, GitCommitCommandFn, GitCommitMessageFn, GitPushCommandFn } from '@lumpcode/core';
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
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';
3
3
 
4
- declare const defineBranchFn: (e: BranchFn) => BranchFn;
4
+ declare function defineBranchFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<BranchFn<V>>): BranchFn<V>;
5
5
 
6
- declare const defineCommand: (e: CommandFn) => CommandFn;
6
+ declare function defineCommand<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(fn: NoInfer<CommandFn<V, SV>>): CommandFn<V, SV>;
7
7
 
8
- interface CommandModule {
9
- command: CommandFn;
10
- setup?: SetupFn;
11
- teardown?: TeardownFn;
8
+ interface CommandModule<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> {
9
+ command: CommandFn<V, SV>;
10
+ setup?: SetupFn<V>;
11
+ teardown?: TeardownFn<V>;
12
12
  }
13
13
 
14
- declare const defineCommandModule: (e: CommandModule) => CommandModule;
14
+ declare function defineCommandModule<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(module: NoInfer<CommandModule<V, SV>>): CommandModule<V, SV>;
15
15
 
16
- declare const defineCommandSetup: (e: SetupFn) => SetupFn;
16
+ declare function defineCommandSetup<V extends LumpVariables = LumpVariables>(fn: NoInfer<SetupFn<V>>): SetupFn<V>;
17
17
 
18
- declare const defineCommandTeardown: (e: TeardownFn) => TeardownFn;
18
+ declare function defineCommandTeardown<V extends LumpVariables = LumpVariables>(fn: NoInfer<TeardownFn<V>>): TeardownFn<V>;
19
19
 
20
20
  type FilePath = string;
21
21
 
@@ -25,17 +25,24 @@ type MergeObjs<T, U> = Omit<T, keyof U> & U;
25
25
 
26
26
  type CommandTag = string;
27
27
 
28
- type LumpJsConfigStep = MergeObjs<Step, {
28
+ type LumpJsConfigStepsFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = (input: Omit<PromptFnInput<V, SV>, 'stepVariables'>) => MaybePromise<LumpJsConfigSteps<V, SV> | LumpJsConfigStepsItem<V, SV>>;
29
+ type StepFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = LumpJsConfigStepsFn<V, SV>;
30
+ type LumpJsConfigStepsItem<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = LumpJsConfigStep<V, SV> | LumpJsConfigStepsFn<V, SV> | LumpJsConfigStep<V, SV>['promptTemplate'];
31
+ type LumpJsConfigSteps<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = Array<LumpJsConfigStepsItem<V, SV>>;
32
+
33
+ type LumpJsConfigPostCommandExecFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = (input: Parameters<PostCommandExecFn<V, SV>>[0]) => MaybePromise<void | LumpJsConfigSteps<V, SV> | LumpJsConfigStepsItem<V, SV>>;
34
+
35
+ type LumpJsConfigStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = MergeObjs<Step<V, SV>, {
29
36
  promptTemplate?: FilePathOrString;
30
- promptFn?: FilePath | PromptFn;
31
- postCommandExecFn?: FilePath | PostCommandExecFn;
32
- command?: CommandTag | FilePath | Step['commandFn'];
37
+ promptFn?: FilePath | PromptFn<V, SV>;
38
+ postCommandExecFn?: FilePath | LumpJsConfigPostCommandExecFn<V, SV>;
39
+ command?: CommandTag | FilePath | Step<V, SV>['commandFn'];
33
40
  }>;
34
41
 
35
- type ContextMatchFn = (params: {
42
+ type ContextMatchFn<V extends LumpVariables = LumpVariables> = (params: {
36
43
  codeBasePath: CodeBasePath;
37
44
  codeBasePaths: CodeBasePath[];
38
- lumpVariables: Record<string, unknown>;
45
+ lumpVariables: V;
39
46
  }) => MaybePromise<Maybe<{
40
47
  contextName: Context['name'];
41
48
  filePathVariableName: string;
@@ -45,66 +52,64 @@ type ContextMatchFn = (params: {
45
52
 
46
53
  type ContextOptionsFn = (contextWithoutOptions: Omit<Context, 'options'>) => MaybePromise<Maybe<Context['options']>>;
47
54
 
48
- type LumpJsConfigSteps = Array<LumpJsConfigStep | ((input: Exclude<PromptFnInput, 'stepVariables'>) => MaybePromise<LumpJsConfigSteps>) | LumpJsConfigStep['promptTemplate']>;
49
-
50
- type LumpJsConfigSoloStep = LumpJsConfigStep | LumpJsConfigStep['promptTemplate'] | LumpJsConfigStep['promptFn'];
51
- type LumpJsConfig<V extends LumpVariables = LumpVariables> = MergeObjs<Omit<{
52
- [K in keyof RunLumpInput<V>]?: NonNullable<RunLumpInput<V>[K]> extends Function ? (RunLumpInput<V>[K] | FilePath) : RunLumpInput<V>[K];
55
+ type LumpJsConfigSoloStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = LumpJsConfigStep<V, SV> | LumpJsConfigStep<V, SV>['promptTemplate'] | LumpJsConfigStep<V, SV>['promptFn'];
56
+ type LumpJsConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = MergeObjs<Omit<{
57
+ [K in keyof RunLumpInput<V, SV>]?: NonNullable<RunLumpInput<V, SV>[K]> extends Function ? (RunLumpInput<V, SV>[K] | FilePath) : RunLumpInput<V, SV>[K];
53
58
  }, 'gitCommitMessageFn' | 'projectRoot' | 'branchFn' | 'baseBranch' | 'setupWorkspaceFn' | 'teardownWorkspaceFn' | 'gitAddCommandFn' | 'gitCommitCommandFn' | 'gitPushCommandFn'>, {
54
- baseBranch?: RunLumpInput<V>['baseBranch'];
59
+ baseBranch?: RunLumpInput<V, SV>['baseBranch'];
55
60
  /** Which integration line this lump is discovered and scheduled on (defaults to primary branch from local.json). */
56
61
  discoveryBranch?: string;
57
- command?: LumpJsConfigStep['command'];
62
+ command?: LumpJsConfigStep<V, SV>['command'];
58
63
  contextListJson?: FilePath | Record<string, string>;
59
- contextMatchFn?: FilePath | ContextMatchFn;
64
+ contextMatchFn?: FilePath | ContextMatchFn<V>;
60
65
  contextOptionsFn?: FilePath | ContextOptionsFn;
61
66
  disabled?: boolean | (() => MaybePromise<boolean>) | FilePath;
62
67
  maximumNumberOfConcurrentBranches?: number;
63
- prompt?: LumpJsConfigSoloStep;
64
- steps?: LumpJsConfigSteps | LumpJsConfigSoloStep;
68
+ prompt?: LumpJsConfigSoloStep<V, SV>;
69
+ steps?: LumpJsConfigSteps<V, SV> | LumpJsConfigStepsItem<V, SV>;
65
70
  registerCommands?: string[];
66
71
  keepHistory?: boolean;
67
72
  verbose?: boolean;
68
73
  }>;
69
74
 
70
- declare const defineConfig: <V extends LumpVariables = LumpVariables>(config: LumpJsConfig<V>) => LumpJsConfig<V>;
75
+ declare function defineConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(config: NoInfer<LumpJsConfig<V, SV>>): LumpJsConfig<V, SV>;
71
76
 
72
- declare const defineContextMatchFn: (e: ContextMatchFn) => ContextMatchFn;
77
+ declare function defineContextMatchFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<ContextMatchFn<V>>): ContextMatchFn<V>;
73
78
 
74
79
  declare const defineContextOptionsFn: (e: ContextOptionsFn) => ContextOptionsFn;
75
80
 
76
- declare const defineGetContextListFn: (e: GetContextListFn) => GetContextListFn;
81
+ declare function defineGetContextListFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<GetContextListFn<V>>): GetContextListFn<V>;
77
82
 
78
83
  declare const defineGitAddCommandFn: (e: GitAddCommandFn) => GitAddCommandFn;
79
84
 
80
85
  declare const defineGitCommitCommandFn: (e: GitCommitCommandFn) => GitCommitCommandFn;
81
86
 
82
- declare const defineGitCommitMessageFn: (e: GitCommitMessageFn) => GitCommitMessageFn;
87
+ declare function defineGitCommitMessageFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<GitCommitMessageFn<V>>): GitCommitMessageFn<V>;
83
88
 
84
89
  declare const defineGitPushCommandFn: (e: GitPushCommandFn) => GitPushCommandFn;
85
90
 
86
- declare const definePostCommandExecFn: (e: PostCommandExecFn) => PostCommandExecFn;
91
+ declare function definePostCommandExecFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(fn: NoInfer<LumpJsConfigPostCommandExecFn<V, SV>>): LumpJsConfigPostCommandExecFn<V, SV>;
87
92
 
88
- declare const definePromptFn: (e: PromptFn) => PromptFn;
93
+ declare function definePromptFn<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(fn: NoInfer<PromptFn<V, SV>>): PromptFn<V, SV>;
89
94
 
90
- declare const defineStep: (e: LumpJsConfigStep) => LumpJsConfigStep;
95
+ declare function defineStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables>(step: NoInfer<LumpJsConfigStep<V, SV>>): LumpJsConfigStep<V, SV>;
91
96
 
92
- declare const defineSetupFn: (e: SetupFn) => SetupFn;
97
+ declare function defineSetupFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<SetupFn<V>>): SetupFn<V>;
93
98
 
94
- declare const defineTeardownFn: (e: TeardownFn) => TeardownFn;
99
+ declare function defineTeardownFn<V extends LumpVariables = LumpVariables>(fn: NoInfer<TeardownFn<V>>): TeardownFn<V>;
95
100
 
96
- type LumpJsonConfigStep = MergeObjs<Omit<Step, 'commandFn'>, {
101
+ type LumpJsonConfigStep<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = MergeObjs<Omit<Step<V, SV>, 'commandFn'>, {
97
102
  promptTemplate?: FilePathOrString;
98
103
  promptFn?: FilePath;
99
104
  command?: string | FilePath;
100
105
  postCommandExecFn?: FilePath;
101
106
  }>;
102
107
 
103
- type LumpJsonConfig<V extends LumpVariables = LumpVariables> = {
104
- [K in keyof LumpJsConfig<V>]: Exclude<LumpJsConfig<V>[K], Function>;
108
+ type LumpJsonConfig<V extends LumpVariables = LumpVariables, SV extends StepVariables = StepVariables> = {
109
+ [K in keyof LumpJsConfig<V, SV>]: Exclude<LumpJsConfig<V, SV>[K], Function>;
105
110
  } & {
106
- prompt?: LumpJsonConfigStep;
107
- steps?: (LumpJsonConfigStep | string)[];
111
+ prompt?: LumpJsonConfigStep<V, SV>;
112
+ steps?: (LumpJsonConfigStep<V, SV> | string)[];
108
113
  };
109
114
 
110
115
  /**
@@ -152,4 +157,4 @@ interface ProjectConfig {
152
157
  }
153
158
 
154
159
  export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommandFn, defineGitCommitCommandFn, defineGitCommitMessageFn, defineGitPushCommandFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
155
- export type { CommandModule, CommandTag, ContextMatchFn, ContextOptionsFn, FilePath, FilePathOrString, LocalConfig, LumpJsConfig, LumpJsConfigStep, LumpJsConfigSteps, LumpJsonConfig, LumpJsonConfigStep, MergeObjs, Mode, ProjectConfig };
160
+ export type { CommandModule, CommandTag, ContextMatchFn, ContextOptionsFn, FilePath, FilePathOrString, LocalConfig, LumpJsConfig, LumpJsConfigPostCommandExecFn, LumpJsConfigStep, LumpJsConfigSteps, LumpJsConfigStepsFn, LumpJsConfigStepsItem, LumpJsonConfig, LumpJsonConfigStep, MergeObjs, Mode, ProjectConfig, StepFn };
package/dist/index.js CHANGED
@@ -1,39 +1,67 @@
1
- const identity = (e) => e;
1
+ function defineBranchFn(fn) {
2
+ return fn;
3
+ }
2
4
 
3
- const defineBranchFn = (identity);
5
+ function defineCommand(fn) {
6
+ return fn;
7
+ }
4
8
 
5
- const defineCommand = (identity);
9
+ function defineCommandModule(module) {
10
+ return module;
11
+ }
6
12
 
7
- const defineCommandModule = (identity);
13
+ function defineCommandSetup(fn) {
14
+ return fn;
15
+ }
8
16
 
9
- const defineCommandSetup = (identity);
17
+ function defineCommandTeardown(fn) {
18
+ return fn;
19
+ }
10
20
 
11
- const defineCommandTeardown = (identity);
21
+ function defineConfig(config) {
22
+ return config;
23
+ }
12
24
 
13
- const defineConfig = identity;
25
+ function defineContextMatchFn(fn) {
26
+ return fn;
27
+ }
14
28
 
15
- const defineContextMatchFn = (identity);
29
+ const identity = (e) => e;
16
30
 
17
31
  const defineContextOptionsFn = (identity);
18
32
 
19
- const defineGetContextListFn = (identity);
33
+ function defineGetContextListFn(fn) {
34
+ return fn;
35
+ }
20
36
 
21
37
  const defineGitAddCommandFn = (identity);
22
38
 
23
39
  const defineGitCommitCommandFn = (identity);
24
40
 
25
- const defineGitCommitMessageFn = (identity);
41
+ function defineGitCommitMessageFn(fn) {
42
+ return fn;
43
+ }
26
44
 
27
45
  const defineGitPushCommandFn = (identity);
28
46
 
29
- const definePostCommandExecFn = (identity);
47
+ function definePostCommandExecFn(fn) {
48
+ return fn;
49
+ }
30
50
 
31
- const definePromptFn = (identity);
51
+ function definePromptFn(fn) {
52
+ return fn;
53
+ }
32
54
 
33
- const defineStep = (identity);
55
+ function defineStep(step) {
56
+ return step;
57
+ }
34
58
 
35
- const defineSetupFn = (identity);
59
+ function defineSetupFn(fn) {
60
+ return fn;
61
+ }
36
62
 
37
- const defineTeardownFn = (identity);
63
+ function defineTeardownFn(fn) {
64
+ return fn;
65
+ }
38
66
 
39
67
  export { defineBranchFn, defineCommand, defineCommandModule, defineCommandSetup, defineCommandTeardown, defineConfig, defineContextMatchFn, defineContextOptionsFn, defineGetContextListFn, defineGitAddCommandFn, defineGitCommitCommandFn, defineGitCommitMessageFn, defineGitPushCommandFn, definePostCommandExecFn, definePromptFn, defineSetupFn, defineStep, defineTeardownFn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumpcode/cli-types",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
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.12"
40
+ "@lumpcode/core": "^0.0.14"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@rollup/plugin-commonjs": "^28.0.1",