@theglitchking/hit-em-with-the-docs 2.0.0 → 2.0.2

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 (200) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +7 -100
  3. package/LICENSE +0 -0
  4. package/MIGRATION.md +0 -0
  5. package/README.backup.md +0 -0
  6. package/README.md +1197 -479
  7. package/action.yml +0 -0
  8. package/dist/action/action/index.d.ts +0 -0
  9. package/dist/action/action/index.d.ts.map +1 -1
  10. package/dist/action/cli/index.d.ts +0 -0
  11. package/dist/action/cli/index.d.ts.map +1 -1
  12. package/dist/action/core/audit/auditor.d.ts +0 -0
  13. package/dist/action/core/audit/auditor.d.ts.map +1 -1
  14. package/dist/action/core/audit/rules.d.ts +0 -0
  15. package/dist/action/core/audit/rules.d.ts.map +1 -1
  16. package/dist/action/core/discover/antipatterns.d.ts +0 -0
  17. package/dist/action/core/discover/antipatterns.d.ts.map +1 -1
  18. package/dist/action/core/discover/dependencies.d.ts +0 -0
  19. package/dist/action/core/discover/dependencies.d.ts.map +1 -1
  20. package/dist/action/core/discover/patterns.d.ts +0 -0
  21. package/dist/action/core/discover/patterns.d.ts.map +1 -1
  22. package/dist/action/core/discover/standards.d.ts +0 -0
  23. package/dist/action/core/discover/standards.d.ts.map +1 -1
  24. package/dist/action/core/domains/classifier.d.ts +0 -0
  25. package/dist/action/core/domains/classifier.d.ts.map +1 -1
  26. package/dist/action/core/domains/constants.d.ts +0 -0
  27. package/dist/action/core/domains/constants.d.ts.map +1 -1
  28. package/dist/action/core/domains/detector.d.ts +0 -0
  29. package/dist/action/core/domains/detector.d.ts.map +1 -1
  30. package/dist/action/core/integrate/integrator.d.ts +0 -0
  31. package/dist/action/core/integrate/integrator.d.ts.map +1 -1
  32. package/dist/action/core/links/checker.d.ts +0 -0
  33. package/dist/action/core/links/checker.d.ts.map +1 -1
  34. package/dist/action/core/links/tracker.d.ts +0 -0
  35. package/dist/action/core/links/tracker.d.ts.map +1 -1
  36. package/dist/action/core/maintain/orchestrator.d.ts +0 -0
  37. package/dist/action/core/maintain/orchestrator.d.ts.map +1 -1
  38. package/dist/action/core/metadata/generator.d.ts +0 -0
  39. package/dist/action/core/metadata/generator.d.ts.map +1 -1
  40. package/dist/action/core/metadata/schema.d.ts +4 -4
  41. package/dist/action/core/metadata/schema.d.ts.map +1 -1
  42. package/dist/action/core/metadata/sync.d.ts +0 -0
  43. package/dist/action/core/metadata/sync.d.ts.map +1 -1
  44. package/dist/action/generators/index-generator.d.ts +0 -0
  45. package/dist/action/generators/index-generator.d.ts.map +1 -1
  46. package/dist/action/generators/registry-generator.d.ts +0 -0
  47. package/dist/action/generators/registry-generator.d.ts.map +1 -1
  48. package/dist/action/generators/scaffold.d.ts +0 -0
  49. package/dist/action/generators/scaffold.d.ts.map +1 -1
  50. package/dist/action/generators/templates/document.d.ts +0 -0
  51. package/dist/action/generators/templates/document.d.ts.map +1 -1
  52. package/dist/action/generators/templates/domain-index.d.ts +0 -0
  53. package/dist/action/generators/templates/domain-index.d.ts.map +1 -1
  54. package/dist/action/generators/templates/domain-registry.d.ts +0 -0
  55. package/dist/action/generators/templates/domain-registry.d.ts.map +1 -1
  56. package/dist/action/index.d.ts +0 -0
  57. package/dist/action/index.d.ts.map +1 -1
  58. package/dist/action/index.js +0 -0
  59. package/dist/action/index.js.map +0 -0
  60. package/dist/action/package.json +0 -0
  61. package/dist/action/reports/audit-report.d.ts +0 -0
  62. package/dist/action/reports/audit-report.d.ts.map +1 -1
  63. package/dist/action/reports/health-report.d.ts +0 -0
  64. package/dist/action/reports/health-report.d.ts.map +1 -1
  65. package/dist/action/reports/link-report.d.ts +0 -0
  66. package/dist/action/reports/link-report.d.ts.map +1 -1
  67. package/dist/action/utils/frontmatter.d.ts +0 -0
  68. package/dist/action/utils/frontmatter.d.ts.map +1 -1
  69. package/dist/action/utils/glob.d.ts +0 -0
  70. package/dist/action/utils/glob.d.ts.map +1 -1
  71. package/dist/action/utils/logger.d.ts +0 -0
  72. package/dist/action/utils/logger.d.ts.map +1 -1
  73. package/dist/action/utils/markdown.d.ts +0 -0
  74. package/dist/action/utils/markdown.d.ts.map +1 -1
  75. package/dist/cli/index.d.ts +0 -0
  76. package/dist/cli/index.d.ts.map +0 -0
  77. package/dist/cli/index.js +0 -0
  78. package/dist/cli/index.js.map +0 -0
  79. package/dist/core/audit/auditor.d.ts +0 -0
  80. package/dist/core/audit/auditor.d.ts.map +0 -0
  81. package/dist/core/audit/auditor.js +0 -0
  82. package/dist/core/audit/auditor.js.map +0 -0
  83. package/dist/core/audit/rules.d.ts +0 -0
  84. package/dist/core/audit/rules.d.ts.map +0 -0
  85. package/dist/core/audit/rules.js +0 -0
  86. package/dist/core/audit/rules.js.map +0 -0
  87. package/dist/core/discover/antipatterns.d.ts +0 -0
  88. package/dist/core/discover/antipatterns.d.ts.map +0 -0
  89. package/dist/core/discover/antipatterns.js +0 -0
  90. package/dist/core/discover/antipatterns.js.map +0 -0
  91. package/dist/core/discover/dependencies.d.ts +0 -0
  92. package/dist/core/discover/dependencies.d.ts.map +0 -0
  93. package/dist/core/discover/dependencies.js +0 -0
  94. package/dist/core/discover/dependencies.js.map +0 -0
  95. package/dist/core/discover/patterns.d.ts +0 -0
  96. package/dist/core/discover/patterns.d.ts.map +0 -0
  97. package/dist/core/discover/patterns.js +0 -0
  98. package/dist/core/discover/patterns.js.map +0 -0
  99. package/dist/core/discover/standards.d.ts +0 -0
  100. package/dist/core/discover/standards.d.ts.map +0 -0
  101. package/dist/core/discover/standards.js +0 -0
  102. package/dist/core/discover/standards.js.map +0 -0
  103. package/dist/core/domains/classifier.d.ts +0 -0
  104. package/dist/core/domains/classifier.d.ts.map +0 -0
  105. package/dist/core/domains/classifier.js +0 -0
  106. package/dist/core/domains/classifier.js.map +0 -0
  107. package/dist/core/domains/constants.d.ts +0 -0
  108. package/dist/core/domains/constants.d.ts.map +0 -0
  109. package/dist/core/domains/constants.js +0 -0
  110. package/dist/core/domains/constants.js.map +0 -0
  111. package/dist/core/domains/detector.d.ts +0 -0
  112. package/dist/core/domains/detector.d.ts.map +0 -0
  113. package/dist/core/domains/detector.js +0 -0
  114. package/dist/core/domains/detector.js.map +0 -0
  115. package/dist/core/integrate/integrator.d.ts +0 -0
  116. package/dist/core/integrate/integrator.d.ts.map +0 -0
  117. package/dist/core/integrate/integrator.js +0 -0
  118. package/dist/core/integrate/integrator.js.map +0 -0
  119. package/dist/core/links/checker.d.ts +0 -0
  120. package/dist/core/links/checker.d.ts.map +0 -0
  121. package/dist/core/links/checker.js +0 -0
  122. package/dist/core/links/checker.js.map +0 -0
  123. package/dist/core/links/tracker.d.ts +0 -0
  124. package/dist/core/links/tracker.d.ts.map +0 -0
  125. package/dist/core/links/tracker.js +0 -0
  126. package/dist/core/links/tracker.js.map +0 -0
  127. package/dist/core/maintain/orchestrator.d.ts +0 -0
  128. package/dist/core/maintain/orchestrator.d.ts.map +0 -0
  129. package/dist/core/maintain/orchestrator.js +0 -0
  130. package/dist/core/maintain/orchestrator.js.map +0 -0
  131. package/dist/core/metadata/generator.d.ts +0 -0
  132. package/dist/core/metadata/generator.d.ts.map +0 -0
  133. package/dist/core/metadata/generator.js +0 -0
  134. package/dist/core/metadata/generator.js.map +0 -0
  135. package/dist/core/metadata/schema.d.ts +0 -0
  136. package/dist/core/metadata/schema.d.ts.map +0 -0
  137. package/dist/core/metadata/schema.js +0 -0
  138. package/dist/core/metadata/schema.js.map +0 -0
  139. package/dist/core/metadata/sync.d.ts +0 -0
  140. package/dist/core/metadata/sync.d.ts.map +0 -0
  141. package/dist/core/metadata/sync.js +0 -0
  142. package/dist/core/metadata/sync.js.map +0 -0
  143. package/dist/generators/index-generator.d.ts +0 -0
  144. package/dist/generators/index-generator.d.ts.map +0 -0
  145. package/dist/generators/index-generator.js +0 -0
  146. package/dist/generators/index-generator.js.map +0 -0
  147. package/dist/generators/registry-generator.d.ts +0 -0
  148. package/dist/generators/registry-generator.d.ts.map +0 -0
  149. package/dist/generators/registry-generator.js +0 -0
  150. package/dist/generators/registry-generator.js.map +0 -0
  151. package/dist/generators/scaffold.d.ts +0 -0
  152. package/dist/generators/scaffold.d.ts.map +0 -0
  153. package/dist/generators/scaffold.js +0 -0
  154. package/dist/generators/scaffold.js.map +0 -0
  155. package/dist/generators/templates/document.d.ts +0 -0
  156. package/dist/generators/templates/document.d.ts.map +0 -0
  157. package/dist/generators/templates/document.js +0 -0
  158. package/dist/generators/templates/document.js.map +0 -0
  159. package/dist/generators/templates/domain-index.d.ts +0 -0
  160. package/dist/generators/templates/domain-index.d.ts.map +0 -0
  161. package/dist/generators/templates/domain-index.js +0 -0
  162. package/dist/generators/templates/domain-index.js.map +0 -0
  163. package/dist/generators/templates/domain-registry.d.ts +0 -0
  164. package/dist/generators/templates/domain-registry.d.ts.map +0 -0
  165. package/dist/generators/templates/domain-registry.js +0 -0
  166. package/dist/generators/templates/domain-registry.js.map +0 -0
  167. package/dist/index.d.ts +0 -0
  168. package/dist/index.d.ts.map +0 -0
  169. package/dist/index.js +0 -0
  170. package/dist/index.js.map +0 -0
  171. package/dist/reports/audit-report.d.ts +0 -0
  172. package/dist/reports/audit-report.d.ts.map +0 -0
  173. package/dist/reports/audit-report.js +0 -0
  174. package/dist/reports/audit-report.js.map +0 -0
  175. package/dist/reports/health-report.d.ts +0 -0
  176. package/dist/reports/health-report.d.ts.map +0 -0
  177. package/dist/reports/health-report.js +0 -0
  178. package/dist/reports/health-report.js.map +0 -0
  179. package/dist/reports/link-report.d.ts +0 -0
  180. package/dist/reports/link-report.d.ts.map +0 -0
  181. package/dist/reports/link-report.js +0 -0
  182. package/dist/reports/link-report.js.map +0 -0
  183. package/dist/utils/frontmatter.d.ts +0 -0
  184. package/dist/utils/frontmatter.d.ts.map +0 -0
  185. package/dist/utils/frontmatter.js +0 -0
  186. package/dist/utils/frontmatter.js.map +0 -0
  187. package/dist/utils/glob.d.ts +0 -0
  188. package/dist/utils/glob.d.ts.map +0 -0
  189. package/dist/utils/glob.js +0 -0
  190. package/dist/utils/glob.js.map +0 -0
  191. package/dist/utils/logger.d.ts +0 -0
  192. package/dist/utils/logger.d.ts.map +0 -0
  193. package/dist/utils/logger.js +0 -0
  194. package/dist/utils/logger.js.map +0 -0
  195. package/dist/utils/markdown.d.ts +0 -0
  196. package/dist/utils/markdown.d.ts.map +0 -0
  197. package/dist/utils/markdown.js +0 -0
  198. package/dist/utils/markdown.js.map +0 -0
  199. package/package.json +1 -1
  200. package/templates/claude/CLAUDE.md +0 -0
package/README.md CHANGED
@@ -1,557 +1,769 @@
1
- # hit-em-with-the-docs
1
+ # Hit 'Em With The Docs
2
2
 
3
3
  > A self-managing documentation system that keeps your docs organized, accurate, and easy to find.
4
4
 
5
- [![GitHub Action](https://img.shields.io/badge/GitHub-Action-blue?logo=github)](https://github.com/marketplace/actions/hit-em-with-the-docs)
6
- [![npm version](https://img.shields.io/npm/v/hit-em-with-the-docs.svg)](https://www.npmjs.com/package/hit-em-with-the-docs)
5
+ [![npm version](https://img.shields.io/npm/v/@theglitchking/hit-em-with-the-docs.svg)](https://www.npmjs.com/package/@theglitchking/hit-em-with-the-docs)
7
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
-
7
+ [![GitHub Action](https://img.shields.io/badge/GitHub-Action-blue?logo=github)](https://github.com/marketplace/actions/hit-em-with-the-docs)
9
8
 
10
9
  > [!IMPORTANT]
11
- > You will still need to remember to invoke this plugin for document creation! As projects continue to scale, documetnation will need to be created / maintained. a user will still need to invoke this plugin or ask and LLM for that documentation to be created for your > feature / workflow / infrastructure, or create it yourself using the commands from this plugin. This plugin needs to be invoked to either create / update / maintain it all.
12
-
10
+ > You still need to remember to use this plugin when creating documentation! As projects grow, documentation needs to be created and maintained. You'll need to invoke this plugin or ask an LLM to create documentation for your features, workflows, or infrastructure. This plugin must be invoked to create, update, or maintain your docs.
13
11
 
12
+ ---
14
13
 
15
14
  ## Summary
16
15
 
17
- Documentation often becomes messy and hard to find as projects grow. Important information gets scattered across many files, links break when files move, and nobody knows if docs are up to date. Hit-em-with-the-docs solves these problems by organizing your documentation into 15 clear categories, checking links automatically, and making sure every document has proper information about what it contains. It keeps your documentation healthy without you having to think about it.
16
+ When projects get bigger, documentation becomes a mess. Important information gets lost across many files, links break when you move things around, and nobody knows if the docs are still correct. Hit 'Em With The Docs fixes these problems by organizing everything into 15 clear categories, automatically checking your links, and making sure every document has the right information tags. The system watches your docs and fixes common problems without you having to do it manually. Everything stays organized and up-to-date so your team can find what they need fast.
17
+
18
+ ---
18
19
 
19
20
  ## Operational Summary
20
21
 
21
- The plugin creates a special folder called `.documentation` in your project with 15 organized sections (called "domains") like security, API, database, and testing. Each document gets tagged with metadata - information like title, category, and last update date - that helps you and the system understand what it's about.
22
+ The plugin creates a special folder called `.documentation` in your project with 15 organized sections called "domains" - things like security, API docs, database guides, and testing information. When you add a document, the system reads it and figures out which category it belongs in based on keywords and content. Each document gets special information tags (metadata) added to the top - things like the title, what category it's in, when it was last updated, and how long it takes to read. This metadata helps both you and the system understand what each document is about.
23
+
24
+ The system includes automated tools that check your documentation for problems. It scans through all your files looking for broken links between documents, makes sure the metadata is complete, checks that files are named correctly, and verifies they're in the right folders. You can run these checks yourself whenever you want, or set them up to run automatically in your build process using GitHub Actions. The plugin can also look through your actual source code to find patterns (like how you structure your classes or handle errors) and automatically create documentation from what it discovers. Everything works with markdown files and gives you a health score from 0 to 100 so you know how good your documentation is.
22
25
 
23
- The system has built-in tools that automatically check your documentation for problems. It finds broken links between documents, makes sure metadata is complete, and verifies files are named correctly. You can run these checks manually or set them up to run automatically in your build process. The plugin can also scan your actual code to discover patterns and create documentation from what it finds. Everything is designed to work with markdown files and integrates seamlessly with GitHub Actions for continuous monitoring.
26
+ ---
24
27
 
25
28
  ## Features
26
29
 
27
30
  - **Organized Structure**: Automatically creates 15 specialized categories for different types of documentation
28
- - **Smart Classification**: Analyzes your documents and automatically puts them in the right category
29
- - **Metadata Management**: Tracks 22 different pieces of information about each document (title, status, tags, etc.)
31
+ - **Smart Classification**: Reads your documents and automatically puts them in the right category
32
+ - **Metadata Management**: Tracks 22 different pieces of information about each document (title, status, tags, last update, etc.)
30
33
  - **Link Checking**: Finds and reports broken links between documents
31
- - **Auto-Fixing**: Can automatically repair common problems like missing metadata
34
+ - **Auto-Fixing**: Automatically repairs common problems like missing metadata
32
35
  - **Pattern Discovery**: Scans your code to find and document coding patterns
33
- - **Health Reports**: Generates reports showing the overall quality of your documentation
34
- - **GitHub Integration**: Works as a GitHub Action for automated checks
36
+ - **Health Reports**: Generates reports showing the overall quality of your documentation with a 0-100 score
37
+ - **GitHub Integration**: Works as a GitHub Action for automated checks on every commit
35
38
  - **CLI Tool**: Full command-line interface for all operations
36
39
  - **Search Functionality**: Quick search across all documentation
40
+ - **Claude Code Plugin**: Integrates with Claude Code so AI can read and help maintain your docs
41
+ - **Sister Plugin Companion**: When [`semantic-pages`](https://github.com/TheGlitchKing/semantic-pages) is also installed, a **read-only** MCP server is auto-wired over `./.documentation/` so Claude can semantically search your docs without risking accidental writes (hewtd stays the sole writer of the tree)
37
42
 
38
- ## Quick Start
43
+ ---
39
44
 
40
- ### Installation Methods
45
+ ## Sister Plugin: semantic-pages
41
46
 
42
- #### Method 1: Global Installation (Recommended for CLI use)
47
+ `hit-em-with-the-docs` is the canonical **writer** of `./.documentation/` it scaffolds the 15-domain structure, classifies incoming docs, maintains the 22-field metadata schema, checks links, and produces health reports. By design, it treats `./.documentation/` as a tree it owns.
43
48
 
44
- This method installs the tool on your computer so you can use it anywhere.
49
+ [`semantic-pages`](https://github.com/TheGlitchKing/semantic-pages) is the canonical **reader**. It's a local MCP server that indexes any folder of markdown into a vector database + knowledge graph, exposing semantic search, wikilink traversal, and CRUD tools to Claude Code.
45
50
 
46
- 1. Open your terminal or command prompt
47
- 2. Type this command and press Enter:
48
- ```bash
49
- npm install -g hit-em-with-the-docs
50
- ```
51
- 3. Wait for the installation to complete
52
- 4. Verify it worked by typing:
53
- ```bash
54
- hewtd --version
55
- ```
56
- 5. You should see the version number
51
+ When both plugins are installed together, `semantic-pages` auto-detects hewtd via Claude Code's plugin registry and stands up a **second, read-only** MCP instance pointed at `./.documentation/`. The read-only mode suppresses all 7 write tools (`create_note`, `update_note`, `delete_note`, `move_note`, `update_frontmatter`, `manage_tags`, `rename_tag`) so Claude can search and read the docs tree but can't race hewtd over writes. Your personal scratch vault at `./.claude/.vault/` stays fully read/write.
57
52
 
58
- #### Method 2: Project Installation
53
+ ### Behavior matrix
59
54
 
60
- This method installs the tool only for your current project.
55
+ | `hit-em-with-the-docs` | `semantic-pages` | Result |
56
+ |---|---|---|
57
+ | ✗ | ✗ | nothing |
58
+ | ✓ | ✗ | hewtd CLI only; `.documentation/` managed but not indexed |
59
+ | ✗ | ✓ | single MCP at `./.claude/.vault` (read/write) |
60
+ | ✓ | ✓ | `./.claude/.vault` (r/w) **+** `./.documentation` (read-only) |
61
61
 
62
- 1. Open your terminal in your project folder
63
- 2. Type this command:
64
- ```bash
65
- npm install --save-dev hit-em-with-the-docs
66
- ```
67
- 3. Add a script to your `package.json`:
68
- ```json
69
- "scripts": {
70
- "docs": "hewtd"
71
- }
72
- ```
73
- 4. Use it with: `npm run docs`
62
+ ### How it's wired
74
63
 
75
- #### Method 3: One-Time Use (No Installation)
64
+ `semantic-pages` ships a `SessionStart` hook that runs at the start of every Claude Code session and reconciles the project's `.mcp.json`. If hewtd is enabled in `~/.claude/settings.json` **and** `./.documentation/` exists in the current project, it adds a `semantic-pages` MCP entry pointed at `./.documentation` with `--read-only`. If either condition stops being true, it idempotently cleans up. See the [semantic-pages Sister Plugin docs](https://github.com/TheGlitchKing/semantic-pages#sister-plugin-hit-em-with-the-docs) for the full auto-wiring behavior.
76
65
 
77
- You can run the tool without installing it using `npx`:
66
+ ### Why we don't do it from hewtd's side
67
+
68
+ hewtd does **not** ship any MCP configuration, declare semantic-pages as a dependency, or write to `.mcp.json`. Installing hewtd alone gives you a CLI-only tool with no MCP server — your project stays clean. The auto-wire only kicks in when a user has explicitly installed both plugins, signaling they want Claude to semantically index the hewtd-managed tree. The wiring logic lives entirely on the semantic-pages side.
69
+
70
+ ### Install both
78
71
 
79
72
  ```bash
80
- npx hit-em-with-the-docs <command>
73
+ # Inside a Claude Code session
74
+ /plugin marketplace add TheGlitchKing/hit-em-with-the-docs
75
+ /plugin install hit-em-with-the-docs@hit-em-with-the-docs-marketplace
76
+
77
+ /plugin marketplace add TheGlitchKing/semantic-pages
78
+ /plugin install semantic-pages@semantic-pages-marketplace
81
79
  ```
82
80
 
83
- #### Method 4: GitHub Action
81
+ Next session start, `./.claude/.vault/` is created, `.mcp.json` is wired, and Claude has 14 read tools on `./.documentation/` plus 21 full tools on `./.claude/.vault/`.
84
82
 
85
- Add this to your repository at `.github/workflows/docs-check.yml`:
83
+ ---
86
84
 
87
- ```yaml
88
- name: Documentation Health Check
85
+ ## Quick Start
89
86
 
90
- on:
91
- push:
92
- paths:
93
- - '.documentation/**'
94
- schedule:
95
- - cron: '0 16 * * 5' # Every Friday at 4 PM
87
+ ### 1. Installation Methods
96
88
 
97
- jobs:
98
- docs-check:
99
- runs-on: ubuntu-latest
100
- steps:
101
- - uses: actions/checkout@v4
89
+ #### Method A: NPM Installation
102
90
 
103
- - name: Run Documentation Health Check
104
- uses: TheGlitchKing/hit-em-with-the-docs@v1
105
- with:
106
- command: maintain
107
- mode: quick
108
- fail-on-error: true
91
+ ##### Global Installation (Recommended for regular use)
92
+
93
+ This installs the tool on your computer so you can use it in any project.
94
+
95
+ **Step 1**: Open your terminal or command prompt
96
+
97
+ **Step 2**: Type this command and press Enter:
98
+ ```bash
99
+ npm install -g @theglitchking/hit-em-with-the-docs
109
100
  ```
110
101
 
111
- ### Initializing the Plugin
102
+ **Step 3**: Wait for the installation to complete. You'll see some messages about downloading packages.
103
+
104
+ **Step 4**: Test that it worked by typing:
105
+ ```bash
106
+ hewtd --version
107
+ ```
112
108
 
113
- After installing, you need to create the documentation structure:
109
+ **Step 5**: You should see a version number like `2.0.0`. If you do, it's installed correctly!
114
110
 
111
+ **To enable the plugin in your project**:
115
112
  ```bash
116
- # Create .documentation folder with all 15 categories
113
+ # Go to your project folder
114
+ cd /path/to/your/project
115
+
116
+ # Create the documentation structure
117
117
  hewtd init
118
118
 
119
- # Or specify a different location
120
- hewtd init --path ./docs
119
+ # You should see a new .documentation folder with 15 categories inside
121
120
  ```
122
121
 
123
- This creates a folder structure like:
122
+ ##### NPX Method (No installation needed)
123
+
124
+ This lets you use the tool without installing it permanently.
125
+
126
+ **Step 1**: Open your terminal in your project folder
127
+
128
+ **Step 2**: Run any command by putting `npx @theglitchking/hit-em-with-the-docs` before it:
129
+ ```bash
130
+ npx @theglitchking/hit-em-with-the-docs init
124
131
  ```
125
- .documentation/
126
- ├── INDEX.md # Main navigation page
127
- ├── REGISTRY.md # Quick reference list
128
- ├── README.md # Overview of the documentation
129
- ├── security/ # Security-related docs
130
- ├── api/ # API documentation
131
- ├── database/ # Database docs
132
- ├── testing/ # Test documentation
133
- └── ... (11 more categories)
132
+
133
+ **Step 3**: The first time you run it, NPX will download the tool (this takes a few seconds)
134
+
135
+ **Step 4**: After that, it runs your command automatically
136
+
137
+ **Use this method when**: You want to try the tool without installing it, or you only need it occasionally.
138
+
139
+ ##### Project Installation (For team projects)
140
+
141
+ This installs the tool only for one specific project.
142
+
143
+ **Step 1**: Open your terminal in your project folder
144
+
145
+ **Step 2**: Type this command:
146
+ ```bash
147
+ npm install --save-dev @theglitchking/hit-em-with-the-docs
134
148
  ```
135
149
 
136
- ---
150
+ **Step 3**: Add a script to your `package.json` file:
151
+ ```json
152
+ {
153
+ "scripts": {
154
+ "docs": "hewtd",
155
+ "docs:check": "hewtd maintain --quick",
156
+ "docs:fix": "hewtd maintain --quick --fix"
157
+ }
158
+ }
159
+ ```
137
160
 
138
- ## CLI Commands
161
+ **Step 4**: Now you can use it with npm commands:
162
+ ```bash
163
+ npm run docs init # Create documentation structure
164
+ npm run docs:check # Check documentation health
165
+ npm run docs:fix # Fix documentation problems
166
+ ```
139
167
 
140
- ### Basic Commands
168
+ **To enable the plugin**:
169
+ ```bash
170
+ npm run docs init
171
+ ```
141
172
 
142
- | Command | Description |
143
- |---------|-------------|
144
- | `hewtd init` | Create the documentation structure |
145
- | `hewtd maintain` | Run full health check and maintenance |
146
- | `hewtd integrate <file>` | Add a document to the system |
147
- | `hewtd list` | Show all documentation categories |
148
- | `hewtd search <query>` | Search for content in documentation |
173
+ #### Method B: Claude Code Plugin Installation
149
174
 
150
- ### Maintenance Commands
175
+ This method installs it as a plugin for Claude Code so Claude can help manage your documentation.
151
176
 
152
- | Command | Description |
153
- |---------|-------------|
154
- | `hewtd metadata-sync` | Update and fix document metadata |
155
- | `hewtd link-check` | Find broken links |
156
- | `hewtd audit` | Check documentation quality |
157
- | `hewtd report <type>` | Generate reports (health, audit, links) |
177
+ **Step 1**: Open Claude Code
178
+
179
+ **Step 2**: Type this command in your conversation:
180
+ ```
181
+ /plugin install TheGlitchKing/hit-em-with-the-docs
182
+ ```
158
183
 
159
- ### Discovery Commands
184
+ **Step 3**: Wait for Claude to confirm the installation
160
185
 
161
- | Command | Description |
162
- |---------|-------------|
163
- | `hewtd discover patterns` | Find coding patterns in your codebase |
164
- | `hewtd discover anti-patterns` | Find problematic code patterns |
165
- | `hewtd discover standards` | Extract coding standards from code |
166
- | `hewtd discover dependencies` | Analyze project dependencies |
186
+ **Step 4**: The plugin is now installed! Claude can now use special `/docs` commands.
187
+
188
+ **To enable and initialize in your project**:
189
+
190
+ Ask Claude in conversation:
191
+ ```
192
+ Please initialize hit-em-with-the-docs in this project
193
+ ```
194
+
195
+ Or use the command:
196
+ ```
197
+ /docs init
198
+ ```
199
+
200
+ Claude will create the `.documentation` folder with all 15 categories for you.
167
201
 
168
202
  ---
169
203
 
170
- ### Command Details and Examples
204
+ ### 2. How to Use
171
205
 
172
- #### `hewtd init` - Create Documentation Structure
206
+ #### CLI Commands
173
207
 
174
- **When to use**: First time setting up documentation in a project.
208
+ These commands run in your terminal and manage your documentation.
175
209
 
176
- **What it does**: Creates the `.documentation` folder with 15 organized categories and starter files.
210
+ | Command | Description |
211
+ |---------|-------------|
212
+ | `hewtd init` | Create the documentation structure with 15 categories |
213
+ | `hewtd maintain` | Run full health check and fix problems |
214
+ | `hewtd integrate <file>` | Add a document to the system |
215
+ | `hewtd list` | Show all 15 documentation categories |
216
+ | `hewtd search <query>` | Search for content in your docs |
217
+ | `hewtd metadata-sync` | Update document information tags |
218
+ | `hewtd link-check` | Find broken links between documents |
219
+ | `hewtd audit` | Check documentation quality and compliance |
220
+ | `hewtd report <type>` | Generate health, audit, or link reports |
221
+ | `hewtd discover` | Scan code for patterns and create docs |
177
222
 
178
- **Examples**:
223
+ ##### Command Examples and Details
224
+
225
+ **`hewtd init` - Set up documentation**
226
+
227
+ **How to use it**:
179
228
  ```bash
180
- # Basic initialization
229
+ # Basic setup in current folder
181
230
  hewtd init
182
231
 
183
- # Custom location
184
- hewtd init --path ./my-docs
232
+ # Set up in a custom location
233
+ hewtd init --path ./docs
185
234
 
186
- # Overwrite existing structure
235
+ # Replace existing structure
187
236
  hewtd init --force
188
237
  ```
189
238
 
190
- **What to expect**: You'll see 53 files and folders created. Each category gets an INDEX.md (table of contents) and REGISTRY.md (quick reference list).
239
+ **When to use it**: First time setting up documentation in a project.
191
240
 
192
- ---
241
+ **What to use it on**: Your project root folder (it creates a `.documentation` folder there).
193
242
 
194
- #### `hewtd maintain` - Full Documentation Maintenance
243
+ **What to expect**: Creates 53 files and folders organized into 15 categories like security, api, database, testing, etc. Each category gets an INDEX.md (table of contents) and REGISTRY.md (quick list).
195
244
 
196
- **When to use**: Weekly checkups, before releases, or after adding lots of documentation.
245
+ ---
197
246
 
198
- **What it does**: Runs a complete health check - fixes metadata, checks links, and creates a report with a score.
247
+ **`hewtd maintain` - Check and fix your docs**
199
248
 
200
- **Examples**:
249
+ **How to use it**:
201
250
  ```bash
202
- # Full maintenance (checks everything)
251
+ # Full check (looks at everything)
203
252
  hewtd maintain
204
253
 
205
- # Quick mode (skips link checking - faster)
254
+ # Quick check (skips link checking, much faster)
206
255
  hewtd maintain --quick
207
256
 
208
- # Quick mode with auto-fix
257
+ # Quick check and auto-fix problems
209
258
  hewtd maintain --quick --fix
210
259
 
211
- # Specific folder
212
- hewtd maintain --path ./docs
260
+ # Full check with auto-fix
261
+ hewtd maintain --fix
213
262
  ```
214
263
 
215
- **What to expect**:
216
- - See a health score from 0 to 100
217
- - Get a list of issues found
218
- - See how many issues were fixed
219
- - Find a detailed report in `.documentation/reports/`
264
+ **When to use it**:
265
+ - Before committing code changes
266
+ - Once a week for regular maintenance
267
+ - Before releasing a new version
268
+ - When you've added lots of new documentation
220
269
 
221
- **Use it on**: Your entire documentation folder, especially before merging code or releasing.
270
+ **What to use it on**: Your entire `.documentation` folder.
222
271
 
223
- ---
272
+ **What to expect**:
273
+ - You'll see a health score from 0 to 100 (aim for 80+)
274
+ - A list of issues found (broken links, missing metadata, misplaced files)
275
+ - If you use `--fix`, it automatically fixes what it can
276
+ - A detailed report saves to `.documentation/reports/maintenance-[date].md`
277
+ - Takes 5-30 seconds depending on how many docs you have
224
278
 
225
- #### `hewtd integrate` - Add Documents to the System
279
+ **Example output**:
280
+ ```
281
+ ✓ Metadata completeness: 95%
282
+ ✓ Link health: 100%
283
+ ✓ Naming compliance: 87%
284
+ ⚠ Found 3 issues
285
+ ✓ Fixed 3 issues
286
+ Health Score: 92/100
287
+ ```
226
288
 
227
- **When to use**: Adding new documentation files or organizing existing ones.
289
+ ---
228
290
 
229
- **What it does**: Reads your document, figures out which category it belongs in, adds metadata, and moves it to the right place.
291
+ **`hewtd integrate <file>` - Add documents to the system**
230
292
 
231
- **Examples**:
293
+ **How to use it**:
232
294
  ```bash
233
- # Add a single document
295
+ # Add a single document (it will ask which category)
234
296
  hewtd integrate ./my-guide.md
235
297
 
236
- # Preview where it would go (doesn't actually move it)
298
+ # Preview where it would go without moving it
237
299
  hewtd integrate ./my-guide.md --dry-run
238
300
 
239
- # Automatic mode (no questions asked)
301
+ # Automatic mode (uses best guess, no questions)
240
302
  hewtd integrate ./my-guide.md --auto
241
303
 
242
- # Add multiple documents
304
+ # Add multiple documents at once
243
305
  for file in old-docs/*.md; do
244
306
  hewtd integrate "$file" --auto
245
307
  done
246
308
  ```
247
309
 
248
- **What to expect**: The tool will read your document and suggest a category like "security" or "api" based on its content. It adds metadata and moves the file.
310
+ **When to use it**: When you have markdown files outside the `.documentation` folder that you want to organize.
311
+
312
+ **What to use it on**: Individual markdown (.md) files or a folder of markdown files.
313
+
314
+ **What to expect**:
315
+ - The tool reads your document's content
316
+ - It suggests which category it belongs in (like "security" or "api")
317
+ - It adds metadata to the top of the file
318
+ - It moves the file to the correct folder
319
+ - In auto mode, it does this without asking questions
320
+
321
+ ---
322
+
323
+ **`hewtd list` - Show all categories**
324
+
325
+ **How to use it**:
326
+ ```bash
327
+ hewtd list
328
+ ```
329
+
330
+ **When to use it**: When you need a quick reminder of what categories are available.
249
331
 
250
- **Use it on**: New markdown files you want to add to your documentation system.
332
+ **What to expect**: A table showing all 15 categories with descriptions:
333
+ ```
334
+ ┌─────────────────┬──────────┬────────────────────────────┐
335
+ │ Domain │ Priority │ Description │
336
+ ├─────────────────┼──────────┼────────────────────────────┤
337
+ │ security │ 9 │ Security and auth docs │
338
+ │ api │ 8 │ API endpoints │
339
+ │ database │ 8 │ Database schema │
340
+ └─────────────────┴──────────┴────────────────────────────┘
341
+ ```
251
342
 
252
343
  ---
253
344
 
254
- #### `hewtd metadata-sync` - Update Document Information
345
+ **`hewtd search <query>` - Find information**
346
+
347
+ **How to use it**:
348
+ ```bash
349
+ # Search all docs
350
+ hewtd search "authentication"
351
+
352
+ # Search only security docs
353
+ hewtd search "authentication" --domain security
354
+
355
+ # Search with multiple words
356
+ hewtd search "user login flow"
357
+ ```
358
+
359
+ **When to use it**: When you need to find where specific information is documented.
255
360
 
256
- **When to use**: After manually editing files or when metadata is missing.
361
+ **What to use it on**: Any topic, concept, or keyword you want to find.
362
+
363
+ **What to expect**: A list of files containing your search term, showing:
364
+ - File path
365
+ - Number of matches
366
+ - Preview of matching lines
367
+ - Sorted by relevance
368
+
369
+ ---
257
370
 
258
- **What it does**: Checks all documents for proper metadata and fills in missing information automatically.
371
+ **`hewtd metadata-sync` - Fix document information**
259
372
 
260
- **Examples**:
373
+ **How to use it**:
261
374
  ```bash
262
- # Check everything (preview only)
375
+ # Check all documents (preview only)
263
376
  hewtd metadata-sync
264
377
 
265
- # Fix all issues
378
+ # Fix all missing metadata
266
379
  hewtd metadata-sync --fix
267
380
 
268
- # Only check security documentation
381
+ # Fix only security documents
269
382
  hewtd metadata-sync --domain security --fix
270
383
  ```
271
384
 
272
- **What to expect**: Sees how many documents have complete information, automatically adds things like word count and reading time.
385
+ **When to use it**:
386
+ - After manually editing lots of files
387
+ - When documents are missing metadata
388
+ - As part of regular maintenance
273
389
 
274
- **Use it on**: The entire `.documentation` folder or specific categories.
390
+ **What to use it on**: The entire `.documentation` folder or specific categories.
275
391
 
276
- ---
277
-
278
- #### `hewtd link-check` - Find Broken Links
392
+ **What to expect**:
393
+ - Checks every document for complete metadata
394
+ - Adds missing information like word count and reading time
395
+ - Shows you how many documents were updated
396
+ - With `--fix`, it automatically adds missing metadata
279
397
 
280
- **When to use**: Before releases, after moving files, or monthly maintenance.
398
+ ---
281
399
 
282
- **What it does**: Checks every link in your documentation to make sure it points to a real file.
400
+ **`hewtd link-check` - Find broken links**
283
401
 
284
- **Examples**:
402
+ **How to use it**:
285
403
  ```bash
286
- # Check all links
404
+ # Check all documents
287
405
  hewtd link-check
288
406
 
289
- # Check specific category
407
+ # Check only API docs
290
408
  hewtd link-check --domain api
291
409
 
292
410
  # Generate detailed report
293
411
  hewtd link-check --report
294
412
  ```
295
413
 
296
- **What to expect**: See a list of broken links with file names and line numbers. The report saves to `.documentation/reports/`.
297
-
298
- **Use it on**: Your entire documentation, especially after reorganizing files.
414
+ **When to use it**:
415
+ - Before releasing a new version
416
+ - After moving or renaming files
417
+ - Monthly as part of regular maintenance
418
+ - When you suspect broken links
299
419
 
300
- ---
420
+ **What to use it on**: Your entire documentation or specific categories.
301
421
 
302
- #### `hewtd audit` - Check Documentation Quality
422
+ **What to expect**:
423
+ - List of all broken links found
424
+ - Which file contains each broken link
425
+ - What line number the link is on
426
+ - Saves detailed report to `.documentation/reports/links-[date].md`
303
427
 
304
- **When to use**: Quality checks, code reviews, or establishing a baseline.
428
+ ---
305
429
 
306
- **What it does**: Checks if files follow naming rules, are in the right categories, and have complete metadata.
430
+ **`hewtd audit` - Check quality**
307
431
 
308
- **Examples**:
432
+ **How to use it**:
309
433
  ```bash
310
434
  # Audit everything
311
435
  hewtd audit
312
436
 
313
- # Only show problems
437
+ # Show only problems
314
438
  hewtd audit --issues-only
315
439
 
316
440
  # Audit specific category
317
- hewtd audit --domain standards
441
+ hewtd audit --domain database
318
442
 
319
443
  # Generate full report
320
444
  hewtd audit --report
321
445
  ```
322
446
 
323
- **What to expect**: Get a quality score and detailed list of what needs fixing.
447
+ **When to use it**:
448
+ - Establishing a baseline for your docs
449
+ - During code reviews
450
+ - Before important releases
324
451
 
325
- **Use it on**: The entire documentation system to measure quality.
452
+ **What to use it on**: The entire documentation system to measure quality.
453
+
454
+ **What to expect**:
455
+ - Quality score from 0-100
456
+ - List of issues:
457
+ - Files in wrong folders
458
+ - Incorrect file names (should be kebab-case)
459
+ - Missing required metadata
460
+ - Empty documents
461
+ - Recommendations for fixes
326
462
 
327
463
  ---
328
464
 
329
- #### `hewtd discover patterns` - Find Code Patterns
465
+ **`hewtd report <type>` - Generate reports**
330
466
 
331
- **When to use**: Creating architecture documentation, onboarding guides, or style guides.
467
+ **How to use it**:
468
+ ```bash
469
+ # Health report (overall score and stats)
470
+ hewtd report health
332
471
 
333
- **What it does**: Scans your code and creates documentation about patterns it finds (like Singleton, Factory, Repository).
472
+ # Audit report (quality issues)
473
+ hewtd report audit
334
474
 
335
- **Examples**:
475
+ # Links report (link topology and broken links)
476
+ hewtd report links
477
+
478
+ # JSON format for automation
479
+ hewtd report health --format json
480
+ ```
481
+
482
+ **When to use it**:
483
+ - Weekly metrics for your team
484
+ - Dashboards showing documentation health
485
+ - Stakeholder updates
486
+ - Tracking improvement over time
487
+
488
+ **What to use it on**: Your documentation system.
489
+
490
+ **What to expect**: Detailed markdown or JSON report saved to `.documentation/reports/` with:
491
+ - Health score and trends
492
+ - Statistics (document count, word count, etc.)
493
+ - Issues found and severity
494
+ - Recommendations for improvement
495
+
496
+ ---
497
+
498
+ **`hewtd discover` - Find code patterns**
499
+
500
+ **How to use it**:
336
501
  ```bash
337
- # Find all patterns
502
+ # Find all patterns in your code
338
503
  hewtd discover patterns
339
504
 
340
- # Only TypeScript files
505
+ # Find problematic patterns
506
+ hewtd discover anti-patterns
507
+
508
+ # Extract coding standards
509
+ hewtd discover standards
510
+
511
+ # Analyze dependencies
512
+ hewtd discover dependencies
513
+
514
+ # Only scan TypeScript files
341
515
  hewtd discover patterns --language typescript
342
516
 
343
517
  # Scan specific folder
344
518
  hewtd discover patterns --root ./src
345
519
  ```
346
520
 
347
- **What to expect**: Creates markdown files with examples of patterns found in your code, including file locations.
521
+ **When to use it**:
522
+ - Creating architecture documentation
523
+ - Onboarding new developers
524
+ - Documenting coding standards
525
+ - Understanding project dependencies
348
526
 
349
- **Use it on**: Your source code folders (automatically skips node_modules and other common folders).
527
+ **What to use it on**: Your source code folders (automatically skips node_modules, dist, and other build folders).
350
528
 
351
- ---
529
+ **What to expect**:
530
+ - Creates markdown files with discovered patterns
531
+ - Shows code examples with file locations
532
+ - Identifies common architectural patterns (Singleton, Factory, Repository, etc.)
533
+ - Lists anti-patterns to avoid
534
+ - Documents dependencies and their versions
352
535
 
353
- #### `hewtd list` - Show All Categories
536
+ ---
354
537
 
355
- **When to use**: Quick reference to see available categories.
538
+ #### Claude Code Commands
356
539
 
357
- **What it does**: Displays all 15 categories with descriptions.
540
+ When the plugin is installed in Claude Code, these commands let Claude help manage your documentation.
358
541
 
359
- **Example**:
360
- ```bash
361
- hewtd list
362
- ```
542
+ | Command | Description |
543
+ |---------|-------------|
544
+ | `/docs load <domain>` | Load a specific category of docs so Claude can answer questions about it |
545
+ | `/docs list` | Show all 15 documentation categories |
546
+ | `/docs search <query>` | Search through all documentation |
547
+ | `/docs stats` | Display statistics (health score, doc count, recent updates) |
548
+ | `/docs maintain` | Run health check and fix issues |
549
+ | `/docs integrate <file>` | Add a document to the documentation system |
550
+ | `/discover` | Scan code for patterns and create documentation |
363
551
 
364
- **What to expect**: A table showing category names, priority, and descriptions.
552
+ ##### Claude Command Examples and Details
365
553
 
366
- ---
554
+ **`/docs load <domain>` - Give Claude access to specific docs**
367
555
 
368
- #### `hewtd search` - Find Documentation
556
+ **How to use it**:
557
+ ```
558
+ /docs load security
559
+ ```
369
560
 
370
- **When to use**: Looking for specific information across all docs.
561
+ **When to use it**:
562
+ - Before asking Claude questions about a specific topic
563
+ - When you want Claude to reference your existing documentation
564
+ - Before asking Claude to update or create documentation in a category
371
565
 
372
- **What it does**: Searches through all documentation files for your search term.
566
+ **What to use it on**: Any of the 15 domain names (security, api, database, testing, etc.).
373
567
 
374
- **Examples**:
375
- ```bash
376
- # Basic search
377
- hewtd search "authentication"
568
+ **What to expect**:
569
+ - Claude loads all documents from that category into its context
570
+ - Claude can now answer detailed questions about those docs
571
+ - Claude can reference specific files and sections
572
+ - Claude can suggest improvements or updates
378
573
 
379
- # Search in specific category
380
- hewtd search "authentication" --domain security
574
+ **Example conversation**:
381
575
  ```
576
+ You: /docs load security
577
+ Claude: I've loaded the security documentation. I can see you have 12 documents covering authentication, authorization, encryption, and security best practices. What would you like to know?
382
578
 
383
- **What to expect**: List of files containing your search term, sorted by relevance.
384
-
385
- **Use it on**: Any topic you need to find in your documentation.
579
+ You: How do we handle OAuth tokens?
580
+ Claude: Based on your security docs, OAuth tokens are stored in httpOnly cookies and have a 1-hour expiration. The implementation is in security/oauth-implementation.md...
581
+ ```
386
582
 
387
583
  ---
388
584
 
389
- #### `hewtd report` - Generate Reports
585
+ **`/docs list` - See what documentation exists**
390
586
 
391
- **When to use**: Weekly metrics, stakeholder updates, or dashboards.
587
+ **How to use it**:
588
+ ```
589
+ /docs list
590
+ ```
392
591
 
393
- **What it does**: Creates comprehensive reports in markdown or JSON format.
592
+ **When to use it**: When you want to know what documentation categories are available.
394
593
 
395
- **Examples**:
396
- ```bash
397
- # Health report
398
- hewtd report health
594
+ **What to expect**: Claude shows you all 15 categories with descriptions and document counts.
399
595
 
400
- # Audit report
401
- hewtd report audit
596
+ ---
402
597
 
403
- # Link topology report
404
- hewtd report links
598
+ **`/docs search <query>` - Find specific information**
405
599
 
406
- # JSON output for automation
407
- hewtd report health --format json
600
+ **How to use it**:
601
+ ```
602
+ /docs search "authentication flow"
408
603
  ```
409
604
 
410
- **What to expect**: Detailed report saved to `.documentation/reports/` with scores, statistics, and recommendations.
411
-
412
- **Use it on**: Your documentation system to get metrics and trends.
605
+ **When to use it**:
606
+ - Before writing new documentation (check if it already exists)
607
+ - When you can't remember where something is documented
608
+ - To find all places a topic is mentioned
413
609
 
414
- ---
610
+ **What to expect**: Claude shows you which files contain your search term and can read those files for you.
415
611
 
416
- ## Claude Code Integration
612
+ **Example**:
613
+ ```
614
+ You: /docs search "API rate limiting"
615
+ Claude: Found "API rate limiting" in 3 files:
616
+ 1. api/rate-limiting.md (6 matches)
617
+ 2. security/api-security.md (2 matches)
618
+ 3. troubleshooting/api-errors.md (1 match)
417
619
 
418
- This tool works as a Claude Code plugin to help Claude understand and work with your documentation.
620
+ Would you like me to load these files and explain the rate limiting implementation?
621
+ ```
419
622
 
420
- ### Available Claude Commands
623
+ ---
421
624
 
422
- These commands can be used in conversation with Claude when the plugin is installed:
625
+ **`/docs stats` - Check documentation health**
423
626
 
424
- | Command | Description |
425
- |---------|-------------|
426
- | `/docs load <domain>` | Load a specific category of documentation |
427
- | `/docs list` | Show all documentation categories |
428
- | `/docs search <query>` | Search through documentation |
429
- | `/docs stats` | Display documentation statistics |
430
- | `/docs maintain` | Run maintenance checks |
627
+ **How to use it**:
628
+ ```
629
+ /docs stats
630
+ ```
431
631
 
432
- ### Setting Up Claude Integration
632
+ **When to use it**:
633
+ - Quick health check before committing
634
+ - To see how much documentation exists
635
+ - To check recent changes
636
+ - Before starting a documentation cleanup session
433
637
 
434
- Create or update `.claude/CLAUDE.md` in your project:
638
+ **What to expect**: Claude shows you:
639
+ - Health score (0-100)
640
+ - Total number of documents
641
+ - Documents by category
642
+ - Recently updated files
643
+ - Issues found (broken links, missing metadata)
435
644
 
436
- ```markdown
437
- # Documentation System
645
+ ---
438
646
 
439
- This project uses hit-em-with-the-docs for documentation management.
647
+ **`/docs maintain` - Fix documentation problems**
440
648
 
441
- ## Available Documentation Commands
649
+ **How to use it**:
650
+ ```
651
+ /docs maintain
652
+ ```
442
653
 
443
- - `/docs load <domain>` - Load specific documentation domain
444
- - `/docs list` - List all available domains
445
- - `/docs search <query>` - Search documentation
446
- - `/docs stats` - Show documentation statistics
447
- - `/docs maintain` - Run documentation maintenance
654
+ **When to use it**:
655
+ - Before committing changes
656
+ - Weekly maintenance
657
+ - After adding lots of new documentation
658
+ - When you notice issues
448
659
 
449
- ## Documentation Structure
660
+ **What to expect**: Claude runs the maintenance system and reports:
661
+ - Issues found
662
+ - Issues automatically fixed
663
+ - Updated health score
664
+ - Suggestions for manual fixes
450
665
 
451
- Documentation is organized into 15 domains:
452
- - security: Authentication, authorization, security practices
453
- - api: API endpoints and specifications
454
- - database: Database schema and queries
455
- - testing: Test strategies and patterns
456
- - And 11 more specialized categories
457
- ```
666
+ ---
458
667
 
459
- ### How to Use with Claude
668
+ **`/docs integrate <file>` - Organize a document**
460
669
 
461
- **Loading documentation**:
670
+ **How to use it**:
462
671
  ```
463
- You: /docs load security
464
- Claude: [Loads all security-related documentation and can answer questions about it]
672
+ /docs integrate ./new-guide.md
465
673
  ```
466
674
 
467
- **Searching documentation**:
468
- ```
469
- You: /docs search authentication
470
- Claude: [Shows files containing "authentication"]
471
- ```
675
+ **When to use it**: When you have a markdown file that needs to be added to the documentation system.
472
676
 
473
- **Getting statistics**:
474
- ```
475
- You: /docs stats
476
- Claude: [Shows health score, document counts, recent updates]
477
- ```
677
+ **What to expect**: Claude reads the file, determines the best category, adds metadata, and moves it to the correct location.
478
678
 
479
- **Running maintenance**:
679
+ ---
680
+
681
+ **`/discover` - Generate docs from code**
682
+
683
+ **How to use it**:
480
684
  ```
481
- You: /docs maintain
482
- Claude: [Runs health check and reports issues]
685
+ /discover patterns
686
+ /discover anti-patterns
687
+ /discover standards
688
+ /discover dependencies
483
689
  ```
484
690
 
485
- **When to use these commands**:
486
- - Use `/docs load` when asking Claude questions about specific topics
487
- - Use `/docs search` to find existing documentation before writing new content
488
- - Use `/docs stats` to check documentation health
489
- - Use `/docs maintain` before committing changes
691
+ **When to use it**:
692
+ - Creating architecture documentation
693
+ - Onboarding guides for new developers
694
+ - When you need to document existing patterns
490
695
 
491
- **What to expect**: Claude will have full context of your documentation and can answer questions, suggest improvements, or help maintain it.
696
+ **What to expect**: Claude scans your code, identifies patterns, and creates documentation files with code examples.
492
697
 
493
698
  ---
494
699
 
495
700
  ## Common Workflows
496
701
 
497
- ### Daily Development
702
+ ### Quick Daily Check (30 seconds)
498
703
  ```bash
499
- # Quick health check before committing
704
+ # Before committing changes
500
705
  hewtd maintain --quick
501
706
  ```
502
707
 
503
- ### Adding New Documentation
708
+ ### Adding New Documentation (2 minutes)
504
709
  ```bash
505
- # 1. Write your document
710
+ # Step 1: Write your doc (use any editor)
506
711
  vim my-new-guide.md
507
712
 
508
- # 2. Add it to the system
713
+ # Step 2: Add it to the system
509
714
  hewtd integrate my-new-guide.md
510
715
 
511
- # 3. Quick check
716
+ # Step 3: Quick health check
512
717
  hewtd maintain --quick --fix
513
718
  ```
514
719
 
515
- ### Weekly Maintenance
720
+ ### Weekly Maintenance (5 minutes)
516
721
  ```bash
517
722
  # Auto-fix all issues
518
723
  hewtd maintain --quick --fix
519
724
 
520
725
  # Review the report
521
726
  cat .documentation/reports/maintenance-*.md
727
+
728
+ # Or just look at the health score
729
+ hewtd report health
522
730
  ```
523
731
 
524
- ### Before Releasing
732
+ ### Before Releasing (10 minutes)
525
733
  ```bash
526
- # 1. Full maintenance with link checking
734
+ # Step 1: Full check with link validation
527
735
  hewtd maintain --fix
528
736
 
529
- # 2. Generate health report
737
+ # Step 2: Generate health report
530
738
  hewtd report health
531
739
 
532
- # 3. Make sure score is above 80
533
- # 4. Commit changes
740
+ # Step 3: Make sure score is above 80
741
+ # If not, check the report for issues
742
+
743
+ # Step 4: Commit changes
744
+ git add .documentation
745
+ git commit -m "docs: update and fix documentation"
534
746
  ```
535
747
 
536
- ### Migrating Existing Documentation
748
+ ### Migrating Existing Docs (30 minutes)
537
749
  ```bash
538
- # 1. Create structure
750
+ # Step 1: Create structure
539
751
  hewtd init
540
752
 
541
- # 2. Preview where files will go
753
+ # Step 2: Preview where files will go
542
754
  for file in old-docs/*.md; do
543
755
  hewtd integrate "$file" --dry-run
544
756
  done
545
757
 
546
- # 3. Integrate all files
758
+ # Step 3: If preview looks good, integrate them all
547
759
  for file in old-docs/*.md; do
548
760
  hewtd integrate "$file" --auto
549
761
  done
550
762
 
551
- # 4. Run maintenance
763
+ # Step 4: Fix any issues
552
764
  hewtd maintain --fix
553
765
 
554
- # 5. Check results
766
+ # Step 5: Check results
555
767
  hewtd report health
556
768
  ```
557
769
 
@@ -561,309 +773,815 @@ hewtd report health
561
773
 
562
774
  ### Architecture Overview
563
775
 
564
- The system is built with TypeScript and organized into several core modules:
776
+ Hit 'Em With The Docs is built with TypeScript and organized into several core modules:
565
777
 
566
778
  ```
567
779
  src/
568
- ├── cli/ # Command-line interface
569
- ├── core/
570
- ├── audit/ # Documentation quality auditing
571
- ├── discover/ # Code pattern discovery
572
- │ ├── domains/ # Domain classification system
573
- │ ├── integrate/ # Document integration
574
- │ ├── links/ # Link checking and tracking
575
- ├── maintain/ # Maintenance orchestration
576
- └── metadata/ # Metadata management
577
- ├── generators/ # Scaffold and template generation
578
- ├── reports/ # Report generation
579
- └── utils/ # Shared utilities
780
+ ├── cli/ # Command-line interface
781
+ │ └── index.ts # Main CLI entry point and command definitions
782
+
783
+ ├── core/ # Core business logic
784
+ │ ├── audit/ # Quality auditing
785
+ ├── auditor.ts # Main audit orchestrator
786
+ ├── naming.ts # File naming convention checks
787
+ │ └── placement.ts # Document placement validation
788
+
789
+ ├── discover/ # Code pattern discovery
790
+ │ │ ├── patterns.ts # Pattern detection (Singleton, Factory, etc.)
791
+ │ │ ├── anti-patterns.ts # Anti-pattern detection
792
+ │ │ ├── standards.ts # Coding standard extraction
793
+ │ │ └── dependencies.ts # Dependency analysis
794
+ │ │
795
+ │ ├── domains/ # Domain classification system
796
+ │ │ ├── definitions.ts # 15 domain definitions with keywords
797
+ │ │ ├── classifier.ts # Smart classification algorithm
798
+ │ │ └── loader.ts # Domain loading and caching
799
+ │ │
800
+ │ ├── integrate/ # Document integration
801
+ │ │ ├── integrator.ts # Main integration orchestrator
802
+ │ │ ├── analyzer.ts # Content analysis for classification
803
+ │ │ └── mover.ts # File movement and organization
804
+ │ │
805
+ │ ├── links/ # Link checking and tracking
806
+ │ │ ├── checker.ts # Link validation
807
+ │ │ ├── parser.ts # Markdown link extraction
808
+ │ │ ├── resolver.ts # Relative path resolution
809
+ │ │ └── topology.ts # Link graph and backlinks
810
+ │ │
811
+ │ ├── maintain/ # Maintenance orchestration
812
+ │ │ ├── orchestrator.ts # Main maintenance coordinator
813
+ │ │ ├── health.ts # Health score calculation
814
+ │ │ └── scheduler.ts # Maintenance scheduling
815
+ │ │
816
+ │ └── metadata/ # Metadata management
817
+ │ ├── sync.ts # Metadata synchronization
818
+ │ ├── validator.ts # Metadata validation
819
+ │ └── generator.ts # Auto-generation of computed fields
820
+
821
+ ├── generators/ # Scaffold and template generation
822
+ │ ├── scaffold.ts # Documentation structure creation
823
+ │ └── templates/ # Document templates
824
+
825
+ ├── reports/ # Report generation
826
+ │ ├── health.ts # Health reports
827
+ │ ├── audit.ts # Audit reports
828
+ │ ├── links.ts # Link topology reports
829
+ │ └── formatters/ # Output formatters (markdown, JSON)
830
+
831
+ └── utils/ # Shared utilities
832
+ ├── files.ts # File system operations
833
+ ├── markdown.ts # Markdown parsing and manipulation
834
+ └── logger.ts # Logging and output formatting
580
835
  ```
581
836
 
582
837
  ### File Structure
583
838
 
584
- **Root Documentation Files**:
585
- - `INDEX.md` - Main navigation hub with links to all domains
586
- - `REGISTRY.md` - Quick reference list of all documents
587
- - `README.md` - Overview and getting started guide
839
+ When you run `hewtd init`, it creates this structure:
588
840
 
589
- **Domain Structure**:
590
- Each of the 15 domains follows this pattern:
591
- ```
592
- domain-name/
593
- ├── INDEX.md # Domain table of contents
594
- ├── REGISTRY.md # Quick reference for this domain
595
- └── *.md # Individual documentation files
596
- ```
597
-
598
- **Generated Files**:
599
841
  ```
600
842
  .documentation/
601
- ├── reports/ # Health, audit, and link reports
602
- ├── maintenance-YYYYMMDD-HHMMSS.md
603
- ├── audit-YYYYMMDD-HHMMSS.md
604
- └── links-YYYYMMDD-HHMMSS.md
605
- └── drafts/ # Work-in-progress documents
843
+ ├── INDEX.md # Main navigation hub (links to all domains)
844
+ ├── REGISTRY.md # Complete list of all documents (auto-generated)
845
+ ├── README.md # Getting started guide for contributors
846
+
847
+ ├── security/ # Security documentation (priority: 9)
848
+ │ ├── INDEX.md # Security domain table of contents
849
+ │ ├── REGISTRY.md # Quick reference for security docs
850
+ │ └── *.md # Individual security documents
851
+
852
+ ├── api/ # API documentation (priority: 8)
853
+ │ ├── INDEX.md
854
+ │ ├── REGISTRY.md
855
+ │ └── *.md
856
+
857
+ ├── database/ # Database documentation (priority: 8)
858
+ │ ├── INDEX.md
859
+ │ ├── REGISTRY.md
860
+ │ └── *.md
861
+
862
+ ├── testing/ # Testing documentation (priority: 7)
863
+ ├── architecture/ # Architecture docs (priority: 7)
864
+ ├── standards/ # Coding standards (priority: 10)
865
+ ├── devops/ # DevOps/infrastructure (priority: 8)
866
+ ├── quickstart/ # Onboarding guides (priority: 9)
867
+ ├── features/ # Feature docs (priority: 6)
868
+ ├── procedures/ # Step-by-step procedures (priority: 6)
869
+ ├── workflows/ # Process documentation (priority: 5)
870
+ ├── troubleshooting/ # Debug guides (priority: 6)
871
+ ├── agents/ # AI agent docs (priority: 5)
872
+ ├── backups/ # Backup/recovery (priority: 4)
873
+ ├── plans/ # Planning docs (priority: 3)
874
+
875
+ └── reports/ # Generated reports
876
+ ├── maintenance-YYYYMMDD-HHMMSS.md
877
+ ├── audit-YYYYMMDD-HHMMSS.md
878
+ └── links-YYYYMMDD-HHMMSS.md
606
879
  ```
607
880
 
608
881
  ### Domain System
609
882
 
610
- The system organizes documentation into 15 specialized domains:
611
-
612
- | Domain | Category | Priority | Description |
613
- |--------|----------|----------|-------------|
614
- | `standards` | development | 10 | Coding standards and conventions |
615
- | `security` | core | 9 | Security, auth, encryption |
616
- | `quickstart` | features | 9 | Setup and onboarding |
617
- | `devops` | core | 8 | Deployment and infrastructure |
618
- | `database` | core | 8 | Schema and queries |
619
- | `api` | core | 8 | API endpoints and specs |
620
- | `testing` | development | 7 | Test strategies and patterns |
621
- | `architecture` | development | 7 | System design and patterns |
622
- | `features` | features | 6 | Feature implementation guides |
623
- | `procedures` | features | 6 | Step-by-step operations |
624
- | `troubleshooting` | advanced | 6 | Debug guides and solutions |
625
- | `workflows` | features | 5 | Process documentation |
626
- | `agents` | advanced | 5 | AI agent documentation |
627
- | `backups` | advanced | 4 | Backup and recovery |
628
- | `plans` | advanced | 3 | Planning and roadmaps |
629
-
630
- **Priority System**: Domains with higher priority (1-10 scale) are loaded first by Claude Code and other integrations.
883
+ The system organizes documentation into 15 specialized domains with different priorities (1-10 scale, higher = more important):
884
+
885
+ | Domain | Priority | Category | Description | Keywords |
886
+ |--------|----------|----------|-------------|----------|
887
+ | `standards` | 10 | development | Coding standards and conventions | standards, conventions, style guide, best practices |
888
+ | `security` | 9 | core | Security, authentication, authorization | security, auth, encryption, oauth, jwt, permissions |
889
+ | `quickstart` | 9 | features | Setup and onboarding guides | quickstart, setup, installation, getting started |
890
+ | `devops` | 8 | core | Deployment and infrastructure | devops, deployment, ci/cd, docker, kubernetes |
891
+ | `database` | 8 | core | Database schema and queries | database, schema, sql, migrations, orm |
892
+ | `api` | 8 | core | API endpoints and specifications | api, endpoint, rest, graphql, http |
893
+ | `testing` | 7 | development | Test strategies and patterns | testing, unit test, integration, e2e |
894
+ | `architecture` | 7 | development | System design and patterns | architecture, design, patterns, structure |
895
+ | `features` | 6 | features | Feature implementation guides | features, implementation, functionality |
896
+ | `procedures` | 6 | features | Step-by-step operations | procedures, steps, operations, how-to |
897
+ | `troubleshooting` | 6 | advanced | Debugging guides | troubleshooting, debug, errors, solutions |
898
+ | `workflows` | 5 | features | Process documentation | workflows, process, pipelines |
899
+ | `agents` | 5 | advanced | AI agent documentation | agents, ai, automation, bots |
900
+ | `backups` | 4 | advanced | Backup and recovery | backups, recovery, restore |
901
+ | `plans` | 3 | advanced | Planning and roadmaps | plans, roadmap, future, planning |
902
+
903
+ **Priority System**: Claude Code and other integrations load higher-priority domains first. This ensures critical documentation (like security and API docs) is available before less-critical content.
631
904
 
632
905
  **Categories**:
633
- - `core`: Essential project infrastructure
634
- - `development`: Development practices and patterns
635
- - `features`: Feature-specific documentation
636
- - `advanced`: Specialized or less-frequently accessed
906
+ - **core**: Essential infrastructure (security, database, APIs, devops)
907
+ - **development**: Development practices (testing, standards, architecture)
908
+ - **features**: Feature-specific documentation (features, procedures, workflows, quickstart)
909
+ - **advanced**: Specialized content (troubleshooting, agents, backups, plans)
637
910
 
638
911
  ### Metadata Schema
639
912
 
640
913
  Every document includes YAML frontmatter with up to 22 fields:
641
914
 
642
- **Required Fields**:
915
+ #### Required Fields (Must be present)
643
916
  ```yaml
644
- title: "Document Title"
645
- tier: guide|standard|example|reference|admin
646
- domains: [primary-domain, secondary-domain]
647
- status: draft|active|deprecated|archived
917
+ ---
918
+ title: "Document Title" # Human-readable title
919
+ tier: guide # guide|standard|example|reference|admin
920
+ domains: [primary-domain] # Which category/categories it belongs to
921
+ status: active # draft|active|deprecated|archived
922
+ ---
648
923
  ```
649
924
 
650
- **Auto-Generated Fields**:
925
+ #### Auto-Generated Fields (System fills these in)
651
926
  ```yaml
652
- word_count: 1234 # Calculated from content
653
- estimated_read_time: "5 minutes" # Based on 200 words/minute
654
- last_validated: '2024-01-15' # Date of last metadata sync
927
+ word_count: 1234 # Calculated from content
928
+ estimated_read_time: "5 minutes" # Based on 200 words/minute
929
+ last_validated: '2024-01-15' # Date of last metadata sync
930
+ backlinks: [] # Generated by link checker
655
931
  ```
656
932
 
657
- **Optional Fields**:
933
+ #### Optional Fields (You can add these)
658
934
  ```yaml
659
- # Discovery
660
- purpose: "One-sentence description"
661
- tags: [tag1, tag2, tag3]
662
- audience: [developers|devops|admin|all]
663
- related_docs: [./other-doc.md]
664
-
665
- # Lifecycle
666
- last_updated: '2024-01-15'
667
- version: '1.0.0'
668
- review_frequency: monthly|quarterly|annually
935
+ # Discovery and Organization
936
+ purpose: "One-sentence description" # What this doc is about
937
+ tags: [security, auth, api] # Searchable tags
938
+ audience: [developers, devops] # Who should read this
939
+ related_docs: [./other-doc.md] # Related documentation
940
+ keywords: [keyword1, keyword2] # Search keywords
941
+
942
+ # Lifecycle Management
943
+ last_updated: '2024-01-15' # When content was last changed
944
+ version: '1.0.0' # Document version
945
+ review_frequency: monthly # How often to review (monthly|quarterly|annually)
669
946
 
670
947
  # Ownership
671
- author: "Name"
672
- maintainer: "Team Name"
673
-
674
- # Implementation
675
- implementation_status: planned|in_progress|complete
676
- tested: true|false
677
- production_ready: true|false
678
- load_priority: 1-10
679
- backlinks: [] # Auto-generated by link checker
948
+ author: "John Doe" # Original author
949
+ maintainer: "Platform Team" # Current maintainer
950
+ contributors: ["Jane", "Bob"] # Additional contributors
951
+
952
+ # Implementation Tracking
953
+ implementation_status: complete # planned|in_progress|complete
954
+ tested: true # Whether examples are tested
955
+ production_ready: true # Ready for production use
956
+ load_priority: 8 # Override default domain priority (1-10)
957
+
958
+ # Additional Context
959
+ prerequisites: ["setup.md", "auth.md"] # Required reading
960
+ difficulty: intermediate # beginner|intermediate|advanced
680
961
  ```
681
962
 
682
963
  ### Classification Algorithm
683
964
 
684
- The domain classifier uses keyword-based scoring with Levenshtein distance:
965
+ The domain classifier uses a sophisticated keyword-based scoring system with fuzzy matching:
966
+
967
+ #### Step 1: Content Extraction
968
+ ```typescript
969
+ // src/core/domains/classifier.ts
970
+ function extractKeywords(document: Document): string[] {
971
+ // Extract from title (weighted 3x)
972
+ const titleWords = tokenize(document.title);
973
+
974
+ // Extract from content (weighted 1x)
975
+ const contentWords = tokenize(document.content);
976
+
977
+ // Remove stop words (the, and, or, etc.)
978
+ return removeStopWords([...titleWords, ...contentWords]);
979
+ }
980
+ ```
981
+
982
+ #### Step 2: Domain Scoring
983
+ ```typescript
984
+ function scoreDomain(keywords: string[], domain: Domain): number {
985
+ let score = 0;
986
+
987
+ for (const keyword of keywords) {
988
+ for (const domainKeyword of domain.keywords) {
989
+ // Exact match: +10 points
990
+ if (keyword === domainKeyword) {
991
+ score += 10;
992
+ }
993
+ // Fuzzy match (Levenshtein distance < 3): +5 points
994
+ else if (levenshteinDistance(keyword, domainKeyword) < 3) {
995
+ score += 5;
996
+ }
997
+ }
998
+ }
999
+
1000
+ return score;
1001
+ }
1002
+ ```
1003
+
1004
+ #### Step 3: Confidence Calculation
1005
+ ```typescript
1006
+ function calculateConfidence(scores: Map<Domain, number>): Confidence {
1007
+ const topScore = Math.max(...scores.values());
1008
+ const totalScore = Array.from(scores.values()).reduce((a, b) => a + b, 0);
1009
+
1010
+ // Confidence = (top score / total score) * 100
1011
+ const confidence = (topScore / totalScore) * 100;
1012
+
1013
+ return {
1014
+ topDomain: getTopDomain(scores),
1015
+ confidence: Math.round(confidence),
1016
+ suggestions: getTopN(scores, 3) // Top 3 suggestions
1017
+ };
1018
+ }
1019
+ ```
1020
+
1021
+ **Example**:
1022
+ ```
1023
+ Document title: "OAuth 2.0 Authentication Guide"
1024
+ Keywords extracted: [oauth, authentication, guide, security, token]
1025
+
1026
+ Scoring:
1027
+ - security domain: oauth(10) + authentication(10) + security(10) = 30
1028
+ - api domain: oauth(5) + authentication(5) = 10
1029
+ - quickstart domain: guide(10) = 10
1030
+
1031
+ Top domain: security (60% confidence)
1032
+ Suggestions: [security, api, quickstart]
1033
+ ```
1034
+
1035
+ ### Link Tracking System
1036
+
1037
+ The link checker maintains a complete topology of your documentation:
1038
+
1039
+ #### Link Extraction
1040
+ ```typescript
1041
+ // src/core/links/parser.ts
1042
+ function extractLinks(markdown: string): Link[] {
1043
+ // Matches: [text](./path.md) and [text](./path.md#anchor)
1044
+ const linkRegex = /\[([^\]]+)\]\(([^)]+)\)/g;
1045
+
1046
+ const links: Link[] = [];
1047
+ let match;
1048
+
1049
+ while ((match = linkRegex.exec(markdown)) !== null) {
1050
+ links.push({
1051
+ text: match[1], // Link text
1052
+ target: match[2], // Link target
1053
+ line: getLineNumber(markdown, match.index)
1054
+ });
1055
+ }
1056
+
1057
+ return links;
1058
+ }
1059
+ ```
1060
+
1061
+ #### Link Resolution
1062
+ ```typescript
1063
+ // src/core/links/resolver.ts
1064
+ function resolveLink(sourceFile: string, target: string): ResolvedLink {
1065
+ // Handle relative paths
1066
+ if (target.startsWith('./') || target.startsWith('../')) {
1067
+ const absolute = path.resolve(path.dirname(sourceFile), target);
1068
+
1069
+ // Remove anchor
1070
+ const [filePath, anchor] = absolute.split('#');
1071
+
1072
+ return {
1073
+ sourceFile,
1074
+ targetFile: filePath,
1075
+ anchor,
1076
+ exists: fs.existsSync(filePath)
1077
+ };
1078
+ }
1079
+
1080
+ // Handle absolute paths within .documentation
1081
+ if (target.startsWith('/')) {
1082
+ const absolute = path.join(DOCS_ROOT, target);
1083
+ return { /* ... */ };
1084
+ }
1085
+
1086
+ // External links (http://, https://)
1087
+ return { isExternal: true, target };
1088
+ }
1089
+ ```
1090
+
1091
+ #### Topology Building
1092
+ ```typescript
1093
+ // src/core/links/topology.ts
1094
+ interface LinkTopology {
1095
+ forward: Map<string, string[]>; // file -> [linked files]
1096
+ backward: Map<string, string[]>; // file -> [files that link to it]
1097
+ broken: BrokenLink[]; // List of broken links
1098
+ orphaned: string[]; // Files with no incoming links
1099
+ }
685
1100
 
686
- 1. **Keyword Matching** (`src/core/domains/classifier.ts`):
687
- - Extracts words from document title and content
688
- - Scores each domain based on keyword matches
689
- - Uses weighted scoring (title matches count more)
1101
+ function buildTopology(documents: Document[]): LinkTopology {
1102
+ const topology: LinkTopology = {
1103
+ forward: new Map(),
1104
+ backward: new Map(),
1105
+ broken: [],
1106
+ orphaned: []
1107
+ };
1108
+
1109
+ // Build forward links
1110
+ for (const doc of documents) {
1111
+ const links = extractLinks(doc.content);
1112
+ const resolved = links.map(link => resolveLink(doc.path, link.target));
1113
+
1114
+ topology.forward.set(doc.path, resolved.map(r => r.targetFile));
1115
+
1116
+ // Track broken links
1117
+ for (const link of resolved) {
1118
+ if (!link.exists) {
1119
+ topology.broken.push({ source: doc.path, target: link.target });
1120
+ }
1121
+ }
1122
+ }
690
1123
 
691
- 2. **Fuzzy Matching**:
692
- - Uses Levenshtein distance for similar words
693
- - Catches variations (e.g., "authenticate" matches "authentication")
694
- - Configurable similarity threshold
1124
+ // Build backward links (backlinks)
1125
+ for (const [source, targets] of topology.forward) {
1126
+ for (const target of targets) {
1127
+ if (!topology.backward.has(target)) {
1128
+ topology.backward.set(target, []);
1129
+ }
1130
+ topology.backward.get(target)!.push(source);
1131
+ }
1132
+ }
695
1133
 
696
- 3. **Confidence Scoring**:
697
- - Returns confidence percentage for each domain
698
- - Suggests top 3 matches
699
- - Falls back to user selection if confidence is low
1134
+ // Find orphaned documents
1135
+ for (const doc of documents) {
1136
+ if (!topology.backward.has(doc.path)) {
1137
+ topology.orphaned.push(doc.path);
1138
+ }
1139
+ }
700
1140
 
701
- ### Link Tracking
1141
+ return topology;
1142
+ }
1143
+ ```
702
1144
 
703
- The link checker (`src/core/links/checker.ts`) maintains a topology map:
1145
+ ### Maintenance Orchestration
1146
+
1147
+ The maintenance system coordinates multiple checks and generates a comprehensive health score:
1148
+
1149
+ ```typescript
1150
+ // src/core/maintain/orchestrator.ts
1151
+ async function runMaintenance(options: MaintenanceOptions): Promise<MaintenanceReport> {
1152
+ const report: MaintenanceReport = {
1153
+ timestamp: new Date(),
1154
+ healthScore: 0,
1155
+ issues: [],
1156
+ fixed: [],
1157
+ statistics: {}
1158
+ };
1159
+
1160
+ // Step 1: Metadata Sync (40% of health score)
1161
+ console.log('Step 1: Metadata Sync');
1162
+ const metadataResults = await syncMetadata(options);
1163
+ report.statistics.metadataCompliance = metadataResults.compliance;
1164
+ report.healthScore += metadataResults.compliance * 0.4;
1165
+
1166
+ // Step 2: Link Check (30% of health score) - optional in quick mode
1167
+ if (!options.quick) {
1168
+ console.log('Step 2: Link Check');
1169
+ const linkResults = await checkLinks(options);
1170
+ report.statistics.linkHealth = linkResults.health;
1171
+ report.healthScore += linkResults.health * 0.3;
1172
+ report.statistics.brokenLinks = linkResults.broken.length;
1173
+ }
704
1174
 
705
- - Parses markdown links in all documents
706
- - Resolves relative paths
707
- - Tracks cross-domain references
708
- - Builds backlink map
709
- - Detects broken links and orphaned documents
1175
+ // Step 3: Audit (30% of health score)
1176
+ console.log('Step 3: Audit');
1177
+ const auditResults = await runAudit(options);
1178
+ const namingScore = auditResults.namingCompliance;
1179
+ const placementScore = auditResults.placementAccuracy;
1180
+ report.statistics.namingCompliance = namingScore;
1181
+ report.statistics.placementAccuracy = placementScore;
1182
+ report.healthScore += (namingScore * 0.2) + (placementScore * 0.1);
710
1183
 
711
- ### Maintenance Orchestrator
1184
+ // Step 4: Generate Report
1185
+ console.log('Step 4: Generate Report');
1186
+ await writeReport(report, options);
712
1187
 
713
- The maintenance system (`src/core/maintain/orchestrator.ts`) coordinates:
1188
+ return report;
1189
+ }
1190
+ ```
714
1191
 
715
- 1. **Metadata Sync**: Updates frontmatter across all documents
716
- 2. **Link Check**: Validates internal links (optional in quick mode)
717
- 3. **Audit**: Checks naming conventions and file placement
718
- 4. **Report Generation**: Creates health score and detailed report
1192
+ **Health Score Breakdown**:
1193
+ - **Metadata Completeness (40%)**: How many required fields are filled in
1194
+ - **Link Health (30%)**: Percentage of valid links (skipped in quick mode)
1195
+ - **Naming Compliance (20%)**: Files following kebab-case convention
1196
+ - **Placement Accuracy (10%)**: Files in correct domains
719
1197
 
720
- Health score calculation:
721
- - Metadata completeness: 40%
722
- - Link health: 30%
723
- - Naming compliance: 20%
724
- - File placement accuracy: 10%
1198
+ **Target Scores**:
1199
+ - 90-100: Excellent (production-ready)
1200
+ - 80-89: Good (acceptable for production)
1201
+ - 70-79: Fair (needs improvement)
1202
+ - Below 70: Poor (requires immediate attention)
725
1203
 
726
- ### GitHub Action
1204
+ ### GitHub Action Integration
727
1205
 
728
- The action (`src/action/index.ts`) wraps the CLI for GitHub workflows:
1206
+ The GitHub Action wraps the CLI for automated checks:
729
1207
 
730
- **Inputs**:
731
- - `command`: CLI command to run
732
- - `mode`: Execution mode (quick/full/fix)
733
- - `docs-path`: Path to documentation
734
- - `domain`: Specific domain filter
735
- - `fail-on-error`: Exit code behavior
736
- - `fail-threshold`: Minimum health score
1208
+ ```yaml
1209
+ # .github/workflows/docs-check.yml
1210
+ name: Documentation Health
1211
+
1212
+ on:
1213
+ push:
1214
+ paths:
1215
+ - '.documentation/**'
1216
+ pull_request:
1217
+ paths:
1218
+ - '.documentation/**'
1219
+ schedule:
1220
+ - cron: '0 16 * * 5' # Every Friday at 4 PM UTC
1221
+
1222
+ jobs:
1223
+ docs-health:
1224
+ runs-on: ubuntu-latest
1225
+ steps:
1226
+ - uses: actions/checkout@v4
1227
+
1228
+ - name: Check Documentation
1229
+ uses: TheGlitchKing/hit-em-with-the-docs@v2
1230
+ with:
1231
+ command: maintain # Command to run
1232
+ mode: quick # quick|full|fix
1233
+ docs-path: .documentation # Path to docs
1234
+ fail-on-error: true # Fail if issues found
1235
+ fail-threshold: 80 # Minimum health score
1236
+
1237
+ - name: Upload Report
1238
+ if: always()
1239
+ uses: actions/upload-artifact@v3
1240
+ with:
1241
+ name: docs-report
1242
+ path: .documentation/reports/
1243
+ ```
1244
+
1245
+ **Available Inputs**:
1246
+ - `command`: CLI command (maintain, audit, link-check, report)
1247
+ - `mode`: Execution mode (quick, full, fix)
1248
+ - `docs-path`: Path to documentation folder (default: .documentation)
1249
+ - `domain`: Filter by specific domain
1250
+ - `fail-on-error`: Whether to fail if issues found (default: false)
1251
+ - `fail-threshold`: Minimum health score to pass (0-100)
737
1252
 
738
1253
  **Outputs**:
739
- - `health-score`: Overall quality (0-100)
740
- - `total-documents`: Document count
741
- - `issues-found`: Problem count
742
- - `issues-fixed`: Auto-fixed count
743
- - `broken-links`: Broken link count
744
- - `metadata-compliance`: Metadata completeness %
745
- - `report-path`: Generated report location
1254
+ - `health-score`: Overall quality score (0-100)
1255
+ - `total-documents`: Number of documents found
1256
+ - `issues-found`: Number of problems detected
1257
+ - `issues-fixed`: Number of auto-fixed issues (only in fix mode)
1258
+ - `broken-links`: Number of broken links
1259
+ - `metadata-compliance`: Metadata completeness percentage
1260
+ - `report-path`: Path to generated report
746
1261
 
747
1262
  ### Edge Cases and Handling
748
1263
 
749
- **Duplicate Documents**:
750
- - Detected during integration
751
- - User prompted to merge or keep separate
752
- - Can force integration with `--force` flag
1264
+ #### Duplicate Documents
1265
+ ```typescript
1266
+ // Detected during integration
1267
+ if (documentExists(targetPath)) {
1268
+ if (options.force) {
1269
+ // Overwrite existing
1270
+ overwriteDocument(targetPath, document);
1271
+ } else {
1272
+ // Prompt user
1273
+ const action = await prompt('Document exists. Merge or keep separate?');
1274
+ if (action === 'merge') {
1275
+ mergeDocuments(existing, document);
1276
+ }
1277
+ }
1278
+ }
1279
+ ```
753
1280
 
754
- **Missing Metadata**:
755
- - Auto-generated with sensible defaults
756
- - Required fields must be provided
757
- - Validation prevents invalid values
1281
+ #### Missing Metadata
1282
+ ```typescript
1283
+ // Auto-generate with defaults
1284
+ const metadata = {
1285
+ title: inferTitleFromContent(document),
1286
+ tier: 'guide', // Default tier
1287
+ domains: [classifyDomain(document)],
1288
+ status: 'draft', // Default status
1289
+ word_count: countWords(document),
1290
+ estimated_read_time: calculateReadTime(document),
1291
+ last_validated: new Date().toISOString()
1292
+ };
1293
+ ```
758
1294
 
759
- **Circular Links**:
760
- - Detected but not flagged as errors
761
- - Logged in link topology report
762
- - Useful for navigation structures
1295
+ #### Circular Links
1296
+ ```typescript
1297
+ // Not flagged as errors (useful for navigation)
1298
+ function detectCircularLinks(topology: LinkTopology): CircularPath[] {
1299
+ const circles = [];
1300
+
1301
+ for (const [source, targets] of topology.forward) {
1302
+ for (const target of targets) {
1303
+ if (topology.forward.get(target)?.includes(source)) {
1304
+ circles.push({ from: source, to: target, type: 'bidirectional' });
1305
+ }
1306
+ }
1307
+ }
763
1308
 
764
- **Large Files**:
765
- - Configurable size limit (default: 50KB)
766
- - Warning for oversized documents
767
- - Suggest splitting into multiple files
1309
+ // Log for information only
1310
+ console.log(`Found ${circles.length} bidirectional links (not an error)`);
1311
+ return circles;
1312
+ }
1313
+ ```
768
1314
 
769
- **Non-Standard Domains**:
770
- - Custom domains via configuration
771
- - Must include keywords and description
772
- - Integrated into classification system
1315
+ #### Large Files
1316
+ ```typescript
1317
+ // Warn about oversized documents
1318
+ const MAX_SIZE = 50_000; // 50 KB
1319
+
1320
+ if (document.size > MAX_SIZE) {
1321
+ console.warn(`⚠️ ${document.path} is ${formatSize(document.size)}`);
1322
+ console.warn(' Consider splitting into multiple documents');
1323
+ issues.push({
1324
+ type: 'oversized',
1325
+ file: document.path,
1326
+ size: document.size,
1327
+ suggestion: 'Split into smaller documents'
1328
+ });
1329
+ }
1330
+ ```
773
1331
 
774
- **Empty Documents**:
775
- - Flagged in audit
776
- - Not counted in health score
777
- - Suggested for removal or completion
1332
+ #### Empty Documents
1333
+ ```typescript
1334
+ // Flag in audit, exclude from health score
1335
+ if (document.content.trim().length === 0) {
1336
+ issues.push({
1337
+ type: 'empty',
1338
+ file: document.path,
1339
+ severity: 'warning',
1340
+ suggestion: 'Add content or remove file'
1341
+ });
1342
+
1343
+ // Don't include in health score calculation
1344
+ excludeFromHealthScore(document);
1345
+ }
1346
+ ```
778
1347
 
779
1348
  ### Configuration
780
1349
 
781
- Create `.hewtd.config.json` for customization:
1350
+ Create `.hewtd.config.json` in your project root for customization:
782
1351
 
783
1352
  ```json
784
1353
  {
785
1354
  "docsPath": ".documentation",
1355
+
786
1356
  "domains": {
787
1357
  "custom-domain": {
788
- "description": "Custom domain description",
789
- "keywords": ["keyword1", "keyword2"],
1358
+ "description": "Custom domain for specific docs",
1359
+ "keywords": ["custom", "specific", "domain"],
790
1360
  "loadPriority": 5,
791
1361
  "category": "features"
792
1362
  }
793
1363
  },
1364
+
794
1365
  "metadata": {
795
1366
  "requiredFields": ["title", "tier", "domains", "status"],
796
- "autoGenerate": ["word_count", "estimated_read_time", "last_validated"]
1367
+ "autoGenerate": ["word_count", "estimated_read_time", "last_validated"],
1368
+ "customFields": {
1369
+ "team": { "type": "string", "description": "Owning team" },
1370
+ "jira_ticket": { "type": "string", "pattern": "^[A-Z]+-\\d+$" }
1371
+ }
797
1372
  },
1373
+
798
1374
  "audit": {
799
1375
  "namingConvention": "kebab-case",
800
1376
  "maxFileSize": 50000,
801
- "allowedTiers": ["guide", "standard", "example", "reference", "admin"]
1377
+ "allowedTiers": ["guide", "standard", "example", "reference", "admin"],
1378
+ "requiredDomains": ["security", "api", "testing"]
802
1379
  },
1380
+
803
1381
  "discover": {
804
- "excludePaths": ["node_modules", "dist", "vendor", ".git"],
805
- "languages": ["typescript", "javascript", "python", "go"],
1382
+ "excludePaths": ["node_modules", "dist", "build", "vendor", ".git"],
1383
+ "languages": ["typescript", "javascript", "python", "go", "java"],
806
1384
  "patterns": {
807
1385
  "enabled": true,
808
1386
  "minOccurrences": 2
1387
+ },
1388
+ "antiPatterns": {
1389
+ "enabled": true,
1390
+ "severity": "warning"
809
1391
  }
810
1392
  },
1393
+
811
1394
  "links": {
812
1395
  "checkExternal": false,
813
- "ignorePatterns": ["http://localhost", "*.example.com"]
1396
+ "ignorePatterns": ["http://localhost", "*.example.com", "*.test"],
1397
+ "allowedProtocols": ["http", "https", "mailto"],
1398
+ "checkAnchors": true
814
1399
  },
1400
+
815
1401
  "reports": {
816
1402
  "outputPath": ".documentation/reports",
817
1403
  "format": "markdown",
818
- "includeTimestamp": true
1404
+ "includeTimestamp": true,
1405
+ "retention": {
1406
+ "days": 90,
1407
+ "maxReports": 50
1408
+ }
1409
+ },
1410
+
1411
+ "maintenance": {
1412
+ "autoFix": true,
1413
+ "quickMode": {
1414
+ "skipLinkCheck": true,
1415
+ "skipExternalLinks": true
1416
+ },
1417
+ "schedule": {
1418
+ "daily": "0 9 * * *", // 9 AM daily
1419
+ "weekly": "0 16 * * 5" // 4 PM Friday
1420
+ }
819
1421
  }
820
1422
  }
821
1423
  ```
822
1424
 
823
1425
  ### Performance Considerations
824
1426
 
825
- **Large Repositories**:
826
- - Uses streaming for file reads
827
- - Parallel processing where possible
828
- - Configurable concurrency limits
829
- - Quick mode skips expensive operations
1427
+ #### Large Repositories
1428
+ - **Streaming**: Files read in chunks, not loaded entirely into memory
1429
+ - **Parallel Processing**: Uses worker threads for document processing
1430
+ - **Concurrency Limits**: Configurable max concurrent operations
1431
+ - **Quick Mode**: Skips expensive operations (link checking) for speed
1432
+ - **Caching**: Metadata cached during operations, invalidated on changes
830
1433
 
831
- **Memory Usage**:
832
- - Metadata cached in memory during operations
833
- - Link topology built incrementally
834
- - Reports streamed to disk
1434
+ #### Memory Usage
1435
+ - **Incremental Processing**: Documents processed one at a time
1436
+ - **Link Topology**: Built incrementally to avoid loading all links at once
1437
+ - **Report Streaming**: Large reports streamed to disk instead of buffered
1438
+ - **Garbage Collection**: Explicit cleanup after major operations
1439
+
1440
+ #### CI/CD Optimization
1441
+ ```yaml
1442
+ # Fast checks (30-60 seconds)
1443
+ - name: Quick Check
1444
+ run: hewtd maintain --quick
1445
+
1446
+ # Thorough checks (2-5 minutes) - scheduled only
1447
+ - name: Full Check
1448
+ if: github.event.schedule
1449
+ run: hewtd maintain --fix
1450
+
1451
+ # Conditional failure
1452
+ - name: Check with Threshold
1453
+ run: hewtd maintain --fail-threshold 70
1454
+ ```
835
1455
 
836
- **CI/CD Optimization**:
837
- - Quick mode recommended for frequent checks
838
- - Full mode for scheduled/release checks
839
- - Use `fail-threshold` to allow gradual improvement
1456
+ **Recommended Strategies**:
1457
+ - **PR Checks**: Use `--quick` mode (fast, catches most issues)
1458
+ - **Daily Scheduled**: Use full mode with `--fix` (thorough)
1459
+ - **Release Checks**: Use full mode with strict threshold (80+)
1460
+ - **Use fail-threshold**: Allow gradual improvement (start at 60, increase over time)
840
1461
 
841
1462
  ---
842
1463
 
843
1464
  ## Requirements
844
1465
 
845
- - Node.js >= 20.0.0
846
- - npm or yarn
847
- - Git (for GitHub Action)
1466
+ - **Node.js**: Version 20.0.0 or higher
1467
+ - **npm**: Version 8.0.0 or higher (comes with Node.js)
1468
+ - **Operating System**: Linux, macOS, or Windows (with WSL2)
1469
+ - **Git**: Version 2.0+ (for GitHub Action)
1470
+
1471
+ ---
1472
+
1473
+ ## Troubleshooting
1474
+
1475
+ ### Installation Issues
1476
+
1477
+ **Problem**: `npm install` fails with permission errors
1478
+
1479
+ **Solution**:
1480
+ ```bash
1481
+ # Don't use sudo! Instead, fix npm permissions:
1482
+ mkdir ~/.npm-global
1483
+ npm config set prefix '~/.npm-global'
1484
+ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
1485
+ source ~/.bashrc
1486
+
1487
+ # Now install again
1488
+ npm install -g @theglitchking/hit-em-with-the-docs
1489
+ ```
1490
+
1491
+ **Problem**: `hewtd: command not found` after installation
1492
+
1493
+ **Solution**:
1494
+ ```bash
1495
+ # Check if npm bin is in your PATH
1496
+ npm config get prefix
1497
+
1498
+ # Add it to your PATH
1499
+ export PATH="$(npm config get prefix)/bin:$PATH"
1500
+
1501
+ # Add to your shell profile (~/.bashrc or ~/.zshrc)
1502
+ echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
1503
+ ```
1504
+
1505
+ ### Usage Issues
1506
+
1507
+ **Problem**: "No .documentation folder found"
1508
+
1509
+ **Solution**: Run `hewtd init` to create the structure first
1510
+
1511
+ **Problem**: Health score is very low (below 50)
1512
+
1513
+ **Solution**:
1514
+ ```bash
1515
+ # Auto-fix as much as possible
1516
+ hewtd maintain --fix
1517
+
1518
+ # Check the report for remaining issues
1519
+ cat .documentation/reports/maintenance-*.md
1520
+
1521
+ # Common issues:
1522
+ # - Missing metadata: hewtd metadata-sync --fix
1523
+ # - Broken links: hewtd link-check and fix manually
1524
+ # - Wrong file names: Rename to kebab-case (my-file.md)
1525
+ ```
1526
+
1527
+ **Problem**: `hewtd integrate` doesn't put file in the right category
1528
+
1529
+ **Solution**:
1530
+ ```bash
1531
+ # Don't use --auto, let it ask you
1532
+ hewtd integrate ./my-file.md
1533
+
1534
+ # Or move it manually after integration
1535
+ mv .documentation/wrong-domain/file.md .documentation/right-domain/
1536
+ ```
1537
+
1538
+ ---
1539
+
1540
+ ## Migration from v1.x to v2.0
1541
+
1542
+ If you're upgrading from the old unscoped package, see [MIGRATION.md](./MIGRATION.md) for detailed instructions.
1543
+
1544
+ **Quick Migration Steps**:
1545
+ ```bash
1546
+ # Uninstall old version
1547
+ npm uninstall -g hit-em-with-the-docs
1548
+
1549
+ # Install new scoped version
1550
+ npm install -g @theglitchking/hit-em-with-the-docs
1551
+
1552
+ # Verify
1553
+ hewtd --version # Should show 2.0.0 or higher
1554
+
1555
+ # Everything else works the same!
1556
+ ```
1557
+
1558
+ ---
848
1559
 
849
1560
  ## Contributing
850
1561
 
851
- Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
1562
+ Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for:
852
1563
  - Setting up development environment
853
1564
  - Running tests
854
1565
  - Code style guidelines
855
1566
  - Submitting pull requests
856
1567
 
1568
+ ---
1569
+
857
1570
  ## License
858
1571
 
859
- MIT - see [LICENSE](LICENSE) for details.
1572
+ MIT License - see [LICENSE](./LICENSE) file for details.
1573
+
1574
+ ---
860
1575
 
861
1576
  ## Support
862
1577
 
863
- - **Issues**: [GitHub Issues](https://github.com/TheGlitchKing/hit-em-with-the-docs/issues)
864
- - **Discussions**: [GitHub Discussions](https://github.com/TheGlitchKing/hit-em-with-the-docs/discussions)
865
- - **Documentation**: This README and `.documentation/` in your project
1578
+ - **GitHub Issues**: [Report bugs or request features](https://github.com/TheGlitchKing/hit-em-with-the-docs/issues)
1579
+ - **GitHub Discussions**: [Ask questions or share ideas](https://github.com/TheGlitchKing/hit-em-with-the-docs/discussions)
1580
+ - **NPM Package**: [@theglitchking/hit-em-with-the-docs](https://www.npmjs.com/package/@theglitchking/hit-em-with-the-docs)
1581
+ - **Changelog**: [View version history](https://github.com/TheGlitchKing/hit-em-with-the-docs/releases)
1582
+
1583
+ ---
866
1584
 
867
- ## Changelog
1585
+ **Made with ❤️ by TheGlitchKing**
868
1586
 
869
- See [releases](https://github.com/TheGlitchKing/hit-em-with-the-docs/releases) for version history and changes.
1587
+ [NPM](https://www.npmjs.com/package/@theglitchking/hit-em-with-the-docs) | [GitHub](https://github.com/TheGlitchKing/hit-em-with-the-docs) | [Issues](https://github.com/TheGlitchKing/hit-em-with-the-docs/issues)