spec-canon 0.1.12 → 0.1.13

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.
@@ -21,6 +21,8 @@ const BASE_DIRS = [
21
21
  ];
22
22
  const RULES_FILE = join(SDD_ROOT, 'rules', 'RULES.md');
23
23
  const LEGACY_RULES_FILE = join(SDD_ROOT, 'skills', 'SKILL.md');
24
+ const LEGACY_RULES_H1 = '# SKILLS.md — 团队规则库';
25
+ const RULES_H1 = '# RULES.md — 团队规则库';
24
26
  export class ScaffoldSyncError extends Error {
25
27
  }
26
28
  export async function ensureBaseScaffoldDirs(rootDir) {
@@ -236,7 +238,8 @@ async function applyLegacyRulesCompatibility(rootDir) {
236
238
  }
237
239
  const rulesExists = await fileExists(rulesPath);
238
240
  if (!rulesExists) {
239
- await writeFileSafe(rulesPath, await readFileSafe(legacyRulesPath));
241
+ const legacyRulesContent = await readFileSafe(legacyRulesPath);
242
+ await writeFileSafe(rulesPath, normalizeLegacyRulesContent(legacyRulesContent));
240
243
  migrated.push({
241
244
  path: RULES_FILE,
242
245
  fromPath: LEGACY_RULES_FILE,
@@ -275,6 +278,16 @@ function containsLegacyRulesReference(content) {
275
278
  'spec-canon/skills/SKILL.md',
276
279
  ].some((pattern) => content.includes(pattern));
277
280
  }
281
+ function normalizeLegacyRulesContent(content) {
282
+ if (content === LEGACY_RULES_H1) {
283
+ return RULES_H1;
284
+ }
285
+ const legacyHeadingWithNewline = `${LEGACY_RULES_H1}\n`;
286
+ if (content.startsWith(legacyHeadingWithNewline)) {
287
+ return `${RULES_H1}${content.slice(LEGACY_RULES_H1.length)}`;
288
+ }
289
+ return content;
290
+ }
278
291
  function hashContent(content) {
279
292
  return createHash('sha256').update(content).digest('hex');
280
293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-canon",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "CLI toolkit for Spec-Driven Development (SDD)",
5
5
  "type": "module",
6
6
  "license": "MIT",