hydra-nano 0.2.0 → 0.3.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 +15 -0
- package/package.json +3 -2
- package/skills/hydra/SKILL.md +13 -19
- package/skills/hydra/scripts/hooks/route-tests.mjs +6 -4
- package/skills/hydra/scripts/hydra.mjs +200 -14
- package/skills/hydra/scripts/lib/claude_hooks.mjs +49 -10
- package/skills/hydra/scripts/lib/integrations.mjs +38 -1
- package/skills/hydra/scripts/lib/ledger.mjs +8 -4
- package/skills/hydra/scripts/lib/refactor.mjs +1122 -0
- package/skills/hydra/scripts/mcp.mjs +25 -0
|
@@ -29,6 +29,12 @@ const TOOLS = [
|
|
|
29
29
|
inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'One test or build command, for example "npm test" or "pytest -q tests/test_api.py".' }, cwd: cwdProperty }, required: ['command'] } },
|
|
30
30
|
{ name: 'hydra_os', description: 'Answer a read-only question about this machine (ports, processes, disk, memory, system, environment variable names).',
|
|
31
31
|
inputSchema: { type: 'object', properties: { question: { type: 'string', description: 'The question, in plain words.' } }, required: ['question'] } },
|
|
32
|
+
{ name: 'hydra_smell', description: 'Scan a file, directory or git diff for Refactoring.Guru code smells (Long Method, Large Class, Deep Nesting, Long Parameter List, etc.) with exact line numbers and refactoring recipes.',
|
|
33
|
+
inputSchema: { type: 'object', properties: { target: { type: 'string', description: 'File or directory path to scan. Defaults to repository root.' }, diff: { type: 'boolean', description: 'If true, scans newly introduced smells in unstaged/staged git changes.' }, cwd: cwdProperty } } },
|
|
34
|
+
{ name: 'hydra_refactor', description: 'Generate a step-by-step Refactoring.Guru recipe (Extract Method, Guard Clauses, Parameter Object) for a function or line range in a file.',
|
|
35
|
+
inputSchema: { type: 'object', properties: { file: { type: 'string', description: 'Path to the file.' }, symbol: { type: 'string', description: 'Function, method or class name.' }, lines: { type: 'string', description: 'Line range like "40-90".' }, cwd: cwdProperty }, required: ['file'] } },
|
|
36
|
+
{ name: 'hydra_design', description: 'Query GoF design patterns from Refactoring.Guru (intent, problem, solution, applicability) or get pattern recommendations for an architectural problem.',
|
|
37
|
+
inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Pattern name (e.g. strategy, builder, observer) or architectural problem description.' }, file: { type: 'string', description: 'Optional path to file to analyze for pattern recommendation.' }, cwd: cwdProperty }, required: ['query'] } },
|
|
32
38
|
];
|
|
33
39
|
|
|
34
40
|
let client = 'mcp-client';
|
|
@@ -103,6 +109,25 @@ export async function callTool(name, args = {}) {
|
|
|
103
109
|
}
|
|
104
110
|
return hydra(['run', '--', ...argv], workdir(args.cwd));
|
|
105
111
|
}
|
|
112
|
+
if (name === 'hydra_smell') {
|
|
113
|
+
const cliArgs = ['smell'];
|
|
114
|
+
if (args.diff) cliArgs.push('--diff');
|
|
115
|
+
if (args.target) cliArgs.push(args.target);
|
|
116
|
+
return hydra(cliArgs, workdir(args.cwd));
|
|
117
|
+
}
|
|
118
|
+
if (name === 'hydra_refactor') {
|
|
119
|
+
if (typeof args.file !== 'string' || !args.file.trim()) throw new Error('file is required');
|
|
120
|
+
const cliArgs = ['refactor', args.file];
|
|
121
|
+
if (args.symbol) cliArgs.push(args.symbol);
|
|
122
|
+
if (args.lines) cliArgs.push('--lines', args.lines);
|
|
123
|
+
return hydra(cliArgs, workdir(args.cwd));
|
|
124
|
+
}
|
|
125
|
+
if (name === 'hydra_design') {
|
|
126
|
+
if (typeof args.query !== 'string' || !args.query.trim()) throw new Error('query is required');
|
|
127
|
+
const cliArgs = ['design', args.query];
|
|
128
|
+
if (args.file) cliArgs.push('--file', args.file);
|
|
129
|
+
return hydra(cliArgs, workdir(args.cwd));
|
|
130
|
+
}
|
|
106
131
|
throw new Error(`Unknown tool: ${name}`);
|
|
107
132
|
}
|
|
108
133
|
|