nexusforge-cli 1.1.1 → 1.2.1
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/components/App.d.ts.map +1 -1
- package/dist/components/App.js +183 -17
- package/dist/components/App.js.map +1 -1
- package/dist/index.js +462 -10
- package/dist/index.js.map +1 -1
- package/dist/modules/commandEngine.d.ts +70 -0
- package/dist/modules/commandEngine.d.ts.map +1 -0
- package/dist/modules/commandEngine.js +672 -0
- package/dist/modules/commandEngine.js.map +1 -0
- package/dist/modules/contextBuilder.d.ts +51 -0
- package/dist/modules/contextBuilder.d.ts.map +1 -0
- package/dist/modules/contextBuilder.js +725 -0
- package/dist/modules/contextBuilder.js.map +1 -0
- package/dist/modules/domainDetector.d.ts +64 -0
- package/dist/modules/domainDetector.d.ts.map +1 -0
- package/dist/modules/domainDetector.js +722 -0
- package/dist/modules/domainDetector.js.map +1 -0
- package/dist/modules/fileOperations.d.ts +99 -0
- package/dist/modules/fileOperations.d.ts.map +1 -0
- package/dist/modules/fileOperations.js +543 -0
- package/dist/modules/fileOperations.js.map +1 -0
- package/dist/modules/forgeEngine.d.ts +153 -0
- package/dist/modules/forgeEngine.d.ts.map +1 -0
- package/dist/modules/forgeEngine.js +652 -0
- package/dist/modules/forgeEngine.js.map +1 -0
- package/dist/modules/gitManager.d.ts +151 -0
- package/dist/modules/gitManager.d.ts.map +1 -0
- package/dist/modules/gitManager.js +539 -0
- package/dist/modules/gitManager.js.map +1 -0
- package/dist/modules/index.d.ts +25 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +25 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/prdProcessor.d.ts +125 -0
- package/dist/modules/prdProcessor.d.ts.map +1 -0
- package/dist/modules/prdProcessor.js +466 -0
- package/dist/modules/prdProcessor.js.map +1 -0
- package/dist/modules/projectScanner.d.ts +105 -0
- package/dist/modules/projectScanner.d.ts.map +1 -0
- package/dist/modules/projectScanner.js +859 -0
- package/dist/modules/projectScanner.js.map +1 -0
- package/dist/modules/safetyGuard.d.ts +83 -0
- package/dist/modules/safetyGuard.d.ts.map +1 -0
- package/dist/modules/safetyGuard.js +492 -0
- package/dist/modules/safetyGuard.js.map +1 -0
- package/dist/modules/templateManager.d.ts +78 -0
- package/dist/modules/templateManager.d.ts.map +1 -0
- package/dist/modules/templateManager.js +556 -0
- package/dist/modules/templateManager.js.map +1 -0
- package/dist/native/index.d.ts +125 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +164 -0
- package/dist/native/index.js.map +1 -0
- package/dist/services/executor.d.ts +24 -0
- package/dist/services/executor.d.ts.map +1 -1
- package/dist/services/executor.js +149 -6
- package/dist/services/executor.js.map +1 -1
- package/dist/services/fileManager.d.ts +134 -0
- package/dist/services/fileManager.d.ts.map +1 -0
- package/dist/services/fileManager.js +489 -0
- package/dist/services/fileManager.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safetyGuard.js","sourceRoot":"","sources":["../../src/modules/safetyGuard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,MAAM,CAAN,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,wBAAW,CAAA;IACX,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,kCAAqB,CAAA;AACvB,CAAC,EANW,SAAS,KAAT,SAAS,QAMpB;AAED,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,gCAAe,CAAA;IAC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modules/fileops/templates.py
|
|
5
|
+
*/
|
|
6
|
+
export interface TemplateMetadata {
|
|
7
|
+
name: string;
|
|
8
|
+
type: 'file' | 'project';
|
|
9
|
+
source: string;
|
|
10
|
+
created: string;
|
|
11
|
+
variables: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface TemplateInfo {
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
extension?: string;
|
|
17
|
+
files?: number;
|
|
18
|
+
variables: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface SnippetData {
|
|
21
|
+
name: string;
|
|
22
|
+
language: string;
|
|
23
|
+
description: string;
|
|
24
|
+
variables: string[];
|
|
25
|
+
content: string;
|
|
26
|
+
created: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TemplateContext {
|
|
29
|
+
name?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
author?: string;
|
|
32
|
+
timestamp?: string;
|
|
33
|
+
date?: string;
|
|
34
|
+
year?: number;
|
|
35
|
+
imports?: string[];
|
|
36
|
+
hooks?: string[];
|
|
37
|
+
styled?: boolean;
|
|
38
|
+
propsInterface?: boolean;
|
|
39
|
+
props?: Array<{
|
|
40
|
+
name: string;
|
|
41
|
+
type: string;
|
|
42
|
+
optional?: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
[key: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
export declare class TemplateManager {
|
|
47
|
+
private templatesDir;
|
|
48
|
+
constructor(templatesDir?: string);
|
|
49
|
+
createFromTemplate(templateName: string, outputPath: string, context?: TemplateContext, overwrite?: boolean): string;
|
|
50
|
+
registerTemplate(sourcePath: string, templateName: string, templateType?: 'file' | 'project'): string;
|
|
51
|
+
listTemplates(templateType?: 'file' | 'project'): {
|
|
52
|
+
files: TemplateInfo[];
|
|
53
|
+
projects: TemplateInfo[];
|
|
54
|
+
};
|
|
55
|
+
createSnippet(name: string, content: string, language: string, description?: string, variables?: string[]): string;
|
|
56
|
+
getSnippet(name: string, language?: string): string;
|
|
57
|
+
listSnippets(language?: string): SnippetData[];
|
|
58
|
+
private getDefaultContext;
|
|
59
|
+
private findTemplate;
|
|
60
|
+
private renderFileTemplate;
|
|
61
|
+
private renderProjectTemplate;
|
|
62
|
+
private renderTemplate;
|
|
63
|
+
private applyFilter;
|
|
64
|
+
private extractVariables;
|
|
65
|
+
private loadMetadata;
|
|
66
|
+
private isTextFile;
|
|
67
|
+
private copyDir;
|
|
68
|
+
private countFiles;
|
|
69
|
+
private toCamelCase;
|
|
70
|
+
private toSnakeCase;
|
|
71
|
+
private toKebabCase;
|
|
72
|
+
private toPascalCase;
|
|
73
|
+
private pluralize;
|
|
74
|
+
private createBuiltinTemplates;
|
|
75
|
+
}
|
|
76
|
+
export declare function getTemplateManager(templatesDir?: string): TemplateManager;
|
|
77
|
+
export declare function resetTemplateManager(): void;
|
|
78
|
+
//# sourceMappingURL=templateManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateManager.d.ts","sourceRoot":"","sources":["../../src/modules/templateManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,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AE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAAE,GACnB,MAAM;IAiBT,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IA4BnD,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE;IAmC9C,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,cAAc;IAuCtB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,OAAO;IAaf,OAAO,CAAC,UAAU;IAgBlB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,sBAAsB;CA6H/B;AAQD,wBAAgB,kBAAkB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,CAKzE;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Manager for NexusForge CLI
|
|
3
|
+
* Smart file and project templating system
|
|
4
|
+
* Ported from Python nexusforge/modules/fileops/templates.py
|
|
5
|
+
*/
|
|
6
|
+
import * as fs from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import * as os from 'os';
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// TEMPLATE MANAGER CLASS
|
|
11
|
+
// ============================================================================
|
|
12
|
+
export class TemplateManager {
|
|
13
|
+
templatesDir;
|
|
14
|
+
constructor(templatesDir) {
|
|
15
|
+
this.templatesDir = templatesDir || path.join(os.homedir(), '.nexusforge', 'templates');
|
|
16
|
+
// Ensure directory exists
|
|
17
|
+
if (!fs.existsSync(this.templatesDir)) {
|
|
18
|
+
fs.mkdirSync(this.templatesDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
// Create built-in templates
|
|
21
|
+
this.createBuiltinTemplates();
|
|
22
|
+
}
|
|
23
|
+
// ========================================================================
|
|
24
|
+
// TEMPLATE CREATION
|
|
25
|
+
// ========================================================================
|
|
26
|
+
createFromTemplate(templateName, outputPath, context, overwrite = false) {
|
|
27
|
+
context = this.getDefaultContext(context);
|
|
28
|
+
// Find template
|
|
29
|
+
const templatePath = this.findTemplate(templateName);
|
|
30
|
+
if (!templatePath) {
|
|
31
|
+
throw new Error(`Template not found: ${templateName}`);
|
|
32
|
+
}
|
|
33
|
+
// Check output
|
|
34
|
+
if (fs.existsSync(outputPath) && !overwrite) {
|
|
35
|
+
throw new Error(`Output file already exists: ${outputPath}`);
|
|
36
|
+
}
|
|
37
|
+
// Render template
|
|
38
|
+
const stat = fs.statSync(templatePath);
|
|
39
|
+
if (stat.isFile()) {
|
|
40
|
+
// Single file template
|
|
41
|
+
const content = this.renderFileTemplate(templatePath, context);
|
|
42
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
43
|
+
fs.writeFileSync(outputPath, content);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
// Project template (directory)
|
|
47
|
+
this.renderProjectTemplate(templatePath, outputPath, context);
|
|
48
|
+
}
|
|
49
|
+
return outputPath;
|
|
50
|
+
}
|
|
51
|
+
registerTemplate(sourcePath, templateName, templateType = 'file') {
|
|
52
|
+
if (!fs.existsSync(sourcePath)) {
|
|
53
|
+
throw new Error(`Source path not found: ${sourcePath}`);
|
|
54
|
+
}
|
|
55
|
+
// Determine destination
|
|
56
|
+
let destPath;
|
|
57
|
+
if (templateType === 'project') {
|
|
58
|
+
destPath = path.join(this.templatesDir, 'projects', templateName);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const ext = path.extname(sourcePath);
|
|
62
|
+
destPath = path.join(this.templatesDir, 'files', `${templateName}${ext}`);
|
|
63
|
+
}
|
|
64
|
+
// Create parent directory
|
|
65
|
+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
66
|
+
// Copy template
|
|
67
|
+
const stat = fs.statSync(sourcePath);
|
|
68
|
+
if (stat.isFile()) {
|
|
69
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this.copyDir(sourcePath, destPath);
|
|
73
|
+
}
|
|
74
|
+
// Create metadata
|
|
75
|
+
const metadata = {
|
|
76
|
+
name: templateName,
|
|
77
|
+
type: templateType,
|
|
78
|
+
source: sourcePath,
|
|
79
|
+
created: new Date().toISOString(),
|
|
80
|
+
variables: this.extractVariables(sourcePath),
|
|
81
|
+
};
|
|
82
|
+
const metaPath = destPath + '.meta.json';
|
|
83
|
+
fs.writeFileSync(metaPath, JSON.stringify(metadata, null, 2));
|
|
84
|
+
return destPath;
|
|
85
|
+
}
|
|
86
|
+
listTemplates(templateType) {
|
|
87
|
+
const templates = {
|
|
88
|
+
files: [],
|
|
89
|
+
projects: [],
|
|
90
|
+
};
|
|
91
|
+
// File templates
|
|
92
|
+
if (!templateType || templateType === 'file') {
|
|
93
|
+
const filesDir = path.join(this.templatesDir, 'files');
|
|
94
|
+
if (fs.existsSync(filesDir)) {
|
|
95
|
+
for (const file of fs.readdirSync(filesDir)) {
|
|
96
|
+
if (!file.endsWith('.meta.json')) {
|
|
97
|
+
const filePath = path.join(filesDir, file);
|
|
98
|
+
const meta = this.loadMetadata(filePath);
|
|
99
|
+
templates.files.push({
|
|
100
|
+
name: path.parse(file).name,
|
|
101
|
+
path: filePath,
|
|
102
|
+
extension: path.extname(file),
|
|
103
|
+
variables: meta?.variables || [],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Project templates
|
|
110
|
+
if (!templateType || templateType === 'project') {
|
|
111
|
+
const projectsDir = path.join(this.templatesDir, 'projects');
|
|
112
|
+
if (fs.existsSync(projectsDir)) {
|
|
113
|
+
for (const dir of fs.readdirSync(projectsDir)) {
|
|
114
|
+
const dirPath = path.join(projectsDir, dir);
|
|
115
|
+
if (fs.statSync(dirPath).isDirectory()) {
|
|
116
|
+
const meta = this.loadMetadata(dirPath);
|
|
117
|
+
templates.projects.push({
|
|
118
|
+
name: dir,
|
|
119
|
+
path: dirPath,
|
|
120
|
+
files: this.countFiles(dirPath),
|
|
121
|
+
variables: meta?.variables || [],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return templates;
|
|
128
|
+
}
|
|
129
|
+
// ========================================================================
|
|
130
|
+
// SNIPPETS
|
|
131
|
+
// ========================================================================
|
|
132
|
+
createSnippet(name, content, language, description, variables) {
|
|
133
|
+
const snippetPath = path.join(this.templatesDir, 'snippets', language, `${name}.snippet`);
|
|
134
|
+
fs.mkdirSync(path.dirname(snippetPath), { recursive: true });
|
|
135
|
+
const snippetData = {
|
|
136
|
+
name,
|
|
137
|
+
language,
|
|
138
|
+
description: description || '',
|
|
139
|
+
variables: variables || [],
|
|
140
|
+
content,
|
|
141
|
+
created: new Date().toISOString(),
|
|
142
|
+
};
|
|
143
|
+
fs.writeFileSync(snippetPath, JSON.stringify(snippetData, null, 2));
|
|
144
|
+
return snippetPath;
|
|
145
|
+
}
|
|
146
|
+
getSnippet(name, language) {
|
|
147
|
+
// Search for snippet
|
|
148
|
+
if (language) {
|
|
149
|
+
const snippetPath = path.join(this.templatesDir, 'snippets', language, `${name}.snippet`);
|
|
150
|
+
if (fs.existsSync(snippetPath)) {
|
|
151
|
+
const data = JSON.parse(fs.readFileSync(snippetPath, 'utf-8'));
|
|
152
|
+
return data.content;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// Search all languages
|
|
157
|
+
const snippetsDir = path.join(this.templatesDir, 'snippets');
|
|
158
|
+
if (fs.existsSync(snippetsDir)) {
|
|
159
|
+
for (const langDir of fs.readdirSync(snippetsDir)) {
|
|
160
|
+
const langPath = path.join(snippetsDir, langDir);
|
|
161
|
+
if (fs.statSync(langPath).isDirectory()) {
|
|
162
|
+
const snippetPath = path.join(langPath, `${name}.snippet`);
|
|
163
|
+
if (fs.existsSync(snippetPath)) {
|
|
164
|
+
const data = JSON.parse(fs.readFileSync(snippetPath, 'utf-8'));
|
|
165
|
+
return data.content;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
throw new Error(`Snippet not found: ${name}`);
|
|
172
|
+
}
|
|
173
|
+
listSnippets(language) {
|
|
174
|
+
const snippets = [];
|
|
175
|
+
const snippetsDir = path.join(this.templatesDir, 'snippets');
|
|
176
|
+
if (!fs.existsSync(snippetsDir)) {
|
|
177
|
+
return snippets;
|
|
178
|
+
}
|
|
179
|
+
const languages = language ? [language] : fs.readdirSync(snippetsDir);
|
|
180
|
+
for (const lang of languages) {
|
|
181
|
+
const langPath = path.join(snippetsDir, lang);
|
|
182
|
+
if (fs.existsSync(langPath) && fs.statSync(langPath).isDirectory()) {
|
|
183
|
+
for (const file of fs.readdirSync(langPath)) {
|
|
184
|
+
if (file.endsWith('.snippet')) {
|
|
185
|
+
try {
|
|
186
|
+
const data = JSON.parse(fs.readFileSync(path.join(langPath, file), 'utf-8'));
|
|
187
|
+
snippets.push(data);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// Ignore errors
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return snippets;
|
|
197
|
+
}
|
|
198
|
+
// ========================================================================
|
|
199
|
+
// PRIVATE METHODS
|
|
200
|
+
// ========================================================================
|
|
201
|
+
getDefaultContext(context) {
|
|
202
|
+
const defaults = {
|
|
203
|
+
timestamp: new Date().toISOString(),
|
|
204
|
+
date: new Date().toISOString().split('T')[0],
|
|
205
|
+
year: new Date().getFullYear(),
|
|
206
|
+
author: process.env.USER || 'NexusForge',
|
|
207
|
+
};
|
|
208
|
+
return { ...defaults, ...context };
|
|
209
|
+
}
|
|
210
|
+
findTemplate(name) {
|
|
211
|
+
// Check file templates
|
|
212
|
+
const filesDir = path.join(this.templatesDir, 'files');
|
|
213
|
+
if (fs.existsSync(filesDir)) {
|
|
214
|
+
for (const file of fs.readdirSync(filesDir)) {
|
|
215
|
+
if (file.startsWith(name) && !file.endsWith('.meta.json')) {
|
|
216
|
+
return path.join(filesDir, file);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Check project templates
|
|
221
|
+
const projectPath = path.join(this.templatesDir, 'projects', name);
|
|
222
|
+
if (fs.existsSync(projectPath)) {
|
|
223
|
+
return projectPath;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
renderFileTemplate(templatePath, context) {
|
|
228
|
+
let content = fs.readFileSync(templatePath, 'utf-8');
|
|
229
|
+
return this.renderTemplate(content, context);
|
|
230
|
+
}
|
|
231
|
+
renderProjectTemplate(templateDir, outputDir, context) {
|
|
232
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
233
|
+
for (const entry of fs.readdirSync(templateDir, { withFileTypes: true })) {
|
|
234
|
+
if (entry.name.endsWith('.meta.json') || entry.name.endsWith('.meta.yaml')) {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
const sourcePath = path.join(templateDir, entry.name);
|
|
238
|
+
const renderedName = this.renderTemplate(entry.name, context);
|
|
239
|
+
const destPath = path.join(outputDir, renderedName);
|
|
240
|
+
if (entry.isDirectory()) {
|
|
241
|
+
this.renderProjectTemplate(sourcePath, destPath, context);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
if (this.isTextFile(sourcePath)) {
|
|
245
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
246
|
+
const renderedContent = this.renderTemplate(content, context);
|
|
247
|
+
fs.writeFileSync(destPath, renderedContent);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
renderTemplate(template, context) {
|
|
256
|
+
// Simple template rendering with {{ variable }} syntax
|
|
257
|
+
let result = template;
|
|
258
|
+
// Replace {{ variable }} patterns
|
|
259
|
+
const varPattern = /\{\{\s*(\w+)(?:\s*\|\s*(\w+))?\s*\}\}/g;
|
|
260
|
+
result = result.replace(varPattern, (match, varName, filter) => {
|
|
261
|
+
let value = context[varName];
|
|
262
|
+
if (value === undefined)
|
|
263
|
+
return match;
|
|
264
|
+
// Apply filters
|
|
265
|
+
if (filter) {
|
|
266
|
+
value = this.applyFilter(String(value), filter);
|
|
267
|
+
}
|
|
268
|
+
return String(value);
|
|
269
|
+
});
|
|
270
|
+
// Replace {% if variable %}...{% endif %} blocks
|
|
271
|
+
const ifPattern = /\{%\s*if\s+(\w+)\s*%\}([\s\S]*?)\{%\s*endif\s*%\}/g;
|
|
272
|
+
result = result.replace(ifPattern, (match, varName, content) => {
|
|
273
|
+
return context[varName] ? content : '';
|
|
274
|
+
});
|
|
275
|
+
// Replace {% for item in array %}...{% endfor %} blocks
|
|
276
|
+
const forPattern = /\{%\s*for\s+(\w+)\s+in\s+(\w+)\s*%\}([\s\S]*?)\{%\s*endfor\s*%\}/g;
|
|
277
|
+
result = result.replace(forPattern, (match, itemName, arrayName, content) => {
|
|
278
|
+
const array = context[arrayName];
|
|
279
|
+
if (!Array.isArray(array))
|
|
280
|
+
return '';
|
|
281
|
+
return array.map(item => {
|
|
282
|
+
const itemContext = { ...context, [itemName]: item };
|
|
283
|
+
return this.renderTemplate(content, itemContext);
|
|
284
|
+
}).join('');
|
|
285
|
+
});
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
applyFilter(value, filter) {
|
|
289
|
+
switch (filter) {
|
|
290
|
+
case 'camelcase':
|
|
291
|
+
return this.toCamelCase(value);
|
|
292
|
+
case 'snakecase':
|
|
293
|
+
return this.toSnakeCase(value);
|
|
294
|
+
case 'kebabcase':
|
|
295
|
+
return this.toKebabCase(value);
|
|
296
|
+
case 'pascalcase':
|
|
297
|
+
return this.toPascalCase(value);
|
|
298
|
+
case 'pluralize':
|
|
299
|
+
return this.pluralize(value);
|
|
300
|
+
default:
|
|
301
|
+
return value;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
extractVariables(sourcePath) {
|
|
305
|
+
const variables = new Set();
|
|
306
|
+
const extractFromContent = (content) => {
|
|
307
|
+
const pattern = /\{\{\s*(\w+)/g;
|
|
308
|
+
let match;
|
|
309
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
310
|
+
variables.add(match[1]);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
const stat = fs.statSync(sourcePath);
|
|
314
|
+
if (stat.isFile() && this.isTextFile(sourcePath)) {
|
|
315
|
+
const content = fs.readFileSync(sourcePath, 'utf-8');
|
|
316
|
+
extractFromContent(content);
|
|
317
|
+
}
|
|
318
|
+
else if (stat.isDirectory()) {
|
|
319
|
+
const scan = (dir) => {
|
|
320
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
321
|
+
const fullPath = path.join(dir, entry.name);
|
|
322
|
+
if (entry.isDirectory()) {
|
|
323
|
+
scan(fullPath);
|
|
324
|
+
}
|
|
325
|
+
else if (this.isTextFile(fullPath)) {
|
|
326
|
+
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
327
|
+
extractFromContent(content);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
scan(sourcePath);
|
|
332
|
+
}
|
|
333
|
+
return Array.from(variables).sort();
|
|
334
|
+
}
|
|
335
|
+
loadMetadata(templatePath) {
|
|
336
|
+
const metaPath = templatePath + '.meta.json';
|
|
337
|
+
if (fs.existsSync(metaPath)) {
|
|
338
|
+
try {
|
|
339
|
+
return JSON.parse(fs.readFileSync(metaPath, 'utf-8'));
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
isTextFile(filePath) {
|
|
348
|
+
try {
|
|
349
|
+
const buffer = Buffer.alloc(512);
|
|
350
|
+
const fd = fs.openSync(filePath, 'r');
|
|
351
|
+
fs.readSync(fd, buffer, 0, 512, 0);
|
|
352
|
+
fs.closeSync(fd);
|
|
353
|
+
// Check for null bytes (binary indicator)
|
|
354
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
355
|
+
if (buffer[i] === 0)
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
copyDir(src, dest) {
|
|
365
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
366
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
367
|
+
const srcPath = path.join(src, entry.name);
|
|
368
|
+
const destPath = path.join(dest, entry.name);
|
|
369
|
+
if (entry.isDirectory()) {
|
|
370
|
+
this.copyDir(srcPath, destPath);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
fs.copyFileSync(srcPath, destPath);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
countFiles(dir) {
|
|
378
|
+
let count = 0;
|
|
379
|
+
const scan = (d) => {
|
|
380
|
+
for (const entry of fs.readdirSync(d, { withFileTypes: true })) {
|
|
381
|
+
if (entry.isDirectory()) {
|
|
382
|
+
scan(path.join(d, entry.name));
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
count++;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
scan(dir);
|
|
390
|
+
return count;
|
|
391
|
+
}
|
|
392
|
+
// String transformation helpers
|
|
393
|
+
toCamelCase(value) {
|
|
394
|
+
const words = value.replace(/-/g, '_').split('_');
|
|
395
|
+
return words[0].toLowerCase() + words.slice(1).map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join('');
|
|
396
|
+
}
|
|
397
|
+
toSnakeCase(value) {
|
|
398
|
+
return value
|
|
399
|
+
.replace(/([A-Z])/g, '_$1')
|
|
400
|
+
.toLowerCase()
|
|
401
|
+
.replace(/^_/, '')
|
|
402
|
+
.replace(/-/g, '_');
|
|
403
|
+
}
|
|
404
|
+
toKebabCase(value) {
|
|
405
|
+
return this.toSnakeCase(value).replace(/_/g, '-');
|
|
406
|
+
}
|
|
407
|
+
toPascalCase(value) {
|
|
408
|
+
const words = value.replace(/-/g, '_').split('_');
|
|
409
|
+
return words.map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join('');
|
|
410
|
+
}
|
|
411
|
+
pluralize(value) {
|
|
412
|
+
if (value.endsWith('y')) {
|
|
413
|
+
return value.slice(0, -1) + 'ies';
|
|
414
|
+
}
|
|
415
|
+
else if (['s', 'x', 'z'].some(c => value.endsWith(c)) ||
|
|
416
|
+
['ch', 'sh'].some(s => value.endsWith(s))) {
|
|
417
|
+
return value + 'es';
|
|
418
|
+
}
|
|
419
|
+
return value + 's';
|
|
420
|
+
}
|
|
421
|
+
// ========================================================================
|
|
422
|
+
// BUILT-IN TEMPLATES
|
|
423
|
+
// ========================================================================
|
|
424
|
+
createBuiltinTemplates() {
|
|
425
|
+
const marker = path.join(this.templatesDir, '.templates_initialized');
|
|
426
|
+
if (fs.existsSync(marker)) {
|
|
427
|
+
return; // Templates already created
|
|
428
|
+
}
|
|
429
|
+
// Python module template
|
|
430
|
+
const pythonModule = `"""
|
|
431
|
+
{{ description }}
|
|
432
|
+
|
|
433
|
+
Created: {{ date }}
|
|
434
|
+
Author: {{ author }}
|
|
435
|
+
"""
|
|
436
|
+
|
|
437
|
+
{% if imports %}
|
|
438
|
+
{% for imp in imports %}
|
|
439
|
+
{{ imp }}
|
|
440
|
+
{% endfor %}
|
|
441
|
+
|
|
442
|
+
{% endif %}
|
|
443
|
+
class {{ name | pascalcase }}:
|
|
444
|
+
"""{{ description }}"""
|
|
445
|
+
|
|
446
|
+
def __init__(self):
|
|
447
|
+
"""Initialize {{ name }}"""
|
|
448
|
+
pass
|
|
449
|
+
|
|
450
|
+
def process(self):
|
|
451
|
+
"""Main processing method"""
|
|
452
|
+
pass
|
|
453
|
+
|
|
454
|
+
def main():
|
|
455
|
+
"""Main entry point"""
|
|
456
|
+
instance = {{ name | pascalcase }}()
|
|
457
|
+
instance.process()
|
|
458
|
+
|
|
459
|
+
if __name__ == "__main__":
|
|
460
|
+
main()
|
|
461
|
+
`;
|
|
462
|
+
const pythonPath = path.join(this.templatesDir, 'files', 'python_module.py');
|
|
463
|
+
fs.mkdirSync(path.dirname(pythonPath), { recursive: true });
|
|
464
|
+
fs.writeFileSync(pythonPath, pythonModule);
|
|
465
|
+
// React component template
|
|
466
|
+
const reactComponent = `import React{% if hooks %}, { {{ hooks | join(', ') }} }{% endif %} from 'react';
|
|
467
|
+
{% if styled %}
|
|
468
|
+
import styled from 'styled-components';
|
|
469
|
+
{% endif %}
|
|
470
|
+
{% if propsInterface %}
|
|
471
|
+
|
|
472
|
+
interface {{ name }}Props {
|
|
473
|
+
{% for prop in props %}
|
|
474
|
+
{{ prop.name }}{% if prop.optional %}?{% endif %}: {{ prop.type }};
|
|
475
|
+
{% endfor %}
|
|
476
|
+
}
|
|
477
|
+
{% endif %}
|
|
478
|
+
|
|
479
|
+
{% if styled %}
|
|
480
|
+
const {{ name }}Container = styled.div\`
|
|
481
|
+
/* Add styles here */
|
|
482
|
+
\`;
|
|
483
|
+
{% endif %}
|
|
484
|
+
|
|
485
|
+
export const {{ name }}{% if propsInterface %}: React.FC<{{ name }}Props>{% endif %} = ({% if propsInterface %}props{% endif %}) => {
|
|
486
|
+
{% if hooks %}
|
|
487
|
+
{% for hook in hooks %}
|
|
488
|
+
// Add {{ hook }} logic here
|
|
489
|
+
{% endfor %}
|
|
490
|
+
|
|
491
|
+
{% endif %}
|
|
492
|
+
return (
|
|
493
|
+
{% if styled %}<{{ name }}Container>{% else %}<div>{% endif %}
|
|
494
|
+
<h1>{{ name }} Component</h1>
|
|
495
|
+
{/* Add component content here */}
|
|
496
|
+
{% if styled %}</{{ name }}Container>{% else %}</div>{% endif %}
|
|
497
|
+
);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
export default {{ name }};
|
|
501
|
+
`;
|
|
502
|
+
const reactPath = path.join(this.templatesDir, 'files', 'react_component.tsx');
|
|
503
|
+
fs.writeFileSync(reactPath, reactComponent);
|
|
504
|
+
// TypeScript module template
|
|
505
|
+
const tsModule = `/**
|
|
506
|
+
* {{ description }}
|
|
507
|
+
* Created: {{ date }}
|
|
508
|
+
* Author: {{ author }}
|
|
509
|
+
*/
|
|
510
|
+
|
|
511
|
+
{% if imports %}
|
|
512
|
+
{% for imp in imports %}
|
|
513
|
+
{{ imp }}
|
|
514
|
+
{% endfor %}
|
|
515
|
+
|
|
516
|
+
{% endif %}
|
|
517
|
+
export interface {{ name | pascalcase }}Options {
|
|
518
|
+
// Add options here
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export class {{ name | pascalcase }} {
|
|
522
|
+
private options: {{ name | pascalcase }}Options;
|
|
523
|
+
|
|
524
|
+
constructor(options?: Partial<{{ name | pascalcase }}Options>) {
|
|
525
|
+
this.options = { ...options };
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
async process(): Promise<void> {
|
|
529
|
+
// Main processing logic
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export function create{{ name | pascalcase }}(options?: Partial<{{ name | pascalcase }}Options>): {{ name | pascalcase }} {
|
|
534
|
+
return new {{ name | pascalcase }}(options);
|
|
535
|
+
}
|
|
536
|
+
`;
|
|
537
|
+
const tsPath = path.join(this.templatesDir, 'files', 'typescript_module.ts');
|
|
538
|
+
fs.writeFileSync(tsPath, tsModule);
|
|
539
|
+
// Create marker file
|
|
540
|
+
fs.writeFileSync(marker, new Date().toISOString());
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// ============================================================================
|
|
544
|
+
// SINGLETON INSTANCE
|
|
545
|
+
// ============================================================================
|
|
546
|
+
let managerInstance = null;
|
|
547
|
+
export function getTemplateManager(templatesDir) {
|
|
548
|
+
if (!managerInstance) {
|
|
549
|
+
managerInstance = new TemplateManager(templatesDir);
|
|
550
|
+
}
|
|
551
|
+
return managerInstance;
|
|
552
|
+
}
|
|
553
|
+
export function resetTemplateManager() {
|
|
554
|
+
managerInstance = null;
|
|
555
|
+
}
|
|
556
|
+
//# sourceMappingURL=templateManager.js.map
|