sdd-flow 1.2.5 → 1.3.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/bin/cli.js +55 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -72,6 +72,28 @@ function removeSddCommands(commandsDest) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
function syncGitExclude(entries, shouldExclude) {
|
|
76
|
+
const gitDir = path.join(CWD, '.git');
|
|
77
|
+
if (!fs.existsSync(gitDir)) {
|
|
78
|
+
warn('.git/ não encontrado — .git/info/exclude não configurado.');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const excludePath = path.join(gitDir, 'info', 'exclude');
|
|
83
|
+
let content = fs.existsSync(excludePath) ? fs.readFileSync(excludePath, 'utf8') : '';
|
|
84
|
+
|
|
85
|
+
content = content.replace(/\n*# sdd-flow\n[\s\S]*?# \/sdd-flow\n*/g, '');
|
|
86
|
+
content = content.trimEnd();
|
|
87
|
+
|
|
88
|
+
if (shouldExclude) {
|
|
89
|
+
const sep = content ? '\n\n' : '';
|
|
90
|
+
content += sep + '# sdd-flow\n' + entries.join('\n') + '\n# /sdd-flow';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fs.mkdirSync(path.dirname(excludePath), { recursive: true });
|
|
94
|
+
fs.writeFileSync(excludePath, content + '\n', 'utf8');
|
|
95
|
+
}
|
|
96
|
+
|
|
75
97
|
async function init() {
|
|
76
98
|
log();
|
|
77
99
|
log(bold('sdd-cli') + dim(' — Spec Driven Development workflow'));
|
|
@@ -130,6 +152,39 @@ async function init() {
|
|
|
130
152
|
info('Harness ignorado. Use ' + bold('sdd harness') + ' para instalar depois.');
|
|
131
153
|
}
|
|
132
154
|
|
|
155
|
+
log();
|
|
156
|
+
const docsAnswer = await ask(' Deseja criar a pasta docs/ para documentos de referência? (s/N) ');
|
|
157
|
+
const wantsDocs = docsAnswer.toLowerCase() === 's';
|
|
158
|
+
|
|
159
|
+
if (wantsDocs) {
|
|
160
|
+
const docsDir = path.join(CWD, 'docs');
|
|
161
|
+
if (fs.existsSync(docsDir)) {
|
|
162
|
+
info('docs/ já existe — preservado');
|
|
163
|
+
} else {
|
|
164
|
+
fs.mkdirSync(docsDir, { recursive: true });
|
|
165
|
+
for (const [name, header] of [['prd.md', '# PRD'], ['roadmap.md', '# Roadmap'], ['architecture.md', '# Architecture']]) {
|
|
166
|
+
fs.writeFileSync(path.join(docsDir, name), header + '\n', 'utf8');
|
|
167
|
+
}
|
|
168
|
+
ok('docs/ criado com prd.md, roadmap.md, architecture.md');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
log();
|
|
173
|
+
info('Deseja versionar os arquivos do workflow?');
|
|
174
|
+
log(` ${dim('N → arquivos ignorados via .git/info/exclude (apenas nesta máquina)')}`);
|
|
175
|
+
const versionAnswer = await ask(' Escolha (S/n) [S]: ');
|
|
176
|
+
const shouldVersion = versionAnswer.toLowerCase() !== 'n';
|
|
177
|
+
|
|
178
|
+
const excludeEntries = ['AGENTS.md', 'QUICKSTART.md', 'agents/'];
|
|
179
|
+
if (wantsDocs) excludeEntries.push('docs/');
|
|
180
|
+
|
|
181
|
+
syncGitExclude(excludeEntries, !shouldVersion);
|
|
182
|
+
|
|
183
|
+
if (!shouldVersion) {
|
|
184
|
+
ok('Arquivos adicionados a .git/info/exclude');
|
|
185
|
+
warn('Outros desenvolvedores no projeto não terão esses arquivos.');
|
|
186
|
+
}
|
|
187
|
+
|
|
133
188
|
log();
|
|
134
189
|
log(bold('Próximos passos:'));
|
|
135
190
|
log(` ${c.cyan}1.${c.reset} Abra uma sessão do seu agente no projeto`);
|