multi-agents-cli 1.0.27 → 1.0.29

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.
Files changed (2) hide show
  1. package/init.js +21 -3
  2. package/package.json +1 -1
package/init.js CHANGED
@@ -80,10 +80,20 @@ const red = (s) => `${c.red}${s}${c.reset}`;
80
80
 
81
81
  // ── CLI argument handling ─────────────────────────────────────────────────────
82
82
 
83
- const args = process.argv.slice(2);
83
+ const args = process.argv.slice(2);
84
84
  const isGlobalCLI = args[0] === 'init' && args[1];
85
+ const isReInit = args[0] === 'init' && !args[1];
85
86
  const projectArg = isGlobalCLI ? args[1] : null;
86
87
 
88
+ if (isReInit) {
89
+ // Re-init from inside project or worktree - self-relocate to repo root
90
+ try {
91
+ const { execSync } = require('child_process');
92
+ const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
93
+ process.chdir(repoRoot);
94
+ } catch { /* stay in current directory */ }
95
+ }
96
+
87
97
  if (isGlobalCLI) {
88
98
  const targetDir = path.resolve(process.cwd(), projectArg);
89
99
 
@@ -93,6 +103,13 @@ if (isGlobalCLI) {
93
103
  fs.mkdirSync(targetDir, { recursive: true });
94
104
  process.chdir(targetDir);
95
105
 
106
+ // Write temporary package.json so npm run init works if abandoned mid-init
107
+ fs.writeFileSync(
108
+ path.join(targetDir, 'package.json'),
109
+ JSON.stringify({ name: path.basename(targetDir), version: '1.0.0', scripts: { init: 'multi-agents init' } }, null, 2),
110
+ 'utf8'
111
+ );
112
+
96
113
  // Initialize git
97
114
  try {
98
115
  execSync('git init -b main', { cwd: targetDir, stdio: 'pipe' });
@@ -1137,8 +1154,9 @@ If a dependency is not met:
1137
1154
  prompts: '^2.4.2',
1138
1155
  },
1139
1156
  scripts: {
1140
- agent: 'cd "$(git rev-parse --git-common-dir)/.." && node .workflow/agent.js',
1141
- complete: 'cd "$(git rev-parse --git-common-dir)/.." && node .workflow/complete.js',
1157
+ init: 'multi-agents init',
1158
+ agent: 'node .workflow/agent.js',
1159
+ complete: 'node .workflow/complete.js',
1142
1160
  },
1143
1161
  };
1144
1162
  fs.writeFileSync(path.join(ROOT, 'package.json'), JSON.stringify(userPackage, null, 2), 'utf8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multi-agents-cli",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Multi-agent workflow orchestration for Claude Code — isolated git worktrees, structured state tracking, autonomous task chaining",
5
5
  "keywords": [
6
6
  "claude-code",