dsh-gitignore-gen
September 12, 2026 · View on GitHub
@qingshanjiluo/dsh-gitignore-gen — a DeepSeek Harness (Cordis) tool plugin that authors
.gitignore text from self-contained templates. It ships no browser half, touches no
filesystem, and makes no network calls: both tools are pure string functions over the
arguments the model supplies, so their behaviour is reproducible and unit-testable.
What it does
gitignore_generaterenders.gitignorecontent by merging any number of built-in template strings (node,python,macos,ide) with caller-supplied custom patterns, de-duplicating patterns across sections and reporting names it does not know instead of silently dropping them. The tool returns text; you decide where to save it.gitignore_detectscores a list of repository paths (for example the output ofgit ls-files) against extension, manifest, and directory signals, and returns the template names it suggests plus one evidence line per signal — ready to feed back intogitignore_generate.
Built-in templates are embedded in the plugin, so generation works offline.
Install
npx -y @deepseek-ai/dsh plugin --profile web add @qingshanjiluo/dsh-gitignore-gen
Tools
| Tool | Arguments | Returns |
|---|---|---|
gitignore_generate | templates: string[] (names to include; [] uses defaultTemplates), custom: string[] (extra patterns; [] when none) | ok, content, patterns, usedTemplates, unknownTemplates, warnings, lineCount |
gitignore_detect | files: string[] (repository-relative paths) | ok, detected, evidence, filesScanned, availableTemplates, warnings |
Both tools are declared concurrency-safe.
Detection scoring
| Signal | Example | Weight |
|---|---|---|
| Manifest / marker file | package.json, pyproject.toml, .DS_Store, .classpath | 3 |
| AppleDouble prefix | ._thumbnail.png | 3 |
| Known directory | node_modules/, __pycache__/, .vscode/ | 2 |
| Extension | .ts, .py, .iml, .swp | 1 |
Repeated signals of the same kind count once per template. Only templates whose total
reaches detectMinScore are suggested; the rest are reported in warnings.
Configuration
| Field | Type | Default | Purpose |
|---|---|---|---|
header | string | # Generated by dsh-gitignore-gen | First line of every generated file |
defaultTemplates | string[] | ["node", "macos", "ide"] | Used when a call passes an empty templates list |
detectMinScore | number | 1 | Evidence-score cutoff for gitignore_detect |
The bundle attaches itself through cordis.patch.yml:
- insert:
- id: gitignore-gen
name: '@qingshanjiluo/dsh-gitignore-gen'
config:
header: '# Generated by dsh-gitignore-gen'
defaultTemplates:
- node
- macos
- ide
detectMinScore: 1
Example
// gitignore_detect
{ "files": ["package.json", "src/app.ts", "app.py", ".DS_Store"] }
// -> detected: ["node", "macos", "python"] (ranked by evidence score)
// -> evidence: ["node (+3): package.json <- package.json", ...]
// gitignore_generate
{ "templates": ["node", "macos"], "custom": ["secrets/*.pem"] }
# Generated by dsh-gitignore-gen
# Node.js
node_modules/
...
# macOS
.DS_Store
...
# Custom
secrets/*.pem
Development
npm install
npx tsc --noEmit
npm run build # emits lib/index.js + lib/index.d.ts
npx vitest run
node scripts/load-smoke.mjs
License
MIT