@kibitzsh/kibitz 0.0.4 → 0.0.5
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 +7 -8
- package/dist/cli/index.js +2676 -341
- package/dist/core/commentary.js +929 -602
- package/dist/core/platform-support.js +127 -155
- package/dist/core/session-dispatch.js +391 -379
- package/dist/core/watcher.js +852 -829
- package/package.json +5 -3
|
@@ -1,174 +1,146 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/core/platform-support.ts
|
|
31
|
+
var platform_support_exports = {};
|
|
32
|
+
__export(platform_support_exports, {
|
|
33
|
+
findCommandPath: () => findCommandPath,
|
|
34
|
+
getProviderCliCommand: () => getProviderCliCommand,
|
|
35
|
+
inheritShellPath: () => inheritShellPath,
|
|
36
|
+
resolveCmdNodeScript: () => resolveCmdNodeScript
|
|
17
37
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.getProviderCliCommand = getProviderCliCommand;
|
|
37
|
-
exports.resolveCmdNodeScript = resolveCmdNodeScript;
|
|
38
|
-
exports.inheritShellPath = inheritShellPath;
|
|
39
|
-
exports.findCommandPath = findCommandPath;
|
|
40
|
-
const child_process_1 = require("child_process");
|
|
41
|
-
const fs = __importStar(require("fs"));
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
/**
|
|
44
|
-
* Keep CLI discovery consistent across panel and terminal flows.
|
|
45
|
-
*/
|
|
38
|
+
module.exports = __toCommonJS(platform_support_exports);
|
|
39
|
+
var import_child_process = require("child_process");
|
|
40
|
+
var fs = __toESM(require("fs"));
|
|
41
|
+
var path = __toESM(require("path"));
|
|
46
42
|
function getProviderCliCommand(provider, platform = process.platform) {
|
|
47
|
-
|
|
43
|
+
return platform === "win32" ? `${provider}.cmd` : provider;
|
|
48
44
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Resolve npm .cmd wrappers to their underlying JavaScript file.
|
|
51
|
-
* This avoids cmd.exe arg limits on Windows for long prompts.
|
|
52
|
-
*/
|
|
53
45
|
function resolveCmdNodeScript(cmdPath) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
catch {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
46
|
+
if (!String(cmdPath || "").toLowerCase().endsWith(".cmd")) return null;
|
|
47
|
+
try {
|
|
48
|
+
const content = fs.readFileSync(cmdPath, "utf8");
|
|
49
|
+
const match = content.match(/%dp0%\\(.+?\.js)/i);
|
|
50
|
+
if (!match) return null;
|
|
51
|
+
const scriptPath = path.join(path.dirname(cmdPath), match[1]);
|
|
52
|
+
return fs.existsSync(scriptPath) ? scriptPath : null;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
67
56
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Merge user shell PATH into process PATH so packaged VS Code extension host
|
|
70
|
-
* can still locate user-installed CLIs.
|
|
71
|
-
*/
|
|
72
57
|
function inheritShellPath(platform = process.platform) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
inheritNpmPrefixPath('linux');
|
|
58
|
+
if (platform === "darwin") {
|
|
59
|
+
inheritDarwinPath();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (platform === "win32") {
|
|
63
|
+
inheritNpmPrefixPath("win32");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
inheritNpmPrefixPath("linux");
|
|
83
67
|
}
|
|
84
68
|
function findCommandPath(command, platform = process.platform) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
const out = (0, child_process_1.execFileSync)('which', [command], {
|
|
96
|
-
encoding: 'utf8',
|
|
97
|
-
timeout: 5000,
|
|
98
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
99
|
-
}).trim();
|
|
100
|
-
return out || undefined;
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return undefined;
|
|
69
|
+
try {
|
|
70
|
+
if (platform === "win32") {
|
|
71
|
+
const out2 = (0, import_child_process.execSync)(`where ${command}`, {
|
|
72
|
+
encoding: "utf8",
|
|
73
|
+
timeout: 5e3,
|
|
74
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
75
|
+
}).trim();
|
|
76
|
+
const first = out2.split(/\r?\n/).map((line) => line.trim()).find(Boolean);
|
|
77
|
+
return first || void 0;
|
|
104
78
|
}
|
|
79
|
+
const out = (0, import_child_process.execFileSync)("which", [command], {
|
|
80
|
+
encoding: "utf8",
|
|
81
|
+
timeout: 5e3,
|
|
82
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
83
|
+
}).trim();
|
|
84
|
+
return out || void 0;
|
|
85
|
+
} catch {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
105
88
|
}
|
|
106
89
|
function inheritDarwinPath() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!shellPath)
|
|
123
|
-
continue;
|
|
124
|
-
process.env.PATH = mergePath(currentPath, shellPath, parts);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
catch {
|
|
128
|
-
// Try next shell candidate.
|
|
129
|
-
}
|
|
90
|
+
const currentPath = process.env.PATH || "";
|
|
91
|
+
const parts = new Set(currentPath.split(path.delimiter).filter(Boolean));
|
|
92
|
+
const candidateShells = [process.env.SHELL, "/bin/zsh", "/bin/bash"].map((value) => String(value || "").trim()).filter(Boolean).filter((value, index, arr) => arr.indexOf(value) === index);
|
|
93
|
+
for (const shell of candidateShells) {
|
|
94
|
+
if (!fs.existsSync(shell)) continue;
|
|
95
|
+
try {
|
|
96
|
+
const shellPath = (0, import_child_process.execFileSync)(shell, ["-lic", "echo $PATH"], {
|
|
97
|
+
encoding: "utf8",
|
|
98
|
+
timeout: 5e3,
|
|
99
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
100
|
+
}).trim();
|
|
101
|
+
if (!shellPath) continue;
|
|
102
|
+
process.env.PATH = mergePath(currentPath, shellPath, parts);
|
|
103
|
+
return;
|
|
104
|
+
} catch {
|
|
130
105
|
}
|
|
106
|
+
}
|
|
131
107
|
}
|
|
132
108
|
function inheritNpmPrefixPath(platform) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (!candidate || parts.has(candidate))
|
|
150
|
-
continue;
|
|
151
|
-
nextPath = nextPath ? `${candidate}${path.delimiter}${nextPath}` : candidate;
|
|
152
|
-
parts.add(candidate);
|
|
153
|
-
}
|
|
154
|
-
process.env.PATH = nextPath;
|
|
155
|
-
}
|
|
156
|
-
catch {
|
|
157
|
-
// npm unavailable; keep current PATH.
|
|
109
|
+
const npmCommand = platform === "win32" ? "npm.cmd" : "npm";
|
|
110
|
+
try {
|
|
111
|
+
const npmPrefix = (0, import_child_process.execFileSync)(npmCommand, ["prefix", "-g"], {
|
|
112
|
+
encoding: "utf8",
|
|
113
|
+
timeout: 5e3,
|
|
114
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
115
|
+
shell: platform === "win32"
|
|
116
|
+
}).trim();
|
|
117
|
+
if (!npmPrefix) return;
|
|
118
|
+
const candidates = platform === "win32" ? [npmPrefix, path.join(npmPrefix, "node_modules", ".bin")] : [path.join(npmPrefix, "bin")];
|
|
119
|
+
let nextPath = process.env.PATH || "";
|
|
120
|
+
const parts = new Set(nextPath.split(path.delimiter).filter(Boolean));
|
|
121
|
+
for (const candidate of candidates) {
|
|
122
|
+
if (!candidate || parts.has(candidate)) continue;
|
|
123
|
+
nextPath = nextPath ? `${candidate}${path.delimiter}${nextPath}` : candidate;
|
|
124
|
+
parts.add(candidate);
|
|
158
125
|
}
|
|
126
|
+
process.env.PATH = nextPath;
|
|
127
|
+
} catch {
|
|
128
|
+
}
|
|
159
129
|
}
|
|
160
130
|
function mergePath(currentPath, shellPath, knownParts) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return currentPath;
|
|
170
|
-
return currentPath
|
|
171
|
-
? `${currentPath}${path.delimiter}${additions.join(path.delimiter)}`
|
|
172
|
-
: additions.join(path.delimiter);
|
|
131
|
+
const additions = [];
|
|
132
|
+
for (const candidate of shellPath.split(path.delimiter).filter(Boolean)) {
|
|
133
|
+
if (knownParts.has(candidate)) continue;
|
|
134
|
+
knownParts.add(candidate);
|
|
135
|
+
additions.push(candidate);
|
|
136
|
+
}
|
|
137
|
+
if (additions.length === 0) return currentPath;
|
|
138
|
+
return currentPath ? `${currentPath}${path.delimiter}${additions.join(path.delimiter)}` : additions.join(path.delimiter);
|
|
173
139
|
}
|
|
174
|
-
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
findCommandPath,
|
|
143
|
+
getProviderCliCommand,
|
|
144
|
+
inheritShellPath,
|
|
145
|
+
resolveCmdNodeScript
|
|
146
|
+
});
|