codeforge-dev 1.7.0 → 1.9.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.
- package/.devcontainer/.env +4 -6
- package/.devcontainer/.env.example +29 -0
- package/.devcontainer/.gitignore +8 -0
- package/.devcontainer/.secrets.example +12 -0
- package/.devcontainer/CHANGELOG.md +181 -0
- package/.devcontainer/CLAUDE.md +57 -20
- package/.devcontainer/README.md +111 -56
- package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +72 -0
- package/.devcontainer/config/defaults/rules/spec-workflow.md +67 -0
- package/.devcontainer/config/defaults/rules/workspace-scope.md +7 -0
- package/.devcontainer/config/defaults/settings.json +67 -0
- package/.devcontainer/config/file-manifest.json +32 -0
- package/.devcontainer/devcontainer.json +20 -0
- package/.devcontainer/docs/configuration-reference.md +90 -0
- package/.devcontainer/docs/keybindings.md +100 -0
- package/.devcontainer/docs/optional-features.md +129 -0
- package/.devcontainer/docs/plugins.md +154 -0
- package/.devcontainer/docs/troubleshooting.md +128 -0
- package/.devcontainer/features/agent-browser/install.sh +6 -0
- package/.devcontainer/features/ast-grep/install.sh +6 -0
- package/.devcontainer/features/biome/README.md +27 -0
- package/.devcontainer/features/biome/install.sh +6 -0
- package/.devcontainer/features/ccburn/install.sh +6 -0
- package/.devcontainer/features/ccstatusline/devcontainer-feature.json +5 -0
- package/.devcontainer/features/ccstatusline/install.sh +7 -0
- package/.devcontainer/features/ccusage/install.sh +6 -0
- package/.devcontainer/features/claude-monitor/install.sh +6 -0
- package/.devcontainer/features/dprint/README.md +30 -0
- package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
- package/.devcontainer/features/dprint/install.sh +131 -0
- package/.devcontainer/features/hadolint/README.md +35 -0
- package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
- package/.devcontainer/features/hadolint/install.sh +86 -0
- package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
- package/.devcontainer/features/lsp-servers/install.sh +7 -0
- package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +5 -0
- package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
- package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +5 -0
- package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
- package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
- package/.devcontainer/features/notify-hook/install.sh +7 -0
- package/.devcontainer/features/ruff/README.md +26 -0
- package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
- package/.devcontainer/features/ruff/install.sh +74 -0
- package/.devcontainer/features/shellcheck/README.md +38 -0
- package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
- package/.devcontainer/features/shellcheck/install.sh +24 -0
- package/.devcontainer/features/shfmt/README.md +37 -0
- package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
- package/.devcontainer/features/shfmt/install.sh +85 -0
- package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
- package/.devcontainer/features/splitrail/install.sh +7 -0
- package/.devcontainer/features/tmux/install.sh +8 -0
- package/.devcontainer/features/tree-sitter/install.sh +6 -0
- package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +104 -104
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/.claude-plugin/plugin.json +7 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/README.md +158 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/hooks/hooks.json +39 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/collect-edited-files.py +47 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/format-on-stop.py +297 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/lint-file.py +536 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/syntax-validator.py +146 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +114 -9
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +478 -76
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +94 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +4 -4
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +14 -23
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +20 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +20 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +99 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +20 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +152 -9
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +18 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +114 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +24 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +101 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +33 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +24 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +65 -24
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +3 -3
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +99 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +100 -56
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +61 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/spec-reminder.py +121 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-check/SKILL.md +86 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/SKILL.md +97 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/backlog-template.md +7 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/roadmap-template.md +13 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/SKILL.md +101 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/references/template.md +110 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-update/SKILL.md +124 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +32 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
- package/.devcontainer/scripts/check-setup.sh +72 -0
- package/.devcontainer/scripts/setup-aliases.sh +43 -3
- package/.devcontainer/scripts/setup-auth.sh +74 -0
- package/.devcontainer/scripts/setup-config.sh +117 -24
- package/.devcontainer/scripts/setup-update-claude.sh +8 -0
- package/.devcontainer/scripts/setup.sh +46 -13
- package/README.md +23 -190
- package/package.json +42 -42
- package/setup.js +245 -71
- package/.devcontainer/config/settings.json +0 -70
- package/.devcontainer/features/claude-code/README.md +0 -498
- package/.devcontainer/features/claude-code/config/settings.json +0 -72
- package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
- package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
- package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
- package/.devcontainer/features/claude-code/install.sh +0 -466
- package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
- package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
- /package/.devcontainer/config/{keybindings.json → defaults/keybindings.json} +0 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ast-grep-patterns
|
|
3
|
+
description: >-
|
|
4
|
+
This skill should be used when the user asks to "use ast-grep",
|
|
5
|
+
"structural search", "syntax-aware search", "find code patterns",
|
|
6
|
+
"search with ast-grep", "use tree-sitter", "find function calls structurally",
|
|
7
|
+
or discusses ast-grep patterns, structural code search, meta-variables,
|
|
8
|
+
tree-sitter parsing, or syntax-aware code matching.
|
|
9
|
+
version: 0.1.0
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# AST-Grep Patterns
|
|
13
|
+
|
|
14
|
+
## Mental Model
|
|
15
|
+
|
|
16
|
+
Text search finds **strings**. Structural search finds **code constructs**. When you need to find all calls to `fetch()` regardless of arguments, a regex like `fetch\(.*\)` matches strings inside comments, string literals, and variable names containing "fetch." ast-grep matches the actual function call in the syntax tree.
|
|
17
|
+
|
|
18
|
+
**When to use which tool:**
|
|
19
|
+
|
|
20
|
+
| Need | Tool | Why |
|
|
21
|
+
|------|------|-----|
|
|
22
|
+
| Simple text or identifier | `Grep` | Fastest for literal text matching |
|
|
23
|
+
| Code pattern with variable parts | `ast-grep` (`sg`) | Understands syntax, ignores comments/strings |
|
|
24
|
+
| Full parse tree or all symbols | `tree-sitter` | Deepest structural insight per file |
|
|
25
|
+
| File names by pattern | `Glob` | Path-based discovery |
|
|
26
|
+
|
|
27
|
+
**Default to Grep** for simple searches. Escalate to ast-grep when:
|
|
28
|
+
- The pattern has variable sub-expressions (any arguments, any name)
|
|
29
|
+
- You need to distinguish code from comments/strings
|
|
30
|
+
- The pattern spans multiple syntax elements (function with decorator, class with method)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Meta-Variable Reference
|
|
35
|
+
|
|
36
|
+
ast-grep uses meta-variables to match parts of the syntax tree:
|
|
37
|
+
|
|
38
|
+
| Syntax | Meaning | Example |
|
|
39
|
+
|--------|---------|---------|
|
|
40
|
+
| `$NAME` | Matches exactly one AST node | `console.log($MSG)` matches `console.log("hi")` |
|
|
41
|
+
| `$$$ARGS` | Matches zero or more nodes (variadic) | `func($$$ARGS)` matches `func()`, `func(a)`, `func(a, b, c)` |
|
|
42
|
+
| `$_` | Wildcard — matches one node, not captured | `if ($_ ) { $$$BODY }` matches any if-statement |
|
|
43
|
+
|
|
44
|
+
**Key distinctions:**
|
|
45
|
+
- `$X` captures and can be referenced — use when you care about what matched
|
|
46
|
+
- `$_` is a throwaway — use when you just need "something here"
|
|
47
|
+
- `$$$X` is greedy — it captures everything between fixed anchors
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Tool Invocation
|
|
52
|
+
|
|
53
|
+
### ast-grep (`sg`)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Basic pattern search
|
|
57
|
+
sg run -p 'PATTERN' -l LANGUAGE
|
|
58
|
+
|
|
59
|
+
# Search in specific directory
|
|
60
|
+
sg run -p 'PATTERN' -l LANGUAGE path/to/dir/
|
|
61
|
+
|
|
62
|
+
# With JSON output for parsing
|
|
63
|
+
sg run -p 'PATTERN' -l LANGUAGE --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Language identifiers**: `python`, `javascript`, `typescript`, `go`, `rust`, `java`, `c`, `cpp`, `css`, `html`
|
|
67
|
+
|
|
68
|
+
### tree-sitter
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Extract all definitions (functions, classes, methods)
|
|
72
|
+
tree-sitter tags /path/to/file.py
|
|
73
|
+
|
|
74
|
+
# Parse file and show syntax tree
|
|
75
|
+
tree-sitter parse /path/to/file.py
|
|
76
|
+
|
|
77
|
+
# Parse and show tree for specific language
|
|
78
|
+
tree-sitter parse --language python /path/to/file.py
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Common Cross-Language Patterns
|
|
84
|
+
|
|
85
|
+
### Function Calls
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Any call to a specific function
|
|
89
|
+
sg run -p 'fetch($$$ARGS)' -l javascript
|
|
90
|
+
|
|
91
|
+
# Method call on any object
|
|
92
|
+
sg run -p '$OBJ.save($$$ARGS)' -l python
|
|
93
|
+
|
|
94
|
+
# Chained method calls
|
|
95
|
+
sg run -p '$OBJ.filter($$$A).map($$$B)' -l javascript
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Function/Method Definitions
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Python function
|
|
102
|
+
sg run -p 'def $NAME($$$PARAMS): $$$BODY' -l python
|
|
103
|
+
|
|
104
|
+
# Async Python function
|
|
105
|
+
sg run -p 'async def $NAME($$$PARAMS): $$$BODY' -l python
|
|
106
|
+
|
|
107
|
+
# JavaScript/TypeScript function
|
|
108
|
+
sg run -p 'function $NAME($$$PARAMS) { $$$BODY }' -l javascript
|
|
109
|
+
|
|
110
|
+
# Arrow function assigned to variable
|
|
111
|
+
sg run -p 'const $NAME = ($$$PARAMS) => $$$BODY' -l javascript
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Import Statements
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Python imports
|
|
118
|
+
sg run -p 'from $MODULE import $$$NAMES' -l python
|
|
119
|
+
sg run -p 'import $MODULE' -l python
|
|
120
|
+
|
|
121
|
+
# JavaScript/TypeScript imports
|
|
122
|
+
sg run -p 'import $$$NAMES from "$MODULE"' -l javascript
|
|
123
|
+
sg run -p 'import { $$$NAMES } from "$MODULE"' -l typescript
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Class Definitions
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Python class
|
|
130
|
+
sg run -p 'class $NAME($$$BASES): $$$BODY' -l python
|
|
131
|
+
|
|
132
|
+
# TypeScript class
|
|
133
|
+
sg run -p 'class $NAME { $$$BODY }' -l typescript
|
|
134
|
+
|
|
135
|
+
# Class with extends
|
|
136
|
+
sg run -p 'class $NAME extends $BASE { $$$BODY }' -l typescript
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Error Handling
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Python try/except
|
|
143
|
+
sg run -p 'try: $$$TRY except $EXCEPTION: $$$EXCEPT' -l python
|
|
144
|
+
|
|
145
|
+
# JavaScript try/catch
|
|
146
|
+
sg run -p 'try { $$$TRY } catch ($ERR) { $$$CATCH }' -l javascript
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Decorators / Attributes
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Python decorator
|
|
153
|
+
sg run -p '@$DECORATOR def $NAME($$$PARAMS): $$$BODY' -l python
|
|
154
|
+
|
|
155
|
+
# Specific decorator
|
|
156
|
+
sg run -p '@app.route($$$ARGS) def $NAME($$$PARAMS): $$$BODY' -l python
|
|
157
|
+
|
|
158
|
+
# TypeScript decorator
|
|
159
|
+
sg run -p '@$DECORATOR class $NAME { $$$BODY }' -l typescript
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Combining Tools
|
|
165
|
+
|
|
166
|
+
Use ast-grep for structural finding, then Grep and Read for context:
|
|
167
|
+
|
|
168
|
+
1. **Find structurally**: `sg run -p 'pattern' -l lang` → get file paths and line numbers
|
|
169
|
+
2. **Filter textually**: Use `Grep` on the results to narrow by specific strings
|
|
170
|
+
3. **Read context**: Use `Read` to examine surrounding code for the matches
|
|
171
|
+
|
|
172
|
+
Example workflow — find all Express route handlers that don't have error handling:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Step 1: Find all route handlers
|
|
176
|
+
sg run -p 'app.$METHOD($PATH, $$$HANDLERS)' -l javascript
|
|
177
|
+
|
|
178
|
+
# Step 2: Check which handlers lack try/catch (use Grep on matched files)
|
|
179
|
+
# Grep for the handler function names, then check for try/catch blocks
|
|
180
|
+
|
|
181
|
+
# Step 3: Read the full handler to confirm
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## tree-sitter Integration
|
|
187
|
+
|
|
188
|
+
Use `tree-sitter` when you need the full syntax tree, not just pattern matches:
|
|
189
|
+
|
|
190
|
+
- **`tree-sitter tags`** — Extracts all definitions (functions, classes, methods, variables) from a file. Use for getting a file's API surface quickly.
|
|
191
|
+
- **`tree-sitter parse`** — Shows the complete syntax tree. Use for debugging ast-grep patterns that don't match as expected, or for understanding unfamiliar syntax.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Ambiguity Policy
|
|
196
|
+
|
|
197
|
+
| Ambiguity | Default |
|
|
198
|
+
|-----------|---------|
|
|
199
|
+
| **Search tool not specified** | Use Grep for simple text; ast-grep for structural patterns |
|
|
200
|
+
| **Language not specified** | Infer from file extensions in the search directory |
|
|
201
|
+
| **Pattern too broad** | Narrow by directory first, then refine the pattern |
|
|
202
|
+
| **No results from ast-grep** | Fall back to Grep — the pattern may not match the exact syntax tree structure |
|
|
203
|
+
| **Complex nested pattern** | Break into simpler patterns and combine results |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Reference Files
|
|
208
|
+
|
|
209
|
+
| File | Contents |
|
|
210
|
+
|------|----------|
|
|
211
|
+
| [Language Patterns](references/language-patterns.md) | Complete pattern catalog for Python, TypeScript/JavaScript, Go, and Rust — function calls, class definitions, imports, async patterns, and more with exact `sg` commands |
|
|
@@ -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 |
|