jaxhu1108/dsh-code-intelligence ↗★ 0
dsh-code-intelligence
DSH code intelligence: TypeScript, Python, and Kotlin LSP navigation plus read-only AST search.
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add dsh-code-intelligenceUsage
ast_grep
// TypeScript: find calls of greet(...) in one file
ast_grep({ pattern: 'greet($$$)', path: 'src/consumer.ts' })
// A whole directory needs an explicit language
ast_grep({ pattern: 'function $F($$$) { $$$ }', path: 'src', lang: 'typescript' })
// Python, with a return annotation
ast_grep({ pattern: 'def $F($$$) -> $T: $$$', path: 'src', lang: 'python' })
// Kotlin typed functions must carry the return type in the pattern
ast_grep({ pattern: 'fun $F($$$): $T { $$$ }', path: 'src', lang: 'kotlin' })
Arguments are just pattern, path, lang. There is no rewrite option and no way to ask for one.
Language inference: for a single file the extension decides (.ts/.tsx/.js/.jsx/.mjs/.cjs/.mts/.cts, .py/.pyi, .rs, .go, .java, .kt/.kts, .json, .yaml/.yml, .html, .css). Anything unrecognised falls back to JavaScript — so if you're searching a directory, or a language that isn't in that list, pass lang explicitly. For a directory the default is JavaScript.
But language coverage is broader than that inference table: lang is handed to ast-grep, so any language ast-grep itself supports works — just name it.
Paths must stay inside the workspace, relative, no absolute paths. Matching goes through DSH's subprocess service as an argv vector, never through a shell. Output is capped at 120,000 bytes on stdout and 16,000 on stderr; if stdout would overflow, the call fails loudly and tells you to narrow the query rather than returning half-parsed JSON. The tool has a 30-second timeout and forwards cancellation.
lsp
lsp({ operation: 'goToDefinition', file_path: 'src/consumer.ts', line: 2, character: 18 })
lsp({ operation: 'findReferences', file_path: 'src/source.ts', line: 1, character: 17 })
lsp({ operation: 'hover', file_path: 'src/consumer.ts', line: 2, character: 18 })
lsp({ operation: 'goToImplementation', file_path: 'src/service.ts', line: 3, character: 15 })
line and character are 1-based; character counts UTF-16 columns. Results depend on the project being configured well enough for the language server to understand it — an empty result usually means "the server couldn't resolve this", not "no such symbol". goToImplementation only has something to return when an interface or abstract declaration actually exists to implement.
TypeScript and Python are launched by Node directly — no shell, no global installs — and TypeScript is pointed at the bundled typescript package with the syntax-only server disabled (useSyntaxServer: never), because the syntax server alone returns import aliases instead of resolving to the real declaration.