claude-term-tabs 0.0.0-bootstrap → 2.1.0
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/bin/claude-term-tabs +1 -1
- package/dist/cli.js +11 -12
- package/dist/commands.js +1 -1
- package/package.json +1 -1
package/bin/claude-term-tabs
CHANGED
|
@@ -15,5 +15,5 @@ if (argv[0] === COMPLETE_FLAG) {
|
|
|
15
15
|
process.exitCode = answerCompletion(argv.slice(1), { stdout: lineWriter(1), stderr: lineWriter(2) })
|
|
16
16
|
} else {
|
|
17
17
|
const { main } = await import(src('cli.ts'))
|
|
18
|
-
process.exitCode = await main(argv)
|
|
18
|
+
process.exitCode = await main(argv, { installed: !fromSrc })
|
|
19
19
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { closeSync, openSync, readSync } from 'node:fs';
|
|
3
|
-
import { sep } from 'node:path';
|
|
4
3
|
import { isatty } from 'node:tty';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
4
|
import { parseFlags, SEARCH_FLAGS } from "./args.js";
|
|
7
5
|
import { DigestCache } from "./cache.js";
|
|
8
6
|
import { loadConfig } from "./config.js";
|
|
@@ -214,7 +212,8 @@ function promptTty(question) {
|
|
|
214
212
|
* The real outside world. Building it runs nothing: whether fzf is installed is checked the first
|
|
215
213
|
* time something asks, so completion requests, which never need it, start no process.
|
|
216
214
|
*/
|
|
217
|
-
|
|
215
|
+
/** `installed`: the launcher runs the built package (dist/), not a clone's src/. */
|
|
216
|
+
export function realDeps(exec = realExec, installed = false) {
|
|
218
217
|
let fzf;
|
|
219
218
|
const deps = {
|
|
220
219
|
exec,
|
|
@@ -244,22 +243,22 @@ export function realDeps(exec = realExec) {
|
|
|
244
243
|
},
|
|
245
244
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
246
245
|
self: [process.execPath, process.argv[1]],
|
|
247
|
-
completionProgram: completionProgram(process.argv[1],
|
|
246
|
+
completionProgram: completionProgram(process.argv[1], installed),
|
|
248
247
|
shell: process.env.SHELL
|
|
249
248
|
};
|
|
250
249
|
return deps;
|
|
251
250
|
}
|
|
252
251
|
/**
|
|
253
|
-
* What a completion script should run. An installed package
|
|
254
|
-
*
|
|
255
|
-
*
|
|
252
|
+
* What a completion script should run. An installed package is called by name from PATH, because the path it ran
|
|
253
|
+
* from may not last (npx cleans its cache; a version manager keeps one prefix per Node). A clone keeps its own path,
|
|
254
|
+
* so it works without being on PATH.
|
|
256
255
|
*/
|
|
257
|
-
export function completionProgram(argv1,
|
|
258
|
-
return
|
|
256
|
+
export function completionProgram(argv1, installed) {
|
|
257
|
+
return installed ? 'claude-term-tabs' : argv1;
|
|
259
258
|
}
|
|
260
|
-
/** Entry point used by bin/claude-term-tabs. */
|
|
261
|
-
export async function main(argv) {
|
|
262
|
-
const deps = realDeps();
|
|
259
|
+
/** Entry point used by bin/claude-term-tabs, which says whether it runs the installed package. */
|
|
260
|
+
export async function main(argv, { installed = false } = {}) {
|
|
261
|
+
const deps = realDeps(realExec, installed);
|
|
263
262
|
const sub = await runCommand(argv, deps);
|
|
264
263
|
if (sub !== undefined)
|
|
265
264
|
return sub;
|
package/dist/commands.js
CHANGED
|
@@ -101,7 +101,7 @@ function completion(argv, deps) {
|
|
|
101
101
|
const where = positionals[0] === undefined ? ' in $SHELL' : '';
|
|
102
102
|
throw new Error(`unknown shell "${shell}"${where} (supported: ${SHELLS.join(', ')}); run ${SHELLS.map(s => `ctt completion ${s}`).join(' or ')}`);
|
|
103
103
|
}
|
|
104
|
-
deps.stdout(completionScript(shell, deps.completionProgram
|
|
104
|
+
deps.stdout(completionScript(shell, deps.completionProgram));
|
|
105
105
|
return EXIT_OK;
|
|
106
106
|
}
|
|
107
107
|
function focus(argv, deps) {
|