metacoding 1.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/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +244 -0
- package/bin/metacoding.js +27 -0
- package/lib/cli.d.ts +2 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +83 -0
- package/lib/cli.js.map +1 -0
- package/lib/commands/init.d.ts +15 -0
- package/lib/commands/init.d.ts.map +1 -0
- package/lib/commands/init.js +185 -0
- package/lib/commands/init.js.map +1 -0
- package/lib/commands/update.d.ts +5 -0
- package/lib/commands/update.d.ts.map +1 -0
- package/lib/commands/update.js +20 -0
- package/lib/commands/update.js.map +1 -0
- package/lib/commands/validate.d.ts +5 -0
- package/lib/commands/validate.d.ts.map +1 -0
- package/lib/commands/validate.js +20 -0
- package/lib/commands/validate.js.map +1 -0
- package/lib/services/filesystem.d.ts +13 -0
- package/lib/services/filesystem.d.ts.map +1 -0
- package/lib/services/filesystem.js +84 -0
- package/lib/services/filesystem.js.map +1 -0
- package/lib/services/project-detector.d.ts +12 -0
- package/lib/services/project-detector.d.ts.map +1 -0
- package/lib/services/project-detector.js +191 -0
- package/lib/services/project-detector.js.map +1 -0
- package/lib/services/template-manager.d.ts +15 -0
- package/lib/services/template-manager.d.ts.map +1 -0
- package/lib/services/template-manager.js +167 -0
- package/lib/services/template-manager.js.map +1 -0
- package/lib/services/vscode.d.ts +10 -0
- package/lib/services/vscode.d.ts.map +1 -0
- package/lib/services/vscode.js +108 -0
- package/lib/services/vscode.js.map +1 -0
- package/lib/types/index.d.ts +66 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/package.json +134 -0
- package/templates/general/files/code-review.instructions.md +111 -0
- package/templates/general/files/copilot-instructions.md.template +404 -0
- package/templates/general/files/docs-update.instructions.md +203 -0
- package/templates/general/files/release.instructions.md +72 -0
- package/templates/general/files/test-runner.instructions.md +107 -0
- package/templates/general/template.json +9 -0
- package/templates/node/files/code-review.instructions.md +222 -0
- package/templates/node/files/copilot-instructions.md.template +391 -0
- package/templates/node/files/docs-update.instructions.md +203 -0
- package/templates/node/files/release.instructions.md +72 -0
- package/templates/node/files/test-runner.instructions.md +108 -0
- package/templates/node/template.json +23 -0
- package/templates/python/files/code-review.instructions.md +215 -0
- package/templates/python/files/copilot-instructions.md.template +418 -0
- package/templates/python/files/docs-update.instructions.md +203 -0
- package/templates/python/files/release.instructions.md +72 -0
- package/templates/python/files/test-runner.instructions.md +108 -0
- package/templates/python/template.json +75 -0
- package/templates/react/files/code-review.instructions.md +160 -0
- package/templates/react/files/copilot-instructions.md.template +472 -0
- package/templates/react/files/docs-update.instructions.md +203 -0
- package/templates/react/files/release.instructions.md +72 -0
- package/templates/react/files/test-runner.instructions.md +108 -0
- package/templates/react/template.json +14 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TemplateManager = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const fs = __importStar(require("fs-extra"));
|
|
39
|
+
class TemplateManager {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.templatesDir = path.join(__dirname, '../../templates');
|
|
42
|
+
}
|
|
43
|
+
async getTemplate(templateName) {
|
|
44
|
+
const templatePath = path.join(this.templatesDir, templateName);
|
|
45
|
+
if (!(await fs.pathExists(templatePath))) {
|
|
46
|
+
throw new Error(`Template '${templateName}' not found`);
|
|
47
|
+
}
|
|
48
|
+
const configPath = path.join(templatePath, 'template.json');
|
|
49
|
+
if (!(await fs.pathExists(configPath))) {
|
|
50
|
+
throw new Error(`Template configuration not found for '${templateName}'`);
|
|
51
|
+
}
|
|
52
|
+
const config = await fs.readJson(configPath);
|
|
53
|
+
const filesDir = path.join(templatePath, 'files');
|
|
54
|
+
const files = await this.loadTemplateFiles(filesDir);
|
|
55
|
+
return {
|
|
56
|
+
name: templateName,
|
|
57
|
+
description: config.description,
|
|
58
|
+
files,
|
|
59
|
+
prompts: config.prompts || [],
|
|
60
|
+
vscodeSettings: config.vscodeSettings || {},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async processTemplate(template, config) {
|
|
64
|
+
const processedFiles = [];
|
|
65
|
+
for (const file of template.files) {
|
|
66
|
+
let content;
|
|
67
|
+
if (file.template) {
|
|
68
|
+
const templateContent = await fs.readFile(path.join(this.templatesDir, template.name, 'files', file.source), 'utf8');
|
|
69
|
+
content = this.processTemplateContent(templateContent, config);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
content = await fs.readFile(path.join(this.templatesDir, template.name, 'files', file.source), 'utf8');
|
|
73
|
+
}
|
|
74
|
+
processedFiles.push({
|
|
75
|
+
path: file.destination,
|
|
76
|
+
content,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return processedFiles;
|
|
80
|
+
}
|
|
81
|
+
async getAvailableTemplates() {
|
|
82
|
+
if (!(await fs.pathExists(this.templatesDir))) {
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
const items = await fs.readdir(this.templatesDir);
|
|
86
|
+
const templates = [];
|
|
87
|
+
for (const item of items) {
|
|
88
|
+
const itemPath = path.join(this.templatesDir, item);
|
|
89
|
+
const stat = await fs.stat(itemPath);
|
|
90
|
+
if (stat.isDirectory()) {
|
|
91
|
+
const configPath = path.join(itemPath, 'template.json');
|
|
92
|
+
if (await fs.pathExists(configPath)) {
|
|
93
|
+
templates.push(item);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return templates;
|
|
98
|
+
}
|
|
99
|
+
async loadTemplateFiles(filesDir) {
|
|
100
|
+
const files = [];
|
|
101
|
+
if (!(await fs.pathExists(filesDir))) {
|
|
102
|
+
return files;
|
|
103
|
+
}
|
|
104
|
+
const items = await fs.readdir(filesDir, { withFileTypes: true });
|
|
105
|
+
for (const item of items) {
|
|
106
|
+
if (item.isFile()) {
|
|
107
|
+
const isTemplate = item.name.endsWith('.template');
|
|
108
|
+
const source = item.name;
|
|
109
|
+
let destination = item.name;
|
|
110
|
+
if (isTemplate) {
|
|
111
|
+
destination = item.name.replace('.template', '');
|
|
112
|
+
}
|
|
113
|
+
if (destination === 'copilot-instructions.md') {
|
|
114
|
+
destination = '.github/copilot-instructions.md';
|
|
115
|
+
}
|
|
116
|
+
else if (destination.endsWith('.instructions.md')) {
|
|
117
|
+
destination = `.github/instructions/${destination}`;
|
|
118
|
+
}
|
|
119
|
+
files.push({
|
|
120
|
+
source,
|
|
121
|
+
destination,
|
|
122
|
+
template: isTemplate,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return files;
|
|
127
|
+
}
|
|
128
|
+
processTemplateContent(content, config) {
|
|
129
|
+
const variables = {
|
|
130
|
+
PROJECT_NAME: config.name,
|
|
131
|
+
PROJECT_DESCRIPTION: config.description,
|
|
132
|
+
TECH_STACK: Array.isArray(config.techStack)
|
|
133
|
+
? config.techStack.join(', ')
|
|
134
|
+
: config.techStack,
|
|
135
|
+
PROJECT_TYPE: config.projectType,
|
|
136
|
+
TEST_FRAMEWORK: config.testFramework || 'Jest',
|
|
137
|
+
BUILD_TOOL: config.buildTool || 'TypeScript Compiler',
|
|
138
|
+
PROJECT_DOMAIN: this.getProjectDomain(config.projectType),
|
|
139
|
+
};
|
|
140
|
+
let processedContent = content;
|
|
141
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
142
|
+
const placeholder = `{{${key}}}`;
|
|
143
|
+
processedContent = processedContent.replace(new RegExp(placeholder, 'g'), value);
|
|
144
|
+
}
|
|
145
|
+
processedContent = processedContent.replace(/\[short project description\]/g, config.description);
|
|
146
|
+
processedContent = processedContent.replace(/\[Main goal 1\]/g, 'Provide guided development workflow');
|
|
147
|
+
processedContent = processedContent.replace(/\[Main goal 2\]/g, 'Ensure code quality and best practices');
|
|
148
|
+
processedContent = processedContent.replace(/\[Main goal 3\]/g, 'Enable efficient team collaboration');
|
|
149
|
+
processedContent = processedContent.replace(/\[List primary technologies\]/g, variables.TECH_STACK);
|
|
150
|
+
processedContent = processedContent.replace(/\[project specific\]/g, variables.PROJECT_DOMAIN);
|
|
151
|
+
return processedContent;
|
|
152
|
+
}
|
|
153
|
+
getProjectDomain(projectType) {
|
|
154
|
+
switch (projectType) {
|
|
155
|
+
case 'react':
|
|
156
|
+
return 'React frontend';
|
|
157
|
+
case 'node':
|
|
158
|
+
return 'Node.js backend';
|
|
159
|
+
case 'python':
|
|
160
|
+
return 'Python';
|
|
161
|
+
default:
|
|
162
|
+
return 'software';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.TemplateManager = TemplateManager;
|
|
167
|
+
//# sourceMappingURL=template-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-manager.js","sourceRoot":"","sources":["../../src/services/template-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAM/B,MAAa,eAAe;IAG1B;QAEE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAKD,KAAK,CAAC,WAAW,CAAC,YAAoB;QACpC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QAEhE,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,aAAa,YAAY,aAAa,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;QAE5D,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,yCAAyC,YAAY,GAAG,CAAC,CAAC;QAC5E,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAA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AC;QAG/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACrD,MAAM,WAAW,GAAG,KAAK,GAAG,IAAI,CAAC;YACjC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,IAAI,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAC5B,KAAK,CACN,CAAC;QACJ,CAAC;QAGD,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,gCAAgC,EAChC,MAAM,CAAC,WAAW,CACnB,CAAC;QACF,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,kBAAkB,EAClB,qCAAqC,CACtC,CAAC;QACF,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,kBAAkB,EAClB,wCAAwC,CACzC,CAAC;QACF,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,kBAAkB,EAClB,qCAAqC,CACtC,CAAC;QACF,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,gCAAgC,EAChC,SAAS,CAAC,UAAU,CACrB,CAAC;QACF,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,uBAAuB,EACvB,SAAS,CAAC,cAAc,CACzB,CAAC;QAEF,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAKO,gBAAgB,CAAC,WAAmB;QAC1C,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,OAAO;gBACV,OAAO,gBAAgB,CAAC;YAC1B,KAAK,MAAM;gBACT,OAAO,iBAAiB,CAAC;YAC3B,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,UAAU,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AAhOD,0CAgOC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class VSCodeService {
|
|
2
|
+
private readonly vscodeDir;
|
|
3
|
+
private readonly settingsFile;
|
|
4
|
+
updateSettings(additionalSettings?: Record<string, any>): Promise<void>;
|
|
5
|
+
isConfigured(): Promise<boolean>;
|
|
6
|
+
backupSettings(): Promise<string | null>;
|
|
7
|
+
getSettings(): Promise<Record<string, any>>;
|
|
8
|
+
hasVSCodeConfiguration(): Promise<boolean>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=vscode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vscode.d.ts","sourceRoot":"","sources":["../../src/services/vscode.ts"],"names":[],"mappings":"AAMA,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;IAKrE,cAAc,CAClB,kBAAkB,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAC3C,OAAO,CAAC,IAAI,CAAC;IAyCV,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;IAqBhC,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAcxC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAgB3C,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC;CAGjD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.VSCodeService = void 0;
|
|
37
|
+
const fs = __importStar(require("fs-extra"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
class VSCodeService {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.vscodeDir = '.vscode';
|
|
42
|
+
this.settingsFile = path.join(this.vscodeDir, 'settings.json');
|
|
43
|
+
}
|
|
44
|
+
async updateSettings(additionalSettings = {}) {
|
|
45
|
+
const requiredSettings = {
|
|
46
|
+
'github.copilot.chat.codeGeneration.useInstructionFiles': true,
|
|
47
|
+
'chat.promptFiles': true,
|
|
48
|
+
...additionalSettings,
|
|
49
|
+
};
|
|
50
|
+
let existingSettings = {};
|
|
51
|
+
if (await fs.pathExists(this.settingsFile)) {
|
|
52
|
+
try {
|
|
53
|
+
const content = await fs.readFile(this.settingsFile, 'utf8');
|
|
54
|
+
existingSettings = JSON.parse(content);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
await this.backupSettings();
|
|
58
|
+
existingSettings = {};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const mergedSettings = {
|
|
62
|
+
...existingSettings,
|
|
63
|
+
...requiredSettings,
|
|
64
|
+
};
|
|
65
|
+
await fs.ensureDir(this.vscodeDir);
|
|
66
|
+
await fs.writeFile(this.settingsFile, JSON.stringify(mergedSettings, null, 2), 'utf8');
|
|
67
|
+
}
|
|
68
|
+
async isConfigured() {
|
|
69
|
+
if (!(await fs.pathExists(this.settingsFile))) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const content = await fs.readFile(this.settingsFile, 'utf8');
|
|
74
|
+
const settings = JSON.parse(content);
|
|
75
|
+
return (settings['github.copilot.chat.codeGeneration.useInstructionFiles'] ===
|
|
76
|
+
true && settings['chat.promptFiles'] === true);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async backupSettings() {
|
|
83
|
+
if (!(await fs.pathExists(this.settingsFile))) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
87
|
+
const backupPath = `${this.settingsFile}.backup-${timestamp}`;
|
|
88
|
+
await fs.copy(this.settingsFile, backupPath);
|
|
89
|
+
return backupPath;
|
|
90
|
+
}
|
|
91
|
+
async getSettings() {
|
|
92
|
+
if (!(await fs.pathExists(this.settingsFile))) {
|
|
93
|
+
return {};
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const content = await fs.readFile(this.settingsFile, 'utf8');
|
|
97
|
+
return JSON.parse(content);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async hasVSCodeConfiguration() {
|
|
104
|
+
return await fs.pathExists(this.vscodeDir);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.VSCodeService = VSCodeService;
|
|
108
|
+
//# sourceMappingURL=vscode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vscode.js","sourceRoot":"","sources":["../../src/services/vscode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAK7B,MAAa,aAAa;IAA1B;QACmB,cAAS,GAAG,SAAS,CAAC;QACtB,iBAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IAsG7E,CAAC;IAjGC,KAAK,CAAC,cAAc,CAClB,qBAA0C,EAAE;QAE5C,MAAM,gBAAgB,GAAG;YACvB,wDAAwD,EAAE,IAAI;YAC9D,kBAAkB,EAAE,IAAI;YACxB,GAAG,kBAAkB;SACtB,CAAC;QAEF,IAAI,gBAAgB,GAAG,EAAE,CAAC;QAG1B,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;gBAC7D,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACzC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAEf,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;gBAC5B,gBAAgB,GAAG,EAAE,CAAC;YACxB,CAAC;QACH,CAAC;QAGD,MAAM,cAAc,GAAG;YACrB,GAAG,gBAAgB;YACnB,GAAG,gBAAgB;SACpB,CAAC;QAGF,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAGnC,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,CA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AC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAKD,KAAK,CAAC,sBAAsB;QAC1B,OAAO,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;CACF;AAxGD,sCAwGC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
template: string;
|
|
3
|
+
force?: boolean;
|
|
4
|
+
skipVscode?: boolean;
|
|
5
|
+
skipGit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ValidateOptions {
|
|
8
|
+
fix?: boolean;
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UpdateOptions {
|
|
12
|
+
template?: string;
|
|
13
|
+
backup?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ProjectConfig {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
techStack: string[];
|
|
19
|
+
projectType: string;
|
|
20
|
+
testFramework?: string;
|
|
21
|
+
buildTool?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface Template {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
files: TemplateFile[];
|
|
27
|
+
prompts: TemplatePrompt[];
|
|
28
|
+
vscodeSettings?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
export interface TemplateFile {
|
|
31
|
+
source: string;
|
|
32
|
+
destination: string;
|
|
33
|
+
template: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface TemplatePrompt {
|
|
36
|
+
name: string;
|
|
37
|
+
type: 'input' | 'list' | 'confirm';
|
|
38
|
+
message: string;
|
|
39
|
+
choices?: string[];
|
|
40
|
+
default?: any;
|
|
41
|
+
validate?: (input: any) => boolean | string;
|
|
42
|
+
}
|
|
43
|
+
export interface ValidationResult {
|
|
44
|
+
valid: boolean;
|
|
45
|
+
errors: ValidationError[];
|
|
46
|
+
warnings: ValidationWarning[];
|
|
47
|
+
}
|
|
48
|
+
export interface ValidationError {
|
|
49
|
+
code: string;
|
|
50
|
+
message: string;
|
|
51
|
+
file?: string;
|
|
52
|
+
fixable: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface ValidationWarning {
|
|
55
|
+
code: string;
|
|
56
|
+
message: string;
|
|
57
|
+
file?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface FileSystemResult {
|
|
60
|
+
success: boolean;
|
|
61
|
+
error?: string;
|
|
62
|
+
created?: string[];
|
|
63
|
+
updated?: string[];
|
|
64
|
+
skipped?: string[];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAA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AM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "metacoding",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Guided Development Workflow for GitHub Copilot - Transform your coding experience with AI-guided standards, structured workflows, and quality practices",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"metacoding": "bin/metacoding.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"test": "jest",
|
|
14
|
+
"test:watch": "jest --watch",
|
|
15
|
+
"test:coverage": "jest --coverage",
|
|
16
|
+
"test:integration": "jest --testPathPattern=integration",
|
|
17
|
+
"lint": "eslint src/**/*.ts",
|
|
18
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
19
|
+
"format": "prettier --write src/**/*.ts",
|
|
20
|
+
"prepare": "npm run build",
|
|
21
|
+
"prepublishOnly": "npm run lint && npm run test && npm run build",
|
|
22
|
+
"start": "node bin/metacoding.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"github-copilot",
|
|
26
|
+
"development-workflow",
|
|
27
|
+
"ai-coding",
|
|
28
|
+
"code-quality",
|
|
29
|
+
"vscode",
|
|
30
|
+
"developer-tools",
|
|
31
|
+
"copilot-instructions",
|
|
32
|
+
"programming-workflow",
|
|
33
|
+
"tdd",
|
|
34
|
+
"best-practices",
|
|
35
|
+
"automation",
|
|
36
|
+
"cli"
|
|
37
|
+
],
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Anton Kulikov",
|
|
40
|
+
"email": "anton.g.kulikov@gmail.com"
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/anton-g-kulikov/metacoding.git"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/anton-g-kulikov/metacoding#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/anton-g-kulikov/metacoding/issues"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"bin/",
|
|
53
|
+
"lib/",
|
|
54
|
+
"templates/",
|
|
55
|
+
"README.md",
|
|
56
|
+
"LICENSE",
|
|
57
|
+
"CHANGELOG.md"
|
|
58
|
+
],
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0",
|
|
61
|
+
"npm": ">=8.0.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"commander": "^11.1.0",
|
|
65
|
+
"inquirer": "^8.2.6",
|
|
66
|
+
"chalk": "^4.1.2",
|
|
67
|
+
"fs-extra": "^11.2.0",
|
|
68
|
+
"glob": "^10.3.10",
|
|
69
|
+
"ora": "^5.4.1",
|
|
70
|
+
"yaml": "^2.3.4"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@types/fs-extra": "^11.0.4",
|
|
74
|
+
"@types/inquirer": "^8.2.10",
|
|
75
|
+
"@types/jest": "^29.5.8",
|
|
76
|
+
"@types/node": "^20.10.0",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
|
78
|
+
"@typescript-eslint/parser": "^6.13.1",
|
|
79
|
+
"eslint": "^8.54.0",
|
|
80
|
+
"eslint-config-prettier": "^9.0.0",
|
|
81
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
82
|
+
"jest": "^29.7.0",
|
|
83
|
+
"prettier": "^3.1.0",
|
|
84
|
+
"ts-jest": "^29.1.1",
|
|
85
|
+
"ts-node": "^10.9.1",
|
|
86
|
+
"typescript": "^5.3.2"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"vscode": "*"
|
|
90
|
+
},
|
|
91
|
+
"peerDependenciesMeta": {
|
|
92
|
+
"vscode": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"jest": {
|
|
97
|
+
"preset": "ts-jest",
|
|
98
|
+
"testEnvironment": "node",
|
|
99
|
+
"roots": [
|
|
100
|
+
"<rootDir>/src",
|
|
101
|
+
"<rootDir>/test"
|
|
102
|
+
],
|
|
103
|
+
"testMatch": [
|
|
104
|
+
"**/__tests__/**/*.ts",
|
|
105
|
+
"**/*.test.ts"
|
|
106
|
+
],
|
|
107
|
+
"collectCoverageFrom": [
|
|
108
|
+
"src/**/*.ts",
|
|
109
|
+
"!src/**/*.d.ts",
|
|
110
|
+
"!src/**/__tests__/**",
|
|
111
|
+
"!src/**/index.ts"
|
|
112
|
+
],
|
|
113
|
+
"coverageReporters": [
|
|
114
|
+
"text",
|
|
115
|
+
"lcov",
|
|
116
|
+
"html"
|
|
117
|
+
],
|
|
118
|
+
"coverageThreshold": {
|
|
119
|
+
"global": {
|
|
120
|
+
"branches": 80,
|
|
121
|
+
"functions": 80,
|
|
122
|
+
"lines": 80,
|
|
123
|
+
"statements": 80
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"prettier": {
|
|
128
|
+
"semi": true,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"singleQuote": true,
|
|
131
|
+
"printWidth": 80,
|
|
132
|
+
"tabWidth": 2
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Automated code review checklist'
|
|
3
|
+
applyTo: '**'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Focus Areas
|
|
7
|
+
|
|
8
|
+
## Functionality Assessment
|
|
9
|
+
|
|
10
|
+
- **Requirements Compliance:** Does the code meet the specified requirements?
|
|
11
|
+
- **Edge Cases:** Are edge cases properly handled?
|
|
12
|
+
- **Error Scenarios:** How does the code behave with invalid inputs?
|
|
13
|
+
- **Business Logic:** Is the business logic correctly implemented?
|
|
14
|
+
- **Integration Points:** Do integrations with other components work correctly?
|
|
15
|
+
|
|
16
|
+
## Code Quality and Readability
|
|
17
|
+
|
|
18
|
+
- **Naming Conventions:** Are variables, functions, and classes named clearly?
|
|
19
|
+
- **Code Structure:** Is the code well-organized and logically structured?
|
|
20
|
+
- **Function Size:** Are functions focused and reasonably sized (< 50 lines)?
|
|
21
|
+
- **Complexity:** Is the code unnecessarily complex or could it be simplified?
|
|
22
|
+
- **Comments:** Are comments helpful and explain "why" not "what"?
|
|
23
|
+
- **Consistency:** Does the code follow established project patterns?
|
|
24
|
+
|
|
25
|
+
## Performance Considerations
|
|
26
|
+
|
|
27
|
+
- **Algorithm Efficiency:** Are appropriate algorithms and data structures used?
|
|
28
|
+
- **Memory Usage:** Are there potential memory leaks or excessive memory usage?
|
|
29
|
+
- **Database Queries:** Are database queries optimized and avoid N+1 problems?
|
|
30
|
+
- **Async Operations:** Are async operations used appropriately for I/O?
|
|
31
|
+
- **Caching:** Are caching opportunities identified and implemented correctly?
|
|
32
|
+
- **Resource Management:** Are resources properly acquired and released?
|
|
33
|
+
|
|
34
|
+
## Security Review
|
|
35
|
+
|
|
36
|
+
- **Input Validation:** Are all inputs properly validated and sanitized?
|
|
37
|
+
- **Authentication:** Are authentication checks in place where needed?
|
|
38
|
+
- **Authorization:** Are authorization checks appropriate for the functionality?
|
|
39
|
+
- **Data Exposure:** Is sensitive data properly protected?
|
|
40
|
+
- **Injection Attacks:** Are SQL injection and other injection attacks prevented?
|
|
41
|
+
- **Encryption:** Is sensitive data encrypted appropriately?
|
|
42
|
+
|
|
43
|
+
## Testing and Testability
|
|
44
|
+
|
|
45
|
+
- **Test Coverage:** Are there sufficient tests for the new functionality?
|
|
46
|
+
- **Test Quality:** Are tests meaningful and test the right things?
|
|
47
|
+
- **Testability:** Is the code structured to be easily testable?
|
|
48
|
+
- **Mocking:** Are external dependencies properly mocked in tests?
|
|
49
|
+
- **Integration Tests:** Are integration points covered by appropriate tests?
|
|
50
|
+
- **Regression Protection:** Do tests protect against known regression issues?
|
|
51
|
+
|
|
52
|
+
## Error Handling and Logging
|
|
53
|
+
|
|
54
|
+
- **Exception Handling:** Are exceptions handled appropriately?
|
|
55
|
+
- **Error Messages:** Are error messages helpful for debugging?
|
|
56
|
+
- **Logging:** Is appropriate logging in place for debugging and monitoring?
|
|
57
|
+
- **Graceful Degradation:** Does the system handle failures gracefully?
|
|
58
|
+
- **Recovery:** Are there appropriate recovery mechanisms?
|
|
59
|
+
|
|
60
|
+
## Documentation and Maintenance
|
|
61
|
+
|
|
62
|
+
- **Code Documentation:** Is the code self-documenting or properly commented?
|
|
63
|
+
- **API Documentation:** Are public APIs documented with JSDoc?
|
|
64
|
+
- **Breaking Changes:** Are breaking changes clearly identified and documented?
|
|
65
|
+
- **Migration Guides:** Are migration paths provided for breaking changes?
|
|
66
|
+
- **Changelog Updates:** Are user-facing changes documented in changelog?
|
|
67
|
+
|
|
68
|
+
## Standards Compliance
|
|
69
|
+
|
|
70
|
+
- **Coding Standards:** Does the code follow project coding standards?
|
|
71
|
+
- **Architectural Patterns:** Are established architectural patterns followed?
|
|
72
|
+
- **Dependency Management:** Are new dependencies justified and properly managed?
|
|
73
|
+
- **Configuration:** Are configuration changes handled appropriately?
|
|
74
|
+
- **Version Compatibility:** Is backwards compatibility maintained where required?
|
|
75
|
+
|
|
76
|
+
## Common Anti-Patterns to Flag
|
|
77
|
+
|
|
78
|
+
- **Deep Nesting:** Excessive if/else or try/catch nesting
|
|
79
|
+
- **God Objects:** Classes or functions with too many responsibilities
|
|
80
|
+
- **Magic Numbers:** Hardcoded values without explanation
|
|
81
|
+
- **Copy-Paste Code:** Duplicated code that should be refactored
|
|
82
|
+
- **Tight Coupling:** Components that are too dependent on each other
|
|
83
|
+
- **Memory Leaks:** Objects not properly cleaned up
|
|
84
|
+
- **Temporary File Pollution:** Leaving debug files, temp outputs, or experimental code in repository
|
|
85
|
+
- **Blocking Operations:** Synchronous operations that could block the main thread
|
|
86
|
+
|
|
87
|
+
## Review Process Guidelines
|
|
88
|
+
|
|
89
|
+
- **Constructive Feedback:** Provide specific, actionable feedback
|
|
90
|
+
- **Explain Reasoning:** Explain why changes are needed
|
|
91
|
+
- **Suggest Alternatives:** Offer alternative approaches when applicable
|
|
92
|
+
- **Acknowledge Good Work:** Recognize well-written code and good practices
|
|
93
|
+
- **Focus on Code:** Keep feedback focused on code, not personal
|
|
94
|
+
- **Prioritize Issues:** Distinguish between critical issues and suggestions
|
|
95
|
+
|
|
96
|
+
## Automated Checks to Verify
|
|
97
|
+
|
|
98
|
+
- **Linting:** Code passes linting rules
|
|
99
|
+
- **Formatting:** Code follows formatting standards
|
|
100
|
+
- **Type Checking:** TypeScript compilation succeeds without errors
|
|
101
|
+
- **Tests:** All tests pass including new and existing ones
|
|
102
|
+
- **Build:** Code builds successfully
|
|
103
|
+
- **Security Scans:** Automated security scans pass
|
|
104
|
+
|
|
105
|
+
## File and Repository Hygiene
|
|
106
|
+
|
|
107
|
+
- **Temporary Files:** Are all temporary files, debug outputs, and experimental code removed?
|
|
108
|
+
- **File Organization:** Are files placed in appropriate directories according to project structure?
|
|
109
|
+
- **Cleanup Verification:** Has development session cleanup been performed before commit?
|
|
110
|
+
- **Test Fixtures:** Are temporary test files moved to appropriate `/test/fixtures/` location?
|
|
111
|
+
- **Repository State:** Is the repository in a clean state without orphaned files?
|