fraude-code 0.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 +68 -0
- package/dist/index.js +179297 -0
- package/package.json +88 -0
- package/src/agent/agent.ts +475 -0
- package/src/agent/contextManager.ts +141 -0
- package/src/agent/index.ts +14 -0
- package/src/agent/pendingChanges.ts +270 -0
- package/src/agent/prompts/AskPrompt.txt +10 -0
- package/src/agent/prompts/FastPrompt.txt +40 -0
- package/src/agent/prompts/PlannerPrompt.txt +51 -0
- package/src/agent/prompts/ReviewerPrompt.txt +57 -0
- package/src/agent/prompts/WorkerPrompt.txt +33 -0
- package/src/agent/subagents/askAgent.ts +37 -0
- package/src/agent/subagents/extractionAgent.ts +123 -0
- package/src/agent/subagents/fastAgent.ts +45 -0
- package/src/agent/subagents/managerAgent.ts +36 -0
- package/src/agent/subagents/relationAgent.ts +76 -0
- package/src/agent/subagents/researchSubAgent.ts +79 -0
- package/src/agent/subagents/reviewerSubAgent.ts +42 -0
- package/src/agent/subagents/workerSubAgent.ts +42 -0
- package/src/agent/tools/bashTool.ts +94 -0
- package/src/agent/tools/descriptions/bash.txt +47 -0
- package/src/agent/tools/descriptions/edit.txt +7 -0
- package/src/agent/tools/descriptions/glob.txt +4 -0
- package/src/agent/tools/descriptions/grep.txt +8 -0
- package/src/agent/tools/descriptions/lsp.txt +20 -0
- package/src/agent/tools/descriptions/plan.txt +3 -0
- package/src/agent/tools/descriptions/read.txt +9 -0
- package/src/agent/tools/descriptions/todo.txt +12 -0
- package/src/agent/tools/descriptions/write.txt +8 -0
- package/src/agent/tools/editTool.ts +44 -0
- package/src/agent/tools/globTool.ts +59 -0
- package/src/agent/tools/grepTool.ts +343 -0
- package/src/agent/tools/lspTool.ts +429 -0
- package/src/agent/tools/planTool.ts +118 -0
- package/src/agent/tools/readTool.ts +78 -0
- package/src/agent/tools/rememberTool.ts +91 -0
- package/src/agent/tools/testRunnerTool.ts +77 -0
- package/src/agent/tools/testTool.ts +44 -0
- package/src/agent/tools/todoTool.ts +224 -0
- package/src/agent/tools/writeTool.ts +33 -0
- package/src/commands/COMMANDS.ts +38 -0
- package/src/commands/cerebras/auth.ts +27 -0
- package/src/commands/cerebras/index.ts +31 -0
- package/src/commands/forget.ts +29 -0
- package/src/commands/google/auth.ts +24 -0
- package/src/commands/google/index.ts +31 -0
- package/src/commands/groq/add_model.ts +60 -0
- package/src/commands/groq/auth.ts +24 -0
- package/src/commands/groq/index.ts +33 -0
- package/src/commands/index.ts +65 -0
- package/src/commands/knowledge.ts +92 -0
- package/src/commands/log.ts +32 -0
- package/src/commands/mistral/auth.ts +27 -0
- package/src/commands/mistral/index.ts +31 -0
- package/src/commands/model/index.ts +145 -0
- package/src/commands/models/index.ts +16 -0
- package/src/commands/ollama/index.ts +29 -0
- package/src/commands/openrouter/add_model.ts +64 -0
- package/src/commands/openrouter/auth.ts +24 -0
- package/src/commands/openrouter/index.ts +33 -0
- package/src/commands/remember.ts +48 -0
- package/src/commands/serve.ts +31 -0
- package/src/commands/session/index.ts +21 -0
- package/src/commands/usage.ts +15 -0
- package/src/commands/visualize.ts +773 -0
- package/src/components/App.tsx +55 -0
- package/src/components/IntroComponent.tsx +70 -0
- package/src/components/LoaderComponent.tsx +68 -0
- package/src/components/OutputRenderer.tsx +88 -0
- package/src/components/SettingsRenderer.tsx +23 -0
- package/src/components/input/CommandSuggestions.tsx +41 -0
- package/src/components/input/FileSuggestions.tsx +61 -0
- package/src/components/input/InputBox.tsx +371 -0
- package/src/components/output/CheckpointView.tsx +13 -0
- package/src/components/output/CommandView.tsx +13 -0
- package/src/components/output/CommentView.tsx +12 -0
- package/src/components/output/ConfirmationView.tsx +179 -0
- package/src/components/output/ContextUsage.tsx +62 -0
- package/src/components/output/DiffView.tsx +202 -0
- package/src/components/output/ErrorView.tsx +14 -0
- package/src/components/output/InteractiveServerView.tsx +69 -0
- package/src/components/output/KnowledgeView.tsx +220 -0
- package/src/components/output/MarkdownView.tsx +15 -0
- package/src/components/output/ModelSelectView.tsx +71 -0
- package/src/components/output/ReasoningView.tsx +21 -0
- package/src/components/output/ToolCallView.tsx +45 -0
- package/src/components/settings/ModelList.tsx +250 -0
- package/src/components/settings/TokenUsage.tsx +274 -0
- package/src/config/schema.ts +19 -0
- package/src/config/settings.ts +229 -0
- package/src/index.tsx +100 -0
- package/src/parsers/tree-sitter-python.wasm +0 -0
- package/src/providers/providers.ts +71 -0
- package/src/services/PluginLoader.ts +123 -0
- package/src/services/cerebras.ts +69 -0
- package/src/services/embeddingService.ts +229 -0
- package/src/services/google.ts +65 -0
- package/src/services/graphSerializer.ts +248 -0
- package/src/services/groq.ts +23 -0
- package/src/services/knowledgeOrchestrator.ts +286 -0
- package/src/services/mistral.ts +79 -0
- package/src/services/ollama.ts +109 -0
- package/src/services/openrouter.ts +23 -0
- package/src/services/symbolExtractor.ts +277 -0
- package/src/store/useFraudeStore.ts +123 -0
- package/src/store/useSettingsStore.ts +38 -0
- package/src/theme.ts +26 -0
- package/src/types/Agent.ts +147 -0
- package/src/types/CommandDefinition.ts +8 -0
- package/src/types/Model.ts +94 -0
- package/src/types/OutputItem.ts +24 -0
- package/src/types/PluginContext.ts +55 -0
- package/src/types/TokenUsage.ts +5 -0
- package/src/types/assets.d.ts +4 -0
- package/src/utils/agentCognition.ts +1152 -0
- package/src/utils/fileSuggestions.ts +111 -0
- package/src/utils/index.ts +17 -0
- package/src/utils/initFraude.ts +8 -0
- package/src/utils/logger.ts +24 -0
- package/src/utils/lspClient.ts +1415 -0
- package/src/utils/paths.ts +24 -0
- package/src/utils/queryHandler.ts +227 -0
- package/src/utils/router.ts +278 -0
- package/src/utils/streamHandler.ts +132 -0
- package/src/utils/treeSitterQueries.ts +125 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-sitter query patterns for extracting code structure across languages.
|
|
3
|
+
* Used by TreeSitterProvider to extract imports, calls, and definitions.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface LanguageQueries {
|
|
7
|
+
imports: string;
|
|
8
|
+
calls: string;
|
|
9
|
+
definitions: string;
|
|
10
|
+
inheritance?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const pythonQueries: LanguageQueries = {
|
|
14
|
+
imports: `
|
|
15
|
+
(import_statement) @import
|
|
16
|
+
(import_from_statement) @import
|
|
17
|
+
`,
|
|
18
|
+
calls: `
|
|
19
|
+
(call function: (identifier) @func)
|
|
20
|
+
(call function: (attribute) @func)
|
|
21
|
+
`,
|
|
22
|
+
definitions: `
|
|
23
|
+
(function_definition name: (identifier) @name) @def
|
|
24
|
+
(class_definition name: (identifier) @name) @def
|
|
25
|
+
`,
|
|
26
|
+
inheritance: `
|
|
27
|
+
(class_definition
|
|
28
|
+
name: (identifier) @class_name
|
|
29
|
+
superclasses: (argument_list (identifier) @parent))
|
|
30
|
+
`,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const rustQueries: LanguageQueries = {
|
|
34
|
+
imports: `
|
|
35
|
+
(use_declaration) @import
|
|
36
|
+
`,
|
|
37
|
+
calls: `
|
|
38
|
+
(call_expression function: (identifier) @func)
|
|
39
|
+
(call_expression function: (field_expression) @func)
|
|
40
|
+
`,
|
|
41
|
+
definitions: `
|
|
42
|
+
(function_item name: (identifier) @name) @def
|
|
43
|
+
(struct_item name: (type_identifier) @name) @def
|
|
44
|
+
(enum_item name: (type_identifier) @name) @def
|
|
45
|
+
(trait_item name: (type_identifier) @name) @def
|
|
46
|
+
(impl_item type: (type_identifier) @name) @def
|
|
47
|
+
`,
|
|
48
|
+
inheritance: `
|
|
49
|
+
(impl_item
|
|
50
|
+
trait: (type_identifier) @trait
|
|
51
|
+
type: (type_identifier) @implementor)
|
|
52
|
+
`,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const goQueries: LanguageQueries = {
|
|
56
|
+
imports: `
|
|
57
|
+
(import_declaration) @import
|
|
58
|
+
(import_spec path: (interpreted_string_literal) @path)
|
|
59
|
+
`,
|
|
60
|
+
calls: `
|
|
61
|
+
(call_expression function: (identifier) @func)
|
|
62
|
+
(call_expression function: (selector_expression) @func)
|
|
63
|
+
`,
|
|
64
|
+
definitions: `
|
|
65
|
+
(function_declaration name: (identifier) @name) @def
|
|
66
|
+
(method_declaration name: (field_identifier) @name) @def
|
|
67
|
+
(type_declaration (type_spec name: (type_identifier) @name)) @def
|
|
68
|
+
`,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const typescriptQueries: LanguageQueries = {
|
|
72
|
+
imports: `
|
|
73
|
+
(import_statement) @import
|
|
74
|
+
(import_clause) @import
|
|
75
|
+
`,
|
|
76
|
+
calls: `
|
|
77
|
+
(call_expression function: (identifier) @func)
|
|
78
|
+
(call_expression function: (member_expression) @func)
|
|
79
|
+
`,
|
|
80
|
+
definitions: `
|
|
81
|
+
(function_declaration name: (identifier) @name) @def
|
|
82
|
+
(class_declaration name: (type_identifier) @name) @def
|
|
83
|
+
(interface_declaration name: (type_identifier) @name) @def
|
|
84
|
+
(method_definition name: (property_identifier) @name) @def
|
|
85
|
+
`,
|
|
86
|
+
inheritance: `
|
|
87
|
+
(class_declaration
|
|
88
|
+
name: (type_identifier) @class_name
|
|
89
|
+
(class_heritage (extends_clause (identifier) @parent)))
|
|
90
|
+
`,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get queries for a language by extension
|
|
95
|
+
*/
|
|
96
|
+
export function getQueriesForExtension(ext: string): LanguageQueries | null {
|
|
97
|
+
switch (ext) {
|
|
98
|
+
case "py":
|
|
99
|
+
return pythonQueries;
|
|
100
|
+
case "rs":
|
|
101
|
+
return rustQueries;
|
|
102
|
+
case "go":
|
|
103
|
+
return goQueries;
|
|
104
|
+
case "ts":
|
|
105
|
+
case "tsx":
|
|
106
|
+
case "js":
|
|
107
|
+
case "jsx":
|
|
108
|
+
return typescriptQueries;
|
|
109
|
+
default:
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Language to WASM path mapping
|
|
116
|
+
*/
|
|
117
|
+
export const wasmPaths: Record<string, string> = {
|
|
118
|
+
py: "parsers/tree-sitter-python.wasm",
|
|
119
|
+
rs: "parsers/tree-sitter-rust.wasm",
|
|
120
|
+
go: "parsers/tree-sitter-go.wasm",
|
|
121
|
+
ts: "parsers/tree-sitter-typescript.wasm",
|
|
122
|
+
tsx: "parsers/tree-sitter-tsx.wasm",
|
|
123
|
+
js: "parsers/tree-sitter-javascript.wasm",
|
|
124
|
+
jsx: "parsers/tree-sitter-javascript.wasm",
|
|
125
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*": ["src/*"]
|
|
6
|
+
},
|
|
7
|
+
// Environment setup & latest features
|
|
8
|
+
"lib": ["ESNext"],
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"module": "Preserve",
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
|
|
15
|
+
// Bundler mode
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
"allowImportingTsExtensions": true,
|
|
18
|
+
"verbatimModuleSyntax": true,
|
|
19
|
+
"noEmit": true,
|
|
20
|
+
|
|
21
|
+
// Best practices
|
|
22
|
+
"strict": true,
|
|
23
|
+
"skipLibCheck": true,
|
|
24
|
+
"noFallthroughCasesInSwitch": true,
|
|
25
|
+
"noUncheckedIndexedAccess": true,
|
|
26
|
+
"noImplicitOverride": true,
|
|
27
|
+
|
|
28
|
+
// Some stricter flags (disabled by default)
|
|
29
|
+
"noUnusedLocals": false,
|
|
30
|
+
"noUnusedParameters": false,
|
|
31
|
+
"noPropertyAccessFromIndexSignature": false
|
|
32
|
+
}
|
|
33
|
+
}
|