wmx-os-generators 0.2.3 → 0.2.5
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/memoryGenerator.d.ts +3 -0
- package/dist/memoryGenerator.js +92 -0
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/memoryGenerator.ts +95 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ScaffoldGenerator } from "./scaffold.js";
|
|
2
2
|
export { generateAnalysis, generateReadme, generateArchitectureDocs, generateApiDocs } from "./docsGenerator.js";
|
|
3
3
|
export { generateVercelConfig, generateRenderConfig, generateNetlifyConfig } from "./deployGenerator.js";
|
|
4
|
+
export { generateMemoryDoc, writeMemoryDoc } from "./memoryGenerator.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ScaffoldGenerator } from "./scaffold.js";
|
|
2
2
|
export { generateAnalysis, generateReadme, generateArchitectureDocs, generateApiDocs } from "./docsGenerator.js";
|
|
3
3
|
export { generateVercelConfig, generateRenderConfig, generateNetlifyConfig } from "./deployGenerator.js";
|
|
4
|
+
export { generateMemoryDoc, writeMemoryDoc } from "./memoryGenerator.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
function routeTable(routes) {
|
|
4
|
+
if (routes.length === 0)
|
|
5
|
+
return '_No routes detected._';
|
|
6
|
+
return [
|
|
7
|
+
'| Method | Path | File |',
|
|
8
|
+
'|--------|------|------|',
|
|
9
|
+
...routes.map(r => `| \`${r.method}\` | \`${r.path}\` | ${r.file} |`),
|
|
10
|
+
].join('\n');
|
|
11
|
+
}
|
|
12
|
+
function apiTable(routes) {
|
|
13
|
+
if (routes.length === 0)
|
|
14
|
+
return '_No API endpoints detected._';
|
|
15
|
+
return [
|
|
16
|
+
'| Method | Path | File | Line |',
|
|
17
|
+
'|--------|------|------|------|',
|
|
18
|
+
...routes.map(r => `| \`${r.method}\` | \`${r.path}\` | ${r.file} | ${r.line} |`),
|
|
19
|
+
].join('\n');
|
|
20
|
+
}
|
|
21
|
+
function componentList(items) {
|
|
22
|
+
if (items.length === 0)
|
|
23
|
+
return '_None detected._';
|
|
24
|
+
return items.map(c => `- \`${c.name}\` — ${c.file}`).join('\n');
|
|
25
|
+
}
|
|
26
|
+
export function generateMemoryDoc(memory) {
|
|
27
|
+
return `# Project Memory
|
|
28
|
+
|
|
29
|
+
_Generated by \`wmx memory\` on ${new Date().toISOString()}_
|
|
30
|
+
|
|
31
|
+
This file summarizes the project for AI assistants (Claude, ChatGPT, Cursor, etc.) so they can understand the codebase without re-scanning it from scratch.
|
|
32
|
+
|
|
33
|
+
## Project Summary
|
|
34
|
+
|
|
35
|
+
- **Name:** ${memory.projectName}
|
|
36
|
+
- **Description:** ${memory.description || '_No description in package.json_'}
|
|
37
|
+
- **Framework:** ${memory.framework ?? 'unknown'}
|
|
38
|
+
- **Database:** ${memory.database ?? 'none detected'}
|
|
39
|
+
- **Package manager:** ${memory.packageManager ?? 'unknown'}
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
|
|
43
|
+
- Framework: **${memory.framework ?? 'unknown'}**
|
|
44
|
+
- Database: **${memory.database ?? 'none detected'}**
|
|
45
|
+
- Total page routes: **${memory.routes.length}**
|
|
46
|
+
- Total API endpoints: **${memory.apiRoutes.length}**
|
|
47
|
+
- Total components: **${memory.components.length}**
|
|
48
|
+
- Total hooks: **${memory.hooks.length}**
|
|
49
|
+
|
|
50
|
+
## Routes
|
|
51
|
+
|
|
52
|
+
${routeTable(memory.routes)}
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
${apiTable(memory.apiRoutes)}
|
|
57
|
+
|
|
58
|
+
## Database
|
|
59
|
+
|
|
60
|
+
${memory.database ? `This project uses **${memory.database}**.` : 'No database dependency detected.'}
|
|
61
|
+
|
|
62
|
+
## Hooks
|
|
63
|
+
|
|
64
|
+
${componentList(memory.hooks)}
|
|
65
|
+
|
|
66
|
+
## Components
|
|
67
|
+
|
|
68
|
+
${componentList(memory.components)}
|
|
69
|
+
|
|
70
|
+
## Coding Style
|
|
71
|
+
|
|
72
|
+
- Quotes: **${memory.codingStyle.quotes}**
|
|
73
|
+
- Semicolons: **${memory.codingStyle.semicolons ? 'yes' : 'no'}**
|
|
74
|
+
- Indentation: **${memory.codingStyle.indent}**
|
|
75
|
+
|
|
76
|
+
## Naming Convention
|
|
77
|
+
|
|
78
|
+
- Component files: **${memory.namingConvention.componentFiles}**
|
|
79
|
+
- General files: **${memory.namingConvention.generalFiles}**
|
|
80
|
+
|
|
81
|
+
## Folder Structure
|
|
82
|
+
|
|
83
|
+
\`\`\`
|
|
84
|
+
${memory.folderTree}
|
|
85
|
+
\`\`\`
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
export async function writeMemoryDoc(memory, outputDir) {
|
|
89
|
+
await fs.ensureDir(outputDir);
|
|
90
|
+
await fs.writeFile(path.join(outputDir, 'memory.md'), generateMemoryDoc(memory), 'utf8');
|
|
91
|
+
await fs.writeFile(path.join(outputDir, 'memory.json'), JSON.stringify(memory, null, 2), 'utf8');
|
|
92
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wmx-os-generators",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"execa": "^8.0.0",
|
|
13
13
|
"fs-extra": "^11.0.0",
|
|
14
|
-
"wmx-os-core": "^0.2.
|
|
15
|
-
"wmx-os-scanners": "^0.2.
|
|
14
|
+
"wmx-os-core": "^0.2.5",
|
|
15
|
+
"wmx-os-scanners": "^0.2.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/fs-extra": "^11.0.0",
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ScaffoldGenerator } from "./scaffold.js";
|
|
2
2
|
export { generateAnalysis, generateReadme, generateArchitectureDocs, generateApiDocs } from "./docsGenerator.js";
|
|
3
3
|
export { generateVercelConfig, generateRenderConfig, generateNetlifyConfig } from "./deployGenerator.js";
|
|
4
|
+
export { generateMemoryDoc, writeMemoryDoc } from "./memoryGenerator.js";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import fs from 'fs-extra'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import type { ProjectMemory } from 'wmx-os-scanners'
|
|
4
|
+
|
|
5
|
+
function routeTable(routes: ProjectMemory['routes']): string {
|
|
6
|
+
if (routes.length === 0) return '_No routes detected._'
|
|
7
|
+
return [
|
|
8
|
+
'| Method | Path | File |',
|
|
9
|
+
'|--------|------|------|',
|
|
10
|
+
...routes.map(r => `| \`${r.method}\` | \`${r.path}\` | ${r.file} |`),
|
|
11
|
+
].join('\n')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function apiTable(routes: ProjectMemory['apiRoutes']): string {
|
|
15
|
+
if (routes.length === 0) return '_No API endpoints detected._'
|
|
16
|
+
return [
|
|
17
|
+
'| Method | Path | File | Line |',
|
|
18
|
+
'|--------|------|------|------|',
|
|
19
|
+
...routes.map(r => `| \`${r.method}\` | \`${r.path}\` | ${r.file} | ${r.line} |`),
|
|
20
|
+
].join('\n')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function componentList(items: ProjectMemory['components']): string {
|
|
24
|
+
if (items.length === 0) return '_None detected._'
|
|
25
|
+
return items.map(c => `- \`${c.name}\` — ${c.file}`).join('\n')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function generateMemoryDoc(memory: ProjectMemory): string {
|
|
29
|
+
return `# Project Memory
|
|
30
|
+
|
|
31
|
+
_Generated by \`wmx memory\` on ${new Date().toISOString()}_
|
|
32
|
+
|
|
33
|
+
This file summarizes the project for AI assistants (Claude, ChatGPT, Cursor, etc.) so they can understand the codebase without re-scanning it from scratch.
|
|
34
|
+
|
|
35
|
+
## Project Summary
|
|
36
|
+
|
|
37
|
+
- **Name:** ${memory.projectName}
|
|
38
|
+
- **Description:** ${memory.description || '_No description in package.json_'}
|
|
39
|
+
- **Framework:** ${memory.framework ?? 'unknown'}
|
|
40
|
+
- **Database:** ${memory.database ?? 'none detected'}
|
|
41
|
+
- **Package manager:** ${memory.packageManager ?? 'unknown'}
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
- Framework: **${memory.framework ?? 'unknown'}**
|
|
46
|
+
- Database: **${memory.database ?? 'none detected'}**
|
|
47
|
+
- Total page routes: **${memory.routes.length}**
|
|
48
|
+
- Total API endpoints: **${memory.apiRoutes.length}**
|
|
49
|
+
- Total components: **${memory.components.length}**
|
|
50
|
+
- Total hooks: **${memory.hooks.length}**
|
|
51
|
+
|
|
52
|
+
## Routes
|
|
53
|
+
|
|
54
|
+
${routeTable(memory.routes)}
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
${apiTable(memory.apiRoutes)}
|
|
59
|
+
|
|
60
|
+
## Database
|
|
61
|
+
|
|
62
|
+
${memory.database ? `This project uses **${memory.database}**.` : 'No database dependency detected.'}
|
|
63
|
+
|
|
64
|
+
## Hooks
|
|
65
|
+
|
|
66
|
+
${componentList(memory.hooks)}
|
|
67
|
+
|
|
68
|
+
## Components
|
|
69
|
+
|
|
70
|
+
${componentList(memory.components)}
|
|
71
|
+
|
|
72
|
+
## Coding Style
|
|
73
|
+
|
|
74
|
+
- Quotes: **${memory.codingStyle.quotes}**
|
|
75
|
+
- Semicolons: **${memory.codingStyle.semicolons ? 'yes' : 'no'}**
|
|
76
|
+
- Indentation: **${memory.codingStyle.indent}**
|
|
77
|
+
|
|
78
|
+
## Naming Convention
|
|
79
|
+
|
|
80
|
+
- Component files: **${memory.namingConvention.componentFiles}**
|
|
81
|
+
- General files: **${memory.namingConvention.generalFiles}**
|
|
82
|
+
|
|
83
|
+
## Folder Structure
|
|
84
|
+
|
|
85
|
+
\`\`\`
|
|
86
|
+
${memory.folderTree}
|
|
87
|
+
\`\`\`
|
|
88
|
+
`
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export async function writeMemoryDoc(memory: ProjectMemory, outputDir: string): Promise<void> {
|
|
92
|
+
await fs.ensureDir(outputDir)
|
|
93
|
+
await fs.writeFile(path.join(outputDir, 'memory.md'), generateMemoryDoc(memory), 'utf8')
|
|
94
|
+
await fs.writeFile(path.join(outputDir, 'memory.json'), JSON.stringify(memory, null, 2), 'utf8')
|
|
95
|
+
}
|