@nexus-framework/cli 0.1.2 → 0.1.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.
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/repair.d.ts +20 -0
- package/dist/commands/repair.d.ts.map +1 -0
- package/dist/commands/repair.js +85 -0
- package/dist/commands/repair.js.map +1 -0
- package/dist/commands/upgrade.d.ts +21 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +95 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/generators/ai-config.js +202 -87
- package/dist/generators/ai-config.js.map +1 -1
- package/dist/generators/docs.d.ts.map +1 -1
- package/dist/generators/docs.js +370 -150
- package/dist/generators/docs.js.map +1 -1
- package/dist/generators/index.d.ts +44 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +144 -1
- package/dist/generators/index.js.map +1 -1
- package/dist/utils/file-system.d.ts +9 -1
- package/dist/utils/file-system.d.ts.map +1 -1
- package/dist/utils/file-system.js +24 -1
- package/dist/utils/file-system.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import { adoptCommand } from './commands/adopt.js';
|
|
8
8
|
import { initCommand } from './commands/init.js';
|
|
9
|
+
import { repairCommand } from './commands/repair.js';
|
|
10
|
+
import { upgradeCommand } from './commands/upgrade.js';
|
|
9
11
|
import { version } from './version.js';
|
|
10
12
|
const program = new Command();
|
|
11
13
|
program
|
|
@@ -25,6 +27,18 @@ program
|
|
|
25
27
|
.action(async (targetPath) => {
|
|
26
28
|
await adoptCommand(targetPath);
|
|
27
29
|
});
|
|
30
|
+
program
|
|
31
|
+
.command('upgrade [path]')
|
|
32
|
+
.description('Upgrade NEXUS ecosystem to latest templates (preserves project knowledge)')
|
|
33
|
+
.action(async (targetPath) => {
|
|
34
|
+
await upgradeCommand(targetPath);
|
|
35
|
+
});
|
|
36
|
+
program
|
|
37
|
+
.command('repair [path]')
|
|
38
|
+
.description('Repair missing or corrupted .nexus/ files (preserves everything valid)')
|
|
39
|
+
.action(async (targetPath) => {
|
|
40
|
+
await repairCommand(targetPath);
|
|
41
|
+
});
|
|
28
42
|
// Default to help if no command is given
|
|
29
43
|
program.parse();
|
|
30
44
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,8DAA8D,CAAC;KAC3E,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAErC,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,SAAS,EAAE,qEAAqE,CAAC;KACxF,MAAM,CAAC,KAAK,EAAE,WAA+B,EAAE,OAA4B,EAAE,EAAE;IAC9E,MAAM,WAAW,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC;AAEL,OAAO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C/C,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,2EAA2E,CAAC;KACxF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,wEAAwE,CAAC;KACrF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEL,yCAAyC;AACzC,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Repair Command
|
|
3
|
+
*
|
|
4
|
+
* The `nexus repair [path]` command restores missing or corrupted .nexus/
|
|
5
|
+
* files WITHOUT updating templates to a newer version.
|
|
6
|
+
*
|
|
7
|
+
* Use this when:
|
|
8
|
+
* - Files were accidentally deleted from .nexus/
|
|
9
|
+
* - A file's structure is corrupted (empty, broken frontmatter, invalid JSON)
|
|
10
|
+
* - You want to fix issues without changing template content
|
|
11
|
+
*
|
|
12
|
+
* For upgrading to the latest CLI templates, use `nexus upgrade` instead.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Handler for `nexus repair [path]`.
|
|
16
|
+
*
|
|
17
|
+
* @param targetPath - Optional path to the project to repair (defaults to cwd)
|
|
18
|
+
*/
|
|
19
|
+
export declare function repairCommand(targetPath?: string): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=repair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repair.d.ts","sourceRoot":"","sources":["../../src/commands/repair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwEtE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Repair Command
|
|
3
|
+
*
|
|
4
|
+
* The `nexus repair [path]` command restores missing or corrupted .nexus/
|
|
5
|
+
* files WITHOUT updating templates to a newer version.
|
|
6
|
+
*
|
|
7
|
+
* Use this when:
|
|
8
|
+
* - Files were accidentally deleted from .nexus/
|
|
9
|
+
* - A file's structure is corrupted (empty, broken frontmatter, invalid JSON)
|
|
10
|
+
* - You want to fix issues without changing template content
|
|
11
|
+
*
|
|
12
|
+
* For upgrading to the latest CLI templates, use `nexus upgrade` instead.
|
|
13
|
+
*/
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import fs from 'fs-extra';
|
|
16
|
+
import { repairProject } from '../generators/index.js';
|
|
17
|
+
import { logger } from '../utils/logger.js';
|
|
18
|
+
import { version } from '../version.js';
|
|
19
|
+
/**
|
|
20
|
+
* Handler for `nexus repair [path]`.
|
|
21
|
+
*
|
|
22
|
+
* @param targetPath - Optional path to the project to repair (defaults to cwd)
|
|
23
|
+
*/
|
|
24
|
+
export async function repairCommand(targetPath) {
|
|
25
|
+
logger.banner(version);
|
|
26
|
+
const targetDir = targetPath
|
|
27
|
+
? path.resolve(process.cwd(), targetPath)
|
|
28
|
+
: process.cwd();
|
|
29
|
+
// ─── Check for .nexus/manifest.json ──────────────────────
|
|
30
|
+
const manifestPath = path.join(targetDir, '.nexus', 'manifest.json');
|
|
31
|
+
let manifest;
|
|
32
|
+
try {
|
|
33
|
+
const raw = await fs.readFile(manifestPath, 'utf-8');
|
|
34
|
+
manifest = JSON.parse(raw);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
logger.error('No valid .nexus/manifest.json found in this project.');
|
|
38
|
+
logger.newline();
|
|
39
|
+
logger.info('The repair command requires an existing NEXUS project with a valid manifest.');
|
|
40
|
+
logger.info('If the manifest itself is corrupted, try `nexus upgrade` instead.');
|
|
41
|
+
logger.info('To add NEXUS to an existing project, run:');
|
|
42
|
+
logger.newline();
|
|
43
|
+
logger.nexus(' nexus adopt');
|
|
44
|
+
logger.newline();
|
|
45
|
+
process.exit(1);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const config = manifest.config;
|
|
49
|
+
logger.nexus(`Repairing "${config.displayName}" NEXUS ecosystem...`);
|
|
50
|
+
logger.newline();
|
|
51
|
+
try {
|
|
52
|
+
const result = await repairProject(targetDir, config);
|
|
53
|
+
const fixCount = result.created.length + result.repaired.length;
|
|
54
|
+
if (fixCount === 0) {
|
|
55
|
+
logger.nexus('All NEXUS files are intact — nothing to repair.');
|
|
56
|
+
logger.newline();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (result.created.length > 0) {
|
|
60
|
+
logger.info(`✨ Restored (${result.created.length} missing files):`);
|
|
61
|
+
for (const f of result.created) {
|
|
62
|
+
logger.info(` + ${f}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (result.repaired.length > 0) {
|
|
66
|
+
logger.info(`🔧 Repaired (${result.repaired.length} corrupted files):`);
|
|
67
|
+
for (const f of result.repaired) {
|
|
68
|
+
logger.info(` ⚕ ${f}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
logger.info(`🔒 Untouched (${result.preserved.length} valid files preserved)`);
|
|
72
|
+
logger.newline();
|
|
73
|
+
logger.nexus(`Repair complete! Fixed ${fixCount} file${fixCount === 1 ? '' : 's'}.`);
|
|
74
|
+
logger.info('Your project knowledge was preserved.');
|
|
75
|
+
logger.newline();
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
logger.error('Repair failed.');
|
|
79
|
+
if (err instanceof Error) {
|
|
80
|
+
logger.error(err.message);
|
|
81
|
+
}
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|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MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,iBAAiB,MAAM,CAAC,SAAS,CAAC,MAAM,yBAAyB,CAAC,CAAC;QAE/E,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,CACV,0BAA0B,QAAQ,QAAQ,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CACvE,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACrD,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC/B,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Upgrade Command
|
|
3
|
+
*
|
|
4
|
+
* The `nexus upgrade [path]` command regenerates the .nexus/ ecosystem
|
|
5
|
+
* with the latest CLI templates while preserving project knowledge.
|
|
6
|
+
*
|
|
7
|
+
* Strategy:
|
|
8
|
+
* - REPLACE: AI instructions, tool files, manifest, .nexus/index.md
|
|
9
|
+
* - PRESERVE: knowledge.md, any doc with `status: populated`
|
|
10
|
+
* - SMART: Template docs get replaced; populated docs are kept
|
|
11
|
+
*
|
|
12
|
+
* The command reads `.nexus/manifest.json` to recover the original
|
|
13
|
+
* project config, regenerates everything, then applies the strategy.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Handler for `nexus upgrade [path]`.
|
|
17
|
+
*
|
|
18
|
+
* @param targetPath - Optional path to the project to upgrade (defaults to cwd)
|
|
19
|
+
*/
|
|
20
|
+
export declare function upgradeCommand(targetPath?: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=upgrade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFvE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Upgrade Command
|
|
3
|
+
*
|
|
4
|
+
* The `nexus upgrade [path]` command regenerates the .nexus/ ecosystem
|
|
5
|
+
* with the latest CLI templates while preserving project knowledge.
|
|
6
|
+
*
|
|
7
|
+
* Strategy:
|
|
8
|
+
* - REPLACE: AI instructions, tool files, manifest, .nexus/index.md
|
|
9
|
+
* - PRESERVE: knowledge.md, any doc with `status: populated`
|
|
10
|
+
* - SMART: Template docs get replaced; populated docs are kept
|
|
11
|
+
*
|
|
12
|
+
* The command reads `.nexus/manifest.json` to recover the original
|
|
13
|
+
* project config, regenerates everything, then applies the strategy.
|
|
14
|
+
*/
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import fs from 'fs-extra';
|
|
17
|
+
import { upgradeProject } from '../generators/index.js';
|
|
18
|
+
import { logger } from '../utils/logger.js';
|
|
19
|
+
import { version } from '../version.js';
|
|
20
|
+
/**
|
|
21
|
+
* Handler for `nexus upgrade [path]`.
|
|
22
|
+
*
|
|
23
|
+
* @param targetPath - Optional path to the project to upgrade (defaults to cwd)
|
|
24
|
+
*/
|
|
25
|
+
export async function upgradeCommand(targetPath) {
|
|
26
|
+
logger.banner(version);
|
|
27
|
+
const targetDir = targetPath
|
|
28
|
+
? path.resolve(process.cwd(), targetPath)
|
|
29
|
+
: process.cwd();
|
|
30
|
+
// ─── Check for .nexus/manifest.json ──────────────────────
|
|
31
|
+
const manifestPath = path.join(targetDir, '.nexus', 'manifest.json');
|
|
32
|
+
let manifest;
|
|
33
|
+
try {
|
|
34
|
+
const raw = await fs.readFile(manifestPath, 'utf-8');
|
|
35
|
+
manifest = JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
logger.error('No .nexus/manifest.json found in this project.');
|
|
39
|
+
logger.newline();
|
|
40
|
+
logger.info('The upgrade command requires an existing NEXUS project.');
|
|
41
|
+
logger.info('To add NEXUS to an existing project, run:');
|
|
42
|
+
logger.newline();
|
|
43
|
+
logger.nexus(' nexus adopt');
|
|
44
|
+
logger.newline();
|
|
45
|
+
process.exit(1);
|
|
46
|
+
return; // unreachable but satisfies TS
|
|
47
|
+
}
|
|
48
|
+
const config = manifest.config;
|
|
49
|
+
const oldVersion = manifest.cli?.version ?? 'unknown';
|
|
50
|
+
logger.nexus(`Upgrading "${config.displayName}" NEXUS ecosystem...`);
|
|
51
|
+
logger.newline();
|
|
52
|
+
logger.info(`Previous CLI version: ${oldVersion}`);
|
|
53
|
+
logger.info(`Current CLI version: ${version}`);
|
|
54
|
+
logger.newline();
|
|
55
|
+
try {
|
|
56
|
+
const result = await upgradeProject(targetDir, config);
|
|
57
|
+
// Log results
|
|
58
|
+
if (result.created.length > 0) {
|
|
59
|
+
logger.info(`✨ Created (${result.created.length} new files):`);
|
|
60
|
+
for (const f of result.created) {
|
|
61
|
+
logger.info(` + ${f}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (result.repaired.length > 0) {
|
|
65
|
+
logger.info(`🔧 Repaired (${result.repaired.length} corrupted files restored):`);
|
|
66
|
+
for (const f of result.repaired) {
|
|
67
|
+
logger.info(` ⚕ ${f}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (result.replaced.length > 0) {
|
|
71
|
+
logger.info(`🔄 Replaced (${result.replaced.length} files updated to latest):`);
|
|
72
|
+
for (const f of result.replaced) {
|
|
73
|
+
logger.info(` ↻ ${f}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (result.preserved.length > 0) {
|
|
77
|
+
logger.info(`🔒 Preserved (${result.preserved.length} files with project knowledge):`);
|
|
78
|
+
for (const f of result.preserved) {
|
|
79
|
+
logger.info(` ✓ ${f}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
logger.newline();
|
|
83
|
+
logger.nexus(`Upgrade complete! NEXUS ecosystem updated from v${oldVersion} → v${version}.`);
|
|
84
|
+
logger.info('Your project knowledge (populated docs, knowledge base, progress) was preserved.');
|
|
85
|
+
logger.newline();
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
logger.error('Upgrade failed.');
|
|
89
|
+
if (err instanceof Error) {
|
|
90
|
+
logger.error(err.message);
|
|
91
|
+
}
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAmB;IACtD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEvB,MAAM,SAAS,GAAG,UAAU;QAC1B,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UA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