erosolar-cli 1.7.55 → 1.7.56

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 (273) hide show
  1. package/package.json +1 -1
  2. package/dist/active-stack-security.d.ts +0 -110
  3. package/dist/active-stack-security.js +0 -313
  4. package/dist/active-stack-security.js.map +0 -1
  5. package/dist/advanced-targeting.d.ts +0 -113
  6. package/dist/advanced-targeting.js +0 -252
  7. package/dist/advanced-targeting.js.map +0 -1
  8. package/dist/bin/adapters/node/index.js +0 -33
  9. package/dist/bin/adapters/types.js +0 -1
  10. package/dist/bin/alpha-zero/agentWrapper.js +0 -165
  11. package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
  12. package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
  13. package/dist/bin/alpha-zero/index.js +0 -98
  14. package/dist/bin/alpha-zero/introspection.js +0 -298
  15. package/dist/bin/alpha-zero/metricsTracker.js +0 -207
  16. package/dist/bin/alpha-zero/security/core.js +0 -269
  17. package/dist/bin/alpha-zero/security/google.js +0 -308
  18. package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
  19. package/dist/bin/alpha-zero/security/index.js +0 -31
  20. package/dist/bin/alpha-zero/security/simulation.js +0 -274
  21. package/dist/bin/alpha-zero/selfModification.js +0 -231
  22. package/dist/bin/alpha-zero/types.js +0 -30
  23. package/dist/bin/bin/erosolar-optimized.js +0 -205
  24. package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
  25. package/dist/bin/capabilities/bashCapability.js +0 -22
  26. package/dist/bin/capabilities/cloudCapability.js +0 -36
  27. package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
  28. package/dist/bin/capabilities/codeQualityCapability.js +0 -23
  29. package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
  30. package/dist/bin/capabilities/devCapability.js +0 -22
  31. package/dist/bin/capabilities/editCapability.js +0 -28
  32. package/dist/bin/capabilities/emailCapability.js +0 -20
  33. package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
  34. package/dist/bin/capabilities/filesystemCapability.js +0 -22
  35. package/dist/bin/capabilities/globCapability.js +0 -28
  36. package/dist/bin/capabilities/interactionCapability.js +0 -20
  37. package/dist/bin/capabilities/learnCapability.js +0 -22
  38. package/dist/bin/capabilities/mcpCapability.js +0 -20
  39. package/dist/bin/capabilities/notebookCapability.js +0 -28
  40. package/dist/bin/capabilities/planningCapability.js +0 -27
  41. package/dist/bin/capabilities/refactoringCapability.js +0 -23
  42. package/dist/bin/capabilities/repoChecksCapability.js +0 -22
  43. package/dist/bin/capabilities/searchCapability.js +0 -22
  44. package/dist/bin/capabilities/skillCapability.js +0 -76
  45. package/dist/bin/capabilities/taskManagementCapability.js +0 -20
  46. package/dist/bin/capabilities/testingCapability.js +0 -23
  47. package/dist/bin/capabilities/toolManifest.js +0 -159
  48. package/dist/bin/capabilities/toolRegistry.js +0 -114
  49. package/dist/bin/capabilities/webCapability.js +0 -20
  50. package/dist/bin/config.js +0 -139
  51. package/dist/bin/contracts/v1/agent.js +0 -7
  52. package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
  53. package/dist/bin/contracts/v1/agentRules.js +0 -9
  54. package/dist/bin/contracts/v1/toolAccess.js +0 -8
  55. package/dist/bin/erosolar-optimized.d.ts +0 -12
  56. package/dist/bin/erosolar-optimized.d.ts.map +0 -1
  57. package/dist/bin/erosolar-optimized.js +0 -239
  58. package/dist/bin/erosolar-optimized.js.map +0 -1
  59. package/dist/bin/headless/headlessApp.js +0 -172
  60. package/dist/bin/mcp/config.js +0 -202
  61. package/dist/bin/mcp/stdioClient.js +0 -172
  62. package/dist/bin/mcp/toolBridge.js +0 -104
  63. package/dist/bin/mcp/types.js +0 -1
  64. package/dist/bin/plugins/index.js +0 -113
  65. package/dist/bin/plugins/providers/anthropic/index.js +0 -25
  66. package/dist/bin/plugins/providers/deepseek/index.js +0 -24
  67. package/dist/bin/plugins/providers/google/index.js +0 -26
  68. package/dist/bin/plugins/providers/index.js +0 -19
  69. package/dist/bin/plugins/providers/ollama/index.js +0 -59
  70. package/dist/bin/plugins/providers/openai/index.js +0 -26
  71. package/dist/bin/plugins/providers/xai/index.js +0 -24
  72. package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
  73. package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
  74. package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
  75. package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
  76. package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
  77. package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
  78. package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
  79. package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
  80. package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
  81. package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
  82. package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
  83. package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
  84. package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
  85. package/dist/bin/plugins/tools/index.js +0 -2
  86. package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
  87. package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
  88. package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
  89. package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
  90. package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
  91. package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
  92. package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
  93. package/dist/bin/plugins/tools/registry.js +0 -57
  94. package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
  95. package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
  96. package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
  97. package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
  98. package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
  99. package/dist/bin/providers/anthropicProvider.js +0 -329
  100. package/dist/bin/providers/googleProvider.js +0 -203
  101. package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
  102. package/dist/bin/providers/openaiResponsesProvider.js +0 -249
  103. package/dist/bin/providers/providerFactory.js +0 -24
  104. package/dist/bin/runtime/agentController.js +0 -321
  105. package/dist/bin/runtime/agentHost.js +0 -153
  106. package/dist/bin/runtime/agentSession.js +0 -195
  107. package/dist/bin/runtime/node.js +0 -10
  108. package/dist/bin/runtime/universal.js +0 -28
  109. package/dist/bin/skills/skillRepository.js +0 -236
  110. package/dist/bin/skills/types.js +0 -1
  111. package/dist/bin/subagents/taskRunner.js +0 -269
  112. package/dist/bin/tools/backgroundBashTools.js +0 -211
  113. package/dist/bin/tools/bashTools.js +0 -159
  114. package/dist/bin/tools/cloudTools.js +0 -864
  115. package/dist/bin/tools/codeAnalysisTools.js +0 -641
  116. package/dist/bin/tools/codeQualityTools.js +0 -294
  117. package/dist/bin/tools/dependencyTools.js +0 -282
  118. package/dist/bin/tools/devTools.js +0 -238
  119. package/dist/bin/tools/diffUtils.js +0 -137
  120. package/dist/bin/tools/editTools.js +0 -134
  121. package/dist/bin/tools/emailTools.js +0 -448
  122. package/dist/bin/tools/fileTools.js +0 -282
  123. package/dist/bin/tools/globTools.js +0 -173
  124. package/dist/bin/tools/grepTools.js +0 -332
  125. package/dist/bin/tools/interactionTools.js +0 -170
  126. package/dist/bin/tools/learnTools.js +0 -1818
  127. package/dist/bin/tools/notebookEditTools.js +0 -196
  128. package/dist/bin/tools/planningTools.js +0 -46
  129. package/dist/bin/tools/refactoringTools.js +0 -293
  130. package/dist/bin/tools/repoChecksTools.js +0 -160
  131. package/dist/bin/tools/searchTools.js +0 -206
  132. package/dist/bin/tools/skillTools.js +0 -177
  133. package/dist/bin/tools/taskManagementTools.js +0 -156
  134. package/dist/bin/tools/testingTools.js +0 -232
  135. package/dist/bin/tools/webTools.js +0 -480
  136. package/dist/bin/workspace.js +0 -106
  137. package/dist/bin/workspace.validator.js +0 -213
  138. package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
  139. package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
  140. package/dist/capabilities/offensiveSecurityCapability.js +0 -58
  141. package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
  142. package/dist/capabilities/realSecurityCapability.d.ts +0 -26
  143. package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
  144. package/dist/capabilities/realSecurityCapability.js +0 -53
  145. package/dist/capabilities/realSecurityCapability.js.map +0 -1
  146. package/dist/capabilities/securityCapability.d.ts +0 -32
  147. package/dist/capabilities/securityCapability.d.ts.map +0 -1
  148. package/dist/capabilities/securityCapability.js +0 -57
  149. package/dist/capabilities/securityCapability.js.map +0 -1
  150. package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
  151. package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
  152. package/dist/capabilities/ultimateSecurityCapability.js +0 -96
  153. package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
  154. package/dist/core/designThoughtCheck.d.ts +0 -196
  155. package/dist/core/designThoughtCheck.d.ts.map +0 -1
  156. package/dist/core/designThoughtCheck.js +0 -287
  157. package/dist/core/designThoughtCheck.js.map +0 -1
  158. package/dist/core/designThoughtCheckEngine.d.ts +0 -58
  159. package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
  160. package/dist/core/designThoughtCheckEngine.js +0 -358
  161. package/dist/core/designThoughtCheckEngine.js.map +0 -1
  162. package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
  163. package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
  164. package/dist/core/designThoughtCheckIntegration.js +0 -207
  165. package/dist/core/designThoughtCheckIntegration.js.map +0 -1
  166. package/dist/core/intelligenceTools.d.ts +0 -19
  167. package/dist/core/intelligenceTools.d.ts.map +0 -1
  168. package/dist/core/intelligenceTools.js +0 -453
  169. package/dist/core/intelligenceTools.js.map +0 -1
  170. package/dist/core/operationalTools.d.ts +0 -19
  171. package/dist/core/operationalTools.d.ts.map +0 -1
  172. package/dist/core/operationalTools.js +0 -467
  173. package/dist/core/operationalTools.js.map +0 -1
  174. package/dist/offensive/core/offensive-engine.d.ts +0 -171
  175. package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
  176. package/dist/offensive/core/offensive-engine.js +0 -345
  177. package/dist/offensive/core/offensive-engine.js.map +0 -1
  178. package/dist/offensive/core/offensive-integration.d.ts +0 -129
  179. package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
  180. package/dist/offensive/core/offensive-integration.js +0 -364
  181. package/dist/offensive/core/offensive-integration.js.map +0 -1
  182. package/dist/offensive/core/offensive-tools.d.ts +0 -55
  183. package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
  184. package/dist/offensive/core/offensive-tools.js +0 -438
  185. package/dist/offensive/core/offensive-tools.js.map +0 -1
  186. package/dist/offensive/offensive-cli.d.ts +0 -48
  187. package/dist/offensive/offensive-cli.d.ts.map +0 -1
  188. package/dist/offensive/offensive-cli.js +0 -233
  189. package/dist/offensive/offensive-cli.js.map +0 -1
  190. package/dist/security/apt-simulation-cli.d.ts +0 -57
  191. package/dist/security/apt-simulation-cli.d.ts.map +0 -1
  192. package/dist/security/apt-simulation-cli.js +0 -278
  193. package/dist/security/apt-simulation-cli.js.map +0 -1
  194. package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
  195. package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
  196. package/dist/security/apt-simulation-engine-complete.js +0 -441
  197. package/dist/security/apt-simulation-engine-complete.js.map +0 -1
  198. package/dist/security/apt-simulation-engine.d.ts +0 -97
  199. package/dist/security/apt-simulation-engine.d.ts.map +0 -1
  200. package/dist/security/apt-simulation-engine.js +0 -441
  201. package/dist/security/apt-simulation-engine.js.map +0 -1
  202. package/dist/security/authorization.d.ts +0 -45
  203. package/dist/security/authorization.d.ts.map +0 -1
  204. package/dist/security/authorization.js +0 -128
  205. package/dist/security/authorization.js.map +0 -1
  206. package/dist/security/comprehensive-security-research.d.ts +0 -84
  207. package/dist/security/comprehensive-security-research.d.ts.map +0 -1
  208. package/dist/security/comprehensive-security-research.js +0 -211
  209. package/dist/security/comprehensive-security-research.js.map +0 -1
  210. package/dist/security/offensive/exploitationEngine.d.ts +0 -54
  211. package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
  212. package/dist/security/offensive/exploitationEngine.js +0 -263
  213. package/dist/security/offensive/exploitationEngine.js.map +0 -1
  214. package/dist/security/real/networkExploitation.d.ts +0 -92
  215. package/dist/security/real/networkExploitation.d.ts.map +0 -1
  216. package/dist/security/real/networkExploitation.js +0 -316
  217. package/dist/security/real/networkExploitation.js.map +0 -1
  218. package/dist/security/real/persistenceImplementation.d.ts +0 -62
  219. package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
  220. package/dist/security/real/persistenceImplementation.js +0 -323
  221. package/dist/security/real/persistenceImplementation.js.map +0 -1
  222. package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
  223. package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
  224. package/dist/security/real/vulnerabilityScanner.js +0 -341
  225. package/dist/security/real/vulnerabilityScanner.js.map +0 -1
  226. package/dist/shell/capturePastePatch.d.ts +0 -9
  227. package/dist/shell/capturePastePatch.d.ts.map +0 -1
  228. package/dist/shell/capturePastePatch.js +0 -98
  229. package/dist/shell/capturePastePatch.js.map +0 -1
  230. package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
  231. package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
  232. package/dist/shell/enhancedInteractiveShell.js +0 -248
  233. package/dist/shell/enhancedInteractiveShell.js.map +0 -1
  234. package/dist/shell/inputProcessor.d.ts +0 -56
  235. package/dist/shell/inputProcessor.d.ts.map +0 -1
  236. package/dist/shell/inputProcessor.js +0 -172
  237. package/dist/shell/inputProcessor.js.map +0 -1
  238. package/dist/shell/interactiveShell-patch.d.ts +0 -27
  239. package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
  240. package/dist/shell/interactiveShell-patch.js +0 -38
  241. package/dist/shell/interactiveShell-patch.js.map +0 -1
  242. package/dist/shell/interactiveShell-robust.d.ts +0 -26
  243. package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
  244. package/dist/shell/interactiveShell-robust.js +0 -34
  245. package/dist/shell/interactiveShell-robust.js.map +0 -1
  246. package/dist/shell/multiLinePasteManager.d.ts +0 -106
  247. package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
  248. package/dist/shell/multiLinePasteManager.js +0 -308
  249. package/dist/shell/multiLinePasteManager.js.map +0 -1
  250. package/dist/shell/processInputBlockPatch.d.ts +0 -8
  251. package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
  252. package/dist/shell/processInputBlockPatch.js +0 -133
  253. package/dist/shell/processInputBlockPatch.js.map +0 -1
  254. package/dist/shell/unifiedInputProcessor.d.ts +0 -23
  255. package/dist/shell/unifiedInputProcessor.d.ts.map +0 -1
  256. package/dist/shell/unifiedInputProcessor.js +0 -92
  257. package/dist/shell/unifiedInputProcessor.js.map +0 -1
  258. package/dist/tools/enhancedSecurityTools.d.ts +0 -19
  259. package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
  260. package/dist/tools/enhancedSecurityTools.js +0 -215
  261. package/dist/tools/enhancedSecurityTools.js.map +0 -1
  262. package/dist/tools/offensiveSecurityTools.d.ts +0 -16
  263. package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
  264. package/dist/tools/offensiveSecurityTools.js +0 -285
  265. package/dist/tools/offensiveSecurityTools.js.map +0 -1
  266. package/dist/tools/realSecurityTools.d.ts +0 -18
  267. package/dist/tools/realSecurityTools.d.ts.map +0 -1
  268. package/dist/tools/realSecurityTools.js +0 -468
  269. package/dist/tools/realSecurityTools.js.map +0 -1
  270. package/dist/tools/securityTools.d.ts +0 -20
  271. package/dist/tools/securityTools.d.ts.map +0 -1
  272. package/dist/tools/securityTools.js +0 -449
  273. package/dist/tools/securityTools.js.map +0 -1
@@ -1,160 +0,0 @@
1
- import { exec } from 'node:child_process';
2
- import { readFile } from 'node:fs/promises';
3
- import { join } from 'node:path';
4
- import { promisify } from 'node:util';
5
- import { buildSandboxEnv } from './bashTools.js';
6
- const execAsync = promisify(exec);
7
- const DEFAULT_SCRIPT_ORDER = ['test', 'build', 'lint'];
8
- const MAX_STREAM_CHARS = 1200;
9
- export function createRepoCheckTools(workingDir) {
10
- return [
11
- {
12
- name: 'run_repo_checks',
13
- description: 'Run common repo validation commands (npm test / npm run build / npm run lint when present) inside the sandbox and summarize pass/fail output.',
14
- parameters: {
15
- type: 'object',
16
- properties: {
17
- scripts: {
18
- type: 'array',
19
- description: 'Optional override list of npm script names to run (defaults to test/build/lint if present).',
20
- items: { type: 'string' },
21
- },
22
- extraArgs: {
23
- type: 'string',
24
- description: 'Additional arguments appended to every npm run <script> invocation.',
25
- },
26
- },
27
- additionalProperties: false,
28
- },
29
- handler: async (args) => {
30
- const { scripts, skipped } = await resolveScripts(args['scripts'], workingDir);
31
- if (!scripts.length) {
32
- return 'No runnable npm scripts found (looked for test, build, lint). Add scripts to package.json or pass scripts explicitly.';
33
- }
34
- const extraArgsArg = args['extraArgs'];
35
- const extraArgs = typeof extraArgsArg === 'string' && extraArgsArg.trim()
36
- ? ` -- ${extraArgsArg.trim()}`
37
- : '';
38
- const env = await buildSandboxEnv(workingDir, {
39
- // macOS refuses to launch esbuild binaries when HOME is rewritten,
40
- // so repo checks keep the host HOME there to honor Gatekeeper prompts.
41
- preserveHome: process.platform === 'darwin',
42
- });
43
- const results = [];
44
- for (const script of scripts) {
45
- const command = `npm run ${script}${extraArgs}`;
46
- results.push(await runScript(script, command, workingDir, env));
47
- }
48
- if (skipped.length) {
49
- results.push({
50
- script: skipped.join(', '),
51
- command: skipped.join(', '),
52
- success: false,
53
- stdout: '',
54
- stderr: '',
55
- elapsedMs: 0,
56
- skipped: true,
57
- errorMessage: `Skipped missing scripts: ${skipped.join(', ')}`,
58
- });
59
- }
60
- return formatResults(results);
61
- },
62
- },
63
- ];
64
- }
65
- async function resolveScripts(raw, workingDir) {
66
- const declaredScripts = await readPackageScripts(workingDir);
67
- const requested = normalizeScriptList(raw);
68
- const baseline = DEFAULT_SCRIPT_ORDER.filter((name) => declaredScripts.has(name));
69
- const selected = (requested.length ? requested : baseline).filter((name) => declaredScripts.has(name));
70
- const skipped = requested.filter((name) => !declaredScripts.has(name));
71
- return { scripts: selected, skipped };
72
- }
73
- async function readPackageScripts(workingDir) {
74
- try {
75
- const raw = await readFile(join(workingDir, 'package.json'), 'utf8');
76
- const parsed = JSON.parse(raw);
77
- const scripts = parsed?.scripts && typeof parsed.scripts === 'object' ? Object.keys(parsed.scripts) : [];
78
- return new Set(scripts);
79
- }
80
- catch {
81
- return new Set();
82
- }
83
- }
84
- function normalizeScriptList(raw) {
85
- if (!raw) {
86
- return [];
87
- }
88
- if (Array.isArray(raw)) {
89
- return raw.map(String).map((value) => value.trim()).filter(Boolean);
90
- }
91
- if (typeof raw === 'string') {
92
- return raw
93
- .split(/[,\s]+/)
94
- .map((value) => value.trim())
95
- .filter(Boolean);
96
- }
97
- return [];
98
- }
99
- async function runScript(script, command, workingDir, env) {
100
- const startedAt = Date.now();
101
- try {
102
- const { stdout, stderr } = await execAsync(command, {
103
- cwd: workingDir,
104
- env,
105
- timeout: 10 * 60 * 1000, // 10 minutes to cover installs/builds
106
- maxBuffer: 10 * 1024 * 1024, // 10MB
107
- });
108
- return {
109
- script,
110
- command,
111
- success: true,
112
- stdout,
113
- stderr,
114
- elapsedMs: Date.now() - startedAt,
115
- };
116
- }
117
- catch (error) {
118
- return {
119
- script,
120
- command,
121
- success: false,
122
- stdout: error?.stdout ?? '',
123
- stderr: error?.stderr ?? '',
124
- elapsedMs: Date.now() - startedAt,
125
- errorMessage: error?.message ?? 'Command failed',
126
- };
127
- }
128
- }
129
- function formatResults(results) {
130
- if (!results.length) {
131
- return 'No checks were executed.';
132
- }
133
- const lines = ['Repo checks summary:'];
134
- for (const result of results) {
135
- const icon = result.success ? '✓' : '✕';
136
- const duration = result.elapsedMs ? ` (${(result.elapsedMs / 1000).toFixed(1)}s)` : '';
137
- const label = result.skipped ? 'skipped' : result.command;
138
- lines.push(`- ${icon} ${label}${duration}`);
139
- if (result.errorMessage && !result.success) {
140
- lines.push(` error: ${result.errorMessage}`);
141
- }
142
- const stdout = formatStream('stdout', result.stdout);
143
- if (stdout) {
144
- lines.push(` ${stdout}`);
145
- }
146
- const stderr = formatStream('stderr', result.stderr);
147
- if (stderr) {
148
- lines.push(` ${stderr}`);
149
- }
150
- }
151
- return lines.join('\n');
152
- }
153
- function formatStream(label, value) {
154
- const trimmed = value.trim();
155
- if (!trimmed) {
156
- return null;
157
- }
158
- const truncated = trimmed.length > MAX_STREAM_CHARS ? `${trimmed.slice(0, MAX_STREAM_CHARS)}...` : trimmed;
159
- return `${label}:\n${truncated}`;
160
- }
@@ -1,206 +0,0 @@
1
- import { readFileSync, readdirSync, statSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { createGrepTools } from './grepTools.js';
4
- export function createSearchTools(workingDir) {
5
- // Include the advanced Grep tool from grepTools
6
- const grepTools = createGrepTools(workingDir);
7
- return [
8
- ...grepTools,
9
- {
10
- name: 'grep_search',
11
- description: 'Search for text patterns in files (similar to grep)',
12
- parameters: {
13
- type: 'object',
14
- properties: {
15
- pattern: {
16
- type: 'string',
17
- description: 'The text pattern to search for (regex supported)',
18
- },
19
- path: {
20
- type: 'string',
21
- description: 'The directory or file to search in',
22
- },
23
- filePattern: {
24
- type: 'string',
25
- description: 'File pattern to filter (e.g., "*.ts", "*.js")',
26
- },
27
- caseSensitive: {
28
- type: 'boolean',
29
- description: 'Whether to perform case-sensitive search',
30
- },
31
- },
32
- required: ['pattern'],
33
- additionalProperties: false,
34
- },
35
- handler: async (args) => {
36
- try {
37
- const pattern = requireStringArg(args['pattern'], 'pattern');
38
- const searchPath = resolveSearchRoot(workingDir, args['path']);
39
- const filePattern = args['filePattern'] === undefined || args['filePattern'] === null
40
- ? undefined
41
- : requireStringArg(args['filePattern'], 'filePattern');
42
- const caseSensitive = args['caseSensitive'] === true;
43
- const regex = new RegExp(pattern, caseSensitive ? 'g' : 'gi');
44
- const results = searchInFiles(searchPath, regex, filePattern);
45
- if (results.length === 0) {
46
- return `No matches found for pattern: ${pattern}`;
47
- }
48
- return formatSearchResults(results);
49
- }
50
- catch (error) {
51
- return formatSearchError('searching', error);
52
- }
53
- },
54
- },
55
- {
56
- name: 'find_definition',
57
- description: 'Find function/class/interface definitions in code',
58
- parameters: {
59
- type: 'object',
60
- properties: {
61
- name: {
62
- type: 'string',
63
- description: 'The name of the function, class, or interface to find',
64
- },
65
- type: {
66
- type: 'string',
67
- enum: ['function', 'class', 'interface', 'type', 'const', 'any'],
68
- description: 'The type of definition to search for',
69
- },
70
- },
71
- required: ['name'],
72
- additionalProperties: false,
73
- },
74
- handler: async (args) => {
75
- try {
76
- const name = requireStringArg(args['name'], 'name');
77
- const normalizedType = normalizeDefinitionType(args['type']);
78
- const patterns = {
79
- function: `(function\\s+${name}|const\\s+${name}\\s*=.*=>|${name}\\s*\\([^)]*\\)\\s*{)`,
80
- class: `class\\s+${name}`,
81
- interface: `interface\\s+${name}`,
82
- type: `type\\s+${name}`,
83
- const: `const\\s+${name}`,
84
- any: `(function\\s+${name}|class\\s+${name}|interface\\s+${name}|type\\s+${name}|const\\s+${name})`,
85
- };
86
- const pattern = patterns[normalizedType];
87
- const regex = new RegExp(pattern, 'gi');
88
- const results = searchInFiles(workingDir, regex, '*.{ts,js,tsx,jsx}');
89
- if (results.length === 0) {
90
- return `No definitions found for: ${name}`;
91
- }
92
- return formatSearchResults(results);
93
- }
94
- catch (error) {
95
- return formatSearchError('finding definition', error);
96
- }
97
- },
98
- },
99
- ];
100
- }
101
- function searchInFiles(path, regex, filePattern) {
102
- const results = [];
103
- const ignoredDirs = new Set(['.git', 'node_modules', 'dist', '.next', 'build', 'coverage']);
104
- function search(currentPath) {
105
- try {
106
- const stat = statSync(currentPath);
107
- if (stat.isDirectory()) {
108
- const entries = readdirSync(currentPath);
109
- for (const entry of entries) {
110
- if (ignoredDirs.has(entry))
111
- continue;
112
- search(join(currentPath, entry));
113
- }
114
- }
115
- else if (stat.isFile()) {
116
- if (filePattern && !matchFilePattern(currentPath, filePattern)) {
117
- return;
118
- }
119
- if (isBinaryFile(currentPath)) {
120
- return;
121
- }
122
- try {
123
- const content = readFileSync(currentPath, 'utf-8');
124
- const lines = content.split('\n');
125
- lines.forEach((line, index) => {
126
- const matches = line.match(regex);
127
- if (matches) {
128
- results.push({
129
- file: currentPath,
130
- line: index + 1,
131
- content: line.trim(),
132
- match: matches[0],
133
- });
134
- }
135
- });
136
- }
137
- catch (error) {
138
- }
139
- }
140
- }
141
- catch (error) {
142
- }
143
- }
144
- search(path);
145
- return results;
146
- }
147
- function normalizeDefinitionType(value) {
148
- if (typeof value !== 'string') {
149
- return 'any';
150
- }
151
- const trimmed = value.trim().toLowerCase();
152
- if (trimmed === 'function' || trimmed === 'class' || trimmed === 'interface' || trimmed === 'type' || trimmed === 'const') {
153
- return trimmed;
154
- }
155
- return 'any';
156
- }
157
- function formatSearchResults(results) {
158
- const grouped = new Map();
159
- for (const result of results) {
160
- if (!grouped.has(result.file)) {
161
- grouped.set(result.file, []);
162
- }
163
- grouped.get(result.file).push(result);
164
- }
165
- const output = [`Found ${results.length} matches in ${grouped.size} files:\n`];
166
- for (const [file, matches] of grouped) {
167
- output.push(`\n${file}:`);
168
- for (const match of matches) {
169
- output.push(` Line ${match.line}: ${match.content}`);
170
- }
171
- }
172
- return output.join('\n');
173
- }
174
- function matchFilePattern(filePath, pattern) {
175
- const regex = new RegExp(pattern
176
- .replace(/\./g, '\\.')
177
- .replace(/\*/g, '.*')
178
- .replace(/\?/g, '.'), 'i');
179
- return regex.test(filePath);
180
- }
181
- function isBinaryFile(filePath) {
182
- const textExtensions = new Set([
183
- '.ts', '.js', '.tsx', '.jsx', '.json', '.md', '.txt',
184
- '.html', '.css', '.scss', '.sass', '.less',
185
- '.yml', '.yaml', '.xml', '.svg', '.sh', '.bash',
186
- '.py', '.rb', '.go', '.rs', '.c', '.cpp', '.h',
187
- ]);
188
- return !textExtensions.has(filePath.slice(filePath.lastIndexOf('.')));
189
- }
190
- function resolveSearchRoot(workingDir, rawPath) {
191
- if (rawPath === undefined || rawPath === null || rawPath === '') {
192
- return workingDir;
193
- }
194
- const normalized = requireStringArg(rawPath, 'path');
195
- return join(workingDir, normalized);
196
- }
197
- function requireStringArg(value, name) {
198
- if (typeof value !== 'string' || !value.trim()) {
199
- throw new Error(`${name} must be a non-empty string.`);
200
- }
201
- return value.trim();
202
- }
203
- function formatSearchError(action, error) {
204
- const message = error instanceof Error ? error.message : String(error);
205
- return `Error ${action}: ${message}`;
206
- }
@@ -1,177 +0,0 @@
1
- export function createSkillTools(options) {
2
- const repository = options.repository;
3
- return [
4
- {
5
- name: 'ListSkills',
6
- description: 'List Claude Code compatible skills discovered in the workspace, ~/.claude/skills, and ~/.erosolar/skills directories.',
7
- parameters: {
8
- type: 'object',
9
- properties: {
10
- query: {
11
- type: 'string',
12
- description: 'Optional substring to filter skills by name, namespace, or description.',
13
- },
14
- refresh_cache: {
15
- type: 'boolean',
16
- description: 'When true, force a re-scan of skill directories before listing.',
17
- },
18
- },
19
- },
20
- handler: async (args) => {
21
- if (args && typeof args['refresh_cache'] === 'boolean' && args['refresh_cache']) {
22
- repository.refresh();
23
- }
24
- const query = typeof args?.['query'] === 'string' ? args['query'].trim().toLowerCase() : '';
25
- const skills = repository
26
- .listSkills()
27
- .filter((skill) => skillMatches(skill, query))
28
- .sort((a, b) => a.name.localeCompare(b.name));
29
- if (!skills.length) {
30
- return query
31
- ? `No skills matched "${query}". Add SKILL.md files under skills/ or ~/.claude/skills and rerun the command.`
32
- : 'No skills found. Create a skills/ directory with SKILL.md files or import Claude Code plugin skills.';
33
- }
34
- const lines = [];
35
- lines.push(`Discovered ${skills.length} skill${skills.length === 1 ? '' : 's'}:`);
36
- for (const skill of skills) {
37
- lines.push(formatSkillSummary(skill));
38
- }
39
- return lines.join('\n');
40
- },
41
- },
42
- {
43
- name: 'Skill',
44
- description: 'Load a Claude Skill package by name, slug, or path. Returns metadata, documentation body, and optional resource listings.',
45
- parameters: {
46
- type: 'object',
47
- properties: {
48
- skill: {
49
- type: 'string',
50
- description: 'Skill name, slug (kebab-case), namespace-qualified id (e.g. plugin-dev:skill-development), or path to SKILL.md.',
51
- },
52
- sections: {
53
- type: 'array',
54
- description: 'Optional list of sections to include. Defaults to all sections.',
55
- items: {
56
- type: 'string',
57
- enum: ['metadata', 'body', 'references', 'scripts', 'assets'],
58
- },
59
- },
60
- refresh_cache: {
61
- type: 'boolean',
62
- description: 'When true, force a re-scan of skills before loading.',
63
- },
64
- },
65
- required: ['skill'],
66
- },
67
- handler: async (args) => {
68
- if (args && typeof args['refresh_cache'] === 'boolean' && args['refresh_cache']) {
69
- repository.refresh();
70
- }
71
- const identifier = String(args?.['skill'] ?? '').trim();
72
- if (!identifier) {
73
- return 'Skill identifier is required.';
74
- }
75
- const skill = repository.getSkill(identifier);
76
- if (!skill) {
77
- return `Skill "${identifier}" not found. Run ListSkills to inspect available skills.`;
78
- }
79
- const sections = normalizeSections(args?.['sections']);
80
- // Use simplified format for basic Skill type
81
- const output = formatBasicSkillDetail(skill, sections);
82
- return output || `Skill "${skill.name}" has no content.`;
83
- },
84
- },
85
- ];
86
- }
87
- function skillMatches(skill, query) {
88
- if (!query) {
89
- return true;
90
- }
91
- const haystack = [
92
- skill.id,
93
- skill.slug,
94
- skill.name,
95
- skill.description,
96
- skill.namespace ?? '',
97
- skill.relativeLocation ?? '',
98
- ]
99
- .join(' ')
100
- .toLowerCase();
101
- return haystack.includes(query);
102
- }
103
- function normalizeSections(value) {
104
- if (!Array.isArray(value) || !value.length) {
105
- return new Set(['metadata', 'body', 'references', 'scripts', 'assets']);
106
- }
107
- const normalized = new Set();
108
- for (const entry of value) {
109
- if (typeof entry !== 'string') {
110
- continue;
111
- }
112
- const key = entry.trim().toLowerCase();
113
- if (key === 'metadata' || key === 'body' || key === 'references' || key === 'scripts' || key === 'assets') {
114
- normalized.add(key);
115
- }
116
- }
117
- if (!normalized.size) {
118
- normalized.add('metadata');
119
- normalized.add('body');
120
- }
121
- return normalized;
122
- }
123
- function formatSkillSummary(skill) {
124
- const namespace = skill.namespace ? `${skill.namespace}:` : '';
125
- const label = `${namespace}${skill.slug}`;
126
- const location = skill.relativeLocation ?? skill.location;
127
- const resourceStatus = [
128
- `Body ${skill.hasBody ? '✅' : '—'}`,
129
- `References ${skill.hasReferences ? '✅' : '—'}`,
130
- `Scripts ${skill.hasScripts ? '✅' : '—'}`,
131
- `Assets ${skill.hasAssets ? '✅' : '—'}`,
132
- ].join(' | ');
133
- const lines = [
134
- `- ${label} — ${skill.description}`,
135
- ` Source: ${skill.sourceLabel} • Path: ${location}`,
136
- ` ${resourceStatus}`,
137
- ];
138
- return lines.join('\n');
139
- }
140
- /**
141
- * Simplified skill detail formatter for the basic Skill type from skillRepository
142
- */
143
- function formatBasicSkillDetail(skill, sections) {
144
- const lines = [];
145
- lines.push(`# Skill: ${skill.name}`);
146
- lines.push(`ID: ${skill.id}`);
147
- lines.push('');
148
- if (sections.has('metadata')) {
149
- lines.push('## Metadata');
150
- lines.push(`- Description: ${skill.description}`);
151
- lines.push(`- Category: ${skill.category}`);
152
- lines.push(`- Tags: ${skill.tags.join(', ')}`);
153
- lines.push('');
154
- }
155
- if (sections.has('body')) {
156
- lines.push('## Implementation');
157
- lines.push(`Pattern: ${skill.implementation.pattern}`);
158
- if (skill.implementation.template) {
159
- lines.push('');
160
- lines.push('Template:');
161
- lines.push(skill.implementation.template);
162
- }
163
- lines.push('');
164
- }
165
- if (sections.has('references') && skill.examples.length > 0) {
166
- lines.push('## Examples');
167
- for (const example of skill.examples) {
168
- lines.push(`### ${example.name}`);
169
- lines.push(example.description);
170
- lines.push('```');
171
- lines.push(example.code);
172
- lines.push('```');
173
- lines.push('');
174
- }
175
- }
176
- return lines.join('\n').trim();
177
- }