speccrew 0.2.4 → 0.2.5
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/commands/init.js +11 -7
- package/lib/commands/update.js +22 -8
- package/package.json +1 -1
package/lib/commands/init.js
CHANGED
|
@@ -144,12 +144,6 @@ function createWorkspaceStructure(workspaceDir) {
|
|
|
144
144
|
function copyWorkspaceTemplate(templateDir, workspaceDir) {
|
|
145
145
|
if (!fs.existsSync(templateDir)) return { copied: 0, skipped: 0 };
|
|
146
146
|
|
|
147
|
-
const docsSourceDir = path.join(templateDir, 'docs');
|
|
148
|
-
const docsDestDir = path.join(workspaceDir, 'docs');
|
|
149
|
-
|
|
150
|
-
if (!fs.existsSync(docsSourceDir)) return { copied: 0, skipped: 0 };
|
|
151
|
-
|
|
152
|
-
fs.mkdirSync(docsDestDir, { recursive: true });
|
|
153
147
|
let copied = 0, skipped = 0;
|
|
154
148
|
|
|
155
149
|
function copyIfNotExists(src, dest) {
|
|
@@ -172,7 +166,17 @@ function copyWorkspaceTemplate(templateDir, workspaceDir) {
|
|
|
172
166
|
}
|
|
173
167
|
}
|
|
174
168
|
|
|
175
|
-
|
|
169
|
+
// 遍历 workspace-template 下的所有一级子目录并复制
|
|
170
|
+
const entries = fs.readdirSync(templateDir, { withFileTypes: true });
|
|
171
|
+
for (const entry of entries) {
|
|
172
|
+
if (entry.isDirectory()) {
|
|
173
|
+
const srcSubDir = path.join(templateDir, entry.name);
|
|
174
|
+
const destSubDir = path.join(workspaceDir, entry.name);
|
|
175
|
+
fs.mkdirSync(destSubDir, { recursive: true });
|
|
176
|
+
copyIfNotExists(srcSubDir, destSubDir);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
176
180
|
return { copied, skipped };
|
|
177
181
|
}
|
|
178
182
|
|
package/lib/commands/update.js
CHANGED
|
@@ -453,13 +453,26 @@ function run() {
|
|
|
453
453
|
totalStats.extraDirs.push(...skillStats.extraDirs);
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
// 更新 workspace docs
|
|
457
|
-
const
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
456
|
+
// 更新 workspace 文件(docs, scripts 等所有子目录)
|
|
457
|
+
const destWorkspaceDir = path.join(projectRoot, 'speccrew-workspace');
|
|
458
|
+
const workspaceStats = { updated: 0, added: 0 };
|
|
459
|
+
|
|
460
|
+
// 遍历 workspace-template 下的所有一级子目录并同步
|
|
461
|
+
if (fs.existsSync(workspaceTemplatePath)) {
|
|
462
|
+
const templateEntries = fs.readdirSync(workspaceTemplatePath, { withFileTypes: true });
|
|
463
|
+
for (const entry of templateEntries) {
|
|
464
|
+
if (entry.isDirectory()) {
|
|
465
|
+
const srcSubDir = path.join(workspaceTemplatePath, entry.name);
|
|
466
|
+
const destSubDir = path.join(destWorkspaceDir, entry.name);
|
|
467
|
+
const subStats = { updated: 0, added: 0 };
|
|
468
|
+
updateWorkspaceDocs(srcSubDir, destSubDir, subStats);
|
|
469
|
+
workspaceStats.updated += subStats.updated;
|
|
470
|
+
workspaceStats.added += subStats.added;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
totalStats.workspaceDocs.updated = workspaceStats.updated;
|
|
475
|
+
totalStats.workspaceDocs.added = workspaceStats.added;
|
|
463
476
|
|
|
464
477
|
// 更新 npm 包文档 (GETTING-STARTED*.md and README*.md)
|
|
465
478
|
const packageRoot = getPackageRoot();
|
|
@@ -483,7 +496,8 @@ function run() {
|
|
|
483
496
|
|
|
484
497
|
console.log(`Agents: ${totalStats.agents.updated} updated, ${totalStats.agents.added} added`);
|
|
485
498
|
console.log(`Skills: ${totalStats.skills.updated} updated, ${totalStats.skills.added} added`);
|
|
486
|
-
console.log(`
|
|
499
|
+
console.log(`Workspace: ${totalStats.workspaceDocs.updated} updated, ${totalStats.workspaceDocs.added} added`);
|
|
500
|
+
console.log(`Docs: ${totalStats.packageDocs.updated} updated, ${totalStats.packageDocs.added} added`);
|
|
487
501
|
|
|
488
502
|
// 输出警告
|
|
489
503
|
const allExtras = [...new Set([...totalStats.extra, ...totalStats.extraDirs])];
|