specline 1.3.1 → 1.3.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/cli.mjs +15 -17
- package/package.json +1 -1
- package/templates/.specline-config.yaml +0 -1
package/cli.mjs
CHANGED
|
@@ -347,10 +347,10 @@ function cmd_init(targetPath) {
|
|
|
347
347
|
process.exit(1);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
const
|
|
350
|
+
const lockFile = join(target, 'specline', '.specline-lock.yaml');
|
|
351
351
|
const forceMode = process.argv.includes('--force') || process.argv.includes('-f');
|
|
352
352
|
|
|
353
|
-
if (existsSync(
|
|
353
|
+
if (existsSync(lockFile) && !forceMode) {
|
|
354
354
|
warn('Specline 已在此项目中初始化。使用 --force 强制覆盖。');
|
|
355
355
|
process.exit(0);
|
|
356
356
|
}
|
|
@@ -406,13 +406,6 @@ function cmd_init(targetPath) {
|
|
|
406
406
|
const skillsCount = countFiles(join(target, '.cursor', 'skills'));
|
|
407
407
|
const hooksCount = countFiles(join(target, '.cursor', 'hooks'));
|
|
408
408
|
|
|
409
|
-
// 写入初始化配置
|
|
410
|
-
const initConfig = `# Specline 项目配置
|
|
411
|
-
version: "${VERSION}"
|
|
412
|
-
initialized_at: "${new Date().toISOString()}"
|
|
413
|
-
`;
|
|
414
|
-
writeFileSync(configFile, initConfig, 'utf-8');
|
|
415
|
-
|
|
416
409
|
success('Specline 初始化完成');
|
|
417
410
|
log(`📁 文件: ${commandsCount} commands, ${skillsCount} skills, ${agentsCount} agents, ${hooksCount} hooks`);
|
|
418
411
|
log('');
|
|
@@ -509,10 +502,19 @@ function cmd_sync({ dryRun, targetPath }) {
|
|
|
509
502
|
const target = resolve(cwd, targetPath || '.');
|
|
510
503
|
|
|
511
504
|
// 1. 检查项目是否已初始化
|
|
512
|
-
const
|
|
513
|
-
if (!existsSync(
|
|
514
|
-
|
|
515
|
-
|
|
505
|
+
const lockFile = join(target, 'specline', '.specline-lock.yaml');
|
|
506
|
+
if (!existsSync(lockFile)) {
|
|
507
|
+
// 向后兼容:检查旧版 .specline-config.yaml
|
|
508
|
+
const oldMarker = join(target, '.specline-config.yaml');
|
|
509
|
+
if (existsSync(oldMarker)) {
|
|
510
|
+
warn('检测到旧版项目,正在自动迁移...');
|
|
511
|
+
const lockData = buildLockData(target, target);
|
|
512
|
+
writeLockFile(target, lockData);
|
|
513
|
+
success('已从旧版项目迁移,生成了锁文件');
|
|
514
|
+
} else {
|
|
515
|
+
error('未检测到 Specline 项目,请先运行 specline init');
|
|
516
|
+
process.exit(1);
|
|
517
|
+
}
|
|
516
518
|
}
|
|
517
519
|
|
|
518
520
|
// 2. 构建上游模板哈希映射
|
|
@@ -545,10 +547,6 @@ function cmd_sync({ dryRun, targetPath }) {
|
|
|
545
547
|
// 6. 分类
|
|
546
548
|
const results = [];
|
|
547
549
|
for (const path of allPaths) {
|
|
548
|
-
if (path === '.specline-config.yaml') {
|
|
549
|
-
// 项目标识文件,由 specline init 生成(含时间戳),sync 不覆盖
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
550
|
const templateHash = upstreamFiles.get(path) || null;
|
|
553
551
|
const lockEntry = lockData ? (lockData.files.get(path) || null) : null;
|
|
554
552
|
const projectPath = join(target, path);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version: "1.0.0"
|