@kb-labs/cli-commands 2.89.0 → 2.94.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.
@@ -1,4 +1,4 @@
1
- import { ManifestV3 } from '@kb-labs/plugin-contracts';
1
+ import { ManifestV3, PluginContextV3 } from '@kb-labs/plugin-contracts';
2
2
 
3
3
  /**
4
4
  * @kb-labs/cli-commands/registry
@@ -27,12 +27,15 @@ interface CommandManifest {
27
27
  permissions?: string[];
28
28
  telemetry?: 'opt-in' | 'off';
29
29
  manifestV2?: ManifestV3;
30
+ pkgRoot?: string;
31
+ /** Internal flag: true for synthetic "unavailable" manifests that must not be cached. */
32
+ _synthetic?: boolean;
30
33
  }
31
34
  interface FlagDefinition {
32
35
  name: string;
33
36
  type: "string" | "boolean" | "number" | "array";
34
37
  alias?: string;
35
- default?: any;
38
+ default?: unknown;
36
39
  description?: string;
37
40
  describe?: string;
38
41
  choices?: string[];
@@ -50,17 +53,20 @@ interface RegisteredCommand {
50
53
  shadowed: boolean;
51
54
  pkgRoot?: string;
52
55
  packageName?: string;
56
+ /** Lifecycle dispose hook, set by manifest module if it exports `dispose`. */
57
+ _disposeHook?: () => Promise<void>;
53
58
  }
54
59
  interface CommandModule {
55
- run: (ctx: any, argv: string[], flags: Record<string, any>) => Promise<number | void>;
60
+ run: (ctx: unknown, argv: string[], flags: Record<string, unknown>) => Promise<number | void>;
56
61
  }
57
62
  interface DiscoveryResult {
58
63
  source: 'workspace' | 'node_modules' | 'linked' | 'builtin';
59
64
  /**
60
65
  * Scope this result came from. Platform-wide discovery (monorepo workspace,
61
66
  * platform node_modules) reports `platform`; discovery from
62
- * `<projectRoot>/.kb/plugins/` reports `project`. On collision (same
63
- * packageName in both scopes) the platform entry wins — see ADR-0012.
67
+ * `<projectRoot>/.kb/plugins/` or `<projectRoot>` workspace reports `project`.
68
+ * On collision (same packageName in both scopes) the project entry wins —
69
+ * project overrides platform defaults.
64
70
  */
65
71
  scope: 'platform' | 'project';
66
72
  packageName: string;
@@ -121,7 +127,7 @@ type AvailabilityCheck = {
121
127
  */
122
128
 
123
129
  interface CommandRun {
124
- (ctx: any, argv: string[], flags: Record<string, any>): Promise<number | void>;
130
+ (ctx: PluginContextV3, argv: string[], flags: Record<string, unknown>): Promise<number | void>;
125
131
  }
126
132
  interface Command {
127
133
  name: string;
@@ -142,10 +148,10 @@ interface CommandGroup {
142
148
  interface CommandRegistry {
143
149
  register(cmd: Command): void;
144
150
  registerGroup(group: CommandGroup): void;
145
- registerManifest(cmd: any): void;
151
+ registerManifest(cmd: RegisteredCommand): void;
146
152
  list(): Command[];
147
153
  listGroups(): CommandGroup[];
148
- listManifests(): any[];
154
+ listManifests(): RegisteredCommand[];
149
155
  markPartial(isPartial: boolean): void;
150
156
  isPartial(): boolean;
151
157
  }
@@ -243,9 +249,7 @@ declare function findCommandWithType(nameOrPath: string | string[]): CommandLook
243
249
  * Create loader stub for ManifestV3 commands.
244
250
  * Loader should never be executed directly – CLI adapters must handle execution.
245
251
  */
246
- declare function createManifestV3Loader(commandId: string): () => Promise<{
247
- run: any;
248
- }>;
252
+ declare function createManifestV3Loader(commandId: string): () => Promise<CommandModule>;
249
253
  /**
250
254
  * Ensure manifest has loader function (rehydrate after JSON serialization).
251
255
  */
@@ -284,4 +288,4 @@ declare function discoverManifests(cwd: string, noCache?: boolean, options?: {
284
288
  */
285
289
  declare function discoverManifestsByNamespace(cwd: string, namespace: string, noCache?: boolean): Promise<DiscoveryResult[]>;
286
290
 
287
- export { type AvailabilityCheck as A, type CommandGroup as C, type DiscoveryResult as D, type FlagDefinition as F, type GlobalFlags as G, type ProductGroup as P, type RegisteredCommand as R, __test as _, type Command as a, type CacheFile as b, type CommandLookupResult as c, type CommandManifest as d, type CommandModule as e, type CommandType as f, type PackageCacheEntry as g, discoverManifests as h, discoverManifestsByNamespace as i, findCommand as j, findCommandWithType as k, resetInProcCache as l, registry as r };
291
+ export { type AvailabilityCheck as A, type CommandGroup as C, type DiscoveryResult as D, type FlagDefinition as F, type GlobalFlags as G, type ProductGroup as P, type RegisteredCommand as R, __test as _, type Command as a, type CacheFile as b, type CommandLookupResult as c, type CommandManifest as d, type CommandModule as e, type CommandType as f, type PackageCacheEntry as g, discoverManifests as h, discoverManifestsByNamespace as i, findCommand as j, findCommandWithType as k, type CommandRegistry as l, resetInProcCache as m, registry as r };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CommandGroup, P as ProductGroup, a as Command, R as RegisteredCommand } from './discover-Cz7X5bQp.js';
2
- export { A as AvailabilityCheck, b as CacheFile, c as CommandLookupResult, d as CommandManifest, e as CommandModule, f as CommandType, D as DiscoveryResult, F as FlagDefinition, G as GlobalFlags, g as PackageCacheEntry, h as discoverManifests, i as discoverManifestsByNamespace, j as findCommand, k as findCommandWithType, r as registry } from './discover-Cz7X5bQp.js';
1
+ import { C as CommandGroup, P as ProductGroup, a as Command, R as RegisteredCommand } from './discover-CCE84_5E.js';
2
+ export { A as AvailabilityCheck, b as CacheFile, c as CommandLookupResult, d as CommandManifest, e as CommandModule, f as CommandType, D as DiscoveryResult, F as FlagDefinition, G as GlobalFlags, g as PackageCacheEntry, h as discoverManifests, i as discoverManifestsByNamespace, j as findCommand, k as findCommandWithType, r as registry } from './discover-CCE84_5E.js';
3
3
  import { ILogger } from '@kb-labs/core-platform';
4
4
  export { TimingTracker } from '@kb-labs/shared-cli-ui';
5
5
  import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';