@gadmin2n/cli 0.0.94 → 0.0.96

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.
@@ -30,6 +30,16 @@ const DEFAULT_EXCLUDES = [
30
30
  '.DS_Store',
31
31
  '.env.local',
32
32
  'readme.md',
33
+ // package manager lock files & PnP artifacts —
34
+ // regenerated by the auto-install stage based on the merged package.json.
35
+ // Letting template versions overwrite instance lock files is semantically
36
+ // wrong (lock should reflect actually-installed deps) and clutters diff output.
37
+ 'yarn.lock',
38
+ 'package-lock.json',
39
+ 'pnpm-lock.yaml',
40
+ '.yarn',
41
+ '.pnp.cjs',
42
+ '.pnp.loader.mjs',
33
43
  ];
34
44
  const CLAUDE_CONTEXT_REPO = 'https://git.tencent.com/OIT-OMC/erp-ai-coding-context.git';
35
45
  const CLAUDE_CONTEXT_BRANCH = 'master';
@@ -337,12 +347,14 @@ function fetchClaudeContextRepo() {
337
347
  }
338
348
  /**
339
349
  * Recursively copy every file under `srcDir` into `destDir`, preserving
340
- * relative structure. Existing destination files are NOT overwritten.
341
- * Returns counts.
350
+ * relative structure. The remote source is authoritative: existing files in
351
+ * `destDir` are OVERWRITTEN. Files that exist only in `destDir` (instance-only)
352
+ * are left untouched — this is an additive/overwriting sync, never a delete.
353
+ * Returns counts split between newly-added files and overwritten files.
342
354
  */
343
- function copyTreeNoOverwrite(srcDir, destDir) {
355
+ function copyTreeOverwrite(srcDir, destDir) {
344
356
  let added = 0;
345
- let skipped = 0;
357
+ let updated = 0;
346
358
  function walk(rel) {
347
359
  const absSrc = path.join(srcDir, rel);
348
360
  const entries = fs.readdirSync(absSrc, { withFileTypes: true });
@@ -354,20 +366,22 @@ function copyTreeNoOverwrite(srcDir, destDir) {
354
366
  walk(childRel);
355
367
  }
356
368
  else if (entry.isFile()) {
357
- if (fs.existsSync(absChildDest)) {
358
- skipped++;
359
- continue;
360
- }
369
+ const existed = fs.existsSync(absChildDest);
361
370
  fs.mkdirSync(path.dirname(absChildDest), { recursive: true });
362
371
  fs.copyFileSync(absChildSrc, absChildDest);
363
- added++;
372
+ if (existed) {
373
+ updated++;
374
+ }
375
+ else {
376
+ added++;
377
+ }
364
378
  }
365
379
  }
366
380
  }
367
381
  if (!fs.existsSync(srcDir))
368
- return { added, skipped };
382
+ return { added, updated };
369
383
  walk('');
370
- return { added, skipped };
384
+ return { added, updated };
371
385
  }
372
386
  function syncClaudeContext(instanceDir, dryRun) {
373
387
  return __awaiter(this, void 0, void 0, function* () {
@@ -377,7 +391,7 @@ function syncClaudeContext(instanceDir, dryRun) {
377
391
  console.info(`${chalk.gray('Source: ')} ${CLAUDE_CONTEXT_REPO} (${CLAUDE_CONTEXT_BRANCH}) :: ${CLAUDE_SOURCE_SUBDIR}/`);
378
392
  console.info(`${chalk.gray('Targets:')} ${CLAUDE_TARGET_DIRS.map((d) => `${d}/`).join(', ')}\n`);
379
393
  if (dryRun) {
380
- console.info(chalk.gray('(dry-run mode — would clone the repo and copy missing files into target dirs)\n'));
394
+ console.info(chalk.gray('(dry-run mode — would clone the repo and copy remote files into target dirs, overwriting existing files; instance-only files are kept)\n'));
381
395
  return;
382
396
  }
383
397
  const claudeSrc = fetchClaudeContextRepo();
@@ -387,12 +401,12 @@ function syncClaudeContext(instanceDir, dryRun) {
387
401
  for (const targetName of CLAUDE_TARGET_DIRS) {
388
402
  const destDir = path.join(instanceDir, targetName);
389
403
  fs.mkdirSync(destDir, { recursive: true });
390
- const { added, skipped } = copyTreeNoOverwrite(claudeSrc, destDir);
404
+ const { added, updated } = copyTreeOverwrite(claudeSrc, destDir);
391
405
  const summary = [];
392
406
  if (added > 0)
393
407
  summary.push(`${added} added`);
394
- if (skipped > 0)
395
- summary.push(`${skipped} kept (already exists)`);
408
+ if (updated > 0)
409
+ summary.push(`${updated} overwritten`);
396
410
  if (summary.length === 0)
397
411
  summary.push('no files');
398
412
  console.info(` ${chalk.cyan(targetName + '/')} ${summary.join(' | ')}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/cli",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "Gadmin - modern, fast, powerful node.js web framework (@cli)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,7 +47,7 @@
47
47
  "@angular-devkit/core": "13.3.2",
48
48
  "@angular-devkit/schematics": "13.3.2",
49
49
  "@angular-devkit/schematics-cli": "13.3.2",
50
- "@gadmin2n/schematics": "^0.0.76",
50
+ "@gadmin2n/schematics": "^0.0.78",
51
51
  "abc": "^0.6.1",
52
52
  "chalk": "3.0.0",
53
53
  "chokidar": "3.5.3",