@zibby/cli 0.1.6 → 0.1.7
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/package.json +1 -1
- package/src/commands/init.js +12 -1
- package/src/commands/run.js +2 -0
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -205,10 +205,21 @@ export async function initCommand(projectName, options) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
//
|
|
208
|
+
// Create package.json for new projects, or ensure "type": "module" in existing ones
|
|
209
209
|
if (isNewProject) {
|
|
210
210
|
const packageJsonContent = generatePackageJson(projectNameActual, answers);
|
|
211
211
|
await writeFile(join(targetDir, 'package.json'), packageJsonContent);
|
|
212
|
+
} else if (!existsSync(join(targetDir, 'package.json'))) {
|
|
213
|
+
const minimalPkg = JSON.stringify({ type: 'module', private: true }, null, 2);
|
|
214
|
+
await writeFile(join(targetDir, 'package.json'), minimalPkg);
|
|
215
|
+
} else {
|
|
216
|
+
try {
|
|
217
|
+
const existingPkg = JSON.parse(await readFile(join(targetDir, 'package.json'), 'utf-8'));
|
|
218
|
+
if (!existingPkg.type) {
|
|
219
|
+
existingPkg.type = 'module';
|
|
220
|
+
await writeFile(join(targetDir, 'package.json'), JSON.stringify(existingPkg, null, 2));
|
|
221
|
+
}
|
|
222
|
+
} catch { /* leave existing package.json alone if unparseable */ }
|
|
212
223
|
}
|
|
213
224
|
|
|
214
225
|
// Create .gitignore if doesn't exist
|
package/src/commands/run.js
CHANGED
|
@@ -603,6 +603,8 @@ export async function runCommand(specPath, options) {
|
|
|
603
603
|
};
|
|
604
604
|
} catch (_error) {
|
|
605
605
|
console.log(chalk.yellow(`⚠️ Could not load config from ${options.config}`));
|
|
606
|
+
config.agent = { provider: options.agent || 'claude' };
|
|
607
|
+
config.cloudSync = false;
|
|
606
608
|
}
|
|
607
609
|
} else {
|
|
608
610
|
// No config file, use defaults
|