claude-scope 0.1.5 → 0.1.7

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.
Files changed (54) hide show
  1. package/dist/data/stdin-provider.d.ts +1 -1
  2. package/dist/data/stdin-provider.d.ts.map +1 -1
  3. package/dist/data/stdin-provider.js +7 -18
  4. package/dist/data/stdin-provider.js.map +1 -1
  5. package/dist/index.js +0 -0
  6. package/dist/schemas/stdin-schema.d.ts +80 -119
  7. package/dist/schemas/stdin-schema.d.ts.map +1 -1
  8. package/dist/schemas/stdin-schema.js +35 -68
  9. package/dist/schemas/stdin-schema.js.map +1 -1
  10. package/dist/validation/combinators.d.ts +10 -0
  11. package/dist/validation/combinators.d.ts.map +1 -0
  12. package/dist/validation/combinators.js +49 -0
  13. package/dist/validation/combinators.js.map +1 -0
  14. package/dist/validation/core.d.ts +30 -0
  15. package/dist/validation/core.d.ts.map +1 -0
  16. package/dist/validation/core.js +2 -0
  17. package/dist/validation/core.js.map +1 -0
  18. package/dist/validation/index.d.ts +4 -0
  19. package/dist/validation/index.d.ts.map +1 -0
  20. package/dist/validation/index.js +4 -0
  21. package/dist/validation/index.js.map +1 -0
  22. package/dist/validation/result.d.ts +5 -0
  23. package/dist/validation/result.d.ts.map +1 -0
  24. package/dist/validation/result.js +11 -0
  25. package/dist/validation/result.js.map +1 -0
  26. package/dist/validation/validators.d.ts +7 -0
  27. package/dist/validation/validators.d.ts.map +1 -0
  28. package/dist/validation/validators.js +41 -0
  29. package/dist/validation/validators.js.map +1 -0
  30. package/package.json +2 -4
  31. package/dist/core/stdin-data-widget.d.ts +0 -85
  32. package/dist/core/stdin-data-widget.d.ts.map +0 -1
  33. package/dist/core/stdin-data-widget.js +0 -75
  34. package/dist/core/stdin-data-widget.js.map +0 -1
  35. package/dist/providers/stdin-provider.d.ts +0 -44
  36. package/dist/providers/stdin-provider.d.ts.map +0 -1
  37. package/dist/providers/stdin-provider.js +0 -83
  38. package/dist/providers/stdin-provider.js.map +0 -1
  39. package/dist/utils/colors.d.ts +0 -52
  40. package/dist/utils/colors.d.ts.map +0 -1
  41. package/dist/utils/colors.js +0 -54
  42. package/dist/utils/colors.js.map +0 -1
  43. package/dist/utils/formatters.d.ts +0 -56
  44. package/dist/utils/formatters.d.ts.map +0 -1
  45. package/dist/utils/formatters.js +0 -114
  46. package/dist/utils/formatters.js.map +0 -1
  47. package/dist/widgets/git-changes-widget.d.ts +0 -16
  48. package/dist/widgets/git-changes-widget.d.ts.map +0 -1
  49. package/dist/widgets/git-changes-widget.js +0 -37
  50. package/dist/widgets/git-changes-widget.js.map +0 -1
  51. package/dist/widgets/git-widget.d.ts +0 -35
  52. package/dist/widgets/git-widget.d.ts.map +0 -1
  53. package/dist/widgets/git-widget.js +0 -51
  54. package/dist/widgets/git-widget.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/validation/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,MAAM;IACpB,OAAO;QACL,QAAQ,CAAC,KAAK;YACZ,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;YACrD,OAAO,OAAO,CAAC,EAAE,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,OAAO;QACL,QAAQ,CAAC,KAAK;YACZ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;gBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7E,OAAO,OAAO,CAAC,EAAE,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAAsC,QAAW;IACtE,OAAO;QACL,QAAQ,CAAC,KAAK;YACZ,IAAI,KAAK,KAAK,QAAQ;gBAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;YACjD,OAAO,OAAO,CAAC,EAAE,EAAE,aAAa,QAAQ,GAAG,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,QAAQ,CAAC,KAAK;YACZ,IAAI,KAAK,KAAK,IAAI;gBAAE,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;YACzC,OAAO,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,EAAE,QAAQ,CAAC,KAAK,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scope",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Claude Code plugin for session status and analytics",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,9 +29,7 @@
29
29
  "test:snapshot:verify": "tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts",
30
30
  "dev": "tsx src/index.ts"
31
31
  },
32
- "dependencies": {
33
- "zod": "^4.3.5"
34
- },
32
+ "dependencies": {},
35
33
  "devDependencies": {
36
34
  "@types/node": "^22.10.2",
37
35
  "c8": "^10.1.3",
@@ -1,85 +0,0 @@
1
- /**
2
- * Base class for widgets that receive StdinData
3
- *
4
- * Eliminates duplicate data storage and update logic across widgets.
5
- * Extending widgets only need to implement render() method.
6
- */
7
- import type { IWidget, IWidgetMetadata, WidgetContext, RenderContext } from './types.js';
8
- import type { StdinData } from '../types.js';
9
- /**
10
- * Abstract base class for widgets working with StdinData
11
- *
12
- * Provides common functionality:
13
- * - StdinData storage and retrieval
14
- * - Enabled state management
15
- * - Consistent update pattern
16
- *
17
- * @example
18
- * ```typescript
19
- * export class ModelWidget extends StdinDataWidget {
20
- * readonly id = 'model';
21
- * readonly metadata = {
22
- * name: 'Model',
23
- * description: 'Displays Claude model',
24
- * version: '1.0.0',
25
- * author: 'claude-scope'
26
- * };
27
- *
28
- * async render(context: RenderContext): Promise<string | null> {
29
- * const data = this.getData();
30
- * return data.model.display_name;
31
- * }
32
- * }
33
- * ```
34
- */
35
- export declare abstract class StdinDataWidget implements IWidget {
36
- /**
37
- * Stored stdin data from last update
38
- */
39
- protected data: StdinData | null;
40
- /**
41
- * Widget enabled state
42
- */
43
- protected enabled: boolean;
44
- /**
45
- * Unique widget identifier
46
- */
47
- abstract readonly id: string;
48
- /**
49
- * Widget metadata
50
- */
51
- abstract readonly metadata: IWidgetMetadata;
52
- /**
53
- * Initialize widget with context
54
- * @param context - Widget initialization context
55
- */
56
- initialize(context: WidgetContext): Promise<void>;
57
- /**
58
- * Update widget with new stdin data
59
- * @param data - Stdin data from Claude Code
60
- */
61
- update(data: StdinData): Promise<void>;
62
- /**
63
- * Check if widget is enabled
64
- * @returns true if widget should render
65
- */
66
- isEnabled(): boolean;
67
- /**
68
- * Get stored stdin data
69
- * @returns StdinData
70
- * @throws Error if data not initialized (update() not called)
71
- */
72
- protected getData(): StdinData;
73
- /**
74
- * Render widget output
75
- * @param context - Render context
76
- * @returns Rendered string, or null if widget should not display
77
- */
78
- abstract render(context: RenderContext): Promise<string | null>;
79
- /**
80
- * Optional cleanup method
81
- * Override if widget has resources to clean up
82
- */
83
- cleanup?(): Promise<void>;
84
- }
85
- //# sourceMappingURL=stdin-data-widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stdin-data-widget.d.ts","sourceRoot":"","sources":["../../src/core/stdin-data-widget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,8BAAsB,eAAgB,YAAW,OAAO;IACtD;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAQ;IAExC;;OAEG;IACH,SAAS,CAAC,OAAO,UAAQ;IAEzB;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAE5C;;;OAGG;IACG,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C;;;OAGG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;OAIG;IACH,SAAS,CAAC,OAAO,IAAI,SAAS;IAS9B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAE/D;;;OAGG;IACG,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAChC"}
@@ -1,75 +0,0 @@
1
- /**
2
- * Base class for widgets that receive StdinData
3
- *
4
- * Eliminates duplicate data storage and update logic across widgets.
5
- * Extending widgets only need to implement render() method.
6
- */
7
- /**
8
- * Abstract base class for widgets working with StdinData
9
- *
10
- * Provides common functionality:
11
- * - StdinData storage and retrieval
12
- * - Enabled state management
13
- * - Consistent update pattern
14
- *
15
- * @example
16
- * ```typescript
17
- * export class ModelWidget extends StdinDataWidget {
18
- * readonly id = 'model';
19
- * readonly metadata = {
20
- * name: 'Model',
21
- * description: 'Displays Claude model',
22
- * version: '1.0.0',
23
- * author: 'claude-scope'
24
- * };
25
- *
26
- * async render(context: RenderContext): Promise<string | null> {
27
- * const data = this.getData();
28
- * return data.model.display_name;
29
- * }
30
- * }
31
- * ```
32
- */
33
- export class StdinDataWidget {
34
- /**
35
- * Stored stdin data from last update
36
- */
37
- data = null;
38
- /**
39
- * Widget enabled state
40
- */
41
- enabled = true;
42
- /**
43
- * Initialize widget with context
44
- * @param context - Widget initialization context
45
- */
46
- async initialize(context) {
47
- this.enabled = context.config?.enabled !== false;
48
- }
49
- /**
50
- * Update widget with new stdin data
51
- * @param data - Stdin data from Claude Code
52
- */
53
- async update(data) {
54
- this.data = data;
55
- }
56
- /**
57
- * Check if widget is enabled
58
- * @returns true if widget should render
59
- */
60
- isEnabled() {
61
- return this.enabled;
62
- }
63
- /**
64
- * Get stored stdin data
65
- * @returns StdinData
66
- * @throws Error if data not initialized (update() not called)
67
- */
68
- getData() {
69
- if (!this.data) {
70
- throw new Error(`Widget ${this.id} data not initialized. Call update() before render().`);
71
- }
72
- return this.data;
73
- }
74
- }
75
- //# sourceMappingURL=stdin-data-widget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stdin-data-widget.js","sourceRoot":"","sources":["../../src/core/stdin-data-widget.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAgB,eAAe;IACnC;;OAEG;IACO,IAAI,GAAqB,IAAI,CAAC;IAExC;;OAEG;IACO,OAAO,GAAG,IAAI,CAAC;IAYzB;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,OAAsB;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,KAAK,KAAK,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,IAAe;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACO,OAAO;QACf,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,EAAE,uDAAuD,CACzE,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CAcF"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Stdin provider for parsing JSON data from stdin
3
- * Parses and validates Claude Code session data using Zod
4
- */
5
- import type { StdinData } from '../types.js';
6
- /**
7
- * Error thrown when stdin parsing fails
8
- */
9
- export declare class StdinParseError extends Error {
10
- constructor(message: string);
11
- }
12
- /**
13
- * Error thrown when stdin validation fails
14
- */
15
- export declare class StdinValidationError extends Error {
16
- constructor(message: string);
17
- }
18
- /**
19
- * Stdin provider for parsing and validating JSON data
20
- */
21
- export declare class StdinProvider {
22
- /**
23
- * Parse and validate JSON string from stdin
24
- * @param input JSON string to parse
25
- * @returns Validated StdinData object
26
- * @throws StdinParseError if JSON is malformed
27
- * @throws StdinValidationError if data doesn't match schema
28
- */
29
- parse(input: string): Promise<StdinData>;
30
- /**
31
- * Safe parse that returns result instead of throwing
32
- * Useful for testing and optional validation
33
- * @param input JSON string to parse
34
- * @returns Result object with success flag
35
- */
36
- safeParse(input: string): Promise<{
37
- success: true;
38
- data: StdinData;
39
- } | {
40
- success: false;
41
- error: string;
42
- }>;
43
- }
44
- //# sourceMappingURL=stdin-provider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stdin-provider.d.ts","sourceRoot":"","sources":["../../src/providers/stdin-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAmC9C;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAQhH"}
@@ -1,83 +0,0 @@
1
- /**
2
- * Stdin provider for parsing JSON data from stdin
3
- * Parses and validates Claude Code session data using Zod
4
- */
5
- import { z } from 'zod';
6
- import { StdinDataSchema } from '../schemas/stdin-schema.js';
7
- /**
8
- * Error thrown when stdin parsing fails
9
- */
10
- export class StdinParseError extends Error {
11
- constructor(message) {
12
- super(message);
13
- this.name = 'StdinParseError';
14
- }
15
- }
16
- /**
17
- * Error thrown when stdin validation fails
18
- */
19
- export class StdinValidationError extends Error {
20
- constructor(message) {
21
- super(message);
22
- this.name = 'StdinValidationError';
23
- }
24
- }
25
- /**
26
- * Stdin provider for parsing and validating JSON data
27
- */
28
- export class StdinProvider {
29
- /**
30
- * Parse and validate JSON string from stdin
31
- * @param input JSON string to parse
32
- * @returns Validated StdinData object
33
- * @throws StdinParseError if JSON is malformed
34
- * @throws StdinValidationError if data doesn't match schema
35
- */
36
- async parse(input) {
37
- // Check for empty input
38
- if (!input || input.trim().length === 0) {
39
- throw new StdinParseError('stdin data is empty');
40
- }
41
- // Parse JSON
42
- let data;
43
- try {
44
- data = JSON.parse(input);
45
- }
46
- catch (error) {
47
- throw new StdinParseError(`Invalid JSON: ${error.message}`);
48
- }
49
- // Validate with Zod
50
- try {
51
- return StdinDataSchema.parse(data);
52
- }
53
- catch (error) {
54
- if (error instanceof z.ZodError) {
55
- // Format error messages nicely
56
- const errorDetails = error.issues
57
- .map((e) => {
58
- const path = e.path.length > 0 ? e.path.join('.') : 'root';
59
- return `${path}: ${e.message}`;
60
- })
61
- .join(', ');
62
- throw new StdinValidationError(`Validation failed: ${errorDetails}`);
63
- }
64
- throw error;
65
- }
66
- }
67
- /**
68
- * Safe parse that returns result instead of throwing
69
- * Useful for testing and optional validation
70
- * @param input JSON string to parse
71
- * @returns Result object with success flag
72
- */
73
- async safeParse(input) {
74
- try {
75
- const data = await this.parse(input);
76
- return { success: true, data };
77
- }
78
- catch (error) {
79
- return { success: false, error: error.message };
80
- }
81
- }
82
- }
83
- //# sourceMappingURL=stdin-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stdin-provider.js","sourceRoot":"","sources":["../../src/providers/stdin-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,KAAa;QACvB,wBAAwB;QACxB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CA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,CAAC;YACf,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC;QAC7D,CAAC;IACH,CAAC;CACF"}
@@ -1,52 +0,0 @@
1
- /**
2
- * ANSI color utilities for terminal output
3
- *
4
- * Provides ANSI escape codes for colors and text styling in terminal output.
5
- * These codes work in most modern terminal emulators.
6
- */
7
- /**
8
- * Reset all styles and colors
9
- */
10
- export declare const reset = "\u001B[0m";
11
- /**
12
- * Foreground colors (30-37, 90 for bright/bold variants)
13
- */
14
- export declare const red = "\u001B[31m";
15
- export declare const green = "\u001B[32m";
16
- export declare const yellow = "\u001B[33m";
17
- export declare const blue = "\u001B[34m";
18
- export declare const magenta = "\u001B[35m";
19
- export declare const cyan = "\u001B[36m";
20
- export declare const white = "\u001B[37m";
21
- export declare const gray = "\u001B[90m";
22
- /**
23
- * Background colors (40-47)
24
- */
25
- export declare const bgRed = "\u001B[41m";
26
- export declare const bgGreen = "\u001B[42m";
27
- export declare const bgYellow = "\u001B[43m";
28
- export declare const bgBlue = "\u001B[44m";
29
- /**
30
- * Text styles
31
- */
32
- export declare const bold = "\u001B[1m";
33
- export declare const dim = "\u001B[2m";
34
- export declare const italic = "\u001B[3m";
35
- export declare const underline = "\u001B[4m";
36
- /**
37
- * Context usage colors
38
- * Used for context progress bar based on usage percentage
39
- */
40
- export declare const contextColors: {
41
- readonly low: "\u001B[32m";
42
- readonly medium: "\u001B[33m";
43
- readonly high: "\u001B[31m";
44
- };
45
- /**
46
- * Wrap text in ANSI color
47
- * @param text - Text to colorize
48
- * @param color - ANSI color code
49
- * @returns Colorized text with reset code
50
- */
51
- export declare function colorize(text: string, color: string): string;
52
- //# sourceMappingURL=colors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,KAAK,cAAY,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,GAAG,eAAa,CAAC;AAC9B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,MAAM,eAAa,CAAC;AACjC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,IAAI,eAAa,CAAC;AAC/B,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,IAAI,eAAa,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,KAAK,eAAa,CAAC;AAChC,eAAO,MAAM,OAAO,eAAa,CAAC;AAClC,eAAO,MAAM,QAAQ,eAAa,CAAC;AACnC,eAAO,MAAM,MAAM,eAAa,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,IAAI,cAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,cAAY,CAAC;AAC7B,eAAO,MAAM,MAAM,cAAY,CAAC;AAChC,eAAO,MAAM,SAAS,cAAY,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -1,54 +0,0 @@
1
- /**
2
- * ANSI color utilities for terminal output
3
- *
4
- * Provides ANSI escape codes for colors and text styling in terminal output.
5
- * These codes work in most modern terminal emulators.
6
- */
7
- /**
8
- * Reset all styles and colors
9
- */
10
- export const reset = '\x1b[0m';
11
- /**
12
- * Foreground colors (30-37, 90 for bright/bold variants)
13
- */
14
- export const red = '\x1b[31m';
15
- export const green = '\x1b[32m';
16
- export const yellow = '\x1b[33m';
17
- export const blue = '\x1b[34m';
18
- export const magenta = '\x1b[35m';
19
- export const cyan = '\x1b[36m';
20
- export const white = '\x1b[37m';
21
- export const gray = '\x1b[90m';
22
- /**
23
- * Background colors (40-47)
24
- */
25
- export const bgRed = '\x1b[41m';
26
- export const bgGreen = '\x1b[42m';
27
- export const bgYellow = '\x1b[43m';
28
- export const bgBlue = '\x1b[44m';
29
- /**
30
- * Text styles
31
- */
32
- export const bold = '\x1b[1m';
33
- export const dim = '\x1b[2m';
34
- export const italic = '\x1b[3m';
35
- export const underline = '\x1b[4m';
36
- /**
37
- * Context usage colors
38
- * Used for context progress bar based on usage percentage
39
- */
40
- export const contextColors = {
41
- low: green, // <50% usage
42
- medium: yellow, // 50-79% usage
43
- high: red // >=80% usage
44
- };
45
- /**
46
- * Wrap text in ANSI color
47
- * @param text - Text to colorize
48
- * @param color - ANSI color code
49
- * @returns Colorized text with reset code
50
- */
51
- export function colorize(text, color) {
52
- return `${color}${text}${reset}`;
53
- }
54
- //# sourceMappingURL=colors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC;AAC9B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAC;AAChC,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC;AAC9B,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,GAAG,EAAE,KAAK,EAAM,aAAa;IAC7B,MAAM,EAAE,MAAM,EAAE,eAAe;IAC/B,IAAI,EAAE,GAAG,CAAO,cAAc;CACtB,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAa;IAClD,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC;AACnC,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * Formatter utilities for displaying data in human-readable formats
3
- */
4
- /**
5
- * Format milliseconds to human-readable duration
6
- *
7
- * Examples:
8
- * - 45000 -> "45s"
9
- * - 60000 -> "1m 0s"
10
- * - 3600000 -> "1h 0m 0s"
11
- * - 3665000 -> "1h 1m 5s"
12
- *
13
- * @param ms - Duration in milliseconds
14
- * @returns Human-readable duration string
15
- */
16
- export declare function formatDuration(ms: number): string;
17
- /**
18
- * Format cost in USD with appropriate precision
19
- *
20
- * - Values < $0.01 (positive): 4 decimal places ($0.0012)
21
- * - Values >= $0.01: 2 decimal places ($1.23)
22
- * - Values >= $100: 0 decimal places ($123)
23
- * - Negative values: 2 decimal places ($-1.23)
24
- *
25
- * @param usd - Cost in USD
26
- * @returns Formatted cost string with $ prefix
27
- */
28
- export declare function formatCostUSD(usd: number): string;
29
- /**
30
- * Create a visual progress bar
31
- *
32
- * @param percent - Percentage (0-100)
33
- * @param width - Bar width in characters (default: DEFAULTS.PROGRESS_BAR_WIDTH)
34
- * @returns Progress bar string like "████████░░░░░░░░░░░░"
35
- */
36
- export declare function progressBar(percent: number, width?: number): string;
37
- /**
38
- * Get color code for context percentage
39
- *
40
- * - <50%: green (low usage)
41
- * - 50-79%: yellow (medium usage)
42
- * - >=80%: red (high usage)
43
- *
44
- * @param percent - Context usage percentage (0-100)
45
- * @returns ANSI color code
46
- */
47
- export declare function getContextColor(percent: number): string;
48
- /**
49
- * Colorize text with ANSI color code
50
- *
51
- * @param text - Text to colorize
52
- * @param color - ANSI color code
53
- * @returns Colorized text with reset code
54
- */
55
- export declare function colorize(text: string, color: string): string;
56
- //# sourceMappingURL=formatters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAsBjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBjD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAoC,GAAG,MAAM,CAKhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUvD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -1,114 +0,0 @@
1
- /**
2
- * Formatter utilities for displaying data in human-readable formats
3
- */
4
- import { TIME, COST_THRESHOLDS, CONTEXT_THRESHOLDS, ANSI_COLORS, DEFAULTS } from '../constants.js';
5
- /**
6
- * Format milliseconds to human-readable duration
7
- *
8
- * Examples:
9
- * - 45000 -> "45s"
10
- * - 60000 -> "1m 0s"
11
- * - 3600000 -> "1h 0m 0s"
12
- * - 3665000 -> "1h 1m 5s"
13
- *
14
- * @param ms - Duration in milliseconds
15
- * @returns Human-readable duration string
16
- */
17
- export function formatDuration(ms) {
18
- if (ms <= 0)
19
- return '0s';
20
- const seconds = Math.floor(ms / TIME.MS_PER_SECOND);
21
- const hours = Math.floor(seconds / TIME.SECONDS_PER_HOUR);
22
- const minutes = Math.floor((seconds % TIME.SECONDS_PER_HOUR) / TIME.SECONDS_PER_MINUTE);
23
- const secs = seconds % TIME.SECONDS_PER_MINUTE;
24
- const parts = [];
25
- if (hours > 0) {
26
- parts.push(`${hours}h`);
27
- parts.push(`${minutes}m`);
28
- parts.push(`${secs}s`);
29
- }
30
- else if (minutes > 0) {
31
- parts.push(`${minutes}m`);
32
- parts.push(`${secs}s`);
33
- }
34
- else {
35
- parts.push(`${secs}s`);
36
- }
37
- return parts.join(' ');
38
- }
39
- /**
40
- * Format cost in USD with appropriate precision
41
- *
42
- * - Values < $0.01 (positive): 4 decimal places ($0.0012)
43
- * - Values >= $0.01: 2 decimal places ($1.23)
44
- * - Values >= $100: 0 decimal places ($123)
45
- * - Negative values: 2 decimal places ($-1.23)
46
- *
47
- * @param usd - Cost in USD
48
- * @returns Formatted cost string with $ prefix
49
- */
50
- export function formatCostUSD(usd) {
51
- const absUsd = Math.abs(usd);
52
- if (usd < 0) {
53
- // Negative values: 2 decimal places
54
- return `$${usd.toFixed(2)}`;
55
- }
56
- else if (absUsd < COST_THRESHOLDS.SMALL) {
57
- // 4 decimal places for very small positive values
58
- return `$${usd.toFixed(4)}`;
59
- }
60
- else if (absUsd < COST_THRESHOLDS.LARGE) {
61
- // 2 decimal places for normal values
62
- return `$${usd.toFixed(2)}`;
63
- }
64
- else {
65
- // 0 decimal places for large values
66
- return `$${Math.floor(usd).toFixed(0)}`;
67
- }
68
- }
69
- /**
70
- * Create a visual progress bar
71
- *
72
- * @param percent - Percentage (0-100)
73
- * @param width - Bar width in characters (default: DEFAULTS.PROGRESS_BAR_WIDTH)
74
- * @returns Progress bar string like "████████░░░░░░░░░░░░"
75
- */
76
- export function progressBar(percent, width = DEFAULTS.PROGRESS_BAR_WIDTH) {
77
- const clampedPercent = Math.max(0, Math.min(100, percent));
78
- const filled = Math.round((clampedPercent / 100) * width);
79
- const empty = width - filled;
80
- return '█'.repeat(filled) + '░'.repeat(empty);
81
- }
82
- /**
83
- * Get color code for context percentage
84
- *
85
- * - <50%: green (low usage)
86
- * - 50-79%: yellow (medium usage)
87
- * - >=80%: red (high usage)
88
- *
89
- * @param percent - Context usage percentage (0-100)
90
- * @returns ANSI color code
91
- */
92
- export function getContextColor(percent) {
93
- const clampedPercent = Math.max(0, Math.min(100, percent));
94
- if (clampedPercent < CONTEXT_THRESHOLDS.LOW_MEDIUM) {
95
- return ANSI_COLORS.GREEN;
96
- }
97
- else if (clampedPercent < CONTEXT_THRESHOLDS.MEDIUM_HIGH) {
98
- return ANSI_COLORS.YELLOW;
99
- }
100
- else {
101
- return ANSI_COLORS.RED;
102
- }
103
- }
104
- /**
105
- * Colorize text with ANSI color code
106
- *
107
- * @param text - Text to colorize
108
- * @param color - ANSI color code
109
- * @returns Colorized text with reset code
110
- */
111
- export function colorize(text, color) {
112
- return `${color}${text}${ANSI_COLORS.RESET}`;
113
- }
114
- //# sourceMappingURL=formatters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/utils/formatters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEnG;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC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,CAAC,IAAY,EAAE,KAAa;IAClD,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;AAC/C,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Git Changes Widget
3
- *
4
- * Displays git diff statistics
5
- */
6
- import { StdinDataWidget } from '../core/stdin-data-widget.js';
7
- import type { IGit } from '../providers/git-provider.js';
8
- import type { RenderContext } from '../core/types.js';
9
- export declare class GitChangesWidget extends StdinDataWidget {
10
- private gitProvider;
11
- readonly id = "git-changes";
12
- readonly metadata: import("../core/types.js").IWidgetMetadata;
13
- constructor(gitProvider: IGit);
14
- render(context: RenderContext): Promise<string | null>;
15
- }
16
- //# sourceMappingURL=git-changes-widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-changes-widget.d.ts","sourceRoot":"","sources":["../../src/widgets/git-changes-widget.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,qBAAa,gBAAiB,SAAQ,eAAe;IAOvC,OAAO,CAAC,WAAW;IAN/B,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,QAAQ,CAAC,QAAQ,6CAGf;gBAEkB,WAAW,EAAE,IAAI;IAI/B,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAoB7D"}