claude-scope 0.8.18 → 0.8.20

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.
@@ -1529,24 +1529,27 @@ var init_widget_registry = __esm({
1529
1529
  "src/core/widget-registry.ts"() {
1530
1530
  "use strict";
1531
1531
  WidgetRegistry = class {
1532
- widgets = /* @__PURE__ */ new Map();
1532
+ widgets = [];
1533
1533
  /**
1534
1534
  * Register a widget
1535
1535
  */
1536
1536
  async register(widget, context) {
1537
- if (this.widgets.has(widget.id)) {
1538
- throw new Error(`Widget with id '${widget.id}' already registered`);
1539
- }
1540
1537
  if (context) {
1541
1538
  await widget.initialize(context);
1542
1539
  }
1543
- this.widgets.set(widget.id, widget);
1540
+ this.widgets.push(widget);
1544
1541
  }
1545
1542
  /**
1546
1543
  * Unregister a widget
1544
+ * @param widgetOrId Widget instance or widget id
1547
1545
  */
1548
- async unregister(id) {
1549
- const widget = this.widgets.get(id);
1546
+ async unregister(widgetOrId) {
1547
+ let widget;
1548
+ if (typeof widgetOrId === "string") {
1549
+ widget = this.widgets.find((w) => w.id === widgetOrId);
1550
+ } else {
1551
+ widget = this.widgets.find((w) => w === widgetOrId);
1552
+ }
1550
1553
  if (!widget) {
1551
1554
  return;
1552
1555
  }
@@ -1555,26 +1558,29 @@ var init_widget_registry = __esm({
1555
1558
  await widget.cleanup();
1556
1559
  }
1557
1560
  } finally {
1558
- this.widgets.delete(id);
1561
+ const index = this.widgets.indexOf(widget);
1562
+ if (index !== -1) {
1563
+ this.widgets.splice(index, 1);
1564
+ }
1559
1565
  }
1560
1566
  }
1561
1567
  /**
1562
1568
  * Get a widget by id
1563
1569
  */
1564
1570
  get(id) {
1565
- return this.widgets.get(id);
1571
+ return this.widgets.find((w) => w.id === id);
1566
1572
  }
1567
1573
  /**
1568
1574
  * Check if widget is registered
1569
1575
  */
1570
1576
  has(id) {
1571
- return this.widgets.has(id);
1577
+ return this.widgets.some((w) => w.id === id);
1572
1578
  }
1573
1579
  /**
1574
1580
  * Get all registered widgets
1575
1581
  */
1576
1582
  getAll() {
1577
- return Array.from(this.widgets.values());
1583
+ return [...this.widgets];
1578
1584
  }
1579
1585
  /**
1580
1586
  * Get only enabled widgets
@@ -1586,12 +1592,12 @@ var init_widget_registry = __esm({
1586
1592
  * Clear all widgets
1587
1593
  */
1588
1594
  async clear() {
1589
- for (const widget of this.widgets.values()) {
1595
+ for (const widget of this.widgets) {
1590
1596
  if (widget.cleanup) {
1591
1597
  await widget.cleanup();
1592
1598
  }
1593
1599
  }
1594
- this.widgets.clear();
1600
+ this.widgets = [];
1595
1601
  }
1596
1602
  };
1597
1603
  }
@@ -8082,6 +8088,9 @@ async function ensureDefaultConfig() {
8082
8088
 
8083
8089
  // src/config/config-loader.ts
8084
8090
  function getConfigPath() {
8091
+ if (process.env.CLAUDE_SCOPE_CONFIG) {
8092
+ return process.env.CLAUDE_SCOPE_CONFIG;
8093
+ }
8085
8094
  return (0, import_node_path4.join)((0, import_node_os4.homedir)(), ".claude-scope", "config.json");
8086
8095
  }
8087
8096
  async function loadWidgetConfig() {
@@ -9079,18 +9088,12 @@ async function readStdin() {
9079
9088
  }
9080
9089
  return Buffer.concat(chunks).toString("utf8");
9081
9090
  }
9082
- function applyWidgetConfig(widget, widgetId, config) {
9083
- for (const [lineNum, widgets] of Object.entries(config.lines)) {
9084
- const widgetConfig = widgets.find((w) => w.id === widgetId);
9085
- if (widgetConfig) {
9086
- if (typeof widget.setStyle === "function" && isValidWidgetStyle(widgetConfig.style)) {
9087
- widget.setStyle(widgetConfig.style);
9088
- }
9089
- if (typeof widget.setLine === "function") {
9090
- widget.setLine(parseInt(lineNum, 10));
9091
- }
9092
- break;
9093
- }
9091
+ function applyWidgetConfig(widget, widgetConfig) {
9092
+ if (typeof widget.setStyle === "function" && isValidWidgetStyle(widgetConfig.style)) {
9093
+ widget.setStyle(widgetConfig.style);
9094
+ }
9095
+ if (typeof widget.setLine === "function" && typeof widgetConfig.line === "number") {
9096
+ widget.setLine(widgetConfig.line);
9094
9097
  }
9095
9098
  }
9096
9099
  async function main() {
@@ -9111,11 +9114,14 @@ async function main() {
9111
9114
  const widgetConfig = await loadWidgetConfig();
9112
9115
  const factory = new WidgetFactory();
9113
9116
  if (widgetConfig) {
9114
- for (const [_lineNum, widgets] of Object.entries(widgetConfig.lines)) {
9117
+ for (const [lineNum, widgets] of Object.entries(widgetConfig.lines)) {
9115
9118
  for (const widgetConfigItem of widgets) {
9116
9119
  const widget = factory.createWidget(widgetConfigItem.id);
9117
9120
  if (widget) {
9118
- applyWidgetConfig(widget, widgetConfigItem.id, widgetConfig);
9121
+ applyWidgetConfig(widget, {
9122
+ ...widgetConfigItem,
9123
+ line: parseInt(lineNum, 10)
9124
+ });
9119
9125
  await registry.register(widget);
9120
9126
  }
9121
9127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scope",
3
- "version": "0.8.18",
3
+ "version": "0.8.20",
4
4
  "description": "Claude Code plugin for session status and analytics",
5
5
  "license": "MIT",
6
6
  "type": "module",