@gadmin2n/cli 0.0.176 → 0.0.178

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.
@@ -52,7 +52,8 @@ function formatMaterializeError(schematicsVersion, err) {
52
52
  * ------------------------------------------------------------------ */
53
53
  /**
54
54
  * Shallow-clone the remote .claude context repo into a temp dir and return
55
- * the absolute path to the `.claude` subfolder. Returns null on failure
55
+ * the absolute path to the `.claude` subfolder plus the repo-root `CLAUDE.md`
56
+ * path (when present). Returns null on failure
56
57
  * (e.g. no network, repo private, credentials missing, etc.).
57
58
  */
58
59
  function fetchClaudeContextRepo(repoUrl, branch) {
@@ -66,6 +67,10 @@ function fetchClaudeContextRepo(repoUrl, branch) {
66
67
  fs.rmSync(tmpDir, { recursive: true, force: true });
67
68
  return null;
68
69
  }
70
+ const rootClaudeMdSrc = path.join(tmpDir, 'CLAUDE.md');
71
+ const rootClaudeMd = fs.existsSync(rootClaudeMdSrc)
72
+ ? rootClaudeMdSrc
73
+ : null;
69
74
  // Caller is responsible for cleaning up the parent tmpDir.
70
75
  // We return the inner path; we stash the parent on a property so caller
71
76
  // can clean it. To keep things simple, register a process exit cleanup
@@ -78,7 +83,7 @@ function fetchClaudeContextRepo(repoUrl, branch) {
78
83
  // ignore
79
84
  }
80
85
  });
81
- return claudeSrc;
86
+ return { claudeDir: claudeSrc, rootClaudeMd };
82
87
  }
83
88
  catch (err) {
84
89
  fs.rmSync(tmpDir, { recursive: true, force: true });
@@ -198,12 +203,13 @@ function syncClaudeContext(instanceDir, dryRun, source) {
198
203
  console.info(chalk.bold(' Sync .claude context'));
199
204
  console.info(chalk.bold('═══════════════════════════════════════════════════'));
200
205
  console.info(`${chalk.gray('Source: ')} ${source.repo} (${source.branch}) :: ${CLAUDE_SOURCE_SUBDIR}/`);
201
- console.info(`${chalk.gray('Targets:')} ${CLAUDE_TARGET_DIRS.map((d) => `${d}/`).join(', ')}\n`);
206
+ console.info(`${chalk.gray('Targets:')} ${CLAUDE_TARGET_DIRS.map((d) => `${d}/`).join(', ')}, AGENTS.md\n`);
202
207
  if (dryRun) {
203
208
  console.info(chalk.gray('(dry-run — no files written. The real run would:'));
204
209
  console.info(chalk.gray(` 1. git clone ${source.repo} --branch ${source.branch} --depth 1 (into tmp dir)`));
205
210
  console.info(chalk.gray(` 2. Copy <tmp>/${CLAUDE_SOURCE_SUBDIR}/** → each target dir, OVERWRITING same-named files`));
206
- console.info(chalk.gray(' 3. Files only present in target dirs (instance-only) are kept untouched)\n'));
211
+ console.info(chalk.gray(' 3. Copy <tmp>/CLAUDE.md → project root AGENTS.md (overwriting if present)'));
212
+ console.info(chalk.gray(' 4. Files only present in target dirs (instance-only) are kept untouched)\n'));
207
213
  return;
208
214
  }
209
215
  // Real run: warn the user that same-named files will be overwritten before
@@ -212,14 +218,14 @@ function syncClaudeContext(instanceDir, dryRun, source) {
212
218
  // visible so changes to the local copy aren't silently clobbered.
213
219
  console.info(chalk.yellow('⚠️ Same-named files in target dirs will be overwritten by the remote version.'));
214
220
  console.info(chalk.gray(' Instance-only files (only present locally) are kept untouched.\n'));
215
- const claudeSrc = fetchClaudeContextRepo(source.repo, source.branch);
216
- if (!claudeSrc) {
221
+ const fetched = fetchClaudeContextRepo(source.repo, source.branch);
222
+ if (!fetched) {
217
223
  return;
218
224
  }
219
225
  for (const targetName of CLAUDE_TARGET_DIRS) {
220
226
  const destDir = path.join(instanceDir, targetName);
221
227
  fs.mkdirSync(destDir, { recursive: true });
222
- const { added, updated } = copyTreeOverwrite(claudeSrc, destDir);
228
+ const { added, updated } = copyTreeOverwrite(fetched.claudeDir, destDir);
223
229
  const summary = [];
224
230
  if (added > 0)
225
231
  summary.push(`${added} added`);
@@ -229,6 +235,13 @@ function syncClaudeContext(instanceDir, dryRun, source) {
229
235
  summary.push('no files');
230
236
  console.info(` ${chalk.cyan(targetName + '/')} ${summary.join(' | ')}`);
231
237
  }
238
+ // Sync repo-root CLAUDE.md into the project root as AGENTS.md.
239
+ if (fetched.rootClaudeMd) {
240
+ const agentsDest = path.join(instanceDir, 'AGENTS.md');
241
+ const agentsExisted = fs.existsSync(agentsDest);
242
+ fs.copyFileSync(fetched.rootClaudeMd, agentsDest);
243
+ console.info(` ${chalk.cyan('AGENTS.md')} ${agentsExisted ? 'overwritten' : 'added'} (from CLAUDE.md)`);
244
+ }
232
245
  console.info();
233
246
  });
234
247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gadmin2n/cli",
3
- "version": "0.0.176",
3
+ "version": "0.0.178",
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.143",
50
+ "@gadmin2n/schematics": "^0.0.144",
51
51
  "abc": "^0.6.1",
52
52
  "chalk": "3.0.0",
53
53
  "chokidar": "3.5.3",