contextos-agents 1.7.0 → 2.0.0-beta.2

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 (309) hide show
  1. package/.agents/AGENTS.md +1 -1
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +80 -101
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +574 -111
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +719 -64
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +259 -60
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver.js +50 -534
  40. package/.agents/schemas/attestation.review.v1.json +111 -0
  41. package/.agents/schemas/attestation.verification.v1.json +85 -0
  42. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  43. package/.agents/schemas/profile.v2.schema.json +114 -0
  44. package/.agents/schemas/runtime.thread.v1.json +192 -0
  45. package/.agents/schemas/skill.manifest.v2.json +177 -0
  46. package/.agents/schemas/verification.spec.v1.json +39 -0
  47. package/.agents/schemas/workspace.graph.schema.json +106 -0
  48. package/.agents/transaction-core/event-store.js +288 -0
  49. package/.agents/transaction-core/idempotency.js +129 -0
  50. package/.agents/transaction-core/ipc-lock.js +311 -0
  51. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  52. package/.agents/validate.js +44 -1
  53. package/.agents/watch.js +354 -102
  54. package/.agents/workspace/workspace-graph.js +778 -0
  55. package/README.md +59 -387
  56. package/benchmarks/v2/analysis/statistics.js +140 -0
  57. package/benchmarks/v2/analysis/stats.js +69 -0
  58. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  59. package/benchmarks/v2/dataset.schema.json +34 -0
  60. package/benchmarks/v2/evaluators/index.js +25 -0
  61. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  62. package/benchmarks/v2/harness/runner.js +88 -0
  63. package/benchmarks/v2/pilot-tasks.json +392 -0
  64. package/bin/commands/recover.js +88 -0
  65. package/bin/commands/update.js +80 -17
  66. package/bin/commands.js +62 -25
  67. package/bin/index.js +138 -81
  68. package/bin/lib/lockfile.js +5 -3
  69. package/bin/lib/safe-writer.js +34 -3
  70. package/package.json +85 -72
  71. package/registry.json +2 -2
  72. package/registry.v2.schema.json +86 -0
  73. package/.agents/core/profiles/backend.yaml +0 -47
  74. package/.agents/core/profiles/enterprise.yaml +0 -46
  75. package/.agents/core/profiles/frontend.yaml +0 -46
  76. package/.agents/core/profiles/hackathon.yaml +0 -45
  77. package/.agents/core/profiles/mvp.yaml +0 -44
  78. package/.agents/core/profiles/startup.yaml +0 -48
  79. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  80. package/.agents/core/skills/adapters/SKILL.md +0 -105
  81. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  82. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  83. package/.agents/core/skills/adapters/skill.yaml +0 -16
  84. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  85. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  86. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  87. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  88. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  89. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  90. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  91. package/.agents/core/skills/database/SKILL.md +0 -101
  92. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  93. package/.agents/core/skills/database/VALIDATION.json +0 -11
  94. package/.agents/core/skills/database/skill.yaml +0 -31
  95. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  96. package/.agents/core/skills/ddd/SKILL.md +0 -247
  97. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  98. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  99. package/.agents/core/skills/ddd/ddd.md +0 -178
  100. package/.agents/core/skills/ddd/skill.yaml +0 -17
  101. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  102. package/.agents/core/skills/decisions/SKILL.md +0 -90
  103. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  104. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  105. package/.agents/core/skills/decisions/skill.yaml +0 -16
  106. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  107. package/.agents/core/skills/docker/SKILL.md +0 -63
  108. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  109. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  110. package/.agents/core/skills/docker/skill.yaml +0 -29
  111. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  112. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  113. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  114. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  115. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  116. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  117. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  118. package/.agents/core/skills/generators/SKILL.md +0 -112
  119. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  120. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  121. package/.agents/core/skills/generators/skill.yaml +0 -25
  122. package/.agents/core/skills/generators/templates/API.md +0 -77
  123. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  124. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  125. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  126. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  127. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  128. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  129. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  130. package/.agents/core/skills/generators/templates/UI.md +0 -73
  131. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  132. package/.agents/core/skills/graphify/SKILL.md +0 -130
  133. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  134. package/.agents/core/skills/graphify/skill.yaml +0 -18
  135. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  136. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  137. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  138. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  139. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  140. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  141. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  142. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  143. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  144. package/.agents/core/skills/microservices/SKILL.md +0 -164
  145. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  146. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  147. package/.agents/core/skills/microservices/microservices.md +0 -119
  148. package/.agents/core/skills/microservices/skill.yaml +0 -17
  149. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  150. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  151. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  152. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  153. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  154. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  155. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  156. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  157. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  158. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  159. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  160. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  161. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  162. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  163. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  164. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  165. package/.agents/core/skills/node/SKILL.md +0 -128
  166. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  167. package/.agents/core/skills/node/VALIDATION.json +0 -12
  168. package/.agents/core/skills/node/node.md +0 -87
  169. package/.agents/core/skills/node/skill.yaml +0 -17
  170. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  171. package/.agents/core/skills/performance/SKILL.md +0 -75
  172. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  173. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  174. package/.agents/core/skills/performance/performance.md +0 -52
  175. package/.agents/core/skills/performance/skill.yaml +0 -17
  176. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  177. package/.agents/core/skills/react/SKILL.md +0 -132
  178. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  179. package/.agents/core/skills/react/VALIDATION.json +0 -12
  180. package/.agents/core/skills/react/react.md +0 -93
  181. package/.agents/core/skills/react/skill.yaml +0 -17
  182. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  183. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  185. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  186. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  187. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  188. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  189. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  190. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  191. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  192. package/.agents/core/skills/state-management/SKILL.md +0 -48
  193. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  194. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  195. package/.agents/core/skills/state-management/skill.yaml +0 -28
  196. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  197. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  198. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  199. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  200. package/.agents/core/skills/system-design/SKILL.md +0 -419
  201. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  202. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  203. package/.agents/core/skills/system-design/skill.yaml +0 -20
  204. package/.agents/core/skills/system-design/system-design.md +0 -112
  205. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  206. package/.agents/core/skills/testing/SKILL.md +0 -70
  207. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  208. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  209. package/.agents/core/skills/testing/skill.yaml +0 -32
  210. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  211. package/.agents/core/skills/typescript/SKILL.md +0 -112
  212. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  213. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  214. package/.agents/core/skills/typescript/skill.yaml +0 -17
  215. package/.agents/core/skills/typescript/typescript.md +0 -71
  216. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  217. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  218. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  219. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  220. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  221. package/.agents/core/skills/ui-design/ui.md +0 -88
  222. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  223. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  224. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  225. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  226. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  227. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  228. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  229. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  230. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  231. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  232. package/.agents/core/skills/ux-design/ux.md +0 -80
  233. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  234. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  235. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  236. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  237. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  238. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  239. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  240. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  241. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  242. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  243. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  244. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  245. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  246. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  247. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  248. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  249. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  250. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  251. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  252. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  253. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  254. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  255. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  256. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  257. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  258. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  259. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  260. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  261. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  262. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  263. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  264. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  265. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  266. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  267. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  268. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  269. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  270. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  271. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  272. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  273. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  274. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  275. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  276. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  277. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  278. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  279. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  280. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  281. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  282. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  283. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  284. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  285. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  286. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  287. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  288. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  289. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  290. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  291. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  292. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  293. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  294. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  295. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  296. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  297. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  298. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  299. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  300. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  301. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  302. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  303. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  304. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  305. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  306. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  307. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  308. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  309. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -1,144 +0,0 @@
1
- ---
2
- name: docker
3
- description: >
4
- Docker containerization, multi-stage builds, non-root security, layer caching optimization, and docker-compose standards.
5
- ---
6
- # Docker
7
-
8
- ## Overview
9
-
10
- Containerization, Dockerfile architecture, security best practices, and container orchestration for production workloads.
11
-
12
- ## When to Use
13
-
14
- Activate when creating or optimizing Dockerfiles, docker-compose configurations, container security audits, or CI/CD container builds.
15
-
16
- ## Rules & Patterns
17
-
18
- ### Negative Constraints (What NOT to Do)
19
-
20
- 1. **NEVER run containers as `root` in production**: Always create and switch to an unprivileged non-root user (e.g. `USER node` or `USER nonroot`).
21
- 2. **NEVER use the `latest` tag**: Always pin base images to specific immutable version digests or explicit minor tags (e.g. `node:20.12.2-alpine3.19`).
22
- 3. **NEVER copy source code before `package.json`**: Always copy lockfiles and install dependencies first to leverage Docker's layer caching.
23
- 4. **NEVER bake secrets, API keys, or `.env` files into image layers**: Pass secrets via build-time secret mounts (`--mount=type=secret`) or runtime environment variables.
24
- 5. **NEVER include build tools or devDependencies in the final runner image**: Always use multi-stage builds to discard compilers and package managers from production images.
25
-
26
- ### Multi-Stage Standard Pattern
27
-
28
- ```dockerfile
29
- FROM node:20.12.2-alpine3.19 AS builder
30
- WORKDIR /app
31
- COPY package.json package-lock.json ./
32
- RUN npm ci
33
- COPY . .
34
- RUN npm run build && npm prune --production
35
-
36
- FROM node:20.12.2-alpine3.19 AS runner
37
- WORKDIR /app
38
- ENV NODE_ENV=production
39
- RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 appuser -G appgroup
40
- COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
41
- COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
42
- USER appuser
43
- CMD ["node", "dist/index.js"]
44
- ```
45
-
46
- ## Code Examples
47
-
48
- See `EXAMPLES.md` for production Dockerfiles and dockerignore patterns.
49
-
50
- ## Validation Checklist
51
-
52
- - [ ] Multi-stage build separates build tools from runtime
53
- - [ ] Non-root `USER` directive active in final stage
54
- - [ ] Base images pinned to exact versions
55
- - [ ] `.dockerignore` file prevents leaking node_modules or secrets
56
-
57
- ## Common Mistakes
58
-
59
- - Copying entire workspace before `npm ci`, breaking Docker cache. See `TROUBLESHOOTING.md`.
60
-
61
- ## Integration Notes
62
-
63
- Interacts with `security` (container hardening) and `node` / `nextjs` / `fastapi`.
64
-
65
-
66
- <!-- Source: EXAMPLES.md -->
67
-
68
- # Docker Examples — Anti-patterns vs ContextOS Standard
69
-
70
- ## Example 1: Multi-Stage Build & Layer Caching
71
-
72
- ### Anti-pattern: Anti-pattern (Fat single-stage image running as root)
73
-
74
- ```dockerfile
75
- # BAD: 1.2GB image, runs as root, breaks caching on every file edit
76
- FROM node:latest
77
- WORKDIR /app
78
- COPY . .
79
- RUN npm install
80
- RUN npm run build
81
- EXPOSE 3000
82
- CMD ["npm", "start"]
83
- ```
84
-
85
- ### Best practice: ContextOS Standard (Slim multi-stage build with non-root user)
86
-
87
- ```dockerfile
88
- # GOOD: 95MB image, non-root user, optimized layer caching
89
- FROM node:20.12.2-alpine3.19 AS builder
90
- WORKDIR /app
91
- COPY package.json package-lock.json ./
92
- RUN npm ci
93
- COPY . .
94
- RUN npm run build && npm prune --production
95
-
96
- FROM node:20.12.2-alpine3.19 AS runner
97
- WORKDIR /app
98
- ENV NODE_ENV=production
99
- RUN addgroup -S -g 1001 appgroup && adduser -S -u 1001 appuser -G appgroup
100
- COPY --from=builder --chown=appuser:appgroup /app/dist ./dist
101
- COPY --from=builder --chown=appuser:appgroup /app/node_modules ./node_modules
102
- USER appuser
103
- CMD ["node", "dist/main.js"]
104
- ```
105
-
106
- ---
107
-
108
- ## Example 2: Docker Ignore File (`.dockerignore`)
109
-
110
- ### Best practice: ContextOS Standard `.dockerignore`
111
-
112
- ```gitignore
113
- node_modules
114
- npm-debug.log
115
- .git
116
- .gitignore
117
- .env
118
- .env.*
119
- dist
120
- coverage
121
- .DS_Store
122
- *.md
123
- ```
124
-
125
- <!-- Source: TROUBLESHOOTING.md -->
126
-
127
- # Docker Troubleshooting Guide
128
-
129
- ## Common Issues & Fixes
130
-
131
- ### 1. Slow Docker builds rebuilding node_modules every time
132
-
133
- - **Cause**: Copying the entire directory (`COPY . .`) before running `npm ci`.
134
- - **Fix**: Copy `package.json` and `package-lock.json` separately first, run `npm ci`, and only then copy application source code.
135
-
136
- ### 2. Permission Denied Errors with Non-Root Users
137
-
138
- - **Cause**: Files copied from builder without changing ownership.
139
- - **Fix**: Always use `--chown=appuser:appgroup` when copying files in Dockerfile.
140
-
141
- ### 3. Missing native build dependencies on Alpine Linux
142
-
143
- - **Cause**: Packages requiring C bindings (e.g. `sharp`, `bcrypt`) fail on musl libc.
144
- - **Fix**: Add `RUN apk add --no-cache libc6-compat python3 make g++` in the builder stage.
@@ -1,209 +0,0 @@
1
- ---
2
- name: FastAPI
3
- description: >
4
- ContextOS skill for FastAPI
5
- ---
6
- # FastAPI
7
-
8
- ## Overview
9
-
10
- High-performance Python backend engineering using FastAPI, Pydantic v2, and async SQLAlchemy/Tortoise ORM. Enforces type-driven request validation, OpenAPI contracts, and async non-blocking endpoints.
11
-
12
- ## When to Use
13
-
14
- Activate when building Python REST APIs, microservices, asynchronous background jobs, or integrating Python ML services into web backends.
15
-
16
- ## Rules & Patterns
17
- <!-- Source: fastapi.md -->
18
-
19
- ## FastAPI — Best Practices
20
-
21
- ## Project Structure
22
-
23
- ```
24
- app/
25
- ├── main.py # App entry, CORS, middleware
26
- ├── config.py # Settings with Pydantic BaseSettings
27
- ├── database.py # Database session, engine
28
- ├── models/ # SQLAlchemy models
29
- │ ├── __init__.py
30
- │ └── user.py
31
- ├── schemas/ # Pydantic schemas (request/response)
32
- │ ├── __init__.py
33
- │ └── user.py
34
- ├── api/ # Route handlers
35
- │ ├── __init__.py
36
- │ ├── deps.py # Dependency injection
37
- │ └── v1/
38
- │ ├── __init__.py
39
- │ └── users.py
40
- ├── services/ # Business logic
41
- │ └── user_service.py
42
- ├── repositories/ # Database access
43
- │ └── user_repo.py
44
- └── tests/
45
- └── test_users.py
46
- ```
47
-
48
- ## Pydantic Models
49
-
50
- ```python
51
- from pydantic import BaseModel, EmailStr, Field
52
-
53
- class UserCreate(BaseModel):
54
- email: EmailStr
55
- name: str = Field(..., min_length=1, max_length=100)
56
-
57
- class UserResponse(BaseModel):
58
- id: int
59
- email: str
60
- name: str
61
-
62
- model_config = ConfigDict(from_attributes=True)
63
- ```
64
-
65
- ## Dependency Injection
66
-
67
- ```python
68
- from fastapi import Depends
69
- from sqlalchemy.ext.asyncio import AsyncSession
70
-
71
- async def get_db() -> AsyncGenerator[AsyncSession, None]:
72
- async with async_session() as session:
73
- yield session
74
-
75
- async def get_current_user(
76
- token: str = Depends(oauth2_scheme),
77
- db: AsyncSession = Depends(get_db)
78
- ) -> User:
79
- # Verify token, return user
80
- ...
81
- ```
82
-
83
- ## Async
84
-
85
- - **Use async** for all I/O operations (database, HTTP calls, file I/O)
86
- - **Never block the event loop** — no sync I/O in async endpoints
87
- - **Use `asyncio.gather`** for parallel async operations
88
- - **Background tasks** — `BackgroundTasks` for non-critical work
89
-
90
- ## Error Handling
91
-
92
- ```python
93
- from fastapi import HTTPException
94
-
95
- class AppException(HTTPException):
96
- def __init__(self, status_code: int, detail: str, code: str):
97
- super().__init__(status_code=status_code, detail=detail)
98
- self.code = code
99
- ```
100
-
101
- ## Security
102
-
103
- - **OAuth2 with JWT** — use `python-jose`
104
- - **Password hashing** — bcrypt via `passlib`
105
- - **CORS** — configure explicitly
106
- - **Rate limiting** — use `slowapi`
107
- - **Input validation** — Pydantic handles this automatically
108
-
109
- ## Testing
110
-
111
- ```python
112
- import pytest
113
- from httpx import AsyncClient
114
-
115
- @pytest.mark.asyncio
116
- async def test_create_user(client: AsyncClient):
117
- response = await client.post("/api/v1/users", json={
118
- "email": "test@example.com",
119
- "name": "Test User"
120
- })
121
- assert response.status_code == 201
122
- ```
123
-
124
- ## Anti-Patterns
125
-
126
- - [FAIL] Business logic in route handlers — use services
127
- - [FAIL] Raw SQL without ORM — use SQLAlchemy
128
- - [FAIL] Sync database calls — use async drivers
129
- - [FAIL] Hardcoded settings — use Pydantic BaseSettings
130
- - [FAIL] No schema validation — always use Pydantic models
131
-
132
-
133
- ## Code Examples
134
-
135
- See `EXAMPLES.md` for detailed code examples.
136
-
137
- ## Validation Checklist
138
-
139
- What to verify during the review phase before completing the task.
140
-
141
- ## Common Mistakes
142
-
143
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
144
-
145
- ## Integration Notes
146
-
147
- How this skill interacts with other skills.
148
-
149
-
150
- <!-- Source: EXAMPLES.md -->
151
-
152
- # fastapi Examples — Anti-patterns vs ContextOS Standard
153
-
154
- ## Example 1: Asynchronous Route Handlers
155
-
156
- ### Anti-pattern: Blocking I/O inside `async def`
157
-
158
- ```python
159
- # BAD: time.sleep or synchronous requests blocks the entire asyncio event loop!
160
- import time
161
- import requests
162
-
163
- @app.get("/slow")
164
- async def slow_route():
165
- time.sleep(5) # BLOCKS ALL CONCURRENT USERS!
166
- return {"status": "done"}
167
- ```
168
-
169
- ### Best practice: ContextOS Standard (Non-blocking Async or Def Offload)
170
-
171
- ```python
172
- # GOOD: Use async non-blocking client (httpx) or standard def for sync CPU work
173
- import asyncio
174
- import httpx
175
-
176
- @app.get("/fast")
177
- async def fast_route():
178
- async with httpx.AsyncClient() as client:
179
- response = await client.get("https://api.example.com/data")
180
- return response.json()
181
-
182
- # Or standard def (FastAPI automatically runs it in a background threadpool):
183
- @app.get("/sync-worker")
184
- def sync_worker():
185
- time.sleep(5) # Runs in worker thread without blocking event loop
186
- return {"status": "done"}
187
- ```
188
-
189
- <!-- Source: TROUBLESHOOTING.md -->
190
-
191
- # fastapi Troubleshooting & Common Mistakes
192
-
193
- ## 1. Pydantic v1 vs v2 Deprecations
194
-
195
- - **Symptom**: Warnings or crashes regarding @validator or .dict() methods.
196
- - **Root Cause**: FastAPI projects upgrading to Pydantic v2.
197
- - **Fix**: Use @field_validator instead of @validator, and .model_dump() instead of .dict().
198
-
199
- ## 2. Database Session Leaks
200
-
201
- - **Symptom**: Database pool runs out of connections after a few requests.
202
- - **Root Cause**: Database sessions opened manually without proper try...finally or dependency injection.
203
- - **Fix**: Always provide database sessions via Depends(get_db) with a yield block.
204
-
205
- ## 3. Unhandled Validation Errors Returning Inconsistent JSON
206
-
207
- - **Symptom**: Frontend receives raw 422 arrays without matching standard API error response envelope.
208
- - **Root Cause**: Missing custom RequestValidationError handler.
209
- - **Fix**: Register an app-level exception handler for RequestValidationError that normalizes error shapes.
@@ -1,142 +0,0 @@
1
- ---
2
- name: generators
3
- description: >
4
- Generates complete project documentation (PRD, Architecture, Database, API, UI, Roadmap, Tasks) from ideas and templates with incremental update support.
5
- ---
6
- # document-generator
7
-
8
- ## Overview
9
-
10
- Automated technical documentation generator. Transforms initial project ideas and specs into comprehensive PRDs, architecture schemas, API contracts, database ERDs, and roadmap task breakdowns.
11
-
12
- ## When to Use
13
-
14
- Activate during project kickoff (ctx init), new service scaffolding, or when generating baseline technical specs from high-level user requirements.
15
-
16
- ## Rules & Patterns
17
-
18
- You generate project documentation from a user's idea. Use the templates in `templates/` as the structure for each document.
19
-
20
- ## Commands
21
-
22
- ### `ctx init`
23
-
24
- Full project initialization. From one user prompt, generate ALL documents:
25
-
26
- 1. Ask clarifying questions (see Context OS SKILL.md)
27
- 2. Select profile and skill pack
28
- 3. Generate documents in this order:
29
- - `docs/PRD.md` — Product Requirements (from template)
30
- - `docs/ARCHITECTURE.md` — System Architecture
31
- - `docs/DATABASE.md` — Database Schema
32
- - `docs/API.md` — API Specification
33
- - `docs/UI.md` — UI/UX Specification
34
- - `docs/ROADMAP.md` — Development Roadmap
35
- - `docs/TASKS.md` — Task Breakdown
36
- - `docs/PROJECT_GRAPH.md` — Project Graph
37
- 4. Create `docs/decisions/` directory for future ADRs
38
- 5. Generate agent config via Adapters skill
39
-
40
- ### `ctx update`
41
-
42
- Incremental update. When requirements change:
43
-
44
- 1. Identify which documents are affected
45
- 2. Update only affected documents
46
- 3. Show diff of changes
47
- 4. Ask user to confirm
48
- 5. Update Project Graph if structure changed
49
-
50
- ### `ctx plan`
51
-
52
- Generate development plan from existing PRD:
53
-
54
- 1. Read `docs/PRD.md`
55
- 2. Break into modules (Project Graph)
56
- 3. Break modules into features
57
- 4. Break features into tasks
58
- 5. Estimate complexity (S/M/L/XL)
59
- 6. Output to `docs/TASKS.md`
60
-
61
- ## Template Usage
62
-
63
- Each template contains:
64
-
65
- - **Section headers** — required sections for the document
66
- - **Placeholder prompts** — `{{description}}` markers that guide content generation
67
- - **Examples** — sample content to illustrate the expected format
68
- - **Validation rules** — what must be present for the document to be valid
69
-
70
- When generating a document:
71
-
72
- 1. Read the template
73
- 2. Fill in each section based on the user's idea and clarifying answers
74
- 3. Replace all `{{placeholders}}` with real content
75
- 4. Remove the template comments (lines starting with `<!-- -->`)
76
- 5. Validate: ensure all required sections are present
77
-
78
- ## Document Dependencies
79
-
80
- ```
81
- PRD.md
82
- ├── ARCHITECTURE.md
83
- │ ├── DATABASE.md
84
- │ ├── API.md
85
- │ └── DEPLOYMENT.md
86
- ├── UI.md
87
- ├── ROADMAP.md
88
- │ └── TASKS.md
89
- └── PROJECT_GRAPH.md
90
- ```
91
-
92
- When updating a parent document, check if child documents need updates too.
93
-
94
-
95
- ## Code Examples
96
-
97
- See `EXAMPLES.md` for detailed code examples.
98
-
99
- ## Validation Checklist
100
-
101
- What to verify during the review phase before completing the task.
102
-
103
- ## Common Mistakes
104
-
105
- Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
106
-
107
- ## Integration Notes
108
-
109
- How this skill interacts with other skills.
110
-
111
-
112
- <!-- Source: EXAMPLES.md -->
113
-
114
- # generators Examples — Anti-patterns vs ContextOS Standard
115
-
116
- ## Example 1: Technical Documentation Generation
117
-
118
- ### Anti-pattern: Scaffolding from Scratch Without Templates
119
-
120
- ```text
121
- Agent drafts a 2-paragraph "architecture overview" missing databases, security, and hosting models.
122
- ```
123
-
124
- ### Best practice: ContextOS Standard (ctx init Template Generation)
125
-
126
- ```text
127
- Generates complete engineering suite:
128
- - PRD.md (User personas, in-scope, out-of-scope, acceptance criteria)
129
- - ARCHITECTURE.md (C4 model, data flow, scaling boundaries)
130
- - DATABASE.md (ERD, indexing strategy, migration plans)
131
- - API.md (OpenAPI 3.1 endpoints, error codes, authentication)
132
- ```
133
-
134
- <!-- Source: TROUBLESHOOTING.md -->
135
-
136
- # generators Troubleshooting & Common Mistakes
137
-
138
- ## 1. Generic Boilerplate Generation
139
-
140
- - **Symptom**: Generated documentation contains placeholders like [Insert DB Name here].
141
- - **Root Cause**: Generating docs before clarifying core project constraints.
142
- - **Fix**: Run the interview-me protocol before generating technical documentation.
@@ -1,205 +0,0 @@
1
- ---
2
- name: graphify
3
- description: >
4
- Codebase knowledge graph generator and architecture mapping guide. Instructs agents on AST dependency extraction and blast radius analysis.
5
- ---
6
- # graphify
7
-
8
- ## Overview
9
-
10
- **Graphify** is an instruction-only codebase mapping and context optimization guide. Instead of feeding raw directory trees or entire source files into an agent's context window, Graphify instructs agents on how to construct a deterministic, queryable knowledge graph (`graph.json`, `GRAPH_REPORT.md`, `graph.html`) using external companion analyzers (such as the TypeScript AST analyzer in `contextos-mcp` or the external `graphifyy` CLI), keeping the core package 100% zero-dependency without bundled native Tree-sitter binaries.
11
-
12
- This skill instructs agents how to build, query, and maintain codebase graphs to navigate complex architectures with near-zero token overhead.
13
-
14
- ## When to Use
15
-
16
- Activate whenever:
17
-
18
- - Working in large repositories (10k+ LOC) where full-file reads cause context overflow.
19
- - Performing cross-module refactorings and needing to determine exact dependency **blast radius**.
20
- - Onboarding onto an unfamiliar codebase or mapping legacy service boundaries.
21
- - The user asks to "map the codebase", "show dependency graph", "find central components", or "run graphify".
22
- - Working alongside `context-manager` to supply an automated `PROJECT_GRAPH.md` / `graph.json`.
23
-
24
- ## Rules & Patterns
25
-
26
- ### 1. The Graph-First Navigation Protocol
27
-
28
- Before opening and reading arbitrary source files in a large project:
29
-
30
- 1. **Check for Existing Artifacts**:
31
- - Inspect if `graph.json` or `GRAPH_REPORT.md` exists in the project root or `.graphify/`.
32
- - If present, query `graph.json` or read `GRAPH_REPORT.md` first to locate target modules.
33
- 2. **Deterministic CLI Execution**:
34
- - If missing or stale, generate the graph using the Python package (`pip install graphifyy`):
35
-
36
- ```bash
37
- graphify run .
38
- ```
39
-
40
- - For live development sessions, run in watch mode:
41
-
42
- ```bash
43
- graphify watch .
44
- ```
45
-
46
- 3. **Inspect God Nodes**:
47
- - Always check the "God Nodes" section of `GRAPH_REPORT.md`. These represent high-centrality modules (e.g., core configs, base models, central dispatchers). Changes to god nodes have the highest blast radius.
48
-
49
- ### 2. Context Safety Rules
50
-
51
- - **Never load `graph.html` into agent context**: `graph.html` is an interactive visualization for humans in the browser; reading it burns tokens needlessly.
52
- - **Selective JSON Querying**: Do not dump the entire `graph.json` into prompt context if it exceeds 50KB. Use targeted grep/jq queries to extract specific node neighbors.
53
- - **Git Hygiene**: Add `graph.html` and `.graphify/cache` to `.gitignore`. Keep `GRAPH_REPORT.md` committed only if the team uses it as shared documentation.
54
-
55
- ### 3. Blast Radius Verification
56
-
57
- When modifying a function, class, or interface:
58
-
59
- 1. Locate the symbol's node in `graph.json`.
60
- 2. Extract all inbound edges (`dependents` / `callers`).
61
- 3. Formulate the verification plan specifically around those dependent call sites.
62
-
63
- ---
64
-
65
- ## Code Examples
66
-
67
- ### Installing and Running Graphify
68
-
69
- ```bash
70
- # Install graphify CLI (package name is graphifyy on PyPI)
71
- pip install graphifyy
72
-
73
- # Generate knowledge graph and markdown architectural report
74
- graphify run ./src --output .graphify/
75
-
76
- # View interactive visualization locally
77
- open .graphify/graph.html
78
- ```
79
-
80
- ### Querying Node Dependencies via Shell
81
-
82
- ```bash
83
- # Find dependents of a critical module in graph.json without loading entire file
84
- node -e "
85
- const g = require('./.graphify/graph.json');
86
- const target = 'UserService';
87
- const inbound = g.edges.filter(e => e.target === target).map(e => e.source);
88
- console.log('Modules dependent on ' + target + ':', inbound);
89
- "
90
- ```
91
-
92
- ### Git Pre-Commit Hook Integration
93
-
94
- ```bash
95
- #!/bin/sh
96
- # .git/hooks/pre-commit: ensure GRAPH_REPORT.md remains fresh
97
- if command -v graphify >/dev/null 2>&1; then
98
- graphify run . --report-only
99
- git add GRAPH_REPORT.md
100
- fi
101
- ```
102
-
103
- ---
104
-
105
- ## Validation Checklist
106
-
107
- - [ ] `graph.json` and `GRAPH_REPORT.md` are generated without syntax errors.
108
- - [ ] Central "God Nodes" are identified and accounted for in the implementation plan.
109
- - [ ] No heavy visualization artifacts (`graph.html`, raw SVG dumps) are ingested into agent prompt context.
110
- - [ ] Inbound dependencies (callers) are checked before modifying exported signatures.
111
- - [ ] `.gitignore` properly excludes local graph caches and visualization outputs.
112
-
113
- ---
114
-
115
- ## Common Mistakes
116
-
117
- - **Context Window Flooding**: Ingesting the complete `graph.json` of a 500k LOC repository into agent context instead of slicing target subgraphs.
118
- - **Stale Graph Fallacy**: Assuming `graph.json` is up to date after heavy code refactorings without re-running `graphify run` or using `--watch`.
119
- - **Ignoring Semantic Non-Code Files**: Neglecting SQL migrations, OpenAPI specs, and docker configs during graph extraction.
120
- - **Mistaking Package Name**: Trying to install `pip install graphify` instead of the official PyPI package `graphifyy`.
121
-
122
- ---
123
-
124
- ## Integration Notes
125
-
126
- - **Synergy with `context-manager`**: Graphify serves as the automated backend engine for `context-manager`. Instead of manually maintaining `docs/PROJECT_GRAPH.md`, run Graphify to keep `graph.json` current.
127
- - **Synergy with `system-design`**: Use `GRAPH_REPORT.md` to ground architectural proposals in actual codebase topology.
128
- - **Synergy with `architecture-diagrams`**: The nodes and edges extracted in `graph.json` can be directly mapped into animated SVG C4 architecture diagrams.
129
-
130
-
131
- <!-- Source: EXAMPLES.md -->
132
-
133
- # Graphify Examples — Anti-patterns vs ContextOS Standard
134
-
135
- ## Example 1: Codebase Exploration & Architecture Mapping
136
-
137
- ### Anti-pattern: Context Window Flooding (Dumping source directories into prompt)
138
-
139
- ```bash
140
- # BAD: Reading 150 TypeScript files into context to understand system architecture.
141
- # Burns 200k+ tokens, causes model hallucinations, and loses attention span.
142
- cat src/**/*.ts | llm "explain the architecture and component connections"
143
- ```
144
-
145
- ### Best practice: ContextOS Standard (Deterministic Tree-sitter AST Graph)
146
-
147
- ```bash
148
- # GOOD: Generate queryable AST knowledge graph and compact architecture summary
149
- graphify run ./src --output .graphify/
150
-
151
- # Inspect high-level architecture and god nodes with minimal tokens (<2k tokens)
152
- cat .graphify/GRAPH_REPORT.md
153
- ```
154
-
155
- ---
156
-
157
- ## Example 2: Refactoring Blast-Radius Analysis
158
-
159
- ### Anti-pattern: String Grep Guesswork
160
-
161
- ```bash
162
- # BAD: Grepping for common symbol names returns hundreds of false positives (comments, logs, unrelated types)
163
- grep -rn "PaymentService" src/
164
- ```
165
-
166
- ### Best practice: ContextOS Standard (Inbound Dependency Traversal via graph.json)
167
-
168
- ```javascript
169
- // GOOD: Precise AST-level callers extracted directly from knowledge graph edges
170
- const fs = require('fs');
171
- const graph = JSON.parse(fs.readFileSync('.graphify/graph.json', 'utf8'));
172
-
173
- const targetNode = 'PaymentService';
174
- const dependents = graph.edges
175
- .filter(edge => edge.target === targetNode && edge.type === 'imports')
176
- .map(edge => edge.source);
177
-
178
- console.log(`Modules directly broken by modifying ${targetNode}:`, dependents);
179
- ```
180
-
181
- ---
182
-
183
- ## Example 3: Keeping Graph Fresh in CI / Pre-commit
184
-
185
- ### Anti-pattern: Relying on Outdated Graphs
186
-
187
- ```bash
188
- # BAD: Developing against a graph generated two months ago.
189
- # Dependencies drift, leading to false safety assumptions.
190
- ```
191
-
192
- ### Best practice: ContextOS Standard (Git Hook & Automated Watch)
193
-
194
- ```bash
195
- # Option A: Active development in watch mode
196
- graphify watch ./src --output .graphify/
197
-
198
- # Option B: Pre-commit hook to verify fresh GRAPH_REPORT.md
199
- #!/bin/sh
200
- # .git/hooks/pre-commit
201
- if command -v graphify >/dev/null 2>&1; then
202
- graphify run ./src --report-only
203
- git add GRAPH_REPORT.md
204
- fi
205
- ```