copilot-statusline 0.1.7 → 0.1.8

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.
@@ -52574,7 +52574,6 @@ import { execSync } from "child_process";
52574
52574
  import * as fs3 from "fs";
52575
52575
  import * as os4 from "os";
52576
52576
  import * as path2 from "path";
52577
- var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
52578
52577
  function getCopilotConfigDir() {
52579
52578
  return path2.join(os4.homedir(), ".copilot");
52580
52579
  }
@@ -52618,28 +52617,6 @@ function isInstalled() {
52618
52617
  function isKnownCommand(command) {
52619
52618
  return command.includes("copilot-statusline") || command.includes("statusline.sh") || command.includes("statusline.cmd");
52620
52619
  }
52621
- function findJsPath() {
52622
- const bunGlobal = path2.join(os4.homedir(), ".bun", "install", "global", "node_modules", "copilot-statusline", "dist", "copilot-statusline.js");
52623
- if (fs3.existsSync(bunGlobal)) {
52624
- return bunGlobal;
52625
- }
52626
- try {
52627
- const npmRoot = execSync("npm root -g", { encoding: "utf-8" }).trim();
52628
- const npmGlobal = path2.join(npmRoot, "copilot-statusline", "dist", "copilot-statusline.js");
52629
- if (fs3.existsSync(npmGlobal)) {
52630
- return npmGlobal;
52631
- }
52632
- } catch {}
52633
- const localDist = path2.resolve(__dirname, "..", "..", "dist", "copilot-statusline.js");
52634
- if (fs3.existsSync(localDist)) {
52635
- return localDist;
52636
- }
52637
- const bundledPath = path2.resolve(__dirname, "copilot-statusline.js");
52638
- if (fs3.existsSync(bundledPath)) {
52639
- return bundledPath;
52640
- }
52641
- return null;
52642
- }
52643
52620
  function findRuntime() {
52644
52621
  const isBunRuntime = typeof Bun !== "undefined" || process.env.BUN_INSTALL !== undefined || (process.argv[0] ?? "").includes("bun");
52645
52622
  if (isBunRuntime) {
@@ -52651,38 +52628,34 @@ function findRuntime() {
52651
52628
  } catch {}
52652
52629
  return "node";
52653
52630
  }
52654
- function generateUnixScript(jsPath) {
52631
+ function generateUnixScript() {
52655
52632
  const runtime = findRuntime();
52633
+ const runner = runtime === "bun" ? "bunx" : "npx";
52656
52634
  return `#!/bin/bash
52657
52635
  # copilot-statusline — auto-generated launcher
52636
+ # Uses ${runner} to always run the latest version.
52658
52637
  # Buffers stdin because Copilot CLI closes the pipe before slow runtimes start.
52659
- JS="${jsPath}"
52660
- RT="${runtime}"
52661
52638
  if [ -t 0 ]; then
52662
- exec "$RT" "$JS" "$@"
52639
+ exec ${runner} -y copilot-statusline@latest "$@"
52663
52640
  else
52664
52641
  INPUT=$(cat)
52665
- echo "$INPUT" | exec "$RT" "$JS" "$@"
52642
+ echo "$INPUT" | exec ${runner} -y copilot-statusline@latest "$@"
52666
52643
  fi
52667
52644
  `;
52668
52645
  }
52669
- function generateWindowsScript(jsPath) {
52646
+ function generateWindowsScript() {
52670
52647
  const runtime = findRuntime();
52648
+ const runner = runtime === "bun" ? "bunx" : "npx";
52671
52649
  return `@echo off\r
52672
- set "RT=${runtime}"\r
52673
- "%RT%" "${jsPath}" %*\r
52650
+ ${runner} -y copilot-statusline@latest %*\r
52674
52651
  `;
52675
52652
  }
52676
52653
  function installStatusLine() {
52677
- const jsPath = findJsPath();
52678
- if (!jsPath) {
52679
- throw new Error("Could not find copilot-statusline.js. Install globally first: bun install -g copilot-statusline");
52680
- }
52681
52654
  const scriptPath = getScriptPath();
52682
52655
  if (process.platform === "win32") {
52683
- fs3.writeFileSync(scriptPath, generateWindowsScript(jsPath));
52656
+ fs3.writeFileSync(scriptPath, generateWindowsScript());
52684
52657
  } else {
52685
- fs3.writeFileSync(scriptPath, generateUnixScript(jsPath));
52658
+ fs3.writeFileSync(scriptPath, generateUnixScript());
52686
52659
  fs3.chmodSync(scriptPath, 493);
52687
52660
  }
52688
52661
  const config2 = loadCopilotConfig() ?? {};
@@ -52940,7 +52913,7 @@ import { execSync as execSync3 } from "child_process";
52940
52913
  import * as fs5 from "fs";
52941
52914
  import * as path4 from "path";
52942
52915
  var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
52943
- var PACKAGE_VERSION = "0.1.7";
52916
+ var PACKAGE_VERSION = "0.1.8";
52944
52917
  function getPackageVersion() {
52945
52918
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
52946
52919
  return PACKAGE_VERSION;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-statusline",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "A customizable status line formatter for GitHub Copilot CLI — based on ccstatusline",
5
5
  "module": "src/copilot-statusline.ts",
6
6
  "type": "module",