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.
@@ -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
- export function realDeps(exec = realExec) {
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], import.meta.url),
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 (built, so it runs from dist/) is called by name from
254
- * PATH, because the path it ran from may not last (npx cleans its cache; a version manager keeps one prefix per Node). A clone runs from src/ and keeps
255
- * its own path, so it works without being on PATH.
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, moduleUrl) {
258
- return fileURLToPath(moduleUrl).endsWith(`${sep}dist${sep}cli.js`) ? 'claude-term-tabs' : argv1;
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 ?? deps.self[1] ?? 'ctt'));
104
+ deps.stdout(completionScript(shell, deps.completionProgram));
105
105
  return EXIT_OK;
106
106
  }
107
107
  function focus(argv, deps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-term-tabs",
3
- "version": "0.0.0-bootstrap",
3
+ "version": "2.1.0",
4
4
  "description": "Find a running Claude Code session by what you remember, and jump to its terminal tab",
5
5
  "type": "module",
6
6
  "license": "MIT",