@gkganesh12/codecraft-cli 1.0.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/README.md +99 -0
- package/dist/commands/adr.d.ts +2 -0
- package/dist/commands/adr.d.ts.map +1 -0
- package/dist/commands/adr.js +48 -0
- package/dist/commands/adr.js.map +1 -0
- package/dist/commands/architect.d.ts +2 -0
- package/dist/commands/architect.d.ts.map +1 -0
- package/dist/commands/architect.js +83 -0
- package/dist/commands/architect.js.map +1 -0
- package/dist/commands/code.d.ts +2 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/code.js +111 -0
- package/dist/commands/code.js.map +1 -0
- package/dist/commands/config.d.ts +11 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +101 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +36 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/explain.d.ts +2 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +41 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/feature.d.ts +2 -0
- package/dist/commands/feature.d.ts.map +1 -0
- package/dist/commands/feature.js +49 -0
- package/dist/commands/feature.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +63 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/plan.d.ts +2 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +61 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/review.d.ts +2 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +41 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +48 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +31 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verify.d.ts +2 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +64 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/config/loader.d.ts +8 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +35 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +25 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +19 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/llm/client.d.ts +14 -0
- package/dist/core/llm/client.d.ts.map +1 -0
- package/dist/core/llm/client.js +28 -0
- package/dist/core/llm/client.js.map +1 -0
- package/dist/core/prompts/roles.d.ts +11 -0
- package/dist/core/prompts/roles.d.ts.map +1 -0
- package/dist/core/prompts/roles.js +238 -0
- package/dist/core/prompts/roles.js.map +1 -0
- package/dist/core/rules.d.ts +14 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +39 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/scanner.d.ts +6 -0
- package/dist/core/scanner.d.ts.map +1 -0
- package/dist/core/scanner.js +21 -0
- package/dist/core/scanner.js.map +1 -0
- package/dist/core/scope.d.ts +11 -0
- package/dist/core/scope.d.ts.map +1 -0
- package/dist/core/scope.js +34 -0
- package/dist/core/scope.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/repl.d.ts +2 -0
- package/dist/repl.d.ts.map +1 -0
- package/dist/repl.js +148 -0
- package/dist/repl.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PM_ROLE = "# Project Manager - Code & Project Review Rules\n\n## Role Overview\nAs a Senior Project Manager, you are responsible for project planning, sprint management, quality assurance, risk mitigation, stakeholder communication, and ensuring the development team delivers high-quality features on time.\n\n---\n\n## 1. PROJECT PLANNING & ESTIMATION\n- Break down features into manageable, estimable tasks\n- Each feature must have clear acceptance criteria\n- Identify and document dependencies\n- Tasks should be sized appropriately (1-5 days max)\n\n## 2. TASK & FEATURE MANAGEMENT\n- Create clear, actionable tasks with descriptive titles\n- Define acceptance criteria and technical requirements\n- Prioritize tasks (P0, P1, P2, P3)\n\n## 3. QUALITY ASSURANCE OVERSIGHT\n- Enforce code review process\n- Ensure comprehensive testing (Unit, Integration, E2E)\n- Track bug resolution and prioritize critical issues\n\n## 4. RISK MANAGEMENT\n- Proactively identify and mitigate risks\n- Track dependencies and potential blockers\n- Prevent scope creep\n\n## 5. OUTPUT FORMAT\nYou must generate a clear, structured Implementation Plan (markdown) that includes:\n1. **Goal Description**: precise summary of what is being built.\n2. **Proposed Changes**: detailed file-by-file changes.\n3. **Verification Plan**: how to test the changes.\n";
|
|
2
|
+
export declare const ARCHITECT_ROLE = "# Technical Architect - Code Review Rules\n\n## Role Overview\nAs a Senior Technical Architect, you are responsible for ensuring code quality, architectural integrity, system scalability, and adherence to best practices.\n\n---\n\n## 1. ARCHITECTURE PRINCIPLES\n- **Separation of Concerns**: Each component/module must have a single responsibility.\n- **Layered Architecture**: Enforce clear separation (Presentation \u2192 Business Logic \u2192 Data Access).\n- **DRY**: No code duplication beyond 3 lines.\n- **Scalability**: Design for growth (pagination, lazy loading, indexing).\n\n## 2. CODE QUALITY STANDARDS\n- **Naming**: Descriptive, consistent naming (PascalCase for components, camelCase for functions).\n- **Function Design**: Small, focused functions (max 50 lines).\n- **Complexity**: Low cyclomatic complexity (max 3 nesting levels).\n- **Documentation**: Self-documenting code with JSDoc for public APIs.\n\n## 3. SECURITY REQUIREMENTS\n- **Input Validation**: Validate all inputs (never trust client).\n- **Auth**: Secure authentication and RBAC.\n- **Data Protection**: Encrypt sensitive data, no secrets in code.\n\n## 4. REVIEW CHECKLIST\nVerify:\n- Functionality solves the problem.\n- Code quality follows standards.\n- Architecture is sound.\n- Security vulnerabilities are absent.\n- Tests are present and passing.\n";
|
|
3
|
+
export declare const FRONTEND_DEV_ROLE = "# Frontend Developer - Development Guidelines\n\n## Role Overview\nAs a Senior Frontend Developer, you are responsible for building responsive, accessible, and performant user interfaces using React, TypeScript, and TailwindCSS.\n\n---\n\n## 1. CORE PRINCIPLES\n- **SOLID Principles**: Adapted for React (SRP for components).\n- **Composition**: Use composition over complex inheritance or prop drilling.\n- **Performance**: Minimize re-renders, use memoization, lazy load routes.\n\n## 2. COMPONENT DESIGN\n- Functional components with hooks.\n- Max 300 lines per component.\n- Typed props (TypeScript interfaces).\n- Reusable UI components (buttons, inputs) extracted.\n\n## 3. STATE MANAGEMENT\n- Local state: `useState`\n- Complex state: `useReducer`\n- Global/Feature state: Context API or Redux Toolkit (if needed).\n- Server state: React Query / RTK Query.\n\n## 4. STYLING (TailwindCSS)\n- Use utility classes directly.\n- Extract repeated patterns to components.\n- Mobile-first responsive design.\n\n## 5. OUTPUT FORMAT\nYou must generate valid, functioning Typescript/React code.\n- Ensure all imports are correct.\n- Ensure all types are defined.\n- Follow the project structure.\n";
|
|
4
|
+
export declare const BACKEND_DEV_ROLE = "# Backend Developer - Development Guidelines\n\n## Role Overview\nAs a Senior Backend Developer, you are responsible for building robust APIs, business logic, and database schemas using Node.js, TypeScript, and relevant frameworks.\n\n---\n\n## 1. ARCHITECTURAL PATTERNS\n- **Modules**: Feature-based modular architecture.\n- **Controllers**: Thin controllers, fat services.\n- **Services**: Business logic only, no direct DB access (use repositories).\n- **Repositories**: Centralized database access.\n\n## 2. DATABASE BEST PRACTICES\n- Normalized schema.\n- Efficient queries (SELECT only needed fields, pagination).\n- Use transactions for data integrity.\n\n## 3. SECURITY & QUALITY\n- Input validation (DTOs).\n- Authentication/Authorization (Guards).\n- Error handling (Global filters, proper status codes).\n\n## 4. OUTPUT FORMAT\nYou must generate valid, functioning Typescript code.\n- Ensure strict type safety.\n- Handle edge cases.\n";
|
|
5
|
+
export declare const QA_ROLE = "# Senior QA - Testing & Quality Assurance Rules\n\n## Role Overview\nAs a Senior QA Engineer, you are responsible for ensuring comprehensive test coverage, API validation, and quality metrics.\n\n---\n\n## 1. TEST STRATEGY\n- **Unit Tests**: Mock dependencies, test logic.\n- **Integration Tests**: Test API endpoints and DB interactions.\n- **E2E Tests**: Test critical user flows.\n\n## 2. API TESTING\n- Validate all HTTP methods.\n- Check status codes (2xx, 4xx, 5xx).\n- Validate response payloads.\n- Test authentication/authorization.\n\n## 3. RISK MANAGEMENT\n- Prioritize high-risk areas (Auth, Payments).\n- Identify edge cases and boundary values.\n\n## 4. OUTPUT FORMAT\nAnalyze the provided code/plan and:\n- Identify missing tests.\n- highlight potential risks (0-100 score).\n- Suggest specific test cases.\n";
|
|
6
|
+
export declare const FEATURE_PROMPT = "# Feature Specification Generator\n\n## Role\nYou are a Senior Product Manager and System Architect.\n\n## Goal\nGenerate a comprehensive Feature Specification based on the user's description.\n\n## Output Format\nUse Markdown, following this structure:\n1. **Feature Name & ID**\n2. **User Stories** (As a... I want... So that...)\n3. **Acceptance Criteria**\n4. **Technical Implementation** (API endpoints, DB changes, Components)\n5. **Dependencies**\n\nMake it detailed and actionable for developers.\n";
|
|
7
|
+
export declare const ADR_PROMPT = "# Architecture Decision Record (ADR) Generator\n\n## Role\nYou are a Principal Software Architect.\n\n## Goal\nCreate a formal ADR for a significant architectural decision.\n\n## Output Format\nUse Markdown.\n1. **Title** (ADR-XXX)\n2. **Status** (Proposed/Accepted)\n3. **Context** (The problem)\n4. **Decision** (The solution)\n5. **Consequences** (Pros/Cons, Risks)\n";
|
|
8
|
+
export declare const UNIT_TEST_PROMPT = "# Unit Test Generator\n\n## Role\nYou are a Senior SDET (Software Development Engineer in Test).\n\n## Goal\nWrite comprehensive unit tests for the provided code.\n\n## Rules\n1. Use the testing framework appropriate for the file (Jest/Vitest for JS/TS).\n2. Cover happy paths, edge cases, and error states.\n3. Mock external dependencies.\n4. Output ONLY the test code.\n";
|
|
9
|
+
export declare const REVIEW_PROMPT = "# Code Reviewer\n\n## Role\nYou are a Senior Tech Lead.\n\n## Goal\nReview the provided code for:\n1. **Bugs & Safety**\n2. **Performance**\n3. **Readability & Maintainability**\n4. **Security Vulnerabilities**\n\n## Output\nProvide a bulleted list of issues, ranked by severity (Critical / Warning / Nitpick).\n";
|
|
10
|
+
export declare const EXPLAIN_PROMPT = "# Code Explainer\n\n## Role\nYou are a Helpful Senior Developer Mentor.\n\n## Goal\nExplain the provided code in plain English.\n\n## Output\n1. **High-Level Summary**: What does this module do?\n2. **Key Concepts**: Explain any complex logic or patterns.\n3. **Flow**: Walk through the critical path.\n4. **Usage**: How should other developers use this?\n";
|
|
11
|
+
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../../src/core/prompts/roles.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,szCAiCnB,CAAC;AAEF,eAAO,MAAM,cAAc,k0CA+B1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,8qCAkC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,u7BA2B5B,CAAC;AAEF,eAAO,MAAM,OAAO,4zBA2BnB,CAAC;AAEF,eAAO,MAAM,cAAc,+fAiB1B,CAAC;AAEF,eAAO,MAAM,UAAU,uXAetB,CAAC;AAEF,eAAO,MAAM,gBAAgB,yXAa5B,CAAC;AAEF,eAAO,MAAM,aAAa,6TAczB,CAAC;AAEF,eAAO,MAAM,cAAc,yWAa1B,CAAC"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPLAIN_PROMPT = exports.REVIEW_PROMPT = exports.UNIT_TEST_PROMPT = exports.ADR_PROMPT = exports.FEATURE_PROMPT = exports.QA_ROLE = exports.BACKEND_DEV_ROLE = exports.FRONTEND_DEV_ROLE = exports.ARCHITECT_ROLE = exports.PM_ROLE = void 0;
|
|
4
|
+
exports.PM_ROLE = `# Project Manager - Code & Project Review Rules
|
|
5
|
+
|
|
6
|
+
## Role Overview
|
|
7
|
+
As a Senior Project Manager, you are responsible for project planning, sprint management, quality assurance, risk mitigation, stakeholder communication, and ensuring the development team delivers high-quality features on time.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. PROJECT PLANNING & ESTIMATION
|
|
12
|
+
- Break down features into manageable, estimable tasks
|
|
13
|
+
- Each feature must have clear acceptance criteria
|
|
14
|
+
- Identify and document dependencies
|
|
15
|
+
- Tasks should be sized appropriately (1-5 days max)
|
|
16
|
+
|
|
17
|
+
## 2. TASK & FEATURE MANAGEMENT
|
|
18
|
+
- Create clear, actionable tasks with descriptive titles
|
|
19
|
+
- Define acceptance criteria and technical requirements
|
|
20
|
+
- Prioritize tasks (P0, P1, P2, P3)
|
|
21
|
+
|
|
22
|
+
## 3. QUALITY ASSURANCE OVERSIGHT
|
|
23
|
+
- Enforce code review process
|
|
24
|
+
- Ensure comprehensive testing (Unit, Integration, E2E)
|
|
25
|
+
- Track bug resolution and prioritize critical issues
|
|
26
|
+
|
|
27
|
+
## 4. RISK MANAGEMENT
|
|
28
|
+
- Proactively identify and mitigate risks
|
|
29
|
+
- Track dependencies and potential blockers
|
|
30
|
+
- Prevent scope creep
|
|
31
|
+
|
|
32
|
+
## 5. OUTPUT FORMAT
|
|
33
|
+
You must generate a clear, structured Implementation Plan (markdown) that includes:
|
|
34
|
+
1. **Goal Description**: precise summary of what is being built.
|
|
35
|
+
2. **Proposed Changes**: detailed file-by-file changes.
|
|
36
|
+
3. **Verification Plan**: how to test the changes.
|
|
37
|
+
`;
|
|
38
|
+
exports.ARCHITECT_ROLE = `# Technical Architect - Code Review Rules
|
|
39
|
+
|
|
40
|
+
## Role Overview
|
|
41
|
+
As a Senior Technical Architect, you are responsible for ensuring code quality, architectural integrity, system scalability, and adherence to best practices.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 1. ARCHITECTURE PRINCIPLES
|
|
46
|
+
- **Separation of Concerns**: Each component/module must have a single responsibility.
|
|
47
|
+
- **Layered Architecture**: Enforce clear separation (Presentation → Business Logic → Data Access).
|
|
48
|
+
- **DRY**: No code duplication beyond 3 lines.
|
|
49
|
+
- **Scalability**: Design for growth (pagination, lazy loading, indexing).
|
|
50
|
+
|
|
51
|
+
## 2. CODE QUALITY STANDARDS
|
|
52
|
+
- **Naming**: Descriptive, consistent naming (PascalCase for components, camelCase for functions).
|
|
53
|
+
- **Function Design**: Small, focused functions (max 50 lines).
|
|
54
|
+
- **Complexity**: Low cyclomatic complexity (max 3 nesting levels).
|
|
55
|
+
- **Documentation**: Self-documenting code with JSDoc for public APIs.
|
|
56
|
+
|
|
57
|
+
## 3. SECURITY REQUIREMENTS
|
|
58
|
+
- **Input Validation**: Validate all inputs (never trust client).
|
|
59
|
+
- **Auth**: Secure authentication and RBAC.
|
|
60
|
+
- **Data Protection**: Encrypt sensitive data, no secrets in code.
|
|
61
|
+
|
|
62
|
+
## 4. REVIEW CHECKLIST
|
|
63
|
+
Verify:
|
|
64
|
+
- Functionality solves the problem.
|
|
65
|
+
- Code quality follows standards.
|
|
66
|
+
- Architecture is sound.
|
|
67
|
+
- Security vulnerabilities are absent.
|
|
68
|
+
- Tests are present and passing.
|
|
69
|
+
`;
|
|
70
|
+
exports.FRONTEND_DEV_ROLE = `# Frontend Developer - Development Guidelines
|
|
71
|
+
|
|
72
|
+
## Role Overview
|
|
73
|
+
As a Senior Frontend Developer, you are responsible for building responsive, accessible, and performant user interfaces using React, TypeScript, and TailwindCSS.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 1. CORE PRINCIPLES
|
|
78
|
+
- **SOLID Principles**: Adapted for React (SRP for components).
|
|
79
|
+
- **Composition**: Use composition over complex inheritance or prop drilling.
|
|
80
|
+
- **Performance**: Minimize re-renders, use memoization, lazy load routes.
|
|
81
|
+
|
|
82
|
+
## 2. COMPONENT DESIGN
|
|
83
|
+
- Functional components with hooks.
|
|
84
|
+
- Max 300 lines per component.
|
|
85
|
+
- Typed props (TypeScript interfaces).
|
|
86
|
+
- Reusable UI components (buttons, inputs) extracted.
|
|
87
|
+
|
|
88
|
+
## 3. STATE MANAGEMENT
|
|
89
|
+
- Local state: \`useState\`
|
|
90
|
+
- Complex state: \`useReducer\`
|
|
91
|
+
- Global/Feature state: Context API or Redux Toolkit (if needed).
|
|
92
|
+
- Server state: React Query / RTK Query.
|
|
93
|
+
|
|
94
|
+
## 4. STYLING (TailwindCSS)
|
|
95
|
+
- Use utility classes directly.
|
|
96
|
+
- Extract repeated patterns to components.
|
|
97
|
+
- Mobile-first responsive design.
|
|
98
|
+
|
|
99
|
+
## 5. OUTPUT FORMAT
|
|
100
|
+
You must generate valid, functioning Typescript/React code.
|
|
101
|
+
- Ensure all imports are correct.
|
|
102
|
+
- Ensure all types are defined.
|
|
103
|
+
- Follow the project structure.
|
|
104
|
+
`;
|
|
105
|
+
exports.BACKEND_DEV_ROLE = `# Backend Developer - Development Guidelines
|
|
106
|
+
|
|
107
|
+
## Role Overview
|
|
108
|
+
As a Senior Backend Developer, you are responsible for building robust APIs, business logic, and database schemas using Node.js, TypeScript, and relevant frameworks.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 1. ARCHITECTURAL PATTERNS
|
|
113
|
+
- **Modules**: Feature-based modular architecture.
|
|
114
|
+
- **Controllers**: Thin controllers, fat services.
|
|
115
|
+
- **Services**: Business logic only, no direct DB access (use repositories).
|
|
116
|
+
- **Repositories**: Centralized database access.
|
|
117
|
+
|
|
118
|
+
## 2. DATABASE BEST PRACTICES
|
|
119
|
+
- Normalized schema.
|
|
120
|
+
- Efficient queries (SELECT only needed fields, pagination).
|
|
121
|
+
- Use transactions for data integrity.
|
|
122
|
+
|
|
123
|
+
## 3. SECURITY & QUALITY
|
|
124
|
+
- Input validation (DTOs).
|
|
125
|
+
- Authentication/Authorization (Guards).
|
|
126
|
+
- Error handling (Global filters, proper status codes).
|
|
127
|
+
|
|
128
|
+
## 4. OUTPUT FORMAT
|
|
129
|
+
You must generate valid, functioning Typescript code.
|
|
130
|
+
- Ensure strict type safety.
|
|
131
|
+
- Handle edge cases.
|
|
132
|
+
`;
|
|
133
|
+
exports.QA_ROLE = `# Senior QA - Testing & Quality Assurance Rules
|
|
134
|
+
|
|
135
|
+
## Role Overview
|
|
136
|
+
As a Senior QA Engineer, you are responsible for ensuring comprehensive test coverage, API validation, and quality metrics.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 1. TEST STRATEGY
|
|
141
|
+
- **Unit Tests**: Mock dependencies, test logic.
|
|
142
|
+
- **Integration Tests**: Test API endpoints and DB interactions.
|
|
143
|
+
- **E2E Tests**: Test critical user flows.
|
|
144
|
+
|
|
145
|
+
## 2. API TESTING
|
|
146
|
+
- Validate all HTTP methods.
|
|
147
|
+
- Check status codes (2xx, 4xx, 5xx).
|
|
148
|
+
- Validate response payloads.
|
|
149
|
+
- Test authentication/authorization.
|
|
150
|
+
|
|
151
|
+
## 3. RISK MANAGEMENT
|
|
152
|
+
- Prioritize high-risk areas (Auth, Payments).
|
|
153
|
+
- Identify edge cases and boundary values.
|
|
154
|
+
|
|
155
|
+
## 4. OUTPUT FORMAT
|
|
156
|
+
Analyze the provided code/plan and:
|
|
157
|
+
- Identify missing tests.
|
|
158
|
+
- highlight potential risks (0-100 score).
|
|
159
|
+
- Suggest specific test cases.
|
|
160
|
+
`;
|
|
161
|
+
exports.FEATURE_PROMPT = `# Feature Specification Generator
|
|
162
|
+
|
|
163
|
+
## Role
|
|
164
|
+
You are a Senior Product Manager and System Architect.
|
|
165
|
+
|
|
166
|
+
## Goal
|
|
167
|
+
Generate a comprehensive Feature Specification based on the user's description.
|
|
168
|
+
|
|
169
|
+
## Output Format
|
|
170
|
+
Use Markdown, following this structure:
|
|
171
|
+
1. **Feature Name & ID**
|
|
172
|
+
2. **User Stories** (As a... I want... So that...)
|
|
173
|
+
3. **Acceptance Criteria**
|
|
174
|
+
4. **Technical Implementation** (API endpoints, DB changes, Components)
|
|
175
|
+
5. **Dependencies**
|
|
176
|
+
|
|
177
|
+
Make it detailed and actionable for developers.
|
|
178
|
+
`;
|
|
179
|
+
exports.ADR_PROMPT = `# Architecture Decision Record (ADR) Generator
|
|
180
|
+
|
|
181
|
+
## Role
|
|
182
|
+
You are a Principal Software Architect.
|
|
183
|
+
|
|
184
|
+
## Goal
|
|
185
|
+
Create a formal ADR for a significant architectural decision.
|
|
186
|
+
|
|
187
|
+
## Output Format
|
|
188
|
+
Use Markdown.
|
|
189
|
+
1. **Title** (ADR-XXX)
|
|
190
|
+
2. **Status** (Proposed/Accepted)
|
|
191
|
+
3. **Context** (The problem)
|
|
192
|
+
4. **Decision** (The solution)
|
|
193
|
+
5. **Consequences** (Pros/Cons, Risks)
|
|
194
|
+
`;
|
|
195
|
+
exports.UNIT_TEST_PROMPT = `# Unit Test Generator
|
|
196
|
+
|
|
197
|
+
## Role
|
|
198
|
+
You are a Senior SDET (Software Development Engineer in Test).
|
|
199
|
+
|
|
200
|
+
## Goal
|
|
201
|
+
Write comprehensive unit tests for the provided code.
|
|
202
|
+
|
|
203
|
+
## Rules
|
|
204
|
+
1. Use the testing framework appropriate for the file (Jest/Vitest for JS/TS).
|
|
205
|
+
2. Cover happy paths, edge cases, and error states.
|
|
206
|
+
3. Mock external dependencies.
|
|
207
|
+
4. Output ONLY the test code.
|
|
208
|
+
`;
|
|
209
|
+
exports.REVIEW_PROMPT = `# Code Reviewer
|
|
210
|
+
|
|
211
|
+
## Role
|
|
212
|
+
You are a Senior Tech Lead.
|
|
213
|
+
|
|
214
|
+
## Goal
|
|
215
|
+
Review the provided code for:
|
|
216
|
+
1. **Bugs & Safety**
|
|
217
|
+
2. **Performance**
|
|
218
|
+
3. **Readability & Maintainability**
|
|
219
|
+
4. **Security Vulnerabilities**
|
|
220
|
+
|
|
221
|
+
## Output
|
|
222
|
+
Provide a bulleted list of issues, ranked by severity (Critical / Warning / Nitpick).
|
|
223
|
+
`;
|
|
224
|
+
exports.EXPLAIN_PROMPT = `# Code Explainer
|
|
225
|
+
|
|
226
|
+
## Role
|
|
227
|
+
You are a Helpful Senior Developer Mentor.
|
|
228
|
+
|
|
229
|
+
## Goal
|
|
230
|
+
Explain the provided code in plain English.
|
|
231
|
+
|
|
232
|
+
## Output
|
|
233
|
+
1. **High-Level Summary**: What does this module do?
|
|
234
|
+
2. **Key Concepts**: Explain any complex logic or patterns.
|
|
235
|
+
3. **Flow**: Walk through the critical path.
|
|
236
|
+
4. **Usage**: How should other developers use this?
|
|
237
|
+
`;
|
|
238
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../../src/core/prompts/roles.ts"],"names":[],"mappings":";;;AACa,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCtB,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B7B,CAAC;AAEW,QAAA,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChC,CAAC;AAEW,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B/B,CAAC;AAEW,QAAA,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BtB,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;;;;;;;CAiB7B,CAAC;AAEW,QAAA,UAAU,GAAG;;;;;;;;;;;;;;;CAezB,CAAC;AAEW,QAAA,gBAAgB,GAAG;;;;;;;;;;;;;CAa/B,CAAC;AAEW,QAAA,aAAa,GAAG;;;;;;;;;;;;;;CAc5B,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;;;CAa7B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CodeCraftConfig } from '../config/schema';
|
|
2
|
+
export interface RuleViolation {
|
|
3
|
+
ruleName: string;
|
|
4
|
+
description: string;
|
|
5
|
+
severity: 'error' | 'warn' | 'info';
|
|
6
|
+
files: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare class RuleValidator {
|
|
9
|
+
private config;
|
|
10
|
+
private cwd;
|
|
11
|
+
constructor(config: CodeCraftConfig, cwd?: string);
|
|
12
|
+
validate(): RuleViolation[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/core/rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,KAAK,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,GAAG,CAAS;gBAER,MAAM,EAAE,eAAe,EAAE,GAAG,GAAE,MAAsB;IAKhE,QAAQ,IAAI,aAAa,EAAE;CAgC9B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleValidator = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
class RuleValidator {
|
|
6
|
+
constructor(config, cwd = process.cwd()) {
|
|
7
|
+
this.config = config;
|
|
8
|
+
this.cwd = cwd;
|
|
9
|
+
}
|
|
10
|
+
validate() {
|
|
11
|
+
const violations = [];
|
|
12
|
+
for (const rule of this.config.rules) {
|
|
13
|
+
try {
|
|
14
|
+
// Execute the check command (e.g. grep)
|
|
15
|
+
// If grep finds matches, it returns 0 (success), which means a PROHIBITED pattern was found.
|
|
16
|
+
// We catch the output to see which files failed.
|
|
17
|
+
// Note: execSync throws if exit code is non-zero (which for grep means "no matches found", i.e., PASS)
|
|
18
|
+
// So:
|
|
19
|
+
// - exit 0 (matches found) -> FAIL (Violation)
|
|
20
|
+
// - exit 1 (no matches) -> PASS
|
|
21
|
+
(0, child_process_1.execSync)(rule.check, { cwd: this.cwd, stdio: 'ignore' });
|
|
22
|
+
// If we reached here, grep found something!
|
|
23
|
+
violations.push({
|
|
24
|
+
ruleName: rule.name,
|
|
25
|
+
description: rule.description,
|
|
26
|
+
severity: rule.severity,
|
|
27
|
+
files: ['(Run check manually to see files)'] // TODO: Parse grep output for specific files
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
// grep returned status 1, which means NO matches found. This is GOOD.
|
|
32
|
+
// So we do nothing.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return violations;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.RuleValidator = RuleValidator;
|
|
39
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/core/rules.ts"],"names":[],"mappings":";;;AAEA,iDAAyC;AAUzC,MAAa,aAAa;IAItB,YAAY,MAAuB,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;QAC5D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,QAAQ;QACJ,MAAM,UAAU,GAAoB,EAAE,CAAC;QAEvC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACnC,IAAI,CAAC;gBACD,wCAAwC;gBACxC,6FAA6F;gBAC7F,iDAAiD;gBAEjD,uGAAuG;gBACvG,MAAM;gBACN,+CAA+C;gBAC/C,gCAAgC;gBAEhC,IAAA,wBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAEzD,4CAA4C;gBAC5C,UAAU,CAAC,IAAI,CAAC;oBACZ,QAAQ,EAAE,IAAI,CAAC,IAAI;oBACnB,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,KAAK,EAAE,CAAC,mCAAmC,CAAC,CAAC,6CAA6C;iBAC7F,CAAC,CAAC;YAEP,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBAClB,sEAAsE;gBACtE,oBAAoB;YACxB,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAzCD,sCAyCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../src/core/scanner.ts"],"names":[],"mappings":"AAIA,qBAAa,cAAc;IACvB,OAAO,CAAC,GAAG,CAAS;gBAER,GAAG,GAAE,MAAsB;IAIjC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAUlC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectScanner = void 0;
|
|
4
|
+
const glob_1 = require("glob");
|
|
5
|
+
class ProjectScanner {
|
|
6
|
+
constructor(cwd = process.cwd()) {
|
|
7
|
+
this.cwd = cwd;
|
|
8
|
+
}
|
|
9
|
+
async scan() {
|
|
10
|
+
// Scan all files, ignoring node_modules and .git by default
|
|
11
|
+
// In a real implementation, we would also parse .gitignore
|
|
12
|
+
const files = await (0, glob_1.glob)('**/*', {
|
|
13
|
+
cwd: this.cwd,
|
|
14
|
+
ignore: ['node_modules/**', '.git/**', 'dist/**', '.codecraft/**'],
|
|
15
|
+
nodir: true
|
|
16
|
+
});
|
|
17
|
+
return files;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ProjectScanner = ProjectScanner;
|
|
21
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/core/scanner.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAG5B,MAAa,cAAc;IAGvB,YAAY,MAAc,OAAO,CAAC,GAAG,EAAE;QACnC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,IAAI;QACN,4DAA4D;QAC5D,2DAA2D;QAC3D,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EAAC,MAAM,EAAE;YAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,CAAC,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC;YAClE,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAjBD,wCAiBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CodeCraftConfig } from '../config/schema';
|
|
2
|
+
export declare class ScopeManager {
|
|
3
|
+
private config;
|
|
4
|
+
constructor(config: CodeCraftConfig);
|
|
5
|
+
isAllowed(filePath: string): boolean;
|
|
6
|
+
validateScope(files: string[]): {
|
|
7
|
+
allowed: string[];
|
|
8
|
+
blocked: string[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/core/scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAInC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAWpC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;CAc3E"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScopeManager = void 0;
|
|
4
|
+
const minimatch_1 = require("minimatch");
|
|
5
|
+
class ScopeManager {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.config = config;
|
|
8
|
+
}
|
|
9
|
+
isAllowed(filePath) {
|
|
10
|
+
// Check if path is protected
|
|
11
|
+
const protectedPaths = this.config.scopeGuard.protectedPaths;
|
|
12
|
+
for (const pattern of protectedPaths) {
|
|
13
|
+
if ((0, minimatch_1.minimatch)(filePath, pattern)) {
|
|
14
|
+
return false; // Protected!
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return true; // Allowed by default (unless we add whitelist logic later)
|
|
18
|
+
}
|
|
19
|
+
validateScope(files) {
|
|
20
|
+
const allowed = [];
|
|
21
|
+
const blocked = [];
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
if (this.isAllowed(file)) {
|
|
24
|
+
allowed.push(file);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
blocked.push(file);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return { allowed, blocked };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ScopeManager = ScopeManager;
|
|
34
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/core/scope.ts"],"names":[],"mappings":";;;AAEA,yCAAsC;AAEtC,MAAa,YAAY;IAGrB,YAAY,MAAuB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,SAAS,CAAC,QAAgB;QACtB,6BAA6B;QAC7B,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC;QAC7D,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;YACnC,IAAI,IAAA,qBAAS,EAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC,CAAC,aAAa;YAC/B,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,CAAC,2DAA2D;IAC5E,CAAC;IAED,aAAa,CAAC,KAAe;QACzB,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;QACL,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAChC,CAAC;CACJ;AAhCD,oCAgCC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin / env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const dotenv = __importStar(require("dotenv"));
|
|
43
|
+
const fs_1 = require("fs");
|
|
44
|
+
const path_1 = __importDefault(require("path"));
|
|
45
|
+
const init_1 = require("./commands/init");
|
|
46
|
+
const plan_1 = require("./commands/plan");
|
|
47
|
+
const architect_1 = require("./commands/architect");
|
|
48
|
+
const code_1 = require("./commands/code");
|
|
49
|
+
const verify_1 = require("./commands/verify");
|
|
50
|
+
dotenv.config();
|
|
51
|
+
const program = new commander_1.Command();
|
|
52
|
+
// Read version from package.json
|
|
53
|
+
const packageJson = JSON.parse((0, fs_1.readFileSync)(path_1.default.join(__dirname, '../package.json'), 'utf-8'));
|
|
54
|
+
program
|
|
55
|
+
.name('codecraft')
|
|
56
|
+
.description('AI Governance CLI for Developers')
|
|
57
|
+
.version(packageJson.version);
|
|
58
|
+
const config_1 = require("./commands/config");
|
|
59
|
+
const update_1 = require("./commands/update");
|
|
60
|
+
const doctor_1 = require("./commands/doctor");
|
|
61
|
+
const repl_1 = require("./repl");
|
|
62
|
+
// Global Options
|
|
63
|
+
program
|
|
64
|
+
.option('-v, --verbose', 'Enable verbose logging')
|
|
65
|
+
.option('-m, --model <name>', 'Override AI model')
|
|
66
|
+
.option('-p, --print', 'Print output instead of interactive mode');
|
|
67
|
+
program
|
|
68
|
+
.command('init')
|
|
69
|
+
.description('Initialize CodeCraft in the current project')
|
|
70
|
+
.action(init_1.initCommand);
|
|
71
|
+
program
|
|
72
|
+
.command('plan')
|
|
73
|
+
.description('Create an implementation plan for a task')
|
|
74
|
+
.argument('<task>', 'Description of the task')
|
|
75
|
+
.action(plan_1.planCommand);
|
|
76
|
+
// ...
|
|
77
|
+
program
|
|
78
|
+
.command('architect')
|
|
79
|
+
.description('Validate the plan against architecture rules')
|
|
80
|
+
.action(architect_1.architectCommand);
|
|
81
|
+
program
|
|
82
|
+
.command('code')
|
|
83
|
+
.description('Execute the plan and generate code')
|
|
84
|
+
.action(code_1.codeCommand);
|
|
85
|
+
program
|
|
86
|
+
.command('verify')
|
|
87
|
+
.description('Verify changes and calculate risk score')
|
|
88
|
+
.action(verify_1.verifyCommand);
|
|
89
|
+
program
|
|
90
|
+
.command('config')
|
|
91
|
+
.description('Manage configuration')
|
|
92
|
+
.argument('[args...]', 'Arguments for config')
|
|
93
|
+
.action((args) => (0, config_1.configCommand)(args || []));
|
|
94
|
+
program
|
|
95
|
+
.command('update')
|
|
96
|
+
.description('Check for updates')
|
|
97
|
+
.action(update_1.updateCommand);
|
|
98
|
+
program
|
|
99
|
+
.command('doctor')
|
|
100
|
+
.description('Check environment health')
|
|
101
|
+
.action(doctor_1.doctorCommand);
|
|
102
|
+
// Check for globals before processing
|
|
103
|
+
program.hook('preAction', (thisCommand) => {
|
|
104
|
+
const opts = thisCommand.opts();
|
|
105
|
+
if (opts.verbose) {
|
|
106
|
+
process.env.VERBOSE = 'true';
|
|
107
|
+
console.log(chalk_1.default.gray('[Verbose Mode Enabled]'));
|
|
108
|
+
}
|
|
109
|
+
if (opts.model) {
|
|
110
|
+
process.env.CODECRAFT_MODEL = opts.model;
|
|
111
|
+
console.log(chalk_1.default.gray(`[Model Override: ${opts.model}]`));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
// Check if any command is provided (args[0] is node, args[1] is script)
|
|
115
|
+
if (process.argv.length <= 2) {
|
|
116
|
+
(0, repl_1.startRepl)();
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
program.parse(process.argv);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/dist/repl.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":"AAiBA,wBAAsB,SAAS,kBAmH9B"}
|