@aku11i/phantom 0.8.1 → 0.9.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/dist/phantom.js +236 -7
- package/dist/phantom.js.map +4 -4
- package/package.json +1 -1
package/dist/phantom.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/bin/phantom.ts
|
|
4
|
-
import { argv, exit } from "node:process";
|
|
4
|
+
import { argv, exit as exit2 } from "node:process";
|
|
5
5
|
|
|
6
6
|
// src/cli/handlers/attach.ts
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
@@ -418,6 +418,198 @@ async function attachHandler(args2) {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
// src/cli/handlers/completion.ts
|
|
422
|
+
import { exit } from "node:process";
|
|
423
|
+
var FISH_COMPLETION_SCRIPT = `# Fish completion for phantom
|
|
424
|
+
# Place this in ~/.config/fish/completions/phantom.fish
|
|
425
|
+
|
|
426
|
+
function __phantom_list_worktrees
|
|
427
|
+
phantom list --names 2>/dev/null
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
function __phantom_using_command
|
|
431
|
+
set -l cmd (commandline -opc)
|
|
432
|
+
set -l cmd_count (count $cmd)
|
|
433
|
+
if test $cmd_count -eq 1
|
|
434
|
+
# No subcommand yet, so any command can be used
|
|
435
|
+
if test (count $argv) -eq 0
|
|
436
|
+
return 0
|
|
437
|
+
else
|
|
438
|
+
return 1
|
|
439
|
+
end
|
|
440
|
+
else if test $cmd_count -ge 2
|
|
441
|
+
# Check if we're in the context of a specific command
|
|
442
|
+
if test (count $argv) -gt 0 -a "$argv[1]" = "$cmd[2]"
|
|
443
|
+
return 0
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
return 1
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
# Disable file completion for phantom
|
|
450
|
+
complete -c phantom -f
|
|
451
|
+
|
|
452
|
+
# Main commands
|
|
453
|
+
complete -c phantom -n "__phantom_using_command" -a "create" -d "Create a new Git worktree (phantom)"
|
|
454
|
+
complete -c phantom -n "__phantom_using_command" -a "attach" -d "Attach to an existing branch by creating a new worktree"
|
|
455
|
+
complete -c phantom -n "__phantom_using_command" -a "list" -d "List all Git worktrees (phantoms)"
|
|
456
|
+
complete -c phantom -n "__phantom_using_command" -a "where" -d "Output the filesystem path of a specific worktree"
|
|
457
|
+
complete -c phantom -n "__phantom_using_command" -a "delete" -d "Delete a Git worktree (phantom)"
|
|
458
|
+
complete -c phantom -n "__phantom_using_command" -a "exec" -d "Execute a command in a worktree directory"
|
|
459
|
+
complete -c phantom -n "__phantom_using_command" -a "shell" -d "Open an interactive shell in a worktree directory"
|
|
460
|
+
complete -c phantom -n "__phantom_using_command" -a "version" -d "Display phantom version information"
|
|
461
|
+
complete -c phantom -n "__phantom_using_command" -a "completion" -d "Generate shell completion scripts"
|
|
462
|
+
|
|
463
|
+
# Global options
|
|
464
|
+
complete -c phantom -l help -d "Show help (-h)"
|
|
465
|
+
complete -c phantom -l version -d "Show version (-v)"
|
|
466
|
+
|
|
467
|
+
# create command options
|
|
468
|
+
complete -c phantom -n "__phantom_using_command create" -l shell -d "Open an interactive shell in the new worktree after creation (-s)"
|
|
469
|
+
complete -c phantom -n "__phantom_using_command create" -l exec -d "Execute a command in the new worktree after creation (-x)" -x
|
|
470
|
+
complete -c phantom -n "__phantom_using_command create" -l tmux -d "Open the worktree in a new tmux window (-t)"
|
|
471
|
+
complete -c phantom -n "__phantom_using_command create" -l tmux-vertical -d "Open the worktree in a vertical tmux pane"
|
|
472
|
+
complete -c phantom -n "__phantom_using_command create" -l tmux-horizontal -d "Open the worktree in a horizontal tmux pane"
|
|
473
|
+
complete -c phantom -n "__phantom_using_command create" -l copy-file -d "Copy specified files from the current worktree" -r
|
|
474
|
+
|
|
475
|
+
# attach command options
|
|
476
|
+
complete -c phantom -n "__phantom_using_command attach" -l shell -d "Open an interactive shell in the worktree after attaching (-s)"
|
|
477
|
+
complete -c phantom -n "__phantom_using_command attach" -l exec -d "Execute a command in the worktree after attaching (-x)" -x
|
|
478
|
+
|
|
479
|
+
# list command options
|
|
480
|
+
complete -c phantom -n "__phantom_using_command list" -l fzf -d "Use fzf for interactive selection"
|
|
481
|
+
complete -c phantom -n "__phantom_using_command list" -l names -d "Output only phantom names (for scripts and completion)"
|
|
482
|
+
|
|
483
|
+
# where command options
|
|
484
|
+
complete -c phantom -n "__phantom_using_command where" -l fzf -d "Use fzf for interactive selection"
|
|
485
|
+
complete -c phantom -n "__phantom_using_command where" -a "(__phantom_list_worktrees)"
|
|
486
|
+
|
|
487
|
+
# delete command options
|
|
488
|
+
complete -c phantom -n "__phantom_using_command delete" -l force -d "Force deletion even if worktree has uncommitted changes (-f)"
|
|
489
|
+
complete -c phantom -n "__phantom_using_command delete" -l current -d "Delete the current worktree"
|
|
490
|
+
complete -c phantom -n "__phantom_using_command delete" -l fzf -d "Use fzf for interactive selection"
|
|
491
|
+
complete -c phantom -n "__phantom_using_command delete" -a "(__phantom_list_worktrees)"
|
|
492
|
+
|
|
493
|
+
# exec command - accept worktree names and then any command
|
|
494
|
+
complete -c phantom -n "__phantom_using_command exec" -a "(__phantom_list_worktrees)"
|
|
495
|
+
|
|
496
|
+
# shell command options
|
|
497
|
+
complete -c phantom -n "__phantom_using_command shell" -l fzf -d "Use fzf for interactive selection"
|
|
498
|
+
complete -c phantom -n "__phantom_using_command shell" -a "(__phantom_list_worktrees)"
|
|
499
|
+
|
|
500
|
+
# completion command - shell names
|
|
501
|
+
complete -c phantom -n "__phantom_using_command completion" -a "fish zsh" -d "Shell type"`;
|
|
502
|
+
var ZSH_COMPLETION_SCRIPT = `#compdef phantom
|
|
503
|
+
# Zsh completion for phantom
|
|
504
|
+
# Place this in a directory in your $fpath (e.g., ~/.zsh/completions/)
|
|
505
|
+
# Or load dynamically with: eval "$(phantom completion zsh)"
|
|
506
|
+
|
|
507
|
+
# Only define the function, don't execute it
|
|
508
|
+
_phantom() {
|
|
509
|
+
local -a commands
|
|
510
|
+
commands=(
|
|
511
|
+
'create:Create a new Git worktree (phantom)'
|
|
512
|
+
'attach:Attach to an existing branch by creating a new worktree'
|
|
513
|
+
'list:List all Git worktrees (phantoms)'
|
|
514
|
+
'where:Output the filesystem path of a specific worktree'
|
|
515
|
+
'delete:Delete a Git worktree (phantom)'
|
|
516
|
+
'exec:Execute a command in a worktree directory'
|
|
517
|
+
'shell:Open an interactive shell in a worktree directory'
|
|
518
|
+
'version:Display phantom version information'
|
|
519
|
+
'completion:Generate shell completion scripts'
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
_arguments -C \\
|
|
523
|
+
'--help[Show help (-h)]' \\
|
|
524
|
+
'--version[Show version (-v)]' \\
|
|
525
|
+
'1:command:->command' \\
|
|
526
|
+
'*::arg:->args'
|
|
527
|
+
|
|
528
|
+
case \${state} in
|
|
529
|
+
command)
|
|
530
|
+
_describe 'phantom command' commands
|
|
531
|
+
;;
|
|
532
|
+
args)
|
|
533
|
+
case \${line[1]} in
|
|
534
|
+
create)
|
|
535
|
+
_arguments \\
|
|
536
|
+
'--shell[Open an interactive shell in the new worktree after creation (-s)]' \\
|
|
537
|
+
'--exec[Execute a command in the new worktree after creation (-x)]:command:' \\
|
|
538
|
+
'--tmux[Open the worktree in a new tmux window (-t)]' \\
|
|
539
|
+
'--tmux-vertical[Open the worktree in a vertical tmux pane]' \\
|
|
540
|
+
'--tmux-horizontal[Open the worktree in a horizontal tmux pane]' \\
|
|
541
|
+
'*--copy-file[Copy specified files from the current worktree]:file:_files' \\
|
|
542
|
+
'1:name:'
|
|
543
|
+
;;
|
|
544
|
+
attach)
|
|
545
|
+
_arguments \\
|
|
546
|
+
'--shell[Open an interactive shell in the worktree after attaching (-s)]' \\
|
|
547
|
+
'--exec[Execute a command in the worktree after attaching (-x)]:command:' \\
|
|
548
|
+
'1:worktree-name:' \\
|
|
549
|
+
'2:branch-name:'
|
|
550
|
+
;;
|
|
551
|
+
list)
|
|
552
|
+
_arguments \\
|
|
553
|
+
'--fzf[Use fzf for interactive selection]' \\
|
|
554
|
+
'--names[Output only phantom names (for scripts and completion)]'
|
|
555
|
+
;;
|
|
556
|
+
where|delete|shell)
|
|
557
|
+
local worktrees
|
|
558
|
+
worktrees=(\${(f)"$(phantom list --names 2>/dev/null)"})
|
|
559
|
+
if [[ \${line[1]} == "where" || \${line[1]} == "shell" ]]; then
|
|
560
|
+
_arguments \\
|
|
561
|
+
'--fzf[Use fzf for interactive selection]' \\
|
|
562
|
+
'1:worktree:(\${(q)worktrees[@]})'
|
|
563
|
+
elif [[ \${line[1]} == "delete" ]]; then
|
|
564
|
+
_arguments \\
|
|
565
|
+
'--force[Force deletion even if worktree has uncommitted changes (-f)]' \\
|
|
566
|
+
'--current[Delete the current worktree]' \\
|
|
567
|
+
'--fzf[Use fzf for interactive selection]' \\
|
|
568
|
+
'1:worktree:(\${(q)worktrees[@]})'
|
|
569
|
+
fi
|
|
570
|
+
;;
|
|
571
|
+
exec)
|
|
572
|
+
local worktrees
|
|
573
|
+
worktrees=(\${(f)"$(phantom list --names 2>/dev/null)"})
|
|
574
|
+
_arguments \\
|
|
575
|
+
'1:worktree:(\${(q)worktrees[@]})' \\
|
|
576
|
+
'*:command:_command_names'
|
|
577
|
+
;;
|
|
578
|
+
completion)
|
|
579
|
+
_arguments \\
|
|
580
|
+
'1:shell:(fish zsh)'
|
|
581
|
+
;;
|
|
582
|
+
esac
|
|
583
|
+
;;
|
|
584
|
+
esac
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
# Register the completion function if loading dynamically
|
|
588
|
+
if [[ -n \${ZSH_VERSION} ]]; then
|
|
589
|
+
autoload -Uz compinit && compinit -C
|
|
590
|
+
compdef _phantom phantom
|
|
591
|
+
fi`;
|
|
592
|
+
function completionHandler(args2) {
|
|
593
|
+
const shell = args2[0];
|
|
594
|
+
if (!shell) {
|
|
595
|
+
output.error("Usage: phantom completion <shell>");
|
|
596
|
+
output.error("Supported shells: fish, zsh");
|
|
597
|
+
exit(1);
|
|
598
|
+
}
|
|
599
|
+
switch (shell.toLowerCase()) {
|
|
600
|
+
case "fish":
|
|
601
|
+
console.log(FISH_COMPLETION_SCRIPT);
|
|
602
|
+
break;
|
|
603
|
+
case "zsh":
|
|
604
|
+
console.log(ZSH_COMPLETION_SCRIPT);
|
|
605
|
+
break;
|
|
606
|
+
default:
|
|
607
|
+
output.error(`Unsupported shell: ${shell}`);
|
|
608
|
+
output.error("Supported shells: fish, zsh");
|
|
609
|
+
exit(1);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
421
613
|
// src/cli/handlers/create.ts
|
|
422
614
|
import { parseArgs as parseArgs2 } from "node:util";
|
|
423
615
|
|
|
@@ -1399,7 +1591,7 @@ import { parseArgs as parseArgs7 } from "node:util";
|
|
|
1399
1591
|
var package_default = {
|
|
1400
1592
|
name: "@aku11i/phantom",
|
|
1401
1593
|
packageManager: "pnpm@10.8.1",
|
|
1402
|
-
version: "0.
|
|
1594
|
+
version: "0.9.0",
|
|
1403
1595
|
description: "A powerful CLI tool for managing Git worktrees for parallel development",
|
|
1404
1596
|
keywords: [
|
|
1405
1597
|
"git",
|
|
@@ -1729,6 +1921,37 @@ var attachHelp = {
|
|
|
1729
1921
|
]
|
|
1730
1922
|
};
|
|
1731
1923
|
|
|
1924
|
+
// src/cli/help/completion.ts
|
|
1925
|
+
var completionHelp = {
|
|
1926
|
+
name: "completion",
|
|
1927
|
+
usage: "phantom completion <shell>",
|
|
1928
|
+
description: "Generate shell completion scripts for fish or zsh",
|
|
1929
|
+
examples: [
|
|
1930
|
+
{
|
|
1931
|
+
command: "phantom completion fish > ~/.config/fish/completions/phantom.fish",
|
|
1932
|
+
description: "Generate and install Fish completion"
|
|
1933
|
+
},
|
|
1934
|
+
{
|
|
1935
|
+
command: "phantom completion fish | source",
|
|
1936
|
+
description: "Load Fish completion in current session"
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
command: "phantom completion zsh > ~/.zsh/completions/_phantom",
|
|
1940
|
+
description: "Generate and install Zsh completion"
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
command: 'eval "$(phantom completion zsh)"',
|
|
1944
|
+
description: "Load Zsh completion in current session"
|
|
1945
|
+
}
|
|
1946
|
+
],
|
|
1947
|
+
notes: [
|
|
1948
|
+
"Supported shells: fish, zsh",
|
|
1949
|
+
"After installing completions, you may need to restart your shell or source the completion file",
|
|
1950
|
+
"For Fish: completions are loaded automatically from ~/.config/fish/completions/",
|
|
1951
|
+
"For Zsh: ensure the completion file is in a directory in your $fpath"
|
|
1952
|
+
]
|
|
1953
|
+
};
|
|
1954
|
+
|
|
1732
1955
|
// src/cli/help/create.ts
|
|
1733
1956
|
var createHelp = {
|
|
1734
1957
|
name: "create",
|
|
@@ -2044,6 +2267,12 @@ var commands = [
|
|
|
2044
2267
|
description: "Display phantom version information",
|
|
2045
2268
|
handler: versionHandler,
|
|
2046
2269
|
help: versionHelp
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
name: "completion",
|
|
2273
|
+
description: "Generate shell completion scripts",
|
|
2274
|
+
handler: completionHandler,
|
|
2275
|
+
help: completionHelp
|
|
2047
2276
|
}
|
|
2048
2277
|
];
|
|
2049
2278
|
function printHelp(commands2) {
|
|
@@ -2076,18 +2305,18 @@ function findCommand(args2, commands2) {
|
|
|
2076
2305
|
var args = argv.slice(2);
|
|
2077
2306
|
if (args.length === 0 || args[0] === "-h" || args[0] === "--help") {
|
|
2078
2307
|
printHelp(commands);
|
|
2079
|
-
|
|
2308
|
+
exit2(0);
|
|
2080
2309
|
}
|
|
2081
2310
|
if (args[0] === "--version" || args[0] === "-v") {
|
|
2082
2311
|
versionHandler();
|
|
2083
|
-
|
|
2312
|
+
exit2(0);
|
|
2084
2313
|
}
|
|
2085
2314
|
var { command, remainingArgs } = findCommand(args, commands);
|
|
2086
2315
|
if (!command || !command.handler) {
|
|
2087
2316
|
console.error(`Error: Unknown command '${args.join(" ")}'
|
|
2088
2317
|
`);
|
|
2089
2318
|
printHelp(commands);
|
|
2090
|
-
|
|
2319
|
+
exit2(1);
|
|
2091
2320
|
}
|
|
2092
2321
|
if (remainingArgs.includes("--help") || remainingArgs.includes("-h")) {
|
|
2093
2322
|
if (command.help) {
|
|
@@ -2095,7 +2324,7 @@ if (remainingArgs.includes("--help") || remainingArgs.includes("-h")) {
|
|
|
2095
2324
|
} else {
|
|
2096
2325
|
console.log(`Help not available for command '${command.name}'`);
|
|
2097
2326
|
}
|
|
2098
|
-
|
|
2327
|
+
exit2(0);
|
|
2099
2328
|
}
|
|
2100
2329
|
try {
|
|
2101
2330
|
await command.handler(remainingArgs);
|
|
@@ -2104,6 +2333,6 @@ try {
|
|
|
2104
2333
|
"Error:",
|
|
2105
2334
|
error instanceof Error ? error.message : String(error)
|
|
2106
2335
|
);
|
|
2107
|
-
|
|
2336
|
+
exit2(1);
|
|
2108
2337
|
}
|
|
2109
2338
|
//# sourceMappingURL=phantom.js.map
|
package/dist/phantom.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/bin/phantom.ts", "../src/cli/handlers/attach.ts", "../src/core/git/libs/get-git-root.ts", "../src/core/git/executor.ts", "../src/core/types/result.ts", "../src/core/worktree/errors.ts", "../src/core/worktree/validate.ts", "../src/core/paths.ts", "../src/core/process/spawn.ts", "../src/core/process/errors.ts", "../src/core/process/exec.ts", "../src/core/process/shell.ts", "../src/core/worktree/attach.ts", "../src/core/git/libs/attach-worktree.ts", "../src/core/git/libs/branch-exists.ts", "../src/cli/output.ts", "../src/cli/errors.ts", "../src/cli/handlers/create.ts", "../src/core/config/loader.ts", "../src/core/utils/type-guards.ts", "../src/core/config/validate.ts", "../src/core/process/tmux.ts", "../src/core/worktree/create.ts", "../src/core/git/libs/add-worktree.ts", "../src/core/worktree/file-copier.ts", "../src/cli/handlers/delete.ts", "../src/core/git/libs/list-worktrees.ts", "../src/core/git/libs/get-current-worktree.ts", "../src/core/worktree/delete.ts", "../src/core/utils/fzf.ts", "../src/core/worktree/list.ts", "../src/core/worktree/select.ts", "../src/cli/handlers/exec.ts", "../src/cli/handlers/list.ts", "../src/cli/handlers/shell.ts", "../src/cli/handlers/version.ts", "../package.json", "../src/core/version.ts", "../src/cli/handlers/where.ts", "../src/core/worktree/where.ts", "../src/cli/help.ts", "../src/cli/help/attach.ts", "../src/cli/help/create.ts", "../src/cli/help/delete.ts", "../src/cli/help/exec.ts", "../src/cli/help/list.ts", "../src/cli/help/shell.ts", "../src/cli/help/version.ts", "../src/cli/help/where.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n\nimport { argv, exit } from \"node:process\";\nimport { attachHandler } from \"../cli/handlers/attach.ts\";\nimport { createHandler } from \"../cli/handlers/create.ts\";\nimport { deleteHandler } from \"../cli/handlers/delete.ts\";\nimport { execHandler } from \"../cli/handlers/exec.ts\";\nimport { listHandler } from \"../cli/handlers/list.ts\";\nimport { shellHandler } from \"../cli/handlers/shell.ts\";\nimport { versionHandler } from \"../cli/handlers/version.ts\";\nimport { whereHandler } from \"../cli/handlers/where.ts\";\nimport { type CommandHelp, helpFormatter } from \"../cli/help.ts\";\nimport { attachHelp } from \"../cli/help/attach.ts\";\nimport { createHelp } from \"../cli/help/create.ts\";\nimport { deleteHelp } from \"../cli/help/delete.ts\";\nimport { execHelp } from \"../cli/help/exec.ts\";\nimport { listHelp } from \"../cli/help/list.ts\";\nimport { shellHelp } from \"../cli/help/shell.ts\";\nimport { versionHelp } from \"../cli/help/version.ts\";\nimport { whereHelp } from \"../cli/help/where.ts\";\n\ninterface Command {\n name: string;\n description: string;\n subcommands?: Command[];\n handler?: (args: string[]) => void | Promise<void>;\n help?: CommandHelp;\n}\n\nconst commands: Command[] = [\n {\n name: \"create\",\n description: \"Create a new Git worktree (phantom)\",\n handler: createHandler,\n help: createHelp,\n },\n {\n name: \"attach\",\n description: \"Attach to an existing branch by creating a new worktree\",\n handler: attachHandler,\n help: attachHelp,\n },\n {\n name: \"list\",\n description: \"List all Git worktrees (phantoms)\",\n handler: listHandler,\n help: listHelp,\n },\n {\n name: \"where\",\n description: \"Output the filesystem path of a specific worktree\",\n handler: whereHandler,\n help: whereHelp,\n },\n {\n name: \"delete\",\n description: \"Delete a Git worktree (phantom)\",\n handler: deleteHandler,\n help: deleteHelp,\n },\n {\n name: \"exec\",\n description: \"Execute a command in a worktree directory\",\n handler: execHandler,\n help: execHelp,\n },\n {\n name: \"shell\",\n description: \"Open an interactive shell in a worktree directory\",\n handler: shellHandler,\n help: shellHelp,\n },\n {\n name: \"version\",\n description: \"Display phantom version information\",\n handler: versionHandler,\n help: versionHelp,\n },\n];\n\nfunction printHelp(commands: Command[]) {\n const simpleCommands = commands.map((cmd) => ({\n name: cmd.name,\n description: cmd.description,\n }));\n console.log(helpFormatter.formatMainHelp(simpleCommands));\n}\n\nfunction findCommand(\n args: string[],\n commands: Command[],\n): { command: Command | null; remainingArgs: string[] } {\n if (args.length === 0) {\n return { command: null, remainingArgs: [] };\n }\n\n const [cmdName, ...rest] = args;\n const command = commands.find((cmd) => cmd.name === cmdName);\n\n if (!command) {\n return { command: null, remainingArgs: args };\n }\n\n if (command.subcommands && rest.length > 0) {\n const { command: subcommand, remainingArgs } = findCommand(\n rest,\n command.subcommands,\n );\n if (subcommand) {\n return { command: subcommand, remainingArgs };\n }\n }\n\n return { command, remainingArgs: rest };\n}\n\nconst args = argv.slice(2);\n\nif (args.length === 0 || args[0] === \"-h\" || args[0] === \"--help\") {\n printHelp(commands);\n exit(0);\n}\n\nif (args[0] === \"--version\" || args[0] === \"-v\") {\n versionHandler();\n exit(0);\n}\n\nconst { command, remainingArgs } = findCommand(args, commands);\n\nif (!command || !command.handler) {\n console.error(`Error: Unknown command '${args.join(\" \")}'\\n`);\n printHelp(commands);\n exit(1);\n}\n\n// Check if user is requesting help for a specific command\nif (remainingArgs.includes(\"--help\") || remainingArgs.includes(\"-h\")) {\n if (command.help) {\n console.log(helpFormatter.formatCommandHelp(command.help));\n } else {\n console.log(`Help not available for command '${command.name}'`);\n }\n exit(0);\n}\n\ntry {\n await command.handler(remainingArgs);\n} catch (error) {\n console.error(\n \"Error:\",\n error instanceof Error ? error.message : String(error),\n );\n exit(1);\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree } from \"../../core/process/exec.ts\";\nimport { shellInWorktree } from \"../../core/process/shell.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { attachWorktreeCore } from \"../../core/worktree/attach.ts\";\nimport {\n BranchNotFoundError,\n WorktreeAlreadyExistsError,\n} from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function attachHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n strict: true,\n allowPositionals: true,\n options: {\n shell: {\n type: \"boolean\",\n short: \"s\",\n },\n exec: {\n type: \"string\",\n short: \"e\",\n },\n },\n });\n\n if (positionals.length === 0) {\n exitWithError(\n \"Missing required argument: branch name\",\n exitCodes.validationError,\n );\n }\n\n const [branchName] = positionals;\n\n if (values.shell && values.exec) {\n exitWithError(\n \"Cannot use both --shell and --exec options\",\n exitCodes.validationError,\n );\n }\n\n const gitRoot = await getGitRoot();\n const result = await attachWorktreeCore(gitRoot, branchName);\n\n if (isErr(result)) {\n const error = result.error;\n if (error instanceof WorktreeAlreadyExistsError) {\n exitWithError(error.message, exitCodes.validationError);\n }\n if (error instanceof BranchNotFoundError) {\n exitWithError(error.message, exitCodes.notFound);\n }\n exitWithError(error.message, exitCodes.generalError);\n }\n\n const worktreePath = result.value;\n output.log(`Attached phantom: ${branchName}`);\n\n if (values.shell) {\n const shellResult = await shellInWorktree(gitRoot, branchName);\n if (isErr(shellResult)) {\n exitWithError(shellResult.error.message, exitCodes.generalError);\n }\n } else if (values.exec) {\n const execResult = await execInWorktree(\n gitRoot,\n branchName,\n values.exec.split(\" \"),\n { interactive: true },\n );\n if (isErr(execResult)) {\n exitWithError(execResult.error.message, exitCodes.generalError);\n }\n }\n}\n", "import { dirname, resolve } from \"node:path\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function getGitRoot(): Promise<string> {\n const { stdout } = await executeGitCommand([\"rev-parse\", \"--git-common-dir\"]);\n\n if (stdout.endsWith(\"/.git\") || stdout === \".git\") {\n return resolve(process.cwd(), dirname(stdout));\n }\n\n const { stdout: toplevel } = await executeGitCommand([\n \"rev-parse\",\n \"--show-toplevel\",\n ]);\n return toplevel;\n}\n", "import { execFile as execFileCallback } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFile = promisify(execFileCallback);\n\nexport interface GitExecutorOptions {\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n}\n\nexport interface GitExecutorResult {\n stdout: string;\n stderr: string;\n}\n\n/**\n * Execute a git command with consistent error handling\n */\nexport async function executeGitCommand(\n args: string[],\n options: GitExecutorOptions = {},\n): Promise<GitExecutorResult> {\n try {\n const result = await execFile(\"git\", args, {\n cwd: options.cwd,\n env: options.env || process.env,\n encoding: \"utf8\",\n });\n\n return {\n stdout: result.stdout.trim(),\n stderr: result.stderr.trim(),\n };\n } catch (error) {\n // Git commands often return non-zero exit codes for normal operations\n // (e.g., `git diff` returns 1 when there are differences)\n // So we need to handle errors carefully\n if (\n error &&\n typeof error === \"object\" &&\n \"stdout\" in error &&\n \"stderr\" in error\n ) {\n const execError = error as {\n stdout: string;\n stderr: string;\n code?: number;\n };\n\n // If we have stderr content, it's likely a real error\n if (execError.stderr?.trim()) {\n throw new Error(execError.stderr.trim());\n }\n\n // Otherwise, return the output even though the exit code was non-zero\n return {\n stdout: execError.stdout?.trim() || \"\",\n stderr: execError.stderr?.trim() || \"\",\n };\n }\n\n throw error;\n }\n}\n\n/**\n * Execute a git command in a specific directory\n */\nexport async function executeGitCommandInDirectory(\n directory: string,\n args: string[],\n): Promise<GitExecutorResult> {\n return executeGitCommand([\"-C\", directory, ...args], {});\n}\n", "/**\n * Represents a value that is either successful (Ok) or contains an error (Err).\n * This type is inspired by Rust's Result type and provides type-safe error handling.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value (defaults to Error)\n */\nexport type Result<T, E = Error> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/**\n * Creates a successful Result containing the given value.\n *\n * @template T - The type of the success value\n * @param value - The success value to wrap\n * @returns A Result in the Ok state containing the value\n *\n * @example\n * const result = ok(42);\n * // result: Result<number, never> = { ok: true, value: 42 }\n */\nexport const ok = <T>(value: T): Result<T, never> => ({\n ok: true,\n value,\n});\n\n/**\n * Creates a failed Result containing the given error.\n *\n * @template E - The type of the error value\n * @param error - The error value to wrap\n * @returns A Result in the Err state containing the error\n *\n * @example\n * const result = err(new Error(\"Something went wrong\"));\n * // result: Result<never, Error> = { ok: false, error: Error(...) }\n */\nexport const err = <E>(error: E): Result<never, E> => ({\n ok: false,\n error,\n});\n\n/**\n * Type guard that checks if a Result is in the Ok state.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value\n * @param result - The Result to check\n * @returns True if the Result is Ok, false otherwise\n *\n * @example\n * if (isOk(result)) {\n * console.log(result.value); // TypeScript knows result.value exists\n * }\n */\nexport const isOk = <T, E>(\n result: Result<T, E>,\n): result is { ok: true; value: T } => result.ok;\n\n/**\n * Type guard that checks if a Result is in the Err state.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value\n * @param result - The Result to check\n * @returns True if the Result is Err, false otherwise\n *\n * @example\n * if (isErr(result)) {\n * console.error(result.error); // TypeScript knows result.error exists\n * }\n */\nexport const isErr = <T, E>(\n result: Result<T, E>,\n): result is { ok: false; error: E } => !result.ok;\n", "export class WorktreeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"WorktreeError\";\n }\n}\n\nexport class WorktreeNotFoundError extends WorktreeError {\n constructor(name: string) {\n super(`Worktree '${name}' not found`);\n this.name = \"WorktreeNotFoundError\";\n }\n}\n\nexport class WorktreeAlreadyExistsError extends WorktreeError {\n constructor(name: string) {\n super(`Worktree '${name}' already exists`);\n this.name = \"WorktreeAlreadyExistsError\";\n }\n}\n\nexport class InvalidWorktreeNameError extends WorktreeError {\n constructor(name: string) {\n super(`Invalid worktree name: '${name}'`);\n this.name = \"InvalidWorktreeNameError\";\n }\n}\n\nexport class GitOperationError extends WorktreeError {\n constructor(operation: string, details: string) {\n super(`Git ${operation} failed: ${details}`);\n this.name = \"GitOperationError\";\n }\n}\n\nexport class BranchNotFoundError extends WorktreeError {\n constructor(branchName: string) {\n super(`Branch '${branchName}' not found`);\n this.name = \"BranchNotFoundError\";\n }\n}\n", "import fs from \"node:fs/promises\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface ValidationResult {\n exists: boolean;\n path?: string;\n message?: string;\n}\n\nexport async function validateWorktreeExists(\n gitRoot: string,\n name: string,\n): Promise<ValidationResult> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreePath);\n return {\n exists: true,\n path: worktreePath,\n };\n } catch {\n return {\n exists: false,\n message: `Worktree '${name}' does not exist`,\n };\n }\n}\n\nexport async function validateWorktreeDoesNotExist(\n gitRoot: string,\n name: string,\n): Promise<ValidationResult> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreePath);\n return {\n exists: true,\n message: `Worktree '${name}' already exists`,\n };\n } catch {\n return {\n exists: false,\n path: worktreePath,\n };\n }\n}\n\nexport async function validatePhantomDirectoryExists(\n gitRoot: string,\n): Promise<boolean> {\n const phantomDir = getPhantomDirectory(gitRoot);\n\n try {\n await fs.access(phantomDir);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function validateWorktreeName(name: string): Result<void, Error> {\n if (!name || name.trim() === \"\") {\n return err(new Error(\"Phantom name cannot be empty\"));\n }\n\n if (name.includes(\"/\")) {\n return err(new Error(\"Phantom name cannot contain slashes\"));\n }\n\n if (name.startsWith(\".\")) {\n return err(new Error(\"Phantom name cannot start with a dot\"));\n }\n\n return ok(undefined);\n}\n", "import { join } from \"node:path\";\n\nexport function getPhantomDirectory(gitRoot: string): string {\n return join(gitRoot, \".git\", \"phantom\", \"worktrees\");\n}\n\nexport function getWorktreePath(gitRoot: string, name: string): string {\n return join(getPhantomDirectory(gitRoot), name);\n}\n", "import {\n type ChildProcess,\n type SpawnOptions,\n spawn as nodeSpawn,\n} from \"node:child_process\";\nimport { type Result, err, ok } from \"../types/result.ts\";\nimport {\n type ProcessError,\n ProcessExecutionError,\n ProcessSignalError,\n ProcessSpawnError,\n} from \"./errors.ts\";\n\nexport interface SpawnSuccess {\n exitCode: number;\n}\n\nexport interface SpawnConfig {\n command: string;\n args?: string[];\n options?: SpawnOptions;\n}\n\nexport async function spawnProcess(\n config: SpawnConfig,\n): Promise<Result<SpawnSuccess, ProcessError>> {\n return new Promise((resolve) => {\n const { command, args = [], options = {} } = config;\n\n const childProcess: ChildProcess = nodeSpawn(command, args, {\n stdio: \"inherit\",\n ...options,\n });\n\n childProcess.on(\"error\", (error) => {\n resolve(err(new ProcessSpawnError(command, error.message)));\n });\n\n childProcess.on(\"exit\", (code, signal) => {\n if (signal) {\n resolve(err(new ProcessSignalError(signal)));\n } else {\n const exitCode = code ?? 0;\n if (exitCode === 0) {\n resolve(ok({ exitCode }));\n } else {\n resolve(err(new ProcessExecutionError(command, exitCode)));\n }\n }\n });\n });\n}\n", "export class ProcessError extends Error {\n public readonly exitCode?: number;\n\n constructor(message: string, exitCode?: number) {\n super(message);\n this.name = \"ProcessError\";\n this.exitCode = exitCode;\n }\n}\n\nexport class ProcessExecutionError extends ProcessError {\n constructor(command: string, exitCode: number) {\n super(`Command '${command}' failed with exit code ${exitCode}`, exitCode);\n this.name = \"ProcessExecutionError\";\n }\n}\n\nexport class ProcessSignalError extends ProcessError {\n constructor(signal: string) {\n const exitCode = 128 + (signal === \"SIGTERM\" ? 15 : 1);\n super(`Command terminated by signal: ${signal}`, exitCode);\n this.name = \"ProcessSignalError\";\n }\n}\n\nexport class ProcessSpawnError extends ProcessError {\n constructor(command: string, details: string) {\n super(`Error executing command '${command}': ${details}`);\n this.name = \"ProcessSpawnError\";\n }\n}\n", "import type { StdioOptions } from \"node:child_process\";\nimport { type Result, err } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"../worktree/errors.ts\";\nimport { validateWorktreeExists } from \"../worktree/validate.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type ExecInWorktreeSuccess = SpawnSuccess;\n\nexport interface ExecInWorktreeOptions {\n interactive?: boolean;\n}\n\nexport async function execInWorktree(\n gitRoot: string,\n worktreeName: string,\n command: string[],\n options: ExecInWorktreeOptions = {},\n): Promise<\n Result<ExecInWorktreeSuccess, WorktreeNotFoundError | ProcessError>\n> {\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(worktreeName));\n }\n\n const worktreePath = validation.path as string;\n const [cmd, ...args] = command;\n\n const stdio: StdioOptions = options.interactive\n ? \"inherit\"\n : [\"ignore\", \"inherit\", \"inherit\"];\n\n return spawnProcess({\n command: cmd,\n args,\n options: {\n cwd: worktreePath,\n stdio,\n },\n });\n}\n", "import { type Result, err } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"../worktree/errors.ts\";\nimport { validateWorktreeExists } from \"../worktree/validate.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type ShellInWorktreeSuccess = SpawnSuccess;\n\nexport async function shellInWorktree(\n gitRoot: string,\n worktreeName: string,\n): Promise<\n Result<ShellInWorktreeSuccess, WorktreeNotFoundError | ProcessError>\n> {\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(worktreeName));\n }\n\n const worktreePath = validation.path as string;\n const shell = process.env.SHELL || \"/bin/sh\";\n\n return spawnProcess({\n command: shell,\n args: [],\n options: {\n cwd: worktreePath,\n env: {\n ...process.env,\n PHANTOM: \"1\",\n PHANTOM_NAME: worktreeName,\n PHANTOM_PATH: worktreePath,\n },\n },\n });\n}\n", "import { existsSync } from \"node:fs\";\nimport { attachWorktree } from \"../git/libs/attach-worktree.ts\";\nimport { branchExists } from \"../git/libs/branch-exists.ts\";\nimport { getWorktreePath } from \"../paths.ts\";\nimport type { Result } from \"../types/result.ts\";\nimport { err, isErr, ok } from \"../types/result.ts\";\nimport { BranchNotFoundError, WorktreeAlreadyExistsError } from \"./errors.ts\";\nimport { validateWorktreeName } from \"./validate.ts\";\n\nexport async function attachWorktreeCore(\n gitRoot: string,\n name: string,\n): Promise<Result<string, Error>> {\n const validation = validateWorktreeName(name);\n if (isErr(validation)) {\n return validation;\n }\n\n const worktreePath = getWorktreePath(gitRoot, name);\n if (existsSync(worktreePath)) {\n return err(new WorktreeAlreadyExistsError(name));\n }\n\n const branchCheckResult = await branchExists(gitRoot, name);\n if (isErr(branchCheckResult)) {\n return err(branchCheckResult.error);\n }\n\n if (!branchCheckResult.value) {\n return err(new BranchNotFoundError(name));\n }\n\n const attachResult = await attachWorktree(gitRoot, worktreePath, name);\n if (isErr(attachResult)) {\n return err(attachResult.error);\n }\n\n return ok(worktreePath);\n}\n", "import type { Result } from \"../../types/result.ts\";\nimport { err, ok } from \"../../types/result.ts\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function attachWorktree(\n gitRoot: string,\n worktreePath: string,\n branchName: string,\n): Promise<Result<void, Error>> {\n try {\n await executeGitCommand([\"worktree\", \"add\", worktreePath, branchName], {\n cwd: gitRoot,\n });\n return ok(undefined);\n } catch (error) {\n return err(\n error instanceof Error\n ? error\n : new Error(`Failed to attach worktree: ${String(error)}`),\n );\n }\n}\n", "import type { Result } from \"../../types/result.ts\";\nimport { err, isErr, ok } from \"../../types/result.ts\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function branchExists(\n gitRoot: string,\n branchName: string,\n): Promise<Result<boolean, Error>> {\n try {\n await executeGitCommand(\n [\"show-ref\", \"--verify\", \"--quiet\", `refs/heads/${branchName}`],\n { cwd: gitRoot },\n );\n return ok(true);\n } catch (error) {\n if (error && typeof error === \"object\" && \"code\" in error) {\n const execError = error as { code?: number; message?: string };\n if (execError.code === 1) {\n return ok(false);\n }\n }\n return err(\n new Error(\n `Failed to check branch existence: ${\n error instanceof Error ? error.message : String(error)\n }`,\n ),\n );\n }\n}\n", "import type { ChildProcess } from \"node:child_process\";\n\nexport const output = {\n log: (message: string) => {\n console.log(message);\n },\n\n error: (message: string) => {\n console.error(message);\n },\n\n warn: (message: string) => {\n console.warn(message);\n },\n\n table: (data: unknown) => {\n console.table(data);\n },\n\n processOutput: (proc: ChildProcess) => {\n proc.stdout?.pipe(process.stdout);\n proc.stderr?.pipe(process.stderr);\n },\n};\n", "import { output } from \"./output.ts\";\n\nexport const exitCodes = {\n success: 0,\n generalError: 1,\n notFound: 2,\n validationError: 3,\n} as const;\n\nexport function handleError(\n error: unknown,\n exitCode: number = exitCodes.generalError,\n): never {\n if (error instanceof Error) {\n output.error(error.message);\n } else {\n output.error(String(error));\n }\n process.exit(exitCode);\n}\n\nexport function exitWithSuccess(): never {\n process.exit(exitCodes.success);\n}\n\nexport function exitWithError(\n message: string,\n exitCode: number = exitCodes.generalError,\n): never {\n output.error(message);\n process.exit(exitCode);\n}\n", "import { parseArgs } from \"node:util\";\nimport {\n ConfigNotFoundError,\n ConfigParseError,\n loadConfig,\n} from \"../../core/config/loader.ts\";\nimport { ConfigValidationError } from \"../../core/config/validate.ts\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree } from \"../../core/process/exec.ts\";\nimport { shellInWorktree } from \"../../core/process/shell.ts\";\nimport { executeTmuxCommand, isInsideTmux } from \"../../core/process/tmux.ts\";\nimport { isErr, isOk } from \"../../core/types/result.ts\";\nimport { createWorktree as createWorktreeCore } from \"../../core/worktree/create.ts\";\nimport { WorktreeAlreadyExistsError } from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function createHandler(args: string[]): Promise<void> {\n const { values, positionals } = parseArgs({\n args,\n options: {\n shell: {\n type: \"boolean\",\n short: \"s\",\n },\n exec: {\n type: \"string\",\n short: \"x\",\n },\n tmux: {\n type: \"boolean\",\n short: \"t\",\n },\n \"tmux-vertical\": {\n type: \"boolean\",\n },\n \"tmux-v\": {\n type: \"boolean\",\n },\n \"tmux-horizontal\": {\n type: \"boolean\",\n },\n \"tmux-h\": {\n type: \"boolean\",\n },\n \"copy-file\": {\n type: \"string\",\n multiple: true,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n if (positionals.length === 0) {\n exitWithError(\n \"Please provide a name for the new worktree\",\n exitCodes.validationError,\n );\n }\n\n const worktreeName = positionals[0];\n const openShell = values.shell ?? false;\n const execCommand = values.exec;\n const copyFileOptions = values[\"copy-file\"];\n\n // Determine tmux option\n const tmuxOption =\n values.tmux ||\n values[\"tmux-vertical\"] ||\n values[\"tmux-v\"] ||\n values[\"tmux-horizontal\"] ||\n values[\"tmux-h\"];\n\n let tmuxDirection: \"new\" | \"vertical\" | \"horizontal\" | undefined;\n if (values.tmux) {\n tmuxDirection = \"new\";\n } else if (values[\"tmux-vertical\"] || values[\"tmux-v\"]) {\n tmuxDirection = \"vertical\";\n } else if (values[\"tmux-horizontal\"] || values[\"tmux-h\"]) {\n tmuxDirection = \"horizontal\";\n }\n\n if (\n [openShell, execCommand !== undefined, tmuxOption].filter(Boolean).length >\n 1\n ) {\n exitWithError(\n \"Cannot use --shell, --exec, and --tmux options together\",\n exitCodes.validationError,\n );\n }\n\n if (tmuxOption && !(await isInsideTmux())) {\n exitWithError(\n \"The --tmux option can only be used inside a tmux session\",\n exitCodes.validationError,\n );\n }\n\n try {\n const gitRoot = await getGitRoot();\n\n let filesToCopy: string[] = [];\n\n // Load files from config\n const configResult = await loadConfig(gitRoot);\n if (isOk(configResult)) {\n if (configResult.value.postCreate?.copyFiles) {\n filesToCopy = [...configResult.value.postCreate.copyFiles];\n }\n } else {\n // Display warning for validation and parse errors\n if (configResult.error instanceof ConfigValidationError) {\n output.warn(`Configuration warning: ${configResult.error.message}`);\n } else if (configResult.error instanceof ConfigParseError) {\n output.warn(`Configuration warning: ${configResult.error.message}`);\n }\n // ConfigNotFoundError remains silent as the config file is optional\n }\n\n // Add files from CLI options\n if (copyFileOptions && copyFileOptions.length > 0) {\n const cliFiles = Array.isArray(copyFileOptions)\n ? copyFileOptions\n : [copyFileOptions];\n // Merge with config files, removing duplicates\n filesToCopy = [...new Set([...filesToCopy, ...cliFiles])];\n }\n\n const result = await createWorktreeCore(gitRoot, worktreeName, {\n copyFiles: filesToCopy.length > 0 ? filesToCopy : undefined,\n });\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeAlreadyExistsError\n ? exitCodes.validationError\n : exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n output.log(result.value.message);\n\n if (result.value.copyError) {\n output.error(\n `\\nWarning: Failed to copy some files: ${result.value.copyError}`,\n );\n }\n\n // Execute post-create commands from config\n if (isOk(configResult) && configResult.value.postCreate?.commands) {\n const commands = configResult.value.postCreate.commands;\n output.log(\"\\nRunning post-create commands...\");\n\n for (const command of commands) {\n output.log(`Executing: ${command}`);\n const shell = process.env.SHELL || \"/bin/sh\";\n const cmdResult = await execInWorktree(gitRoot, worktreeName, [\n shell,\n \"-c\",\n command,\n ]);\n\n if (isErr(cmdResult)) {\n output.error(`Failed to execute command: ${cmdResult.error.message}`);\n const exitCode =\n \"exitCode\" in cmdResult.error\n ? (cmdResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(`Post-create command failed: ${command}`, exitCode);\n }\n\n // Check exit code\n if (cmdResult.value.exitCode !== 0) {\n exitWithError(\n `Post-create command failed: ${command}`,\n cmdResult.value.exitCode,\n );\n }\n }\n }\n\n if (execCommand && isOk(result)) {\n output.log(\n `\\nExecuting command in worktree '${worktreeName}': ${execCommand}`,\n );\n\n const shell = process.env.SHELL || \"/bin/sh\";\n const execResult = await execInWorktree(\n gitRoot,\n worktreeName,\n [shell, \"-c\", execCommand],\n { interactive: true },\n );\n\n if (isErr(execResult)) {\n output.error(execResult.error.message);\n const exitCode =\n \"exitCode\" in execResult.error\n ? (execResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n\n process.exit(execResult.value.exitCode ?? 0);\n }\n\n if (openShell && isOk(result)) {\n output.log(\n `\\nEntering worktree '${worktreeName}' at ${result.value.path}`,\n );\n output.log(\"Type 'exit' to return to your original directory\\n\");\n\n const shellResult = await shellInWorktree(gitRoot, worktreeName);\n\n if (isErr(shellResult)) {\n output.error(shellResult.error.message);\n const exitCode =\n \"exitCode\" in shellResult.error\n ? (shellResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n\n process.exit(shellResult.value.exitCode ?? 0);\n }\n\n if (tmuxDirection && isOk(result)) {\n output.log(\n `\\nOpening worktree '${worktreeName}' in tmux ${\n tmuxDirection === \"new\" ? \"window\" : \"pane\"\n }...`,\n );\n\n const shell = process.env.SHELL || \"/bin/sh\";\n\n const tmuxResult = await executeTmuxCommand({\n direction: tmuxDirection,\n command: shell,\n cwd: result.value.path,\n env: {\n PHANTOM: \"1\",\n PHANTOM_NAME: worktreeName,\n PHANTOM_PATH: result.value.path,\n },\n });\n\n if (isErr(tmuxResult)) {\n output.error(tmuxResult.error.message);\n const exitCode =\n \"exitCode\" in tmuxResult.error\n ? (tmuxResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n }\n\n exitWithSuccess();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { type Result, err, ok } from \"../types/result.ts\";\nimport { type ConfigValidationError, validateConfig } from \"./validate.ts\";\n\nexport interface PhantomConfig {\n postCreate?: {\n copyFiles?: string[];\n commands?: string[];\n };\n}\n\nexport class ConfigNotFoundError extends Error {\n constructor() {\n super(\"phantom.config.json not found\");\n this.name = \"ConfigNotFoundError\";\n }\n}\n\nexport class ConfigParseError extends Error {\n constructor(message: string) {\n super(`Failed to parse phantom.config.json: ${message}`);\n this.name = \"ConfigParseError\";\n }\n}\n\nexport async function loadConfig(\n gitRoot: string,\n): Promise<\n Result<\n PhantomConfig,\n ConfigNotFoundError | ConfigParseError | ConfigValidationError\n >\n> {\n const configPath = path.join(gitRoot, \"phantom.config.json\");\n\n try {\n const content = await fs.readFile(configPath, \"utf-8\");\n try {\n const parsed = JSON.parse(content);\n const validationResult = validateConfig(parsed);\n\n if (!validationResult.ok) {\n return err(validationResult.error);\n }\n\n return ok(validationResult.value);\n } catch (error) {\n return err(\n new ConfigParseError(\n error instanceof Error ? error.message : String(error),\n ),\n );\n }\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") {\n return err(new ConfigNotFoundError());\n }\n throw error;\n }\n}\n", "export function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n", "import { type Result, err, ok } from \"../types/result.ts\";\nimport { isObject } from \"../utils/type-guards.ts\";\nimport type { PhantomConfig } from \"./loader.ts\";\n\nexport class ConfigValidationError extends Error {\n constructor(message: string) {\n super(`Invalid phantom.config.json: ${message}`);\n this.name = \"ConfigValidationError\";\n }\n}\n\nexport function validateConfig(\n config: unknown,\n): Result<PhantomConfig, ConfigValidationError> {\n if (!isObject(config)) {\n return err(new ConfigValidationError(\"Configuration must be an object\"));\n }\n\n const cfg = config;\n\n if (cfg.postCreate !== undefined) {\n if (!isObject(cfg.postCreate)) {\n return err(new ConfigValidationError(\"postCreate must be an object\"));\n }\n\n const postCreate = cfg.postCreate;\n if (postCreate.copyFiles !== undefined) {\n if (!Array.isArray(postCreate.copyFiles)) {\n return err(\n new ConfigValidationError(\"postCreate.copyFiles must be an array\"),\n );\n }\n\n if (!postCreate.copyFiles.every((f: unknown) => typeof f === \"string\")) {\n return err(\n new ConfigValidationError(\n \"postCreate.copyFiles must contain only strings\",\n ),\n );\n }\n }\n\n if (postCreate.commands !== undefined) {\n if (!Array.isArray(postCreate.commands)) {\n return err(\n new ConfigValidationError(\"postCreate.commands must be an array\"),\n );\n }\n\n if (!postCreate.commands.every((c: unknown) => typeof c === \"string\")) {\n return err(\n new ConfigValidationError(\n \"postCreate.commands must contain only strings\",\n ),\n );\n }\n }\n }\n\n return ok(config as PhantomConfig);\n}\n", "import type { Result } from \"../types/result.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type TmuxSplitDirection = \"new\" | \"vertical\" | \"horizontal\";\n\nexport interface TmuxOptions {\n direction: TmuxSplitDirection;\n command: string;\n cwd?: string;\n env?: Record<string, string>;\n}\n\nexport type TmuxSuccess = SpawnSuccess;\n\nexport async function isInsideTmux(): Promise<boolean> {\n return process.env.TMUX !== undefined;\n}\n\nexport async function executeTmuxCommand(\n options: TmuxOptions,\n): Promise<Result<TmuxSuccess, ProcessError>> {\n const { direction, command, cwd, env } = options;\n\n const tmuxArgs: string[] = [];\n\n switch (direction) {\n case \"new\":\n tmuxArgs.push(\"new-window\");\n break;\n case \"vertical\":\n tmuxArgs.push(\"split-window\", \"-v\");\n break;\n case \"horizontal\":\n tmuxArgs.push(\"split-window\", \"-h\");\n break;\n }\n\n if (cwd) {\n tmuxArgs.push(\"-c\", cwd);\n }\n\n // Add environment variables safely\n if (env) {\n for (const [key, value] of Object.entries(env)) {\n tmuxArgs.push(\"-e\", `${key}=${value}`);\n }\n }\n\n tmuxArgs.push(command);\n\n const result = await spawnProcess({\n command: \"tmux\",\n args: tmuxArgs,\n });\n\n return result;\n}\n", "import fs from \"node:fs/promises\";\nimport { addWorktree } from \"../git/libs/add-worktree.ts\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, err, isErr, isOk, ok } from \"../types/result.ts\";\nimport { GitOperationError, WorktreeAlreadyExistsError } from \"./errors.ts\";\nimport { copyFiles } from \"./file-copier.ts\";\nimport {\n validateWorktreeDoesNotExist,\n validateWorktreeName,\n} from \"./validate.ts\";\n\nexport interface CreateWorktreeOptions {\n branch?: string;\n commitish?: string;\n copyFiles?: string[];\n}\n\nexport interface CreateWorktreeSuccess {\n message: string;\n path: string;\n copiedFiles?: string[];\n skippedFiles?: string[];\n copyError?: string;\n}\n\nexport async function createWorktree(\n gitRoot: string,\n name: string,\n options: CreateWorktreeOptions = {},\n): Promise<\n Result<CreateWorktreeSuccess, WorktreeAlreadyExistsError | GitOperationError>\n> {\n const nameValidation = validateWorktreeName(name);\n if (isErr(nameValidation)) {\n return nameValidation;\n }\n\n const { branch = name, commitish = \"HEAD\" } = options;\n\n const worktreesPath = getPhantomDirectory(gitRoot);\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreesPath);\n } catch {\n await fs.mkdir(worktreesPath, { recursive: true });\n }\n\n const validation = await validateWorktreeDoesNotExist(gitRoot, name);\n if (validation.exists) {\n return err(new WorktreeAlreadyExistsError(name));\n }\n\n try {\n await addWorktree({\n path: worktreePath,\n branch,\n commitish,\n });\n\n let copiedFiles: string[] | undefined;\n let skippedFiles: string[] | undefined;\n let copyError: string | undefined;\n\n if (options.copyFiles && options.copyFiles.length > 0) {\n const copyResult = await copyFiles(\n gitRoot,\n worktreePath,\n options.copyFiles,\n );\n\n if (isOk(copyResult)) {\n copiedFiles = copyResult.value.copiedFiles;\n skippedFiles = copyResult.value.skippedFiles;\n } else {\n copyError = copyResult.error.message;\n }\n }\n\n return ok({\n message: `Created worktree '${name}' at ${worktreePath}`,\n path: worktreePath,\n copiedFiles,\n skippedFiles,\n copyError,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"worktree add\", errorMessage));\n }\n}\n", "import { executeGitCommand } from \"../executor.ts\";\n\nexport interface AddWorktreeOptions {\n path: string;\n branch: string;\n commitish?: string;\n}\n\nexport async function addWorktree(options: AddWorktreeOptions): Promise<void> {\n const { path, branch, commitish = \"HEAD\" } = options;\n\n await executeGitCommand([\"worktree\", \"add\", path, \"-b\", branch, commitish]);\n}\n", "import { copyFile, mkdir, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface CopyFileResult {\n copiedFiles: string[];\n skippedFiles: string[];\n}\n\nexport class FileCopyError extends Error {\n public readonly file: string;\n\n constructor(file: string, message: string) {\n super(`Failed to copy ${file}: ${message}`);\n this.name = \"FileCopyError\";\n this.file = file;\n }\n}\n\nexport async function copyFiles(\n sourceDir: string,\n targetDir: string,\n files: string[],\n): Promise<Result<CopyFileResult, FileCopyError>> {\n const copiedFiles: string[] = [];\n const skippedFiles: string[] = [];\n\n for (const file of files) {\n const sourcePath = path.join(sourceDir, file);\n const targetPath = path.join(targetDir, file);\n\n try {\n const stats = await stat(sourcePath);\n if (!stats.isFile()) {\n skippedFiles.push(file);\n continue;\n }\n\n const targetDirPath = path.dirname(targetPath);\n await mkdir(targetDirPath, { recursive: true });\n\n await copyFile(sourcePath, targetPath);\n copiedFiles.push(file);\n } catch (error) {\n if (\n error instanceof Error &&\n \"code\" in error &&\n error.code === \"ENOENT\"\n ) {\n skippedFiles.push(file);\n } else {\n return err(\n new FileCopyError(\n file,\n error instanceof Error ? error.message : String(error),\n ),\n );\n }\n }\n }\n\n return ok({ copiedFiles, skippedFiles });\n}\n", "import { parseArgs } from \"node:util\";\nimport { getCurrentWorktree } from \"../../core/git/libs/get-current-worktree.ts\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { deleteWorktree as deleteWorktreeCore } from \"../../core/worktree/delete.ts\";\nimport {\n WorktreeError,\n WorktreeNotFoundError,\n} from \"../../core/worktree/errors.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function deleteHandler(args: string[]): Promise<void> {\n const { values, positionals } = parseArgs({\n args,\n options: {\n force: {\n type: \"boolean\",\n short: \"f\",\n },\n current: {\n type: \"boolean\",\n },\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const deleteCurrent = values.current ?? false;\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !deleteCurrent && !useFzf) {\n exitWithError(\n \"Please provide a worktree name to delete, use --current to delete the current worktree, or use --fzf for interactive selection\",\n exitCodes.validationError,\n );\n }\n\n if ((positionals.length > 0 || useFzf) && deleteCurrent) {\n exitWithError(\n \"Cannot specify --current with a worktree name or --fzf option\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n const forceDelete = values.force ?? false;\n\n try {\n const gitRoot = await getGitRoot();\n\n let worktreeName: string;\n if (deleteCurrent) {\n const currentWorktree = await getCurrentWorktree(gitRoot);\n if (!currentWorktree) {\n exitWithError(\n \"Not in a worktree directory. The --current option can only be used from within a worktree.\",\n exitCodes.validationError,\n );\n }\n worktreeName = currentWorktree;\n } else if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n const result = await deleteWorktreeCore(gitRoot, worktreeName, {\n force: forceDelete,\n });\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.validationError\n : result.error instanceof WorktreeError &&\n result.error.message.includes(\"uncommitted changes\")\n ? exitCodes.validationError\n : exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n output.log(result.value.message);\n exitWithSuccess();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { executeGitCommand } from \"../executor.ts\";\n\nexport interface GitWorktree {\n path: string;\n branch: string;\n head: string;\n isLocked: boolean;\n isPrunable: boolean;\n}\n\nexport async function listWorktrees(gitRoot: string): Promise<GitWorktree[]> {\n const { stdout } = await executeGitCommand([\n \"worktree\",\n \"list\",\n \"--porcelain\",\n ]);\n\n const worktrees: GitWorktree[] = [];\n let currentWorktree: Partial<GitWorktree> = {};\n\n const lines = stdout.split(\"\\n\").filter((line) => line.length > 0);\n\n for (const line of lines) {\n if (line.startsWith(\"worktree \")) {\n if (currentWorktree.path) {\n worktrees.push(currentWorktree as GitWorktree);\n }\n currentWorktree = {\n path: line.substring(\"worktree \".length),\n isLocked: false,\n isPrunable: false,\n };\n } else if (line.startsWith(\"HEAD \")) {\n currentWorktree.head = line.substring(\"HEAD \".length);\n } else if (line.startsWith(\"branch \")) {\n const fullBranch = line.substring(\"branch \".length);\n currentWorktree.branch = fullBranch.startsWith(\"refs/heads/\")\n ? fullBranch.substring(\"refs/heads/\".length)\n : fullBranch;\n } else if (line === \"detached\") {\n currentWorktree.branch = \"(detached HEAD)\";\n } else if (line === \"locked\") {\n currentWorktree.isLocked = true;\n } else if (line === \"prunable\") {\n currentWorktree.isPrunable = true;\n }\n }\n\n if (currentWorktree.path) {\n worktrees.push(currentWorktree as GitWorktree);\n }\n\n return worktrees;\n}\n", "import { executeGitCommand } from \"../executor.ts\";\nimport { listWorktrees } from \"./list-worktrees.ts\";\n\nexport async function getCurrentWorktree(\n gitRoot: string,\n): Promise<string | null> {\n try {\n const { stdout: currentPath } = await executeGitCommand([\n \"rev-parse\",\n \"--show-toplevel\",\n ]);\n\n const currentPathTrimmed = currentPath.trim();\n\n const worktrees = await listWorktrees(gitRoot);\n\n const currentWorktree = worktrees.find(\n (wt) => wt.path === currentPathTrimmed,\n );\n\n if (!currentWorktree || currentWorktree.path === gitRoot) {\n return null;\n }\n\n return currentWorktree.branch;\n } catch {\n return null;\n }\n}\n", "import {\n executeGitCommand,\n executeGitCommandInDirectory,\n} from \"../git/executor.ts\";\nimport { type Result, err, isOk, ok } from \"../types/result.ts\";\nimport {\n GitOperationError,\n WorktreeError,\n WorktreeNotFoundError,\n} from \"./errors.ts\";\nimport { validateWorktreeExists } from \"./validate.ts\";\n\nexport interface DeleteWorktreeOptions {\n force?: boolean;\n}\n\nexport interface DeleteWorktreeSuccess {\n message: string;\n hasUncommittedChanges?: boolean;\n changedFiles?: number;\n}\n\nexport interface WorktreeStatus {\n hasUncommittedChanges: boolean;\n changedFiles: number;\n}\n\nexport async function getWorktreeStatus(\n worktreePath: string,\n): Promise<WorktreeStatus> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"status\",\n \"--porcelain\",\n ]);\n if (stdout) {\n return {\n hasUncommittedChanges: true,\n changedFiles: stdout.split(\"\\n\").length,\n };\n }\n } catch {\n // If git status fails, assume no changes\n }\n return {\n hasUncommittedChanges: false,\n changedFiles: 0,\n };\n}\n\nexport async function removeWorktree(\n gitRoot: string,\n worktreePath: string,\n force = false,\n): Promise<void> {\n try {\n await executeGitCommand([\"worktree\", \"remove\", worktreePath], {\n cwd: gitRoot,\n });\n } catch (error) {\n // Always try force removal if the regular removal fails\n try {\n await executeGitCommand([\"worktree\", \"remove\", \"--force\", worktreePath], {\n cwd: gitRoot,\n });\n } catch {\n throw new Error(\"Failed to remove worktree\");\n }\n }\n}\n\nexport async function deleteBranch(\n gitRoot: string,\n branchName: string,\n): Promise<Result<boolean, GitOperationError>> {\n try {\n await executeGitCommand([\"branch\", \"-D\", branchName], { cwd: gitRoot });\n return ok(true);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"branch delete\", errorMessage));\n }\n}\n\nexport async function deleteWorktree(\n gitRoot: string,\n name: string,\n options: DeleteWorktreeOptions = {},\n): Promise<\n Result<\n DeleteWorktreeSuccess,\n WorktreeNotFoundError | WorktreeError | GitOperationError\n >\n> {\n const { force = false } = options;\n\n const validation = await validateWorktreeExists(gitRoot, name);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(name));\n }\n\n const worktreePath = validation.path as string;\n\n const status = await getWorktreeStatus(worktreePath);\n\n if (status.hasUncommittedChanges && !force) {\n return err(\n new WorktreeError(\n `Worktree '${name}' has uncommitted changes (${status.changedFiles} files). Use --force to delete anyway.`,\n ),\n );\n }\n\n try {\n await removeWorktree(gitRoot, worktreePath, force);\n\n const branchName = name;\n const branchResult = await deleteBranch(gitRoot, branchName);\n\n let message: string;\n if (isOk(branchResult)) {\n message = `Deleted worktree '${name}' and its branch '${branchName}'`;\n } else {\n message = `Deleted worktree '${name}'`;\n message += `\\nNote: Branch '${branchName}' could not be deleted: ${branchResult.error.message}`;\n }\n\n if (status.hasUncommittedChanges) {\n message = `Warning: Worktree '${name}' had uncommitted changes (${status.changedFiles} files)\\n${message}`;\n }\n\n return ok({\n message,\n hasUncommittedChanges: status.hasUncommittedChanges,\n changedFiles: status.hasUncommittedChanges\n ? status.changedFiles\n : undefined,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"worktree remove\", errorMessage));\n }\n}\n", "import { spawn } from \"node:child_process\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface FzfOptions {\n prompt?: string;\n header?: string;\n previewCommand?: string;\n}\n\nexport async function selectWithFzf(\n items: string[],\n options: FzfOptions = {},\n): Promise<Result<string | null, Error>> {\n return new Promise((resolve) => {\n const args: string[] = [];\n\n if (options.prompt) {\n args.push(\"--prompt\", options.prompt);\n }\n\n if (options.header) {\n args.push(\"--header\", options.header);\n }\n\n if (options.previewCommand) {\n args.push(\"--preview\", options.previewCommand);\n }\n\n const fzf = spawn(\"fzf\", args, {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n });\n\n let result = \"\";\n let errorOutput = \"\";\n\n fzf.stdout.on(\"data\", (data) => {\n result += data.toString();\n });\n\n if (fzf.stderr) {\n fzf.stderr.on(\"data\", (data) => {\n errorOutput += data.toString();\n });\n }\n\n fzf.on(\"error\", (error) => {\n if (error.message.includes(\"ENOENT\")) {\n resolve(\n err(new Error(\"fzf command not found. Please install fzf first.\")),\n );\n } else {\n resolve(err(error));\n }\n });\n\n fzf.on(\"close\", (code) => {\n if (code === 0) {\n const selected = result.trim();\n resolve(ok(selected || null));\n } else if (code === 1) {\n resolve(ok(null));\n } else if (code === 130) {\n resolve(ok(null));\n } else {\n resolve(err(new Error(`fzf exited with code ${code}: ${errorOutput}`)));\n }\n });\n\n fzf.stdin.write(items.join(\"\\n\"));\n fzf.stdin.end();\n });\n}\n", "import { executeGitCommandInDirectory } from \"../git/executor.ts\";\nimport { listWorktrees as gitListWorktrees } from \"../git/libs/list-worktrees.ts\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, ok } from \"../types/result.ts\";\n\nexport interface WorktreeInfo {\n name: string;\n path: string;\n branch: string;\n isClean: boolean;\n}\n\nexport interface ListWorktreesSuccess {\n worktrees: WorktreeInfo[];\n message?: string;\n}\n\nexport async function getWorktreeBranch(worktreePath: string): Promise<string> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"branch\",\n \"--show-current\",\n ]);\n return stdout || \"(detached HEAD)\";\n } catch {\n return \"unknown\";\n }\n}\n\nexport async function getWorktreeStatus(\n worktreePath: string,\n): Promise<boolean> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"status\",\n \"--porcelain\",\n ]);\n return !stdout; // Clean if no output\n } catch {\n // If git status fails, assume clean\n return true;\n }\n}\n\nexport async function getWorktreeInfo(\n gitRoot: string,\n name: string,\n): Promise<WorktreeInfo> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n const [branch, isClean] = await Promise.all([\n getWorktreeBranch(worktreePath),\n getWorktreeStatus(worktreePath),\n ]);\n\n return {\n name,\n path: worktreePath,\n branch,\n isClean,\n };\n}\n\nexport async function listWorktrees(\n gitRoot: string,\n): Promise<Result<ListWorktreesSuccess, never>> {\n try {\n const gitWorktrees = await gitListWorktrees(gitRoot);\n const phantomDir = getPhantomDirectory(gitRoot);\n\n const phantomWorktrees = gitWorktrees.filter((worktree) =>\n worktree.path.startsWith(phantomDir),\n );\n\n if (phantomWorktrees.length === 0) {\n return ok({\n worktrees: [],\n message: \"No worktrees found\",\n });\n }\n\n const worktrees = await Promise.all(\n phantomWorktrees.map(async (gitWorktree) => {\n const name = gitWorktree.path.substring(phantomDir.length + 1);\n const isClean = await getWorktreeStatus(gitWorktree.path);\n\n return {\n name,\n path: gitWorktree.path,\n branch: gitWorktree.branch || \"(detached HEAD)\",\n isClean,\n };\n }),\n );\n\n return ok({\n worktrees,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to list worktrees: ${errorMessage}`);\n }\n}\n", "import { type Result, isErr } from \"../types/result.ts\";\nimport { selectWithFzf } from \"../utils/fzf.ts\";\nimport { listWorktrees } from \"./list.ts\";\n\nexport interface SelectWorktreeResult {\n name: string;\n branch: string | null;\n isClean: boolean;\n}\n\nexport async function selectWorktreeWithFzf(\n gitRoot: string,\n): Promise<Result<SelectWorktreeResult | null, Error>> {\n const listResult = await listWorktrees(gitRoot);\n\n if (isErr(listResult)) {\n return listResult;\n }\n\n const { worktrees } = listResult.value;\n\n if (worktrees.length === 0) {\n return {\n ok: true,\n value: null,\n };\n }\n\n const list = worktrees.map((wt) => {\n const branchInfo = wt.branch ? `(${wt.branch})` : \"\";\n const status = !wt.isClean ? \" [dirty]\" : \"\";\n return `${wt.name} ${branchInfo}${status}`;\n });\n\n const fzfResult = await selectWithFzf(list, {\n prompt: \"Select worktree> \",\n header: \"Git Worktrees (Phantoms)\",\n });\n\n if (isErr(fzfResult)) {\n return fzfResult;\n }\n\n if (!fzfResult.value) {\n return {\n ok: true,\n value: null,\n };\n }\n\n const selectedName = fzfResult.value.split(\" \")[0];\n const selectedWorktree = worktrees.find((wt) => wt.name === selectedName);\n\n if (!selectedWorktree) {\n return {\n ok: false,\n error: new Error(\"Selected worktree not found\"),\n };\n }\n\n return {\n ok: true,\n value: {\n name: selectedWorktree.name,\n branch: selectedWorktree.branch,\n isClean: selectedWorktree.isClean,\n },\n };\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree as execInWorktreeCore } from \"../../core/process/exec.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { WorktreeNotFoundError } from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\n\nexport async function execHandler(args: string[]): Promise<void> {\n const { positionals } = parseArgs({\n args,\n options: {},\n strict: true,\n allowPositionals: true,\n });\n\n if (positionals.length < 2) {\n exitWithError(\n \"Usage: phantom exec <worktree-name> <command> [args...]\",\n exitCodes.validationError,\n );\n }\n\n const [worktreeName, ...commandArgs] = positionals;\n\n try {\n const gitRoot = await getGitRoot();\n const result = await execInWorktreeCore(\n gitRoot,\n worktreeName,\n commandArgs,\n { interactive: true },\n );\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.notFound\n : result.error.exitCode || exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n process.exit(result.value.exitCode);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { listWorktrees as listWorktreesCore } from \"../../core/worktree/list.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function listHandler(args: string[] = []): Promise<void> {\n const { values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n names: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: false,\n });\n try {\n const gitRoot = await getGitRoot();\n\n if (values.fzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n\n if (selectResult.value) {\n output.log(selectResult.value.name);\n }\n } else {\n const result = await listWorktreesCore(gitRoot);\n\n if (isErr(result)) {\n exitWithError(\"Failed to list worktrees\", exitCodes.generalError);\n }\n\n const { worktrees, message } = result.value;\n\n if (worktrees.length === 0) {\n if (!values.names) {\n output.log(message || \"No worktrees found.\");\n }\n process.exit(exitCodes.success);\n }\n\n if (values.names) {\n for (const worktree of worktrees) {\n output.log(worktree.name);\n }\n } else {\n const maxNameLength = Math.max(\n ...worktrees.map((wt) => wt.name.length),\n );\n\n for (const worktree of worktrees) {\n const paddedName = worktree.name.padEnd(maxNameLength + 2);\n const branchInfo = worktree.branch ? `(${worktree.branch})` : \"\";\n const status = !worktree.isClean ? \" [dirty]\" : \"\";\n\n output.log(`${paddedName} ${branchInfo}${status}`);\n }\n }\n }\n\n process.exit(exitCodes.success);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { shellInWorktree as shellInWorktreeCore } from \"../../core/process/shell.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { WorktreeNotFoundError } from \"../../core/worktree/errors.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { validateWorktreeExists } from \"../../core/worktree/validate.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function shellHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !useFzf) {\n exitWithError(\n \"Usage: phantom shell <worktree-name> or phantom shell --fzf\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n let worktreeName: string;\n\n try {\n const gitRoot = await getGitRoot();\n\n if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n // Get worktree path for display\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n exitWithError(\n validation.message || `Worktree '${worktreeName}' not found`,\n exitCodes.generalError,\n );\n }\n\n output.log(`Entering worktree '${worktreeName}' at ${validation.path}`);\n output.log(\"Type 'exit' to return to your original directory\\n\");\n\n const result = await shellInWorktreeCore(gitRoot, worktreeName);\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.notFound\n : result.error.exitCode || exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n process.exit(result.value.exitCode);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getVersion } from \"../../core/version.ts\";\nimport { exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport function versionHandler(args: string[] = []): void {\n parseArgs({\n args,\n options: {},\n strict: true,\n allowPositionals: false,\n });\n const version = getVersion();\n output.log(`Phantom v${version}`);\n exitWithSuccess();\n}\n", "{\n \"name\": \"@aku11i/phantom\",\n \"packageManager\": \"pnpm@10.8.1\",\n \"version\": \"0.8.1\",\n \"description\": \"A powerful CLI tool for managing Git worktrees for parallel development\",\n \"keywords\": [\n \"git\",\n \"worktree\",\n \"cli\",\n \"phantom\",\n \"workspace\",\n \"development\",\n \"parallel\"\n ],\n \"homepage\": \"https://github.com/aku11i/phantom#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/aku11i/phantom/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/aku11i/phantom.git\"\n },\n \"license\": \"MIT\",\n \"author\": \"aku11i\",\n \"type\": \"module\",\n \"bin\": {\n \"phantom\": \"./dist/phantom.js\"\n },\n \"scripts\": {\n \"start\": \"node ./src/bin/phantom.ts\",\n \"phantom\": \"node ./src/bin/phantom.ts\",\n \"build\": \"node build.ts\",\n \"typecheck\": \"tsgo --noEmit\",\n \"test\": \"node --test --experimental-strip-types --experimental-test-module-mocks \\\"src/**/*.test.js\\\"\",\n \"test:coverage\": \"node --experimental-test-coverage --test --experimental-strip-types --experimental-test-module-mocks \\\"src/**/*.test.js\\\"\",\n \"test:file\": \"node --test --experimental-strip-types --experimental-test-module-mocks\",\n \"lint\": \"biome check .\",\n \"fix\": \"biome check --write .\",\n \"ready\": \"pnpm fix && pnpm typecheck && pnpm test\",\n \"ready:check\": \"pnpm lint && pnpm typecheck && pnpm test\",\n \"prepublishOnly\": \"pnpm ready:check && pnpm build\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"files\": [\n \"dist/\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"devDependencies\": {\n \"@biomejs/biome\": \"^1.9.4\",\n \"@types/node\": \"^22.15.29\",\n \"@typescript/native-preview\": \"7.0.0-dev.20250602.1\",\n \"esbuild\": \"^0.25.5\",\n \"typescript\": \"^5.8.3\"\n }\n}\n", "import packageJson from \"../../package.json\" with { type: \"json\" };\n\nexport function getVersion(): string {\n return packageJson.version;\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { whereWorktree as whereWorktreeCore } from \"../../core/worktree/where.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function whereHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !useFzf) {\n exitWithError(\n \"Usage: phantom where <worktree-name> or phantom where --fzf\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n let worktreeName: string;\n let gitRoot: string;\n\n try {\n gitRoot = await getGitRoot();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n\n if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n const result = await whereWorktreeCore(gitRoot, worktreeName);\n\n if (isErr(result)) {\n exitWithError(result.error.message, exitCodes.notFound);\n }\n\n output.log(result.value.path);\n exitWithSuccess();\n}\n", "import { type Result, err, ok } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"./errors.ts\";\nimport { validateWorktreeExists } from \"./validate.ts\";\n\nexport interface WhereWorktreeSuccess {\n path: string;\n}\n\nexport async function whereWorktree(\n gitRoot: string,\n name: string,\n): Promise<Result<WhereWorktreeSuccess, WorktreeNotFoundError>> {\n const validation = await validateWorktreeExists(gitRoot, name);\n\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(name));\n }\n\n return ok({\n path: validation.path as string,\n });\n}\n", "import { stdout } from \"node:process\";\n\nexport interface CommandOption {\n name: string;\n short?: string;\n type: \"boolean\" | \"string\";\n description: string;\n multiple?: boolean;\n example?: string;\n}\n\nexport interface CommandHelp {\n name: string;\n description: string;\n usage: string;\n options?: CommandOption[];\n examples?: Array<{\n description: string;\n command: string;\n }>;\n notes?: string[];\n}\n\nexport class HelpFormatter {\n private readonly width: number;\n private readonly indent = \" \";\n\n constructor() {\n this.width = stdout.columns || 80;\n }\n\n formatMainHelp(\n commands: Array<{ name: string; description: string }>,\n ): string {\n const lines: string[] = [];\n\n lines.push(this.bold(\"Phantom - Git Worktree Manager\"));\n lines.push(\"\");\n lines.push(\n this.dim(\n \"A CLI tool for managing Git worktrees with enhanced functionality\",\n ),\n );\n lines.push(\"\");\n lines.push(this.section(\"USAGE\"));\n lines.push(`${this.indent}phantom <command> [options]`);\n lines.push(\"\");\n lines.push(this.section(\"COMMANDS\"));\n\n const maxNameLength = Math.max(...commands.map((cmd) => cmd.name.length));\n\n for (const cmd of commands) {\n const paddedName = cmd.name.padEnd(maxNameLength + 2);\n lines.push(`${this.indent}${this.cyan(paddedName)}${cmd.description}`);\n }\n\n lines.push(\"\");\n lines.push(this.section(\"GLOBAL OPTIONS\"));\n const helpOption = \"-h, --help\";\n const versionOption = \"-v, --version\";\n const globalOptionWidth =\n Math.max(helpOption.length, versionOption.length) + 2;\n lines.push(\n `${this.indent}${this.cyan(helpOption.padEnd(globalOptionWidth))}Show help`,\n );\n lines.push(\n `${this.indent}${this.cyan(versionOption.padEnd(globalOptionWidth))}Show version`,\n );\n lines.push(\"\");\n lines.push(\n this.dim(\n \"Run 'phantom <command> --help' for more information on a command.\",\n ),\n );\n\n return lines.join(\"\\n\");\n }\n\n formatCommandHelp(help: CommandHelp): string {\n const lines: string[] = [];\n\n lines.push(this.bold(`phantom ${help.name}`));\n lines.push(this.dim(help.description));\n lines.push(\"\");\n\n lines.push(this.section(\"USAGE\"));\n lines.push(`${this.indent}${help.usage}`);\n lines.push(\"\");\n\n if (help.options && help.options.length > 0) {\n lines.push(this.section(\"OPTIONS\"));\n const maxOptionLength = Math.max(\n ...help.options.map((opt) => this.formatOptionName(opt).length),\n );\n\n for (const option of help.options) {\n const optionName = this.formatOptionName(option);\n const paddedName = optionName.padEnd(maxOptionLength + 2);\n const description = this.wrapText(\n option.description,\n maxOptionLength + 4,\n );\n\n lines.push(`${this.indent}${this.cyan(paddedName)}${description[0]}`);\n for (let i = 1; i < description.length; i++) {\n lines.push(\n `${this.indent}${\" \".repeat(maxOptionLength + 2)}${description[i]}`,\n );\n }\n\n if (option.example) {\n const exampleIndent = \" \".repeat(maxOptionLength + 4);\n lines.push(\n `${this.indent}${exampleIndent}${this.dim(`Example: ${option.example}`)}`,\n );\n }\n }\n lines.push(\"\");\n }\n\n if (help.examples && help.examples.length > 0) {\n lines.push(this.section(\"EXAMPLES\"));\n for (const example of help.examples) {\n lines.push(`${this.indent}${this.dim(example.description)}`);\n lines.push(`${this.indent}${this.indent}$ ${example.command}`);\n lines.push(\"\");\n }\n }\n\n if (help.notes && help.notes.length > 0) {\n lines.push(this.section(\"NOTES\"));\n for (const note of help.notes) {\n const wrappedNote = this.wrapText(note, 2);\n for (const line of wrappedNote) {\n lines.push(`${this.indent}${line}`);\n }\n }\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n }\n\n private formatOptionName(option: CommandOption): string {\n const parts: string[] = [];\n\n if (option.short) {\n parts.push(`-${option.short},`);\n }\n\n parts.push(`--${option.name}`);\n\n if (option.type === \"string\") {\n parts.push(option.multiple ? \"<value>...\" : \"<value>\");\n }\n\n return parts.join(\" \");\n }\n\n private wrapText(text: string, indent: number): string[] {\n const maxWidth = this.width - indent - 2;\n const words = text.split(\" \");\n const lines: string[] = [];\n let currentLine = \"\";\n\n for (const word of words) {\n if (currentLine.length + word.length + 1 > maxWidth) {\n lines.push(currentLine);\n currentLine = word;\n } else {\n currentLine = currentLine ? `${currentLine} ${word}` : word;\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n return lines;\n }\n\n private section(text: string): string {\n return this.bold(text);\n }\n\n private bold(text: string): string {\n return `\\x1b[1m${text}\\x1b[0m`;\n }\n\n private dim(text: string): string {\n return `\\x1b[2m${text}\\x1b[0m`;\n }\n\n private cyan(text: string): string {\n return `\\x1b[36m${text}\\x1b[0m`;\n }\n}\n\nexport const helpFormatter = new HelpFormatter();\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const attachHelp: CommandHelp = {\n name: \"attach\",\n description: \"Attach to an existing branch by creating a new worktree\",\n usage: \"phantom attach <worktree-name> <branch-name> [options]\",\n options: [\n {\n name: \"shell\",\n short: \"s\",\n type: \"boolean\",\n description: \"Open an interactive shell in the worktree after attaching\",\n },\n {\n name: \"exec\",\n short: \"x\",\n type: \"string\",\n description: \"Execute a command in the worktree after attaching\",\n example: \"--exec 'git pull'\",\n },\n ],\n examples: [\n {\n description: \"Attach to an existing branch\",\n command: \"phantom attach review-pr main\",\n },\n {\n description: \"Attach to a remote branch and open a shell\",\n command: \"phantom attach hotfix origin/hotfix-v1.2 --shell\",\n },\n {\n description: \"Attach to a branch and pull latest changes\",\n command: \"phantom attach staging origin/staging --exec 'git pull'\",\n },\n ],\n notes: [\n \"The branch must already exist (locally or remotely)\",\n \"If attaching to a remote branch, it will be checked out locally\",\n \"Only one of --shell or --exec options can be used at a time\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const createHelp: CommandHelp = {\n name: \"create\",\n description: \"Create a new Git worktree (phantom)\",\n usage: \"phantom create <name> [options]\",\n options: [\n {\n name: \"shell\",\n short: \"s\",\n type: \"boolean\",\n description:\n \"Open an interactive shell in the new worktree after creation\",\n },\n {\n name: \"exec\",\n short: \"x\",\n type: \"string\",\n description: \"Execute a command in the new worktree after creation\",\n example: \"--exec 'npm install'\",\n },\n {\n name: \"tmux\",\n short: \"t\",\n type: \"boolean\",\n description:\n \"Open the worktree in a new tmux window (requires being inside tmux)\",\n },\n {\n name: \"tmux-vertical\",\n type: \"boolean\",\n description:\n \"Open the worktree in a vertical tmux pane (requires being inside tmux)\",\n },\n {\n name: \"tmux-horizontal\",\n type: \"boolean\",\n description:\n \"Open the worktree in a horizontal tmux pane (requires being inside tmux)\",\n },\n {\n name: \"copy-file\",\n type: \"string\",\n multiple: true,\n description:\n \"Copy specified files from the current worktree to the new one. Can be used multiple times\",\n example: \"--copy-file .env --copy-file config.local.json\",\n },\n ],\n examples: [\n {\n description: \"Create a new worktree named 'feature-auth'\",\n command: \"phantom create feature-auth\",\n },\n {\n description: \"Create a worktree and open a shell in it\",\n command: \"phantom create bugfix-123 --shell\",\n },\n {\n description: \"Create a worktree and run npm install\",\n command: \"phantom create new-feature --exec 'npm install'\",\n },\n {\n description: \"Create a worktree in a new tmux window\",\n command: \"phantom create experiment --tmux\",\n },\n {\n description: \"Create a worktree and copy environment files\",\n command:\n \"phantom create staging --copy-file .env --copy-file database.yml\",\n },\n ],\n notes: [\n \"The worktree name will be used as the branch name\",\n \"Only one of --shell, --exec, or --tmux options can be used at a time\",\n \"File copying can also be configured in phantom.config.json\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const deleteHelp: CommandHelp = {\n name: \"delete\",\n description: \"Delete a Git worktree (phantom)\",\n usage: \"phantom delete <name> [options]\",\n options: [\n {\n name: \"force\",\n short: \"f\",\n type: \"boolean\",\n description:\n \"Force deletion even if the worktree has uncommitted or unpushed changes\",\n },\n {\n name: \"--current\",\n type: \"boolean\",\n description: \"Delete the current worktree\",\n },\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Delete a worktree\",\n command: \"phantom delete feature-auth\",\n },\n {\n description: \"Force delete a worktree with uncommitted changes\",\n command: \"phantom delete experimental --force\",\n },\n {\n description: \"Delete the current worktree\",\n command: \"phantom delete --current\",\n },\n {\n description: \"Delete a worktree with interactive fzf selection\",\n command: \"phantom delete --fzf\",\n },\n ],\n notes: [\n \"By default, deletion will fail if the worktree has uncommitted changes\",\n \"The associated branch will also be deleted if it's not checked out elsewhere\",\n \"With --fzf, you can interactively select the worktree to delete\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const execHelp: CommandHelp = {\n name: \"exec\",\n description: \"Execute a command in a worktree directory\",\n usage: \"phantom exec <worktree-name> <command> [args...]\",\n examples: [\n {\n description: \"Run npm test in a worktree\",\n command: \"phantom exec feature-auth npm test\",\n },\n {\n description: \"Check git status in a worktree\",\n command: \"phantom exec bugfix-123 git status\",\n },\n {\n description: \"Run a complex command with arguments\",\n command: \"phantom exec staging npm run build -- --production\",\n },\n ],\n notes: [\n \"The command is executed with the worktree directory as the working directory\",\n \"All arguments after the worktree name are passed to the command\",\n \"The exit code of the executed command is preserved\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const listHelp: CommandHelp = {\n name: \"list\",\n description: \"List all Git worktrees (phantoms)\",\n usage: \"phantom list [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n {\n name: \"--names\",\n type: \"boolean\",\n description: \"Output only phantom names (for scripts and completion)\",\n },\n ],\n examples: [\n {\n description: \"List all worktrees\",\n command: \"phantom list\",\n },\n {\n description: \"List worktrees with interactive fzf selection\",\n command: \"phantom list --fzf\",\n },\n {\n description: \"List only worktree names\",\n command: \"phantom list --names\",\n },\n ],\n notes: [\n \"Shows all worktrees with their paths and associated branches\",\n \"The main worktree is marked as '(bare)' if using a bare repository\",\n \"With --fzf, outputs only the selected worktree name\",\n \"Use --names for shell completion scripts and automation\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const shellHelp: CommandHelp = {\n name: \"shell\",\n description: \"Open an interactive shell in a worktree directory\",\n usage: \"phantom shell <worktree-name> [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Open a shell in a worktree\",\n command: \"phantom shell feature-auth\",\n },\n {\n description: \"Open a shell with interactive fzf selection\",\n command: \"phantom shell --fzf\",\n },\n ],\n notes: [\n \"Uses your default shell from the SHELL environment variable\",\n \"The shell starts with the worktree directory as the working directory\",\n \"Type 'exit' to return to your original directory\",\n \"With --fzf, you can interactively select the worktree to enter\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const versionHelp: CommandHelp = {\n name: \"version\",\n description: \"Display phantom version information\",\n usage: \"phantom version\",\n examples: [\n {\n description: \"Show version\",\n command: \"phantom version\",\n },\n ],\n notes: [\"Also accessible via 'phantom --version' or 'phantom -v'\"],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const whereHelp: CommandHelp = {\n name: \"where\",\n description: \"Output the filesystem path of a specific worktree\",\n usage: \"phantom where <worktree-name> [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Get the path of a worktree\",\n command: \"phantom where feature-auth\",\n },\n {\n description: \"Change directory to a worktree\",\n command: \"cd $(phantom where staging)\",\n },\n {\n description: \"Get path with interactive fzf selection\",\n command: \"phantom where --fzf\",\n },\n {\n description: \"Change directory using fzf selection\",\n command: \"cd $(phantom where --fzf)\",\n },\n ],\n notes: [\n \"Outputs only the path, making it suitable for use in scripts\",\n \"Exits with an error code if the worktree doesn't exist\",\n \"With --fzf, you can interactively select the worktree\",\n ],\n};\n"],
|
|
5
|
-
"mappings": ";;;AAEA,SAAS,MAAM,YAAY;;;ACF3B,SAA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pE,MAAI,QAAQ,MAAM;AAChB,YAAQ,IAAI,cAAc,kBAAkB,QAAQ,IAAI,CAAC;AAAA,EAC3D,OAAO;AACL,YAAQ,IAAI,mCAAmC,QAAQ,IAAI,GAAG;AAAA,EAChE;AACA,OAAK,CAAC;AACR;AAEA,IAAI;AACF,QAAM,QAAQ,QAAQ,aAAa;AACrC,SAAS,OAAO;AACd,UAAQ;AAAA,IACN;AAAA,IACA,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,EACvD;AACA,OAAK,CAAC;AACR;",
|
|
6
|
-
"names": ["args", "stdout", "command", "resolve", "command", "args", "command", "args", "args", "parseArgs", "fs", "fs", "command", "fs", "path", "path", "path", "fs", "args", "parseArgs", "commands", "command", "parseArgs", "stdout", "stdout", "resolve", "args", "getWorktreeStatus", "stdout", "listWorktrees", "getWorktreeStatus", "listWorktrees", "args", "parseArgs", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "listWorktrees", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "commands", "commands", "args", "command", "remainingArgs"]
|
|
3
|
+
"sources": ["../src/bin/phantom.ts", "../src/cli/handlers/attach.ts", "../src/core/git/libs/get-git-root.ts", "../src/core/git/executor.ts", "../src/core/types/result.ts", "../src/core/worktree/errors.ts", "../src/core/worktree/validate.ts", "../src/core/paths.ts", "../src/core/process/spawn.ts", "../src/core/process/errors.ts", "../src/core/process/exec.ts", "../src/core/process/shell.ts", "../src/core/worktree/attach.ts", "../src/core/git/libs/attach-worktree.ts", "../src/core/git/libs/branch-exists.ts", "../src/cli/output.ts", "../src/cli/errors.ts", "../src/cli/handlers/completion.ts", "../src/cli/handlers/create.ts", "../src/core/config/loader.ts", "../src/core/utils/type-guards.ts", "../src/core/config/validate.ts", "../src/core/process/tmux.ts", "../src/core/worktree/create.ts", "../src/core/git/libs/add-worktree.ts", "../src/core/worktree/file-copier.ts", "../src/cli/handlers/delete.ts", "../src/core/git/libs/list-worktrees.ts", "../src/core/git/libs/get-current-worktree.ts", "../src/core/worktree/delete.ts", "../src/core/utils/fzf.ts", "../src/core/worktree/list.ts", "../src/core/worktree/select.ts", "../src/cli/handlers/exec.ts", "../src/cli/handlers/list.ts", "../src/cli/handlers/shell.ts", "../src/cli/handlers/version.ts", "../package.json", "../src/core/version.ts", "../src/cli/handlers/where.ts", "../src/core/worktree/where.ts", "../src/cli/help.ts", "../src/cli/help/attach.ts", "../src/cli/help/completion.ts", "../src/cli/help/create.ts", "../src/cli/help/delete.ts", "../src/cli/help/exec.ts", "../src/cli/help/list.ts", "../src/cli/help/shell.ts", "../src/cli/help/version.ts", "../src/cli/help/where.ts"],
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n\nimport { argv, exit } from \"node:process\";\nimport { attachHandler } from \"../cli/handlers/attach.ts\";\nimport { completionHandler } from \"../cli/handlers/completion.ts\";\nimport { createHandler } from \"../cli/handlers/create.ts\";\nimport { deleteHandler } from \"../cli/handlers/delete.ts\";\nimport { execHandler } from \"../cli/handlers/exec.ts\";\nimport { listHandler } from \"../cli/handlers/list.ts\";\nimport { shellHandler } from \"../cli/handlers/shell.ts\";\nimport { versionHandler } from \"../cli/handlers/version.ts\";\nimport { whereHandler } from \"../cli/handlers/where.ts\";\nimport { type CommandHelp, helpFormatter } from \"../cli/help.ts\";\nimport { attachHelp } from \"../cli/help/attach.ts\";\nimport { completionHelp } from \"../cli/help/completion.ts\";\nimport { createHelp } from \"../cli/help/create.ts\";\nimport { deleteHelp } from \"../cli/help/delete.ts\";\nimport { execHelp } from \"../cli/help/exec.ts\";\nimport { listHelp } from \"../cli/help/list.ts\";\nimport { shellHelp } from \"../cli/help/shell.ts\";\nimport { versionHelp } from \"../cli/help/version.ts\";\nimport { whereHelp } from \"../cli/help/where.ts\";\n\ninterface Command {\n name: string;\n description: string;\n subcommands?: Command[];\n handler?: (args: string[]) => void | Promise<void>;\n help?: CommandHelp;\n}\n\nconst commands: Command[] = [\n {\n name: \"create\",\n description: \"Create a new Git worktree (phantom)\",\n handler: createHandler,\n help: createHelp,\n },\n {\n name: \"attach\",\n description: \"Attach to an existing branch by creating a new worktree\",\n handler: attachHandler,\n help: attachHelp,\n },\n {\n name: \"list\",\n description: \"List all Git worktrees (phantoms)\",\n handler: listHandler,\n help: listHelp,\n },\n {\n name: \"where\",\n description: \"Output the filesystem path of a specific worktree\",\n handler: whereHandler,\n help: whereHelp,\n },\n {\n name: \"delete\",\n description: \"Delete a Git worktree (phantom)\",\n handler: deleteHandler,\n help: deleteHelp,\n },\n {\n name: \"exec\",\n description: \"Execute a command in a worktree directory\",\n handler: execHandler,\n help: execHelp,\n },\n {\n name: \"shell\",\n description: \"Open an interactive shell in a worktree directory\",\n handler: shellHandler,\n help: shellHelp,\n },\n {\n name: \"version\",\n description: \"Display phantom version information\",\n handler: versionHandler,\n help: versionHelp,\n },\n {\n name: \"completion\",\n description: \"Generate shell completion scripts\",\n handler: completionHandler,\n help: completionHelp,\n },\n];\n\nfunction printHelp(commands: Command[]) {\n const simpleCommands = commands.map((cmd) => ({\n name: cmd.name,\n description: cmd.description,\n }));\n console.log(helpFormatter.formatMainHelp(simpleCommands));\n}\n\nfunction findCommand(\n args: string[],\n commands: Command[],\n): { command: Command | null; remainingArgs: string[] } {\n if (args.length === 0) {\n return { command: null, remainingArgs: [] };\n }\n\n const [cmdName, ...rest] = args;\n const command = commands.find((cmd) => cmd.name === cmdName);\n\n if (!command) {\n return { command: null, remainingArgs: args };\n }\n\n if (command.subcommands && rest.length > 0) {\n const { command: subcommand, remainingArgs } = findCommand(\n rest,\n command.subcommands,\n );\n if (subcommand) {\n return { command: subcommand, remainingArgs };\n }\n }\n\n return { command, remainingArgs: rest };\n}\n\nconst args = argv.slice(2);\n\nif (args.length === 0 || args[0] === \"-h\" || args[0] === \"--help\") {\n printHelp(commands);\n exit(0);\n}\n\nif (args[0] === \"--version\" || args[0] === \"-v\") {\n versionHandler();\n exit(0);\n}\n\nconst { command, remainingArgs } = findCommand(args, commands);\n\nif (!command || !command.handler) {\n console.error(`Error: Unknown command '${args.join(\" \")}'\\n`);\n printHelp(commands);\n exit(1);\n}\n\n// Check if user is requesting help for a specific command\nif (remainingArgs.includes(\"--help\") || remainingArgs.includes(\"-h\")) {\n if (command.help) {\n console.log(helpFormatter.formatCommandHelp(command.help));\n } else {\n console.log(`Help not available for command '${command.name}'`);\n }\n exit(0);\n}\n\ntry {\n await command.handler(remainingArgs);\n} catch (error) {\n console.error(\n \"Error:\",\n error instanceof Error ? error.message : String(error),\n );\n exit(1);\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree } from \"../../core/process/exec.ts\";\nimport { shellInWorktree } from \"../../core/process/shell.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { attachWorktreeCore } from \"../../core/worktree/attach.ts\";\nimport {\n BranchNotFoundError,\n WorktreeAlreadyExistsError,\n} from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function attachHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n strict: true,\n allowPositionals: true,\n options: {\n shell: {\n type: \"boolean\",\n short: \"s\",\n },\n exec: {\n type: \"string\",\n short: \"e\",\n },\n },\n });\n\n if (positionals.length === 0) {\n exitWithError(\n \"Missing required argument: branch name\",\n exitCodes.validationError,\n );\n }\n\n const [branchName] = positionals;\n\n if (values.shell && values.exec) {\n exitWithError(\n \"Cannot use both --shell and --exec options\",\n exitCodes.validationError,\n );\n }\n\n const gitRoot = await getGitRoot();\n const result = await attachWorktreeCore(gitRoot, branchName);\n\n if (isErr(result)) {\n const error = result.error;\n if (error instanceof WorktreeAlreadyExistsError) {\n exitWithError(error.message, exitCodes.validationError);\n }\n if (error instanceof BranchNotFoundError) {\n exitWithError(error.message, exitCodes.notFound);\n }\n exitWithError(error.message, exitCodes.generalError);\n }\n\n const worktreePath = result.value;\n output.log(`Attached phantom: ${branchName}`);\n\n if (values.shell) {\n const shellResult = await shellInWorktree(gitRoot, branchName);\n if (isErr(shellResult)) {\n exitWithError(shellResult.error.message, exitCodes.generalError);\n }\n } else if (values.exec) {\n const execResult = await execInWorktree(\n gitRoot,\n branchName,\n values.exec.split(\" \"),\n { interactive: true },\n );\n if (isErr(execResult)) {\n exitWithError(execResult.error.message, exitCodes.generalError);\n }\n }\n}\n", "import { dirname, resolve } from \"node:path\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function getGitRoot(): Promise<string> {\n const { stdout } = await executeGitCommand([\"rev-parse\", \"--git-common-dir\"]);\n\n if (stdout.endsWith(\"/.git\") || stdout === \".git\") {\n return resolve(process.cwd(), dirname(stdout));\n }\n\n const { stdout: toplevel } = await executeGitCommand([\n \"rev-parse\",\n \"--show-toplevel\",\n ]);\n return toplevel;\n}\n", "import { execFile as execFileCallback } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFile = promisify(execFileCallback);\n\nexport interface GitExecutorOptions {\n cwd?: string;\n env?: NodeJS.ProcessEnv;\n}\n\nexport interface GitExecutorResult {\n stdout: string;\n stderr: string;\n}\n\n/**\n * Execute a git command with consistent error handling\n */\nexport async function executeGitCommand(\n args: string[],\n options: GitExecutorOptions = {},\n): Promise<GitExecutorResult> {\n try {\n const result = await execFile(\"git\", args, {\n cwd: options.cwd,\n env: options.env || process.env,\n encoding: \"utf8\",\n });\n\n return {\n stdout: result.stdout.trim(),\n stderr: result.stderr.trim(),\n };\n } catch (error) {\n // Git commands often return non-zero exit codes for normal operations\n // (e.g., `git diff` returns 1 when there are differences)\n // So we need to handle errors carefully\n if (\n error &&\n typeof error === \"object\" &&\n \"stdout\" in error &&\n \"stderr\" in error\n ) {\n const execError = error as {\n stdout: string;\n stderr: string;\n code?: number;\n };\n\n // If we have stderr content, it's likely a real error\n if (execError.stderr?.trim()) {\n throw new Error(execError.stderr.trim());\n }\n\n // Otherwise, return the output even though the exit code was non-zero\n return {\n stdout: execError.stdout?.trim() || \"\",\n stderr: execError.stderr?.trim() || \"\",\n };\n }\n\n throw error;\n }\n}\n\n/**\n * Execute a git command in a specific directory\n */\nexport async function executeGitCommandInDirectory(\n directory: string,\n args: string[],\n): Promise<GitExecutorResult> {\n return executeGitCommand([\"-C\", directory, ...args], {});\n}\n", "/**\n * Represents a value that is either successful (Ok) or contains an error (Err).\n * This type is inspired by Rust's Result type and provides type-safe error handling.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value (defaults to Error)\n */\nexport type Result<T, E = Error> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/**\n * Creates a successful Result containing the given value.\n *\n * @template T - The type of the success value\n * @param value - The success value to wrap\n * @returns A Result in the Ok state containing the value\n *\n * @example\n * const result = ok(42);\n * // result: Result<number, never> = { ok: true, value: 42 }\n */\nexport const ok = <T>(value: T): Result<T, never> => ({\n ok: true,\n value,\n});\n\n/**\n * Creates a failed Result containing the given error.\n *\n * @template E - The type of the error value\n * @param error - The error value to wrap\n * @returns A Result in the Err state containing the error\n *\n * @example\n * const result = err(new Error(\"Something went wrong\"));\n * // result: Result<never, Error> = { ok: false, error: Error(...) }\n */\nexport const err = <E>(error: E): Result<never, E> => ({\n ok: false,\n error,\n});\n\n/**\n * Type guard that checks if a Result is in the Ok state.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value\n * @param result - The Result to check\n * @returns True if the Result is Ok, false otherwise\n *\n * @example\n * if (isOk(result)) {\n * console.log(result.value); // TypeScript knows result.value exists\n * }\n */\nexport const isOk = <T, E>(\n result: Result<T, E>,\n): result is { ok: true; value: T } => result.ok;\n\n/**\n * Type guard that checks if a Result is in the Err state.\n *\n * @template T - The type of the success value\n * @template E - The type of the error value\n * @param result - The Result to check\n * @returns True if the Result is Err, false otherwise\n *\n * @example\n * if (isErr(result)) {\n * console.error(result.error); // TypeScript knows result.error exists\n * }\n */\nexport const isErr = <T, E>(\n result: Result<T, E>,\n): result is { ok: false; error: E } => !result.ok;\n", "export class WorktreeError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"WorktreeError\";\n }\n}\n\nexport class WorktreeNotFoundError extends WorktreeError {\n constructor(name: string) {\n super(`Worktree '${name}' not found`);\n this.name = \"WorktreeNotFoundError\";\n }\n}\n\nexport class WorktreeAlreadyExistsError extends WorktreeError {\n constructor(name: string) {\n super(`Worktree '${name}' already exists`);\n this.name = \"WorktreeAlreadyExistsError\";\n }\n}\n\nexport class InvalidWorktreeNameError extends WorktreeError {\n constructor(name: string) {\n super(`Invalid worktree name: '${name}'`);\n this.name = \"InvalidWorktreeNameError\";\n }\n}\n\nexport class GitOperationError extends WorktreeError {\n constructor(operation: string, details: string) {\n super(`Git ${operation} failed: ${details}`);\n this.name = \"GitOperationError\";\n }\n}\n\nexport class BranchNotFoundError extends WorktreeError {\n constructor(branchName: string) {\n super(`Branch '${branchName}' not found`);\n this.name = \"BranchNotFoundError\";\n }\n}\n", "import fs from \"node:fs/promises\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface ValidationResult {\n exists: boolean;\n path?: string;\n message?: string;\n}\n\nexport async function validateWorktreeExists(\n gitRoot: string,\n name: string,\n): Promise<ValidationResult> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreePath);\n return {\n exists: true,\n path: worktreePath,\n };\n } catch {\n return {\n exists: false,\n message: `Worktree '${name}' does not exist`,\n };\n }\n}\n\nexport async function validateWorktreeDoesNotExist(\n gitRoot: string,\n name: string,\n): Promise<ValidationResult> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreePath);\n return {\n exists: true,\n message: `Worktree '${name}' already exists`,\n };\n } catch {\n return {\n exists: false,\n path: worktreePath,\n };\n }\n}\n\nexport async function validatePhantomDirectoryExists(\n gitRoot: string,\n): Promise<boolean> {\n const phantomDir = getPhantomDirectory(gitRoot);\n\n try {\n await fs.access(phantomDir);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function validateWorktreeName(name: string): Result<void, Error> {\n if (!name || name.trim() === \"\") {\n return err(new Error(\"Phantom name cannot be empty\"));\n }\n\n if (name.includes(\"/\")) {\n return err(new Error(\"Phantom name cannot contain slashes\"));\n }\n\n if (name.startsWith(\".\")) {\n return err(new Error(\"Phantom name cannot start with a dot\"));\n }\n\n return ok(undefined);\n}\n", "import { join } from \"node:path\";\n\nexport function getPhantomDirectory(gitRoot: string): string {\n return join(gitRoot, \".git\", \"phantom\", \"worktrees\");\n}\n\nexport function getWorktreePath(gitRoot: string, name: string): string {\n return join(getPhantomDirectory(gitRoot), name);\n}\n", "import {\n type ChildProcess,\n type SpawnOptions,\n spawn as nodeSpawn,\n} from \"node:child_process\";\nimport { type Result, err, ok } from \"../types/result.ts\";\nimport {\n type ProcessError,\n ProcessExecutionError,\n ProcessSignalError,\n ProcessSpawnError,\n} from \"./errors.ts\";\n\nexport interface SpawnSuccess {\n exitCode: number;\n}\n\nexport interface SpawnConfig {\n command: string;\n args?: string[];\n options?: SpawnOptions;\n}\n\nexport async function spawnProcess(\n config: SpawnConfig,\n): Promise<Result<SpawnSuccess, ProcessError>> {\n return new Promise((resolve) => {\n const { command, args = [], options = {} } = config;\n\n const childProcess: ChildProcess = nodeSpawn(command, args, {\n stdio: \"inherit\",\n ...options,\n });\n\n childProcess.on(\"error\", (error) => {\n resolve(err(new ProcessSpawnError(command, error.message)));\n });\n\n childProcess.on(\"exit\", (code, signal) => {\n if (signal) {\n resolve(err(new ProcessSignalError(signal)));\n } else {\n const exitCode = code ?? 0;\n if (exitCode === 0) {\n resolve(ok({ exitCode }));\n } else {\n resolve(err(new ProcessExecutionError(command, exitCode)));\n }\n }\n });\n });\n}\n", "export class ProcessError extends Error {\n public readonly exitCode?: number;\n\n constructor(message: string, exitCode?: number) {\n super(message);\n this.name = \"ProcessError\";\n this.exitCode = exitCode;\n }\n}\n\nexport class ProcessExecutionError extends ProcessError {\n constructor(command: string, exitCode: number) {\n super(`Command '${command}' failed with exit code ${exitCode}`, exitCode);\n this.name = \"ProcessExecutionError\";\n }\n}\n\nexport class ProcessSignalError extends ProcessError {\n constructor(signal: string) {\n const exitCode = 128 + (signal === \"SIGTERM\" ? 15 : 1);\n super(`Command terminated by signal: ${signal}`, exitCode);\n this.name = \"ProcessSignalError\";\n }\n}\n\nexport class ProcessSpawnError extends ProcessError {\n constructor(command: string, details: string) {\n super(`Error executing command '${command}': ${details}`);\n this.name = \"ProcessSpawnError\";\n }\n}\n", "import type { StdioOptions } from \"node:child_process\";\nimport { type Result, err } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"../worktree/errors.ts\";\nimport { validateWorktreeExists } from \"../worktree/validate.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type ExecInWorktreeSuccess = SpawnSuccess;\n\nexport interface ExecInWorktreeOptions {\n interactive?: boolean;\n}\n\nexport async function execInWorktree(\n gitRoot: string,\n worktreeName: string,\n command: string[],\n options: ExecInWorktreeOptions = {},\n): Promise<\n Result<ExecInWorktreeSuccess, WorktreeNotFoundError | ProcessError>\n> {\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(worktreeName));\n }\n\n const worktreePath = validation.path as string;\n const [cmd, ...args] = command;\n\n const stdio: StdioOptions = options.interactive\n ? \"inherit\"\n : [\"ignore\", \"inherit\", \"inherit\"];\n\n return spawnProcess({\n command: cmd,\n args,\n options: {\n cwd: worktreePath,\n stdio,\n },\n });\n}\n", "import { type Result, err } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"../worktree/errors.ts\";\nimport { validateWorktreeExists } from \"../worktree/validate.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type ShellInWorktreeSuccess = SpawnSuccess;\n\nexport async function shellInWorktree(\n gitRoot: string,\n worktreeName: string,\n): Promise<\n Result<ShellInWorktreeSuccess, WorktreeNotFoundError | ProcessError>\n> {\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(worktreeName));\n }\n\n const worktreePath = validation.path as string;\n const shell = process.env.SHELL || \"/bin/sh\";\n\n return spawnProcess({\n command: shell,\n args: [],\n options: {\n cwd: worktreePath,\n env: {\n ...process.env,\n PHANTOM: \"1\",\n PHANTOM_NAME: worktreeName,\n PHANTOM_PATH: worktreePath,\n },\n },\n });\n}\n", "import { existsSync } from \"node:fs\";\nimport { attachWorktree } from \"../git/libs/attach-worktree.ts\";\nimport { branchExists } from \"../git/libs/branch-exists.ts\";\nimport { getWorktreePath } from \"../paths.ts\";\nimport type { Result } from \"../types/result.ts\";\nimport { err, isErr, ok } from \"../types/result.ts\";\nimport { BranchNotFoundError, WorktreeAlreadyExistsError } from \"./errors.ts\";\nimport { validateWorktreeName } from \"./validate.ts\";\n\nexport async function attachWorktreeCore(\n gitRoot: string,\n name: string,\n): Promise<Result<string, Error>> {\n const validation = validateWorktreeName(name);\n if (isErr(validation)) {\n return validation;\n }\n\n const worktreePath = getWorktreePath(gitRoot, name);\n if (existsSync(worktreePath)) {\n return err(new WorktreeAlreadyExistsError(name));\n }\n\n const branchCheckResult = await branchExists(gitRoot, name);\n if (isErr(branchCheckResult)) {\n return err(branchCheckResult.error);\n }\n\n if (!branchCheckResult.value) {\n return err(new BranchNotFoundError(name));\n }\n\n const attachResult = await attachWorktree(gitRoot, worktreePath, name);\n if (isErr(attachResult)) {\n return err(attachResult.error);\n }\n\n return ok(worktreePath);\n}\n", "import type { Result } from \"../../types/result.ts\";\nimport { err, ok } from \"../../types/result.ts\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function attachWorktree(\n gitRoot: string,\n worktreePath: string,\n branchName: string,\n): Promise<Result<void, Error>> {\n try {\n await executeGitCommand([\"worktree\", \"add\", worktreePath, branchName], {\n cwd: gitRoot,\n });\n return ok(undefined);\n } catch (error) {\n return err(\n error instanceof Error\n ? error\n : new Error(`Failed to attach worktree: ${String(error)}`),\n );\n }\n}\n", "import type { Result } from \"../../types/result.ts\";\nimport { err, isErr, ok } from \"../../types/result.ts\";\nimport { executeGitCommand } from \"../executor.ts\";\n\nexport async function branchExists(\n gitRoot: string,\n branchName: string,\n): Promise<Result<boolean, Error>> {\n try {\n await executeGitCommand(\n [\"show-ref\", \"--verify\", \"--quiet\", `refs/heads/${branchName}`],\n { cwd: gitRoot },\n );\n return ok(true);\n } catch (error) {\n if (error && typeof error === \"object\" && \"code\" in error) {\n const execError = error as { code?: number; message?: string };\n if (execError.code === 1) {\n return ok(false);\n }\n }\n return err(\n new Error(\n `Failed to check branch existence: ${\n error instanceof Error ? error.message : String(error)\n }`,\n ),\n );\n }\n}\n", "import type { ChildProcess } from \"node:child_process\";\n\nexport const output = {\n log: (message: string) => {\n console.log(message);\n },\n\n error: (message: string) => {\n console.error(message);\n },\n\n warn: (message: string) => {\n console.warn(message);\n },\n\n table: (data: unknown) => {\n console.table(data);\n },\n\n processOutput: (proc: ChildProcess) => {\n proc.stdout?.pipe(process.stdout);\n proc.stderr?.pipe(process.stderr);\n },\n};\n", "import { output } from \"./output.ts\";\n\nexport const exitCodes = {\n success: 0,\n generalError: 1,\n notFound: 2,\n validationError: 3,\n} as const;\n\nexport function handleError(\n error: unknown,\n exitCode: number = exitCodes.generalError,\n): never {\n if (error instanceof Error) {\n output.error(error.message);\n } else {\n output.error(String(error));\n }\n process.exit(exitCode);\n}\n\nexport function exitWithSuccess(): never {\n process.exit(exitCodes.success);\n}\n\nexport function exitWithError(\n message: string,\n exitCode: number = exitCodes.generalError,\n): never {\n output.error(message);\n process.exit(exitCode);\n}\n", "import { exit } from \"node:process\";\nimport { output } from \"../output.ts\";\n\nconst FISH_COMPLETION_SCRIPT = `# Fish completion for phantom\n# Place this in ~/.config/fish/completions/phantom.fish\n\nfunction __phantom_list_worktrees\n phantom list --names 2>/dev/null\nend\n\nfunction __phantom_using_command\n set -l cmd (commandline -opc)\n set -l cmd_count (count $cmd)\n if test $cmd_count -eq 1\n # No subcommand yet, so any command can be used\n if test (count $argv) -eq 0\n return 0\n else\n return 1\n end\n else if test $cmd_count -ge 2\n # Check if we're in the context of a specific command\n if test (count $argv) -gt 0 -a \"$argv[1]\" = \"$cmd[2]\"\n return 0\n end\n end\n return 1\nend\n\n# Disable file completion for phantom\ncomplete -c phantom -f\n\n# Main commands\ncomplete -c phantom -n \"__phantom_using_command\" -a \"create\" -d \"Create a new Git worktree (phantom)\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"attach\" -d \"Attach to an existing branch by creating a new worktree\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"list\" -d \"List all Git worktrees (phantoms)\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"where\" -d \"Output the filesystem path of a specific worktree\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"delete\" -d \"Delete a Git worktree (phantom)\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"exec\" -d \"Execute a command in a worktree directory\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"shell\" -d \"Open an interactive shell in a worktree directory\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"version\" -d \"Display phantom version information\"\ncomplete -c phantom -n \"__phantom_using_command\" -a \"completion\" -d \"Generate shell completion scripts\"\n\n# Global options\ncomplete -c phantom -l help -d \"Show help (-h)\"\ncomplete -c phantom -l version -d \"Show version (-v)\"\n\n# create command options\ncomplete -c phantom -n \"__phantom_using_command create\" -l shell -d \"Open an interactive shell in the new worktree after creation (-s)\"\ncomplete -c phantom -n \"__phantom_using_command create\" -l exec -d \"Execute a command in the new worktree after creation (-x)\" -x\ncomplete -c phantom -n \"__phantom_using_command create\" -l tmux -d \"Open the worktree in a new tmux window (-t)\"\ncomplete -c phantom -n \"__phantom_using_command create\" -l tmux-vertical -d \"Open the worktree in a vertical tmux pane\"\ncomplete -c phantom -n \"__phantom_using_command create\" -l tmux-horizontal -d \"Open the worktree in a horizontal tmux pane\"\ncomplete -c phantom -n \"__phantom_using_command create\" -l copy-file -d \"Copy specified files from the current worktree\" -r\n\n# attach command options\ncomplete -c phantom -n \"__phantom_using_command attach\" -l shell -d \"Open an interactive shell in the worktree after attaching (-s)\"\ncomplete -c phantom -n \"__phantom_using_command attach\" -l exec -d \"Execute a command in the worktree after attaching (-x)\" -x\n\n# list command options\ncomplete -c phantom -n \"__phantom_using_command list\" -l fzf -d \"Use fzf for interactive selection\"\ncomplete -c phantom -n \"__phantom_using_command list\" -l names -d \"Output only phantom names (for scripts and completion)\"\n\n# where command options\ncomplete -c phantom -n \"__phantom_using_command where\" -l fzf -d \"Use fzf for interactive selection\"\ncomplete -c phantom -n \"__phantom_using_command where\" -a \"(__phantom_list_worktrees)\"\n\n# delete command options\ncomplete -c phantom -n \"__phantom_using_command delete\" -l force -d \"Force deletion even if worktree has uncommitted changes (-f)\"\ncomplete -c phantom -n \"__phantom_using_command delete\" -l current -d \"Delete the current worktree\"\ncomplete -c phantom -n \"__phantom_using_command delete\" -l fzf -d \"Use fzf for interactive selection\"\ncomplete -c phantom -n \"__phantom_using_command delete\" -a \"(__phantom_list_worktrees)\"\n\n# exec command - accept worktree names and then any command\ncomplete -c phantom -n \"__phantom_using_command exec\" -a \"(__phantom_list_worktrees)\"\n\n# shell command options\ncomplete -c phantom -n \"__phantom_using_command shell\" -l fzf -d \"Use fzf for interactive selection\"\ncomplete -c phantom -n \"__phantom_using_command shell\" -a \"(__phantom_list_worktrees)\"\n\n# completion command - shell names\ncomplete -c phantom -n \"__phantom_using_command completion\" -a \"fish zsh\" -d \"Shell type\"`;\n\nconst ZSH_COMPLETION_SCRIPT = `#compdef phantom\n# Zsh completion for phantom\n# Place this in a directory in your $fpath (e.g., ~/.zsh/completions/)\n# Or load dynamically with: eval \"$(phantom completion zsh)\"\n\n# Only define the function, don't execute it\n_phantom() {\n local -a commands\n commands=(\n 'create:Create a new Git worktree (phantom)'\n 'attach:Attach to an existing branch by creating a new worktree'\n 'list:List all Git worktrees (phantoms)'\n 'where:Output the filesystem path of a specific worktree'\n 'delete:Delete a Git worktree (phantom)'\n 'exec:Execute a command in a worktree directory'\n 'shell:Open an interactive shell in a worktree directory'\n 'version:Display phantom version information'\n 'completion:Generate shell completion scripts'\n )\n\n _arguments -C \\\\\n '--help[Show help (-h)]' \\\\\n '--version[Show version (-v)]' \\\\\n '1:command:->command' \\\\\n '*::arg:->args'\n\n case \\${state} in\n command)\n _describe 'phantom command' commands\n ;;\n args)\n case \\${line[1]} in\n create)\n _arguments \\\\\n '--shell[Open an interactive shell in the new worktree after creation (-s)]' \\\\\n '--exec[Execute a command in the new worktree after creation (-x)]:command:' \\\\\n '--tmux[Open the worktree in a new tmux window (-t)]' \\\\\n '--tmux-vertical[Open the worktree in a vertical tmux pane]' \\\\\n '--tmux-horizontal[Open the worktree in a horizontal tmux pane]' \\\\\n '*--copy-file[Copy specified files from the current worktree]:file:_files' \\\\\n '1:name:'\n ;;\n attach)\n _arguments \\\\\n '--shell[Open an interactive shell in the worktree after attaching (-s)]' \\\\\n '--exec[Execute a command in the worktree after attaching (-x)]:command:' \\\\\n '1:worktree-name:' \\\\\n '2:branch-name:'\n ;;\n list)\n _arguments \\\\\n '--fzf[Use fzf for interactive selection]' \\\\\n '--names[Output only phantom names (for scripts and completion)]'\n ;;\n where|delete|shell)\n local worktrees\n worktrees=(\\${(f)\"$(phantom list --names 2>/dev/null)\"})\n if [[ \\${line[1]} == \"where\" || \\${line[1]} == \"shell\" ]]; then\n _arguments \\\\\n '--fzf[Use fzf for interactive selection]' \\\\\n '1:worktree:(\\${(q)worktrees[@]})'\n elif [[ \\${line[1]} == \"delete\" ]]; then\n _arguments \\\\\n '--force[Force deletion even if worktree has uncommitted changes (-f)]' \\\\\n '--current[Delete the current worktree]' \\\\\n '--fzf[Use fzf for interactive selection]' \\\\\n '1:worktree:(\\${(q)worktrees[@]})'\n fi\n ;;\n exec)\n local worktrees\n worktrees=(\\${(f)\"$(phantom list --names 2>/dev/null)\"})\n _arguments \\\\\n '1:worktree:(\\${(q)worktrees[@]})' \\\\\n '*:command:_command_names'\n ;;\n completion)\n _arguments \\\\\n '1:shell:(fish zsh)'\n ;;\n esac\n ;;\n esac\n}\n\n# Register the completion function if loading dynamically\nif [[ -n \\${ZSH_VERSION} ]]; then\n autoload -Uz compinit && compinit -C\n compdef _phantom phantom\nfi`;\n\nexport function completionHandler(args: string[]): void {\n const shell = args[0];\n\n if (!shell) {\n output.error(\"Usage: phantom completion <shell>\");\n output.error(\"Supported shells: fish, zsh\");\n exit(1);\n }\n\n switch (shell.toLowerCase()) {\n case \"fish\":\n console.log(FISH_COMPLETION_SCRIPT);\n break;\n case \"zsh\":\n console.log(ZSH_COMPLETION_SCRIPT);\n break;\n default:\n output.error(`Unsupported shell: ${shell}`);\n output.error(\"Supported shells: fish, zsh\");\n exit(1);\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport {\n ConfigNotFoundError,\n ConfigParseError,\n loadConfig,\n} from \"../../core/config/loader.ts\";\nimport { ConfigValidationError } from \"../../core/config/validate.ts\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree } from \"../../core/process/exec.ts\";\nimport { shellInWorktree } from \"../../core/process/shell.ts\";\nimport { executeTmuxCommand, isInsideTmux } from \"../../core/process/tmux.ts\";\nimport { isErr, isOk } from \"../../core/types/result.ts\";\nimport { createWorktree as createWorktreeCore } from \"../../core/worktree/create.ts\";\nimport { WorktreeAlreadyExistsError } from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function createHandler(args: string[]): Promise<void> {\n const { values, positionals } = parseArgs({\n args,\n options: {\n shell: {\n type: \"boolean\",\n short: \"s\",\n },\n exec: {\n type: \"string\",\n short: \"x\",\n },\n tmux: {\n type: \"boolean\",\n short: \"t\",\n },\n \"tmux-vertical\": {\n type: \"boolean\",\n },\n \"tmux-v\": {\n type: \"boolean\",\n },\n \"tmux-horizontal\": {\n type: \"boolean\",\n },\n \"tmux-h\": {\n type: \"boolean\",\n },\n \"copy-file\": {\n type: \"string\",\n multiple: true,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n if (positionals.length === 0) {\n exitWithError(\n \"Please provide a name for the new worktree\",\n exitCodes.validationError,\n );\n }\n\n const worktreeName = positionals[0];\n const openShell = values.shell ?? false;\n const execCommand = values.exec;\n const copyFileOptions = values[\"copy-file\"];\n\n // Determine tmux option\n const tmuxOption =\n values.tmux ||\n values[\"tmux-vertical\"] ||\n values[\"tmux-v\"] ||\n values[\"tmux-horizontal\"] ||\n values[\"tmux-h\"];\n\n let tmuxDirection: \"new\" | \"vertical\" | \"horizontal\" | undefined;\n if (values.tmux) {\n tmuxDirection = \"new\";\n } else if (values[\"tmux-vertical\"] || values[\"tmux-v\"]) {\n tmuxDirection = \"vertical\";\n } else if (values[\"tmux-horizontal\"] || values[\"tmux-h\"]) {\n tmuxDirection = \"horizontal\";\n }\n\n if (\n [openShell, execCommand !== undefined, tmuxOption].filter(Boolean).length >\n 1\n ) {\n exitWithError(\n \"Cannot use --shell, --exec, and --tmux options together\",\n exitCodes.validationError,\n );\n }\n\n if (tmuxOption && !(await isInsideTmux())) {\n exitWithError(\n \"The --tmux option can only be used inside a tmux session\",\n exitCodes.validationError,\n );\n }\n\n try {\n const gitRoot = await getGitRoot();\n\n let filesToCopy: string[] = [];\n\n // Load files from config\n const configResult = await loadConfig(gitRoot);\n if (isOk(configResult)) {\n if (configResult.value.postCreate?.copyFiles) {\n filesToCopy = [...configResult.value.postCreate.copyFiles];\n }\n } else {\n // Display warning for validation and parse errors\n if (configResult.error instanceof ConfigValidationError) {\n output.warn(`Configuration warning: ${configResult.error.message}`);\n } else if (configResult.error instanceof ConfigParseError) {\n output.warn(`Configuration warning: ${configResult.error.message}`);\n }\n // ConfigNotFoundError remains silent as the config file is optional\n }\n\n // Add files from CLI options\n if (copyFileOptions && copyFileOptions.length > 0) {\n const cliFiles = Array.isArray(copyFileOptions)\n ? copyFileOptions\n : [copyFileOptions];\n // Merge with config files, removing duplicates\n filesToCopy = [...new Set([...filesToCopy, ...cliFiles])];\n }\n\n const result = await createWorktreeCore(gitRoot, worktreeName, {\n copyFiles: filesToCopy.length > 0 ? filesToCopy : undefined,\n });\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeAlreadyExistsError\n ? exitCodes.validationError\n : exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n output.log(result.value.message);\n\n if (result.value.copyError) {\n output.error(\n `\\nWarning: Failed to copy some files: ${result.value.copyError}`,\n );\n }\n\n // Execute post-create commands from config\n if (isOk(configResult) && configResult.value.postCreate?.commands) {\n const commands = configResult.value.postCreate.commands;\n output.log(\"\\nRunning post-create commands...\");\n\n for (const command of commands) {\n output.log(`Executing: ${command}`);\n const shell = process.env.SHELL || \"/bin/sh\";\n const cmdResult = await execInWorktree(gitRoot, worktreeName, [\n shell,\n \"-c\",\n command,\n ]);\n\n if (isErr(cmdResult)) {\n output.error(`Failed to execute command: ${cmdResult.error.message}`);\n const exitCode =\n \"exitCode\" in cmdResult.error\n ? (cmdResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(`Post-create command failed: ${command}`, exitCode);\n }\n\n // Check exit code\n if (cmdResult.value.exitCode !== 0) {\n exitWithError(\n `Post-create command failed: ${command}`,\n cmdResult.value.exitCode,\n );\n }\n }\n }\n\n if (execCommand && isOk(result)) {\n output.log(\n `\\nExecuting command in worktree '${worktreeName}': ${execCommand}`,\n );\n\n const shell = process.env.SHELL || \"/bin/sh\";\n const execResult = await execInWorktree(\n gitRoot,\n worktreeName,\n [shell, \"-c\", execCommand],\n { interactive: true },\n );\n\n if (isErr(execResult)) {\n output.error(execResult.error.message);\n const exitCode =\n \"exitCode\" in execResult.error\n ? (execResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n\n process.exit(execResult.value.exitCode ?? 0);\n }\n\n if (openShell && isOk(result)) {\n output.log(\n `\\nEntering worktree '${worktreeName}' at ${result.value.path}`,\n );\n output.log(\"Type 'exit' to return to your original directory\\n\");\n\n const shellResult = await shellInWorktree(gitRoot, worktreeName);\n\n if (isErr(shellResult)) {\n output.error(shellResult.error.message);\n const exitCode =\n \"exitCode\" in shellResult.error\n ? (shellResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n\n process.exit(shellResult.value.exitCode ?? 0);\n }\n\n if (tmuxDirection && isOk(result)) {\n output.log(\n `\\nOpening worktree '${worktreeName}' in tmux ${\n tmuxDirection === \"new\" ? \"window\" : \"pane\"\n }...`,\n );\n\n const shell = process.env.SHELL || \"/bin/sh\";\n\n const tmuxResult = await executeTmuxCommand({\n direction: tmuxDirection,\n command: shell,\n cwd: result.value.path,\n env: {\n PHANTOM: \"1\",\n PHANTOM_NAME: worktreeName,\n PHANTOM_PATH: result.value.path,\n },\n });\n\n if (isErr(tmuxResult)) {\n output.error(tmuxResult.error.message);\n const exitCode =\n \"exitCode\" in tmuxResult.error\n ? (tmuxResult.error.exitCode ?? exitCodes.generalError)\n : exitCodes.generalError;\n exitWithError(\"\", exitCode);\n }\n }\n\n exitWithSuccess();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { type Result, err, ok } from \"../types/result.ts\";\nimport { type ConfigValidationError, validateConfig } from \"./validate.ts\";\n\nexport interface PhantomConfig {\n postCreate?: {\n copyFiles?: string[];\n commands?: string[];\n };\n}\n\nexport class ConfigNotFoundError extends Error {\n constructor() {\n super(\"phantom.config.json not found\");\n this.name = \"ConfigNotFoundError\";\n }\n}\n\nexport class ConfigParseError extends Error {\n constructor(message: string) {\n super(`Failed to parse phantom.config.json: ${message}`);\n this.name = \"ConfigParseError\";\n }\n}\n\nexport async function loadConfig(\n gitRoot: string,\n): Promise<\n Result<\n PhantomConfig,\n ConfigNotFoundError | ConfigParseError | ConfigValidationError\n >\n> {\n const configPath = path.join(gitRoot, \"phantom.config.json\");\n\n try {\n const content = await fs.readFile(configPath, \"utf-8\");\n try {\n const parsed = JSON.parse(content);\n const validationResult = validateConfig(parsed);\n\n if (!validationResult.ok) {\n return err(validationResult.error);\n }\n\n return ok(validationResult.value);\n } catch (error) {\n return err(\n new ConfigParseError(\n error instanceof Error ? error.message : String(error),\n ),\n );\n }\n } catch (error) {\n if (error instanceof Error && \"code\" in error && error.code === \"ENOENT\") {\n return err(new ConfigNotFoundError());\n }\n throw error;\n }\n}\n", "export function isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n", "import { type Result, err, ok } from \"../types/result.ts\";\nimport { isObject } from \"../utils/type-guards.ts\";\nimport type { PhantomConfig } from \"./loader.ts\";\n\nexport class ConfigValidationError extends Error {\n constructor(message: string) {\n super(`Invalid phantom.config.json: ${message}`);\n this.name = \"ConfigValidationError\";\n }\n}\n\nexport function validateConfig(\n config: unknown,\n): Result<PhantomConfig, ConfigValidationError> {\n if (!isObject(config)) {\n return err(new ConfigValidationError(\"Configuration must be an object\"));\n }\n\n const cfg = config;\n\n if (cfg.postCreate !== undefined) {\n if (!isObject(cfg.postCreate)) {\n return err(new ConfigValidationError(\"postCreate must be an object\"));\n }\n\n const postCreate = cfg.postCreate;\n if (postCreate.copyFiles !== undefined) {\n if (!Array.isArray(postCreate.copyFiles)) {\n return err(\n new ConfigValidationError(\"postCreate.copyFiles must be an array\"),\n );\n }\n\n if (!postCreate.copyFiles.every((f: unknown) => typeof f === \"string\")) {\n return err(\n new ConfigValidationError(\n \"postCreate.copyFiles must contain only strings\",\n ),\n );\n }\n }\n\n if (postCreate.commands !== undefined) {\n if (!Array.isArray(postCreate.commands)) {\n return err(\n new ConfigValidationError(\"postCreate.commands must be an array\"),\n );\n }\n\n if (!postCreate.commands.every((c: unknown) => typeof c === \"string\")) {\n return err(\n new ConfigValidationError(\n \"postCreate.commands must contain only strings\",\n ),\n );\n }\n }\n }\n\n return ok(config as PhantomConfig);\n}\n", "import type { Result } from \"../types/result.ts\";\nimport type { ProcessError } from \"./errors.ts\";\nimport { type SpawnSuccess, spawnProcess } from \"./spawn.ts\";\n\nexport type TmuxSplitDirection = \"new\" | \"vertical\" | \"horizontal\";\n\nexport interface TmuxOptions {\n direction: TmuxSplitDirection;\n command: string;\n cwd?: string;\n env?: Record<string, string>;\n}\n\nexport type TmuxSuccess = SpawnSuccess;\n\nexport async function isInsideTmux(): Promise<boolean> {\n return process.env.TMUX !== undefined;\n}\n\nexport async function executeTmuxCommand(\n options: TmuxOptions,\n): Promise<Result<TmuxSuccess, ProcessError>> {\n const { direction, command, cwd, env } = options;\n\n const tmuxArgs: string[] = [];\n\n switch (direction) {\n case \"new\":\n tmuxArgs.push(\"new-window\");\n break;\n case \"vertical\":\n tmuxArgs.push(\"split-window\", \"-v\");\n break;\n case \"horizontal\":\n tmuxArgs.push(\"split-window\", \"-h\");\n break;\n }\n\n if (cwd) {\n tmuxArgs.push(\"-c\", cwd);\n }\n\n // Add environment variables safely\n if (env) {\n for (const [key, value] of Object.entries(env)) {\n tmuxArgs.push(\"-e\", `${key}=${value}`);\n }\n }\n\n tmuxArgs.push(command);\n\n const result = await spawnProcess({\n command: \"tmux\",\n args: tmuxArgs,\n });\n\n return result;\n}\n", "import fs from \"node:fs/promises\";\nimport { addWorktree } from \"../git/libs/add-worktree.ts\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, err, isErr, isOk, ok } from \"../types/result.ts\";\nimport { GitOperationError, WorktreeAlreadyExistsError } from \"./errors.ts\";\nimport { copyFiles } from \"./file-copier.ts\";\nimport {\n validateWorktreeDoesNotExist,\n validateWorktreeName,\n} from \"./validate.ts\";\n\nexport interface CreateWorktreeOptions {\n branch?: string;\n commitish?: string;\n copyFiles?: string[];\n}\n\nexport interface CreateWorktreeSuccess {\n message: string;\n path: string;\n copiedFiles?: string[];\n skippedFiles?: string[];\n copyError?: string;\n}\n\nexport async function createWorktree(\n gitRoot: string,\n name: string,\n options: CreateWorktreeOptions = {},\n): Promise<\n Result<CreateWorktreeSuccess, WorktreeAlreadyExistsError | GitOperationError>\n> {\n const nameValidation = validateWorktreeName(name);\n if (isErr(nameValidation)) {\n return nameValidation;\n }\n\n const { branch = name, commitish = \"HEAD\" } = options;\n\n const worktreesPath = getPhantomDirectory(gitRoot);\n const worktreePath = getWorktreePath(gitRoot, name);\n\n try {\n await fs.access(worktreesPath);\n } catch {\n await fs.mkdir(worktreesPath, { recursive: true });\n }\n\n const validation = await validateWorktreeDoesNotExist(gitRoot, name);\n if (validation.exists) {\n return err(new WorktreeAlreadyExistsError(name));\n }\n\n try {\n await addWorktree({\n path: worktreePath,\n branch,\n commitish,\n });\n\n let copiedFiles: string[] | undefined;\n let skippedFiles: string[] | undefined;\n let copyError: string | undefined;\n\n if (options.copyFiles && options.copyFiles.length > 0) {\n const copyResult = await copyFiles(\n gitRoot,\n worktreePath,\n options.copyFiles,\n );\n\n if (isOk(copyResult)) {\n copiedFiles = copyResult.value.copiedFiles;\n skippedFiles = copyResult.value.skippedFiles;\n } else {\n copyError = copyResult.error.message;\n }\n }\n\n return ok({\n message: `Created worktree '${name}' at ${worktreePath}`,\n path: worktreePath,\n copiedFiles,\n skippedFiles,\n copyError,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"worktree add\", errorMessage));\n }\n}\n", "import { executeGitCommand } from \"../executor.ts\";\n\nexport interface AddWorktreeOptions {\n path: string;\n branch: string;\n commitish?: string;\n}\n\nexport async function addWorktree(options: AddWorktreeOptions): Promise<void> {\n const { path, branch, commitish = \"HEAD\" } = options;\n\n await executeGitCommand([\"worktree\", \"add\", path, \"-b\", branch, commitish]);\n}\n", "import { copyFile, mkdir, stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface CopyFileResult {\n copiedFiles: string[];\n skippedFiles: string[];\n}\n\nexport class FileCopyError extends Error {\n public readonly file: string;\n\n constructor(file: string, message: string) {\n super(`Failed to copy ${file}: ${message}`);\n this.name = \"FileCopyError\";\n this.file = file;\n }\n}\n\nexport async function copyFiles(\n sourceDir: string,\n targetDir: string,\n files: string[],\n): Promise<Result<CopyFileResult, FileCopyError>> {\n const copiedFiles: string[] = [];\n const skippedFiles: string[] = [];\n\n for (const file of files) {\n const sourcePath = path.join(sourceDir, file);\n const targetPath = path.join(targetDir, file);\n\n try {\n const stats = await stat(sourcePath);\n if (!stats.isFile()) {\n skippedFiles.push(file);\n continue;\n }\n\n const targetDirPath = path.dirname(targetPath);\n await mkdir(targetDirPath, { recursive: true });\n\n await copyFile(sourcePath, targetPath);\n copiedFiles.push(file);\n } catch (error) {\n if (\n error instanceof Error &&\n \"code\" in error &&\n error.code === \"ENOENT\"\n ) {\n skippedFiles.push(file);\n } else {\n return err(\n new FileCopyError(\n file,\n error instanceof Error ? error.message : String(error),\n ),\n );\n }\n }\n }\n\n return ok({ copiedFiles, skippedFiles });\n}\n", "import { parseArgs } from \"node:util\";\nimport { getCurrentWorktree } from \"../../core/git/libs/get-current-worktree.ts\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { deleteWorktree as deleteWorktreeCore } from \"../../core/worktree/delete.ts\";\nimport {\n WorktreeError,\n WorktreeNotFoundError,\n} from \"../../core/worktree/errors.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function deleteHandler(args: string[]): Promise<void> {\n const { values, positionals } = parseArgs({\n args,\n options: {\n force: {\n type: \"boolean\",\n short: \"f\",\n },\n current: {\n type: \"boolean\",\n },\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const deleteCurrent = values.current ?? false;\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !deleteCurrent && !useFzf) {\n exitWithError(\n \"Please provide a worktree name to delete, use --current to delete the current worktree, or use --fzf for interactive selection\",\n exitCodes.validationError,\n );\n }\n\n if ((positionals.length > 0 || useFzf) && deleteCurrent) {\n exitWithError(\n \"Cannot specify --current with a worktree name or --fzf option\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n const forceDelete = values.force ?? false;\n\n try {\n const gitRoot = await getGitRoot();\n\n let worktreeName: string;\n if (deleteCurrent) {\n const currentWorktree = await getCurrentWorktree(gitRoot);\n if (!currentWorktree) {\n exitWithError(\n \"Not in a worktree directory. The --current option can only be used from within a worktree.\",\n exitCodes.validationError,\n );\n }\n worktreeName = currentWorktree;\n } else if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n const result = await deleteWorktreeCore(gitRoot, worktreeName, {\n force: forceDelete,\n });\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.validationError\n : result.error instanceof WorktreeError &&\n result.error.message.includes(\"uncommitted changes\")\n ? exitCodes.validationError\n : exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n output.log(result.value.message);\n exitWithSuccess();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { executeGitCommand } from \"../executor.ts\";\n\nexport interface GitWorktree {\n path: string;\n branch: string;\n head: string;\n isLocked: boolean;\n isPrunable: boolean;\n}\n\nexport async function listWorktrees(gitRoot: string): Promise<GitWorktree[]> {\n const { stdout } = await executeGitCommand([\n \"worktree\",\n \"list\",\n \"--porcelain\",\n ]);\n\n const worktrees: GitWorktree[] = [];\n let currentWorktree: Partial<GitWorktree> = {};\n\n const lines = stdout.split(\"\\n\").filter((line) => line.length > 0);\n\n for (const line of lines) {\n if (line.startsWith(\"worktree \")) {\n if (currentWorktree.path) {\n worktrees.push(currentWorktree as GitWorktree);\n }\n currentWorktree = {\n path: line.substring(\"worktree \".length),\n isLocked: false,\n isPrunable: false,\n };\n } else if (line.startsWith(\"HEAD \")) {\n currentWorktree.head = line.substring(\"HEAD \".length);\n } else if (line.startsWith(\"branch \")) {\n const fullBranch = line.substring(\"branch \".length);\n currentWorktree.branch = fullBranch.startsWith(\"refs/heads/\")\n ? fullBranch.substring(\"refs/heads/\".length)\n : fullBranch;\n } else if (line === \"detached\") {\n currentWorktree.branch = \"(detached HEAD)\";\n } else if (line === \"locked\") {\n currentWorktree.isLocked = true;\n } else if (line === \"prunable\") {\n currentWorktree.isPrunable = true;\n }\n }\n\n if (currentWorktree.path) {\n worktrees.push(currentWorktree as GitWorktree);\n }\n\n return worktrees;\n}\n", "import { executeGitCommand } from \"../executor.ts\";\nimport { listWorktrees } from \"./list-worktrees.ts\";\n\nexport async function getCurrentWorktree(\n gitRoot: string,\n): Promise<string | null> {\n try {\n const { stdout: currentPath } = await executeGitCommand([\n \"rev-parse\",\n \"--show-toplevel\",\n ]);\n\n const currentPathTrimmed = currentPath.trim();\n\n const worktrees = await listWorktrees(gitRoot);\n\n const currentWorktree = worktrees.find(\n (wt) => wt.path === currentPathTrimmed,\n );\n\n if (!currentWorktree || currentWorktree.path === gitRoot) {\n return null;\n }\n\n return currentWorktree.branch;\n } catch {\n return null;\n }\n}\n", "import {\n executeGitCommand,\n executeGitCommandInDirectory,\n} from \"../git/executor.ts\";\nimport { type Result, err, isOk, ok } from \"../types/result.ts\";\nimport {\n GitOperationError,\n WorktreeError,\n WorktreeNotFoundError,\n} from \"./errors.ts\";\nimport { validateWorktreeExists } from \"./validate.ts\";\n\nexport interface DeleteWorktreeOptions {\n force?: boolean;\n}\n\nexport interface DeleteWorktreeSuccess {\n message: string;\n hasUncommittedChanges?: boolean;\n changedFiles?: number;\n}\n\nexport interface WorktreeStatus {\n hasUncommittedChanges: boolean;\n changedFiles: number;\n}\n\nexport async function getWorktreeStatus(\n worktreePath: string,\n): Promise<WorktreeStatus> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"status\",\n \"--porcelain\",\n ]);\n if (stdout) {\n return {\n hasUncommittedChanges: true,\n changedFiles: stdout.split(\"\\n\").length,\n };\n }\n } catch {\n // If git status fails, assume no changes\n }\n return {\n hasUncommittedChanges: false,\n changedFiles: 0,\n };\n}\n\nexport async function removeWorktree(\n gitRoot: string,\n worktreePath: string,\n force = false,\n): Promise<void> {\n try {\n await executeGitCommand([\"worktree\", \"remove\", worktreePath], {\n cwd: gitRoot,\n });\n } catch (error) {\n // Always try force removal if the regular removal fails\n try {\n await executeGitCommand([\"worktree\", \"remove\", \"--force\", worktreePath], {\n cwd: gitRoot,\n });\n } catch {\n throw new Error(\"Failed to remove worktree\");\n }\n }\n}\n\nexport async function deleteBranch(\n gitRoot: string,\n branchName: string,\n): Promise<Result<boolean, GitOperationError>> {\n try {\n await executeGitCommand([\"branch\", \"-D\", branchName], { cwd: gitRoot });\n return ok(true);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"branch delete\", errorMessage));\n }\n}\n\nexport async function deleteWorktree(\n gitRoot: string,\n name: string,\n options: DeleteWorktreeOptions = {},\n): Promise<\n Result<\n DeleteWorktreeSuccess,\n WorktreeNotFoundError | WorktreeError | GitOperationError\n >\n> {\n const { force = false } = options;\n\n const validation = await validateWorktreeExists(gitRoot, name);\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(name));\n }\n\n const worktreePath = validation.path as string;\n\n const status = await getWorktreeStatus(worktreePath);\n\n if (status.hasUncommittedChanges && !force) {\n return err(\n new WorktreeError(\n `Worktree '${name}' has uncommitted changes (${status.changedFiles} files). Use --force to delete anyway.`,\n ),\n );\n }\n\n try {\n await removeWorktree(gitRoot, worktreePath, force);\n\n const branchName = name;\n const branchResult = await deleteBranch(gitRoot, branchName);\n\n let message: string;\n if (isOk(branchResult)) {\n message = `Deleted worktree '${name}' and its branch '${branchName}'`;\n } else {\n message = `Deleted worktree '${name}'`;\n message += `\\nNote: Branch '${branchName}' could not be deleted: ${branchResult.error.message}`;\n }\n\n if (status.hasUncommittedChanges) {\n message = `Warning: Worktree '${name}' had uncommitted changes (${status.changedFiles} files)\\n${message}`;\n }\n\n return ok({\n message,\n hasUncommittedChanges: status.hasUncommittedChanges,\n changedFiles: status.hasUncommittedChanges\n ? status.changedFiles\n : undefined,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return err(new GitOperationError(\"worktree remove\", errorMessage));\n }\n}\n", "import { spawn } from \"node:child_process\";\nimport { type Result, err, ok } from \"../types/result.ts\";\n\nexport interface FzfOptions {\n prompt?: string;\n header?: string;\n previewCommand?: string;\n}\n\nexport async function selectWithFzf(\n items: string[],\n options: FzfOptions = {},\n): Promise<Result<string | null, Error>> {\n return new Promise((resolve) => {\n const args: string[] = [];\n\n if (options.prompt) {\n args.push(\"--prompt\", options.prompt);\n }\n\n if (options.header) {\n args.push(\"--header\", options.header);\n }\n\n if (options.previewCommand) {\n args.push(\"--preview\", options.previewCommand);\n }\n\n const fzf = spawn(\"fzf\", args, {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n });\n\n let result = \"\";\n let errorOutput = \"\";\n\n fzf.stdout.on(\"data\", (data) => {\n result += data.toString();\n });\n\n if (fzf.stderr) {\n fzf.stderr.on(\"data\", (data) => {\n errorOutput += data.toString();\n });\n }\n\n fzf.on(\"error\", (error) => {\n if (error.message.includes(\"ENOENT\")) {\n resolve(\n err(new Error(\"fzf command not found. Please install fzf first.\")),\n );\n } else {\n resolve(err(error));\n }\n });\n\n fzf.on(\"close\", (code) => {\n if (code === 0) {\n const selected = result.trim();\n resolve(ok(selected || null));\n } else if (code === 1) {\n resolve(ok(null));\n } else if (code === 130) {\n resolve(ok(null));\n } else {\n resolve(err(new Error(`fzf exited with code ${code}: ${errorOutput}`)));\n }\n });\n\n fzf.stdin.write(items.join(\"\\n\"));\n fzf.stdin.end();\n });\n}\n", "import { executeGitCommandInDirectory } from \"../git/executor.ts\";\nimport { listWorktrees as gitListWorktrees } from \"../git/libs/list-worktrees.ts\";\nimport { getPhantomDirectory, getWorktreePath } from \"../paths.ts\";\nimport { type Result, ok } from \"../types/result.ts\";\n\nexport interface WorktreeInfo {\n name: string;\n path: string;\n branch: string;\n isClean: boolean;\n}\n\nexport interface ListWorktreesSuccess {\n worktrees: WorktreeInfo[];\n message?: string;\n}\n\nexport async function getWorktreeBranch(worktreePath: string): Promise<string> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"branch\",\n \"--show-current\",\n ]);\n return stdout || \"(detached HEAD)\";\n } catch {\n return \"unknown\";\n }\n}\n\nexport async function getWorktreeStatus(\n worktreePath: string,\n): Promise<boolean> {\n try {\n const { stdout } = await executeGitCommandInDirectory(worktreePath, [\n \"status\",\n \"--porcelain\",\n ]);\n return !stdout; // Clean if no output\n } catch {\n // If git status fails, assume clean\n return true;\n }\n}\n\nexport async function getWorktreeInfo(\n gitRoot: string,\n name: string,\n): Promise<WorktreeInfo> {\n const worktreePath = getWorktreePath(gitRoot, name);\n\n const [branch, isClean] = await Promise.all([\n getWorktreeBranch(worktreePath),\n getWorktreeStatus(worktreePath),\n ]);\n\n return {\n name,\n path: worktreePath,\n branch,\n isClean,\n };\n}\n\nexport async function listWorktrees(\n gitRoot: string,\n): Promise<Result<ListWorktreesSuccess, never>> {\n try {\n const gitWorktrees = await gitListWorktrees(gitRoot);\n const phantomDir = getPhantomDirectory(gitRoot);\n\n const phantomWorktrees = gitWorktrees.filter((worktree) =>\n worktree.path.startsWith(phantomDir),\n );\n\n if (phantomWorktrees.length === 0) {\n return ok({\n worktrees: [],\n message: \"No worktrees found\",\n });\n }\n\n const worktrees = await Promise.all(\n phantomWorktrees.map(async (gitWorktree) => {\n const name = gitWorktree.path.substring(phantomDir.length + 1);\n const isClean = await getWorktreeStatus(gitWorktree.path);\n\n return {\n name,\n path: gitWorktree.path,\n branch: gitWorktree.branch || \"(detached HEAD)\",\n isClean,\n };\n }),\n );\n\n return ok({\n worktrees,\n });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to list worktrees: ${errorMessage}`);\n }\n}\n", "import { type Result, isErr } from \"../types/result.ts\";\nimport { selectWithFzf } from \"../utils/fzf.ts\";\nimport { listWorktrees } from \"./list.ts\";\n\nexport interface SelectWorktreeResult {\n name: string;\n branch: string | null;\n isClean: boolean;\n}\n\nexport async function selectWorktreeWithFzf(\n gitRoot: string,\n): Promise<Result<SelectWorktreeResult | null, Error>> {\n const listResult = await listWorktrees(gitRoot);\n\n if (isErr(listResult)) {\n return listResult;\n }\n\n const { worktrees } = listResult.value;\n\n if (worktrees.length === 0) {\n return {\n ok: true,\n value: null,\n };\n }\n\n const list = worktrees.map((wt) => {\n const branchInfo = wt.branch ? `(${wt.branch})` : \"\";\n const status = !wt.isClean ? \" [dirty]\" : \"\";\n return `${wt.name} ${branchInfo}${status}`;\n });\n\n const fzfResult = await selectWithFzf(list, {\n prompt: \"Select worktree> \",\n header: \"Git Worktrees (Phantoms)\",\n });\n\n if (isErr(fzfResult)) {\n return fzfResult;\n }\n\n if (!fzfResult.value) {\n return {\n ok: true,\n value: null,\n };\n }\n\n const selectedName = fzfResult.value.split(\" \")[0];\n const selectedWorktree = worktrees.find((wt) => wt.name === selectedName);\n\n if (!selectedWorktree) {\n return {\n ok: false,\n error: new Error(\"Selected worktree not found\"),\n };\n }\n\n return {\n ok: true,\n value: {\n name: selectedWorktree.name,\n branch: selectedWorktree.branch,\n isClean: selectedWorktree.isClean,\n },\n };\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { execInWorktree as execInWorktreeCore } from \"../../core/process/exec.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { WorktreeNotFoundError } from \"../../core/worktree/errors.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\n\nexport async function execHandler(args: string[]): Promise<void> {\n const { positionals } = parseArgs({\n args,\n options: {},\n strict: true,\n allowPositionals: true,\n });\n\n if (positionals.length < 2) {\n exitWithError(\n \"Usage: phantom exec <worktree-name> <command> [args...]\",\n exitCodes.validationError,\n );\n }\n\n const [worktreeName, ...commandArgs] = positionals;\n\n try {\n const gitRoot = await getGitRoot();\n const result = await execInWorktreeCore(\n gitRoot,\n worktreeName,\n commandArgs,\n { interactive: true },\n );\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.notFound\n : result.error.exitCode || exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n process.exit(result.value.exitCode);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { listWorktrees as listWorktreesCore } from \"../../core/worktree/list.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { exitCodes, exitWithError } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function listHandler(args: string[] = []): Promise<void> {\n const { values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n names: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: false,\n });\n try {\n const gitRoot = await getGitRoot();\n\n if (values.fzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n\n if (selectResult.value) {\n output.log(selectResult.value.name);\n }\n } else {\n const result = await listWorktreesCore(gitRoot);\n\n if (isErr(result)) {\n exitWithError(\"Failed to list worktrees\", exitCodes.generalError);\n }\n\n const { worktrees, message } = result.value;\n\n if (worktrees.length === 0) {\n if (!values.names) {\n output.log(message || \"No worktrees found.\");\n }\n process.exit(exitCodes.success);\n }\n\n if (values.names) {\n for (const worktree of worktrees) {\n output.log(worktree.name);\n }\n } else {\n const maxNameLength = Math.max(\n ...worktrees.map((wt) => wt.name.length),\n );\n\n for (const worktree of worktrees) {\n const paddedName = worktree.name.padEnd(maxNameLength + 2);\n const branchInfo = worktree.branch ? `(${worktree.branch})` : \"\";\n const status = !worktree.isClean ? \" [dirty]\" : \"\";\n\n output.log(`${paddedName} ${branchInfo}${status}`);\n }\n }\n }\n\n process.exit(exitCodes.success);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { shellInWorktree as shellInWorktreeCore } from \"../../core/process/shell.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { WorktreeNotFoundError } from \"../../core/worktree/errors.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { validateWorktreeExists } from \"../../core/worktree/validate.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function shellHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !useFzf) {\n exitWithError(\n \"Usage: phantom shell <worktree-name> or phantom shell --fzf\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n let worktreeName: string;\n\n try {\n const gitRoot = await getGitRoot();\n\n if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n // Get worktree path for display\n const validation = await validateWorktreeExists(gitRoot, worktreeName);\n if (!validation.exists) {\n exitWithError(\n validation.message || `Worktree '${worktreeName}' not found`,\n exitCodes.generalError,\n );\n }\n\n output.log(`Entering worktree '${worktreeName}' at ${validation.path}`);\n output.log(\"Type 'exit' to return to your original directory\\n\");\n\n const result = await shellInWorktreeCore(gitRoot, worktreeName);\n\n if (isErr(result)) {\n const exitCode =\n result.error instanceof WorktreeNotFoundError\n ? exitCodes.notFound\n : result.error.exitCode || exitCodes.generalError;\n exitWithError(result.error.message, exitCode);\n }\n\n process.exit(result.value.exitCode);\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n}\n", "import { parseArgs } from \"node:util\";\nimport { getVersion } from \"../../core/version.ts\";\nimport { exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport function versionHandler(args: string[] = []): void {\n parseArgs({\n args,\n options: {},\n strict: true,\n allowPositionals: false,\n });\n const version = getVersion();\n output.log(`Phantom v${version}`);\n exitWithSuccess();\n}\n", "{\n \"name\": \"@aku11i/phantom\",\n \"packageManager\": \"pnpm@10.8.1\",\n \"version\": \"0.9.0\",\n \"description\": \"A powerful CLI tool for managing Git worktrees for parallel development\",\n \"keywords\": [\n \"git\",\n \"worktree\",\n \"cli\",\n \"phantom\",\n \"workspace\",\n \"development\",\n \"parallel\"\n ],\n \"homepage\": \"https://github.com/aku11i/phantom#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/aku11i/phantom/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/aku11i/phantom.git\"\n },\n \"license\": \"MIT\",\n \"author\": \"aku11i\",\n \"type\": \"module\",\n \"bin\": {\n \"phantom\": \"./dist/phantom.js\"\n },\n \"scripts\": {\n \"start\": \"node ./src/bin/phantom.ts\",\n \"phantom\": \"node ./src/bin/phantom.ts\",\n \"build\": \"node build.ts\",\n \"typecheck\": \"tsgo --noEmit\",\n \"test\": \"node --test --experimental-strip-types --experimental-test-module-mocks \\\"src/**/*.test.js\\\"\",\n \"test:coverage\": \"node --experimental-test-coverage --test --experimental-strip-types --experimental-test-module-mocks \\\"src/**/*.test.js\\\"\",\n \"test:file\": \"node --test --experimental-strip-types --experimental-test-module-mocks\",\n \"lint\": \"biome check .\",\n \"fix\": \"biome check --write .\",\n \"ready\": \"pnpm fix && pnpm typecheck && pnpm test\",\n \"ready:check\": \"pnpm lint && pnpm typecheck && pnpm test\",\n \"prepublishOnly\": \"pnpm ready:check && pnpm build\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"files\": [\n \"dist/\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"devDependencies\": {\n \"@biomejs/biome\": \"^1.9.4\",\n \"@types/node\": \"^22.15.29\",\n \"@typescript/native-preview\": \"7.0.0-dev.20250602.1\",\n \"esbuild\": \"^0.25.5\",\n \"typescript\": \"^5.8.3\"\n }\n}\n", "import packageJson from \"../../package.json\" with { type: \"json\" };\n\nexport function getVersion(): string {\n return packageJson.version;\n}\n", "import { parseArgs } from \"node:util\";\nimport { getGitRoot } from \"../../core/git/libs/get-git-root.ts\";\nimport { isErr } from \"../../core/types/result.ts\";\nimport { selectWorktreeWithFzf } from \"../../core/worktree/select.ts\";\nimport { whereWorktree as whereWorktreeCore } from \"../../core/worktree/where.ts\";\nimport { exitCodes, exitWithError, exitWithSuccess } from \"../errors.ts\";\nimport { output } from \"../output.ts\";\n\nexport async function whereHandler(args: string[]): Promise<void> {\n const { positionals, values } = parseArgs({\n args,\n options: {\n fzf: {\n type: \"boolean\",\n default: false,\n },\n },\n strict: true,\n allowPositionals: true,\n });\n\n const useFzf = values.fzf ?? false;\n\n if (positionals.length === 0 && !useFzf) {\n exitWithError(\n \"Usage: phantom where <worktree-name> or phantom where --fzf\",\n exitCodes.validationError,\n );\n }\n\n if (positionals.length > 0 && useFzf) {\n exitWithError(\n \"Cannot specify both a worktree name and --fzf option\",\n exitCodes.validationError,\n );\n }\n\n let worktreeName: string;\n let gitRoot: string;\n\n try {\n gitRoot = await getGitRoot();\n } catch (error) {\n exitWithError(\n error instanceof Error ? error.message : String(error),\n exitCodes.generalError,\n );\n }\n\n if (useFzf) {\n const selectResult = await selectWorktreeWithFzf(gitRoot);\n if (isErr(selectResult)) {\n exitWithError(selectResult.error.message, exitCodes.generalError);\n }\n if (!selectResult.value) {\n exitWithSuccess();\n }\n worktreeName = selectResult.value.name;\n } else {\n worktreeName = positionals[0];\n }\n\n const result = await whereWorktreeCore(gitRoot, worktreeName);\n\n if (isErr(result)) {\n exitWithError(result.error.message, exitCodes.notFound);\n }\n\n output.log(result.value.path);\n exitWithSuccess();\n}\n", "import { type Result, err, ok } from \"../types/result.ts\";\nimport { WorktreeNotFoundError } from \"./errors.ts\";\nimport { validateWorktreeExists } from \"./validate.ts\";\n\nexport interface WhereWorktreeSuccess {\n path: string;\n}\n\nexport async function whereWorktree(\n gitRoot: string,\n name: string,\n): Promise<Result<WhereWorktreeSuccess, WorktreeNotFoundError>> {\n const validation = await validateWorktreeExists(gitRoot, name);\n\n if (!validation.exists) {\n return err(new WorktreeNotFoundError(name));\n }\n\n return ok({\n path: validation.path as string,\n });\n}\n", "import { stdout } from \"node:process\";\n\nexport interface CommandOption {\n name: string;\n short?: string;\n type: \"boolean\" | \"string\";\n description: string;\n multiple?: boolean;\n example?: string;\n}\n\nexport interface CommandHelp {\n name: string;\n description: string;\n usage: string;\n options?: CommandOption[];\n examples?: Array<{\n description: string;\n command: string;\n }>;\n notes?: string[];\n}\n\nexport class HelpFormatter {\n private readonly width: number;\n private readonly indent = \" \";\n\n constructor() {\n this.width = stdout.columns || 80;\n }\n\n formatMainHelp(\n commands: Array<{ name: string; description: string }>,\n ): string {\n const lines: string[] = [];\n\n lines.push(this.bold(\"Phantom - Git Worktree Manager\"));\n lines.push(\"\");\n lines.push(\n this.dim(\n \"A CLI tool for managing Git worktrees with enhanced functionality\",\n ),\n );\n lines.push(\"\");\n lines.push(this.section(\"USAGE\"));\n lines.push(`${this.indent}phantom <command> [options]`);\n lines.push(\"\");\n lines.push(this.section(\"COMMANDS\"));\n\n const maxNameLength = Math.max(...commands.map((cmd) => cmd.name.length));\n\n for (const cmd of commands) {\n const paddedName = cmd.name.padEnd(maxNameLength + 2);\n lines.push(`${this.indent}${this.cyan(paddedName)}${cmd.description}`);\n }\n\n lines.push(\"\");\n lines.push(this.section(\"GLOBAL OPTIONS\"));\n const helpOption = \"-h, --help\";\n const versionOption = \"-v, --version\";\n const globalOptionWidth =\n Math.max(helpOption.length, versionOption.length) + 2;\n lines.push(\n `${this.indent}${this.cyan(helpOption.padEnd(globalOptionWidth))}Show help`,\n );\n lines.push(\n `${this.indent}${this.cyan(versionOption.padEnd(globalOptionWidth))}Show version`,\n );\n lines.push(\"\");\n lines.push(\n this.dim(\n \"Run 'phantom <command> --help' for more information on a command.\",\n ),\n );\n\n return lines.join(\"\\n\");\n }\n\n formatCommandHelp(help: CommandHelp): string {\n const lines: string[] = [];\n\n lines.push(this.bold(`phantom ${help.name}`));\n lines.push(this.dim(help.description));\n lines.push(\"\");\n\n lines.push(this.section(\"USAGE\"));\n lines.push(`${this.indent}${help.usage}`);\n lines.push(\"\");\n\n if (help.options && help.options.length > 0) {\n lines.push(this.section(\"OPTIONS\"));\n const maxOptionLength = Math.max(\n ...help.options.map((opt) => this.formatOptionName(opt).length),\n );\n\n for (const option of help.options) {\n const optionName = this.formatOptionName(option);\n const paddedName = optionName.padEnd(maxOptionLength + 2);\n const description = this.wrapText(\n option.description,\n maxOptionLength + 4,\n );\n\n lines.push(`${this.indent}${this.cyan(paddedName)}${description[0]}`);\n for (let i = 1; i < description.length; i++) {\n lines.push(\n `${this.indent}${\" \".repeat(maxOptionLength + 2)}${description[i]}`,\n );\n }\n\n if (option.example) {\n const exampleIndent = \" \".repeat(maxOptionLength + 4);\n lines.push(\n `${this.indent}${exampleIndent}${this.dim(`Example: ${option.example}`)}`,\n );\n }\n }\n lines.push(\"\");\n }\n\n if (help.examples && help.examples.length > 0) {\n lines.push(this.section(\"EXAMPLES\"));\n for (const example of help.examples) {\n lines.push(`${this.indent}${this.dim(example.description)}`);\n lines.push(`${this.indent}${this.indent}$ ${example.command}`);\n lines.push(\"\");\n }\n }\n\n if (help.notes && help.notes.length > 0) {\n lines.push(this.section(\"NOTES\"));\n for (const note of help.notes) {\n const wrappedNote = this.wrapText(note, 2);\n for (const line of wrappedNote) {\n lines.push(`${this.indent}${line}`);\n }\n }\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n }\n\n private formatOptionName(option: CommandOption): string {\n const parts: string[] = [];\n\n if (option.short) {\n parts.push(`-${option.short},`);\n }\n\n parts.push(`--${option.name}`);\n\n if (option.type === \"string\") {\n parts.push(option.multiple ? \"<value>...\" : \"<value>\");\n }\n\n return parts.join(\" \");\n }\n\n private wrapText(text: string, indent: number): string[] {\n const maxWidth = this.width - indent - 2;\n const words = text.split(\" \");\n const lines: string[] = [];\n let currentLine = \"\";\n\n for (const word of words) {\n if (currentLine.length + word.length + 1 > maxWidth) {\n lines.push(currentLine);\n currentLine = word;\n } else {\n currentLine = currentLine ? `${currentLine} ${word}` : word;\n }\n }\n\n if (currentLine) {\n lines.push(currentLine);\n }\n\n return lines;\n }\n\n private section(text: string): string {\n return this.bold(text);\n }\n\n private bold(text: string): string {\n return `\\x1b[1m${text}\\x1b[0m`;\n }\n\n private dim(text: string): string {\n return `\\x1b[2m${text}\\x1b[0m`;\n }\n\n private cyan(text: string): string {\n return `\\x1b[36m${text}\\x1b[0m`;\n }\n}\n\nexport const helpFormatter = new HelpFormatter();\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const attachHelp: CommandHelp = {\n name: \"attach\",\n description: \"Attach to an existing branch by creating a new worktree\",\n usage: \"phantom attach <worktree-name> <branch-name> [options]\",\n options: [\n {\n name: \"shell\",\n short: \"s\",\n type: \"boolean\",\n description: \"Open an interactive shell in the worktree after attaching\",\n },\n {\n name: \"exec\",\n short: \"x\",\n type: \"string\",\n description: \"Execute a command in the worktree after attaching\",\n example: \"--exec 'git pull'\",\n },\n ],\n examples: [\n {\n description: \"Attach to an existing branch\",\n command: \"phantom attach review-pr main\",\n },\n {\n description: \"Attach to a remote branch and open a shell\",\n command: \"phantom attach hotfix origin/hotfix-v1.2 --shell\",\n },\n {\n description: \"Attach to a branch and pull latest changes\",\n command: \"phantom attach staging origin/staging --exec 'git pull'\",\n },\n ],\n notes: [\n \"The branch must already exist (locally or remotely)\",\n \"If attaching to a remote branch, it will be checked out locally\",\n \"Only one of --shell or --exec options can be used at a time\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const completionHelp: CommandHelp = {\n name: \"completion\",\n usage: \"phantom completion <shell>\",\n description: \"Generate shell completion scripts for fish or zsh\",\n examples: [\n {\n command:\n \"phantom completion fish > ~/.config/fish/completions/phantom.fish\",\n description: \"Generate and install Fish completion\",\n },\n {\n command: \"phantom completion fish | source\",\n description: \"Load Fish completion in current session\",\n },\n {\n command: \"phantom completion zsh > ~/.zsh/completions/_phantom\",\n description: \"Generate and install Zsh completion\",\n },\n {\n command: 'eval \"$(phantom completion zsh)\"',\n description: \"Load Zsh completion in current session\",\n },\n ],\n notes: [\n \"Supported shells: fish, zsh\",\n \"After installing completions, you may need to restart your shell or source the completion file\",\n \"For Fish: completions are loaded automatically from ~/.config/fish/completions/\",\n \"For Zsh: ensure the completion file is in a directory in your $fpath\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const createHelp: CommandHelp = {\n name: \"create\",\n description: \"Create a new Git worktree (phantom)\",\n usage: \"phantom create <name> [options]\",\n options: [\n {\n name: \"shell\",\n short: \"s\",\n type: \"boolean\",\n description:\n \"Open an interactive shell in the new worktree after creation\",\n },\n {\n name: \"exec\",\n short: \"x\",\n type: \"string\",\n description: \"Execute a command in the new worktree after creation\",\n example: \"--exec 'npm install'\",\n },\n {\n name: \"tmux\",\n short: \"t\",\n type: \"boolean\",\n description:\n \"Open the worktree in a new tmux window (requires being inside tmux)\",\n },\n {\n name: \"tmux-vertical\",\n type: \"boolean\",\n description:\n \"Open the worktree in a vertical tmux pane (requires being inside tmux)\",\n },\n {\n name: \"tmux-horizontal\",\n type: \"boolean\",\n description:\n \"Open the worktree in a horizontal tmux pane (requires being inside tmux)\",\n },\n {\n name: \"copy-file\",\n type: \"string\",\n multiple: true,\n description:\n \"Copy specified files from the current worktree to the new one. Can be used multiple times\",\n example: \"--copy-file .env --copy-file config.local.json\",\n },\n ],\n examples: [\n {\n description: \"Create a new worktree named 'feature-auth'\",\n command: \"phantom create feature-auth\",\n },\n {\n description: \"Create a worktree and open a shell in it\",\n command: \"phantom create bugfix-123 --shell\",\n },\n {\n description: \"Create a worktree and run npm install\",\n command: \"phantom create new-feature --exec 'npm install'\",\n },\n {\n description: \"Create a worktree in a new tmux window\",\n command: \"phantom create experiment --tmux\",\n },\n {\n description: \"Create a worktree and copy environment files\",\n command:\n \"phantom create staging --copy-file .env --copy-file database.yml\",\n },\n ],\n notes: [\n \"The worktree name will be used as the branch name\",\n \"Only one of --shell, --exec, or --tmux options can be used at a time\",\n \"File copying can also be configured in phantom.config.json\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const deleteHelp: CommandHelp = {\n name: \"delete\",\n description: \"Delete a Git worktree (phantom)\",\n usage: \"phantom delete <name> [options]\",\n options: [\n {\n name: \"force\",\n short: \"f\",\n type: \"boolean\",\n description:\n \"Force deletion even if the worktree has uncommitted or unpushed changes\",\n },\n {\n name: \"--current\",\n type: \"boolean\",\n description: \"Delete the current worktree\",\n },\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Delete a worktree\",\n command: \"phantom delete feature-auth\",\n },\n {\n description: \"Force delete a worktree with uncommitted changes\",\n command: \"phantom delete experimental --force\",\n },\n {\n description: \"Delete the current worktree\",\n command: \"phantom delete --current\",\n },\n {\n description: \"Delete a worktree with interactive fzf selection\",\n command: \"phantom delete --fzf\",\n },\n ],\n notes: [\n \"By default, deletion will fail if the worktree has uncommitted changes\",\n \"The associated branch will also be deleted if it's not checked out elsewhere\",\n \"With --fzf, you can interactively select the worktree to delete\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const execHelp: CommandHelp = {\n name: \"exec\",\n description: \"Execute a command in a worktree directory\",\n usage: \"phantom exec <worktree-name> <command> [args...]\",\n examples: [\n {\n description: \"Run npm test in a worktree\",\n command: \"phantom exec feature-auth npm test\",\n },\n {\n description: \"Check git status in a worktree\",\n command: \"phantom exec bugfix-123 git status\",\n },\n {\n description: \"Run a complex command with arguments\",\n command: \"phantom exec staging npm run build -- --production\",\n },\n ],\n notes: [\n \"The command is executed with the worktree directory as the working directory\",\n \"All arguments after the worktree name are passed to the command\",\n \"The exit code of the executed command is preserved\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const listHelp: CommandHelp = {\n name: \"list\",\n description: \"List all Git worktrees (phantoms)\",\n usage: \"phantom list [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n {\n name: \"--names\",\n type: \"boolean\",\n description: \"Output only phantom names (for scripts and completion)\",\n },\n ],\n examples: [\n {\n description: \"List all worktrees\",\n command: \"phantom list\",\n },\n {\n description: \"List worktrees with interactive fzf selection\",\n command: \"phantom list --fzf\",\n },\n {\n description: \"List only worktree names\",\n command: \"phantom list --names\",\n },\n ],\n notes: [\n \"Shows all worktrees with their paths and associated branches\",\n \"The main worktree is marked as '(bare)' if using a bare repository\",\n \"With --fzf, outputs only the selected worktree name\",\n \"Use --names for shell completion scripts and automation\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const shellHelp: CommandHelp = {\n name: \"shell\",\n description: \"Open an interactive shell in a worktree directory\",\n usage: \"phantom shell <worktree-name> [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Open a shell in a worktree\",\n command: \"phantom shell feature-auth\",\n },\n {\n description: \"Open a shell with interactive fzf selection\",\n command: \"phantom shell --fzf\",\n },\n ],\n notes: [\n \"Uses your default shell from the SHELL environment variable\",\n \"The shell starts with the worktree directory as the working directory\",\n \"Type 'exit' to return to your original directory\",\n \"With --fzf, you can interactively select the worktree to enter\",\n ],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const versionHelp: CommandHelp = {\n name: \"version\",\n description: \"Display phantom version information\",\n usage: \"phantom version\",\n examples: [\n {\n description: \"Show version\",\n command: \"phantom version\",\n },\n ],\n notes: [\"Also accessible via 'phantom --version' or 'phantom -v'\"],\n};\n", "import type { CommandHelp } from \"../help.ts\";\n\nexport const whereHelp: CommandHelp = {\n name: \"where\",\n description: \"Output the filesystem path of a specific worktree\",\n usage: \"phantom where <worktree-name> [options]\",\n options: [\n {\n name: \"--fzf\",\n type: \"boolean\",\n description: \"Use fzf for interactive selection\",\n },\n ],\n examples: [\n {\n description: \"Get the path of a worktree\",\n command: \"phantom where feature-auth\",\n },\n {\n description: \"Change directory to a worktree\",\n command: \"cd $(phantom where staging)\",\n },\n {\n description: \"Get path with interactive fzf selection\",\n command: \"phantom where --fzf\",\n },\n {\n description: \"Change directory using fzf selection\",\n command: \"cd $(phantom where --fzf)\",\n },\n ],\n notes: [\n \"Outputs only the path, making it suitable for use in scripts\",\n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AAA,MAAK,CAAC;AACR;",
|
|
6
|
+
"names": ["exit", "args", "stdout", "command", "resolve", "command", "args", "command", "args", "args", "args", "parseArgs", "fs", "fs", "command", "fs", "path", "path", "path", "fs", "args", "parseArgs", "commands", "command", "parseArgs", "stdout", "stdout", "resolve", "args", "getWorktreeStatus", "stdout", "listWorktrees", "getWorktreeStatus", "listWorktrees", "args", "parseArgs", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "listWorktrees", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "parseArgs", "args", "parseArgs", "commands", "commands", "args", "command", "remainingArgs", "exit"]
|
|
7
7
|
}
|