@sidleo3/instruction-scan
v0.2.2
Published
Configurable AGENTS.md file discovery provider for DSH: scan cwd / project / ancestors / global, editable candidates and project-root markers, replacing hardcoded discovery in dsh-agent-instructions.
Downloads
913
Maintainers
Readme
@sidleo3/instruction-scan
Configurable AGENTS.md instruction-file discovery provider for DeepSeek Harness (DSH). Replaces the hardcoded discovery of dsh-agent-instructions with four toggleable layers and user-editable candidates/markers.
Features
- Four scanning layers: cwd (highest) → project/parents (mutually exclusive) → global (lowest)
- scanParents mode: Walk every ancestor from cwd upward to filesystem root — no depth limit
- Custom candidates: Add/remove base instruction file names and local overlay names
- Custom project-root markers: Configure which files/dirs identify a project root
- Web GUI card: Settings → Plugins → 指令扫描 — configure everything from the browser
- Provider interface: Exposes
instructionScanProvideron context for agent-instructions to consume
Installation
# From npm
dsh plugin --profile web add @sidleo3/instruction-scan
# From local checkout
dsh plugin --profile web add link:/path/to/instruction-scanConfiguration
interface InstructionScanConfig {
scanCwd: boolean // default: true
scanProject: boolean // default: true (mutually exclusive with scanParents)
scanParents: boolean // default: false (mutually exclusive with scanProject)
scanGlobal: boolean // default: true
instructionFileCandidates: string[] // default: ['AGENTS.md', 'CLAUDE.md']
localInstructionFileCandidates: string[] // default: ['AGENTS.local.md', 'CLAUDE.local.md']
projectRootMarkers: string[] // default: ['.git']
dshHome: string // default: '~/.dsh'
}How it works
- Discovery: Scans configured layers for instruction files matching candidates
- Provider: Exposes results via
ctx.instructionScanProvider.list(cwd) - agent-instructions: Modified to consume from this provider (falls back to built-in discovery if unavailable)
Usage
The plugin mounts its workspace-instruction injection pipeline at HOST scope:
an unscoped ctx.on('agent/pre-step') listener receives every agent's
pre-step regardless of preset, so instruction-scan works in all modes
(standard / liangshen / code / …) — no preset editing or special preset
selection needed. Installation is fully automatic: the first activation seeds
~/.dsh/dsh-instruction-scan.json (parents mode by default).
- Install:
(From a checkout:dsh plugin --profile web add @sidleo3/instruction-scandsh plugin --profile web add link:/path/to/instruction-scan) - Restart DSH (the host half mounts the pipeline on activation).
- Use ANY preset for new sessions. Workspace instructions are injected per the configured four-layer scan.
- Toggle layers from Settings → Plugins → AGENTS扫描; changes persist to
~/.dsh/dsh-instruction-scan.jsonand the pipeline reads disk config on every session start.
No duplicates: the pipeline removes every pending
agent-instructionsinbox message (including those injected by the built-indsh-agent-instructionsrow in each preset) before injecting its own synthesized result, so the built-in discovery is fully replaced.
Development
pnpm build # tsdown → lib/index.js + lib/client.js
pnpm typecheck # tsc --noEmit