universal-dev-standards 5.0.0-rc.6 → 5.0.0-rc.9

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 (32) hide show
  1. package/bin/uds.js +15 -1
  2. package/bundled/ai/options/documentation/api-docs.ai.yaml +17 -2
  3. package/bundled/ai/standards/context-aware-loading.ai.yaml +17 -0
  4. package/bundled/ai/standards/documentation-structure.ai.yaml +66 -3
  5. package/bundled/ai/standards/documentation-writing-standards.ai.yaml +74 -3
  6. package/bundled/core/documentation-structure.md +148 -2
  7. package/bundled/core/documentation-writing-standards.md +188 -9
  8. package/bundled/locales/zh-CN/core/documentation-structure.md +5 -5
  9. package/bundled/locales/zh-CN/core/documentation-writing-standards.md +5 -5
  10. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +2 -2
  11. package/bundled/locales/zh-CN/docs/OPERATION-WORKFLOW.md +5 -5
  12. package/bundled/locales/zh-CN/skills/documentation-guide/SKILL.md +5 -5
  13. package/bundled/locales/zh-TW/MAINTENANCE.md +9 -734
  14. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +1 -1
  15. package/bundled/locales/zh-TW/core/documentation-structure.md +146 -5
  16. package/bundled/locales/zh-TW/core/documentation-writing-standards.md +191 -12
  17. package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +224 -0
  18. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +2 -2
  19. package/bundled/locales/zh-TW/docs/OPERATION-WORKFLOW.md +5 -5
  20. package/bundled/locales/zh-TW/docs/SKILL-FALLBACK-GUIDE.md +407 -0
  21. package/bundled/locales/zh-TW/skills/documentation-guide/SKILL.md +6 -5
  22. package/bundled/skills/documentation-guide/SKILL.md +56 -6
  23. package/package.json +1 -1
  24. package/src/commands/check.js +16 -4
  25. package/src/commands/update.js +15 -3
  26. package/src/i18n/messages.js +21 -0
  27. package/src/utils/config-manager.js +4 -0
  28. package/src/utils/hasher.js +1 -1
  29. package/src/utils/npm-registry.js +1 -1
  30. package/src/utils/standard-validator.js +1 -1
  31. package/src/utils/update-checker.js +139 -0
  32. package/standards-registry.json +3 -3
package/bin/uds.js CHANGED
@@ -20,7 +20,8 @@ import { auditCommand } from '../src/commands/audit.js';
20
20
  import { uninstallCommand } from '../src/commands/uninstall.js';
21
21
  import { specCreateCommand, specListCommand, specShowCommand, specConfirmCommand, specArchiveCommand, specDeleteCommand } from '../src/commands/spec.js';
22
22
  import { startCommand, missionStatusCommand, missionPauseCommand, missionResumeCommand, missionCancelCommand, missionListCommand } from '../src/commands/start.js';
23
- import { setLanguage, setLanguageExplicit, detectLanguage } from '../src/i18n/messages.js';
23
+ import { setLanguage, setLanguageExplicit, detectLanguage, t } from '../src/i18n/messages.js';
24
+ import { maybeCheckForUpdates, formatUpdateNotice } from '../src/utils/update-checker.js';
24
25
 
25
26
  const require = createRequire(import.meta.url);
26
27
  const pkg = require('../package.json');
@@ -40,6 +41,19 @@ program
40
41
  // Explicit setting: mark as explicitly set to prevent override
41
42
  setLanguageExplicit(uiLang);
42
43
  }
44
+ })
45
+ .hook('postAction', async (thisCommand) => {
46
+ const cmd = thisCommand.name();
47
+ const notifyCommands = ['init', 'list', 'add', 'config'];
48
+ if (!notifyCommands.includes(cmd)) return;
49
+ try {
50
+ const result = await maybeCheckForUpdates(pkg.version);
51
+ if (result?.shouldNotify) {
52
+ console.log(formatUpdateNotice(result, t()));
53
+ }
54
+ } catch {
55
+ // Silent failure — update check should never break CLI
56
+ }
43
57
  });
44
58
 
45
59
  program
@@ -4,8 +4,8 @@
4
4
  id: api-docs
5
5
  meta:
6
6
  parent: documentation-structure
7
- version: "1.0.0"
8
- description: API reference documentation standards
7
+ version: "1.1.0"
8
+ description: API reference documentation standards (enhanced automation)
9
9
 
10
10
  best_for:
11
11
  - REST APIs
@@ -145,6 +145,21 @@ example_endpoint_doc: |
145
145
  | 400 | Invalid request body |
146
146
  | 409 | Email already exists |
147
147
 
148
+ automation:
149
+ validation:
150
+ - name: Link check
151
+ tool: markdown-link-check
152
+ stage: pre-commit
153
+ - name: OpenAPI lint
154
+ tool: spectral
155
+ stage: PR check
156
+ - name: Example validation
157
+ tool: Custom script (extract + run code blocks)
158
+ stage: PR check
159
+ llm_discovery:
160
+ description: Include API endpoints in llms.txt for LLM-assisted integration
161
+ format: "- [Endpoint Group](docs/api.md#section): Description"
162
+
148
163
  tools:
149
164
  generators:
150
165
  - name: swagger-codegen
@@ -153,6 +153,23 @@ standard:
153
153
  /release, /commit → workflow
154
154
  priority: required
155
155
 
156
+ - id: version-check-on-uds-operation
157
+ trigger: "user invokes a UDS slash command or UDS-related operation"
158
+ instruction: >
159
+ When the user invokes a UDS-related slash command (/commit, /sdd,
160
+ /review, /release, /tdd, /bdd, /docs, /changelog, etc.) for the
161
+ FIRST TIME in the current conversation, check for UDS updates:
162
+
163
+ 1. Read .standards/manifest.json → extract upstream.version
164
+ 2. Run: npm view universal-dev-standards dist-tags --json
165
+ 3. Compare upstream.version with the "latest" tag from npm
166
+ 4. If a newer version exists, display ONE line before your response:
167
+ "ℹ UDS v{latest} 已發布(目前 v{current})— 執行 `uds update` 更新"
168
+ 5. If versions match or npm is unreachable, skip silently
169
+ 6. Only check ONCE per conversation — do not repeat on subsequent
170
+ UDS operations in the same session
171
+ priority: optional
172
+
156
173
  architecture:
157
174
  classification: always-on-protocol
158
175
  note: >
@@ -3,10 +3,10 @@
3
3
 
4
4
  id: documentation-structure
5
5
  meta:
6
- version: "1.3.0"
7
- updated: "2025-12-29"
6
+ version: "1.4.0"
7
+ updated: "2026-03-17"
8
8
  source: core/documentation-structure.md
9
- description: Consistent documentation structure for software projects
9
+ description: Consistent documentation structure for software projects (Diátaxis classification, LLM discovery, doc testing)
10
10
 
11
11
  options:
12
12
  documentation_style:
@@ -68,7 +68,70 @@ structure:
68
68
  purpose: Architecture diagrams
69
69
  formats: [".mmd", ".puml", ".drawio"]
70
70
 
71
+ diataxis_classification:
72
+ types:
73
+ - id: tutorial
74
+ purpose: Learning-oriented
75
+ user_need: "I want to learn"
76
+ examples: [getting-started.md, first-project-walkthrough.md]
77
+ - id: how-to
78
+ purpose: Task-oriented
79
+ user_need: "I want to accomplish X"
80
+ examples: [deployment.md, migration.md, troubleshooting.md]
81
+ - id: reference
82
+ purpose: Information-oriented
83
+ user_need: "I need to look up Y"
84
+ examples: [api-reference.md, CHANGELOG.md, configuration.md]
85
+ - id: explanation
86
+ purpose: Understanding-oriented
87
+ user_need: "I want to understand why"
88
+ examples: [architecture.md, ADR/, design-rationale.md]
89
+
90
+ llm_discovery:
91
+ files:
92
+ - name: llms.txt
93
+ location: project root
94
+ purpose: Structured index for LLM retrieval systems
95
+ when: Public projects or projects using AI tools
96
+ - name: llms-full.txt
97
+ location: project root
98
+ purpose: Full concatenated docs for complete context
99
+ when: Optional
100
+
101
+ doc_testing:
102
+ layers:
103
+ - name: Link Validation
104
+ tools: [markdown-link-check, lychee]
105
+ ci_stage: pre-commit
106
+ - name: Code Sample Testing
107
+ tools: [doctest, custom scripts]
108
+ ci_stage: PR check
109
+ - name: Structure Validation
110
+ tools: [remark-lint, custom linter]
111
+ ci_stage: pre-commit
112
+ - name: Content Freshness
113
+ tools: [custom date-check script]
114
+ ci_stage: release
115
+ - name: Traceability
116
+ tools: [traceability matrix]
117
+ ci_stage: release
118
+
71
119
  rules:
120
+ - id: diataxis-classify
121
+ trigger: creating new documentation
122
+ instruction: Classify document as Tutorial, How-to, Reference, or Explanation and add Document Type header
123
+ priority: recommended
124
+
125
+ - id: llm-discovery
126
+ trigger: creating public project documentation
127
+ instruction: Consider adding llms.txt for LLM discoverability
128
+ priority: recommended
129
+
130
+ - id: doc-testing-links
131
+ trigger: adding documentation
132
+ instruction: Validate all links before committing
133
+ priority: required
134
+
72
135
  - id: root-uppercase
73
136
  trigger: creating root documentation
74
137
  instruction: Use UPPERCASE for root-level docs (README, CONTRIBUTING, CHANGELOG)
@@ -3,10 +3,10 @@
3
3
 
4
4
  id: documentation-writing-standards
5
5
  meta:
6
- version: "1.0.1"
7
- updated: "2025-12-30"
6
+ version: "1.1.0"
7
+ updated: "2026-03-17"
8
8
  source: core/documentation-writing-standards.md
9
- description: Documentation requirements based on project types
9
+ description: Documentation requirements based on project types (enhanced ADR, LLM writing, quality metrics, translation-friendly)
10
10
 
11
11
  project_types:
12
12
  new_project:
@@ -127,14 +127,85 @@ document_categories:
127
127
  naming: "NNN-kebab-case-title.md"
128
128
  required_sections:
129
129
  - Title
130
+ - Date (YYYY-MM-DD)
130
131
  - Status (proposed/accepted/deprecated/superseded)
132
+ - Deciders (who participated)
131
133
  - Context
132
134
  - Decision
133
135
  - Consequences
134
136
  recommended_sections:
137
+ - Drivers (key factors)
135
138
  - Alternatives Considered
139
+ - Related ADRs (supersedes/superseded-by)
140
+ lifecycle: "proposed → accepted → [deprecated | superseded]"
141
+ decision_matrix:
142
+ description: "When to write ADR (impact × reversibility)"
143
+ adr_required: "High impact + Hard to reverse"
144
+ optional: "High impact + Easy to reverse OR Low impact + Hard to reverse"
145
+ not_needed: "Low impact + Easy to reverse"
146
+
147
+ llm_writing:
148
+ rules:
149
+ - Short paragraphs (3-5 lines)
150
+ - Consistent terminology throughout
151
+ - Always specify language in code blocks
152
+ - Avoid pronoun ambiguity across paragraphs
153
+ - Each H2 section should be context-self-sufficient
154
+ - State explicit negation when distinctions matter
155
+ chunking:
156
+ max_h2_size: "4K-8K tokens (~3000 words)"
157
+ principle: "One topic per H2, front-load summaries"
158
+ retrieval_metadata: [title, scope, difficulty, tags, last_validated]
159
+
160
+ translation_friendly:
161
+ writing_rules:
162
+ - Complete sentences (avoid fragments)
163
+ - Avoid idioms and slang
164
+ - Consistent terminology (follow glossary)
165
+ - Simple SVO sentence structure
166
+ - Explicit references (avoid ambiguous pronouns)
167
+ glossary_file: glossary.md
168
+ translation_status_fields: [translation_status, source_version, source_hash, translated_by, last_synced]
169
+
170
+ quality_metrics:
171
+ leading:
172
+ - name: Coverage
173
+ target: "≥90% public APIs documented"
174
+ - name: Freshness
175
+ target: "All docs updated within 90 days"
176
+ - name: Link Health
177
+ target: "100% valid links"
178
+ - name: Example Validity
179
+ target: "100% code examples run"
180
+ - name: Structure Compliance
181
+ target: "All docs have required sections"
182
+ lagging:
183
+ - Support ticket reduction
184
+ - Onboarding time
185
+ - Doc-related PR comments
186
+ tools: [markdown-link-check, lychee, remark-lint, textstat, vale]
136
187
 
137
188
  rules:
189
+ - id: llm-writing
190
+ trigger: writing documentation
191
+ instruction: Follow LLM-optimized writing rules (short paragraphs, consistent terms, context self-sufficiency)
192
+ priority: recommended
193
+
194
+ - id: translation-friendly
195
+ trigger: writing documentation for multilingual projects
196
+ instruction: Use complete sentences, avoid idioms, follow glossary, use simple sentence structure
197
+ priority: recommended
198
+
199
+ - id: quality-metrics
200
+ trigger: documentation review
201
+ instruction: Check documentation quality metrics (coverage, freshness, link health)
202
+ priority: recommended
203
+
204
+ - id: adr-enhanced
205
+ trigger: creating ADR
206
+ instruction: Include Date, Deciders, Drivers fields; use decision matrix (impact × reversibility) to decide if ADR is needed
207
+ priority: required
208
+
138
209
  - id: project-type-docs
139
210
  trigger: starting a project
140
211
  instruction: Identify project type and create required documents
@@ -2,8 +2,8 @@
2
2
 
3
3
  > **Language**: English | [繁體中文](../locales/zh-TW/core/documentation-structure.md)
4
4
 
5
- **Version**: 1.4.0
6
- **Last Updated**: 2026-03-04
5
+ **Version**: 1.5.0
6
+ **Last Updated**: 2026-03-17
7
7
  **Applicability**: All software projects requiring documentation
8
8
  **Scope**: partial
9
9
  **Industry Standards**: None (Industry convention)
@@ -17,6 +17,95 @@ This standard defines a consistent documentation structure for software projects
17
17
 
18
18
  ---
19
19
 
20
+ ## Documentation Classification (Diátaxis)
21
+
22
+ All documentation should be classified into one of four types based on the [Diátaxis framework](https://diataxis.fr/). This explicit classification helps readers find the right document and helps writers focus on the correct content.
23
+
24
+ ### The Four Document Types
25
+
26
+ | Type | Purpose | User Need | Orientation | Example |
27
+ |------|---------|-----------|-------------|---------|
28
+ | **Tutorial** | Learning-oriented | "I want to learn" | Practical steps | Getting started guide, first project walkthrough |
29
+ | **How-to** | Task-oriented | "I want to accomplish X" | Practical steps | Deployment guide, migration checklist |
30
+ | **Reference** | Information-oriented | "I need to look up Y" | Theoretical knowledge | API reference, configuration parameters |
31
+ | **Explanation** | Understanding-oriented | "I want to understand why" | Theoretical knowledge | Architecture overview, ADR, design rationale |
32
+
33
+ ### Document Type Header
34
+
35
+ Add a `Document Type` field to document headers for explicit classification:
36
+
37
+ ```markdown
38
+ **Document Type**: Tutorial | How-to | Reference | Explanation
39
+ ```
40
+
41
+ ### Mapping to Standard Documents
42
+
43
+ | Standard Document | Diátaxis Type | Rationale |
44
+ |-------------------|---------------|-----------|
45
+ | README.md | Tutorial / How-to | Quick start orientation |
46
+ | getting-started.md | Tutorial | Step-by-step learning |
47
+ | ARCHITECTURE.md | Explanation | Understanding system design |
48
+ | API Reference | Reference | Looking up endpoints |
49
+ | DEPLOYMENT.md | How-to | Task: deploy the system |
50
+ | MIGRATION.md | How-to | Task: migrate the system |
51
+ | ADR/ | Explanation | Understanding decisions |
52
+ | troubleshooting.md | How-to | Task: fix a problem |
53
+ | CHANGELOG.md | Reference | Looking up change history |
54
+ | Flow documentation | Reference / Explanation | Understanding data flows |
55
+
56
+ ---
57
+
58
+ ## LLM Discovery Files
59
+
60
+ Projects that publish documentation for external consumption should consider providing LLM-optimized discovery files, similar to `robots.txt` for search engines.
61
+
62
+ ### llms.txt Standard
63
+
64
+ The `llms.txt` file (placed at the project or site root) provides a structured index for LLM-based retrieval systems.
65
+
66
+ **Format**:
67
+
68
+ ```markdown
69
+ # Project Name
70
+
71
+ > Brief one-line description of the project.
72
+
73
+ ## Documentation
74
+
75
+ - [Getting Started](docs/getting-started.md): Tutorial for new users
76
+ - [API Reference](docs/api-reference.md): Complete REST API documentation
77
+ - [Architecture](docs/architecture.md): System design and component overview
78
+
79
+ ## Optional
80
+
81
+ - [CHANGELOG](CHANGELOG.md): Version history
82
+ - [Contributing](CONTRIBUTING.md): Contribution guidelines
83
+ ```
84
+
85
+ ### When to Create llms.txt
86
+
87
+ | Scenario | Create llms.txt? | Rationale |
88
+ |----------|:-----------------:|-----------|
89
+ | Public open source project | ✅ Yes | Helps AI tools discover and index docs |
90
+ | Public API with external consumers | ✅ Yes | Enables AI-assisted API integration |
91
+ | Internal company project | ⚪ Optional | Useful if using internal AI tools |
92
+ | Private/personal project | ❌ No | No external consumers |
93
+
94
+ ### Placement
95
+
96
+ ```
97
+ project-root/
98
+ ├── llms.txt # LLM discovery file
99
+ ├── llms-full.txt # Optional: full concatenated docs
100
+ ├── README.md
101
+ └── docs/
102
+ ```
103
+
104
+ - `llms.txt`: Structured index with links and descriptions
105
+ - `llms-full.txt` (optional): Full documentation concatenated into a single file for complete context ingestion
106
+
107
+ ---
108
+
20
109
  ## Standard Documentation Structure
21
110
 
22
111
  ```
@@ -1278,6 +1367,62 @@ This matrix extends the Document Requirements Matrix above to include all docume
1278
1367
 
1279
1368
  ---
1280
1369
 
1370
+ ## Documentation Testing
1371
+
1372
+ Documentation should be tested systematically, not just reviewed manually. This section defines testable quality layers.
1373
+
1374
+ ### Testing Layers
1375
+
1376
+ | Layer | What It Tests | Tools | CI Stage |
1377
+ |-------|---------------|-------|----------|
1378
+ | **Link Validation** | All internal/external links resolve | markdown-link-check, lychee | Pre-commit / PR |
1379
+ | **Code Sample Testing** | Code examples compile and run | doctest, mdx-js, custom scripts | PR check |
1380
+ | **Structure Validation** | Required sections present, heading hierarchy correct | Custom linter, remark-lint | Pre-commit |
1381
+ | **Content Freshness** | Documents updated within retention period | Custom script (check Last Updated date) | Release |
1382
+ | **Traceability** | Every feature has documentation, every doc maps to code | Traceability matrix | Release |
1383
+
1384
+ ### Code Sample Validation
1385
+
1386
+ Code examples in documentation should be validated to prevent drift from actual implementation:
1387
+
1388
+ ```markdown
1389
+ <!-- doctest: lang=bash, skip=false -->
1390
+ ```bash
1391
+ npm install your-package
1392
+ npm test
1393
+ ```
1394
+ ```
1395
+
1396
+ **Validation Approaches**:
1397
+
1398
+ | Approach | Description | Best For |
1399
+ |----------|-------------|----------|
1400
+ | **Extract and run** | Extract code blocks, execute in sandbox | CLI examples, scripts |
1401
+ | **Import from source** | Include actual source files in docs | API usage examples |
1402
+ | **Snapshot comparison** | Compare output against expected | Command output examples |
1403
+
1404
+ ### Documentation Traceability Matrix
1405
+
1406
+ Track the relationship between features, code, and documentation:
1407
+
1408
+ ```markdown
1409
+ | Feature | Code Location | Documentation | Test | Status |
1410
+ |---------|---------------|---------------|------|--------|
1411
+ | User auth | src/auth/ | docs/api.md#auth | tests/auth.test.js | ✅ Current |
1412
+ | Export CSV | src/export/ | docs/api.md#export | tests/export.test.js | ⚠️ Stale |
1413
+ | Webhooks | src/webhooks/ | ❌ Missing | tests/webhooks.test.js | ❌ Undocumented |
1414
+ ```
1415
+
1416
+ ### CI/CD Integration
1417
+
1418
+ | Stage | Checks | Blocking |
1419
+ |-------|--------|:--------:|
1420
+ | **Pre-commit** | Link check, structure lint | ✅ Yes |
1421
+ | **PR check** | Code sample validation, freshness | ✅ Yes |
1422
+ | **Release** | Full traceability audit, all layers | ⚠️ Warning |
1423
+
1424
+ ---
1425
+
1281
1426
  ## Related Standards
1282
1427
 
1283
1428
  - [Documentation Writing Standards](documentation-writing-standards.md)
@@ -1291,6 +1436,7 @@ This matrix extends the Document Requirements Matrix above to include all docume
1291
1436
 
1292
1437
  | Version | Date | Changes |
1293
1438
  |---------|------|---------|
1439
+ | 1.5.0 | 2026-03-17 | Added: Diátaxis documentation classification, LLM Discovery Files (llms.txt), Documentation Testing standards (5-layer testing, traceability matrix, CI/CD integration) |
1294
1440
  | 1.4.0 | 2026-03-04 | Added: Development Artifacts (docs/working/) directory and lifecycle management, Expanded Document Types Matrix |
1295
1441
  | 1.3.0 | 2026-01-24 | Added: Specification documentation standards with specs/ directory structure |
1296
1442
  | 1.2.2 | 2025-12-24 | Added: Related Standards section |