codeforge-dev 1.7.0 → 1.8.0

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 (136) hide show
  1. package/.devcontainer/.env +4 -6
  2. package/.devcontainer/.env.example +29 -0
  3. package/.devcontainer/.gitignore +8 -0
  4. package/.devcontainer/.secrets.example +12 -0
  5. package/.devcontainer/CHANGELOG.md +130 -0
  6. package/.devcontainer/CLAUDE.md +56 -19
  7. package/.devcontainer/README.md +111 -56
  8. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +72 -0
  9. package/.devcontainer/config/file-manifest.json +20 -0
  10. package/.devcontainer/devcontainer.json +20 -0
  11. package/.devcontainer/docs/configuration-reference.md +90 -0
  12. package/.devcontainer/docs/keybindings.md +100 -0
  13. package/.devcontainer/docs/optional-features.md +129 -0
  14. package/.devcontainer/docs/plugins.md +154 -0
  15. package/.devcontainer/docs/troubleshooting.md +128 -0
  16. package/.devcontainer/features/agent-browser/install.sh +6 -0
  17. package/.devcontainer/features/ast-grep/install.sh +6 -0
  18. package/.devcontainer/features/biome/README.md +27 -0
  19. package/.devcontainer/features/biome/install.sh +6 -0
  20. package/.devcontainer/features/ccburn/install.sh +6 -0
  21. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +5 -0
  22. package/.devcontainer/features/ccstatusline/install.sh +7 -0
  23. package/.devcontainer/features/ccusage/install.sh +6 -0
  24. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  25. package/.devcontainer/features/dprint/README.md +30 -0
  26. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  27. package/.devcontainer/features/dprint/install.sh +131 -0
  28. package/.devcontainer/features/hadolint/README.md +35 -0
  29. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  30. package/.devcontainer/features/hadolint/install.sh +86 -0
  31. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  32. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  33. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +5 -0
  34. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  35. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +5 -0
  36. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  37. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/notify-hook/install.sh +7 -0
  39. package/.devcontainer/features/ruff/README.md +26 -0
  40. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  41. package/.devcontainer/features/ruff/install.sh +74 -0
  42. package/.devcontainer/features/shellcheck/README.md +38 -0
  43. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  44. package/.devcontainer/features/shellcheck/install.sh +24 -0
  45. package/.devcontainer/features/shfmt/README.md +37 -0
  46. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  47. package/.devcontainer/features/shfmt/install.sh +85 -0
  48. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  49. package/.devcontainer/features/splitrail/install.sh +7 -0
  50. package/.devcontainer/features/tmux/install.sh +8 -0
  51. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  52. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  53. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  54. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  55. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +114 -9
  56. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  57. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  58. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +478 -76
  60. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  61. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  62. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +17 -0
  63. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +4 -4
  64. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +14 -23
  65. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +2 -0
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +13 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +2 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +10 -1
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +6 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +4 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +36 -23
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +3 -3
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +3 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +39 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +61 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +32 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  106. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  107. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  108. package/.devcontainer/scripts/check-setup.sh +72 -0
  109. package/.devcontainer/scripts/setup-aliases.sh +43 -3
  110. package/.devcontainer/scripts/setup-auth.sh +74 -0
  111. package/.devcontainer/scripts/setup-config.sh +112 -22
  112. package/.devcontainer/scripts/setup-update-claude.sh +8 -0
  113. package/.devcontainer/scripts/setup.sh +46 -13
  114. package/README.md +23 -190
  115. package/package.json +1 -1
  116. package/setup.js +245 -71
  117. package/.devcontainer/features/claude-code/README.md +0 -498
  118. package/.devcontainer/features/claude-code/config/settings.json +0 -72
  119. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  120. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  121. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  122. package/.devcontainer/features/claude-code/install.sh +0 -466
  123. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  124. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  125. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  126. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  127. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  128. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  129. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  131. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  132. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  133. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  134. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  135. /package/.devcontainer/config/{keybindings.json → defaults/keybindings.json} +0 -0
  136. /package/.devcontainer/config/{settings.json → defaults/settings.json} +0 -0
@@ -0,0 +1,327 @@
1
+ # Language-Specific AST-Grep Patterns
2
+
3
+ Complete pattern reference organized by language. Each pattern includes the `sg` command and example matches.
4
+
5
+ ---
6
+
7
+ ## Python
8
+
9
+ ### Function Definitions
10
+
11
+ ```bash
12
+ # All functions
13
+ sg run -p 'def $NAME($$$PARAMS): $$$BODY' -l python
14
+
15
+ # Async functions
16
+ sg run -p 'async def $NAME($$$PARAMS): $$$BODY' -l python
17
+
18
+ # Functions with return type annotation
19
+ sg run -p 'def $NAME($$$PARAMS) -> $RET: $$$BODY' -l python
20
+
21
+ # Functions with specific decorator
22
+ sg run -p '@staticmethod
23
+ def $NAME($$$PARAMS): $$$BODY' -l python
24
+ ```
25
+
26
+ ### Class Definitions
27
+
28
+ ```bash
29
+ # Any class
30
+ sg run -p 'class $NAME: $$$BODY' -l python
31
+
32
+ # Class with base classes
33
+ sg run -p 'class $NAME($$$BASES): $$$BODY' -l python
34
+
35
+ # Dataclass
36
+ sg run -p '@dataclass
37
+ class $NAME: $$$BODY' -l python
38
+
39
+ # Pydantic model
40
+ sg run -p 'class $NAME(BaseModel): $$$BODY' -l python
41
+ ```
42
+
43
+ ### Decorators
44
+
45
+ ```bash
46
+ # Any decorated function
47
+ sg run -p '@$DEC
48
+ def $NAME($$$P): $$$B' -l python
49
+
50
+ # FastAPI/Flask route
51
+ sg run -p '@app.route($$$ARGS)
52
+ def $NAME($$$P): $$$B' -l python
53
+
54
+ # pytest fixture
55
+ sg run -p '@pytest.fixture
56
+ def $NAME($$$P): $$$B' -l python
57
+
58
+ # Property
59
+ sg run -p '@property
60
+ def $NAME(self): $$$B' -l python
61
+ ```
62
+
63
+ ### Imports
64
+
65
+ ```bash
66
+ # From imports
67
+ sg run -p 'from $MOD import $$$NAMES' -l python
68
+
69
+ # Star import
70
+ sg run -p 'from $MOD import *' -l python
71
+
72
+ # Aliased import
73
+ sg run -p 'import $MOD as $ALIAS' -l python
74
+ ```
75
+
76
+ ### Try/Except
77
+
78
+ ```bash
79
+ # Basic try/except
80
+ sg run -p 'try:
81
+ $$$TRY
82
+ except $EXC:
83
+ $$$HANDLER' -l python
84
+
85
+ # Bare except (code smell)
86
+ sg run -p 'try:
87
+ $$$TRY
88
+ except:
89
+ $$$HANDLER' -l python
90
+ ```
91
+
92
+ ### Comprehensions
93
+
94
+ ```bash
95
+ # List comprehension
96
+ sg run -p '[$EXPR for $VAR in $ITER]' -l python
97
+
98
+ # Dict comprehension
99
+ sg run -p '{$KEY: $VAL for $VAR in $ITER}' -l python
100
+
101
+ # Generator with condition
102
+ sg run -p '($EXPR for $VAR in $ITER if $COND)' -l python
103
+ ```
104
+
105
+ ### Async Patterns
106
+
107
+ ```bash
108
+ # Async with
109
+ sg run -p 'async with $CTX as $VAR: $$$BODY' -l python
110
+
111
+ # Await expression
112
+ sg run -p 'await $EXPR' -l python
113
+
114
+ # Async for
115
+ sg run -p 'async for $VAR in $ITER: $$$BODY' -l python
116
+ ```
117
+
118
+ ---
119
+
120
+ ## TypeScript / JavaScript
121
+
122
+ ### Function Calls
123
+
124
+ ```bash
125
+ # Specific function call
126
+ sg run -p 'fetch($$$ARGS)' -l typescript
127
+
128
+ # Method call
129
+ sg run -p '$OBJ.addEventListener($$$ARGS)' -l typescript
130
+
131
+ # Console methods
132
+ sg run -p 'console.$METHOD($$$ARGS)' -l javascript
133
+
134
+ # React hook
135
+ sg run -p 'useState($$$ARGS)' -l typescript
136
+ sg run -p 'useEffect($$$ARGS)' -l typescript
137
+ ```
138
+
139
+ ### JSX / React Components
140
+
141
+ ```bash
142
+ # Component usage
143
+ sg run -p '<$Component $$$PROPS />' -l typescript
144
+
145
+ # Component with children
146
+ sg run -p '<$Component $$$PROPS>$$$CHILDREN</$Component>' -l typescript
147
+
148
+ # Specific component
149
+ sg run -p '<Button $$$PROPS>$$$CHILDREN</Button>' -l typescript
150
+ ```
151
+
152
+ ### Imports / Exports
153
+
154
+ ```bash
155
+ # Named import
156
+ sg run -p 'import { $$$NAMES } from "$MOD"' -l typescript
157
+
158
+ # Default import
159
+ sg run -p 'import $NAME from "$MOD"' -l typescript
160
+
161
+ # Dynamic import
162
+ sg run -p 'import($PATH)' -l typescript
163
+
164
+ # Named export
165
+ sg run -p 'export const $NAME = $VAL' -l typescript
166
+
167
+ # Export function
168
+ sg run -p 'export function $NAME($$$P) { $$$B }' -l typescript
169
+ ```
170
+
171
+ ### Class Methods
172
+
173
+ ```bash
174
+ # Method definition
175
+ sg run -p 'class $C { $$$B1 $METHOD($$$P) { $$$B2 } $$$B3 }' -l typescript
176
+
177
+ # Async method
178
+ sg run -p 'async $METHOD($$$P) { $$$BODY }' -l typescript
179
+
180
+ # Constructor
181
+ sg run -p 'constructor($$$PARAMS) { $$$BODY }' -l typescript
182
+ ```
183
+
184
+ ### Arrow Functions
185
+
186
+ ```bash
187
+ # Arrow with body
188
+ sg run -p 'const $NAME = ($$$P) => { $$$BODY }' -l typescript
189
+
190
+ # Arrow with expression
191
+ sg run -p 'const $NAME = ($$$P) => $EXPR' -l typescript
192
+
193
+ # Callback arrow
194
+ sg run -p '($$$P) => $EXPR' -l typescript
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Go
200
+
201
+ ### Function Signatures
202
+
203
+ ```bash
204
+ # Function definition
205
+ sg run -p 'func $NAME($$$PARAMS) $$$RETURN { $$$BODY }' -l go
206
+
207
+ # Method (with receiver)
208
+ sg run -p 'func ($RECV $TYPE) $NAME($$$PARAMS) $$$RETURN { $$$BODY }' -l go
209
+
210
+ # Function returning error
211
+ sg run -p 'func $NAME($$$P) ($$$R, error) { $$$B }' -l go
212
+ ```
213
+
214
+ ### Struct Definitions
215
+
216
+ ```bash
217
+ # Struct
218
+ sg run -p 'type $NAME struct { $$$FIELDS }' -l go
219
+
220
+ # Interface
221
+ sg run -p 'type $NAME interface { $$$METHODS }' -l go
222
+ ```
223
+
224
+ ### Goroutines and Concurrency
225
+
226
+ ```bash
227
+ # Goroutine launch
228
+ sg run -p 'go $FUNC($$$ARGS)' -l go
229
+
230
+ # Defer statement
231
+ sg run -p 'defer $FUNC($$$ARGS)' -l go
232
+
233
+ # Channel send
234
+ sg run -p '$CH <- $VAL' -l go
235
+
236
+ # Channel receive
237
+ sg run -p '$VAR := <-$CH' -l go
238
+
239
+ # Select statement
240
+ sg run -p 'select { $$$CASES }' -l go
241
+ ```
242
+
243
+ ### Error Handling
244
+
245
+ ```bash
246
+ # Error check pattern
247
+ sg run -p 'if err != nil { $$$BODY }' -l go
248
+
249
+ # Error wrapping
250
+ sg run -p 'fmt.Errorf($$$ARGS)' -l go
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Rust
256
+
257
+ ### Function and Impl Blocks
258
+
259
+ ```bash
260
+ # Function
261
+ sg run -p 'fn $NAME($$$PARAMS) -> $RET { $$$BODY }' -l rust
262
+
263
+ # Impl block
264
+ sg run -p 'impl $TYPE { $$$METHODS }' -l rust
265
+
266
+ # Trait implementation
267
+ sg run -p 'impl $TRAIT for $TYPE { $$$METHODS }' -l rust
268
+
269
+ # Public function
270
+ sg run -p 'pub fn $NAME($$$PARAMS) -> $RET { $$$BODY }' -l rust
271
+ ```
272
+
273
+ ### Match Arms
274
+
275
+ ```bash
276
+ # Match statement
277
+ sg run -p 'match $EXPR { $$$ARMS }' -l rust
278
+
279
+ # Specific match arm (harder — ast-grep matches full expressions better)
280
+ ```
281
+
282
+ ### Macro Invocations
283
+
284
+ ```bash
285
+ # println! macro
286
+ sg run -p 'println!($$$ARGS)' -l rust
287
+
288
+ # vec! macro
289
+ sg run -p 'vec![$$$ITEMS]' -l rust
290
+
291
+ # Any macro
292
+ sg run -p '$MACRO!($$$ARGS)' -l rust
293
+ ```
294
+
295
+ ### Error Handling
296
+
297
+ ```bash
298
+ # unwrap calls (potential panics)
299
+ sg run -p '$EXPR.unwrap()' -l rust
300
+
301
+ # expect calls
302
+ sg run -p '$EXPR.expect($MSG)' -l rust
303
+
304
+ # ? operator (harder to match as standalone — use in function context)
305
+ ```
306
+
307
+ ### Async Patterns
308
+
309
+ ```bash
310
+ # Async function
311
+ sg run -p 'async fn $NAME($$$P) -> $RET { $$$B }' -l rust
312
+
313
+ # .await
314
+ sg run -p '$EXPR.await' -l rust
315
+
316
+ # tokio::spawn
317
+ sg run -p 'tokio::spawn($$$ARGS)' -l rust
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Tips
323
+
324
+ - **Pattern doesn't match?** Use `tree-sitter parse file.ext` to see the actual syntax tree structure. ast-grep patterns must match the tree structure, which sometimes differs from how code appears visually.
325
+ - **Too many results?** Add more context to the pattern (surrounding code) or search within a specific directory.
326
+ - **Cross-language search?** Run separate `sg` commands per language — ast-grep requires a language specification.
327
+ - **Combine with Grep:** Use ast-grep to find structural patterns, then Grep to filter results by specific strings within matches.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: dependency-management
3
+ description: >-
4
+ This skill should be used when the user asks to "check dependencies",
5
+ "audit dependencies", "find outdated packages", "check dependency health",
6
+ "scan for vulnerabilities", "find unused dependencies", "license check",
7
+ "npm audit", "pip audit", "cargo audit", or discusses dependency analysis,
8
+ supply chain security, package version gaps, or license compliance.
9
+ version: 0.1.0
10
+ ---
11
+
12
+ # Dependency Management
13
+
14
+ ## Mental Model
15
+
16
+ Dependency health is **ongoing hygiene**, not a one-time audit. Every dependency is a trust relationship — you inherit its bugs, vulnerabilities, and license obligations. Healthy projects monitor five dimensions continuously:
17
+
18
+ 1. **Currency** — How far behind are you? Major gaps accumulate breaking changes; patch gaps leave security holes open.
19
+ 2. **Security** — Are there known vulnerabilities? Severity × exploitability × exposure = actual risk.
20
+ 3. **Unused** — Dead dependencies increase attack surface and slow installs for zero value.
21
+ 4. **Conflicts** — Version mismatches cause subtle runtime bugs that are expensive to diagnose.
22
+ 5. **Licensing** — License obligations propagate transitively. One GPL dependency can change your distribution obligations.
23
+
24
+ Treat dependency updates like any other code change: assess, plan, execute, verify.
25
+
26
+ ---
27
+
28
+ ## Ecosystem Detection
29
+
30
+ Identify which package managers are in use before running any analysis. A project may span multiple ecosystems (e.g., Python backend + Node.js frontend).
31
+
32
+ | Ecosystem | Manifest Files | Lock Files |
33
+ |-----------|---------------|------------|
34
+ | **Node.js** | `package.json` | `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` |
35
+ | **Python** | `pyproject.toml`, `setup.py`, `requirements*.txt`, `Pipfile` | `poetry.lock`, `uv.lock`, `Pipfile.lock` |
36
+ | **Rust** | `Cargo.toml` | `Cargo.lock` |
37
+ | **Go** | `go.mod` | `go.sum` |
38
+
39
+ Use `Glob` to discover manifests. Read each manifest to count direct dependencies before running analysis commands.
40
+
41
+ For monorepos, identify each workspace/package separately and analyze independently.
42
+
43
+ ---
44
+
45
+ ## Analysis Workflow
46
+
47
+ ### Phase 1: Outdated Packages
48
+
49
+ Check currency across all detected ecosystems. Categorize findings by version gap:
50
+
51
+ - **Major** — Likely breaking changes. Review changelog before upgrading.
52
+ - **Minor** — New features, generally low risk.
53
+ - **Patch** — Bug fixes and security patches. Upgrade promptly.
54
+
55
+ Prioritize patch-level upgrades first — they carry the least risk and often fix security issues.
56
+
57
+ ### Phase 2: Security Vulnerabilities
58
+
59
+ Run ecosystem-specific audit tools. For each finding, report:
60
+ - Package name and installed version
61
+ - Vulnerability ID (CVE, GHSA)
62
+ - Severity (critical / high / medium / low)
63
+ - Fixed version (if available)
64
+ - Whether it is a **direct** or **transitive** dependency
65
+
66
+ Direct dependencies are simpler to fix. Transitive vulnerabilities may require upgrading an intermediary package.
67
+
68
+ ### Phase 3: Unused Dependencies
69
+
70
+ Cross-reference manifest declarations with source imports:
71
+ 1. Read the manifest to list declared dependencies.
72
+ 2. Search for import/require statements across all source files.
73
+ 3. Flag packages with zero import matches as potentially unused.
74
+
75
+ Mark known implicit-use categories separately: plugins, CLI tools, type packages (`@types/*`), test frameworks in `devDependencies`, build tools, and runtime-loaded modules. These get a "verify manually" note rather than a definitive "unused" label.
76
+
77
+ ### Phase 4: Version Conflicts
78
+
79
+ Check for conflicting version requirements in the dependency tree. Peer dependency issues in Node.js, version resolution conflicts in Python, and duplicate packages at different versions all indicate problems.
80
+
81
+ ### Phase 5: License Compliance
82
+
83
+ Classify all dependency licenses and flag risk:
84
+ - **Permissive** (MIT, BSD, Apache-2.0, ISC) — Safe for all use.
85
+ - **Weak copyleft** (LGPL, MPL) — Safe as library, restrictions on modifications.
86
+ - **Strong copyleft** (GPL, AGPL) — May require source disclosure. Flag for commercial projects.
87
+ - **Unknown/Missing** — Flag for manual review. Unlicensed code carries legal risk.
88
+
89
+ ---
90
+
91
+ ## Version Gap Classification
92
+
93
+ | Gap | Risk | Action |
94
+ |-----|------|--------|
95
+ | Patch (0.0.x) | Low | Upgrade promptly — bug fixes and security patches |
96
+ | Minor (0.x.0) | Low–Medium | Review changelog, usually safe to upgrade |
97
+ | Major (x.0.0) | Medium–High | Review migration guide, test thoroughly |
98
+ | Multiple majors behind | High | Plan incremental upgrade path, one major at a time |
99
+
100
+ ---
101
+
102
+ ## Vulnerability Severity
103
+
104
+ CVSS scores provide a starting point but need context:
105
+
106
+ | CVSS Range | Label | Typical Action |
107
+ |------------|-------|---------------|
108
+ | 9.0–10.0 | Critical | Patch immediately. These often have active exploits. |
109
+ | 7.0–8.9 | High | Patch within days. Check if your usage triggers the vulnerability. |
110
+ | 4.0–6.9 | Medium | Patch within weeks. Assess exploitability in your context. |
111
+ | 0.1–3.9 | Low | Patch during regular maintenance. Low exploitability. |
112
+
113
+ A critical vulnerability in a transitive dependency used only in tests has lower effective risk than a medium vulnerability in a direct dependency exposed to user input. Always assess exploitability in context.
114
+
115
+ ---
116
+
117
+ ## Ambiguity Policy
118
+
119
+ | Ambiguity | Default |
120
+ |-----------|---------|
121
+ | **Scope not specified** | Run all five phases (outdated, security, unused, conflicts, licenses) |
122
+ | **Ecosystem not specified** | Analyze all detected ecosystems |
123
+ | **Severity threshold** | Report all severities, highlight critical and high |
124
+ | **Update recommendations** | Advisory only — never modify manifests or lock files |
125
+ | **Direct vs transitive** | Always distinguish; prioritize direct dependencies |
126
+
127
+ ---
128
+
129
+ ## Reference Files
130
+
131
+ | File | Contents |
132
+ |------|----------|
133
+ | [Ecosystem Commands](references/ecosystem-commands.md) | Per-ecosystem command tables for npm, pip/uv, cargo, and go — outdated checks, audits, unused detection, conflict checks, and license listing |
134
+ | [License Compliance](references/license-compliance.md) | License classification table, SPDX identifiers, commercial implications, common conflicts, and recommended actions per risk level |
@@ -0,0 +1,264 @@
1
+ # Ecosystem Commands Reference
2
+
3
+ Per-ecosystem command reference for dependency analysis. All commands are **read-only** — they inspect but never modify the project.
4
+
5
+ If a command is not found, note it as unavailable and skip. Do not attempt to install tools.
6
+
7
+ ---
8
+
9
+ ## Node.js (npm / yarn / pnpm)
10
+
11
+ ### Outdated Packages
12
+
13
+ ```bash
14
+ # npm
15
+ npm outdated 2>/dev/null || true
16
+
17
+ # yarn
18
+ yarn outdated 2>/dev/null || true
19
+
20
+ # pnpm
21
+ pnpm outdated 2>/dev/null || true
22
+ ```
23
+
24
+ Output columns: Package, Current, Wanted (semver-compatible), Latest (newest).
25
+
26
+ ### Security Audit
27
+
28
+ ```bash
29
+ # npm — structured output for parsing
30
+ npm audit --json 2>/dev/null || true
31
+
32
+ # npm — human-readable summary
33
+ npm audit 2>/dev/null || true
34
+
35
+ # yarn
36
+ yarn audit 2>/dev/null || true
37
+
38
+ # pnpm
39
+ pnpm audit 2>/dev/null || true
40
+ ```
41
+
42
+ ### Unused Detection
43
+
44
+ No built-in command. Cross-reference `package.json` dependencies with source imports:
45
+
46
+ ```bash
47
+ # List declared dependencies
48
+ node -e "const p=require('./package.json'); console.log(Object.keys(p.dependencies||{}).join('\n'))"
49
+
50
+ # Search for imports (use Grep tool, not bash grep)
51
+ # Pattern: require('pkg') or import ... from 'pkg'
52
+ ```
53
+
54
+ Known exceptions to flag as "verify manually":
55
+ - `@types/*` packages — TypeScript type definitions, no runtime import
56
+ - Packages in `devDependencies` used only by build/test tooling
57
+ - Babel/ESLint/Prettier plugins loaded by configuration
58
+ - `dotenv` and similar packages loaded via `-r` flag or preload
59
+
60
+ ### Version Conflicts
61
+
62
+ ```bash
63
+ # Check for peer dependency issues
64
+ npm ls 2>&1 | head -100 || true
65
+
66
+ # Check for duplicated packages
67
+ npm ls --all 2>/dev/null | head -200 || true
68
+ ```
69
+
70
+ ### License Listing
71
+
72
+ ```bash
73
+ # Using npx (no install needed)
74
+ npx license-checker --summary 2>/dev/null || true
75
+
76
+ # Detailed per-package
77
+ npx license-checker --json 2>/dev/null || true
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Python (pip / uv / poetry)
83
+
84
+ ### Outdated Packages
85
+
86
+ ```bash
87
+ # pip
88
+ pip list --outdated 2>/dev/null || true
89
+
90
+ # uv
91
+ uv pip list --outdated 2>/dev/null || true
92
+
93
+ # poetry
94
+ poetry show --outdated 2>/dev/null || true
95
+ ```
96
+
97
+ ### Security Audit
98
+
99
+ ```bash
100
+ # pip-audit (preferred)
101
+ pip-audit 2>/dev/null || true
102
+
103
+ # pip-audit with JSON output
104
+ pip-audit --format json 2>/dev/null || true
105
+
106
+ # safety (alternative)
107
+ safety check 2>/dev/null || true
108
+ ```
109
+
110
+ ### Unused Detection
111
+
112
+ Cross-reference manifest with source imports:
113
+
114
+ ```bash
115
+ # List declared dependencies from pyproject.toml
116
+ python3 -c "
117
+ import tomllib, pathlib
118
+ data = tomllib.loads(pathlib.Path('pyproject.toml').read_text())
119
+ deps = data.get('project', {}).get('dependencies', [])
120
+ for d in deps:
121
+ print(d.split('>=')[0].split('==')[0].split('<')[0].split('>')[0].split('~=')[0].strip())
122
+ " 2>/dev/null || true
123
+ ```
124
+
125
+ Then use Grep to search for `import pkg` or `from pkg import` across `.py` files.
126
+
127
+ Known exceptions: pytest plugins, mypy/ruff extensions, ASGI/WSGI servers (uvicorn, gunicorn), and packages used only in configuration files.
128
+
129
+ ### Version Conflicts
130
+
131
+ ```bash
132
+ # pip check for broken dependencies
133
+ pip check 2>/dev/null || true
134
+ ```
135
+
136
+ ### License Listing
137
+
138
+ ```bash
139
+ # pip-licenses
140
+ pip-licenses 2>/dev/null || true
141
+
142
+ # pip-licenses with format
143
+ pip-licenses --format=json 2>/dev/null || true
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Rust (cargo)
149
+
150
+ ### Outdated Packages
151
+
152
+ ```bash
153
+ # Requires cargo-outdated
154
+ cargo outdated 2>/dev/null || true
155
+
156
+ # Alternative: check Cargo.toml against crates.io manually
157
+ cargo search <crate_name> 2>/dev/null || true
158
+ ```
159
+
160
+ ### Security Audit
161
+
162
+ ```bash
163
+ # Requires cargo-audit
164
+ cargo audit 2>/dev/null || true
165
+
166
+ # JSON output
167
+ cargo audit --json 2>/dev/null || true
168
+ ```
169
+
170
+ ### Unused Detection
171
+
172
+ ```bash
173
+ # Requires cargo-udeps (nightly)
174
+ cargo +nightly udeps 2>/dev/null || true
175
+ ```
176
+
177
+ If `cargo-udeps` is unavailable, cross-reference `Cargo.toml` `[dependencies]` with `use` statements in `src/**/*.rs`.
178
+
179
+ ### Version Conflicts
180
+
181
+ ```bash
182
+ # Check dependency tree for duplicates
183
+ cargo tree --duplicates 2>/dev/null || true
184
+ ```
185
+
186
+ ### License Listing
187
+
188
+ ```bash
189
+ # Requires cargo-license
190
+ cargo license 2>/dev/null || true
191
+
192
+ # Alternative: cargo-deny
193
+ cargo deny check licenses 2>/dev/null || true
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Go
199
+
200
+ ### Outdated Packages
201
+
202
+ ```bash
203
+ # List all dependencies with available updates
204
+ go list -u -m all 2>/dev/null || true
205
+ ```
206
+
207
+ ### Security Audit
208
+
209
+ ```bash
210
+ # Official Go vulnerability checker
211
+ govulncheck ./... 2>/dev/null || true
212
+ ```
213
+
214
+ ### Unused Detection
215
+
216
+ Go modules are imported explicitly. Check for modules in `go.mod` not imported in any `.go` file:
217
+
218
+ ```bash
219
+ # List declared modules
220
+ go list -m all 2>/dev/null | tail -n +2 || true
221
+
222
+ # Tidy check (would remove unused, but don't run with -v to avoid modifications)
223
+ # Instead, compare go.mod with actual imports via Grep
224
+ ```
225
+
226
+ ### Version Conflicts
227
+
228
+ Go uses minimum version selection — conflicts are rare. Check for replace directives that may mask issues:
229
+
230
+ ```bash
231
+ # Show replace directives
232
+ grep -n "replace" go.mod 2>/dev/null || true
233
+
234
+ # Verify module graph consistency
235
+ go mod verify 2>/dev/null || true
236
+ ```
237
+
238
+ ### License Listing
239
+
240
+ ```bash
241
+ # Requires go-licenses
242
+ go-licenses csv ./... 2>/dev/null || true
243
+
244
+ # Alternative: manual check via go.sum and module proxy
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Error Handling
250
+
251
+ When a tool is not installed:
252
+ - Note it as **unavailable** in the report.
253
+ - Skip that check and proceed to the next.
254
+ - Suggest installation if the tool would provide significant value.
255
+ - Never attempt to install tools — that changes system state.
256
+
257
+ Common missing tools and alternatives:
258
+ | Tool | Ecosystem | Alternative |
259
+ |------|-----------|-------------|
260
+ | `cargo-audit` | Rust | Check RustSec advisory DB manually |
261
+ | `cargo-outdated` | Rust | `cargo search` per crate |
262
+ | `pip-audit` | Python | `safety check` |
263
+ | `govulncheck` | Go | Check Go vulnerability DB manually |
264
+ | `license-checker` | Node.js | Read `license` field from each `node_modules/*/package.json` |