reposentry 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.
@@ -0,0 +1,260 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ buildDirectoryTree,
4
+ detectConfigs,
5
+ detectLanguages,
6
+ detectRoutes,
7
+ isGitRepo,
8
+ scanFiles
9
+ } from "./chunk-NYYK2IZI.js";
10
+ import "./chunk-JZB6VB4T.js";
11
+
12
+ // src/engines/fix-engine.ts
13
+ import { join } from "path";
14
+ import { existsSync, readFileSync } from "fs";
15
+ async function scanForFixableIssues(rootDir, ignore) {
16
+ const scanResult = await scanFiles(rootDir, ignore);
17
+ const langInfo = detectLanguages(rootDir, scanResult.files);
18
+ const configInfo = detectConfigs(rootDir, scanResult.files);
19
+ const routes = detectRoutes(rootDir, scanResult.files);
20
+ const fileTree = buildDirectoryTree(scanResult.files, 3);
21
+ const context = {
22
+ projectName: resolveProjectName(rootDir),
23
+ languages: langInfo.languages,
24
+ frameworks: langInfo.frameworks,
25
+ packageManager: langInfo.packageManager || "unknown",
26
+ fileTree,
27
+ rootDir
28
+ };
29
+ const issues = [];
30
+ if (!configInfo.hasReadme) {
31
+ issues.push({
32
+ id: "readme",
33
+ priority: "P0",
34
+ category: "Documentation",
35
+ title: "Missing README.md",
36
+ description: "No README.md found. This is the first thing developers see.",
37
+ files: ["README.md"],
38
+ promptBuilder: (ctx) => `Create a professional README.md for the "${ctx.projectName}" project. Languages: ${ctx.languages.join(", ")}. Frameworks: ${ctx.frameworks.join(", ")}. Package manager: ${ctx.packageManager}. Project structure:
39
+ ${ctx.fileTree}
40
+
41
+ Include: project description, features, installation, usage, contributing section, license. Write the file to README.md in the project root.`
42
+ });
43
+ }
44
+ if (!configInfo.hasGitignore) {
45
+ issues.push({
46
+ id: "gitignore",
47
+ priority: "P0",
48
+ category: "Security",
49
+ title: "Missing .gitignore",
50
+ description: "No .gitignore \u2014 sensitive files or build artifacts may be committed.",
51
+ files: [".gitignore"],
52
+ promptBuilder: (ctx) => `Create a comprehensive .gitignore file for a ${ctx.languages.join("/")} project using ${ctx.packageManager}. Frameworks: ${ctx.frameworks.join(", ")}. Include entries for: IDE files, OS files, build output, dependencies, env files, logs. Write the file to .gitignore in the project root.`
53
+ });
54
+ }
55
+ if (!configInfo.hasLicense) {
56
+ issues.push({
57
+ id: "license",
58
+ priority: "P0",
59
+ category: "Documentation",
60
+ title: "Missing LICENSE",
61
+ description: "No LICENSE file \u2014 the project has no explicit license.",
62
+ files: ["LICENSE"],
63
+ promptBuilder: (_ctx) => `Create a MIT LICENSE file with the current year and "Contributors" as the copyright holder. Write the file to LICENSE in the project root.`
64
+ });
65
+ }
66
+ if (!configInfo.hasCIConfig) {
67
+ issues.push({
68
+ id: "ci-pipeline",
69
+ priority: "P0",
70
+ category: "CI/CD",
71
+ title: "No CI/CD pipeline",
72
+ description: "No continuous integration configuration found.",
73
+ files: [],
74
+ // determined at fix time based on provider selection
75
+ promptBuilder: (ctx) => {
76
+ const provider = ctx.ciProvider || "GitHub Actions";
77
+ const fileMap = {
78
+ "GitHub Actions": ".github/workflows/ci.yml",
79
+ "GitLab CI": ".gitlab-ci.yml",
80
+ "CircleCI": ".circleci/config.yml",
81
+ "Jenkins": "Jenkinsfile",
82
+ "Travis CI": ".travis.yml"
83
+ };
84
+ const ciFile = fileMap[provider] || ".github/workflows/ci.yml";
85
+ return `Create a ${provider} CI/CD pipeline for a ${ctx.languages.join("/")} project. Package manager: ${ctx.packageManager}. Frameworks: ${ctx.frameworks.join(", ")}. Include: install dependencies, lint/typecheck, run tests, build. Use latest LTS Node.js versions if applicable. Write the file to ${ciFile} in the project root.`;
86
+ }
87
+ });
88
+ }
89
+ if (!configInfo.hasContributing) {
90
+ issues.push({
91
+ id: "contributing",
92
+ priority: "P1",
93
+ category: "Documentation",
94
+ title: "Missing CONTRIBUTING.md",
95
+ description: "No contributing guide for potential contributors.",
96
+ files: ["CONTRIBUTING.md"],
97
+ promptBuilder: (ctx) => `Create a CONTRIBUTING.md guide for the "${ctx.projectName}" project. Languages: ${ctx.languages.join(", ")}. Package manager: ${ctx.packageManager}. Include: how to set up dev environment, coding standards, PR process, issue reporting. Write the file to CONTRIBUTING.md in the project root.`
98
+ });
99
+ }
100
+ if (!configInfo.hasDockerfile) {
101
+ issues.push({
102
+ id: "dockerfile",
103
+ priority: "P1",
104
+ category: "Infrastructure",
105
+ title: "Missing Dockerfile",
106
+ description: "No Dockerfile for containerized deployment.",
107
+ files: ["Dockerfile"],
108
+ promptBuilder: (ctx) => `Create a production-ready multi-stage Dockerfile for a ${ctx.languages.join("/")} project. Package manager: ${ctx.packageManager}. Frameworks: ${ctx.frameworks.join(", ")}. Use slim base images, non-root user, proper layer caching. Write the file to Dockerfile in the project root.`
109
+ });
110
+ }
111
+ if (!configInfo.hasEnvExample) {
112
+ issues.push({
113
+ id: "env-example",
114
+ priority: "P1",
115
+ category: "Infrastructure",
116
+ title: "Missing .env.example",
117
+ description: "No .env.example \u2014 developers don't know what environment variables are needed.",
118
+ files: [".env.example"],
119
+ promptBuilder: (ctx) => `Analyze the "${ctx.projectName}" project source code and create a .env.example file. Look for environment variable usage (process.env, os.environ, etc.) in the source files. List all required variables with placeholder values and comments explaining each. Write the file to .env.example in the project root.`
120
+ });
121
+ }
122
+ if (!configInfo.hasPRTemplate) {
123
+ issues.push({
124
+ id: "pr-template",
125
+ priority: "P1",
126
+ category: "Collaboration",
127
+ title: "Missing PR template",
128
+ description: "No pull request template \u2014 PRs lack consistent structure.",
129
+ files: [".github/pull_request_template.md"],
130
+ promptBuilder: (_ctx) => `Create a pull request template with sections: Description, Type of Change (checkboxes), How Has This Been Tested, Checklist (code review items). Write the file to .github/pull_request_template.md.`
131
+ });
132
+ }
133
+ if (!configInfo.hasIssueTemplates) {
134
+ issues.push({
135
+ id: "issue-templates",
136
+ priority: "P1",
137
+ category: "Collaboration",
138
+ title: "Missing issue templates",
139
+ description: "No issue templates \u2014 bug reports and feature requests lack structure.",
140
+ files: [".github/ISSUE_TEMPLATE/bug_report.md", ".github/ISSUE_TEMPLATE/feature_request.md"],
141
+ promptBuilder: (_ctx) => `Create GitHub issue templates: 1. Bug report template at .github/ISSUE_TEMPLATE/bug_report.md with sections: Describe the Bug, To Reproduce, Expected Behavior, Screenshots, Environment. 2. Feature request template at .github/ISSUE_TEMPLATE/feature_request.md with sections: Problem, Proposed Solution, Alternatives, Additional Context. Write both files.`
142
+ });
143
+ }
144
+ if (!configInfo.hasCodeowners) {
145
+ issues.push({
146
+ id: "codeowners",
147
+ priority: "P1",
148
+ category: "Collaboration",
149
+ title: "Missing CODEOWNERS",
150
+ description: "No CODEOWNERS file \u2014 no automatic review assignments.",
151
+ files: ["CODEOWNERS"],
152
+ promptBuilder: (ctx) => `Create a CODEOWNERS file for the "${ctx.projectName}" project. Project structure:
153
+ ${ctx.fileTree}
154
+
155
+ Add a default owner (* @owner) and section-specific owners based on the directory structure. Add helpful comments explaining the format. Write the file to CODEOWNERS in the project root.`
156
+ });
157
+ }
158
+ if (!configInfo.hasChangelog) {
159
+ issues.push({
160
+ id: "changelog",
161
+ priority: "P2",
162
+ category: "Documentation",
163
+ title: "Missing CHANGELOG.md",
164
+ description: "No changelog to track version history.",
165
+ files: ["CHANGELOG.md"],
166
+ promptBuilder: (ctx) => `Create a CHANGELOG.md for the "${ctx.projectName}" project using the Keep a Changelog format. Read the git log to determine what changes have been made. Group by version tags if any exist, otherwise by date. Categorize as: Added, Changed, Deprecated, Removed, Fixed, Security. Write the file to CHANGELOG.md in the project root.`
167
+ });
168
+ }
169
+ if (!configInfo.hasDockerCompose) {
170
+ issues.push({
171
+ id: "docker-compose",
172
+ priority: "P2",
173
+ category: "Infrastructure",
174
+ title: "Missing docker-compose.yml",
175
+ description: "No Docker Compose for local development environment.",
176
+ files: ["docker-compose.yml"],
177
+ promptBuilder: (ctx) => `Create a docker-compose.yml for local development of the "${ctx.projectName}" project. Languages: ${ctx.languages.join(", ")}. Frameworks: ${ctx.frameworks.join(", ")}. Include the app service and any likely database/cache services based on the project dependencies. Use proper networking, volumes for hot reload, and environment variable references. Write the file to docker-compose.yml in the project root.`
178
+ });
179
+ }
180
+ if (!configInfo.hasEditorConfig) {
181
+ issues.push({
182
+ id: "editorconfig",
183
+ priority: "P2",
184
+ category: "Collaboration",
185
+ title: "Missing .editorconfig",
186
+ description: "No .editorconfig \u2014 inconsistent formatting across editors.",
187
+ files: [".editorconfig"],
188
+ promptBuilder: (ctx) => `Create a .editorconfig file for a ${ctx.languages.join("/")} project. Set sensible defaults: utf-8, lf line endings, trim trailing whitespace, insert final newline, indent with spaces (2 for JS/TS/JSON/YAML, 4 for Python). Write the file to .editorconfig in the project root.`
189
+ });
190
+ }
191
+ const testFiles = scanResult.files.filter(
192
+ (f) => f.includes(".test.") || f.includes(".spec.") || f.includes("__tests__") || f.includes("test_")
193
+ );
194
+ if (testFiles.length === 0 && routes.length > 0) {
195
+ issues.push({
196
+ id: "test-scaffold",
197
+ priority: "P1",
198
+ category: "Testing",
199
+ title: "No test files found",
200
+ description: `${routes.length} API routes detected but zero test files.`,
201
+ files: [],
202
+ // Copilot will determine based on framework
203
+ promptBuilder: (ctx) => `The "${ctx.projectName}" project has API routes but no test files. Languages: ${ctx.languages.join(", ")}. Frameworks: ${ctx.frameworks.join(", ")}. Create a basic test setup: install the appropriate test framework if needed, create a sample test file that tests at least one route or component. Use the project's package manager (${ctx.packageManager}). Write the test file(s) in the conventional location for this project type.`
204
+ });
205
+ }
206
+ const hasSecurityMd = existsSync(join(rootDir, "SECURITY.md"));
207
+ if (!hasSecurityMd) {
208
+ issues.push({
209
+ id: "security-policy",
210
+ priority: "P2",
211
+ category: "Security",
212
+ title: "Missing SECURITY.md",
213
+ description: "No security policy \u2014 no clear way to report vulnerabilities.",
214
+ files: ["SECURITY.md"],
215
+ promptBuilder: (ctx) => `Create a SECURITY.md file for the "${ctx.projectName}" project. Include: supported versions table, how to report vulnerabilities, expected response time, disclosure policy. Write the file to SECURITY.md in the project root.`
216
+ });
217
+ }
218
+ const isGit = isGitRepo(rootDir);
219
+ const filtered = isGit ? issues : issues.filter((i) => i.category !== "Collaboration");
220
+ const priorityOrder = { P0: 0, P1: 1, P2: 2 };
221
+ filtered.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
222
+ return { issues: filtered, context, configInfo };
223
+ }
224
+ function resolveProjectName(rootDir) {
225
+ try {
226
+ const pkg = JSON.parse(readFileSync(join(rootDir, "package.json"), "utf-8"));
227
+ if (pkg.name) return pkg.name;
228
+ } catch {
229
+ }
230
+ return rootDir.split(/[\\/]/).pop() || "project";
231
+ }
232
+ var CI_PROVIDERS = [
233
+ { name: "GitHub Actions", file: ".github/workflows/ci.yml" },
234
+ { name: "GitLab CI", file: ".gitlab-ci.yml" },
235
+ { name: "CircleCI", file: ".circleci/config.yml" },
236
+ { name: "Jenkins", file: "Jenkinsfile" },
237
+ { name: "Travis CI", file: ".travis.yml" },
238
+ { name: "Azure Pipelines", file: "azure-pipelines.yml" }
239
+ ];
240
+ function buildDeployGuidePrompt(ctx) {
241
+ return `Create a comprehensive "take-it-to-prod.md" deployment guide for the "${ctx.projectName}" project. Languages: ${ctx.languages.join(", ")}. Frameworks: ${ctx.frameworks.join(", ")}. Package manager: ${ctx.packageManager}. CI provider: ${ctx.ciProvider || "not configured"}. Project structure:
242
+ ${ctx.fileTree}
243
+
244
+ Include sections:
245
+ 1. Pre-Production Checklist (env vars, secrets, database migrations)
246
+ 2. Deployment Options (cloud providers suitable for this stack)
247
+ 3. Step-by-step deployment for the top 2 recommended platforms
248
+ 4. Environment Variables & Secrets to configure (list what the CI/CD pipeline needs)
249
+ 5. Post-Deployment Verification (health checks, smoke tests)
250
+ 6. Rollback Procedures
251
+ 7. Monitoring & Observability recommendations
252
+
253
+ Write the file to take-it-to-prod.md in the project root.`;
254
+ }
255
+ export {
256
+ CI_PROVIDERS,
257
+ buildDeployGuidePrompt,
258
+ scanForFixableIssues
259
+ };
260
+ //# sourceMappingURL=fix-engine-W5U2J3IJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engines/fix-engine.ts"],"sourcesContent":["import { resolve, join } from 'node:path';\r\nimport { existsSync, readFileSync } from 'node:fs';\r\nimport { detectConfigs, ConfigInfo } from '../scanners/config-detector.js';\r\nimport { scanFiles } from '../scanners/file-scanner.js';\r\nimport { detectLanguages } from '../scanners/language-detector.js';\r\nimport { detectRoutes } from '../scanners/route-detector.js';\r\nimport { PromptContext, buildFileTree } from '../core/prompt-builder.js';\r\nimport { buildDirectoryTree } from '../scanners/file-scanner.js';\r\nimport { isGitRepo } from '../utils/git.js';\r\n\r\nexport type Priority = 'P0' | 'P1' | 'P2';\r\nexport type FixCategory = 'Documentation' | 'CI/CD' | 'Security' | 'Testing' | 'Collaboration' | 'Infrastructure';\r\n\r\nexport interface FixableIssue {\r\n id: string;\r\n priority: Priority;\r\n category: FixCategory;\r\n title: string;\r\n description: string;\r\n /** The file(s) that will be created or modified */\r\n files: string[];\r\n /** Prompt to send to Copilot to fix this issue */\r\n promptBuilder: (ctx: FixContext) => string;\r\n}\r\n\r\nexport interface FixContext {\r\n projectName: string;\r\n languages: string[];\r\n frameworks: string[];\r\n packageManager: string;\r\n fileTree: string;\r\n rootDir: string;\r\n ciProvider?: string;\r\n}\r\n\r\nexport interface FixScanResult {\r\n issues: FixableIssue[];\r\n context: FixContext;\r\n configInfo: ConfigInfo;\r\n}\r\n\r\n/**\r\n * Scan the project and return all fixable issues sorted by priority.\r\n */\r\nexport async function scanForFixableIssues(rootDir: string, ignore: string[]): Promise<FixScanResult> {\r\n const scanResult = await scanFiles(rootDir, ignore);\r\n const langInfo = detectLanguages(rootDir, scanResult.files);\r\n const configInfo = detectConfigs(rootDir, scanResult.files);\r\n const routes = detectRoutes(rootDir, scanResult.files);\r\n const fileTree = buildDirectoryTree(scanResult.files, 3);\r\n\r\n const context: FixContext = {\r\n projectName: resolveProjectName(rootDir),\r\n languages: langInfo.languages,\r\n frameworks: langInfo.frameworks,\r\n packageManager: langInfo.packageManager || 'unknown',\r\n fileTree,\r\n rootDir,\r\n };\r\n\r\n const issues: FixableIssue[] = [];\r\n\r\n // ─── P0: Critical missing files ───\r\n\r\n if (!configInfo.hasReadme) {\r\n issues.push({\r\n id: 'readme',\r\n priority: 'P0',\r\n category: 'Documentation',\r\n title: 'Missing README.md',\r\n description: 'No README.md found. This is the first thing developers see.',\r\n files: ['README.md'],\r\n promptBuilder: (ctx) =>\r\n `Create a professional README.md for the \"${ctx.projectName}\" project. ` +\r\n `Languages: ${ctx.languages.join(', ')}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Package manager: ${ctx.packageManager}. ` +\r\n `Project structure:\\n${ctx.fileTree}\\n\\n` +\r\n `Include: project description, features, installation, usage, contributing section, license. ` +\r\n `Write the file to README.md in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasGitignore) {\r\n issues.push({\r\n id: 'gitignore',\r\n priority: 'P0',\r\n category: 'Security',\r\n title: 'Missing .gitignore',\r\n description: 'No .gitignore — sensitive files or build artifacts may be committed.',\r\n files: ['.gitignore'],\r\n promptBuilder: (ctx) =>\r\n `Create a comprehensive .gitignore file for a ${ctx.languages.join('/')} project using ${ctx.packageManager}. ` +\r\n `Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Include entries for: IDE files, OS files, build output, dependencies, env files, logs. ` +\r\n `Write the file to .gitignore in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasLicense) {\r\n issues.push({\r\n id: 'license',\r\n priority: 'P0',\r\n category: 'Documentation',\r\n title: 'Missing LICENSE',\r\n description: 'No LICENSE file — the project has no explicit license.',\r\n files: ['LICENSE'],\r\n promptBuilder: (_ctx) =>\r\n `Create a MIT LICENSE file with the current year and \"Contributors\" as the copyright holder. ` +\r\n `Write the file to LICENSE in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasCIConfig) {\r\n issues.push({\r\n id: 'ci-pipeline',\r\n priority: 'P0',\r\n category: 'CI/CD',\r\n title: 'No CI/CD pipeline',\r\n description: 'No continuous integration configuration found.',\r\n files: [], // determined at fix time based on provider selection\r\n promptBuilder: (ctx) => {\r\n const provider = ctx.ciProvider || 'GitHub Actions';\r\n const fileMap: Record<string, string> = {\r\n 'GitHub Actions': '.github/workflows/ci.yml',\r\n 'GitLab CI': '.gitlab-ci.yml',\r\n 'CircleCI': '.circleci/config.yml',\r\n 'Jenkins': 'Jenkinsfile',\r\n 'Travis CI': '.travis.yml',\r\n };\r\n const ciFile = fileMap[provider] || '.github/workflows/ci.yml';\r\n return `Create a ${provider} CI/CD pipeline for a ${ctx.languages.join('/')} project. ` +\r\n `Package manager: ${ctx.packageManager}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Include: install dependencies, lint/typecheck, run tests, build. ` +\r\n `Use latest LTS Node.js versions if applicable. ` +\r\n `Write the file to ${ciFile} in the project root.`;\r\n },\r\n });\r\n }\r\n\r\n // ─── P1: Important missing files ───\r\n\r\n if (!configInfo.hasContributing) {\r\n issues.push({\r\n id: 'contributing',\r\n priority: 'P1',\r\n category: 'Documentation',\r\n title: 'Missing CONTRIBUTING.md',\r\n description: 'No contributing guide for potential contributors.',\r\n files: ['CONTRIBUTING.md'],\r\n promptBuilder: (ctx) =>\r\n `Create a CONTRIBUTING.md guide for the \"${ctx.projectName}\" project. ` +\r\n `Languages: ${ctx.languages.join(', ')}. Package manager: ${ctx.packageManager}. ` +\r\n `Include: how to set up dev environment, coding standards, PR process, issue reporting. ` +\r\n `Write the file to CONTRIBUTING.md in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasDockerfile) {\r\n issues.push({\r\n id: 'dockerfile',\r\n priority: 'P1',\r\n category: 'Infrastructure',\r\n title: 'Missing Dockerfile',\r\n description: 'No Dockerfile for containerized deployment.',\r\n files: ['Dockerfile'],\r\n promptBuilder: (ctx) =>\r\n `Create a production-ready multi-stage Dockerfile for a ${ctx.languages.join('/')} project. ` +\r\n `Package manager: ${ctx.packageManager}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Use slim base images, non-root user, proper layer caching. ` +\r\n `Write the file to Dockerfile in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasEnvExample) {\r\n issues.push({\r\n id: 'env-example',\r\n priority: 'P1',\r\n category: 'Infrastructure',\r\n title: 'Missing .env.example',\r\n description: 'No .env.example — developers don\\'t know what environment variables are needed.',\r\n files: ['.env.example'],\r\n promptBuilder: (ctx) =>\r\n `Analyze the \"${ctx.projectName}\" project source code and create a .env.example file. ` +\r\n `Look for environment variable usage (process.env, os.environ, etc.) in the source files. ` +\r\n `List all required variables with placeholder values and comments explaining each. ` +\r\n `Write the file to .env.example in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasPRTemplate) {\r\n issues.push({\r\n id: 'pr-template',\r\n priority: 'P1',\r\n category: 'Collaboration',\r\n title: 'Missing PR template',\r\n description: 'No pull request template — PRs lack consistent structure.',\r\n files: ['.github/pull_request_template.md'],\r\n promptBuilder: (_ctx) =>\r\n `Create a pull request template with sections: Description, Type of Change (checkboxes), ` +\r\n `How Has This Been Tested, Checklist (code review items). ` +\r\n `Write the file to .github/pull_request_template.md.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasIssueTemplates) {\r\n issues.push({\r\n id: 'issue-templates',\r\n priority: 'P1',\r\n category: 'Collaboration',\r\n title: 'Missing issue templates',\r\n description: 'No issue templates — bug reports and feature requests lack structure.',\r\n files: ['.github/ISSUE_TEMPLATE/bug_report.md', '.github/ISSUE_TEMPLATE/feature_request.md'],\r\n promptBuilder: (_ctx) =>\r\n `Create GitHub issue templates: ` +\r\n `1. Bug report template at .github/ISSUE_TEMPLATE/bug_report.md with sections: Describe the Bug, To Reproduce, Expected Behavior, Screenshots, Environment. ` +\r\n `2. Feature request template at .github/ISSUE_TEMPLATE/feature_request.md with sections: Problem, Proposed Solution, Alternatives, Additional Context. ` +\r\n `Write both files.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasCodeowners) {\r\n issues.push({\r\n id: 'codeowners',\r\n priority: 'P1',\r\n category: 'Collaboration',\r\n title: 'Missing CODEOWNERS',\r\n description: 'No CODEOWNERS file — no automatic review assignments.',\r\n files: ['CODEOWNERS'],\r\n promptBuilder: (ctx) =>\r\n `Create a CODEOWNERS file for the \"${ctx.projectName}\" project. ` +\r\n `Project structure:\\n${ctx.fileTree}\\n\\n` +\r\n `Add a default owner (* @owner) and section-specific owners based on the directory structure. ` +\r\n `Add helpful comments explaining the format. ` +\r\n `Write the file to CODEOWNERS in the project root.`,\r\n });\r\n }\r\n\r\n // ─── P2: Nice-to-have ───\r\n\r\n if (!configInfo.hasChangelog) {\r\n issues.push({\r\n id: 'changelog',\r\n priority: 'P2',\r\n category: 'Documentation',\r\n title: 'Missing CHANGELOG.md',\r\n description: 'No changelog to track version history.',\r\n files: ['CHANGELOG.md'],\r\n promptBuilder: (ctx) =>\r\n `Create a CHANGELOG.md for the \"${ctx.projectName}\" project using the Keep a Changelog format. ` +\r\n `Read the git log to determine what changes have been made. ` +\r\n `Group by version tags if any exist, otherwise by date. ` +\r\n `Categorize as: Added, Changed, Deprecated, Removed, Fixed, Security. ` +\r\n `Write the file to CHANGELOG.md in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasDockerCompose) {\r\n issues.push({\r\n id: 'docker-compose',\r\n priority: 'P2',\r\n category: 'Infrastructure',\r\n title: 'Missing docker-compose.yml',\r\n description: 'No Docker Compose for local development environment.',\r\n files: ['docker-compose.yml'],\r\n promptBuilder: (ctx) =>\r\n `Create a docker-compose.yml for local development of the \"${ctx.projectName}\" project. ` +\r\n `Languages: ${ctx.languages.join(', ')}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Include the app service and any likely database/cache services based on the project dependencies. ` +\r\n `Use proper networking, volumes for hot reload, and environment variable references. ` +\r\n `Write the file to docker-compose.yml in the project root.`,\r\n });\r\n }\r\n\r\n if (!configInfo.hasEditorConfig) {\r\n issues.push({\r\n id: 'editorconfig',\r\n priority: 'P2',\r\n category: 'Collaboration',\r\n title: 'Missing .editorconfig',\r\n description: 'No .editorconfig — inconsistent formatting across editors.',\r\n files: ['.editorconfig'],\r\n promptBuilder: (ctx) =>\r\n `Create a .editorconfig file for a ${ctx.languages.join('/')} project. ` +\r\n `Set sensible defaults: utf-8, lf line endings, trim trailing whitespace, ` +\r\n `insert final newline, indent with spaces (2 for JS/TS/JSON/YAML, 4 for Python). ` +\r\n `Write the file to .editorconfig in the project root.`,\r\n });\r\n }\r\n\r\n // Check for missing test files\r\n const testFiles = scanResult.files.filter(f =>\r\n f.includes('.test.') || f.includes('.spec.') || f.includes('__tests__') || f.includes('test_'),\r\n );\r\n if (testFiles.length === 0 && routes.length > 0) {\r\n issues.push({\r\n id: 'test-scaffold',\r\n priority: 'P1',\r\n category: 'Testing',\r\n title: 'No test files found',\r\n description: `${routes.length} API routes detected but zero test files.`,\r\n files: [], // Copilot will determine based on framework\r\n promptBuilder: (ctx) =>\r\n `The \"${ctx.projectName}\" project has API routes but no test files. ` +\r\n `Languages: ${ctx.languages.join(', ')}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Create a basic test setup: install the appropriate test framework if needed, ` +\r\n `create a sample test file that tests at least one route or component. ` +\r\n `Use the project's package manager (${ctx.packageManager}). ` +\r\n `Write the test file(s) in the conventional location for this project type.`,\r\n });\r\n }\r\n\r\n // Check for missing security policy\r\n const hasSecurityMd = existsSync(join(rootDir, 'SECURITY.md'));\r\n if (!hasSecurityMd) {\r\n issues.push({\r\n id: 'security-policy',\r\n priority: 'P2',\r\n category: 'Security',\r\n title: 'Missing SECURITY.md',\r\n description: 'No security policy — no clear way to report vulnerabilities.',\r\n files: ['SECURITY.md'],\r\n promptBuilder: (ctx) =>\r\n `Create a SECURITY.md file for the \"${ctx.projectName}\" project. ` +\r\n `Include: supported versions table, how to report vulnerabilities, ` +\r\n `expected response time, disclosure policy. ` +\r\n `Write the file to SECURITY.md in the project root.`,\r\n });\r\n }\r\n\r\n // Filter out Collaboration issues if not a git repo\r\n const isGit = isGitRepo(rootDir);\r\n const filtered = isGit ? issues : issues.filter(i => i.category !== 'Collaboration');\r\n\r\n // Sort: P0 first, then P1, then P2\r\n const priorityOrder: Record<Priority, number> = { P0: 0, P1: 1, P2: 2 };\r\n filtered.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);\r\n\r\n return { issues: filtered, context, configInfo };\r\n}\r\n\r\nfunction resolveProjectName(rootDir: string): string {\r\n try {\r\n const pkg = JSON.parse(readFileSync(join(rootDir, 'package.json'), 'utf-8'));\r\n if (pkg.name) return pkg.name;\r\n } catch { /* ignore */ }\r\n return rootDir.split(/[\\\\/]/).pop() || 'project';\r\n}\r\n\r\n/**\r\n * Build the CI/CD provider selection prompt for fix-engine.\r\n */\r\nexport const CI_PROVIDERS = [\r\n { name: 'GitHub Actions', file: '.github/workflows/ci.yml' },\r\n { name: 'GitLab CI', file: '.gitlab-ci.yml' },\r\n { name: 'CircleCI', file: '.circleci/config.yml' },\r\n { name: 'Jenkins', file: 'Jenkinsfile' },\r\n { name: 'Travis CI', file: '.travis.yml' },\r\n { name: 'Azure Pipelines', file: 'azure-pipelines.yml' },\r\n] as const;\r\n\r\n/**\r\n * Build a production deployment guide prompt.\r\n */\r\nexport function buildDeployGuidePrompt(ctx: FixContext): string {\r\n return `Create a comprehensive \"take-it-to-prod.md\" deployment guide for the \"${ctx.projectName}\" project. ` +\r\n `Languages: ${ctx.languages.join(', ')}. Frameworks: ${ctx.frameworks.join(', ')}. ` +\r\n `Package manager: ${ctx.packageManager}. CI provider: ${ctx.ciProvider || 'not configured'}. ` +\r\n `Project structure:\\n${ctx.fileTree}\\n\\n` +\r\n `Include sections:\\n` +\r\n `1. Pre-Production Checklist (env vars, secrets, database migrations)\\n` +\r\n `2. Deployment Options (cloud providers suitable for this stack)\\n` +\r\n `3. Step-by-step deployment for the top 2 recommended platforms\\n` +\r\n `4. Environment Variables & Secrets to configure (list what the CI/CD pipeline needs)\\n` +\r\n `5. Post-Deployment Verification (health checks, smoke tests)\\n` +\r\n `6. Rollback Procedures\\n` +\r\n `7. Monitoring & Observability recommendations\\n\\n` +\r\n `Write the file to take-it-to-prod.md in the project root.`;\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAAA,SAAkB,YAAY;AAC9B,SAAS,YAAY,oBAAoB;AA2CzC,eAAsB,qBAAqB,SAAiB,QAA0C;AACpG,QAAM,aAAa,MAAM,UAAU,SAAS,MAAM;AAClD,QAAM,WAAW,gBAAgB,SAAS,WAAW,KAAK;AAC1D,QAAM,aAAa,cAAc,SAAS,WAAW,KAAK;AAC1D,QAAM,SAAS,aAAa,SAAS,WAAW,KAAK;AACrD,QAAM,WAAW,mBAAmB,WAAW,OAAO,CAAC;AAEvD,QAAM,UAAsB;AAAA,IAC1B,aAAa,mBAAmB,OAAO;AAAA,IACvC,WAAW,SAAS;AAAA,IACpB,YAAY,SAAS;AAAA,IACrB,gBAAgB,SAAS,kBAAkB;AAAA,IAC3C;AAAA,IACA;AAAA,EACF;AAEA,QAAM,SAAyB,CAAC;AAIhC,MAAI,CAAC,WAAW,WAAW;AACzB,WAAO,KAAK;AAAA,MACV,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO;AAAA,MACP,aAAa;AAAA,MACb,OAAO,CAAC,WAAW;AAAA,MACnB,eAAe,CAAC,QACd,4CAA4C,IAAI,WAAW,yBAC7C,IAAI,UAAU,KAAK,IAAI,CAAC,iBAAiB,IAAI,WAAW,KAAK,IAAI,CAAC,sBAC5D,IAAI,cAAc;AAAA,EACf,IAAI,QAAQ;AAAA;AAAA;AAAA,IAGvC,CAAC;AAAA,EACH;AAEA,MAAI,CAAC,WAAW,cAAc;AAC5B,WAAO,KAAK;AAAA,MACV,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO;AAAA,MACP,aAAa;AAAA,MACb,OAAO,CAAC,YAAY;AAAA,M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A,EACvC,EAAE,MAAM,aAAa,MAAM,cAAc;AAAA,EACzC,EAAE,MAAM,mBAAmB,MAAM,sBAAsB;AACzD;AAKO,SAAS,uBAAuB,KAAyB;AAC9D,SAAO,yEAAyE,IAAI,WAAW,yBAC/E,IAAI,UAAU,KAAK,IAAI,CAAC,iBAAiB,IAAI,WAAW,KAAK,IAAI,CAAC,sBAC5D,IAAI,cAAc,kBAAkB,IAAI,cAAc,gBAAgB;AAAA,EACnE,IAAI,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUvC;","names":[]}
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ensureDir,
4
+ ensureDirSync,
5
+ fileExists,
6
+ getExtension,
7
+ readFileContent,
8
+ readFileContentSync,
9
+ readFileTruncated,
10
+ walkDir,
11
+ writeOutput,
12
+ writeOutputSync
13
+ } from "./chunk-JZB6VB4T.js";
14
+ export {
15
+ ensureDir,
16
+ ensureDirSync,
17
+ fileExists,
18
+ getExtension,
19
+ readFileContent,
20
+ readFileContentSync,
21
+ readFileTruncated,
22
+ walkDir,
23
+ writeOutput,
24
+ writeOutputSync
25
+ };
26
+ //# sourceMappingURL=fs-GEDK6OCC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createCLI
4
+ } from "./chunk-I2CN2HU4.js";
5
+ import "./chunk-ZW3DYU5Y.js";
6
+ import "./chunk-RNKCNCJW.js";
7
+ import "./chunk-NYYK2IZI.js";
8
+ import "./chunk-JZB6VB4T.js";
9
+
10
+ // src/index.ts
11
+ var program = createCLI();
12
+ program.parse();
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createCLI } from './cli.js';\r\n\r\nconst program = createCLI();\r\nprogram.parse();\r\n"],"mappings":";;;;;;;;;;AAEA,IAAM,UAAU,UAAU;AAC1B,QAAQ,MAAM;","names":[]}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ Progress,
4
+ createProgress
5
+ } from "./chunk-RNKCNCJW.js";
6
+ export {
7
+ Progress,
8
+ createProgress
9
+ };
10
+ //# sourceMappingURL=progress-EQXHBUOU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}