claude-scope 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,29 @@
1
1
  #!/usr/bin/env node
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var index_exports = {};
23
+ __export(index_exports, {
24
+ main: () => main
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
2
27
 
3
28
  // src/core/widget-registry.ts
4
29
  var WidgetRegistry = class {
@@ -178,9 +203,9 @@ function createWidgetMetadata(name, description, version = "1.0.0", author = "cl
178
203
  }
179
204
 
180
205
  // src/providers/git-provider.ts
181
- import { execFile } from "node:child_process";
182
- import { promisify } from "node:util";
183
- var execFileAsync = promisify(execFile);
206
+ var import_node_child_process = require("node:child_process");
207
+ var import_node_util = require("node:util");
208
+ var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
184
209
  var NativeGit = class {
185
210
  cwd;
186
211
  constructor(cwd) {
@@ -733,6 +758,7 @@ main().then((output) => {
733
758
  }).catch(() => {
734
759
  process.exit(0);
735
760
  });
736
- export {
761
+ // Annotate the CommonJS export names for ESM import in node:
762
+ 0 && (module.exports = {
737
763
  main
738
- };
764
+ });
package/package.json CHANGED
@@ -1,21 +1,15 @@
1
1
  {
2
2
  "name": "claude-scope",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "Claude Code plugin for session status and analytics",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "main": "dist/index.js",
8
- "exports": {
9
- ".": {
10
- "import": "dist/index.js",
11
- "types": "dist/index.d.ts"
12
- }
13
- },
7
+ "main": "dist/claude-scope.cjs",
14
8
  "bin": {
15
- "claude-scope": "dist/claude-scope.js"
9
+ "claude-scope": "dist/claude-scope.cjs"
16
10
  },
17
11
  "files": [
18
- "dist/claude-scope.js",
12
+ "dist/claude-scope.cjs",
19
13
  "README.md",
20
14
  "LICENSE.md"
21
15
  ],
@@ -23,7 +17,7 @@
23
17
  "prepack": "npm run build",
24
18
  "build": "npm run build:tsc && npm run build:bundle",
25
19
  "build:tsc": "tsc",
26
- "build:bundle": "esbuild src/index.ts --bundle --platform=node --target=node18 --format=esm --outfile=dist/claude-scope-bundle.js && chmod +x dist/claude-scope-bundle.js && sh -c 'mv dist/claude-scope-bundle.js dist/claude-scope.js'",
20
+ "build:bundle": "esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/claude-scope.cjs && chmod +x dist/claude-scope.cjs",
27
21
  "prebuild:bundle": "npm run build:tsc",
28
22
  "test": "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",
29
23
  "test:unit": "tsx --test 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",
package/dist/index.js DELETED
@@ -1,78 +0,0 @@
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/git-widget.js';
9
- import { ModelWidget } from './widgets/model-widget.js';
10
- import { ContextWidget } from './widgets/context-widget.js';
11
- import { CostWidget } from './widgets/cost-widget.js';
12
- import { DurationWidget } from './widgets/duration-widget.js';
13
- import { GitChangesWidget } from './widgets/git/git-changes-widget.js';
14
- import { StdinProvider } from './data/stdin-provider.js';
15
- /**
16
- * Read stdin as string
17
- */
18
- async function readStdin() {
19
- const chunks = [];
20
- for await (const chunk of process.stdin) {
21
- chunks.push(chunk);
22
- }
23
- return Buffer.concat(chunks).toString('utf8');
24
- }
25
- /**
26
- * Main entry point
27
- */
28
- export async function main() {
29
- try {
30
- // Read JSON from stdin
31
- const stdin = await readStdin();
32
- // If stdin is empty, return empty string
33
- if (!stdin || stdin.trim().length === 0) {
34
- return '';
35
- }
36
- // Parse and validate with StdinProvider
37
- const provider = new StdinProvider();
38
- const stdinData = await provider.parse(stdin);
39
- // Create registry
40
- const registry = new WidgetRegistry();
41
- // Register all widgets (no constructor args needed)
42
- await registry.register(new ModelWidget());
43
- await registry.register(new ContextWidget());
44
- await registry.register(new CostWidget());
45
- await registry.register(new DurationWidget());
46
- await registry.register(new GitWidget());
47
- await registry.register(new GitChangesWidget());
48
- // Create renderer with error handling configuration
49
- const renderer = new Renderer({
50
- separator: ' │ ',
51
- onError: (error, widget) => {
52
- // Silently ignore widget errors - they return null
53
- },
54
- showErrors: false
55
- });
56
- // Update all widgets with data
57
- for (const widget of registry.getAll()) {
58
- await widget.update(stdinData);
59
- }
60
- // Render
61
- const output = await renderer.render(registry.getEnabledWidgets(), { width: 80, timestamp: Date.now() });
62
- return output || '';
63
- }
64
- catch (error) {
65
- // Return empty string on any error
66
- return '';
67
- }
68
- }
69
- // Run when executed (works with both direct node and npx)
70
- main().then((output) => {
71
- if (output) {
72
- console.log(output);
73
- }
74
- }).catch(() => {
75
- // Silently fail - return empty status line
76
- process.exit(0);
77
- });
78
- //# sourceMappingURL=index.js.map