safeword 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/check-3NGQ4NR5.js +129 -0
  2. package/dist/check-3NGQ4NR5.js.map +1 -0
  3. package/dist/chunk-2XWIUEQK.js +190 -0
  4. package/dist/chunk-2XWIUEQK.js.map +1 -0
  5. package/dist/chunk-GZRQL3SX.js +146 -0
  6. package/dist/chunk-GZRQL3SX.js.map +1 -0
  7. package/dist/chunk-ORQHKDT2.js +10 -0
  8. package/dist/chunk-ORQHKDT2.js.map +1 -0
  9. package/dist/chunk-W66Z3C5H.js +21 -0
  10. package/dist/chunk-W66Z3C5H.js.map +1 -0
  11. package/dist/cli.d.ts +1 -0
  12. package/dist/cli.js +34 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/diff-Y6QTAW4O.js +166 -0
  15. package/dist/diff-Y6QTAW4O.js.map +1 -0
  16. package/dist/index.d.ts +11 -0
  17. package/dist/index.js +7 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/reset-3ACTIYYE.js +143 -0
  20. package/dist/reset-3ACTIYYE.js.map +1 -0
  21. package/dist/setup-RR4M334C.js +266 -0
  22. package/dist/setup-RR4M334C.js.map +1 -0
  23. package/dist/upgrade-6AR3DHUV.js +134 -0
  24. package/dist/upgrade-6AR3DHUV.js.map +1 -0
  25. package/package.json +44 -19
  26. package/{.safeword → templates}/hooks/agents-md-check.sh +0 -0
  27. package/{.safeword → templates}/hooks/post-tool.sh +0 -0
  28. package/{.safeword → templates}/hooks/pre-commit.sh +0 -0
  29. package/.claude/commands/arch-review.md +0 -32
  30. package/.claude/commands/lint.md +0 -6
  31. package/.claude/commands/quality-review.md +0 -13
  32. package/.claude/commands/setup-linting.md +0 -6
  33. package/.claude/hooks/auto-lint.sh +0 -6
  34. package/.claude/hooks/auto-quality-review.sh +0 -170
  35. package/.claude/hooks/check-linting-sync.sh +0 -17
  36. package/.claude/hooks/inject-timestamp.sh +0 -6
  37. package/.claude/hooks/question-protocol.sh +0 -12
  38. package/.claude/hooks/run-linters.sh +0 -8
  39. package/.claude/hooks/run-quality-review.sh +0 -76
  40. package/.claude/hooks/version-check.sh +0 -10
  41. package/.claude/mcp/README.md +0 -96
  42. package/.claude/mcp/arcade.sample.json +0 -9
  43. package/.claude/mcp/context7.sample.json +0 -7
  44. package/.claude/mcp/playwright.sample.json +0 -7
  45. package/.claude/settings.json +0 -62
  46. package/.claude/skills/quality-reviewer/SKILL.md +0 -190
  47. package/.claude/skills/safeword-quality-reviewer/SKILL.md +0 -13
  48. package/.env.arcade.example +0 -4
  49. package/.env.example +0 -11
  50. package/.gitmodules +0 -4
  51. package/.safeword/SAFEWORD.md +0 -33
  52. package/.safeword/eslint/eslint-base.mjs +0 -101
  53. package/.safeword/guides/architecture-guide.md +0 -404
  54. package/.safeword/guides/code-philosophy.md +0 -174
  55. package/.safeword/guides/context-files-guide.md +0 -405
  56. package/.safeword/guides/data-architecture-guide.md +0 -183
  57. package/.safeword/guides/design-doc-guide.md +0 -165
  58. package/.safeword/guides/learning-extraction.md +0 -515
  59. package/.safeword/guides/llm-instruction-design.md +0 -239
  60. package/.safeword/guides/llm-prompting.md +0 -95
  61. package/.safeword/guides/tdd-best-practices.md +0 -570
  62. package/.safeword/guides/test-definitions-guide.md +0 -243
  63. package/.safeword/guides/testing-methodology.md +0 -573
  64. package/.safeword/guides/user-story-guide.md +0 -237
  65. package/.safeword/guides/zombie-process-cleanup.md +0 -214
  66. package/.safeword/planning/002-user-story-quality-evaluation.md +0 -1840
  67. package/.safeword/planning/003-langsmith-eval-setup-prompt.md +0 -363
  68. package/.safeword/planning/004-llm-eval-test-cases.md +0 -3226
  69. package/.safeword/planning/005-architecture-enforcement-system.md +0 -169
  70. package/.safeword/planning/006-reactive-fix-prevention-research.md +0 -135
  71. package/.safeword/planning/011-cli-ux-vision.md +0 -330
  72. package/.safeword/planning/012-project-structure-cleanup.md +0 -154
  73. package/.safeword/planning/README.md +0 -39
  74. package/.safeword/planning/automation-plan-v2.md +0 -1225
  75. package/.safeword/planning/automation-plan-v3.md +0 -1291
  76. package/.safeword/planning/automation-plan.md +0 -3058
  77. package/.safeword/planning/design/005-cli-implementation.md +0 -343
  78. package/.safeword/planning/design/013-cli-self-contained-templates.md +0 -596
  79. package/.safeword/planning/design/013a-eslint-plugin-suite.md +0 -256
  80. package/.safeword/planning/design/013b-implementation-snippets.md +0 -385
  81. package/.safeword/planning/design/013c-config-isolation-strategy.md +0 -242
  82. package/.safeword/planning/design/code-philosophy-improvements.md +0 -60
  83. package/.safeword/planning/mcp-analysis.md +0 -545
  84. package/.safeword/planning/phase2-subagents-vs-skills-analysis.md +0 -451
  85. package/.safeword/planning/settings-improvements.md +0 -970
  86. package/.safeword/planning/test-definitions/005-cli-implementation.md +0 -1301
  87. package/.safeword/planning/test-definitions/cli-self-contained-templates.md +0 -205
  88. package/.safeword/planning/user-stories/001-guides-review-user-stories.md +0 -1381
  89. package/.safeword/planning/user-stories/003-reactive-fix-prevention.md +0 -132
  90. package/.safeword/planning/user-stories/004-technical-constraints.md +0 -86
  91. package/.safeword/planning/user-stories/005-cli-implementation.md +0 -311
  92. package/.safeword/planning/user-stories/cli-self-contained-templates.md +0 -172
  93. package/.safeword/planning/versioned-distribution.md +0 -740
  94. package/.safeword/prompts/arch-review.md +0 -43
  95. package/.safeword/prompts/quality-review.md +0 -11
  96. package/.safeword/scripts/arch-review.sh +0 -235
  97. package/.safeword/scripts/check-linting-sync.sh +0 -58
  98. package/.safeword/scripts/setup-linting.sh +0 -559
  99. package/.safeword/templates/architecture-template.md +0 -136
  100. package/.safeword/templates/ci/architecture-check.yml +0 -79
  101. package/.safeword/templates/design-doc-template.md +0 -127
  102. package/.safeword/templates/test-definitions-feature.md +0 -100
  103. package/.safeword/templates/ticket-template.md +0 -74
  104. package/.safeword/templates/user-stories-template.md +0 -82
  105. package/.safeword/tickets/001-guides-review-user-stories.md +0 -83
  106. package/.safeword/tickets/002-architecture-enforcement.md +0 -211
  107. package/.safeword/tickets/003-reactive-fix-prevention.md +0 -57
  108. package/.safeword/tickets/004-technical-constraints-in-user-stories.md +0 -39
  109. package/.safeword/tickets/005-cli-implementation.md +0 -248
  110. package/.safeword/tickets/006-flesh-out-skills.md +0 -43
  111. package/.safeword/tickets/007-flesh-out-questioning.md +0 -44
  112. package/.safeword/tickets/008-upgrade-questioning.md +0 -58
  113. package/.safeword/tickets/009-naming-conventions.md +0 -41
  114. package/.safeword/tickets/010-safeword-md-cleanup.md +0 -34
  115. package/.safeword/tickets/011-cursor-setup.md +0 -86
  116. package/.safeword/tickets/README.md +0 -73
  117. package/.safeword/version +0 -1
  118. package/AGENTS.md +0 -59
  119. package/CLAUDE.md +0 -12
  120. package/README.md +0 -347
  121. package/docs/001-cli-implementation-plan.md +0 -856
  122. package/docs/elite-dx-implementation-plan.md +0 -1034
  123. package/framework/README.md +0 -131
  124. package/framework/mcp/README.md +0 -96
  125. package/framework/mcp/arcade.sample.json +0 -8
  126. package/framework/mcp/context7.sample.json +0 -6
  127. package/framework/mcp/playwright.sample.json +0 -6
  128. package/framework/scripts/arch-review.sh +0 -235
  129. package/framework/scripts/check-linting-sync.sh +0 -58
  130. package/framework/scripts/load-env.sh +0 -49
  131. package/framework/scripts/setup-claude.sh +0 -223
  132. package/framework/scripts/setup-linting.sh +0 -559
  133. package/framework/scripts/setup-quality.sh +0 -477
  134. package/framework/scripts/setup-safeword.sh +0 -550
  135. package/framework/templates/ci/architecture-check.yml +0 -78
  136. package/learnings/ai-sdk-v5-breaking-changes.md +0 -178
  137. package/learnings/e2e-test-zombie-processes.md +0 -231
  138. package/learnings/milkdown-crepe-editor-property.md +0 -96
  139. package/learnings/prosemirror-fragment-traversal.md +0 -119
  140. package/packages/cli/AGENTS.md +0 -1
  141. package/packages/cli/ARCHITECTURE.md +0 -279
  142. package/packages/cli/package.json +0 -51
  143. package/packages/cli/src/cli.ts +0 -63
  144. package/packages/cli/src/commands/check.ts +0 -166
  145. package/packages/cli/src/commands/diff.ts +0 -209
  146. package/packages/cli/src/commands/reset.ts +0 -190
  147. package/packages/cli/src/commands/setup.ts +0 -325
  148. package/packages/cli/src/commands/upgrade.ts +0 -163
  149. package/packages/cli/src/index.ts +0 -3
  150. package/packages/cli/src/templates/config.ts +0 -58
  151. package/packages/cli/src/templates/content.ts +0 -18
  152. package/packages/cli/src/templates/index.ts +0 -12
  153. package/packages/cli/src/utils/agents-md.ts +0 -66
  154. package/packages/cli/src/utils/fs.ts +0 -179
  155. package/packages/cli/src/utils/git.ts +0 -124
  156. package/packages/cli/src/utils/hooks.ts +0 -29
  157. package/packages/cli/src/utils/output.ts +0 -60
  158. package/packages/cli/src/utils/project-detector.test.ts +0 -185
  159. package/packages/cli/src/utils/project-detector.ts +0 -44
  160. package/packages/cli/src/utils/version.ts +0 -28
  161. package/packages/cli/src/version.ts +0 -6
  162. package/packages/cli/templates/SAFEWORD.md +0 -776
  163. package/packages/cli/templates/doc-templates/architecture-template.md +0 -136
  164. package/packages/cli/templates/doc-templates/design-doc-template.md +0 -134
  165. package/packages/cli/templates/doc-templates/test-definitions-feature.md +0 -131
  166. package/packages/cli/templates/doc-templates/ticket-template.md +0 -82
  167. package/packages/cli/templates/doc-templates/user-stories-template.md +0 -92
  168. package/packages/cli/templates/guides/architecture-guide.md +0 -423
  169. package/packages/cli/templates/guides/code-philosophy.md +0 -195
  170. package/packages/cli/templates/guides/context-files-guide.md +0 -457
  171. package/packages/cli/templates/guides/data-architecture-guide.md +0 -200
  172. package/packages/cli/templates/guides/design-doc-guide.md +0 -171
  173. package/packages/cli/templates/guides/learning-extraction.md +0 -552
  174. package/packages/cli/templates/guides/llm-instruction-design.md +0 -248
  175. package/packages/cli/templates/guides/llm-prompting.md +0 -102
  176. package/packages/cli/templates/guides/tdd-best-practices.md +0 -615
  177. package/packages/cli/templates/guides/test-definitions-guide.md +0 -334
  178. package/packages/cli/templates/guides/testing-methodology.md +0 -618
  179. package/packages/cli/templates/guides/user-story-guide.md +0 -256
  180. package/packages/cli/templates/guides/zombie-process-cleanup.md +0 -219
  181. package/packages/cli/templates/hooks/agents-md-check.sh +0 -27
  182. package/packages/cli/templates/hooks/post-tool.sh +0 -4
  183. package/packages/cli/templates/hooks/pre-commit.sh +0 -10
  184. package/packages/cli/templates/prompts/arch-review.md +0 -43
  185. package/packages/cli/templates/prompts/quality-review.md +0 -10
  186. package/packages/cli/templates/skills/safeword-quality-reviewer/SKILL.md +0 -207
  187. package/packages/cli/tests/commands/check.test.ts +0 -129
  188. package/packages/cli/tests/commands/cli.test.ts +0 -89
  189. package/packages/cli/tests/commands/diff.test.ts +0 -115
  190. package/packages/cli/tests/commands/reset.test.ts +0 -310
  191. package/packages/cli/tests/commands/self-healing.test.ts +0 -170
  192. package/packages/cli/tests/commands/setup-blocking.test.ts +0 -71
  193. package/packages/cli/tests/commands/setup-core.test.ts +0 -135
  194. package/packages/cli/tests/commands/setup-git.test.ts +0 -139
  195. package/packages/cli/tests/commands/setup-hooks.test.ts +0 -334
  196. package/packages/cli/tests/commands/setup-linting.test.ts +0 -189
  197. package/packages/cli/tests/commands/setup-noninteractive.test.ts +0 -80
  198. package/packages/cli/tests/commands/setup-templates.test.ts +0 -181
  199. package/packages/cli/tests/commands/upgrade.test.ts +0 -215
  200. package/packages/cli/tests/helpers.ts +0 -243
  201. package/packages/cli/tests/npm-package.test.ts +0 -83
  202. package/packages/cli/tests/technical-constraints.test.ts +0 -96
  203. package/packages/cli/tsconfig.json +0 -25
  204. package/packages/cli/tsup.config.ts +0 -11
  205. package/packages/cli/vitest.config.ts +0 -23
  206. package/promptfoo.yaml +0 -3270
  207. /package/{framework → templates}/SAFEWORD.md +0 -0
  208. /package/{packages/cli/templates → templates}/commands/arch-review.md +0 -0
  209. /package/{packages/cli/templates → templates}/commands/lint.md +0 -0
  210. /package/{packages/cli/templates → templates}/commands/quality-review.md +0 -0
  211. /package/{framework/templates → templates/doc-templates}/architecture-template.md +0 -0
  212. /package/{framework/templates → templates/doc-templates}/design-doc-template.md +0 -0
  213. /package/{framework/templates → templates/doc-templates}/test-definitions-feature.md +0 -0
  214. /package/{framework/templates → templates/doc-templates}/ticket-template.md +0 -0
  215. /package/{framework/templates → templates/doc-templates}/user-stories-template.md +0 -0
  216. /package/{framework → templates}/guides/architecture-guide.md +0 -0
  217. /package/{framework → templates}/guides/code-philosophy.md +0 -0
  218. /package/{framework → templates}/guides/context-files-guide.md +0 -0
  219. /package/{framework → templates}/guides/data-architecture-guide.md +0 -0
  220. /package/{framework → templates}/guides/design-doc-guide.md +0 -0
  221. /package/{framework → templates}/guides/learning-extraction.md +0 -0
  222. /package/{framework → templates}/guides/llm-instruction-design.md +0 -0
  223. /package/{framework → templates}/guides/llm-prompting.md +0 -0
  224. /package/{framework → templates}/guides/tdd-best-practices.md +0 -0
  225. /package/{framework → templates}/guides/test-definitions-guide.md +0 -0
  226. /package/{framework → templates}/guides/testing-methodology.md +0 -0
  227. /package/{framework → templates}/guides/user-story-guide.md +0 -0
  228. /package/{framework → templates}/guides/zombie-process-cleanup.md +0 -0
  229. /package/{packages/cli/templates → templates}/hooks/inject-timestamp.sh +0 -0
  230. /package/{packages/cli/templates → templates}/lib/common.sh +0 -0
  231. /package/{packages/cli/templates → templates}/lib/jq-fallback.sh +0 -0
  232. /package/{packages/cli/templates → templates}/markdownlint.jsonc +0 -0
  233. /package/{framework → templates}/prompts/arch-review.md +0 -0
  234. /package/{framework → templates}/prompts/quality-review.md +0 -0
  235. /package/{framework/skills/quality-reviewer → templates/skills/safeword-quality-reviewer}/SKILL.md +0 -0
@@ -1,1301 +0,0 @@
1
- # Test Definitions: Safeword CLI (Issue #1)
2
-
3
- **Guide**: `@./.safeword/guides/test-definitions-guide.md` - Structure, status tracking, and TDD workflow
4
- **Template**: `@./.safeword/templates/test-definitions-feature.md`
5
-
6
- **Feature**: TypeScript CLI (`safeword`) for project setup, verification, and maintenance
7
-
8
- **Related Issue**: #1 (GitHub)
9
- **User Stories**: `.safeword/planning/user-stories/005-cli-implementation.md`
10
- **Test Files**:
11
- - Unit: `packages/cli/src/**/*.test.ts`
12
- - Integration: `packages/cli/tests/**/*.test.ts`
13
-
14
- **Total Tests**: 70 (0 passing, 0 skipped, 70 not implemented)
15
-
16
- ---
17
-
18
- ## Test Suite 0: Technical Constraints
19
-
20
- Tests for non-functional requirements that apply across all commands.
21
-
22
- ### Test 0.1: CLI startup time under 500ms ❌
23
- **Status**: ❌ Not Implemented
24
- **Type**: Integration
25
- **Description**: Verifies CLI starts quickly (no heavy imports at top level)
26
-
27
- **Steps**:
28
- 1. Run `time npx safeword --version` 10 times
29
- 2. Calculate average startup time
30
-
31
- **Expected**:
32
- - Average startup time < 500ms
33
- - No individual run > 750ms
34
-
35
- ---
36
-
37
- ### Test 0.2: Setup completes under 30s ❌
38
- **Status**: ❌ Not Implemented
39
- **Type**: Integration
40
- **Description**: Verifies setup completes in reasonable time
41
-
42
- **Steps**:
43
- 1. Create temp directory with package.json
44
- 2. Time `safeword setup --yes`
45
-
46
- **Expected**:
47
- - Setup completes in < 30s
48
- - Includes npm install time for linting deps
49
-
50
- ---
51
-
52
- ### Test 0.3: Node.js version check ❌
53
- **Status**: ❌ Not Implemented
54
- **Type**: Integration
55
- **Description**: Verifies CLI checks Node.js version and exits gracefully if too old
56
-
57
- **Steps**:
58
- 1. Run CLI with Node.js < 18 (mock or container)
59
- 2. Capture stderr
60
-
61
- **Expected**:
62
- - Exit code 1
63
- - Error message mentions Node.js version requirement
64
- - Suggests upgrading to Node.js 18+
65
-
66
- ---
67
-
68
- ### Test 0.4: Works with different package managers ❌
69
- **Status**: ❌ Not Implemented
70
- **Type**: Integration
71
- **Description**: Verifies setup works regardless of package manager
72
-
73
- **Steps**:
74
- 1. Create temp directory with package.json
75
- 2. Run `safeword setup --yes` using npm
76
- 3. Verify setup succeeded
77
- 4. Repeat with pnpm, yarn (where available)
78
-
79
- **Expected**:
80
- - Setup succeeds with npm
81
- - Setup succeeds with pnpm
82
- - Setup succeeds with yarn
83
- - Linting deps installed correctly with each
84
-
85
- **Notes**: May need separate CI jobs per package manager rather than single test.
86
-
87
- ---
88
-
89
- ## Test Suite 1: Version and Help (Story 1)
90
-
91
- Tests for CLI entry point, version display, and help output.
92
-
93
- ### Test 1.1: --version flag shows CLI version ❌
94
- **Status**: ❌ Not Implemented
95
- **Type**: Integration
96
- **Description**: Verifies `safeword --version` outputs the version from package.json
97
-
98
- **Steps**:
99
- 1. Run `npx safeword --version`
100
- 2. Capture stdout
101
-
102
- **Expected**:
103
- - Output matches semver pattern (e.g., "1.0.0")
104
- - Exit code 0
105
-
106
- ---
107
-
108
- ### Test 1.2: --help flag shows help text ❌
109
- **Status**: ❌ Not Implemented
110
- **Type**: Integration
111
- **Description**: Verifies `safeword --help` displays comprehensive help
112
-
113
- **Steps**:
114
- 1. Run `npx safeword --help`
115
- 2. Capture stdout
116
-
117
- **Expected**:
118
- - Output contains "setup" command
119
- - Output contains "check" command
120
- - Output contains "upgrade" command
121
- - Output contains "diff" command
122
- - Output contains "reset" command
123
- - Output contains "--version" flag
124
- - Output contains "--help" flag
125
- - Output contains "--yes" flag
126
- - Output contains "--verbose" flag
127
- - Output contains "--offline" flag
128
- - Exit code 0
129
-
130
- ---
131
-
132
- ### Test 1.3: Bare command shows help ❌
133
- **Status**: ❌ Not Implemented
134
- **Type**: Integration
135
- **Description**: Verifies `safeword` with no arguments shows help (same as --help)
136
-
137
- **Steps**:
138
- 1. Run `npx safeword` (no arguments)
139
- 2. Capture stdout
140
-
141
- **Expected**:
142
- - Output matches `--help` output
143
- - Exit code 0
144
-
145
- ---
146
-
147
- ## Test Suite 2: Setup - Core Files (Story 2)
148
-
149
- Tests for `.safeword/` directory creation and AGENTS.md handling.
150
-
151
- ### Test 2.1: Creates .safeword directory structure ❌
152
- **Status**: ❌ Not Implemented
153
- **Type**: Integration
154
- **Description**: Verifies setup creates complete `.safeword/` directory
155
-
156
- **Steps**:
157
- 1. Create empty temp directory with package.json
158
- 2. Run `safeword setup --yes`
159
- 3. Check directory structure
160
-
161
- **Expected**:
162
- - `.safeword/` directory exists
163
- - `.safeword/SAFEWORD.md` exists
164
- - `.safeword/version` exists and contains CLI version
165
- - `.safeword/guides/` directory exists
166
- - `.safeword/templates/` directory exists
167
- - `.safeword/hooks/` directory exists
168
- - Exit code 0
169
-
170
- ---
171
-
172
- ### Test 2.2: Creates AGENTS.md if missing ❌
173
- **Status**: ❌ Not Implemented
174
- **Type**: Integration
175
- **Description**: Verifies setup creates AGENTS.md when it doesn't exist
176
-
177
- **Steps**:
178
- 1. Create empty temp directory with package.json (no AGENTS.md)
179
- 2. Run `safeword setup --yes`
180
- 3. Check AGENTS.md
181
-
182
- **Expected**:
183
- - `AGENTS.md` file exists
184
- - First line contains `**⚠️ ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**`
185
-
186
- ---
187
-
188
- ### Test 2.3: Prepends link to existing AGENTS.md ❌
189
- **Status**: ❌ Not Implemented
190
- **Type**: Integration
191
- **Description**: Verifies setup prepends link to existing AGENTS.md without losing content
192
-
193
- **Steps**:
194
- 1. Create temp directory with package.json
195
- 2. Create AGENTS.md with content "# My Project\n\nExisting content"
196
- 3. Run `safeword setup --yes`
197
- 4. Read AGENTS.md
198
-
199
- **Expected**:
200
- - First line is `**⚠️ ALWAYS READ FIRST: @./.safeword/SAFEWORD.md**`
201
- - Original content preserved below the link
202
- - "# My Project" still present
203
- - "Existing content" still present
204
-
205
- ---
206
-
207
- ### Test 2.4: No duplicate links in AGENTS.md on upgrade ❌
208
- **Status**: ❌ Not Implemented
209
- **Type**: Integration
210
- **Description**: Verifies upgrade doesn't add duplicate link if already present
211
-
212
- **Steps**:
213
- 1. Create configured project (run setup first)
214
- 2. Verify AGENTS.md has safeword link
215
- 3. Run `safeword upgrade`
216
- 4. Count occurrences of link in AGENTS.md
217
-
218
- **Expected**:
219
- - Link appears exactly once
220
- - No duplicate lines added by upgrade
221
-
222
- ---
223
-
224
- ### Test 2.5: Prints summary of created files ❌
225
- **Status**: ❌ Not Implemented
226
- **Type**: Integration
227
- **Description**: Verifies setup outputs summary of what was created
228
-
229
- **Steps**:
230
- 1. Create empty temp directory with package.json
231
- 2. Run `safeword setup --yes`
232
- 3. Capture stdout
233
-
234
- **Expected**:
235
- - Output contains "Created .safeword/"
236
- - Output contains file count or list
237
- - Output indicates success
238
-
239
- ---
240
-
241
- ## Test Suite 3: Setup - Hooks and Skills (Story 3)
242
-
243
- Tests for Claude Code hook registration and skill copying.
244
-
245
- ### Test 3.1: Registers hooks in settings.json ❌
246
- **Status**: ❌ Not Implemented
247
- **Type**: Integration
248
- **Description**: Verifies setup creates/updates `.claude/settings.json` with hooks
249
-
250
- **Steps**:
251
- 1. Create empty temp directory with package.json
252
- 2. Run `safeword setup --yes`
253
- 3. Read `.claude/settings.json`
254
-
255
- **Expected**:
256
- - `.claude/settings.json` exists
257
- - Contains "hooks" object
258
- - Contains "SessionStart" hook array
259
- - Contains "PostToolUse" hook array
260
- - Hooks reference `.safeword/hooks/` paths
261
-
262
- ---
263
-
264
- ### Test 3.2: Copies skills to .claude/skills ❌
265
- **Status**: ❌ Not Implemented
266
- **Type**: Integration
267
- **Description**: Verifies setup copies skills to Claude skills directory
268
-
269
- **Steps**:
270
- 1. Create empty temp directory with package.json
271
- 2. Run `safeword setup --yes`
272
- 3. Check `.claude/skills/` directory
273
-
274
- **Expected**:
275
- - `.claude/skills/` directory exists
276
- - Contains `safeword-*/` subdirectory(ies)
277
- - Each skill directory contains `SKILL.md`
278
-
279
- ---
280
-
281
- ### Test 3.3: Preserves existing hooks ❌
282
- **Status**: ❌ Not Implemented
283
- **Type**: Integration
284
- **Description**: Verifies setup appends to existing hooks without replacing
285
-
286
- **Steps**:
287
- 1. Create temp directory with package.json
288
- 2. Create `.claude/settings.json` with existing custom hook
289
- 3. Run `safeword setup --yes`
290
- 4. Read `.claude/settings.json`
291
-
292
- **Expected**:
293
- - Original custom hook still present
294
- - Safeword hooks added (appended)
295
- - No hooks removed or overwritten
296
-
297
- ---
298
-
299
- ### Test 3.4: Includes SessionStart hook for AGENTS.md ❌
300
- **Status**: ❌ Not Implemented
301
- **Type**: Integration
302
- **Description**: Verifies SessionStart hook includes AGENTS.md verification script
303
-
304
- **Steps**:
305
- 1. Create empty temp directory with package.json
306
- 2. Run `safeword setup --yes`
307
- 3. Read `.claude/settings.json`
308
- 4. Find SessionStart hooks
309
-
310
- **Expected**:
311
- - SessionStart array contains hook with command referencing AGENTS.md check
312
- - Hook script file exists at referenced path
313
-
314
- ---
315
-
316
- ### Test 3.5: Exit 1 if hook registration fails ❌
317
- **Status**: ❌ Not Implemented
318
- **Type**: Integration
319
- **Description**: Verifies setup fails with exit 1 if hooks can't be registered
320
-
321
- **Steps**:
322
- 1. Create temp directory with package.json
323
- 2. Create `.claude/settings.json` as read-only file
324
- 3. Run `safeword setup --yes`
325
-
326
- **Expected**:
327
- - Exit code 1
328
- - Error message mentions hook registration failure
329
- - No partial setup left behind
330
-
331
- ---
332
-
333
- ## Test Suite 4: Setup - Linting (Story 4)
334
-
335
- Tests for ESLint + Prettier configuration.
336
-
337
- ### Test 4.1: Detects TypeScript project ❌
338
- **Status**: ❌ Not Implemented
339
- **Type**: Unit
340
- **Description**: Verifies project type detection from package.json
341
-
342
- **Steps**:
343
- 1. Create package.json with typescript in devDependencies
344
- 2. Call detectProjectType(packageJson)
345
-
346
- **Expected**:
347
- - Returns object with `typescript: true`
348
-
349
- ---
350
-
351
- ### Test 4.2: Detects React project ❌
352
- **Status**: ❌ Not Implemented
353
- **Type**: Unit
354
- **Description**: Verifies React detection from package.json
355
-
356
- **Steps**:
357
- 1. Create package.json with react in dependencies
358
- 2. Call detectProjectType(packageJson)
359
-
360
- **Expected**:
361
- - Returns object with `react: true`
362
-
363
- ---
364
-
365
- ### Test 4.3: Detects Next.js project ❌
366
- **Status**: ❌ Not Implemented
367
- **Type**: Unit
368
- **Description**: Verifies Next.js detection from package.json
369
-
370
- **Steps**:
371
- 1. Create package.json with next in dependencies
372
- 2. Call detectProjectType(packageJson)
373
-
374
- **Expected**:
375
- - Returns object with `nextjs: true`
376
- - Also sets `react: true` (Next.js implies React)
377
-
378
- ---
379
-
380
- ### Test 4.4: Creates eslint.config.mjs ❌
381
- **Status**: ❌ Not Implemented
382
- **Type**: Integration
383
- **Description**: Verifies setup creates ESLint flat config
384
-
385
- **Steps**:
386
- 1. Create temp directory with TypeScript package.json
387
- 2. Run `safeword setup --yes`
388
- 3. Check for eslint.config.mjs
389
-
390
- **Expected**:
391
- - `eslint.config.mjs` file exists
392
- - Contains TypeScript config (detected from package.json)
393
-
394
- ---
395
-
396
- ### Test 4.5: Creates .prettierrc ❌
397
- **Status**: ❌ Not Implemented
398
- **Type**: Integration
399
- **Description**: Verifies setup creates Prettier config
400
-
401
- **Steps**:
402
- 1. Create temp directory with package.json
403
- 2. Run `safeword setup --yes`
404
- 3. Check for .prettierrc
405
-
406
- **Expected**:
407
- - `.prettierrc` file exists
408
- - Contains valid JSON config
409
-
410
- ---
411
-
412
- ### Test 4.6: Adds lint script to package.json ❌
413
- **Status**: ❌ Not Implemented
414
- **Type**: Integration
415
- **Description**: Verifies setup adds lint script
416
-
417
- **Steps**:
418
- 1. Create temp directory with package.json (no scripts.lint)
419
- 2. Run `safeword setup --yes`
420
- 3. Read package.json
421
-
422
- **Expected**:
423
- - `scripts.lint` equals "eslint ."
424
-
425
- ---
426
-
427
- ### Test 4.7: Adds format script to package.json ❌
428
- **Status**: ❌ Not Implemented
429
- **Type**: Integration
430
- **Description**: Verifies setup adds format script
431
-
432
- **Steps**:
433
- 1. Create temp directory with package.json (no scripts.format)
434
- 2. Run `safeword setup --yes`
435
- 3. Read package.json
436
-
437
- **Expected**:
438
- - `scripts.format` equals "prettier --write ."
439
-
440
- ---
441
-
442
- ### Test 4.8: Exit 1 if linting setup fails ❌
443
- **Status**: ❌ Not Implemented
444
- **Type**: Integration
445
- **Description**: Verifies setup fails with exit 1 if linting can't be configured
446
-
447
- **Steps**:
448
- 1. Create temp directory with read-only package.json
449
- 2. Run `safeword setup --yes`
450
-
451
- **Expected**:
452
- - Exit code 1
453
- - Error message mentions linting setup failure
454
-
455
- ---
456
-
457
- ## Test Suite 5: Setup Blocks on Existing (Story 5)
458
-
459
- Tests for setup error when already configured.
460
-
461
- ### Test 5.1: Error when .safeword exists ❌
462
- **Status**: ❌ Not Implemented
463
- **Type**: Integration
464
- **Description**: Verifies setup errors if `.safeword/` already exists
465
-
466
- **Steps**:
467
- 1. Create temp directory with package.json
468
- 2. Create `.safeword/` directory
469
- 3. Run `safeword setup`
470
-
471
- **Expected**:
472
- - Exit code 1
473
- - Error message contains "Already configured"
474
- - Error message contains "safeword upgrade"
475
-
476
- ---
477
-
478
- ### Test 5.2: No files modified on error ❌
479
- **Status**: ❌ Not Implemented
480
- **Type**: Integration
481
- **Description**: Verifies setup doesn't modify files when erroring
482
-
483
- **Steps**:
484
- 1. Create temp directory with package.json and `.safeword/`
485
- 2. Create AGENTS.md with known content
486
- 3. Run `safeword setup`
487
- 4. Compare AGENTS.md content
488
-
489
- **Expected**:
490
- - AGENTS.md unchanged
491
- - No new files created
492
- - Exit code 1
493
-
494
- ---
495
-
496
- ## Test Suite 6: Non-Interactive Setup (Story 6)
497
-
498
- Tests for CI/headless operation.
499
-
500
- ### Test 6.1: --yes flag skips all prompts ❌
501
- **Status**: ❌ Not Implemented
502
- **Type**: Integration
503
- **Description**: Verifies --yes flag enables non-interactive mode
504
-
505
- **Steps**:
506
- 1. Create temp directory with package.json (no .git)
507
- 2. Run `safeword setup --yes`
508
- 3. Verify no stdin required
509
-
510
- **Expected**:
511
- - Setup completes without hanging
512
- - Exit code 0
513
- - Git init skipped (default)
514
-
515
- ---
516
-
517
- ### Test 6.2: No TTY uses defaults ❌
518
- **Status**: ❌ Not Implemented
519
- **Type**: Integration
520
- **Description**: Verifies non-TTY environment uses defaults
521
-
522
- **Steps**:
523
- 1. Create temp directory with package.json (no .git)
524
- 2. Run `safeword setup` with stdin as pipe (non-TTY)
525
- 3. Verify no stdin required
526
-
527
- **Expected**:
528
- - Setup completes without hanging
529
- - Exit code 0
530
- - Warning about skipped git init
531
-
532
- ---
533
-
534
- ### Test 6.3: Warning shown when git skipped ❌
535
- **Status**: ❌ Not Implemented
536
- **Type**: Integration
537
- **Description**: Verifies warning message when git initialization skipped
538
-
539
- **Steps**:
540
- 1. Create temp directory with package.json (no .git)
541
- 2. Run `safeword setup --yes`
542
- 3. Capture stdout
543
-
544
- **Expected**:
545
- - Output contains "Skipped git initialization"
546
- - Exit code 0
547
-
548
- ---
549
-
550
- ## Test Suite 7: Git Repository Handling (Story 7)
551
-
552
- Tests for git detection and hook installation.
553
-
554
- ### Test 7.1: Prompts for git init when no .git ❌
555
- **Status**: ❌ Not Implemented
556
- **Type**: Integration
557
- **Description**: Verifies prompt appears when .git missing (TTY mode)
558
-
559
- **Steps**:
560
- 1. Create temp directory with package.json (no .git)
561
- 2. Run `safeword setup` with TTY simulation
562
- 3. Check for prompt
563
-
564
- **Expected**:
565
- - Output contains "Initialize git repository?"
566
- - Waits for input
567
-
568
- ---
569
-
570
- ### Test 7.2: Runs git init when user confirms ❌
571
- **Status**: ❌ Not Implemented
572
- **Type**: Integration
573
- **Description**: Verifies git init runs when user says yes
574
-
575
- **Steps**:
576
- 1. Create temp directory with package.json (no .git)
577
- 2. Run `safeword setup` with "y" input
578
- 3. Check for .git directory
579
-
580
- **Expected**:
581
- - `.git/` directory exists
582
- - Exit code 0
583
-
584
- ---
585
-
586
- ### Test 7.3: Skips git init when user declines ❌
587
- **Status**: ❌ Not Implemented
588
- **Type**: Integration
589
- **Description**: Verifies git init skipped when user says no
590
-
591
- **Steps**:
592
- 1. Create temp directory with package.json (no .git)
593
- 2. Run `safeword setup` with "n" input
594
- 3. Check for .git directory
595
-
596
- **Expected**:
597
- - `.git/` directory does not exist
598
- - Warning about skipped git hooks
599
- - Exit code 0
600
-
601
- ---
602
-
603
- ### Test 7.4: Installs git hooks when .git present ❌
604
- **Status**: ❌ Not Implemented
605
- **Type**: Integration
606
- **Description**: Verifies git hooks installed in existing repo
607
-
608
- **Steps**:
609
- 1. Create temp directory with package.json
610
- 2. Run `git init`
611
- 3. Run `safeword setup --yes`
612
- 4. Check `.git/hooks/pre-commit`
613
-
614
- **Expected**:
615
- - `.git/hooks/pre-commit` exists
616
- - Contains `SAFEWORD_ARCH_CHECK_START` marker
617
- - Contains `SAFEWORD_ARCH_CHECK_END` marker
618
-
619
- ---
620
-
621
- ### Test 7.5: Preserves existing pre-commit hooks ❌
622
- **Status**: ❌ Not Implemented
623
- **Type**: Integration
624
- **Description**: Verifies existing git hooks not overwritten
625
-
626
- **Steps**:
627
- 1. Create temp directory with package.json
628
- 2. Run `git init`
629
- 3. Create `.git/hooks/pre-commit` with custom content
630
- 4. Run `safeword setup --yes`
631
- 5. Read `.git/hooks/pre-commit`
632
-
633
- **Expected**:
634
- - Original custom content preserved
635
- - Safeword markers added (appended)
636
- - Both custom and safeword hooks present
637
-
638
- ---
639
-
640
- ## Test Suite 8: Health Check (Story 8)
641
-
642
- Tests for `safeword check` command.
643
-
644
- ### Test 8.1: Shows CLI version ❌
645
- **Status**: ❌ Not Implemented
646
- **Type**: Integration
647
- **Description**: Verifies check displays CLI version
648
-
649
- **Steps**:
650
- 1. Create configured project (run setup first)
651
- 2. Run `safeword check`
652
- 3. Capture stdout
653
-
654
- **Expected**:
655
- - Output contains "Safeword CLI:"
656
- - Output contains version number
657
-
658
- ---
659
-
660
- ### Test 8.2: Shows project config version ❌
661
- **Status**: ❌ Not Implemented
662
- **Type**: Integration
663
- **Description**: Verifies check displays project version
664
-
665
- **Steps**:
666
- 1. Create configured project (run setup first)
667
- 2. Run `safeword check`
668
- 3. Capture stdout
669
-
670
- **Expected**:
671
- - Output contains "Project config:"
672
- - Output contains version from `.safeword/version`
673
-
674
- ---
675
-
676
- ### Test 8.3: Shows update available ❌
677
- **Status**: ❌ Not Implemented
678
- **Type**: Integration
679
- **Description**: Verifies check shows when update available
680
-
681
- **Steps**:
682
- 1. Create configured project with older version in `.safeword/version`
683
- 2. Run `safeword check` (mock npm registry to return newer version)
684
- 3. Capture stdout
685
-
686
- **Expected**:
687
- - Output contains "available" or indicates update
688
-
689
- ---
690
-
691
- ### Test 8.4: Unconfigured project message ❌
692
- **Status**: ❌ Not Implemented
693
- **Type**: Integration
694
- **Description**: Verifies check shows message on unconfigured project
695
-
696
- **Steps**:
697
- 1. Create temp directory with package.json (no .safeword)
698
- 2. Run `safeword check`
699
- 3. Capture stdout
700
-
701
- **Expected**:
702
- - Output contains "Not configured"
703
- - Output contains "safeword setup"
704
- - Exit code 0
705
-
706
- ---
707
-
708
- ### Test 8.5: Graceful timeout on version check ❌
709
- **Status**: ❌ Not Implemented
710
- **Type**: Integration
711
- **Description**: Verifies check handles network timeout gracefully
712
-
713
- **Steps**:
714
- 1. Create configured project
715
- 2. Run `safeword check` with network blocked/slow (mock timeout)
716
- 3. Capture stdout
717
-
718
- **Expected**:
719
- - Completes within reasonable time (not hanging)
720
- - Output contains "Couldn't check for updates"
721
- - Exit code 0
722
-
723
- ---
724
-
725
- ### Test 8.6: --offline skips version check ❌
726
- **Status**: ❌ Not Implemented
727
- **Type**: Integration
728
- **Description**: Verifies --offline flag skips remote version check
729
-
730
- **Steps**:
731
- 1. Create configured project
732
- 2. Run `safeword check --offline`
733
- 3. Capture stdout
734
-
735
- **Expected**:
736
- - No network request made
737
- - Shows local versions only
738
- - Exit code 0
739
-
740
- ---
741
-
742
- ### Test 8.7: Detects corrupted .safeword structure ❌
743
- **Status**: ❌ Not Implemented
744
- **Type**: Integration
745
- **Description**: Verifies check detects when required files are missing
746
-
747
- **Steps**:
748
- 1. Create configured project
749
- 2. Delete `.safeword/SAFEWORD.md` (critical file)
750
- 3. Run `safeword check`
751
- 4. Capture stdout
752
-
753
- **Expected**:
754
- - Output indicates structure issue or missing files
755
- - Suggests running `safeword upgrade` to repair
756
- - Exit code 0 (warning, not failure)
757
-
758
- ---
759
-
760
- ## Test Suite 9: Upgrade (Story 9)
761
-
762
- Tests for `safeword upgrade` command.
763
-
764
- ### Test 9.1: Overwrites .safeword files ❌
765
- **Status**: ❌ Not Implemented
766
- **Type**: Integration
767
- **Description**: Verifies upgrade replaces all .safeword files
768
-
769
- **Steps**:
770
- 1. Create configured project
771
- 2. Modify a file in `.safeword/`
772
- 3. Run `safeword upgrade`
773
- 4. Check if modification is gone
774
-
775
- **Expected**:
776
- - Modified file restored to CLI version
777
- - `.safeword/version` updated
778
-
779
- ---
780
-
781
- ### Test 9.2: Updates skills ❌
782
- **Status**: ❌ Not Implemented
783
- **Type**: Integration
784
- **Description**: Verifies upgrade updates skill files
785
-
786
- **Steps**:
787
- 1. Create configured project
788
- 2. Modify a file in `.claude/skills/safeword-*/`
789
- 3. Run `safeword upgrade`
790
- 4. Check if modification is gone
791
-
792
- **Expected**:
793
- - Skill file restored to CLI version
794
-
795
- ---
796
-
797
- ### Test 9.3: Preserves non-safeword hooks ❌
798
- **Status**: ❌ Not Implemented
799
- **Type**: Integration
800
- **Description**: Verifies upgrade doesn't remove custom hooks
801
-
802
- **Steps**:
803
- 1. Create configured project
804
- 2. Add custom hook to `.claude/settings.json`
805
- 3. Run `safeword upgrade`
806
- 4. Check `.claude/settings.json`
807
-
808
- **Expected**:
809
- - Custom hook still present
810
- - Safeword hooks updated
811
-
812
- ---
813
-
814
- ### Test 9.4: Same-version reinstalls ❌
815
- **Status**: ❌ Not Implemented
816
- **Type**: Integration
817
- **Description**: Verifies upgrade works even with same version
818
-
819
- **Steps**:
820
- 1. Create configured project (same version as CLI)
821
- 2. Modify a .safeword file
822
- 3. Run `safeword upgrade`
823
- 4. Check if modification is gone
824
-
825
- **Expected**:
826
- - File restored despite same version
827
- - No "already up to date" skip
828
-
829
- ---
830
-
831
- ### Test 9.5: Refuses to downgrade ❌
832
- **Status**: ❌ Not Implemented
833
- **Type**: Integration
834
- **Description**: Verifies upgrade refuses when project newer than CLI
835
-
836
- **Steps**:
837
- 1. Create configured project
838
- 2. Set `.safeword/version` to higher version than CLI
839
- 3. Run `safeword upgrade`
840
-
841
- **Expected**:
842
- - Exit code 1
843
- - Error contains "older" or "downgrade"
844
- - Error contains "Update CLI"
845
-
846
- ---
847
-
848
- ### Test 9.6: Unconfigured project error ❌
849
- **Status**: ❌ Not Implemented
850
- **Type**: Integration
851
- **Description**: Verifies upgrade errors on unconfigured project
852
-
853
- **Steps**:
854
- 1. Create temp directory with package.json (no .safeword)
855
- 2. Run `safeword upgrade`
856
-
857
- **Expected**:
858
- - Exit code 1
859
- - Error contains "Not configured"
860
- - Error contains "safeword setup"
861
-
862
- ---
863
-
864
- ### Test 9.7: Prints summary of changes ❌
865
- **Status**: ❌ Not Implemented
866
- **Type**: Integration
867
- **Description**: Verifies upgrade shows what changed
868
-
869
- **Steps**:
870
- 1. Create configured project with older version
871
- 2. Run `safeword upgrade`
872
- 3. Capture stdout
873
-
874
- **Expected**:
875
- - Output shows files added/modified/unchanged
876
- - Output shows version transition
877
-
878
- ---
879
-
880
- ## Test Suite 10: Diff (Story 10)
881
-
882
- Tests for `safeword diff` command.
883
-
884
- ### Test 10.1: Shows summary by default ❌
885
- **Status**: ❌ Not Implemented
886
- **Type**: Integration
887
- **Description**: Verifies diff shows summary without --verbose
888
-
889
- **Steps**:
890
- 1. Create configured project with older version
891
- 2. Run `safeword diff`
892
- 3. Capture stdout
893
-
894
- **Expected**:
895
- - Output shows count of files (added, modified, unchanged)
896
- - Output does NOT show full diff content
897
- - Exit code 0
898
-
899
- ---
900
-
901
- ### Test 10.2: Lists files by category ❌
902
- **Status**: ❌ Not Implemented
903
- **Type**: Integration
904
- **Description**: Verifies diff categorizes files
905
-
906
- **Steps**:
907
- 1. Create configured project with older version
908
- 2. Run `safeword diff`
909
- 3. Capture stdout
910
-
911
- **Expected**:
912
- - Output groups files as Added, Modified, or Unchanged
913
-
914
- ---
915
-
916
- ### Test 10.3: Shows version transition ❌
917
- **Status**: ❌ Not Implemented
918
- **Type**: Integration
919
- **Description**: Verifies diff shows from/to versions
920
-
921
- **Steps**:
922
- 1. Create configured project with version "1.0.0"
923
- 2. Run `safeword diff` (CLI is "1.1.0")
924
- 3. Capture stdout
925
-
926
- **Expected**:
927
- - Output contains "1.0.0"
928
- - Output contains "1.1.0"
929
- - Output contains "→" or similar transition indicator
930
-
931
- ---
932
-
933
- ### Test 10.4: --verbose shows full diff ❌
934
- **Status**: ❌ Not Implemented
935
- **Type**: Integration
936
- **Description**: Verifies --verbose flag shows unified diff
937
-
938
- **Steps**:
939
- 1. Create configured project with older version
940
- 2. Run `safeword diff --verbose`
941
- 3. Capture stdout
942
-
943
- **Expected**:
944
- - Output contains unified diff format (--- +++ @@ lines)
945
- - Shows actual content changes
946
-
947
- ---
948
-
949
- ### Test 10.5: Unconfigured project error ❌
950
- **Status**: ❌ Not Implemented
951
- **Type**: Integration
952
- **Description**: Verifies diff errors on unconfigured project
953
-
954
- **Steps**:
955
- 1. Create temp directory with package.json (no .safeword)
956
- 2. Run `safeword diff`
957
-
958
- **Expected**:
959
- - Exit code 1
960
- - Error contains "Not configured"
961
-
962
- ---
963
-
964
- ## Test Suite 11: Reset (Story 11)
965
-
966
- Tests for `safeword reset` command.
967
-
968
- ### Test 11.1: Prompts for confirmation ❌
969
- **Status**: ❌ Not Implemented
970
- **Type**: Integration
971
- **Description**: Verifies reset asks for confirmation
972
-
973
- **Steps**:
974
- 1. Create configured project
975
- 2. Run `safeword reset` (TTY mode)
976
- 3. Check for prompt
977
-
978
- **Expected**:
979
- - Output contains "remove safeword"
980
- - Output contains "Continue?"
981
- - Waits for input
982
-
983
- ---
984
-
985
- ### Test 11.2: --yes auto-confirms ❌
986
- **Status**: ❌ Not Implemented
987
- **Type**: Integration
988
- **Description**: Verifies --yes skips confirmation
989
-
990
- **Steps**:
991
- 1. Create configured project
992
- 2. Run `safeword reset --yes`
993
- 3. Check .safeword directory
994
-
995
- **Expected**:
996
- - No prompt displayed
997
- - `.safeword/` removed
998
- - Exit code 0
999
-
1000
- ---
1001
-
1002
- ### Test 11.3: No TTY auto-confirms ❌
1003
- **Status**: ❌ Not Implemented
1004
- **Type**: Integration
1005
- **Description**: Verifies non-TTY mode auto-confirms
1006
-
1007
- **Steps**:
1008
- 1. Create configured project
1009
- 2. Run `safeword reset` with stdin as pipe
1010
- 3. Check .safeword directory
1011
-
1012
- **Expected**:
1013
- - No hanging for input
1014
- - `.safeword/` removed
1015
- - Exit code 0
1016
-
1017
- ---
1018
-
1019
- ### Test 11.4: Removes .safeword directory ❌
1020
- **Status**: ❌ Not Implemented
1021
- **Type**: Integration
1022
- **Description**: Verifies reset removes .safeword
1023
-
1024
- **Steps**:
1025
- 1. Create configured project
1026
- 2. Run `safeword reset --yes`
1027
- 3. Check filesystem
1028
-
1029
- **Expected**:
1030
- - `.safeword/` directory does not exist
1031
-
1032
- ---
1033
-
1034
- ### Test 11.5: Removes hooks from settings.json ❌
1035
- **Status**: ❌ Not Implemented
1036
- **Type**: Integration
1037
- **Description**: Verifies reset removes safeword hooks
1038
-
1039
- **Steps**:
1040
- 1. Create configured project with custom hook
1041
- 2. Run `safeword reset --yes`
1042
- 3. Read `.claude/settings.json`
1043
-
1044
- **Expected**:
1045
- - Safeword hooks removed
1046
- - Custom hooks preserved
1047
- - `.claude/settings.json` still valid JSON
1048
-
1049
- ---
1050
-
1051
- ### Test 11.6: Removes safeword skills ❌
1052
- **Status**: ❌ Not Implemented
1053
- **Type**: Integration
1054
- **Description**: Verifies reset removes skill directories
1055
-
1056
- **Steps**:
1057
- 1. Create configured project
1058
- 2. Run `safeword reset --yes`
1059
- 3. Check `.claude/skills/`
1060
-
1061
- **Expected**:
1062
- - `safeword-*/` directories removed
1063
- - Other skills (if any) preserved
1064
-
1065
- ---
1066
-
1067
- ### Test 11.7: Removes git hook markers ❌
1068
- **Status**: ❌ Not Implemented
1069
- **Type**: Integration
1070
- **Description**: Verifies reset removes safeword markers from pre-commit
1071
-
1072
- **Steps**:
1073
- 1. Create configured project with git hooks
1074
- 2. Add custom content to pre-commit outside markers
1075
- 3. Run `safeword reset --yes`
1076
- 4. Read `.git/hooks/pre-commit`
1077
-
1078
- **Expected**:
1079
- - `SAFEWORD_ARCH_CHECK_START` marker gone
1080
- - `SAFEWORD_ARCH_CHECK_END` marker gone
1081
- - Content between markers removed
1082
- - Custom content outside markers preserved
1083
-
1084
- ---
1085
-
1086
- ### Test 11.8: Removes link from AGENTS.md ❌
1087
- **Status**: ❌ Not Implemented
1088
- **Type**: Integration
1089
- **Description**: Verifies reset removes safeword link from AGENTS.md
1090
-
1091
- **Steps**:
1092
- 1. Create configured project
1093
- 2. Add custom content to AGENTS.md below link
1094
- 3. Run `safeword reset --yes`
1095
- 4. Read `AGENTS.md`
1096
-
1097
- **Expected**:
1098
- - Safeword link line removed
1099
- - Custom content preserved
1100
- - File not deleted (unless empty)
1101
-
1102
- ---
1103
-
1104
- ### Test 11.9: Preserves linting config ❌
1105
- **Status**: ❌ Not Implemented
1106
- **Type**: Integration
1107
- **Description**: Verifies reset leaves linting artifacts
1108
-
1109
- **Steps**:
1110
- 1. Create configured project
1111
- 2. Run `safeword reset --yes`
1112
- 3. Check filesystem
1113
-
1114
- **Expected**:
1115
- - `eslint.config.mjs` still exists
1116
- - `.prettierrc` still exists
1117
- - `scripts.lint` still in package.json
1118
- - `scripts.format` still in package.json
1119
-
1120
- ---
1121
-
1122
- ### Test 11.10: Unconfigured project message ❌
1123
- **Status**: ❌ Not Implemented
1124
- **Type**: Integration
1125
- **Description**: Verifies reset shows message on unconfigured project
1126
-
1127
- **Steps**:
1128
- 1. Create temp directory with package.json (no .safeword)
1129
- 2. Run `safeword reset --yes`
1130
-
1131
- **Expected**:
1132
- - Output contains "Nothing to remove"
1133
- - Exit code 0
1134
-
1135
- ---
1136
-
1137
- ## Test Suite 12: AGENTS.md Self-Healing (Story 12)
1138
-
1139
- Tests for SessionStart hook that maintains AGENTS.md link.
1140
-
1141
- ### Test 12.1: Hook detects missing link ❌
1142
- **Status**: ❌ Not Implemented
1143
- **Type**: Unit
1144
- **Description**: Verifies hook script detects when link is missing
1145
-
1146
- **Steps**:
1147
- 1. Create AGENTS.md without safeword link
1148
- 2. Run hook script
1149
- 3. Check return/output
1150
-
1151
- **Expected**:
1152
- - Script detects link is missing
1153
- - Returns indication that repair is needed
1154
-
1155
- ---
1156
-
1157
- ### Test 12.2: Hook re-adds missing link ❌
1158
- **Status**: ❌ Not Implemented
1159
- **Type**: Integration
1160
- **Description**: Verifies hook restores removed link
1161
-
1162
- **Steps**:
1163
- 1. Create configured project
1164
- 2. Remove safeword link from AGENTS.md (keep other content)
1165
- 3. Run SessionStart hook script
1166
- 4. Read AGENTS.md
1167
-
1168
- **Expected**:
1169
- - Link restored at top of file
1170
- - Original content preserved below
1171
-
1172
- ---
1173
-
1174
- ### Test 12.3: Hook shows warning on restoration ❌
1175
- **Status**: ❌ Not Implemented
1176
- **Type**: Integration
1177
- **Description**: Verifies hook outputs warning when restoring
1178
-
1179
- **Steps**:
1180
- 1. Create configured project
1181
- 2. Remove safeword link from AGENTS.md
1182
- 3. Run SessionStart hook script
1183
- 4. Capture stdout/stderr
1184
-
1185
- **Expected**:
1186
- - Output contains "Restored" or similar
1187
- - Output mentions AGENTS.md
1188
-
1189
- ---
1190
-
1191
- ### Test 12.4: Hook recreates deleted AGENTS.md ❌
1192
- **Status**: ❌ Not Implemented
1193
- **Type**: Integration
1194
- **Description**: Verifies hook recreates AGENTS.md if file deleted
1195
-
1196
- **Steps**:
1197
- 1. Create configured project
1198
- 2. Delete AGENTS.md entirely
1199
- 3. Run SessionStart hook script
1200
- 4. Check filesystem
1201
-
1202
- **Expected**:
1203
- - `AGENTS.md` file exists
1204
- - Contains safeword link
1205
-
1206
- ---
1207
-
1208
- ### Test 12.5: Hook prevents duplicates ❌
1209
- **Status**: ❌ Not Implemented
1210
- **Type**: Integration
1211
- **Description**: Verifies hook doesn't add duplicate links
1212
-
1213
- **Steps**:
1214
- 1. Create configured project with link present
1215
- 2. Run SessionStart hook script
1216
- 3. Count link occurrences in AGENTS.md
1217
-
1218
- **Expected**:
1219
- - Link appears exactly once
1220
- - No duplicates added
1221
-
1222
- ---
1223
-
1224
- ### Test 12.6: Hook exits cleanly ❌
1225
- **Status**: ❌ Not Implemented
1226
- **Type**: Integration
1227
- **Description**: Verifies hook doesn't block Claude Code startup
1228
-
1229
- **Steps**:
1230
- 1. Create configured project
1231
- 2. Run SessionStart hook script
1232
- 3. Check exit code and timing
1233
-
1234
- **Expected**:
1235
- - Exit code 0
1236
- - Completes quickly (< 1s)
1237
- - No hanging
1238
-
1239
- ---
1240
-
1241
- ## Summary
1242
-
1243
- **Total**: 70 tests
1244
- **Passing**: 0 tests (0%)
1245
- **Skipped**: 0 tests (0%)
1246
- **Not Implemented**: 70 tests (100%)
1247
- **Failing**: 0 tests (0%)
1248
-
1249
- ### Coverage by Story
1250
-
1251
- | Story | Tests | Status |
1252
- |-------|-------|--------|
1253
- | Technical Constraints | 4 | ❌ 0% |
1254
- | Story 1: Version/Help | 3 | ❌ 0% |
1255
- | Story 2: Core Files | 5 | ❌ 0% |
1256
- | Story 3: Hooks/Skills | 5 | ❌ 0% |
1257
- | Story 4: Linting | 8 | ❌ 0% |
1258
- | Story 5: Blocks Existing | 2 | ❌ 0% |
1259
- | Story 6: Non-Interactive | 3 | ❌ 0% |
1260
- | Story 7: Git Handling | 5 | ❌ 0% |
1261
- | Story 8: Health Check | 7 | ❌ 0% |
1262
- | Story 9: Upgrade | 7 | ❌ 0% |
1263
- | Story 10: Diff | 5 | ❌ 0% |
1264
- | Story 11: Reset | 10 | ❌ 0% |
1265
- | Story 12: Self-Healing | 6 | ❌ 0% |
1266
-
1267
- ### Test Type Distribution
1268
-
1269
- | Type | Count | Percentage |
1270
- |------|-------|------------|
1271
- | Unit | 4 | 6% |
1272
- | Integration | 66 | 94% |
1273
- | E2E | 0 | 0% |
1274
-
1275
- **Rationale for distribution**: CLI testing is primarily integration testing - we test commands against real file systems in temp directories. Unit tests are used only for pure functions (project type detection). No E2E tests needed as CLI doesn't require a browser.
1276
-
1277
- ### Skipped Tests Rationale
1278
-
1279
- None skipped.
1280
-
1281
- ---
1282
-
1283
- ## Test Execution
1284
-
1285
- ```bash
1286
- # Run all CLI tests
1287
- pnpm --filter @safeword/cli test
1288
-
1289
- # Run specific test file
1290
- pnpm --filter @safeword/cli test -- src/commands/setup.test.ts
1291
-
1292
- # Run tests matching pattern
1293
- pnpm --filter @safeword/cli test -- --grep "setup"
1294
-
1295
- # Run with coverage
1296
- pnpm --filter @safeword/cli test:coverage
1297
- ```
1298
-
1299
- ---
1300
-
1301
- **Last Updated**: 2025-11-27