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_generate renders .gitignore content 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_detect scores a list of repository paths (for example the output of git 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 into gitignore_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

ToolArgumentsReturns
gitignore_generatetemplates: string[] (names to include; [] uses defaultTemplates), custom: string[] (extra patterns; [] when none)ok, content, patterns, usedTemplates, unknownTemplates, warnings, lineCount
gitignore_detectfiles: string[] (repository-relative paths)ok, detected, evidence, filesScanned, availableTemplates, warnings

Both tools are declared concurrency-safe.

Detection scoring

SignalExampleWeight
Manifest / marker filepackage.json, pyproject.toml, .DS_Store, .classpath3
AppleDouble prefix._thumbnail.png3
Known directorynode_modules/, __pycache__/, .vscode/2
Extension.ts, .py, .iml, .swp1

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

FieldTypeDefaultPurpose
headerstring# Generated by dsh-gitignore-genFirst line of every generated file
defaultTemplatesstring[]["node", "macos", "ide"]Used when a call passes an empty templates list
detectMinScorenumber1Evidence-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