claude-scope 0.8.6 → 0.8.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.
@@ -6693,7 +6693,7 @@ function selectWithPreviewImpl(config, done) {
6693
6693
  if (status === "done") {
6694
6694
  return [`${config.message} ${activeChoice.name}`, ""];
6695
6695
  }
6696
- const line = "\x1B[1;37m" + "\u2500".repeat(60) + "\x1B[0m";
6696
+ const line = `\x1B[1;37m${"\u2500".repeat(60)}\x1B[0m`;
6697
6697
  const previewBox = `${line}
6698
6698
  \x1B[1;37mLive Preview\x1B[0m
6699
6699
 
@@ -7315,18 +7315,78 @@ async function loadWidgetConfig() {
7315
7315
  }
7316
7316
  }
7317
7317
 
7318
- // src/config/widget-flags.ts
7319
- var WIDGET_FLAGS = {
7320
- activeTools: true,
7321
- cacheMetrics: true
7322
- };
7323
- function isWidgetEnabled(name) {
7324
- return WIDGET_FLAGS[name] ?? true;
7325
- }
7326
-
7327
7318
  // src/index.ts
7328
7319
  init_renderer();
7329
7320
  init_style_types();
7321
+
7322
+ // src/core/widget-factory.ts
7323
+ init_theme();
7324
+ init_active_tools();
7325
+ init_cache_metrics();
7326
+ init_config_count_widget();
7327
+ init_context_widget();
7328
+ init_cost_widget();
7329
+ init_duration_widget();
7330
+ init_git_tag_widget();
7331
+ init_git_widget();
7332
+ init_lines_widget();
7333
+ init_model_widget();
7334
+ var WidgetFactory = class {
7335
+ transcriptProvider;
7336
+ constructor() {
7337
+ this.transcriptProvider = new TranscriptProvider();
7338
+ }
7339
+ /**
7340
+ * Create a widget instance by ID
7341
+ * @param widgetId - Widget identifier (e.g., "model", "git", "context")
7342
+ * @returns Widget instance or null if widget ID is unknown
7343
+ */
7344
+ createWidget(widgetId) {
7345
+ switch (widgetId) {
7346
+ case "model":
7347
+ return new ModelWidget();
7348
+ case "context":
7349
+ return new ContextWidget();
7350
+ case "cost":
7351
+ return new CostWidget();
7352
+ case "lines":
7353
+ return new LinesWidget();
7354
+ case "duration":
7355
+ return new DurationWidget();
7356
+ case "git":
7357
+ return new GitWidget();
7358
+ case "git-tag":
7359
+ return new GitTagWidget();
7360
+ case "config-count":
7361
+ return new ConfigCountWidget();
7362
+ case "cache-metrics":
7363
+ return new CacheMetricsWidget(DEFAULT_THEME);
7364
+ case "active-tools":
7365
+ return new ActiveToolsWidget(DEFAULT_THEME, this.transcriptProvider);
7366
+ default:
7367
+ return null;
7368
+ }
7369
+ }
7370
+ /**
7371
+ * Get list of all supported widget IDs
7372
+ */
7373
+ getSupportedWidgetIds() {
7374
+ return [
7375
+ "model",
7376
+ "context",
7377
+ "cost",
7378
+ "lines",
7379
+ "duration",
7380
+ "git",
7381
+ "git-tag",
7382
+ "config-count",
7383
+ "cache-metrics",
7384
+ "active-tools"
7385
+ ];
7386
+ }
7387
+ };
7388
+
7389
+ // src/index.ts
7330
7390
  init_widget_registry();
7331
7391
 
7332
7392
  // src/validation/result.ts
@@ -7505,17 +7565,6 @@ var StdinProvider = class {
7505
7565
  };
7506
7566
 
7507
7567
  // src/index.ts
7508
- init_theme();
7509
- init_active_tools();
7510
- init_cache_metrics();
7511
- init_config_count_widget();
7512
- init_context_widget();
7513
- init_cost_widget();
7514
- init_duration_widget();
7515
- init_git_tag_widget();
7516
- init_git_widget();
7517
- init_lines_widget();
7518
- init_model_widget();
7519
7568
  async function readStdin() {
7520
7569
  const chunks = [];
7521
7570
  for await (const chunk of process.stdin) {
@@ -7537,12 +7586,6 @@ function applyWidgetConfig(widget, widgetId, config) {
7537
7586
  }
7538
7587
  }
7539
7588
  }
7540
- async function registerWidgetWithConfig(registry, widget, widgetId, config) {
7541
- if (config) {
7542
- applyWidgetConfig(widget, widgetId, config);
7543
- }
7544
- await registry.register(widget);
7545
- }
7546
7589
  async function main() {
7547
7590
  try {
7548
7591
  const command = parseCommand();
@@ -7558,31 +7601,26 @@ async function main() {
7558
7601
  const provider = new StdinProvider();
7559
7602
  const stdinData = await provider.parse(stdin);
7560
7603
  const registry = new WidgetRegistry();
7561
- const transcriptProvider = new TranscriptProvider();
7562
7604
  const widgetConfig = await loadWidgetConfig();
7563
- await registerWidgetWithConfig(registry, new ModelWidget(), "model", widgetConfig);
7564
- await registerWidgetWithConfig(registry, new ContextWidget(), "context", widgetConfig);
7565
- await registerWidgetWithConfig(registry, new CostWidget(), "cost", widgetConfig);
7566
- await registerWidgetWithConfig(registry, new LinesWidget(), "lines", widgetConfig);
7567
- await registerWidgetWithConfig(registry, new DurationWidget(), "duration", widgetConfig);
7568
- await registerWidgetWithConfig(registry, new GitWidget(), "git", widgetConfig);
7569
- await registerWidgetWithConfig(registry, new GitTagWidget(), "git-tag", widgetConfig);
7570
- await registerWidgetWithConfig(registry, new ConfigCountWidget(), "config-count", widgetConfig);
7571
- if (isWidgetEnabled("cacheMetrics")) {
7572
- await registerWidgetWithConfig(
7573
- registry,
7574
- new CacheMetricsWidget(DEFAULT_THEME),
7575
- "cache-metrics",
7576
- widgetConfig
7577
- );
7578
- }
7579
- if (isWidgetEnabled("activeTools")) {
7580
- await registerWidgetWithConfig(
7581
- registry,
7582
- new ActiveToolsWidget(DEFAULT_THEME, transcriptProvider),
7583
- "active-tools",
7584
- widgetConfig
7585
- );
7605
+ const factory = new WidgetFactory();
7606
+ if (widgetConfig) {
7607
+ for (const [_lineNum, widgets] of Object.entries(widgetConfig.lines)) {
7608
+ for (const widgetConfigItem of widgets) {
7609
+ const widget = factory.createWidget(widgetConfigItem.id);
7610
+ if (widget) {
7611
+ applyWidgetConfig(widget, widgetConfigItem.id, widgetConfig);
7612
+ await registry.register(widget);
7613
+ }
7614
+ }
7615
+ }
7616
+ } else {
7617
+ const defaultWidgets = ["model", "git", "context"];
7618
+ for (const widgetId of defaultWidgets) {
7619
+ const widget = factory.createWidget(widgetId);
7620
+ if (widget) {
7621
+ await registry.register(widget);
7622
+ }
7623
+ }
7586
7624
  }
7587
7625
  const renderer = new Renderer({
7588
7626
  separator: " \u2502 ",
@@ -7606,7 +7644,11 @@ async function main() {
7606
7644
  async function tryGitFallback() {
7607
7645
  try {
7608
7646
  const cwd = process.cwd();
7609
- const widget = new GitWidget();
7647
+ const factory = new WidgetFactory();
7648
+ const widget = factory.createWidget("git");
7649
+ if (!widget) {
7650
+ return "";
7651
+ }
7610
7652
  await widget.initialize({ config: {} });
7611
7653
  await widget.update({ cwd, session_id: "fallback" });
7612
7654
  const result = await widget.render({ width: 80, timestamp: Date.now() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scope",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Claude Code plugin for session status and analytics",
5
5
  "license": "MIT",
6
6
  "type": "module",