docspec 0.2.0 → 0.3.0

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 (80) hide show
  1. package/README.md +64 -142
  2. package/dist/__tests__/changed.test.d.ts +2 -0
  3. package/dist/__tests__/changed.test.d.ts.map +1 -0
  4. package/dist/__tests__/changed.test.js +98 -0
  5. package/dist/__tests__/changed.test.js.map +1 -0
  6. package/dist/__tests__/cli.test.js +34 -142
  7. package/dist/__tests__/cli.test.js.map +1 -1
  8. package/dist/__tests__/create.test.d.ts +2 -0
  9. package/dist/__tests__/create.test.d.ts.map +1 -0
  10. package/dist/__tests__/create.test.js +122 -0
  11. package/dist/__tests__/create.test.js.map +1 -0
  12. package/dist/__tests__/generate.test.d.ts +2 -0
  13. package/dist/__tests__/generate.test.d.ts.map +1 -0
  14. package/dist/__tests__/generate.test.js +113 -0
  15. package/dist/__tests__/generate.test.js.map +1 -0
  16. package/dist/__tests__/generator.test.js +26 -22
  17. package/dist/__tests__/generator.test.js.map +1 -1
  18. package/dist/__tests__/path-utils.test.d.ts +2 -0
  19. package/dist/__tests__/path-utils.test.d.ts.map +1 -0
  20. package/dist/__tests__/path-utils.test.js +49 -0
  21. package/dist/__tests__/path-utils.test.js.map +1 -0
  22. package/dist/__tests__/template.test.d.ts +2 -0
  23. package/dist/__tests__/template.test.d.ts.map +1 -0
  24. package/dist/__tests__/template.test.js +95 -0
  25. package/dist/__tests__/template.test.js.map +1 -0
  26. package/dist/changed.d.ts +25 -0
  27. package/dist/changed.d.ts.map +1 -0
  28. package/dist/changed.js +210 -0
  29. package/dist/changed.js.map +1 -0
  30. package/dist/cli.js +89 -72
  31. package/dist/cli.js.map +1 -1
  32. package/dist/constants.d.ts +2 -0
  33. package/dist/constants.d.ts.map +1 -1
  34. package/dist/constants.js +118 -15
  35. package/dist/constants.js.map +1 -1
  36. package/dist/create.d.ts +12 -0
  37. package/dist/create.d.ts.map +1 -0
  38. package/dist/create.js +93 -0
  39. package/dist/create.js.map +1 -0
  40. package/dist/docspec-changed.d.ts +25 -0
  41. package/dist/docspec-changed.d.ts.map +1 -0
  42. package/dist/docspec-changed.js +210 -0
  43. package/dist/docspec-changed.js.map +1 -0
  44. package/dist/docspec-generate.d.ts +22 -0
  45. package/dist/docspec-generate.d.ts.map +1 -0
  46. package/dist/docspec-generate.js +171 -0
  47. package/dist/docspec-generate.js.map +1 -0
  48. package/dist/format-parser.d.ts +2 -1
  49. package/dist/format-parser.d.ts.map +1 -1
  50. package/dist/format-parser.js +45 -15
  51. package/dist/format-parser.js.map +1 -1
  52. package/dist/generate.d.ts +26 -0
  53. package/dist/generate.d.ts.map +1 -0
  54. package/dist/generate.js +175 -0
  55. package/dist/generate.js.map +1 -0
  56. package/dist/generator.d.ts +4 -3
  57. package/dist/generator.d.ts.map +1 -1
  58. package/dist/generator.js +35 -12
  59. package/dist/generator.js.map +1 -1
  60. package/dist/index.d.ts +8 -4
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +16 -7
  63. package/dist/index.js.map +1 -1
  64. package/dist/logger.d.ts +40 -0
  65. package/dist/logger.d.ts.map +1 -0
  66. package/dist/logger.js +74 -0
  67. package/dist/logger.js.map +1 -0
  68. package/dist/path-utils.d.ts +17 -0
  69. package/dist/path-utils.d.ts.map +1 -0
  70. package/dist/path-utils.js +76 -0
  71. package/dist/path-utils.js.map +1 -0
  72. package/dist/template.d.ts +20 -0
  73. package/dist/template.d.ts.map +1 -0
  74. package/dist/template.js +151 -0
  75. package/dist/template.js.map +1 -0
  76. package/dist/validator.d.ts.map +1 -1
  77. package/dist/validator.js +34 -1
  78. package/dist/validator.js.map +1 -1
  79. package/package.json +1 -1
  80. package/README.docspec.md +0 -180
package/README.docspec.md DELETED
@@ -1,180 +0,0 @@
1
- # DOCSPEC: [README.md](/README.md)
2
-
3
- > A specification that defines how the target document should be maintained by agents.
4
-
5
- ## AGENT INSTRUCTIONS
6
-
7
- **Target document:** `README.md`
8
-
9
- **Your task:**
10
-
11
- * Compare the target document against this docspec.
12
- * Update the target document to satisfy this docspec.
13
- * Make the smallest changes necessary.
14
- * Preserve existing content that already complies.
15
- * Do not invent content, sections, or facts not implied by this docspec or the repository.
16
-
17
-
18
-
19
- ## 1. Document Purpose
20
-
21
- This README serves as the primary entry point and comprehensive documentation for the docspec project. It is a technical project overview that must answer:
22
-
23
- - **What is docspec?** - A specification format and toolchain for agent-maintained documentation
24
- - **How do I install it?** - npm installation methods (local and global)
25
- - **How do I use it?** - CLI commands (`validate`, `generate`) and TypeScript API usage
26
- - **How do I integrate it?** - Pre-commit hooks, GitHub Actions (post-merge sync, manual audit)
27
- - **What is the docspec format?** - High-level overview and reference to docspec-format.md
28
- - **How do I develop with it?** - Test and build commands
29
-
30
- **Target audiences:**
31
- - End-users using the CLI for validation and generation
32
- - Library consumers using the TypeScript API in their projects
33
- - GitHub Actions users integrating automated documentation workflows
34
- - CI/CD integrators adding docspec validation to their pipelines
35
- - Contributors developing and testing the project
36
-
37
- **Document type:** Technical project documentation (README/overview)
38
-
39
- ## 2. Update Triggers
40
-
41
- **Changes that SHOULD trigger updates:**
42
-
43
- - **CLI changes** (src/cli.ts): New commands, modified command arguments, changed command behavior
44
- - **Validation logic** (src/validator.ts): New validation rules, changed error messages, modified validation behavior
45
- - **Docspec format definition** (docspec-format.md): Changes to required sections, section names, validation rules
46
- - **GitHub Action configuration** (action.yml): New inputs/outputs, changed defaults, modified descriptions
47
- - **Workflow files** (.github/workflows/docspec-check.yml, docspec-generate.yml): Workflow name changes, trigger changes, new steps or configuration
48
- - **Installation method** (package.json): Package name changes, new installation requirements
49
- - **File naming convention**: Changes to how .docspec.md maps to .md files
50
- - **Required sections** (src/constants.ts): Changes to REQUIRED_SECTIONS array or section definitions
51
- - **Pre-commit hook configuration** (.pre-commit-config.yaml): Changes to hook setup or usage
52
- - **Library API exports** (src/index.ts): New exported functions, types, or constants; removed exports; changed function signatures
53
-
54
- **Changes that SHOULD NOT trigger updates:**
55
-
56
- - Internal implementation details that don't affect public APIs (validator internals, generator internals, format-parser internals)
57
- - Test file changes (src/__tests__/*) unless they reveal new documented behavior
58
- - Build system changes (tsconfig.json, package build scripts) that don't affect installation or usage
59
- - Python script implementation details (docspec_update.py, improve_docspec.py) - these are internal to GitHub Actions
60
- - Dependency version updates that don't change user-facing functionality
61
- - Code refactoring that preserves the same external behavior
62
-
63
- ## 3. Expected Structure
64
-
65
- The README must contain these sections in order:
66
-
67
- 1. **Title and Description**: Package name (`# docspec`) and one-sentence description of what docspec is
68
-
69
- 2. **The Docspec Format**: High-level overview of the format
70
- - Link to docspec-format.md as the definitive format specification
71
- - List the 5 required sections by name
72
- - Explain validation requirements (non-boilerplate content, 50-character minimum)
73
- - Constraint: Do NOT duplicate the full format specification; link to docspec-format.md instead
74
-
75
- 3. **Installation**: npm installation instructions
76
- - Local installation (`npm install docspec`)
77
- - Global installation (`npm install -g docspec`)
78
- - Constraint: Keep concise, no version-specific details
79
-
80
- 4. **Usage**: How to use docspec with subsections:
81
- - **CLI Commands**: Document `validate` and `generate` commands with examples matching src/cli.ts exactly
82
- - **Library Usage**: TypeScript import examples showing exported functions and types from src/index.ts
83
- - Constraint: Code examples must be actual working commands from the codebase
84
-
85
- 5. **Pre-commit Integration**: How to use with pre-commit hooks
86
- - Reference .pre-commit-config.yaml
87
- - Installation command (`pre-commit install`)
88
- - Brief explanation of how validation works
89
- - Constraint: High-level only, link to actual config file
90
-
91
- 6. **GitHub Action Integration**: How to use the GitHub Actions
92
- - Overview of the two workflows (post-merge sync, manual audit)
93
- - **Post-Merge Documentation Updates** subsection:
94
- - Setup instructions (add workflow, configure secrets)
95
- - How it works (discovery strategy, Claude Code CLI invocation, PR creation)
96
- - File naming convention (filename.docspec.md → filename.md)
97
- - Configuration options (reference action.yml inputs)
98
- - Safety features (list specific guardrails)
99
- - **Manual Docspec Audit** subsection:
100
- - What it's for (audit, discover gaps, regenerate)
101
- - How it works (two-phase approach: discovery and implementation)
102
- - Usage instructions (how to trigger workflow)
103
- - Constraint: Link to actual workflow files instead of duplicating YAML; configuration options must match action.yml exactly
104
-
105
- 7. **Development**: Commands for contributors
106
- - Running tests (`npm test`, `npm run test:watch`)
107
- - Building (`npm run build`)
108
- - Constraint: Keep minimal, only essential commands
109
-
110
- 8. **License**: License type (MIT)
111
-
112
- ## 4. Editing Guidelines
113
-
114
- **Tone and audience:**
115
- - Use technical but accessible language
116
- - Target developers familiar with Node.js/npm, GitHub Actions, and CI/CD concepts
117
- - Be concise and direct; avoid marketing language
118
-
119
- **Code examples and accuracy:**
120
- - CLI command documentation must match src/cli.ts exactly
121
- - Library API examples must only show functions/types exported from src/index.ts
122
- - Action inputs/outputs must match action.yml exactly
123
- - File paths in examples must use the actual naming convention (.docspec.md → .md)
124
- - Workflow references should use actual file names (.github/workflows/docspec-check.yml, docspec-generate.yml)
125
-
126
- **Level of detail:**
127
- - Keep workflow configuration sections high-level; link to actual YAML files instead of duplicating content
128
- - Reference the 5 required sections by name when describing validation
129
- - Link to docspec-format.md for the full format specification; don't duplicate it in the README
130
- - Safety features should list specific guardrails without implementation details
131
- - Pre-commit integration should be high-level; link to .pre-commit-config.yaml
132
-
133
- **DO:**
134
- - Use actual command examples that work: `docspec validate`, `docspec generate path/to/README.docspec.md`
135
- - Reference source files when describing behavior: "matches src/cli.ts", "exported from src/index.ts"
136
- - Link to definitive sources: action.yml for configuration options, docspec-format.md for format details
137
- - Mention that docspec-format.md is included in the published package
138
- - Note that validation handles permission errors gracefully
139
-
140
- **DON'T:**
141
- - Invent CLI flags or options that don't exist in src/cli.ts
142
- - Document internal APIs not exported from src/index.ts
143
- - Include version-specific information (except referencing package.json)
144
- - Repeat YAML workflow content verbatim; link to files instead
145
- - Duplicate the docspec format specification from docspec-format.md
146
- - Add exhaustive lists of every possible feature or edge case
147
-
148
- ## 5. Intentional Omissions
149
-
150
- This README deliberately excludes:
151
-
152
- **Internal implementation details:**
153
- - TypeScript implementation internals (src/validator.ts, src/generator.ts, src/format-parser.ts, src/constants.ts)
154
- - Validation algorithm implementation details
155
- - Template rendering and substitution logic
156
- - How the format file is parsed and cached
157
-
158
- **GitHub Action internals:**
159
- - Python script implementation (docspec_update.py, improve_docspec.py) - these are internal automation scripts
160
- - Claude Code CLI prompt templates (.github/actions/*/templates/*.md)
161
- - Action step-by-step implementation details
162
- - How unified diff patches are generated and applied
163
-
164
- **Development and build details:**
165
- - Test implementation and test file structure (src/__tests__/)
166
- - Build configuration (tsconfig.json, build scripts)
167
- - Package.json configuration details beyond installation
168
- - Pre-commit hook internal implementation
169
-
170
- **Docspec format specification:**
171
- - The detailed format specification lives in docspec-format.md
172
- - Section definitions, boilerplate text, validation rules are defined there
173
- - The README provides only a high-level overview and links to the format file
174
-
175
- **Where to find this information:**
176
- - Format specification: docspec-format.md
177
- - API implementation: src/ directory TypeScript files
178
- - GitHub Action implementation: .github/actions/ directory
179
- - Tests: src/__tests__/ directory
180
- - Build configuration: tsconfig.json, package.json