@dittowords/spec-cli 0.0.1-alpha.1 → 0.0.1-alpha.2
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.ts +13 -6
package/package.json
CHANGED
package/src/commands/init.ts
CHANGED
|
@@ -109,16 +109,21 @@ type AgentEnv = "claude" | "cursor" | "none";
|
|
|
109
109
|
export async function init(opts: InitOptions = {}): Promise<void> {
|
|
110
110
|
const cwd = process.cwd();
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
const configExists = fs.existsSync(path.join(cwd, CONFIG_NAME));
|
|
113
|
+
|
|
114
|
+
if (configExists && !opts.writeAgent) {
|
|
113
115
|
console.log(`${CONFIG_NAME} already exists. Nothing to do.`);
|
|
116
|
+
console.log("Run with --agent to add agent configuration (CLAUDE.md, .cursorrules, etc.).");
|
|
114
117
|
return;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
if (!configExists) {
|
|
121
|
+
fs.writeFileSync(path.join(cwd, CONFIG_NAME), DEFAULT_CONFIG + "\n");
|
|
122
|
+
console.log(`✓ Created ${CONFIG_NAME}`);
|
|
119
123
|
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
fs.writeFileSync(path.join(cwd, WORKSPACE_SPEC_NAME), WORKSPACE_SPEC);
|
|
125
|
+
console.log(`✓ Created ${WORKSPACE_SPEC_NAME}`);
|
|
126
|
+
}
|
|
122
127
|
|
|
123
128
|
const env = detectAgentEnv(cwd);
|
|
124
129
|
|
|
@@ -128,7 +133,9 @@ export async function init(opts: InitOptions = {}): Promise<void> {
|
|
|
128
133
|
printAgentSuggestions(env);
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
if (!configExists) {
|
|
137
|
+
printNextSteps();
|
|
138
|
+
}
|
|
132
139
|
}
|
|
133
140
|
|
|
134
141
|
function detectAgentEnv(cwd: string): AgentEnv {
|