@ddse/acm-aicoder 0.5.0 → 0.5.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.
Files changed (47) hide show
  1. package/dist/src/capability-map.d.ts +4 -0
  2. package/dist/src/capability-map.d.ts.map +1 -0
  3. package/dist/src/capability-map.js +289 -0
  4. package/dist/src/capability-map.js.map +1 -0
  5. package/dist/src/registries.d.ts +3 -0
  6. package/dist/src/registries.d.ts.map +1 -1
  7. package/dist/src/registries.js +11 -0
  8. package/dist/src/registries.js.map +1 -1
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/package.json +21 -7
  11. package/.aicoder/index.json +0 -304
  12. package/AICODER_IMPLEMENTATION_PLAN_PHASE2.md +0 -284
  13. package/bin/interactive.tsx +0 -232
  14. package/docs/AICODER.png +0 -0
  15. package/docs/INTERACTIVE_CLI_GUIDE.md +0 -201
  16. package/docs/TUI_MOCKUP.md +0 -180
  17. package/src/config/providers.ts +0 -174
  18. package/src/config/session.ts +0 -143
  19. package/src/context/bm25.ts +0 -173
  20. package/src/context/code-search.ts +0 -188
  21. package/src/context/context-pack.ts +0 -133
  22. package/src/context/dependency-mapper.ts +0 -72
  23. package/src/context/index.ts +0 -8
  24. package/src/context/symbol-extractor.ts +0 -149
  25. package/src/context/test-mapper.ts +0 -77
  26. package/src/context/types.ts +0 -69
  27. package/src/context/workspace-indexer.ts +0 -249
  28. package/src/index.ts +0 -5
  29. package/src/registries.ts +0 -118
  30. package/src/runtime/budget-manager.ts +0 -118
  31. package/src/runtime/interactive-runtime.ts +0 -423
  32. package/src/tasks-v2/analysis-tasks.ts +0 -311
  33. package/src/tasks-v2/developer-tasks.ts +0 -437
  34. package/src/tasks-v2/index.ts +0 -3
  35. package/src/tools-v2/edit-tools.ts +0 -153
  36. package/src/tools-v2/index.ts +0 -6
  37. package/src/tools-v2/read-tools.ts +0 -286
  38. package/src/tools-v2/search-tools.ts +0 -175
  39. package/src/tools-v2/test-tools.ts +0 -147
  40. package/src/tools-v2/workspace-context.ts +0 -428
  41. package/src/ui/App.tsx +0 -392
  42. package/src/ui/components/ChatPane.tsx +0 -84
  43. package/src/ui/components/EventsPane.tsx +0 -81
  44. package/src/ui/components/GoalsTasksPane.tsx +0 -149
  45. package/src/ui/store.ts +0 -362
  46. package/tests/integration.test.ts +0 -537
  47. package/tsconfig.json +0 -22
@@ -1,133 +0,0 @@
1
- // Context Pack Generator - Create rich context for LLM planning
2
- import type {
3
- ContextPack,
4
- WorkspaceIndex,
5
- SymbolInfo,
6
- DependencyInfo,
7
- TestMapping
8
- } from './types.js';
9
- import { CodeSearch } from './code-search.js';
10
-
11
- export interface ContextPackOptions {
12
- maxFiles?: number;
13
- maxSymbols?: number;
14
- includeTests?: boolean;
15
- includeDependencies?: boolean;
16
- }
17
-
18
- export class ContextPackGenerator {
19
- private search: CodeSearch;
20
-
21
- constructor(search: CodeSearch) {
22
- this.search = search;
23
- }
24
-
25
- /**
26
- * Generate context pack for a goal
27
- */
28
- async generate(
29
- goal: string,
30
- index: WorkspaceIndex,
31
- symbols: SymbolInfo[],
32
- dependencies: DependencyInfo[],
33
- testMappings: TestMapping[],
34
- options: ContextPackOptions = {}
35
- ): Promise<ContextPack> {
36
- const maxFiles = options.maxFiles ?? 8;
37
- const maxSymbols = options.maxSymbols ?? 20;
38
- const normalizedGoal = (goal || '').toString();
39
- const searchQuery = normalizedGoal.trim().length > 0
40
- ? normalizedGoal
41
- : 'workspace overview';
42
-
43
- // Search for relevant files
44
- const searchResults = await this.search.search(searchQuery, {
45
- k: maxFiles,
46
- includeContext: true,
47
- contextLines: 2,
48
- });
49
-
50
- // Extract relevant symbols (top matching symbols)
51
- const relevantSymbols = this.findRelevantSymbols(normalizedGoal, symbols, maxSymbols);
52
-
53
- // Filter dependencies if requested
54
- const relevantDeps = options.includeDependencies
55
- ? dependencies.slice(0, 20) // Top 20 deps
56
- : [];
57
-
58
- // Extract test files if requested
59
- const testFiles = options.includeTests
60
- ? testMappings.map(m => m.testFile)
61
- : [];
62
-
63
- // Build context pack
64
- const pack: ContextPack = {
65
- goal: normalizedGoal,
66
- files: searchResults.map(r => ({
67
- path: r.path,
68
- snippet: r.snippet,
69
- relevance: r.score,
70
- })),
71
- symbols: relevantSymbols,
72
- dependencies: relevantDeps,
73
- testFiles,
74
- summary: this.generateSummary(index, searchResults.length, relevantSymbols.length),
75
- generatedAt: new Date().toISOString(),
76
- };
77
-
78
- return pack;
79
- }
80
-
81
- /**
82
- * Find symbols relevant to the goal
83
- */
84
- private findRelevantSymbols(goal: string, symbols: SymbolInfo[], limit: number): SymbolInfo[] {
85
- const goalLower = (goal || '').toLowerCase();
86
- const tokens = goalLower.split(/\s+/).filter(Boolean);
87
-
88
- if (tokens.length === 0) {
89
- return [];
90
- }
91
-
92
- // Score symbols by relevance
93
- const scored = symbols.map(symbol => {
94
- let score = 0;
95
- const nameLower = symbol.name.toLowerCase();
96
-
97
- // Exact match
98
- if (tokens.some(t => nameLower === t)) {
99
- score += 10;
100
- }
101
-
102
- // Partial match
103
- if (tokens.some(t => nameLower.includes(t) || t.includes(nameLower))) {
104
- score += 5;
105
- }
106
-
107
- // Boost exported symbols
108
- if (symbol.kind === 'function' || symbol.kind === 'class') {
109
- score += 2;
110
- }
111
-
112
- return { symbol, score };
113
- });
114
-
115
- // Sort by score and return top symbols
116
- return scored
117
- .filter(s => s.score > 0)
118
- .sort((a, b) => b.score - a.score)
119
- .slice(0, limit)
120
- .map(s => s.symbol);
121
- }
122
-
123
- /**
124
- * Generate a summary of the context
125
- */
126
- private generateSummary(index: WorkspaceIndex, fileCount: number, symbolCount: number): string {
127
- const totalFiles = index.totalFiles;
128
- const totalSize = (index.totalSize / 1024 / 1024).toFixed(2);
129
-
130
- return `Workspace: ${totalFiles} files, ${totalSize}MB. ` +
131
- `Context: ${fileCount} relevant files, ${symbolCount} symbols.`;
132
- }
133
- }
@@ -1,72 +0,0 @@
1
- // Dependency Mapper - Parse and analyze dependencies
2
- import * as fs from 'fs/promises';
3
- import * as path from 'path';
4
- import type { DependencyInfo, WorkspaceIndex } from './types.js';
5
-
6
- export class DependencyMapper {
7
- private rootPath: string;
8
-
9
- constructor(rootPath: string) {
10
- this.rootPath = rootPath;
11
- }
12
-
13
- /**
14
- * Extract dependencies from package.json files
15
- */
16
- async extractDependencies(index: WorkspaceIndex): Promise<DependencyInfo[]> {
17
- const dependencies: DependencyInfo[] = [];
18
-
19
- // Find all package.json files
20
- const packageFiles = index.files.filter(f =>
21
- path.basename(f.path) === 'package.json'
22
- );
23
-
24
- for (const file of packageFiles) {
25
- try {
26
- const fullPath = path.join(this.rootPath, file.path);
27
- const content = await fs.readFile(fullPath, 'utf-8');
28
- const pkg = JSON.parse(content);
29
-
30
- // Extract dependencies
31
- if (pkg.dependencies) {
32
- for (const [name, version] of Object.entries(pkg.dependencies)) {
33
- dependencies.push({
34
- name,
35
- version: version as string,
36
- type: 'dependency',
37
- packageJsonPath: file.path,
38
- });
39
- }
40
- }
41
-
42
- // Extract devDependencies
43
- if (pkg.devDependencies) {
44
- for (const [name, version] of Object.entries(pkg.devDependencies)) {
45
- dependencies.push({
46
- name,
47
- version: version as string,
48
- type: 'devDependency',
49
- packageJsonPath: file.path,
50
- });
51
- }
52
- }
53
-
54
- // Extract peerDependencies
55
- if (pkg.peerDependencies) {
56
- for (const [name, version] of Object.entries(pkg.peerDependencies)) {
57
- dependencies.push({
58
- name,
59
- version: version as string,
60
- type: 'peerDependency',
61
- packageJsonPath: file.path,
62
- });
63
- }
64
- }
65
- } catch {
66
- // Skip invalid package.json files
67
- }
68
- }
69
-
70
- return dependencies;
71
- }
72
- }
@@ -1,8 +0,0 @@
1
- // Context Engine - Intelligent repository understanding
2
- export * from './workspace-indexer.js';
3
- export * from './symbol-extractor.js';
4
- export * from './dependency-mapper.js';
5
- export * from './test-mapper.js';
6
- export * from './code-search.js';
7
- export * from './context-pack.js';
8
- export * from './types.js';
@@ -1,149 +0,0 @@
1
- // Symbol Extractor - Extract symbols from TypeScript/JavaScript files
2
- import * as fs from 'fs/promises';
3
- import * as path from 'path';
4
- import type { SymbolInfo, WorkspaceIndex } from './types.js';
5
-
6
- /**
7
- * Simple symbol extractor using regex patterns
8
- * For production use, consider ts-morph or @typescript/vfs
9
- */
10
- export class SymbolExtractor {
11
- private rootPath: string;
12
-
13
- constructor(rootPath: string) {
14
- this.rootPath = rootPath;
15
- }
16
-
17
- /**
18
- * Extract symbols from indexed files
19
- */
20
- async extractSymbols(index: WorkspaceIndex): Promise<SymbolInfo[]> {
21
- const symbols: SymbolInfo[] = [];
22
-
23
- // Filter to TS/JS files
24
- const codeFiles = index.files.filter(f =>
25
- (f.language === 'typescript' || f.language === 'javascript') &&
26
- !f.isBinary &&
27
- f.size < 500_000
28
- );
29
-
30
- for (const file of codeFiles) {
31
- try {
32
- const fullPath = path.join(this.rootPath, file.path);
33
- const content = await fs.readFile(fullPath, 'utf-8');
34
- const fileSymbols = this.parseSymbols(content, file.path);
35
- symbols.push(...fileSymbols);
36
- } catch {
37
- // Skip files we can't read
38
- }
39
- }
40
-
41
- return symbols;
42
- }
43
-
44
- /**
45
- * Parse symbols from file content using regex
46
- */
47
- private parseSymbols(content: string, filePath: string): SymbolInfo[] {
48
- const symbols: SymbolInfo[] = [];
49
- const lines = content.split('\n');
50
-
51
- // Patterns for different symbol types
52
- const patterns = {
53
- function: /(?:export\s+)?(?:async\s+)?function\s+(\w+)/g,
54
- class: /(?:export\s+)?class\s+(\w+)/g,
55
- interface: /(?:export\s+)?interface\s+(\w+)/g,
56
- type: /(?:export\s+)?type\s+(\w+)/g,
57
- const: /(?:export\s+)?const\s+(\w+)/g,
58
- let: /(?:export\s+)?let\s+(\w+)/g,
59
- var: /(?:export\s+)?var\s+(\w+)/g,
60
- };
61
-
62
- lines.forEach((line, idx) => {
63
- const lineNum = idx + 1;
64
-
65
- // Extract functions
66
- const functionMatches = line.matchAll(patterns.function);
67
- for (const match of functionMatches) {
68
- symbols.push({
69
- name: match[1],
70
- kind: 'function',
71
- path: filePath,
72
- line: lineNum,
73
- signature: line.trim(),
74
- });
75
- }
76
-
77
- // Extract classes
78
- const classMatches = line.matchAll(patterns.class);
79
- for (const match of classMatches) {
80
- symbols.push({
81
- name: match[1],
82
- kind: 'class',
83
- path: filePath,
84
- line: lineNum,
85
- });
86
- }
87
-
88
- // Extract interfaces
89
- const interfaceMatches = line.matchAll(patterns.interface);
90
- for (const match of interfaceMatches) {
91
- symbols.push({
92
- name: match[1],
93
- kind: 'interface',
94
- path: filePath,
95
- line: lineNum,
96
- });
97
- }
98
-
99
- // Extract types
100
- const typeMatches = line.matchAll(patterns.type);
101
- for (const match of typeMatches) {
102
- symbols.push({
103
- name: match[1],
104
- kind: 'type',
105
- path: filePath,
106
- line: lineNum,
107
- });
108
- }
109
-
110
- // Extract exports (const/let/var)
111
- if (line.includes('export')) {
112
- for (const [pattern, kind] of [
113
- [patterns.const, 'export'],
114
- [patterns.let, 'export'],
115
- [patterns.var, 'export'],
116
- ] as const) {
117
- const matches = line.matchAll(pattern);
118
- for (const match of matches) {
119
- symbols.push({
120
- name: match[1],
121
- kind,
122
- path: filePath,
123
- line: lineNum,
124
- });
125
- }
126
- }
127
- }
128
- });
129
-
130
- return symbols;
131
- }
132
-
133
- /**
134
- * Find symbol definition by name
135
- */
136
- static findSymbol(symbols: SymbolInfo[], name: string): SymbolInfo[] {
137
- return symbols.filter(s =>
138
- s.name === name || s.name.toLowerCase() === name.toLowerCase()
139
- );
140
- }
141
-
142
- /**
143
- * Get symbols by kind
144
- */
145
- static filterByKind(symbols: SymbolInfo[], kinds: SymbolInfo['kind'][]): SymbolInfo[] {
146
- const kindSet = new Set(kinds);
147
- return symbols.filter(s => kindSet.has(s.kind));
148
- }
149
- }
@@ -1,77 +0,0 @@
1
- // Test Mapper - Identify test files and their targets
2
- import * as path from 'path';
3
- import type { TestMapping, WorkspaceIndex } from './types.js';
4
-
5
- const TEST_PATTERNS = [
6
- /\.test\.(ts|tsx|js|jsx)$/,
7
- /\.spec\.(ts|tsx|js|jsx)$/,
8
- /__tests__\//,
9
- /\.test\..*$/,
10
- ];
11
-
12
- export class TestMapper {
13
- /**
14
- * Map test files to their likely source targets
15
- */
16
- static mapTests(index: WorkspaceIndex): TestMapping[] {
17
- const mappings: TestMapping[] = [];
18
-
19
- // Find test files
20
- const testFiles = index.files.filter(f =>
21
- TEST_PATTERNS.some(pattern => pattern.test(f.path))
22
- );
23
-
24
- for (const testFile of testFiles) {
25
- // Try to infer source file
26
- const targetFiles = this.inferTargetFiles(testFile.path, index);
27
-
28
- // Detect test framework
29
- const framework = this.detectFramework(testFile.path);
30
-
31
- mappings.push({
32
- testFile: testFile.path,
33
- targetFiles,
34
- testFramework: framework,
35
- });
36
- }
37
-
38
- return mappings;
39
- }
40
-
41
- /**
42
- * Infer target source files from test file path
43
- */
44
- private static inferTargetFiles(testPath: string, index: WorkspaceIndex): string[] {
45
- const targets: string[] = [];
46
-
47
- // Remove test suffix/prefix patterns
48
- let basePath = testPath
49
- .replace(/\.test\.(ts|tsx|js|jsx)$/, '.$1')
50
- .replace(/\.spec\.(ts|tsx|js|jsx)$/, '.$1')
51
- .replace(/__tests__\//, '');
52
-
53
- // Check if this file exists
54
- if (index.files.some(f => f.path === basePath)) {
55
- targets.push(basePath);
56
- }
57
-
58
- // Try src/ variant
59
- const srcPath = path.join('src', path.basename(basePath));
60
- if (index.files.some(f => f.path === srcPath)) {
61
- targets.push(srcPath);
62
- }
63
-
64
- return targets;
65
- }
66
-
67
- /**
68
- * Detect test framework from file path
69
- */
70
- private static detectFramework(testPath: string): string | undefined {
71
- if (testPath.includes('jest')) return 'jest';
72
- if (testPath.includes('mocha')) return 'mocha';
73
- if (testPath.includes('vitest')) return 'vitest';
74
- if (testPath.includes('spec')) return 'jasmine';
75
- return undefined;
76
- }
77
- }
@@ -1,69 +0,0 @@
1
- // Context Engine Types
2
-
3
- export interface FileMetadata {
4
- path: string;
5
- size: number;
6
- mtime: number;
7
- hash: string;
8
- language: string;
9
- isBinary: boolean;
10
- }
11
-
12
- export interface WorkspaceIndex {
13
- files: FileMetadata[];
14
- totalFiles: number;
15
- totalSize: number;
16
- indexedAt: string;
17
- rootPath: string;
18
- }
19
-
20
- export interface SymbolInfo {
21
- name: string;
22
- kind: 'function' | 'class' | 'variable' | 'interface' | 'type' | 'export' | 'import';
23
- path: string;
24
- line: number;
25
- column?: number;
26
- signature?: string;
27
- }
28
-
29
- export interface DependencyInfo {
30
- name: string;
31
- version: string;
32
- type: 'dependency' | 'devDependency' | 'peerDependency';
33
- packageJsonPath: string;
34
- }
35
-
36
- export interface ImportGraph {
37
- [filePath: string]: {
38
- imports: string[];
39
- exportedSymbols: string[];
40
- };
41
- }
42
-
43
- export interface TestMapping {
44
- testFile: string;
45
- targetFiles: string[];
46
- testFramework?: string;
47
- }
48
-
49
- export interface SearchResult {
50
- path: string;
51
- score: number;
52
- snippet: string;
53
- line: number;
54
- column?: number;
55
- }
56
-
57
- export interface ContextPack {
58
- goal: string;
59
- files: Array<{
60
- path: string;
61
- snippet: string;
62
- relevance: number;
63
- }>;
64
- symbols: SymbolInfo[];
65
- dependencies: DependencyInfo[];
66
- testFiles: string[];
67
- summary: string;
68
- generatedAt: string;
69
- }