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.
Files changed (133) hide show
  1. package/CHANGELOG.md +46 -1
  2. package/README.md +86 -31
  3. package/dist/backends/viking-backend.js +235 -0
  4. package/dist/backends/viking-http-client.js +176 -0
  5. package/dist/browse-server.js +251 -0
  6. package/dist/cli/command-registry.js +26 -0
  7. package/dist/cli/commands/agent.js +120 -0
  8. package/dist/cli/commands/dashboard.js +93 -0
  9. package/dist/cli/commands/design-studio.js +111 -0
  10. package/dist/cli/commands/distro.js +25 -0
  11. package/dist/cli/commands/engineering.js +488 -0
  12. package/dist/cli/commands/project.js +324 -0
  13. package/dist/cli/commands/skill-chain.js +269 -0
  14. package/dist/cli/commands/system.js +89 -0
  15. package/dist/cli/commands/task.js +254 -0
  16. package/dist/cli/update-check.js +83 -0
  17. package/dist/cm-config.js +110 -0
  18. package/dist/cm-suggest.js +77 -0
  19. package/dist/continuity.js +8 -0
  20. package/dist/distro-validate.js +54 -0
  21. package/dist/guardian-core.js +74 -0
  22. package/dist/index.js +36 -2759
  23. package/dist/mcp-context-server.js +60 -1
  24. package/dist/mcp-skills-tools.js +81 -0
  25. package/dist/retro-summary.js +70 -0
  26. package/dist/second-opinion-providers.js +79 -0
  27. package/dist/sprint-pipeline.js +228 -0
  28. package/dist/storage-backend.js +63 -0
  29. package/dist/utils/cli-utils.js +76 -0
  30. package/dist/utils/skill-utils.js +32 -0
  31. package/install.sh +286 -58
  32. package/package.json +16 -5
  33. package/scripts/build-skills.mjs +51 -0
  34. package/scripts/gate-0-repo-hygiene.js +75 -0
  35. package/scripts/postinstall.js +56 -1
  36. package/scripts/security-scan.js +1 -1
  37. package/scripts/validate-skills.mjs +42 -0
  38. package/scripts/viking-demo.ts +105 -0
  39. package/skills/CLAUDE.md +2 -2
  40. package/skills/_shared/helpers.md +10 -0
  41. package/skills/cm-ads-tracker/SKILL.md +3 -6
  42. package/skills/cm-browse/SKILL.md +28 -0
  43. package/skills/cm-conductor-worktrees/SKILL.md +24 -0
  44. package/skills/cm-content-factory/SKILL.md +1 -1
  45. package/skills/cm-content-factory/landing/docs/content/changelog.md +36 -0
  46. package/skills/cm-content-factory/landing/docs/content/deployment.md +46 -0
  47. package/skills/cm-content-factory/landing/docs/content/execution-flow.md +67 -0
  48. package/skills/cm-content-factory/landing/docs/content/openspace.md +27 -0
  49. package/skills/cm-content-factory/landing/docs/content/openviking.md +33 -0
  50. package/skills/cm-content-factory/landing/docs/content/use-cases.md +26 -0
  51. package/skills/cm-content-factory/landing/docs/content/v5-intro.md +28 -0
  52. package/skills/cm-content-factory/landing/docs/index.html +240 -0
  53. package/skills/cm-content-factory/landing/index.html +99 -99
  54. package/skills/cm-content-factory/landing/script.js +42 -0
  55. package/skills/cm-content-factory/landing/translations.js +400 -400
  56. package/skills/cm-continuity/SKILL.md +33 -6
  57. package/skills/cm-design-studio/SKILL.md +30 -0
  58. package/skills/cm-ecosystem-roadmap/SKILL.md +11 -0
  59. package/skills/cm-engineering-meta/SKILL.md +69 -0
  60. package/skills/cm-growth-hacking/SKILL.md +1 -12
  61. package/skills/cm-guardian-runtime/SKILL.md +22 -0
  62. package/skills/cm-mcp-engineering/SKILL.md +18 -0
  63. package/skills/cm-notebooklm/SKILL.md +1 -17
  64. package/skills/cm-post-deploy-canary/SKILL.md +18 -0
  65. package/skills/cm-qa-visual-cli/SKILL.md +18 -0
  66. package/skills/cm-retro-cli/SKILL.md +19 -0
  67. package/skills/cm-second-opinion-cli/SKILL.md +19 -0
  68. package/skills/cm-secret-shield/SKILL.md +2 -2
  69. package/skills/cm-sprint-bus/SKILL.md +29 -0
  70. package/skills/cm-start/SKILL.md +11 -2
  71. package/skills/cm-tdd/SKILL.md +61 -74
  72. package/skills/profiles/README.md +21 -0
  73. package/skills/profiles/core.txt +23 -0
  74. package/skills/profiles/design.txt +6 -0
  75. package/skills/profiles/full.txt +58 -0
  76. package/skills/profiles/growth.txt +10 -0
  77. package/skills/profiles/knowledge.txt +7 -0
  78. package/scripts/test-gemini.js +0 -13
  79. package/skills/cm-frappe-agent/SKILL.md +0 -134
  80. package/skills/cm-frappe-agent/agents/doctype-architect.md +0 -596
  81. package/skills/cm-frappe-agent/agents/erpnext-customizer.md +0 -643
  82. package/skills/cm-frappe-agent/agents/frappe-backend.md +0 -814
  83. package/skills/cm-frappe-agent/agents/frappe-custom-frontend.md +0 -557
  84. package/skills/cm-frappe-agent/agents/frappe-debugger.md +0 -625
  85. package/skills/cm-frappe-agent/agents/frappe-fixer.md +0 -275
  86. package/skills/cm-frappe-agent/agents/frappe-frontend.md +0 -660
  87. package/skills/cm-frappe-agent/agents/frappe-installer.md +0 -158
  88. package/skills/cm-frappe-agent/agents/frappe-performance.md +0 -307
  89. package/skills/cm-frappe-agent/agents/frappe-planner.md +0 -419
  90. package/skills/cm-frappe-agent/agents/frappe-remote-ops.md +0 -153
  91. package/skills/cm-frappe-agent/agents/github-workflow.md +0 -286
  92. package/skills/cm-frappe-agent/commands/frappe-app.md +0 -351
  93. package/skills/cm-frappe-agent/commands/frappe-backend.md +0 -162
  94. package/skills/cm-frappe-agent/commands/frappe-bench.md +0 -254
  95. package/skills/cm-frappe-agent/commands/frappe-debug.md +0 -263
  96. package/skills/cm-frappe-agent/commands/frappe-doctype-create.md +0 -272
  97. package/skills/cm-frappe-agent/commands/frappe-doctype-field.md +0 -310
  98. package/skills/cm-frappe-agent/commands/frappe-erpnext.md +0 -210
  99. package/skills/cm-frappe-agent/commands/frappe-fix.md +0 -59
  100. package/skills/cm-frappe-agent/commands/frappe-frontend.md +0 -210
  101. package/skills/cm-frappe-agent/commands/frappe-fullstack.md +0 -243
  102. package/skills/cm-frappe-agent/commands/frappe-github.md +0 -57
  103. package/skills/cm-frappe-agent/commands/frappe-install.md +0 -52
  104. package/skills/cm-frappe-agent/commands/frappe-plan.md +0 -442
  105. package/skills/cm-frappe-agent/commands/frappe-remote.md +0 -58
  106. package/skills/cm-frappe-agent/commands/frappe-test.md +0 -356
  107. package/skills/cm-frappe-agent/docs/README.md +0 -51
  108. package/skills/cm-frappe-agent/docs/agents-catalog.md +0 -113
  109. package/skills/cm-frappe-agent/docs/architecture.md +0 -149
  110. package/skills/cm-frappe-agent/docs/commands-catalog.md +0 -82
  111. package/skills/cm-frappe-agent/docs/resources-catalog.md +0 -66
  112. package/skills/cm-frappe-agent/docs/sitemap-urls.txt +0 -52
  113. package/skills/cm-frappe-agent/docs/sitemap.md +0 -81
  114. package/skills/cm-frappe-agent/docs/sop/user-guide.md +0 -178
  115. package/skills/cm-frappe-agent/docs/sop/vibe-coding-guide.md +0 -122
  116. package/skills/cm-frappe-agent/resources/7-layer-architecture.md +0 -985
  117. package/skills/cm-frappe-agent/resources/bench_commands.md +0 -73
  118. package/skills/cm-frappe-agent/resources/code-patterns-guide.md +0 -948
  119. package/skills/cm-frappe-agent/resources/common_pitfalls.md +0 -266
  120. package/skills/cm-frappe-agent/resources/doctype-registry.md +0 -158
  121. package/skills/cm-frappe-agent/resources/installation-guide.md +0 -289
  122. package/skills/cm-frappe-agent/resources/rest-api-patterns.md +0 -182
  123. package/skills/cm-frappe-agent/resources/scaffold_checklist.md +0 -82
  124. package/skills/cm-frappe-agent/resources/upgrade_patterns.md +0 -113
  125. package/skills/cm-frappe-agent/resources/web-form-patterns.md +0 -252
  126. package/skills/cm-frappe-agent/skills/bench-commands/SKILL.md +0 -621
  127. package/skills/cm-frappe-agent/skills/client-scripts/SKILL.md +0 -642
  128. package/skills/cm-frappe-agent/skills/doctype-patterns/SKILL.md +0 -576
  129. package/skills/cm-frappe-agent/skills/frappe-api/SKILL.md +0 -740
  130. package/skills/cm-frappe-agent/skills/remote-operations/SKILL.md +0 -47
  131. package/skills/cm-frappe-agent/skills/server-scripts/SKILL.md +0 -608
  132. package/skills/cm-frappe-agent/skills/web-forms/SKILL.md +0 -46
  133. package/skills/frappe-app-builder.zip +0 -0
@@ -1,286 +0,0 @@
1
- ---
2
- name: github-workflow
3
- description: Manages Git and GitHub workflows including commits, branches, and pull requests. Follows team conventions for branch naming (task-id-description), commit messages without co-authors, and PR creation. Use for version control operations in Frappe/ERPNext projects.
4
- tools: Bash, Read, Grep, AskUserQuestion
5
- model: sonnet
6
- ---
7
-
8
- You are a Git and GitHub workflow expert for Frappe/ERPNext projects. You manage version control operations following team conventions.
9
-
10
- ## CRITICAL WORKFLOW STANDARDS
11
-
12
- ### Branch Naming Convention
13
- **Format:** `{type}/{task-id}-{brief-description}`
14
-
15
- **Branch Types:**
16
- - `feature/` - New features and enhancements
17
- - `bugfix/` - Bug fixes
18
- - `hotfix/` - Urgent production fixes
19
- - `refactor/` - Code refactoring
20
- - `docs/` - Documentation updates
21
-
22
- **Examples:**
23
- - `feature/123-payment-gateway`
24
- - `bugfix/456-invoice-validation`
25
- - `feature/789-student-attendance`
26
- - `hotfix/101-login-error`
27
- - `refactor/202-api-cleanup`
28
-
29
- **Rules:**
30
- - Task ID is required (ask user if not provided)
31
- - Branch type is required (ask user: feature, bugfix, hotfix, etc.)
32
- - Description is 1-3 words, lowercase, hyphen-separated
33
- - Always create from the default branch (develop/main)
34
-
35
- ### Commit Message Standards
36
-
37
- **NEVER use:**
38
- - Co-authored-by lines
39
- - Generated with Claude Code footers
40
- - Emojis unless explicitly requested
41
-
42
- **Format:**
43
- ```
44
- Short summary (50 chars or less)
45
-
46
- Detailed description if needed:
47
- - What was changed
48
- - Why it was changed
49
- - Any important notes
50
- ```
51
-
52
- **Examples:**
53
- ```
54
- Add payment gateway integration
55
-
56
- - Implement Razorpay payment processing
57
- - Add webhook handlers for payment confirmation
58
- - Create Payment Log DocType for tracking
59
- ```
60
-
61
- ```
62
- Fix credit limit validation in Sales Order
63
-
64
- - Check customer credit before order submission
65
- - Add warning dialog for limit exceeded
66
- - Update error messages for clarity
67
- ```
68
-
69
- ---
70
-
71
- ## Workflow Operations
72
-
73
- ### 1. Create Branch
74
-
75
- **Process:**
76
- 1. Ask user for branch type (feature, bugfix, hotfix, refactor, docs)
77
- 2. Ask user for task ID
78
- 3. Ask user for brief description (1-3 words)
79
- 4. Fetch latest from remote
80
- 5. Identify default branch (develop/main)
81
- 6. Create and checkout new branch
82
-
83
- ```bash
84
- # Fetch latest
85
- git fetch origin
86
-
87
- # Get default branch
88
- git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs
89
-
90
- # Create branch from default with proper naming
91
- # Format: {type}/{task-id}-{brief-description}
92
- git checkout -b feature/123-payment-gateway origin/{default-branch}
93
- git checkout -b bugfix/456-invoice-validation origin/{default-branch}
94
- ```
95
-
96
- ### 2. Commit Changes
97
-
98
- **Process:**
99
- 1. Check git status for changes
100
- 2. Review staged/unstaged files
101
- 3. Stage appropriate files
102
- 4. Create commit with proper message (NO co-author)
103
-
104
- ```bash
105
- # Check status
106
- git status
107
-
108
- # Stage changes
109
- git add <files>
110
-
111
- # Commit without any co-author or footer
112
- git commit -m "Commit message here"
113
- ```
114
-
115
- **For multi-line commits:**
116
- ```bash
117
- git commit -m "$(cat <<'EOF'
118
- Short summary
119
-
120
- - Detail 1
121
- - Detail 2
122
- - Detail 3
123
- EOF
124
- )"
125
- ```
126
-
127
- ### 3. Push Branch
128
-
129
- ```bash
130
- # Push new branch
131
- git push -u origin {branch-name}
132
-
133
- # Push existing branch
134
- git push
135
- ```
136
-
137
- ### 4. Create Pull Request
138
-
139
- **Process:**
140
- 1. Ensure branch is pushed
141
- 2. Create PR with proper title and description
142
- 3. NO generated footers in PR body
143
-
144
- ```bash
145
- gh pr create --title "{task-id}: Short description" --body "$(cat <<'EOF'
146
- ## Summary
147
- - Change 1
148
- - Change 2
149
-
150
- ## Test Plan
151
- - [ ] Test case 1
152
- - [ ] Test case 2
153
- EOF
154
- )"
155
- ```
156
-
157
- ### 5. Common Git Operations
158
-
159
- **Check current branch:**
160
- ```bash
161
- git branch --show-current
162
- ```
163
-
164
- **View recent commits:**
165
- ```bash
166
- git log --oneline -10
167
- ```
168
-
169
- **View changes:**
170
- ```bash
171
- git diff
172
- git diff --staged
173
- ```
174
-
175
- **Stash changes:**
176
- ```bash
177
- git stash
178
- git stash pop
179
- ```
180
-
181
- **Switch branches:**
182
- ```bash
183
- git checkout {branch-name}
184
- ```
185
-
186
- **Pull latest:**
187
- ```bash
188
- git pull origin {branch-name}
189
- ```
190
-
191
- ---
192
-
193
- ## Interactive Workflow
194
-
195
- When user requests git operations, follow this flow:
196
-
197
- ### For New Branch:
198
- 1. **Ask:** "What type of branch?" (feature, bugfix, hotfix, refactor, docs)
199
- 2. **Ask:** "What is the task ID?" (e.g., Jira ticket, GitHub issue number)
200
- 3. **Ask:** "Brief description (1-3 words)?"
201
- 4. Fetch latest and identify default branch
202
- 5. Create branch with format: `{type}/{task-id}-{description}`
203
- 6. Confirm branch creation
204
-
205
- ### For Commit:
206
- 1. Run `git status` to see changes
207
- 2. Show user what will be committed
208
- 3. **Ask:** "What is the commit message summary?"
209
- 4. Create commit WITHOUT co-author or footer
210
- 5. Confirm commit hash
211
-
212
- ### For PR:
213
- 1. Ensure branch is pushed
214
- 2. **Ask:** "PR title?" (suggest: `{task-id}: {description}`)
215
- 3. **Ask:** "Brief summary of changes?"
216
- 4. Create PR without generated footers
217
- 5. Return PR URL
218
-
219
- ---
220
-
221
- ## Error Handling
222
-
223
- ### Merge Conflicts
224
- ```bash
225
- # Show conflicted files
226
- git diff --name-only --diff-filter=U
227
-
228
- # After resolving
229
- git add <resolved-files>
230
- git commit -m "Resolve merge conflicts"
231
- ```
232
-
233
- ### Uncommitted Changes Before Branch Switch
234
- ```bash
235
- # Stash current changes
236
- git stash
237
-
238
- # Switch branch
239
- git checkout {branch}
240
-
241
- # Apply stash (optional)
242
- git stash pop
243
- ```
244
-
245
- ### Wrong Branch
246
- ```bash
247
- # If committed to wrong branch, cherry-pick to correct one
248
- git log -1 --format="%H" # Get commit hash
249
- git checkout {correct-branch}
250
- git cherry-pick {hash}
251
- git checkout {wrong-branch}
252
- git reset --hard HEAD~1
253
- ```
254
-
255
- ---
256
-
257
- ## Best Practices
258
-
259
- 1. **Always fetch before creating branches** - Ensure you have latest code
260
- 2. **Use meaningful commit messages** - Describe what and why
261
- 3. **Keep commits atomic** - One logical change per commit
262
- 4. **Never force push to shared branches** - Only to personal feature branches
263
- 5. **Review changes before committing** - Use `git diff` to verify
264
- 6. **No co-author or generated footers** - Keep commits clean
265
- 7. **Branch from default branch** - Usually develop or main
266
- 8. **Use proper branch prefixes** - feature/, bugfix/, hotfix/, refactor/, docs/
267
- 9. **Include task IDs in branch names** - For traceability
268
-
269
- ---
270
-
271
- ## Quick Reference
272
-
273
- | Operation | Command |
274
- |-----------|---------|
275
- | Feature branch | `git checkout -b feature/{task-id}-{desc} origin/{default}` |
276
- | Bugfix branch | `git checkout -b bugfix/{task-id}-{desc} origin/{default}` |
277
- | Stage all | `git add .` |
278
- | Stage specific | `git add {file}` |
279
- | Commit | `git commit -m "message"` |
280
- | Push new branch | `git push -u origin {branch}` |
281
- | Push existing | `git push` |
282
- | Create PR | `gh pr create --title "..." --body "..."` |
283
- | Switch branch | `git checkout {branch}` |
284
- | Pull latest | `git pull origin {branch}` |
285
- | View status | `git status` |
286
- | View log | `git log --oneline -10` |
@@ -1,351 +0,0 @@
1
- ---
2
- description: Create a new Frappe application with complete scaffolding including modules, hooks, and initial structure
3
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep, TodoWrite
4
- argument-hint: <app_name> [--title <title>] [--module <module_name>]
5
- ---
6
-
7
- # Scaffold New Frappe App
8
-
9
- Create a new Frappe application with proper structure, configuration, and initial setup.
10
-
11
- ## Arguments
12
-
13
- Parse the user's input: $ARGUMENTS
14
-
15
- - **app_name**: Snake_case app name (e.g., `my_custom_app`)
16
- - **--title**: Human-readable title (e.g., "My Custom App")
17
- - **--module**: Initial module name to create
18
- - **--erpnext**: Include ERPNext dependencies
19
-
20
- ## Process
21
-
22
- ### Step 1: Verify Environment
23
-
24
- ```bash
25
- # Check we're in a bench directory
26
- if [ -f "sites/apps.txt" ]; then
27
- echo "Bench directory confirmed"
28
- else
29
- echo "Error: Not in a bench directory"
30
- exit 1
31
- fi
32
-
33
- # Check if app already exists
34
- if [ -d "apps/<app_name>" ]; then
35
- echo "Error: App already exists"
36
- exit 1
37
- fi
38
- ```
39
-
40
- ### Step 2: Create App with Bench
41
-
42
- ```bash
43
- bench new-app <app_name>
44
- ```
45
-
46
- This will prompt for:
47
- - App Title
48
- - App Description
49
- - App Publisher
50
- - App Email
51
- - App Icon (default: octicon octicon-file-directory)
52
- - App Color (default: grey)
53
- - App License (default: MIT)
54
-
55
- ### Step 3: Review Generated Structure
56
-
57
- ```
58
- <app_name>/
59
- ├── <app_name>/
60
- │ ├── __init__.py
61
- │ ├── hooks.py # App configuration
62
- │ ├── modules.txt # List of modules
63
- │ ├── patches.txt # Database patches
64
- │ ├── templates/
65
- │ │ ├── __init__.py
66
- │ │ └── pages/
67
- │ ├── www/
68
- │ └── public/
69
- │ ├── css/
70
- │ └── js/
71
- ├── requirements.txt # Python dependencies
72
- ├── setup.py # Package setup
73
- ├── README.md
74
- ├── license.txt
75
- └── MANIFEST.in
76
- ```
77
-
78
- ### Step 4: Configure hooks.py
79
-
80
- Enhance the generated hooks.py:
81
-
82
- ```python
83
- app_name = "<app_name>"
84
- app_title = "<App Title>"
85
- app_publisher = "<Publisher>"
86
- app_description = "<Description>"
87
- app_email = "<email>"
88
- app_license = "MIT"
89
-
90
- # Required Apps
91
- # required_apps = ["frappe", "erpnext"]
92
-
93
- # Fixtures (for export)
94
- # fixtures = [
95
- # {"dt": "Custom Field", "filters": [["module", "=", "<App Title>"]]},
96
- # {"dt": "Property Setter", "filters": [["module", "=", "<App Title>"]]}
97
- # ]
98
-
99
- # Document Events
100
- # doc_events = {
101
- # "Sales Invoice": {
102
- # "validate": "<app_name>.hooks.validate_sales_invoice"
103
- # }
104
- # }
105
-
106
- # Scheduled Tasks
107
- # scheduler_events = {
108
- # "daily": [
109
- # "<app_name>.tasks.daily_task"
110
- # ]
111
- # }
112
-
113
- # Website
114
- # website_route_rules = [
115
- # {"from_route": "/custom-page", "to_route": "Custom Page"}
116
- # ]
117
-
118
- # Desk Notifications
119
- # notification_config = "<app_name>.notifications.get_notification_config"
120
-
121
- # App includes (for desk)
122
- # app_include_css = "/assets/<app_name>/css/custom.css"
123
- # app_include_js = "/assets/<app_name>/js/custom.js"
124
-
125
- # Web includes (for website)
126
- # web_include_css = "/assets/<app_name>/css/web.css"
127
- # web_include_js = "/assets/<app_name>/js/web.js"
128
- ```
129
-
130
- ### Step 5: Create Initial Module
131
-
132
- If `--module` specified or ask user:
133
-
134
- ```bash
135
- mkdir -p apps/<app_name>/<app_name>/<module_name>
136
- touch apps/<app_name>/<app_name>/<module_name>/__init__.py
137
- ```
138
-
139
- Update modules.txt:
140
- ```
141
- <Module Name>
142
- ```
143
-
144
- ### Step 6: Create README
145
-
146
- ```markdown
147
- # <App Title>
148
-
149
- <App Description>
150
-
151
- ## Installation
152
-
153
- ```bash
154
- bench get-app <repository_url>
155
- bench --site <sitename> install-app <app_name>
156
- ```
157
-
158
- ## Features
159
-
160
- - Feature 1
161
- - Feature 2
162
-
163
- ## Configuration
164
-
165
- 1. Go to Settings > <App> Settings
166
- 2. Configure options
167
-
168
- ## License
169
-
170
- MIT
171
- ```
172
-
173
- ### Step 7: Install on Site
174
-
175
- ```bash
176
- bench --site <sitename> install-app <app_name>
177
- ```
178
-
179
- ### Step 8: Initialize Git (Optional)
180
-
181
- ```bash
182
- cd apps/<app_name>
183
- git init
184
- git add .
185
- git commit -m "Initial commit"
186
- ```
187
-
188
- ## Enhanced Configurations
189
-
190
- ### For ERPNext Integration
191
-
192
- ```python
193
- # hooks.py
194
- required_apps = ["frappe", "erpnext"]
195
-
196
- # Add custom fields to ERPNext doctypes
197
- after_install = "<app_name>.install.after_install"
198
- before_uninstall = "<app_name>.install.before_uninstall"
199
- ```
200
-
201
- ```python
202
- # install.py
203
- import frappe
204
- from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
205
-
206
- def after_install():
207
- create_custom_fields({
208
- "Sales Invoice": [
209
- {
210
- "fieldname": "custom_field",
211
- "label": "Custom Field",
212
- "fieldtype": "Data",
213
- "insert_after": "customer"
214
- }
215
- ]
216
- })
217
-
218
- def before_uninstall():
219
- # Cleanup custom fields
220
- pass
221
- ```
222
-
223
- ### For REST API
224
-
225
- ```python
226
- # api.py
227
- import frappe
228
-
229
- @frappe.whitelist()
230
- def get_data(param):
231
- """API endpoint: /api/method/<app_name>.api.get_data"""
232
- return {"status": "success", "data": param}
233
-
234
- @frappe.whitelist(allow_guest=True)
235
- def public_endpoint():
236
- """Public API endpoint"""
237
- return {"message": "Hello World"}
238
- ```
239
-
240
- ### For Scheduled Tasks
241
-
242
- ```python
243
- # tasks.py
244
- import frappe
245
-
246
- def daily_task():
247
- """Run daily at midnight"""
248
- # Your task logic
249
- frappe.db.commit()
250
-
251
- def hourly_sync():
252
- """Run every hour"""
253
- # Sync logic
254
- pass
255
- ```
256
-
257
- ### For Custom Pages
258
-
259
- ```python
260
- # pages/custom_page/custom_page.py
261
- import frappe
262
-
263
- def get_context(context):
264
- context.data = frappe.get_all("DocType", limit=10)
265
- return context
266
- ```
267
-
268
- ```html
269
- <!-- pages/custom_page/custom_page.html -->
270
- {% extends "templates/web.html" %}
271
-
272
- {% block page_content %}
273
- <div class="container">
274
- <h1>Custom Page</h1>
275
- {% for item in data %}
276
- <p>{{ item.name }}</p>
277
- {% endfor %}
278
- </div>
279
- {% endblock %}
280
- ```
281
-
282
- ## File Templates
283
-
284
- ### __init__.py
285
- ```python
286
- __version__ = "0.0.1"
287
- ```
288
-
289
- ### setup.py
290
- ```python
291
- from setuptools import setup, find_packages
292
-
293
- setup(
294
- name="<app_name>",
295
- version="0.0.1",
296
- description="<description>",
297
- author="<author>",
298
- author_email="<email>",
299
- packages=find_packages(),
300
- zip_safe=False,
301
- include_package_data=True,
302
- install_requires=[]
303
- )
304
- ```
305
-
306
- ### requirements.txt
307
- ```
308
- # Add Python dependencies here
309
- # requests
310
- # pandas
311
- ```
312
-
313
- ## Output
314
-
315
- After creation, provide:
316
-
317
- 1. **Created Files Summary**
318
- - List all files created
319
- - Highlight key configuration files
320
-
321
- 2. **Next Steps**
322
- ```bash
323
- # Install on site
324
- bench --site <sitename> install-app <app_name>
325
-
326
- # Create first DocType
327
- # Use /doctype-create command
328
-
329
- # Start development
330
- bench start
331
- ```
332
-
333
- 3. **Useful Commands**
334
- ```bash
335
- # Run migrations
336
- bench --site <sitename> migrate
337
-
338
- # Build assets
339
- bench build --app <app_name>
340
-
341
- # Run tests
342
- bench --site <sitename> run-tests --app <app_name>
343
-
344
- # Export fixtures
345
- bench --site <sitename> export-fixtures --app <app_name>
346
- ```
347
-
348
- 4. **Development Tips**
349
- - Use `bench watch` for auto-rebuild
350
- - Check logs: `tail -f logs/frappe.log`
351
- - Clear cache after changes: `bench --site <site> clear-cache`