cortex-tms 2.6.0 → 3.0.0
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/README.md +304 -68
- package/bin/cortex.js +18 -0
- package/dist/cli.js +17 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +21 -11
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +36 -23
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/prompt.js +1 -2
- package/dist/commands/prompt.js.map +1 -1
- package/dist/commands/review.d.ts +4 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +167 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +94 -4
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tutorial.js +26 -2
- package/dist/commands/tutorial.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +4 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/guardian.d.ts +18 -0
- package/dist/types/guardian.d.ts.map +1 -0
- package/dist/types/guardian.js +2 -0
- package/dist/types/guardian.js.map +1 -0
- package/dist/utils/config.js +2 -2
- package/dist/utils/guardian-prompt.d.ts +3 -0
- package/dist/utils/guardian-prompt.d.ts.map +1 -0
- package/dist/utils/guardian-prompt.js +85 -0
- package/dist/utils/guardian-prompt.js.map +1 -0
- package/dist/utils/llm-client.d.ts +30 -0
- package/dist/utils/llm-client.d.ts.map +1 -0
- package/dist/utils/llm-client.js +215 -0
- package/dist/utils/llm-client.js.map +1 -0
- package/dist/utils/templates.d.ts.map +1 -1
- package/dist/utils/templates.js +1 -1
- package/dist/utils/templates.js.map +1 -1
- package/dist/utils/token-counter.d.ts +75 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +159 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/dist/utils/validator.d.ts +1 -1
- package/dist/utils/validator.d.ts.map +1 -1
- package/dist/utils/validator.js +61 -30
- package/dist/utils/validator.js.map +1 -1
- package/package.json +17 -10
- package/templates/.github/copilot-instructions.md +3 -0
- package/templates/CLAUDE.md +15 -1
- package/templates/FUTURE-ENHANCEMENTS.md +1 -1
- package/templates/NEXT-TASKS.md +1 -1
- package/templates/PROMPTS.md +93 -1
- package/templates/README.md +1 -1
- package/templates/docs/archive/v1.0-CHANGELOG.md +1 -1
- package/templates/docs/core/ARCHITECTURE.md +1 -1
- package/templates/docs/core/DECISIONS.md +1 -1
- package/templates/docs/core/DOMAIN-LOGIC.md +1 -1
- package/templates/docs/core/GLOSSARY.md +1 -1
- package/templates/docs/core/PATTERNS.md +1 -1
- package/templates/docs/core/SCHEMA.md +1 -1
- package/templates/docs/core/TROUBLESHOOTING.md +1 -1
package/dist/utils/validator.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { readFile } from 'fs/promises';
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
3
|
import { join, basename } from 'path';
|
|
4
|
-
import { loadConfig, mergeConfig, getEffectiveLineLimits, saveConfig, createConfigFromScope, } from './config.js';
|
|
4
|
+
import { loadConfig, mergeConfig, getEffectiveLineLimits, saveConfig, createConfigFromScope, getScopePreset, } from './config.js';
|
|
5
5
|
import { getTemplatesDir, processTemplate } from './templates.js';
|
|
6
6
|
export const DEFAULT_LINE_LIMITS = {
|
|
7
7
|
'NEXT-TASKS.md': 200,
|
|
8
8
|
'FUTURE-ENHANCEMENTS.md': 500,
|
|
9
9
|
'ARCHITECTURE.md': 500,
|
|
10
|
-
'PATTERNS.md':
|
|
11
|
-
'DOMAIN-LOGIC.md':
|
|
10
|
+
'PATTERNS.md': 650,
|
|
11
|
+
'DOMAIN-LOGIC.md': 400,
|
|
12
12
|
'DECISIONS.md': 400,
|
|
13
13
|
'GLOSSARY.md': 200,
|
|
14
14
|
'SCHEMA.md': 600,
|
|
@@ -19,13 +19,7 @@ export const MANDATORY_FILES = [
|
|
|
19
19
|
'.github/copilot-instructions.md',
|
|
20
20
|
'CLAUDE.md',
|
|
21
21
|
];
|
|
22
|
-
const
|
|
23
|
-
/\[Project Name\]/g,
|
|
24
|
-
/\[project-name\]/g,
|
|
25
|
-
/\[Description\]/g,
|
|
26
|
-
/\[Your Name\]/g,
|
|
27
|
-
/\[Repository URL\]/g,
|
|
28
|
-
];
|
|
22
|
+
const PLACEHOLDER_PATTERN = /\[([A-Z][a-zA-Z\s]+)\](?!\()/g;
|
|
29
23
|
async function countLines(filePath) {
|
|
30
24
|
try {
|
|
31
25
|
const content = await readFile(filePath, 'utf-8');
|
|
@@ -38,22 +32,35 @@ async function countLines(filePath) {
|
|
|
38
32
|
async function scanForPlaceholders(filePath) {
|
|
39
33
|
try {
|
|
40
34
|
const content = await readFile(filePath, 'utf-8');
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
35
|
+
const matches = content.match(PLACEHOLDER_PATTERN);
|
|
36
|
+
if (matches) {
|
|
37
|
+
return {
|
|
38
|
+
found: true,
|
|
39
|
+
placeholders: [...new Set(matches)],
|
|
40
|
+
};
|
|
47
41
|
}
|
|
48
|
-
return {
|
|
49
|
-
found: found.length > 0,
|
|
50
|
-
placeholders: [...new Set(found)],
|
|
51
|
-
};
|
|
42
|
+
return { found: false, placeholders: [] };
|
|
52
43
|
}
|
|
53
44
|
catch {
|
|
54
45
|
return { found: false, placeholders: [] };
|
|
55
46
|
}
|
|
56
47
|
}
|
|
48
|
+
async function scanForAIDrafts(filePath) {
|
|
49
|
+
try {
|
|
50
|
+
const content = await readFile(filePath, 'utf-8');
|
|
51
|
+
const matches = content.match(/<!--\s*AI-DRAFT.*?-->/gi);
|
|
52
|
+
if (matches) {
|
|
53
|
+
return {
|
|
54
|
+
found: true,
|
|
55
|
+
count: matches.length,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return { found: false, count: 0 };
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return { found: false, count: 0 };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
57
64
|
async function countCompletedTasks(filePath) {
|
|
58
65
|
try {
|
|
59
66
|
const content = await readFile(filePath, 'utf-8');
|
|
@@ -110,9 +117,20 @@ export async function validateFileSizes(cwd, limits = DEFAULT_LINE_LIMITS) {
|
|
|
110
117
|
}
|
|
111
118
|
return checks;
|
|
112
119
|
}
|
|
113
|
-
|
|
120
|
+
function getMandatoryFilesForScope(scope) {
|
|
121
|
+
if (!scope) {
|
|
122
|
+
return MANDATORY_FILES;
|
|
123
|
+
}
|
|
124
|
+
const preset = getScopePreset(scope);
|
|
125
|
+
if (!preset) {
|
|
126
|
+
return MANDATORY_FILES;
|
|
127
|
+
}
|
|
128
|
+
return preset.mandatoryFiles;
|
|
129
|
+
}
|
|
130
|
+
export function validateMandatoryFiles(cwd, scope) {
|
|
114
131
|
const checks = [];
|
|
115
|
-
|
|
132
|
+
const mandatoryFiles = getMandatoryFilesForScope(scope);
|
|
133
|
+
for (const file of mandatoryFiles) {
|
|
116
134
|
const filePath = join(cwd, file);
|
|
117
135
|
const exists = existsSync(filePath);
|
|
118
136
|
checks.push({
|
|
@@ -182,23 +200,36 @@ export async function validatePlaceholders(cwd, ignoreFiles = []) {
|
|
|
182
200
|
if (!existsSync(filePath)) {
|
|
183
201
|
continue;
|
|
184
202
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
203
|
+
const [placeholderResult, draftResult] = await Promise.all([
|
|
204
|
+
scanForPlaceholders(filePath),
|
|
205
|
+
scanForAIDrafts(filePath),
|
|
206
|
+
]);
|
|
207
|
+
if (placeholderResult.found) {
|
|
187
208
|
checks.push({
|
|
188
|
-
name: `
|
|
209
|
+
name: `Completion: ${file}`,
|
|
189
210
|
passed: false,
|
|
211
|
+
level: 'error',
|
|
212
|
+
message: `${file} is incomplete (contains placeholder text)`,
|
|
213
|
+
details: `Found: ${placeholderResult.placeholders.join(', ')}\n💡 Run 'cortex-tms prompt bootstrap' with your AI agent to populate this file.`,
|
|
214
|
+
file,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
else if (draftResult.found) {
|
|
218
|
+
checks.push({
|
|
219
|
+
name: `Completion: ${file}`,
|
|
220
|
+
passed: true,
|
|
190
221
|
level: 'warning',
|
|
191
|
-
message: `${file} contains
|
|
192
|
-
details:
|
|
222
|
+
message: `${file} contains AI-generated drafts (needs human review)`,
|
|
223
|
+
details: `${draftResult.count} draft section${draftResult.count > 1 ? 's' : ''} marked with <!-- AI-DRAFT -->\n💡 Review the AI-generated content and remove the <!-- AI-DRAFT --> markers once accepted.`,
|
|
193
224
|
file,
|
|
194
225
|
});
|
|
195
226
|
}
|
|
196
227
|
else {
|
|
197
228
|
checks.push({
|
|
198
|
-
name: `
|
|
229
|
+
name: `Completion: ${file}`,
|
|
199
230
|
passed: true,
|
|
200
231
|
level: 'info',
|
|
201
|
-
message: `${file}
|
|
232
|
+
message: `${file} is complete and reviewed`,
|
|
202
233
|
file,
|
|
203
234
|
});
|
|
204
235
|
}
|
|
@@ -262,7 +293,7 @@ export async function validateProject(cwd, options = {}) {
|
|
|
262
293
|
const ignoreFiles = config.validation?.ignoreFiles || [];
|
|
263
294
|
const [fileSizeChecks, mandatoryChecks, configChecks, placeholderChecks, archiveChecks] = await Promise.all([
|
|
264
295
|
validateFileSizes(cwd, limits),
|
|
265
|
-
Promise.resolve(validateMandatoryFiles(cwd)),
|
|
296
|
+
Promise.resolve(validateMandatoryFiles(cwd, config.scope)),
|
|
266
297
|
Promise.resolve(validateConfig(cwd)),
|
|
267
298
|
validatePlaceholders(cwd, ignoreFiles),
|
|
268
299
|
validateArchiveStatus(cwd),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/utils/validator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/utils/validator.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAQtC,OAAO,EACL,UAAU,EACV,WAAW,EACX,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMlE,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,eAAe,EAAE,GAAG;IACpB,wBAAwB,EAAE,GAAG;IAC7B,iBAAiB,EAAE,GAAG;IACtB,aAAa,EAAE,GAAG;IAClB,iBAAiB,EAAE,GAAG;IACtB,cAAc,EAAE,GAAG;IACnB,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,GAAG;IAChB,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAKF,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,eAAe;IACf,iCAAiC;IACjC,WAAW;CACZ,CAAC;AAWF,MAAM,mBAAmB,GAAG,+BAA+B,CAAC;AAK5D,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;Q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,OAAO,CAAC,CAAC,MAAM;KACzD,CAAC;IAGF,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEhE,OAAO;QACL,MAAM;QACN,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cortex-tms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "AI-powered project scaffolding CLI for documentation, task management, and workflow automation. Optimized for Claude Code, GitHub Copilot, and LLM-assisted development.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"cortex-tms": "./bin/cortex-tms.js"
|
|
7
|
+
"cortex-tms": "./bin/cortex-tms.js",
|
|
8
|
+
"cortex": "./bin/cortex.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"bin/",
|
|
@@ -35,7 +36,10 @@
|
|
|
35
36
|
"test:coverage": "vitest run --coverage",
|
|
36
37
|
"lint": "eslint src/**/*.ts",
|
|
37
38
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
38
|
-
"prepare": "husky"
|
|
39
|
+
"prepare": "husky",
|
|
40
|
+
"website:dev": "pnpm --filter @cortex-tms/website dev",
|
|
41
|
+
"website:build": "pnpm --filter @cortex-tms/website build",
|
|
42
|
+
"website:preview": "pnpm --filter @cortex-tms/website preview"
|
|
39
43
|
},
|
|
40
44
|
"keywords": [
|
|
41
45
|
"documentation",
|
|
@@ -54,16 +58,19 @@
|
|
|
54
58
|
"typescript",
|
|
55
59
|
"starter-kit"
|
|
56
60
|
],
|
|
57
|
-
"author":
|
|
61
|
+
"author": {
|
|
62
|
+
"name": "Cortex TMS Contributors",
|
|
63
|
+
"email": "maintainers@cortex-tms.org"
|
|
64
|
+
},
|
|
58
65
|
"license": "MIT",
|
|
59
66
|
"repository": {
|
|
60
67
|
"type": "git",
|
|
61
|
-
"url": "https://github.com/
|
|
68
|
+
"url": "https://github.com/cortex-tms/cortex-tms.git"
|
|
62
69
|
},
|
|
63
70
|
"bugs": {
|
|
64
|
-
"url": "https://github.com/
|
|
71
|
+
"url": "https://github.com/cortex-tms/cortex-tms/issues"
|
|
65
72
|
},
|
|
66
|
-
"homepage": "https://
|
|
73
|
+
"homepage": "https://cortex-tms.org/",
|
|
67
74
|
"dependencies": {
|
|
68
75
|
"chalk": "^5.3.0",
|
|
69
76
|
"clipboardy": "^4.0.0",
|
|
@@ -76,12 +83,12 @@
|
|
|
76
83
|
"devDependencies": {
|
|
77
84
|
"@types/fs-extra": "^11.0.4",
|
|
78
85
|
"@types/inquirer": "^9.0.7",
|
|
79
|
-
"@types/node": "^20.
|
|
86
|
+
"@types/node": "^20.19.30",
|
|
80
87
|
"eslint": "^9.17.0",
|
|
81
88
|
"husky": "^9.1.7",
|
|
82
|
-
"prettier": "^3.
|
|
89
|
+
"prettier": "^3.8.1",
|
|
83
90
|
"tsx": "^4.19.2",
|
|
84
91
|
"typescript": "^5.7.3",
|
|
85
|
-
"vitest": "^4.0.
|
|
92
|
+
"vitest": "^4.0.18"
|
|
86
93
|
}
|
|
87
94
|
}
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
- **Types**: ALWAYS use strict TypeScript. No `any`. No `@ts-ignore`.
|
|
8
8
|
- **Logic**: Before implementing business logic, check `docs/core/DOMAIN-LOGIC.md`.
|
|
9
9
|
|
|
10
|
+
<!-- SETUP NOTE: If you see [placeholder] text above, this project needs
|
|
11
|
+
bootstrapping. Run: cortex-tms prompt bootstrap -->
|
|
12
|
+
|
|
10
13
|
## 🏗️ Technical Map (Read Order)
|
|
11
14
|
|
|
12
15
|
AI agents MUST follow this order before proposing code:
|
package/templates/CLAUDE.md
CHANGED
|
@@ -17,4 +17,18 @@ Expert Senior Developer. Follow the **"Propose, Justify, Recommend"** framework.
|
|
|
17
17
|
3. If unsure of a term, check `docs/core/GLOSSARY.md`.
|
|
18
18
|
4. Execute TDD (Test-Driven Development).
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
## 🚀 First Session Setup
|
|
21
|
+
<!-- Remove this section after completing setup -->
|
|
22
|
+
|
|
23
|
+
If this is your first session with this project, the documentation files
|
|
24
|
+
contain placeholder content. Help the user populate them:
|
|
25
|
+
|
|
26
|
+
1. Run `cortex-tms prompt bootstrap` (or paste the bootstrap prompt)
|
|
27
|
+
2. Analyze the codebase and populate docs/core/ARCHITECTURE.md
|
|
28
|
+
3. Customize this file (CLAUDE.md) with real CLI commands
|
|
29
|
+
4. Update .github/copilot-instructions.md with real tech stack
|
|
30
|
+
5. Suggest initial tasks for NEXT-TASKS.md
|
|
31
|
+
|
|
32
|
+
After setup, remove this "First Session Setup" section.
|
|
33
|
+
|
|
34
|
+
<!-- @cortex-tms-version 3.0.0 -->
|
|
@@ -78,4 +78,4 @@ A task moves from FUTURE → NEXT when:
|
|
|
78
78
|
**Why Rejected**: [Reason - e.g., "User research showed low demand", "Technical complexity too high"]
|
|
79
79
|
**Alternative**: [What we did instead - e.g., "Built simplified version in Sprint 3"]
|
|
80
80
|
|
|
81
|
-
<!-- @cortex-tms-version
|
|
81
|
+
<!-- @cortex-tms-version 3.0.0 -->
|
package/templates/NEXT-TASKS.md
CHANGED
package/templates/PROMPTS.md
CHANGED
|
@@ -52,10 +52,102 @@ Task complete. Execute the Maintenance Protocol:
|
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
+
## bootstrap
|
|
56
|
+
|
|
57
|
+
You have just been added to a project that uses Cortex TMS for AI governance.
|
|
58
|
+
The documentation files exist but contain placeholder content that needs to be
|
|
59
|
+
populated with real project information.
|
|
60
|
+
|
|
61
|
+
**Your task**: Analyze this codebase and populate the TMS documentation files
|
|
62
|
+
as DRAFTS for human review.
|
|
63
|
+
|
|
64
|
+
**Step 1 - Understand the project**:
|
|
65
|
+
- Read `package.json` (or equivalent) for tech stack and dependencies
|
|
66
|
+
- Scan the directory structure to understand components
|
|
67
|
+
- Read entry points (`src/index.*`, `src/app.*`, `bin/*`)
|
|
68
|
+
- Read any existing README.md for project context
|
|
69
|
+
|
|
70
|
+
**Step 2 - Populate ARCHITECTURE.md** (`docs/core/ARCHITECTURE.md`):
|
|
71
|
+
- Fill "Quick Context" with what the project does, who it's for, key constraint
|
|
72
|
+
- Fill "System Overview" with 2-3 sentences about the system
|
|
73
|
+
- Fill "Component Map" table with real components from the codebase
|
|
74
|
+
- Fill "Core Data Flow" with the actual happy path
|
|
75
|
+
- Mark all populated sections with: `<!-- AI-DRAFT: Review before treating as canonical -->`
|
|
76
|
+
|
|
77
|
+
**Step 3 - Customize CLAUDE.md**:
|
|
78
|
+
- Update CLI commands with the project's actual commands (from package.json scripts)
|
|
79
|
+
- Add project-specific operational loop steps
|
|
80
|
+
- Add any project-specific rules or conventions you observed
|
|
81
|
+
|
|
82
|
+
**Step 4 - Customize copilot-instructions.md** (`.github/copilot-instructions.md`):
|
|
83
|
+
- Fill in the actual tech stack
|
|
84
|
+
- Add real conventions observed in the code
|
|
85
|
+
- Add project-specific prohibitions
|
|
86
|
+
|
|
87
|
+
**Step 5 - Populate NEXT-TASKS.md**:
|
|
88
|
+
- If there are open TODOs, issues, or incomplete features, suggest initial tasks
|
|
89
|
+
- Otherwise, suggest "Review AI-generated documentation" as first task
|
|
90
|
+
|
|
91
|
+
**Rules**:
|
|
92
|
+
- Be SPECIFIC to this project - no generic advice
|
|
93
|
+
- Reference actual file paths from the codebase
|
|
94
|
+
- Mark every generated section with `<!-- AI-DRAFT -->` comment
|
|
95
|
+
- Ask the user to confirm before writing each file
|
|
96
|
+
- If unsure about something, ASK rather than guess
|
|
97
|
+
- Do NOT open or send content from `.env*`, `*.pem`, `id_rsa*`, or similar secret files
|
|
98
|
+
- Skip `node_modules/`, `dist/`, `build/`, `coverage/`, `.git/`
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## populate-architecture
|
|
103
|
+
|
|
104
|
+
Analyze this codebase and populate `docs/core/ARCHITECTURE.md`:
|
|
105
|
+
|
|
106
|
+
1. Read `package.json` for tech stack, then scan `src/` directory structure
|
|
107
|
+
2. Fill "Quick Context": what it does, who it's for, key constraint
|
|
108
|
+
3. Fill "Component Map": real components with responsibilities and tech stack
|
|
109
|
+
4. Fill "Core Data Flow": trace the main happy path from entry point to output
|
|
110
|
+
5. Fill "Deployment & Infrastructure" from config files and CI workflows
|
|
111
|
+
|
|
112
|
+
Be specific to THIS project. Reference actual file paths. Mark sections with
|
|
113
|
+
`<!-- AI-DRAFT: Review before treating as canonical -->`.
|
|
114
|
+
Present the draft and ask for confirmation before writing.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## discover-patterns
|
|
119
|
+
|
|
120
|
+
Review this codebase and document patterns for `docs/core/PATTERNS.md`:
|
|
121
|
+
|
|
122
|
+
1. Scan representative files in `src/` for recurring conventions
|
|
123
|
+
2. Identify: naming conventions, error handling, component structure, testing patterns
|
|
124
|
+
3. For each pattern, find a canonical example (actual file path + code snippet)
|
|
125
|
+
4. Document as "Pattern N: Name" with Rule, Anti-Pattern, and Canonical Example
|
|
126
|
+
|
|
127
|
+
Extract ACTUAL patterns from code, not generic best practices.
|
|
128
|
+
Mark all entries with `<!-- AI-DRAFT -->`. Present draft for review before writing.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## extract-rules
|
|
133
|
+
|
|
134
|
+
Extract domain-specific rules for `docs/core/DOMAIN-LOGIC.md`:
|
|
135
|
+
|
|
136
|
+
1. Look for validation logic (schemas, validators, form rules)
|
|
137
|
+
2. Look for business rules (calculations, state machines, conditionals)
|
|
138
|
+
3. Look for integration constraints (API limits, timeouts, rate limits)
|
|
139
|
+
4. Look for security rules (auth checks, input sanitization)
|
|
140
|
+
|
|
141
|
+
For each rule: write a clear imperative statement, cite the source file,
|
|
142
|
+
and mark severity (critical/important/guideline).
|
|
143
|
+
Mark all entries with `<!-- AI-DRAFT -->`. Present draft for review before writing.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
55
147
|
## Usage Tips
|
|
56
148
|
|
|
57
149
|
- Replace placeholders like `[FEATURE]`, `[ISSUE]`, `[COMPONENT]`, `[TOPIC]` with your specific context
|
|
58
150
|
- Customize these prompts to match your team's vocabulary and workflow
|
|
59
151
|
- Run `cortex-tms prompt --list` to see all available prompts
|
|
60
152
|
|
|
61
|
-
<!-- @cortex-tms-version
|
|
153
|
+
<!-- @cortex-tms-version 3.0.0 -->
|
package/templates/README.md
CHANGED
|
@@ -171,4 +171,4 @@ This project follows conventional commit standards and uses AI-assisted developm
|
|
|
171
171
|
|
|
172
172
|
**Built with [Cortex TMS](https://github.com/[your-org]/cortex-tms) - AI-Optimized Project Documentation**
|
|
173
173
|
|
|
174
|
-
<!-- @cortex-tms-version
|
|
174
|
+
<!-- @cortex-tms-version 3.0.0 -->
|
|
@@ -82,4 +82,4 @@ This file documents **why** we made key technical decisions. When an AI agent or
|
|
|
82
82
|
- **Patterns**: See `docs/core/PATTERNS.md` for implementation patterns
|
|
83
83
|
- **Glossary**: See `docs/core/GLOSSARY.md` for term definitions
|
|
84
84
|
|
|
85
|
-
<!-- @cortex-tms-version
|
|
85
|
+
<!-- @cortex-tms-version 3.0.0 -->
|
|
@@ -65,4 +65,4 @@ This file defines project-specific terminology, acronyms, and domain language to
|
|
|
65
65
|
- **Patterns**: See `docs/core/PATTERNS.md` for code conventions
|
|
66
66
|
- **Decisions**: See `docs/core/DECISIONS.md` for technology choices
|
|
67
67
|
|
|
68
|
-
<!-- @cortex-tms-version
|
|
68
|
+
<!-- @cortex-tms-version 3.0.0 -->
|