universal-dev-standards 6.8.0 → 6.9.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.
- package/bin/uds.js +12 -2
- package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +14 -2
- package/bundled/ai/standards/adr-standards.ai.yaml +14 -2
- package/bundled/ai/standards/code-review.ai.yaml +13 -3
- package/bundled/ai/standards/commit-message.ai.yaml +8 -4
- package/bundled/ai/standards/deferred-item-exit.ai.yaml +225 -0
- package/bundled/ai/standards/feature-discovery-standards.ai.yaml +14 -2
- package/bundled/ai/standards/governance-layer.ai.yaml +128 -2
- package/bundled/ai/standards/logging.ai.yaml +2 -2
- package/bundled/ai/standards/retrospective-standards.ai.yaml +14 -2
- package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +73 -2
- package/bundled/ai/standards/security-standards.ai.yaml +2 -2
- package/bundled/ai/standards/spec-driven-development.ai.yaml +14 -2
- package/bundled/ai/standards/tech-debt-standards.ai.yaml +87 -3
- package/bundled/ai/standards/turn-completion-integrity.ai.yaml +131 -0
- package/bundled/core/acceptance-criteria-traceability.md +5 -2
- package/bundled/core/adr-standards.md +26 -2
- package/bundled/core/code-review-checklist.md +5 -2
- package/bundled/core/context-aware-loading.md +1 -1
- package/bundled/core/deferred-item-exit.md +254 -0
- package/bundled/core/feature-discovery-standards.md +5 -1
- package/bundled/core/governance-layer.md +114 -2
- package/bundled/core/retrospective-standards.md +4 -2
- package/bundled/core/reverse-engineering-standards.md +81 -2
- package/bundled/core/spec-driven-development.md +8 -2
- package/bundled/core/tech-debt-standards.md +67 -8
- package/bundled/core/turn-completion-integrity.md +196 -0
- package/bundled/hooks/check-dangerous-cmd.mjs +60 -0
- package/bundled/hooks/check-logging-standard.mjs +59 -0
- package/bundled/hooks/check-turn-completion.mjs +233 -0
- package/bundled/hooks/inject-standards.mjs +183 -0
- package/bundled/hooks/telemetry-wrapper.mjs +77 -0
- package/bundled/hooks/turn-completion/detect.mjs +99 -0
- package/bundled/hooks/turn-completion/locales/en.mjs +159 -0
- package/bundled/hooks/turn-completion/locales/zh-TW.mjs +166 -0
- package/bundled/hooks/validate-commit-msg.mjs +104 -0
- package/bundled/locales/zh-CN/CHANGELOG.md +47 -3
- package/bundled/locales/zh-CN/CLAUDE.md +1 -1
- package/bundled/locales/zh-CN/README.md +2 -2
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/core/adr-standards.md +1 -1
- package/bundled/locales/zh-CN/core/governance-layer.md +118 -6
- package/bundled/locales/zh-CN/core/retrospective-standards.md +1 -1
- package/bundled/locales/zh-CN/core/tech-debt-standards.md +71 -4
- package/bundled/locales/zh-CN/core/turn-completion-integrity.md +190 -0
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +8 -1
- package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +29 -68
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +25 -15
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +1 -2
- package/bundled/locales/zh-CN/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
- package/bundled/locales/zh-CN/integrations/google-antigravity/README.md +3 -3
- package/bundled/locales/zh-CN/skills/atdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-CN/skills/bdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +22 -12
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +12 -9
- package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/commands/brainstorm.md +17 -13
- package/bundled/locales/zh-CN/skills/commands/config.md +0 -1
- package/bundled/locales/zh-CN/skills/commands/init.md +1 -2
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +2 -0
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +2 -0
- package/bundled/locales/zh-CN/skills/observability-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/project-structure-guide/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/release-standards/SKILL.md +3 -0
- package/bundled/locales/zh-CN/skills/requirement-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +3 -0
- package/bundled/locales/zh-CN/skills/runbook-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/slo-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/CHANGELOG.md +47 -3
- package/bundled/locales/zh-TW/CLAUDE.md +1 -1
- package/bundled/locales/zh-TW/README.md +2 -2
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +2 -0
- package/bundled/locales/zh-TW/core/adr-standards.md +26 -5
- package/bundled/locales/zh-TW/core/code-review-checklist.md +2 -0
- package/bundled/locales/zh-TW/core/container-image-standards.md +2 -2
- package/bundled/locales/zh-TW/core/contract-testing-standards.md +2 -2
- package/bundled/locales/zh-TW/core/cross-flow-regression.md +8 -7
- package/bundled/locales/zh-TW/core/data-contract.md +2 -2
- package/bundled/locales/zh-TW/core/data-migration-testing.md +2 -2
- package/bundled/locales/zh-TW/core/data-pipeline.md +2 -2
- package/bundled/locales/zh-TW/core/deferred-item-exit.md +251 -0
- package/bundled/locales/zh-TW/core/documentation-writing-standards.md +228 -3
- package/bundled/locales/zh-TW/core/full-coverage-testing.md +15 -2
- package/bundled/locales/zh-TW/core/governance-layer.md +118 -5
- package/bundled/locales/zh-TW/core/iac-design-principles.md +2 -2
- package/bundled/locales/zh-TW/core/incident-response.md +2 -2
- package/bundled/locales/zh-TW/core/model-provenance.md +4 -2
- package/bundled/locales/zh-TW/core/pii-classification.md +42 -6
- package/bundled/locales/zh-TW/core/prd-standards.md +4 -2
- package/bundled/locales/zh-TW/core/product-metrics-standards.md +4 -2
- package/bundled/locales/zh-TW/core/release-readiness-gate.md +2 -2
- package/bundled/locales/zh-TW/core/resource-cost-boundary.md +2 -2
- package/bundled/locales/zh-TW/core/retrospective-standards.md +5 -3
- package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +83 -5
- package/bundled/locales/zh-TW/core/runbook.md +2 -2
- package/bundled/locales/zh-TW/core/schema-evolution.md +2 -2
- package/bundled/locales/zh-TW/core/secret-management-standards.md +2 -2
- package/bundled/locales/zh-TW/core/slo-sli.md +2 -2
- package/bundled/locales/zh-TW/core/spec-driven-development.md +2 -0
- package/bundled/locales/zh-TW/core/tech-debt-standards.md +71 -4
- package/bundled/locales/zh-TW/core/turn-completion-integrity.md +190 -0
- package/bundled/locales/zh-TW/core/user-journey-testing.md +2 -2
- package/bundled/locales/zh-TW/core/user-story-mapping.md +2 -2
- package/bundled/locales/zh-TW/core/verification-oracle.md +2 -2
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +8 -1
- package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +29 -68
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +25 -15
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +1 -2
- package/bundled/locales/zh-TW/integrations/google-antigravity/{INSTRUCTIONS.md → AGENTS.md} +1 -1
- package/bundled/locales/zh-TW/integrations/google-antigravity/README.md +3 -3
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +22 -12
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +12 -9
- package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/commands/brainstorm.md +17 -13
- package/bundled/locales/zh-TW/skills/commands/config.md +0 -1
- package/bundled/locales/zh-TW/skills/commands/init.md +1 -2
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +2 -1
- package/bundled/locales/zh-TW/skills/dev-methodology/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/knowledge-graph/guide.md +2 -2
- package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/observability-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/project-discovery/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/project-structure-guide/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/release-standards/SKILL.md +3 -0
- package/bundled/locales/zh-TW/skills/requirement-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +3 -0
- package/bundled/locales/zh-TW/skills/runbook-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/slo-assistant/SKILL.md +1 -0
- package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +2 -0
- package/bundled/skills/atdd-assistant/SKILL.md +2 -0
- package/bundled/skills/bdd-assistant/SKILL.md +2 -0
- package/bundled/skills/brainstorm-assistant/SKILL.md +31 -13
- package/bundled/skills/brainstorm-assistant/guide.md +9 -6
- package/bundled/skills/code-review-assistant/SKILL.md +1 -0
- package/bundled/skills/commands/brainstorm.md +12 -9
- package/bundled/skills/commands/config.md +0 -1
- package/bundled/skills/commands/init.md +2 -3
- package/bundled/skills/commit-standards/SKILL.md +2 -0
- package/bundled/skills/contract-test-assistant/SKILL.md +1 -0
- package/bundled/skills/dev-methodology/SKILL.md +4 -0
- package/bundled/skills/observability-assistant/SKILL.md +1 -0
- package/bundled/skills/project-discovery/SKILL.md +1 -0
- package/bundled/skills/project-structure-guide/SKILL.md +1 -0
- package/bundled/skills/release-standards/SKILL.md +3 -0
- package/bundled/skills/requirement-assistant/SKILL.md +2 -0
- package/bundled/skills/reverse-engineer/SKILL.md +3 -0
- package/bundled/skills/runbook-assistant/SKILL.md +1 -0
- package/bundled/skills/slo-assistant/SKILL.md +1 -0
- package/bundled/skills/tdd-assistant/SKILL.md +2 -0
- package/bundled/templates/.ai-context.yaml.template +194 -0
- package/bundled/templates/CLAUDE.md.template +145 -0
- package/bundled/templates/DESIGN.md +237 -0
- package/bundled/templates/SKILL-BRIEF-TEMPLATE.md +57 -0
- package/bundled/templates/SKILL-CANDIDATES.md +39 -0
- package/bundled/templates/gates/check-error-exit.mjs +309 -0
- package/bundled/templates/mcp-config.json +10 -0
- package/bundled/templates/methodology-template.yaml +209 -0
- package/bundled/templates/migration-template.md +408 -0
- package/bundled/templates/requirement-checklist.md +410 -0
- package/bundled/templates/requirement-document-template.md +591 -0
- package/bundled/templates/requirement-template.md +881 -0
- package/bundled/templates/reverse-spec-template.md +409 -0
- package/bundled/templates/test-case-template.md +74 -0
- package/bundled/templates/test-plan-template.md +74 -0
- package/package.json +7 -5
- package/src/commands/audit.js +82 -0
- package/src/commands/check.js +66 -10
- package/src/commands/init.js +161 -16
- package/src/commands/update.js +286 -14
- package/src/compilers/claude-code-compiler.js +4 -1
- package/src/config/ai-agent-paths.js +62 -17
- package/src/core/constants.js +42 -11
- package/src/core/manifest.js +201 -3
- package/src/core/paths.js +2 -2
- package/src/i18n/messages.js +6 -29
- package/src/installers/hooks-installer.js +167 -75
- package/src/installers/integration-installer.js +9 -5
- package/src/prompts/init.js +14 -14
- package/src/utils/detector.js +21 -1
- package/src/utils/effect-boundary.js +1093 -0
- package/src/utils/hasher.js +166 -1
- package/src/utils/hook-stats.js +1 -1
- package/src/utils/integration-generator.js +79 -1
- package/src/utils/reference-sync.js +4 -1
- package/src/utils/yaml-generator.js +51 -9
- package/standards-registry.json +31 -8
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
# [SPEC-XXX] [Feature Name] (Reverse Engineered)
|
|
2
|
+
|
|
3
|
+
**Version**: 1.0.0
|
|
4
|
+
**Last Updated**: 2026-01-19
|
|
5
|
+
|
|
6
|
+
> ⚠️ **This specification was reverse engineered from existing code**
|
|
7
|
+
>
|
|
8
|
+
> - **Analysis Date**: YYYY-MM-DD
|
|
9
|
+
> - **Analyzed Path**: `path/to/code`
|
|
10
|
+
> - **Analyzer**: [AI/Human Name]
|
|
11
|
+
>
|
|
12
|
+
> Sections marked `[Unknown]` require human confirmation before this spec is considered complete.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Human Review Checklist
|
|
17
|
+
|
|
18
|
+
Before considering this spec complete, verify:
|
|
19
|
+
|
|
20
|
+
### Accuracy
|
|
21
|
+
- [ ] All `[Confirmed]` items verified against actual code
|
|
22
|
+
- [ ] Source citations (file:line) are correct
|
|
23
|
+
- [ ] No fabricated APIs, configurations, or behaviors
|
|
24
|
+
|
|
25
|
+
### Inference Validation
|
|
26
|
+
- [ ] All `[Inferred]` items reviewed for accuracy
|
|
27
|
+
- [ ] Incorrect inferences corrected or removed
|
|
28
|
+
- [ ] Reasoning for inferences is sound
|
|
29
|
+
|
|
30
|
+
### Required Human Input
|
|
31
|
+
- [ ] `Motivation` section completed (why this feature exists)
|
|
32
|
+
- [ ] `Risks` section completed (potential failure modes)
|
|
33
|
+
- [ ] `Out of Scope` section verified (intentional exclusions)
|
|
34
|
+
- [ ] `User Story` / business context added
|
|
35
|
+
|
|
36
|
+
### Final Sign-off
|
|
37
|
+
- [ ] Original developer reviewed (if available)
|
|
38
|
+
- [ ] Product owner approved business context
|
|
39
|
+
- [ ] All `[Unknown]` labels resolved or acknowledged
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Summary
|
|
44
|
+
|
|
45
|
+
[Confirmed] Brief description of what the code does.
|
|
46
|
+
|
|
47
|
+
- [Source: Code] `primary_file.ts:start-end`
|
|
48
|
+
|
|
49
|
+
<!-- Example:
|
|
50
|
+
[Confirmed] This module provides user authentication via JWT tokens, supporting login, logout, and token refresh operations.
|
|
51
|
+
|
|
52
|
+
- [Source: Code] src/controllers/AuthController.ts:1-150
|
|
53
|
+
- [Source: Code] src/services/AuthService.ts:1-200
|
|
54
|
+
-->
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Motivation
|
|
59
|
+
|
|
60
|
+
[Unknown] **Requires human input**
|
|
61
|
+
|
|
62
|
+
Answer these questions:
|
|
63
|
+
|
|
64
|
+
1. **Why was this feature built?**
|
|
65
|
+
<!-- What problem does it solve? What was the business driver? -->
|
|
66
|
+
|
|
67
|
+
2. **Who requested this feature?**
|
|
68
|
+
<!-- Product owner, customer, internal team? -->
|
|
69
|
+
|
|
70
|
+
3. **What user problem does it address?**
|
|
71
|
+
<!-- User pain points, workflow improvements -->
|
|
72
|
+
|
|
73
|
+
4. **What was the original timeline/context?**
|
|
74
|
+
<!-- When was it built? Any relevant context? -->
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## User Story
|
|
79
|
+
|
|
80
|
+
[Unknown] **Requires human input**
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
As a [user type],
|
|
84
|
+
I want to [action/capability],
|
|
85
|
+
So that [benefit/value].
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<!-- Example:
|
|
89
|
+
As a registered user,
|
|
90
|
+
I want to log in with my email and password,
|
|
91
|
+
So that I can access my personal dashboard and data.
|
|
92
|
+
-->
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Detailed Design
|
|
97
|
+
|
|
98
|
+
### Architecture Overview
|
|
99
|
+
|
|
100
|
+
[Confirmed/Inferred] High-level architecture extracted from code.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
104
|
+
│ Component Diagram │
|
|
105
|
+
├─────────────────────────────────────────────────────────────┤
|
|
106
|
+
│ │
|
|
107
|
+
│ [Describe the main components and their relationships] │
|
|
108
|
+
│ │
|
|
109
|
+
└─────────────────────────────────────────────────────────────┘
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- [Source: Code] `src/architecture/` or inferred from imports
|
|
113
|
+
|
|
114
|
+
### Component Details
|
|
115
|
+
|
|
116
|
+
#### Component 1: [Name]
|
|
117
|
+
|
|
118
|
+
[Confirmed] Description of component responsibility.
|
|
119
|
+
|
|
120
|
+
- **Location**: `path/to/component`
|
|
121
|
+
- **Dependencies**: List of dependencies
|
|
122
|
+
- **Key Methods**:
|
|
123
|
+
- `methodName()` - Description
|
|
124
|
+
- `anotherMethod()` - Description
|
|
125
|
+
|
|
126
|
+
- [Source: Code] `file.ts:lines`
|
|
127
|
+
|
|
128
|
+
#### Component 2: [Name]
|
|
129
|
+
|
|
130
|
+
[Confirmed/Inferred] Description.
|
|
131
|
+
|
|
132
|
+
- [Source: Code] `file.ts:lines`
|
|
133
|
+
|
|
134
|
+
### Data Models
|
|
135
|
+
|
|
136
|
+
#### Model: [EntityName]
|
|
137
|
+
|
|
138
|
+
[Confirmed] Data structure definition.
|
|
139
|
+
|
|
140
|
+
| Field | Type | Required | Description |
|
|
141
|
+
|-------|------|----------|-------------|
|
|
142
|
+
| id | string | Yes | Primary identifier |
|
|
143
|
+
| field1 | type | Yes/No | [Confirmed] Description |
|
|
144
|
+
| field2 | type | Yes/No | [Inferred] Description |
|
|
145
|
+
|
|
146
|
+
- [Source: Code] `src/models/EntityName.ts:lines`
|
|
147
|
+
|
|
148
|
+
### API / Interface
|
|
149
|
+
|
|
150
|
+
#### Endpoint/Method 1
|
|
151
|
+
|
|
152
|
+
[Confirmed] `METHOD /path/to/endpoint`
|
|
153
|
+
|
|
154
|
+
**Parameters**:
|
|
155
|
+
| Name | Location | Type | Required | Description |
|
|
156
|
+
|------|----------|------|----------|-------------|
|
|
157
|
+
| param1 | path/query/body | type | Yes/No | Description |
|
|
158
|
+
|
|
159
|
+
**Request Body** (if applicable):
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"field": "value"
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Response**:
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"result": "value"
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Error Codes**:
|
|
174
|
+
| Code | Description |
|
|
175
|
+
|------|-------------|
|
|
176
|
+
| 400 | [Inferred] Bad request |
|
|
177
|
+
| 401 | [Confirmed] Unauthorized |
|
|
178
|
+
|
|
179
|
+
- [Source: Code] `src/controllers/Controller.ts:lines`
|
|
180
|
+
|
|
181
|
+
### Configuration
|
|
182
|
+
|
|
183
|
+
[Confirmed] Configuration extracted from code.
|
|
184
|
+
|
|
185
|
+
| Setting | Default | Description | Source |
|
|
186
|
+
|---------|---------|-------------|--------|
|
|
187
|
+
| SETTING_1 | value | Description | [Source: Code] config.ts:5 |
|
|
188
|
+
| SETTING_2 | value | Description | [Source: Code] .env.example:10 |
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## E2E Scenarios(必填)
|
|
193
|
+
|
|
194
|
+
> 定義使用者或呼叫者視角的端對端場景。至少填 1 條 Happy Path。
|
|
195
|
+
> 若確實不需要 E2E,填寫 `e2e_not_required_reason` 並留空 Scenarios 區塊。
|
|
196
|
+
|
|
197
|
+
**e2e_not_required_reason**(若 Scenarios 為空,此欄必填):
|
|
198
|
+
<!-- 有效理由:純內部工具函式 | 已被 SPEC-NNN E2E 涵蓋,見 [SPEC-NNN] -->
|
|
199
|
+
<!-- 無效理由:「之後再補」「現在沒空」 -->
|
|
200
|
+
|
|
201
|
+
### Happy Path: [場景名稱]
|
|
202
|
+
|
|
203
|
+
```gherkin
|
|
204
|
+
Given [用戶或系統狀態前提]
|
|
205
|
+
When [觸發動作或 API 呼叫]
|
|
206
|
+
Then [可觀察的預期結果:HTTP status、資料庫狀態、回應 body]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Error Path: [場景名稱](建議:安全相關、Quota、計費功能必填)
|
|
210
|
+
|
|
211
|
+
```gherkin
|
|
212
|
+
Given [異常前提條件]
|
|
213
|
+
When [觸發動作]
|
|
214
|
+
Then [預期錯誤處理:status code、錯誤訊息、無副作用]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Acceptance Criteria
|
|
220
|
+
|
|
221
|
+
### Extracted from Tests
|
|
222
|
+
|
|
223
|
+
[Inferred] Acceptance criteria derived from test cases:
|
|
224
|
+
|
|
225
|
+
#### Feature Area 1
|
|
226
|
+
|
|
227
|
+
- [ ] [Inferred] Criterion from `test_should_do_something` (test_file.ts:10)
|
|
228
|
+
- [ ] [Inferred] Criterion from `test_should_handle_error` (test_file.ts:25)
|
|
229
|
+
|
|
230
|
+
#### Feature Area 2
|
|
231
|
+
|
|
232
|
+
- [ ] [Inferred] Criterion from test analysis
|
|
233
|
+
|
|
234
|
+
- [Source: Code] `src/tests/feature.test.ts`
|
|
235
|
+
|
|
236
|
+
### Coverage Gaps
|
|
237
|
+
|
|
238
|
+
[Unknown] The following areas lack test coverage:
|
|
239
|
+
|
|
240
|
+
| Area | Risk Level | Recommendation |
|
|
241
|
+
|------|------------|----------------|
|
|
242
|
+
| Error handling | 🟡 Medium | Add tests before modification |
|
|
243
|
+
| Edge cases | 🔴 High | Requires documentation |
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## Dependencies
|
|
248
|
+
|
|
249
|
+
### External Dependencies
|
|
250
|
+
|
|
251
|
+
[Confirmed] Dependencies from package.json/requirements.txt:
|
|
252
|
+
|
|
253
|
+
| Package | Version | Purpose |
|
|
254
|
+
|---------|---------|---------|
|
|
255
|
+
| package1 | ^1.0.0 | Description |
|
|
256
|
+
| package2 | ^2.0.0 | Description |
|
|
257
|
+
|
|
258
|
+
- [Source: Code] `package.json:lines`
|
|
259
|
+
|
|
260
|
+
### Internal Dependencies
|
|
261
|
+
|
|
262
|
+
[Confirmed] Internal module dependencies:
|
|
263
|
+
|
|
264
|
+
| Module | Depends On | Type |
|
|
265
|
+
|--------|------------|------|
|
|
266
|
+
| AuthService | UserRepository | Runtime |
|
|
267
|
+
| UserController | AuthService, UserService | Runtime |
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Risks
|
|
272
|
+
|
|
273
|
+
[Unknown] **Requires human input**
|
|
274
|
+
|
|
275
|
+
### Technical Risks
|
|
276
|
+
|
|
277
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
278
|
+
|------|------------|--------|------------|
|
|
279
|
+
| <!-- Add technical risks --> | Low/Medium/High | Low/Medium/High | <!-- Mitigation strategy --> |
|
|
280
|
+
|
|
281
|
+
### Business Risks
|
|
282
|
+
|
|
283
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
284
|
+
|------|------------|--------|------------|
|
|
285
|
+
| <!-- Add business risks --> | Low/Medium/High | Low/Medium/High | <!-- Mitigation strategy --> |
|
|
286
|
+
|
|
287
|
+
### Known Issues / Tech Debt
|
|
288
|
+
|
|
289
|
+
[Unknown] Document any known issues discovered during analysis:
|
|
290
|
+
|
|
291
|
+
| Issue | Severity | Notes |
|
|
292
|
+
|-------|----------|-------|
|
|
293
|
+
| <!-- Add issues --> | Low/Medium/High | <!-- Additional context --> |
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Assumptions & Open Questions
|
|
298
|
+
|
|
299
|
+
### Assumptions
|
|
300
|
+
|
|
301
|
+
| # | Assumption | Impact Scope | Verification Method | Status |
|
|
302
|
+
|---|-----------|--------------|---------------------|--------|
|
|
303
|
+
| A1 | [Assumption] <!-- describe assumption --> | <!-- affected area --> | <!-- how to verify --> | Unverified |
|
|
304
|
+
|
|
305
|
+
<!-- Example:
|
|
306
|
+
| A1 | [Assumption] Auth middleware validates JWT before reaching controller | AuthController, UserController | Check middleware chain in app.ts | Unverified |
|
|
307
|
+
| A2 | [Assumption] Database indexes exist for all query patterns | Performance | Run EXPLAIN on common queries | Unverified |
|
|
308
|
+
-->
|
|
309
|
+
|
|
310
|
+
### Open Questions
|
|
311
|
+
|
|
312
|
+
| # | Question | Affected Area | Owner | Deadline |
|
|
313
|
+
|---|---------|--------------|-------|----------|
|
|
314
|
+
| Q1 | [Need Confirmation] <!-- question --> | <!-- area --> | <!-- who --> | <!-- when --> |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Out of Scope
|
|
319
|
+
|
|
320
|
+
[Unknown] **Requires human input**
|
|
321
|
+
|
|
322
|
+
What was intentionally NOT included in this feature?
|
|
323
|
+
|
|
324
|
+
- [ ] <!-- Item 1 - was this intentionally excluded? -->
|
|
325
|
+
- [ ] <!-- Item 2 -->
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Historical Context
|
|
330
|
+
|
|
331
|
+
[Unknown] **Requires human input**
|
|
332
|
+
|
|
333
|
+
### Design Decisions
|
|
334
|
+
|
|
335
|
+
| Decision | Rationale | Date | Decided By |
|
|
336
|
+
|----------|-----------|------|------------|
|
|
337
|
+
| <!-- What was decided --> | <!-- Why --> | <!-- When --> | <!-- Who --> |
|
|
338
|
+
|
|
339
|
+
### Trade-offs Made
|
|
340
|
+
|
|
341
|
+
| Trade-off | Chosen Option | Alternative | Reason |
|
|
342
|
+
|-----------|---------------|-------------|--------|
|
|
343
|
+
| <!-- Trade-off description --> | <!-- What was chosen --> | <!-- What was rejected --> | <!-- Why --> |
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Related Resources
|
|
348
|
+
|
|
349
|
+
### Code References
|
|
350
|
+
|
|
351
|
+
| Resource | Path | Description |
|
|
352
|
+
|----------|------|-------------|
|
|
353
|
+
| Main Implementation | `src/path/to/main` | Primary code location |
|
|
354
|
+
| Tests | `src/tests/path` | Test files |
|
|
355
|
+
| Configuration | `src/config/path` | Config files |
|
|
356
|
+
|
|
357
|
+
### Documentation
|
|
358
|
+
|
|
359
|
+
[Unknown] Existing documentation (if any):
|
|
360
|
+
|
|
361
|
+
- [ ] README: `path/to/readme` (exists/missing)
|
|
362
|
+
- [ ] API Docs: `path/to/docs` (exists/missing)
|
|
363
|
+
- [ ] Architecture: `path/to/arch` (exists/missing)
|
|
364
|
+
|
|
365
|
+
### Related Specs
|
|
366
|
+
|
|
367
|
+
- [ ] [SPEC-XXX] Related feature (if any)
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Analysis Metadata
|
|
372
|
+
|
|
373
|
+
| Attribute | Value |
|
|
374
|
+
|-----------|-------|
|
|
375
|
+
| **Analyzed By** | [AI Assistant / Human Name] |
|
|
376
|
+
| **Analysis Date** | YYYY-MM-DD |
|
|
377
|
+
| **Tool/Method** | `/reverse-spec` command |
|
|
378
|
+
| **Code Version** | Git commit hash or version |
|
|
379
|
+
| **Files Analyzed** | N files |
|
|
380
|
+
| **Lines of Code** | N lines |
|
|
381
|
+
|
|
382
|
+
### Confidence Summary
|
|
383
|
+
|
|
384
|
+
| Certainty Level | Count | Percentage |
|
|
385
|
+
|-----------------|-------|------------|
|
|
386
|
+
| [Confirmed] | N | X% |
|
|
387
|
+
| [Inferred] | N | X% |
|
|
388
|
+
| [Unknown] | N | X% |
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Version History
|
|
393
|
+
|
|
394
|
+
| Version | Date | Changes | Author |
|
|
395
|
+
|---------|------|---------|--------|
|
|
396
|
+
| 1.0.0 | YYYY-MM-DD | Initial reverse-engineered spec | [Name] |
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Appendix: Raw Analysis Data
|
|
401
|
+
|
|
402
|
+
<details>
|
|
403
|
+
<summary>Click to expand code analysis output</summary>
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
<!-- Paste raw analysis output here for reference -->
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
</details>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Test Case Template
|
|
2
|
+
|
|
3
|
+
> Inspired by ISO/IEC/IEEE 29119-3 Test Case Specification.
|
|
4
|
+
|
|
5
|
+
## Test Case: TC-{NNN}
|
|
6
|
+
|
|
7
|
+
### Metadata
|
|
8
|
+
|
|
9
|
+
| Field | Value |
|
|
10
|
+
|-------|-------|
|
|
11
|
+
| **ID** | TC-{NNN} |
|
|
12
|
+
| **Title** | {Descriptive test case title} |
|
|
13
|
+
| **Test Level** | Unit / Integration / System / E2E |
|
|
14
|
+
| **Priority** | High / Medium / Low |
|
|
15
|
+
| **Related Task** | T-{NNN} |
|
|
16
|
+
| **Author** | {name} |
|
|
17
|
+
| **Date** | {date} |
|
|
18
|
+
|
|
19
|
+
### Preconditions
|
|
20
|
+
|
|
21
|
+
- {Required state or setup before test execution}
|
|
22
|
+
|
|
23
|
+
### Test Steps
|
|
24
|
+
|
|
25
|
+
| Step | Action | Expected Result |
|
|
26
|
+
|------|--------|----------------|
|
|
27
|
+
| 1 | {action} | {expected} |
|
|
28
|
+
| 2 | {action} | {expected} |
|
|
29
|
+
| 3 | {action} | {expected} |
|
|
30
|
+
|
|
31
|
+
### Verify Command
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
{command to verify this test case passes}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Test Data
|
|
38
|
+
|
|
39
|
+
- {Input data requirements}
|
|
40
|
+
|
|
41
|
+
### Postconditions
|
|
42
|
+
|
|
43
|
+
- {Expected state after test execution}
|
|
44
|
+
|
|
45
|
+
### Notes
|
|
46
|
+
|
|
47
|
+
- {Additional information, edge cases, or references}
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
### Test Case: TC-001
|
|
54
|
+
|
|
55
|
+
| Field | Value |
|
|
56
|
+
|-------|-------|
|
|
57
|
+
| **ID** | TC-001 |
|
|
58
|
+
| **Title** | User login with valid credentials returns JWT token |
|
|
59
|
+
| **Test Level** | Integration |
|
|
60
|
+
| **Priority** | High |
|
|
61
|
+
| **Related Task** | T-003 |
|
|
62
|
+
|
|
63
|
+
**Preconditions**: Test database seeded with user `test@example.com`
|
|
64
|
+
|
|
65
|
+
| Step | Action | Expected Result |
|
|
66
|
+
|------|--------|----------------|
|
|
67
|
+
| 1 | POST /api/login with valid credentials | 200 OK |
|
|
68
|
+
| 2 | Check response body | Contains `token` field |
|
|
69
|
+
| 3 | Decode JWT token | Contains correct user ID |
|
|
70
|
+
|
|
71
|
+
**Verify Command**:
|
|
72
|
+
```bash
|
|
73
|
+
vitest run src/auth/login.integration.test.ts
|
|
74
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Test Plan Template
|
|
2
|
+
|
|
3
|
+
> Inspired by ISO/IEC/IEEE 29119-3.
|
|
4
|
+
|
|
5
|
+
## 1. Test Plan Identifier
|
|
6
|
+
|
|
7
|
+
- **Plan ID**: TP-{project}-{version}
|
|
8
|
+
- **Project**: {project name}
|
|
9
|
+
- **Version**: {version}
|
|
10
|
+
- **Date**: {date}
|
|
11
|
+
|
|
12
|
+
## 2. Test Scope
|
|
13
|
+
|
|
14
|
+
### In Scope
|
|
15
|
+
- {Feature/component to test}
|
|
16
|
+
|
|
17
|
+
### Out of Scope
|
|
18
|
+
- {Explicitly excluded items}
|
|
19
|
+
|
|
20
|
+
## 3. Test Levels
|
|
21
|
+
|
|
22
|
+
| Level | Command | Timeout | Scope |
|
|
23
|
+
|-------|---------|---------|-------|
|
|
24
|
+
| Unit (UT) | `{test:unit command}` | 120000ms | Single function/method |
|
|
25
|
+
| Integration (IT) | `{test:integration command}` | 120000ms | Multiple components |
|
|
26
|
+
| System (ST) | `{test:system command}` | 300000ms | Complete subsystem |
|
|
27
|
+
| E2E | `{test:e2e command}` | 600000ms | Full user flows |
|
|
28
|
+
|
|
29
|
+
## 4. Static Analysis
|
|
30
|
+
|
|
31
|
+
- **Command**: `{lint/type-check/analysis command}`
|
|
32
|
+
- **Tools**: {ESLint, ruff, mypy, etc.}
|
|
33
|
+
|
|
34
|
+
## 5. Quality Thresholds
|
|
35
|
+
|
|
36
|
+
| Setting | Value |
|
|
37
|
+
|---------|-------|
|
|
38
|
+
| Profile | strict / standard / minimal / none |
|
|
39
|
+
| Verify | true/false |
|
|
40
|
+
| Max Retries | {number} |
|
|
41
|
+
|
|
42
|
+
## 6. Test Completion Criteria
|
|
43
|
+
|
|
44
|
+
> ISO 29119: Test Completion Criteria / Test Exit Criteria
|
|
45
|
+
> Agile/Scrum: Definition of Done (DoD)
|
|
46
|
+
|
|
47
|
+
| Check | Command | Required |
|
|
48
|
+
|-------|---------|----------|
|
|
49
|
+
| All tests pass | `{test command}` | Yes |
|
|
50
|
+
| No lint errors | `{lint command}` | Yes |
|
|
51
|
+
| Type check clean | `{typecheck command}` | Yes |
|
|
52
|
+
| Static analysis clean | `{command}` | Yes |
|
|
53
|
+
| Documentation updated | _(manual review)_ | No |
|
|
54
|
+
|
|
55
|
+
## 7. Test Environment
|
|
56
|
+
|
|
57
|
+
| Environment | Purpose | Mock Strategy |
|
|
58
|
+
|-------------|---------|---------------|
|
|
59
|
+
| local | UT, fast IT | In-memory mocks |
|
|
60
|
+
| ci | Full suite | Containerized deps |
|
|
61
|
+
| sit | ST | Stubbed external APIs |
|
|
62
|
+
| staging | E2E | No mocks |
|
|
63
|
+
|
|
64
|
+
## 8. Risks and Mitigations
|
|
65
|
+
|
|
66
|
+
| Risk | Impact | Mitigation |
|
|
67
|
+
|------|--------|------------|
|
|
68
|
+
| {risk} | {impact} | {mitigation} |
|
|
69
|
+
|
|
70
|
+
## 9. Approval
|
|
71
|
+
|
|
72
|
+
- **Author**: {name}
|
|
73
|
+
- **Reviewer**: {name}
|
|
74
|
+
- **Approved**: {date}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-dev-standards",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
4
4
|
"description": "CLI tool for adopting Universal Development Standards",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"documentation",
|
|
@@ -58,11 +58,13 @@
|
|
|
58
58
|
"check:bundle-parity": "node scripts/check-bundle-parity.mjs",
|
|
59
59
|
"prepack": "node scripts/prepack.mjs",
|
|
60
60
|
"check:reachability": "node scripts/check-module-reachability.mjs",
|
|
61
|
-
"check:command-existence": "node scripts/check-command-existence.mjs"
|
|
61
|
+
"check:command-existence": "node scripts/check-command-existence.mjs",
|
|
62
|
+
"check:effect-boundary": "node scripts/check-effect-boundary.mjs",
|
|
63
|
+
"check:effect-boundary:self-test": "node scripts/check-effect-boundary.mjs --self-test"
|
|
62
64
|
},
|
|
63
65
|
"dependencies": {
|
|
64
66
|
"@inquirer/prompts": "^8.4.2",
|
|
65
|
-
"chalk": "^
|
|
67
|
+
"chalk": "^6.0.0",
|
|
66
68
|
"commander": "^15.0.0",
|
|
67
69
|
"js-yaml": "^5.2.1",
|
|
68
70
|
"ora": "^9.4.0",
|
|
@@ -71,8 +73,8 @@
|
|
|
71
73
|
"devDependencies": {
|
|
72
74
|
"@eslint/js": "^10.0.1",
|
|
73
75
|
"@vitest/coverage-v8": "^4.1.5",
|
|
74
|
-
"eslint": "10.
|
|
75
|
-
"globals": "17.
|
|
76
|
+
"eslint": "10.8.0",
|
|
77
|
+
"globals": "17.11.0",
|
|
76
78
|
"husky": "^9.1.7",
|
|
77
79
|
"lint-staged": "^17.0.3",
|
|
78
80
|
"vitest": "^4.1.5"
|
package/src/commands/audit.js
CHANGED
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
import chalk from 'chalk';
|
|
15
15
|
import { checkbox, input } from '@inquirer/prompts';
|
|
16
16
|
import { createRequire } from 'node:module';
|
|
17
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
18
|
+
import { resolve as resolvePath } from 'node:path';
|
|
19
|
+
import {
|
|
20
|
+
analyseEffectBoundary,
|
|
21
|
+
formatReport,
|
|
22
|
+
parseBaselineTsv,
|
|
23
|
+
DEFAULT_CONFIG_PATH,
|
|
24
|
+
DEFAULT_BASELINE_PATH
|
|
25
|
+
} from '../utils/effect-boundary.js';
|
|
17
26
|
import { readManifest, isInitialized } from '../utils/copier.js';
|
|
18
27
|
import { runHealthCheck } from '../utils/health-checker.js';
|
|
19
28
|
import { runHealthScore, saveScoreSnapshot, loadTrend } from '../utils/health-scorer.js';
|
|
@@ -59,6 +68,17 @@ export async function auditCommand(options = {}) {
|
|
|
59
68
|
return handleScoreMode(projectPath, options);
|
|
60
69
|
}
|
|
61
70
|
|
|
71
|
+
// Handle --effects mode (XSPEC-383 R8 — static effect boundary gate).
|
|
72
|
+
//
|
|
73
|
+
// It is its own mode rather than a fourth layer of the health/patterns/friction
|
|
74
|
+
// report for one reason: it has a THREE-state exit code (0 clean / 1 findings /
|
|
75
|
+
// 2 cannot measure), and folding it into a report that always exits 0 would
|
|
76
|
+
// erase exactly the state it exists to preserve — "we could not measure this"
|
|
77
|
+
// must not print the same thing as "this is fine".
|
|
78
|
+
if (options.effects) {
|
|
79
|
+
return handleEffectsMode(projectPath, options);
|
|
80
|
+
}
|
|
81
|
+
|
|
62
82
|
// Determine which layers to run
|
|
63
83
|
const hasLayerFlag = options.health || options.patterns || options.friction;
|
|
64
84
|
const runHealth = hasLayerFlag ? !!options.health : true;
|
|
@@ -140,6 +160,68 @@ export async function auditCommand(options = {}) {
|
|
|
140
160
|
}
|
|
141
161
|
}
|
|
142
162
|
|
|
163
|
+
/**
|
|
164
|
+
* XSPEC-383 R8 — static effect boundary gate.
|
|
165
|
+
*
|
|
166
|
+
* Shape D: a component that is reachable, is called, runs, reports success, and
|
|
167
|
+
* does nothing. R3's reachability gate cannot see it — reachability asks who
|
|
168
|
+
* calls this file (in-edges); shape D lives in the out-edges (what it finally
|
|
169
|
+
* touches). Opposite direction.
|
|
170
|
+
*
|
|
171
|
+
* All judgement lives in utils/effect-boundary.js. This function is one of its
|
|
172
|
+
* two entry points; the other is scripts/check-effect-boundary.mjs, which CI
|
|
173
|
+
* and `npm run check:effect-boundary` use. The engine sits in src/ because
|
|
174
|
+
* `cli/scripts/` ships zero files (measured with `npm pack --dry-run`), so an
|
|
175
|
+
* engine living only there would not be on an adopter's disk at all.
|
|
176
|
+
*
|
|
177
|
+
* @param {string} projectPath
|
|
178
|
+
* @param {Object} options
|
|
179
|
+
*/
|
|
180
|
+
function handleEffectsMode(projectPath, options) {
|
|
181
|
+
const configPath = resolvePath(projectPath, options.effectsConfig || DEFAULT_CONFIG_PATH);
|
|
182
|
+
|
|
183
|
+
if (!existsSync(configPath)) {
|
|
184
|
+
console.error(chalk.red('[effect-boundary] FATAL: no effect-family config at ') + configPath);
|
|
185
|
+
console.error(' This gate asks whether each implementation of an effect interface reaches');
|
|
186
|
+
console.error(' anything outside this process. It cannot answer that without being told');
|
|
187
|
+
console.error(' which implementations form a family.');
|
|
188
|
+
console.error('');
|
|
189
|
+
console.error(` Declare them by glob in ${DEFAULT_CONFIG_PATH} (or pass --effects-config <path>):`);
|
|
190
|
+
console.error(' { "families": [ { "name": "deploy-adapters",');
|
|
191
|
+
console.error(' "include": ["src/**/adapters/*.adapter.ts"] } ] }');
|
|
192
|
+
console.error('');
|
|
193
|
+
console.error(' Declared by glob, not by a list of filenames: a glob keeps matching the');
|
|
194
|
+
console.error(' adapter nobody has written yet, which is the one this gate exists to catch.');
|
|
195
|
+
console.error('');
|
|
196
|
+
console.error(chalk.yellow(' Exiting 2 (cannot measure), not 0. A gate with nothing to check must not print a green tick.'));
|
|
197
|
+
process.exit(2);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let config;
|
|
201
|
+
try {
|
|
202
|
+
config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
203
|
+
} catch (e) {
|
|
204
|
+
console.error(chalk.red(`[effect-boundary] FATAL: config exists but does not parse: ${configPath}: ${e.message}`));
|
|
205
|
+
console.error(' This is "cannot read the config", not "there is no config".');
|
|
206
|
+
process.exit(2);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const baselinePath = resolvePath(projectPath, DEFAULT_BASELINE_PATH);
|
|
210
|
+
const baseline = existsSync(baselinePath)
|
|
211
|
+
? parseBaselineTsv(readFileSync(baselinePath, 'utf8'))
|
|
212
|
+
: { entries: [], errors: [] };
|
|
213
|
+
|
|
214
|
+
const result = analyseEffectBoundary({ projectPath, config });
|
|
215
|
+
const { lines, exitCode } = formatReport(result, baseline);
|
|
216
|
+
|
|
217
|
+
if (options.format === 'json') {
|
|
218
|
+
console.log(JSON.stringify({ exitCode, report: lines, result }, null, 2));
|
|
219
|
+
} else {
|
|
220
|
+
for (const line of lines) console.log(line);
|
|
221
|
+
}
|
|
222
|
+
process.exit(exitCode);
|
|
223
|
+
}
|
|
224
|
+
|
|
143
225
|
/**
|
|
144
226
|
* Output full terminal report
|
|
145
227
|
* @param {Object} auditResult
|