claude-scope 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.
Files changed (39) hide show
  1. package/LICENSE.md +22 -0
  2. package/README.md +83 -0
  3. package/dist/core/renderer.d.ts +21 -0
  4. package/dist/core/renderer.d.ts.map +1 -0
  5. package/dist/core/renderer.js +33 -0
  6. package/dist/core/renderer.js.map +1 -0
  7. package/dist/core/types.d.ts +56 -0
  8. package/dist/core/types.d.ts.map +1 -0
  9. package/dist/core/types.js +5 -0
  10. package/dist/core/types.js.map +1 -0
  11. package/dist/core/widget-registry.d.ts +40 -0
  12. package/dist/core/widget-registry.d.ts.map +1 -0
  13. package/dist/core/widget-registry.js +75 -0
  14. package/dist/core/widget-registry.js.map +1 -0
  15. package/dist/index.d.ts +10 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +37 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/providers/git-provider.d.ts +48 -0
  20. package/dist/providers/git-provider.d.ts.map +1 -0
  21. package/dist/providers/git-provider.js +50 -0
  22. package/dist/providers/git-provider.js.map +1 -0
  23. package/dist/providers/stdin-provider.d.ts +43 -0
  24. package/dist/providers/stdin-provider.d.ts.map +1 -0
  25. package/dist/providers/stdin-provider.js +114 -0
  26. package/dist/providers/stdin-provider.js.map +1 -0
  27. package/dist/types.d.ts +33 -0
  28. package/dist/types.d.ts.map +1 -0
  29. package/dist/types.js +5 -0
  30. package/dist/types.js.map +1 -0
  31. package/dist/utils/colors.d.ts +36 -0
  32. package/dist/utils/colors.d.ts.map +1 -0
  33. package/dist/utils/colors.js +36 -0
  34. package/dist/utils/colors.js.map +1 -0
  35. package/dist/widgets/git-widget.d.ts +29 -0
  36. package/dist/widgets/git-widget.d.ts.map +1 -0
  37. package/dist/widgets/git-widget.js +51 -0
  38. package/dist/widgets/git-widget.js.map +1 -0
  39. package/package.json +37 -0
package/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2026 Yurii Chukhlib
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # claude-scope
2
+
3
+ Claude Code plugin for session status and analytics.
4
+
5
+ **Requirements:**
6
+ - Node.js 18 or higher
7
+
8
+ ## Installation
9
+
10
+ ### Via npx (recommended)
11
+
12
+ No installation required:
13
+
14
+ ```bash
15
+ npx claude-scope@latest
16
+ ```
17
+
18
+ ### Via npm globally
19
+
20
+ ```bash
21
+ npm install -g claude-scope
22
+ ```
23
+
24
+ ### Via bun
25
+
26
+ ```bash
27
+ bunx claude-scope@latest
28
+ ```
29
+
30
+ ## Configuration
31
+
32
+ Add to your `~/.claude/settings.json`:
33
+
34
+ ```json
35
+ {
36
+ "statusLine": {
37
+ "type": "command",
38
+ "command": "npx -y claude-scope@latest",
39
+ "padding": 0
40
+ }
41
+ }
42
+ ```
43
+
44
+ Or for global install:
45
+
46
+ ```json
47
+ {
48
+ "statusLine": {
49
+ "type": "command",
50
+ "command": "claude-scope",
51
+ "padding": 0
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ Once configured, claude-scope displays the current git branch in your statusline.
59
+
60
+ **Note:** This is an early release with basic functionality. Additional features (repository status, session analytics, etc.) are planned for future releases.
61
+
62
+ ## Releasing
63
+
64
+ To create a new release:
65
+
66
+ 1. Update version in `package.json`
67
+ 2. Commit changes
68
+ 3. Create and push tag:
69
+
70
+ ```bash
71
+ git tag v0.1.0
72
+ git push origin main
73
+ git push origin v0.1.0
74
+ ```
75
+
76
+ The GitHub Actions workflow will:
77
+ - Run all tests
78
+ - Build the project
79
+ - Generate coverage report
80
+ - Commit `dist/` to repository
81
+ - Create GitHub Release with auto-generated notes
82
+
83
+ **Note:** If tests fail, the release will not be created.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Unified rendering engine
3
+ * Combines widget outputs into statusline
4
+ */
5
+ import type { IWidget } from './types.js';
6
+ import type { RenderContext } from '../types.js';
7
+ /**
8
+ * Renderer for combining widget outputs
9
+ */
10
+ export declare class Renderer {
11
+ private separator;
12
+ /**
13
+ * Render widgets into a single line
14
+ */
15
+ render(widgets: IWidget[], context: RenderContext): Promise<string>;
16
+ /**
17
+ * Set custom separator
18
+ */
19
+ setSeparator(separator: string): void;
20
+ }
21
+ //# sourceMappingURL=renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/core/renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,SAAS,CAAO;IAExB;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBzE;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAGtC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Unified rendering engine
3
+ * Combines widget outputs into statusline
4
+ */
5
+ /**
6
+ * Renderer for combining widget outputs
7
+ */
8
+ export class Renderer {
9
+ separator = ' ';
10
+ /**
11
+ * Render widgets into a single line
12
+ */
13
+ async render(widgets, context) {
14
+ const outputs = [];
15
+ for (const widget of widgets) {
16
+ if (!widget.isEnabled()) {
17
+ continue;
18
+ }
19
+ const output = await widget.render(context);
20
+ if (output !== null) {
21
+ outputs.push(output);
22
+ }
23
+ }
24
+ return outputs.join(this.separator);
25
+ }
26
+ /**
27
+ * Set custom separator
28
+ */
29
+ setSeparator(separator) {
30
+ this.separator = separator;
31
+ }
32
+ }
33
+ //# sourceMappingURL=renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../src/core/renderer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,MAAM,OAAO,QAAQ;IACX,SAAS,GAAG,GAAG,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAkB,EAAE,OAAsB;QACrD,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;gBACxB,SAAS;YACX,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,SAAiB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Core types for the widget system
3
+ */
4
+ import type { StdinData, RenderContext } from '../types.js';
5
+ /**
6
+ * Widget metadata describing the widget
7
+ */
8
+ export interface IWidgetMetadata {
9
+ name: string;
10
+ description: string;
11
+ version: string;
12
+ author: string;
13
+ }
14
+ /**
15
+ * Initialization context passed to widgets
16
+ */
17
+ export interface WidgetContext {
18
+ config: Record<string, unknown>;
19
+ }
20
+ /**
21
+ * Interface that all widgets must implement
22
+ */
23
+ export interface IWidget {
24
+ /** Unique widget identifier */
25
+ readonly id: string;
26
+ /** Widget metadata */
27
+ readonly metadata: IWidgetMetadata;
28
+ /**
29
+ * Initialize the widget with context
30
+ * Called once when widget is registered
31
+ */
32
+ initialize(context: WidgetContext): Promise<void>;
33
+ /**
34
+ * Render the widget output
35
+ * Called on each update cycle
36
+ * @returns String to render, or null if widget should not display
37
+ */
38
+ render(context: RenderContext): Promise<string | null>;
39
+ /**
40
+ * Update widget with new data
41
+ * Called when new stdin data arrives
42
+ */
43
+ update(data: StdinData): Promise<void>;
44
+ /**
45
+ * Check if widget is enabled
46
+ * Widget only renders if enabled
47
+ */
48
+ isEnabled(): boolean;
49
+ /**
50
+ * Cleanup resources
51
+ * Optional - called when widget is unregistered
52
+ */
53
+ cleanup?(): Promise<void>;
54
+ }
55
+ export type { StdinData, RenderContext };
56
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,sBAAsB;IACtB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEvD;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAID,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Core types for the widget system
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Central widget registry
3
+ * Manages widget lifecycle and retrieval
4
+ */
5
+ import type { IWidget, WidgetContext } from './types.js';
6
+ /**
7
+ * Registry for managing widgets
8
+ */
9
+ export declare class WidgetRegistry {
10
+ private widgets;
11
+ /**
12
+ * Register a widget
13
+ */
14
+ register(widget: IWidget, context?: WidgetContext): Promise<void>;
15
+ /**
16
+ * Unregister a widget
17
+ */
18
+ unregister(id: string): Promise<void>;
19
+ /**
20
+ * Get a widget by id
21
+ */
22
+ get(id: string): IWidget | undefined;
23
+ /**
24
+ * Check if widget is registered
25
+ */
26
+ has(id: string): boolean;
27
+ /**
28
+ * Get all registered widgets
29
+ */
30
+ getAll(): IWidget[];
31
+ /**
32
+ * Get only enabled widgets
33
+ */
34
+ getEnabledWidgets(): IWidget[];
35
+ /**
36
+ * Clear all widgets
37
+ */
38
+ clear(): Promise<void>;
39
+ }
40
+ //# sourceMappingURL=widget-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-registry.d.ts","sourceRoot":"","sources":["../../src/core/widget-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAmC;IAElD;;OAEG;IACG,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvE;;OAEG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3C;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAIpC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB;;OAEG;IACH,MAAM,IAAI,OAAO,EAAE;IAInB;;OAEG;IACH,iBAAiB,IAAI,OAAO,EAAE;IAI9B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ7B"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Central widget registry
3
+ * Manages widget lifecycle and retrieval
4
+ */
5
+ /**
6
+ * Registry for managing widgets
7
+ */
8
+ export class WidgetRegistry {
9
+ widgets = new Map();
10
+ /**
11
+ * Register a widget
12
+ */
13
+ async register(widget, context) {
14
+ if (this.widgets.has(widget.id)) {
15
+ throw new Error(`Widget with id '${widget.id}' already registered`);
16
+ }
17
+ if (context) {
18
+ await widget.initialize(context);
19
+ }
20
+ this.widgets.set(widget.id, widget);
21
+ }
22
+ /**
23
+ * Unregister a widget
24
+ */
25
+ async unregister(id) {
26
+ const widget = this.widgets.get(id);
27
+ if (!widget) {
28
+ return;
29
+ }
30
+ try {
31
+ if (widget.cleanup) {
32
+ await widget.cleanup();
33
+ }
34
+ }
35
+ finally {
36
+ this.widgets.delete(id);
37
+ }
38
+ }
39
+ /**
40
+ * Get a widget by id
41
+ */
42
+ get(id) {
43
+ return this.widgets.get(id);
44
+ }
45
+ /**
46
+ * Check if widget is registered
47
+ */
48
+ has(id) {
49
+ return this.widgets.has(id);
50
+ }
51
+ /**
52
+ * Get all registered widgets
53
+ */
54
+ getAll() {
55
+ return Array.from(this.widgets.values());
56
+ }
57
+ /**
58
+ * Get only enabled widgets
59
+ */
60
+ getEnabledWidgets() {
61
+ return this.getAll().filter(w => w.isEnabled());
62
+ }
63
+ /**
64
+ * Clear all widgets
65
+ */
66
+ async clear() {
67
+ for (const widget of this.widgets.values()) {
68
+ if (widget.cleanup) {
69
+ await widget.cleanup();
70
+ }
71
+ }
72
+ this.widgets.clear();
73
+ }
74
+ }
75
+ //# sourceMappingURL=widget-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-registry.js","sourceRoot":"","sources":["../../src/core/widget-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,GAAyB,IAAI,GAAG,EAAE,CAAC;IAElD;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,MAAe,EAAE,OAAuB;QACrD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,CAAC,EAAE,sBAAsB,CAAC,CAA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,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Claude Scope - Claude Code statusline plugin
4
+ * Entry point
5
+ */
6
+ /**
7
+ * Main entry point
8
+ */
9
+ export declare function main(): Promise<string>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAOH;;GAEG;AACH,wBAAsB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CA4B5C"}
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Claude Scope - Claude Code statusline plugin
4
+ * Entry point
5
+ */
6
+ import { WidgetRegistry } from './core/widget-registry.js';
7
+ import { Renderer } from './core/renderer.js';
8
+ import { GitWidget } from './widgets/git-widget.js';
9
+ import { simpleGit } from 'simple-git';
10
+ /**
11
+ * Main entry point
12
+ */
13
+ export async function main() {
14
+ // Initialize git
15
+ const git = simpleGit();
16
+ // Create registry
17
+ const registry = new WidgetRegistry();
18
+ // Create and register git widget
19
+ const gitWidget = new GitWidget({ git });
20
+ await registry.register(gitWidget);
21
+ // Create renderer
22
+ const renderer = new Renderer();
23
+ // Render output
24
+ const cwd = process.cwd();
25
+ await gitWidget.update({
26
+ session_id: 'dev-session',
27
+ cwd,
28
+ model: { id: 'dev', display_name: 'Development' }
29
+ });
30
+ const output = await renderer.render(registry.getEnabledWidgets(), { width: 80, timestamp: Date.now() });
31
+ return output;
32
+ }
33
+ // Run if executed directly
34
+ if (import.meta.url === `file://${process.argv[1]}`) {
35
+ main().then(console.log).catch(console.error);
36
+ }
37
+ //# sourceMappingURL=index.js.map
@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,CAAC;IACpD,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Git operations provider
3
+ * Wraps simple-git for dependency injection
4
+ */
5
+ import type { GitInfo } from '../types.js';
6
+ /**
7
+ * Git interface for dependency injection
8
+ */
9
+ export interface IGit {
10
+ checkIsRepo(): Promise<boolean>;
11
+ branch(): Promise<{
12
+ current: string | null;
13
+ all: string[];
14
+ }>;
15
+ }
16
+ /**
17
+ * Dependencies for GitProvider
18
+ */
19
+ export interface GitProviderDeps {
20
+ git: IGit;
21
+ }
22
+ /**
23
+ * Git provider for repository operations
24
+ */
25
+ export declare class GitProvider {
26
+ private git;
27
+ private repoPath;
28
+ private _isRepo;
29
+ constructor(deps: GitProviderDeps);
30
+ /**
31
+ * Initialize provider with repository path
32
+ */
33
+ init(path: string): Promise<void>;
34
+ /**
35
+ * Get current branch name
36
+ * @returns Branch name or null if not in repo
37
+ */
38
+ getBranch(): Promise<string | null>;
39
+ /**
40
+ * Check if current path is a git repository
41
+ */
42
+ isRepo(): boolean;
43
+ /**
44
+ * Get complete git info
45
+ */
46
+ getInfo(): Promise<GitInfo>;
47
+ }
48
+ //# sourceMappingURL=git-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-provider.d.ts","sourceRoot":"","sources":["../../src/providers/git-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC9D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,IAAI,CAAC;CACX;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,GAAG,CAAO;IAClB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAkB;gBAErB,IAAI,EAAE,eAAe;IAKjC;;OAEG;IACG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IASzC;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;CAMlC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Git operations provider
3
+ * Wraps simple-git for dependency injection
4
+ */
5
+ /**
6
+ * Git provider for repository operations
7
+ */
8
+ export class GitProvider {
9
+ git;
10
+ repoPath;
11
+ _isRepo = false;
12
+ constructor(deps) {
13
+ this.git = deps.git;
14
+ this.repoPath = '';
15
+ }
16
+ /**
17
+ * Initialize provider with repository path
18
+ */
19
+ async init(path) {
20
+ this.repoPath = path;
21
+ this._isRepo = await this.git.checkIsRepo();
22
+ }
23
+ /**
24
+ * Get current branch name
25
+ * @returns Branch name or null if not in repo
26
+ */
27
+ async getBranch() {
28
+ if (!this._isRepo) {
29
+ return null;
30
+ }
31
+ const result = await this.git.branch();
32
+ return result.current;
33
+ }
34
+ /**
35
+ * Check if current path is a git repository
36
+ */
37
+ isRepo() {
38
+ return this._isRepo;
39
+ }
40
+ /**
41
+ * Get complete git info
42
+ */
43
+ async getInfo() {
44
+ return {
45
+ branch: await this.getBranch(),
46
+ isRepo: this.isRepo()
47
+ };
48
+ }
49
+ }
50
+ //# sourceMappingURL=git-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-provider.js","sourceRoot":"","sources":["../../src/providers/git-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH;;GAEG;AACH,MAAM,OAAO,WAAW;IACd,GAAG,CAAO;IACV,QAAQ,CAAS;IACjB,OAAO,GAAY,KAAK,CAAC;IAEjC,YAAY,IAAqB;QAC/B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,IAAY;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,OAAO;YACL,MAAM,EAAE,MAAM,IAAI,CAAC,SAAS,EAAE;YAC9B,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;SACtB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Stdin provider for parsing JSON data from stdin
3
+ * Parses and validates Claude Code session data
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 JSON data
20
+ */
21
+ export declare class StdinProvider {
22
+ /**
23
+ * Parse JSON string from stdin
24
+ * @param input JSON string to parse
25
+ * @returns Parsed StdinData object
26
+ * @throws StdinParseError if JSON is malformed
27
+ * @throws StdinValidationError if data is invalid
28
+ */
29
+ parse(input: string): Promise<StdinData>;
30
+ /**
31
+ * Validate stdin data structure
32
+ * @param data Data to validate
33
+ * @returns true if valid, false otherwise
34
+ */
35
+ validate(data: unknown): data is StdinData;
36
+ /**
37
+ * Validate stdin data and return detailed error message
38
+ * @param data Data to validate
39
+ * @returns Error message if invalid, null if valid
40
+ */
41
+ private getValidationError;
42
+ }
43
+ //# sourceMappingURL=stdin-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdin-provider.d.ts","sourceRoot":"","sources":["../../src/providers/stdin-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;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;IAuB9C;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,SAAS;IAmC1C;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;CA+B3B"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Stdin provider for parsing JSON data from stdin
3
+ * Parses and validates Claude Code session data
4
+ */
5
+ /**
6
+ * Error thrown when stdin parsing fails
7
+ */
8
+ export class StdinParseError extends Error {
9
+ constructor(message) {
10
+ super(message);
11
+ this.name = 'StdinParseError';
12
+ }
13
+ }
14
+ /**
15
+ * Error thrown when stdin validation fails
16
+ */
17
+ export class StdinValidationError extends Error {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = 'StdinValidationError';
21
+ }
22
+ }
23
+ /**
24
+ * Stdin provider for parsing JSON data
25
+ */
26
+ export class StdinProvider {
27
+ /**
28
+ * Parse JSON string from stdin
29
+ * @param input JSON string to parse
30
+ * @returns Parsed StdinData object
31
+ * @throws StdinParseError if JSON is malformed
32
+ * @throws StdinValidationError if data is invalid
33
+ */
34
+ async parse(input) {
35
+ // Check for empty input
36
+ if (!input || input.trim().length === 0) {
37
+ throw new StdinParseError('stdin data is empty');
38
+ }
39
+ // Parse JSON
40
+ let data;
41
+ try {
42
+ data = JSON.parse(input);
43
+ }
44
+ catch {
45
+ throw new StdinParseError('Failed to parse stdin data: Invalid JSON');
46
+ }
47
+ // Validate data structure
48
+ if (!this.validate(data)) {
49
+ const error = this.getValidationError(data);
50
+ throw new StdinValidationError(`stdin data validation failed: ${error}`);
51
+ }
52
+ return data;
53
+ }
54
+ /**
55
+ * Validate stdin data structure
56
+ * @param data Data to validate
57
+ * @returns true if valid, false otherwise
58
+ */
59
+ validate(data) {
60
+ // Basic type check
61
+ if (typeof data !== 'object' || data === null) {
62
+ return false;
63
+ }
64
+ const obj = data;
65
+ // Check required top-level fields
66
+ if (typeof obj.session_id !== 'string') {
67
+ return false;
68
+ }
69
+ if (typeof obj.cwd !== 'string') {
70
+ return false;
71
+ }
72
+ // Check model object
73
+ if (typeof obj.model !== 'object' || obj.model === null) {
74
+ return false;
75
+ }
76
+ const model = obj.model;
77
+ if (typeof model.id !== 'string') {
78
+ return false;
79
+ }
80
+ if (typeof model.display_name !== 'string') {
81
+ return false;
82
+ }
83
+ return true;
84
+ }
85
+ /**
86
+ * Validate stdin data and return detailed error message
87
+ * @param data Data to validate
88
+ * @returns Error message if invalid, null if valid
89
+ */
90
+ getValidationError(data) {
91
+ if (typeof data !== 'object' || data === null) {
92
+ return 'stdin data must be an object';
93
+ }
94
+ const obj = data;
95
+ if (typeof obj.session_id !== 'string') {
96
+ return 'missing session_id';
97
+ }
98
+ if (typeof obj.cwd !== 'string') {
99
+ return 'missing cwd';
100
+ }
101
+ if (typeof obj.model !== 'object' || obj.model === null) {
102
+ return 'missing model';
103
+ }
104
+ const model = obj.model;
105
+ if (typeof model.id !== 'string') {
106
+ return 'missing model.id';
107
+ }
108
+ if (typeof model.display_name !== 'string') {
109
+ return 'missing model.display_name';
110
+ }
111
+ return null;
112
+ }
113
+ }
114
+ //# sourceMappingURL=stdin-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdin-provider.js","sourceRoot":"","sources":["../../src/providers/stdin-provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;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,CAAC;YACxC,MAAM,IAAI,eAAe,CAAC,qBAAqB,CAAC,CAAC;QACnD,CAAC;QAED,aAAa;QACb,IAAI,IAAa,CAAC;QAClB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,eAAe,CAAC,0CAA0C,CAAC,CAAC;QACxE,CAAC;QAED,0BAA0B;QAC1B,IAAI,CAAC,IA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G,IAA+B,CAAC;QAE5C,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,oBAAoB,CAAC;QAC9B,CAAC;QAED,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACxD,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,KAAgC,CAAC;QAEnD,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QAED,IAAI,OAAO,KAAK,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YAC3C,OAAO,4BAA4B,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Shared types used across the application
3
+ */
4
+ /**
5
+ * Model information from Claude Code
6
+ */
7
+ export interface ModelInfo {
8
+ id: string;
9
+ display_name: string;
10
+ }
11
+ /**
12
+ * Data received from Claude Code via stdin
13
+ */
14
+ export interface StdinData {
15
+ session_id: string;
16
+ cwd: string;
17
+ model: ModelInfo;
18
+ }
19
+ /**
20
+ * Git repository information
21
+ */
22
+ export interface GitInfo {
23
+ branch: string | null;
24
+ isRepo: boolean;
25
+ }
26
+ /**
27
+ * Rendering context passed to widgets
28
+ */
29
+ export interface RenderContext {
30
+ width: number;
31
+ timestamp: number;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared types used across the application
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,36 @@
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
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,36 @@
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
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Git status widget
3
+ * Displays current git branch
4
+ */
5
+ import type { IWidget, IWidgetMetadata, WidgetContext, RenderContext, StdinData } from '../core/types.js';
6
+ import type { GitProviderDeps } from '../providers/git-provider.js';
7
+ /**
8
+ * Git widget dependencies
9
+ */
10
+ export interface GitWidgetDeps {
11
+ git: GitProviderDeps['git'];
12
+ }
13
+ /**
14
+ * Widget displaying git branch information
15
+ */
16
+ export declare class GitWidget implements IWidget {
17
+ readonly id = "git";
18
+ readonly metadata: IWidgetMetadata;
19
+ private gitProvider;
20
+ private enabled;
21
+ private currentCwd;
22
+ constructor(deps: GitWidgetDeps);
23
+ initialize(context: WidgetContext): Promise<void>;
24
+ render(context: RenderContext): Promise<string | null>;
25
+ update(data: StdinData): Promise<void>;
26
+ isEnabled(): boolean;
27
+ cleanup(): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=git-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-widget.d.ts","sourceRoot":"","sources":["../../src/widgets/git-widget.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGpE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,SAAU,YAAW,OAAO;IACvC,QAAQ,CAAC,EAAE,SAAS;IAEpB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAKhC;IAEF,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,UAAU,CAAM;gBAEZ,IAAI,EAAE,aAAa;IAIzB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IActD,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5C,SAAS,IAAI,OAAO;IAId,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Git status widget
3
+ * Displays current git branch
4
+ */
5
+ import { GitProvider } from '../providers/git-provider.js';
6
+ /**
7
+ * Widget displaying git branch information
8
+ */
9
+ export class GitWidget {
10
+ id = 'git';
11
+ metadata = {
12
+ name: 'Git Widget',
13
+ description: 'Displays current git branch',
14
+ version: '1.0.0',
15
+ author: 'claude-scope'
16
+ };
17
+ gitProvider;
18
+ enabled = true;
19
+ currentCwd = '';
20
+ constructor(deps) {
21
+ this.gitProvider = new GitProvider({ git: deps.git });
22
+ }
23
+ async initialize(context) {
24
+ // Initialize with config if needed
25
+ this.enabled = context.config.enabled !== false;
26
+ }
27
+ async render(context) {
28
+ if (!this.enabled || !this.gitProvider.isRepo()) {
29
+ return null;
30
+ }
31
+ const branch = await this.gitProvider.getBranch();
32
+ if (!branch) {
33
+ return null;
34
+ }
35
+ // Simple format: branch-name
36
+ return ` ${branch}`;
37
+ }
38
+ async update(data) {
39
+ if (data.cwd !== this.currentCwd) {
40
+ this.currentCwd = data.cwd;
41
+ await this.gitProvider.init(data.cwd);
42
+ }
43
+ }
44
+ isEnabled() {
45
+ return this.enabled;
46
+ }
47
+ async cleanup() {
48
+ // No resources to clean up
49
+ }
50
+ }
51
+ //# sourceMappingURL=git-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-widget.js","sourceRoot":"","sources":["../../src/widgets/git-widget.ts"],"names":[],"mappings":"AAAA;;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ACH,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,2BAA2B;IAC7B,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "claude-scope",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code plugin for session status and analytics",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "bin": {
9
+ "claude-scope": "./dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist/",
13
+ "README.md",
14
+ "LICENSE.md"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "test": "tsx --test tests/**/*.test.ts",
19
+ "test:unit": "tsx --test tests/unit/**/*.test.ts",
20
+ "test:integration": "tsx --test tests/integration/**/*.test.ts",
21
+ "test:coverage": "c8 --reporter=text --reporter=html --exclude='tests/**' --exclude='**/*.test.ts' tsx --test tests/**/*.test.ts",
22
+ "dev": "tsx src/index.ts"
23
+ },
24
+ "dependencies": {
25
+ "simple-git": "^3.27.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.10.2",
29
+ "c8": "^10.1.3",
30
+ "chai": "^6.2.2",
31
+ "tsx": "^4.19.2",
32
+ "typescript": "^5.7.2"
33
+ },
34
+ "engines": {
35
+ "node": ">=18.0.0"
36
+ }
37
+ }