fusion-agent 1.1.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/README.md +467 -0
- package/REQUIREMENTS.md +158 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +500 -0
- package/dist/cli.js.map +1 -0
- package/dist/cluster-monitor/cluster-monitor.d.ts +49 -0
- package/dist/cluster-monitor/cluster-monitor.d.ts.map +1 -0
- package/dist/cluster-monitor/cluster-monitor.js +374 -0
- package/dist/cluster-monitor/cluster-monitor.js.map +1 -0
- package/dist/cluster-monitor/index.d.ts +9 -0
- package/dist/cluster-monitor/index.d.ts.map +1 -0
- package/dist/cluster-monitor/index.js +19 -0
- package/dist/cluster-monitor/index.js.map +1 -0
- package/dist/cluster-monitor/kubernetes-connector.d.ts +21 -0
- package/dist/cluster-monitor/kubernetes-connector.d.ts.map +1 -0
- package/dist/cluster-monitor/kubernetes-connector.js +109 -0
- package/dist/cluster-monitor/kubernetes-connector.js.map +1 -0
- package/dist/cluster-monitor/notifications.d.ts +26 -0
- package/dist/cluster-monitor/notifications.d.ts.map +1 -0
- package/dist/cluster-monitor/notifications.js +182 -0
- package/dist/cluster-monitor/notifications.js.map +1 -0
- package/dist/cluster-monitor/remediation.d.ts +33 -0
- package/dist/cluster-monitor/remediation.d.ts.map +1 -0
- package/dist/cluster-monitor/remediation.js +134 -0
- package/dist/cluster-monitor/remediation.js.map +1 -0
- package/dist/cluster-monitor/rules.d.ts +26 -0
- package/dist/cluster-monitor/rules.d.ts.map +1 -0
- package/dist/cluster-monitor/rules.js +133 -0
- package/dist/cluster-monitor/rules.js.map +1 -0
- package/dist/cluster-monitor/types.d.ts +184 -0
- package/dist/cluster-monitor/types.d.ts.map +1 -0
- package/dist/cluster-monitor/types.js +3 -0
- package/dist/cluster-monitor/types.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -0
- package/dist/index.js.map +1 -0
- package/dist/live-debugger/index.d.ts +32 -0
- package/dist/live-debugger/index.d.ts.map +1 -0
- package/dist/live-debugger/index.js +119 -0
- package/dist/live-debugger/index.js.map +1 -0
- package/dist/live-debugger/log-watcher.d.ts +19 -0
- package/dist/live-debugger/log-watcher.d.ts.map +1 -0
- package/dist/live-debugger/log-watcher.js +77 -0
- package/dist/live-debugger/log-watcher.js.map +1 -0
- package/dist/live-debugger/service-connector.d.ts +33 -0
- package/dist/live-debugger/service-connector.d.ts.map +1 -0
- package/dist/live-debugger/service-connector.js +123 -0
- package/dist/live-debugger/service-connector.js.map +1 -0
- package/dist/providers/anthropic.d.ts +9 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +71 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/base.d.ts +29 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +14 -0
- package/dist/providers/base.js.map +1 -0
- package/dist/providers/gemini.d.ts +11 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +73 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +14 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +38 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +9 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +59 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/session/guardrails.d.ts +20 -0
- package/dist/session/guardrails.d.ts.map +1 -0
- package/dist/session/guardrails.js +83 -0
- package/dist/session/guardrails.js.map +1 -0
- package/dist/session/index.d.ts +6 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +12 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/session-manager.d.ts +15 -0
- package/dist/session/session-manager.d.ts.map +1 -0
- package/dist/session/session-manager.js +89 -0
- package/dist/session/session-manager.js.map +1 -0
- package/dist/session/session.d.ts +63 -0
- package/dist/session/session.d.ts.map +1 -0
- package/dist/session/session.js +123 -0
- package/dist/session/session.js.map +1 -0
- package/dist/speckits/base.d.ts +9 -0
- package/dist/speckits/base.d.ts.map +1 -0
- package/dist/speckits/base.js +3 -0
- package/dist/speckits/base.js.map +1 -0
- package/dist/speckits/cluster-debugger.d.ts +3 -0
- package/dist/speckits/cluster-debugger.d.ts.map +1 -0
- package/dist/speckits/cluster-debugger.js +48 -0
- package/dist/speckits/cluster-debugger.js.map +1 -0
- package/dist/speckits/code-review.d.ts +3 -0
- package/dist/speckits/code-review.d.ts.map +1 -0
- package/dist/speckits/code-review.js +41 -0
- package/dist/speckits/code-review.js.map +1 -0
- package/dist/speckits/debugger.d.ts +3 -0
- package/dist/speckits/debugger.d.ts.map +1 -0
- package/dist/speckits/debugger.js +38 -0
- package/dist/speckits/debugger.js.map +1 -0
- package/dist/speckits/index.d.ts +11 -0
- package/dist/speckits/index.d.ts.map +1 -0
- package/dist/speckits/index.js +40 -0
- package/dist/speckits/index.js.map +1 -0
- package/dist/speckits/more-speckits.d.ts +6 -0
- package/dist/speckits/more-speckits.d.ts.map +1 -0
- package/dist/speckits/more-speckits.js +136 -0
- package/dist/speckits/more-speckits.js.map +1 -0
- package/dist/speckits/vibe-coder.d.ts +3 -0
- package/dist/speckits/vibe-coder.d.ts.map +1 -0
- package/dist/speckits/vibe-coder.js +32 -0
- package/dist/speckits/vibe-coder.js.map +1 -0
- package/dist/utils/config.d.ts +18 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +107 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/file-ops.d.ts +15 -0
- package/dist/utils/file-ops.d.ts.map +1 -0
- package/dist/utils/file-ops.js +109 -0
- package/dist/utils/file-ops.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +25 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/web/public/css/app.css +370 -0
- package/dist/web/public/index.html +91 -0
- package/dist/web/public/js/app.js +212 -0
- package/dist/web/routes/sessions.d.ts +4 -0
- package/dist/web/routes/sessions.d.ts.map +1 -0
- package/dist/web/routes/sessions.js +51 -0
- package/dist/web/routes/sessions.js.map +1 -0
- package/dist/web/routes/settings.d.ts +3 -0
- package/dist/web/routes/settings.d.ts.map +1 -0
- package/dist/web/routes/settings.js +33 -0
- package/dist/web/routes/settings.js.map +1 -0
- package/dist/web/server.d.ts +16 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +76 -0
- package/dist/web/server.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/speckits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAOjC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAS5C,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D;AAED,wBAAgB,YAAY,IAAI,OAAO,EAAE,CAExC;AAED,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clusterDebugger = exports.securityAudit = exports.refactor = exports.testWriter = exports.docWriter = exports.codeReview = exports.debuggerSpeckit = exports.vibeCoder = exports.SPECKITS = void 0;
|
|
4
|
+
exports.getSpeckit = getSpeckit;
|
|
5
|
+
exports.listSpeckits = listSpeckits;
|
|
6
|
+
const vibe_coder_1 = require("./vibe-coder");
|
|
7
|
+
const debugger_1 = require("./debugger");
|
|
8
|
+
const code_review_1 = require("./code-review");
|
|
9
|
+
const more_speckits_1 = require("./more-speckits");
|
|
10
|
+
const cluster_debugger_1 = require("./cluster-debugger");
|
|
11
|
+
exports.SPECKITS = {
|
|
12
|
+
'vibe-coder': vibe_coder_1.vibeCoder,
|
|
13
|
+
'debugger': debugger_1.debugger_,
|
|
14
|
+
'code-review': code_review_1.codeReview,
|
|
15
|
+
'doc-writer': more_speckits_1.docWriter,
|
|
16
|
+
'test-writer': more_speckits_1.testWriter,
|
|
17
|
+
'refactor': more_speckits_1.refactor,
|
|
18
|
+
'security-audit': more_speckits_1.securityAudit,
|
|
19
|
+
'cluster-debugger': cluster_debugger_1.clusterDebugger,
|
|
20
|
+
};
|
|
21
|
+
function getSpeckit(name) {
|
|
22
|
+
return exports.SPECKITS[name];
|
|
23
|
+
}
|
|
24
|
+
function listSpeckits() {
|
|
25
|
+
return Object.values(exports.SPECKITS);
|
|
26
|
+
}
|
|
27
|
+
var vibe_coder_2 = require("./vibe-coder");
|
|
28
|
+
Object.defineProperty(exports, "vibeCoder", { enumerable: true, get: function () { return vibe_coder_2.vibeCoder; } });
|
|
29
|
+
var debugger_2 = require("./debugger");
|
|
30
|
+
Object.defineProperty(exports, "debuggerSpeckit", { enumerable: true, get: function () { return debugger_2.debugger_; } });
|
|
31
|
+
var code_review_2 = require("./code-review");
|
|
32
|
+
Object.defineProperty(exports, "codeReview", { enumerable: true, get: function () { return code_review_2.codeReview; } });
|
|
33
|
+
var more_speckits_2 = require("./more-speckits");
|
|
34
|
+
Object.defineProperty(exports, "docWriter", { enumerable: true, get: function () { return more_speckits_2.docWriter; } });
|
|
35
|
+
Object.defineProperty(exports, "testWriter", { enumerable: true, get: function () { return more_speckits_2.testWriter; } });
|
|
36
|
+
Object.defineProperty(exports, "refactor", { enumerable: true, get: function () { return more_speckits_2.refactor; } });
|
|
37
|
+
Object.defineProperty(exports, "securityAudit", { enumerable: true, get: function () { return more_speckits_2.securityAudit; } });
|
|
38
|
+
var cluster_debugger_2 = require("./cluster-debugger");
|
|
39
|
+
Object.defineProperty(exports, "clusterDebugger", { enumerable: true, get: function () { return cluster_debugger_2.clusterDebugger; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/speckits/index.ts"],"names":[],"mappings":";;;AAkBA,gCAEC;AAED,oCAEC;AAvBD,6CAAyC;AACzC,yCAAuC;AACvC,+CAA2C;AAC3C,mDAAiF;AACjF,yDAAqD;AAExC,QAAA,QAAQ,GAA4B;IAC/C,YAAY,EAAE,sBAAS;IACvB,UAAU,EAAE,oBAAS;IACrB,aAAa,EAAE,wBAAU;IACzB,YAAY,EAAE,yBAAS;IACvB,aAAa,EAAE,0BAAU;IACzB,UAAU,EAAE,wBAAQ;IACpB,gBAAgB,EAAE,6BAAa;IAC/B,kBAAkB,EAAE,kCAAe;CACpC,CAAC;AAEF,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,gBAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,YAAY;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAQ,CAAC,CAAC;AACjC,CAAC;AAGD,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,uCAA0D;AAAjD,2GAAA,SAAS,OAAmB;AACrC,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,iDAAiF;AAAxE,0GAAA,SAAS,OAAA;AAAE,2GAAA,UAAU,OAAA;AAAE,yGAAA,QAAQ,OAAA;AAAE,8GAAA,aAAa,OAAA;AACvD,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"more-speckits.d.ts","sourceRoot":"","sources":["../../src/speckits/more-speckits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,eAAO,MAAM,SAAS,EAAE,OA4BvB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,OAgCxB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,OA2BtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAyC3B,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.securityAudit = exports.refactor = exports.testWriter = exports.docWriter = void 0;
|
|
4
|
+
exports.docWriter = {
|
|
5
|
+
name: 'doc-writer',
|
|
6
|
+
description: 'Generates and improves documentation: JSDoc, README, API docs, and inline comments.',
|
|
7
|
+
systemPrompt: `You are a technical writer and documentation expert.
|
|
8
|
+
|
|
9
|
+
You can generate:
|
|
10
|
+
- **JSDoc / TSDoc** comments for functions, classes, and interfaces
|
|
11
|
+
- **README.md** files with usage examples, installation, and API reference
|
|
12
|
+
- **API documentation** in OpenAPI/Swagger format
|
|
13
|
+
- **Inline comments** explaining complex logic
|
|
14
|
+
- **Architecture decision records (ADRs)**
|
|
15
|
+
- **Changelog entries**
|
|
16
|
+
|
|
17
|
+
Guidelines:
|
|
18
|
+
- Write clear, concise documentation at the appropriate level for the audience
|
|
19
|
+
- Include code examples where helpful
|
|
20
|
+
- Document edge cases, errors, and limitations
|
|
21
|
+
- Use consistent terminology and style throughout
|
|
22
|
+
|
|
23
|
+
When generating documentation:
|
|
24
|
+
- Preserve all existing code logic unchanged
|
|
25
|
+
- Add documentation without breaking existing functionality
|
|
26
|
+
- Format output correctly for the target documentation system`,
|
|
27
|
+
examples: [
|
|
28
|
+
'Generate JSDoc comments for this TypeScript class',
|
|
29
|
+
'Write a README for my npm package',
|
|
30
|
+
'Document this REST API in OpenAPI format',
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
exports.testWriter = {
|
|
34
|
+
name: 'test-writer',
|
|
35
|
+
description: 'Generates comprehensive unit and integration tests with good coverage.',
|
|
36
|
+
systemPrompt: `You are an expert in software testing and test-driven development.
|
|
37
|
+
|
|
38
|
+
You write tests that are:
|
|
39
|
+
- **Comprehensive**: Cover happy paths, edge cases, and error conditions
|
|
40
|
+
- **Isolated**: Each test is independent with proper setup/teardown
|
|
41
|
+
- **Fast**: No unnecessary I/O or sleep calls
|
|
42
|
+
- **Readable**: Clear test names describe expected behavior
|
|
43
|
+
- **Maintainable**: Avoid brittle assertions that break on minor changes
|
|
44
|
+
|
|
45
|
+
Supported frameworks:
|
|
46
|
+
- Jest, Vitest (JavaScript/TypeScript)
|
|
47
|
+
- pytest (Python)
|
|
48
|
+
- JUnit (Java)
|
|
49
|
+
- Go testing package
|
|
50
|
+
- RSpec (Ruby)
|
|
51
|
+
|
|
52
|
+
For each test you write:
|
|
53
|
+
1. Group related tests in describe/suite blocks
|
|
54
|
+
2. Use AAA pattern: Arrange, Act, Assert
|
|
55
|
+
3. Mock external dependencies (HTTP, DB, file system)
|
|
56
|
+
4. Test both success and error paths
|
|
57
|
+
5. Include edge cases (null, empty, boundary values)
|
|
58
|
+
|
|
59
|
+
Provide the complete test file with all necessary imports.`,
|
|
60
|
+
examples: [
|
|
61
|
+
'Write unit tests for this UserService class',
|
|
62
|
+
'Generate integration tests for this Express API',
|
|
63
|
+
'Add edge case tests for this sorting function',
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
exports.refactor = {
|
|
67
|
+
name: 'refactor',
|
|
68
|
+
description: 'Suggests and applies structural refactoring while preserving functionality.',
|
|
69
|
+
systemPrompt: `You are a refactoring expert focused on improving code structure without changing behavior.
|
|
70
|
+
|
|
71
|
+
Refactoring techniques you apply:
|
|
72
|
+
- Extract Method/Function: Break large functions into smaller, focused ones
|
|
73
|
+
- Extract Class: Split classes with too many responsibilities
|
|
74
|
+
- Rename: Improve variable, function, and class names for clarity
|
|
75
|
+
- Move Code: Reorganize code into appropriate modules/files
|
|
76
|
+
- Replace Conditional with Polymorphism
|
|
77
|
+
- Introduce Design Patterns (Factory, Strategy, Observer, etc.)
|
|
78
|
+
- Remove Code Smells: Duplicate code, long methods, feature envy
|
|
79
|
+
|
|
80
|
+
Process:
|
|
81
|
+
1. Analyze the existing code structure
|
|
82
|
+
2. Identify what should be refactored and why
|
|
83
|
+
3. Provide the refactored code
|
|
84
|
+
4. Explain what changed and why it's better
|
|
85
|
+
|
|
86
|
+
Always preserve the existing behavior — refactoring is about structure, not functionality.
|
|
87
|
+
Provide the complete refactored files.`,
|
|
88
|
+
examples: [
|
|
89
|
+
'This function is 200 lines, can you break it up?',
|
|
90
|
+
'Refactor this class hierarchy using the Strategy pattern',
|
|
91
|
+
'This file has too many responsibilities, split it up',
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
exports.securityAudit = {
|
|
95
|
+
name: 'security-audit',
|
|
96
|
+
description: 'Scans code for security vulnerabilities with OWASP-aligned analysis.',
|
|
97
|
+
systemPrompt: `You are a cybersecurity expert performing a security audit on code.
|
|
98
|
+
|
|
99
|
+
You check for (aligned with OWASP Top 10 and common CVEs):
|
|
100
|
+
1. **Injection**: SQL, NoSQL, OS command, LDAP injection
|
|
101
|
+
2. **Authentication**: Broken auth, weak passwords, session issues
|
|
102
|
+
3. **Sensitive Data Exposure**: Unencrypted data, hardcoded secrets
|
|
103
|
+
4. **XXE**: XML external entity injection
|
|
104
|
+
5. **Broken Access Control**: Missing authorization checks, IDOR
|
|
105
|
+
6. **Security Misconfiguration**: Default passwords, verbose errors, open directories
|
|
106
|
+
7. **XSS**: Reflected, stored, DOM-based cross-site scripting
|
|
107
|
+
8. **Insecure Deserialization**
|
|
108
|
+
9. **Vulnerable Dependencies**: Known CVEs in packages
|
|
109
|
+
10. **Insufficient Logging**: Missing audit trails
|
|
110
|
+
|
|
111
|
+
Report format:
|
|
112
|
+
## Security Audit Report
|
|
113
|
+
|
|
114
|
+
### 🚨 Critical Vulnerabilities
|
|
115
|
+
[Immediate action required]
|
|
116
|
+
|
|
117
|
+
### ⚠️ High Severity
|
|
118
|
+
[Fix before deployment]
|
|
119
|
+
|
|
120
|
+
### 📋 Medium/Low Severity
|
|
121
|
+
[Address in upcoming sprint]
|
|
122
|
+
|
|
123
|
+
### ✅ Security Positives
|
|
124
|
+
[What the code does securely]
|
|
125
|
+
|
|
126
|
+
### Recommendations
|
|
127
|
+
[General security hardening suggestions]
|
|
128
|
+
|
|
129
|
+
Include specific line references and concrete remediation code for each finding.`,
|
|
130
|
+
examples: [
|
|
131
|
+
'Audit this login endpoint for security issues',
|
|
132
|
+
'Check my file upload handler for vulnerabilities',
|
|
133
|
+
'Review my JWT implementation for security flaws',
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=more-speckits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"more-speckits.js","sourceRoot":"","sources":["../../src/speckits/more-speckits.ts"],"names":[],"mappings":";;;AAEa,QAAA,SAAS,GAAY;IAChC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,qFAAqF;IAClG,YAAY,EAAE;;;;;;;;;;;;;;;;;;;8DAmB8C;IAC5D,QAAQ,EAAE;QACR,mDAAmD;QACnD,mCAAmC;QACnC,0CAA0C;KAC3C;CACF,CAAC;AAEW,QAAA,UAAU,GAAY;IACjC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,wEAAwE;IACrF,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;2DAuB2C;IACzD,QAAQ,EAAE;QACR,6CAA6C;QAC7C,iDAAiD;QACjD,+CAA+C;KAChD;CACF,CAAC;AAEW,QAAA,QAAQ,GAAY;IAC/B,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,6EAA6E;IAC1F,YAAY,EAAE;;;;;;;;;;;;;;;;;;uCAkBuB;IACrC,QAAQ,EAAE;QACR,kDAAkD;QAClD,0DAA0D;QAC1D,sDAAsD;KACvD;CACF,CAAC;AAEW,QAAA,aAAa,GAAY;IACpC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,sEAAsE;IACnF,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iFAgCiE;IAC/E,QAAQ,EAAE;QACR,+CAA+C;QAC/C,kDAAkD;QAClD,iDAAiD;KAClD;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vibe-coder.d.ts","sourceRoot":"","sources":["../../src/speckits/vibe-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,eAAO,MAAM,SAAS,EAAE,OA2BvB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vibeCoder = void 0;
|
|
4
|
+
exports.vibeCoder = {
|
|
5
|
+
name: 'vibe-coder',
|
|
6
|
+
description: 'AI pair programmer that generates, modifies, and refactors code based on natural-language prompts.',
|
|
7
|
+
systemPrompt: `You are an expert AI pair programmer — a "vibe coder". You help developers write, refactor, and improve code.
|
|
8
|
+
|
|
9
|
+
Your capabilities:
|
|
10
|
+
- Generate new code files and components
|
|
11
|
+
- Refactor existing code while maintaining functionality
|
|
12
|
+
- Explain complex code in plain language
|
|
13
|
+
- Suggest architectural improvements
|
|
14
|
+
- Write idiomatic code in any language
|
|
15
|
+
|
|
16
|
+
When you modify or create files, ALWAYS:
|
|
17
|
+
1. Clearly state which file you are creating/modifying
|
|
18
|
+
2. Provide the COMPLETE file content (not just the changed parts)
|
|
19
|
+
3. Explain your changes briefly
|
|
20
|
+
4. Wrap file content in a code block with the file path as the header:
|
|
21
|
+
\`\`\`language:path/to/file.ts
|
|
22
|
+
// complete file content
|
|
23
|
+
\`\`\`
|
|
24
|
+
|
|
25
|
+
Be concise but thorough. Ask clarifying questions if the request is ambiguous.`,
|
|
26
|
+
examples: [
|
|
27
|
+
'Create a REST API endpoint for user authentication',
|
|
28
|
+
'Refactor this function to use async/await',
|
|
29
|
+
'Add TypeScript types to this JavaScript file',
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=vibe-coder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vibe-coder.js","sourceRoot":"","sources":["../../src/speckits/vibe-coder.ts"],"names":[],"mappings":";;;AAEa,QAAA,SAAS,GAAY;IAChC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,oGAAoG;IACjH,YAAY,EAAE;;;;;;;;;;;;;;;;;;+EAkB+D;IAC7E,QAAQ,EAAE;QACR,oDAAoD;QACpD,2CAA2C;QAC3C,8CAA8C;KAC/C;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface AIAgentConfig {
|
|
2
|
+
provider: 'openai' | 'anthropic' | 'gemini';
|
|
3
|
+
model?: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
sessionDir?: string;
|
|
7
|
+
guardrails?: GuardrailConfig[];
|
|
8
|
+
logLevel?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GuardrailConfig {
|
|
11
|
+
id?: string;
|
|
12
|
+
type: 'allow-paths' | 'deny-paths' | 'deny-operations' | 'max-tokens' | 'style' | 'custom';
|
|
13
|
+
value: string | string[] | number;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function loadConfig(overrides?: Partial<AIAgentConfig>): AIAgentConfig;
|
|
17
|
+
export declare function saveConfig(config: Partial<AIAgentConfig>): void;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,iBAAiB,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC3F,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA6BD,wBAAgB,UAAU,CAAC,SAAS,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,aAAa,CAkDhF;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAkB/D"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.loadConfig = loadConfig;
|
|
7
|
+
exports.saveConfig = saveConfig;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const os_1 = __importDefault(require("os"));
|
|
11
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
12
|
+
const DEFAULT_CONFIG = {
|
|
13
|
+
provider: 'openai',
|
|
14
|
+
model: undefined,
|
|
15
|
+
port: 3000,
|
|
16
|
+
sessionDir: path_1.default.join(os_1.default.homedir(), '.fusion-agent', 'sessions'),
|
|
17
|
+
guardrails: [],
|
|
18
|
+
logLevel: 'info',
|
|
19
|
+
};
|
|
20
|
+
function getConfigPaths() {
|
|
21
|
+
return [
|
|
22
|
+
path_1.default.join(process.cwd(), '.fusion-agent.json'),
|
|
23
|
+
path_1.default.join(process.cwd(), '.fusion-agent.yaml'),
|
|
24
|
+
path_1.default.join(os_1.default.homedir(), '.fusion-agent', 'config.json'),
|
|
25
|
+
path_1.default.join(os_1.default.homedir(), '.fusion-agent', 'config.yaml'),
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
function parseConfigFile(filePath) {
|
|
29
|
+
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
30
|
+
const content = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
31
|
+
if (ext === '.yaml' || ext === '.yml') {
|
|
32
|
+
return js_yaml_1.default.load(content);
|
|
33
|
+
}
|
|
34
|
+
return JSON.parse(content);
|
|
35
|
+
}
|
|
36
|
+
function loadConfig(overrides = {}) {
|
|
37
|
+
let fileConfig = {};
|
|
38
|
+
for (const configPath of getConfigPaths()) {
|
|
39
|
+
if (fs_1.default.existsSync(configPath)) {
|
|
40
|
+
try {
|
|
41
|
+
fileConfig = parseConfigFile(configPath);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// ignore parse errors, try next
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const envConfig = {};
|
|
50
|
+
if (process.env.AI_PROVIDER) {
|
|
51
|
+
envConfig.provider = process.env.AI_PROVIDER;
|
|
52
|
+
}
|
|
53
|
+
if (process.env.AI_MODEL)
|
|
54
|
+
envConfig.model = process.env.AI_MODEL;
|
|
55
|
+
if (process.env.OPENAI_API_KEY && (!envConfig.provider || envConfig.provider === 'openai')) {
|
|
56
|
+
envConfig.apiKey = process.env.OPENAI_API_KEY;
|
|
57
|
+
}
|
|
58
|
+
if (process.env.ANTHROPIC_API_KEY && envConfig.provider === 'anthropic') {
|
|
59
|
+
envConfig.apiKey = process.env.ANTHROPIC_API_KEY;
|
|
60
|
+
}
|
|
61
|
+
if (process.env.GEMINI_API_KEY && envConfig.provider === 'gemini') {
|
|
62
|
+
envConfig.apiKey = process.env.GEMINI_API_KEY;
|
|
63
|
+
}
|
|
64
|
+
if (process.env.AI_AGENT_PORT)
|
|
65
|
+
envConfig.port = parseInt(process.env.AI_AGENT_PORT, 10);
|
|
66
|
+
const merged = {
|
|
67
|
+
...DEFAULT_CONFIG,
|
|
68
|
+
...fileConfig,
|
|
69
|
+
...envConfig,
|
|
70
|
+
...overrides,
|
|
71
|
+
};
|
|
72
|
+
// Resolve API key from environment if not set
|
|
73
|
+
if (!merged.apiKey) {
|
|
74
|
+
if (merged.provider === 'openai')
|
|
75
|
+
merged.apiKey = process.env.OPENAI_API_KEY;
|
|
76
|
+
else if (merged.provider === 'anthropic')
|
|
77
|
+
merged.apiKey = process.env.ANTHROPIC_API_KEY;
|
|
78
|
+
else if (merged.provider === 'gemini')
|
|
79
|
+
merged.apiKey = process.env.GEMINI_API_KEY;
|
|
80
|
+
}
|
|
81
|
+
// Ensure session dir exists
|
|
82
|
+
if (merged.sessionDir && !fs_1.default.existsSync(merged.sessionDir)) {
|
|
83
|
+
fs_1.default.mkdirSync(merged.sessionDir, { recursive: true });
|
|
84
|
+
}
|
|
85
|
+
return merged;
|
|
86
|
+
}
|
|
87
|
+
function saveConfig(config) {
|
|
88
|
+
const configDir = path_1.default.join(os_1.default.homedir(), '.fusion-agent');
|
|
89
|
+
if (!fs_1.default.existsSync(configDir)) {
|
|
90
|
+
fs_1.default.mkdirSync(configDir, { recursive: true });
|
|
91
|
+
}
|
|
92
|
+
const configPath = path_1.default.join(configDir, 'config.json');
|
|
93
|
+
let existing = {};
|
|
94
|
+
if (fs_1.default.existsSync(configPath)) {
|
|
95
|
+
try {
|
|
96
|
+
existing = JSON.parse(fs_1.default.readFileSync(configPath, 'utf-8'));
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// ignore
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const merged = { ...existing, ...config };
|
|
103
|
+
// Never save raw API keys to config file
|
|
104
|
+
delete merged.apiKey;
|
|
105
|
+
fs_1.default.writeFileSync(configPath, JSON.stringify(merged, null, 2), 'utf-8');
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":";;;;;AAiDA,gCAkDC;AAED,gCAkBC;AAvHD,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,sDAA2B;AAmB3B,MAAM,cAAc,GAAkB;IACpC,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,CAAC;IAChE,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE,MAAM;CACjB,CAAC;AAEF,SAAS,cAAc;IACrB,OAAO;QACL,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QAC9C,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC;QAC9C,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,aAAa,CAAC;QACvD,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,aAAa,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,GAAG,GAAG,cAAI,CA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C,MAA8B;IACvD,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,eAAe,CAAC,CAAC;IAC3D,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,YAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACvD,IAAI,QAAQ,GAA2B,EAAE,CAAC;IAC1C,IAAI,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1C,yCAAyC;IACzC,OAAO,MAAM,CAAC,MAAM,CAAC;IACrB,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FileChange {
|
|
2
|
+
filePath: string;
|
|
3
|
+
originalContent: string;
|
|
4
|
+
newContent: string;
|
|
5
|
+
patch: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function readFile(filePath: string): string;
|
|
8
|
+
export declare function writeFile(filePath: string, content: string): void;
|
|
9
|
+
export declare function fileExists(filePath: string): boolean;
|
|
10
|
+
export declare function createChange(filePath: string, newContent: string): FileChange;
|
|
11
|
+
export declare function applyChange(change: FileChange): void;
|
|
12
|
+
export declare function revertChange(change: FileChange): void;
|
|
13
|
+
export declare function getDirectoryStructure(dir: string, maxDepth?: number, currentDepth?: number, ignore?: string[]): string;
|
|
14
|
+
export declare function gatherProjectContext(projectDir: string, maxFiles?: number, maxFileSize?: number): string;
|
|
15
|
+
//# sourceMappingURL=file-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-ops.d.ts","sourceRoot":"","sources":["../../src/utils/file-ops.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,CAI7E;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEpD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CASrD;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,SAAI,EACZ,YAAY,SAAI,EAChB,MAAM,WAAmE,GACxE,MAAM,CAqBR;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,QAAQ,SAAK,EACb,WAAW,SAAO,GACjB,MAAM,CAgCR"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.readFile = readFile;
|
|
7
|
+
exports.writeFile = writeFile;
|
|
8
|
+
exports.fileExists = fileExists;
|
|
9
|
+
exports.createChange = createChange;
|
|
10
|
+
exports.applyChange = applyChange;
|
|
11
|
+
exports.revertChange = revertChange;
|
|
12
|
+
exports.getDirectoryStructure = getDirectoryStructure;
|
|
13
|
+
exports.gatherProjectContext = gatherProjectContext;
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const diff_1 = require("diff");
|
|
17
|
+
function readFile(filePath) {
|
|
18
|
+
return fs_1.default.readFileSync(filePath, 'utf-8');
|
|
19
|
+
}
|
|
20
|
+
function writeFile(filePath, content) {
|
|
21
|
+
const dir = path_1.default.dirname(filePath);
|
|
22
|
+
if (!fs_1.default.existsSync(dir)) {
|
|
23
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
fs_1.default.writeFileSync(filePath, content, 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
function fileExists(filePath) {
|
|
28
|
+
return fs_1.default.existsSync(filePath);
|
|
29
|
+
}
|
|
30
|
+
function createChange(filePath, newContent) {
|
|
31
|
+
const originalContent = fileExists(filePath) ? readFile(filePath) : '';
|
|
32
|
+
const patch = (0, diff_1.createPatch)(filePath, originalContent, newContent);
|
|
33
|
+
return { filePath, originalContent, newContent, patch };
|
|
34
|
+
}
|
|
35
|
+
function applyChange(change) {
|
|
36
|
+
writeFile(change.filePath, change.newContent);
|
|
37
|
+
}
|
|
38
|
+
function revertChange(change) {
|
|
39
|
+
if (change.originalContent === '') {
|
|
40
|
+
// File didn't exist before — delete it
|
|
41
|
+
if (fileExists(change.filePath)) {
|
|
42
|
+
fs_1.default.unlinkSync(change.filePath);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
writeFile(change.filePath, change.originalContent);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getDirectoryStructure(dir, maxDepth = 3, currentDepth = 0, ignore = ['node_modules', '.git', 'dist', '.next', '__pycache__', '.env']) {
|
|
50
|
+
if (currentDepth > maxDepth)
|
|
51
|
+
return '';
|
|
52
|
+
const items = [];
|
|
53
|
+
let entries;
|
|
54
|
+
try {
|
|
55
|
+
entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (ignore.includes(entry.name))
|
|
62
|
+
continue;
|
|
63
|
+
const indent = ' '.repeat(currentDepth);
|
|
64
|
+
if (entry.isDirectory()) {
|
|
65
|
+
items.push(`${indent}${entry.name}/`);
|
|
66
|
+
const sub = getDirectoryStructure(path_1.default.join(dir, entry.name), maxDepth, currentDepth + 1, ignore);
|
|
67
|
+
if (sub)
|
|
68
|
+
items.push(sub);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
items.push(`${indent}${entry.name}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return items.join('\n');
|
|
75
|
+
}
|
|
76
|
+
function gatherProjectContext(projectDir, maxFiles = 10, maxFileSize = 8000) {
|
|
77
|
+
const structure = getDirectoryStructure(projectDir);
|
|
78
|
+
const contextParts = [`# Project Structure\n\`\`\`\n${structure}\n\`\`\``];
|
|
79
|
+
// Read key files for context
|
|
80
|
+
const keyFiles = [
|
|
81
|
+
'package.json',
|
|
82
|
+
'tsconfig.json',
|
|
83
|
+
'pyproject.toml',
|
|
84
|
+
'requirements.txt',
|
|
85
|
+
'Cargo.toml',
|
|
86
|
+
'go.mod',
|
|
87
|
+
'README.md',
|
|
88
|
+
];
|
|
89
|
+
let filesRead = 0;
|
|
90
|
+
for (const kf of keyFiles) {
|
|
91
|
+
if (filesRead >= maxFiles)
|
|
92
|
+
break;
|
|
93
|
+
const fp = path_1.default.join(projectDir, kf);
|
|
94
|
+
if (fileExists(fp)) {
|
|
95
|
+
try {
|
|
96
|
+
const content = readFile(fp);
|
|
97
|
+
if (content.length <= maxFileSize) {
|
|
98
|
+
contextParts.push(`# ${kf}\n\`\`\`\n${content}\n\`\`\``);
|
|
99
|
+
filesRead++;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// skip unreadable files
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return contextParts.join('\n\n');
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=file-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-ops.js","sourceRoot":"","sources":["../../src/utils/file-ops.ts"],"names":[],"mappings":";;;;;AAWA,4BAEC;AAED,8BAMC;AAED,gCAEC;AAED,oCAIC;AAED,kCAEC;AAED,oCASC;AAED,sDA0BC;AAED,oDAoCC;AAhHD,4CAAoB;AACpB,gDAAwB;AACxB,+BAAmC;AASnC,SAAgB,QAAQ,CAAC,QAAgB;IACvC,OAAO,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,SAAS,CAAC,QAAgB,EAAE,OAAe;IACzD,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,YAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,UAAU,CAAC,QAAgB;IACzC,OAAO,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAA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E,CAAC;QAC1B,IAAI,SAAS,IAAI,QAAQ;YAAE,MAAM;QACjC,MAAM,EAAE,GAAG,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACrC,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;gBAC7B,IAAI,OAAO,CAAC,MAAM,IAAI,WAAW,EAAE,CAAC;oBAClC,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,OAAO,UAAU,CAAC,CAAC;oBACzD,SAAS,EAAE,CAAC;gBACd,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,wBAAwB;YAC1B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAQ9B,eAAO,MAAM,MAAM,gBAWjB,CAAC;AAEH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logger = void 0;
|
|
7
|
+
exports.setLogLevel = setLogLevel;
|
|
8
|
+
const winston_1 = __importDefault(require("winston"));
|
|
9
|
+
const { combine, timestamp, printf, colorize } = winston_1.default.format;
|
|
10
|
+
const consoleFormat = printf(({ level, message, timestamp: ts }) => {
|
|
11
|
+
return `${ts} [${level}] ${message}`;
|
|
12
|
+
});
|
|
13
|
+
exports.logger = winston_1.default.createLogger({
|
|
14
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
15
|
+
format: combine(timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), consoleFormat),
|
|
16
|
+
transports: [
|
|
17
|
+
new winston_1.default.transports.Console({
|
|
18
|
+
format: combine(colorize(), timestamp({ format: 'HH:mm:ss' }), consoleFormat),
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
});
|
|
22
|
+
function setLogLevel(level) {
|
|
23
|
+
exports.logger.level = level;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;;;;AAqBA,kCAEC;AAvBD,sDAA8B;AAE9B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAO,CAAC,MAAM,CAAC;AAEhE,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE;IACjE,OAAO,GAAG,EAAE,KAAK,KAAK,KAAK,OAAO,EAAE,CAAC;AACvC,CAAC,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,iBAAO,CAAC,YAAY,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;IACtC,MAAM,EAAE,OAAO,CACb,SAAS,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC,EAC5C,aAAa,CACd;IACD,UAAU,EAAE;QACV,IAAI,iBAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,aAAa,CAAC;SAC9E,CAAC;KACH;CACF,CAAC,CAAC;AAEH,SAAgB,WAAW,CAAC,KAAa;IACvC,cAAM,CAAC,KAAK,GAAG,KAAK,CAAC;AACvB,CAAC"}
|