@su-record/vibe 2.8.24 → 2.8.26
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/dist/cli/commands/config.d.ts +17 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +207 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/info.d.ts.map +1 -1
- package/dist/cli/commands/info.js +2 -0
- package/dist/cli/commands/info.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +78 -54
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/stats.d.ts +13 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +280 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +33 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/postinstall/constants.d.ts.map +1 -1
- package/dist/cli/postinstall/constants.js +1 -0
- package/dist/cli/postinstall/constants.js.map +1 -1
- package/dist/cli/setup/GlobalInstaller.d.ts.map +1 -1
- package/dist/cli/setup/GlobalInstaller.js +7 -7
- package/dist/cli/setup/GlobalInstaller.js.map +1 -1
- package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
- package/dist/cli/setup/ProjectSetup.js +18 -12
- package/dist/cli/setup/ProjectSetup.js.map +1 -1
- package/dist/infra/lib/ContextCompressor.d.ts.map +1 -1
- package/dist/infra/lib/ContextCompressor.js +10 -4
- package/dist/infra/lib/ContextCompressor.js.map +1 -1
- package/dist/infra/lib/ProjectCache.d.ts +2 -2
- package/dist/infra/lib/ProjectCache.d.ts.map +1 -1
- package/dist/infra/lib/ProjectCache.js +4 -3
- package/dist/infra/lib/ProjectCache.js.map +1 -1
- package/dist/infra/lib/utils.d.ts +24 -0
- package/dist/infra/lib/utils.d.ts.map +1 -1
- package/dist/infra/lib/utils.js +41 -0
- package/dist/infra/lib/utils.js.map +1 -1
- package/dist/infra/orchestrator/SmartRouter.d.ts +3 -0
- package/dist/infra/orchestrator/SmartRouter.d.ts.map +1 -1
- package/dist/infra/orchestrator/SmartRouter.js +11 -1
- package/dist/infra/orchestrator/SmartRouter.js.map +1 -1
- package/dist/infra/orchestrator/SmartRouter.test.d.ts +5 -0
- package/dist/infra/orchestrator/SmartRouter.test.d.ts.map +1 -0
- package/dist/infra/orchestrator/SmartRouter.test.js +457 -0
- package/dist/infra/orchestrator/SmartRouter.test.js.map +1 -0
- package/dist/tools/convention/analyzeComplexity.d.ts.map +1 -1
- package/dist/tools/convention/analyzeComplexity.js +18 -10
- package/dist/tools/convention/analyzeComplexity.js.map +1 -1
- package/dist/tools/convention/checkCouplingCohesion.d.ts.map +1 -1
- package/dist/tools/convention/checkCouplingCohesion.js +14 -6
- package/dist/tools/convention/checkCouplingCohesion.js.map +1 -1
- package/dist/tools/semantic/analyzeDependencyGraph.d.ts.map +1 -1
- package/dist/tools/semantic/analyzeDependencyGraph.js +1 -1
- package/dist/tools/semantic/analyzeDependencyGraph.js.map +1 -1
- package/dist/tools/semantic/findReferences.d.ts.map +1 -1
- package/dist/tools/semantic/findReferences.js +13 -13
- package/dist/tools/semantic/findReferences.js.map +1 -1
- package/dist/tools/semantic/findSymbol.d.ts.map +1 -1
- package/dist/tools/semantic/findSymbol.js +12 -13
- package/dist/tools/semantic/findSymbol.js.map +1 -1
- package/dist/tools/semantic/lsp.d.ts.map +1 -1
- package/dist/tools/semantic/lsp.js +22 -14
- package/dist/tools/semantic/lsp.js.map +1 -1
- package/hooks/hooks.json +29 -0
- package/hooks/scripts/__tests__/keyword-detector.test.js +199 -0
- package/hooks/scripts/__tests__/pre-tool-guard.test.js +286 -0
- package/hooks/scripts/__tests__/sentinel-guard.test.js +210 -0
- package/hooks/scripts/auto-commit.js +65 -0
- package/hooks/scripts/auto-format.js +64 -0
- package/hooks/scripts/auto-test.js +81 -0
- package/hooks/scripts/code-check.js +139 -0
- package/hooks/scripts/command-log.js +32 -0
- package/hooks/scripts/context-save.js +60 -6
- package/hooks/scripts/hud-status.js +32 -2
- package/hooks/scripts/llm-orchestrate.js +95 -17
- package/hooks/scripts/pr-test-gate.js +52 -0
- package/package.json +1 -1
- package/skills/agents-md/rubrics/what-to-keep.md +49 -0
- package/skills/agents-md/templates/agents-md.md +36 -0
- package/skills/arch-guard/agents/detector.md +48 -0
- package/skills/arch-guard/agents/reporter.md +48 -0
- package/skills/arch-guard/agents/rule-generator.md +49 -0
- package/skills/arch-guard/agents/violation-checker.md +51 -0
- package/skills/arch-guard/frameworks/clean-architecture.md +108 -0
- package/skills/arch-guard/frameworks/solid.md +102 -0
- package/skills/arch-guard/scripts/check-boundaries.js +90 -0
- package/skills/arch-guard/templates/arch-rules.json +47 -0
- package/skills/arch-guard/templates/violation-report.md +53 -0
- package/skills/brand-assets/rubrics/asset-checklist.md +98 -0
- package/skills/brand-assets/templates/brand-guide.md +161 -0
- package/skills/capability-loop/agents/capability-designer.md +61 -0
- package/skills/capability-loop/agents/failure-analyst.md +55 -0
- package/skills/capability-loop/agents/implementer.md +50 -0
- package/skills/capability-loop/agents/tester.md +53 -0
- package/skills/capability-loop/templates/capability-spec.md +118 -0
- package/skills/capability-loop/templates/failure-analysis.md +118 -0
- package/skills/characterization-test/agents/behavior-capturer.md +50 -0
- package/skills/characterization-test/agents/coverage-checker.md +54 -0
- package/skills/characterization-test/agents/reporter.md +50 -0
- package/skills/characterization-test/agents/test-writer.md +49 -0
- package/skills/characterization-test/rubrics/coverage-criteria.md +53 -0
- package/skills/characterization-test/templates/test-template.ts +101 -0
- package/skills/claude-md-guide/rubrics/anti-patterns.md +88 -0
- package/skills/claude-md-guide/templates/claude-md.md +54 -0
- package/skills/commerce-patterns/rubrics/checkout-flow.md +48 -0
- package/skills/commerce-patterns/templates/product-schema.md +85 -0
- package/skills/commit-push-pr/agents/change-analyzer.md +55 -0
- package/skills/commit-push-pr/agents/message-writer.md +50 -0
- package/skills/commit-push-pr/agents/pr-writer.md +58 -0
- package/skills/commit-push-pr/agents/reviewer.md +52 -0
- package/skills/commit-push-pr/rubrics/commit-message.md +73 -0
- package/skills/commit-push-pr/templates/pr-body.md +63 -0
- package/skills/context7-usage/rubrics/when-to-use.md +50 -0
- package/skills/create-prd/agents/edge-case-finder.md +48 -0
- package/skills/create-prd/agents/prioritizer.md +60 -0
- package/skills/create-prd/agents/requirements-writer.md +48 -0
- package/skills/create-prd/agents/researcher.md +55 -0
- package/skills/create-prd/agents/reviewer.md +54 -0
- package/skills/create-prd/frameworks/jobs-to-be-done.md +96 -0
- package/skills/create-prd/frameworks/rice-scoring.md +97 -0
- package/skills/create-prd/orchestrator.md +70 -0
- package/skills/create-prd/rubrics/completeness.md +58 -0
- package/skills/create-prd/templates/prd.md +139 -0
- package/skills/design-audit/agents/a11y-auditor.md +43 -0
- package/skills/design-audit/agents/performance-auditor.md +46 -0
- package/skills/design-audit/agents/responsive-auditor.md +46 -0
- package/skills/design-audit/agents/scorer.md +47 -0
- package/skills/design-audit/agents/slop-detector.md +47 -0
- package/skills/design-audit/frameworks/core-web-vitals.md +107 -0
- package/skills/design-audit/frameworks/wcag-checklist.md +64 -0
- package/skills/design-audit/orchestrator.md +64 -0
- package/skills/design-audit/rubrics/ai-slop-patterns.md +83 -0
- package/skills/design-audit/rubrics/scoring.md +63 -0
- package/skills/design-audit/templates/report.md +88 -0
- package/skills/design-critique/rubrics/ux-heuristics.md +143 -0
- package/skills/design-critique/templates/critique-report.md +86 -0
- package/skills/design-distill/templates/design-system.md +132 -0
- package/skills/design-normalize/rubrics/token-naming.md +117 -0
- package/skills/design-normalize/templates/token-audit.md +89 -0
- package/skills/design-polish/rubrics/polish-checklist.md +68 -0
- package/skills/design-polish/templates/polish-report.md +64 -0
- package/skills/design-teach/rubrics/brand-personality.md +73 -0
- package/skills/design-teach/templates/design-context.json +36 -0
- package/skills/e2e-commerce/templates/test-scenarios.md +170 -0
- package/skills/event-comms/templates/email-invite.md +99 -0
- package/skills/event-comms/templates/sns-post.md +133 -0
- package/skills/event-ops/rubrics/contingency.md +85 -0
- package/skills/event-ops/templates/d-day-checklist.md +65 -0
- package/skills/event-planning/rubrics/timeline.md +70 -0
- package/skills/event-planning/templates/event-plan.md +91 -0
- package/skills/exec-plan/agents/decomposer.md +47 -0
- package/skills/exec-plan/agents/dependency-mapper.md +44 -0
- package/skills/exec-plan/agents/estimator.md +43 -0
- package/skills/exec-plan/agents/validator.md +55 -0
- package/skills/exec-plan/orchestrator.md +70 -0
- package/skills/exec-plan/rubrics/complexity-scoring.md +75 -0
- package/skills/exec-plan/templates/plan.md +147 -0
- package/skills/git-worktree/rubrics/when-to-use.md +55 -0
- package/skills/handoff/agents/context-summarizer.md +51 -0
- package/skills/handoff/agents/document-writer.md +63 -0
- package/skills/handoff/agents/state-collector.md +53 -0
- package/skills/handoff/agents/verifier.md +48 -0
- package/skills/handoff/rubrics/completeness.md +62 -0
- package/skills/handoff/templates/handoff.md +107 -0
- package/skills/parallel-research/agents/best-practices.md +43 -0
- package/skills/parallel-research/agents/codebase-patterns.md +46 -0
- package/skills/parallel-research/agents/framework-docs.md +45 -0
- package/skills/parallel-research/agents/security-advisory.md +46 -0
- package/skills/parallel-research/agents/synthesizer.md +52 -0
- package/skills/parallel-research/experts/best-practices.md +50 -0
- package/skills/parallel-research/experts/codebase-patterns.md +70 -0
- package/skills/parallel-research/experts/framework-docs.md +65 -0
- package/skills/parallel-research/experts/security-advisory.md +69 -0
- package/skills/parallel-research/orchestrator.md +65 -0
- package/skills/parallel-research/templates/synthesis.md +101 -0
- package/skills/prioritization-frameworks/rubrics/frameworks.md +79 -0
- package/skills/prioritization-frameworks/templates/scoring-matrix.md +69 -0
- package/skills/priority-todos/rubrics/prioritization.md +70 -0
- package/skills/priority-todos/templates/todo-board.md +59 -0
- package/skills/seo-checklist/frameworks/structured-data.md +153 -0
- package/skills/seo-checklist/rubrics/content-seo.md +42 -0
- package/skills/seo-checklist/rubrics/technical-seo.md +48 -0
- package/skills/techdebt/agents/analyzer.md +50 -0
- package/skills/techdebt/agents/fixer.md +41 -0
- package/skills/techdebt/agents/reviewer.md +47 -0
- package/skills/techdebt/agents/scanner.md +44 -0
- package/skills/techdebt/orchestrator.md +70 -0
- package/skills/techdebt/rubrics/severity.md +51 -0
- package/skills/techdebt/scripts/scan.js +90 -0
- package/skills/techdebt/templates/report.md +86 -0
- package/skills/tool-fallback/rubrics/fallback-chain.md +58 -0
- package/skills/typescript-advanced-types/rubrics/type-patterns.md +109 -0
- package/skills/ui-ux-pro-max/rubrics/interaction-states.md +83 -0
- package/skills/ui-ux-pro-max/rubrics/responsive-breakpoints.md +99 -0
- package/skills/user-personas/rubrics/research-methods.md +56 -0
- package/skills/user-personas/templates/persona.md +89 -0
- package/skills/vercel-react-best-practices/rubrics/performance.md +82 -0
- package/skills/vercel-react-best-practices/rubrics/server-components.md +86 -0
- package/skills/vibe-docs/SKILL.md +171 -0
- package/skills/vibe-docs/templates/architecture.md +80 -0
- package/skills/vibe-docs/templates/readme.md +84 -0
- package/skills/vibe-docs/templates/release-notes.md +74 -0
- package/skills/vibe-figma/SKILL.md +122 -206
- package/skills/vibe-figma/rubrics/extraction-checklist.md +51 -0
- package/skills/vibe-figma/templates/figma-handoff.md +96 -0
- package/skills/vibe-figma-analyze/rubrics/analysis-dimensions.md +53 -0
- package/skills/vibe-figma-codegen/rubrics/code-quality.md +54 -0
- package/skills/vibe-figma-consolidate/templates/consolidation-report.md +95 -0
- package/skills/vibe-figma-convert/SKILL.md +13 -175
- package/skills/vibe-figma-convert/rubrics/conversion-rules.md +83 -0
- package/skills/vibe-figma-convert/templates/component.md +152 -0
- package/skills/vibe-figma-extract/rubrics/image-rules.md +67 -0
- package/skills/vibe-figma-frame/rubrics/frame-selection.md +55 -0
- package/skills/vibe-figma-pipeline/rubrics/pipeline-stages.md +96 -0
- package/skills/vibe-figma-rules/rubrics/naming-conventions.md +70 -0
- package/skills/vibe-figma-style/rubrics/style-mapping.md +100 -0
- package/skills/video-production/rubrics/quality-checklist.md +58 -0
- package/skills/video-production/templates/production-plan.md +104 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: coverage-checker
|
|
3
|
+
role: Verifies all public methods and edge cases are covered by characterization tests
|
|
4
|
+
tools: [Read, Bash, Grep]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Coverage Checker
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
Audits the generated characterization test file against the behavior manifest to confirm every public method, branch path, and identified edge case has a corresponding locked test. Flags gaps before the refactor begins.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
- Cross-reference every public function in the manifest against test cases
|
|
14
|
+
- Verify each branching path has at least one test
|
|
15
|
+
- Confirm edge cases (null, empty, boundary) are all exercised
|
|
16
|
+
- Run the test suite and confirm all tests pass with current code
|
|
17
|
+
- Report any uncovered paths as blockers
|
|
18
|
+
|
|
19
|
+
## Input
|
|
20
|
+
- Behavior manifest from behavior-capturer
|
|
21
|
+
- Generated test file path from test-writer
|
|
22
|
+
- Project root path for running vitest
|
|
23
|
+
|
|
24
|
+
## Output
|
|
25
|
+
Coverage audit report:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
## Coverage Audit: {ModuleName}
|
|
29
|
+
|
|
30
|
+
### Public Methods
|
|
31
|
+
- functionA: covered (3 tests)
|
|
32
|
+
- functionB: MISSING — no test found
|
|
33
|
+
|
|
34
|
+
### Branch Paths
|
|
35
|
+
- functionA happy path: covered
|
|
36
|
+
- functionA null branch: covered
|
|
37
|
+
- functionB error branch: MISSING
|
|
38
|
+
|
|
39
|
+
### Edge Cases
|
|
40
|
+
- empty string: covered
|
|
41
|
+
- null input: covered
|
|
42
|
+
- value > MAX: MISSING
|
|
43
|
+
|
|
44
|
+
### Test Run Result
|
|
45
|
+
- Passed: 12 / Failed: 0
|
|
46
|
+
- Uncovered items: 2 (must fix before refactor)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Communication
|
|
50
|
+
- Reports findings to: orchestrator (characterization-test skill)
|
|
51
|
+
- Receives instructions from: orchestrator
|
|
52
|
+
|
|
53
|
+
## Domain Knowledge
|
|
54
|
+
Any MISSING item is a blocker — refactor must not start until all identified behaviors are locked. Re-run test-writer for gap items rather than patching manually.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reporter
|
|
3
|
+
role: Summarizes what behavior is locked and confirms the codebase is safe to refactor
|
|
4
|
+
tools: [Read, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Reporter
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
Produces the final summary after all characterization tests pass. Communicates to the developer exactly what is now locked, what is not covered, and what the safe refactoring boundaries are.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
- Summarize total test count and what behaviors each test locks
|
|
14
|
+
- List any intentionally excluded behaviors and the rationale
|
|
15
|
+
- State explicit refactor safety boundaries (what can change vs. what must stay)
|
|
16
|
+
- Provide the single command to run before and after any code change
|
|
17
|
+
- Archive the behavior manifest alongside the test file
|
|
18
|
+
|
|
19
|
+
## Input
|
|
20
|
+
- Coverage audit report from coverage-checker
|
|
21
|
+
- Final test run results
|
|
22
|
+
- Original behavior manifest
|
|
23
|
+
|
|
24
|
+
## Output
|
|
25
|
+
A handoff summary printed to the user:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
## Characterization Test Report: {ModuleName}
|
|
29
|
+
|
|
30
|
+
### Locked Behaviors (safe to refactor)
|
|
31
|
+
- functionA: 3 cases locked (happy path, null, empty array)
|
|
32
|
+
- functionB: 2 cases locked (returns string, throws on invalid)
|
|
33
|
+
|
|
34
|
+
### Not Covered (refactor with caution)
|
|
35
|
+
- functionC: no tests — side effects unclear, manual review required
|
|
36
|
+
|
|
37
|
+
### Refactor Safety Command
|
|
38
|
+
Run this before AND after changes:
|
|
39
|
+
npx vitest run src/__tests__/{module}.characterization.test.ts
|
|
40
|
+
|
|
41
|
+
### Verdict
|
|
42
|
+
SAFE TO REFACTOR — all public API surface locked.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Communication
|
|
46
|
+
- Reports findings to: user / orchestrator
|
|
47
|
+
- Receives instructions from: orchestrator
|
|
48
|
+
|
|
49
|
+
## Domain Knowledge
|
|
50
|
+
A green characterization suite is a contract. Any failure after refactor means behavior changed — intentional or not. Distinguish between "expected failures" (intended changes) and "unexpected failures" (regressions).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-writer
|
|
3
|
+
role: Generates vitest characterization tests that lock captured behavior
|
|
4
|
+
tools: [Read, Write, Edit, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Test Writer
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
Takes the behavior manifest from behavior-capturer and produces a complete vitest test file that locks the current behavior as-is. Tests capture actual output — not expected behavior — using snapshot assertions.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
- Write one `describe` block per module with clearly labeled test cases
|
|
14
|
+
- Cover every branching path identified in the behavior manifest
|
|
15
|
+
- Use `toMatchSnapshot()` for complex return shapes, `toBe`/`toEqual` for primitives
|
|
16
|
+
- Include error path tests with `toThrowErrorMatchingSnapshot()`
|
|
17
|
+
- Never fix bugs — lock current behavior exactly as it is
|
|
18
|
+
|
|
19
|
+
## Input
|
|
20
|
+
- Behavior manifest from behavior-capturer
|
|
21
|
+
- Target file path(s) and their import shapes
|
|
22
|
+
- Project test config (vitest.config.ts location)
|
|
23
|
+
|
|
24
|
+
## Output
|
|
25
|
+
A complete test file written to `src/__tests__/{module}.characterization.test.ts`:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { describe, it, expect } from 'vitest';
|
|
29
|
+
import { targetFn } from '../path/to/module.js';
|
|
30
|
+
|
|
31
|
+
describe('{ModuleName} characterization tests', () => {
|
|
32
|
+
it('should handle normal input', () => {
|
|
33
|
+
expect(targetFn(normalInput)).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should handle null input', () => {
|
|
37
|
+
expect(() => targetFn(null)).toThrowErrorMatchingSnapshot();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Reports: path to generated test file and count of test cases written.
|
|
43
|
+
|
|
44
|
+
## Communication
|
|
45
|
+
- Reports findings to: orchestrator (characterization-test skill)
|
|
46
|
+
- Receives instructions from: orchestrator
|
|
47
|
+
|
|
48
|
+
## Domain Knowledge
|
|
49
|
+
Characterization test rule: if the current code returns a wrong value for an input, the test must lock THAT wrong value. The goal is regression detection, not correctness. Use `vitest --run -u` to initialize snapshots on first run.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Characterization Test Coverage Criteria
|
|
2
|
+
|
|
3
|
+
Coverage that MUST exist before any refactoring begins.
|
|
4
|
+
|
|
5
|
+
## Mandatory Coverage (all must pass before changing code)
|
|
6
|
+
|
|
7
|
+
### Public API Surface
|
|
8
|
+
- [ ] Every exported function has at least one characterization test
|
|
9
|
+
- [ ] Every exported class method (public) has at least one test
|
|
10
|
+
- [ ] Every exported type's runtime behavior is tested where applicable
|
|
11
|
+
|
|
12
|
+
### Input Coverage
|
|
13
|
+
- [ ] Typical / happy-path input
|
|
14
|
+
- [ ] Minimum valid input (empty string, 0, `[]`, `{}`)
|
|
15
|
+
- [ ] Maximum or large input (long strings, large arrays)
|
|
16
|
+
- [ ] Boundary values (off-by-one, limits)
|
|
17
|
+
|
|
18
|
+
### Branch Coverage
|
|
19
|
+
- [ ] Each top-level `if` branch has a dedicated test
|
|
20
|
+
- [ ] Each `switch` case has a dedicated test
|
|
21
|
+
- [ ] `try/catch` — both success and error paths tested
|
|
22
|
+
- [ ] Short-circuit conditions (`&&`, `||`) exercised
|
|
23
|
+
|
|
24
|
+
### Error Paths
|
|
25
|
+
- [ ] `null` input behavior captured
|
|
26
|
+
- [ ] `undefined` input behavior captured
|
|
27
|
+
- [ ] Invalid type input behavior captured
|
|
28
|
+
- [ ] Thrown errors match snapshot (message, type)
|
|
29
|
+
|
|
30
|
+
### Side Effects
|
|
31
|
+
- [ ] External calls (DB, network, filesystem) are mocked and call args verified
|
|
32
|
+
- [ ] Return values from mocks are representative of real responses
|
|
33
|
+
- [ ] State mutations are verified before and after
|
|
34
|
+
|
|
35
|
+
## Sufficient vs. Insufficient Coverage
|
|
36
|
+
|
|
37
|
+
| Situation | Sufficient? |
|
|
38
|
+
|-----------|-------------|
|
|
39
|
+
| 1 happy-path snapshot only | No — missing edge cases and error paths |
|
|
40
|
+
| All branches covered, no error paths | No — error behavior must be locked |
|
|
41
|
+
| All public exports tested | Minimum viable — add side-effect tests if any exist |
|
|
42
|
+
| Snapshot exists but test not run | No — must run and pass before refactoring |
|
|
43
|
+
| Test passes after code change | Confirm intentional; update snapshot with reason |
|
|
44
|
+
|
|
45
|
+
## Definition of Done
|
|
46
|
+
|
|
47
|
+
The characterization suite is complete when:
|
|
48
|
+
|
|
49
|
+
1. All tests pass on current code without modification
|
|
50
|
+
2. Every public export is exercised
|
|
51
|
+
3. At least one error-path test exists per function
|
|
52
|
+
4. Snapshots are committed alongside tests
|
|
53
|
+
5. `npx vitest run <test-file>` exits with code 0
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Characterization test template — lock existing behavior before refactoring.
|
|
3
|
+
*
|
|
4
|
+
* Instructions:
|
|
5
|
+
* 1. Replace {{MODULE_NAME}} with the module under test.
|
|
6
|
+
* 2. Replace {{IMPORT_PATH}} with the relative import path.
|
|
7
|
+
* 3. Replace {{FUNCTION_NAME}} with each public export to characterize.
|
|
8
|
+
* 4. Run once to generate snapshots: npx vitest run --update {{TEST_FILE}}
|
|
9
|
+
* 5. Verify all tests pass BEFORE making any changes to the source.
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: Capture ACTUAL behavior, not expected/ideal behavior.
|
|
12
|
+
* If the current code has a bug, capture the buggy output — fix it separately.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
16
|
+
// import { {{FUNCTION_NAME}} } from '{{IMPORT_PATH}}';
|
|
17
|
+
|
|
18
|
+
describe('{{MODULE_NAME}} — characterization tests', () => {
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
vi.clearAllMocks();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// -------------------------------------------------------------------------
|
|
24
|
+
// Happy path — normal inputs
|
|
25
|
+
// -------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
it('should handle typical input', () => {
|
|
28
|
+
// const result = {{FUNCTION_NAME}}({{TYPICAL_INPUT}});
|
|
29
|
+
// expect(result).toMatchSnapshot();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should handle minimum valid input', () => {
|
|
33
|
+
// const result = {{FUNCTION_NAME}}({{MIN_INPUT}});
|
|
34
|
+
// expect(result).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should handle maximum valid input', () => {
|
|
38
|
+
// const result = {{FUNCTION_NAME}}({{MAX_INPUT}});
|
|
39
|
+
// expect(result).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// -------------------------------------------------------------------------
|
|
43
|
+
// Edge cases — boundary values
|
|
44
|
+
// -------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
it('should handle empty string input', () => {
|
|
47
|
+
// const result = {{FUNCTION_NAME}}('');
|
|
48
|
+
// expect(result).toMatchSnapshot();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should handle empty array input', () => {
|
|
52
|
+
// const result = {{FUNCTION_NAME}}([]);
|
|
53
|
+
// expect(result).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should handle zero / false / null-like values', () => {
|
|
57
|
+
// const result = {{FUNCTION_NAME}}(0);
|
|
58
|
+
// expect(result).toMatchSnapshot();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// -------------------------------------------------------------------------
|
|
62
|
+
// Error paths — failure modes
|
|
63
|
+
// -------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
it('should handle null input', () => {
|
|
66
|
+
// expect(() => {{FUNCTION_NAME}}(null)).toThrowErrorMatchingSnapshot();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should handle undefined input', () => {
|
|
70
|
+
// expect(() => {{FUNCTION_NAME}}(undefined)).toThrowErrorMatchingSnapshot();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should handle invalid type input', () => {
|
|
74
|
+
// expect(() => {{FUNCTION_NAME}}({{INVALID_INPUT}})).toThrowErrorMatchingSnapshot();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// -------------------------------------------------------------------------
|
|
78
|
+
// Side effects — external interactions
|
|
79
|
+
// -------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
it('should call external dependency with correct arguments', () => {
|
|
82
|
+
// const spy = vi.spyOn({{DEPENDENCY}}, '{{METHOD}}');
|
|
83
|
+
// {{FUNCTION_NAME}}({{TYPICAL_INPUT}});
|
|
84
|
+
// expect(spy).toHaveBeenCalledWith({{EXPECTED_ARGS}});
|
|
85
|
+
// expect(spy).toHaveBeenCalledTimes(1);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// -------------------------------------------------------------------------
|
|
89
|
+
// Branching paths — one test per major branch
|
|
90
|
+
// -------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
it('should take branch A when condition is true', () => {
|
|
93
|
+
// const result = {{FUNCTION_NAME}}({{BRANCH_A_INPUT}});
|
|
94
|
+
// expect(result).toMatchSnapshot();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should take branch B when condition is false', () => {
|
|
98
|
+
// const result = {{FUNCTION_NAME}}({{BRANCH_B_INPUT}});
|
|
99
|
+
// expect(result).toMatchSnapshot();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# CLAUDE.md Anti-Patterns
|
|
2
|
+
|
|
3
|
+
## Anti-pattern 1: Discoverable Content
|
|
4
|
+
|
|
5
|
+
**Symptom**: Listing things the agent can find by reading the repo.
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# Bad
|
|
9
|
+
- Components are in src/components/
|
|
10
|
+
- Uses React 18 with TypeScript
|
|
11
|
+
- Run tests with npm test
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
# Good
|
|
16
|
+
(delete these — they're in package.json and the repo structure)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Anti-pattern 2: Instruction Overload
|
|
20
|
+
|
|
21
|
+
**Symptom**: 300+ line CLAUDE.md full of best practices.
|
|
22
|
+
|
|
23
|
+
LLM compliance drops to ~5% after 15+ instructions. Every line competes for attention.
|
|
24
|
+
|
|
25
|
+
Fix: Keep under 150 lines. Move feature-specific rules to SPEC files.
|
|
26
|
+
|
|
27
|
+
## Anti-pattern 3: Emphasis Inflation
|
|
28
|
+
|
|
29
|
+
**Symptom**: IMPORTANT, CRITICAL, MUST on every other line.
|
|
30
|
+
|
|
31
|
+
When everything is critical, nothing is. Reserve emphasis words for P1 rules only.
|
|
32
|
+
|
|
33
|
+
## Anti-pattern 4: Past-Tense History
|
|
34
|
+
|
|
35
|
+
**Symptom**: Phase tables, progress logs, "we decided to..." narratives.
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
# Bad
|
|
39
|
+
## Progress
|
|
40
|
+
- Phase 1 ✅ Auth
|
|
41
|
+
- Phase 2 ✅ Dashboard
|
|
42
|
+
- Phase 3 🚧 Payments
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This is context noise, not guidance. Delete it.
|
|
46
|
+
|
|
47
|
+
## Anti-pattern 5: Technology Anchoring
|
|
48
|
+
|
|
49
|
+
**Symptom**: Listing what you use instead of what to avoid.
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
# Bad
|
|
53
|
+
We use Zod for validation, Prisma for ORM, Tailwind for styling.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
# Good
|
|
58
|
+
Never use joi or yup — Zod is the only validation library.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Naming a technology biases the agent toward it. Only name tech in prohibitions.
|
|
62
|
+
|
|
63
|
+
## Anti-pattern 6: Vague Prohibitions
|
|
64
|
+
|
|
65
|
+
**Symptom**: Rules without specific triggers.
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
# Bad
|
|
69
|
+
- Write clean, readable code
|
|
70
|
+
- Follow best practices
|
|
71
|
+
- Keep functions small
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The agent already knows these. They consume tokens and provide no new signal.
|
|
75
|
+
|
|
76
|
+
## Anti-pattern 7: Missing Boundaries
|
|
77
|
+
|
|
78
|
+
**Symptom**: No section on what the agent should never touch.
|
|
79
|
+
|
|
80
|
+
Without explicit boundaries, agents will "helpfully" refactor generated files, edit lock files, or push to main.
|
|
81
|
+
|
|
82
|
+
Always include: what's off-limits, what requires human approval first.
|
|
83
|
+
|
|
84
|
+
## Anti-pattern 8: Stale Secrets/Keys
|
|
85
|
+
|
|
86
|
+
**Symptom**: API keys or connection strings in CLAUDE.md.
|
|
87
|
+
|
|
88
|
+
These belong in `.env` only. CLAUDE.md is committed to version control.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
{{OPTIONAL: 1-2 sentence description. Only if project purpose is unclear from reading the code.}}
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
{{Only non-obvious commands. Delete commands already in package.json scripts.}}
|
|
8
|
+
|
|
9
|
+
- `{{COMMAND}}` — {{WHY_ORDER_MATTERS_OR_SPECIAL_FLAGS}}
|
|
10
|
+
|
|
11
|
+
## Conventions
|
|
12
|
+
|
|
13
|
+
{{Only what linters/formatters don't enforce automatically.}}
|
|
14
|
+
|
|
15
|
+
- {{CONVENTION}} — {{e.g., "ESM only — imports need .js extension"}}
|
|
16
|
+
|
|
17
|
+
## Gotchas
|
|
18
|
+
|
|
19
|
+
{{Non-discoverable traps an agent will hit without being told.}}
|
|
20
|
+
|
|
21
|
+
- **{{TRAP_TITLE}}.** {{Specific do/don't description.}}
|
|
22
|
+
- **{{TRAP_TITLE}}.** {{Specific do/don't description.}}
|
|
23
|
+
|
|
24
|
+
## Boundaries
|
|
25
|
+
|
|
26
|
+
{{What the agent should never touch or always ask about first.}}
|
|
27
|
+
|
|
28
|
+
Always: {{ALWAYS_DO}}
|
|
29
|
+
Ask first: {{ASK_BEFORE_DOING}}
|
|
30
|
+
Never: {{ABSOLUTE_PROHIBITION}}
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<!--
|
|
35
|
+
FILLING INSTRUCTIONS
|
|
36
|
+
|
|
37
|
+
Size targets:
|
|
38
|
+
- Small project (< 10 files): 20-30 lines
|
|
39
|
+
- Medium project (10-50 files): 60-150 lines
|
|
40
|
+
- Large project / monorepo: 100 lines root + 30 lines per package
|
|
41
|
+
|
|
42
|
+
Placement priority (LLM attention is highest at top and bottom):
|
|
43
|
+
- Top: most critical rules (security, never-do)
|
|
44
|
+
- Middle: background context
|
|
45
|
+
- Bottom: frequently violated rules
|
|
46
|
+
|
|
47
|
+
For each line ask:
|
|
48
|
+
1. Would the agent make a mistake without this? No → delete
|
|
49
|
+
2. Does every session need this? No → move to SPEC or plan file
|
|
50
|
+
3. Does a linter/hook enforce this? Yes → delete
|
|
51
|
+
4. Is this discoverable from code? Yes → delete
|
|
52
|
+
|
|
53
|
+
Delete this comment block before committing.
|
|
54
|
+
-->
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Checkout UX Best Practices Checklist
|
|
2
|
+
|
|
3
|
+
## Cart Review Step
|
|
4
|
+
|
|
5
|
+
- [ ] Cart items show current price, quantity, and subtotal per line
|
|
6
|
+
- [ ] Price change warning shown if item price changed since add-to-cart
|
|
7
|
+
- [ ] Out-of-stock items flagged before user proceeds
|
|
8
|
+
- [ ] Clear "Continue to Checkout" CTA — one primary action per step
|
|
9
|
+
- [ ] Guest checkout option visible (no forced registration)
|
|
10
|
+
|
|
11
|
+
## Shipping & Address Step
|
|
12
|
+
|
|
13
|
+
- [ ] Address autocomplete reduces input friction
|
|
14
|
+
- [ ] Saved addresses surfaced first for logged-in users
|
|
15
|
+
- [ ] Shipping cost displayed before payment (no surprise at confirmation)
|
|
16
|
+
- [ ] Estimated delivery date shown per shipping method
|
|
17
|
+
- [ ] Address validation feedback inline, not on submit
|
|
18
|
+
|
|
19
|
+
## Payment Step
|
|
20
|
+
|
|
21
|
+
- [ ] Supported payment methods visible upfront (icons, labels)
|
|
22
|
+
- [ ] Payment form uses browser autofill attributes (`autocomplete`)
|
|
23
|
+
- [ ] Idempotency key bound to order ID — double-click safe
|
|
24
|
+
- [ ] Loading state on submit button prevents double submission
|
|
25
|
+
- [ ] Clear error messages distinguish user error from system error
|
|
26
|
+
- [ ] PG redirect handles back-button recovery gracefully
|
|
27
|
+
|
|
28
|
+
## Order Confirmation Step
|
|
29
|
+
|
|
30
|
+
- [ ] Order ID prominently displayed (user can reference for support)
|
|
31
|
+
- [ ] Confirmation email sent within 30 seconds of payment success
|
|
32
|
+
- [ ] Summary includes: items, total, shipping address, estimated delivery
|
|
33
|
+
- [ ] Clear next step (track order / continue shopping)
|
|
34
|
+
- [ ] No personal payment data displayed (mask card number)
|
|
35
|
+
|
|
36
|
+
## Error & Edge Cases
|
|
37
|
+
|
|
38
|
+
- [ ] Stock exhausted mid-checkout: clear message, return to cart
|
|
39
|
+
- [ ] Payment timeout: inform user, preserve order state for retry
|
|
40
|
+
- [ ] Session expiry during checkout: preserve cart, redirect to login
|
|
41
|
+
- [ ] Network failure on submit: prevent duplicate submission, show retry CTA
|
|
42
|
+
|
|
43
|
+
## Accessibility & Performance
|
|
44
|
+
|
|
45
|
+
- [ ] Checkout steps announced to screen readers (step X of Y)
|
|
46
|
+
- [ ] Tab order logical through form fields
|
|
47
|
+
- [ ] Core checkout flow works without JavaScript (progressive enhancement)
|
|
48
|
+
- [ ] Page weight under 200 KB per step (no unnecessary third-party scripts)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Product Data Schema Template
|
|
2
|
+
|
|
3
|
+
## Core Product
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
interface Product {
|
|
7
|
+
id: string; // UUID or slug — immutable after creation
|
|
8
|
+
sku: string; // Unique stock keeping unit
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
12
|
+
|
|
13
|
+
pricing: ProductPricing;
|
|
14
|
+
inventory: ProductInventory;
|
|
15
|
+
media: ProductMedia[];
|
|
16
|
+
attributes: ProductAttribute[]; // color, size, material, etc.
|
|
17
|
+
variants: ProductVariant[]; // if applicable
|
|
18
|
+
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Pricing
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
interface ProductPricing {
|
|
28
|
+
currency: string; // ISO 4217 — "KRW", "USD"
|
|
29
|
+
basePrice: number; // In smallest currency unit (cents/원)
|
|
30
|
+
salePrice?: number; // null = no active sale
|
|
31
|
+
salePeriod?: { from: Date; to: Date };
|
|
32
|
+
taxRate: number; // 0.1 = 10%
|
|
33
|
+
taxIncluded: boolean; // Is tax included in basePrice?
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Inventory
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
interface ProductInventory {
|
|
41
|
+
trackInventory: boolean; // false = always in stock (digital goods)
|
|
42
|
+
stock: number; // Current available quantity
|
|
43
|
+
reservedStock: number; // Locked in active checkouts
|
|
44
|
+
lowStockThreshold: number; // Alert when stock <= this value
|
|
45
|
+
backorderAllowed: boolean;
|
|
46
|
+
reservationTtlMinutes: number; // How long to hold reserved stock (default: 15)
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Variant
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
interface ProductVariant {
|
|
54
|
+
id: string;
|
|
55
|
+
sku: string;
|
|
56
|
+
attributes: Record<string, string>; // { color: "red", size: "M" }
|
|
57
|
+
pricing?: Partial<ProductPricing>; // Override base pricing
|
|
58
|
+
inventory: ProductInventory;
|
|
59
|
+
active: boolean;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Cart Line Item (Price Snapshot)
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
interface CartLineItem {
|
|
67
|
+
productId: string;
|
|
68
|
+
variantId?: string;
|
|
69
|
+
quantity: number;
|
|
70
|
+
// Snapshot at add-to-cart time — do not read live price from DB during checkout
|
|
71
|
+
snapshotPrice: number;
|
|
72
|
+
snapshotCurrency: string;
|
|
73
|
+
snapshotName: string;
|
|
74
|
+
addedAt: Date;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Usage Notes
|
|
79
|
+
|
|
80
|
+
- Store `snapshotPrice` in cart to survive price changes — revalidate at checkout entry only
|
|
81
|
+
- `reservedStock + stock` = total physical stock on hand
|
|
82
|
+
- Use `FOR UPDATE` or atomic SQL when decrementing `stock`
|
|
83
|
+
- Archive products instead of deleting — orders reference them
|
|
84
|
+
- `{{CURRENCY}}` — replace with project's primary currency code
|
|
85
|
+
- `{{TAX_RATE}}` — replace with applicable tax rate (e.g., `0.1` for 10% VAT)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: change-analyzer
|
|
3
|
+
role: Analyzes git diff to understand what changed and why
|
|
4
|
+
tools: [Bash, Read, Grep]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Change Analyzer
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
Reads the full git diff and related source files to produce a structured change summary. Distinguishes between what was changed, why it was changed, and what the impact surface is — so message-writer and pr-writer have accurate material.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
- Run `git diff --staged` and `git diff` to capture all pending changes
|
|
14
|
+
- Categorize changes: new feature, bug fix, refactor, config, docs, test
|
|
15
|
+
- Identify the primary motivation for the change (what problem does it solve)
|
|
16
|
+
- List files changed grouped by concern (e.g., business logic, tests, config)
|
|
17
|
+
- Flag any risky changes: deleted files, public API modifications, schema changes
|
|
18
|
+
|
|
19
|
+
## Input
|
|
20
|
+
- Project root path
|
|
21
|
+
- Optional: SPEC or issue reference to cross-check intent
|
|
22
|
+
|
|
23
|
+
## Output
|
|
24
|
+
Change analysis report:
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
## Change Analysis
|
|
28
|
+
|
|
29
|
+
### Category
|
|
30
|
+
bug-fix (primary) + refactor (secondary)
|
|
31
|
+
|
|
32
|
+
### What Changed
|
|
33
|
+
- src/auth.ts: added null check before JWT decode call
|
|
34
|
+
- src/auth.ts: extracted `decodeToken` into standalone function
|
|
35
|
+
- tests/auth.test.ts: added 2 tests for null token edge case
|
|
36
|
+
|
|
37
|
+
### Why It Changed
|
|
38
|
+
JWT decode was called without checking for null token, causing unhandled
|
|
39
|
+
TypeError on unauthenticated requests to protected routes.
|
|
40
|
+
|
|
41
|
+
### Risk Surface
|
|
42
|
+
- Public API: `validateToken()` signature unchanged — safe
|
|
43
|
+
- Behavior change: now returns `null` instead of throwing on invalid token
|
|
44
|
+
|
|
45
|
+
### Files Changed
|
|
46
|
+
- src/auth.ts (logic)
|
|
47
|
+
- tests/auth.test.ts (tests)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Communication
|
|
51
|
+
- Reports findings to: message-writer, pr-writer
|
|
52
|
+
- Receives instructions from: orchestrator (commit-push-pr skill)
|
|
53
|
+
|
|
54
|
+
## Domain Knowledge
|
|
55
|
+
Conventional commit categories: feat, fix, refactor, test, docs, chore, perf, ci. A change is a "fix" only if it corrects incorrect behavior. Categorize by primary intent — a bug fix with refactoring is still "fix".
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: message-writer
|
|
3
|
+
role: Drafts a conventional commit message from the change analysis
|
|
4
|
+
tools: [Read, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Message Writer
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
Produces a well-formed conventional commit message from the change analysis. Follows the Conventional Commits specification. Focuses on communicating the "why" in the body, not repeating the diff in the subject line.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
- Write a subject line: `<type>(<scope>): <imperative summary>` under 72 characters
|
|
14
|
+
- Write a body paragraph explaining motivation and context (not just what changed)
|
|
15
|
+
- Add BREAKING CHANGE footer if public API or behavior changed incompatibly
|
|
16
|
+
- Reference issue/ticket numbers if provided
|
|
17
|
+
- Avoid generic filler ("update code", "fix stuff", "various changes")
|
|
18
|
+
|
|
19
|
+
## Input
|
|
20
|
+
- Change analysis report from change-analyzer
|
|
21
|
+
- Optional: issue number, ticket ID, or SPEC reference
|
|
22
|
+
|
|
23
|
+
## Output
|
|
24
|
+
Ready-to-use commit message:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
fix(auth): handle null token in validateToken to prevent TypeError
|
|
28
|
+
|
|
29
|
+
JWT decode was called without a null guard, causing unhandled TypeErrors
|
|
30
|
+
on unauthenticated requests to protected routes. Now returns null for
|
|
31
|
+
invalid or missing tokens instead of throwing.
|
|
32
|
+
|
|
33
|
+
Closes #142
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Also outputs the git command to apply it:
|
|
37
|
+
```bash
|
|
38
|
+
git commit -m "$(cat <<'EOF'
|
|
39
|
+
fix(auth): handle null token in validateToken to prevent TypeError
|
|
40
|
+
...
|
|
41
|
+
EOF
|
|
42
|
+
)"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Communication
|
|
46
|
+
- Reports findings to: reviewer
|
|
47
|
+
- Receives instructions from: orchestrator (commit-push-pr skill)
|
|
48
|
+
|
|
49
|
+
## Domain Knowledge
|
|
50
|
+
Conventional Commits spec: type(scope): subject. Types: feat, fix, refactor, test, docs, chore, perf, ci, build. Scope is the module or area affected. Subject uses imperative mood ("add" not "added"). Body wraps at 72 chars. Breaking changes go in footer as `BREAKING CHANGE: description`.
|