claude-autopm 1.21.0 ā 1.22.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/autopm/.claude/agents/cloud/gcp-cloud-functions-engineer.md +5 -10
- package/autopm/.claude/agents/cloud/gemini-api-expert.md +1 -1
- package/autopm/.claude/agents/cloud/openai-python-expert.md +1 -1
- package/autopm/.claude/agents/cloud/terraform-infrastructure-expert.md +7 -11
- package/autopm/.claude/agents/core/mcp-manager.md +7 -0
- package/autopm/.claude/agents/data/airflow-orchestration-expert.md +1 -1
- package/autopm/.claude/agents/data/kedro-pipeline-expert.md +1 -1
- package/autopm/.claude/agents/data/langgraph-workflow-expert.md +1 -1
- package/autopm/.claude/agents/databases/bigquery-expert.md +1 -1
- package/autopm/.claude/agents/databases/cosmosdb-expert.md +1 -1
- package/autopm/.claude/agents/databases/mongodb-expert.md +1 -1
- package/autopm/.claude/agents/databases/postgresql-expert.md +1 -1
- package/autopm/.claude/agents/databases/redis-expert.md +1 -1
- package/autopm/.claude/agents/decision-matrices/playwright-testing-selection.md +6 -0
- package/autopm/.claude/agents/decision-matrices/python-backend-selection.md +7 -0
- package/autopm/.claude/agents/decision-matrices/ui-framework-selection.md +7 -0
- package/autopm/.claude/agents/devops/azure-devops-specialist.md +1 -1
- package/autopm/.claude/agents/devops/github-operations-specialist.md +7 -0
- package/autopm/.claude/agents/devops/mcp-context-manager.md +7 -0
- package/autopm/.claude/agents/devops/ssh-operations-expert.md +1 -1
- package/autopm/.claude/agents/devops/traefik-proxy-expert.md +1 -1
- package/autopm/.claude/agents/frameworks/nats-messaging-expert.md +1 -1
- package/autopm/.claude/agents/frameworks/react-frontend-engineer.md +1 -1
- package/autopm/.claude/agents/languages/bash-scripting-expert.md +1 -1
- package/autopm/.claude/agents/languages/javascript-frontend-engineer.md +1 -1
- package/autopm/.claude/agents/languages/nodejs-backend-engineer.md +3 -7
- package/autopm/.claude/agents/languages/python-backend-engineer.md +1 -1
- package/autopm/.claude/commands/ai/langgraph-workflow.md +17 -0
- package/autopm/.claude/commands/ai/openai-chat.md +17 -0
- package/autopm/.claude/commands/azure/active-work.md +17 -0
- package/autopm/.claude/commands/azure/aliases.md +17 -0
- package/autopm/.claude/commands/azure/blocked-items.md +17 -0
- package/autopm/.claude/commands/azure/clean.md +17 -0
- package/autopm/.claude/commands/azure/docs-query.md +17 -0
- package/autopm/.claude/commands/azure/feature-decompose.md +17 -0
- package/autopm/.claude/commands/azure/feature-list.md +17 -0
- package/autopm/.claude/commands/azure/feature-new.md +17 -0
- package/autopm/.claude/commands/azure/feature-show.md +17 -0
- package/autopm/.claude/commands/azure/feature-start.md +17 -0
- package/autopm/.claude/commands/azure/fix-integration-example.md +17 -0
- package/autopm/.claude/commands/azure/help.md +17 -0
- package/autopm/.claude/commands/azure/import-us.md +17 -0
- package/autopm/.claude/commands/azure/init.md +17 -0
- package/autopm/.claude/commands/azure/next-task.md +17 -0
- package/autopm/.claude/commands/azure/search.md +17 -0
- package/autopm/.claude/commands/azure/sprint-status.md +17 -0
- package/autopm/.claude/commands/azure/standup.md +17 -0
- package/autopm/.claude/commands/azure/sync-all.md +17 -0
- package/autopm/.claude/commands/azure/task-analyze.md +17 -0
- package/autopm/.claude/commands/azure/task-close.md +17 -0
- package/autopm/.claude/commands/azure/task-edit.md +17 -0
- package/autopm/.claude/commands/azure/task-list.md +17 -0
- package/autopm/.claude/commands/azure/task-new.md +17 -0
- package/autopm/.claude/commands/azure/task-reopen.md +17 -0
- package/autopm/.claude/commands/azure/task-show.md +17 -0
- package/autopm/.claude/commands/azure/task-start.md +17 -0
- package/autopm/.claude/commands/azure/task-status.md +17 -0
- package/autopm/.claude/commands/azure/task-sync.md +17 -0
- package/autopm/.claude/commands/azure/us-edit.md +17 -0
- package/autopm/.claude/commands/azure/us-list.md +17 -0
- package/autopm/.claude/commands/azure/us-new.md +17 -0
- package/autopm/.claude/commands/azure/us-parse.md +17 -0
- package/autopm/.claude/commands/azure/us-show.md +17 -0
- package/autopm/.claude/commands/azure/us-status.md +17 -0
- package/autopm/.claude/commands/azure/validate.md +17 -0
- package/autopm/.claude/commands/azure/work-item-sync.md +17 -0
- package/autopm/.claude/commands/cloud/infra-deploy.md +17 -0
- package/autopm/.claude/commands/config/toggle-features.md +15 -0
- package/autopm/.claude/commands/context/create.md +16 -0
- package/autopm/.claude/commands/context/prime.md +16 -0
- package/autopm/.claude/commands/context/update.md +16 -0
- package/autopm/.claude/commands/github/workflow-create.md +17 -0
- package/autopm/.claude/commands/infrastructure/ssh-security.md +17 -0
- package/autopm/.claude/commands/infrastructure/traefik-setup.md +17 -0
- package/autopm/.claude/commands/kubernetes/deploy.md +16 -0
- package/autopm/.claude/commands/mcp/context-setup.md +17 -0
- package/autopm/.claude/commands/mcp/docs-refresh.md +17 -0
- package/autopm/.claude/commands/playwright/test-scaffold.md +17 -0
- package/autopm/.claude/commands/pm/blocked.md +17 -0
- package/autopm/.claude/commands/pm/clean.md +17 -0
- package/autopm/.claude/commands/pm/context.md +17 -0
- package/autopm/.claude/commands/pm/epic-close.md +17 -0
- package/autopm/.claude/commands/pm/epic-decompose.md +16 -0
- package/autopm/.claude/commands/pm/epic-edit.md +17 -0
- package/autopm/.claude/commands/pm/epic-list.md +17 -0
- package/autopm/.claude/commands/pm/epic-merge.md +17 -0
- package/autopm/.claude/commands/pm/epic-oneshot.md +17 -0
- package/autopm/.claude/commands/pm/epic-refresh.md +17 -0
- package/autopm/.claude/commands/pm/epic-show.md +17 -0
- package/autopm/.claude/commands/pm/epic-split.md +17 -0
- package/autopm/.claude/commands/pm/epic-start.md +17 -0
- package/autopm/.claude/commands/pm/epic-status.md +17 -0
- package/autopm/.claude/commands/pm/epic-sync-modular.md +17 -0
- package/autopm/.claude/commands/pm/epic-sync-original.md +17 -0
- package/autopm/.claude/commands/pm/epic-sync.md +17 -0
- package/autopm/.claude/commands/pm/help.md +17 -0
- package/autopm/.claude/commands/pm/import.md +17 -0
- package/autopm/.claude/commands/pm/in-progress.md +17 -0
- package/autopm/.claude/commands/pm/init.md +17 -0
- package/autopm/.claude/commands/pm/issue-analyze.md +17 -0
- package/autopm/.claude/commands/pm/issue-close.md +17 -0
- package/autopm/.claude/commands/pm/issue-edit.md +17 -0
- package/autopm/.claude/commands/pm/issue-reopen.md +17 -0
- package/autopm/.claude/commands/pm/issue-show.md +17 -0
- package/autopm/.claude/commands/pm/issue-start.md +16 -0
- package/autopm/.claude/commands/pm/issue-status.md +17 -0
- package/autopm/.claude/commands/pm/issue-sync.md +17 -0
- package/autopm/.claude/commands/pm/next.md +17 -0
- package/autopm/.claude/commands/pm/prd-edit.md +17 -0
- package/autopm/.claude/commands/pm/prd-list.md +17 -0
- package/autopm/.claude/commands/pm/prd-new.md +16 -0
- package/autopm/.claude/commands/pm/prd-parse.md +17 -0
- package/autopm/.claude/commands/pm/prd-status.md +17 -0
- package/autopm/.claude/commands/pm/search.md +17 -0
- package/autopm/.claude/commands/pm/standup.md +17 -0
- package/autopm/.claude/commands/pm/status.md +17 -0
- package/autopm/.claude/commands/pm/sync.md +17 -0
- package/autopm/.claude/commands/pm/test-reference-update.md +17 -0
- package/autopm/.claude/commands/pm/validate.md +17 -0
- package/autopm/.claude/commands/pm/what-next.md +17 -0
- package/autopm/.claude/commands/python/api-scaffold.md +17 -0
- package/autopm/.claude/commands/python/docs-query.md +17 -0
- package/autopm/.claude/commands/react/app-scaffold.md +17 -0
- package/autopm/.claude/commands/testing/prime.md +17 -0
- package/autopm/.claude/commands/testing/run.md +17 -0
- package/autopm/.claude/commands/ui/bootstrap-scaffold.md +17 -0
- package/autopm/.claude/commands/ui/tailwind-system.md +17 -0
- package/autopm/.claude/hooks/pre-agent-context7.js +224 -0
- package/autopm/.claude/hooks/pre-command-context7.js +229 -0
- package/autopm/.claude/rules/context7-enforcement.md +292 -0
- package/package.json +1 -1
- package/scripts/add-context7-to-commands.js +351 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Context7 Documentation Enforcement
|
|
2
|
+
|
|
3
|
+
> **CRITICAL**: This rule has HIGHEST PRIORITY. ALL commands and agents MUST query Context7 before execution.
|
|
4
|
+
|
|
5
|
+
## Core Context7 Philosophy
|
|
6
|
+
|
|
7
|
+
**Prime Directive**: Query live documentation from Context7 MCP BEFORE implementing any solution.
|
|
8
|
+
**Zero Tolerance**: No implementation without Context7 query. No reliance on training data. No shortcuts.
|
|
9
|
+
|
|
10
|
+
## Why This is Critical
|
|
11
|
+
|
|
12
|
+
### Problems We Solve
|
|
13
|
+
|
|
14
|
+
- **Hallucinations**: AI training data becomes stale, leading to outdated patterns
|
|
15
|
+
- **API Changes**: Frameworks evolve - training data doesn't reflect latest versions
|
|
16
|
+
- **Best Practices Drift**: Industry standards change faster than model retraining
|
|
17
|
+
- **Version Conflicts**: Code suggestions may target wrong framework versions
|
|
18
|
+
|
|
19
|
+
### Context7 Benefits
|
|
20
|
+
|
|
21
|
+
- **Always Current**: Live documentation reflects latest releases
|
|
22
|
+
- **Verified Patterns**: Real code examples from official sources
|
|
23
|
+
- **API Accuracy**: Current function signatures, parameters, return types
|
|
24
|
+
- **Breaking Changes**: Immediate awareness of deprecated patterns
|
|
25
|
+
|
|
26
|
+
## The Context7 Cycle
|
|
27
|
+
|
|
28
|
+
### 1. QUERY Phase (Before Implementation)
|
|
29
|
+
|
|
30
|
+
**MANDATORY Steps:**
|
|
31
|
+
1. Read command/agent file to extract `**Documentation Queries:**` section
|
|
32
|
+
2. Query EACH Context7 MCP link listed
|
|
33
|
+
3. Analyze results for relevant patterns, APIs, and best practices
|
|
34
|
+
4. Summarize key findings before proceeding
|
|
35
|
+
|
|
36
|
+
**Required Information:**
|
|
37
|
+
- Current API signatures and parameters
|
|
38
|
+
- Recommended patterns and anti-patterns
|
|
39
|
+
- Breaking changes from recent versions
|
|
40
|
+
- Official code examples
|
|
41
|
+
|
|
42
|
+
### 2. IMPLEMENT Phase (Using Context7 Knowledge)
|
|
43
|
+
|
|
44
|
+
**Requirements:**
|
|
45
|
+
- Apply patterns EXACTLY as documented in Context7 results
|
|
46
|
+
- Use API signatures from Context7 (not from training data)
|
|
47
|
+
- Follow architectural recommendations from live docs
|
|
48
|
+
- Reference Context7 findings in code comments where applicable
|
|
49
|
+
|
|
50
|
+
**Verification:**
|
|
51
|
+
- Cross-check implementation against Context7 examples
|
|
52
|
+
- Validate parameters match current API documentation
|
|
53
|
+
- Ensure no deprecated patterns are used
|
|
54
|
+
|
|
55
|
+
### 3. VALIDATE Phase (Post-Implementation)
|
|
56
|
+
|
|
57
|
+
**Mandatory Checks:**
|
|
58
|
+
- Implementation matches Context7 best practices
|
|
59
|
+
- No training data hallucinations introduced
|
|
60
|
+
- Code follows latest framework conventions
|
|
61
|
+
- All deprecation warnings addressed
|
|
62
|
+
|
|
63
|
+
## Enforcement Rules
|
|
64
|
+
|
|
65
|
+
### ABSOLUTE REQUIREMENTS
|
|
66
|
+
|
|
67
|
+
**For ALL Commands:**
|
|
68
|
+
- MUST read `## Required Documentation Access` section
|
|
69
|
+
- MUST query EVERY `mcp://context7/...` link before execution
|
|
70
|
+
- MUST summarize Context7 findings before proceeding
|
|
71
|
+
- MUST apply Context7 guidance in implementation
|
|
72
|
+
|
|
73
|
+
**For ALL Agents:**
|
|
74
|
+
- MUST read `**Documentation Queries:**` section
|
|
75
|
+
- MUST query Context7 before making technical decisions
|
|
76
|
+
- MUST verify API signatures against live documentation
|
|
77
|
+
- MUST flag conflicts between training data and Context7
|
|
78
|
+
|
|
79
|
+
**For ALL Implementations:**
|
|
80
|
+
- NO code based solely on training data for technical specifics
|
|
81
|
+
- NO assumptions about API signatures without Context7 verification
|
|
82
|
+
- NO "I think this is how it works" - VERIFY with Context7
|
|
83
|
+
- NO skipping Context7 "because it's a small change"
|
|
84
|
+
|
|
85
|
+
### PROHIBITED PRACTICES
|
|
86
|
+
|
|
87
|
+
- ā Implementing without querying Context7 first
|
|
88
|
+
- ā "I remember how this works" - training data is stale
|
|
89
|
+
- ā Skipping Context7 for "simple" or "obvious" tasks
|
|
90
|
+
- ā Using cached knowledge instead of live documentation
|
|
91
|
+
- ā Proceeding when Context7 query fails (STOP and report)
|
|
92
|
+
- ā Ignoring Context7 guidance because training data "seems better"
|
|
93
|
+
|
|
94
|
+
## Query Quality Standards
|
|
95
|
+
|
|
96
|
+
### Effective Context7 Queries
|
|
97
|
+
|
|
98
|
+
**DO:**
|
|
99
|
+
- ā
Query ALL links in Documentation Queries section
|
|
100
|
+
- ā
Request specific topics relevant to the task
|
|
101
|
+
- ā
Ask for code examples and patterns
|
|
102
|
+
- ā
Verify API signatures and parameters
|
|
103
|
+
- ā
Check for breaking changes and migrations
|
|
104
|
+
|
|
105
|
+
**DON'T:**
|
|
106
|
+
- ā Skip queries assuming training data is sufficient
|
|
107
|
+
- ā Query only one link when multiple are listed
|
|
108
|
+
- ā Accept generic results - request specifics
|
|
109
|
+
- ā Ignore version mismatches in results
|
|
110
|
+
|
|
111
|
+
### Coverage Requirements
|
|
112
|
+
|
|
113
|
+
- **100% Query Rate**: Every command/agent execution queries Context7
|
|
114
|
+
- **Complete Coverage**: ALL listed Context7 links must be queried
|
|
115
|
+
- **Result Validation**: Verify Context7 returned relevant information
|
|
116
|
+
- **Fallback Protocol**: If Context7 fails, STOP and report (don't proceed with stale data)
|
|
117
|
+
|
|
118
|
+
## Integration with Workflow
|
|
119
|
+
|
|
120
|
+
### Command Execution Flow
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
User executes command: /pm:epic-decompose feature-name
|
|
124
|
+
|
|
125
|
+
BEFORE execution:
|
|
126
|
+
1. Read .claude/commands/pm/epic-decompose.md
|
|
127
|
+
2. Extract Documentation Queries section:
|
|
128
|
+
- mcp://context7/agile/epic-decomposition
|
|
129
|
+
- mcp://context7/agile/task-sizing
|
|
130
|
+
- mcp://context7/agile/user-stories
|
|
131
|
+
- mcp://context7/project-management/task-breakdown
|
|
132
|
+
3. Query Context7 for EACH link
|
|
133
|
+
4. Summarize findings: "Context7 confirms INVEST criteria for user stories..."
|
|
134
|
+
5. PROCEED with command execution using Context7 guidance
|
|
135
|
+
|
|
136
|
+
DURING execution:
|
|
137
|
+
- Apply Context7 patterns
|
|
138
|
+
- Reference Context7 examples
|
|
139
|
+
- Follow Context7 best practices
|
|
140
|
+
|
|
141
|
+
AFTER execution:
|
|
142
|
+
- Validate against Context7 standards
|
|
143
|
+
- Flag any deviations from documentation
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Agent Invocation Flow
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
User invokes agent: @aws-cloud-architect design VPC
|
|
150
|
+
|
|
151
|
+
BEFORE invocation:
|
|
152
|
+
1. Read .claude/agents/cloud/aws-cloud-architect.md
|
|
153
|
+
2. Extract Documentation Queries section:
|
|
154
|
+
- mcp://context7/aws/compute
|
|
155
|
+
- mcp://context7/aws/networking
|
|
156
|
+
- mcp://context7/terraform/aws
|
|
157
|
+
3. Query Context7 for EACH link
|
|
158
|
+
4. Summarize: "Context7 shows VPC best practices: /16 for staging, /20 for prod..."
|
|
159
|
+
5. PROCEED with agent work using Context7 knowledge
|
|
160
|
+
|
|
161
|
+
DURING agent work:
|
|
162
|
+
- Use current AWS API patterns from Context7
|
|
163
|
+
- Apply Terraform AWS provider patterns from Context7
|
|
164
|
+
- Follow networking best practices from Context7
|
|
165
|
+
|
|
166
|
+
AFTER agent work:
|
|
167
|
+
- Cross-check VPC design against Context7 recommendations
|
|
168
|
+
- Ensure no deprecated patterns used
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Violation Consequences
|
|
172
|
+
|
|
173
|
+
**If Context7 enforcement is violated:**
|
|
174
|
+
|
|
175
|
+
### Immediate Actions
|
|
176
|
+
|
|
177
|
+
1. **STOP** execution immediately
|
|
178
|
+
2. **IDENTIFY** what was implemented without Context7 verification
|
|
179
|
+
3. **DELETE** code based on potentially stale training data
|
|
180
|
+
4. **QUERY** Context7 for the relevant documentation
|
|
181
|
+
5. **REIMPLEMENT** using Context7 guidance
|
|
182
|
+
6. **DOCUMENT** violation and correction
|
|
183
|
+
|
|
184
|
+
### Severity Levels
|
|
185
|
+
|
|
186
|
+
**Level 1 - Minor (Warning):**
|
|
187
|
+
- Partial Context7 queries (some links skipped)
|
|
188
|
+
- Action: Complete missing queries, validate implementation
|
|
189
|
+
|
|
190
|
+
**Level 2 - Moderate (Correction Required):**
|
|
191
|
+
- No Context7 queries performed
|
|
192
|
+
- Action: Stop, query Context7, review implementation
|
|
193
|
+
|
|
194
|
+
**Level 3 - Critical (Revert and Redo):**
|
|
195
|
+
- Implementation contradicts Context7 documentation
|
|
196
|
+
- Action: Delete code, start over with Context7 guidance
|
|
197
|
+
|
|
198
|
+
### No Exceptions Policy
|
|
199
|
+
|
|
200
|
+
- NO "small changes" exceptions
|
|
201
|
+
- NO "I'm confident this is right" exceptions
|
|
202
|
+
- NO "Context7 is slow" exceptions
|
|
203
|
+
- NO "training data matches Context7" assumptions
|
|
204
|
+
|
|
205
|
+
## Success Metrics
|
|
206
|
+
|
|
207
|
+
### Compliance Indicators
|
|
208
|
+
|
|
209
|
+
- ā
100% of commands query Context7 before execution
|
|
210
|
+
- ā
100% of agents query Context7 before implementation
|
|
211
|
+
- ā
Zero implementations based solely on training data
|
|
212
|
+
- ā
All API signatures verified against live documentation
|
|
213
|
+
- ā
No deprecated patterns in codebase
|
|
214
|
+
- ā
Context7 findings documented in comments/commits
|
|
215
|
+
|
|
216
|
+
### Quality Indicators
|
|
217
|
+
|
|
218
|
+
- ā
Implementation matches Context7 examples
|
|
219
|
+
- ā
No "unexpected behavior" due to API changes
|
|
220
|
+
- ā
Code follows latest framework conventions
|
|
221
|
+
- ā
Breaking changes identified and addressed proactively
|
|
222
|
+
|
|
223
|
+
## Automation and Enforcement
|
|
224
|
+
|
|
225
|
+
### Pre-Command Hook
|
|
226
|
+
|
|
227
|
+
File: `.claude/hooks/pre-command-context7.js`
|
|
228
|
+
|
|
229
|
+
**Purpose**: Automatically extract and query Context7 before command execution
|
|
230
|
+
|
|
231
|
+
**Behavior**:
|
|
232
|
+
1. Intercept command execution
|
|
233
|
+
2. Read command file from `.claude/commands/{category}/{command}.md`
|
|
234
|
+
3. Extract `**Documentation Queries:**` section
|
|
235
|
+
4. Query Context7 MCP for each link
|
|
236
|
+
5. Inject results into command context
|
|
237
|
+
6. Proceed with execution
|
|
238
|
+
|
|
239
|
+
### Pre-Agent Hook
|
|
240
|
+
|
|
241
|
+
File: `.claude/hooks/pre-agent-context7.js`
|
|
242
|
+
|
|
243
|
+
**Purpose**: Automatically extract and query Context7 before agent invocation
|
|
244
|
+
|
|
245
|
+
**Behavior**:
|
|
246
|
+
1. Intercept agent invocation
|
|
247
|
+
2. Read agent file from `.claude/agents/{category}/{agent}.md`
|
|
248
|
+
3. Extract `**Documentation Queries:**` section
|
|
249
|
+
4. Query Context7 MCP for each link
|
|
250
|
+
5. Inject results into agent context
|
|
251
|
+
6. Proceed with agent work
|
|
252
|
+
|
|
253
|
+
### Validation Rule
|
|
254
|
+
|
|
255
|
+
File: `.claude/rules/context7-enforcement.md` (this file)
|
|
256
|
+
|
|
257
|
+
**Purpose**: Remind Claude to ALWAYS query Context7
|
|
258
|
+
|
|
259
|
+
**Enforcement**:
|
|
260
|
+
- Read by Claude on every session start
|
|
261
|
+
- Highest priority in rule hierarchy
|
|
262
|
+
- Zero tolerance for violations
|
|
263
|
+
|
|
264
|
+
## Emergency Fallback
|
|
265
|
+
|
|
266
|
+
**If Context7 MCP is unavailable:**
|
|
267
|
+
|
|
268
|
+
1. **ALERT** user immediately: "ā ļø Context7 MCP unavailable - cannot verify documentation"
|
|
269
|
+
2. **REQUEST** user decision:
|
|
270
|
+
- WAIT for Context7 to become available (RECOMMENDED)
|
|
271
|
+
- PROCEED with explicit user acknowledgment and risk acceptance
|
|
272
|
+
3. **DOCUMENT** in code: `// WARNING: Implemented without Context7 verification - Context7 MCP was unavailable`
|
|
273
|
+
4. **FLAG** for review: Add TODO to re-verify with Context7 when available
|
|
274
|
+
|
|
275
|
+
**DO NOT:**
|
|
276
|
+
- ā Silently proceed without Context7
|
|
277
|
+
- ā Assume training data is sufficient
|
|
278
|
+
- ā Skip documentation queries
|
|
279
|
+
|
|
280
|
+
## Related Rules
|
|
281
|
+
|
|
282
|
+
- **TDD Enforcement** (`.claude/rules/tdd.enforcement.md`) - Tests first, always
|
|
283
|
+
- **Agent Usage** (`.claude/rules/agent-usage.md`) - When to use specialized agents
|
|
284
|
+
- **Code Quality** (`.claude/rules/code-quality.md`) - Standards and anti-patterns
|
|
285
|
+
|
|
286
|
+
## Final Reminder
|
|
287
|
+
|
|
288
|
+
> **Context7 is NOT optional. It is MANDATORY for EVERY command and agent execution.**
|
|
289
|
+
>
|
|
290
|
+
> Training data becomes stale. APIs change. Best practices evolve.
|
|
291
|
+
>
|
|
292
|
+
> Context7 keeps us current. Query it. Every. Single. Time.
|
package/package.json
CHANGED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Automatically add "Required Documentation Access" section to all commands
|
|
5
|
+
* that don't already have it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
// Command categories with their Context7 topic mappings
|
|
13
|
+
const CATEGORY_MAPPINGS = {
|
|
14
|
+
'ai': {
|
|
15
|
+
topics: ['ai/llm-integration', 'ai/workflow-orchestration', 'openai/api', 'langchain/agents'],
|
|
16
|
+
description: 'AI integration and LLM workflows'
|
|
17
|
+
},
|
|
18
|
+
'azure': {
|
|
19
|
+
topics: ['azure-devops/boards', 'agile/user-stories', 'project-management/work-items', 'agile/sprint-planning'],
|
|
20
|
+
description: 'Azure DevOps integration and agile workflows'
|
|
21
|
+
},
|
|
22
|
+
'cloud': {
|
|
23
|
+
topics: ['cloud/infrastructure', 'devops/deployment', 'terraform/best-practices', 'cloud/security'],
|
|
24
|
+
description: 'cloud infrastructure deployment'
|
|
25
|
+
},
|
|
26
|
+
'config': {
|
|
27
|
+
topics: ['configuration-management/best-practices', 'devops/feature-flags'],
|
|
28
|
+
description: 'configuration management'
|
|
29
|
+
},
|
|
30
|
+
'context': {
|
|
31
|
+
topics: ['ai/context-management', 'llm/prompt-engineering', 'ai/rag-systems'],
|
|
32
|
+
description: 'AI context management'
|
|
33
|
+
},
|
|
34
|
+
'github': {
|
|
35
|
+
topics: ['github/workflows', 'ci-cd/github-actions', 'devops/automation'],
|
|
36
|
+
description: 'GitHub workflow creation'
|
|
37
|
+
},
|
|
38
|
+
'infrastructure': {
|
|
39
|
+
topics: ['security/ssh-hardening', 'infrastructure/reverse-proxy', 'security/best-practices', 'devops/traefik'],
|
|
40
|
+
description: 'infrastructure setup and security'
|
|
41
|
+
},
|
|
42
|
+
'kubernetes': {
|
|
43
|
+
topics: ['kubernetes/deployment', 'kubernetes/best-practices', 'devops/container-orchestration'],
|
|
44
|
+
description: 'Kubernetes deployment'
|
|
45
|
+
},
|
|
46
|
+
'mcp': {
|
|
47
|
+
topics: ['mcp/protocol', 'mcp/servers', 'ai/context-management', 'mcp/integration'],
|
|
48
|
+
description: 'MCP server setup and documentation'
|
|
49
|
+
},
|
|
50
|
+
'playwright': {
|
|
51
|
+
topics: ['playwright/testing', 'testing/e2e', 'testing/best-practices', 'playwright/patterns'],
|
|
52
|
+
description: 'Playwright test scaffolding'
|
|
53
|
+
},
|
|
54
|
+
'pm': {
|
|
55
|
+
topics: ['agile/epic-management', 'project-management/issue-tracking', 'agile/task-breakdown', 'project-management/workflow'],
|
|
56
|
+
description: 'project management workflows'
|
|
57
|
+
},
|
|
58
|
+
'python': {
|
|
59
|
+
topics: ['python/api-development', 'fastapi/best-practices', 'python/documentation', 'api-design/rest'],
|
|
60
|
+
description: 'Python API development'
|
|
61
|
+
},
|
|
62
|
+
'react': {
|
|
63
|
+
topics: ['react/application-setup', 'react/best-practices', 'frontend/architecture', 'react/tooling'],
|
|
64
|
+
description: 'React application scaffolding'
|
|
65
|
+
},
|
|
66
|
+
'testing': {
|
|
67
|
+
topics: ['testing/strategy', 'testing/automation', 'tdd/workflow', 'testing/best-practices'],
|
|
68
|
+
description: 'testing workflows'
|
|
69
|
+
},
|
|
70
|
+
'ui': {
|
|
71
|
+
topics: ['ui/bootstrap', 'ui/tailwind', 'frontend/design-systems', 'css/frameworks'],
|
|
72
|
+
description: 'UI framework setup'
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Special mappings for specific commands
|
|
77
|
+
const COMMAND_SPECIFIC_MAPPINGS = {
|
|
78
|
+
'epic-decompose': {
|
|
79
|
+
topics: ['agile/epic-decomposition', 'agile/task-sizing', 'agile/user-stories', 'project-management/task-breakdown'],
|
|
80
|
+
description: 'decomposing epics'
|
|
81
|
+
},
|
|
82
|
+
'epic-split': {
|
|
83
|
+
topics: ['agile/epic-splitting', 'project-management/dependency-mapping', 'agile/priority-frameworks', 'architecture/component-analysis'],
|
|
84
|
+
description: 'splitting PRDs into epics'
|
|
85
|
+
},
|
|
86
|
+
'issue-analyze': {
|
|
87
|
+
topics: ['agile/issue-analysis', 'agile/parallel-work', 'project-management/task-dependencies', 'agile/estimation'],
|
|
88
|
+
description: 'analyzing issues'
|
|
89
|
+
},
|
|
90
|
+
'issue-start': {
|
|
91
|
+
topics: ['agile/issue-planning', 'tdd/workflow', 'git/branching', 'collaboration/parallel-work'],
|
|
92
|
+
description: 'starting work on issues'
|
|
93
|
+
},
|
|
94
|
+
'prd-new': {
|
|
95
|
+
topics: ['product-management/prd-templates', 'product-management/requirements', 'agile/user-stories', 'product-management/success-metrics'],
|
|
96
|
+
description: 'creating PRDs'
|
|
97
|
+
},
|
|
98
|
+
'prd-parse': {
|
|
99
|
+
topics: ['product-management/prd-to-epic', 'agile/epic-structure', 'architecture/technical-design', 'project-management/task-breakdown'],
|
|
100
|
+
description: 'converting PRDs to epics'
|
|
101
|
+
},
|
|
102
|
+
'feature-decompose': {
|
|
103
|
+
topics: ['agile/feature-breakdown', 'azure-devops/features', 'agile/task-sizing', 'project-management/work-breakdown'],
|
|
104
|
+
description: 'decomposing Azure features'
|
|
105
|
+
},
|
|
106
|
+
'us-new': {
|
|
107
|
+
topics: ['agile/user-stories', 'agile/invest-criteria', 'azure-devops/user-stories', 'requirements/writing'],
|
|
108
|
+
description: 'creating user stories'
|
|
109
|
+
},
|
|
110
|
+
'task-analyze': {
|
|
111
|
+
topics: ['agile/task-analysis', 'project-management/task-planning', 'agile/estimation', 'azure-devops/tasks'],
|
|
112
|
+
description: 'analyzing tasks'
|
|
113
|
+
},
|
|
114
|
+
'workflow-create': {
|
|
115
|
+
topics: ['github/workflows', 'ci-cd/github-actions', 'devops/pipeline-design', 'ci-cd/best-practices'],
|
|
116
|
+
description: 'creating GitHub workflows'
|
|
117
|
+
},
|
|
118
|
+
'infra-deploy': {
|
|
119
|
+
topics: ['infrastructure/deployment', 'cloud/best-practices', 'devops/automation', 'infrastructure/configuration'],
|
|
120
|
+
description: 'deploying infrastructure'
|
|
121
|
+
},
|
|
122
|
+
'ssh-security': {
|
|
123
|
+
topics: ['security/ssh-hardening', 'security/authentication', 'infrastructure/security', 'security/best-practices'],
|
|
124
|
+
description: 'SSH security hardening'
|
|
125
|
+
},
|
|
126
|
+
'traefik-setup': {
|
|
127
|
+
topics: ['infrastructure/reverse-proxy', 'traefik/configuration', 'devops/networking', 'security/tls'],
|
|
128
|
+
description: 'Traefik setup'
|
|
129
|
+
},
|
|
130
|
+
'test-scaffold': {
|
|
131
|
+
topics: ['playwright/scaffolding', 'testing/e2e', 'testing/page-objects', 'playwright/best-practices'],
|
|
132
|
+
description: 'scaffolding Playwright tests'
|
|
133
|
+
},
|
|
134
|
+
'api-scaffold': {
|
|
135
|
+
topics: ['python/api-scaffolding', 'fastapi/structure', 'api-design/rest', 'python/best-practices'],
|
|
136
|
+
description: 'scaffolding Python APIs'
|
|
137
|
+
},
|
|
138
|
+
'app-scaffold': {
|
|
139
|
+
topics: ['react/project-setup', 'react/application-structure', 'frontend/tooling', 'react/best-practices'],
|
|
140
|
+
description: 'scaffolding React applications'
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
function getCommandCategory(filePath) {
|
|
145
|
+
const parts = filePath.split('/');
|
|
146
|
+
const commandsIndex = parts.indexOf('commands');
|
|
147
|
+
if (commandsIndex >= 0 && commandsIndex < parts.length - 1) {
|
|
148
|
+
return parts[commandsIndex + 1];
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getCommandName(filePath) {
|
|
154
|
+
return path.basename(filePath, '.md');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function getTopicsForCommand(filePath) {
|
|
158
|
+
const commandName = getCommandName(filePath);
|
|
159
|
+
const category = getCommandCategory(filePath);
|
|
160
|
+
|
|
161
|
+
// Check for command-specific mapping first
|
|
162
|
+
if (COMMAND_SPECIFIC_MAPPINGS[commandName]) {
|
|
163
|
+
return COMMAND_SPECIFIC_MAPPINGS[commandName];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Fall back to category mapping
|
|
167
|
+
if (category && CATEGORY_MAPPINGS[category]) {
|
|
168
|
+
return CATEGORY_MAPPINGS[category];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Default generic topics
|
|
172
|
+
return {
|
|
173
|
+
topics: ['best-practices/general', 'development/workflow'],
|
|
174
|
+
description: 'executing this command'
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function generateContext7Section(filePath) {
|
|
179
|
+
const mapping = getTopicsForCommand(filePath);
|
|
180
|
+
const { topics, description } = mapping;
|
|
181
|
+
|
|
182
|
+
const documentationQueries = topics
|
|
183
|
+
.map(topic => `- \`mcp://context7/${topic}\` - ${topic.split('/').pop().replace(/-/g, ' ')} best practices`)
|
|
184
|
+
.join('\n');
|
|
185
|
+
|
|
186
|
+
return `## Required Documentation Access
|
|
187
|
+
|
|
188
|
+
**MANDATORY:** Before ${description}, query Context7 for best practices:
|
|
189
|
+
|
|
190
|
+
**Documentation Queries:**
|
|
191
|
+
${documentationQueries}
|
|
192
|
+
|
|
193
|
+
**Why This is Required:**
|
|
194
|
+
- Ensures adherence to current industry standards and best practices
|
|
195
|
+
- Prevents outdated or incorrect implementation patterns
|
|
196
|
+
- Provides access to latest framework/tool documentation
|
|
197
|
+
- Reduces errors from stale knowledge or assumptions
|
|
198
|
+
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function shouldProcessFile(filePath) {
|
|
203
|
+
const fileName = path.basename(filePath);
|
|
204
|
+
|
|
205
|
+
// Skip non-command files
|
|
206
|
+
const skipFiles = [
|
|
207
|
+
'README.md',
|
|
208
|
+
'COMMANDS.md',
|
|
209
|
+
'COMMAND_MAPPING.md',
|
|
210
|
+
'INTEGRATION_FIX.md',
|
|
211
|
+
'ui-framework-commands.md',
|
|
212
|
+
'ux-design-commands.md',
|
|
213
|
+
'code-rabbit.md',
|
|
214
|
+
'prompt.md',
|
|
215
|
+
're-init.md'
|
|
216
|
+
];
|
|
217
|
+
|
|
218
|
+
return !skipFiles.includes(fileName);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function hasContext7Section(content) {
|
|
222
|
+
return content.includes('## Required Documentation Access');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function findInsertionPoint(content) {
|
|
226
|
+
const lines = content.split('\n');
|
|
227
|
+
|
|
228
|
+
// Look for common section headers where we should insert BEFORE
|
|
229
|
+
const beforeSections = [
|
|
230
|
+
'## Instructions',
|
|
231
|
+
'## Required Rules',
|
|
232
|
+
'## Quick Check',
|
|
233
|
+
'## Description',
|
|
234
|
+
'## Usage Examples',
|
|
235
|
+
'## Overview',
|
|
236
|
+
'## Pre-flight Checks',
|
|
237
|
+
'## Validation',
|
|
238
|
+
'## Steps'
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
for (let i = 0; i < lines.length; i++) {
|
|
242
|
+
for (const section of beforeSections) {
|
|
243
|
+
if (lines[i].trim().startsWith(section)) {
|
|
244
|
+
return i;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// If no known section found, insert after usage block (usually has ```)
|
|
250
|
+
let usageEndIndex = -1;
|
|
251
|
+
let inUsageBlock = false;
|
|
252
|
+
for (let i = 0; i < lines.length; i++) {
|
|
253
|
+
if (lines[i].includes('## Usage') || lines[i].includes('## Example')) {
|
|
254
|
+
inUsageBlock = true;
|
|
255
|
+
}
|
|
256
|
+
if (inUsageBlock && lines[i].trim() === '```') {
|
|
257
|
+
usageEndIndex = i + 1;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (usageEndIndex > 0) {
|
|
263
|
+
return usageEndIndex;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Last resort: insert after first heading block (after frontmatter and title)
|
|
267
|
+
let headingCount = 0;
|
|
268
|
+
for (let i = 0; i < lines.length; i++) {
|
|
269
|
+
if (lines[i].startsWith('#')) {
|
|
270
|
+
headingCount++;
|
|
271
|
+
if (headingCount >= 2) {
|
|
272
|
+
return i;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return 10; // Fallback to line 10
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function addContext7Section(filePath) {
|
|
281
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
282
|
+
|
|
283
|
+
if (hasContext7Section(content)) {
|
|
284
|
+
return { modified: false, reason: 'already has section' };
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const context7Section = generateContext7Section(filePath);
|
|
288
|
+
const insertionLine = findInsertionPoint(content);
|
|
289
|
+
|
|
290
|
+
const lines = content.split('\n');
|
|
291
|
+
lines.splice(insertionLine, 0, context7Section);
|
|
292
|
+
|
|
293
|
+
const newContent = lines.join('\n');
|
|
294
|
+
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
295
|
+
|
|
296
|
+
return { modified: true, insertionLine };
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function main() {
|
|
300
|
+
const commandsDir = path.join(__dirname, '../autopm/.claude/commands');
|
|
301
|
+
|
|
302
|
+
// Find all .md files recursively
|
|
303
|
+
const findCommand = `find "${commandsDir}" -name "*.md" -type f`;
|
|
304
|
+
const files = execSync(findCommand, { encoding: 'utf8' })
|
|
305
|
+
.trim()
|
|
306
|
+
.split('\n')
|
|
307
|
+
.filter(f => f.length > 0);
|
|
308
|
+
|
|
309
|
+
console.log(`\nš Found ${files.length} command files\n`);
|
|
310
|
+
|
|
311
|
+
const results = {
|
|
312
|
+
modified: [],
|
|
313
|
+
skipped: [],
|
|
314
|
+
alreadyHas: []
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
for (const file of files) {
|
|
318
|
+
const fileName = path.relative(commandsDir, file);
|
|
319
|
+
|
|
320
|
+
if (!shouldProcessFile(file)) {
|
|
321
|
+
results.skipped.push(fileName);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const result = addContext7Section(file);
|
|
326
|
+
|
|
327
|
+
if (result.modified) {
|
|
328
|
+
results.modified.push({ file: fileName, line: result.insertionLine });
|
|
329
|
+
console.log(`ā
Added to: ${fileName} (line ${result.insertionLine})`);
|
|
330
|
+
} else {
|
|
331
|
+
results.alreadyHas.push(fileName);
|
|
332
|
+
console.log(`āļø Skip: ${fileName} (${result.reason})`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
console.log(`\nš Summary:`);
|
|
337
|
+
console.log(` Modified: ${results.modified.length}`);
|
|
338
|
+
console.log(` Already has Context7: ${results.alreadyHas.length}`);
|
|
339
|
+
console.log(` Skipped (non-command files): ${results.skipped.length}`);
|
|
340
|
+
console.log(` Total processed: ${files.length}\n`);
|
|
341
|
+
|
|
342
|
+
if (results.modified.length > 0) {
|
|
343
|
+
console.log(`⨠Successfully added Context7 sections to ${results.modified.length} commands!\n`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (require.main === module) {
|
|
348
|
+
main();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
module.exports = { addContext7Section, getTopicsForCommand };
|