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.
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-AIL5RL45.js +276 -0
  22. package/dist/setup-AIL5RL45.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,1034 +0,0 @@
1
- # Safeword Elite DX Implementation Plan
2
-
3
- Implementation roadmap for upgrading Safeword to elite developer experience standards.
4
-
5
- ---
6
-
7
- ## 1. One-Command Installation: Debate & Decision
8
-
9
- ### Option A: curl Installer
10
-
11
- ```bash
12
- curl -fsSL https://raw.githubusercontent.com/TheMostlyGreat/safeword/main/install.sh | bash
13
- ```
14
-
15
- **Pros:**
16
-
17
- - Universal (works on any Unix system without Node.js)
18
- - Fast (no npm registry delays)
19
- - Direct from source (GitHub)
20
- - Works in Docker, CI, minimal environments
21
- - Standard pattern (Rust, Homebrew, Docker use this)
22
-
23
- **Cons:**
24
-
25
- - Scary for security-conscious devs ("piping to bash")
26
- - No built-in version management (must handle manually)
27
- - Harder to distribute updates (users must re-curl)
28
- - Platform-specific (need separate Windows installer)
29
-
30
- **Best for:** System-level tools, language installers, cross-platform CLIs
31
-
32
- ---
33
-
34
- ### Option B: npx/npm
35
-
36
- ```bash
37
- npx @safeword/cli init
38
- # or
39
- npm install -g @safeword/cli
40
- safeword init
41
- ```
42
-
43
- **Pros:**
44
-
45
- - Instant run (npx downloads + executes, no install)
46
- - Automatic updates (npm handles versions)
47
- - Works cross-platform (Windows, macOS, Linux)
48
- - Familiar to all JS/TS devs
49
- - Can bundle as dev dependency (teammates auto-get it)
50
- - npm registry handles distribution
51
-
52
- **Cons:**
53
-
54
- - Requires Node.js (not universal)
55
- - npm registry can be slow
56
- - Global installs can conflict between projects
57
- - npx adds ~2-3s startup time on first run
58
-
59
- **Best for:** JavaScript/TypeScript project tooling, dev-focused CLIs
60
-
61
- ---
62
-
63
- ### Option C: brew tap (macOS only)
64
-
65
- ```bash
66
- brew install safeword/tap/safeword
67
- safeword init
68
- ```
69
-
70
- **Pros:**
71
-
72
- - Native package manager (trusted by macOS devs)
73
- - Automatic updates (brew upgrade)
74
- - Clean uninstall (brew uninstall)
75
- - Version pinning (brew pin)
76
-
77
- **Cons:**
78
-
79
- - macOS only (70%+ of devs, but not universal)
80
- - Requires maintaining Homebrew formula
81
- - Slower adoption (must discover tap)
82
- - Extra maintenance overhead
83
-
84
- **Best for:** macOS-first tools with broad appeal
85
-
86
- ---
87
-
88
- ### **RECOMMENDATION: Option B (npx/npm)**
89
-
90
- **Reasoning:**
91
-
92
- 1. **Target audience = JS/TS devs** - Safeword targets Claude Code users working on web projects. 99% have Node.js installed.
93
-
94
- 2. **Zero-friction distribution** - npm registry handles:
95
- - Versioning (`@safeword/cli@1.2.3`)
96
- - Updates (`npm update @safeword/cli`)
97
- - Platform detection (Windows, macOS, Linux)
98
- - Dependencies (no manual installs)
99
-
100
- 3. **Team onboarding magic** - Can add to `package.json`:
101
-
102
- ```json
103
- {
104
- "devDependencies": {
105
- "@safeword/cli": "^1.0.0"
106
- },
107
- "scripts": {
108
- "postinstall": "safeword verify --auto-init"
109
- }
110
- }
111
- ```
112
-
113
- Teammates run `npm install` → Safeword auto-configures. **Zero manual steps.**
114
-
115
- 4. **npx is instant** - No global install needed:
116
-
117
- ```bash
118
- npx @safeword/cli init # Downloads, runs, caches
119
- npx @safeword/cli status # Uses cached version
120
- ```
121
-
122
- 5. **Escape hatch for non-Node projects** - If someone wants Safeword for Python/Go/Rust, they can:
123
- ```bash
124
- npm install -g @safeword/cli # Install once
125
- safeword init # Use anywhere
126
- ```
127
-
128
- **Phase 2:** Add curl installer for non-Node users (Python/Go/Rust projects). But ship npx first.
129
-
130
- ---
131
-
132
- ## 2. Version Management
133
-
134
- ### Implementation
135
-
136
- **In CLI:**
137
-
138
- ```bash
139
- safeword --version # 1.2.3
140
- safeword update # Update to latest (npm update -g @safeword/cli)
141
- safeword update --version 1.2.0 # Install specific version (npm install -g @safeword/cli@1.2.0)
142
- safeword changelog # Print CHANGELOG.md or open in browser
143
- ```
144
-
145
- **Version in project:**
146
-
147
- - Store in `.safeword/version` file: `1.2.3`
148
- - CLI checks on `safeword status`:
149
-
150
- ```
151
- Project safeword version: 1.2.3
152
- Latest available: 1.3.0
153
-
154
- Update? safeword upgrade-project
155
- ```
156
-
157
- **Breaking changes:**
158
-
159
- - Semantic versioning (semver): `MAJOR.MINOR.PATCH`
160
- - Major bumps = breaking changes (require migration)
161
- - CLI detects version mismatch and offers migration:
162
-
163
- ```bash
164
- safeword status
165
-
166
- ⚠ Project safeword version (1.x) is outdated (latest: 2.0.0)
167
-
168
- Run migration: safeword migrate --from 1.x --to 2.x
169
- ```
170
-
171
- ---
172
-
173
- ## 3. Interactive Mode with Defaults
174
-
175
- ### Current Flow (Silent)
176
-
177
- ```bash
178
- bash ./framework/scripts/setup-safeword.sh
179
- # ... tons of output ...
180
- # Done
181
- ```
182
-
183
- ### Elite Flow (Interactive)
184
-
185
- ```bash
186
- safeword init
187
-
188
- # Detecting project...
189
- # ✓ Found: Next.js with TypeScript
190
- #
191
- # Install options:
192
- # [1] Recommended (auto-linting + quality review)
193
- # [2] Auto-linting only
194
- # [3] Quality review only
195
- # [4] Custom (choose components)
196
- #
197
- # Choice [1]:
198
- #
199
- # Linting mode:
200
- # [1] Auto-detect (recommended: biome)
201
- # [2] ESLint + Prettier
202
- # [3] Biome
203
- # [4] Skip linting
204
- #
205
- # Choice [1]:
206
- #
207
- # Installing... ███████████████████████░ 90%
208
- #
209
- # ✓ Configured in 4.2s
210
- #
211
- # Installed:
212
- # • Auto-linting (biome, 15MB)
213
- # • Quality review hooks
214
- # • SAFEWORD.md with .safeword/SAFEWORD.md reference
215
- #
216
- # Next steps:
217
- # 1. git add .safeword .claude SAFEWORD.md
218
- # 2. git commit -m "Add safeword config"
219
- # 3. Ask Claude to create a file (test hooks)
220
- #
221
- # Verification:
222
- # safeword status
223
- ```
224
-
225
- ### Non-interactive (CI mode)
226
-
227
- ```bash
228
- safeword init --yes # Accept all defaults
229
- safeword init --ci # Non-interactive, uses defaults, no colors
230
- safeword init --linting-only # Skip quality review
231
- ```
232
-
233
- ---
234
-
235
- ## 4. Automatic Verification
236
-
237
- ### What to Verify
238
-
239
- **After `safeword init`:**
240
-
241
- 1. **Files created:**
242
- - ✓ `.safeword/SAFEWORD.md` exists
243
- - ✓ `.safeword/guides/` exists (12 files)
244
- - ✓ `.claude/hooks/` exists (auto-lint.sh, auto-quality-review.sh, run-\*.sh)
245
- - ✓ `.claude/settings.json` exists
246
- - ✓ `SAFEWORD.md` or `CLAUDE.md` exists
247
-
248
- 2. **Hooks registered:**
249
- - ✓ PostToolUse hook → auto-lint.sh
250
- - ✓ Stop hook → auto-quality-review.sh
251
- - ✓ SessionStart hook → version-check.sh
252
-
253
- 3. **SAFEWORD.md reference:**
254
- - ✓ Contains `@./.safeword/SAFEWORD.md`
255
-
256
- 4. **Linting configured:**
257
- - ✓ `eslint.config.mjs` or `biome.jsonc` exists
258
- - ✓ `npm run lint` works
259
- - ✓ `npm run format` works
260
-
261
- 5. **Smoke test:**
262
- - Create temp file: `test-safeword.js`
263
- - Run linter on it: `npx biome check test-safeword.js` (should succeed)
264
- - Delete temp file
265
- - ✓ Linter works
266
-
267
- ### Output
268
-
269
- ```bash
270
- safeword init
271
-
272
- # ... setup runs ...
273
-
274
- Running verification...
275
-
276
- Files:
277
- ✓ .safeword/SAFEWORD.md
278
- ✓ .safeword/guides/ (12 guides)
279
- ✓ .claude/hooks/ (5 hooks)
280
- ✓ .claude/settings.json
281
- ✓ SAFEWORD.md
282
-
283
- Hooks:
284
- ✓ PostToolUse → auto-lint.sh
285
- ✓ Stop → auto-quality-review.sh
286
- ✓ SessionStart → version-check.sh
287
-
288
- Linting:
289
- ✓ biome.jsonc configured
290
- ✓ npm run lint works
291
- ✓ npm run format works
292
-
293
- ✓ All checks passed!
294
-
295
- Next: git add .safeword .claude SAFEWORD.md
296
- ```
297
-
298
- **If verification fails:**
299
-
300
- ```bash
301
- Running verification...
302
-
303
- Files:
304
- ✓ .safeword/SAFEWORD.md
305
- ✗ .claude/settings.json missing
306
-
307
- Fix: Re-run setup with --force
308
- safeword init --force
309
- ```
310
-
311
- ---
312
-
313
- ## 6. Global Config: No Global Folder
314
-
315
- ### Current Problem
316
-
317
- README says:
318
-
319
- ```bash
320
- # (Deprecated) global clone — prefer project-local scripts
321
- ```
322
-
323
- This creates **global state** that devs must manage:
324
-
325
- # Use project-local scripts in ./framework/scripts/, no global update step
326
-
327
- - Manual git operations
328
- - Confusing mental model (is safeword global or per-project?)
329
-
330
- ### Elite Solution: Project-Self-Contained
331
-
332
- **Core principle:** Everything lives in the project. Zero global folders.
333
-
334
- ```
335
- my-project/
336
- ├── .safeword/
337
- │ ├── SAFEWORD.md # Core patterns
338
- │ ├── guides/ # All guides (copied from npm package)
339
- │ ├── templates/ # Templates
340
- │ └── version # 1.2.3
341
- ├── .claude/
342
- │ ├── hooks/
343
- │ └── settings.json
344
- └── SAFEWORD.md # References @./.safeword/SAFEWORD.md
345
- ```
346
-
347
- **No global folder required. Fully portable and project-local.**
348
-
349
- ### How Updates Work
350
-
351
- **Option A: npm package contains everything**
352
-
353
- When you run `npx @safeword/cli init`:
354
-
355
- 1. CLI downloads from npm (contains all guides/templates/patterns)
356
- 2. Copies files to `.safeword/` in your project
357
- 3. Project is now **standalone** (no external dependencies)
358
-
359
- To update project:
360
-
361
- ```bash
362
- safeword upgrade-project
363
-
364
- # Fetching latest from npm...
365
- # Upgrading .safeword/ from 1.2.3 → 1.3.0
366
- #
367
- # Changed files:
368
- # • guides/testing-methodology.md (updated)
369
- # • guides/llm-prompting.md (new)
370
- #
371
- # ✓ Upgraded to 1.3.0
372
- ```
373
-
374
- **Internal:** CLI compares `.safeword/` files to npm package, only updates changed files.
375
-
376
- ---
377
-
378
- **Option B: Hidden cache for faster installs**
379
-
380
- CLI caches guides in `~/.cache/safeword/` (no global folder):
381
-
382
- ```
383
- ~/.cache/safeword/
384
- └── 1.3.0/ # Version-specific cache
385
- ├── SAFEWORD.md
386
- ├── guides/
387
- └── templates/
388
- ```
389
-
390
- **When you run `safeword init`:**
391
-
392
- 1. Check cache for latest version
393
- 2. If missing, download from npm → cache
394
- 3. Copy from cache to `.safeword/` in project
395
- 4. Project is standalone (cache only speeds up future installs)
396
-
397
- **Benefits:**
398
-
399
- - Faster installs (no repeated npm downloads)
400
- - Offline support (cached versions work without network)
401
- - Multiple projects share cache (save disk space)
402
-
403
- **Clear cache:**
404
-
405
- ```bash
406
- safeword cache clear # Remove all cached versions
407
- safeword cache clear --older-than 1.2.0 # Remove old versions
408
- ```
409
-
410
- **Important:** Cache is **optional optimization**. Projects don't depend on it. If cache deleted, CLI re-downloads from npm.
411
-
412
- ---
413
-
414
- ### Learnings: Global or Project-Scoped?
415
-
416
- **Problem:** Where do custom learnings go?
417
-
418
- **Current:** `.safeword/learnings/[concept].md` (project-local, shared via repo)
419
-
420
- **Elite approach:** Both!
421
-
422
- ```
423
- # Project-specific learnings (this codebase only)
424
- my-project/.safeword/learnings/custom-auth-flow.md
425
-
426
- # Global learnings (reusable across projects)
427
- ~/.config/safeword/learnings/react-hooks-gotchas.md
428
- ```
429
-
430
- **CLI behavior:**
431
-
432
- ```bash
433
- # In project directory
434
- safeword learning add react-hooks-gotchas --global
435
- # Creates: ~/.config/safeword/learnings/react-hooks-gotchas.md
436
-
437
- safeword learning add custom-auth-flow
438
- # Creates: .safeword/learnings/custom-auth-flow.md (project-local)
439
-
440
- safeword learning list
441
- # Shows both global + project learnings
442
- ```
443
-
444
- **Agent behavior:** When agent needs learnings, check both:
445
-
446
- 1. `.safeword/learnings/*` (project-specific)
447
- 2. `~/.config/safeword/learnings/*` (global, cross-project)
448
-
449
- **Why:** Some learnings are universal (React hooks), others are project-specific (your auth flow).
450
-
451
- ---
452
-
453
- ## 7. Zero Setup for Teammates
454
-
455
- ### The Problem
456
-
457
- **Current flow:**
458
-
459
- 1. Dev sets up safeword: `bash ./framework/scripts/setup-safeword.sh`
460
- 2. Commits `.safeword/` and `.claude/` to git
461
- 3. Teammate clones project
462
- 4. Teammate has safeword files but **hooks don't work** (no CLI installed)
463
- 5. Teammate must read docs, install CLI, run setup
464
-
465
- **Pain:** 5 manual steps. High friction.
466
-
467
- ---
468
-
469
- ### Elite Solution: Automatic Onboarding
470
-
471
- **Step 1: Dev sets up project**
472
-
473
- ```bash
474
- cd my-project
475
- npx @safeword/cli init
476
-
477
- # Installs safeword, adds to package.json
478
- ```
479
-
480
- **package.json after setup:**
481
-
482
- ```json
483
- {
484
- "devDependencies": {
485
- "@safeword/cli": "^1.0.0"
486
- },
487
- "scripts": {
488
- "postinstall": "safeword verify --auto-init"
489
- }
490
- }
491
- ```
492
-
493
- **Step 2: Dev commits**
494
-
495
- ```bash
496
- git add .safeword/ .claude/ SAFEWORD.md package.json
497
- git commit -m "Add safeword config"
498
- git push
499
- ```
500
-
501
- **Step 3: Teammate clones and installs**
502
-
503
- ```bash
504
- git clone my-project
505
- cd my-project
506
- npm install # or pnpm install, yarn install
507
- ```
508
-
509
- **What happens automatically:**
510
-
511
- 1. `npm install` runs
512
- 2. Installs `@safeword/cli` (from package.json)
513
- 3. Runs `postinstall` script → `safeword verify --auto-init`
514
- 4. CLI checks:
515
- - ✓ `.safeword/` exists (from git)
516
- - ✓ `.claude/` exists (from git)
517
- - ✓ SAFEWORD.md exists (from git)
518
- - ✓ Hooks registered in `.claude/settings.json`
519
- 5. Output:
520
-
521
- ```
522
- Safeword detected in project
523
- ✓ Configuration valid
524
- ✓ Hooks active
525
-
526
- Ready to use Claude Code!
527
- ```
528
-
529
- **Teammate is done.** Zero manual steps. Hooks work immediately.
530
-
531
- ---
532
-
533
- ### What `safeword verify --auto-init` Does
534
-
535
- ```bash
536
- safeword verify --auto-init
537
-
538
- # Check if project has safeword files
539
- if [ -d .safeword ] && [ -d .claude ]; then
540
- # Project already configured
541
- echo "✓ Safeword configured"
542
-
543
- # Verify hooks are valid
544
- if [ hooks_valid ]; then
545
- echo "✓ Hooks active"
546
- exit 0
547
- else
548
- echo "⚠ Hooks invalid, repairing..."
549
- repair_hooks()
550
- exit 0
551
- fi
552
- else
553
- # Project not configured (first dev)
554
- if [ --auto-init flag ]; then
555
- echo "Initializing safeword..."
556
- safeword init --yes
557
- else
558
- echo "Safeword not configured. Run: safeword init"
559
- exit 1
560
- fi
561
- fi
562
- ```
563
-
564
- ---
565
-
566
- ### Alternative: Pre-commit Hook (No postinstall)
567
-
568
- Some teams don't want `postinstall` scripts (security concerns).
569
-
570
- **Alternative:** Add to `.git/hooks/post-checkout`:
571
-
572
- ```bash
573
- #!/bin/bash
574
- # Auto-verify safeword on branch checkout
575
-
576
- if command -v safeword &> /dev/null; then
577
- safeword verify --silent
578
- fi
579
- ```
580
-
581
- Teammate checks out branch → Hooks auto-verify.
582
-
583
- ---
584
-
585
- ### Why This is Elite
586
-
587
- **Zero documentation needed.** Teammate workflow:
588
-
589
- 1. `git clone`
590
- 2. `npm install`
591
- 3. Done
592
-
593
- Compare to current:
594
-
595
- 1. `git clone`
596
- 2. Read README
597
- 3. Install safeword manually
598
- 4. Run setup script
599
- 5. Hope it worked
600
-
601
- **5 steps → 2 steps.** That's elite.
602
-
603
- ---
604
-
605
- ## 11. CI/CD Mode: What It Means
606
-
607
- ### The Problem
608
-
609
- **CI/CD pipelines are non-interactive:**
610
-
611
- - No human to answer prompts
612
- - No TTY (no colors, no progress bars)
613
- - Failure = block deployment
614
-
615
- **Current safeword setup:**
616
-
617
- - Prompts for input (breaks CI)
618
- - Verbose output (clutters logs)
619
- - No way to verify success programmatically
620
-
621
- ---
622
-
623
- ### Elite Solution: CI-Friendly Mode
624
-
625
- ```bash
626
- safeword init --ci
627
-
628
- # Non-interactive (uses defaults)
629
- # No colors (plain text only)
630
- # Minimal output (only errors + summary)
631
- # Exit code 0 = success, 1 = failure
632
- ```
633
-
634
- **Example CI usage (GitHub Actions):**
635
-
636
- ```yaml
637
- name: Verify Safeword
638
- on: [push, pull_request]
639
-
640
- jobs:
641
- verify:
642
- runs-on: ubuntu-latest
643
- steps:
644
- - uses: actions/checkout@v3
645
- - uses: actions/setup-node@v3
646
- - run: npm install
647
- - run: npx @safeword/cli verify --ci
648
- # ✓ Passes if safeword configured correctly
649
- # ✗ Fails if hooks missing or invalid
650
- ```
651
-
652
- ---
653
-
654
- ### CI Mode Flags
655
-
656
- ```bash
657
- safeword init --ci
658
- # = --yes (auto-accept) + --no-color + --minimal-output
659
-
660
- safeword init --yes
661
- # Accept all defaults (but still colorful)
662
-
663
- safeword init --no-color
664
- # Plain text (no ANSI colors)
665
-
666
- safeword verify --ci
667
- # Verify hooks + exit 0/1 (for CI pass/fail)
668
- ```
669
-
670
- ---
671
-
672
- ### Why CI Mode Matters
673
-
674
- **Use cases:**
675
-
676
- 1. **Enforce safeword in PRs:**
677
-
678
- ```yaml
679
- - run: npx @safeword/cli verify --ci
680
- ```
681
-
682
- PR fails if safeword not configured → Forces devs to set it up.
683
-
684
- 2. **Auto-setup in Docker:**
685
-
686
- ```dockerfile
687
- RUN npx @safeword/cli init --ci
688
- ```
689
-
690
- No prompts, works in non-interactive Docker build.
691
-
692
- 3. **Monorepo setup script:**
693
- ```bash
694
- for project in packages/*; do
695
- cd $project
696
- npx @safeword/cli init --yes
697
- done
698
- ```
699
- Batch setup without manual prompts.
700
-
701
- ---
702
-
703
- ## 12. CLI Language: TypeScript vs Bash
704
-
705
- ### Debate
706
-
707
- | Criteria | TypeScript | Bash |
708
- | ---------------------- | --------------------------- | ---------------------------- |
709
- | **npm distribution** | ✓ Native (npm packages) | ⚠ Requires bundling |
710
- | **Cross-platform** | ✓ Node.js everywhere | ⚠ Windows needs WSL/Git Bash |
711
- | **Version management** | ✓ package.json | ✗ Manual versioning |
712
- | **Testing** | ✓ Jest/Vitest | ⚠ bats or manual |
713
- | **Maintainability** | ✓ Type safety, refactorable | ⚠ Brittle, hard to refactor |
714
- | **Speed** | ⚠ 100-200ms Node.js startup | ✓ Instant (native) |
715
- | **Dependencies** | ✓ npm ecosystem | ⚠ Limited (jq, curl, grep) |
716
- | **File operations** | ✓ fs module | ✓ Native |
717
- | **JSON parsing** | ✓ Native | ⚠ Requires jq |
718
- | **Error handling** | ✓ Try/catch | ⚠ set -e (brittle) |
719
-
720
- ---
721
-
722
- ### **RECOMMENDATION: TypeScript**
723
-
724
- **Reasoning:**
725
-
726
- 1. **Target audience = JS/TS devs** - They're comfortable with TypeScript, not shell scripting.
727
-
728
- 2. **npm ecosystem = perfect fit:**
729
- - Publish to npm registry (`@safeword/cli`)
730
- - Users run with `npx` (no install needed)
731
- - Automatic version management
732
-
733
- 3. **Maintainability >> startup speed:**
734
- - Current bash scripts are 700+ lines each
735
- - Adding features (interactive mode, verification) will balloon to 2000+ lines
736
- - TypeScript is refactorable, testable, readable
737
- - Bash at that scale becomes unmaintainable
738
-
739
- 4. **Cross-platform by default:**
740
- - No Windows compatibility headaches
741
- - Node.js handles file paths, line endings, etc.
742
-
743
- 5. **Rich CLI libraries:**
744
- - Interactive prompts: `inquirer`, `prompts`
745
- - Progress bars: `ora`, `cli-progress`
746
- - Colors: `chalk`, `picocolors`
747
- - File operations: `fs-extra`, `globby`
748
- - JSON parsing: Native (no jq dependency)
749
-
750
- 6. **Testing:**
751
- - Unit tests: Vitest
752
- - Integration tests: Mock file system
753
- - CI-friendly (no manual testing)
754
-
755
- ---
756
-
757
- ### TypeScript CLI Architecture
758
-
759
- ```
760
- @safeword/cli/
761
- ├── src/
762
- │ ├── commands/
763
- │ │ ├── init.ts # safeword init
764
- │ │ ├── status.ts # safeword status
765
- │ │ ├── verify.ts # safeword verify
766
- │ │ ├── upgrade.ts # safeword upgrade-project
767
- │ │ └── learning.ts # safeword learning add/list
768
- │ ├── lib/
769
- │ │ ├── files.ts # File operations (copy guides, etc)
770
- │ │ ├── hooks.ts # Hook registration/verification
771
- │ │ ├── detect.ts # Project type detection
772
- │ │ ├── verify.ts # Verification checks
773
- │ │ └── version.ts # Version management
774
- │ ├── templates/ # Embedded templates (SAFEWORD.md, guides)
775
- │ └── cli.ts # Entry point
776
- ├── package.json
777
- └── tsconfig.json
778
- ```
779
-
780
- **Entry point (`cli.ts`):**
781
-
782
- ```typescript
783
- #!/usr/bin/env node
784
- import { Command } from 'commander';
785
- import { init } from './commands/init';
786
- import { status } from './commands/status';
787
- import { verify } from './commands/verify';
788
-
789
- const program = new Command();
790
-
791
- program.name('safeword').description('Elite DX for Claude Code patterns').version('1.0.0');
792
-
793
- program
794
- .command('init')
795
- .description('Initialize safeword in current project')
796
- .option('--yes', 'Accept all defaults')
797
- .option('--ci', 'Non-interactive mode for CI/CD')
798
- .option('--linting-only', 'Skip quality review setup')
799
- .action(init);
800
-
801
- program.command('status').description('Show project status and health').action(status);
802
-
803
- program
804
- .command('verify')
805
- .description('Verify safeword configuration')
806
- .option('--auto-init', 'Auto-initialize if not configured')
807
- .option('--ci', 'CI mode (exit 0/1)')
808
- .action(verify);
809
-
810
- program.parse();
811
- ```
812
-
813
- ---
814
-
815
- ### Embedding Templates
816
-
817
- **Templates live in npm package:**
818
-
819
- ```
820
- @safeword/cli/src/templates/
821
- ├── SAFEWORD.md
822
- ├── guides/
823
- │ ├── testing-methodology.md
824
- │ ├── code-philosophy.md
825
- │ └── ...
826
- ├── hooks/
827
- │ ├── auto-lint.sh
828
- │ ├── auto-quality-review.sh
829
- │ └── ...
830
- └── config/
831
- ├── eslint.config.mjs.template
832
- ├── biome.jsonc.template
833
- └── .prettierrc.template
834
- ```
835
-
836
- **On `safeword init`:**
837
-
838
- ```typescript
839
- import fs from 'fs-extra';
840
- import path from 'path';
841
-
842
- export async function copyTemplates(projectDir: string) {
843
- const templatesDir = path.join(__dirname, '../templates');
844
- const targetDir = path.join(projectDir, '.safeword');
845
-
846
- // Copy all templates to project
847
- await fs.copy(templatesDir, targetDir);
848
-
849
- console.log('✓ Copied guides and patterns to .safeword/');
850
- }
851
- ```
852
-
853
- **Result:** Project is standalone. No external dependencies.
854
-
855
- ---
856
-
857
- ## 10. Progress Bar + Summary Output
858
-
859
- ### Current (Verbose)
860
-
861
- ```
862
- ================================
863
- Claude Code Project Setup
864
- Version: v1.0.0
865
- ================================
866
-
867
- Setting up project in: /Users/alex/projects/my-app
868
-
869
- [1/2] Running linting setup (mode: biome)...
870
-
871
- ================================
872
- Claude Code Linting Setup
873
- Mode: biome
874
- ================================
875
-
876
- [1/6] Checking for package.json...
877
- ✓ package.json exists
878
-
879
- [2/6] Checking dependencies...
880
- ✓ Dependencies checked
881
-
882
- [3/6] Checking for Biome...
883
- Installing packages (this may take a moment)...
884
- Packages: @biomejs/biome
885
- ✓ Installed packages for biome mode
886
-
887
- ... (50 more lines) ...
888
- ```
889
-
890
- ---
891
-
892
- ### Elite (Concise)
893
-
894
- ```bash
895
- safeword init
896
-
897
- Detecting project... ✓ Next.js with TypeScript
898
-
899
- Install options:
900
- [1] Recommended (auto-linting + quality review)
901
- [2] Auto-linting only
902
- [3] Quality review only
903
-
904
- Choice [1]:
905
-
906
- Installing...
907
-
908
- Linting (biome) ████████████████████ 15.2 MB
909
- Quality review ████████████████████ 2.1 MB
910
- Guides ████████████████████ 1.8 MB
911
-
912
- ✓ Configured in 4.2s
913
-
914
- Installed:
915
- • Auto-linting (biome)
916
- • Quality review hooks
917
- • 12 guides in .safeword/
918
-
919
- Next: git add .safeword .claude SAFEWORD.md
920
- ```
921
-
922
- ---
923
-
924
- ### Implementation (TypeScript)
925
-
926
- ```typescript
927
- import ora from 'ora';
928
- import chalk from 'chalk';
929
-
930
- export async function install(options: InstallOptions) {
931
- const spinner = ora('Detecting project...').start();
932
-
933
- const projectType = await detectProjectType();
934
- spinner.succeed(`Detected: ${projectType}`);
935
-
936
- // Interactive prompts
937
- const answers = await prompt([
938
- {
939
- type: 'select',
940
- name: 'mode',
941
- message: 'Install options:',
942
- choices: [
943
- { title: 'Recommended (auto-linting + quality review)', value: 'full' },
944
- { title: 'Auto-linting only', value: 'linting' },
945
- { title: 'Quality review only', value: 'quality' },
946
- ],
947
- initial: 0,
948
- },
949
- ]);
950
-
951
- // Install with progress
952
- spinner.start('Installing...');
953
-
954
- await installLinting({ onProgress: pct => (spinner.text = `Linting ${pct}%`) });
955
- await installQualityReview({ onProgress: pct => (spinner.text = `Quality review ${pct}%`) });
956
- await copyGuides({ onProgress: pct => (spinner.text = `Guides ${pct}%`) });
957
-
958
- spinner.succeed('Configured in 4.2s');
959
-
960
- // Summary
961
- console.log('\nInstalled:');
962
- console.log(' • Auto-linting (biome)');
963
- console.log(' • Quality review hooks');
964
- console.log(' • 12 guides in .safeword/');
965
- console.log('\nNext: git add .safeword .claude SAFEWORD.md');
966
- }
967
- ```
968
-
969
- ---
970
-
971
- ## Implementation Phases
972
-
973
- ### Phase 1: Core CLI (v1.0.0)
974
-
975
- - ✓ TypeScript CLI with commander
976
- - ✓ `safeword init` (interactive + --ci mode)
977
- - ✓ Automatic verification after init
978
- - ✓ `safeword --version`
979
- - ✓ Progress bar + summary output
980
- - ✓ Embed templates in npm package
981
- - ✓ Publish to npm as `@safeword/cli`
982
-
983
- ### Phase 2: Advanced Features (v1.1.0)
984
-
985
- - ✓ `safeword status` (health check)
986
- - ✓ `safeword upgrade-project` (update guides)
987
- - ✓ `safeword learning add/list` (manage learnings)
988
- - ✓ `safeword verify --auto-init` (teammate onboarding)
989
-
990
- ### Phase 3: Ecosystem (v1.2.0)
991
-
992
- - ✓ `safeword cache clear` (manage cache)
993
- - ✓ `safeword migrate --from 1.x --to 2.x` (version migrations)
994
- - ✓ curl installer (for non-Node projects)
995
- - ✓ VS Code extension (status bar + quick actions)
996
-
997
- ---
998
-
999
- ## Next Steps
1000
-
1001
- 1. **Create TypeScript CLI scaffold:**
1002
-
1003
- ```bash
1004
- mkdir packages/cli
1005
- cd packages/cli
1006
- npm init -y
1007
- npm install commander inquirer ora chalk fs-extra
1008
- npm install -D typescript @types/node
1009
- ```
1010
-
1011
- 2. **Port bash scripts to TypeScript:**
1012
- - `setup-safeword.sh` → `src/commands/init.ts`
1013
- - `setup-linting.sh` → `src/lib/linting.ts`
1014
- - `setup-quality.sh` → `src/lib/quality-review.ts`
1015
-
1016
- 3. **Embed templates:**
1017
- - Copy `SAFEWORD.md`, `guides/`, `hooks/` to `src/templates/`
1018
-
1019
- 4. **Test locally:**
1020
-
1021
- ```bash
1022
- npm link
1023
- cd ~/test-project
1024
- safeword init
1025
- ```
1026
-
1027
- 5. **Publish to npm:**
1028
-
1029
- ```bash
1030
- npm publish --access public
1031
- ```
1032
-
1033
- 6. **Update README:**
1034
- - Replace bash install with `npx @safeword/cli init`