@zhuan-ai/zhuanspec 2.2.3 → 2.2.4

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.
@@ -65,7 +65,6 @@ export declare class InitCommand {
65
65
  private findGitRootForPath;
66
66
  private safeRealpath;
67
67
  private copyGitTrackedDirectoryFiles;
68
- private mergeDirectoryWithoutOverwrite;
69
68
  private describeClaudeAssetResult;
70
69
  private writeTemplateFiles;
71
70
  private configureAITools;
package/dist/core/init.js CHANGED
@@ -918,10 +918,7 @@ export class InitCommand {
918
918
  if (!sourceAsset) {
919
919
  return { source: 'none', status: 'missing' };
920
920
  }
921
- if (existsSync(targetPath)) {
922
- return { source: sourceAsset.source, status: 'kept-existing' };
923
- }
924
- cpSync(sourceAsset.path, targetPath, { force: false });
921
+ cpSync(sourceAsset.path, targetPath, { force: true });
925
922
  return { source: sourceAsset.source, status: 'copied' };
926
923
  }
927
924
  copyClaudeDirectoryIfNeeded(sourceAsset, targetPath) {
@@ -997,12 +994,11 @@ export class InitCommand {
997
994
  return false;
998
995
  }
999
996
  copyClaudeDirectoryByFileSystem(sourceAsset, targetPath) {
1000
- if (!existsSync(targetPath)) {
1001
- cpSync(sourceAsset.path, targetPath, { recursive: true, force: true });
1002
- return { source: sourceAsset.source, status: 'copied' };
997
+ if (existsSync(targetPath)) {
998
+ rmSync(targetPath, { recursive: true, force: true });
1003
999
  }
1004
- this.mergeDirectoryWithoutOverwrite(sourceAsset.path, targetPath);
1005
- return { source: sourceAsset.source, status: 'kept-existing' };
1000
+ cpSync(sourceAsset.path, targetPath, { recursive: true, force: true });
1001
+ return { source: sourceAsset.source, status: 'copied' };
1006
1002
  }
1007
1003
  findGitRootForPath(sourcePath) {
1008
1004
  try {
@@ -1042,15 +1038,15 @@ export class InitCommand {
1042
1038
  if (trackedFiles.length === 0) {
1043
1039
  return false;
1044
1040
  }
1041
+ if (existsSync(targetDir)) {
1042
+ rmSync(targetDir, { recursive: true, force: true });
1043
+ }
1045
1044
  mkdirSync(targetDir, { recursive: true });
1046
1045
  trackedFiles.forEach((repoFilePath) => {
1047
1046
  const relativePath = repoFilePath.startsWith(sourcePrefix)
1048
1047
  ? repoFilePath.slice(sourcePrefix.length)
1049
1048
  : path.basename(repoFilePath);
1050
1049
  const targetFilePath = path.join(targetDir, relativePath);
1051
- if (existsSync(targetFilePath)) {
1052
- return;
1053
- }
1054
1050
  mkdirSync(path.dirname(targetFilePath), { recursive: true });
1055
1051
  const content = execSync(`git show HEAD:${repoFilePath}`, {
1056
1052
  encoding: 'buffer',
@@ -1065,27 +1061,6 @@ export class InitCommand {
1065
1061
  return false;
1066
1062
  }
1067
1063
  }
1068
- mergeDirectoryWithoutOverwrite(sourceDir, targetDir) {
1069
- if (!existsSync(sourceDir) || !existsSync(targetDir)) {
1070
- return;
1071
- }
1072
- const copyRecursive = (source, target) => {
1073
- const entries = readdirSync(source, { withFileTypes: true });
1074
- for (const entry of entries) {
1075
- const sourceEntryPath = path.join(source, entry.name);
1076
- const targetEntryPath = path.join(target, entry.name);
1077
- if (entry.isDirectory()) {
1078
- mkdirSync(targetEntryPath, { recursive: true });
1079
- copyRecursive(sourceEntryPath, targetEntryPath);
1080
- continue;
1081
- }
1082
- if (!existsSync(targetEntryPath)) {
1083
- cpSync(sourceEntryPath, targetEntryPath, { force: false });
1084
- }
1085
- }
1086
- };
1087
- copyRecursive(sourceDir, targetDir);
1088
- }
1089
1064
  describeClaudeAssetResult(assetName, result) {
1090
1065
  if (result.status === 'missing') {
1091
1066
  return `${assetName} 未找到可用模板`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhuan-ai/zhuanspec",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "AI-native system for spec-driven development",
5
5
  "keywords": [
6
6
  "zhuanspec",