spec-first-claude 0.5.0-beta.13 → 0.5.0-beta.14
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/lib/update.js +0 -42
- package/package.json +1 -1
- package/templates/.claude/commands/load.md +23 -1
package/lib/update.js
CHANGED
|
@@ -35,9 +35,6 @@ function update({ templatesDir, targetDir, force }) {
|
|
|
35
35
|
const stats = { added: [], updated: [], skipped: 0 };
|
|
36
36
|
syncDir(templatesDir, dest, force, stats, dest);
|
|
37
37
|
|
|
38
|
-
// Auto-configure .gitignore based on sfw.config.yml (before printing results)
|
|
39
|
-
adjustGitignore(dest, stats);
|
|
40
|
-
|
|
41
38
|
console.log('');
|
|
42
39
|
if (stats.added.length > 0) {
|
|
43
40
|
console.log(`Added (${stats.added.length}):`);
|
|
@@ -133,43 +130,4 @@ function isFrameworkPath(rel) {
|
|
|
133
130
|
return false;
|
|
134
131
|
}
|
|
135
132
|
|
|
136
|
-
const WORKSPACE_IGNORE_MARKER = '# SFW: workspace ignored (external backend detected)';
|
|
137
|
-
const WORKSPACE_IGNORE_BLOCK = `
|
|
138
|
-
${WORKSPACE_IGNORE_MARKER}
|
|
139
|
-
# Content lives in the external backend (Confluence, etc.) — local is just cache
|
|
140
|
-
workspace/Output/**
|
|
141
|
-
!workspace/Output/.gitkeep
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
function adjustGitignore(dest, stats) {
|
|
145
|
-
const configPath = path.join(dest, 'sfw.config.yml');
|
|
146
|
-
const gitignorePath = path.join(dest, '.gitignore');
|
|
147
|
-
|
|
148
|
-
if (!fs.existsSync(configPath) || !fs.existsSync(gitignorePath)) return;
|
|
149
|
-
|
|
150
|
-
const config = fs.readFileSync(configPath, 'utf-8');
|
|
151
|
-
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
152
|
-
|
|
153
|
-
// Detect external adapter (anything that's not "filesystem" for input)
|
|
154
|
-
const inputMatch = config.match(/^\s*adapter:\s*(\S+)/m);
|
|
155
|
-
const inputAdapter = inputMatch ? inputMatch[1] : 'filesystem';
|
|
156
|
-
const isExternal = inputAdapter !== 'filesystem';
|
|
157
|
-
|
|
158
|
-
// Check if any output target has mode != off
|
|
159
|
-
const hasActiveOutput = /mode:\s*(auto|manual)/m.test(config);
|
|
160
|
-
|
|
161
|
-
const alreadyHasBlock = gitignore.includes(WORKSPACE_IGNORE_MARKER);
|
|
162
|
-
|
|
163
|
-
if (isExternal && !alreadyHasBlock) {
|
|
164
|
-
// Add workspace ignore block
|
|
165
|
-
fs.appendFileSync(gitignorePath, WORKSPACE_IGNORE_BLOCK);
|
|
166
|
-
stats.updated.push('.gitignore (workspace ignored — external backend)');
|
|
167
|
-
} else if (!isExternal && alreadyHasBlock) {
|
|
168
|
-
// Remove workspace ignore block (user switched to filesystem)
|
|
169
|
-
const cleaned = gitignore.split(WORKSPACE_IGNORE_MARKER)[0].trimEnd() + '\n';
|
|
170
|
-
fs.writeFileSync(gitignorePath, cleaned, 'utf-8');
|
|
171
|
-
stats.updated.push('.gitignore (workspace restored — local mode)');
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
133
|
module.exports = { update };
|
package/package.json
CHANGED
|
@@ -156,7 +156,29 @@ Formato append-only:
|
|
|
156
156
|
- Se não existia no log → status `NOVO`
|
|
157
157
|
- Arquivo que existia no log mas sumiu do backend → status `REMOVIDO` (log only, não deleta local)
|
|
158
158
|
|
|
159
|
-
### 5.
|
|
159
|
+
### 5. Ajustar `.gitignore` conforme o adapter
|
|
160
|
+
|
|
161
|
+
Se o adapter NÃO é `filesystem` (ou seja, é um backend externo como Confluence):
|
|
162
|
+
- Verificar se `.gitignore` contém o bloco `# SFW: workspace ignored`
|
|
163
|
+
- Se NÃO contém, **adicionar** ao final do `.gitignore`:
|
|
164
|
+
```
|
|
165
|
+
# SFW: workspace ignored (external backend detected)
|
|
166
|
+
# Content lives in the external backend (Confluence, etc.) — local is just cache
|
|
167
|
+
workspace/Output/**
|
|
168
|
+
!workspace/Output/.gitkeep
|
|
169
|
+
```
|
|
170
|
+
- Informar ao usuário: "workspace/Output/ adicionado ao .gitignore (conteúdo vive no {adapter})"
|
|
171
|
+
|
|
172
|
+
Se o adapter É `filesystem`:
|
|
173
|
+
- Se `.gitignore` contém o bloco `# SFW: workspace ignored`, **removê-lo**
|
|
174
|
+
- Informar ao usuário: "workspace/Output/ removido do .gitignore (modo local)"
|
|
175
|
+
|
|
176
|
+
Isso garante que:
|
|
177
|
+
- Projetos com Confluence não commitam cache local
|
|
178
|
+
- Projetos que mudam de Confluence → filesystem voltam a rastrear
|
|
179
|
+
- A lógica roda no momento certo (após configurar `sfw.config.yml`, não no `init`)
|
|
180
|
+
|
|
181
|
+
### 6. Informar o usuário
|
|
160
182
|
|
|
161
183
|
```
|
|
162
184
|
Insumos carregados em workspace/Input/{nome}/
|