codeprobe 0.1.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/LICENSE +21 -0
- package/README.md +406 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +104 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ab.d.ts +7 -0
- package/dist/commands/ab.d.ts.map +1 -0
- package/dist/commands/ab.js +230 -0
- package/dist/commands/ab.js.map +1 -0
- package/dist/commands/agents.d.ts +10 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +326 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/autotest.d.ts +10 -0
- package/dist/commands/autotest.d.ts.map +1 -0
- package/dist/commands/autotest.js +408 -0
- package/dist/commands/autotest.js.map +1 -0
- package/dist/commands/benchmark.d.ts +6 -0
- package/dist/commands/benchmark.d.ts.map +1 -0
- package/dist/commands/benchmark.js +215 -0
- package/dist/commands/benchmark.js.map +1 -0
- package/dist/commands/check.d.ts +10 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +333 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/context.d.ts +16 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +219 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/cost.d.ts +9 -0
- package/dist/commands/cost.d.ts.map +1 -0
- package/dist/commands/cost.js +142 -0
- package/dist/commands/cost.js.map +1 -0
- package/dist/commands/dashboard.d.ts +10 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +462 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/diff.d.ts +6 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +118 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +203 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/explain.d.ts +7 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +164 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/flaky.d.ts +10 -0
- package/dist/commands/flaky.d.ts.map +1 -0
- package/dist/commands/flaky.js +141 -0
- package/dist/commands/flaky.js.map +1 -0
- package/dist/commands/generateClaudeMd.d.ts +11 -0
- package/dist/commands/generateClaudeMd.d.ts.map +1 -0
- package/dist/commands/generateClaudeMd.js +278 -0
- package/dist/commands/generateClaudeMd.js.map +1 -0
- package/dist/commands/generateRules.d.ts +11 -0
- package/dist/commands/generateRules.d.ts.map +1 -0
- package/dist/commands/generateRules.js +413 -0
- package/dist/commands/generateRules.js.map +1 -0
- package/dist/commands/heatmap.d.ts +7 -0
- package/dist/commands/heatmap.d.ts.map +1 -0
- package/dist/commands/heatmap.js +117 -0
- package/dist/commands/heatmap.js.map +1 -0
- package/dist/commands/history.d.ts +13 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +113 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/hooks.d.ts +9 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +199 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/improve.d.ts +7 -0
- package/dist/commands/improve.d.ts.map +1 -0
- package/dist/commands/improve.js +192 -0
- package/dist/commands/improve.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +270 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/installHook.d.ts +9 -0
- package/dist/commands/installHook.d.ts.map +1 -0
- package/dist/commands/installHook.js +78 -0
- package/dist/commands/installHook.js.map +1 -0
- package/dist/commands/lint.d.ts +6 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +237 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/map.d.ts +9 -0
- package/dist/commands/map.d.ts.map +1 -0
- package/dist/commands/map.js +114 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +151 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/models.d.ts +9 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +89 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/pack.d.ts +10 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +248 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/recommend.d.ts +10 -0
- package/dist/commands/recommend.d.ts.map +1 -0
- package/dist/commands/recommend.js +472 -0
- package/dist/commands/recommend.js.map +1 -0
- package/dist/commands/regression.d.ts +10 -0
- package/dist/commands/regression.d.ts.map +1 -0
- package/dist/commands/regression.js +212 -0
- package/dist/commands/regression.js.map +1 -0
- package/dist/commands/repl.d.ts +9 -0
- package/dist/commands/repl.d.ts.map +1 -0
- package/dist/commands/repl.js +245 -0
- package/dist/commands/repl.js.map +1 -0
- package/dist/commands/scan.d.ts +10 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +352 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/score.d.ts +10 -0
- package/dist/commands/score.d.ts.map +1 -0
- package/dist/commands/score.js +192 -0
- package/dist/commands/score.js.map +1 -0
- package/dist/commands/security.d.ts +10 -0
- package/dist/commands/security.d.ts.map +1 -0
- package/dist/commands/security.js +211 -0
- package/dist/commands/security.js.map +1 -0
- package/dist/commands/simulate.d.ts +7 -0
- package/dist/commands/simulate.d.ts.map +1 -0
- package/dist/commands/simulate.js +149 -0
- package/dist/commands/simulate.js.map +1 -0
- package/dist/commands/summary.d.ts +9 -0
- package/dist/commands/summary.d.ts.map +1 -0
- package/dist/commands/summary.js +271 -0
- package/dist/commands/summary.js.map +1 -0
- package/dist/commands/test.d.ts +9 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +219 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/ui.d.ts +8 -0
- package/dist/commands/ui.d.ts.map +1 -0
- package/dist/commands/ui.js +222 -0
- package/dist/commands/ui.js.map +1 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +254 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/workflow.d.ts +39 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +309 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/core/__tests__/contextAnalyzer.test.d.ts +2 -0
- package/dist/core/__tests__/contextAnalyzer.test.d.ts.map +1 -0
- package/dist/core/__tests__/contextAnalyzer.test.js +48 -0
- package/dist/core/__tests__/contextAnalyzer.test.js.map +1 -0
- package/dist/core/__tests__/promptLinter.test.d.ts +2 -0
- package/dist/core/__tests__/promptLinter.test.d.ts.map +1 -0
- package/dist/core/__tests__/promptLinter.test.js +74 -0
- package/dist/core/__tests__/promptLinter.test.js.map +1 -0
- package/dist/core/__tests__/promptRunner.test.d.ts +2 -0
- package/dist/core/__tests__/promptRunner.test.d.ts.map +1 -0
- package/dist/core/__tests__/promptRunner.test.js +84 -0
- package/dist/core/__tests__/promptRunner.test.js.map +1 -0
- package/dist/core/__tests__/securityScanner.test.d.ts +2 -0
- package/dist/core/__tests__/securityScanner.test.d.ts.map +1 -0
- package/dist/core/__tests__/securityScanner.test.js +39 -0
- package/dist/core/__tests__/securityScanner.test.js.map +1 -0
- package/dist/core/agentTracer.d.ts +21 -0
- package/dist/core/agentTracer.d.ts.map +1 -0
- package/dist/core/agentTracer.js +355 -0
- package/dist/core/agentTracer.js.map +1 -0
- package/dist/core/anthropicClient.d.ts +26 -0
- package/dist/core/anthropicClient.d.ts.map +1 -0
- package/dist/core/anthropicClient.js +62 -0
- package/dist/core/anthropicClient.js.map +1 -0
- package/dist/core/benchmarkRunner.d.ts +25 -0
- package/dist/core/benchmarkRunner.d.ts.map +1 -0
- package/dist/core/benchmarkRunner.js +182 -0
- package/dist/core/benchmarkRunner.js.map +1 -0
- package/dist/core/contextAnalyzer.d.ts +19 -0
- package/dist/core/contextAnalyzer.d.ts.map +1 -0
- package/dist/core/contextAnalyzer.js +221 -0
- package/dist/core/contextAnalyzer.js.map +1 -0
- package/dist/core/contextPacker.d.ts +26 -0
- package/dist/core/contextPacker.d.ts.map +1 -0
- package/dist/core/contextPacker.js +358 -0
- package/dist/core/contextPacker.js.map +1 -0
- package/dist/core/datasetRunner.d.ts +10 -0
- package/dist/core/datasetRunner.d.ts.map +1 -0
- package/dist/core/datasetRunner.js +130 -0
- package/dist/core/datasetRunner.js.map +1 -0
- package/dist/core/doctorRunner.d.ts +24 -0
- package/dist/core/doctorRunner.d.ts.map +1 -0
- package/dist/core/doctorRunner.js +278 -0
- package/dist/core/doctorRunner.js.map +1 -0
- package/dist/core/hookScanner.d.ts +24 -0
- package/dist/core/hookScanner.d.ts.map +1 -0
- package/dist/core/hookScanner.js +226 -0
- package/dist/core/hookScanner.js.map +1 -0
- package/dist/core/mcpScanner.d.ts +22 -0
- package/dist/core/mcpScanner.d.ts.map +1 -0
- package/dist/core/mcpScanner.js +290 -0
- package/dist/core/mcpScanner.js.map +1 -0
- package/dist/core/modelRegistry.d.ts +35 -0
- package/dist/core/modelRegistry.d.ts.map +1 -0
- package/dist/core/modelRegistry.js +97 -0
- package/dist/core/modelRegistry.js.map +1 -0
- package/dist/core/promptDiff.d.ts +25 -0
- package/dist/core/promptDiff.d.ts.map +1 -0
- package/dist/core/promptDiff.js +130 -0
- package/dist/core/promptDiff.js.map +1 -0
- package/dist/core/promptExplainer.d.ts +17 -0
- package/dist/core/promptExplainer.d.ts.map +1 -0
- package/dist/core/promptExplainer.js +334 -0
- package/dist/core/promptExplainer.js.map +1 -0
- package/dist/core/promptImprover.d.ts +19 -0
- package/dist/core/promptImprover.d.ts.map +1 -0
- package/dist/core/promptImprover.js +260 -0
- package/dist/core/promptImprover.js.map +1 -0
- package/dist/core/promptLinter.d.ts +24 -0
- package/dist/core/promptLinter.d.ts.map +1 -0
- package/dist/core/promptLinter.js +319 -0
- package/dist/core/promptLinter.js.map +1 -0
- package/dist/core/promptRunner.d.ts +31 -0
- package/dist/core/promptRunner.d.ts.map +1 -0
- package/dist/core/promptRunner.js +427 -0
- package/dist/core/promptRunner.js.map +1 -0
- package/dist/core/providers/anthropic.d.ts +10 -0
- package/dist/core/providers/anthropic.d.ts.map +1 -0
- package/dist/core/providers/anthropic.js +26 -0
- package/dist/core/providers/anthropic.js.map +1 -0
- package/dist/core/providers/base.d.ts +22 -0
- package/dist/core/providers/base.d.ts.map +1 -0
- package/dist/core/providers/base.js +2 -0
- package/dist/core/providers/base.js.map +1 -0
- package/dist/core/providers/factory.d.ts +7 -0
- package/dist/core/providers/factory.d.ts.map +1 -0
- package/dist/core/providers/factory.js +42 -0
- package/dist/core/providers/factory.js.map +1 -0
- package/dist/core/providers/google.d.ts +10 -0
- package/dist/core/providers/google.d.ts.map +1 -0
- package/dist/core/providers/google.js +47 -0
- package/dist/core/providers/google.js.map +1 -0
- package/dist/core/providers/openai.d.ts +19 -0
- package/dist/core/providers/openai.d.ts.map +1 -0
- package/dist/core/providers/openai.js +54 -0
- package/dist/core/providers/openai.js.map +1 -0
- package/dist/core/regressionRunner.d.ts +11 -0
- package/dist/core/regressionRunner.d.ts.map +1 -0
- package/dist/core/regressionRunner.js +116 -0
- package/dist/core/regressionRunner.js.map +1 -0
- package/dist/core/repositorySimulator.d.ts +17 -0
- package/dist/core/repositorySimulator.d.ts.map +1 -0
- package/dist/core/repositorySimulator.js +104 -0
- package/dist/core/repositorySimulator.js.map +1 -0
- package/dist/core/scorer.d.ts +30 -0
- package/dist/core/scorer.d.ts.map +1 -0
- package/dist/core/scorer.js +317 -0
- package/dist/core/scorer.js.map +1 -0
- package/dist/core/securityScanner.d.ts +23 -0
- package/dist/core/securityScanner.d.ts.map +1 -0
- package/dist/core/securityScanner.js +216 -0
- package/dist/core/securityScanner.js.map +1 -0
- package/dist/core/skillValidator.d.ts +41 -0
- package/dist/core/skillValidator.d.ts.map +1 -0
- package/dist/core/skillValidator.js +235 -0
- package/dist/core/skillValidator.js.map +1 -0
- package/dist/core/testHistory.d.ts +44 -0
- package/dist/core/testHistory.d.ts.map +1 -0
- package/dist/core/testHistory.js +91 -0
- package/dist/core/testHistory.js.map +1 -0
- package/dist/tokenizers/claudeTokenizer.d.ts +26 -0
- package/dist/tokenizers/claudeTokenizer.d.ts.map +1 -0
- package/dist/tokenizers/claudeTokenizer.js +83 -0
- package/dist/tokenizers/claudeTokenizer.js.map +1 -0
- package/dist/types/agent.d.ts +26 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +5 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/config.d.ts +30 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +5 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/context.d.ts +77 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +5 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/dataset.d.ts +26 -0
- package/dist/types/dataset.d.ts.map +1 -0
- package/dist/types/dataset.js +5 -0
- package/dist/types/dataset.js.map +1 -0
- package/dist/types/diagnostics.d.ts +31 -0
- package/dist/types/diagnostics.d.ts.map +1 -0
- package/dist/types/diagnostics.js +5 -0
- package/dist/types/diagnostics.js.map +1 -0
- package/dist/types/prompt.d.ts +53 -0
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/types/prompt.js +5 -0
- package/dist/types/prompt.js.map +1 -0
- package/dist/types/results.d.ts +42 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +5 -0
- package/dist/types/results.js.map +1 -0
- package/dist/ui/dashboard.d.ts +57 -0
- package/dist/ui/dashboard.d.ts.map +1 -0
- package/dist/ui/dashboard.js +644 -0
- package/dist/ui/dashboard.js.map +1 -0
- package/dist/utils/__tests__/hashing.test.d.ts +2 -0
- package/dist/utils/__tests__/hashing.test.d.ts.map +1 -0
- package/dist/utils/__tests__/hashing.test.js +28 -0
- package/dist/utils/__tests__/hashing.test.js.map +1 -0
- package/dist/utils/__tests__/output.test.d.ts +2 -0
- package/dist/utils/__tests__/output.test.d.ts.map +1 -0
- package/dist/utils/__tests__/output.test.js +62 -0
- package/dist/utils/__tests__/output.test.js.map +1 -0
- package/dist/utils/cache.d.ts +29 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +87 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/config.d.ts +15 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +61 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/errors.d.ts +43 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +83 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/fs.d.ts +44 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +119 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/hashing.d.ts +13 -0
- package/dist/utils/hashing.d.ts.map +1 -0
- package/dist/utils/hashing.js +18 -0
- package/dist/utils/hashing.js.map +1 -0
- package/dist/utils/logger.d.ts +32 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +76 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/output.d.ts +34 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +99 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/paths.d.ts +33 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +51 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/spinner.d.ts +23 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +79 -0
- package/dist/utils/spinner.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for codeprobe CLI.
|
|
3
|
+
*/
|
|
4
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
5
|
+
/**
|
|
6
|
+
* Enable or disable JSON output mode.
|
|
7
|
+
* When enabled, spinners and decorative output are suppressed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setJsonMode(enabled: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* Check whether JSON output mode is active.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isJsonMode(): boolean;
|
|
14
|
+
export declare function setLogLevel(level: LogLevel): void;
|
|
15
|
+
export declare function getLogLevel(): LogLevel;
|
|
16
|
+
export declare function debug(message: string, ...args: unknown[]): void;
|
|
17
|
+
export declare function info(message: string, ...args: unknown[]): void;
|
|
18
|
+
export declare function warn(message: string, ...args: unknown[]): void;
|
|
19
|
+
export declare function error(message: string, ...args: unknown[]): void;
|
|
20
|
+
export declare function success(message: string, ...args: unknown[]): void;
|
|
21
|
+
export declare function dim(message: string, ...args: unknown[]): void;
|
|
22
|
+
export declare const logger: {
|
|
23
|
+
debug: typeof debug;
|
|
24
|
+
info: typeof info;
|
|
25
|
+
warn: typeof warn;
|
|
26
|
+
error: typeof error;
|
|
27
|
+
success: typeof success;
|
|
28
|
+
dim: typeof dim;
|
|
29
|
+
setLogLevel: typeof setLogLevel;
|
|
30
|
+
getLogLevel: typeof getLogLevel;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAKtE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAElD;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAUD,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAEjD;AAED,wBAAgB,WAAW,IAAI,QAAQ,CAEtC;AAMD,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI/D;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9D;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI/D;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAIjE;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI7D;AAED,eAAO,MAAM,MAAM;;;;;;;;;CASlB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities for codeprobe CLI.
|
|
3
|
+
*/
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
let currentLevel = 'info';
|
|
6
|
+
let jsonMode = false;
|
|
7
|
+
/**
|
|
8
|
+
* Enable or disable JSON output mode.
|
|
9
|
+
* When enabled, spinners and decorative output are suppressed.
|
|
10
|
+
*/
|
|
11
|
+
export function setJsonMode(enabled) {
|
|
12
|
+
jsonMode = enabled;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check whether JSON output mode is active.
|
|
16
|
+
*/
|
|
17
|
+
export function isJsonMode() {
|
|
18
|
+
return jsonMode;
|
|
19
|
+
}
|
|
20
|
+
const LEVEL_ORDER = {
|
|
21
|
+
debug: 0,
|
|
22
|
+
info: 1,
|
|
23
|
+
warn: 2,
|
|
24
|
+
error: 3,
|
|
25
|
+
silent: 4,
|
|
26
|
+
};
|
|
27
|
+
export function setLogLevel(level) {
|
|
28
|
+
currentLevel = level;
|
|
29
|
+
}
|
|
30
|
+
export function getLogLevel() {
|
|
31
|
+
return currentLevel;
|
|
32
|
+
}
|
|
33
|
+
function shouldLog(level) {
|
|
34
|
+
return LEVEL_ORDER[level] >= LEVEL_ORDER[currentLevel];
|
|
35
|
+
}
|
|
36
|
+
export function debug(message, ...args) {
|
|
37
|
+
if (shouldLog('debug')) {
|
|
38
|
+
console.log(chalk.gray(`[debug] ${message}`), ...args);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function info(message, ...args) {
|
|
42
|
+
if (shouldLog('info')) {
|
|
43
|
+
console.log(message, ...args);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function warn(message, ...args) {
|
|
47
|
+
if (shouldLog('warn')) {
|
|
48
|
+
console.warn(chalk.yellow(`[warn] ${message}`), ...args);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function error(message, ...args) {
|
|
52
|
+
if (shouldLog('error')) {
|
|
53
|
+
console.error(chalk.red(`[error] ${message}`), ...args);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function success(message, ...args) {
|
|
57
|
+
if (shouldLog('info')) {
|
|
58
|
+
console.log(chalk.green(message), ...args);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function dim(message, ...args) {
|
|
62
|
+
if (shouldLog('info')) {
|
|
63
|
+
console.log(chalk.dim(message), ...args);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const logger = {
|
|
67
|
+
debug,
|
|
68
|
+
info,
|
|
69
|
+
warn,
|
|
70
|
+
error,
|
|
71
|
+
success,
|
|
72
|
+
dim,
|
|
73
|
+
setLogLevel,
|
|
74
|
+
getLogLevel,
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,IAAI,YAAY,GAAa,MAAM,CAAC;AACpC,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,QAAQ,GAAG,OAAO,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,WAAW,GAA6B;IAC5C,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,KAAe;IACzC,YAAY,GAAG,KAAK,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,SAAS,CAAC,KAAe;IAChC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,GAAG,IAAe;IACvD,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,GAAG,IAAe;I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2
|
+
* Output formatting utilities for tables, sizes, durations, and
|
|
3
|
+
* ASCII bar charts.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format an array of rows into an aligned plain-text table.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatTable(headers: string[], rows: string[][]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Format a byte count into a human-readable string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatBytes(bytes: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format a token count into a human-readable string (e.g. "12.3k").
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatTokens(tokens: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Format a duration in milliseconds into a human-readable string.
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatDuration(ms: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Format a value between 0 and 1 as a percentage string.
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatPercentage(value: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Render an ASCII progress/proportion bar.
|
|
27
|
+
*
|
|
28
|
+
* @param value Current value
|
|
29
|
+
* @param max Maximum value (determines bar fill)
|
|
30
|
+
* @param width Character width of the bar (default 30)
|
|
31
|
+
* @returns A string like `[########............]`
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatBar(value: number, max: number, width?: number): string;
|
|
34
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CA2BvE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,MAAW,GACjB,MAAM,CAQR"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatting utilities for tables, sizes, durations, and
|
|
3
|
+
* ASCII bar charts.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format an array of rows into an aligned plain-text table.
|
|
7
|
+
*/
|
|
8
|
+
export function formatTable(headers, rows) {
|
|
9
|
+
const colWidths = headers.map((h, i) => {
|
|
10
|
+
const maxData = rows.reduce((max, row) => Math.max(max, (row[i] ?? '').length), 0);
|
|
11
|
+
return Math.max(h.length, maxData);
|
|
12
|
+
});
|
|
13
|
+
const lines = [];
|
|
14
|
+
const headerLine = headers
|
|
15
|
+
.map((h, i) => h.padEnd(colWidths[i]))
|
|
16
|
+
.join(' ');
|
|
17
|
+
lines.push(headerLine);
|
|
18
|
+
const separator = colWidths.map((w) => '-'.repeat(w)).join(' ');
|
|
19
|
+
lines.push(separator);
|
|
20
|
+
for (const row of rows) {
|
|
21
|
+
const line = row
|
|
22
|
+
.map((cell, i) => (cell ?? '').padEnd(colWidths[i]))
|
|
23
|
+
.join(' ');
|
|
24
|
+
lines.push(line);
|
|
25
|
+
}
|
|
26
|
+
return lines.join('\n');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Format a byte count into a human-readable string.
|
|
30
|
+
*/
|
|
31
|
+
export function formatBytes(bytes) {
|
|
32
|
+
if (bytes < 0)
|
|
33
|
+
return '0 B';
|
|
34
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
35
|
+
let unitIndex = 0;
|
|
36
|
+
let value = bytes;
|
|
37
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
38
|
+
value /= 1024;
|
|
39
|
+
unitIndex++;
|
|
40
|
+
}
|
|
41
|
+
if (unitIndex === 0)
|
|
42
|
+
return `${value} B`;
|
|
43
|
+
return `${value.toFixed(1)} ${units[unitIndex]}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Format a token count into a human-readable string (e.g. "12.3k").
|
|
47
|
+
*/
|
|
48
|
+
export function formatTokens(tokens) {
|
|
49
|
+
if (tokens < 0)
|
|
50
|
+
return '0';
|
|
51
|
+
if (tokens < 1000)
|
|
52
|
+
return tokens.toString();
|
|
53
|
+
if (tokens < 1_000_000)
|
|
54
|
+
return `${(tokens / 1000).toFixed(1)}k`;
|
|
55
|
+
return `${(tokens / 1_000_000).toFixed(2)}M`;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format a duration in milliseconds into a human-readable string.
|
|
59
|
+
*/
|
|
60
|
+
export function formatDuration(ms) {
|
|
61
|
+
if (ms < 0)
|
|
62
|
+
return '0ms';
|
|
63
|
+
if (ms < 1000)
|
|
64
|
+
return `${Math.round(ms)}ms`;
|
|
65
|
+
if (ms < 60_000)
|
|
66
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
67
|
+
if (ms < 3_600_000) {
|
|
68
|
+
const minutes = Math.floor(ms / 60_000);
|
|
69
|
+
const seconds = Math.round((ms % 60_000) / 1000);
|
|
70
|
+
return `${minutes}m ${seconds}s`;
|
|
71
|
+
}
|
|
72
|
+
const hours = Math.floor(ms / 3_600_000);
|
|
73
|
+
const minutes = Math.round((ms % 3_600_000) / 60_000);
|
|
74
|
+
return `${hours}h ${minutes}m`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Format a value between 0 and 1 as a percentage string.
|
|
78
|
+
*/
|
|
79
|
+
export function formatPercentage(value) {
|
|
80
|
+
const clamped = Math.max(0, Math.min(1, value));
|
|
81
|
+
return `${(clamped * 100).toFixed(1)}%`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Render an ASCII progress/proportion bar.
|
|
85
|
+
*
|
|
86
|
+
* @param value Current value
|
|
87
|
+
* @param max Maximum value (determines bar fill)
|
|
88
|
+
* @param width Character width of the bar (default 30)
|
|
89
|
+
* @returns A string like `[########............]`
|
|
90
|
+
*/
|
|
91
|
+
export function formatBar(value, max, width = 30) {
|
|
92
|
+
if (max <= 0)
|
|
93
|
+
return '[' + '.'.repeat(width) + ']';
|
|
94
|
+
const ratio = Math.max(0, Math.min(1, value / max));
|
|
95
|
+
const filled = Math.round(ratio * width);
|
|
96
|
+
const empty = width - filled;
|
|
97
|
+
return '[' + '#'.repeat(filled) + '.'.repeat(empty) + ']';
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAiB,EAAE,IAAgB;IAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CACzB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAClD,CAAC,CACF,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,UAAU,GAAG,OAAO;SACvB,GAAG,CAAC,CAAC,CAAC,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G,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC;IACtD,OAAO,GAAG,KAAK,KAAK,OAAO,GAAG,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAChD,OAAO,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,KAAa,EACb,GAAW,EACX,QAAgB,EAAE;IAElB,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;IAEnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAE7B,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path utilities for resolving project root, cache directories,
|
|
3
|
+
* and normalizing paths.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the project root directory.
|
|
7
|
+
*
|
|
8
|
+
* Uses the current working directory as the project root. This aligns
|
|
9
|
+
* with how CLI tools typically operate: they act on the directory from
|
|
10
|
+
* which they are invoked.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveProjectRoot(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a path relative to the current working directory.
|
|
15
|
+
* Absolute paths are returned as-is.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolvePath(p: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Get a relative path from `from` to `to`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRelativePath(from: string, to: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the cache directory for codeprobe.
|
|
24
|
+
*
|
|
25
|
+
* Follows XDG conventions on Linux/macOS:
|
|
26
|
+
* $XDG_CACHE_HOME/codeprobe (if set)
|
|
27
|
+
* ~/.cache/codeprobe (default)
|
|
28
|
+
*
|
|
29
|
+
* Falls back to the OS temp directory if the home directory is not
|
|
30
|
+
* available.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getCacheDir(): string;
|
|
33
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAYpC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path utilities for resolving project root, cache directories,
|
|
3
|
+
* and normalizing paths.
|
|
4
|
+
*/
|
|
5
|
+
import { resolve, relative, join } from 'node:path';
|
|
6
|
+
import { homedir, tmpdir } from 'node:os';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the project root directory.
|
|
9
|
+
*
|
|
10
|
+
* Uses the current working directory as the project root. This aligns
|
|
11
|
+
* with how CLI tools typically operate: they act on the directory from
|
|
12
|
+
* which they are invoked.
|
|
13
|
+
*/
|
|
14
|
+
export function resolveProjectRoot() {
|
|
15
|
+
return process.cwd();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a path relative to the current working directory.
|
|
19
|
+
* Absolute paths are returned as-is.
|
|
20
|
+
*/
|
|
21
|
+
export function resolvePath(p) {
|
|
22
|
+
return resolve(process.cwd(), p);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get a relative path from `from` to `to`.
|
|
26
|
+
*/
|
|
27
|
+
export function getRelativePath(from, to) {
|
|
28
|
+
return relative(from, to);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the cache directory for codeprobe.
|
|
32
|
+
*
|
|
33
|
+
* Follows XDG conventions on Linux/macOS:
|
|
34
|
+
* $XDG_CACHE_HOME/codeprobe (if set)
|
|
35
|
+
* ~/.cache/codeprobe (default)
|
|
36
|
+
*
|
|
37
|
+
* Falls back to the OS temp directory if the home directory is not
|
|
38
|
+
* available.
|
|
39
|
+
*/
|
|
40
|
+
export function getCacheDir() {
|
|
41
|
+
const xdgCache = process.env['XDG_CACHE_HOME'];
|
|
42
|
+
if (xdgCache) {
|
|
43
|
+
return join(xdgCache, 'codeprobe');
|
|
44
|
+
}
|
|
45
|
+
const home = homedir();
|
|
46
|
+
if (home) {
|
|
47
|
+
return join(home, '.cache', 'codeprobe');
|
|
48
|
+
}
|
|
49
|
+
return join(tmpdir(), 'codeprobe');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAS;IACnC,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,EAAU;IACtD,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC/C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner wrapper around ora (ESM dynamic import).
|
|
3
|
+
*
|
|
4
|
+
* Provides a simplified interface for showing progress indicators.
|
|
5
|
+
* Falls back to plain text output when ora cannot be loaded or when
|
|
6
|
+
* stdout is not a TTY.
|
|
7
|
+
*/
|
|
8
|
+
export interface Spinner {
|
|
9
|
+
start(): void;
|
|
10
|
+
stop(): void;
|
|
11
|
+
succeed(text?: string): void;
|
|
12
|
+
fail(text?: string): void;
|
|
13
|
+
update(text: string): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a spinner with the given initial text.
|
|
17
|
+
*
|
|
18
|
+
* If the log level is set to 'silent' or the terminal does not support
|
|
19
|
+
* TTY output, the returned spinner is a silent no-op that avoids
|
|
20
|
+
* polluting stdout.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSpinner(text: string): Promise<Spinner>;
|
|
23
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/utils/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,OAAO;IACtB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;IACb,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6BlE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spinner wrapper around ora (ESM dynamic import).
|
|
3
|
+
*
|
|
4
|
+
* Provides a simplified interface for showing progress indicators.
|
|
5
|
+
* Falls back to plain text output when ora cannot be loaded or when
|
|
6
|
+
* stdout is not a TTY.
|
|
7
|
+
*/
|
|
8
|
+
import { getLogLevel } from './logger.js';
|
|
9
|
+
/**
|
|
10
|
+
* Create a spinner with the given initial text.
|
|
11
|
+
*
|
|
12
|
+
* If the log level is set to 'silent' or the terminal does not support
|
|
13
|
+
* TTY output, the returned spinner is a silent no-op that avoids
|
|
14
|
+
* polluting stdout.
|
|
15
|
+
*/
|
|
16
|
+
export async function createSpinner(text) {
|
|
17
|
+
if (getLogLevel() === 'silent') {
|
|
18
|
+
return createNoopSpinner();
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const ora = await import('ora');
|
|
22
|
+
const instance = ora.default(text);
|
|
23
|
+
return {
|
|
24
|
+
start() {
|
|
25
|
+
instance.start();
|
|
26
|
+
},
|
|
27
|
+
stop() {
|
|
28
|
+
instance.stop();
|
|
29
|
+
},
|
|
30
|
+
succeed(msg) {
|
|
31
|
+
instance.succeed(msg);
|
|
32
|
+
},
|
|
33
|
+
fail(msg) {
|
|
34
|
+
instance.fail(msg);
|
|
35
|
+
},
|
|
36
|
+
update(msg) {
|
|
37
|
+
instance.text = msg;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return createFallbackSpinner(text);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* No-op spinner for JSON mode.
|
|
47
|
+
*/
|
|
48
|
+
function createNoopSpinner() {
|
|
49
|
+
return {
|
|
50
|
+
start() { },
|
|
51
|
+
stop() { },
|
|
52
|
+
succeed() { },
|
|
53
|
+
fail() { },
|
|
54
|
+
update() { },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Plain text fallback when ora is unavailable.
|
|
59
|
+
*/
|
|
60
|
+
function createFallbackSpinner(text) {
|
|
61
|
+
return {
|
|
62
|
+
start() {
|
|
63
|
+
process.stderr.write(`... ${text}\n`);
|
|
64
|
+
},
|
|
65
|
+
stop() {
|
|
66
|
+
// nothing to clear
|
|
67
|
+
},
|
|
68
|
+
succeed(msg) {
|
|
69
|
+
process.stderr.write(` OK: ${msg ?? text}\n`);
|
|
70
|
+
},
|
|
71
|
+
fail(msg) {
|
|
72
|
+
process.stderr.write(` FAIL: ${msg ?? text}\n`);
|
|
73
|
+
},
|
|
74
|
+
update(msg) {
|
|
75
|
+
process.stderr.write(`... ${msg}\n`);
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/utils/spinner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC9C,IAAI,WAAW,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO;YACL,KAAK;gBACH,QAAQ,CAAC,KAAK,EAAE,CAAC;YACnB,CAAC;YACD,IAAI;gBACF,QAAQ,CAAC,IAAI,EAAE,CAAC;YAClB,CAAC;YACD,OAAO,CAAC,GAAY;gBAClB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;YACD,IAAI,CAAC,GAAY;gBACf,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,MAAM,CAAC,GAAW;gBAChB,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC;YACtB,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB;IACxB,OAAO;QACL,KAAK,KAAgB,CAAC;QACtB,IAAI,KAAgB,CAAC;QACrB,OAAO,KAAgB,CAAC;QACxB,IAAI,KAAgB,CAAC;QACrB,MAAM,KAAgB,CAAC;KACxB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB,CAAC,IAAY;IACzC,OAAO;QACL,KAAK;YACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QACxC,CAAC;QACD,IAAI;YACF,mBAAmB;QACrB,CAAC;QACD,OAAO,CAAC,GAAY;YAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,CAAC,GAAY;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,CAAC,GAAW;YAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codeprobe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DevTools for Claude — context engineering toolkit for Claude Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/cli.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"codeprobe": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"start": "node dist/cli.js",
|
|
14
|
+
"lint": "tsc --noEmit",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"test:watch": "vitest",
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"prepublishOnly": "npm run build && npm test"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"claude",
|
|
22
|
+
"anthropic",
|
|
23
|
+
"context-engineering",
|
|
24
|
+
"prompt-testing",
|
|
25
|
+
"claude-code",
|
|
26
|
+
"devtools",
|
|
27
|
+
"cli"
|
|
28
|
+
],
|
|
29
|
+
"author": "",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": ""
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"ajv": "^8.17.1",
|
|
45
|
+
"chalk": "^5.4.1",
|
|
46
|
+
"chokidar": "^4.0.3",
|
|
47
|
+
"commander": "^13.1.0",
|
|
48
|
+
"glob": "^11.0.1",
|
|
49
|
+
"js-yaml": "^4.1.0",
|
|
50
|
+
"ora": "^8.2.0",
|
|
51
|
+
"tiktoken": "^1.0.21",
|
|
52
|
+
"zod": "^3.24.2"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/js-yaml": "^4.0.9",
|
|
56
|
+
"@types/node": "^22.13.10",
|
|
57
|
+
"typescript": "^5.8.2",
|
|
58
|
+
"vitest": "^4.1.0"
|
|
59
|
+
}
|
|
60
|
+
}
|