ai-nexus 1.3.20 → 1.3.21

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.
@@ -1,11 +1,14 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
  import os from 'os';
4
+ import { fileURLToPath } from 'url';
4
5
  import chalk from 'chalk';
5
6
  import inquirer from 'inquirer';
6
7
  import { detectInstall, scanDir, compareConfigs, ensureDir, computeFileHashes, aggregateToAgentsMd } from '../utils/files.js';
7
8
  import crypto from 'crypto';
8
9
  import { updateRepo } from '../utils/git.js';
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const PACKAGE_ROOT = path.resolve(__dirname, '../..');
9
12
  export async function update(options = {}) {
10
13
  const install = detectInstall();
11
14
  if (!install) {
@@ -51,11 +54,29 @@ export async function update(options = {}) {
51
54
  : process.cwd();
52
55
  const claudeDir = path.join(targetDir, '.claude');
53
56
  if (meta.mode === 'symlink') {
54
- const hasExternal = meta.sources.some(s => s.type === 'external');
55
- if (!hasExternal && !hasChanges) {
56
- console.log(chalk.gray(' Symlink mode with built-in rules only.'));
57
- console.log(chalk.gray(' Built-in rules update when you run:'));
58
- console.log(chalk.bold(' npm update -g ai-nexus\n'));
57
+ // Sync new builtin files to ~/.ai-nexus/config/
58
+ const builtinConfigDir = path.join(PACKAGE_ROOT, 'config');
59
+ const categories = ['rules', 'commands', 'skills', 'agents', 'contexts', 'hooks'];
60
+ let addedCount = 0;
61
+ for (const category of categories) {
62
+ const srcDir = path.join(builtinConfigDir, category);
63
+ if (!fs.existsSync(srcDir))
64
+ continue;
65
+ const destDir = path.join(configDir, category);
66
+ ensureDir(destDir);
67
+ const srcFiles = scanDir(srcDir);
68
+ for (const [rel, content] of Object.entries(srcFiles)) {
69
+ const dest = path.join(destDir, rel);
70
+ if (!fs.existsSync(dest)) {
71
+ ensureDir(path.dirname(dest));
72
+ fs.writeFileSync(dest, content);
73
+ addedCount++;
74
+ }
75
+ }
76
+ }
77
+ if (addedCount > 0) {
78
+ console.log(chalk.green(` + ${addedCount} new files added`));
79
+ hasChanges = true;
59
80
  }
60
81
  }
61
82
  if (meta.mode === 'copy') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-nexus",
3
- "version": "1.3.20",
3
+ "version": "1.3.21",
4
4
  "description": "Unified rule manager for Claude Code, Cursor, and Codex - write once, use everywhere, save tokens",
5
5
  "main": "dist/index.js",
6
6
  "bin": {