@kb-labs/shared-cli-ui 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.
package/dist/index.d.cts CHANGED
@@ -400,14 +400,14 @@ interface CommandManifest {
400
400
  flags?: FlagDefinition[];
401
401
  examples?: string[];
402
402
  loader: () => Promise<{
403
- run: any;
403
+ run: unknown;
404
404
  }>;
405
405
  }
406
406
  interface FlagDefinition {
407
407
  name: string;
408
408
  type: 'string' | 'boolean' | 'number' | 'array';
409
409
  alias?: string;
410
- default?: any;
410
+ default?: string | boolean | number | string[];
411
411
  description?: string;
412
412
  choices?: string[];
413
413
  required?: boolean;
@@ -441,7 +441,7 @@ declare function getCommandInfo(manifest: CommandManifest[], commandId: string):
441
441
  /**
442
442
  * Generate suggestions for a specific group
443
443
  */
444
- declare function generateGroupSuggestions(manifest: CommandManifest[], group: string, _warningCodes: Set<string>, _context: any): Array<{
444
+ declare function generateGroupSuggestions(manifest: CommandManifest[], group: string, _warningCodes: Set<string>, _context: unknown): Array<{
445
445
  id: string;
446
446
  command: string;
447
447
  args: string[];
@@ -458,7 +458,10 @@ declare function generateGroupSuggestions(manifest: CommandManifest[], group: st
458
458
 
459
459
  interface MultiCLIContext {
460
460
  warningCodes: Set<string>;
461
- [key: string]: any;
461
+ undo?: {
462
+ available: boolean;
463
+ };
464
+ [key: string]: unknown;
462
465
  }
463
466
  interface CLIPackage {
464
467
  name: string;
@@ -834,6 +837,14 @@ declare function getContextCwd(input: {
834
837
  */
835
838
  declare function toPosixPath(input: string): string;
836
839
 
840
+ interface RetryOptions {
841
+ attempts?: number;
842
+ delay?: number;
843
+ backoff?: 'fixed' | 'exponential';
844
+ onRetry?: (error: unknown, attempt: number) => void;
845
+ }
846
+ declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
847
+
837
848
  /**
838
849
  * Modern CLI formatting utilities with side border design
839
850
  * Provides minimalist, modern UI components for CLI output
@@ -1055,4 +1066,4 @@ declare function infoResult(title: string, data?: {
1055
1066
  timing?: number;
1056
1067
  }): CommandOutput;
1057
1068
 
1058
- export { type AnalyticsConfig, type ArtifactDisplayOptions, type ArtifactInfo, type BaseFlagSpec, type BooleanFlagSpec, type CLIPackage, type CommandContext, type CommandDiscovery, type CommandExecutionResult, type CommandInfo, type CommandManifest, type CommandOutput, type CommandPresenter, type CommandRegistry, type CommandResult, type CommandResultParams, type CommandRunnerOptions, type CommandSuggestion, DynamicCommandDiscovery, type EnvDefinition, type EnvSchema, type FlagDefinition, type FlagSpec, type FlagType, type FlagsDefinition, type FlagsSchema, type FormatTimestampOptions, type InferFlagsType, type KeyValueOptions, Loader, type LoaderOptions, type ManifestLoader, type MultiCLIContext, MultiCLISuggestions, type NumberFlagSpec, type RichSectionItem, type RuntimeLike, type SafeKeyValueOptions, type SectionContent, type SectionItem, type SideBorderBoxOptions, StaticCommandDiscovery, type StringFlagSpec, type TableColumn, type TableOptions, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, extractCommandGroups, extractCommandIds, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, section, sectionHeader, setJsonMode, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult };
1069
+ export { type AnalyticsConfig, type ArtifactDisplayOptions, type ArtifactInfo, type BaseFlagSpec, type BooleanFlagSpec, type CLIPackage, type CommandContext, type CommandDiscovery, type CommandExecutionResult, type CommandInfo, type CommandManifest, type CommandOutput, type CommandPresenter, type CommandRegistry, type CommandResult, type CommandResultParams, type CommandRunnerOptions, type CommandSuggestion, DynamicCommandDiscovery, type EnvDefinition, type EnvSchema, type FlagDefinition, type FlagSpec, type FlagType, type FlagsDefinition, type FlagsSchema, type FormatTimestampOptions, type InferFlagsType, type KeyValueOptions, Loader, type LoaderOptions, type ManifestLoader, type MultiCLIContext, MultiCLISuggestions, type NumberFlagSpec, type RetryOptions, type RichSectionItem, type RuntimeLike, type SafeKeyValueOptions, type SectionContent, type SectionItem, type SideBorderBoxOptions, StaticCommandDiscovery, type StringFlagSpec, type TableColumn, type TableOptions, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, extractCommandGroups, extractCommandIds, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, section, sectionHeader, setJsonMode, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult, withRetry };
package/dist/index.d.ts CHANGED
@@ -400,14 +400,14 @@ interface CommandManifest {
400
400
  flags?: FlagDefinition[];
401
401
  examples?: string[];
402
402
  loader: () => Promise<{
403
- run: any;
403
+ run: unknown;
404
404
  }>;
405
405
  }
406
406
  interface FlagDefinition {
407
407
  name: string;
408
408
  type: 'string' | 'boolean' | 'number' | 'array';
409
409
  alias?: string;
410
- default?: any;
410
+ default?: string | boolean | number | string[];
411
411
  description?: string;
412
412
  choices?: string[];
413
413
  required?: boolean;
@@ -441,7 +441,7 @@ declare function getCommandInfo(manifest: CommandManifest[], commandId: string):
441
441
  /**
442
442
  * Generate suggestions for a specific group
443
443
  */
444
- declare function generateGroupSuggestions(manifest: CommandManifest[], group: string, _warningCodes: Set<string>, _context: any): Array<{
444
+ declare function generateGroupSuggestions(manifest: CommandManifest[], group: string, _warningCodes: Set<string>, _context: unknown): Array<{
445
445
  id: string;
446
446
  command: string;
447
447
  args: string[];
@@ -458,7 +458,10 @@ declare function generateGroupSuggestions(manifest: CommandManifest[], group: st
458
458
 
459
459
  interface MultiCLIContext {
460
460
  warningCodes: Set<string>;
461
- [key: string]: any;
461
+ undo?: {
462
+ available: boolean;
463
+ };
464
+ [key: string]: unknown;
462
465
  }
463
466
  interface CLIPackage {
464
467
  name: string;
@@ -834,6 +837,14 @@ declare function getContextCwd(input: {
834
837
  */
835
838
  declare function toPosixPath(input: string): string;
836
839
 
840
+ interface RetryOptions {
841
+ attempts?: number;
842
+ delay?: number;
843
+ backoff?: 'fixed' | 'exponential';
844
+ onRetry?: (error: unknown, attempt: number) => void;
845
+ }
846
+ declare function withRetry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
847
+
837
848
  /**
838
849
  * Modern CLI formatting utilities with side border design
839
850
  * Provides minimalist, modern UI components for CLI output
@@ -1055,4 +1066,4 @@ declare function infoResult(title: string, data?: {
1055
1066
  timing?: number;
1056
1067
  }): CommandOutput;
1057
1068
 
1058
- export { type AnalyticsConfig, type ArtifactDisplayOptions, type ArtifactInfo, type BaseFlagSpec, type BooleanFlagSpec, type CLIPackage, type CommandContext, type CommandDiscovery, type CommandExecutionResult, type CommandInfo, type CommandManifest, type CommandOutput, type CommandPresenter, type CommandRegistry, type CommandResult, type CommandResultParams, type CommandRunnerOptions, type CommandSuggestion, DynamicCommandDiscovery, type EnvDefinition, type EnvSchema, type FlagDefinition, type FlagSpec, type FlagType, type FlagsDefinition, type FlagsSchema, type FormatTimestampOptions, type InferFlagsType, type KeyValueOptions, Loader, type LoaderOptions, type ManifestLoader, type MultiCLIContext, MultiCLISuggestions, type NumberFlagSpec, type RichSectionItem, type RuntimeLike, type SafeKeyValueOptions, type SectionContent, type SectionItem, type SideBorderBoxOptions, StaticCommandDiscovery, type StringFlagSpec, type TableColumn, type TableOptions, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, extractCommandGroups, extractCommandIds, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, section, sectionHeader, setJsonMode, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult };
1069
+ export { type AnalyticsConfig, type ArtifactDisplayOptions, type ArtifactInfo, type BaseFlagSpec, type BooleanFlagSpec, type CLIPackage, type CommandContext, type CommandDiscovery, type CommandExecutionResult, type CommandInfo, type CommandManifest, type CommandOutput, type CommandPresenter, type CommandRegistry, type CommandResult, type CommandResultParams, type CommandRunnerOptions, type CommandSuggestion, DynamicCommandDiscovery, type EnvDefinition, type EnvSchema, type FlagDefinition, type FlagSpec, type FlagType, type FlagsDefinition, type FlagsSchema, type FormatTimestampOptions, type InferFlagsType, type KeyValueOptions, Loader, type LoaderOptions, type ManifestLoader, type MultiCLIContext, MultiCLISuggestions, type NumberFlagSpec, type RetryOptions, type RichSectionItem, type RuntimeLike, type SafeKeyValueOptions, type SectionContent, type SectionItem, type SideBorderBoxOptions, StaticCommandDiscovery, type StringFlagSpec, type TableColumn, type TableOptions, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, extractCommandGroups, extractCommandIds, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, section, sectionHeader, setJsonMode, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult, withRetry };
package/dist/index.js CHANGED
@@ -1537,7 +1537,7 @@ function exportToJSON(entries, options = {}) {
1537
1537
  const filtered = options.filter ? filterDebugEntries(entries, options.filter) : entries;
1538
1538
  if (options.includeMeta === false) {
1539
1539
  return JSON.stringify(
1540
- filtered.map(({ meta, ...rest }) => rest),
1540
+ filtered.map(({ meta: _meta, ...rest }) => rest),
1541
1541
  null,
1542
1542
  2
1543
1543
  );
@@ -2259,6 +2259,42 @@ function toPosixPath(input) {
2259
2259
  return input.replace(/\\/g, "/");
2260
2260
  }
2261
2261
 
2262
+ // src/utils/retry.ts
2263
+ async function sleepForRetry(attempt, delay, backoff) {
2264
+ if (delay <= 0) {
2265
+ return;
2266
+ }
2267
+ const wait = backoff === "exponential" ? delay * 2 ** (attempt - 1) : delay;
2268
+ await new Promise((resolve) => {
2269
+ setTimeout(resolve, wait);
2270
+ });
2271
+ }
2272
+ async function withRetry(fn, options = {}) {
2273
+ if (typeof fn !== "function") {
2274
+ throw new TypeError("fn must be a function");
2275
+ }
2276
+ const { attempts = 3, delay = 0, backoff = "fixed", onRetry } = options;
2277
+ if (attempts < 1) {
2278
+ throw new RangeError(`attempts must be >= 1, got ${attempts}`);
2279
+ }
2280
+ if (delay < 0) {
2281
+ throw new RangeError(`delay must be >= 0, got ${delay}`);
2282
+ }
2283
+ let lastError;
2284
+ for (let attempt = 1; attempt <= attempts; attempt++) {
2285
+ try {
2286
+ return await fn();
2287
+ } catch (err) {
2288
+ lastError = err;
2289
+ if (attempt < attempts) {
2290
+ onRetry?.(err, attempt);
2291
+ await sleepForRetry(attempt, delay, backoff);
2292
+ }
2293
+ }
2294
+ }
2295
+ throw lastError;
2296
+ }
2297
+
2262
2298
  // src/modern-format.ts
2263
2299
  function sideBorderBox(options) {
2264
2300
  const { title, sections, footer, status, timing } = options;
@@ -2581,6 +2617,6 @@ function infoResult(title, data) {
2581
2617
  });
2582
2618
  }
2583
2619
 
2584
- export { DebugOutput, DebugSection, DebugTrace, DebugTree, DynamicCommandDiscovery, Loader, MultiCLISuggestions, StaticCommandDiscovery, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDebugTree, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, describeEntriesAI, describeEntriesHuman, describeEntriesTimeline, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, exportDebugEntries, exportToChromeFormat, exportToJSON, exportToPlainText, extractCommandGroups, extractCommandIds, filterByLevel, filterByNamespace, filterByTimeRange, filterDebugEntries, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatDebugEntriesAI, formatDebugEntriesHuman, formatDebugEntryAI, formatDebugEntryHuman, formatDebugOutput, formatDebugOutputs, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimeline, formatTimelineNode, formatTimelineWithSummary, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, groupByGroup, groupByNamespace, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, searchInLogs, section, sectionHeader, setJsonMode, shouldUseAIFormat, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult };
2620
+ export { DebugOutput, DebugSection, DebugTrace, DebugTree, DynamicCommandDiscovery, Loader, MultiCLISuggestions, StaticCommandDiscovery, TimingTracker, accentLabel, box, bulletList, colors, createCommandDiscovery, createCommandRegistry, createCommandRunner, createDebugTree, createDetailedResult, createKBLabsCommandDiscovery, createProgressBar, createSimpleResult, createSpinner, defineEnv, defineFlags, describeEntriesAI, describeEntriesHuman, describeEntriesTimeline, discoverArtifacts, displayArtifacts, displayArtifactsCompact, displaySingleArtifact, errorResult, exportDebugEntries, exportToChromeFormat, exportToJSON, exportToPlainText, extractCommandGroups, extractCommandIds, filterByLevel, filterByNamespace, filterByTimeRange, filterDebugEntries, findCommandById, findCommandsByGroup, formatCommandHelp, formatCommandOutput, formatCommandResult, formatDebugEntriesAI, formatDebugEntriesHuman, formatDebugEntryAI, formatDebugEntryHuman, formatDebugOutput, formatDebugOutputs, formatError, formatKeyValueTable, formatRelativeTime, formatSize, formatTable, formatTimeline, formatTimelineNode, formatTimelineWithSummary, formatTimestamp, formatTiming, formatTimingBreakdown, generateDevlinkSuggestions, generateGroupSuggestions, generateQuickActions, getCommandInfo, getContextCwd, groupByGroup, groupByNamespace, hasAnsi, headline, indent, infoResult, isCommandAvailable, isJsonMode, keyValue, mergeFlags, metricsList, muted, pad, parseBoolean, parseEnvFromRuntime, parseFlagsFromInput, parseNumber, parseNumberFlag, parseString, safeColors, safeKeyValue, safeSymbols, searchInLogs, section, sectionHeader, setJsonMode, shouldUseAIFormat, showError, showLoading, showSuccess, sideBorderBox, statusLine, stripAnsi, successResult, supportsColor, symbols, table, toPosixPath, truncate, useLoader, validateSuggestions, warningResult, withRetry };
2585
2621
  //# sourceMappingURL=index.js.map
2586
2622
  //# sourceMappingURL=index.js.map