claude-term-tabs 2.1.0 → 2.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/README.md +14 -8
- package/dist/cli.js +26 -1
- package/dist/commands.js +3 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# claude-term-tabs
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/claude-term-tabs)
|
|
4
|
+
[](https://github.com/ecoutu/claude-term-tabs/actions/workflows/release.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
3
7
|
Find a running Claude Code session by what you remember about it, and switch to its terminal tab.
|
|
4
8
|
|
|
5
9
|
```bash
|
|
@@ -136,21 +140,23 @@ and modification time. Delete it any time.
|
|
|
136
140
|
## Development
|
|
137
141
|
|
|
138
142
|
```bash
|
|
139
|
-
npm ci
|
|
140
|
-
npm run check
|
|
143
|
+
npm ci # installs the commit hooks (husky + commitlint)
|
|
144
|
+
npm run check # type-check
|
|
141
145
|
npm test
|
|
146
|
+
npm run test:package # packs, installs and runs the npm package
|
|
142
147
|
```
|
|
143
148
|
|
|
144
|
-
No runtime dependencies
|
|
145
|
-
pull request rules.
|
|
149
|
+
No runtime dependencies. A clone runs the TypeScript directly; the npm package ships it built to JavaScript.
|
|
150
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) has the commit and pull request rules.
|
|
146
151
|
|
|
147
152
|
### Releases
|
|
148
153
|
|
|
149
154
|
Every push to `main` runs CI, then semantic-release reads the conventional commit
|
|
150
|
-
messages since the last tag and, when any warrant it, tags the next version (`fix:`
|
|
151
|
-
`feat:` minor, `BREAKING CHANGE:` major), adds the notes to
|
|
152
|
-
|
|
153
|
-
version; the git tag is the version.
|
|
155
|
+
messages since the last tag and, when any warrant it, tags the next version (`fix:`, `perf:` or
|
|
156
|
+
`docs(readme):` patch, `feat:` minor, `!` or `BREAKING CHANGE:` major), adds the notes to
|
|
157
|
+
[CHANGELOG.md](CHANGELOG.md), publishes the package to npm with provenance and creates a GitHub
|
|
158
|
+
release. `package.json` keeps a placeholder version; the git tag is the version.
|
|
159
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) explains how the npm publish works.
|
|
154
160
|
|
|
155
161
|
### Manual checks
|
|
156
162
|
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { closeSync, openSync, readSync } from 'node:fs';
|
|
2
|
+
import { accessSync, closeSync, constants, openSync, readSync, statSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
3
4
|
import { isatty } from 'node:tty';
|
|
4
5
|
import { parseFlags, SEARCH_FLAGS } from "./args.js";
|
|
5
6
|
import { DigestCache } from "./cache.js";
|
|
@@ -244,6 +245,7 @@ export function realDeps(exec = realExec, installed = false) {
|
|
|
244
245
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
245
246
|
self: [process.execPath, process.argv[1]],
|
|
246
247
|
completionProgram: completionProgram(process.argv[1], installed),
|
|
248
|
+
completionWarning: program => completionWarning(program, process.env.PATH ?? '', isProgram),
|
|
247
249
|
shell: process.env.SHELL
|
|
248
250
|
};
|
|
249
251
|
return deps;
|
|
@@ -256,6 +258,29 @@ export function realDeps(exec = realExec, installed = false) {
|
|
|
256
258
|
export function completionProgram(argv1, installed) {
|
|
257
259
|
return installed ? 'claude-term-tabs' : argv1;
|
|
258
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Why a completion script calling `program` won't work, if it won't. A clone's script calls its own path; an installed
|
|
263
|
+
* package's calls claude-term-tabs from PATH. npx (its cache) and a project's node_modules/.bin are on PATH only for
|
|
264
|
+
* this run, so they don't count: without a lasting copy, every Tab press would fail with "command not found".
|
|
265
|
+
*/
|
|
266
|
+
export function completionWarning(program, path, isProgram) {
|
|
267
|
+
if (program.includes('/'))
|
|
268
|
+
return undefined;
|
|
269
|
+
const lasting = path.split(':').filter(d => d !== '' && !d.includes('/_npx/') && !/\/node_modules\/\.bin\/?$/.test(d));
|
|
270
|
+
if (lasting.some(d => isProgram(join(d, program))))
|
|
271
|
+
return undefined;
|
|
272
|
+
return "claude-term-tabs: it isn't on your PATH outside this run, so Tab completion won't work until you run: npm install --global claude-term-tabs";
|
|
273
|
+
}
|
|
274
|
+
/** True for an executable file. */
|
|
275
|
+
function isProgram(p) {
|
|
276
|
+
try {
|
|
277
|
+
accessSync(p, constants.X_OK);
|
|
278
|
+
return statSync(p).isFile();
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
259
284
|
/** Entry point used by bin/claude-term-tabs, which says whether it runs the installed package. */
|
|
260
285
|
export async function main(argv, { installed = false } = {}) {
|
|
261
286
|
const deps = realDeps(realExec, installed);
|
package/dist/commands.js
CHANGED
|
@@ -102,6 +102,9 @@ function completion(argv, deps) {
|
|
|
102
102
|
throw new Error(`unknown shell "${shell}"${where} (supported: ${SHELLS.join(', ')}); run ${SHELLS.map(s => `ctt completion ${s}`).join(' or ')}`);
|
|
103
103
|
}
|
|
104
104
|
deps.stdout(completionScript(shell, deps.completionProgram));
|
|
105
|
+
const warning = deps.completionWarning(deps.completionProgram);
|
|
106
|
+
if (warning !== undefined)
|
|
107
|
+
deps.stderr(warning);
|
|
105
108
|
return EXIT_OK;
|
|
106
109
|
}
|
|
107
110
|
function focus(argv, deps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-term-tabs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
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",
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
"check": "tsc",
|
|
39
39
|
"prepare": "husky",
|
|
40
40
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
41
|
-
"prepack": "npm run build"
|
|
41
|
+
"prepack": "npm run build",
|
|
42
|
+
"test:package": "CTT_NO_REAL_EXEC=1 node --test 'tests/**/*.pack.ts'"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@commitlint/cli": "21.2.4",
|