@profoundlogic/coderflow-server 0.2.1

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 (202) hide show
  1. package/LICENSE.txt +322 -0
  2. package/README.md +158 -0
  3. package/dist/LICENSE.txt +322 -0
  4. package/dist/README.md +158 -0
  5. package/dist/base-image/Dockerfile +184 -0
  6. package/dist/base-image/agent-wrapper.sh +143 -0
  7. package/dist/base-image/apply-local-state.sh +357 -0
  8. package/dist/base-image/coder-git-credential-helper +307 -0
  9. package/dist/base-image/entrypoint.sh +942 -0
  10. package/dist/base-image/ssh_config_template +41 -0
  11. package/dist/base-image/start-code-server.sh +76 -0
  12. package/dist/base-image/sync-repos.sh +170 -0
  13. package/dist/base-image/vscode-extensions.txt +10 -0
  14. package/dist/base-image/vscode-settings.json +41 -0
  15. package/dist/coder-server.js +2 -0
  16. package/dist/config/cli-models.json +45 -0
  17. package/dist/config/imported-skills.schema.json +83 -0
  18. package/dist/config/skill-catalog.json +18 -0
  19. package/dist/config/skill-catalog.schema.json +140 -0
  20. package/dist/config.js +1 -0
  21. package/dist/examples/oidc.json.example +11 -0
  22. package/dist/lib/agent-keepalive.js +1 -0
  23. package/dist/lib/api-keys.js +1 -0
  24. package/dist/lib/apiKeys.js +1 -0
  25. package/dist/lib/auto-judge.js +1 -0
  26. package/dist/lib/basic-auth.js +1 -0
  27. package/dist/lib/build-history.js +1 -0
  28. package/dist/lib/build-output-service.js +1 -0
  29. package/dist/lib/build-scheduler.js +1 -0
  30. package/dist/lib/build-service.js +1 -0
  31. package/dist/lib/claude-oauth-refresh.js +1 -0
  32. package/dist/lib/cli/build.js +1 -0
  33. package/dist/lib/cli/config-command.js +1 -0
  34. package/dist/lib/cli/config.js +1 -0
  35. package/dist/lib/cli/create-user.js +1 -0
  36. package/dist/lib/cli/init.js +1 -0
  37. package/dist/lib/cli/jira.js +1 -0
  38. package/dist/lib/cli/license.js +1 -0
  39. package/dist/lib/cli/server-manager.js +1 -0
  40. package/dist/lib/container-tokens.js +1 -0
  41. package/dist/lib/data-dir.js +1 -0
  42. package/dist/lib/deployment-history.js +1 -0
  43. package/dist/lib/deployment-service.js +1 -0
  44. package/dist/lib/docker-utils.js +1 -0
  45. package/dist/lib/email.js +1 -0
  46. package/dist/lib/emailTemplates.js +1 -0
  47. package/dist/lib/entitlement.js +1 -0
  48. package/dist/lib/fetch-utils.js +1 -0
  49. package/dist/lib/git-provider-service.js +1 -0
  50. package/dist/lib/git-provider-setup/assets/coderflow_github_app.png +0 -0
  51. package/dist/lib/git-provider-setup/github-setup-handler.js +1 -0
  52. package/dist/lib/git-provider-setup/index.js +1 -0
  53. package/dist/lib/git-provider-setup/setup-factory.js +1 -0
  54. package/dist/lib/git-provider-setup/setup-interface.js +1 -0
  55. package/dist/lib/git-providers/azure-devops-provider.js +1 -0
  56. package/dist/lib/git-providers/github-app-provider.js +1 -0
  57. package/dist/lib/git-providers/index.js +1 -0
  58. package/dist/lib/git-providers/provider-factory.js +1 -0
  59. package/dist/lib/git-providers/provider-interface.js +1 -0
  60. package/dist/lib/jira-client.js +1 -0
  61. package/dist/lib/logger.js +1 -0
  62. package/dist/lib/model-fetcher.js +1 -0
  63. package/dist/lib/notifications.js +1 -0
  64. package/dist/lib/oidc-auth.js +1 -0
  65. package/dist/lib/oidc-device-flow.js +1 -0
  66. package/dist/lib/passwordTokens.js +1 -0
  67. package/dist/lib/pin-cascade.js +1 -0
  68. package/dist/lib/provider-accounts.js +1 -0
  69. package/dist/lib/provider-oauth.js +1 -0
  70. package/dist/lib/provider-profile.js +1 -0
  71. package/dist/lib/provider-token-refresh.js +1 -0
  72. package/dist/lib/roles.js +1 -0
  73. package/dist/lib/secrets.js +1 -0
  74. package/dist/lib/state-capture.js +1 -0
  75. package/dist/lib/static-files.js +1 -0
  76. package/dist/lib/task-name-generator.js +1 -0
  77. package/dist/lib/users.js +1 -0
  78. package/dist/middleware/requireAuth.js +1 -0
  79. package/dist/middleware/requireInit.js +1 -0
  80. package/dist/middleware/requirePermission.js +1 -0
  81. package/dist/package-lock.json +4151 -0
  82. package/dist/package.json +50 -0
  83. package/dist/routes/apiKeys.js +1 -0
  84. package/dist/routes/auth-oidc.js +1 -0
  85. package/dist/routes/auth.js +1 -0
  86. package/dist/routes/build.js +1 -0
  87. package/dist/routes/containers.js +1 -0
  88. package/dist/routes/deploy-task.js +1 -0
  89. package/dist/routes/environment-management.js +1 -0
  90. package/dist/routes/environments.js +1 -0
  91. package/dist/routes/external-skills.js +1 -0
  92. package/dist/routes/git-credentials.js +1 -0
  93. package/dist/routes/git-provider-setup.js +1 -0
  94. package/dist/routes/health.js +1 -0
  95. package/dist/routes/jira.js +1 -0
  96. package/dist/routes/objective-management.js +1 -0
  97. package/dist/routes/password.js +1 -0
  98. package/dist/routes/prompt.js +1 -0
  99. package/dist/routes/provider-auth.js +1 -0
  100. package/dist/routes/qa.js +1 -0
  101. package/dist/routes/settings.js +1 -0
  102. package/dist/routes/skill-management.js +1 -0
  103. package/dist/routes/skills.js +1 -0
  104. package/dist/routes/tasks.js +2 -0
  105. package/dist/routes/templates.js +1 -0
  106. package/dist/routes/test-task.js +1 -0
  107. package/dist/routes/test.js +1 -0
  108. package/dist/routes/users.js +1 -0
  109. package/dist/routes/visualizations.js +1 -0
  110. package/dist/schemas/template-metadata.schema.json +178 -0
  111. package/dist/scripts/create-user.js +2 -0
  112. package/dist/shipped-skills/environment-instructions/SKILL.md +154 -0
  113. package/dist/shipped-skills/environment-templates/SKILL.md +282 -0
  114. package/dist/shipped-skills/objective-management/SKILL.md +238 -0
  115. package/dist/shipped-skills/skill-editor/SKILL.md +326 -0
  116. package/dist/start.js +2 -0
  117. package/dist/web-ui/public/activity-detail-modal.js +1 -0
  118. package/dist/web-ui/public/activity-feed.js +1 -0
  119. package/dist/web-ui/public/activity-formatters.js +1 -0
  120. package/dist/web-ui/public/agent-event-parser.js +1 -0
  121. package/dist/web-ui/public/app.js +1 -0
  122. package/dist/web-ui/public/approve-dialog.js +1 -0
  123. package/dist/web-ui/public/coderflow-logo-reversed.svg +46 -0
  124. package/dist/web-ui/public/coderflow-logo.svg +46 -0
  125. package/dist/web-ui/public/comments-widget.js +1 -0
  126. package/dist/web-ui/public/docs/.nojekyll +0 -0
  127. package/dist/web-ui/public/docs/README.md +26 -0
  128. package/dist/web-ui/public/docs/_sidebar.md +47 -0
  129. package/dist/web-ui/public/docs/admin/ai-providers.md +132 -0
  130. package/dist/web-ui/public/docs/admin/email-notifications.md +69 -0
  131. package/dist/web-ui/public/docs/admin/environments.md +215 -0
  132. package/dist/web-ui/public/docs/admin/git-providers.md +147 -0
  133. package/dist/web-ui/public/docs/admin/installation.md +313 -0
  134. package/dist/web-ui/public/docs/admin/skills.md +35 -0
  135. package/dist/web-ui/public/docs/admin/sso.md +241 -0
  136. package/dist/web-ui/public/docs/admin/users-and-roles.md +57 -0
  137. package/dist/web-ui/public/docs/code/cli.md +102 -0
  138. package/dist/web-ui/public/docs/code/files-and-editing.md +86 -0
  139. package/dist/web-ui/public/docs/code/terminal-access.md +110 -0
  140. package/dist/web-ui/public/docs/code/vscode-extension.md +58 -0
  141. package/dist/web-ui/public/docs/getting-started/core-concepts.md +129 -0
  142. package/dist/web-ui/public/docs/getting-started/overview.md +46 -0
  143. package/dist/web-ui/public/docs/index.html +151 -0
  144. package/dist/web-ui/public/docs/integrations/custom.md +58 -0
  145. package/dist/web-ui/public/docs/integrations/ibmi/overview.md +58 -0
  146. package/dist/web-ui/public/docs/integrations/overview.md +48 -0
  147. package/dist/web-ui/public/docs/objectives/qa-mode.md +90 -0
  148. package/dist/web-ui/public/docs/objectives/staged-tasks.md +60 -0
  149. package/dist/web-ui/public/docs/objectives/working-with-objectives.md +102 -0
  150. package/dist/web-ui/public/docs/tasks/approval-and-deployment.md +83 -0
  151. package/dist/web-ui/public/docs/tasks/creating-tasks.md +111 -0
  152. package/dist/web-ui/public/docs/tasks/judging.md +114 -0
  153. package/dist/web-ui/public/docs/tasks/providing-feedback.md +41 -0
  154. package/dist/web-ui/public/docs/tasks/task-groups.md +73 -0
  155. package/dist/web-ui/public/docs/tasks/winner-selection.md +75 -0
  156. package/dist/web-ui/public/docs/templates/batch-processing.md +152 -0
  157. package/dist/web-ui/public/docs/templates/task-templates.md +44 -0
  158. package/dist/web-ui/public/docs/templates/template-examples.md +93 -0
  159. package/dist/web-ui/public/docs/testing/profound-automated-testing.md +77 -0
  160. package/dist/web-ui/public/docs/testing/task-visualizations.md +42 -0
  161. package/dist/web-ui/public/docs/testing/testing-menu.md +118 -0
  162. package/dist/web-ui/public/environments.css +3942 -0
  163. package/dist/web-ui/public/environments.html +1791 -0
  164. package/dist/web-ui/public/environments.js +1 -0
  165. package/dist/web-ui/public/favicon-16.png +0 -0
  166. package/dist/web-ui/public/favicon-32.png +0 -0
  167. package/dist/web-ui/public/favicon.ico +0 -0
  168. package/dist/web-ui/public/feedback-widget.css +3133 -0
  169. package/dist/web-ui/public/feedback-widget.js +1 -0
  170. package/dist/web-ui/public/git-history.css +2663 -0
  171. package/dist/web-ui/public/git-history.html +272 -0
  172. package/dist/web-ui/public/git-history.js +1 -0
  173. package/dist/web-ui/public/git-status.js +1 -0
  174. package/dist/web-ui/public/index.html +1459 -0
  175. package/dist/web-ui/public/index.js +1 -0
  176. package/dist/web-ui/public/login.html +346 -0
  177. package/dist/web-ui/public/login.js +1 -0
  178. package/dist/web-ui/public/markdown-editor.js +1 -0
  179. package/dist/web-ui/public/markdown-file-editor.js +1 -0
  180. package/dist/web-ui/public/modal-maximize.js +1 -0
  181. package/dist/web-ui/public/notifications.js +1 -0
  182. package/dist/web-ui/public/server-health.js +1 -0
  183. package/dist/web-ui/public/settings.css +761 -0
  184. package/dist/web-ui/public/settings.html +1044 -0
  185. package/dist/web-ui/public/settings.js +1 -0
  186. package/dist/web-ui/public/setup-password.html +355 -0
  187. package/dist/web-ui/public/setup-password.js +1 -0
  188. package/dist/web-ui/public/skills.css +1949 -0
  189. package/dist/web-ui/public/skills.html +820 -0
  190. package/dist/web-ui/public/skills.js +1 -0
  191. package/dist/web-ui/public/sse-client.js +1 -0
  192. package/dist/web-ui/public/sse-shared-worker.js +1 -0
  193. package/dist/web-ui/public/styles.css +18614 -0
  194. package/dist/web-ui/public/task.html +1779 -0
  195. package/dist/web-ui/public/task.js +1 -0
  196. package/dist/web-ui/public/terminal.html +45 -0
  197. package/dist/web-ui/public/terminal.js +1 -0
  198. package/dist/web-ui/public/theme.js +1 -0
  199. package/dist/web-ui/public/users.html +298 -0
  200. package/dist/web-ui/public/users.js +1 -0
  201. package/dist/web-ui/public/variant-grouping.js +1 -0
  202. package/package.json +63 -0
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: Objective Management
3
+ description: Manage the parent objective for this task. Update the objective's details or break it down into sub-objectives. When users ask about parent objectives, ALWAYS invoke this skill first to check - never assume whether a parent objective exists.
4
+ argument-hint: update | breakdown
5
+ ---
6
+
7
+ # Objective Management Skill
8
+
9
+ This skill allows you to help the user manage the parent objective that this task was launched from.
10
+
11
+ **IMPORTANT**: This skill requires explicit user approval before making any changes. Always explain what changes you're proposing and ask the user to confirm before executing.
12
+
13
+ ## Available Commands
14
+
15
+ ### 1. Update Parent Objective (`/objective update`)
16
+
17
+ Use this to help the user update the parent objective's details based on learnings from this task.
18
+
19
+ **When to use:**
20
+ - The user asks to update the parent objective
21
+ - Discoveries during this task suggest the objective needs refinement
22
+ - The scope or requirements have changed
23
+
24
+ **Process:**
25
+ 1. Fetch the current objective details
26
+ 2. Discuss proposed changes with the user
27
+ 3. Only after user approval, submit the update
28
+
29
+ ### 2. Create Sub-Objectives (`/objective breakdown`)
30
+
31
+ Use this to help the user break down the parent objective into smaller, more manageable sub-objectives.
32
+
33
+ **When to use:**
34
+ - The user wants to decompose a large objective
35
+ - The task reveals the objective is too broad
36
+ - Multiple distinct workstreams are identified
37
+
38
+ **Process:**
39
+ 1. Fetch the current objective details and existing children
40
+ 2. Propose a breakdown structure to the user
41
+ 3. Only after user approval, create the sub-objectives
42
+
43
+ ## How It Works
44
+
45
+ This skill communicates with the CoderFlow server via the objective management API. The server URL and task credentials are automatically available in the container environment.
46
+
47
+ ### Environment Variables (automatically set when task has parent objective):
48
+ - `SOURCE_OBJECTIVE_ID` - The ID of the parent objective
49
+ - `CODERFLOW_SERVER_URL` - The CoderFlow server URL for API calls
50
+ - `TASK_ID` - This task's ID (for authentication)
51
+
52
+ ### API Endpoints:
53
+ - `GET /api/objective-management/parent` - Fetch parent objective details
54
+ - `PATCH /api/objective-management/parent` - Update parent objective
55
+ - `POST /api/objective-management/sub-objectives` - Create sub-objectives
56
+ - `GET /api/objective-management/children` - List existing sub-objectives
57
+ - `GET /api/objective-management/siblings` - List sibling objectives
58
+
59
+ ## Usage Examples
60
+
61
+ ### Updating an Objective
62
+
63
+ ```
64
+ User: "Update the parent objective to reflect that we also need to handle edge cases"
65
+
66
+ Agent: I'll help you update the parent objective. Let me first fetch the current details...
67
+
68
+ [Fetches objective]
69
+
70
+ Current objective:
71
+ - Name: "Implement user authentication"
72
+ - Instructions: "Add login and logout functionality"
73
+
74
+ I propose updating the instructions to:
75
+ "Add login and logout functionality, including edge case handling for:
76
+ - Invalid credentials
77
+ - Session expiration
78
+ - Concurrent login attempts"
79
+
80
+ Would you like me to apply this update? (Please confirm)
81
+
82
+ User: "Yes, apply it"
83
+
84
+ Agent: [Executes update via API]
85
+ Updated successfully!
86
+ ```
87
+
88
+ ### Breaking Down an Objective
89
+
90
+ ```
91
+ User: "Break this objective into smaller tasks"
92
+
93
+ Agent: I'll help break down the parent objective. Let me fetch the details first...
94
+
95
+ [Fetches objective and existing children]
96
+
97
+ Current objective: "Build complete e-commerce checkout flow"
98
+ Existing sub-objectives: None
99
+
100
+ I propose breaking this into the following sub-objectives:
101
+
102
+ 1. **Cart Management** - Implement add/remove items, quantity updates
103
+ 2. **Payment Integration** - Integrate Stripe for payment processing
104
+ 3. **Order Confirmation** - Create confirmation page and email notifications
105
+ 4. **Shipping Calculation** - Implement shipping cost calculation
106
+
107
+ Would you like me to create these sub-objectives? (Please confirm)
108
+
109
+ User: "Yes, create them"
110
+
111
+ Agent: [Executes API calls to create sub-objectives]
112
+ Created 4 sub-objectives successfully!
113
+ ```
114
+
115
+ ## Implementation
116
+
117
+ The skill executes shell commands to interact with the CoderFlow API:
118
+
119
+ ### Fetch Parent Objective Details
120
+ ```bash
121
+ curl -s "${CODERFLOW_SERVER_URL}/api/objective-management/parent" \
122
+ -H "X-Task-Id: ${TASK_ID}"
123
+ ```
124
+
125
+ **Response:**
126
+ ```json
127
+ {
128
+ "taskId": "obj-xxx",
129
+ "name": "Objective name",
130
+ "status": "objective",
131
+ "instructions": "Objective instructions...",
132
+ "environment": "my-environment",
133
+ "parentObjectiveId": null,
134
+ "launchCount": 3
135
+ }
136
+ ```
137
+
138
+ ### Update Parent Objective
139
+ ```bash
140
+ curl -s -X PATCH "${CODERFLOW_SERVER_URL}/api/objective-management/parent" \
141
+ -H "Content-Type: application/json" \
142
+ -H "X-Task-Id: ${TASK_ID}" \
143
+ -d '{
144
+ "name": "Updated objective name",
145
+ "instructions": "Updated instructions..."
146
+ }'
147
+ ```
148
+
149
+ **Response:**
150
+ ```json
151
+ {
152
+ "success": true,
153
+ "taskId": "obj-xxx",
154
+ "name": "Updated objective name",
155
+ "instructions": "Updated instructions...",
156
+ "updatedAt": "2024-01-15T10:30:00Z"
157
+ }
158
+ ```
159
+
160
+ ### Create Sub-Objectives
161
+ ```bash
162
+ curl -s -X POST "${CODERFLOW_SERVER_URL}/api/objective-management/sub-objectives" \
163
+ -H "Content-Type: application/json" \
164
+ -H "X-Task-Id: ${TASK_ID}" \
165
+ -d '{
166
+ "objectives": [
167
+ {
168
+ "name": "Sub-objective 1",
169
+ "instructions": "Details for first sub-objective"
170
+ },
171
+ {
172
+ "name": "Sub-objective 2",
173
+ "instructions": "Details for second sub-objective"
174
+ }
175
+ ]
176
+ }'
177
+ ```
178
+
179
+ **Response:**
180
+ ```json
181
+ {
182
+ "success": true,
183
+ "created": 2,
184
+ "objectives": [
185
+ {
186
+ "taskId": "obj-yyy",
187
+ "name": "Sub-objective 1",
188
+ "instructions": "Details for first sub-objective",
189
+ "parentObjectiveId": "obj-xxx",
190
+ "sortOrder": 1000
191
+ },
192
+ {
193
+ "taskId": "obj-zzz",
194
+ "name": "Sub-objective 2",
195
+ "instructions": "Details for second sub-objective",
196
+ "parentObjectiveId": "obj-xxx",
197
+ "sortOrder": 2000
198
+ }
199
+ ]
200
+ }
201
+ ```
202
+
203
+ ### List Existing Sub-Objectives (Children)
204
+ ```bash
205
+ curl -s "${CODERFLOW_SERVER_URL}/api/objective-management/children" \
206
+ -H "X-Task-Id: ${TASK_ID}"
207
+ ```
208
+
209
+ **Response:**
210
+ ```json
211
+ {
212
+ "children": [
213
+ {
214
+ "taskId": "obj-yyy",
215
+ "name": "Existing sub-objective",
216
+ "sortOrder": 1000,
217
+ "createdAt": "2024-01-14T09:00:00Z"
218
+ }
219
+ ],
220
+ "parentObjectiveId": "obj-xxx"
221
+ }
222
+ ```
223
+
224
+ ### List Sibling Objectives
225
+ ```bash
226
+ curl -s "${CODERFLOW_SERVER_URL}/api/objective-management/siblings" \
227
+ -H "X-Task-Id: ${TASK_ID}"
228
+ ```
229
+
230
+ ## Important Notes
231
+
232
+ 1. **User Approval Required**: Never execute updates or create sub-objectives without explicit user confirmation
233
+ 2. **Explain Changes**: Always clearly explain what changes will be made before asking for approval
234
+ 3. **Preserve Context**: When updating, preserve any existing context that's still relevant
235
+ 4. **Check for Existing Children**: Before proposing a breakdown, always check for existing sub-objectives
236
+ 5. **Atomic Operations**: Each sub-objective should be a self-contained unit of work
237
+ 6. **Naming Conventions**: Use clear, descriptive names for sub-objectives
238
+ 7. **Error Handling**: If an API call fails, explain the error to the user and suggest alternatives
@@ -0,0 +1,326 @@
1
+ ---
2
+ name: Skill Editor
3
+ description: View, edit, and create skills for this environment. Use this when users want to improve, customize, or create new skills based on learnings from this task.
4
+ argument-hint: list | view <skill-id> | update <skill-id> | create <skill-id>
5
+ ---
6
+
7
+ # Skill Editor Skill
8
+
9
+ This skill allows you to view, edit, and create skills for the environment this task is running in. Use this to improve skills based on learnings from the current task, or create new skills when a reusable pattern emerges.
10
+
11
+ **IMPORTANT**: This skill requires explicit user approval before making any changes. Always explain what changes you're proposing and ask the user to confirm before executing.
12
+
13
+ **NOTE**: Only skills assigned to this environment can be edited. System skills and read-only skills cannot be modified. New skills can be created and optionally assigned to the current environment.
14
+
15
+ ## Available Commands
16
+
17
+ ### 1. List Editable Skills (`/skill-editor list`)
18
+
19
+ List all skills assigned to this environment that can be edited.
20
+
21
+ **When to use:**
22
+ - The user wants to see what skills can be modified
23
+ - You need to identify which skill to update
24
+
25
+ ### 2. View Skill (`/skill-editor view <skill-id>`)
26
+
27
+ View a specific skill's full content including frontmatter and body.
28
+
29
+ **When to use:**
30
+ - The user wants to understand a skill's current behavior
31
+ - You need to review a skill before proposing changes
32
+
33
+ ### 3. Update Skill (`/skill-editor update <skill-id>`)
34
+
35
+ Update a skill's content, description, or configuration.
36
+
37
+ **When to use:**
38
+ - The user wants to improve a skill based on task learnings
39
+ - A skill's behavior needs refinement
40
+ - Documentation or examples need updating
41
+
42
+ ### 4. Create Skill (`/skill-editor create <skill-id>`)
43
+
44
+ Create a new skill with the specified ID.
45
+
46
+ **When to use:**
47
+ - A reusable pattern has emerged from task work
48
+ - The user wants to codify a workflow into a skill
49
+ - A new capability should be available for future tasks
50
+
51
+ **Requirements:**
52
+ - Skill ID must be unique and contain only alphanumeric characters, hyphens, and underscores
53
+ - Name, description, and body (instructions) are required
54
+ - By default, new skills are automatically assigned to the current environment
55
+
56
+ ## How It Works
57
+
58
+ This skill communicates with the CoderFlow server via the skill management API.
59
+
60
+ ### Environment Variables (automatically set):
61
+ - `CODERFLOW_SERVER_URL` - The CoderFlow server URL for API calls
62
+ - `TASK_ID` - This task's ID (for authentication)
63
+
64
+ ### API Endpoints:
65
+ - `GET /api/skill-management/skills` - List editable skills
66
+ - `POST /api/skill-management/skills` - Create a new skill
67
+ - `GET /api/skill-management/skills/:skillId` - Get skill details
68
+ - `PATCH /api/skill-management/skills/:skillId` - Update skill
69
+ - `GET /api/skill-management/skills/:skillId/files/*` - Read supporting file
70
+ - `PUT /api/skill-management/skills/:skillId/files/*` - Update supporting file
71
+
72
+ ## Skill Structure
73
+
74
+ Skills consist of:
75
+ 1. **`SKILL.md`** - The main skill definition with frontmatter and body
76
+ 2. **Supporting files** - Additional files the skill may reference
77
+
78
+ ### SKILL.md Frontmatter
79
+ ```yaml
80
+ ---
81
+ name: Display Name
82
+ description: Brief description for the skill picker
83
+ argument-hint: optional argument examples
84
+ model: optional model override (e.g., haiku for fast tasks)
85
+ allowed-tools:
86
+ - Read
87
+ - Write
88
+ - Bash
89
+ ---
90
+ ```
91
+
92
+ ### SKILL.md Body
93
+ The body contains the detailed skill instructions that guide the AI agent.
94
+
95
+ ## Usage Examples
96
+
97
+ ### Listing Skills
98
+
99
+ ```
100
+ User: "What skills can I edit?"
101
+
102
+ Agent: I'll list the editable skills for this environment.
103
+
104
+ [Executes API call]
105
+
106
+ Editable skills in this environment:
107
+ 1. **code-review** - Performs code review with best practices (editable)
108
+ 2. **test-generator** - Generates unit tests (editable)
109
+ 3. **documentation** - System documentation skill (read-only)
110
+
111
+ Would you like to view or modify any of these?
112
+ ```
113
+
114
+ ### Viewing a Skill
115
+
116
+ ```
117
+ User: "Show me the code-review skill"
118
+
119
+ Agent: I'll fetch the code-review skill details.
120
+
121
+ [Executes API call]
122
+
123
+ **code-review** skill:
124
+ - Description: Performs code review with best practices
125
+ - Model: (default)
126
+ - Allowed tools: Read, Grep, Glob
127
+
128
+ **Instructions:**
129
+ ```markdown
130
+ # Code Review Skill
131
+
132
+ Review the specified code for:
133
+ - Code quality and readability
134
+ - Potential bugs
135
+ - Performance issues
136
+ - Security concerns
137
+ ...
138
+ ```
139
+
140
+ Would you like to update this skill?
141
+ ```
142
+
143
+ ### Updating a Skill
144
+
145
+ ```
146
+ User: "Add security review to the code-review skill"
147
+
148
+ Agent: I'll help you update the code-review skill. Let me fetch the current content first...
149
+
150
+ [Fetches skill]
151
+
152
+ I propose updating the skill body to include a dedicated security review section:
153
+
154
+ ```diff
155
+ # Code Review Skill
156
+
157
+ Review the specified code for:
158
+ - Code quality and readability
159
+ - Potential bugs
160
+ - Performance issues
161
+ - Security concerns
162
+
163
+ +## Security Review Checklist
164
+ +- [ ] Input validation
165
+ +- [ ] SQL injection prevention
166
+ +- [ ] XSS prevention
167
+ +- [ ] Authentication/authorization checks
168
+ +- [ ] Sensitive data handling
169
+ +- [ ] Dependency vulnerabilities
170
+ ```
171
+
172
+ Would you like me to apply this update? (Please confirm)
173
+
174
+ User: "Yes, update it"
175
+
176
+ Agent: [Executes API call]
177
+ Skill "code-review" updated successfully!
178
+ ```
179
+
180
+ ### Creating a Skill
181
+
182
+ ```
183
+ User: "I keep doing the same database migration workflow. Can you create a skill for it?"
184
+
185
+ Agent: I'll help you create a new skill for database migrations. Based on the workflow we've been using, here's what I propose:
186
+
187
+ **Skill ID:** `db-migration`
188
+ **Name:** Database Migration
189
+ **Description:** Run and validate database migrations with rollback support
190
+
191
+ **Instructions:**
192
+ ```markdown
193
+ # Database Migration Skill
194
+
195
+ Guide the user through database migration workflows:
196
+ 1. Check pending migrations
197
+ 2. Create backup before migration
198
+ 3. Run migrations
199
+ 4. Validate schema changes
200
+ 5. Provide rollback instructions if needed
201
+ ...
202
+ ```
203
+
204
+ Would you like me to create this skill? (Please confirm)
205
+
206
+ User: "Yes, create it"
207
+
208
+ Agent: [Executes API call]
209
+ Skill "db-migration" created successfully and assigned to this environment!
210
+ ```
211
+
212
+ ## Implementation
213
+
214
+ ### List Editable Skills
215
+ ```bash
216
+ curl -s "${CODERFLOW_SERVER_URL}/api/skill-management/skills" \
217
+ -H "X-Task-Id: ${TASK_ID}"
218
+ ```
219
+
220
+ **Response:**
221
+ ```json
222
+ {
223
+ "skills": [
224
+ {"id": "code-review", "name": "Code Review", "description": "...", "editable": true}
225
+ ],
226
+ "environment": "my-environment"
227
+ }
228
+ ```
229
+
230
+ ### Get Skill Details
231
+ ```bash
232
+ curl -s "${CODERFLOW_SERVER_URL}/api/skill-management/skills/code-review" \
233
+ -H "X-Task-Id: ${TASK_ID}"
234
+ ```
235
+
236
+ **Response:**
237
+ ```json
238
+ {
239
+ "id": "code-review",
240
+ "name": "Code Review",
241
+ "description": "Performs code review with best practices",
242
+ "body": "# Code Review Skill\n\n...",
243
+ "allowed-tools": ["Read", "Grep", "Glob"],
244
+ "model": null,
245
+ "argument-hint": null,
246
+ "files": [{"name": "checklist.md", "type": "file"}],
247
+ "environment": "my-environment"
248
+ }
249
+ ```
250
+
251
+ ### Update Skill
252
+ ```bash
253
+ curl -s -X PATCH "${CODERFLOW_SERVER_URL}/api/skill-management/skills/code-review" \
254
+ -H "Content-Type: application/json" \
255
+ -H "X-Task-Id: ${TASK_ID}" \
256
+ -d '{
257
+ "description": "Updated description",
258
+ "body": "# Updated Code Review Skill\n\n..."
259
+ }'
260
+ ```
261
+
262
+ **Response:**
263
+ ```json
264
+ {
265
+ "success": true,
266
+ "id": "code-review",
267
+ "environment": "my-environment",
268
+ "updatedAt": "2024-01-15T10:30:00Z"
269
+ }
270
+ ```
271
+
272
+ ### Create Skill
273
+ ```bash
274
+ curl -s -X POST "${CODERFLOW_SERVER_URL}/api/skill-management/skills" \
275
+ -H "Content-Type: application/json" \
276
+ -H "X-Task-Id: ${TASK_ID}" \
277
+ -d '{
278
+ "id": "db-migration",
279
+ "name": "Database Migration",
280
+ "description": "Run and validate database migrations with rollback support",
281
+ "body": "# Database Migration Skill\n\nGuide the user through...",
282
+ "allowed-tools": ["Bash", "Read", "Write"],
283
+ "assignToEnvironment": true
284
+ }'
285
+ ```
286
+
287
+ **Response:**
288
+ ```json
289
+ {
290
+ "success": true,
291
+ "id": "db-migration",
292
+ "environment": "my-environment",
293
+ "createdAt": "2024-01-15T10:30:00Z",
294
+ "createdByTaskId": "task-123",
295
+ "createdByUserId": "user-456",
296
+ "assigned": true
297
+ }
298
+ ```
299
+
300
+ ### Read Supporting File
301
+ ```bash
302
+ curl -s "${CODERFLOW_SERVER_URL}/api/skill-management/skills/code-review/files/checklist.md" \
303
+ -H "X-Task-Id: ${TASK_ID}"
304
+ ```
305
+
306
+ ### Update Supporting File
307
+ ```bash
308
+ curl -s -X PUT "${CODERFLOW_SERVER_URL}/api/skill-management/skills/code-review/files/examples.md" \
309
+ -H "Content-Type: application/json" \
310
+ -H "X-Task-Id: ${TASK_ID}" \
311
+ -d '{
312
+ "content": "# Examples\n\n..."
313
+ }'
314
+ ```
315
+
316
+ ## Important Notes
317
+
318
+ 1. **User Approval Required**: Never execute creates or updates without explicit user confirmation
319
+ 2. **Environment Scope**: Only skills assigned to this environment can be edited. New skills can be created and optionally assigned.
320
+ 3. **Read-Only Skills**: System skills and imported read-only skills cannot be modified
321
+ 4. **Preserve Functionality**: When updating, ensure the skill still works correctly
322
+ 5. **Test Changes**: Consider testing skill changes in a safe context
323
+ 6. **Document Changes**: Update the description if the skill's purpose changes
324
+ 7. **Supporting Files**: Skills may have supporting files that can also be edited
325
+ 8. **Skill ID Format**: When creating skills, use lowercase alphanumeric characters with hyphens (e.g., `my-new-skill`)
326
+ 9. **Auto-Assignment**: New skills are automatically assigned to the current environment by default (use `assignToEnvironment: false` to skip)