@cestoliv/wt 0.2.1 → 0.3.0-pr13.g878c337
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/SKILL.md +5 -0
- package/dist/{agent-PKCZHGN7.js → agent-52M5VZNS.js} +38 -7
- package/dist/chunk-F4DNLDG7.js +114 -0
- package/dist/{chunk-FSARWOCW.js → chunk-HQANH3IS.js} +12 -1
- package/dist/{chunk-BYWCGKUP.js → chunk-HWLB5I4T.js} +6 -4
- package/dist/cli.js +7 -7
- package/dist/{config-OSNYQCZL.js → config-7QMKGWCX.js} +7 -10
- package/dist/{create-5J5NGGGM.js → create-RWGSJRM5.js} +3 -3
- package/dist/{list-5TXRTSIW.js → list-VPPPO26E.js} +3 -3
- package/dist/skill-XCOCBZB3.js +9 -0
- package/package.json +1 -1
- package/dist/chunk-IQWENLPW.js +0 -40
- package/dist/skill-RR6MNLWH.js +0 -9
package/SKILL.md
CHANGED
|
@@ -56,6 +56,11 @@ for you to grant it and confirm, then retries automatically. On other platforms
|
|
|
56
56
|
(or when `ide` is not `zed`) the worktree is still created and opened, but the
|
|
57
57
|
agent is not auto-started.
|
|
58
58
|
|
|
59
|
+
Over SSH it still works, provided the same user has an active graphical login on
|
|
60
|
+
the Mac: the keystroke is sent via `launchctl asuser` so it reaches that GUI
|
|
61
|
+
session. With no one logged in graphically there is nothing to drive, so it
|
|
62
|
+
falls back to the manual "press the chord in Zed" message.
|
|
63
|
+
|
|
59
64
|
If the worktree path already exists, `wt agent` prompts you to **open it in the
|
|
60
65
|
IDE**, **open it and start the agent**, or **quit** — instead of erroring. (In a
|
|
61
66
|
non-interactive shell it errors with a non-zero exit instead of prompting.)
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
openConfiguredIde,
|
|
4
4
|
prepareWorktree,
|
|
5
5
|
promptExistingWorktree
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-HWLB5I4T.js";
|
|
7
|
+
import "./chunk-HQANH3IS.js";
|
|
8
|
+
import "./chunk-F4DNLDG7.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/agent.ts
|
|
11
11
|
import * as clack from "@clack/prompts";
|
|
@@ -273,17 +273,48 @@ Note: "${chord}" is already bound in ${keymapPath}; wt's agent binding will take
|
|
|
273
273
|
return true;
|
|
274
274
|
}
|
|
275
275
|
var ACCESSIBILITY_SETTINGS_URL = "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility";
|
|
276
|
+
function isHeadlessSession(env = process.env) {
|
|
277
|
+
return Boolean(env.SSH_CONNECTION || env.SSH_TTY || env.SSH_CLIENT);
|
|
278
|
+
}
|
|
279
|
+
function buildOsascriptCommand(script, opts = {}) {
|
|
280
|
+
const { env = process.env, uid } = opts;
|
|
281
|
+
if (isHeadlessSession(env) && typeof uid === "number") {
|
|
282
|
+
return {
|
|
283
|
+
command: "launchctl",
|
|
284
|
+
args: ["asuser", String(uid), "osascript", "-e", script]
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return { command: "osascript", args: ["-e", script] };
|
|
288
|
+
}
|
|
289
|
+
var OSASCRIPT_TIMEOUT_MS = 3e4;
|
|
276
290
|
function defaultRunner(script) {
|
|
277
291
|
return new Promise((resolve) => {
|
|
278
|
-
const
|
|
292
|
+
const { command, args } = buildOsascriptCommand(script, {
|
|
293
|
+
uid: process.getuid?.()
|
|
294
|
+
});
|
|
295
|
+
const child = spawn(command, args, {
|
|
279
296
|
stdio: ["ignore", "ignore", "pipe"]
|
|
280
297
|
});
|
|
281
298
|
let stderr = "";
|
|
299
|
+
let settled = false;
|
|
300
|
+
const finish = (result) => {
|
|
301
|
+
if (settled) return;
|
|
302
|
+
settled = true;
|
|
303
|
+
clearTimeout(timer);
|
|
304
|
+
resolve(result);
|
|
305
|
+
};
|
|
306
|
+
const timer = setTimeout(() => {
|
|
307
|
+
child.kill();
|
|
308
|
+
finish({
|
|
309
|
+
code: null,
|
|
310
|
+
stderr: "osascript timed out \u2014 is a user logged into the Mac's graphical session?"
|
|
311
|
+
});
|
|
312
|
+
}, OSASCRIPT_TIMEOUT_MS);
|
|
282
313
|
child.stderr?.on("data", (d) => {
|
|
283
314
|
stderr += d.toString();
|
|
284
315
|
});
|
|
285
|
-
child.on("error", (err) =>
|
|
286
|
-
child.on("close", (code) =>
|
|
316
|
+
child.on("error", (err) => finish({ code: null, stderr: err.message }));
|
|
317
|
+
child.on("close", (code) => finish({ code, stderr }));
|
|
287
318
|
});
|
|
288
319
|
}
|
|
289
320
|
function isAccessibilityError(stderr) {
|
|
@@ -419,7 +450,7 @@ function reportTriggerFailure(result, chord) {
|
|
|
419
450
|
}
|
|
420
451
|
console.warn(
|
|
421
452
|
pc.yellow(
|
|
422
|
-
`\u26A0 Could not auto-start the agent${result.message ? `: ${result.message}` : ""}. In Zed, press ${chord} to start it manually
|
|
453
|
+
`\u26A0 Could not auto-start the agent${result.message ? `: ${result.message}` : ""}. In Zed, press ${chord} to start it manually. (Over SSH, this needs the same user logged into the Mac's graphical session.)`
|
|
423
454
|
)
|
|
424
455
|
);
|
|
425
456
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/lib/config.ts
|
|
4
|
+
import path2 from "path";
|
|
5
|
+
import Conf from "conf";
|
|
6
|
+
|
|
7
|
+
// node_modules/env-paths/index.js
|
|
8
|
+
import path from "path";
|
|
9
|
+
import os from "os";
|
|
10
|
+
import process2 from "process";
|
|
11
|
+
var homedir = os.homedir();
|
|
12
|
+
var tmpdir = os.tmpdir();
|
|
13
|
+
var { env } = process2;
|
|
14
|
+
var macos = (name) => {
|
|
15
|
+
const library = path.join(homedir, "Library");
|
|
16
|
+
return {
|
|
17
|
+
data: path.join(library, "Application Support", name),
|
|
18
|
+
config: path.join(library, "Preferences", name),
|
|
19
|
+
cache: path.join(library, "Caches", name),
|
|
20
|
+
log: path.join(library, "Logs", name),
|
|
21
|
+
temp: path.join(tmpdir, name)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
var windows = (name) => {
|
|
25
|
+
const appData = env.APPDATA || path.join(homedir, "AppData", "Roaming");
|
|
26
|
+
const localAppData = env.LOCALAPPDATA || path.join(homedir, "AppData", "Local");
|
|
27
|
+
return {
|
|
28
|
+
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
29
|
+
data: path.join(localAppData, name, "Data"),
|
|
30
|
+
config: path.join(appData, name, "Config"),
|
|
31
|
+
cache: path.join(localAppData, name, "Cache"),
|
|
32
|
+
log: path.join(localAppData, name, "Log"),
|
|
33
|
+
temp: path.join(tmpdir, name)
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var linux = (name) => {
|
|
37
|
+
const username = path.basename(homedir);
|
|
38
|
+
return {
|
|
39
|
+
data: path.join(env.XDG_DATA_HOME || path.join(homedir, ".local", "share"), name),
|
|
40
|
+
config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, ".config"), name),
|
|
41
|
+
cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, ".cache"), name),
|
|
42
|
+
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
43
|
+
log: path.join(env.XDG_STATE_HOME || path.join(homedir, ".local", "state"), name),
|
|
44
|
+
temp: path.join(tmpdir, username, name)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
function envPaths(name, { suffix = "nodejs" } = {}) {
|
|
48
|
+
if (typeof name !== "string") {
|
|
49
|
+
throw new TypeError(`Expected a string, got ${typeof name}`);
|
|
50
|
+
}
|
|
51
|
+
if (suffix) {
|
|
52
|
+
name += `-${suffix}`;
|
|
53
|
+
}
|
|
54
|
+
if (process2.platform === "darwin") {
|
|
55
|
+
return macos(name);
|
|
56
|
+
}
|
|
57
|
+
if (process2.platform === "win32") {
|
|
58
|
+
return windows(name);
|
|
59
|
+
}
|
|
60
|
+
return linux(name);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/lib/config.ts
|
|
64
|
+
var DEFAULT_CONFIG = {
|
|
65
|
+
worktree_path: "../",
|
|
66
|
+
base_branch: "origin/main",
|
|
67
|
+
setup_commands: [],
|
|
68
|
+
ide: "zed",
|
|
69
|
+
ide_open_args: ["-n"],
|
|
70
|
+
agent_command: "claude --permission-mode plan",
|
|
71
|
+
agent_trigger_chord: "ctrl-shift-cmd-c",
|
|
72
|
+
repos: [],
|
|
73
|
+
repo_overrides: {}
|
|
74
|
+
};
|
|
75
|
+
var DEFAULT_CONFIG_DIR = envPaths("wt").config;
|
|
76
|
+
function getConfigFilePath(cwd) {
|
|
77
|
+
const dir = cwd ?? DEFAULT_CONFIG_DIR;
|
|
78
|
+
return path2.join(dir, "config.json");
|
|
79
|
+
}
|
|
80
|
+
function createStore(cwd) {
|
|
81
|
+
try {
|
|
82
|
+
return new Conf({
|
|
83
|
+
projectName: "wt",
|
|
84
|
+
defaults: DEFAULT_CONFIG,
|
|
85
|
+
...cwd ? { cwd } : {}
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
const configPath = getConfigFilePath(cwd);
|
|
89
|
+
console.error(
|
|
90
|
+
`Error reading config file: ${configPath}
|
|
91
|
+
${error instanceof Error ? error.message : error}`
|
|
92
|
+
);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function getGlobalConfig(store = createStore()) {
|
|
97
|
+
return store.store;
|
|
98
|
+
}
|
|
99
|
+
function getEffectiveConfig(repoPath, store = createStore()) {
|
|
100
|
+
const {
|
|
101
|
+
repos: _repos,
|
|
102
|
+
repo_overrides,
|
|
103
|
+
...repoFields
|
|
104
|
+
} = getGlobalConfig(store);
|
|
105
|
+
const override = repo_overrides[repoPath] ?? {};
|
|
106
|
+
return { ...repoFields, ...override };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
getConfigFilePath,
|
|
111
|
+
createStore,
|
|
112
|
+
getGlobalConfig,
|
|
113
|
+
getEffectiveConfig
|
|
114
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createStore,
|
|
4
4
|
getGlobalConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F4DNLDG7.js";
|
|
6
6
|
|
|
7
7
|
// src/lib/git.ts
|
|
8
8
|
import { execFileSync } from "child_process";
|
|
@@ -124,6 +124,16 @@ function branchExists(repoRoot, branch) {
|
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
+
function setUpstreamTracking(worktreePath, branch, remote = "origin") {
|
|
128
|
+
try {
|
|
129
|
+
execFileSync(
|
|
130
|
+
"git",
|
|
131
|
+
["branch", "--set-upstream-to", `${remote}/${branch}`, branch],
|
|
132
|
+
{ cwd: worktreePath, stdio: "pipe" }
|
|
133
|
+
);
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
127
137
|
function fetchRemote(repoRoot, remote = "origin") {
|
|
128
138
|
execFileSync("git", ["fetch", remote], {
|
|
129
139
|
cwd: repoRoot,
|
|
@@ -498,6 +508,7 @@ export {
|
|
|
498
508
|
removeWorktree,
|
|
499
509
|
listWorktreeDirtyFiles,
|
|
500
510
|
branchExists,
|
|
511
|
+
setUpstreamTracking,
|
|
501
512
|
fetchRemote,
|
|
502
513
|
resolveWorktreePath,
|
|
503
514
|
openIde,
|
|
@@ -10,12 +10,13 @@ import {
|
|
|
10
10
|
registerRepo,
|
|
11
11
|
resolveWorktreePath,
|
|
12
12
|
runBranchInput,
|
|
13
|
-
runRepoPicker
|
|
14
|
-
|
|
13
|
+
runRepoPicker,
|
|
14
|
+
setUpstreamTracking
|
|
15
|
+
} from "./chunk-HQANH3IS.js";
|
|
15
16
|
import {
|
|
16
17
|
createStore,
|
|
17
18
|
getEffectiveConfig
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-F4DNLDG7.js";
|
|
19
20
|
|
|
20
21
|
// src/commands/create.ts
|
|
21
22
|
import { existsSync } from "fs";
|
|
@@ -118,8 +119,8 @@ async function prepareWorktree(branch, options = {}) {
|
|
|
118
119
|
return { status: "exists", repoRoot, worktreePath, config };
|
|
119
120
|
}
|
|
120
121
|
const parts = config.base_branch.split("/", 2);
|
|
122
|
+
const remote = parts[0] || "origin";
|
|
121
123
|
if (parts.length === 2) {
|
|
122
|
-
const remote = parts[0];
|
|
123
124
|
try {
|
|
124
125
|
fetchRemote(repoRoot, remote);
|
|
125
126
|
} catch (err) {
|
|
@@ -136,6 +137,7 @@ async function prepareWorktree(branch, options = {}) {
|
|
|
136
137
|
} else {
|
|
137
138
|
addWorktree(repoRoot, worktreePath, branch, config.base_branch);
|
|
138
139
|
}
|
|
140
|
+
setUpstreamTracking(worktreePath, branch, remote);
|
|
139
141
|
console.log(pc.green(`\u2713 Created worktree at ${worktreePath}`));
|
|
140
142
|
if (config.setup_commands.length > 0) {
|
|
141
143
|
console.log(pc.dim("Running setup commands..."));
|
package/dist/cli.js
CHANGED
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
var program = new Command();
|
|
6
|
-
program.name("wt").description("Git worktree manager").version("0.
|
|
7
|
-
const { runList } = await import("./list-
|
|
6
|
+
program.name("wt").description("Git worktree manager").version("0.3.0-pr13.g878c337").action(async () => {
|
|
7
|
+
const { runList } = await import("./list-VPPPO26E.js");
|
|
8
8
|
await runList();
|
|
9
9
|
});
|
|
10
10
|
program.command("create [branch]").description("Create a new worktree").action(async (branch) => {
|
|
11
|
-
const { createWorktree } = await import("./create-
|
|
11
|
+
const { createWorktree } = await import("./create-RWGSJRM5.js");
|
|
12
12
|
await createWorktree(branch);
|
|
13
13
|
});
|
|
14
14
|
program.command("agent <branch> <plan_prompt>").description("Create a worktree and auto-start an AI agent in Zed (macOS)").action(async (branch, planPrompt) => {
|
|
15
|
-
const { createAgentWorktree } = await import("./agent-
|
|
15
|
+
const { createAgentWorktree } = await import("./agent-52M5VZNS.js");
|
|
16
16
|
await createAgentWorktree(branch, planPrompt);
|
|
17
17
|
});
|
|
18
18
|
program.command("config").description("Open the config file in $EDITOR").option("--path", "Print the config file path and exit").action(async (options) => {
|
|
19
19
|
if (options.path) {
|
|
20
|
-
const { printConfigPath } = await import("./config-
|
|
20
|
+
const { printConfigPath } = await import("./config-7QMKGWCX.js");
|
|
21
21
|
printConfigPath();
|
|
22
22
|
} else {
|
|
23
|
-
const { openConfig } = await import("./config-
|
|
23
|
+
const { openConfig } = await import("./config-7QMKGWCX.js");
|
|
24
24
|
openConfig();
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
program.command("skill").description("Print the wt skill file to stdout").action(async () => {
|
|
28
|
-
const { printSkill } = await import("./skill-
|
|
28
|
+
const { printSkill } = await import("./skill-XCOCBZB3.js");
|
|
29
29
|
printSkill();
|
|
30
30
|
});
|
|
31
31
|
await program.parseAsync(process.argv);
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
getConfigFilePath
|
|
4
|
+
} from "./chunk-F4DNLDG7.js";
|
|
5
5
|
|
|
6
6
|
// src/commands/config.ts
|
|
7
7
|
import { spawn } from "child_process";
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function printConfigPath(cwd) {
|
|
9
|
+
const configPath = getConfigFilePath(cwd);
|
|
10
|
+
console.log(configPath);
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
function openConfig(store = createStore()) {
|
|
15
|
-
const configPath = store.path;
|
|
12
|
+
function openConfig(cwd) {
|
|
13
|
+
const configPath = getConfigFilePath(cwd);
|
|
16
14
|
console.log(`Config: ${configPath}`);
|
|
17
15
|
const editor = process.env.EDITOR ?? "nano";
|
|
18
16
|
const child = spawn(editor, [configPath], { stdio: "inherit" });
|
|
@@ -23,7 +21,6 @@ function openConfig(store = createStore()) {
|
|
|
23
21
|
child.on("close", (code) => process.exit(code ?? 0));
|
|
24
22
|
}
|
|
25
23
|
export {
|
|
26
|
-
getConfigPath,
|
|
27
24
|
openConfig,
|
|
28
25
|
printConfigPath
|
|
29
26
|
};
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
openConfiguredIde,
|
|
5
5
|
prepareWorktree,
|
|
6
6
|
promptExistingWorktree
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-HWLB5I4T.js";
|
|
8
|
+
import "./chunk-HQANH3IS.js";
|
|
9
|
+
import "./chunk-F4DNLDG7.js";
|
|
10
10
|
export {
|
|
11
11
|
createWorktree,
|
|
12
12
|
openConfiguredIde,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
registerRepo,
|
|
9
9
|
removeWorktree,
|
|
10
10
|
runInteractiveList
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HQANH3IS.js";
|
|
12
12
|
import {
|
|
13
13
|
createStore,
|
|
14
14
|
getEffectiveConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-F4DNLDG7.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/list.ts
|
|
18
18
|
import * as clack from "@clack/prompts";
|
|
@@ -110,7 +110,7 @@ ${dirty.map((f) => ` ${f}`).join("\n")}`
|
|
|
110
110
|
},
|
|
111
111
|
onCreate: async () => {
|
|
112
112
|
if (repoRoot) {
|
|
113
|
-
const { createWorktree } = await import("./create-
|
|
113
|
+
const { createWorktree } = await import("./create-RWGSJRM5.js");
|
|
114
114
|
await createWorktree(void 0, { cwd: repoRoot, store });
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/commands/skill.ts
|
|
4
|
+
function printSkill() {
|
|
5
|
+
console.log('---\nname: wt-worktree-manager\ndescription: Use the wt CLI to create, browse, open, and delete git worktrees across repos. Use when the user asks to manage worktrees, create isolated branches, or configure worktree defaults.\n---\n\n# wt \u2014 Git Worktree Manager\n\n`wt` is a CLI for managing git worktrees. It provides an interactive TUI to browse, create, open in your IDE, and delete worktrees across multiple repos.\n\n## Commands\n\n### `wt` (no subcommand)\n\nLaunch the interactive TUI. Shows worktrees for the current repo (repo mode) or all registered repos (global mode, when run outside a repo).\n\n**Keybindings in the TUI:**\n\n- Arrow keys / `j`/`k` \u2014 navigate\n- `Enter` \u2014 open worktree in IDE\n- `d` \u2014 delete worktree\n- `c` \u2014 create new worktree (repo mode only)\n- `/` \u2014 search\n- `q` / `Esc` \u2014 quit\n\n### `wt create [branch]`\n\nCreate a new worktree. If `branch` is omitted, prompts interactively.\n\nThe worktree is created as a sibling directory to the repo: `<parent>/<repo-name>-<branch-name>`.\n\nAfter creation, `wt` runs any configured `setup_commands` and opens the worktree in your IDE.\n\nIf the worktree path already exists, `wt create` doesn\'t error \u2014 it prompts you\nto **open it in the IDE** or **quit**. (In a non-interactive shell it errors\nwith a non-zero exit instead of prompting.)\n\n### `wt agent <branch> <plan_prompt>`\n\nCreate a worktree (same as `wt create`) **and** auto-start an AI agent in Zed\'s\nintegrated terminal, pre-filled with `<plan_prompt>` and left interactive for\nyou to take over.\n\n```bash\nwt agent feature/login \'Read the codebase, then propose a plan for login.\'\n```\n\nIt writes a temporary `.zed/tasks.json` running\n`<agent_command> \'<plan_prompt>\'`, ensures a global Zed keymap chord\n(`agent_trigger_chord`) spawns that task, opens Zed, presses the chord via\n`osascript`, then removes the temporary task so the repo is left clean.\n\n**macOS + Zed only.** Requires Accessibility permission for the app that runs\n`wt` (Zed itself, when run from its integrated terminal). If it isn\'t granted,\n`wt agent` opens the *Privacy & Security \u2192 Accessibility* settings pane and waits\nfor you to grant it and confirm, then retries automatically. On other platforms\n(or when `ide` is not `zed`) the worktree is still created and opened, but the\nagent is not auto-started.\n\nOver SSH it still works, provided the same user has an active graphical login on\nthe Mac: the keystroke is sent via `launchctl asuser` so it reaches that GUI\nsession. With no one logged in graphically there is nothing to drive, so it\nfalls back to the manual "press the chord in Zed" message.\n\nIf the worktree path already exists, `wt agent` prompts you to **open it in the\nIDE**, **open it and start the agent**, or **quit** \u2014 instead of erroring. (In a\nnon-interactive shell it errors with a non-zero exit instead of prompting.)\n\n### `wt config`\n\nOpen the global config file in `$EDITOR` (defaults to `nano`).\n\n```bash\nwt config # open in editor\nwt config --path # print config file path only\n```\n\n### `wt skill`\n\nPrint this skill file to stdout. Useful for piping to agents or copying to a project.\n\n## Configuration\n\nConfig is stored as JSON. Get the path with `wt config --path`.\n\n### Schema\n\n| Key | Type | Default | Description |\n| ---------------- | ---------- | --------------- | ------------------------------------------------------------------------- |\n| `worktree_path` | `string` | `"../"` | Where to place new worktrees, relative to the repo root |\n| `base_branch` | `string` | `"origin/main"` | Branch to base new worktrees on |\n| `setup_commands` | `string[]` | `[]` | Commands to run in a new worktree after creation (e.g. `["npm install"]`) |\n| `ide` | `string` | `"zed"` | IDE command to open worktrees with |\n| `ide_open_args` | `string[]` | `["-n"]` | Arguments passed to the IDE command |\n| `agent_command` | `string` | `"claude --permission-mode plan"` | Command `wt agent` runs in Zed; `<plan_prompt>` is appended single-quoted |\n| `agent_trigger_chord` | `string` | `"ctrl-shift-cmd-c"` | Zed keymap chord `wt agent` installs/presses to spawn the agent task |\n| `repos` | `string[]` | `[]` | Registered repo paths (auto-populated on first use) |\n| `repo_overrides` | `object` | `{}` | Per-repo config overrides (see below) |\n\n### Per-repo overrides\n\nOverride any field (`worktree_path`, `base_branch`, `setup_commands`, `ide`, `ide_open_args`, `agent_command`, `agent_trigger_chord`) for a specific repo:\n\n```json\n{\n "base_branch": "origin/main",\n "ide": "zed",\n "repo_overrides": {\n "/path/to/my-repo": {\n "base_branch": "origin/develop",\n "setup_commands": ["npm install", "npm run build"]\n }\n }\n}\n```\n\n## Common workflows\n\n### Create a worktree for a new feature\n\n```bash\ncd /path/to/repo\nwt create feature/my-branch\n```\n\n### Configure setup commands for a repo\n\n```bash\nwt config\n# Then add to the JSON:\n# "repo_overrides": {\n# "/path/to/repo": {\n# "setup_commands": ["npm install"]\n# }\n# }\n```\n\n### Browse all worktrees across repos\n\nRun `wt` from any directory outside a git repo to see worktrees from all registered repos.\n');
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
printSkill
|
|
9
|
+
};
|
package/package.json
CHANGED
package/dist/chunk-IQWENLPW.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/lib/config.ts
|
|
4
|
-
import Conf from "conf";
|
|
5
|
-
var DEFAULT_CONFIG = {
|
|
6
|
-
worktree_path: "../",
|
|
7
|
-
base_branch: "origin/main",
|
|
8
|
-
setup_commands: [],
|
|
9
|
-
ide: "zed",
|
|
10
|
-
ide_open_args: ["-n"],
|
|
11
|
-
agent_command: "claude --permission-mode plan",
|
|
12
|
-
agent_trigger_chord: "ctrl-shift-cmd-c",
|
|
13
|
-
repos: [],
|
|
14
|
-
repo_overrides: {}
|
|
15
|
-
};
|
|
16
|
-
function createStore(cwd) {
|
|
17
|
-
return new Conf({
|
|
18
|
-
projectName: "wt",
|
|
19
|
-
defaults: DEFAULT_CONFIG,
|
|
20
|
-
...cwd ? { cwd } : {}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function getGlobalConfig(store = createStore()) {
|
|
24
|
-
return store.store;
|
|
25
|
-
}
|
|
26
|
-
function getEffectiveConfig(repoPath, store = createStore()) {
|
|
27
|
-
const {
|
|
28
|
-
repos: _repos,
|
|
29
|
-
repo_overrides,
|
|
30
|
-
...repoFields
|
|
31
|
-
} = getGlobalConfig(store);
|
|
32
|
-
const override = repo_overrides[repoPath] ?? {};
|
|
33
|
-
return { ...repoFields, ...override };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
createStore,
|
|
38
|
-
getGlobalConfig,
|
|
39
|
-
getEffectiveConfig
|
|
40
|
-
};
|
package/dist/skill-RR6MNLWH.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/commands/skill.ts
|
|
4
|
-
function printSkill() {
|
|
5
|
-
console.log('---\nname: wt-worktree-manager\ndescription: Use the wt CLI to create, browse, open, and delete git worktrees across repos. Use when the user asks to manage worktrees, create isolated branches, or configure worktree defaults.\n---\n\n# wt \u2014 Git Worktree Manager\n\n`wt` is a CLI for managing git worktrees. It provides an interactive TUI to browse, create, open in your IDE, and delete worktrees across multiple repos.\n\n## Commands\n\n### `wt` (no subcommand)\n\nLaunch the interactive TUI. Shows worktrees for the current repo (repo mode) or all registered repos (global mode, when run outside a repo).\n\n**Keybindings in the TUI:**\n\n- Arrow keys / `j`/`k` \u2014 navigate\n- `Enter` \u2014 open worktree in IDE\n- `d` \u2014 delete worktree\n- `c` \u2014 create new worktree (repo mode only)\n- `/` \u2014 search\n- `q` / `Esc` \u2014 quit\n\n### `wt create [branch]`\n\nCreate a new worktree. If `branch` is omitted, prompts interactively.\n\nThe worktree is created as a sibling directory to the repo: `<parent>/<repo-name>-<branch-name>`.\n\nAfter creation, `wt` runs any configured `setup_commands` and opens the worktree in your IDE.\n\nIf the worktree path already exists, `wt create` doesn\'t error \u2014 it prompts you\nto **open it in the IDE** or **quit**. (In a non-interactive shell it errors\nwith a non-zero exit instead of prompting.)\n\n### `wt agent <branch> <plan_prompt>`\n\nCreate a worktree (same as `wt create`) **and** auto-start an AI agent in Zed\'s\nintegrated terminal, pre-filled with `<plan_prompt>` and left interactive for\nyou to take over.\n\n```bash\nwt agent feature/login \'Read the codebase, then propose a plan for login.\'\n```\n\nIt writes a temporary `.zed/tasks.json` running\n`<agent_command> \'<plan_prompt>\'`, ensures a global Zed keymap chord\n(`agent_trigger_chord`) spawns that task, opens Zed, presses the chord via\n`osascript`, then removes the temporary task so the repo is left clean.\n\n**macOS + Zed only.** Requires Accessibility permission for the app that runs\n`wt` (Zed itself, when run from its integrated terminal). If it isn\'t granted,\n`wt agent` opens the *Privacy & Security \u2192 Accessibility* settings pane and waits\nfor you to grant it and confirm, then retries automatically. On other platforms\n(or when `ide` is not `zed`) the worktree is still created and opened, but the\nagent is not auto-started.\n\nIf the worktree path already exists, `wt agent` prompts you to **open it in the\nIDE**, **open it and start the agent**, or **quit** \u2014 instead of erroring. (In a\nnon-interactive shell it errors with a non-zero exit instead of prompting.)\n\n### `wt config`\n\nOpen the global config file in `$EDITOR` (defaults to `nano`).\n\n```bash\nwt config # open in editor\nwt config --path # print config file path only\n```\n\n### `wt skill`\n\nPrint this skill file to stdout. Useful for piping to agents or copying to a project.\n\n## Configuration\n\nConfig is stored as JSON. Get the path with `wt config --path`.\n\n### Schema\n\n| Key | Type | Default | Description |\n| ---------------- | ---------- | --------------- | ------------------------------------------------------------------------- |\n| `worktree_path` | `string` | `"../"` | Where to place new worktrees, relative to the repo root |\n| `base_branch` | `string` | `"origin/main"` | Branch to base new worktrees on |\n| `setup_commands` | `string[]` | `[]` | Commands to run in a new worktree after creation (e.g. `["npm install"]`) |\n| `ide` | `string` | `"zed"` | IDE command to open worktrees with |\n| `ide_open_args` | `string[]` | `["-n"]` | Arguments passed to the IDE command |\n| `agent_command` | `string` | `"claude --permission-mode plan"` | Command `wt agent` runs in Zed; `<plan_prompt>` is appended single-quoted |\n| `agent_trigger_chord` | `string` | `"ctrl-shift-cmd-c"` | Zed keymap chord `wt agent` installs/presses to spawn the agent task |\n| `repos` | `string[]` | `[]` | Registered repo paths (auto-populated on first use) |\n| `repo_overrides` | `object` | `{}` | Per-repo config overrides (see below) |\n\n### Per-repo overrides\n\nOverride any field (`worktree_path`, `base_branch`, `setup_commands`, `ide`, `ide_open_args`, `agent_command`, `agent_trigger_chord`) for a specific repo:\n\n```json\n{\n "base_branch": "origin/main",\n "ide": "zed",\n "repo_overrides": {\n "/path/to/my-repo": {\n "base_branch": "origin/develop",\n "setup_commands": ["npm install", "npm run build"]\n }\n }\n}\n```\n\n## Common workflows\n\n### Create a worktree for a new feature\n\n```bash\ncd /path/to/repo\nwt create feature/my-branch\n```\n\n### Configure setup commands for a repo\n\n```bash\nwt config\n# Then add to the JSON:\n# "repo_overrides": {\n# "/path/to/repo": {\n# "setup_commands": ["npm install"]\n# }\n# }\n```\n\n### Browse all worktrees across repos\n\nRun `wt` from any directory outside a git repo to see worktrees from all registered repos.\n');
|
|
6
|
-
}
|
|
7
|
-
export {
|
|
8
|
-
printSkill
|
|
9
|
-
};
|