codymaster 4.5.4 → 4.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.
- package/CHANGELOG.md +46 -1
- package/README.md +86 -31
- package/dist/backends/viking-backend.js +235 -0
- package/dist/backends/viking-http-client.js +176 -0
- package/dist/browse-server.js +251 -0
- package/dist/cli/command-registry.js +26 -0
- package/dist/cli/commands/agent.js +120 -0
- package/dist/cli/commands/dashboard.js +93 -0
- package/dist/cli/commands/design-studio.js +111 -0
- package/dist/cli/commands/distro.js +25 -0
- package/dist/cli/commands/engineering.js +488 -0
- package/dist/cli/commands/project.js +324 -0
- package/dist/cli/commands/skill-chain.js +269 -0
- package/dist/cli/commands/system.js +89 -0
- package/dist/cli/commands/task.js +254 -0
- package/dist/cli/update-check.js +83 -0
- package/dist/cm-config.js +110 -0
- package/dist/cm-suggest.js +77 -0
- package/dist/continuity.js +8 -0
- package/dist/distro-validate.js +54 -0
- package/dist/guardian-core.js +74 -0
- package/dist/index.js +36 -2759
- package/dist/mcp-context-server.js +60 -1
- package/dist/mcp-skills-tools.js +81 -0
- package/dist/retro-summary.js +70 -0
- package/dist/second-opinion-providers.js +79 -0
- package/dist/sprint-pipeline.js +228 -0
- package/dist/storage-backend.js +63 -0
- package/dist/utils/cli-utils.js +76 -0
- package/dist/utils/skill-utils.js +32 -0
- package/install.sh +286 -58
- package/package.json +16 -5
- package/scripts/build-skills.mjs +51 -0
- package/scripts/gate-0-repo-hygiene.js +75 -0
- package/scripts/postinstall.js +56 -1
- package/scripts/security-scan.js +1 -1
- package/scripts/validate-skills.mjs +42 -0
- package/scripts/viking-demo.ts +105 -0
- package/skills/CLAUDE.md +2 -2
- package/skills/_shared/helpers.md +10 -0
- package/skills/cm-ads-tracker/SKILL.md +3 -6
- package/skills/cm-browse/SKILL.md +28 -0
- package/skills/cm-conductor-worktrees/SKILL.md +24 -0
- package/skills/cm-content-factory/SKILL.md +1 -1
- package/skills/cm-content-factory/landing/docs/content/changelog.md +36 -0
- package/skills/cm-content-factory/landing/docs/content/deployment.md +46 -0
- package/skills/cm-content-factory/landing/docs/content/execution-flow.md +67 -0
- package/skills/cm-content-factory/landing/docs/content/openspace.md +27 -0
- package/skills/cm-content-factory/landing/docs/content/openviking.md +33 -0
- package/skills/cm-content-factory/landing/docs/content/use-cases.md +26 -0
- package/skills/cm-content-factory/landing/docs/content/v5-intro.md +28 -0
- package/skills/cm-content-factory/landing/docs/index.html +240 -0
- package/skills/cm-content-factory/landing/index.html +99 -99
- package/skills/cm-content-factory/landing/script.js +42 -0
- package/skills/cm-content-factory/landing/translations.js +400 -400
- package/skills/cm-continuity/SKILL.md +33 -6
- package/skills/cm-design-studio/SKILL.md +30 -0
- package/skills/cm-ecosystem-roadmap/SKILL.md +11 -0
- package/skills/cm-engineering-meta/SKILL.md +69 -0
- package/skills/cm-growth-hacking/SKILL.md +1 -12
- package/skills/cm-guardian-runtime/SKILL.md +22 -0
- package/skills/cm-mcp-engineering/SKILL.md +18 -0
- package/skills/cm-notebooklm/SKILL.md +1 -17
- package/skills/cm-post-deploy-canary/SKILL.md +18 -0
- package/skills/cm-qa-visual-cli/SKILL.md +18 -0
- package/skills/cm-retro-cli/SKILL.md +19 -0
- package/skills/cm-second-opinion-cli/SKILL.md +19 -0
- package/skills/cm-secret-shield/SKILL.md +2 -2
- package/skills/cm-sprint-bus/SKILL.md +29 -0
- package/skills/cm-start/SKILL.md +11 -2
- package/skills/cm-tdd/SKILL.md +61 -74
- package/skills/profiles/README.md +21 -0
- package/skills/profiles/core.txt +23 -0
- package/skills/profiles/design.txt +6 -0
- package/skills/profiles/full.txt +58 -0
- package/skills/profiles/growth.txt +10 -0
- package/skills/profiles/knowledge.txt +7 -0
- package/scripts/test-gemini.js +0 -13
- package/skills/cm-frappe-agent/SKILL.md +0 -134
- package/skills/cm-frappe-agent/agents/doctype-architect.md +0 -596
- package/skills/cm-frappe-agent/agents/erpnext-customizer.md +0 -643
- package/skills/cm-frappe-agent/agents/frappe-backend.md +0 -814
- package/skills/cm-frappe-agent/agents/frappe-custom-frontend.md +0 -557
- package/skills/cm-frappe-agent/agents/frappe-debugger.md +0 -625
- package/skills/cm-frappe-agent/agents/frappe-fixer.md +0 -275
- package/skills/cm-frappe-agent/agents/frappe-frontend.md +0 -660
- package/skills/cm-frappe-agent/agents/frappe-installer.md +0 -158
- package/skills/cm-frappe-agent/agents/frappe-performance.md +0 -307
- package/skills/cm-frappe-agent/agents/frappe-planner.md +0 -419
- package/skills/cm-frappe-agent/agents/frappe-remote-ops.md +0 -153
- package/skills/cm-frappe-agent/agents/github-workflow.md +0 -286
- package/skills/cm-frappe-agent/commands/frappe-app.md +0 -351
- package/skills/cm-frappe-agent/commands/frappe-backend.md +0 -162
- package/skills/cm-frappe-agent/commands/frappe-bench.md +0 -254
- package/skills/cm-frappe-agent/commands/frappe-debug.md +0 -263
- package/skills/cm-frappe-agent/commands/frappe-doctype-create.md +0 -272
- package/skills/cm-frappe-agent/commands/frappe-doctype-field.md +0 -310
- package/skills/cm-frappe-agent/commands/frappe-erpnext.md +0 -210
- package/skills/cm-frappe-agent/commands/frappe-fix.md +0 -59
- package/skills/cm-frappe-agent/commands/frappe-frontend.md +0 -210
- package/skills/cm-frappe-agent/commands/frappe-fullstack.md +0 -243
- package/skills/cm-frappe-agent/commands/frappe-github.md +0 -57
- package/skills/cm-frappe-agent/commands/frappe-install.md +0 -52
- package/skills/cm-frappe-agent/commands/frappe-plan.md +0 -442
- package/skills/cm-frappe-agent/commands/frappe-remote.md +0 -58
- package/skills/cm-frappe-agent/commands/frappe-test.md +0 -356
- package/skills/cm-frappe-agent/docs/README.md +0 -51
- package/skills/cm-frappe-agent/docs/agents-catalog.md +0 -113
- package/skills/cm-frappe-agent/docs/architecture.md +0 -149
- package/skills/cm-frappe-agent/docs/commands-catalog.md +0 -82
- package/skills/cm-frappe-agent/docs/resources-catalog.md +0 -66
- package/skills/cm-frappe-agent/docs/sitemap-urls.txt +0 -52
- package/skills/cm-frappe-agent/docs/sitemap.md +0 -81
- package/skills/cm-frappe-agent/docs/sop/user-guide.md +0 -178
- package/skills/cm-frappe-agent/docs/sop/vibe-coding-guide.md +0 -122
- package/skills/cm-frappe-agent/resources/7-layer-architecture.md +0 -985
- package/skills/cm-frappe-agent/resources/bench_commands.md +0 -73
- package/skills/cm-frappe-agent/resources/code-patterns-guide.md +0 -948
- package/skills/cm-frappe-agent/resources/common_pitfalls.md +0 -266
- package/skills/cm-frappe-agent/resources/doctype-registry.md +0 -158
- package/skills/cm-frappe-agent/resources/installation-guide.md +0 -289
- package/skills/cm-frappe-agent/resources/rest-api-patterns.md +0 -182
- package/skills/cm-frappe-agent/resources/scaffold_checklist.md +0 -82
- package/skills/cm-frappe-agent/resources/upgrade_patterns.md +0 -113
- package/skills/cm-frappe-agent/resources/web-form-patterns.md +0 -252
- package/skills/cm-frappe-agent/skills/bench-commands/SKILL.md +0 -621
- package/skills/cm-frappe-agent/skills/client-scripts/SKILL.md +0 -642
- package/skills/cm-frappe-agent/skills/doctype-patterns/SKILL.md +0 -576
- package/skills/cm-frappe-agent/skills/frappe-api/SKILL.md +0 -740
- package/skills/cm-frappe-agent/skills/remote-operations/SKILL.md +0 -47
- package/skills/cm-frappe-agent/skills/server-scripts/SKILL.md +0 -608
- package/skills/cm-frappe-agent/skills/web-forms/SKILL.md +0 -46
- package/skills/frappe-app-builder.zip +0 -0
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Invoke the Frappe backend agent for server-side Python development including controllers, APIs, database operations, and background jobs
|
|
3
|
-
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Task, TodoWrite
|
|
4
|
-
argument-hint: <task_description>
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Frappe Backend Development
|
|
8
|
-
|
|
9
|
-
You are invoking the specialized Frappe backend agent for server-side Python development.
|
|
10
|
-
|
|
11
|
-
## Request
|
|
12
|
-
|
|
13
|
-
$ARGUMENTS
|
|
14
|
-
|
|
15
|
-
## Agent Invocation
|
|
16
|
-
|
|
17
|
-
Use the Task tool to spawn the `frappe-fullstack:frappe-backend` agent with the following configuration:
|
|
18
|
-
|
|
19
|
-
**IMPORTANT:** The agent name MUST be fully qualified: `frappe-fullstack:frappe-backend`
|
|
20
|
-
|
|
21
|
-
### Agent Prompt Template
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
You are working on a Frappe/ERPNext backend task.
|
|
25
|
-
|
|
26
|
-
## Task
|
|
27
|
-
{user's task description}
|
|
28
|
-
|
|
29
|
-
## Context
|
|
30
|
-
- Working directory: {current directory}
|
|
31
|
-
- Site: {detect from sites/currentsite.txt if available}
|
|
32
|
-
|
|
33
|
-
## Your Responsibilities
|
|
34
|
-
|
|
35
|
-
1. **Analyze the Request**
|
|
36
|
-
- Understand what backend functionality is needed
|
|
37
|
-
- Identify which DocTypes are involved
|
|
38
|
-
- Determine if this is controller logic, API, or background job
|
|
39
|
-
|
|
40
|
-
2. **Explore the Codebase**
|
|
41
|
-
- Find relevant existing code patterns
|
|
42
|
-
- Check existing controllers for conventions
|
|
43
|
-
- Identify utility functions that can be reused
|
|
44
|
-
|
|
45
|
-
3. **Implement the Solution**
|
|
46
|
-
- Write clean, well-documented Python code
|
|
47
|
-
- Follow Frappe coding conventions
|
|
48
|
-
- Include proper error handling
|
|
49
|
-
- Add validation where needed
|
|
50
|
-
|
|
51
|
-
4. **Provide Complete Code**
|
|
52
|
-
- Controller methods with lifecycle hooks
|
|
53
|
-
- Whitelisted APIs with proper decorators
|
|
54
|
-
- Database queries using frappe.db API
|
|
55
|
-
- Background jobs if long-running operations
|
|
56
|
-
|
|
57
|
-
## Output Requirements
|
|
58
|
-
- Provide complete, working code
|
|
59
|
-
- Include file paths for where code should go
|
|
60
|
-
- Explain any configuration needed (hooks.py, etc.)
|
|
61
|
-
- List commands to run (migrate, clear-cache, etc.)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Capabilities
|
|
65
|
-
|
|
66
|
-
The frappe-backend agent excels at:
|
|
67
|
-
|
|
68
|
-
### Controller Development
|
|
69
|
-
- Document lifecycle hooks (validate, before_save, on_submit, etc.)
|
|
70
|
-
- Custom validation logic
|
|
71
|
-
- Calculated fields and totals
|
|
72
|
-
- Status management
|
|
73
|
-
- Related document operations
|
|
74
|
-
|
|
75
|
-
### Whitelisted APIs
|
|
76
|
-
```python
|
|
77
|
-
@frappe.whitelist()
|
|
78
|
-
def my_api_endpoint(param1, param2):
|
|
79
|
-
# API logic
|
|
80
|
-
return result
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Database Operations
|
|
84
|
-
```python
|
|
85
|
-
# Query
|
|
86
|
-
results = frappe.db.get_all("DocType", filters={}, fields=[])
|
|
87
|
-
|
|
88
|
-
# Update
|
|
89
|
-
frappe.db.set_value("DocType", "name", "field", "value")
|
|
90
|
-
|
|
91
|
-
# Raw SQL
|
|
92
|
-
frappe.db.sql("SELECT * FROM `tabDocType` WHERE condition")
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### Background Jobs
|
|
96
|
-
```python
|
|
97
|
-
frappe.enqueue(
|
|
98
|
-
"myapp.tasks.heavy_task",
|
|
99
|
-
queue="long",
|
|
100
|
-
timeout=600,
|
|
101
|
-
**kwargs
|
|
102
|
-
)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Scheduled Tasks (hooks.py)
|
|
106
|
-
```python
|
|
107
|
-
scheduler_events = {
|
|
108
|
-
"daily": ["myapp.tasks.daily_task"],
|
|
109
|
-
"hourly": ["myapp.tasks.hourly_task"]
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Common Tasks
|
|
114
|
-
|
|
115
|
-
1. **"Add validation to prevent negative quantities"**
|
|
116
|
-
→ Controller validate method
|
|
117
|
-
|
|
118
|
-
2. **"Create API to fetch customer dashboard data"**
|
|
119
|
-
→ Whitelisted method with aggregation queries
|
|
120
|
-
|
|
121
|
-
3. **"Send email notification when order is approved"**
|
|
122
|
-
→ on_update hook with email logic
|
|
123
|
-
|
|
124
|
-
4. **"Sync data from external API daily"**
|
|
125
|
-
→ Scheduled background job
|
|
126
|
-
|
|
127
|
-
5. **"Calculate running totals across child table"**
|
|
128
|
-
→ Controller validate with iteration
|
|
129
|
-
|
|
130
|
-
## Tools Available to Agent
|
|
131
|
-
|
|
132
|
-
- **Glob**: Find Python files and patterns
|
|
133
|
-
- **Grep**: Search for existing implementations
|
|
134
|
-
- **Read**: Read existing code for context
|
|
135
|
-
- **Write**: Create new files
|
|
136
|
-
- **Edit**: Modify existing code
|
|
137
|
-
- **Bash**: Run bench commands, check structure
|
|
138
|
-
|
|
139
|
-
## Post-Implementation
|
|
140
|
-
|
|
141
|
-
After the agent completes:
|
|
142
|
-
|
|
143
|
-
1. **Run Migration** (if DocType changed)
|
|
144
|
-
```bash
|
|
145
|
-
bench --site <site> migrate
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
2. **Clear Cache**
|
|
149
|
-
```bash
|
|
150
|
-
bench --site <site> clear-cache
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
3. **Test the Code**
|
|
154
|
-
```bash
|
|
155
|
-
bench --site <site> console
|
|
156
|
-
# Test your functions
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
4. **Run Tests**
|
|
160
|
-
```bash
|
|
161
|
-
bench --site <site> run-tests --module <module>
|
|
162
|
-
```
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Execute Frappe Bench CLI commands safely with site awareness and common operation shortcuts
|
|
3
|
-
allowed-tools: Bash, Read, Grep, Glob
|
|
4
|
-
argument-hint: <command> [--site <sitename>]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Execute Bench Command
|
|
8
|
-
|
|
9
|
-
Safely execute Frappe Bench CLI commands with proper site context and validation.
|
|
10
|
-
|
|
11
|
-
## Arguments
|
|
12
|
-
|
|
13
|
-
Parse the user's input: $ARGUMENTS
|
|
14
|
-
|
|
15
|
-
Common commands:
|
|
16
|
-
- `migrate` - Run database migrations
|
|
17
|
-
- `build` - Build JavaScript/CSS assets
|
|
18
|
-
- `clear-cache` - Clear Redis cache
|
|
19
|
-
- `console` - Open Python console
|
|
20
|
-
- `start` - Start development server
|
|
21
|
-
- `update` - Update apps and migrate
|
|
22
|
-
- `backup` - Backup site
|
|
23
|
-
- `restore` - Restore from backup
|
|
24
|
-
|
|
25
|
-
## Process
|
|
26
|
-
|
|
27
|
-
### Step 1: Detect Bench Directory
|
|
28
|
-
|
|
29
|
-
Find the frappe-bench directory:
|
|
30
|
-
```bash
|
|
31
|
-
# Check if we're in a bench directory
|
|
32
|
-
if [ -f "sites/apps.txt" ]; then
|
|
33
|
-
echo "Bench directory found: $(pwd)"
|
|
34
|
-
else
|
|
35
|
-
# Try to find bench directory
|
|
36
|
-
find ~ -name "frappe-bench" -type d 2>/dev/null | head -3
|
|
37
|
-
fi
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Step 2: Identify Available Sites
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
# List available sites
|
|
44
|
-
ls sites/ | grep -v "apps.txt\|common_site_config.json\|assets"
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Step 3: Determine Current Site
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Check default site
|
|
51
|
-
cat sites/currentsite.txt 2>/dev/null || echo "No default site set"
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Step 4: Execute Command
|
|
55
|
-
|
|
56
|
-
Based on the requested operation:
|
|
57
|
-
|
|
58
|
-
#### Migrate
|
|
59
|
-
```bash
|
|
60
|
-
bench --site <sitename> migrate
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
**Safety checks:**
|
|
64
|
-
- Warn about uncommitted changes in apps
|
|
65
|
-
- Suggest backup before migrate
|
|
66
|
-
- Check for pending patches
|
|
67
|
-
|
|
68
|
-
#### Build
|
|
69
|
-
```bash
|
|
70
|
-
# Build all apps
|
|
71
|
-
bench build
|
|
72
|
-
|
|
73
|
-
# Build specific app
|
|
74
|
-
bench build --app <app_name>
|
|
75
|
-
|
|
76
|
-
# Build with verbose output
|
|
77
|
-
bench build --verbose
|
|
78
|
-
|
|
79
|
-
# Production build
|
|
80
|
-
bench build --production
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
#### Clear Cache
|
|
84
|
-
```bash
|
|
85
|
-
bench --site <sitename> clear-cache
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
#### Console
|
|
89
|
-
```bash
|
|
90
|
-
bench --site <sitename> console
|
|
91
|
-
|
|
92
|
-
# Example usage in console:
|
|
93
|
-
# >>> doc = frappe.get_doc("Customer", "CUST-001")
|
|
94
|
-
# >>> frappe.db.sql("SELECT * FROM tabCustomer LIMIT 5", as_dict=True)
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
#### Start Development Server
|
|
98
|
-
```bash
|
|
99
|
-
bench start
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
**Note:** This will occupy the terminal. Use Ctrl+C to stop.
|
|
103
|
-
|
|
104
|
-
#### Update
|
|
105
|
-
```bash
|
|
106
|
-
# Full update
|
|
107
|
-
bench update
|
|
108
|
-
|
|
109
|
-
# Update without backup
|
|
110
|
-
bench update --no-backup
|
|
111
|
-
|
|
112
|
-
# Update specific apps
|
|
113
|
-
bench update --apps frappe,erpnext
|
|
114
|
-
|
|
115
|
-
# Update without migrations
|
|
116
|
-
bench update --no-migrations
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Safety checks:**
|
|
120
|
-
- Warn about production sites
|
|
121
|
-
- Suggest backup first
|
|
122
|
-
- Check for uncommitted changes
|
|
123
|
-
|
|
124
|
-
#### Backup
|
|
125
|
-
```bash
|
|
126
|
-
# Basic backup
|
|
127
|
-
bench --site <sitename> backup
|
|
128
|
-
|
|
129
|
-
# With files
|
|
130
|
-
bench --site <sitename> backup --with-files
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Output location: `sites/<sitename>/private/backups/`
|
|
134
|
-
|
|
135
|
-
#### Restore
|
|
136
|
-
```bash
|
|
137
|
-
bench --site <sitename> restore <path_to_backup.sql.gz>
|
|
138
|
-
|
|
139
|
-
# With files
|
|
140
|
-
bench --site <sitename> restore <backup.sql.gz> \
|
|
141
|
-
--with-private-files <private.tar> \
|
|
142
|
-
--with-public-files <public.tar>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**Safety checks:**
|
|
146
|
-
- Confirm before restore
|
|
147
|
-
- Warn about data loss
|
|
148
|
-
|
|
149
|
-
#### Other Common Commands
|
|
150
|
-
|
|
151
|
-
```bash
|
|
152
|
-
# Set admin password
|
|
153
|
-
bench --site <sitename> set-admin-password <newpassword>
|
|
154
|
-
|
|
155
|
-
# Add system manager
|
|
156
|
-
bench --site <sitename> add-system-manager <email>
|
|
157
|
-
|
|
158
|
-
# Enable/disable scheduler
|
|
159
|
-
bench --site <sitename> enable-scheduler
|
|
160
|
-
bench --site <sitename> disable-scheduler
|
|
161
|
-
|
|
162
|
-
# Show pending jobs
|
|
163
|
-
bench --site <sitename> show-pending-jobs
|
|
164
|
-
|
|
165
|
-
# Doctor - check site health
|
|
166
|
-
bench --site <sitename> doctor
|
|
167
|
-
|
|
168
|
-
# MariaDB console
|
|
169
|
-
bench --site <sitename> mariadb
|
|
170
|
-
|
|
171
|
-
# Export fixtures
|
|
172
|
-
bench --site <sitename> export-fixtures
|
|
173
|
-
|
|
174
|
-
# Run tests
|
|
175
|
-
bench --site <sitename> run-tests --app <app_name>
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## Safety Guidelines
|
|
179
|
-
|
|
180
|
-
### Destructive Commands (Require Confirmation)
|
|
181
|
-
- `drop-site` - Deletes entire site
|
|
182
|
-
- `reinstall` - Drops and recreates database
|
|
183
|
-
- `restore` - Overwrites current data
|
|
184
|
-
- `reset` - Resets to fresh install
|
|
185
|
-
|
|
186
|
-
### Production Warnings
|
|
187
|
-
Before running on production:
|
|
188
|
-
1. Confirm site is in maintenance mode
|
|
189
|
-
2. Ensure backup exists
|
|
190
|
-
3. Check for active users
|
|
191
|
-
|
|
192
|
-
### Command Validation
|
|
193
|
-
|
|
194
|
-
For any command, check:
|
|
195
|
-
1. Is the site name valid?
|
|
196
|
-
2. Is the command recognized by bench?
|
|
197
|
-
3. Are there any pending migrations?
|
|
198
|
-
|
|
199
|
-
## Error Handling
|
|
200
|
-
|
|
201
|
-
Common issues:
|
|
202
|
-
|
|
203
|
-
### "Site not found"
|
|
204
|
-
```bash
|
|
205
|
-
# Check available sites
|
|
206
|
-
ls sites/
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
### "Module not found"
|
|
210
|
-
```bash
|
|
211
|
-
# Rebuild environment
|
|
212
|
-
bench setup env
|
|
213
|
-
pip install -e apps/frappe -e apps/erpnext
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### "Migration failed"
|
|
217
|
-
```bash
|
|
218
|
-
# Check error logs
|
|
219
|
-
tail -100 logs/frappe.log
|
|
220
|
-
|
|
221
|
-
# Skip failing patches
|
|
222
|
-
bench --site <sitename> migrate --skip-failing
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
### "Build failed"
|
|
226
|
-
```bash
|
|
227
|
-
# Clear node modules and rebuild
|
|
228
|
-
rm -rf node_modules
|
|
229
|
-
yarn install
|
|
230
|
-
bench build
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Output
|
|
234
|
-
|
|
235
|
-
After command execution:
|
|
236
|
-
1. Show command output
|
|
237
|
-
2. Report success/failure
|
|
238
|
-
3. Suggest next steps if applicable
|
|
239
|
-
4. Warn about any issues detected
|
|
240
|
-
|
|
241
|
-
## Quick Reference
|
|
242
|
-
|
|
243
|
-
| Task | Command |
|
|
244
|
-
|------|---------|
|
|
245
|
-
| Start dev server | `bench start` |
|
|
246
|
-
| Migrate database | `bench --site <site> migrate` |
|
|
247
|
-
| Clear cache | `bench --site <site> clear-cache` |
|
|
248
|
-
| Build assets | `bench build` |
|
|
249
|
-
| Backup site | `bench --site <site> backup` |
|
|
250
|
-
| View logs | `tail -f logs/frappe.log` |
|
|
251
|
-
| Python console | `bench --site <site> console` |
|
|
252
|
-
| MySQL console | `bench --site <site> mariadb` |
|
|
253
|
-
| Run tests | `bench --site <site> run-tests` |
|
|
254
|
-
| Check health | `bench --site <site> doctor` |
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Invoke the Frappe debugger agent for troubleshooting errors, analyzing logs, debugging permissions, and investigating performance issues
|
|
3
|
-
allowed-tools: Bash, Read, Grep, Glob, Task
|
|
4
|
-
argument-hint: <error_or_issue_description>
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Frappe Debug & Troubleshoot
|
|
8
|
-
|
|
9
|
-
You are invoking the specialized Frappe debugger agent for investigating and resolving issues.
|
|
10
|
-
|
|
11
|
-
## Request
|
|
12
|
-
|
|
13
|
-
$ARGUMENTS
|
|
14
|
-
|
|
15
|
-
## Agent Invocation
|
|
16
|
-
|
|
17
|
-
Use the Task tool to spawn the `frappe-fullstack:frappe-debugger` agent with the following configuration:
|
|
18
|
-
|
|
19
|
-
**IMPORTANT:** The agent name MUST be fully qualified: `frappe-fullstack:frappe-debugger`
|
|
20
|
-
|
|
21
|
-
### Agent Prompt Template
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
You are debugging a Frappe/ERPNext issue.
|
|
25
|
-
|
|
26
|
-
## Issue
|
|
27
|
-
{user's error or issue description}
|
|
28
|
-
|
|
29
|
-
## Context
|
|
30
|
-
- Working directory: {current directory}
|
|
31
|
-
- Check logs, database, permissions, cache
|
|
32
|
-
|
|
33
|
-
## Your Responsibilities
|
|
34
|
-
|
|
35
|
-
1. **Gather Information**
|
|
36
|
-
- Check error logs
|
|
37
|
-
- Identify the error type
|
|
38
|
-
- Find relevant stack traces
|
|
39
|
-
- Check recent changes
|
|
40
|
-
|
|
41
|
-
2. **Analyze the Problem**
|
|
42
|
-
- Determine root cause
|
|
43
|
-
- Check for common issues
|
|
44
|
-
- Verify configuration
|
|
45
|
-
- Test hypotheses
|
|
46
|
-
|
|
47
|
-
3. **Provide Solution**
|
|
48
|
-
- Step-by-step fix
|
|
49
|
-
- Commands to run
|
|
50
|
-
- Code changes if needed
|
|
51
|
-
- Prevention tips
|
|
52
|
-
|
|
53
|
-
## Output Requirements
|
|
54
|
-
- Clear diagnosis of the issue
|
|
55
|
-
- Root cause explanation
|
|
56
|
-
- Solution steps
|
|
57
|
-
- Verification commands
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Capabilities
|
|
61
|
-
|
|
62
|
-
The frappe-debugger agent excels at:
|
|
63
|
-
|
|
64
|
-
### Log Analysis
|
|
65
|
-
```bash
|
|
66
|
-
# Check error logs
|
|
67
|
-
tail -100 logs/frappe.log | grep -i error
|
|
68
|
-
|
|
69
|
-
# Check web errors
|
|
70
|
-
tail -50 logs/web.error.log
|
|
71
|
-
|
|
72
|
-
# Check worker errors
|
|
73
|
-
tail -50 logs/worker.error.log
|
|
74
|
-
|
|
75
|
-
# Site-specific logs
|
|
76
|
-
tail -100 sites/<site>/logs/frappe.log
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Error Types
|
|
80
|
-
|
|
81
|
-
| Error | Common Causes |
|
|
82
|
-
|-------|---------------|
|
|
83
|
-
| `ValidationError` | Failed validation in controller |
|
|
84
|
-
| `PermissionError` | Missing role or user permission |
|
|
85
|
-
| `LinkValidationError` | Referenced document doesn't exist |
|
|
86
|
-
| `MandatoryError` | Required field is empty |
|
|
87
|
-
| `DuplicateEntryError` | Unique constraint violation |
|
|
88
|
-
| `TimestampMismatchError` | Concurrent edit conflict |
|
|
89
|
-
|
|
90
|
-
### Permission Debugging
|
|
91
|
-
```python
|
|
92
|
-
# In bench console
|
|
93
|
-
frappe.session.user
|
|
94
|
-
frappe.get_roles()
|
|
95
|
-
frappe.has_permission("DocType", "write", "doc_name")
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Database Issues
|
|
99
|
-
```sql
|
|
100
|
-
-- Check for orphaned records
|
|
101
|
-
SELECT * FROM `tabChild`
|
|
102
|
-
WHERE parent NOT IN (SELECT name FROM `tabParent`);
|
|
103
|
-
|
|
104
|
-
-- Check table sizes
|
|
105
|
-
SELECT table_name, ROUND(data_length/1024/1024, 2) as MB
|
|
106
|
-
FROM information_schema.tables
|
|
107
|
-
WHERE table_schema = DATABASE()
|
|
108
|
-
ORDER BY data_length DESC;
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Cache Issues
|
|
112
|
-
```bash
|
|
113
|
-
# Clear all cache
|
|
114
|
-
bench --site <site> clear-cache
|
|
115
|
-
|
|
116
|
-
# Clear Redis
|
|
117
|
-
redis-cli FLUSHALL
|
|
118
|
-
|
|
119
|
-
# Clear specific
|
|
120
|
-
frappe.cache().delete_value("key")
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### Background Job Issues
|
|
124
|
-
```bash
|
|
125
|
-
# Check pending jobs
|
|
126
|
-
bench --site <site> show-pending-jobs
|
|
127
|
-
|
|
128
|
-
# Check scheduler
|
|
129
|
-
bench --site <site> show-scheduler-status
|
|
130
|
-
|
|
131
|
-
# View failed jobs
|
|
132
|
-
bench --site <site> console
|
|
133
|
-
>>> from rq import Queue
|
|
134
|
-
>>> from frappe.utils.background_jobs import get_redis_conn
|
|
135
|
-
>>> q = Queue("failed", connection=get_redis_conn())
|
|
136
|
-
>>> for job in q.jobs: print(job.exc_info)
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Common Issues & Solutions
|
|
140
|
-
|
|
141
|
-
### 1. "Document not found"
|
|
142
|
-
```bash
|
|
143
|
-
# Check if document exists
|
|
144
|
-
bench --site <site> console
|
|
145
|
-
>>> frappe.db.exists("DocType", "name")
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 2. "Permission denied"
|
|
149
|
-
```bash
|
|
150
|
-
# Check user roles and permissions
|
|
151
|
-
bench --site <site> console
|
|
152
|
-
>>> frappe.get_roles("user@email.com")
|
|
153
|
-
>>> frappe.get_all("DocPerm", filters={"parent": "DocType"})
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### 3. "Module not found"
|
|
157
|
-
```bash
|
|
158
|
-
# Reinstall apps
|
|
159
|
-
pip install -e apps/frappe
|
|
160
|
-
pip install -e apps/my_app
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### 4. "Migration failed"
|
|
164
|
-
```bash
|
|
165
|
-
# Check what's failing
|
|
166
|
-
bench --site <site> migrate --skip-failing
|
|
167
|
-
|
|
168
|
-
# Check patches
|
|
169
|
-
cat apps/my_app/my_app/patches.txt
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### 5. "Assets not loading"
|
|
173
|
-
```bash
|
|
174
|
-
# Rebuild assets
|
|
175
|
-
bench build --force
|
|
176
|
-
|
|
177
|
-
# Check for JS errors in browser console
|
|
178
|
-
# Hard refresh: Ctrl+Shift+R
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### 6. "Slow performance"
|
|
182
|
-
```bash
|
|
183
|
-
# Enable slow query log
|
|
184
|
-
# In site_config.json: "log_slow_queries": 1
|
|
185
|
-
|
|
186
|
-
# Check slow queries
|
|
187
|
-
grep "slow_query" logs/frappe.log
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### 7. "Background job stuck"
|
|
191
|
-
```bash
|
|
192
|
-
# Check workers
|
|
193
|
-
ps aux | grep worker
|
|
194
|
-
|
|
195
|
-
# Restart workers
|
|
196
|
-
sudo supervisorctl restart frappe-bench-workers:*
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### 8. "Redis connection refused"
|
|
200
|
-
```bash
|
|
201
|
-
# Check Redis
|
|
202
|
-
redis-cli ping
|
|
203
|
-
|
|
204
|
-
# Restart Redis
|
|
205
|
-
sudo systemctl restart redis
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
## Diagnostic Commands
|
|
209
|
-
|
|
210
|
-
```bash
|
|
211
|
-
# Site health check
|
|
212
|
-
bench --site <site> doctor
|
|
213
|
-
|
|
214
|
-
# Show database size
|
|
215
|
-
bench --site <site> mariadb -e "
|
|
216
|
-
SELECT table_name,
|
|
217
|
-
ROUND(data_length/1024/1024, 2) as data_mb
|
|
218
|
-
FROM information_schema.tables
|
|
219
|
-
WHERE table_schema = DATABASE()
|
|
220
|
-
ORDER BY data_length DESC
|
|
221
|
-
LIMIT 10"
|
|
222
|
-
|
|
223
|
-
# Check scheduler status
|
|
224
|
-
bench --site <site> show-scheduler-status
|
|
225
|
-
|
|
226
|
-
# List installed apps
|
|
227
|
-
bench --site <site> list-apps
|
|
228
|
-
|
|
229
|
-
# Check versions
|
|
230
|
-
bench version
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Debug Checklist
|
|
234
|
-
|
|
235
|
-
1. [ ] Check logs: `tail -100 logs/frappe.log`
|
|
236
|
-
2. [ ] Identify error type from traceback
|
|
237
|
-
3. [ ] Check permissions if PermissionError
|
|
238
|
-
4. [ ] Check document exists if LinkValidationError
|
|
239
|
-
5. [ ] Clear cache: `bench --site <site> clear-cache`
|
|
240
|
-
6. [ ] Check Redis is running
|
|
241
|
-
7. [ ] Check background workers if job-related
|
|
242
|
-
8. [ ] Verify recent code changes with git log
|
|
243
|
-
9. [ ] Test in bench console
|
|
244
|
-
10. [ ] Check browser console for JS errors
|
|
245
|
-
|
|
246
|
-
## Tools Available to Agent
|
|
247
|
-
|
|
248
|
-
- **Bash**: Run diagnostic commands, check logs
|
|
249
|
-
- **Read**: Read log files, config files
|
|
250
|
-
- **Grep**: Search logs and code for errors
|
|
251
|
-
- **Glob**: Find relevant files
|
|
252
|
-
|
|
253
|
-
**Note**: Debug agent has read-only focus to investigate without making changes. Solutions are provided for user to implement.
|
|
254
|
-
|
|
255
|
-
## Output Format
|
|
256
|
-
|
|
257
|
-
The debugger will provide:
|
|
258
|
-
|
|
259
|
-
1. **Diagnosis**: What's wrong and why
|
|
260
|
-
2. **Root Cause**: The underlying issue
|
|
261
|
-
3. **Solution**: Step-by-step fix
|
|
262
|
-
4. **Verification**: How to confirm it's fixed
|
|
263
|
-
5. **Prevention**: How to avoid in future
|