@claudetools/tools 0.9.0 → 0.9.2
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.js +9 -1
- package/dist/codedna/__tests__/examples/mongoose-example.d.ts +6 -0
- package/dist/codedna/__tests__/examples/mongoose-example.js +163 -0
- package/dist/codedna/__tests__/fixtures/typeorm-production-test.d.ts +1 -0
- package/dist/codedna/__tests__/fixtures/typeorm-production-test.js +231 -0
- package/dist/codedna/__tests__/fixtures/typeorm-test.d.ts +1 -0
- package/dist/codedna/__tests__/fixtures/typeorm-test.js +124 -0
- package/dist/codedna/__tests__/laravel-output-review.d.ts +1 -0
- package/dist/codedna/__tests__/laravel-output-review.js +249 -0
- package/dist/codedna/__tests__/mongoose-output-test.d.ts +1 -0
- package/dist/codedna/__tests__/mongoose-output-test.js +178 -0
- package/dist/codedna/examples/radix-example.d.ts +2 -0
- package/dist/codedna/examples/radix-example.js +259 -0
- package/dist/codedna/index.d.ts +5 -3
- package/dist/codedna/index.js +6 -3
- package/dist/codedna/kappa-ast.d.ts +143 -5
- package/dist/codedna/kappa-drizzle-generator.js +8 -5
- package/dist/codedna/kappa-gofiber-generator.d.ts +65 -0
- package/dist/codedna/kappa-gofiber-generator.js +587 -0
- package/dist/codedna/kappa-laravel-generator.d.ts +68 -0
- package/dist/codedna/kappa-laravel-generator.js +741 -0
- package/dist/codedna/kappa-lexer.d.ts +44 -0
- package/dist/codedna/kappa-lexer.js +124 -0
- package/dist/codedna/kappa-mantine-generator.d.ts +65 -0
- package/dist/codedna/kappa-mantine-generator.js +518 -0
- package/dist/codedna/kappa-mongoose-generator.d.ts +44 -0
- package/dist/codedna/kappa-mongoose-generator.js +442 -0
- package/dist/codedna/kappa-parser.d.ts +43 -1
- package/dist/codedna/kappa-parser.js +601 -0
- package/dist/codedna/kappa-radix-generator.d.ts +61 -0
- package/dist/codedna/kappa-radix-generator.js +566 -0
- package/dist/codedna/kappa-typeorm-generator.d.ts +59 -0
- package/dist/codedna/kappa-typeorm-generator.js +723 -0
- package/dist/codedna/kappa-vitest-generator.d.ts +85 -0
- package/dist/codedna/kappa-vitest-generator.js +739 -0
- package/dist/codedna/parser.js +26 -1
- package/dist/codegen/cloud-client.d.ts +160 -0
- package/dist/codegen/cloud-client.js +195 -0
- package/dist/codegen/codegen-tool.d.ts +35 -0
- package/dist/codegen/codegen-tool.js +312 -0
- package/dist/codegen/field-inference.d.ts +24 -0
- package/dist/codegen/field-inference.js +101 -0
- package/dist/codegen/form-parser.d.ts +13 -0
- package/dist/codegen/form-parser.js +186 -0
- package/dist/codegen/index.d.ts +2 -0
- package/dist/codegen/index.js +4 -0
- package/dist/codegen/natural-parser.d.ts +50 -0
- package/dist/codegen/natural-parser.js +769 -0
- package/dist/handlers/codedna-handlers.d.ts +1 -1
- package/dist/handlers/codegen-handlers.d.ts +20 -0
- package/dist/handlers/codegen-handlers.js +60 -0
- package/dist/handlers/kappa-handlers.d.ts +97 -0
- package/dist/handlers/kappa-handlers.js +408 -0
- package/dist/handlers/tool-handlers.js +124 -221
- package/dist/helpers/api-client.js +48 -3
- package/dist/helpers/compact-formatter.d.ts +9 -2
- package/dist/helpers/compact-formatter.js +26 -2
- package/dist/helpers/config.d.ts +7 -2
- package/dist/helpers/config.js +25 -10
- package/dist/helpers/session-validation.d.ts +1 -1
- package/dist/helpers/session-validation.js +2 -4
- package/dist/helpers/tasks.d.ts +21 -0
- package/dist/helpers/tasks.js +52 -0
- package/dist/helpers/workers.d.ts +1 -1
- package/dist/helpers/workers.js +19 -19
- package/dist/setup.d.ts +1 -0
- package/dist/setup.js +228 -3
- package/dist/templates/claude-md.d.ts +1 -1
- package/dist/templates/claude-md.js +37 -152
- package/dist/templates/orchestrator-prompt.d.ts +2 -2
- package/dist/templates/orchestrator-prompt.js +31 -38
- package/dist/templates/self-critique.d.ts +50 -0
- package/dist/templates/self-critique.js +209 -0
- package/dist/templates/worker-prompt.d.ts +3 -3
- package/dist/templates/worker-prompt.js +18 -18
- package/dist/tools.js +77 -413
- package/docs/codedna/generator-testing-summary.md +205 -0
- package/docs/codedna/radix-ui-generator.md +478 -0
- package/docs/kappa-gofiber-generator.md +274 -0
- package/docs/kappa-laravel-fixes.md +172 -0
- package/docs/kappa-mongoose-generator.md +322 -0
- package/docs/kappa-vitest-generator.md +337 -0
- package/package.json +1 -1
- package/dist/context/deduplication.test.d.ts +0 -6
- package/dist/context/deduplication.test.js +0 -84
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for DeduplicationTracker
|
|
3
|
-
*
|
|
4
|
-
* These tests demonstrate the usage and verify the logic.
|
|
5
|
-
*/
|
|
6
|
-
import { createDeduplicationTracker } from './deduplication.js';
|
|
7
|
-
// Example usage demonstration
|
|
8
|
-
function demonstrateUsage() {
|
|
9
|
-
const tracker = createDeduplicationTracker(10); // 10-turn freshness threshold
|
|
10
|
-
console.log('\n=== Deduplication Tracker Demo ===\n');
|
|
11
|
-
// Scenario 1: First injection
|
|
12
|
-
console.log('Turn 1: Check if fact_123 should be injected');
|
|
13
|
-
console.log('Result:', tracker.shouldInject('fact_123', 1)); // true - never injected
|
|
14
|
-
tracker.recordInjection('fact_123', 1);
|
|
15
|
-
// Scenario 2: Recent injection (within threshold)
|
|
16
|
-
console.log('\nTurn 5: Check if fact_123 should be injected again');
|
|
17
|
-
console.log('Result:', tracker.shouldInject('fact_123', 5)); // false - only 4 turns ago
|
|
18
|
-
console.log('Turns since injection:', 5 - 1);
|
|
19
|
-
// Scenario 3: Stale injection (beyond threshold)
|
|
20
|
-
console.log('\nTurn 15: Check if fact_123 should be injected again');
|
|
21
|
-
console.log('Result:', tracker.shouldInject('fact_123', 15)); // true - 14 turns ago (> 10)
|
|
22
|
-
console.log('Turns since injection:', 15 - 1);
|
|
23
|
-
// Scenario 4: Multiple facts
|
|
24
|
-
tracker.recordInjection('fact_456', 10);
|
|
25
|
-
tracker.recordInjection('fact_789', 12);
|
|
26
|
-
console.log('\nTurn 20: Check multiple facts');
|
|
27
|
-
console.log('fact_123 (injected turn 1):', tracker.shouldInject('fact_123', 20)); // true - 19 turns
|
|
28
|
-
console.log('fact_456 (injected turn 10):', tracker.shouldInject('fact_456', 20)); // true - 10 turns
|
|
29
|
-
console.log('fact_789 (injected turn 12):', tracker.shouldInject('fact_789', 20)); // false - 8 turns
|
|
30
|
-
// Scenario 5: Statistics
|
|
31
|
-
console.log('\nStatistics at turn 20:');
|
|
32
|
-
console.log(JSON.stringify(tracker.getStats(20), null, 2));
|
|
33
|
-
// Scenario 6: Pruning old facts
|
|
34
|
-
console.log('\nPruning facts older than 50 turns at turn 100:');
|
|
35
|
-
tracker.recordInjection('old_fact', 30);
|
|
36
|
-
const pruned = tracker.pruneOldFacts(100, 50);
|
|
37
|
-
console.log('Pruned:', pruned, 'facts');
|
|
38
|
-
console.log('Remaining facts:', tracker.getInjectedFacts().size);
|
|
39
|
-
}
|
|
40
|
-
// Run tests if this file is executed directly
|
|
41
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
42
|
-
demonstrateUsage();
|
|
43
|
-
}
|
|
44
|
-
// Simple assertion-based tests
|
|
45
|
-
export function runTests() {
|
|
46
|
-
const tracker = createDeduplicationTracker(10);
|
|
47
|
-
// Test 1: Never injected should return true
|
|
48
|
-
if (!tracker.shouldInject('test_fact', 1)) {
|
|
49
|
-
throw new Error('Test 1 failed: Never injected fact should inject');
|
|
50
|
-
}
|
|
51
|
-
// Test 2: Recent injection should return false
|
|
52
|
-
tracker.recordInjection('test_fact', 1);
|
|
53
|
-
if (tracker.shouldInject('test_fact', 5)) {
|
|
54
|
-
throw new Error('Test 2 failed: Recent fact should not inject');
|
|
55
|
-
}
|
|
56
|
-
// Test 3: Stale injection should return true
|
|
57
|
-
if (!tracker.shouldInject('test_fact', 15)) {
|
|
58
|
-
throw new Error('Test 3 failed: Stale fact should inject');
|
|
59
|
-
}
|
|
60
|
-
// Test 4: Custom threshold
|
|
61
|
-
if (!tracker.shouldInject('test_fact', 6, 5)) {
|
|
62
|
-
throw new Error('Test 4 failed: Custom threshold should allow injection');
|
|
63
|
-
}
|
|
64
|
-
// Test 5: Clear should reset state
|
|
65
|
-
tracker.clear();
|
|
66
|
-
if (tracker.getInjectedFacts().size !== 0) {
|
|
67
|
-
throw new Error('Test 5 failed: Clear should remove all facts');
|
|
68
|
-
}
|
|
69
|
-
// Test 6: Statistics
|
|
70
|
-
tracker.recordInjection('fact1', 1);
|
|
71
|
-
tracker.recordInjection('fact2', 8);
|
|
72
|
-
tracker.recordInjection('fact3', 15);
|
|
73
|
-
const stats = tracker.getStats(20);
|
|
74
|
-
if (stats.totalTracked !== 3) {
|
|
75
|
-
throw new Error('Test 6 failed: Should track 3 facts');
|
|
76
|
-
}
|
|
77
|
-
if (stats.fresh !== 1) {
|
|
78
|
-
throw new Error('Test 6 failed: Should have 1 fresh fact');
|
|
79
|
-
}
|
|
80
|
-
if (stats.stale !== 2) {
|
|
81
|
-
throw new Error('Test 6 failed: Should have 2 stale facts');
|
|
82
|
-
}
|
|
83
|
-
console.log('✅ All tests passed!');
|
|
84
|
-
}
|