@nexus-framework/cli 0.1.2 → 0.1.3
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 +108 -89
- 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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CAAC;YAC3B,CAAC;QACH,CAAC;QAED,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,KAAK,CACV,mDAAmD,UAAU,OAAO,OAAO,GAAG,CAC/E,CAAC;QACF,MAAM,CAAC,IAAI,CACT,kFAAkF,CACnF,CAAC;QACF,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAChC,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"}
|
|
@@ -57,20 +57,34 @@ function generateInstructions(config) {
|
|
|
57
57
|
|
|
58
58
|
> **This file is the single source of truth for all AI coding assistants.**
|
|
59
59
|
> It is auto-generated by [NEXUS CLI](https://github.com/GDA-Africa/nexus-cli) v${version}.
|
|
60
|
-
> Root-level config files (.cursorrules, .windsurfrules, etc.)
|
|
60
|
+
> Root-level config files (.cursorrules, .windsurfrules, etc.) embed these same rules.
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## 🧠 YOUR BRAIN: \`.nexus/docs/index.md\`
|
|
65
65
|
|
|
66
|
-
**
|
|
67
|
-
Then read \`.nexus/docs/07_implementation.md\` for the build plan and file-by-file guide.
|
|
66
|
+
**READ \`.nexus/docs/index.md\` FIRST. EVERY TIME. NO EXCEPTIONS.**
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
That file is your project brain. It contains:
|
|
69
|
+
- **Current Objective** — what you should be working on right now
|
|
70
|
+
- **Status Matrix** — what's done, what's in progress, what's blocked
|
|
71
|
+
- **Feature Backlog** — the prioritized roadmap of what to build
|
|
72
|
+
- **What Has Been Built** — every module, file, and test that exists
|
|
73
|
+
- **Progress Log** — session-by-session changelog (your memory)
|
|
74
|
+
- **What's Next** — your prioritized TODO list
|
|
75
|
+
- **Operating Rules** — the rules you MUST follow
|
|
76
|
+
|
|
77
|
+
\`\`\`
|
|
78
|
+
RULE: Before EVERY task, read .nexus/docs/index.md
|
|
79
|
+
RULE: After EVERY task, update .nexus/docs/index.md
|
|
80
|
+
RULE: When the user asks "what should we work on?" → check the index
|
|
81
|
+
RULE: When you finish a feature → update the index, then suggest the next item
|
|
82
|
+
RULE: NEVER ask "what enhancements would you like?" — the index has the answer
|
|
83
|
+
\`\`\`
|
|
70
84
|
|
|
71
85
|
---
|
|
72
86
|
|
|
73
|
-
## 🚨 CRITICAL — Onboarding Protocol (
|
|
87
|
+
## 🚨 CRITICAL — Onboarding Protocol (First-Time Setup)
|
|
74
88
|
|
|
75
89
|
Each NEXUS doc has YAML frontmatter with a \\\`status\\\` field:
|
|
76
90
|
- \\\`template\\\` — the doc is still in its default scaffolded state (has TODO placeholders)
|
|
@@ -81,36 +95,49 @@ STOP. If ANY .nexus/docs/ file has status: template → you MUST populate it FIR
|
|
|
81
95
|
Do NOT skip this step. Do NOT jump straight to the user's request.
|
|
82
96
|
This is a hard requirement, not a suggestion.
|
|
83
97
|
\\\`\\\`\\\`
|
|
98
|
+
\\\`\\\`\\\`
|
|
84
99
|
|
|
85
100
|
### Steps:
|
|
86
101
|
|
|
87
102
|
1. **Scan the codebase** — read \\\`package.json\\\`, \\\`tsconfig.json\\\`, source files in \\\`src/\\\`,
|
|
88
103
|
route definitions, data models, and test files to understand the project.
|
|
89
104
|
|
|
90
|
-
2. **
|
|
105
|
+
2. **Ask the user about their vision** — what are they building? Who are the users?
|
|
106
|
+
What features do they need? Fill in \\\`01_vision.md\\\` and \\\`05_business_logic.md\\\`.
|
|
107
|
+
|
|
108
|
+
3. **Auto-fill what you can infer** from the code:
|
|
91
109
|
- \\\`02_architecture.md\\\` — tech stack, directory structure, data flow
|
|
92
110
|
- \\\`03_data_contracts.md\\\` — schemas, types, validation from source code
|
|
93
111
|
- \\\`04_api_contracts.md\\\` — routes, endpoints, request/response shapes
|
|
94
112
|
- \\\`06_test_strategy.md\\\` — existing test setup, coverage, test patterns
|
|
95
|
-
- \\\`07_implementation.md\\\` — current build state, what exists vs. what's planned
|
|
96
113
|
- \\\`08_deployment.md\\\` — CI/CD config, environment variables, deploy targets
|
|
97
114
|
|
|
98
|
-
|
|
99
|
-
- \\\`01_vision.md\\\`
|
|
100
|
-
-
|
|
101
|
-
-
|
|
115
|
+
4. **Build the implementation plan** (\\\`07_implementation.md\\\`):
|
|
116
|
+
- Turn features from \\\`01_vision.md\\\` into concrete build phases
|
|
117
|
+
- Create a file-by-file plan with every file that needs to be created
|
|
118
|
+
- Set the current phase based on what already exists
|
|
119
|
+
- This is HOW you know what code to write
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
5. **Update the frontmatter** of each doc you fill in:
|
|
104
122
|
\\\`\\\`\\\`yaml
|
|
105
123
|
status: populated
|
|
106
124
|
confidence: high # or medium/low
|
|
107
125
|
last_updated: "YYYY-MM-DD"
|
|
108
126
|
\\\`\\\`\\\`
|
|
109
127
|
|
|
110
|
-
|
|
128
|
+
6. **Build the project brain** (\\\`.nexus/docs/index.md\\\`):
|
|
129
|
+
- Fill in the feature backlog from \\\`01_vision.md\\\` features
|
|
130
|
+
- Update the status matrix to reflect what's populated
|
|
131
|
+
- Update "What Has Been Built" to reflect current state
|
|
132
|
+
- Set "What's Next" to the first real feature from the backlog
|
|
133
|
+
- **This step is CRITICAL — this file drives all future work**
|
|
134
|
+
|
|
135
|
+
7. **THEN proceed** with the user's original request — or suggest
|
|
136
|
+
the first item from "What's Next" in the index.
|
|
111
137
|
|
|
112
138
|
This onboarding flow only applies when docs have \\\`status: template\\\`.
|
|
113
|
-
Once all docs are \\\`populated\\\`, skip this section and work normally
|
|
139
|
+
Once all docs are \\\`populated\\\`, skip this section and work normally —
|
|
140
|
+
but ALWAYS read \\\`.nexus/docs/index.md\\\` before every task.
|
|
114
141
|
|
|
115
142
|
---
|
|
116
143
|
|
|
@@ -191,21 +218,41 @@ This project includes 8 structured documentation files designed for both humans
|
|
|
191
218
|
| 6 | \`.nexus/docs/06_test_strategy.md\` | Coverage targets, test types, testing philosophy |
|
|
192
219
|
| 7 | \`.nexus/docs/07_implementation.md\` | Build order, file-by-file implementation plan |
|
|
193
220
|
| 8 | \`.nexus/docs/08_deployment.md\` | Infrastructure, CI/CD, environment configuration |
|
|
221
|
+
| 🧠 | \`.nexus/docs/index.md\` | **PROJECT BRAIN** — status, backlog, progress, what's next |
|
|
222
|
+
| 📚 | \`.nexus/docs/knowledge.md\` | **KNOWLEDGE BASE** — learned insights, patterns, gotchas |
|
|
194
223
|
|
|
195
|
-
**Start with \`.nexus/docs/
|
|
224
|
+
**Start with \`.nexus/docs/index.md\`** (your brain), then \`.nexus/docs/01_vision.md\`.
|
|
196
225
|
|
|
197
226
|
---
|
|
198
227
|
|
|
199
|
-
## Workflow
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
228
|
+
## Workflow — How To Work On This Project
|
|
229
|
+
|
|
230
|
+
### Before EVERY task:
|
|
231
|
+
1. **Read \`.nexus/docs/index.md\`** — check "Current Objective" and "What's Next"
|
|
232
|
+
2. **Read the relevant spec doc** — find details in the numbered \`.nexus/docs/\` files
|
|
233
|
+
3. **Scan \`.nexus/docs/knowledge.md\`** — check for relevant past learnings before making decisions
|
|
234
|
+
4. **Check \`.nexus/docs/07_implementation.md\`** — find the file-by-file plan
|
|
235
|
+
|
|
236
|
+
### During the task:
|
|
237
|
+
4. **Write the code** following the architecture in \`.nexus/docs/02_architecture.md\`
|
|
238
|
+
5. **Write tests** — match the strategy in \`.nexus/docs/06_test_strategy.md\`
|
|
239
|
+
6. **Validate** — \`${getValidationCommand(config)}\`
|
|
240
|
+
|
|
241
|
+
### After EVERY task:
|
|
242
|
+
7. **Update \`.nexus/docs/index.md\`**:
|
|
243
|
+
- Move completed items from "What's Next" to "Progress Log"
|
|
244
|
+
- Update the "Status Matrix" and "What Has Been Built"
|
|
245
|
+
- Set the "Current Objective" to the next priority item
|
|
246
|
+
8. **Update \`.nexus/docs/07_implementation.md\`** — mark completed files/tasks
|
|
247
|
+
9. **Learn** — if you discovered something non-obvious (bug pattern, architecture insight, package quirk, performance fix), append an entry to \`.nexus/docs/knowledge.md\`
|
|
248
|
+
10. **Commit** — use conventional commits (\`feat:\`, \`fix:\`, etc.)
|
|
249
|
+
11. **Suggest the next task** from \`.nexus/docs/index.md\` "What's Next"
|
|
250
|
+
|
|
251
|
+
### NEVER do this:
|
|
252
|
+
- ❌ Ask "what enhancements would you like?" when the backlog has items
|
|
253
|
+
- ❌ Invent random features not in the backlog
|
|
254
|
+
- ❌ Skip updating the index after completing work
|
|
255
|
+
- ❌ Treat docs as static — they evolve with the project
|
|
209
256
|
|
|
210
257
|
---
|
|
211
258
|
|
|
@@ -235,90 +282,62 @@ function toolInstructionContent(config, toolName) {
|
|
|
235
282
|
return `# ${config.displayName} — ${toolName} Instructions
|
|
236
283
|
|
|
237
284
|
> Auto-generated by [NEXUS CLI](https://github.com/GDA-Africa/nexus-cli) v${version}.
|
|
238
|
-
> Full instructions also at \`.nexus/ai/instructions.md\`.
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 🚨 CRITICAL — Read This First (Onboarding Protocol)
|
|
243
285
|
|
|
244
|
-
|
|
245
|
-
in \`.nexus/docs/\` that describe every aspect of the project.
|
|
286
|
+
## 🧠 YOUR BRAIN: \`.nexus/docs/index.md\`
|
|
246
287
|
|
|
247
|
-
|
|
248
|
-
- \`template\` — still has TODO placeholders, needs to be filled in
|
|
249
|
-
- \`populated\` — already filled in by a human or AI
|
|
288
|
+
**Read it FIRST. Every time. No exceptions.**
|
|
250
289
|
|
|
251
|
-
|
|
290
|
+
It contains: current objective, feature backlog, progress log, what's next.
|
|
252
291
|
|
|
253
292
|
\`\`\`
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
293
|
+
RULE: Before EVERY task → read .nexus/docs/index.md
|
|
294
|
+
RULE: After EVERY task → update .nexus/docs/index.md
|
|
295
|
+
RULE: NEVER ask "what enhancements would you like?" → the index has the answer
|
|
296
|
+
RULE: NEVER invent features → work from the feature backlog
|
|
257
297
|
\`\`\`
|
|
258
298
|
|
|
259
|
-
|
|
260
|
-
routes, data models, and tests to understand the project.
|
|
261
|
-
|
|
262
|
-
**Step 2 — Auto-fill what you can infer** from the code:
|
|
263
|
-
- \`02_architecture.md\` — tech stack, directory structure, data flow
|
|
264
|
-
- \`03_data_contracts.md\` — schemas, types, validation from source code
|
|
265
|
-
- \`04_api_contracts.md\` — routes, endpoints, request/response shapes
|
|
266
|
-
- \`06_test_strategy.md\` — existing test setup, coverage, patterns
|
|
267
|
-
- \`07_implementation.md\` — current build state, what exists vs. planned
|
|
268
|
-
- \`08_deployment.md\` — CI/CD config, environment variables
|
|
269
|
-
|
|
270
|
-
**Step 3 — Ask the user** for things you cannot infer:
|
|
271
|
-
- \`01_vision.md\` — product vision, user personas, success metrics
|
|
272
|
-
- \`05_business_logic.md\` — business rules, algorithms, decision logic
|
|
273
|
-
|
|
274
|
-
**Step 4 — Update frontmatter** of each doc you fill in:
|
|
275
|
-
\`\`\`yaml
|
|
276
|
-
status: populated
|
|
277
|
-
confidence: high # or medium/low
|
|
278
|
-
last_updated: "YYYY-MM-DD"
|
|
279
|
-
\`\`\`
|
|
280
|
-
|
|
281
|
-
**Step 5 — THEN** proceed with whatever the user originally asked.
|
|
299
|
+
## 🚨 First-Time Onboarding
|
|
282
300
|
|
|
283
|
-
|
|
301
|
+
If ANY \`.nexus/docs/\` file has \`status: template\` in its YAML frontmatter:
|
|
284
302
|
|
|
285
|
-
|
|
303
|
+
**STOP. Populate the docs BEFORE doing anything else.**
|
|
304
|
+
Read \`.nexus/ai/instructions.md\` for the full onboarding steps.
|
|
286
305
|
|
|
287
|
-
## Project
|
|
306
|
+
## Project
|
|
288
307
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
308
|
+
| Field | Value |
|
|
309
|
+
|-------|-------|
|
|
310
|
+
| Name | ${config.displayName} |
|
|
311
|
+
| Type | ${config.projectType} |
|
|
312
|
+
| Framework | ${frameworkDisplay} |
|
|
313
|
+
| Data | ${config.dataStrategy} |
|
|
314
|
+
| Testing | ${testDisplay} |
|
|
315
|
+
| Package Manager | ${config.packageManager} |
|
|
316
|
+
| Patterns | ${patternsDisplay} |
|
|
295
317
|
|
|
296
|
-
##
|
|
318
|
+
## Workflow
|
|
297
319
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
| 3 | \`.nexus/docs/03_data_contracts.md\` | Database schemas, validation |
|
|
303
|
-
| 4 | \`.nexus/docs/04_api_contracts.md\` | Endpoints, interfaces |
|
|
304
|
-
| 5 | \`.nexus/docs/05_business_logic.md\` | Rules, algorithms, flows |
|
|
305
|
-
| 6 | \`.nexus/docs/06_test_strategy.md\` | Coverage targets, test types |
|
|
306
|
-
| 7 | \`.nexus/docs/07_implementation.md\` | Build order, file plan |
|
|
307
|
-
| 8 | \`.nexus/docs/08_deployment.md\` | Infrastructure, CI/CD |
|
|
320
|
+
1. **Before:** Read \`.nexus/docs/index.md\` → check "What's Next". Scan \`.nexus/docs/knowledge.md\` for relevant past learnings
|
|
321
|
+
2. **During:** Write code + tests, validate with \`${getValidationCommand(config)}\`
|
|
322
|
+
3. **After:** Update \`.nexus/docs/index.md\` → move item to Progress Log. If you learned something non-obvious, append to \`.nexus/docs/knowledge.md\`
|
|
323
|
+
4. **Suggest:** The next item from the backlog
|
|
308
324
|
|
|
309
325
|
## Code Rules
|
|
310
326
|
|
|
311
327
|
- TypeScript strict mode — no \`any\`, no implicit returns
|
|
312
328
|
- ESM only — \`import\`/\`export\`, never \`require()\`
|
|
313
|
-
- File extensions in imports — always \`.js\`
|
|
314
329
|
- Conventional Commits — \`feat:\`, \`fix:\`, \`docs:\`, \`chore:\`
|
|
315
|
-
- Test everything — \`
|
|
316
|
-
- Validate: \`${getValidationCommand(config)}\`
|
|
330
|
+
- Test everything — validate: \`${getValidationCommand(config)}\`
|
|
317
331
|
|
|
318
|
-
##
|
|
332
|
+
## Docs
|
|
319
333
|
|
|
320
|
-
|
|
321
|
-
|
|
334
|
+
| File | Purpose |
|
|
335
|
+
|------|---------|
|
|
336
|
+
| \`.nexus/docs/index.md\` | **🧠 Project brain** — status, backlog, what's next |
|
|
337
|
+
| \`.nexus/ai/instructions.md\` | Full AI rules, onboarding protocol, architecture |
|
|
338
|
+
| \`.nexus/docs/knowledge.md\` | **📚 Knowledge base** — learned insights, patterns, gotchas |
|
|
339
|
+
| \`.nexus/docs/01_vision.md\` | Vision, features, personas |
|
|
340
|
+
| \`.nexus/docs/07_implementation.md\` | Build order, file-by-file plan |
|
|
322
341
|
`;
|
|
323
342
|
}
|
|
324
343
|
function generateCursorRules(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-config.js","sourceRoot":"","sources":["../../src/generators/ai-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;oEAEoE;AAEpE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAClD,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,qDAAqD;IACrD,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzC,6EAA6E;IAC7E,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,KAAK,CAAC,I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AAS,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,OAAO,mBAAmB,OAAO,OAAO,SAAS,OAAO,CAAC;AAC3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/generators/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/generators/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA2C3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,EAAE,CAiBjE"}
|