copilot-statusline 0.1.0 → 0.1.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/dist/copilot-statusline.js +132 -192
- package/package.json +2 -2
|
@@ -52570,19 +52570,20 @@ async function saveSettings(settings) {
|
|
|
52570
52570
|
}
|
|
52571
52571
|
|
|
52572
52572
|
// src/utils/copilot-settings.ts
|
|
52573
|
+
import { execSync } from "child_process";
|
|
52573
52574
|
import * as fs3 from "fs";
|
|
52574
52575
|
import * as os4 from "os";
|
|
52575
52576
|
import * as path2 from "path";
|
|
52576
|
-
var
|
|
52577
|
-
NPM: "npx -y copilot-statusline@latest",
|
|
52578
|
-
BUNX: "bunx -y copilot-statusline@latest"
|
|
52579
|
-
};
|
|
52577
|
+
var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
|
|
52580
52578
|
function getCopilotConfigDir() {
|
|
52581
52579
|
return path2.join(os4.homedir(), ".copilot");
|
|
52582
52580
|
}
|
|
52583
52581
|
function getCopilotConfigPath() {
|
|
52584
52582
|
return path2.join(getCopilotConfigDir(), "config.json");
|
|
52585
52583
|
}
|
|
52584
|
+
function getScriptPath() {
|
|
52585
|
+
return path2.join(getCopilotConfigDir(), process.platform === "win32" ? "statusline.cmd" : "statusline.sh");
|
|
52586
|
+
}
|
|
52586
52587
|
function loadCopilotConfig() {
|
|
52587
52588
|
try {
|
|
52588
52589
|
const configPath = getCopilotConfigPath();
|
|
@@ -52615,18 +52616,90 @@ function isInstalled() {
|
|
|
52615
52616
|
return command !== null && isKnownCommand(command);
|
|
52616
52617
|
}
|
|
52617
52618
|
function isKnownCommand(command) {
|
|
52618
|
-
return command.includes("copilot-statusline");
|
|
52619
|
+
return command.includes("copilot-statusline") || command.includes("statusline.sh") || command.includes("statusline.cmd");
|
|
52620
|
+
}
|
|
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
|
+
function findRuntime() {
|
|
52644
|
+
const isBunRuntime = typeof Bun !== "undefined" || process.env.BUN_INSTALL !== undefined || (process.argv[0] ?? "").includes("bun");
|
|
52645
|
+
if (isBunRuntime) {
|
|
52646
|
+
return "bun";
|
|
52647
|
+
}
|
|
52648
|
+
try {
|
|
52649
|
+
execSync("bun --version", { stdio: "ignore" });
|
|
52650
|
+
return "bun";
|
|
52651
|
+
} catch {}
|
|
52652
|
+
return "node";
|
|
52653
|
+
}
|
|
52654
|
+
function generateUnixScript(jsPath) {
|
|
52655
|
+
const runtime = findRuntime();
|
|
52656
|
+
return `#!/bin/bash
|
|
52657
|
+
# copilot-statusline — auto-generated launcher
|
|
52658
|
+
# Buffers stdin because Copilot CLI closes the pipe before slow runtimes start.
|
|
52659
|
+
JS="${jsPath}"
|
|
52660
|
+
RT="${runtime}"
|
|
52661
|
+
if [ -t 0 ]; then
|
|
52662
|
+
exec "$RT" "$JS" "$@"
|
|
52663
|
+
else
|
|
52664
|
+
INPUT=$(cat)
|
|
52665
|
+
echo "$INPUT" | exec "$RT" "$JS" "$@"
|
|
52666
|
+
fi
|
|
52667
|
+
`;
|
|
52668
|
+
}
|
|
52669
|
+
function generateWindowsScript(jsPath) {
|
|
52670
|
+
const runtime = findRuntime();
|
|
52671
|
+
return `@echo off\r
|
|
52672
|
+
set "RT=${runtime}"\r
|
|
52673
|
+
"%RT%" "${jsPath}" %*\r
|
|
52674
|
+
`;
|
|
52619
52675
|
}
|
|
52620
|
-
function installStatusLine(
|
|
52676
|
+
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
|
+
const scriptPath = getScriptPath();
|
|
52682
|
+
if (process.platform === "win32") {
|
|
52683
|
+
fs3.writeFileSync(scriptPath, generateWindowsScript(jsPath));
|
|
52684
|
+
} else {
|
|
52685
|
+
fs3.writeFileSync(scriptPath, generateUnixScript(jsPath));
|
|
52686
|
+
fs3.chmodSync(scriptPath, 493);
|
|
52687
|
+
}
|
|
52621
52688
|
const config2 = loadCopilotConfig() ?? {};
|
|
52622
52689
|
config2.statusLine = {
|
|
52623
52690
|
type: "command",
|
|
52624
|
-
command,
|
|
52691
|
+
command: scriptPath,
|
|
52625
52692
|
padding: 0
|
|
52626
52693
|
};
|
|
52627
52694
|
saveCopilotConfig(config2);
|
|
52628
52695
|
}
|
|
52629
52696
|
function uninstallStatusLine() {
|
|
52697
|
+
const scriptPath = getScriptPath();
|
|
52698
|
+
try {
|
|
52699
|
+
if (fs3.existsSync(scriptPath)) {
|
|
52700
|
+
fs3.unlinkSync(scriptPath);
|
|
52701
|
+
}
|
|
52702
|
+
} catch {}
|
|
52630
52703
|
const config2 = loadCopilotConfig();
|
|
52631
52704
|
if (!config2) {
|
|
52632
52705
|
return;
|
|
@@ -52634,18 +52707,9 @@ function uninstallStatusLine() {
|
|
|
52634
52707
|
delete config2.statusLine;
|
|
52635
52708
|
saveCopilotConfig(config2);
|
|
52636
52709
|
}
|
|
52637
|
-
function isBunxAvailable() {
|
|
52638
|
-
try {
|
|
52639
|
-
const { execSync } = __require("child_process");
|
|
52640
|
-
execSync("bun --version", { stdio: "ignore" });
|
|
52641
|
-
return true;
|
|
52642
|
-
} catch {
|
|
52643
|
-
return false;
|
|
52644
|
-
}
|
|
52645
|
-
}
|
|
52646
52710
|
|
|
52647
52711
|
// src/utils/powerline.ts
|
|
52648
|
-
import { execSync } from "child_process";
|
|
52712
|
+
import { execSync as execSync2 } from "child_process";
|
|
52649
52713
|
import * as fs4 from "fs";
|
|
52650
52714
|
import * as os5 from "os";
|
|
52651
52715
|
import * as path3 from "path";
|
|
@@ -52779,7 +52843,7 @@ async function installPowerlineFonts() {
|
|
|
52779
52843
|
if (fs4.existsSync(tempDir)) {
|
|
52780
52844
|
fs4.rmSync(tempDir, { recursive: true, force: true });
|
|
52781
52845
|
}
|
|
52782
|
-
|
|
52846
|
+
execSync2(`git clone --depth=1 https://github.com/powerline/fonts.git "${tempDir}"`, {
|
|
52783
52847
|
stdio: "pipe",
|
|
52784
52848
|
encoding: "utf8"
|
|
52785
52849
|
});
|
|
@@ -52787,14 +52851,14 @@ async function installPowerlineFonts() {
|
|
|
52787
52851
|
const installScript = path3.join(tempDir, "install.sh");
|
|
52788
52852
|
if (fs4.existsSync(installScript)) {
|
|
52789
52853
|
fs4.chmodSync(installScript, 493);
|
|
52790
|
-
|
|
52854
|
+
execSync2(`cd "${tempDir}" && ./install.sh`, {
|
|
52791
52855
|
stdio: "pipe",
|
|
52792
52856
|
encoding: "utf8",
|
|
52793
52857
|
shell: "/bin/bash"
|
|
52794
52858
|
});
|
|
52795
52859
|
if (platform3 === "linux") {
|
|
52796
52860
|
try {
|
|
52797
|
-
|
|
52861
|
+
execSync2("fc-cache -f -v", {
|
|
52798
52862
|
stdio: "pipe",
|
|
52799
52863
|
encoding: "utf8"
|
|
52800
52864
|
});
|
|
@@ -52872,11 +52936,11 @@ async function installPowerlineFonts() {
|
|
|
52872
52936
|
}
|
|
52873
52937
|
|
|
52874
52938
|
// src/utils/terminal.ts
|
|
52875
|
-
import { execSync as
|
|
52939
|
+
import { execSync as execSync3 } from "child_process";
|
|
52876
52940
|
import * as fs5 from "fs";
|
|
52877
52941
|
import * as path4 from "path";
|
|
52878
52942
|
var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
|
|
52879
|
-
var PACKAGE_VERSION = "0.1.
|
|
52943
|
+
var PACKAGE_VERSION = "0.1.2";
|
|
52880
52944
|
function getPackageVersion() {
|
|
52881
52945
|
if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
|
|
52882
52946
|
return PACKAGE_VERSION;
|
|
@@ -52916,7 +52980,7 @@ function probeTerminalWidth() {
|
|
|
52916
52980
|
}
|
|
52917
52981
|
}
|
|
52918
52982
|
try {
|
|
52919
|
-
const width =
|
|
52983
|
+
const width = execSync3("tput cols 2>/dev/null", {
|
|
52920
52984
|
encoding: "utf8",
|
|
52921
52985
|
stdio: ["pipe", "pipe", "ignore"]
|
|
52922
52986
|
}).trim();
|
|
@@ -52933,7 +52997,7 @@ function parsePositiveInteger(value) {
|
|
|
52933
52997
|
}
|
|
52934
52998
|
function getParentProcessId(pid) {
|
|
52935
52999
|
try {
|
|
52936
|
-
const parentPidOutput =
|
|
53000
|
+
const parentPidOutput = execSync3(`ps -o ppid= -p ${pid}`, {
|
|
52937
53001
|
encoding: "utf8",
|
|
52938
53002
|
stdio: ["pipe", "pipe", "ignore"],
|
|
52939
53003
|
shell: "/bin/sh"
|
|
@@ -52945,7 +53009,7 @@ function getParentProcessId(pid) {
|
|
|
52945
53009
|
}
|
|
52946
53010
|
function getTTYForProcess(pid) {
|
|
52947
53011
|
try {
|
|
52948
|
-
const tty2 =
|
|
53012
|
+
const tty2 = execSync3(`ps -o tty= -p ${pid}`, {
|
|
52949
53013
|
encoding: "utf8",
|
|
52950
53014
|
stdio: ["pipe", "pipe", "ignore"],
|
|
52951
53015
|
shell: "/bin/sh"
|
|
@@ -52960,7 +53024,7 @@ function getTTYForProcess(pid) {
|
|
|
52960
53024
|
}
|
|
52961
53025
|
function getWidthForTTY(tty2) {
|
|
52962
53026
|
try {
|
|
52963
|
-
const width =
|
|
53027
|
+
const width = execSync3(`stty size < /dev/${tty2} | awk '{print $2}'`, {
|
|
52964
53028
|
encoding: "utf8",
|
|
52965
53029
|
stdio: ["pipe", "pipe", "ignore"],
|
|
52966
53030
|
shell: "/bin/sh"
|
|
@@ -54826,7 +54890,7 @@ class CacheWriteTokensWidget {
|
|
|
54826
54890
|
}
|
|
54827
54891
|
}
|
|
54828
54892
|
// src/utils/git.ts
|
|
54829
|
-
import { execSync as
|
|
54893
|
+
import { execSync as execSync4 } from "child_process";
|
|
54830
54894
|
var gitCommandCache = new Map;
|
|
54831
54895
|
function resolveGitCwd(context) {
|
|
54832
54896
|
const candidates = [
|
|
@@ -54847,7 +54911,7 @@ function runGit(command, context) {
|
|
|
54847
54911
|
return gitCommandCache.get(cacheKey) ?? null;
|
|
54848
54912
|
}
|
|
54849
54913
|
try {
|
|
54850
|
-
const output =
|
|
54914
|
+
const output = execSync4(`git ${command}`, {
|
|
54851
54915
|
encoding: "utf8",
|
|
54852
54916
|
stdio: ["pipe", "pipe", "ignore"],
|
|
54853
54917
|
...cwd2 ? { cwd: cwd2 } : {}
|
|
@@ -56835,7 +56899,7 @@ class TerminalWidthWidget {
|
|
|
56835
56899
|
}
|
|
56836
56900
|
}
|
|
56837
56901
|
// src/widgets/FreeMemory.ts
|
|
56838
|
-
import { execSync as
|
|
56902
|
+
import { execSync as execSync5 } from "child_process";
|
|
56839
56903
|
import os8 from "os";
|
|
56840
56904
|
function formatBytes(bytes) {
|
|
56841
56905
|
const GB = 1024 ** 3;
|
|
@@ -56851,7 +56915,7 @@ function formatBytes(bytes) {
|
|
|
56851
56915
|
}
|
|
56852
56916
|
function getUsedMemoryMacOS() {
|
|
56853
56917
|
try {
|
|
56854
|
-
const output =
|
|
56918
|
+
const output = execSync5("vm_stat", { encoding: "utf8" });
|
|
56855
56919
|
const lines = output.split(`
|
|
56856
56920
|
`);
|
|
56857
56921
|
const firstLine = lines[0];
|
|
@@ -57164,7 +57228,7 @@ var CustomSymbolEditor = ({ widget, onComplete, onCancel }) => {
|
|
|
57164
57228
|
}, undefined, true, undefined, this);
|
|
57165
57229
|
};
|
|
57166
57230
|
// src/widgets/CustomCommand.tsx
|
|
57167
|
-
import { execSync as
|
|
57231
|
+
import { execSync as execSync6 } from "child_process";
|
|
57168
57232
|
var import_react32 = __toESM(require_react(), 1);
|
|
57169
57233
|
|
|
57170
57234
|
// src/utils/ansi.ts
|
|
@@ -57552,7 +57616,7 @@ class CustomCommandWidget {
|
|
|
57552
57616
|
try {
|
|
57553
57617
|
const timeout = item.timeout ?? 1000;
|
|
57554
57618
|
const jsonInput = JSON.stringify(context.data);
|
|
57555
|
-
let output =
|
|
57619
|
+
let output = execSync6(item.commandPath, {
|
|
57556
57620
|
encoding: "utf8",
|
|
57557
57621
|
input: jsonInput,
|
|
57558
57622
|
timeout,
|
|
@@ -59465,105 +59529,6 @@ var GlobalOverridesMenu = ({ settings, onUpdate, onBack }) => {
|
|
|
59465
59529
|
};
|
|
59466
59530
|
// src/tui/components/InstallMenu.tsx
|
|
59467
59531
|
var jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
|
|
59468
|
-
var InstallMenu = ({
|
|
59469
|
-
bunxAvailable,
|
|
59470
|
-
existingStatusLine,
|
|
59471
|
-
onSelectNpx,
|
|
59472
|
-
onSelectBunx,
|
|
59473
|
-
onCancel,
|
|
59474
|
-
initialSelection = 0
|
|
59475
|
-
}) => {
|
|
59476
|
-
use_input_default((_, key) => {
|
|
59477
|
-
if (key.escape) {
|
|
59478
|
-
onCancel();
|
|
59479
|
-
}
|
|
59480
|
-
});
|
|
59481
|
-
function onSelect(value) {
|
|
59482
|
-
switch (value) {
|
|
59483
|
-
case "npx":
|
|
59484
|
-
onSelectNpx();
|
|
59485
|
-
break;
|
|
59486
|
-
case "bunx":
|
|
59487
|
-
if (bunxAvailable) {
|
|
59488
|
-
onSelectBunx();
|
|
59489
|
-
}
|
|
59490
|
-
break;
|
|
59491
|
-
case "back":
|
|
59492
|
-
onCancel();
|
|
59493
|
-
break;
|
|
59494
|
-
}
|
|
59495
|
-
}
|
|
59496
|
-
const listItems = [
|
|
59497
|
-
{
|
|
59498
|
-
label: "npx - Node Package Execute",
|
|
59499
|
-
value: "npx"
|
|
59500
|
-
},
|
|
59501
|
-
{
|
|
59502
|
-
label: "bunx - Bun Package Execute",
|
|
59503
|
-
sublabel: bunxAvailable ? undefined : "(not installed)",
|
|
59504
|
-
value: "bunx",
|
|
59505
|
-
disabled: !bunxAvailable
|
|
59506
|
-
}
|
|
59507
|
-
];
|
|
59508
|
-
return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
59509
|
-
flexDirection: "column",
|
|
59510
|
-
children: [
|
|
59511
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
59512
|
-
bold: true,
|
|
59513
|
-
children: "Install copilot-statusline to Copilot CLI"
|
|
59514
|
-
}, undefined, false, undefined, this),
|
|
59515
|
-
existingStatusLine && /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
59516
|
-
marginBottom: 1,
|
|
59517
|
-
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
59518
|
-
color: "yellow",
|
|
59519
|
-
children: [
|
|
59520
|
-
'⚠ Current status line: "',
|
|
59521
|
-
existingStatusLine,
|
|
59522
|
-
'"'
|
|
59523
|
-
]
|
|
59524
|
-
}, undefined, true, undefined, this)
|
|
59525
|
-
}, undefined, false, undefined, this),
|
|
59526
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
59527
|
-
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
59528
|
-
dimColor: true,
|
|
59529
|
-
children: "Select package manager to use:"
|
|
59530
|
-
}, undefined, false, undefined, this)
|
|
59531
|
-
}, undefined, false, undefined, this),
|
|
59532
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(List, {
|
|
59533
|
-
color: "blue",
|
|
59534
|
-
marginTop: 1,
|
|
59535
|
-
items: listItems,
|
|
59536
|
-
onSelect: (line) => {
|
|
59537
|
-
if (line === "back") {
|
|
59538
|
-
onCancel();
|
|
59539
|
-
return;
|
|
59540
|
-
}
|
|
59541
|
-
onSelect(line);
|
|
59542
|
-
},
|
|
59543
|
-
initialSelection,
|
|
59544
|
-
showBackButton: true
|
|
59545
|
-
}, undefined, false, undefined, this),
|
|
59546
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
59547
|
-
marginTop: 2,
|
|
59548
|
-
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
59549
|
-
dimColor: true,
|
|
59550
|
-
children: [
|
|
59551
|
-
"The selected command will be written to",
|
|
59552
|
-
" ",
|
|
59553
|
-
getCopilotConfigPath()
|
|
59554
|
-
]
|
|
59555
|
-
}, undefined, true, undefined, this)
|
|
59556
|
-
}, undefined, false, undefined, this),
|
|
59557
|
-
/* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Box_default, {
|
|
59558
|
-
marginTop: 1,
|
|
59559
|
-
children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(Text, {
|
|
59560
|
-
dimColor: true,
|
|
59561
|
-
children: "Press Enter to select, ESC to cancel"
|
|
59562
|
-
}, undefined, false, undefined, this)
|
|
59563
|
-
}, undefined, false, undefined, this)
|
|
59564
|
-
]
|
|
59565
|
-
}, undefined, true, undefined, this);
|
|
59566
|
-
};
|
|
59567
59532
|
// src/tui/components/ItemsEditor.tsx
|
|
59568
59533
|
var import_react37 = __toESM(require_react(), 1);
|
|
59569
59534
|
|
|
@@ -62915,14 +62880,6 @@ var jsx_dev_runtime20 = __toESM(require_jsx_dev_runtime(), 1);
|
|
|
62915
62880
|
function getConfirmCancelScreen(confirmDialog) {
|
|
62916
62881
|
return confirmDialog?.cancelScreen ?? "main";
|
|
62917
62882
|
}
|
|
62918
|
-
function clearInstallMenuSelection(menuSelections) {
|
|
62919
|
-
if (menuSelections.install === undefined) {
|
|
62920
|
-
return menuSelections;
|
|
62921
|
-
}
|
|
62922
|
-
const next = { ...menuSelections };
|
|
62923
|
-
delete next.install;
|
|
62924
|
-
return next;
|
|
62925
|
-
}
|
|
62926
62883
|
var App2 = () => {
|
|
62927
62884
|
const { exit } = use_app_default();
|
|
62928
62885
|
const [settings, setSettings] = import_react45.useState(null);
|
|
@@ -62993,29 +62950,26 @@ var App2 = () => {
|
|
|
62993
62950
|
})();
|
|
62994
62951
|
}
|
|
62995
62952
|
});
|
|
62996
|
-
const
|
|
62953
|
+
const handleInstall = import_react45.useCallback(() => {
|
|
62997
62954
|
const existing = getExistingStatusLine();
|
|
62998
|
-
const
|
|
62999
|
-
|
|
63000
|
-
|
|
63001
|
-
|
|
63002
|
-
|
|
63003
|
-
A
|
|
63004
|
-
Replace it with ${command}?`;
|
|
63005
|
-
} else if (isAlreadyInstalled) {
|
|
63006
|
-
message = `copilot-statusline is already installed in ${getCopilotConfigPath()}
|
|
63007
|
-
Update it with ${command}?`;
|
|
63008
|
-
} else {
|
|
63009
|
-
message = `This will modify ${getCopilotConfigPath()} to add copilot-statusline with ${displayName}.
|
|
63010
|
-
Continue?`;
|
|
63011
|
-
}
|
|
62955
|
+
const message = existing ? `A status line is already configured: "${existing}"
|
|
62956
|
+
|
|
62957
|
+
Replace with copilot-statusline?
|
|
62958
|
+
A launcher script will be created at ~/.copilot/statusline.sh` : `Install copilot-statusline to ${getCopilotConfigPath()}?
|
|
62959
|
+
|
|
62960
|
+
A launcher script will be created at ~/.copilot/statusline.sh`;
|
|
63012
62961
|
setConfirmDialog({
|
|
63013
62962
|
message,
|
|
63014
|
-
cancelScreen: "install",
|
|
63015
62963
|
action: async () => {
|
|
63016
|
-
|
|
63017
|
-
|
|
63018
|
-
|
|
62964
|
+
try {
|
|
62965
|
+
installStatusLine();
|
|
62966
|
+
setIsCopilotInstalled(true);
|
|
62967
|
+
setExistingStatusLine(getExistingStatusLine());
|
|
62968
|
+
setFlashMessage({ text: "✓ Installed to Copilot CLI", color: "green" });
|
|
62969
|
+
} catch (e) {
|
|
62970
|
+
const errorMsg = e instanceof Error ? e.message : String(e);
|
|
62971
|
+
setFlashMessage({ text: `✗ ${errorMsg}`, color: "red" });
|
|
62972
|
+
}
|
|
63019
62973
|
setScreen("main");
|
|
63020
62974
|
setConfirmDialog(null);
|
|
63021
62975
|
return Promise.resolve();
|
|
@@ -63023,18 +62977,6 @@ Continue?`;
|
|
|
63023
62977
|
});
|
|
63024
62978
|
setScreen("confirm");
|
|
63025
62979
|
}, []);
|
|
63026
|
-
const handleNpxInstall = import_react45.useCallback(() => {
|
|
63027
|
-
setMenuSelections((prev) => ({ ...prev, install: 0 }));
|
|
63028
|
-
handleInstallSelection(COPILOT_STATUSLINE_COMMANDS.NPM, "npx");
|
|
63029
|
-
}, [handleInstallSelection]);
|
|
63030
|
-
const handleBunxInstall = import_react45.useCallback(() => {
|
|
63031
|
-
setMenuSelections((prev) => ({ ...prev, install: 1 }));
|
|
63032
|
-
handleInstallSelection(COPILOT_STATUSLINE_COMMANDS.BUNX, "bunx");
|
|
63033
|
-
}, [handleInstallSelection]);
|
|
63034
|
-
const handleInstallMenuCancel = import_react45.useCallback(() => {
|
|
63035
|
-
setMenuSelections(clearInstallMenuSelection);
|
|
63036
|
-
setScreen("main");
|
|
63037
|
-
}, []);
|
|
63038
62980
|
if (!settings) {
|
|
63039
62981
|
return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(Text, {
|
|
63040
62982
|
children: "Loading settings..."
|
|
@@ -63055,7 +62997,7 @@ Continue?`;
|
|
|
63055
62997
|
});
|
|
63056
62998
|
setScreen("confirm");
|
|
63057
62999
|
} else {
|
|
63058
|
-
|
|
63000
|
+
handleInstall();
|
|
63059
63001
|
}
|
|
63060
63002
|
};
|
|
63061
63003
|
const handleMainMenuSelect = async (value) => {
|
|
@@ -63251,14 +63193,6 @@ Continue?`;
|
|
|
63251
63193
|
setConfirmDialog(null);
|
|
63252
63194
|
}
|
|
63253
63195
|
}, undefined, false, undefined, this),
|
|
63254
|
-
screen === "install" && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(InstallMenu, {
|
|
63255
|
-
bunxAvailable: isBunxAvailable(),
|
|
63256
|
-
existingStatusLine,
|
|
63257
|
-
onSelectNpx: handleNpxInstall,
|
|
63258
|
-
onSelectBunx: handleBunxInstall,
|
|
63259
|
-
onCancel: handleInstallMenuCancel,
|
|
63260
|
-
initialSelection: menuSelections.install
|
|
63261
|
-
}, undefined, false, undefined, this),
|
|
63262
63196
|
screen === "powerline" && /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(PowerlineSetup, {
|
|
63263
63197
|
settings,
|
|
63264
63198
|
powerlineFontStatus,
|
|
@@ -63343,22 +63277,28 @@ async function readStdin() {
|
|
|
63343
63277
|
if (process.stdin.isTTY) {
|
|
63344
63278
|
return null;
|
|
63345
63279
|
}
|
|
63346
|
-
const chunks = [];
|
|
63347
63280
|
try {
|
|
63348
|
-
|
|
63349
|
-
|
|
63350
|
-
|
|
63351
|
-
|
|
63352
|
-
|
|
63353
|
-
|
|
63354
|
-
|
|
63355
|
-
|
|
63356
|
-
|
|
63281
|
+
const fs6 = await import("fs");
|
|
63282
|
+
const data = fs6.readFileSync(0, "utf-8");
|
|
63283
|
+
return data.length > 0 ? data : null;
|
|
63284
|
+
} catch {
|
|
63285
|
+
const chunks = [];
|
|
63286
|
+
try {
|
|
63287
|
+
if (typeof Bun !== "undefined") {
|
|
63288
|
+
const decoder = new TextDecoder;
|
|
63289
|
+
for await (const chunk2 of Bun.stdin.stream()) {
|
|
63290
|
+
chunks.push(decoder.decode(chunk2));
|
|
63291
|
+
}
|
|
63292
|
+
} else {
|
|
63293
|
+
process.stdin.setEncoding("utf8");
|
|
63294
|
+
for await (const chunk2 of process.stdin) {
|
|
63295
|
+
chunks.push(chunk2);
|
|
63296
|
+
}
|
|
63357
63297
|
}
|
|
63298
|
+
return chunks.join("") || null;
|
|
63299
|
+
} catch {
|
|
63300
|
+
return null;
|
|
63358
63301
|
}
|
|
63359
|
-
return chunks.join("");
|
|
63360
|
-
} catch {
|
|
63361
|
-
return null;
|
|
63362
63302
|
}
|
|
63363
63303
|
}
|
|
63364
63304
|
async function ensureWindowsUtf8CodePage() {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copilot-statusline",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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",
|
|
7
7
|
"bin": {
|
|
8
|
-
"copilot-statusline": "dist/
|
|
8
|
+
"copilot-statusline": "dist/copilot-statusline.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/"
|