docgrity 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +80 -127
  2. package/package.json +31 -164
  3. package/.github/workflows/ci.yml +0 -54
  4. package/.vscodeignore +0 -13
  5. package/action/LICENSE +0 -21
  6. package/action/README.md +0 -104
  7. package/action/examples/docgrity.yml +0 -61
  8. package/action/package.json +0 -38
  9. package/action/test/corpus.test.mjs +0 -59
  10. package/action/test/issues.test.mjs +0 -89
  11. package/action/test/report.test.mjs +0 -76
  12. package/docgrity_logo.png +0 -0
  13. package/image.png +0 -0
  14. package/media/icon.png +0 -0
  15. package/media/icon.svg +0 -5
  16. package/samples/api-limits.md +0 -23
  17. package/samples/architecture-notes.md +0 -28
  18. package/samples/deployment-guide.md +0 -23
  19. package/samples/integration-guide.md +0 -21
  20. package/samples/release-process.md +0 -23
  21. package/src/agents/assess.ts +0 -187
  22. package/src/agents/prompts.ts +0 -94
  23. package/src/agents/selectModel.ts +0 -50
  24. package/src/core/json.ts +0 -58
  25. package/src/core/prefilter.ts +0 -56
  26. package/src/core/slug.ts +0 -10
  27. package/src/core/verify.ts +0 -15
  28. package/src/extension.ts +0 -142
  29. package/src/findings/diagnostics.ts +0 -78
  30. package/src/findings/report.ts +0 -68
  31. package/src/findings/store.ts +0 -60
  32. package/src/findings/tree.ts +0 -93
  33. package/src/github/issues.ts +0 -90
  34. package/src/github/owners.ts +0 -60
  35. package/src/log.ts +0 -22
  36. package/src/scanner/candidates.ts +0 -62
  37. package/src/scanner/corpus.ts +0 -75
  38. package/src/scanner/scan.ts +0 -215
  39. package/test/candidates.test.ts +0 -63
  40. package/test/json.test.ts +0 -87
  41. package/test/prefilter.test.ts +0 -65
  42. package/test/slug.test.ts +0 -31
  43. package/test/verify.test.ts +0 -47
  44. package/tsconfig.json +0 -15
  45. package/vitest.config.mts +0 -9
  46. /package/{action/action.yml → action.yml} +0 -0
  47. /package/{action/bin → bin}/action.js +0 -0
  48. /package/{action/bin → bin}/docgrity.js +0 -0
  49. /package/{action/src → src}/corpus.js +0 -0
  50. /package/{action/src → src}/issues.js +0 -0
  51. /package/{action/src → src}/llm.js +0 -0
  52. /package/{action/src → src}/prompts.js +0 -0
  53. /package/{action/src → src}/report.js +0 -0
  54. /package/{action/src → src}/scan.js +0 -0
package/README.md CHANGED
@@ -1,151 +1,104 @@
1
- # Docgrity for VS Code
1
+ # Docgrity Action & CLI
2
2
 
3
- [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/ujjavala.docgrity?label=VS%20Code%20Marketplace)](https://marketplace.visualstudio.com/items?itemName=ujjavala.docgrity)
4
- [![CI](https://github.com/ujjavala/docgrity-vscode/actions/workflows/ci.yml/badge.svg)](https://github.com/ujjavala/docgrity-vscode/actions/workflows/ci.yml)
3
+ **Continuous doc-integrity for your repo's markdown: contradictions, duplicates and open
4
+ questions — as a GitHub Action (with deduplicated issues) and a read-only local CLI.**
5
5
 
6
- **Find where your repository's docs disagree with themselves — and raise a GitHub issue to get it fixed.**
6
+ Part of the Docgrity family:
7
7
 
8
- **Install:** search “Docgrity” in the Extensions view, or `code --install-extension ujjavala.docgrity`
9
-
10
- The repo-docs sibling of the [Docgrity Confluence app](https://ujjavala.github.io/docgrity-site/).
11
- Scoped deliberately: **markdown files only** (`**/*.md` — READMEs, ADRs, runbooks, guides).
12
-
13
- This repo contains all three repo-docs surfaces:
14
-
15
- | Surface | Where | Acts? |
8
+ | Surface | Job | Acts? |
16
9
  |---|---|---|
17
- | **VS Code extension** (this root) | interactive scans in the editor | raises issues, human-approved one at a time |
18
- | **GitHub Action** ([action/](action/)) | CI: schedule + PRs | opt-in deduped issues, job summary, HTML report |
19
- | **Local CLI** ([action/bin/docgrity.js](action/bin/docgrity.js)) | your terminal | **read-only** report dashboard, no actions |
20
-
21
- See [action/README.md](action/README.md) for Action and CLI usage
22
- (`uses: ujjavala/docgrity-vscode/action@main`).
23
-
24
- ## What it does
25
-
26
- 1. **Scan** — `Docgrity: Scan repository docs` collects your markdown files, picks
27
- candidate pairs locally with TF-IDF (no network), then asks the LLM to assess:
28
- - **Contradictions** — conflicting factual claims across two docs
29
- - **Duplicates**substantially overlapping docs that should be merged
30
- - **Open questions** unresolved TBD/TODO/"who owns this?" buried in docs
31
- 2. **Review** — findings appear in the Docgrity view with evidence excerpts; each
32
- excerpt is a click away from the exact spot in the file, and shows as a
33
- diagnostic squiggle. Every finding records the model + prompt version.
34
- 3. **Act** — right-click a finding → **Raise GitHub issue**. Docgrity drafts the
35
- issue (title, evidence, suggested next step, *potential* owner from git history),
36
- shows you the draft, and only creates it after you approve. The issue is labelled
37
- `docgrity` and `docgrity:<type>`.
38
-
39
- ## Zero cost, zero keys
40
-
41
- - All LLM calls go through **your own GitHub Copilot subscription** via the VS Code
42
- Language Model API. No API keys, no servers, no telemetry.
43
- - Issue creation uses VS Code's built-in GitHub sign-in.
44
- - Candidate selection is local TF-IDF — the LLM only sees the top pairs.
45
-
46
- ## Modes: report-only vs report + issues
47
-
48
- | `docgrity.mode` | Behaviour |
49
- |---|---|
50
- | `report-and-issue` (default) | Scan, review findings, and raise GitHub issues — each previewed and human-approved. |
51
- | `report-only` | Scan and review only. The *Raise GitHub issue* action is hidden and blocked — the extension is guaranteed to never post anywhere. Good for client repos, compliance-sensitive environments, or just reading. |
52
-
53
- Set it in Settings → search “docgrity mode”, or in `.vscode/settings.json`:
54
-
55
- ```json
56
- { "docgrity.mode": "report-only" }
10
+ | [Confluence app](https://ujjavala.github.io/docgrity-site/) | wiki integrity | comments (human-approved) |
11
+ | VS Code extension | interactive repo-doc scans | raises issues (human-approved) |
12
+ | **This Action** | continuous CI enforcement | issues (opt-in, deduped, capped) + report |
13
+ | **This CLI** | local observation | **read-only** — report dashboard only |
14
+
15
+ ## GitHub Action
16
+
17
+ ```yaml
18
+ - uses: ujjavala/docgrity-vscode/action@main
19
+ env:
20
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21
+ with:
22
+ provider: github-models # freeuses GITHUB_TOKEN, no API key
23
+ create_issues: 'true' # opt-in; default false
24
+ max_new_issues: 5
57
25
  ```
58
26
 
59
- Per-workspace settings win over user settings, so you can default to report-only
60
- globally and enable issues only in repos you own.
27
+ Full example with weekly schedule, PR trigger and Pages report publishing:
28
+ [examples/docgrity.yml](examples/docgrity.yml).
29
+
30
+ What it does per run:
61
31
 
62
- ## Choosing which checks run
32
+ 1. Collects markdown docs (`**/*.md`, capped), selects candidate pairs locally (TF-IDF),
33
+ assesses with the LLM using versioned prompts and typed-JSON validation, verifies
34
+ every evidence excerpt verbatim against the source (hallucination guard).
35
+ 2. Writes a **job summary** table and a **static HTML report** (`docgrity-report/`)
36
+ with evidence, links to docs on GitHub, and *potential* owners from git history.
37
+ 3. **Opt-in** (`create_issues: true`): syncs GitHub issues **deduplicated by a stable
38
+ finding fingerprint** — new findings create issues (capped per run), unchanged ones
39
+ are left alone, resolved ones are auto-closed with a comment. Labels: `docgrity`,
40
+ `docgrity:<type>`.
63
41
 
64
- Each check is a separate toggle — run any combination:
42
+ ### Providers
65
43
 
66
- | Setting | Default | What it does |
44
+ | provider | key | cost |
67
45
  |---|---|---|
68
- | `docgrity.checks.duplicates` | `true` | Pairwise duplicate detection |
69
- | `docgrity.checks.contradictions` | `true` | Pairwise contradiction detection |
70
- | `docgrity.checks.openQuestions` | `true` | Per-doc unresolved-question detection |
46
+ | `github-models` (default in CI) | none — uses `GITHUB_TOKEN` with `models: read` | free (being retired by GitHub — prefer a BYO provider) |
47
+ | `gemini` / `openai` / `anthropic` | `api_key` input (use a repo secret) | your key |
48
+ | `ollama` | none — local or tunnelled endpoint | free, fully private |
71
49
 
72
- These combine freely with any model (`docgrity.model.*`) and either mode
73
- (`docgrity.mode`). Disabling checks also speeds up scans: pair selection is
74
- skipped entirely when both pairwise checks are off.
50
+ ## Local CLI (read-only)
75
51
 
76
- ## Scan performance
52
+ ```bash
53
+ npm i -g docgrity
54
+ docgrity scan --open
55
+ ```
77
56
 
78
- - When both pairwise checks are enabled they run as a **single combined LLM
79
- call per pair** (the model reads each pair once, not twice).
80
- - Docs with no open-question signals (no TODO/TBD/`???`/unanswered questions)
81
- are **pre-filtered out** before any LLM call.
82
- - Assessments run with **bounded concurrency** (4 at a time).
83
- - For large repos, tune `docgrity.maxFiles`, `docgrity.maxPairs`, and
84
- `docgrity.include` to narrow the corpus.
57
+ or without installing: `npx docgrity scan --open` (from a repo checkout:
58
+ `npx github:ujjavala/docgrity-vscode scan --open`).
85
59
 
86
- ## Choosing your model (Copilot, Claude, GPT, local llama…)
60
+ Runs the same scan locally and opens the **report dashboard**: findings, evidence,
61
+ doc links and potential owners. **The CLI never raises issues or takes any action** —
62
+ by design, local scans observe; only CI (explicitly opted in) acts.
87
63
 
88
- Run **`Docgrity: Select AI model`** from the command palette — it lists every model
89
- VS Code exposes and saves your choice. Or set it manually:
64
+ ```
65
+ Usage: docgrity scan [options]
90
66
 
91
- | Setting | Meaning | Default |
92
- |---|---|---|
93
- | `docgrity.model.vendor` | `vscode.lm` vendor id (`copilot` covers Copilot + BYOK models; empty = any) | `copilot` |
94
- | `docgrity.model.family` | preferred model family, e.g. `gpt-4o`, `claude-sonnet-4.5`, `llama3.1` (empty = first available) | `""` |
95
-
96
- **Options, in order of simplicity:**
97
-
98
- 1. **Copilot (default)** sign in to GitHub Copilot; nothing to configure.
99
- 2. **Claude / GPT / Gemini via Copilot** — any model enabled in Copilot's model picker
100
- is available; set `docgrity.model.family` (e.g. `claude-sonnet-4.5`) or use
101
- *Select AI model*.
102
- 3. **Local Ollama** install [Ollama](https://ollama.com), `ollama pull llama3.1`,
103
- then in Copilot Chat → **Manage models** → add the Ollama model. It registers under
104
- the `copilot` vendor; pick it with *Select AI model*. Fully local — no doc content
105
- leaves your machine.
106
- 4. **Remote Ollama over a Cloudflare Tunnel** — if your model runs on another box
107
- (home server, GPU rig):
108
- ```bash
109
- # on the machine running Ollama
110
- cloudflared tunnel --url http://localhost:11434
111
- ```
112
- Point Copilot's Manage models → Ollama endpoint at the generated
113
- `https://….trycloudflare.com` URL. Note: quick tunnels get a **new URL on every
114
- restart** — re-update the endpoint each time, or create a **named tunnel** with your
115
- own domain for a stable URL (`cloudflared tunnel create …`). Protect a named tunnel
116
- with Cloudflare Access — an open LLM endpoint is abusable.
117
-
118
- Small local models fail Docgrity's strict-JSON validation more often than hosted
119
- ones; failed responses are rejected safely (never mis-recorded) — expect fewer
120
- findings rather than wrong ones. 8B+ instruct models work best.
121
-
122
- ## Design principles (shared with the Forge app)
123
-
124
- - Typed JSON outputs only — model responses are validated in code, never trusted prose.
125
- - Every finding requires verbatim evidence, verified against the source file
126
- (hallucinated quotes are dropped).
127
- - Ownership is always *potential* (last git author), never asserted.
128
- - Nothing is posted anywhere without explicit human approval.
129
- - Doc content is untrusted input — it cannot override agent instructions.
67
+ --dir <path> Directory to scan (default: .)
68
+ --out <path> Report output directory (default: docgrity-report)
69
+ --open Open the HTML report when done
70
+
71
+ --checks <list> duplicates, contradictions, open-questions — any combination
72
+ --max-files <n> Max markdown files (default: 200)
73
+ --max-pairs <n> Max document pairs (default: 25)
74
+ --threshold-duplicate / --threshold-contradiction / --threshold-open-question <0..1>
75
+
76
+ --provider <p> ollama | gemini | openai | anthropic | github-models
77
+ --model <m> Model name
78
+ --endpoint <url> Ollama endpoint (default http://localhost:11434)
130
79
 
131
- ## Requirements
80
+ --version, -v Installed version + latest on npm
81
+ --help, -h Full help
82
+ ```
132
83
 
133
- - VS Code 1.95+, an active GitHub Copilot subscription, a workspace with a GitHub
134
- `origin` remote (for issue creation).
84
+ Provider auto-detection: `DOCGRITY_API_KEY` set `gemini`; else `GITHUB_TOKEN`
85
+ `github-models`; else → `ollama` (local, fully private — nothing leaves your machine).
135
86
 
136
- ## Development
87
+ Examples:
137
88
 
138
89
  ```bash
139
- npm install
140
- npm run compile
141
- # F5 in VS Code to launch the Extension Development Host
90
+ docgrity scan --checks contradictions # one check only
91
+ docgrity scan --checks duplicates,open-questions --max-pairs 10
92
+ docgrity scan --provider ollama --model llama3.1:8b # fully local
93
+ DOCGRITY_API_KEY=... docgrity scan --provider gemini --open
142
94
  ```
143
95
 
144
- ## Settings
96
+ ## Design principles (shared across all Docgrity surfaces)
145
97
 
146
- | Setting | Default | Purpose |
147
- |---|---|---|
148
- | `docgrity.include` | `**/*.md` | Docs glob (markdown only by design) |
149
- | `docgrity.exclude` | `**/{node_modules,…}/**` | Excluded paths |
150
- | `docgrity.maxFiles` / `docgrity.maxPairs` | 200 / 25 | Scan caps |
151
- | `docgrity.thresholds.*` | 0.75 / 0.7 / 0.6 | Confidence gates per finding type |
98
+ - Typed JSON outputs only; model responses validated in code.
99
+ - Every finding requires verbatim evidence, verified against the source file.
100
+ - Ownership is always *potential* (last git author), never asserted.
101
+ - Action-taking is opt-in, capped, and auditable (issue trailer records model +
102
+ prompt version + fingerprint).
103
+ - Doc content is untrusted input it cannot override agent instructions.
104
+ - Zero dependencies; plain Node 20+ ESM.
package/package.json CHANGED
@@ -1,171 +1,38 @@
1
1
  {
2
2
  "name": "docgrity",
3
- "displayName": "Docgrity — Doc Integrity for Repos",
4
- "description": "Finds contradictions, duplicates and open questions across your repository's markdown docs, and raises GitHub issues to get them fixed. Uses your own Copilot subscription no keys, no servers.",
5
- "version": "0.1.2",
6
- "publisher": "ujjavala",
3
+ "version": "0.1.3",
4
+ "description": "Docgrity doc-integrity scans for CI and local use: contradictions, duplicates and open questions across repository markdown docs. Read-only CLI generates an HTML report; never posts anything.",
5
+ "type": "module",
6
+ "bin": { "docgrity": "bin/docgrity.js" },
7
+ "files": [
8
+ "bin/",
9
+ "src/",
10
+ "action.yml",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "engines": { "node": ">=20" },
15
+ "scripts": {
16
+ "scan": "node bin/docgrity.js scan",
17
+ "test": "node --test \"test/*.test.mjs\""
18
+ },
7
19
  "repository": {
8
20
  "type": "git",
9
- "url": "https://github.com/ujjavala/docgrity-vscode"
10
- },
11
- "bin": {
12
- "docgrity": "action/bin/docgrity.js"
21
+ "url": "git+https://github.com/ujjavala/docgrity-vscode.git",
22
+ "directory": "action"
13
23
  },
14
- "icon": "media/icon.png",
15
- "engines": {
16
- "vscode": "^1.95.0"
17
- },
18
- "categories": [
19
- "AI",
20
- "Linters",
21
- "Other"
24
+ "homepage": "https://ujjavala.github.io/docgrity-vscode-site/",
25
+ "bugs": "https://github.com/ujjavala/docgrity-vscode/issues",
26
+ "keywords": [
27
+ "documentation",
28
+ "markdown",
29
+ "lint",
30
+ "contradiction",
31
+ "duplicate",
32
+ "llm",
33
+ "cli",
34
+ "github-action"
22
35
  ],
23
- "main": "./out/extension.js",
24
- "activationEvents": [],
25
- "contributes": {
26
- "commands": [
27
- {
28
- "command": "docgrity.scan",
29
- "title": "Docgrity: Scan repository docs"
30
- },
31
- {
32
- "command": "docgrity.selectModel",
33
- "title": "Docgrity: Select AI model (Copilot / Claude / local…)"
34
- },
35
- {
36
- "command": "docgrity.raiseIssue",
37
- "title": "Docgrity: Raise GitHub issue for finding"
38
- },
39
- {
40
- "command": "docgrity.openReport",
41
- "title": "Docgrity: Open findings report (markdown)"
42
- },
43
- {
44
- "command": "docgrity.clearFindings",
45
- "title": "Docgrity: Clear findings"
46
- }
47
- ],
48
- "viewsContainers": {
49
- "activitybar": [
50
- {
51
- "id": "docgrity",
52
- "title": "Docgrity",
53
- "icon": "media/icon.svg"
54
- }
55
- ]
56
- },
57
- "views": {
58
- "docgrity": [
59
- {
60
- "id": "docgrity.findings",
61
- "name": "Findings"
62
- }
63
- ]
64
- },
65
- "menus": {
66
- "view/item/context": [
67
- {
68
- "command": "docgrity.raiseIssue",
69
- "when": "view == docgrity.findings && viewItem == finding && docgrity.issuesEnabled"
70
- }
71
- ],
72
- "commandPalette": [
73
- {
74
- "command": "docgrity.raiseIssue",
75
- "when": "docgrity.issuesEnabled"
76
- }
77
- ]
78
- },
79
- "configuration": {
80
- "title": "Docgrity",
81
- "properties": {
82
- "docgrity.mode": {
83
- "type": "string",
84
- "enum": [
85
- "report-only",
86
- "report-and-issue"
87
- ],
88
- "enumDescriptions": [
89
- "Scan and show findings in the editor only. The 'Raise GitHub issue' action is hidden — nothing can be posted anywhere.",
90
- "Scan, show findings, and allow raising GitHub issues (each one previewed and human-approved before posting)."
91
- ],
92
- "default": "report-and-issue",
93
- "description": "What Docgrity is allowed to do. 'report-only' guarantees the extension never posts anything."
94
- },
95
- "docgrity.checks.duplicates": {
96
- "type": "boolean",
97
- "default": true,
98
- "description": "Check document pairs for duplicates (docs that should be merged)."
99
- },
100
- "docgrity.checks.contradictions": {
101
- "type": "boolean",
102
- "default": true,
103
- "description": "Check document pairs for contradictions (conflicting factual claims)."
104
- },
105
- "docgrity.checks.openQuestions": {
106
- "type": "boolean",
107
- "default": true,
108
- "description": "Check each document for unresolved open questions (TBDs, TODOs, unanswered questions)."
109
- },
110
- "docgrity.include": {
111
- "type": "string",
112
- "default": "**/*.md",
113
- "description": "Glob for documents to scan (markdown only by design)."
114
- },
115
- "docgrity.exclude": {
116
- "type": "string",
117
- "default": "",
118
- "description": "Additional glob for paths to exclude from scans. node_modules, dist, build, vendor etc. and anything in .gitignore are always excluded."
119
- },
120
- "docgrity.maxFiles": {
121
- "type": "number",
122
- "default": 200,
123
- "description": "Maximum number of markdown files per scan."
124
- },
125
- "docgrity.maxPairs": {
126
- "type": "number",
127
- "default": 25,
128
- "description": "Maximum candidate document pairs assessed per scan."
129
- },
130
- "docgrity.model.vendor": {
131
- "type": "string",
132
- "default": "copilot",
133
- "description": "Language model vendor to use via vscode.lm. 'copilot' covers Copilot models and Ollama models added through Copilot Chat's 'Manage models'. Set to another provider's vendor id, or empty for any available model."
134
- },
135
- "docgrity.model.family": {
136
- "type": "string",
137
- "default": "",
138
- "description": "Preferred model family (e.g. 'gpt-4o', 'llama3.1'). Empty = first available model from the vendor."
139
- },
140
- "docgrity.thresholds.duplicate": {
141
- "type": "number",
142
- "default": 0.75,
143
- "description": "Minimum confidence to record a duplicate finding."
144
- },
145
- "docgrity.thresholds.contradiction": {
146
- "type": "number",
147
- "default": 0.7,
148
- "description": "Minimum confidence to record a contradiction finding."
149
- },
150
- "docgrity.thresholds.openQuestion": {
151
- "type": "number",
152
- "default": 0.6,
153
- "description": "Minimum confidence to record an open-question finding."
154
- }
155
- }
156
- }
157
- },
158
- "scripts": {
159
- "compile": "tsc -p ./",
160
- "watch": "tsc -watch -p ./",
161
- "test": "vitest run",
162
- "test:watch": "vitest",
163
- "vscode:prepublish": "npm run compile"
164
- },
165
- "devDependencies": {
166
- "@types/node": "^22.0.0",
167
- "@types/vscode": "^1.95.0",
168
- "typescript": "^5.6.0",
169
- "vitest": "^3.2.7"
170
- }
36
+ "author": "ujjavala",
37
+ "license": "MIT"
171
38
  }
@@ -1,54 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main]
6
- pull_request:
7
-
8
- permissions:
9
- contents: read
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 22
19
- cache: npm
20
- - name: Install dependencies
21
- run: npm ci
22
- - name: Compile (strict TypeScript)
23
- run: npm run compile
24
- - name: Unit tests
25
- run: npm test
26
- - name: Action unit tests (zero-dependency, node:test)
27
- working-directory: action
28
- run: npm test
29
- - name: Dependency vulnerability audit
30
- run: npm audit --audit-level=high
31
- - name: Secret pattern scan (source only)
32
- run: |
33
- ! grep -rInE "(sk-[A-Za-z0-9]{20,}|AIza[A-Za-z0-9_-]{30,}|ghp_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{30,})" src/ action/src/ action/bin/ \
34
- && echo "No hardcoded credentials found."
35
- - name: Package extension
36
- run: npx --yes @vscode/vsce package --no-dependencies
37
- - name: Upload .vsix artifact
38
- uses: actions/upload-artifact@v4
39
- with:
40
- name: docgrity-vsix
41
- path: '*.vsix'
42
-
43
- codeql:
44
- runs-on: ubuntu-latest
45
- permissions:
46
- contents: read
47
- security-events: write
48
- steps:
49
- - uses: actions/checkout@v4
50
- - uses: github/codeql-action/init@v3
51
- with:
52
- languages: javascript-typescript
53
- queries: security-and-quality
54
- - uses: github/codeql-action/analyze@v3
package/.vscodeignore DELETED
@@ -1,13 +0,0 @@
1
- .vscode/**
2
- src/**
3
- test/**
4
- node_modules/**
5
- samples/**
6
- action/**
7
- .github/**
8
- tsconfig.json
9
- vitest.config.ts
10
- .gitignore
11
- **/*.map
12
- media/icon.svg.png
13
- *.vsix
package/action/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Ujjavala
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/action/README.md DELETED
@@ -1,104 +0,0 @@
1
- # Docgrity Action & CLI
2
-
3
- **Continuous doc-integrity for your repo's markdown: contradictions, duplicates and open
4
- questions — as a GitHub Action (with deduplicated issues) and a read-only local CLI.**
5
-
6
- Part of the Docgrity family:
7
-
8
- | Surface | Job | Acts? |
9
- |---|---|---|
10
- | [Confluence app](https://ujjavala.github.io/docgrity-site/) | wiki integrity | comments (human-approved) |
11
- | VS Code extension | interactive repo-doc scans | raises issues (human-approved) |
12
- | **This Action** | continuous CI enforcement | issues (opt-in, deduped, capped) + report |
13
- | **This CLI** | local observation | **read-only** — report dashboard only |
14
-
15
- ## GitHub Action
16
-
17
- ```yaml
18
- - uses: ujjavala/docgrity-vscode/action@main
19
- env:
20
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21
- with:
22
- provider: github-models # free — uses GITHUB_TOKEN, no API key
23
- create_issues: 'true' # opt-in; default false
24
- max_new_issues: 5
25
- ```
26
-
27
- Full example with weekly schedule, PR trigger and Pages report publishing:
28
- [examples/docgrity.yml](examples/docgrity.yml).
29
-
30
- What it does per run:
31
-
32
- 1. Collects markdown docs (`**/*.md`, capped), selects candidate pairs locally (TF-IDF),
33
- assesses with the LLM using versioned prompts and typed-JSON validation, verifies
34
- every evidence excerpt verbatim against the source (hallucination guard).
35
- 2. Writes a **job summary** table and a **static HTML report** (`docgrity-report/`)
36
- with evidence, links to docs on GitHub, and *potential* owners from git history.
37
- 3. **Opt-in** (`create_issues: true`): syncs GitHub issues **deduplicated by a stable
38
- finding fingerprint** — new findings create issues (capped per run), unchanged ones
39
- are left alone, resolved ones are auto-closed with a comment. Labels: `docgrity`,
40
- `docgrity:<type>`.
41
-
42
- ### Providers
43
-
44
- | provider | key | cost |
45
- |---|---|---|
46
- | `github-models` (default in CI) | none — uses `GITHUB_TOKEN` with `models: read` | free (being retired by GitHub — prefer a BYO provider) |
47
- | `gemini` / `openai` / `anthropic` | `api_key` input (use a repo secret) | your key |
48
- | `ollama` | none — local or tunnelled endpoint | free, fully private |
49
-
50
- ## Local CLI (read-only)
51
-
52
- ```bash
53
- npm i -g docgrity
54
- docgrity scan --open
55
- ```
56
-
57
- or without installing: `npx docgrity scan --open` (from a repo checkout:
58
- `npx github:ujjavala/docgrity-vscode scan --open`).
59
-
60
- Runs the same scan locally and opens the **report dashboard**: findings, evidence,
61
- doc links and potential owners. **The CLI never raises issues or takes any action** —
62
- by design, local scans observe; only CI (explicitly opted in) acts.
63
-
64
- ```
65
- Usage: docgrity scan [options]
66
-
67
- --dir <path> Directory to scan (default: .)
68
- --out <path> Report output directory (default: docgrity-report)
69
- --open Open the HTML report when done
70
-
71
- --checks <list> duplicates, contradictions, open-questions — any combination
72
- --max-files <n> Max markdown files (default: 200)
73
- --max-pairs <n> Max document pairs (default: 25)
74
- --threshold-duplicate / --threshold-contradiction / --threshold-open-question <0..1>
75
-
76
- --provider <p> ollama | gemini | openai | anthropic | github-models
77
- --model <m> Model name
78
- --endpoint <url> Ollama endpoint (default http://localhost:11434)
79
-
80
- --version, -v Installed version + latest on npm
81
- --help, -h Full help
82
- ```
83
-
84
- Provider auto-detection: `DOCGRITY_API_KEY` set → `gemini`; else `GITHUB_TOKEN` →
85
- `github-models`; else → `ollama` (local, fully private — nothing leaves your machine).
86
-
87
- Examples:
88
-
89
- ```bash
90
- docgrity scan --checks contradictions # one check only
91
- docgrity scan --checks duplicates,open-questions --max-pairs 10
92
- docgrity scan --provider ollama --model llama3.1:8b # fully local
93
- DOCGRITY_API_KEY=... docgrity scan --provider gemini --open
94
- ```
95
-
96
- ## Design principles (shared across all Docgrity surfaces)
97
-
98
- - Typed JSON outputs only; model responses validated in code.
99
- - Every finding requires verbatim evidence, verified against the source file.
100
- - Ownership is always *potential* (last git author), never asserted.
101
- - Action-taking is opt-in, capped, and auditable (issue trailer records model +
102
- prompt version + fingerprint).
103
- - Doc content is untrusted input — it cannot override agent instructions.
104
- - Zero dependencies; plain Node 20+ ESM.