pi-odd-worktree 2.1.0 → 3.0.1
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 +54 -319
- package/extensions/odd-worktree-tools.ts +4182 -2539
- package/lib/bash-activity.js +1166 -0
- package/lib/bash-design.js +684 -0
- package/lib/bash-destructive.js +559 -0
- package/lib/bash-frame.js +205 -0
- package/lib/card-content.js +23 -0
- package/lib/card-style.js +175 -0
- package/lib/checkout-facts.js +30 -70
- package/lib/codegraph-card-preview.js +628 -0
- package/lib/codegraph-card.js +515 -0
- package/lib/codegraph-compaction.js +76 -0
- package/lib/codegraph-daemon.js +246 -0
- package/lib/codegraph-edit-sync.js +182 -0
- package/lib/codegraph-guard-target.js +337 -0
- package/lib/codegraph-guard.js +211 -0
- package/lib/codegraph-index.js +1020 -0
- package/lib/codegraph-lock.js +607 -0
- package/lib/codegraph-mcp-config.js +134 -0
- package/lib/codegraph-mcp.js +123 -0
- package/lib/codegraph-paths.js +69 -0
- package/lib/codegraph-prompt/explore.md +11 -0
- package/lib/codegraph-prompt/fix.md +6 -0
- package/lib/codegraph-prompt/generic.md +8 -0
- package/lib/codegraph-prompt/judge.md +9 -0
- package/lib/codegraph-prompt/orchestrator.md +17 -0
- package/lib/codegraph-prompt/verify.md +10 -0
- package/lib/codegraph-prompt/worker.md +7 -0
- package/lib/codegraph-role.js +55 -0
- package/lib/codegraph-rules.js +146 -0
- package/lib/codegraph-session.js +303 -383
- package/lib/codegraph-warmup.js +139 -0
- package/lib/file-card-markdown.js +141 -0
- package/lib/file-card-resolver.js +245 -0
- package/lib/file-card.js +659 -0
- package/lib/files-index.js +387 -0
- package/lib/files-insert.js +81 -0
- package/lib/files-orders.js +326 -0
- package/lib/files-picker-view.js +1421 -0
- package/lib/files-preview.js +338 -0
- package/lib/files-scope-detail.js +171 -0
- package/lib/files-scope-view.js +507 -0
- package/lib/gh-issues.js +323 -15
- package/lib/issue-preview.js +26 -7
- package/lib/issues-bash-mutation.js +206 -0
- package/lib/issues-cache-store.js +261 -0
- package/lib/issues-section.js +710 -0
- package/lib/issues-view.js +649 -52
- package/lib/odd-prompt/odd-worktrees.md +21 -0
- package/lib/odd-worktrees-prompt.js +10 -28
- package/lib/related-issues-cache.js +210 -0
- package/lib/shell-card.js +825 -0
- package/lib/skill-odd-card.js +183 -0
- package/lib/tui-paint.js +4 -5
- package/lib/warp-create-panel.js +538 -250
- package/lib/warp-create-picker.js +56 -9
- package/lib/warp-delete-confirm.js +19 -28
- package/lib/warp-selector-view.js +160 -82
- package/lib/which-command.js +90 -0
- package/lib/worktree-card.js +267 -897
- package/lib/worktree-cards.js +383 -0
- package/lib/worktree-create.js +287 -0
- package/lib/worktree-git.js +3 -3
- package/lib/worktree-guard.js +548 -0
- package/lib/worktree-hooks.js +421 -712
- package/lib/worktree-list.js +120 -0
- package/lib/worktree-registry.js +162 -879
- package/lib/{worktree-close-herdr.js → worktree-remove.js} +9 -11
- package/lib/worktree-setup-runner.js +376 -0
- package/lib/worktree-setup.js +140 -0
- package/lib/worktree-warp-busy.js +462 -85
- package/lib/worktree-warp-sessions.js +1 -2
- package/package.json +2 -2
- package/tools/bash-activity.test.js +1420 -0
- package/tools/bash-design.test.js +1093 -0
- package/tools/bash-destructive.test.js +139 -0
- package/tools/card-content.test.js +44 -0
- package/tools/card-style.test.js +298 -0
- package/tools/codegraph-card-preview.test.js +254 -0
- package/tools/codegraph-card.test.js +1080 -0
- package/tools/codegraph-compaction.test.js +378 -0
- package/tools/codegraph-daemon.test.js +248 -0
- package/tools/codegraph-edit-sync.test.js +295 -0
- package/tools/codegraph-guard-target.test.js +174 -0
- package/tools/codegraph-guard.test.js +238 -0
- package/tools/codegraph-index.test.js +1948 -0
- package/tools/codegraph-lock.test.js +932 -0
- package/tools/codegraph-mcp-config.test.js +181 -0
- package/tools/codegraph-mcp.test.js +194 -0
- package/tools/codegraph-paths.test.js +44 -0
- package/tools/codegraph-role.test.js +30 -0
- package/tools/codegraph-rules.test.js +250 -0
- package/tools/codegraph-session.test.js +660 -391
- package/tools/codegraph-warmup.test.js +316 -0
- package/tools/commands.test.js +510 -31
- package/tools/file-card-markdown.test.js +188 -0
- package/tools/file-card.test.js +1289 -0
- package/tools/files-bridge.test.js +575 -0
- package/tools/files-command.test.js +613 -0
- package/tools/files-index.test.js +473 -0
- package/tools/files-insert.test.js +139 -0
- package/tools/files-orders.test.js +597 -0
- package/tools/files-picker-view.test.js +1889 -0
- package/tools/files-preview.test.js +452 -0
- package/tools/files-scope-detail.test.js +264 -0
- package/tools/files-scope-view.test.js +614 -0
- package/tools/fixtures/card-codegraph-outputs.js +110 -0
- package/tools/fixtures/codegraph-cli-stub.js +16 -0
- package/tools/fixtures/codegraph-init-process.js +28 -0
- package/tools/fixtures/codegraph-lock-worker.js +117 -0
- package/tools/fixtures/daemon-fake.js +98 -0
- package/tools/fixtures/daemon-mcp-server.js +39 -0
- package/tools/fixtures/daemon-warmup-worker.js +12 -0
- package/tools/fixtures/load-extension.js +136 -3
- package/tools/gh-issues-feedback.test.js +31 -7
- package/tools/gh-issues.test.js +417 -1
- package/tools/issue-preview.test.js +44 -7
- package/tools/issues-bash-mutation.test.js +101 -0
- package/tools/issues-cache-store.test.js +222 -0
- package/tools/issues-command.test.js +1517 -67
- package/tools/issues-open-guard.test.js +1096 -0
- package/tools/issues-section.test.js +4235 -0
- package/tools/issues-seed-query-regression.test.js +67 -0
- package/tools/issues-view.test.js +1489 -60
- package/tools/odd-worktrees-prompt.test.js +98 -65
- package/tools/package-surface.test.js +431 -36
- package/tools/related-issues-cache.test.js +324 -0
- package/tools/shell-card.test.js +834 -0
- package/tools/skill-odd-card.test.js +200 -0
- package/tools/t5-session-identity.test.js +44 -22
- package/tools/warp-busy-guard.test.js +2565 -309
- package/tools/warp-create-panel.test.js +499 -74
- package/tools/warp-create-picker.test.js +101 -5
- package/tools/warp-delete-confirm.test.js +49 -15
- package/tools/warp-empty-session.test.js +0 -1
- package/tools/warp-fallback-regression.test.js +533 -0
- package/tools/warp-selector-view.test.js +460 -196
- package/tools/which-command.test.js +126 -0
- package/tools/worktree-card.test.js +551 -0
- package/tools/worktree-cards.test.js +845 -0
- package/tools/worktree-changes.test.js +4 -5
- package/tools/worktree-create.test.js +489 -0
- package/tools/worktree-guard.test.js +823 -0
- package/tools/worktree-hooks.test.js +905 -0
- package/tools/worktree-list.test.js +170 -0
- package/tools/worktree-registry.test.js +89 -230
- package/tools/worktree-remove-async.test.js +318 -0
- package/tools/worktree-setup-runner.test.js +276 -0
- package/tools/worktree-setup.test.js +140 -0
- package/tools/worktree-tools.test.js +419 -199
- package/lib/codegraph-commands.js +0 -165
- package/lib/odd-prompt/odd-worktrees.with-codegraph.md +0 -19
- package/lib/odd-prompt/odd-worktrees.without-codegraph.md +0 -15
- package/lib/worktree-model-result.js +0 -291
- package/tools/codegraph-commands.test.js +0 -371
- package/tools/herdr-free-create.test.js +0 -161
- package/tools/worktree-close-herdr-async.test.js +0 -204
- package/tools/worktree-odd-migration.test.js +0 -224
- package/tools/worktree-registry-cache.test.js +0 -163
- package/tools/worktree-registry-odd.test.js +0 -231
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// A LOCAL executable lookup: does this process's PATH hold this command?
|
|
3
|
+
//
|
|
4
|
+
// S13 (issues-startup-performance T11): the issues surfaces have to know whether
|
|
5
|
+
// `gh` exists BEFORE they spend a child process finding out. Running a missing
|
|
6
|
+
// binary costs a fork and answers ENOENT, and the answer was already on disk — it
|
|
7
|
+
// is the PATH walk below. So this is the whole probe: stat/access over the
|
|
8
|
+
// directories `PATH` names, no child, no network, no cache.
|
|
9
|
+
//
|
|
10
|
+
// It is small and fully injectable on purpose: the environment, the platform and
|
|
11
|
+
// the executable test all arrive as options, so a test drives every branch
|
|
12
|
+
// (win32's `;` and `PATHEXT` included) without a real install, and the caller
|
|
13
|
+
// never reads `process.env` behind its own back.
|
|
14
|
+
//
|
|
15
|
+
// Nothing is memoized. PATH belongs to the caller's live environment, and a
|
|
16
|
+
// cached absence would keep the surfaces off after the install that fixed it.
|
|
17
|
+
//
|
|
18
|
+
// `isExecutable(candidate)` defaults to the platform's own rule: an existing
|
|
19
|
+
// regular file with the executable bit on POSIX, an existing regular file on
|
|
20
|
+
// win32 (where the extension decides, and the filesystem is case-insensitive).
|
|
21
|
+
// A directory is never a command.
|
|
22
|
+
|
|
23
|
+
const fs = require('node:fs');
|
|
24
|
+
const path = require('node:path');
|
|
25
|
+
|
|
26
|
+
// Windows spells the variable `Path` as often as `PATH`; both are the same list.
|
|
27
|
+
function pathValueOf(env) {
|
|
28
|
+
if (!env || typeof env !== 'object') return '';
|
|
29
|
+
if (typeof env.PATH === 'string') return env.PATH;
|
|
30
|
+
if (typeof env.Path === 'string') return env.Path;
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function defaultIsExecutable(platform) {
|
|
35
|
+
return (candidate) => {
|
|
36
|
+
try {
|
|
37
|
+
const stat = fs.statSync(candidate);
|
|
38
|
+
if (!stat.isFile()) return false;
|
|
39
|
+
if (platform === 'win32') return true;
|
|
40
|
+
fs.accessSync(candidate, fs.constants.X_OK);
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The candidate spellings of ONE name in one directory: the name itself, then
|
|
49
|
+
// every `PATHEXT` extension, in the order the shell itself would try them.
|
|
50
|
+
function candidatesFor(directory, name, platform, env, join) {
|
|
51
|
+
if (platform !== 'win32') return [join(directory, name)];
|
|
52
|
+
const raw = env && typeof env.PATHEXT === 'string' && env.PATHEXT.length > 0
|
|
53
|
+
? env.PATHEXT
|
|
54
|
+
: '.EXE;.CMD;.BAT;.COM';
|
|
55
|
+
const extensions = ['', ...raw.split(';').filter((entry) => entry.length > 0)];
|
|
56
|
+
return extensions.map((extension) => join(directory, `${name}${extension}`));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The first executable spelled `name` on the given PATH, as the whole path, or
|
|
60
|
+
// `null`. An absolute `name` is tested on its own — a caller that names its own
|
|
61
|
+
// binary (an installer's full path) is not a PATH question.
|
|
62
|
+
function whichCommand(name, options = {}) {
|
|
63
|
+
try {
|
|
64
|
+
if (typeof name !== 'string' || name.length === 0) return null;
|
|
65
|
+
const opts = options && typeof options === 'object' ? options : {};
|
|
66
|
+
const env = opts.env && typeof opts.env === 'object' ? opts.env : {};
|
|
67
|
+
const platform = typeof opts.platform === 'string' ? opts.platform : process.platform;
|
|
68
|
+
const isExecutable = typeof opts.isExecutable === 'function'
|
|
69
|
+
? opts.isExecutable
|
|
70
|
+
: defaultIsExecutable(platform);
|
|
71
|
+
const join = platform === 'win32' ? path.win32.join : path.join;
|
|
72
|
+
if (path.isAbsolute(name)) return isExecutable(name) ? name : null;
|
|
73
|
+
const value = pathValueOf(env);
|
|
74
|
+
if (value.length === 0) return null;
|
|
75
|
+
const delimiter = platform === 'win32' ? ';' : path.delimiter;
|
|
76
|
+
for (const directory of value.split(delimiter)) {
|
|
77
|
+
if (directory.length === 0) continue;
|
|
78
|
+
for (const candidate of candidatesFor(directory, name, platform, env, join)) {
|
|
79
|
+
if (isExecutable(candidate)) return candidate;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
} catch {
|
|
84
|
+
// A probe never throws: an unreadable environment is "not found", which the
|
|
85
|
+
// caller reports as the state it already knows how to draw.
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = { whichCommand };
|