@localsummer/incspec 0.0.9 → 0.0.10

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.
@@ -122,7 +122,8 @@ function parseWorkflowTime(value) {
122
122
  function isOutputArchived(archivedFiles, outputFile, completedAt) {
123
123
  const ext = path.extname(outputFile);
124
124
  const base = path.basename(outputFile, ext);
125
- const pattern = new RegExp(`^${escapeRegExp(base)}(-copy\\d+)?${escapeRegExp(ext)}$`);
125
+ // Match: base.ext, base-2.ext, base-3.ext, ...
126
+ const pattern = new RegExp(`^${escapeRegExp(base)}(-\\d+)?${escapeRegExp(ext)}$`);
126
127
  return archivedFiles.some(file => pattern.test(file.name) && file.mtime >= completedAt);
127
128
  }
128
129
 
package/lib/spec.mjs CHANGED
@@ -21,13 +21,13 @@ function ensureUniqueArchivePath(filePath) {
21
21
  const dir = path.dirname(filePath);
22
22
  const ext = path.extname(filePath);
23
23
  const base = path.basename(filePath, ext);
24
- let counter = 1;
25
- let candidate = filePath;
24
+ let counter = 2;
25
+ let candidate;
26
26
 
27
- while (fs.existsSync(candidate)) {
28
- candidate = path.join(dir, `${base}-copy${counter}${ext}`);
27
+ do {
28
+ candidate = path.join(dir, `${base}-${counter}${ext}`);
29
29
  counter += 1;
30
- }
30
+ } while (fs.existsSync(candidate));
31
31
 
32
32
  return candidate;
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localsummer/incspec",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "面向 AI 编程助手的增量规范驱动开发工具",
5
5
  "bin": {
6
6
  "incspec": "index.mjs"