safeword 0.2.4 → 0.2.6
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/check-3NGQ4NR5.js +129 -0
- package/dist/check-3NGQ4NR5.js.map +1 -0
- package/dist/chunk-2XWIUEQK.js +190 -0
- package/dist/chunk-2XWIUEQK.js.map +1 -0
- package/dist/chunk-GZRQL3SX.js +146 -0
- package/dist/chunk-GZRQL3SX.js.map +1 -0
- package/dist/chunk-ORQHKDT2.js +10 -0
- package/dist/chunk-ORQHKDT2.js.map +1 -0
- package/dist/chunk-W66Z3C5H.js +21 -0
- package/dist/chunk-W66Z3C5H.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +34 -0
- package/dist/cli.js.map +1 -0
- package/dist/diff-Y6QTAW4O.js +166 -0
- package/dist/diff-Y6QTAW4O.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/reset-3ACTIYYE.js +143 -0
- package/dist/reset-3ACTIYYE.js.map +1 -0
- package/dist/setup-AIL5RL45.js +276 -0
- package/dist/setup-AIL5RL45.js.map +1 -0
- package/dist/upgrade-6AR3DHUV.js +134 -0
- package/dist/upgrade-6AR3DHUV.js.map +1 -0
- package/package.json +44 -19
- package/{.safeword → templates}/hooks/agents-md-check.sh +0 -0
- package/{.safeword → templates}/hooks/post-tool.sh +0 -0
- package/{.safeword → templates}/hooks/pre-commit.sh +0 -0
- package/.claude/commands/arch-review.md +0 -32
- package/.claude/commands/lint.md +0 -6
- package/.claude/commands/quality-review.md +0 -13
- package/.claude/commands/setup-linting.md +0 -6
- package/.claude/hooks/auto-lint.sh +0 -6
- package/.claude/hooks/auto-quality-review.sh +0 -170
- package/.claude/hooks/check-linting-sync.sh +0 -17
- package/.claude/hooks/inject-timestamp.sh +0 -6
- package/.claude/hooks/question-protocol.sh +0 -12
- package/.claude/hooks/run-linters.sh +0 -8
- package/.claude/hooks/run-quality-review.sh +0 -76
- package/.claude/hooks/version-check.sh +0 -10
- package/.claude/mcp/README.md +0 -96
- package/.claude/mcp/arcade.sample.json +0 -9
- package/.claude/mcp/context7.sample.json +0 -7
- package/.claude/mcp/playwright.sample.json +0 -7
- package/.claude/settings.json +0 -62
- package/.claude/skills/quality-reviewer/SKILL.md +0 -190
- package/.claude/skills/safeword-quality-reviewer/SKILL.md +0 -13
- package/.env.arcade.example +0 -4
- package/.env.example +0 -11
- package/.gitmodules +0 -4
- package/.safeword/SAFEWORD.md +0 -33
- package/.safeword/eslint/eslint-base.mjs +0 -101
- package/.safeword/guides/architecture-guide.md +0 -404
- package/.safeword/guides/code-philosophy.md +0 -174
- package/.safeword/guides/context-files-guide.md +0 -405
- package/.safeword/guides/data-architecture-guide.md +0 -183
- package/.safeword/guides/design-doc-guide.md +0 -165
- package/.safeword/guides/learning-extraction.md +0 -515
- package/.safeword/guides/llm-instruction-design.md +0 -239
- package/.safeword/guides/llm-prompting.md +0 -95
- package/.safeword/guides/tdd-best-practices.md +0 -570
- package/.safeword/guides/test-definitions-guide.md +0 -243
- package/.safeword/guides/testing-methodology.md +0 -573
- package/.safeword/guides/user-story-guide.md +0 -237
- package/.safeword/guides/zombie-process-cleanup.md +0 -214
- package/.safeword/planning/002-user-story-quality-evaluation.md +0 -1840
- package/.safeword/planning/003-langsmith-eval-setup-prompt.md +0 -363
- package/.safeword/planning/004-llm-eval-test-cases.md +0 -3226
- package/.safeword/planning/005-architecture-enforcement-system.md +0 -169
- package/.safeword/planning/006-reactive-fix-prevention-research.md +0 -135
- package/.safeword/planning/011-cli-ux-vision.md +0 -330
- package/.safeword/planning/012-project-structure-cleanup.md +0 -154
- package/.safeword/planning/README.md +0 -39
- package/.safeword/planning/automation-plan-v2.md +0 -1225
- package/.safeword/planning/automation-plan-v3.md +0 -1291
- package/.safeword/planning/automation-plan.md +0 -3058
- package/.safeword/planning/design/005-cli-implementation.md +0 -343
- package/.safeword/planning/design/013-cli-self-contained-templates.md +0 -596
- package/.safeword/planning/design/013a-eslint-plugin-suite.md +0 -256
- package/.safeword/planning/design/013b-implementation-snippets.md +0 -385
- package/.safeword/planning/design/013c-config-isolation-strategy.md +0 -242
- package/.safeword/planning/design/code-philosophy-improvements.md +0 -60
- package/.safeword/planning/mcp-analysis.md +0 -545
- package/.safeword/planning/phase2-subagents-vs-skills-analysis.md +0 -451
- package/.safeword/planning/settings-improvements.md +0 -970
- package/.safeword/planning/test-definitions/005-cli-implementation.md +0 -1301
- package/.safeword/planning/test-definitions/cli-self-contained-templates.md +0 -205
- package/.safeword/planning/user-stories/001-guides-review-user-stories.md +0 -1381
- package/.safeword/planning/user-stories/003-reactive-fix-prevention.md +0 -132
- package/.safeword/planning/user-stories/004-technical-constraints.md +0 -86
- package/.safeword/planning/user-stories/005-cli-implementation.md +0 -311
- package/.safeword/planning/user-stories/cli-self-contained-templates.md +0 -172
- package/.safeword/planning/versioned-distribution.md +0 -740
- package/.safeword/prompts/arch-review.md +0 -43
- package/.safeword/prompts/quality-review.md +0 -11
- package/.safeword/scripts/arch-review.sh +0 -235
- package/.safeword/scripts/check-linting-sync.sh +0 -58
- package/.safeword/scripts/setup-linting.sh +0 -559
- package/.safeword/templates/architecture-template.md +0 -136
- package/.safeword/templates/ci/architecture-check.yml +0 -79
- package/.safeword/templates/design-doc-template.md +0 -127
- package/.safeword/templates/test-definitions-feature.md +0 -100
- package/.safeword/templates/ticket-template.md +0 -74
- package/.safeword/templates/user-stories-template.md +0 -82
- package/.safeword/tickets/001-guides-review-user-stories.md +0 -83
- package/.safeword/tickets/002-architecture-enforcement.md +0 -211
- package/.safeword/tickets/003-reactive-fix-prevention.md +0 -57
- package/.safeword/tickets/004-technical-constraints-in-user-stories.md +0 -39
- package/.safeword/tickets/005-cli-implementation.md +0 -248
- package/.safeword/tickets/006-flesh-out-skills.md +0 -43
- package/.safeword/tickets/007-flesh-out-questioning.md +0 -44
- package/.safeword/tickets/008-upgrade-questioning.md +0 -58
- package/.safeword/tickets/009-naming-conventions.md +0 -41
- package/.safeword/tickets/010-safeword-md-cleanup.md +0 -34
- package/.safeword/tickets/011-cursor-setup.md +0 -86
- package/.safeword/tickets/README.md +0 -73
- package/.safeword/version +0 -1
- package/AGENTS.md +0 -59
- package/CLAUDE.md +0 -12
- package/README.md +0 -347
- package/docs/001-cli-implementation-plan.md +0 -856
- package/docs/elite-dx-implementation-plan.md +0 -1034
- package/framework/README.md +0 -131
- package/framework/mcp/README.md +0 -96
- package/framework/mcp/arcade.sample.json +0 -8
- package/framework/mcp/context7.sample.json +0 -6
- package/framework/mcp/playwright.sample.json +0 -6
- package/framework/scripts/arch-review.sh +0 -235
- package/framework/scripts/check-linting-sync.sh +0 -58
- package/framework/scripts/load-env.sh +0 -49
- package/framework/scripts/setup-claude.sh +0 -223
- package/framework/scripts/setup-linting.sh +0 -559
- package/framework/scripts/setup-quality.sh +0 -477
- package/framework/scripts/setup-safeword.sh +0 -550
- package/framework/templates/ci/architecture-check.yml +0 -78
- package/learnings/ai-sdk-v5-breaking-changes.md +0 -178
- package/learnings/e2e-test-zombie-processes.md +0 -231
- package/learnings/milkdown-crepe-editor-property.md +0 -96
- package/learnings/prosemirror-fragment-traversal.md +0 -119
- package/packages/cli/AGENTS.md +0 -1
- package/packages/cli/ARCHITECTURE.md +0 -279
- package/packages/cli/package.json +0 -51
- package/packages/cli/src/cli.ts +0 -63
- package/packages/cli/src/commands/check.ts +0 -166
- package/packages/cli/src/commands/diff.ts +0 -209
- package/packages/cli/src/commands/reset.ts +0 -190
- package/packages/cli/src/commands/setup.ts +0 -325
- package/packages/cli/src/commands/upgrade.ts +0 -163
- package/packages/cli/src/index.ts +0 -3
- package/packages/cli/src/templates/config.ts +0 -58
- package/packages/cli/src/templates/content.ts +0 -18
- package/packages/cli/src/templates/index.ts +0 -12
- package/packages/cli/src/utils/agents-md.ts +0 -66
- package/packages/cli/src/utils/fs.ts +0 -179
- package/packages/cli/src/utils/git.ts +0 -124
- package/packages/cli/src/utils/hooks.ts +0 -29
- package/packages/cli/src/utils/output.ts +0 -60
- package/packages/cli/src/utils/project-detector.test.ts +0 -185
- package/packages/cli/src/utils/project-detector.ts +0 -44
- package/packages/cli/src/utils/version.ts +0 -28
- package/packages/cli/src/version.ts +0 -6
- package/packages/cli/templates/SAFEWORD.md +0 -776
- package/packages/cli/templates/doc-templates/architecture-template.md +0 -136
- package/packages/cli/templates/doc-templates/design-doc-template.md +0 -134
- package/packages/cli/templates/doc-templates/test-definitions-feature.md +0 -131
- package/packages/cli/templates/doc-templates/ticket-template.md +0 -82
- package/packages/cli/templates/doc-templates/user-stories-template.md +0 -92
- package/packages/cli/templates/guides/architecture-guide.md +0 -423
- package/packages/cli/templates/guides/code-philosophy.md +0 -195
- package/packages/cli/templates/guides/context-files-guide.md +0 -457
- package/packages/cli/templates/guides/data-architecture-guide.md +0 -200
- package/packages/cli/templates/guides/design-doc-guide.md +0 -171
- package/packages/cli/templates/guides/learning-extraction.md +0 -552
- package/packages/cli/templates/guides/llm-instruction-design.md +0 -248
- package/packages/cli/templates/guides/llm-prompting.md +0 -102
- package/packages/cli/templates/guides/tdd-best-practices.md +0 -615
- package/packages/cli/templates/guides/test-definitions-guide.md +0 -334
- package/packages/cli/templates/guides/testing-methodology.md +0 -618
- package/packages/cli/templates/guides/user-story-guide.md +0 -256
- package/packages/cli/templates/guides/zombie-process-cleanup.md +0 -219
- package/packages/cli/templates/hooks/agents-md-check.sh +0 -27
- package/packages/cli/templates/hooks/post-tool.sh +0 -4
- package/packages/cli/templates/hooks/pre-commit.sh +0 -10
- package/packages/cli/templates/prompts/arch-review.md +0 -43
- package/packages/cli/templates/prompts/quality-review.md +0 -10
- package/packages/cli/templates/skills/safeword-quality-reviewer/SKILL.md +0 -207
- package/packages/cli/tests/commands/check.test.ts +0 -129
- package/packages/cli/tests/commands/cli.test.ts +0 -89
- package/packages/cli/tests/commands/diff.test.ts +0 -115
- package/packages/cli/tests/commands/reset.test.ts +0 -310
- package/packages/cli/tests/commands/self-healing.test.ts +0 -170
- package/packages/cli/tests/commands/setup-blocking.test.ts +0 -71
- package/packages/cli/tests/commands/setup-core.test.ts +0 -135
- package/packages/cli/tests/commands/setup-git.test.ts +0 -139
- package/packages/cli/tests/commands/setup-hooks.test.ts +0 -334
- package/packages/cli/tests/commands/setup-linting.test.ts +0 -189
- package/packages/cli/tests/commands/setup-noninteractive.test.ts +0 -80
- package/packages/cli/tests/commands/setup-templates.test.ts +0 -181
- package/packages/cli/tests/commands/upgrade.test.ts +0 -215
- package/packages/cli/tests/helpers.ts +0 -243
- package/packages/cli/tests/npm-package.test.ts +0 -83
- package/packages/cli/tests/technical-constraints.test.ts +0 -96
- package/packages/cli/tsconfig.json +0 -25
- package/packages/cli/tsup.config.ts +0 -11
- package/packages/cli/vitest.config.ts +0 -23
- package/promptfoo.yaml +0 -3270
- /package/{framework → templates}/SAFEWORD.md +0 -0
- /package/{packages/cli/templates → templates}/commands/arch-review.md +0 -0
- /package/{packages/cli/templates → templates}/commands/lint.md +0 -0
- /package/{packages/cli/templates → templates}/commands/quality-review.md +0 -0
- /package/{framework/templates → templates/doc-templates}/architecture-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/design-doc-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/test-definitions-feature.md +0 -0
- /package/{framework/templates → templates/doc-templates}/ticket-template.md +0 -0
- /package/{framework/templates → templates/doc-templates}/user-stories-template.md +0 -0
- /package/{framework → templates}/guides/architecture-guide.md +0 -0
- /package/{framework → templates}/guides/code-philosophy.md +0 -0
- /package/{framework → templates}/guides/context-files-guide.md +0 -0
- /package/{framework → templates}/guides/data-architecture-guide.md +0 -0
- /package/{framework → templates}/guides/design-doc-guide.md +0 -0
- /package/{framework → templates}/guides/learning-extraction.md +0 -0
- /package/{framework → templates}/guides/llm-instruction-design.md +0 -0
- /package/{framework → templates}/guides/llm-prompting.md +0 -0
- /package/{framework → templates}/guides/tdd-best-practices.md +0 -0
- /package/{framework → templates}/guides/test-definitions-guide.md +0 -0
- /package/{framework → templates}/guides/testing-methodology.md +0 -0
- /package/{framework → templates}/guides/user-story-guide.md +0 -0
- /package/{framework → templates}/guides/zombie-process-cleanup.md +0 -0
- /package/{packages/cli/templates → templates}/hooks/inject-timestamp.sh +0 -0
- /package/{packages/cli/templates → templates}/lib/common.sh +0 -0
- /package/{packages/cli/templates → templates}/lib/jq-fallback.sh +0 -0
- /package/{packages/cli/templates → templates}/markdownlint.jsonc +0 -0
- /package/{framework → templates}/prompts/arch-review.md +0 -0
- /package/{framework → templates}/prompts/quality-review.md +0 -0
- /package/{framework/skills/quality-reviewer → templates/skills/safeword-quality-reviewer}/SKILL.md +0 -0
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: quality-reviewer
|
|
3
|
-
description: Deep code quality review with web research. Use when user explicitly requests verification against latest docs ('double check against latest', 'verify versions', 'check security'), needs deeper analysis beyond automatic hook, or is working on projects without SAFEWORD.md/CLAUDE.md. Fetches current documentation (WebFetch), checks latest versions (WebSearch), and provides deep analysis (performance, security, alternatives).
|
|
4
|
-
allowed-tools: '*'
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Quality Reviewer
|
|
8
|
-
|
|
9
|
-
Deep quality review with web research to verify code against the latest ecosystem state.
|
|
10
|
-
|
|
11
|
-
**Primary differentiator**: Web research (WebSearch, WebFetch) to verify against current versions, documentation, and best practices.
|
|
12
|
-
|
|
13
|
-
**Triggers**:
|
|
14
|
-
|
|
15
|
-
- **Explicit web research request**: "double check against latest docs", "verify we're using latest version", "check for security issues"
|
|
16
|
-
- **Deep dive needed**: User wants analysis beyond automatic hook (performance, architecture alternatives, trade-offs)
|
|
17
|
-
- **No SAFEWORD.md/CLAUDE.md**: Projects without context files (automatic hook won't run, manual review needed)
|
|
18
|
-
- **Pre-change review**: User wants review before making changes (automatic hook only triggers after changes)
|
|
19
|
-
- **Model-invoked**: Claude determines web research would be valuable
|
|
20
|
-
|
|
21
|
-
**Relationship to automatic quality hook**:
|
|
22
|
-
|
|
23
|
-
- **Automatic hook**: Fast quality check using existing knowledge + project context (guaranteed, runs on every change)
|
|
24
|
-
- **This skill**: Deep review with web research when verification against current ecosystem is needed (on-demand, 2-3 min)
|
|
25
|
-
|
|
26
|
-
## Review Protocol
|
|
27
|
-
|
|
28
|
-
### 1. Identify What Changed
|
|
29
|
-
|
|
30
|
-
Understand context:
|
|
31
|
-
|
|
32
|
-
- What files were just modified?
|
|
33
|
-
- What problem is being solved?
|
|
34
|
-
- What was the implementation approach?
|
|
35
|
-
|
|
36
|
-
### 2. Read Project Standards
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
ls CLAUDE.md SAFEWORD.md ARCHITECTURE.md .claude/
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Read relevant standards:
|
|
43
|
-
|
|
44
|
-
- `CLAUDE.md` or `SAFEWORD.md` - Project-specific guidelines
|
|
45
|
-
- `ARCHITECTURE.md` - Architectural principles
|
|
46
|
-
- `@./.safeword/guides/code-philosophy.md` - Core coding principles
|
|
47
|
-
|
|
48
|
-
### 3. Evaluate Correctness
|
|
49
|
-
|
|
50
|
-
**Will it work?**
|
|
51
|
-
|
|
52
|
-
- Does the logic make sense?
|
|
53
|
-
- Are there obvious bugs?
|
|
54
|
-
|
|
55
|
-
**Edge cases:**
|
|
56
|
-
|
|
57
|
-
- Empty inputs, null/undefined, boundary conditions (0, -1, max)?
|
|
58
|
-
- Concurrent access, network failures?
|
|
59
|
-
|
|
60
|
-
**Error handling:**
|
|
61
|
-
|
|
62
|
-
- Are errors caught appropriately?
|
|
63
|
-
- Helpful error messages?
|
|
64
|
-
- Cleanup handled (resources, connections)?
|
|
65
|
-
|
|
66
|
-
**Logic errors:**
|
|
67
|
-
|
|
68
|
-
- Off-by-one errors, race conditions, wrong assumptions?
|
|
69
|
-
|
|
70
|
-
### 4. Evaluate Anti-Bloat
|
|
71
|
-
|
|
72
|
-
- Are all dependencies necessary? Could we use stdlib/built-ins?
|
|
73
|
-
- Are abstractions solving real problems or imaginary ones?
|
|
74
|
-
- YAGNI: Is this feature actually needed now?
|
|
75
|
-
|
|
76
|
-
### 5. Evaluate Elegance
|
|
77
|
-
|
|
78
|
-
- Is the code easy to understand?
|
|
79
|
-
- Are names clear and descriptive?
|
|
80
|
-
- Is the intent obvious?
|
|
81
|
-
- Will this be easy to change later?
|
|
82
|
-
|
|
83
|
-
### 6. Check Standards Compliance
|
|
84
|
-
|
|
85
|
-
**Project standards** (from CLAUDE.md/SAFEWORD.md/ARCHITECTURE.md):
|
|
86
|
-
|
|
87
|
-
- Does it follow established patterns?
|
|
88
|
-
- Does it violate any documented principles?
|
|
89
|
-
|
|
90
|
-
**Library best practices:**
|
|
91
|
-
|
|
92
|
-
- Are we using libraries correctly?
|
|
93
|
-
- Are we following official documentation?
|
|
94
|
-
|
|
95
|
-
### 7. Verify Latest Versions ⭐ **PRIMARY VALUE**
|
|
96
|
-
|
|
97
|
-
**CRITICAL**: This is your main differentiator from automatic hook. ALWAYS check versions.
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
WebSearch: "[library name] latest stable version 2025"
|
|
101
|
-
WebSearch: "[library name] security vulnerabilities"
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Flag if outdated:**
|
|
105
|
-
|
|
106
|
-
- Major versions behind → WARN (e.g., React 17 when 19 is stable)
|
|
107
|
-
- Minor versions behind → NOTE (e.g., React 19.0.0 when 19.1.0 is stable)
|
|
108
|
-
- Security vulnerabilities → CRITICAL (must upgrade)
|
|
109
|
-
- Using latest → Confirm
|
|
110
|
-
|
|
111
|
-
**Common libraries**: React, TypeScript, Vite, Next.js, Node.js, Vitest, Playwright, Jest, esbuild
|
|
112
|
-
|
|
113
|
-
**Check even if dependencies didn't change** - User might be using outdated patterns.
|
|
114
|
-
|
|
115
|
-
### 8. Verify Latest Documentation ⭐ **PRIMARY VALUE**
|
|
116
|
-
|
|
117
|
-
**CRITICAL**: This is your main differentiator from automatic hook. ALWAYS verify against current docs.
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
WebFetch: https://react.dev (for React)
|
|
121
|
-
WebFetch: https://vitejs.dev (for Vite)
|
|
122
|
-
WebFetch: https://www.electronjs.org/docs (for Electron)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Look for:**
|
|
126
|
-
|
|
127
|
-
- Are we using deprecated APIs?
|
|
128
|
-
- Are there newer, better patterns?
|
|
129
|
-
- Did the library's recommendations change since training data?
|
|
130
|
-
|
|
131
|
-
**Cache results**: If you checked docs recently in this session, don't re-fetch.
|
|
132
|
-
|
|
133
|
-
## Output Format
|
|
134
|
-
|
|
135
|
-
**Simple question** ("is it correct?"):
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
**Correctness:** ✓ Logic is sound, edge cases handled, no obvious errors.
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Full review** ("double check and critique"):
|
|
142
|
-
|
|
143
|
-
```markdown
|
|
144
|
-
## Quality Review
|
|
145
|
-
|
|
146
|
-
**Correctness:** [✓/⚠️/❌] [Brief assessment]
|
|
147
|
-
**Anti-Bloat:** [✓/⚠️/❌] [Brief assessment]
|
|
148
|
-
**Elegance:** [✓/⚠️/❌] [Brief assessment]
|
|
149
|
-
**Standards:** [✓/⚠️/❌] [Brief assessment]
|
|
150
|
-
**Versions:** [✓/⚠️/❌] [Latest version check with WebSearch]
|
|
151
|
-
**Documentation:** [✓/⚠️/❌] [Current docs check with WebFetch]
|
|
152
|
-
|
|
153
|
-
**Verdict:** [APPROVE / REQUEST CHANGES / NEEDS DISCUSSION]
|
|
154
|
-
|
|
155
|
-
**Critical issues:** [List or "None"]
|
|
156
|
-
**Suggested improvements:** [List or "None"]
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Use structured format for "double check"/"critique". Use brief format for specific questions.
|
|
160
|
-
|
|
161
|
-
## Example: Full Review
|
|
162
|
-
|
|
163
|
-
```markdown
|
|
164
|
-
## Quality Review
|
|
165
|
-
|
|
166
|
-
**Correctness:** ✓ Logic sound, edge cases covered, error handling adequate
|
|
167
|
-
**Anti-Bloat:** ✓ Minimal dependencies, appropriate abstractions
|
|
168
|
-
**Elegance:** ✓ Clear code, good naming, well-structured
|
|
169
|
-
**Standards:** ✓ Follows CLAUDE.md patterns
|
|
170
|
-
**Versions:** ✓ React 19.0.0 (latest stable), TypeScript 5.7.2 (latest)
|
|
171
|
-
**Documentation:** ✓ Using current React patterns per https://react.dev
|
|
172
|
-
|
|
173
|
-
**Verdict:** APPROVE - Production ready
|
|
174
|
-
|
|
175
|
-
**Critical issues:** None
|
|
176
|
-
**Suggested improvements:** None
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Critical Reminders
|
|
180
|
-
|
|
181
|
-
1. **Primary value: Web research** - Use WebSearch/WebFetch to verify against current ecosystem (versions, docs, security)
|
|
182
|
-
2. **Complement automatic hook** - Hook does fast check with existing knowledge, you do deep dive with web research
|
|
183
|
-
3. **Explicit triggers matter** - "double check against latest docs", "verify versions", "check security" = invoke web research
|
|
184
|
-
4. **Projects without SAFEWORD.md** - Automatic hook won't run, you're the only quality check
|
|
185
|
-
5. **Always check latest docs** - Verify patterns are current, not outdated (WebFetch)
|
|
186
|
-
6. **Always verify versions** - Flag outdated dependencies (WebSearch)
|
|
187
|
-
7. **Be thorough but concise** - Cover all areas but keep explanations brief
|
|
188
|
-
8. **Provide actionable feedback** - Specific line numbers, concrete suggestions
|
|
189
|
-
9. **Clear verdict** - Always end with APPROVE/REQUEST CHANGES/NEEDS DISCUSSION
|
|
190
|
-
10. **Separate critical vs nice-to-have** - User needs to know what's blocking vs optional
|
|
191
|
-
|
|
192
|
-
## Non-Obvious Edge Cases
|
|
193
|
-
|
|
194
|
-
**User requests review after automatic hook ran:**
|
|
195
|
-
|
|
196
|
-
- Acknowledge hook ran: "The automatic quality hook already did a fast check. I'll now do deeper analysis with web research..."
|
|
197
|
-
- Focus on what automatic hook doesn't do: fetch latest docs, verify versions, security checks, performance analysis
|
|
198
|
-
|
|
199
|
-
**WebSearch/WebFetch fails:**
|
|
200
|
-
|
|
201
|
-
- Continue review without version/docs checks
|
|
202
|
-
- Note: "Couldn't verify latest versions/docs, skipping that check"
|
|
203
|
-
|
|
204
|
-
**Project has no CLAUDE.md/SAFEWORD.md:**
|
|
205
|
-
|
|
206
|
-
- Use `@./.safeword/guides/code-philosophy.md` as fallback
|
|
207
|
-
- Note: "No project-specific standards found, using general best practices"
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test Suite 8: Health Check
|
|
3
|
-
*
|
|
4
|
-
* Tests for `safeword check` command.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
8
|
-
import {
|
|
9
|
-
createTempDir,
|
|
10
|
-
removeTempDir,
|
|
11
|
-
createTypeScriptPackageJson,
|
|
12
|
-
createConfiguredProject,
|
|
13
|
-
runCli,
|
|
14
|
-
readTestFile,
|
|
15
|
-
writeTestFile,
|
|
16
|
-
fileExists,
|
|
17
|
-
initGitRepo,
|
|
18
|
-
} from '../helpers';
|
|
19
|
-
import { unlinkSync } from 'node:fs';
|
|
20
|
-
import { join } from 'node:path';
|
|
21
|
-
|
|
22
|
-
describe('Test Suite 8: Health Check', () => {
|
|
23
|
-
let tempDir: string;
|
|
24
|
-
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
tempDir = createTempDir();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
afterEach(() => {
|
|
30
|
-
removeTempDir(tempDir);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('Test 8.1: Shows CLI version', () => {
|
|
34
|
-
it('should display CLI version', async () => {
|
|
35
|
-
await createConfiguredProject(tempDir);
|
|
36
|
-
|
|
37
|
-
const result = await runCli(['check'], { cwd: tempDir });
|
|
38
|
-
|
|
39
|
-
expect(result.exitCode).toBe(0);
|
|
40
|
-
expect(result.stdout.toLowerCase()).toMatch(/cli|safeword/i);
|
|
41
|
-
expect(result.stdout).toMatch(/\d+\.\d+\.\d+/); // semver pattern
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
describe('Test 8.2: Shows project config version', () => {
|
|
46
|
-
it('should display version from .safeword/version', async () => {
|
|
47
|
-
await createConfiguredProject(tempDir);
|
|
48
|
-
|
|
49
|
-
const result = await runCli(['check'], { cwd: tempDir });
|
|
50
|
-
|
|
51
|
-
expect(result.exitCode).toBe(0);
|
|
52
|
-
expect(result.stdout.toLowerCase()).toMatch(/project|config/i);
|
|
53
|
-
|
|
54
|
-
// Should show the version from .safeword/version
|
|
55
|
-
const projectVersion = readTestFile(tempDir, '.safeword/version').trim();
|
|
56
|
-
expect(result.stdout).toContain(projectVersion);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe('Test 8.3: Shows update available', () => {
|
|
61
|
-
it('should indicate when update is available', async () => {
|
|
62
|
-
await createConfiguredProject(tempDir);
|
|
63
|
-
|
|
64
|
-
// Write an older version
|
|
65
|
-
writeTestFile(tempDir, '.safeword/version', '0.0.1');
|
|
66
|
-
|
|
67
|
-
const result = await runCli(['check'], { cwd: tempDir });
|
|
68
|
-
|
|
69
|
-
expect(result.exitCode).toBe(0);
|
|
70
|
-
// Should mention available update or version difference
|
|
71
|
-
expect(result.stdout.toLowerCase()).toMatch(/update|available|upgrade|newer/i);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('Test 8.4: Unconfigured project message', () => {
|
|
76
|
-
it('should show not configured message', async () => {
|
|
77
|
-
createTypeScriptPackageJson(tempDir);
|
|
78
|
-
// No setup run
|
|
79
|
-
|
|
80
|
-
const result = await runCli(['check'], { cwd: tempDir });
|
|
81
|
-
|
|
82
|
-
expect(result.exitCode).toBe(0);
|
|
83
|
-
expect(result.stdout.toLowerCase()).toContain('not configured');
|
|
84
|
-
expect(result.stdout.toLowerCase()).toContain('setup');
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe('Test 8.5: Graceful timeout on version check', () => {
|
|
89
|
-
it('should handle network timeout gracefully', async () => {
|
|
90
|
-
await createConfiguredProject(tempDir);
|
|
91
|
-
|
|
92
|
-
// This test verifies the check completes without hanging
|
|
93
|
-
// Network mocking would be needed for full timeout simulation
|
|
94
|
-
const result = await runCli(['check'], {
|
|
95
|
-
cwd: tempDir,
|
|
96
|
-
timeout: 10000,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
expect(result.exitCode).toBe(0);
|
|
100
|
-
// Should either show version info or timeout message
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('Test 8.6: --offline skips version check', () => {
|
|
105
|
-
it('should skip remote version check', async () => {
|
|
106
|
-
await createConfiguredProject(tempDir);
|
|
107
|
-
|
|
108
|
-
const result = await runCli(['check', '--offline'], { cwd: tempDir });
|
|
109
|
-
|
|
110
|
-
expect(result.exitCode).toBe(0);
|
|
111
|
-
// Should show local versions only
|
|
112
|
-
expect(result.stdout).toMatch(/\d+\.\d+\.\d+/);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
describe('Test 8.7: Detects corrupted .safeword structure', () => {
|
|
117
|
-
it('should detect missing critical files', async () => {
|
|
118
|
-
await createConfiguredProject(tempDir);
|
|
119
|
-
|
|
120
|
-
// Delete a critical file
|
|
121
|
-
unlinkSync(join(tempDir, '.safeword/SAFEWORD.md'));
|
|
122
|
-
|
|
123
|
-
const result = await runCli(['check'], { cwd: tempDir });
|
|
124
|
-
|
|
125
|
-
expect(result.exitCode).toBe(0); // Warning, not failure
|
|
126
|
-
expect(result.stdout.toLowerCase()).toMatch(/missing|issue|repair|upgrade/i);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test Suite 1: Version and Help
|
|
3
|
-
*
|
|
4
|
-
* Tests for CLI entry point, version display, and help output.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect } from 'vitest';
|
|
8
|
-
import { runCli, runCliSync } from '../helpers';
|
|
9
|
-
|
|
10
|
-
describe('Test Suite 1: Version and Help', () => {
|
|
11
|
-
describe('Test 1.1: --version flag shows CLI version', () => {
|
|
12
|
-
it('should output version matching semver pattern', async () => {
|
|
13
|
-
const result = await runCli(['--version']);
|
|
14
|
-
|
|
15
|
-
expect(result.exitCode).toBe(0);
|
|
16
|
-
// Matches semver: X.Y.Z with optional prerelease/build metadata
|
|
17
|
-
expect(result.stdout.trim()).toMatch(/^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should return exit code 0', () => {
|
|
21
|
-
const result = runCliSync(['--version']);
|
|
22
|
-
expect(result.exitCode).toBe(0);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('Test 1.2: --help flag shows help text', () => {
|
|
27
|
-
it('should display comprehensive help with all commands', async () => {
|
|
28
|
-
const result = await runCli(['--help']);
|
|
29
|
-
|
|
30
|
-
expect(result.exitCode).toBe(0);
|
|
31
|
-
|
|
32
|
-
const output = result.stdout;
|
|
33
|
-
|
|
34
|
-
// All commands should be listed
|
|
35
|
-
expect(output).toContain('setup');
|
|
36
|
-
expect(output).toContain('check');
|
|
37
|
-
expect(output).toContain('upgrade');
|
|
38
|
-
expect(output).toContain('diff');
|
|
39
|
-
expect(output).toContain('reset');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should display all global flags', async () => {
|
|
43
|
-
const result = await runCli(['--help']);
|
|
44
|
-
|
|
45
|
-
expect(result.exitCode).toBe(0);
|
|
46
|
-
|
|
47
|
-
const output = result.stdout;
|
|
48
|
-
|
|
49
|
-
// Global flags
|
|
50
|
-
expect(output).toMatch(/--version|-V/);
|
|
51
|
-
expect(output).toMatch(/--help|-h/);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should display command-specific flags in command help', async () => {
|
|
55
|
-
// Check setup --help for --yes flag
|
|
56
|
-
const setupHelp = await runCli(['setup', '--help']);
|
|
57
|
-
expect(setupHelp.stdout).toMatch(/--yes|-y/);
|
|
58
|
-
|
|
59
|
-
// Check diff --help for --verbose flag
|
|
60
|
-
const diffHelp = await runCli(['diff', '--help']);
|
|
61
|
-
expect(diffHelp.stdout).toMatch(/--verbose|-v/);
|
|
62
|
-
|
|
63
|
-
// Check check --help for --offline flag
|
|
64
|
-
const checkHelp = await runCli(['check', '--help']);
|
|
65
|
-
expect(checkHelp.stdout).toContain('--offline');
|
|
66
|
-
|
|
67
|
-
// Check reset --help for --yes flag
|
|
68
|
-
const resetHelp = await runCli(['reset', '--help']);
|
|
69
|
-
expect(resetHelp.stdout).toMatch(/--yes|-y/);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('Test 1.3: Bare command shows help', () => {
|
|
74
|
-
it('should show help when run with no arguments', async () => {
|
|
75
|
-
const bareResult = await runCli([]);
|
|
76
|
-
const helpResult = await runCli(['--help']);
|
|
77
|
-
|
|
78
|
-
expect(bareResult.exitCode).toBe(0);
|
|
79
|
-
|
|
80
|
-
// Should have similar content to --help
|
|
81
|
-
// (Commander may format slightly differently, so check key content)
|
|
82
|
-
expect(bareResult.stdout).toContain('setup');
|
|
83
|
-
expect(bareResult.stdout).toContain('check');
|
|
84
|
-
expect(bareResult.stdout).toContain('upgrade');
|
|
85
|
-
expect(bareResult.stdout).toContain('diff');
|
|
86
|
-
expect(bareResult.stdout).toContain('reset');
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test Suite 10: Diff
|
|
3
|
-
*
|
|
4
|
-
* Tests for `safeword diff` command.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
8
|
-
import {
|
|
9
|
-
createTempDir,
|
|
10
|
-
removeTempDir,
|
|
11
|
-
createTypeScriptPackageJson,
|
|
12
|
-
createConfiguredProject,
|
|
13
|
-
runCli,
|
|
14
|
-
writeTestFile,
|
|
15
|
-
} from '../helpers';
|
|
16
|
-
|
|
17
|
-
describe('Test Suite 10: Diff', () => {
|
|
18
|
-
let tempDir: string;
|
|
19
|
-
|
|
20
|
-
beforeEach(() => {
|
|
21
|
-
tempDir = createTempDir();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
removeTempDir(tempDir);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
describe('Test 10.1: Shows summary by default', () => {
|
|
29
|
-
it('should show file counts without full diff', async () => {
|
|
30
|
-
await createConfiguredProject(tempDir);
|
|
31
|
-
|
|
32
|
-
// Modify version to create differences
|
|
33
|
-
writeTestFile(tempDir, '.safeword/version', '0.0.1');
|
|
34
|
-
|
|
35
|
-
const result = await runCli(['diff'], { cwd: tempDir });
|
|
36
|
-
|
|
37
|
-
expect(result.exitCode).toBe(0);
|
|
38
|
-
|
|
39
|
-
// Should show counts
|
|
40
|
-
expect(result.stdout).toMatch(/\d+/);
|
|
41
|
-
|
|
42
|
-
// Should NOT show full diff markers by default
|
|
43
|
-
expect(result.stdout).not.toMatch(/^[+-]{3}/m);
|
|
44
|
-
expect(result.stdout).not.toMatch(/^@@/m);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('Test 10.2: Lists files by category', () => {
|
|
49
|
-
it('should categorize files as Added, Modified, or Unchanged', async () => {
|
|
50
|
-
await createConfiguredProject(tempDir);
|
|
51
|
-
|
|
52
|
-
// Create a difference
|
|
53
|
-
writeTestFile(tempDir, '.safeword/version', '0.0.1');
|
|
54
|
-
|
|
55
|
-
const result = await runCli(['diff'], { cwd: tempDir });
|
|
56
|
-
|
|
57
|
-
expect(result.exitCode).toBe(0);
|
|
58
|
-
|
|
59
|
-
// Should have some categorization
|
|
60
|
-
const output = result.stdout.toLowerCase();
|
|
61
|
-
expect(output).toMatch(/add|modif|chang|updat|unchanged/i);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('Test 10.3: Shows version transition', () => {
|
|
66
|
-
it('should show from/to versions', async () => {
|
|
67
|
-
await createConfiguredProject(tempDir);
|
|
68
|
-
|
|
69
|
-
// Set older project version
|
|
70
|
-
writeTestFile(tempDir, '.safeword/version', '1.0.0');
|
|
71
|
-
|
|
72
|
-
const result = await runCli(['diff'], { cwd: tempDir });
|
|
73
|
-
|
|
74
|
-
expect(result.exitCode).toBe(0);
|
|
75
|
-
|
|
76
|
-
// Should show version info
|
|
77
|
-
expect(result.stdout).toContain('1.0.0');
|
|
78
|
-
// Should show transition (→ or similar)
|
|
79
|
-
expect(result.stdout).toMatch(/→|->|to|from/);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe('Test 10.4: --verbose shows full diff', () => {
|
|
84
|
-
it('should show unified diff with --verbose', async () => {
|
|
85
|
-
await createConfiguredProject(tempDir);
|
|
86
|
-
|
|
87
|
-
// Create a modification
|
|
88
|
-
writeTestFile(tempDir, '.safeword/SAFEWORD.md', '# Modified\n');
|
|
89
|
-
|
|
90
|
-
const result = await runCli(['diff', '--verbose'], { cwd: tempDir });
|
|
91
|
-
|
|
92
|
-
expect(result.exitCode).toBe(0);
|
|
93
|
-
|
|
94
|
-
// Should show unified diff format
|
|
95
|
-
// --- file
|
|
96
|
-
// +++ file
|
|
97
|
-
// @@ line numbers @@
|
|
98
|
-
expect(result.stdout).toMatch(/^---/m);
|
|
99
|
-
expect(result.stdout).toMatch(/^\+\+\+/m);
|
|
100
|
-
expect(result.stdout).toMatch(/^@@.*@@/m);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('Test 10.5: Unconfigured project error', () => {
|
|
105
|
-
it('should error on unconfigured project', async () => {
|
|
106
|
-
createTypeScriptPackageJson(tempDir);
|
|
107
|
-
// No setup
|
|
108
|
-
|
|
109
|
-
const result = await runCli(['diff'], { cwd: tempDir });
|
|
110
|
-
|
|
111
|
-
expect(result.exitCode).toBe(1);
|
|
112
|
-
expect(result.stderr.toLowerCase()).toContain('not configured');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
});
|