@willh/copilotstatusline 0.2.0 → 0.2.2

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.
package/README.md CHANGED
@@ -53,7 +53,8 @@ copilotstatusline --install global Install a global binary command
53
53
  copilotstatusline --uninstall Remove an owned integration
54
54
  copilotstatusline --check Print integration status as JSON
55
55
  copilotstatusline --config <path> Use a custom formatter settings file
56
- copilotstatusline --version Print the package version
56
+ copilotstatusline -h Print help (alias: --help)
57
+ copilotstatusline -v Print the package version (alias: --version)
57
58
  ```
58
59
 
59
60
  When `--config` is combined with `--install`, the absolute config path is included in Copilot's command setting.
@@ -15820,6 +15820,14 @@ function styleText(value, foreground, background = "none", bold = false, colorLe
15820
15820
  return codes.length === 0 ? value : `\x1B[${codes.join(";")}m${value}\x1B[0m`;
15821
15821
  }
15822
15822
  function powerlineArrow(value, foreground, background, colorLevel) {
15823
+ if (colorLevel === 0 || value === "") {
15824
+ return value;
15825
+ }
15826
+ if (background === "none") {
15827
+ const foregroundCode = foregroundCodes[foreground];
15828
+ const codes = foregroundCode === null ? [49] : [foregroundCode, 49];
15829
+ return `\x1B[${codes.join(";")}m${value}\x1B[0m`;
15830
+ }
15823
15831
  return styleText(value, foreground, background, false, colorLevel);
15824
15832
  }
15825
15833
  var foregroundCodes, backgroundCodes;
@@ -54304,7 +54312,7 @@ var package_default;
54304
54312
  var init_package = __esm(() => {
54305
54313
  package_default = {
54306
54314
  name: "@willh/copilotstatusline",
54307
- version: "0.2.0",
54315
+ version: "0.2.2",
54308
54316
  bugs: {
54309
54317
  url: "https://github.com/doggy8088/copilotstatusline/issues"
54310
54318
  },
@@ -55296,6 +55304,17 @@ var init_StatusLinePreview = __esm(async () => {
55296
55304
  };
55297
55305
  });
55298
55306
 
55307
+ // src/tui/components/widget-editor-input.ts
55308
+ function getEditorGlobalKeyAction(key) {
55309
+ if (key.escape) {
55310
+ return "back";
55311
+ }
55312
+ if (key.ctrl || key.meta) {
55313
+ return "ignore";
55314
+ }
55315
+ return "continue";
55316
+ }
55317
+
55299
55318
  // src/tui/components/WidgetEditor.tsx
55300
55319
  import { randomUUID } from "node:crypto";
55301
55320
  function makeWidget(type) {
@@ -55479,7 +55498,12 @@ function WidgetEditor({
55479
55498
  }
55480
55499
  return;
55481
55500
  }
55482
- if (key.ctrl || key.meta) {
55501
+ const globalKeyAction = getEditorGlobalKeyAction(key);
55502
+ if (globalKeyAction === "back") {
55503
+ onBack();
55504
+ return;
55505
+ }
55506
+ if (globalKeyAction === "ignore") {
55483
55507
  return;
55484
55508
  }
55485
55509
  if ((key.upArrow || key.downArrow) && widgets.length > 0) {
@@ -55525,8 +55549,6 @@ function WidgetEditor({
55525
55549
  startEditing("prefix");
55526
55550
  } else if (input === "s") {
55527
55551
  startEditing("suffix");
55528
- } else if (key.escape) {
55529
- onBack();
55530
55552
  }
55531
55553
  });
55532
55554
  if (showClearConfirmation) {
@@ -56386,6 +56408,28 @@ var init_tui = __esm(async () => {
56386
56408
  import_react34 = __toESM(require_react(), 1);
56387
56409
  });
56388
56410
 
56411
+ // src/cli-options.ts
56412
+ var HELP_TEXT = `Usage: copilotstatusline [options]
56413
+
56414
+ Render a GitHub Copilot CLI status payload from stdin. When stdin is a TTY,
56415
+ open the interactive configuration UI instead.
56416
+
56417
+ Options:
56418
+ -h, --help Show this help message
56419
+ -v, --version Show the package version
56420
+ --config <path> Use a custom formatter settings file
56421
+ --check Print Copilot CLI integration status as JSON
56422
+ --install [mode] Install the integration using npm, bunx, or global
56423
+ --uninstall Remove an integration owned by this package`;
56424
+ function takeFlag(args, ...names) {
56425
+ const index = args.findIndex((argument) => names.includes(argument));
56426
+ if (index < 0) {
56427
+ return false;
56428
+ }
56429
+ args.splice(index, 1);
56430
+ return true;
56431
+ }
56432
+
56389
56433
  // src/types/copilot-status.ts
56390
56434
  init_zod();
56391
56435
  var numberValue = exports_external.preprocess((value) => {
@@ -56404,7 +56448,7 @@ var modelSchema = exports_external.union([
56404
56448
  ]);
56405
56449
  var CopilotStatusSchema = exports_external.looseObject({
56406
56450
  session_id: exports_external.string().optional(),
56407
- session_name: exports_external.string().optional(),
56451
+ session_name: exports_external.string().nullable().optional(),
56408
56452
  transcript_path: exports_external.string().optional(),
56409
56453
  cwd: exports_external.string().optional(),
56410
56454
  version: exports_external.string().optional(),
@@ -56456,7 +56500,7 @@ function normalizeCopilotStatus(status) {
56456
56500
  const totalTokens = reportedTotal > 0 ? reportedTotal : inputTokens + outputTokens + cacheReadTokens + cacheWriteTokens + reasoningTokens;
56457
56501
  return {
56458
56502
  sessionId: status.session_id,
56459
- sessionName: status.session_name,
56503
+ sessionName: status.session_name ?? undefined,
56460
56504
  transcriptPath: status.transcript_path,
56461
56505
  cwd: status.cwd ?? status.workspace?.current_dir ?? status.workspace?.project_dir,
56462
56506
  version: status.version,
@@ -56491,7 +56535,7 @@ function normalizeCopilotStatus(status) {
56491
56535
  init_app_settings();
56492
56536
  init_copilot_settings();
56493
56537
  init_renderer();
56494
- var PACKAGE_VERSION = "0.2.0";
56538
+ var PACKAGE_VERSION = "0.2.2";
56495
56539
  async function readStdin() {
56496
56540
  process.stdin.setEncoding("utf8");
56497
56541
  const chunks = [];
@@ -56512,14 +56556,6 @@ function takeOption(name) {
56512
56556
  process.argv.splice(index, 2);
56513
56557
  return value;
56514
56558
  }
56515
- function hasFlag2(name) {
56516
- const index = process.argv.indexOf(name);
56517
- if (index < 0) {
56518
- return false;
56519
- }
56520
- process.argv.splice(index, 1);
56521
- return true;
56522
- }
56523
56559
  async function renderPipedStatus() {
56524
56560
  const input = await readStdin();
56525
56561
  if (input.trim() === "") {
@@ -56541,7 +56577,7 @@ async function renderPipedStatus() {
56541
56577
  }
56542
56578
  }
56543
56579
  async function runCommandMode() {
56544
- if (hasFlag2("--check")) {
56580
+ if (takeFlag(process.argv, "--check")) {
56545
56581
  const status = await inspectCopilotIntegration();
56546
56582
  console.log(JSON.stringify(status, null, 2));
56547
56583
  return true;
@@ -56557,7 +56593,7 @@ async function runCommandMode() {
56557
56593
  console.log(`Installed copilotstatusline through ${candidate}.`);
56558
56594
  return true;
56559
56595
  }
56560
- if (hasFlag2("--uninstall")) {
56596
+ if (takeFlag(process.argv, "--uninstall")) {
56561
56597
  const removed = await uninstallCopilotStatusLine();
56562
56598
  console.log(removed ? "Removed copilotstatusline from Copilot CLI settings." : "Copilot CLI is not configured to use copilotstatusline.");
56563
56599
  return true;
@@ -56565,7 +56601,11 @@ async function runCommandMode() {
56565
56601
  return false;
56566
56602
  }
56567
56603
  async function main() {
56568
- if (hasFlag2("--version")) {
56604
+ if (takeFlag(process.argv, "-h", "--help")) {
56605
+ console.log(HELP_TEXT);
56606
+ return;
56607
+ }
56608
+ if (takeFlag(process.argv, "-v", "--version")) {
56569
56609
  console.log(PACKAGE_VERSION);
56570
56610
  return;
56571
56611
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willh/copilotstatusline",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "bugs": {
5
5
  "url": "https://github.com/doggy8088/copilotstatusline/issues"
6
6
  },