@vfarcic/dot-ai 0.5.1 → 0.7.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/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/{src/cli.ts → dist/cli.js} +19 -26
- package/dist/core/claude.d.ts +42 -0
- package/dist/core/claude.d.ts.map +1 -0
- package/dist/core/claude.js +229 -0
- package/dist/core/deploy-operation.d.ts +38 -0
- package/dist/core/deploy-operation.d.ts.map +1 -0
- package/dist/core/deploy-operation.js +101 -0
- package/dist/core/discovery.d.ts +162 -0
- package/dist/core/discovery.d.ts.map +1 -0
- package/dist/core/discovery.js +758 -0
- package/dist/core/error-handling.d.ts +167 -0
- package/dist/core/error-handling.d.ts.map +1 -0
- package/dist/core/error-handling.js +399 -0
- package/dist/core/index.d.ts +42 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +123 -0
- package/dist/core/kubernetes-utils.d.ts +38 -0
- package/dist/core/kubernetes-utils.d.ts.map +1 -0
- package/dist/core/kubernetes-utils.js +177 -0
- package/dist/core/memory.d.ts +45 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +113 -0
- package/dist/core/schema.d.ts +187 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +655 -0
- package/dist/core/session-utils.d.ts +29 -0
- package/dist/core/session-utils.d.ts.map +1 -0
- package/dist/core/session-utils.js +121 -0
- package/dist/core/workflow.d.ts +70 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js +161 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/interfaces/cli.d.ts +74 -0
- package/dist/interfaces/cli.d.ts.map +1 -0
- package/dist/interfaces/cli.js +769 -0
- package/dist/interfaces/mcp.d.ts +30 -0
- package/dist/interfaces/mcp.d.ts.map +1 -0
- package/dist/interfaces/mcp.js +105 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +151 -0
- package/dist/tools/answer-question.d.ts +27 -0
- package/dist/tools/answer-question.d.ts.map +1 -0
- package/dist/tools/answer-question.js +696 -0
- package/dist/tools/choose-solution.d.ts +23 -0
- package/dist/tools/choose-solution.d.ts.map +1 -0
- package/dist/tools/choose-solution.js +171 -0
- package/dist/tools/deploy-manifests.d.ts +25 -0
- package/dist/tools/deploy-manifests.d.ts.map +1 -0
- package/dist/tools/deploy-manifests.js +74 -0
- package/dist/tools/generate-manifests.d.ts +23 -0
- package/dist/tools/generate-manifests.d.ts.map +1 -0
- package/dist/tools/generate-manifests.js +424 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +34 -0
- package/dist/tools/recommend.d.ts +23 -0
- package/dist/tools/recommend.d.ts.map +1 -0
- package/dist/tools/recommend.js +332 -0
- package/package.json +124 -2
- package/.claude/commands/context-load.md +0 -11
- package/.claude/commands/context-save.md +0 -16
- package/.claude/commands/prd-done.md +0 -115
- package/.claude/commands/prd-get.md +0 -25
- package/.claude/commands/prd-start.md +0 -87
- package/.claude/commands/task-done.md +0 -77
- package/.claude/commands/tests-reminder.md +0 -32
- package/.claude/settings.local.json +0 -20
- package/.eslintrc.json +0 -25
- package/.github/workflows/ci.yml +0 -170
- package/.prettierrc.json +0 -10
- package/.teller.yml +0 -8
- package/CLAUDE.md +0 -162
- package/assets/images/logo.png +0 -0
- package/bin/dot-ai.ts +0 -47
- package/bin.js +0 -19
- package/destroy.sh +0 -45
- package/devbox.json +0 -13
- package/devbox.lock +0 -225
- package/docs/API.md +0 -449
- package/docs/CONTEXT.md +0 -49
- package/docs/DEVELOPMENT.md +0 -203
- package/docs/NEXT_STEPS.md +0 -97
- package/docs/STAGE_BASED_API.md +0 -97
- package/docs/cli-guide.md +0 -798
- package/docs/design.md +0 -750
- package/docs/discovery-engine.md +0 -515
- package/docs/error-handling.md +0 -429
- package/docs/function-registration.md +0 -157
- package/docs/mcp-guide.md +0 -416
- package/renovate.json +0 -51
- package/setup.sh +0 -111
- package/src/core/claude.ts +0 -280
- package/src/core/deploy-operation.ts +0 -127
- package/src/core/discovery.ts +0 -900
- package/src/core/error-handling.ts +0 -562
- package/src/core/index.ts +0 -143
- package/src/core/kubernetes-utils.ts +0 -218
- package/src/core/memory.ts +0 -148
- package/src/core/schema.ts +0 -830
- package/src/core/session-utils.ts +0 -97
- package/src/core/workflow.ts +0 -234
- package/src/index.ts +0 -18
- package/src/interfaces/cli.ts +0 -872
- package/src/interfaces/mcp.ts +0 -183
- package/src/mcp/server.ts +0 -131
- package/src/tools/answer-question.ts +0 -807
- package/src/tools/choose-solution.ts +0 -169
- package/src/tools/deploy-manifests.ts +0 -94
- package/src/tools/generate-manifests.ts +0 -502
- package/src/tools/index.ts +0 -41
- package/src/tools/recommend.ts +0 -370
- package/tests/__mocks__/@kubernetes/client-node.ts +0 -106
- package/tests/build-system.test.ts +0 -345
- package/tests/configuration.test.ts +0 -226
- package/tests/core/deploy-operation.test.ts +0 -38
- package/tests/core/discovery.test.ts +0 -1648
- package/tests/core/error-handling.test.ts +0 -632
- package/tests/core/schema.test.ts +0 -1658
- package/tests/core/session-utils.test.ts +0 -245
- package/tests/core.test.ts +0 -439
- package/tests/fixtures/configmap-no-labels.yaml +0 -8
- package/tests/fixtures/crossplane-app-configuration.yaml +0 -6
- package/tests/fixtures/crossplane-providers.yaml +0 -45
- package/tests/fixtures/crossplane-rbac.yaml +0 -48
- package/tests/fixtures/invalid-configmap.yaml +0 -8
- package/tests/fixtures/invalid-deployment.yaml +0 -17
- package/tests/fixtures/test-deployment.yaml +0 -28
- package/tests/fixtures/valid-configmap.yaml +0 -15
- package/tests/infrastructure.test.ts +0 -426
- package/tests/interfaces/cli.test.ts +0 -1036
- package/tests/interfaces/mcp.test.ts +0 -139
- package/tests/kubernetes-utils.test.ts +0 -200
- package/tests/mcp/server.test.ts +0 -126
- package/tests/setup.ts +0 -31
- package/tests/tools/answer-question.test.ts +0 -367
- package/tests/tools/choose-solution.test.ts +0 -481
- package/tests/tools/deploy-manifests.test.ts +0 -185
- package/tests/tools/generate-manifests.test.ts +0 -441
- package/tests/tools/index.test.ts +0 -111
- package/tests/tools/recommend.test.ts +0 -180
- package/tsconfig.json +0 -34
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for Recommend Tool
|
|
3
|
-
*
|
|
4
|
-
* Tests the workflow guidance improvements for the recommend tool
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
RECOMMEND_TOOL_NAME,
|
|
9
|
-
RECOMMEND_TOOL_DESCRIPTION,
|
|
10
|
-
RECOMMEND_TOOL_INPUT_SCHEMA,
|
|
11
|
-
handleRecommendTool
|
|
12
|
-
} from '../../src/tools/recommend';
|
|
13
|
-
import { DotAI } from '../../src/core';
|
|
14
|
-
import { ResourceRecommender } from '../../src/core/schema';
|
|
15
|
-
|
|
16
|
-
// Mock dependencies
|
|
17
|
-
jest.mock('../../src/core');
|
|
18
|
-
jest.mock('../../src/core/schema');
|
|
19
|
-
jest.mock('../../src/core/error-handling');
|
|
20
|
-
jest.mock('../../src/core/claude');
|
|
21
|
-
|
|
22
|
-
describe('Recommend Tool', () => {
|
|
23
|
-
describe('Tool Metadata', () => {
|
|
24
|
-
test('should have essential properties only', () => {
|
|
25
|
-
expect(RECOMMEND_TOOL_NAME).toBe('recommend');
|
|
26
|
-
expect(RECOMMEND_TOOL_DESCRIPTION).toContain('Deploy, create, run, or setup applications');
|
|
27
|
-
expect(RECOMMEND_TOOL_INPUT_SCHEMA).toBeDefined();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('should have concise user-facing description', () => {
|
|
31
|
-
expect(RECOMMEND_TOOL_DESCRIPTION).toContain('Deploy, create, run, or setup applications');
|
|
32
|
-
expect(RECOMMEND_TOOL_DESCRIPTION).toContain('Ask the user to describe their application first');
|
|
33
|
-
expect(RECOMMEND_TOOL_DESCRIPTION.length).toBeLessThan(200); // Should be concise
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('should have valid input schema', () => {
|
|
37
|
-
expect(RECOMMEND_TOOL_INPUT_SCHEMA.intent).toBeDefined();
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('Tool Handler - MCP Connectivity Fix Verification', () => {
|
|
42
|
-
test('should verify the fix: function parameters passed correctly', () => {
|
|
43
|
-
// This test verifies that our MCP connectivity fix is in place
|
|
44
|
-
// The fix changed from passing raw data to passing functions
|
|
45
|
-
|
|
46
|
-
// Read the source code to verify the fix
|
|
47
|
-
const fs = require('fs');
|
|
48
|
-
const path = require('path');
|
|
49
|
-
const sourceCode = fs.readFileSync(
|
|
50
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
51
|
-
'utf8'
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
// Verify the fix: discoverResourcesFn should be defined as a function
|
|
55
|
-
expect(sourceCode).toContain('const discoverResourcesFn = async () => {');
|
|
56
|
-
expect(sourceCode).toContain('return await dotAI.discovery.discoverResources();');
|
|
57
|
-
|
|
58
|
-
// Verify the function is passed to findBestSolutions (not raw data)
|
|
59
|
-
expect(sourceCode).toContain('discoverResourcesFn,');
|
|
60
|
-
expect(sourceCode).toContain('explainResourceFn');
|
|
61
|
-
|
|
62
|
-
// Verify we're not passing raw data anymore (the old broken pattern)
|
|
63
|
-
expect(sourceCode).not.toContain('await dotAI.discovery.discoverResources(),');
|
|
64
|
-
expect(sourceCode).not.toContain('availableResources,'); // Old variable name
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('should confirm CLI and MCP patterns now match', () => {
|
|
68
|
-
// Verify both CLI and MCP use the same pattern for calling ResourceRecommender
|
|
69
|
-
const fs = require('fs');
|
|
70
|
-
const path = require('path');
|
|
71
|
-
|
|
72
|
-
const mcpCode = fs.readFileSync(
|
|
73
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
74
|
-
'utf8'
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const cliCode = fs.readFileSync(
|
|
78
|
-
path.join(__dirname, '../../src/interfaces/cli.ts'),
|
|
79
|
-
'utf8'
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// Both should use function-based approach
|
|
83
|
-
expect(mcpCode).toContain('const discoverResourcesFn = async () => {');
|
|
84
|
-
expect(cliCode).toContain('findBestSolutions(intent, discoverResourcesFn, explainResourceFn)'); // CLI uses same pattern
|
|
85
|
-
|
|
86
|
-
// MCP should no longer have the broken pattern
|
|
87
|
-
expect(mcpCode).not.toContain('const availableResources = await dotAI.discovery.discoverResources();');
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
describe('Intent Validation', () => {
|
|
92
|
-
test('should include intent validation in source code', () => {
|
|
93
|
-
// Verify intent validation is implemented in the source
|
|
94
|
-
const fs = require('fs');
|
|
95
|
-
const path = require('path');
|
|
96
|
-
const sourceCode = fs.readFileSync(
|
|
97
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
98
|
-
'utf8'
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// Check that validation function exists
|
|
102
|
-
expect(sourceCode).toContain('async function validateIntentWithAI');
|
|
103
|
-
expect(sourceCode).toContain('intent-validation.md');
|
|
104
|
-
|
|
105
|
-
// Check that validation is called in the handler
|
|
106
|
-
expect(sourceCode).toContain('await validateIntentWithAI(args.intent, claudeIntegration)');
|
|
107
|
-
expect(sourceCode).toContain('Intent needs more specificity');
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
test('should validate prompt file exists', () => {
|
|
111
|
-
const fs = require('fs');
|
|
112
|
-
const path = require('path');
|
|
113
|
-
|
|
114
|
-
const promptPath = path.join(__dirname, '../../prompts/intent-validation.md');
|
|
115
|
-
expect(fs.existsSync(promptPath)).toBe(true);
|
|
116
|
-
|
|
117
|
-
const promptContent = fs.readFileSync(promptPath, 'utf8');
|
|
118
|
-
expect(promptContent).toContain('Intent Validation for Kubernetes Deployment Recommendations');
|
|
119
|
-
expect(promptContent).toContain('{intent}');
|
|
120
|
-
expect(promptContent).toContain('isSpecific');
|
|
121
|
-
expect(promptContent).toContain('suggestions');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('should handle AI validation gracefully on service failures', () => {
|
|
125
|
-
const fs = require('fs');
|
|
126
|
-
const path = require('path');
|
|
127
|
-
const sourceCode = fs.readFileSync(
|
|
128
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
129
|
-
'utf8'
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
// Verify error handling continues on AI service issues
|
|
133
|
-
expect(sourceCode).toContain('console.warn(\'Intent validation failed, continuing with original intent:\', error);');
|
|
134
|
-
expect(sourceCode).toContain('logger.warn(\'Intent validation failed, continuing with recommendation\'');
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
test('should validate proper error structure for vague intents', () => {
|
|
138
|
-
const fs = require('fs');
|
|
139
|
-
const path = require('path');
|
|
140
|
-
const sourceCode = fs.readFileSync(
|
|
141
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
142
|
-
'utf8'
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
// Check that validation errors are properly structured
|
|
146
|
-
expect(sourceCode).toContain('ErrorCategory.VALIDATION');
|
|
147
|
-
expect(sourceCode).toContain('ErrorSeverity.MEDIUM');
|
|
148
|
-
expect(sourceCode).toContain('intent_validation');
|
|
149
|
-
expect(sourceCode).toContain('Provide more specific details about your deployment');
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
test('should include ClaudeIntegration import', () => {
|
|
153
|
-
const fs = require('fs');
|
|
154
|
-
const path = require('path');
|
|
155
|
-
const sourceCode = fs.readFileSync(
|
|
156
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
157
|
-
'utf8'
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
expect(sourceCode).toContain('import { ClaudeIntegration } from \'../core/claude\'');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
test('should validate before expensive resource discovery', () => {
|
|
164
|
-
const fs = require('fs');
|
|
165
|
-
const path = require('path');
|
|
166
|
-
const sourceCode = fs.readFileSync(
|
|
167
|
-
path.join(__dirname, '../../src/tools/recommend.ts'),
|
|
168
|
-
'utf8'
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
// Validation should happen before ResourceRecommender initialization
|
|
172
|
-
const validationIndex = sourceCode.indexOf('await validateIntentWithAI');
|
|
173
|
-
const recommenderIndex = sourceCode.indexOf('new ResourceRecommender');
|
|
174
|
-
|
|
175
|
-
expect(validationIndex).toBeGreaterThan(-1);
|
|
176
|
-
expect(recommenderIndex).toBeGreaterThan(-1);
|
|
177
|
-
expect(validationIndex).toBeLessThan(recommenderIndex);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2022"],
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"strictNullChecks": true,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true,
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"declarationMap": true,
|
|
19
|
-
"sourceMap": true,
|
|
20
|
-
"removeComments": false,
|
|
21
|
-
"experimentalDecorators": true,
|
|
22
|
-
"emitDecoratorMetadata": true
|
|
23
|
-
},
|
|
24
|
-
"include": [
|
|
25
|
-
"src/**/*"
|
|
26
|
-
],
|
|
27
|
-
"exclude": [
|
|
28
|
-
"node_modules",
|
|
29
|
-
"dist",
|
|
30
|
-
"coverage",
|
|
31
|
-
"**/*.test.ts",
|
|
32
|
-
"**/*.spec.ts"
|
|
33
|
-
]
|
|
34
|
-
}
|