claude-sdlc 1.5.1 → 1.5.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/lib/installer.js +1 -30
- package/package.json +1 -1
- package/template/.claude/settings.json +1 -1
package/lib/installer.js
CHANGED
|
@@ -212,24 +212,6 @@ function install(targetDir) {
|
|
|
212
212
|
const templateContent = fs.readFileSync(templateClaudeMd, 'utf-8');
|
|
213
213
|
const isUpgrade = fs.existsSync(targetClaudeMd);
|
|
214
214
|
|
|
215
|
-
// v1.0.6→v1.0.7 迁移:旧版状态内嵌在 CLAUDE.md 中,需要提取出来
|
|
216
|
-
let migratedState = null;
|
|
217
|
-
if (isUpgrade) {
|
|
218
|
-
const oldContent = fs.readFileSync(targetClaudeMd, 'utf-8');
|
|
219
|
-
const yamlMatch = oldContent.match(/```yaml\n# === SDLC 项目状态 ===\n([\s\S]*?)```/);
|
|
220
|
-
if (yamlMatch) {
|
|
221
|
-
// 检查是否有实际数据(非空白模板)
|
|
222
|
-
const yamlBlock = yamlMatch[0];
|
|
223
|
-
const hasData = /current_phase:\s*P[1-6]/.test(yamlBlock)
|
|
224
|
-
|| /task_description:\s*"[^"]+"/.test(yamlBlock)
|
|
225
|
-
|| /modified_files:\s*\n\s*-/.test(yamlBlock)
|
|
226
|
-
|| /prd:\s*\n\s*-\s*id:/.test(yamlBlock);
|
|
227
|
-
if (hasData) {
|
|
228
|
-
migratedState = yamlBlock;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
215
|
fs.writeFileSync(targetClaudeMd, templateContent, 'utf-8');
|
|
234
216
|
fileLog(SYM.check, isUpgrade
|
|
235
217
|
? `CLAUDE.md ${DIM}(已更新至最新版本)${RESET}`
|
|
@@ -256,17 +238,6 @@ function install(targetDir) {
|
|
|
256
238
|
const templateState = path.join(templateDir, '.claude', 'project-state.md');
|
|
257
239
|
if (fs.existsSync(targetState)) {
|
|
258
240
|
fileLog(SYM.check, `.claude/project-state.md ${DIM}(已有状态,跳过保护)${RESET}`);
|
|
259
|
-
} else if (migratedState) {
|
|
260
|
-
// v1.0.6→v1.0.7 迁移:将旧 CLAUDE.md 中的状态写入新的 project-state.md
|
|
261
|
-
const stateTemplate = fs.readFileSync(templateState, 'utf-8');
|
|
262
|
-
const emptyYaml = stateTemplate.match(/```yaml\n# === SDLC 项目状态 ===\n[\s\S]*?```/);
|
|
263
|
-
if (emptyYaml) {
|
|
264
|
-
const migrated = stateTemplate.replace(emptyYaml[0], migratedState);
|
|
265
|
-
fs.writeFileSync(targetState, migrated, 'utf-8');
|
|
266
|
-
} else {
|
|
267
|
-
fs.writeFileSync(targetState, stateTemplate, 'utf-8');
|
|
268
|
-
}
|
|
269
|
-
fileLog(SYM.warn, `.claude/project-state.md ${DIM}(从旧版 CLAUDE.md 迁移状态)${RESET}`);
|
|
270
241
|
} else {
|
|
271
242
|
fs.copyFileSync(templateState, targetState);
|
|
272
243
|
fileLog(SYM.check, '.claude/project-state.md');
|
|
@@ -423,7 +394,7 @@ function uninstall(targetDir) {
|
|
|
423
394
|
}
|
|
424
395
|
|
|
425
396
|
// .claude 子目录(全部删除)
|
|
426
|
-
const removeDirs = ['rules', 'hooks', 'skills', 'reviews', 'agents'];
|
|
397
|
+
const removeDirs = ['rules', 'hooks', 'skills', 'reviews', 'agents', 'commands'];
|
|
427
398
|
for (const dir of removeDirs) {
|
|
428
399
|
const dirPath = path.join(targetDir, '.claude', dir);
|
|
429
400
|
if (fs.existsSync(dirPath)) {
|
package/package.json
CHANGED