zcf 2.9.7 โ†’ 2.9.9

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/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as displayBanner, a4 as selectScriptLanguage, a5 as resolveAiOutputLanguage, a6 as updatePromptOnly, a7 as selectAndInstallWorkflows, a8 as version, a9 as checkAndUpdateTools, aa as displayBannerWithInfo, i as init } from './chunks/simple-config.mjs';
4
+ import { J as getTranslation, Z as ZCF_CONFIG_FILE, h as SUPPORTED_LANGS, K as addNumbersToChoices, j as LANG_LABELS, N as updateZcfConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, O as readZcfConfig, x as applyAiLanguageDirective, P as configureAiPersonality, v as getExistingModelConfig, u as updateDefaultModel, Q as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, R as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, w as getExistingApiConfig, T as formatApiKeyDisplay, H as addCompletedOnboarding, U as modifyApiConfigPartially, V as isCcrInstalled, W as installCcr, X as setupCcrConfiguration, Y as validateApiKey, r as configureApi, _ as readZcfConfigAsync, I as I18N, $ as readCcrConfig, a0 as configureCcrFeature, a1 as handleExitPromptError, a2 as handleGeneralError, a3 as COMETIX_COMMANDS, a4 as COMETIX_COMMAND_NAME, a5 as displayBanner, a6 as selectScriptLanguage, a7 as resolveAiOutputLanguage, a8 as updatePromptOnly, a9 as selectAndInstallWorkflows, aa as version, ab as checkAndUpdateTools, ac as displayBannerWithInfo, i as init } from './chunks/simple-config.mjs';
5
5
  import inquirer from 'inquirer';
6
6
  import { existsSync, unlinkSync } from 'node:fs';
7
7
  import { x } from 'tinyexec';
@@ -9,14 +9,14 @@ import { homedir } from 'node:os';
9
9
  import { join } from 'node:path';
10
10
  import { exec } from 'child_process';
11
11
  import { promisify } from 'util';
12
+ import { exec as exec$1 } from 'node:child_process';
13
+ import { promisify as promisify$1 } from 'node:util';
12
14
  import 'pathe';
13
15
  import 'dayjs';
14
16
  import 'node:url';
15
17
  import 'ora';
16
18
  import 'semver';
17
19
  import 'node:fs/promises';
18
- import 'node:child_process';
19
- import 'node:util';
20
20
 
21
21
  function handleCancellation(scriptLang) {
22
22
  const i18n = getTranslation(scriptLang);
@@ -294,7 +294,7 @@ async function configureAiMemoryFeature(scriptLang) {
294
294
  return;
295
295
  }
296
296
  }
297
- const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.ab; });
297
+ const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.ad; });
298
298
  const aiOutputLang = await selectAiOutputLanguage(scriptLang, scriptLang);
299
299
  applyAiLanguageDirective(aiOutputLang);
300
300
  updateZcfConfig({ aiOutputLang });
@@ -438,7 +438,7 @@ async function executeCcusage(args = []) {
438
438
  }
439
439
  }
440
440
 
441
- const execAsync = promisify(exec);
441
+ const execAsync$1 = promisify(exec);
442
442
  async function runCcrUi(scriptLang, apiKey) {
443
443
  const i18n = I18N[scriptLang];
444
444
  console.log(ansis.cyan(`
@@ -450,7 +450,7 @@ async function runCcrUi(scriptLang, apiKey) {
450
450
  `));
451
451
  }
452
452
  try {
453
- const { stdout, stderr } = await execAsync("ccr ui");
453
+ const { stdout, stderr } = await execAsync$1("ccr ui");
454
454
  if (stdout) console.log(stdout);
455
455
  if (stderr) console.error(ansis.yellow(stderr));
456
456
  console.log(ansis.green(`\u2714 ${i18n.ccr.ccrUiStarted}`));
@@ -464,7 +464,7 @@ async function runCcrStatus(scriptLang) {
464
464
  console.log(ansis.cyan(`
465
465
  \u{1F4CA} ${i18n.ccr.checkingCcrStatus}`));
466
466
  try {
467
- const { stdout, stderr } = await execAsync("ccr status");
467
+ const { stdout, stderr } = await execAsync$1("ccr status");
468
468
  if (stdout) {
469
469
  console.log("\n" + ansis.bold(i18n.ccr.ccrStatusTitle));
470
470
  console.log(stdout);
@@ -480,7 +480,7 @@ async function runCcrRestart(scriptLang) {
480
480
  console.log(ansis.cyan(`
481
481
  \u{1F504} ${i18n.ccr.restartingCcr}`));
482
482
  try {
483
- const { stdout, stderr } = await execAsync("ccr restart");
483
+ const { stdout, stderr } = await execAsync$1("ccr restart");
484
484
  if (stdout) console.log(stdout);
485
485
  if (stderr) console.error(ansis.yellow(stderr));
486
486
  console.log(ansis.green(`\u2714 ${i18n.ccr.ccrRestarted}`));
@@ -494,7 +494,7 @@ async function runCcrStart(scriptLang) {
494
494
  console.log(ansis.cyan(`
495
495
  \u25B6\uFE0F ${i18n.ccr.startingCcr}`));
496
496
  try {
497
- const { stdout, stderr } = await execAsync("ccr start");
497
+ const { stdout, stderr } = await execAsync$1("ccr start");
498
498
  if (stdout) console.log(stdout);
499
499
  if (stderr) console.error(ansis.yellow(stderr));
500
500
  console.log(ansis.green(`\u2714 ${i18n.ccr.ccrStarted}`));
@@ -514,7 +514,7 @@ async function runCcrStop(scriptLang) {
514
514
  console.log(ansis.cyan(`
515
515
  \u23F9\uFE0F ${i18n.ccr.stoppingCcr}`));
516
516
  try {
517
- const { stdout, stderr } = await execAsync("ccr stop");
517
+ const { stdout, stderr } = await execAsync$1("ccr stop");
518
518
  if (stdout) console.log(stdout);
519
519
  if (stderr) console.error(ansis.yellow(stderr));
520
520
  console.log(ansis.green(`\u2714 ${i18n.ccr.ccrStopped}`));
@@ -642,6 +642,84 @@ async function showCcrMenu(scriptLang) {
642
642
  }
643
643
  }
644
644
 
645
+ const execAsync = promisify$1(exec$1);
646
+ async function runCometixInstallOrUpdate(scriptLang) {
647
+ const i18n = getTranslation(scriptLang);
648
+ try {
649
+ console.log(ansis.blue(`${i18n.cometix.installingOrUpdating}`));
650
+ await execAsync(COMETIX_COMMANDS.INSTALL);
651
+ console.log(ansis.green(`\u2714 ${i18n.cometix.installUpdateSuccess}`));
652
+ } catch (error) {
653
+ console.error(ansis.red(`\u2717 ${i18n.cometix.installUpdateFailed}: ${error}`));
654
+ throw error;
655
+ }
656
+ }
657
+ async function runCometixPrintConfig(scriptLang) {
658
+ const i18n = getTranslation(scriptLang);
659
+ try {
660
+ console.log(ansis.blue(`${i18n.cometix.printingConfig}`));
661
+ const { stdout } = await execAsync(COMETIX_COMMANDS.PRINT_CONFIG);
662
+ console.log(stdout);
663
+ } catch (error) {
664
+ if (error.message.includes(`command not found: ${COMETIX_COMMAND_NAME}`)) {
665
+ console.error(ansis.red(`\u2717 ${i18n.cometix.commandNotFound}`));
666
+ } else {
667
+ console.error(ansis.red(`\u2717 ${i18n.cometix.printConfigFailed}: ${error}`));
668
+ }
669
+ throw error;
670
+ }
671
+ }
672
+
673
+ async function showCometixMenu(scriptLang) {
674
+ try {
675
+ const i18n = getTranslation(scriptLang);
676
+ console.log("\n" + ansis.cyan("\u2550".repeat(50)));
677
+ console.log(ansis.bold.cyan(` ${i18n.cometix.cometixMenuTitle}`));
678
+ console.log(ansis.cyan("\u2550".repeat(50)) + "\n");
679
+ console.log(` ${ansis.cyan("1.")} ${i18n.cometix.cometixMenuOptions.installOrUpdate} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.installOrUpdate)}`);
680
+ console.log(` ${ansis.cyan("2.")} ${i18n.cometix.cometixMenuOptions.printConfig} ${ansis.gray("- " + i18n.cometix.cometixMenuDescriptions.printConfig)}`);
681
+ console.log(` ${ansis.yellow("0.")} ${i18n.cometix.cometixMenuOptions.back}`);
682
+ console.log("");
683
+ const { choice } = await inquirer.prompt({
684
+ type: "input",
685
+ name: "choice",
686
+ message: i18n.common.enterChoice,
687
+ validate: (value) => {
688
+ const valid = ["1", "2", "0"];
689
+ return valid.includes(value) || i18n.common.invalidChoice;
690
+ }
691
+ });
692
+ switch (choice) {
693
+ case "1":
694
+ await runCometixInstallOrUpdate(scriptLang);
695
+ break;
696
+ case "2":
697
+ await runCometixPrintConfig(scriptLang);
698
+ break;
699
+ case "0":
700
+ return false;
701
+ }
702
+ if (choice !== "0") {
703
+ console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
704
+ const { continueInCometix } = await inquirer.prompt({
705
+ type: "confirm",
706
+ name: "continueInCometix",
707
+ message: i18n.common.returnToMenu,
708
+ default: true
709
+ });
710
+ if (continueInCometix) {
711
+ return await showCometixMenu(scriptLang);
712
+ }
713
+ }
714
+ return false;
715
+ } catch (error) {
716
+ if (!handleExitPromptError(error)) {
717
+ handleGeneralError(error, scriptLang);
718
+ }
719
+ return false;
720
+ }
721
+ }
722
+
645
723
  function getValidLanguage(lang) {
646
724
  return lang && lang in I18N ? lang : "en";
647
725
  }
@@ -712,6 +790,10 @@ async function runCcrMenuFeature(scriptLang) {
712
790
  const validLang = getValidLanguage(scriptLang);
713
791
  await showCcrMenu(validLang);
714
792
  }
793
+ async function runCometixMenuFeature(scriptLang) {
794
+ const validLang = getValidLanguage(scriptLang);
795
+ await showCometixMenu(validLang);
796
+ }
715
797
 
716
798
  async function update(options = {}) {
717
799
  try {
@@ -817,6 +899,9 @@ async function showMainMenu() {
817
899
  console.log(
818
900
  ` ${ansis.cyan("U.")} ${i18n.menu.menuOptions.ccusage} ${ansis.gray("- " + i18n.menu.menuDescriptions.ccusage)}`
819
901
  );
902
+ console.log(
903
+ ` ${ansis.cyan("L.")} ${i18n.menu.menuOptions.cometixLine} ${ansis.gray("- " + i18n.menu.menuDescriptions.cometixLine)}`
904
+ );
820
905
  console.log("");
821
906
  console.log(" ------------ ZCF ------------");
822
907
  console.log(
@@ -837,7 +922,7 @@ async function showMainMenu() {
837
922
  name: "choice",
838
923
  message: i18n.common.enterChoice,
839
924
  validate: (value) => {
840
- const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "0", "-", "+", "q", "Q"];
925
+ const valid = ["1", "2", "3", "4", "5", "6", "7", "r", "R", "u", "U", "l", "L", "0", "-", "+", "q", "Q"];
841
926
  return valid.includes(value) || i18n.common.invalidChoice;
842
927
  }
843
928
  });
@@ -876,6 +961,10 @@ async function showMainMenu() {
876
961
  case "U":
877
962
  await runCcusageFeature(scriptLang);
878
963
  break;
964
+ case "l":
965
+ case "L":
966
+ await runCometixMenuFeature(scriptLang);
967
+ break;
879
968
  case "0":
880
969
  const newLang = await changeScriptLanguageFeature(scriptLang);
881
970
  if (newLang !== scriptLang) {
@@ -894,7 +983,7 @@ async function showMainMenu() {
894
983
  break;
895
984
  }
896
985
  if (!exitMenu && choice.toLowerCase() !== "q") {
897
- if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r") {
986
+ if (choice === "0" || choice === "-" || choice === "+" || choice.toLowerCase() === "u" || choice.toLowerCase() === "r" || choice.toLowerCase() === "l") {
898
987
  console.log("\n" + ansis.dim("\u2500".repeat(50)) + "\n");
899
988
  continue;
900
989
  }
package/dist/index.d.mts CHANGED
@@ -13,6 +13,7 @@ interface TranslationStructure {
13
13
  errors: any;
14
14
  tools: any;
15
15
  ccr: any;
16
+ cometix: any;
16
17
  updater: any;
17
18
  }
18
19
 
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ interface TranslationStructure {
13
13
  errors: any;
14
14
  tools: any;
15
15
  ccr: any;
16
+ cometix: any;
16
17
  updater: any;
17
18
  }
18
19
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "2.9.7",
4
+ "version": "2.9.9",
5
5
  "description": "Zero-Config Claude-Code Flow - One-click configuration tool for Claude Code",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/UfoMiao/zcf",
@@ -0,0 +1,301 @@
1
+ ---
2
+ description: Manage Git worktrees, support add/list/remove/migrate operations, create in .zcf/ directory by default, auto-configure git ignore rules, support IDE quick open and content migration
3
+ allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp, code, cursor, webstorm), Write(.git/info/exclude)
4
+ argument-hint: <add|list|remove|prune|migrate> [path] [-b <branch>] [-o|--open] [--track] [--guess-remote] [--detach] [--checkout] [--lock] [--migrate-from <source-path>] [--migrate-stash]
5
+ # examples:
6
+ # - /git-worktree add feature-ui # create worktree, ask whether to open in IDE by default
7
+ # - /git-worktree add feature-ui -o # create worktree and open directly in IDE
8
+ # - /git-worktree add hotfix -b fix/login -o # create new branch, worktree and open in IDE directly
9
+ # - /git-worktree migrate feature-ui --from main # migrate uncommitted content from main branch to feature-ui worktree
10
+ # - /git-worktree migrate feature-ui --stash # migrate current stash content to feature-ui worktree
11
+ ---
12
+
13
+ # Claude Command: Git Worktree
14
+
15
+ **Purpose**: Provide Git worktree quick operations, manage multiple working trees in `.zcf/` directory by default, auto-handle git ignore configuration, support IDE quick open and cross-worktree content migration.
16
+
17
+ ---
18
+
19
+ ## Usage
20
+
21
+ ```bash
22
+ # Add worktree (default in .zcf/)
23
+ /git-worktree add <path> # checkout same-name branch to .zcf/<path>, ask whether to open IDE
24
+ /git-worktree add <path> -b <branch> # create new branch and add worktree
25
+ /git-worktree add <path> -o # create and open directly in IDE
26
+ /git-worktree add <path> -b <branch> --open # create new branch, worktree and open directly
27
+
28
+ # Content migration
29
+ /git-worktree migrate <target-path> --from <source-path> # migrate uncommitted content
30
+ /git-worktree migrate <target-path> --stash # migrate stash content
31
+
32
+ # Other operations
33
+ /git-worktree list # show all worktree status
34
+ /git-worktree remove <path> # remove specified worktree
35
+ /git-worktree prune # clean invalid worktree records
36
+ ```
37
+
38
+ ### Options
39
+
40
+ | Option | Description |
41
+ |--------|-------------|
42
+ | `add <path>` | Add new worktree in `.zcf/<path>` |
43
+ | `migrate <target>` | Migrate content to specified worktree |
44
+ | `list` | List all worktrees and their status |
45
+ | `remove <path>` | Remove worktree at specified path |
46
+ | `prune` | Clean invalid worktree references |
47
+ | `-b <branch>` | Create new branch and checkout to worktree |
48
+ | `-o, --open` | Open directly in IDE after creation (skip prompt) |
49
+ | `--from <source>` | Specify migration source path (migrate only) |
50
+ | `--stash` | Migrate current stash content (migrate only) |
51
+ | `--track` | Set new branch to track corresponding remote branch |
52
+ | `--guess-remote` | Auto guess remote branch for tracking |
53
+ | `--detach` | Create detached HEAD worktree |
54
+ | `--checkout` | Checkout immediately after creation (default behavior) |
55
+ | `--lock` | Lock worktree after creation |
56
+
57
+ ---
58
+
59
+ ## What This Command Does
60
+
61
+ ### 1. **Environment Check**
62
+ - Confirm in Git repository via `git rev-parse --is-inside-work-tree`
63
+
64
+ ### 2. **Ignore Rules Configuration**
65
+ - Check if `.git/info/exclude` contains `/.zcf/` rule
66
+ - Auto-add `/.zcf/` to `.git/info/exclude` if not exists
67
+
68
+ ### 3. **Worktree Operations**
69
+ - **add**: Create new worktree in `.zcf/<path>`
70
+ - **list**: Show all worktree paths, branches and status
71
+ - **remove**: Safely remove specified worktree
72
+ - **prune**: Clean orphaned worktree records
73
+
74
+ ### 4. **๐Ÿ†• IDE Quick Open Feature**
75
+ - **Default behavior**: Ask whether to open new worktree in IDE after `add` operation
76
+ - **Direct open**: Use `-o/--open` parameter to skip prompt and open directly
77
+ - **IDE detection**: Auto-detect common IDEs (VS Code, Cursor, WebStorm, etc.)
78
+ - **Smart selection**: Recommend best choice based on project type and installed IDEs
79
+
80
+ ### 5. **๐Ÿ†• Content Migration Feature**
81
+ - **Uncommitted content migration**: Migrate uncommitted changes from one worktree to another
82
+ - **Stash migration**: Apply current stash content to target worktree
83
+ - **Safety check**: Check target worktree status before migration to avoid conflicts
84
+
85
+ ### 6. **Path Handling**
86
+ - Auto-add `.zcf/` prefix to all relative paths
87
+ - Keep absolute paths as-is
88
+ - Auto-create `.zcf/` directory if not exists
89
+
90
+ ### 7. **Branch Management**
91
+ - Support checking out existing branches or creating new branches
92
+ - Auto-handle remote branch tracking
93
+ - Provide branch status and HEAD position info
94
+
95
+ ---
96
+
97
+ ## Enhanced Features
98
+
99
+ ### ๐Ÿ–ฅ๏ธ **IDE Integration**
100
+
101
+ **Supported IDEs**
102
+ - **VS Code**: `code <path>`
103
+ - **Cursor**: `cursor <path>`
104
+ - **WebStorm**: `webstorm <path>`
105
+ - **Others**: Configurable custom IDE commands
106
+
107
+ **Open Modes**
108
+ ```bash
109
+ # Default: ask whether to open after creation
110
+ /git-worktree add feature-ui
111
+ # Output: ๐Ÿ–ฅ๏ธ Open .zcf/feature-ui in IDE? [y/n]:
112
+
113
+ # Direct open: skip prompt
114
+ /git-worktree add feature-ui -o
115
+ # Output: ๐Ÿš€ Opening .zcf/feature-ui in VS Code...
116
+ ```
117
+
118
+ **Smart Detection Flow**
119
+ 1. Check installed IDEs in system
120
+ 2. Recommend based on project type (e.g., recommend VS Code for Node.js projects)
121
+ 3. Provide selection menu for user choice (default mode)
122
+ 4. Remember user preference for next time
123
+
124
+ ### ๐Ÿ“ฆ **Content Migration System**
125
+
126
+ **Migration Types**
127
+ ```bash
128
+ # Migrate uncommitted content from main branch
129
+ /git-worktree migrate feature-ui --from main
130
+
131
+ # Migrate from other worktree
132
+ /git-worktree migrate hotfix --from .zcf/feature-ui
133
+
134
+ # Migrate current stash
135
+ /git-worktree migrate feature-ui --stash
136
+
137
+ # Migrate specific stash
138
+ /git-worktree migrate feature-ui --stash stash@{2}
139
+ ```
140
+
141
+ **Migration Flow**
142
+ 1. **Source check**: Verify source path exists and has uncommitted content
143
+ 2. **Target check**: Ensure target worktree working directory is clean
144
+ 3. **Content analysis**: Show files and changes to be migrated
145
+ 4. **Safe migration**: Use git native commands to ensure data safety
146
+ 5. **Result confirmation**: Show migration results and follow-up suggestions
147
+
148
+ ---
149
+
150
+ ## Safety Features
151
+
152
+ - **Path check**: Prevent creating worktree in existing directory
153
+ - **Branch conflict check**: Avoid same branch being checked out by multiple worktrees
154
+ - **Auto cleanup**: Remove operation cleans both directory and git references
155
+ - **Status display**: Clearly show each worktree's branch, commit and status
156
+
157
+ ### **Migration Safety Protection**
158
+ - **Conflict detection**: Check for potential file conflicts before migration
159
+ - **Backup mechanism**: Auto-create stash backup before migration
160
+ - **Rollback support**: Provide rollback solution when migration fails
161
+ - **Status validation**: Ensure source and target worktrees are in correct state
162
+
163
+ ### **IDE Integration Safety**
164
+ - **Path validation**: Ensure IDE commands use correct paths
165
+ - **Permission check**: Verify IDE executable permissions
166
+ - **Error handling**: Friendly error messages when IDE startup fails
167
+
168
+ ---
169
+
170
+ ## Examples
171
+
172
+ ### **Basic Usage + IDE Open**
173
+ ```bash
174
+ # Create worktree and ask for IDE open (default behavior)
175
+ /git-worktree add feature-ui
176
+ # Output:
177
+ # โœ… Worktree created at .zcf/feature-ui
178
+ # ๐Ÿ–ฅ๏ธ Detected IDEs:
179
+ # 1. VS Code (recommended)
180
+ # 2. Cursor
181
+ # Open this worktree in IDE? [1/2/n]: 1
182
+ # ๐Ÿš€ Opening .zcf/feature-ui in VS Code...
183
+
184
+ # Create worktree and open IDE directly
185
+ /git-worktree add feature-ui -o
186
+ # Output:
187
+ # โœ… Worktree created at .zcf/feature-ui
188
+ # ๐Ÿš€ Opening .zcf/feature-ui in VS Code...
189
+
190
+ # Create new branch and open directly
191
+ /git-worktree add hotfix -b fix/login --open
192
+ # Output:
193
+ # โœ… Created branch 'fix/login' and worktree at .zcf/hotfix
194
+ # ๐Ÿš€ Opening .zcf/hotfix in VS Code...
195
+ ```
196
+
197
+ ### **Content Migration Scenarios**
198
+ ```bash
199
+ # Scenario: developed some features on main branch, want to move to new branch
200
+ # 1. Create new feature worktree
201
+ /git-worktree add feature-ui -b feature/new-ui
202
+
203
+ # 2. Migrate uncommitted content from main
204
+ /git-worktree migrate feature-ui --from main
205
+ # Output:
206
+ # ๐Ÿ“ฆ Found uncommitted content:
207
+ # M src/components/Button.tsx
208
+ # A src/components/Modal.tsx
209
+ # ?? src/styles/new-theme.css
210
+ # ๐Ÿ”„ Migrating to .zcf/feature-ui...
211
+ # โœ… Migration completed! Suggest committing these changes in new worktree.
212
+
213
+ # 3. Ask whether to open IDE (since -o wasn't used during creation)
214
+ # ๐Ÿ–ฅ๏ธ Open .zcf/feature-ui in IDE? [y/n]: y
215
+ ```
216
+
217
+ ### **Stash Migration**
218
+ ```bash
219
+ # Have some stashes, want to apply to specific worktree
220
+ /git-worktree migrate hotfix --stash
221
+ # Output:
222
+ # ๐Ÿ“‹ Found stashes:
223
+ # stash@{0}: WIP on main: fix user login
224
+ # stash@{1}: WIP on main: update docs
225
+ # Select stash to migrate [0/1]: 0
226
+ # ๐Ÿ”„ Applying stash@{0} to .zcf/hotfix...
227
+ # โœ… Stash content applied successfully!
228
+ ```
229
+
230
+ ### **List and Manage Worktrees**
231
+ ```bash
232
+ # View all worktrees
233
+ /git-worktree list
234
+ # Output:
235
+ # /path/to/project [main] โ† main working tree
236
+ # /path/to/project/.zcf/feature-ui [feature/new-ui]
237
+ # /path/to/project/.zcf/hotfix [fix/login]
238
+
239
+ # Remove unneeded worktree
240
+ /git-worktree remove feature-ui
241
+ # Output:
242
+ # โœ… Worktree .zcf/feature-ui removed successfully
243
+
244
+ # Clean invalid references
245
+ /git-worktree prune
246
+ # Output:
247
+ # ๐Ÿงน Pruned 0 worktree entries
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Directory Structure
253
+
254
+ After using this command, project structure will be:
255
+ ```
256
+ your-project/
257
+ โ”œโ”€โ”€ .git/
258
+ โ”œโ”€โ”€ .zcf/ # worktree directory (ignored by git)
259
+ โ”‚ โ”œโ”€โ”€ feature-ui/ # feature-ui branch working tree
260
+ โ”‚ โ”œโ”€โ”€ hotfix/ # hotfix branch working tree
261
+ โ”‚ โ”œโ”€โ”€ debug/ # debug working tree
262
+ โ”‚ โ””โ”€โ”€ .worktree-config # worktree config file
263
+ โ”œโ”€โ”€ src/ # main working tree source
264
+ โ””โ”€โ”€ package.json # main working tree files
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Configuration
270
+
271
+ ### **IDE Preferences**
272
+ Command saves user preferences in `.zcf/.worktree-config`:
273
+ ```json
274
+ {
275
+ "preferredIDE": "code",
276
+ "autoOpenIDE": false,
277
+ "migrateBackup": true,
278
+ "defaultWorktreeDir": ".zcf"
279
+ }
280
+ ```
281
+
282
+ ### **Custom IDE Commands**
283
+ ```bash
284
+ # Set custom IDE
285
+ git config worktree.ide.custom "subl %s" # Sublime Text
286
+ git config worktree.ide.preferred "custom"
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Notes
292
+
293
+ - **Performance optimization**: Worktrees share `.git` directory, saving disk space
294
+ - **IDE support**: Most modern IDEs support multi-worktree projects
295
+ - **Cleanup suggestion**: Regularly run `prune` to clean invalid references
296
+ - **Branch protection**: Avoid operations on protected branches (like main/master)
297
+ - **Migration limitation**: Can only migrate uncommitted changes, use `git cherry-pick` for committed content
298
+ - **IDE requirement**: IDE command-line tools must be installed and in PATH
299
+ - **Cross-platform support**: IDE detection and startup support Windows, macOS, Linux
300
+
301
+ ---