spec-first-copilot 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
CHANGED
|
@@ -37,9 +37,6 @@ function update({ templatesDir, targetDir, force }) {
|
|
|
37
37
|
const stats = { added: [], updated: [], skipped: 0 };
|
|
38
38
|
syncDir(templatesDir, dest, force, stats, dest);
|
|
39
39
|
|
|
40
|
-
// Auto-configure .gitignore based on sfw.config.yml (before printing results)
|
|
41
|
-
adjustGitignore(dest, stats);
|
|
42
|
-
|
|
43
40
|
console.log('');
|
|
44
41
|
if (stats.added.length > 0) {
|
|
45
42
|
console.log(`Added (${stats.added.length}):`);
|
|
@@ -132,37 +129,4 @@ function isFrameworkPath(rel) {
|
|
|
132
129
|
return false;
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
const WORKSPACE_IGNORE_MARKER = '# SFW: workspace ignored (external backend detected)';
|
|
136
|
-
const WORKSPACE_IGNORE_BLOCK = `
|
|
137
|
-
${WORKSPACE_IGNORE_MARKER}
|
|
138
|
-
# Content lives in the external backend (Confluence, etc.) — local is just cache
|
|
139
|
-
workspace/Output/**
|
|
140
|
-
!workspace/Output/.gitkeep
|
|
141
|
-
`;
|
|
142
|
-
|
|
143
|
-
function adjustGitignore(dest, stats) {
|
|
144
|
-
const configPath = path.join(dest, 'sfw.config.yml');
|
|
145
|
-
const gitignorePath = path.join(dest, '.gitignore');
|
|
146
|
-
|
|
147
|
-
if (!fs.existsSync(configPath) || !fs.existsSync(gitignorePath)) return;
|
|
148
|
-
|
|
149
|
-
const config = fs.readFileSync(configPath, 'utf-8');
|
|
150
|
-
const gitignore = fs.readFileSync(gitignorePath, 'utf-8');
|
|
151
|
-
|
|
152
|
-
const inputMatch = config.match(/^\s*adapter:\s*(\S+)/m);
|
|
153
|
-
const inputAdapter = inputMatch ? inputMatch[1] : 'filesystem';
|
|
154
|
-
const isExternal = inputAdapter !== 'filesystem';
|
|
155
|
-
|
|
156
|
-
const alreadyHasBlock = gitignore.includes(WORKSPACE_IGNORE_MARKER);
|
|
157
|
-
|
|
158
|
-
if (isExternal && !alreadyHasBlock) {
|
|
159
|
-
fs.appendFileSync(gitignorePath, WORKSPACE_IGNORE_BLOCK);
|
|
160
|
-
stats.updated.push('.gitignore (workspace ignored — external backend)');
|
|
161
|
-
} else if (!isExternal && alreadyHasBlock) {
|
|
162
|
-
const cleaned = gitignore.split(WORKSPACE_IGNORE_MARKER)[0].trimEnd() + '\n';
|
|
163
|
-
fs.writeFileSync(gitignorePath, cleaned, 'utf-8');
|
|
164
|
-
stats.updated.push('.gitignore (workspace restored — local mode)');
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
132
|
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}/
|