Read-only repository fact scanner kernel for DSH analysis plugins: deterministic probe / file index / modules / dependencies / entry points / symbols / graphs and git facts over a stable JSON schema (CLI + library + skill runbook).
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-repo-scanner
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:duyanta123/dsh-repo-scanner
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
A unified, reproducible, read-only repository fact-scanning kernel for DeepSeek Harness analysis plugins (npm package name matches the repository name: dsh-repo-scanner).
Read-only: never modifies the target repository, never installs dependencies, never executes project code.
Positioning
dsh-repo-scanner is a shared kernel: it implements "repository → structured facts" once so analysis plugins can reuse it. It serves arch-doc, dsh-refactor-insight, and dsh-test-insight (released) as well as the planned dsh-change-impact.
It answers:
- What kind of project is this (language / framework / repo type)?
- What files, modules, symbols, and entry points exist?
- How do internal and external dependencies relate, and are there cycles?
- Which files and modules does a Git change touch (read-only queries)?
- Change impact, test↔source mapping, and stale doc references (facts API)?
Boundaries: a read-only kernel that draws no analytical conclusions (that is the calling plugins' job); its schema_version / analysis_schema are independent of the DSH host version, so host upgrades do not change the schema.
Installation
As a DSH plugin (the package follows the DSH bundle spec — package.json declares dsh.bundle.patch — and registers the repo-scanner-runbook skill on install):
dsh plugin --profile web add "github:duyanta123/dsh-repo-scanner#v0.1.2"
Or from npm (as a library or standalone CLI):
npm install dsh-repo-scanner
Compatibility tiers: the library interface and CLI run standalone on Node.js >= 18 (the existing Node 18/20/22 CI is the standalone scanner regression matrix); as a DSH 0.1.5-rc.2 host plugin it requires Node.js >= 22.19. Run npm run test:compat to complete an isolated-profile install, config dump, and startup smoke test.
After installing, restart dsh --profile web and the skill becomes discoverable; the skill loads its runbook only when needed — scanning itself happens through shell calls to the CLI. Higher-level plugins depend on this package as a library and import the scanning kernel via the exports subpath dsh-repo-scanner/scanner.
Quick Start
1. Use as a standalone CLI
node bin/repo-scanner.mjs <repo_path> --probe
node bin/repo-scanner.mjs <repo_path> --files
node bin/repo-scanner.mjs <repo_path> --scan
node bin/repo-scanner.mjs <repo_path> --deps
node bin/repo-scanner.mjs <repo_path> --entry
node bin/repo-scanner.mjs <repo_path> --symbols
node bin/repo-scanner.mjs <repo_path> --graphs
node bin/repo-scanner.mjs <repo_path> --git --diff-text-file diff.txt
node bin/repo-scanner.mjs <repo_path> --all --json
2. Use as a library (higher-level plugins)
import { scanRepository } from 'dsh-repo-scanner/scanner';
const report = await scanRepository({
repoPath: '.',
modes: ['probe', 'modules', 'dependencies', 'entries', 'symbols', 'graphs', 'git'],
maxDepth: 3,
cache: true, // incremental scan cache
parsers: ['heuristic'], // pluggable parsers (tree-sitter is optional)
symbolQuery: { name: 'auth' }, // symbol query
git: { diffText },
});
3. Facts API (for analysis plugins)
import {
getChangeImpactFacts, // change impact: reverse-dependency propagation + affected modules/symbols
getTestInsightFacts, // test insight: test↔source mapping + module coverage
getDocSyncFacts, // doc sync: doc references + stale references
} from 'dsh-repo-scanner/scanner';
const impact = await getChangeImpactFacts({
repoPath: '.',
git: { statusText }, // or diffText / changedFiles
});
CLI Options
| Option | Default | Description |
|---|---|---|
--max-depth N |
3 | Maximum directory depth |
--max-files N |
2000 | Maximum file count |
--max-file-bytes N |
256000 | Per-file content read limit |
--include-dirs a,b |
empty | Scan only these directories |
--exclude-dirs a,b |
built-in | Extra excluded directories |
--language LANG |
empty | Language filter |
--format json|jsonl |
json | Output format |
--hash |
off | Compute file sha256 (over raw bytes) |
--strict |
off | Non-zero exit when errors or warnings exist |
--follow-symlinks |
off | Follow symlinks (target must stay inside the repo) |
--cache / --cache-dir DIR |
off | Incremental scan cache (writes to temp dirs only) |
--parsers a,b |
heuristic | Symbol parser chain (tree-sitter optional, auto-fallback when missing) |
--symbol-name/file/module |
empty | Symbol query filters |
--perf-budget-ms N |
60000 | Performance budget (0 disables; overrun writes a warning) |
Exit codes: 0 success; 1 errors present, or warnings present under --strict; 2 bad arguments or invalid repo path; 3 output failure or contract violation.
Output
{
"schema_version": "1.0",
"analysis_schema": { "name": "dsh-analysis-schema", "version": "1.0" },
"tool": { "name": "dsh-repo-scanner", "version": "0.1.2" },
"input": { "repo_path": ".", "resolved_path": "C:/work/app", "options": {} },
"limits": { "max_depth": 3, "max_files": 2000, "max_file_bytes": 256000, "truncated": false, "warnings": [] },
"project": {},
"files": [],
"modules": [],
"dependencies": { "internal": [], "external": [] },
"entry_points": [],
"run_methods": [],
"symbols": [],
"graphs": null,
"risks": [],
"errors": [],
"performance": null,
"git": null
}
Full field reference: docs/output-schema.md.
Safety Red Lines
- Never writes to the target repository; no checkout/reset/clean.
- Never installs dependencies or executes target project code or scripts.
- Refuses out-of-bounds paths after normalization; symlinks not followed by default.
- Never spawns subprocesses to obtain file or Git facts (enforced by executable security audit tests).
- Only imports resolvable inside the repo are classified internal; dynamic import/require goes to
risks. - Output auto-redacts tokens, passwords, connection strings, and JWTs.
Relationship to arch-doc / dsh-refactor-insight
Both plugins currently ship their own arch-profile.mjs. This package extracts that scanning logic so they can reuse it via an npm dependency or the CLI; see docs/migration-guide.md for the planned migration order and field mapping (planned, not yet executed).
Documentation
- docs/output-schema.md — output JSON contract (
schema_version 1.0, full field tables) - docs/scanning-rules.md — scanning rules (directory safety, language detection, module detection, dependency resolution, pluggable parsers, cache, performance budget, security audit)
- docs/migration-guide.md — plan for migrating analysis plugins onto the shared kernel
- examples/ — output examples
- CHANGELOG.md — release notes
- PLUGIN-MAINTENANCE.md — repo maintenance runbook
License
Links
More in this category
yjh051108/dsh-routing-suite★ 6997
One repository, three parts: a runtime injector for DSH plugin packages (inject, hot-reload, unload, promote a dev staging tool to the front, route self-heal, plus a settings-page plugin manager that lists, unloads and drags folders in to internalize), a task-aware reasoning-mode router agent preset (router-standard / router-spec / router-react), and a graded two-level task protocol whose six tools (commit_star, lock_stage, revise_do, edit_plan, mark_task, redteam_verdict) pin task state to disk. The injector implementation ships in-tree, so the install carries its own behaviour rather than a dependency list.
strukto-ai/mirage#dsh★ 3696
Swaps the filesystem and bash providers for a mirage virtual workspace: file tools and shell commands run over mounted resources (RAM, S3, Redis, Slack, Gmail, Notion, Postgres) instead of the host disk, with per-mount read/write/exec modes, per-command sandbox routing (monty, pyodide, quickjs in process; docker, e2b, daytona remote), and installed CLIs (git, gh, slack, linear, ntn, gws, or one you register) as head words in the virtual terminal.
first-fluke/oh-my-agent#dsh★ 1344
Runs project OMA checks before and after tool execution and when a turn tries to finish. Installs its OMA CLI dependency and initializes unconfigured projects on first use. Requires Node.js 22+; initial setup needs network access and project write access.
hust-open-atom-club/oh-dsh★ 322
Community distribution: TUI, desktop, and Web UI as one bundle with layered installation.
weijiafu14/pi2dsh★ 217
Pi Host ABI compatibility engine: after one install, unmodified Pi extensions from npm mount as native DSH plugins with `dsh plugin add <pi-package>`. Verified end to end on stock DSH with pi-mcp-adapter (full MCP manager: OAuth, resources, prompts, MCP Apps, elicitation, sampling), @tintinweb/pi-subagents, pi-code, pi-hermes-memory and pi-background-tasks; `pi2dsh inspect` reports a package's compatibility before installing.
Fishquito7/dsh-skill-mcp-panel★ 207
Manages DSH skills and MCP servers from the web settings: skill cards with hot enable/disable, workspace scopes, groups, batch migration and drag-and-drop import, plus stdio/HTTP MCP CRUD with connection tests, secret redaction and the unified dsh-panel CLI.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.