codeforge-dev 1.5.8 → 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 (176) hide show
  1. package/.devcontainer/.env +4 -5
  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 +186 -0
  6. package/.devcontainer/CLAUDE.md +108 -21
  7. package/.devcontainer/README.md +173 -57
  8. package/.devcontainer/config/defaults/keybindings.json +5 -0
  9. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +135 -2
  10. package/.devcontainer/config/{settings.json → defaults/settings.json} +25 -6
  11. package/.devcontainer/config/file-manifest.json +20 -0
  12. package/.devcontainer/devcontainer.json +38 -2
  13. package/.devcontainer/docs/configuration-reference.md +90 -0
  14. package/.devcontainer/docs/keybindings.md +100 -0
  15. package/.devcontainer/docs/optional-features.md +129 -0
  16. package/.devcontainer/docs/plugins.md +154 -0
  17. package/.devcontainer/docs/troubleshooting.md +128 -0
  18. package/.devcontainer/features/README.md +21 -7
  19. package/.devcontainer/features/agent-browser/install.sh +6 -0
  20. package/.devcontainer/features/ast-grep/install.sh +6 -0
  21. package/.devcontainer/features/biome/README.md +27 -0
  22. package/.devcontainer/features/biome/install.sh +6 -0
  23. package/.devcontainer/features/ccburn/README.md +60 -0
  24. package/.devcontainer/features/ccburn/devcontainer-feature.json +38 -0
  25. package/.devcontainer/features/ccburn/install.sh +180 -0
  26. package/.devcontainer/features/ccstatusline/README.md +22 -21
  27. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +6 -1
  28. package/.devcontainer/features/ccstatusline/install.sh +55 -16
  29. package/.devcontainer/features/ccusage/install.sh +6 -0
  30. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  31. package/.devcontainer/features/dprint/README.md +30 -0
  32. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  33. package/.devcontainer/features/dprint/install.sh +131 -0
  34. package/.devcontainer/features/hadolint/README.md +35 -0
  35. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  36. package/.devcontainer/features/hadolint/install.sh +86 -0
  37. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  39. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +6 -1
  40. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  41. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +6 -1
  42. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  43. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  44. package/.devcontainer/features/notify-hook/install.sh +7 -0
  45. package/.devcontainer/features/ruff/README.md +26 -0
  46. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  47. package/.devcontainer/features/ruff/install.sh +74 -0
  48. package/.devcontainer/features/shellcheck/README.md +38 -0
  49. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  50. package/.devcontainer/features/shellcheck/install.sh +24 -0
  51. package/.devcontainer/features/shfmt/README.md +37 -0
  52. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  53. package/.devcontainer/features/shfmt/install.sh +85 -0
  54. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  55. package/.devcontainer/features/splitrail/install.sh +7 -0
  56. package/.devcontainer/features/tmux/install.sh +8 -0
  57. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  58. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  60. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  61. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +133 -13
  62. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  63. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  64. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  65. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +477 -78
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/REVIEW-RUBRIC.md +440 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +207 -0
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +173 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +146 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +250 -0
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +246 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +237 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +134 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +242 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +201 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +265 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +213 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +195 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +289 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +297 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +188 -0
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +248 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +51 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/guard-readonly-bash.cpython-314.pyc +0 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/skill-suggester.cpython-314.pyc +0 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/syntax-validator.cpython-314.pyc +0 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-no-regression.cpython-314.pyc +0 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-tests-pass.cpython-314.pyc +0 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/guard-readonly-bash.py +611 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/redirect-builtin-agents.py +83 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +146 -2
  106. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/syntax-validator.py +9 -4
  107. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  108. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  109. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-no-regression.py +221 -0
  110. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-tests-pass.py +176 -0
  111. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  112. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  113. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  114. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  115. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  116. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/SKILL.md +599 -0
  117. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/references/sdk-typescript-reference.md +954 -0
  118. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  119. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  120. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  121. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  122. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  123. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  124. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/SKILL.md +276 -0
  125. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/advanced-commands.md +332 -0
  126. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/investigation-playbooks.md +319 -0
  127. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  128. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  129. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/SKILL.md +341 -0
  131. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/interpreting-results.md +235 -0
  132. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/tool-commands.md +395 -0
  133. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/SKILL.md +344 -0
  134. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/safe-transformations.md +247 -0
  135. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/smell-catalog.md +332 -0
  136. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/SKILL.md +277 -0
  137. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/owasp-patterns.md +269 -0
  138. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/secrets-patterns.md +253 -0
  139. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +320 -0
  140. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/criteria-patterns.md +245 -0
  141. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/ears-templates.md +239 -0
  142. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  143. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  144. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  145. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +40 -39
  146. package/.devcontainer/scripts/check-setup.sh +72 -0
  147. package/.devcontainer/scripts/setup-aliases.sh +51 -6
  148. package/.devcontainer/scripts/setup-auth.sh +74 -0
  149. package/.devcontainer/scripts/setup-config.sh +112 -20
  150. package/.devcontainer/scripts/setup-plugins.sh +38 -46
  151. package/.devcontainer/scripts/setup-projects.sh +175 -0
  152. package/.devcontainer/scripts/setup-symlink-claude.sh +36 -0
  153. package/.devcontainer/scripts/setup-update-claude.sh +19 -8
  154. package/.devcontainer/scripts/setup.sh +49 -14
  155. package/README.md +23 -190
  156. package/package.json +1 -1
  157. package/setup.js +245 -71
  158. package/.devcontainer/features/claude-code/README.md +0 -498
  159. package/.devcontainer/features/claude-code/config/settings.json +0 -36
  160. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  161. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  162. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  163. package/.devcontainer/features/claude-code/install.sh +0 -466
  164. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  165. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  166. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  167. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  168. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  169. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  170. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  171. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  172. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  173. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  174. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  175. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  176. package/.devcontainer/scripts/setup-irie-claude.sh +0 -32
@@ -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.