Changesets · Branches · Tags · Compare
| Changeset | 8fc76b1055044240b936a08dd0f29880a91edd1ccac697e9e1854117e616e009 |
|---|---|
| Author | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-24 18:52 +05:30 |
| Committer | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-24 18:52 +05:30 |
| Parents | 480243bc3999, e31fcddb0dec |
28 files changed
added .continue/rules/mintlify-formatting.md +100 −0
| @@ -0,0 +1,100 @@ | ||
| 1 | +# Mintlify Documentation Formatting Rules | |
| 2 | + | |
| 3 | +## Component Formatting | |
| 4 | + | |
| 5 | +When working with Mintlify documentation components (Card, Info, Tip, Note, Warning, etc.), follow these formatting guidelines: | |
| 6 | + | |
| 7 | +### Bullet Points and Lists | |
| 8 | + | |
| 9 | +1. **Always add a blank line** after the opening component tag and before the closing tag | |
| 10 | +2. **Indent content** by 2 spaces within components | |
| 11 | +3. **Use proper list formatting** with each item on its own line: | |
| 12 | + - Start lists on a new line after introductory text | |
| 13 | + - Use `-` for unordered lists | |
| 14 | + - Maintain consistent indentation | |
| 15 | + | |
| 16 | +### Examples | |
| 17 | + | |
| 18 | +#### ✅ Correct Formatting: | |
| 19 | + | |
| 20 | +```mdx | |
| 21 | +<Card title="Example" icon="icon-name"> | |
| 22 | + | |
| 23 | + This is the content with proper formatting: | |
| 24 | + - First bullet point | |
| 25 | + - Second bullet point | |
| 26 | + - Third bullet point | |
| 27 | + | |
| 28 | +</Card> | |
| 29 | +``` | |
| 30 | + | |
| 31 | +```mdx | |
| 32 | +<Info> | |
| 33 | + | |
| 34 | + Important information here: | |
| 35 | + - Point one | |
| 36 | + - Point two | |
| 37 | + - Point three | |
| 38 | + | |
| 39 | +</Info> | |
| 40 | +``` | |
| 41 | + | |
| 42 | +#### ❌ Incorrect Formatting: | |
| 43 | + | |
| 44 | +```mdx | |
| 45 | +<Card title="Example" icon="icon-name"> | |
| 46 | + This is wrong: - All bullets - On one line - Bad formatting | |
| 47 | +</Card> | |
| 48 | +``` | |
| 49 | + | |
| 50 | +### Component-Specific Rules | |
| 51 | + | |
| 52 | +1. **Card Components**: Always include blank lines and proper indentation | |
| 53 | +2. **Info/Tip/Note/Warning**: Format lists as bullet points, not inline | |
| 54 | +3. **CardGroup**: Each Card within should follow the same formatting rules | |
| 55 | +4. **Code Blocks**: Within components, maintain proper indentation | |
| 56 | + | |
| 57 | +### Links in Lists | |
| 58 | + | |
| 59 | +When including links in bullet points: | |
| 60 | +```mdx | |
| 61 | +- [Link Text](url): Description of the link | |
| 62 | +``` | |
| 63 | + | |
| 64 | +### Nested Components | |
| 65 | + | |
| 66 | +For nested components, maintain proper indentation levels: | |
| 67 | +```mdx | |
| 68 | +<CardGroup> | |
| 69 | + <Card title="First Card"> | |
| 70 | + | |
| 71 | + Content here: | |
| 72 | + - Bullet one | |
| 73 | + - Bullet two | |
| 74 | + | |
| 75 | + </Card> | |
| 76 | + | |
| 77 | + <Card title="Second Card"> | |
| 78 | + | |
| 79 | + More content: | |
| 80 | + - Another bullet | |
| 81 | + - Final bullet | |
| 82 | + | |
| 83 | + </Card> | |
| 84 | +</CardGroup> | |
| 85 | +``` | |
| 86 | + | |
| 87 | +## Application | |
| 88 | + | |
| 89 | +These rules apply to all `.mdx` files in the `docs/` directory, particularly: | |
| 90 | +- Guide documents | |
| 91 | +- Cookbook documents | |
| 92 | +- Reference documentation | |
| 93 | +- Any Mintlify-powered documentation | |
| 94 | + | |
| 95 | +## Automation Note | |
| 96 | + | |
| 97 | +When using Continue or other AI assistants to generate or modify documentation: | |
| 98 | +- Always format Mintlify components according to these rules | |
| 99 | +- Review generated content for proper formatting | |
| 100 | +- Apply these rules consistently across all documentation | |
| No newline at the end of the file |
added .continue/rules/personality.md +6 −0
| @@ -0,0 +1,6 @@ | ||
| 1 | +--- | |
| 2 | +name: Personality Rules | |
| 3 | +description: Conversational and personality guidelines | |
| 4 | +--- | |
| 5 | + | |
| 6 | +When the user challenges your output or asks a question, don't be overly-amiable (e.g. responding "You're right" all the time). Focus on correctness and be willing to tell the user they are wrong. |
modified .github/workflows/continue-detailed-review.yaml +1 −1
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | timeout-minutes: 10 |
| 19 | 19 | steps: |
| 20 | 20 | - name: Run Detailed PR Review |
| 21 | - uses: continuedev/continue/actions/detailed-review@12e933bf9d13736c5f47728c436445ef4127fd52 | |
| 21 | + uses: continuedev/continue/actions/detailed-review@main | |
| 22 | 22 | with: |
| 23 | 23 | continue-api-key: ${{ secrets.CONTINUE_API_KEY }} |
| 24 | 24 | continue-org: continuedev |
modified .github/workflows/continue-general-review.yaml +1 −1
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | timeout-minutes: 10 |
| 19 | 19 | steps: |
| 20 | 20 | - name: Run Continue PR Review Action |
| 21 | - uses: continuedev/continue/actions/general-review@12e933bf9d13736c5f47728c436445ef4127fd52 | |
| 21 | + uses: continuedev/continue/actions/general-review@main | |
| 22 | 22 | with: |
| 23 | 23 | continue-api-key: ${{ secrets.CONTINUE_API_KEY }} |
| 24 | 24 | continue-org: "continuedev" |
modified .prettierignore +2 −0
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | binary/tmp |
| 5 | 5 | core/.continue-test |
| 6 | 6 | docs/.docusaurus |
| 7 | +docs/**/*.mdx | |
| 7 | 8 | extensions/.continue-debug |
| 8 | 9 | extensions/vscode/continue_rc_schema.json |
| 9 | 10 | extensions/vscode/.vscode-test |
| @@ -17,6 +18,7 @@ | ||
| 17 | 18 | extensions/intellij/src/main/resources |
| 18 | 19 | gui/dist |
| 19 | 20 | **/.continueignore |
| 21 | +.continue/rules/mintlify-formatting.md | |
| 20 | 22 | CHANGELOG.md |
| 21 | 23 | **/continue_tutorial.py |
| 22 | 24 | **/node_modules |
modified docs/customize/custom-providers.mdx +0 −183
| @@ -19,116 +19,62 @@ | ||
| 19 | 19 | |
| 20 | 20 | Reference any file in your current workspace. |
| 21 | 21 | |
| 22 | -- YAML | |
| 23 | -- JSON | |
| 24 | - | |
| 25 | 22 | config.yaml |
| 26 | 23 | |
| 27 | 24 | ``` |
| 28 | 25 | context: - provider: file |
| 29 | 26 | ``` |
| 30 | 27 | |
| 31 | -config.json | |
| 32 | - | |
| 33 | -```json | |
| 34 | -{ "contextProviders": [{ "name": "file" }] } | |
| 35 | -``` | |
| 36 | - | |
| 37 | 28 | ### @Code Context Provider – Reference Functions and Classes |
| 38 | 29 | |
| 39 | 30 | Reference specific functions or classes from throughout your project. |
| 40 | 31 | |
| 41 | -- YAML | |
| 42 | -- JSON | |
| 43 | - | |
| 44 | 32 | config.yaml |
| 45 | 33 | |
| 46 | 34 | ``` |
| 47 | 35 | context: - provider: code |
| 48 | 36 | ``` |
| 49 | 37 | |
| 50 | -config.json | |
| 51 | - | |
| 52 | -```json | |
| 53 | -{ "contextProviders": [{ "name": "code" }] } | |
| 54 | -``` | |
| 55 | - | |
| 56 | 38 | ### @Git Diff Context Provider – Reference Branch Changes |
| 57 | 39 | |
| 58 | 40 | Reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. |
| 59 | 41 | |
| 60 | -- YAML | |
| 61 | -- JSON | |
| 62 | - | |
| 63 | 42 | config.yaml |
| 64 | 43 | |
| 65 | 44 | ``` |
| 66 | 45 | context: - provider: diff |
| 67 | 46 | ``` |
| 68 | 47 | |
| 69 | -config.json | |
| 70 | - | |
| 71 | -```json | |
| 72 | -{ "contextProviders": [{ "name": "diff" }] } | |
| 73 | -``` | |
| 74 | - | |
| 75 | 48 | ### @Current File Context Provider – Reference the Active File |
| 76 | 49 | |
| 77 | 50 | Reference the currently open file. |
| 78 | 51 | |
| 79 | -- YAML | |
| 80 | -- JSON | |
| 81 | - | |
| 82 | 52 | config.yaml |
| 83 | 53 | |
| 84 | 54 | ``` |
| 85 | 55 | context: - provider: currentFile |
| 86 | 56 | ``` |
| 87 | 57 | |
| 88 | -config.json | |
| 89 | - | |
| 90 | -```json | |
| 91 | -{ "contextProviders": [{ "name": "currentFile" }] } | |
| 92 | -``` | |
| 93 | - | |
| 94 | 58 | ### @Terminal Context Provider – Reference Last Terminal Command and Output |
| 95 | 59 | |
| 96 | 60 | Reference the last command you ran in your IDE's terminal and its output. |
| 97 | 61 | |
| 98 | -- YAML | |
| 99 | -- JSON | |
| 100 | - | |
| 101 | 62 | config.yaml |
| 102 | 63 | |
| 103 | 64 | ``` |
| 104 | 65 | context: - provider: terminal |
| 105 | 66 | ``` |
| 106 | 67 | |
| 107 | -config.json | |
| 108 | - | |
| 109 | -```json | |
| 110 | -{ "contextProviders": [{ "name": "terminal" }] } | |
| 111 | -``` | |
| 112 | - | |
| 113 | 68 | ### @Docs Context Provider – Reference Documentation Site Content |
| 114 | 69 | |
| 115 | 70 | Reference the contents from any documentation site. |
| 116 | 71 | |
| 117 | -- YAML | |
| 118 | -- JSON | |
| 119 | - | |
| 120 | 72 | config.yaml |
| 121 | 73 | |
| 122 | 74 | ``` |
| 123 | 75 | context: - provider: docs |
| 124 | 76 | ``` |
| 125 | 77 | |
| 126 | -config.json | |
| 127 | - | |
| 128 | -```json | |
| 129 | -{ "contextProviders": [{ "name": "docs" }] } | |
| 130 | -``` | |
| 131 | - | |
| 132 | 78 | Note that this will only enable the `@Docs` context provider. |
| 133 | 79 | |
| 134 | 80 | To use it, you need to add a documentation site to your config file. See the [docs](/customize/overview#documentation-context) page for more information. |
| @@ -137,9 +83,6 @@ | ||
| 137 | 83 | |
| 138 | 84 | Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. |
| 139 | 85 | |
| 140 | -- YAML | |
| 141 | -- JSON | |
| 142 | - | |
| 143 | 86 | config.yaml |
| 144 | 87 | |
| 145 | 88 | ``` |
| @@ -149,21 +92,12 @@ | ||
| 149 | 92 | onlyPinned: true |
| 150 | 93 | ``` |
| 151 | 94 | |
| 152 | -config.json | |
| 153 | - | |
| 154 | -```json | |
| 155 | -{ "contextProviders": [{ "name": "open", "params": { "onlyPinned": true } }] } | |
| 156 | -``` | |
| 157 | - | |
| 158 | 95 | ### @Web Context Provider – Reference Relevant Web Pages |
| 159 | 96 | |
| 160 | 97 | Reference relevant pages from across the web, automatically determined from your input. |
| 161 | 98 | |
| 162 | 99 | Optionally, set `n` to limit the number of results returned (default 6). |
| 163 | 100 | |
| 164 | -- YAML | |
| 165 | -- JSON | |
| 166 | - | |
| 167 | 101 | config.yaml |
| 168 | 102 | |
| 169 | 103 | ``` |
| @@ -173,19 +107,10 @@ | ||
| 173 | 107 | n: 5 |
| 174 | 108 | ``` |
| 175 | 109 | |
| 176 | -config.json | |
| 177 | - | |
| 178 | -```json | |
| 179 | -{ "contextProviders": [{ "name": "web", "params": { "n": 5 } }] } | |
| 180 | -``` | |
| 181 | - | |
| 182 | 110 | ### @Codebase Context Provider – Reference Relevant Codebase Snippets |
| 183 | 111 | |
| 184 | 112 | Reference the most relevant snippets from your codebase. |
| 185 | 113 | |
| 186 | -- YAML | |
| 187 | -- JSON | |
| 188 | - | |
| 189 | 114 | config.yaml |
| 190 | 115 | |
| 191 | 116 | ``` |
| @@ -193,40 +118,22 @@ | ||
| 193 | 118 | - provider: codebase |
| 194 | 119 | ``` |
| 195 | 120 | |
| 196 | -config.json | |
| 197 | - | |
| 198 | -```json | |
| 199 | -{ "contextProviders": [{ "name": "codebase" }] } | |
| 200 | -``` | |
| 201 | - | |
| 202 | 121 | Read more about indexing and retrieval [here](/customize/overview#codebase-context). |
| 203 | 122 | |
| 204 | 123 | ### @Folder Context Provider – Reference Code from a Specific Folder |
| 205 | 124 | |
| 206 | 125 | Uses the same retrieval mechanism as `@Codebase`, but only on a single folder. |
| 207 | 126 | |
| 208 | -- YAML | |
| 209 | -- JSON | |
| 210 | - | |
| 211 | 127 | config.yaml |
| 212 | 128 | |
| 213 | 129 | ``` |
| 214 | 130 | context: - provider: folder |
| 215 | 131 | ``` |
| 216 | 132 | |
| 217 | -config.json | |
| 218 | - | |
| 219 | -```json | |
| 220 | -{ "contextProviders": [{ "name": "folder" }] } | |
| 221 | -``` | |
| 222 | - | |
| 223 | 133 | ### @Search Context Provider – Reference Code Search Results |
| 224 | 134 | |
| 225 | 135 | Reference the results of codebase search, just like the results you would get from VS Code search. |
| 226 | 136 | |
| 227 | -- YAML | |
| 228 | -- JSON | |
| 229 | - | |
| 230 | 137 | config.yaml |
| 231 | 138 | |
| 232 | 139 | ``` |
| @@ -236,21 +143,12 @@ | ||
| 236 | 143 | maxResults: 100 # optional, defaults to 200 |
| 237 | 144 | ``` |
| 238 | 145 | |
| 239 | -config.json | |
| 240 | - | |
| 241 | -```json | |
| 242 | -{ "contextProviders": [ { "name": "search", "params": { "maxResults": 100 // optional, defaults to 200 } } ]} | |
| 243 | -``` | |
| 244 | - | |
| 245 | 146 | This context provider is powered by [ripgrep](https://github.com/BurntSushi/ripgrep). |
| 246 | 147 | |
| 247 | 148 | ### @Url Context Provider – Reference Content from a URL |
| 248 | 149 | |
| 249 | 150 | Reference the markdown converted contents of a given URL. |
| 250 | 151 | |
| 251 | -- YAML | |
| 252 | -- JSON | |
| 253 | - | |
| 254 | 152 | config.yaml |
| 255 | 153 | |
| 256 | 154 | ``` |
| @@ -258,19 +156,10 @@ | ||
| 258 | 156 | - provider: url |
| 259 | 157 | ``` |
| 260 | 158 | |
| 261 | -config.json | |
| 262 | - | |
| 263 | -```json | |
| 264 | -{ "contextProviders": [{ "name": "url" }] } | |
| 265 | -``` | |
| 266 | - | |
| 267 | 159 | ### @Clipboard Context Provider – Reference Clipboard Items |
| 268 | 160 | |
| 269 | 161 | Reference recent clipboard items |
| 270 | 162 | |
| 271 | -- YAML | |
| 272 | -- JSON | |
| 273 | - | |
| 274 | 163 | config.yaml |
| 275 | 164 | |
| 276 | 165 | ``` |
| @@ -278,19 +167,10 @@ | ||
| 278 | 167 | - provider: clipboard |
| 279 | 168 | ``` |
| 280 | 169 | |
| 281 | -config.json | |
| 282 | - | |
| 283 | -```json | |
| 284 | -{ "contextProviders": [{ "name": "clipboard" }] } | |
| 285 | -``` | |
| 286 | - | |
| 287 | 170 | ### @Tree Context Provider – Reference Workspace File Structure |
| 288 | 171 | |
| 289 | 172 | Reference the structure of your current workspace. |
| 290 | 173 | |
| 291 | -- YAML | |
| 292 | -- JSON | |
| 293 | - | |
| 294 | 174 | config.yaml |
| 295 | 175 | |
| 296 | 176 | ``` |
| @@ -298,19 +178,10 @@ | ||
| 298 | 178 | - provider: tree |
| 299 | 179 | ``` |
| 300 | 180 | |
| 301 | -config.json | |
| 302 | - | |
| 303 | -```json | |
| 304 | -{ "contextProviders": [{ "name": "tree" }] } | |
| 305 | -``` | |
| 306 | - | |
| 307 | 181 | ### @Problems Context Provider – Reference Problems in the Current File |
| 308 | 182 | |
| 309 | 183 | Get Problems from the current file. |
| 310 | 184 | |
| 311 | -- YAML | |
| 312 | -- JSON | |
| 313 | - | |
| 314 | 185 | config.yaml |
| 315 | 186 | |
| 316 | 187 | ``` |
| @@ -318,19 +189,10 @@ | ||
| 318 | 189 | - provider: problems |
| 319 | 190 | ``` |
| 320 | 191 | |
| 321 | -config.json | |
| 322 | - | |
| 323 | -```json | |
| 324 | -{ "contextProviders": [{ "name": "problems" }] } | |
| 325 | -``` | |
| 326 | - | |
| 327 | 192 | ### @Debugger Context Provider – Reference Debugger Local Variables |
| 328 | 193 | |
| 329 | 194 | Reference the contents of the local variables in the debugger. Currently only available in VS Code. |
| 330 | 195 | |
| 331 | -- YAML | |
| 332 | -- JSON | |
| 333 | - | |
| 334 | 196 | config.yaml |
| 335 | 197 | |
| 336 | 198 | ``` |
| @@ -340,12 +202,6 @@ | ||
| 340 | 202 | stackDepth: 3 |
| 341 | 203 | ``` |
| 342 | 204 | |
| 343 | -config.json | |
| 344 | - | |
| 345 | -```json | |
| 346 | -{ "contextProviders": [{ "name": "debugger", "params": { "stackDepth": 3 } }] } | |
| 347 | -``` | |
| 348 | - | |
| 349 | 205 | Uses the top _n_ levels (defaulting to 3) of the call stack for that thread. |
| 350 | 206 | |
| 351 | 207 | ### @Repository Map Context Provider – Reference Codebase Outline and Signatures |
| @@ -354,9 +210,6 @@ | ||
| 354 | 210 | |
| 355 | 211 | `includeSignatures` params can be set to false to exclude signatures. This could be necessary for large codebases and/or to reduce context size significantly. Signatures will not be included if indexing is disabled. |
| 356 | 212 | |
| 357 | -- YAML | |
| 358 | -- JSON | |
| 359 | - | |
| 360 | 213 | config.yaml |
| 361 | 214 | |
| 362 | 215 | ``` |
| @@ -366,12 +219,6 @@ | ||
| 366 | 219 | includeSignatures: false # default true |
| 367 | 220 | ``` |
| 368 | 221 | |
| 369 | -config.json | |
| 370 | - | |
| 371 | -```json | |
| 372 | -{ "contextProviders": [ { "name": "repo-map", "params": { "includeSignatures": false // default true } } ]} | |
| 373 | -``` | |
| 374 | - | |
| 375 | 222 | Provides a list of files and the call signatures of top-level classes, functions, and methods in those files. This helps the model better understand how a particular piece of code relates to the rest of the codebase. |
| 376 | 223 | |
| 377 | 224 | In the submenu that appears, you can select either `Entire codebase`, or specify a subfolder to generate the repository map from. |
| @@ -382,9 +229,6 @@ | ||
| 382 | 229 | |
| 383 | 230 | Reference the architecture and platform of your current operating system. |
| 384 | 231 | |
| 385 | -- YAML | |
| 386 | -- JSON | |
| 387 | - | |
| 388 | 232 | config.yaml |
| 389 | 233 | |
| 390 | 234 | ``` |
| @@ -392,19 +236,10 @@ | ||
| 392 | 236 | - provider: os |
| 393 | 237 | ``` |
| 394 | 238 | |
| 395 | -config.json | |
| 396 | - | |
| 397 | -```json | |
| 398 | -{ "contextProviders": [{ "name": "os" }] } | |
| 399 | -``` | |
| 400 | - | |
| 401 | 239 | ### Using the Model Context Protocol (MCP) in Continue |
| 402 | 240 | |
| 403 | 241 | The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then set up your configuration like this: |
| 404 | 242 | |
| 405 | -- YAML | |
| 406 | -- JSON | |
| 407 | - | |
| 408 | 243 | config.yaml |
| 409 | 244 | |
| 410 | 245 | ``` |
| @@ -417,24 +252,6 @@ | ||
| 417 | 252 | - /Users/NAME/test.db |
| 418 | 253 | ``` |
| 419 | 254 | |
| 420 | -config.json | |
| 421 | - | |
| 422 | -```json | |
| 423 | -{ | |
| 424 | - "experimental": { | |
| 425 | - "modelContextProtocolServers": [ | |
| 426 | - { | |
| 427 | - "transport": { | |
| 428 | - "type": "stdio", | |
| 429 | - "command": "uvx", | |
| 430 | - "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] | |
| 431 | - } | |
| 432 | - } | |
| 433 | - ] | |
| 434 | - } | |
| 435 | -} | |
| 436 | -``` | |
| 437 | - | |
| 438 | 255 | You'll then be able to type "@" and see "MCP" in the context providers dropdown. |
| 439 | 256 | |
| 440 | 257 | ### How to Request a New Context Provider in Continue |
modified docs/customize/deep-dives/custom-providers.mdx +71 −299
| @@ -15,251 +15,95 @@ | ||
| 15 | 15 | |
| 16 | 16 | Reference any file in your current workspace. |
| 17 | 17 | |
| 18 | -<Tabs> | |
| 19 | - <Tab title="YAML"> | |
| 20 | - ```yaml config.yaml | |
| 21 | - context: | |
| 22 | - - provider: file | |
| 23 | - ``` | |
| 24 | - </Tab> | |
| 25 | - <Tab title="JSON (Deprecated)"> | |
| 26 | - ```json config.json | |
| 27 | - { | |
| 28 | - "contextProviders": [ | |
| 29 | - { | |
| 30 | - "name": "file" | |
| 31 | - } | |
| 32 | - ] | |
| 33 | - } | |
| 34 | - ``` | |
| 35 | - </Tab> | |
| 36 | -</Tabs> | |
| 18 | +```yaml config.yaml | |
| 19 | +context: | |
| 20 | + - provider: file | |
| 21 | +``` | |
| 37 | 22 | |
| 38 | 23 | ### `@Code` |
| 39 | 24 | |
| 40 | 25 | Reference specific functions or classes from throughout your project. |
| 41 | 26 | |
| 42 | -<Tabs> | |
| 43 | - <Tab title="YAML"> | |
| 44 | - ```yaml config.yaml | |
| 45 | - context: | |
| 46 | - - provider: code | |
| 47 | - ``` | |
| 48 | - </Tab> | |
| 49 | - <Tab title="JSON (Deprecated)"> | |
| 50 | - ```json config.json | |
| 51 | - { | |
| 52 | - "contextProviders": [ | |
| 53 | - { | |
| 54 | - "name": "code" | |
| 55 | - } | |
| 56 | - ] | |
| 57 | - } | |
| 58 | - ``` | |
| 59 | - </Tab> | |
| 60 | -</Tabs> | |
| 27 | +```yaml config.yaml | |
| 28 | +context: | |
| 29 | + - provider: code | |
| 30 | +``` | |
| 61 | 31 | |
| 62 | 32 | ### `@Git Diff` |
| 63 | 33 | |
| 64 | 34 | Reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. |
| 65 | 35 | |
| 66 | -<Tabs> | |
| 67 | - <Tab title="YAML"> | |
| 68 | - ```yaml config.yaml | |
| 69 | - context: | |
| 70 | - - provider: diff | |
| 71 | - ``` | |
| 72 | - </Tab> | |
| 73 | - <Tab title="JSON (Deprecated)"> | |
| 74 | - ```json config.json | |
| 75 | - { | |
| 76 | - "contextProviders": [ | |
| 77 | - { | |
| 78 | - "name": "diff" | |
| 79 | - } | |
| 80 | - ] | |
| 81 | - } | |
| 82 | - ``` | |
| 83 | - </Tab> | |
| 84 | -</Tabs> | |
| 36 | +```yaml config.yaml | |
| 37 | +context: | |
| 38 | + - provider: diff | |
| 39 | +``` | |
| 85 | 40 | |
| 86 | 41 | ### `@Current File` |
| 87 | 42 | |
| 88 | 43 | Reference the currently open file. |
| 89 | 44 | |
| 90 | -<Tabs> | |
| 91 | - <Tab title="YAML"> | |
| 92 | - ```yaml config.yaml | |
| 93 | - context: | |
| 94 | - - provider: currentFile | |
| 95 | - ``` | |
| 96 | - </Tab> | |
| 97 | - <Tab title="JSON (Deprecated)"> | |
| 98 | - ```json config.json | |
| 99 | - { | |
| 100 | - "contextProviders": [ | |
| 101 | - { | |
| 102 | - "name": "currentFile" | |
| 103 | - } | |
| 104 | - ] | |
| 105 | - } | |
| 106 | - ``` | |
| 107 | - </Tab> | |
| 108 | -</Tabs> | |
| 45 | +```yaml config.yaml | |
| 46 | +context: | |
| 47 | + - provider: currentFile | |
| 48 | +``` | |
| 109 | 49 | |
| 110 | 50 | ### `@Terminal` |
| 111 | 51 | |
| 112 | 52 | Reference the last command you ran in your IDE's terminal and its output. |
| 113 | 53 | |
| 114 | -<Tabs> | |
| 115 | - <Tab title="YAML"> | |
| 116 | - ```yaml config.yaml | |
| 117 | - context: | |
| 118 | - - provider: terminal | |
| 119 | - ``` | |
| 120 | - </Tab> | |
| 121 | - <Tab title="JSON (Deprecated)"> | |
| 122 | - ```json config.json | |
| 123 | - { | |
| 124 | - "contextProviders": [ | |
| 125 | - { | |
| 126 | - "name": "terminal" | |
| 127 | - } | |
| 128 | - ] | |
| 129 | - } | |
| 130 | - ``` | |
| 131 | - </Tab> | |
| 132 | -</Tabs> | |
| 54 | +```yaml config.yaml | |
| 55 | +context: | |
| 56 | + - provider: terminal | |
| 57 | +``` | |
| 133 | 58 | |
| 134 | 59 | ### `@Open` |
| 135 | 60 | |
| 136 | 61 | Reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files. |
| 137 | 62 | |
| 138 | -<Tabs> | |
| 139 | - <Tab title="YAML"> | |
| 140 | - ```yaml config.yaml | |
| 141 | - context: | |
| 142 | - - provider: open | |
| 143 | - params: | |
| 144 | - onlyPinned: true | |
| 145 | - ``` | |
| 146 | - </Tab> | |
| 147 | - <Tab title="JSON (Deprecated)"> | |
| 148 | - ```json config.json | |
| 149 | - { | |
| 150 | - "contextProviders": [ | |
| 151 | - { | |
| 152 | - "name": "open", | |
| 153 | - "params": { | |
| 154 | - "onlyPinned": true | |
| 155 | - } | |
| 156 | - } | |
| 157 | - ] | |
| 158 | - } | |
| 159 | - ``` | |
| 160 | - </Tab> | |
| 161 | -</Tabs> | |
| 63 | +```yaml config.yaml | |
| 64 | +context: | |
| 65 | + - provider: open | |
| 66 | + params: | |
| 67 | + onlyPinned: true | |
| 68 | +``` | |
| 162 | 69 | |
| 163 | 70 | ### `@Clipboard` |
| 164 | 71 | |
| 165 | 72 | Reference recent clipboard items |
| 166 | 73 | |
| 167 | -<Tabs> | |
| 168 | - <Tab title="YAML"> | |
| 169 | - ```yaml config.yaml | |
| 170 | - context: | |
| 171 | - - provider: clipboard | |
| 172 | - ``` | |
| 173 | - </Tab> | |
| 174 | - <Tab title="JSON (Deprecated)"> | |
| 175 | - ```json config.json | |
| 176 | - { | |
| 177 | - "contextProviders": [ | |
| 178 | - { | |
| 179 | - "name": "clipboard" | |
| 180 | - } | |
| 181 | - ] | |
| 182 | - } | |
| 183 | - ``` | |
| 184 | - </Tab> | |
| 185 | -</Tabs> | |
| 74 | +```yaml config.yaml | |
| 75 | +context: | |
| 76 | + - provider: clipboard | |
| 77 | +``` | |
| 186 | 78 | |
| 187 | 79 | ### `@Tree` |
| 188 | 80 | |
| 189 | 81 | Reference the structure of your current workspace. |
| 190 | 82 | |
| 191 | -<Tabs> | |
| 192 | - <Tab title="YAML"> | |
| 193 | - ```yaml config.yaml | |
| 194 | - context: | |
| 195 | - - provider: tree | |
| 196 | - ``` | |
| 197 | - </Tab> | |
| 198 | - <Tab title="JSON (Deprecated)"> | |
| 199 | - ```json config.json | |
| 200 | - { | |
| 201 | - "contextProviders": [ | |
| 202 | - { | |
| 203 | - "name": "tree" | |
| 204 | - } | |
| 205 | - ] | |
| 206 | - } | |
| 207 | - ``` | |
| 208 | - </Tab> | |
| 209 | -</Tabs> | |
| 83 | +```yaml config.yaml | |
| 84 | +context: | |
| 85 | + - provider: tree | |
| 86 | +``` | |
| 210 | 87 | |
| 211 | 88 | ### `@Problems` |
| 212 | 89 | |
| 213 | 90 | Get Problems from the current file. |
| 214 | 91 | |
| 215 | -<Tabs> | |
| 216 | - <Tab title="YAML"> | |
| 217 | - ```yaml config.yaml | |
| 218 | - context: | |
| 219 | - - provider: problems | |
| 220 | - ``` | |
| 221 | - </Tab> | |
| 222 | - <Tab title="JSON (Deprecated)"> | |
| 223 | - ```json config.json | |
| 224 | - { | |
| 225 | - "contextProviders": [ | |
| 226 | - { | |
| 227 | - "name": "problems" | |
| 228 | - } | |
| 229 | - ] | |
| 230 | - } | |
| 231 | - ``` | |
| 232 | - </Tab> | |
| 233 | -</Tabs> | |
| 92 | +```yaml config.yaml | |
| 93 | +context: | |
| 94 | + - provider: problems | |
| 95 | +``` | |
| 234 | 96 | |
| 235 | 97 | ### `@Debugger` |
| 236 | 98 | |
| 237 | 99 | Reference the contents of the local variables in the debugger. Currently only available in VS Code. |
| 238 | 100 | |
| 239 | -<Tabs> | |
| 240 | - <Tab title="YAML"> | |
| 241 | - ```yaml config.yaml | |
| 242 | - context: | |
| 243 | - - provider: debugger | |
| 244 | - params: | |
| 245 | - stackDepth: 3 | |
| 246 | - ``` | |
| 247 | - </Tab> | |
| 248 | - <Tab title="JSON (Deprecated)"> | |
| 249 | - ```json config.json | |
| 250 | - { | |
| 251 | - "contextProviders": [ | |
| 252 | - { | |
| 253 | - "name": "debugger", | |
| 254 | - "params": { | |
| 255 | - "stackDepth": 3 | |
| 256 | - } | |
| 257 | - } | |
| 258 | - ] | |
| 259 | - } | |
| 260 | - ``` | |
| 261 | - </Tab> | |
| 262 | -</Tabs> | |
| 101 | +```yaml config.yaml | |
| 102 | +context: | |
| 103 | + - provider: debugger | |
| 104 | + params: | |
| 105 | + stackDepth: 3 | |
| 106 | +``` | |
| 263 | 107 | |
| 264 | 108 | Uses the top _n_ levels (defaulting to 3) of the call stack for that thread. |
| 265 | 109 | |
| @@ -269,30 +113,12 @@ | ||
| 269 | 113 | |
| 270 | 114 | `includeSignatures` params can be set to false to exclude signatures. This could be necessary for large codebases and/or to reduce context size significantly. Signatures will not be included if indexing is disabled. |
| 271 | 115 | |
| 272 | -<Tabs> | |
| 273 | - <Tab title="YAML"> | |
| 274 | - ```yaml config.yaml | |
| 275 | - context: | |
| 276 | - - provider: repo-map | |
| 277 | - params: | |
| 278 | - includeSignatures: false # default true | |
| 279 | - ``` | |
| 280 | - </Tab> | |
| 281 | - <Tab title="JSON (Deprecated)"> | |
| 282 | - ```json config.json | |
| 283 | - { | |
| 284 | - "contextProviders": [ | |
| 285 | - { | |
| 286 | - "name": "repo-map", | |
| 287 | - "params": { | |
| 288 | - "includeSignatures": false // default true | |
| 289 | - } | |
| 290 | - } | |
| 291 | - ] | |
| 292 | - } | |
| 293 | - ``` | |
| 294 | - </Tab> | |
| 295 | -</Tabs> | |
| 116 | +```yaml config.yaml | |
| 117 | +context: | |
| 118 | + - provider: repo-map | |
| 119 | + params: | |
| 120 | + includeSignatures: false # default true | |
| 121 | +``` | |
| 296 | 122 | |
| 297 | 123 | Provides a list of files and the call signatures of top-level classes, functions, and methods in those files. This helps the model better understand how a particular piece of code relates to the rest of the codebase. |
| 298 | 124 | |
| @@ -304,56 +130,23 @@ | ||
| 304 | 130 | |
| 305 | 131 | Reference the architecture and platform of your current operating system. |
| 306 | 132 | |
| 307 | -<Tabs> | |
| 308 | - <Tab title="YAML"> | |
| 309 | - ```yaml config.yaml | |
| 310 | - context: | |
| 311 | - - provider: os | |
| 312 | - ``` | |
| 313 | - </Tab> | |
| 314 | - <Tab title="JSON (Deprecated)"> | |
| 315 | - ```json config.json | |
| 316 | - { | |
| 317 | - "contextProviders": [ | |
| 318 | - { | |
| 319 | - "name": "os" | |
| 320 | - } | |
| 321 | - ] | |
| 322 | - } | |
| 323 | - ``` | |
| 324 | - </Tab> | |
| 325 | -</Tabs> | |
| 133 | +```yaml config.yaml | |
| 134 | +context: | |
| 135 | + - provider: os | |
| 136 | +``` | |
| 326 | 137 | |
| 327 | 138 | ### `@HTTP` |
| 328 | 139 | |
| 329 | 140 | The HttpContextProvider makes a POST request to the url passed in the configuration. The server must return 200 OK with a ContextItem object or an array of ContextItems. |
| 330 | 141 | |
| 331 | -<Tabs> | |
| 332 | - <Tab title="YAML"> | |
| 333 | - ```yaml config.yaml | |
| 334 | - context: | |
| 335 | - - provider: http | |
| 336 | - params: | |
| 337 | - url: "https://api.example.com/v1/users" | |
| 338 | - headers: | |
| 339 | - - Authorization: "Bearer <token>" | |
| 340 | - ``` | |
| 341 | - </Tab> | |
| 342 | - <Tab title="JSON (Deprecated)"> | |
| 343 | - ```json config.json | |
| 344 | - { | |
| 345 | - "contextProviders": [ | |
| 346 | - { | |
| 347 | - "name": "http", | |
| 348 | - "params": { | |
| 349 | - "url": "https://api.example.com/v1/users" | |
| 350 | - } | |
| 351 | - } | |
| 352 | - ] | |
| 353 | - } | |
| 354 | - ``` | |
| 355 | - </Tab> | |
| 356 | -</Tabs> | |
| 142 | +```yaml config.yaml | |
| 143 | +context: | |
| 144 | + - provider: http | |
| 145 | + params: | |
| 146 | + url: "https://api.example.com/v1/users" | |
| 147 | + headers: | |
| 148 | + - Authorization: "Bearer <token>" | |
| 149 | +``` | |
| 357 | 150 | |
| 358 | 151 | The receiving URL should expect to receive the following parameters: |
| 359 | 152 | |
| @@ -375,36 +168,15 @@ | ||
| 375 | 168 | |
| 376 | 169 | The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider. Read their [quickstart](https://modelcontextprotocol.io/quickstart) to learn how to set up a local server and then set up your configuration like this: |
| 377 | 170 | |
| 378 | -<Tabs> | |
| 379 | - <Tab title="YAML"> | |
| 380 | - ```yaml config.yaml | |
| 381 | - mcpServers: | |
| 382 | - - name: My MCP Server | |
| 383 | - command: uvx | |
| 384 | - args: | |
| 385 | - - mcp-server-sqlite | |
| 386 | - - --db-path | |
| 387 | - - /Users/NAME/test.db | |
| 388 | - ``` | |
| 389 | - </Tab> | |
| 390 | - <Tab title="JSON (Deprecated)"> | |
| 391 | - ```json config.json | |
| 392 | - { | |
| 393 | - "experimental": { | |
| 394 | - "modelContextProtocolServers": [ | |
| 395 | - { | |
| 396 | - "transport": { | |
| 397 | - "type": "stdio", | |
| 398 | - "command": "uvx", | |
| 399 | - "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] | |
| 400 | - } | |
| 401 | - } | |
| 402 | - ] | |
| 403 | - } | |
| 404 | - } | |
| 405 | - ``` | |
| 406 | - </Tab> | |
| 407 | -</Tabs> | |
| 171 | +```yaml config.yaml | |
| 172 | +mcpServers: | |
| 173 | + - name: My MCP Server | |
| 174 | + command: uvx | |
| 175 | + args: | |
| 176 | + - mcp-server-sqlite | |
| 177 | + - --db-path | |
| 178 | + - /Users/NAME/test.db | |
| 179 | +``` | |
| 408 | 180 | |
| 409 | 181 | You'll then be able to type "@" and see "MCP" in the context providers dropdown. |
| 410 | 182 |
modified docs/customize/model-roles/chat.mdx +0 −174
| @@ -36,20 +36,6 @@ | ||
| 36 | 36 | apiKey: <YOUR_ANTHROPIC_API_KEY> |
| 37 | 37 | ``` |
| 38 | 38 | </Tab> |
| 39 | - <Tab title="JSON"> | |
| 40 | - ```json title="config.json" | |
| 41 | - { | |
| 42 | - "models": [ | |
| 43 | - { | |
| 44 | - "title": "Claude Opus 4.1", | |
| 45 | - "provider": "anthropic", | |
| 46 | - "model": "claude-4-1-opus", | |
| 47 | - "apiKey": "<YOUR_ANTHROPIC_API_KEY>" | |
| 48 | - } | |
| 49 | - ] | |
| 50 | - } | |
| 51 | - ``` | |
| 52 | - </Tab> | |
| 53 | 39 | </Tabs> |
| 54 | 40 | |
| 55 | 41 | ### Gemma from Google DeepMind |
| @@ -88,37 +74,6 @@ | ||
| 88 | 74 | </Tab> |
| 89 | 75 | </Tabs> |
| 90 | 76 | </Tab> |
| 91 | - <Tab title="JSON"> | |
| 92 | - <Tabs> | |
| 93 | - <Tab title="Ollama"> | |
| 94 | - ```json title="config.json" | |
| 95 | - { | |
| 96 | - "models": [ | |
| 97 | - { | |
| 98 | - "title": "Gemma 3 27B", | |
| 99 | - "provider": "ollama", | |
| 100 | - "model": "gemma3:27b" | |
| 101 | - } | |
| 102 | - ] | |
| 103 | - } | |
| 104 | - ``` | |
| 105 | - </Tab> | |
| 106 | - <Tab title="Together"> | |
| 107 | - ```json title="config.json" | |
| 108 | - { | |
| 109 | - "models": [ | |
| 110 | - { | |
| 111 | - "title": "Gemma 3 27B", | |
| 112 | - "provider": "together", | |
| 113 | - "model": "google/gemma-2-27b-it", | |
| 114 | - "apiKey": "<YOUR_TOGETHER_API_KEY>" | |
| 115 | - } | |
| 116 | - ] | |
| 117 | - } | |
| 118 | - ``` | |
| 119 | - </Tab> | |
| 120 | - </Tabs> | |
| 121 | - </Tab> | |
| 122 | 77 | </Tabs> |
| 123 | 78 | |
| 124 | 79 | ### GPT-4o from OpenAI |
| @@ -138,20 +93,6 @@ | ||
| 138 | 93 | apiKey: <YOUR_OPENAI_API_KEY> |
| 139 | 94 | ``` |
| 140 | 95 | </Tab> |
| 141 | - <Tab title="JSON"> | |
| 142 | - ```json title="config.json" | |
| 143 | - { | |
| 144 | - "models": [ | |
| 145 | - { | |
| 146 | - "title": "GPT-4o", | |
| 147 | - "provider": "openai", | |
| 148 | - "model": "", | |
| 149 | - "apiKey": "<YOUR_OPENAI_API_KEY>" | |
| 150 | - } | |
| 151 | - ] | |
| 152 | - } | |
| 153 | - ``` | |
| 154 | - </Tab> | |
| 155 | 96 | </Tabs> |
| 156 | 97 | |
| 157 | 98 | ### Grok-2 from xAI |
| @@ -171,20 +112,6 @@ | ||
| 171 | 112 | apiKey: <YOUR_XAI_API_KEY> |
| 172 | 113 | ``` |
| 173 | 114 | </Tab> |
| 174 | - <Tab title="JSON"> | |
| 175 | - ```json title="config.json" | |
| 176 | - { | |
| 177 | - "models": [ | |
| 178 | - { | |
| 179 | - "title": "Grok-2", | |
| 180 | - "provider": "xAI", | |
| 181 | - "model": "grok-2-latest", | |
| 182 | - "apiKey": "<YOUR_XAI_API_KEY>" | |
| 183 | - } | |
| 184 | - ] | |
| 185 | - } | |
| 186 | - ``` | |
| 187 | - </Tab> | |
| 188 | 115 | </Tabs> |
| 189 | 116 | |
| 190 | 117 | ### Gemini 2.0 Flash from Google |
| @@ -204,20 +131,6 @@ | ||
| 204 | 131 | apiKey: <YOUR_GEMINI_API_KEY> |
| 205 | 132 | ``` |
| 206 | 133 | </Tab> |
| 207 | - <Tab title="JSON"> | |
| 208 | - ```json title="config.json" | |
| 209 | - { | |
| 210 | - "models": [ | |
| 211 | - { | |
| 212 | - "title": "Gemini 2.0 Flash", | |
| 213 | - "provider": "gemini", | |
| 214 | - "model": "gemini-2.0-flash", | |
| 215 | - "apiKey": "<YOUR_GEMINI_API_KEY>" | |
| 216 | - } | |
| 217 | - ] | |
| 218 | - } | |
| 219 | - ``` | |
| 220 | - </Tab> | |
| 221 | 134 | </Tabs> |
| 222 | 135 | |
| 223 | 136 | ## Local, offline experience |
| @@ -268,49 +181,6 @@ | ||
| 268 | 181 | </Tab> |
| 269 | 182 | </Tabs> |
| 270 | 183 | </Tab> |
| 271 | - <Tab title="JSON"> | |
| 272 | - <Tabs> | |
| 273 | - <Tab title="Ollama"> | |
| 274 | - ```json title="config.json" | |
| 275 | - { | |
| 276 | - "models": [ | |
| 277 | - { | |
| 278 | - "title": "Llama 3.1 8B", | |
| 279 | - "provider": "ollama", | |
| 280 | - "model": "llama3.1:8b" | |
| 281 | - } | |
| 282 | - ] | |
| 283 | - } | |
| 284 | - ``` | |
| 285 | - </Tab> | |
| 286 | - <Tab title="LM Studio"> | |
| 287 | - ```json title="config.json" | |
| 288 | - { | |
| 289 | - "models": [ | |
| 290 | - { | |
| 291 | - "title": "Llama 3.1 8B", | |
| 292 | - "provider": "lmstudio", | |
| 293 | - "model": "llama3.1-8b" | |
| 294 | - } | |
| 295 | - ] | |
| 296 | - } | |
| 297 | - ``` | |
| 298 | - </Tab> | |
| 299 | - <Tab title="Msty"> | |
| 300 | - ```json title="config.json" | |
| 301 | - { | |
| 302 | - "models": [ | |
| 303 | - { | |
| 304 | - "title": "Llama 3.1 8B", | |
| 305 | - "provider": "msty", | |
| 306 | - "model": "llama3.1-8b" | |
| 307 | - } | |
| 308 | - ] | |
| 309 | - } | |
| 310 | - ``` | |
| 311 | - </Tab> | |
| 312 | - </Tabs> | |
| 313 | - </Tab> | |
| 314 | 184 | </Tabs> |
| 315 | 185 | |
| 316 | 186 | ### DeepSeek Coder 2 16B |
| @@ -357,50 +227,6 @@ | ||
| 357 | 227 | </Tab> |
| 358 | 228 | </Tabs> |
| 359 | 229 | </Tab> |
| 360 | - <Tab title="JSON"> | |
| 361 | - <Tabs> | |
| 362 | - <Tab title="Ollama"> | |
| 363 | - ```json title="config.json" | |
| 364 | - { | |
| 365 | - "models": [ | |
| 366 | - { | |
| 367 | - "title": "DeepSeek Coder 2 16B", | |
| 368 | - "provider": "ollama", | |
| 369 | - "model": "deepseek-coder-v2:16b", | |
| 370 | - "apiBase": "http://localhost:11434" | |
| 371 | - } | |
| 372 | - ] | |
| 373 | - } | |
| 374 | - ``` | |
| 375 | - </Tab> | |
| 376 | - <Tab title="LM Studio"> | |
| 377 | - ```json title="config.json" | |
| 378 | - { | |
| 379 | - "models": [ | |
| 380 | - { | |
| 381 | - "title": "DeepSeek Coder 2 16B", | |
| 382 | - "provider": "lmstudio", | |
| 383 | - "model": "deepseek-coder-v2:16b" | |
| 384 | - } | |
| 385 | - ] | |
| 386 | - } | |
| 387 | - ``` | |
| 388 | - </Tab> | |
| 389 | - <Tab title="Msty"> | |
| 390 | - ```json title="config.json" | |
| 391 | - { | |
| 392 | - "models": [ | |
| 393 | - { | |
| 394 | - "title": "DeepSeek Coder 2 16B", | |
| 395 | - "provider": "msty", | |
| 396 | - "model": "deepseek-coder-v2:16b" | |
| 397 | - } | |
| 398 | - ] | |
| 399 | - } | |
| 400 | - ``` | |
| 401 | - </Tab> | |
| 402 | - </Tabs> | |
| 403 | - </Tab> | |
| 404 | 230 | </Tabs> |
| 405 | 231 | |
| 406 | 232 | ## Other experiences |
modified docs/customize/model-roles/edit.mdx +9 −32
| @@ -10,38 +10,15 @@ | ||
| 10 | 10 | |
| 11 | 11 | In Continue, you can add `edit` to a model's roles to specify that it can be used for Edit requests. If no edit models are specified, the selected `chat` model is used. |
| 12 | 12 | |
| 13 | -<Tabs> | |
| 14 | - <Tab title="YAML"> | |
| 15 | - Use model roles. | |
| 16 | - ```yaml title="config.yaml" | |
| 17 | - models: | |
| 18 | - - name: Claude 3.5 Sonnet | |
| 19 | - provider: anthropic | |
| 20 | - model: claude-3-5-sonnet-latest | |
| 21 | - apiKey: <YOUR_ANTHROPIC_API_KEY> | |
| 22 | - roles: | |
| 23 | - - edit | |
| 24 | - ``` | |
| 25 | - </Tab> | |
| 26 | - <Tab title="JSON"> | |
| 27 | - Set the `experimental.modelRoles.inlineEdit` property in `config.json`. | |
| 28 | - ```json title="config.json" | |
| 29 | - { | |
| 30 | - "models": { | |
| 31 | - "name": "Claude 3.5 Sonnet", | |
| 32 | - "provider": "anthropic", | |
| 33 | - "model": "claude-3-5-sonnet-latest", | |
| 34 | - "apiKey": "<YOUR_ANTHROPIC_API_KEY>" | |
| 35 | - }, | |
| 36 | - "experimental": { | |
| 37 | - "modelRoles": { | |
| 38 | - "inlineEdit": "Claude 3.5 Sonnet", | |
| 39 | - } | |
| 40 | - } | |
| 41 | - } | |
| 42 | - ``` | |
| 43 | - </Tab> | |
| 44 | -</Tabs> | |
| 13 | +```yaml title="config.yaml" | |
| 14 | +models: | |
| 15 | + - name: Claude 4 Sonnet | |
| 16 | + provider: anthropic | |
| 17 | + model: claude-3-5-sonnet-latest | |
| 18 | + apiKey: <YOUR_ANTHROPIC_API_KEY> | |
| 19 | + roles: | |
| 20 | + - edit | |
| 21 | +``` | |
| 45 | 22 | |
| 46 | 23 | Explore edit models in [the hub](https://hub.continue.dev/explore/models?roles=edit). Generally, our recommendations for Edit overlap with recommendations for Chat. |
| 47 | 24 |
modified docs/customize/model-roles/reranking.mdx +5 −53
| @@ -23,7 +23,10 @@ | ||
| 23 | 23 | |
| 24 | 24 | <Tabs> |
| 25 | 25 | <Tab title="Hub"> |
| 26 | - [Voyage Rerank 2 Block](https://hub.continue.dev/voyageai/rerank-2) | |
| 26 | + ```yaml title="config.yaml" | |
| 27 | + models: | |
| 28 | + - uses: voyageai/rerank-2 | |
| 29 | + ``` | |
| 27 | 30 | </Tab> |
| 28 | 31 | <Tab title="YAML"> |
| 29 | 32 | ```yaml title="config.yaml" |
| @@ -36,19 +39,6 @@ | ||
| 36 | 39 | - rerank |
| 37 | 40 | ``` |
| 38 | 41 | </Tab> |
| 39 | - <Tab title="JSON"> | |
| 40 | - ```json title="config.json" | |
| 41 | - { | |
| 42 | - "reranker": { | |
| 43 | - "name": "voyage", | |
| 44 | - "params": { | |
| 45 | - "model": "rerank-2", | |
| 46 | - "apiKey": "<YOUR_VOYAGE_API_KEY>" | |
| 47 | - } | |
| 48 | - } | |
| 49 | - } | |
| 50 | - ``` | |
| 51 | - </Tab> | |
| 52 | 42 | </Tabs> |
| 53 | 43 | |
| 54 | 44 | ### Cohere |
| @@ -71,19 +61,6 @@ | ||
| 71 | 61 | - rerank |
| 72 | 62 | ``` |
| 73 | 63 | </Tab> |
| 74 | - <Tab title="JSON"> | |
| 75 | - ```json title="config.json" | |
| 76 | - { | |
| 77 | - "reranker": { | |
| 78 | - "name": "cohere", | |
| 79 | - "params": { | |
| 80 | - "model": "rerank-english-v3.0", | |
| 81 | - "apiKey": "<YOUR_COHERE_API_KEY>" | |
| 82 | - } | |
| 83 | - } | |
| 84 | - } | |
| 85 | - ``` | |
| 86 | - </Tab> | |
| 87 | 64 | </Tabs> |
| 88 | 65 | |
| 89 | 66 | ### LLM |
| @@ -105,21 +82,9 @@ | ||
| 105 | 82 | - rerank |
| 106 | 83 | ``` |
| 107 | 84 | </Tab> |
| 108 | - <Tab title="JSON"> | |
| 109 | - ```json title="config.json" | |
| 110 | - { | |
| 111 | - "reranker": { | |
| 112 | - "name": "llm", | |
| 113 | - "params": { | |
| 114 | - "modelTitle": "My Model Title" | |
| 115 | - } | |
| 116 | - } | |
| 117 | - } | |
| 118 | - ``` | |
| 119 | - </Tab> | |
| 120 | 85 | </Tabs> |
| 121 | 86 | |
| 122 | -The `"modelTitle"` field must match one of the models in your "models" array in config.json. | |
| 87 | + | |
| 123 | 88 | |
| 124 | 89 | ### Text Embeddings Inference |
| 125 | 90 | |
| @@ -142,17 +107,4 @@ | ||
| 142 | 107 | - rerank |
| 143 | 108 | ``` |
| 144 | 109 | </Tab> |
| 145 | - <Tab title="JSON"> | |
| 146 | - ```json title="config.json" | |
| 147 | - { | |
| 148 | - "reranker": { | |
| 149 | - "name": "huggingface-tei", | |
| 150 | - "params": { | |
| 151 | - "apiBase": "http://localhost:8080", | |
| 152 | - "apiKey": "<YOUR_TEI_API_KEY>" | |
| 153 | - } | |
| 154 | - } | |
| 155 | - } | |
| 156 | - ``` | |
| 157 | - </Tab> | |
| 158 | 110 | </Tabs> |
modified docs/docs.json +9 −1
| @@ -233,7 +233,7 @@ | ||
| 233 | 233 | "guides/codebase-documentation-awareness", |
| 234 | 234 | "guides/cli", |
| 235 | 235 | "guides/continuous-ai", |
| 236 | - "guides/posthog-github-continuous-ai", | |
| 236 | + "guides/snyk-mcp-continue-cookbook", | |
| 237 | 237 | "guides/continuous-ai-readiness-assessment", |
| 238 | 238 | "guides/plan-mode-guide", |
| 239 | 239 | "guides/ollama-guide", |
| @@ -242,6 +242,14 @@ | ||
| 242 | 242 | "guides/custom-code-rag", |
| 243 | 243 | "guides/how-to-self-host-a-model" |
| 244 | 244 | ] |
| 245 | + }, | |
| 246 | + { | |
| 247 | + "group": "Cookbooks", | |
| 248 | + "icon": "book-open-cover", | |
| 249 | + "pages": [ | |
| 250 | + "guides/posthog-github-continuous-ai", | |
| 251 | + "guides/netlify-mcp-continuous-deployment" | |
| 252 | + ] | |
| 245 | 253 | } |
| 246 | 254 | ] |
| 247 | 255 | }, |
modified docs/guides/instinct.mdx +2 −2
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | [HuggingFace model card](https://huggingface.co/continuedev/instinct). |
| 10 | 10 | </Warning> |
| 11 | 11 | |
| 12 | -We recently released Instinct, a state-of-the-art open Next Edit model. Robustly fine-tuned from Qwen2.5-Coder-7B, Instinct intelligently predicts your next move to keep you in flow. To learn more about the model, check out [our blog post](https://blog.continue.dev). | |
| 12 | +We recently released Instinct, a state-of-the-art open Next Edit model. Robustly fine-tuned from Qwen2.5-Coder-7B, Instinct intelligently predicts your next move to keep you in flow. To learn more about the model, check out [our blog post](https://blog.continue.dev/instinct/). | |
| 13 | 13 | |
| 14 | 14 | <Frame> |
| 15 | 15 | <img src="/images/instinct.gif" /> |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | |
| 18 | 18 | ### 1. Install Ollama |
| 19 | 19 | |
| 20 | -If you haven't already installed Ollama, see our guide [here](./ollama-guide.mdx). | |
| 20 | +If you haven't already installed Ollama, see our guide [here](./ollama-guide). | |
| 21 | 21 | |
| 22 | 22 | ### 2. Download Instinct |
| 23 | 23 |
added docs/guides/netlify-mcp-continuous-deployment.mdx +614 −0
| @@ -0,0 +1,614 @@ | ||
| 1 | +--- | |
| 2 | +title: "Netlify Performance Optimization Cookbook" | |
| 3 | +description: "Optimize web performance with A/B testing, automated monitoring, and data-driven improvements using Netlify MCP and Continue." | |
| 4 | +sidebarTitle: "Using Netlify MCP for Performance Optimization" | |
| 5 | +--- | |
| 6 | + | |
| 7 | +<Card title="Ship Faster Code, Not Slower Sites" icon="gauge-high"> | |
| 8 | + Use AI to automatically monitor performance metrics, run A/B tests between | |
| 9 | + branches, and get actionable optimization suggestions based on real user data | |
| 10 | + from Netlify Analytics | |
| 11 | +</Card> | |
| 12 | + | |
| 13 | +<Info> | |
| 14 | + **Did You Know?** Netlify is more than just static hosting! It offers: | |
| 15 | + - [Split Testing](https://docs.netlify.com/site-deploys/split-testing/) for A/B testing branches | |
| 16 | + - [Analytics](https://docs.netlify.com/analytics/get-started/) with Core Web Vitals tracking | |
| 17 | + - [Edge Functions](https://docs.netlify.com/edge-functions/overview/) for personalization at the edge | |
| 18 | + - [Build Plugins](https://docs.netlify.com/integrations/build-plugins/) ecosystem with 100+ integrations | |
| 19 | + - [Forms](https://docs.netlify.com/forms/setup/) with built-in spam protection | |
| 20 | + - [Identity](https://docs.netlify.com/visitor-access/identity/) for user authentication | |
| 21 | + - [Large Media](https://docs.netlify.com/large-media/overview/) for Git LFS support | |
| 22 | + | |
| 23 | +This guide shows you how to leverage these features through natural language with Continue CLI! | |
| 24 | + | |
| 25 | +</Info> | |
| 26 | + | |
| 27 | +## What You'll Learn | |
| 28 | + | |
| 29 | +This cookbook teaches you to: | |
| 30 | + | |
| 31 | +- Run [A/B tests](https://docs.netlify.com/site-deploys/split-testing/) between branches to measure performance impact | |
| 32 | +- Monitor [Core Web Vitals](https://docs.netlify.com/analytics/get-started/#core-web-vitals) and build performance metrics | |
| 33 | +- Automatically block deploys that degrade performance using [Deploy Contexts](https://docs.netlify.com/site-deploys/overview/#deploy-contexts) | |
| 34 | +- Optimize build times with [Build Plugins](https://docs.netlify.com/integrations/build-plugins/) and bundle sizes with AI assistance | |
| 35 | + | |
| 36 | +## Prerequisites | |
| 37 | + | |
| 38 | +- GitHub repository with a web project | |
| 39 | +- [Netlify account](https://netlify.com) (free tier works) | |
| 40 | +- Node.js 22+ installed (required for Netlify) | |
| 41 | +- [Continue CLI](https://docs.continue.dev/guides/cli) (`npm i -g @continuedev/cli`) | |
| 42 | +- [Netlify MCP](https://hub.continue.dev/netlify/netlify-mcp) configured | |
| 43 | +- [Netlify Development Rules](https://hub.continue.dev/netlify/netlify-development) (recommended) | |
| 44 | + | |
| 45 | +## Quick Setup | |
| 46 | + | |
| 47 | +<Steps> | |
| 48 | + <Step title="Install Continue CLI"> | |
| 49 | + ```bash | |
| 50 | + npm i -g @continuedev/cli | |
| 51 | + ``` | |
| 52 | + </Step> | |
| 53 | + | |
| 54 | +<Step title="Configure Netlify MCP"> | |
| 55 | + 1. Install Netlify CLI: `npm i -g netlify-cli` 2. Authenticate with Netlify: | |
| 56 | + `netlify login` 3. Visit [Netlify MCP on Continue | |
| 57 | + Hub](https://hub.continue.dev/netlify/netlify-mcp) 4. Follow the configuration | |
| 58 | + instructions for your editor | |
| 59 | +</Step> | |
| 60 | + | |
| 61 | + <Step title="Add Development Rules"> | |
| 62 | + Install the [Netlify Development Rules](https://hub.continue.dev/netlify/netlify-development) bundle for best practices: | |
| 63 | + | |
| 64 | + 1. Visit the bundle page on Continue Hub | |
| 65 | + 2. Click **"Install Rules"** | |
| 66 | + 3. Rules automatically apply to your agent | |
| 67 | + | |
| 68 | + </Step> | |
| 69 | + | |
| 70 | + <Step title="Verify Setup"> | |
| 71 | + Test the connection with cn CLI: | |
| 72 | + | |
| 73 | + ```bash | |
| 74 | + cn | |
| 75 | + # Then in TUI mode: | |
| 76 | + "Check my Netlify auth and list sites" | |
| 77 | + ``` | |
| 78 | + | |
| 79 | + </Step> | |
| 80 | +</Steps> | |
| 81 | + | |
| 82 | +<Info> | |
| 83 | + The Netlify Development Rules bundle includes guardrails for: - Proper | |
| 84 | + `.gitignore` configuration - Function structure and placement - Edge function | |
| 85 | + constraints - Local development best practices | |
| 86 | +</Info> | |
| 87 | + | |
| 88 | +## Performance Optimization Steps | |
| 89 | + | |
| 90 | +### Step 1: Baseline Performance Metrics | |
| 91 | + | |
| 92 | +Establish your current performance baseline using cn CLI: | |
| 93 | + | |
| 94 | +```bash | |
| 95 | +# Start cn in TUI mode | |
| 96 | +cn | |
| 97 | + | |
| 98 | +# Then ask: | |
| 99 | +"Show my site's Core Web Vitals and build times" | |
| 100 | +``` | |
| 101 | + | |
| 102 | +<Tip> | |
| 103 | + **Test in Plan Mode First**: Before making performance optimizations that | |
| 104 | + might affect your site, test your prompts in plan mode (see the [Plan Mode | |
| 105 | + Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes). This | |
| 106 | + shows you what the agent will do without executing it. For example: `"Set up | |
| 107 | + A/B testing between main and feature branch with performance monitoring"` | |
| 108 | +</Tip> | |
| 109 | + | |
| 110 | +<Info> | |
| 111 | + | |
| 112 | + Netlify automatically tracks: | |
| 113 | + - **Build Performance**: Compile times, cache | |
| 114 | + hits | |
| 115 | + - **Runtime Performance**: Core Web Vitals, Time to Interactive | |
| 116 | + - **Resource Usage**: Bandwidth, function execution times | |
| 117 | + | |
| 118 | +</Info> | |
| 119 | + | |
| 120 | +### Step 2: A/B Test Branch Performance | |
| 121 | + | |
| 122 | +Compare performance between branches: | |
| 123 | + | |
| 124 | +```bash | |
| 125 | +# In cn TUI mode: | |
| 126 | +"Set up A/B test between main and feature branch on Netlify: | |
| 127 | +- Split traffic 50/50 between branches | |
| 128 | +- Track Core Web Vitals for each variant | |
| 129 | +- Monitor conversion metrics and bounce rate | |
| 130 | +- Enable analytics to measure performance impact | |
| 131 | +- Configure cookie-based visitor persistence | |
| 132 | +- Set test duration for 1000 unique visitors | |
| 133 | +- Auto-conclude test when statistical significance reached | |
| 134 | +Report winner based on performance + conversion metrics" | |
| 135 | +``` | |
| 136 | + | |
| 137 | +<Info> | |
| 138 | + **Enhanced Analytics**: Combine Netlify's A/B testing with PostHog session | |
| 139 | + recordings to understand not just which variant performs better, but why users | |
| 140 | + behave differently. See our [PostHog session analysis | |
| 141 | + guide](/guides/posthog-github-continuous-ai) to set up session tracking and | |
| 142 | + create a complete continuous AI analytics workflow. | |
| 143 | +</Info> | |
| 144 | + | |
| 145 | +### Step 3: Advanced Build Optimization with Netlify | |
| 146 | + | |
| 147 | +Leverage Netlify's powerful build features to dramatically reduce build times: | |
| 148 | + | |
| 149 | +```bash | |
| 150 | +# In cn TUI mode: | |
| 151 | +"Optimize my Netlify build performance using these features: | |
| 152 | + | |
| 153 | +1. Enable Netlify Cache Plugin for dependency caching | |
| 154 | + - Configure @netlify/plugin-cache for node_modules | |
| 155 | + - Set up custom cache directories for .next/cache or .nuxt | |
| 156 | + - Enable Gatsby's incremental builds if applicable | |
| 157 | + | |
| 158 | +2. Set up Build Plugins from Netlify's ecosystem: | |
| 159 | + - Install @netlify/plugin-lighthouse for performance monitoring | |
| 160 | + - Add netlify-plugin-checklinks to prevent broken links | |
| 161 | + - Configure netlify-plugin-submit-sitemap for SEO | |
| 162 | + | |
| 163 | +3. Implement Conditional Builds: | |
| 164 | + - Skip builds when only docs change (ignore: /docs/**) | |
| 165 | + - Use build.ignore script for custom logic | |
| 166 | + - Set up monorepo-specific build triggers | |
| 167 | + | |
| 168 | +4. Configure concurrent builds for monorepos | |
| 169 | + - Set base directory per package | |
| 170 | + - Use pnpm workspaces or yarn workspaces | |
| 171 | + | |
| 172 | +Show me the netlify.toml configuration and explain each optimization" | |
| 173 | +``` | |
| 174 | + | |
| 175 | +<Info> | |
| 176 | + **Netlify Build Features You're Getting**: | |
| 177 | + - [Build Caching](https://docs.netlify.com/configure-builds/build-caching/) - Persist dependencies between builds | |
| 178 | + - [Build Plugins](https://docs.netlify.com/integrations/build-plugins/) - Extend build process with 100+ plugins | |
| 179 | + - [Conditional Builds](https://docs.netlify.com/configure-builds/ignore-builds/) - Skip unnecessary builds | |
| 180 | + - [Monorepo Support](https://docs.netlify.com/configure-builds/monorepos/) - Optimize multi-package repos | |
| 181 | + | |
| 182 | +These features can reduce build times by 50-70% for most projects! | |
| 183 | + | |
| 184 | +</Info> | |
| 185 | + | |
| 186 | +<Tip> | |
| 187 | + **Discover more optimization prompts!** The Netlify community has documented dozens of build optimization strategies in their [Support Guide: How can I optimize my Netlify build time](https://answers.netlify.com/t/support-guide-how-can-i-optimize-my-netlify-build-time/3907). | |
| 188 | + | |
| 189 | + Use this guide as inspiration for cn CLI prompts not covered in this cookbook, such as: | |
| 190 | + - `"Configure my builds to skip Dependabot PRs automatically"` | |
| 191 | + - `"Set up custom ignore patterns for documentation-only changes"` | |
| 192 | + - `"Optimize my Contentful webhooks to prevent duplicate builds"` | |
| 193 | + - `"Show me how to use build hooks instead of automatic git triggers"` | |
| 194 | + - `"Help me choose between Astro and Hugo based on build performance"` | |
| 195 | + | |
| 196 | + The community guide contains real-world scenarios that you can turn into AI-assisted solutions - just describe what you want to achieve and let cn CLI handle the implementation! | |
| 197 | +</Tip> | |
| 198 | + | |
| 199 | +### Step 4: Bundle Analysis with Netlify's Built-in Tools | |
| 200 | + | |
| 201 | +Use Netlify's bundle analyzer and optimization features: | |
| 202 | + | |
| 203 | +```bash | |
| 204 | +# In cn TUI mode: | |
| 205 | +"Analyze and optimize my bundle using Netlify's tools: | |
| 206 | + | |
| 207 | +1. Enable Netlify Bundle Analyzer: | |
| 208 | + - Add @netlify/plugin-bundle-analyzer to plugins | |
| 209 | + - Configure size thresholds in netlify.toml | |
| 210 | + - Generate visual bundle reports | |
| 211 | + | |
| 212 | +2. Set up Asset Optimization: | |
| 213 | + - Enable automatic JS minification | |
| 214 | + - Configure CSS optimization | |
| 215 | + - Turn on HTML minification | |
| 216 | + - Set up image processing pipeline | |
| 217 | + | |
| 218 | +3. Implement Smart Code Splitting: | |
| 219 | + - Analyze current chunks with the bundle analyzer | |
| 220 | + - Identify components over 50KB for splitting | |
| 221 | + - Configure webpack/vite for optimal chunking | |
| 222 | + - Set up route-based code splitting | |
| 223 | + | |
| 224 | +4. Configure Netlify's CDN for optimal delivery: | |
| 225 | + - Set cache headers for static assets | |
| 226 | + - Enable Brotli compression | |
| 227 | + - Configure edge caching rules | |
| 228 | + | |
| 229 | +Generate a full report with before/after bundle sizes" | |
| 230 | +``` | |
| 231 | + | |
| 232 | +<Card title="Netlify's Performance Arsenal" icon="rocket"> | |
| 233 | + | |
| 234 | + **Features Available Through Netlify MCP**: | |
| 235 | + - [Bundle | |
| 236 | + Analyzer](https://docs.netlify.com/configure-builds/build-plugins/bundle-analyzer/): Visualize your JavaScript bundles | |
| 237 | + - [Asset | |
| 238 | + Optimization](https://docs.netlify.com/configure-builds/post-processing/): | |
| 239 | + Automatic minification and compression | |
| 240 | + - [Edge | |
| 241 | + Network](https://docs.netlify.com/platform/edge-network/): Global CDN with | |
| 242 | + smart caching | |
| 243 | + - [Deploy | |
| 244 | + Previews](https://docs.netlify.com/site-deploys/deploy-previews/): Test | |
| 245 | + optimizations before production | |
| 246 | + | |
| 247 | +</Card> | |
| 248 | + | |
| 249 | +### Step 5: Image Optimization | |
| 250 | + | |
| 251 | +Optimize images for better performance: | |
| 252 | + | |
| 253 | +```bash | |
| 254 | +# In cn TUI mode: | |
| 255 | +"Set up Cloudinary image optimization for my Netlify site: | |
| 256 | +- Install @cloudinary/netlify-plugin via MCP | |
| 257 | +- Auto-convert images to WebP with fallbacks | |
| 258 | +- Generate responsive sizes (320w, 640w, 1024w, 1920w) | |
| 259 | +- Add lazy loading for all images | |
| 260 | +- Configure blur-up placeholders | |
| 261 | +- Update netlify.toml with Cloudinary settings | |
| 262 | +Target: Reduce image payload by 60-80% and improve LCP" | |
| 263 | +``` | |
| 264 | + | |
| 265 | +## Continuous Performance Monitoring | |
| 266 | + | |
| 267 | +### Step 6: Performance Budget Enforcement with Lighthouse CI | |
| 268 | + | |
| 269 | +Set and enforce performance budgets with automated testing: | |
| 270 | + | |
| 271 | +```bash | |
| 272 | +# In cn TUI mode: | |
| 273 | +"Set up Lighthouse CI with performance budgets for my Netlify site: | |
| 274 | + | |
| 275 | +Requirements: | |
| 276 | +- LCP must be < 2.5 seconds | |
| 277 | +- JavaScript bundle must be < 200KB | |
| 278 | +- Total size < 500KB | |
| 279 | +- Performance score >= 90 | |
| 280 | + | |
| 281 | +Setup needed: | |
| 282 | +1. Install @lhci/cli and @netlify/plugin-lighthouse | |
| 283 | +2. Create lighthouserc.js with these budget assertions | |
| 284 | +3. Configure netlify.toml to run checks on all deploys | |
| 285 | +4. Add GitHub status checks to block PRs that exceed budgets | |
| 286 | +5. Create performance dashboard at /lighthouse-reports | |
| 287 | + | |
| 288 | +Please configure the complete Lighthouse CI setup with these budgets." | |
| 289 | +``` | |
| 290 | + | |
| 291 | +<Tip> | |
| 292 | + This comprehensive setup will automatically test every deploy preview and | |
| 293 | + production deployment, blocking any changes that violate your performance | |
| 294 | + budgets. | |
| 295 | +</Tip> | |
| 296 | + | |
| 297 | +### Step 7: Real User Monitoring with Netlify Analytics | |
| 298 | + | |
| 299 | +Leverage Netlify's built-in analytics and integrate advanced RUM solutions: | |
| 300 | + | |
| 301 | +```bash | |
| 302 | +# In cn TUI mode: | |
| 303 | +"Set up comprehensive Real User Monitoring for my Netlify site: | |
| 304 | + | |
| 305 | +1. Configure Netlify Analytics Pro (requires Pro account): | |
| 306 | + - Set up server-side analytics (no JS required) | |
| 307 | + - Track Core Web Vitals (LCP, FID, CLS, INP) | |
| 308 | + - Monitor top pages by performance score | |
| 309 | + - Create custom performance alerts | |
| 310 | + - Configure weekly performance reports | |
| 311 | + | |
| 312 | +2. Integrate Web Vitals tracking: | |
| 313 | + - Install web-vitals library for detailed metrics | |
| 314 | + - Send metrics to Netlify Functions endpoint | |
| 315 | + - Store performance data in Netlify Blobs | |
| 316 | + - Create performance dashboard at /metrics | |
| 317 | + | |
| 318 | +3. Set up Performance Alerts: | |
| 319 | + - Alert when P75 LCP > 3 seconds | |
| 320 | + - Notify if CLS increases by 20% | |
| 321 | + - Monitor JavaScript error rates | |
| 322 | + - Track 404s and broken resources | |
| 323 | + - Send alerts to Slack via Netlify Functions | |
| 324 | + | |
| 325 | +4. Configure Geographic Performance Monitoring: | |
| 326 | + - Use Netlify Edge Functions to track region-specific metrics | |
| 327 | + - Identify slow regions with Edge geo data | |
| 328 | + - Compare performance across CDN nodes | |
| 329 | + - Optimize edge caching for slow regions | |
| 330 | + | |
| 331 | +5. Create Custom Performance Dashboard: | |
| 332 | + - Build dashboard page using Netlify Functions | |
| 333 | + - Display real-time Core Web Vitals | |
| 334 | + - Show performance trends over time | |
| 335 | + - Include browser and device breakdowns | |
| 336 | + | |
| 337 | +Show me the complete implementation with all code and configurations" | |
| 338 | +``` | |
| 339 | + | |
| 340 | +<Warning> | |
| 341 | + **Note**: Netlify Analytics Pro requires a paid Netlify Pro account ($19/month | |
| 342 | + per site). The prompt above assumes you have this plan. For free tier users, | |
| 343 | + focus on steps 2-5 which use Netlify Functions and Edge Functions to build | |
| 344 | + custom analytics. | |
| 345 | +</Warning> | |
| 346 | + | |
| 347 | +<Info> | |
| 348 | + **Netlify Analytics Advantages**: | |
| 349 | + - [Server-side Analytics](https://docs.netlify.com/analytics/get-started/) - No client-side JavaScript needed | |
| 350 | + - [Core Web Vitals](https://docs.netlify.com/analytics/core-web-vitals/) - Automatic tracking of Google's metrics | |
| 351 | + - [Custom Metrics](https://docs.netlify.com/functions/logs/) - Track any metric via Functions | |
| 352 | + - [Edge Insights](https://docs.netlify.com/edge-functions/overview/#geolocation) - Geographic performance data | |
| 353 | + - [No Cookie Banner Required](https://docs.netlify.com/analytics/get-started/#privacy) - GDPR compliant by default | |
| 354 | + | |
| 355 | +Unlike Google Analytics, Netlify Analytics: | |
| 356 | + | |
| 357 | +- Doesn't slow down your site (server-side) | |
| 358 | +- Captures 100% of traffic (no ad blockers) | |
| 359 | +- Respects user privacy (no cookies) | |
| 360 | +- Shows bot traffic separately | |
| 361 | +</Info> | |
| 362 | + | |
| 363 | +<Tip> | |
| 364 | + | |
| 365 | + **Pro Tip** | |
| 366 | + Combine Netlify Analytics with Edge Functions to create a | |
| 367 | + powerful RUM solution that: | |
| 368 | + - Tracks performance by user segment | |
| 369 | + - A/B tests | |
| 370 | + performance optimizations | |
| 371 | + - Personalizes content based on connection speed | |
| 372 | + - Automatically serves lighter assets to slow connections | |
| 373 | + | |
| 374 | +</Tip> | |
| 375 | + | |
| 376 | +## Automated Performance Checks | |
| 377 | + | |
| 378 | +### GitHub Actions Performance Guard | |
| 379 | + | |
| 380 | +Block PRs that degrade performance: | |
| 381 | + | |
| 382 | +```yaml | |
| 383 | +name: Performance Check | |
| 384 | + | |
| 385 | +on: | |
| 386 | + pull_request: | |
| 387 | + | |
| 388 | +jobs: | |
| 389 | + performance: | |
| 390 | + runs-on: ubuntu-latest | |
| 391 | + steps: | |
| 392 | + - uses: actions/checkout@v4 | |
| 393 | + - uses: actions/setup-node@v4 | |
| 394 | + with: | |
| 395 | + node-version: "22" | |
| 396 | + | |
| 397 | + - name: Deploy and Test Performance | |
| 398 | + id: perf | |
| 399 | + env: | |
| 400 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| 401 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| 402 | + run: | | |
| 403 | + npx @continuedev/cli@latest << 'EOF' | |
| 404 | + Deploy PR preview and run Lighthouse. | |
| 405 | + Compare scores with main branch. | |
| 406 | + Output JSON with score deltas. | |
| 407 | + EOF > performance.json | |
| 408 | + | |
| 409 | + - name: Comment Performance Results | |
| 410 | + uses: actions/github-script@v7 | |
| 411 | + with: | |
| 412 | + script: | | |
| 413 | + const fs = require('fs'); | |
| 414 | + const perf = JSON.parse(fs.readFileSync('performance.json')); | |
| 415 | + | |
| 416 | + const emoji = perf.score_delta < -10 ? '🔴' : | |
| 417 | + perf.score_delta < 0 ? '🟡' : '🟢'; | |
| 418 | + | |
| 419 | + const comment = `## ${emoji} Performance Impact | |
| 420 | + | |
| 421 | + | Metric | Main | PR | Delta | | |
| 422 | + |--------|------|----|---------| | |
| 423 | + | Performance Score | ${perf.main_score} | ${perf.pr_score} | ${perf.score_delta > 0 ? '+' : ''}${perf.score_delta} | | |
| 424 | + | LCP | ${perf.main_lcp}s | ${perf.pr_lcp}s | ${perf.lcp_delta > 0 ? '+' : ''}${perf.lcp_delta}s | | |
| 425 | + | Bundle Size | ${perf.main_bundle}KB | ${perf.pr_bundle}KB | ${perf.bundle_delta > 0 ? '+' : ''}${perf.bundle_delta}KB | | |
| 426 | + | |
| 427 | + ${perf.score_delta < -10 ? '⚠️ **This PR significantly degrades performance. Please optimize before merging.**' : ''} | |
| 428 | + | |
| 429 | + [View Full Report](${perf.report_url})`; | |
| 430 | + | |
| 431 | + github.rest.issues.createComment({ | |
| 432 | + issue_number: context.issue.number, | |
| 433 | + owner: context.repo.owner, | |
| 434 | + repo: context.repo.repo, | |
| 435 | + body: comment | |
| 436 | + }); | |
| 437 | + | |
| 438 | + // Fail check if performance degrades significantly | |
| 439 | + if (perf.score_delta < -10) { | |
| 440 | + core.setFailed('Performance degraded by more than 10 points'); | |
| 441 | + } | |
| 442 | +``` | |
| 443 | + | |
| 444 | +<Warning> | |
| 445 | + This workflow will: - **Block merge** if performance score drops >10 points - | |
| 446 | + **Warn** on any performance regression - **Celebrate** improvements with green | |
| 447 | + indicators | |
| 448 | +</Warning> | |
| 449 | + | |
| 450 | +## Performance Testing Locally | |
| 451 | + | |
| 452 | +### Step 8: Local Performance Testing | |
| 453 | + | |
| 454 | +Test performance before deploying: | |
| 455 | + | |
| 456 | +```bash | |
| 457 | +# In cn TUI mode: | |
| 458 | +"Run production build and measure bundle sizes" | |
| 459 | +``` | |
| 460 | + | |
| 461 | +### Step 9: Pre-commit Performance Checks | |
| 462 | + | |
| 463 | +Prevent performance regressions before they happen: | |
| 464 | + | |
| 465 | +```bash | |
| 466 | +# In cn TUI mode: | |
| 467 | +"Add pre-commit hooks for bundle size limits" | |
| 468 | +``` | |
| 469 | + | |
| 470 | +## Performance Troubleshooting | |
| 471 | + | |
| 472 | +### Debug Performance Issues | |
| 473 | + | |
| 474 | +Identify and fix performance bottlenecks: | |
| 475 | + | |
| 476 | +```bash | |
| 477 | +# In cn TUI mode: | |
| 478 | +"Why did my performance score drop?" | |
| 479 | +``` | |
| 480 | + | |
| 481 | +### Performance Issue Quick Fixes | |
| 482 | + | |
| 483 | +| Issue | Quick Fix Command (in cn TUI) | | |
| 484 | +| ------------- | --------------------------------- | | |
| 485 | +| Slow LCP | `"Preload critical resources"` | | |
| 486 | +| High CLS | `"Add size attributes to images"` | | |
| 487 | +| Large bundles | `"Implement code splitting"` | | |
| 488 | +| Slow builds | `"Enable build caching"` | | |
| 489 | +| Poor caching | `"Configure cache headers"` | | |
| 490 | + | |
| 491 | +## What You've Accomplished | |
| 492 | + | |
| 493 | +<Card title="Performance-First Development" icon="gauge-high"> | |
| 494 | + | |
| 495 | + You've built an AI-powered performance optimization system that: | |
| 496 | + - Automatically monitors Core Web Vitals | |
| 497 | + - Runs A/B tests between branches | |
| 498 | + - Blocks deployments that degrade performance | |
| 499 | + - Provides actionable optimization | |
| 500 | + suggestions | |
| 501 | + | |
| 502 | +</Card> | |
| 503 | + | |
| 504 | +## Discover Netlify's Hidden Performance Gems | |
| 505 | + | |
| 506 | +Features many developers don't know Netlify offers: | |
| 507 | + | |
| 508 | +<CardGroup cols={2}> | |
| 509 | + <Card title="Edge Functions" icon="bolt"> | |
| 510 | + | |
| 511 | + **[Netlify Edge Functions](https://docs.netlify.com/edge-functions/overview/)** | |
| 512 | + - Run code at the edge, closer to users | |
| 513 | + - Transform responses on-the-fly | |
| 514 | + - A/B test at the edge level | |
| 515 | + - Personalize content without client-side JS | |
| 516 | + | |
| 517 | + </Card> | |
| 518 | + | |
| 519 | +<Card title="Netlify Graph" icon="diagram-project"> | |
| 520 | + | |
| 521 | + **[Netlify Graph](https://docs.netlify.com/graph/overview/)** | |
| 522 | + - Unified GraphQL gateway for all your APIs | |
| 523 | + - Automatic TypeScript generation | |
| 524 | + - Built-in authentication handling | |
| 525 | + - Zero client-side API keys needed | |
| 526 | + | |
| 527 | +</Card> | |
| 528 | + | |
| 529 | +<Card title="On-Demand Builders" icon="hammer"> | |
| 530 | + **[On-Demand | |
| 531 | + Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)** - | |
| 532 | + Generate pages only when requested - Cache dynamically generated content - | |
| 533 | + Perfect for large sites (10k+ pages) - Reduce build times dramatically | |
| 534 | +</Card> | |
| 535 | + | |
| 536 | + <Card title="Netlify Functions" icon="function"> | |
| 537 | + **[Background Functions](https://docs.netlify.com/functions/background-functions/)** | |
| 538 | + - Run tasks up to 15 minutes | |
| 539 | + - Process webhooks asynchronously | |
| 540 | + - Handle heavy computations | |
| 541 | + - No timeout worries | |
| 542 | + </Card> | |
| 543 | +</CardGroup> | |
| 544 | + | |
| 545 | +```bash | |
| 546 | +# Try these advanced features in cn TUI mode: | |
| 547 | +"Show me how to use Netlify Edge Functions for geo-based personalization" | |
| 548 | +"Set up On-Demand Builders for my blog with 5000 posts" | |
| 549 | +"Configure Background Functions for image processing" | |
| 550 | +``` | |
| 551 | + | |
| 552 | +## Performance Best Practices | |
| 553 | + | |
| 554 | +The Netlify Performance Rules enforce: | |
| 555 | + | |
| 556 | +<CardGroup cols={3}> | |
| 557 | + <Card title="Build Optimization" icon="hammer"> | |
| 558 | + - Dependency caching enabled | |
| 559 | + - Parallel builds when possible | |
| 560 | + - Incremental compilation | |
| 561 | + - Smart cache invalidation | |
| 562 | + </Card> | |
| 563 | + | |
| 564 | + <Card title="Runtime Performance" icon="bolt"> | |
| 565 | + - Automatic image optimization | |
| 566 | + - Efficient resource hints (preload, prefetch) | |
| 567 | + - Optimal cache headers | |
| 568 | + - CDN configuration | |
| 569 | + </Card> | |
| 570 | + | |
| 571 | + <Card title="Monitoring Standards" icon="chart-line"> | |
| 572 | + - Performance budgets enforced | |
| 573 | + - Core Web Vitals tracking | |
| 574 | + - Real user monitoring | |
| 575 | + - Automated alerts | |
| 576 | + </Card> | |
| 577 | +</CardGroup> | |
| 578 | + | |
| 579 | +## Advanced Performance Strategies | |
| 580 | + | |
| 581 | +### Progressive Enhancement | |
| 582 | + | |
| 583 | +```bash | |
| 584 | +# In cn TUI mode: | |
| 585 | +"Implement progressive enhancement with basic HTML first" | |
| 586 | +``` | |
| 587 | + | |
| 588 | +### Multi-variant Testing | |
| 589 | + | |
| 590 | +```bash | |
| 591 | +# In cn TUI mode: | |
| 592 | +"Test 3 bundle strategies and auto-select winner" | |
| 593 | +``` | |
| 594 | + | |
| 595 | +### Predictive Prefetching | |
| 596 | + | |
| 597 | +```bash | |
| 598 | +# In cn TUI mode: | |
| 599 | +"Analyze navigation patterns and prefetch next pages" | |
| 600 | +``` | |
| 601 | + | |
| 602 | +## Next Steps | |
| 603 | + | |
| 604 | +- Install [Netlify MCP](https://hub.continue.dev/netlify/netlify-mcp) from Continue Hub | |
| 605 | +- Set up [Performance Monitoring](https://docs.netlify.com/analytics/get-started/) | |
| 606 | +- Configure [A/B Testing](https://docs.netlify.com/split-testing/overview/) | |
| 607 | +- Join the [Continue Discord](https://discord.gg/continue) for support | |
| 608 | + | |
| 609 | +## Resources | |
| 610 | + | |
| 611 | +- [Netlify MCP on Continue Hub](https://hub.continue.dev/netlify/netlify-mcp) | |
| 612 | +- [Core Web Vitals Guide](https://web.dev/vitals/) | |
| 613 | +- [Netlify Analytics Documentation](https://docs.netlify.com/analytics/) | |
| 614 | +- [Continue Performance Guides](https://docs.continue.dev/guides) |
modified docs/guides/overview.mdx +8 −1
| @@ -14,7 +14,14 @@ | ||
| 14 | 14 | - [Continuous AI: A Developer's Guide](/guides/continuous-ai) - Integrating AI into development workflows |
| 15 | 15 | - [How to Use Continue CLI (cn)](/guides/cli) - Command-line interface for Continue |
| 16 | 16 | - [Continuous AI Readiness Assessment](/guides/continuous-ai-readiness-assessment) - Evaluate team readiness for Continuous AI adoption |
| 17 | -- [PostHog Session Analysis with Continue CLI](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation | |
| 17 | + | |
| 18 | +## MCP Integration Cookbooks | |
| 19 | + | |
| 20 | +Step-by-step guides for integrating Model Context Protocol (MCP) servers with Continue: | |
| 21 | + | |
| 22 | +- [PostHog Session Analysis Cookbook](/guides/posthog-github-continuous-ai) - Analyze user behavior data to optimize your codebase with automatic issue creation | |
| 23 | +- [Netlify Performance Optimization Cookbook](/guides/netlify-mcp-continuous-deployment) - Optimize web performance with A/B testing and automated monitoring using Netlify MCP | |
| 24 | +- [Snyk + Continue Hub Agent Cookbook (MCP)](/guides/snyk-mcp-continue-cookbook) - Integrate Snyk MCP via Continue Hub to scan code, deps, IaC, and containers | |
| 18 | 25 | |
| 19 | 26 | ## What Advanced Tutorials Are Available |
| 20 | 27 |
modified docs/guides/posthog-github-continuous-ai.mdx +217 −196
| @@ -41,77 +41,118 @@ | ||
| 41 | 41 | </Steps> |
| 42 | 42 | |
| 43 | 43 | <Tip> |
| 44 | - Continue CLI handles all the complex API interactions - you just need to | |
| 45 | - provide the right prompts! | |
| 44 | + Continue CLI handles the complex API interactions - you just need to provide | |
| 45 | + the right prompts! | |
| 46 | 46 | </Tip> |
| 47 | 47 | |
| 48 | 48 | ## Step 1: Set Up Your Credentials |
| 49 | 49 | |
| 50 | -First, you'll need to gather your API credentials and add them as secrets in Continue CLI. | |
| 50 | +First, you'll need to gather your PostHog and GitHub API credentials and add them as secrets in Continue CLI. | |
| 51 | + | |
| 52 | +<Tabs> | |
| 53 | + <Tab title="PostHog API Credentials"> | |
| 54 | + You'll need a **Personal API Key** (not a Project API key) to access session recordings: | |
| 55 | + | |
| 56 | + 1. Go to [Personal API Keys](https://app.posthog.com/settings/user-api-keys) in PostHog | |
| 57 | + 2. Click **+ Create a personal API Key** | |
| 58 | + 3. Name it "Continue CLI Session Analysis" | |
| 59 | + 4. Select these scopes: | |
| 60 | + - `session_recording:read` - **Required** for accessing session data | |
| 61 | + - `insight:read` | |
| 62 | + - `query:read` | |
| 63 | + - `session_recording_playlist:read` | |
| 64 | + 5. Copy the key immediately (you won't see it again!) | |
| 65 | + 6. Note your **Project ID** from your PostHog project settings | |
| 66 | + 7. Note your PostHog host URL (e.g., `https://us.posthog.com` or your custom domain) | |
| 67 | + 8. You'll also need your POSTHOG_AUTH_HEADER value, which is simply `Bearer YOUR_API_KEY` | |
| 68 | + | |
| 69 | + <Tip> | |
| 70 | + **Find Your Project Details**: Your Project ID is in your PostHog URL: | |
| 71 | + `https://app.posthog.com/project/YOUR_PROJECT_ID` | |
| 72 | + </Tip> | |
| 73 | + | |
| 74 | + </Tab> | |
| 75 | + <Tab title="GitHub Personal Access Token"> | |
| 76 | + You'll need a **Personal Access Token** to create issues in your GitHub repository: | |
| 77 | + | |
| 78 | + 1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new) | |
| 79 | + 2. Click **"Generate new token (classic)"** | |
| 80 | + 3. Name it "Continue CLI PostHog Analysis" | |
| 81 | + 4. Select these scopes: | |
| 82 | + - `repo` (or just `public_repo` if your repository is public) | |
| 83 | + - `issues:write` - **Required** for creating issues | |
| 84 | + 5. Copy the token immediately | |
| 85 | + | |
| 86 | + </Tab> | |
| 87 | +</Tabs> | |
| 51 | 88 | |
| 52 | -### Get Your PostHog API Credentials | |
| 89 | +### Add Secrets to Continue CLI | |
| 53 | 90 | |
| 54 | -You need a **Personal API Key** (not a Project API key) to access session recordings: | |
| 91 | +To add environment variables to your Continue Hub account: | |
| 55 | 92 | |
| 56 | -1. Go to [Personal API Keys](https://app.posthog.com/settings/user-api-keys) in PostHog | |
| 57 | -2. Click **+ Create a personal API Key** | |
| 58 | -3. Name it "Continue CLI Session Analysis" | |
| 59 | -4. Select these scopes: | |
| 60 | - - `session_recording:read` - **Required** for accessing session data | |
| 61 | - - `insight:read` - Optional, for additional analytics | |
| 62 | -5. Copy the key immediately (you won't see it again!) | |
| 93 | +1. Go to the [Continue Hub](https://hub.continue.dev) | |
| 94 | +2. Sign in to your account | |
| 95 | +3. Navigate to your user settings | |
| 96 | +4. Look for the "Secrets" section | |
| 97 | +5. Add your variables there (like POSTHOG_API_KEY, POSTHOG_PROJECT_ID, | |
| 98 | + POSTHOG_HOST,GITHUB_PAT, etc.) | |
| 63 | 99 | |
| 64 | -<Tip> | |
| 65 | - **Find Your Project Details**: Your Project ID is in your PostHog URL: | |
| 66 | - `https://app.posthog.com/project/YOUR_PROJECT_ID` | |
| 67 | -</Tip> | |
| 100 | +These environment variables will then be securely stored and available for use in | |
| 101 | +your Continue workflows. | |
| 68 | 102 | |
| 69 | -### Get Your GitHub Personal Access Token | |
| 103 | +## PostHog GitHub Continuous AI Workflow Options | |
| 70 | 104 | |
| 71 | -1. Go to [GitHub Personal Access Tokens](https://github.com/settings/personal-access-tokens/new) | |
| 72 | -2. Click **"Generate new token (classic)"** | |
| 73 | -3. Name it "Continue CLI PostHog Analysis" | |
| 74 | -4. Select these scopes: | |
| 75 | - - `repo` (or just `public_repo` if your repository is public) | |
| 76 | - - `issues:write` - **Required** for creating issues | |
| 77 | -5. Copy the token immediately | |
| 105 | +<Card title="🚀 Fastest Path to Success" icon="zap"> | |
| 106 | + Skip the manual setup and use our pre-built PostHog GitHub agent that includes | |
| 107 | + optimized prompts, rules, and the PostHog MCP for more consistent results. | |
| 108 | +</Card> | |
| 78 | 109 | |
| 79 | -### Add Secrets to Continue CLI | |
| 110 | +After completing **Step 1** below, you have two paths to get started: | |
| 80 | 111 | |
| 81 | -Use Continue CLI's built-in environment setup helper: | |
| 112 | +<Tabs> | |
| 113 | + <Tab title="⚡ Quick Start (Recommended)"> | |
| 114 | + **Perfect for:** Immediate results with optimized prompts and built-in debugging | |
| 82 | 115 | |
| 83 | -```bash | |
| 84 | -cn -p "Help me set up my environment for PostHog session analysis. Please: | |
| 85 | -1. Check if I have the required secrets configured in Continue CLI: | |
| 86 | - - POSTHOG_API_KEY | |
| 87 | - - POSTHOG_PROJECT_ID | |
| 88 | - - POSTHOG_HOST | |
| 89 | - - GITHUB_PAT | |
| 90 | -2. If any are missing, guide me through: | |
| 91 | - - How to get PostHog Personal API Key from PostHog settings | |
| 92 | - - How to find my PostHog Project ID from the URL | |
| 93 | - - How to create a GitHub Personal Access Token with issues:write permission | |
| 94 | - - How to add these as secrets in Continue CLI | |
| 95 | -3. Help me identify my GitHub repository owner and name by: | |
| 96 | - - Checking git remote origin URL | |
| 97 | - - Or asking me to provide them | |
| 98 | -4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work. | |
| 99 | -Please walk me through this setup process step by step." | |
| 100 | -``` | |
| 116 | + <Steps> | |
| 117 | + <Step title="Add the Pre-Built Agent"> | |
| 118 | + Visit the [PostHog GitHub Continuous AI Agent](https://hub.continue.dev/continuedev/awesome-models-posthog-gh) on Continue Hub and click **"Install Agent"** | |
| 101 | 119 | |
| 102 | -<Info> | |
| 103 | - Continue CLI will guide you through adding secrets and testing your API | |
| 104 | - connections. Follow the prompts to add: - `POSTHOG_API_KEY`: Your PostHog | |
| 105 | - Personal API Key - `POSTHOG_PROJECT_ID`: Your PostHog Project ID - | |
| 106 | - `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host) - | |
| 107 | - `GITHUB_PAT`: Your GitHub Personal Access Token | |
| 108 | -</Info> | |
| 120 | + This agent includes: | |
| 121 | + - **Optimized prompts** for PostHog analysis and GitHub issue creation | |
| 122 | + - **Built-in rules** for consistent formatting and error handling | |
| 123 | + - **PostHog MCP** for more reliable API interactions | |
| 124 | + </Step> | |
| 125 | + | |
| 126 | + <Step title="Verify Your Secrets"> | |
| 127 | + The agent uses these Hub resources automatically: | |
| 128 | + - **Environment Variables**: [bekahhw/env-vars](https://hub.continue.dev/bekahhw/env-vars) | |
| 129 | + - **Analysis Rules**: [bekah-hawrot-weigel/posthog-github-continuous-ai-rules](https://hub.continue.dev/bekah-hawrot-weigel/posthog-github-continuous-ai-rules) | |
| 130 | + - **Analysis Prompt**: [continuedev/posthog-analysis](https://hub.continue.dev/continuedev/posthog-analysis) | |
| 131 | + - **Issue Creation Prompt**: [continuedev/github-issues](https://hub.continue.dev/continuedev/github-issues) | |
| 132 | + </Step> | |
| 133 | + | |
| 134 | + <Step title="Run the Analysis"> | |
| 135 | + Navigate to your project directory and run: | |
| 136 | + ```bash | |
| 137 | + cn "Give me my PostHog Session data and create GitHub issues based on the problems." | |
| 138 | + ``` | |
| 139 | + | |
| 140 | + That's it! The agent handles everything automatically. | |
| 141 | + </Step> | |
| 142 | + </Steps> | |
| 143 | + | |
| 144 | + <Info> | |
| 145 | + **Why Use the Agent?** Results are more consistent and debugging is easier thanks to the PostHog MCP integration and pre-tested prompts. | |
| 146 | + </Info> | |
| 147 | + | |
| 148 | + </Tab> | |
| 109 | 149 | |
| 110 | -## Step 2: Analyze PostHog Sessions with Continue CLI | |
| 150 | + <Tab title="🛠️ Manual Setup"> | |
| 151 | + **Perfect for:** Learning the process and customizing prompts. | |
| 111 | 152 | |
| 112 | -Now you'll use Continue CLI to fetch PostHog session data and analyze it for UX issues. Continue CLI handles all the API calls and analysis automatically. | |
| 153 | + Now you'll use Continue CLI to fetch PostHog session data and analyze it for UX issues. Continue CLI handles all the API calls and analysis automatically. | |
| 113 | 154 | |
| 114 | -### Run the Analysis | |
| 155 | +### Run the PostHog Analysis | |
| 115 | 156 | |
| 116 | 157 | Use this prompt with Continue CLI to fetch and analyze your PostHog sessions: |
| 117 | 158 | |
| @@ -143,19 +184,7 @@ | ||
| 143 | 184 | Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data." |
| 144 | 185 | ``` |
| 145 | 186 | |
| 146 | -<Info> | |
| 147 | - **What Continue CLI Does:** - Makes authenticated API calls to PostHog using | |
| 148 | - your stored secrets - Fetches and filters session recordings automatically - | |
| 149 | - Analyzes patterns in the data using AI - Generates structured issue | |
| 150 | - descriptions ready for GitHub | |
| 151 | -</Info> | |
| 152 | - | |
| 153 | -<Tip> | |
| 154 | - Save the analysis output to a file by adding `> analysis-results.txt` to the | |
| 155 | - command if you want to review it later. | |
| 156 | -</Tip> | |
| 157 | - | |
| 158 | -## Step 3: Create GitHub Issues Automatically | |
| 187 | +### Create GitHub Issues from PostHog Analysis | |
| 159 | 188 | |
| 160 | 189 | Now use Continue CLI to create GitHub issues from your analysis results: |
| 161 | 190 | |
| @@ -183,6 +212,21 @@ | ||
| 183 | 212 | " |
| 184 | 213 | ``` |
| 185 | 214 | |
| 215 | + </Tab> | |
| 216 | +</Tabs> | |
| 217 | + | |
| 218 | +<Accordion title="Agent Requirements"> | |
| 219 | + To use the pre-built agent, you need either: | |
| 220 | + - **Continue CLI Pro Plan** with | |
| 221 | + the models add-on, OR | |
| 222 | + - **Your own API keys** added to Continue Hub secrets | |
| 223 | + (same as Step 1 below) The agent will automatically detect and use your | |
| 224 | + configuration. | |
| 225 | + | |
| 226 | +</Accordion> | |
| 227 | + | |
| 228 | +--- | |
| 229 | + | |
| 186 | 230 | <Warning> |
| 187 | 231 | **Repository Labels Required**: Make sure your GitHub repository has these labels: |
| 188 | 232 | - `bug`, `enhancement` |
| @@ -200,7 +244,7 @@ | ||
| 200 | 244 | issues to avoid spam - Provides confirmation with issue URLs |
| 201 | 245 | </Info> |
| 202 | 246 | |
| 203 | -## Step 4: Set Up Automated GitHub Actions Workflow | |
| 247 | +## Setting Up Automated GitHub Actions Workflow | |
| 204 | 248 | |
| 205 | 249 | Create a GitHub Actions workflow that runs your Continue CLI analysis automatically on a schedule. |
| 206 | 250 | |
| @@ -211,26 +255,23 @@ | ||
| 211 | 255 | 1. Go to **Repository Settings → Secrets and variables → Actions** |
| 212 | 256 | 2. Click **"New repository secret"** and add: |
| 213 | 257 | - `CONTINUE_API_KEY`: Your Continue API key from hub.continue.dev |
| 214 | - - `POSTHOG_API_KEY`: Your PostHog Personal API Key | |
| 215 | - - `POSTHOG_PROJECT_ID`: Your PostHog Project ID | |
| 216 | - - `POSTHOG_HOST`: `https://us.posthog.com` (or your custom PostHog host) | |
| 217 | - - `GITHUB_PAT`: Your GitHub Personal Access Token | |
| 218 | 258 | |
| 219 | 259 | ### Create GitHub Actions Workflow |
| 220 | 260 | |
| 221 | 261 | Create `.github/workflows/posthog-analysis.yml` in your repository: |
| 222 | 262 | |
| 263 | +<Tabs> | |
| 264 | + <Tab title="⚡ Using Pre-Built Agent (Recommended)"> | |
| 223 | 265 | ```yaml |
| 224 | -name: PostHog Session Analysis with Continue CLI | |
| 266 | +name: PostHog Session Analysis with Continue CLI Agent | |
| 225 | 267 | |
| 226 | 268 | on: |
| 227 | - schedule: | |
| 228 | - - cron: "0 6 * * *" # Run at 6 AM UTC daily | |
| 229 | - workflow_dispatch: # Allow manual triggering | |
| 269 | +schedule: - cron: "0 6 \* \* \*" # Run at 6 AM UTC daily | |
| 270 | +workflow_dispatch: # Allow manual triggering | |
| 230 | 271 | |
| 231 | 272 | jobs: |
| 232 | - analyze: | |
| 233 | - runs-on: ubuntu-latest | |
| 273 | +analyze: | |
| 274 | +runs-on: ubuntu-latest | |
| 234 | 275 | |
| 235 | 276 | permissions: |
| 236 | 277 | contents: read |
| @@ -250,14 +291,72 @@ | ||
| 250 | 291 | echo "✅ Continue CLI installed" |
| 251 | 292 | cn --version |
| 252 | 293 | |
| 253 | - - name: Set up environment variables | |
| 294 | + - name: Authenticate with Continue CLI | |
| 295 | + run: | | |
| 296 | + # Set Continue API key | |
| 297 | + export CONTINUE_API_KEY="${{ secrets.CONTINUE_API_KEY }}" | |
| 298 | + # Login to Continue CLI | |
| 299 | + if ! cn auth login --api-key "$CONTINUE_API_KEY"; then | |
| 300 | + echo "❌ Failed to authenticate with Continue CLI" | |
| 301 | + exit 1 | |
| 302 | + fi | |
| 303 | + echo "✅ Continue CLI authenticated" | |
| 304 | + | |
| 305 | + - name: Load PostHog GitHub Agent | |
| 306 | + run: | | |
| 307 | + echo "🤖 Loading PostHog GitHub Continuous AI Agent..." | |
| 308 | + cn --config continuedev/awesome-models-posthog-gh | |
| 309 | + echo "✅ Agent loaded successfully" | |
| 310 | + | |
| 311 | + - name: Run PostHog Analysis and Create GitHub Issues | |
| 312 | + run: | | |
| 313 | + echo "🎬 Starting automated PostHog session analysis..." | |
| 314 | + | |
| 315 | + # Run the agent with the simple prompt | |
| 316 | + cn -p "Tell me about my PostHog session recordings and create GitHub issues based on the problems." | |
| 317 | + | |
| 318 | + echo "✅ Analysis and issue creation completed" | |
| 319 | + | |
| 320 | + - name: Summary | |
| 321 | + run: | | |
| 322 | + echo "✅ PostHog analysis workflow completed!" | |
| 323 | + echo "📊 Check the artifacts for detailed analysis results" | |
| 324 | + echo "🐛 Check your repository issues for newly created UX issues" | |
| 325 | + echo "🤖 Agent automatically handled both analysis and issue creation" | |
| 326 | + ``` | |
| 327 | + | |
| 328 | + </Tab> | |
| 329 | + | |
| 330 | + <Tab title="🛠️ Manual Setup Version"> | |
| 331 | + | |
| 332 | +```yaml | |
| 333 | +name: PostHog Session Analysis with Continue CLI Manual | |
| 334 | + | |
| 335 | +on: | |
| 336 | +schedule: - cron: "0 6 \* \* \*" # Run at 6 AM UTC daily | |
| 337 | +workflow_dispatch: # Allow manual triggering | |
| 338 | + | |
| 339 | +jobs: | |
| 340 | +analyze: | |
| 341 | +runs-on: ubuntu-latest | |
| 342 | + | |
| 343 | + permissions: | |
| 344 | + contents: read | |
| 345 | + issues: write | |
| 346 | + | |
| 347 | + steps: | |
| 348 | + - uses: actions/checkout@v4 | |
| 349 | + | |
| 350 | + - name: Set up Node.js | |
| 351 | + uses: actions/setup-node@v4 | |
| 352 | + with: | |
| 353 | + node-version: "18" | |
| 354 | + | |
| 355 | + - name: Install Continue CLI | |
| 254 | 356 | run: | |
| 255 | - echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> $GITHUB_ENV | |
| 256 | - echo "POSTHOG_PROJECT_ID=${{ secrets.POSTHOG_PROJECT_ID }}" >> $GITHUB_ENV | |
| 257 | - echo "POSTHOG_HOST=${{ secrets.POSTHOG_HOST || 'https://us.posthog.com' }}" >> $GITHUB_ENV | |
| 258 | - echo "GITHUB_PAT=${{ secrets.GITHUB_PAT }}" >> $GITHUB_ENV | |
| 259 | - echo "GITHUB_OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV | |
| 260 | - echo "GITHUB_REPO=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV | |
| 357 | + npm install -g @continuedev/cli | |
| 358 | + echo "✅ Continue CLI installed" | |
| 359 | + cn --version | |
| 261 | 360 | |
| 262 | 361 | - name: Authenticate with Continue CLI |
| 263 | 362 | run: | |
| @@ -274,13 +373,12 @@ | ||
| 274 | 373 | run: | |
| 275 | 374 | echo "🎬 Starting PostHog session analysis..." |
| 276 | 375 | # Create the analysis prompt |
| 277 | - cat > analysis_prompt.txt << 'EOF' | |
| 278 | 376 | I need you to help me analyze PostHog session recordings to identify UX issues. Please: |
| 279 | 377 | |
| 280 | 378 | 1. First, fetch session recordings from PostHog using these details: |
| 281 | - - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from environment variables | |
| 282 | - - API endpoint: $POSTHOG_HOST/api/projects/$POSTHOG_PROJECT_ID/session_recordings/?limit=20 | |
| 283 | - - Include Authorization header: "Bearer $POSTHOG_API_KEY" | |
| 379 | + - Use the POSTHOG_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST from my secrets | |
| 380 | + - API endpoint: {POSTHOG_HOST}/api/projects/{POSTHOG_PROJECT_ID}/session_recordings/?limit=20 | |
| 381 | + - Include Authorization header: 'Bearer {POSTHOG_API_KEY}' | |
| 284 | 382 | |
| 285 | 383 | 2. Filter the sessions to find problematic ones with either: |
| 286 | 384 | - console_error_count > 0 (JavaScript errors) |
| @@ -300,43 +398,22 @@ | ||
| 300 | 398 | **Impact**: Quantify the impact (e.g., 'Affects 80% of sessions') |
| 301 | 399 | |
| 302 | 400 | Please make the API call, analyze the data, and provide the 3 formatted issues. Base all recommendations on actual patterns in the session data. |
| 303 | - | |
| 304 | - Environment context: | |
| 305 | - - POSTHOG_API_KEY: $POSTHOG_API_KEY | |
| 306 | - - POSTHOG_PROJECT_ID: $POSTHOG_PROJECT_ID | |
| 307 | - - POSTHOG_HOST: $POSTHOG_HOST | |
| 308 | - - GitHub Repo: $GITHUB_OWNER/$GITHUB_REPO | |
| 309 | 401 | EOF |
| 310 | 402 | |
| 311 | - # Run the analysis | |
| 312 | - cn < analysis_prompt.txt > analysis-results.txt 2>&1 | |
| 313 | - | |
| 314 | - # Check if analysis completed | |
| 315 | - if [ ! -s analysis-results.txt ]; then | |
| 316 | - echo "❌ Analysis failed or produced no output" | |
| 317 | - exit 1 | |
| 318 | - fi | |
| 319 | - | |
| 320 | 403 | echo "✅ Analysis completed" |
| 321 | - echo "📄 Analysis results preview:" | |
| 322 | - head -20 analysis-results.txt | |
| 404 | + | |
| 323 | 405 | |
| 324 | 406 | - name: Create GitHub Issues from Analysis |
| 325 | 407 | run: | |
| 326 | 408 | echo "📝 Creating GitHub issues from analysis..." |
| 327 | 409 | # Create the issue creation prompt |
| 328 | - cat > issue_prompt.txt << 'EOF' | |
| 329 | 410 | I have analyzed PostHog session data and identified UX issues. Now I need you to create GitHub issues using the GitHub API. |
| 330 | 411 | |
| 331 | - Use these details from environment variables: | |
| 332 | - - GITHUB_PAT: My GitHub Personal Access Token | |
| 333 | - - Repository: $GITHUB_OWNER/$GITHUB_REPO | |
| 334 | - | |
| 335 | 412 | For each issue in my analysis: |
| 336 | 413 | 1. Parse the issue title, body content, and priority level |
| 337 | - 2. Create a GitHub issue via API POST to: https://api.github.com/repos/$GITHUB_OWNER/$GITHUB_REPO/issues | |
| 414 | + 2. Create a GitHub issue via API POST to: https://api.github.com/repos/{owner}/{repo}/issues | |
| 338 | 415 | 3. Use these headers: |
| 339 | - - Authorization: token $GITHUB_PAT | |
| 416 | + - Authorization: token {GITHUB_PAT} | |
| 340 | 417 | - Accept: application/vnd.github.v3+json |
| 341 | 418 | - Content-Type: application/json |
| 342 | 419 | 4. Set labels based on priority: |
| @@ -347,57 +424,16 @@ | ||
| 347 | 424 | |
| 348 | 425 | Please create the GitHub issues and confirm they were successfully created with issue numbers and URLs. |
| 349 | 426 | |
| 350 | - Here's my analysis to process: | |
| 351 | - EOF | |
| 352 | - | |
| 353 | - # Append the analysis results to the prompt | |
| 354 | - cat analysis-results.txt >> issue_prompt.txt | |
| 355 | - | |
| 356 | - # Run the issue creation | |
| 357 | - cn < issue_prompt.txt > issue-creation-results.txt 2>&1 | |
| 358 | - | |
| 359 | 427 | echo "✅ Issue creation completed" |
| 360 | - echo "📄 Issue creation results:" | |
| 361 | - cat issue-creation-results.txt | |
| 362 | - | |
| 363 | - - name: Upload Analysis Artifacts | |
| 364 | - uses: actions/upload-artifact@v4 | |
| 365 | - if: always() | |
| 366 | - with: | |
| 367 | - name: analysis-results-${{ github.run_number }} | |
| 368 | - path: | | |
| 369 | - analysis-results.txt | |
| 370 | - issue-creation-results.txt | |
| 371 | - retention-days: 30 | |
| 372 | 428 | |
| 373 | 429 | - name: Summary |
| 374 | 430 | run: | |
| 375 | 431 | echo "✅ PostHog analysis workflow completed!" |
| 376 | - echo "📊 Check the artifacts for detailed analysis results" | |
| 377 | 432 | echo "🐛 Check your repository issues for newly created UX issues" |
| 378 | -``` | |
| 379 | - | |
| 380 | -## Step 5: Testing Your Workflow | |
| 381 | - | |
| 382 | -### Test Locally First | |
| 383 | - | |
| 384 | -Before setting up automation, test the workflow locally: | |
| 385 | - | |
| 386 | -**Test 1: Session Analysis** | |
| 387 | - | |
| 388 | -```bash | |
| 389 | -cn -p "[Paste the PostHog analysis prompt from Step 2]" | |
| 390 | -``` | |
| 391 | - | |
| 392 | -Expected: Analysis output with 3 formatted GitHub issues | |
| 393 | - | |
| 394 | -**Test 2: Issue Creation** | |
| 395 | - | |
| 396 | -```bash | |
| 397 | -cn -p "[Paste the GitHub issue creation prompt from Step 3 with your analysis results]" | |
| 398 | -``` | |
| 433 | + ``` | |
| 399 | 434 | |
| 400 | -Expected: Confirmation of GitHub issues created with URLs | |
| 435 | + </Tab> | |
| 436 | +</Tabs> | |
| 401 | 437 | |
| 402 | 438 | ### Test the GitHub Actions Workflow |
| 403 | 439 | |
| @@ -406,48 +442,28 @@ | ||
| 406 | 442 | 3. **Verify Issues**: Check that GitHub issues were created in your repository |
| 407 | 443 | |
| 408 | 444 | <Check> |
| 409 | - **Success Indicators:** - PostHog API returns session data (not empty) - | |
| 410 | - Continue CLI generates analysis with identified issues - GitHub issues are | |
| 411 | - created with proper labels and formatting - Workflow completes without errors | |
| 412 | -</Check> | |
| 413 | 445 | |
| 414 | -## Troubleshooting | |
| 446 | + **Success Indicators:** | |
| 447 | + - PostHog API returns session data (not empty) | |
| 448 | + - Continue CLI generates analysis with identified issues | |
| 449 | + - GitHub issues are created with proper labels and formatting | |
| 450 | + - Workflow completes without errors | |
| 415 | 451 | |
| 416 | -If you encounter issues, use this helpful prompt to diagnose problems: | |
| 417 | - | |
| 418 | -```bash | |
| 419 | -cn -p "Help me set up my environment for PostHog session analysis. Please: | |
| 420 | - | |
| 421 | -1. Check if I have the required secrets configured in Continue CLI: | |
| 422 | - - POSTHOG_API_KEY | |
| 423 | - - POSTHOG_PROJECT_ID | |
| 424 | - - POSTHOG_HOST | |
| 425 | - - GITHUB_PAT | |
| 426 | - | |
| 427 | -2. If any are missing, guide me through: | |
| 428 | - - How to get PostHog Personal API Key from PostHog settings | |
| 429 | - - How to find my PostHog Project ID from the URL | |
| 430 | - - How to create a GitHub Personal Access Token with issues:write permission | |
| 431 | - - How to add these as secrets in Continue CLI | |
| 432 | - | |
| 433 | -3. Help me identify my GitHub repository owner and name by: | |
| 434 | - - Checking git remote origin URL | |
| 435 | - - Or asking me to provide them | |
| 436 | - | |
| 437 | -4. Test the API connections by making a simple API call to both PostHog and GitHub to verify the credentials work. | |
| 438 | - | |
| 439 | -Please walk me through this setup process step by step." | |
| 440 | -``` | |
| 452 | +</Check> | |
| 441 | 453 | |
| 442 | 454 | ## What You've Built |
| 443 | 455 | |
| 444 | 456 | After completing this guide, you have a complete **Continuous AI system** that: |
| 445 | 457 | |
| 446 | -✅ **Monitors user experience** - Automatically fetches and analyzes PostHog session data | |
| 447 | -✅ **Identifies problems intelligently** - Uses AI to spot patterns and technical issues | |
| 448 | -✅ **Creates actionable tasks** - Generates GitHub issues with specific recommendations | |
| 449 | -✅ **Runs autonomously** - Operates daily without manual intervention using GitHub Actions | |
| 450 | -✅ **Scales with your team** - Handles growing amounts of session data automatically | |
| 458 | +- **Monitors user experience** - Automatically fetches and analyzes PostHog session data | |
| 459 | + | |
| 460 | +- **Identifies problems intelligently** - Uses AI to spot patterns and technical issues | |
| 461 | + | |
| 462 | +- **Creates actionable tasks** - Generates GitHub issues with specific recommendations | |
| 463 | + | |
| 464 | +- **Runs autonomously** - Operates daily without manual intervention using GitHub Actions | |
| 465 | + | |
| 466 | +- **Scales with your team** - Handles growing amounts of session data automatically | |
| 451 | 467 | |
| 452 | 468 | <Card title="Continuous AI" icon="rocket"> |
| 453 | 469 | Your system now operates at **[Level 2 Continuous |
| @@ -459,10 +475,15 @@ | ||
| 459 | 475 | ## Security Best Practices |
| 460 | 476 | |
| 461 | 477 | <Warning> |
| 462 | - **Protect Your API Keys:** - Store all credentials as GitHub Secrets, never in | |
| 463 | - code - Use Continue CLI's secure secret storage - Limit token scopes to | |
| 464 | - minimum required permissions - Rotate API keys regularly (every 90 days | |
| 465 | - recommended) - Monitor token usage for unusual activity | |
| 478 | + | |
| 479 | + **Protect Your API Keys:** | |
| 480 | + - Store all credentials as GitHub Secrets, never in | |
| 481 | + code | |
| 482 | + - Use Continue CLI's secure secret storage | |
| 483 | + - Limit token scopes to minimum required permissions | |
| 484 | + - Rotate API keys regularly (every 90 days recommended) | |
| 485 | + - Monitor token usage for unusual activity | |
| 486 | + | |
| 466 | 487 | </Warning> |
| 467 | 488 | |
| 468 | 489 | ## Advanced Prompts |
added docs/guides/snyk-mcp-continue-cookbook.mdx +404 −0
| @@ -0,0 +1,404 @@ | ||
| 1 | +--- | |
| 2 | +title: "Automated Security Scanning with Snyk MCP and Continue" | |
| 3 | +description: "Set up an AI-powered security workflow that automatically scans your code, dependencies, infrastructure, and containers using natural language commands." | |
| 4 | +sidebarTitle: "Snyk Security Scanning with Continue" | |
| 5 | +--- | |
| 6 | + | |
| 7 | +<Card title="What You'll Build" icon="shield-halved"> | |
| 8 | + An automated security scanning system that uses Continue's AI agent with Snyk | |
| 9 | + MCP to identify vulnerabilities in code, dependencies, infrastructure, and | |
| 10 | + containers - all through simple natural language prompts | |
| 11 | +</Card> | |
| 12 | + | |
| 13 | +## Prerequisites | |
| 14 | + | |
| 15 | +Before starting, ensure you have: | |
| 16 | + | |
| 17 | +- Continue account with **Hub access** | |
| 18 | +- Read: [Understanding Agents — How to get started with Hub agents](/guides/understanding-agents#how-to-get-started-with-hub-agents) | |
| 19 | +- Node.js 18+ installed locally | |
| 20 | +- [Snyk account](https://snyk.io/) (free tier works) | |
| 21 | +- A local project to scan for vulnerabilities | |
| 22 | + | |
| 23 | +<Steps> | |
| 24 | + <Step title="Connect Snyk MCP via Continue Hub"> | |
| 25 | + Visit the [Snyk MCP on Continue Hub](https://hub.continue.dev/snyk/snyk-mcp) and click **Install** to add it to your Continue account. | |
| 26 | + | |
| 27 | + This will add Snyk MCP to your agent's available tools. The Hub listing automatically configures the MCP command: | |
| 28 | + ```bash | |
| 29 | + npx -y snyk@latest mcp -t stdio | |
| 30 | + ``` | |
| 31 | + | |
| 32 | + <Tip> | |
| 33 | + **Alternative installation methods:** | |
| 34 | + 1. **Quick CLI install**: `cn -p --mcp snyk/snyk-mcp` | |
| 35 | + 2. **Manual configuration**: Add the MCP to your `~/.continue/config.json` under the `mcpServers` section | |
| 36 | + | |
| 37 | + Once installed, Snyk MCP tools become available to your Continue agent for all prompts. | |
| 38 | + </Tip> | |
| 39 | + | |
| 40 | + <Info> | |
| 41 | + The MCP will request authentication and folder trust permissions when first used. | |
| 42 | + This is handled automatically by the Continue agent. | |
| 43 | + </Info> | |
| 44 | + | |
| 45 | + </Step> | |
| 46 | + | |
| 47 | + <Step title="Add Secure-at-Inception Rules"> | |
| 48 | + Install the [Snyk Secure-at-Inception rules](https://hub.continue.dev/snyk/secure-at-inception) from the Hub to enable automatic security scanning. | |
| 49 | + | |
| 50 | + **How to add rules to your agent:** | |
| 51 | + 1. Visit the rules link above and click **Install** | |
| 52 | + 2. The rules will be added to your agent configuration automatically | |
| 53 | + 3. Rules apply globally to all your Continue sessions | |
| 54 | + | |
| 55 | + These rules configure your agent to: | |
| 56 | + - **Run [SAST](https://snyk.io/learn/application-security/sast/) scans** on newly generated or modified code | |
| 57 | + - **Check dependencies** when adding or updating packages | |
| 58 | + - **Auto-fix issues** using Snyk's recommendations, then rescan | |
| 59 | + | |
| 60 | + </Step> | |
| 61 | + | |
| 62 | + <Step title="Authenticate with Snyk"> | |
| 63 | + Use this prompt with your Continue agent to set up authentication: | |
| 64 | + | |
| 65 | + ``` | |
| 66 | + Check Snyk auth status. If not authenticated, authenticate me and confirm my org context. | |
| 67 | + ``` | |
| 68 | + | |
| 69 | + Or use the Continue CLI: | |
| 70 | + ```bash | |
| 71 | + cn -p "Check Snyk auth status. If not authenticated, authenticate me and confirm my org context." | |
| 72 | + ``` | |
| 73 | + | |
| 74 | + <Tip> | |
| 75 | + A browser window will open for Snyk login. After authenticating, approve | |
| 76 | + the request to trust your project folder when prompted. | |
| 77 | + </Tip> | |
| 78 | + | |
| 79 | + </Step> | |
| 80 | +</Steps> | |
| 81 | + | |
| 82 | +## Security Scanning Recipes | |
| 83 | + | |
| 84 | +Now you can use natural language prompts to run comprehensive security scans. The Continue agent automatically calls the appropriate Snyk MCP tools. | |
| 85 | + | |
| 86 | +<Info> | |
| 87 | + **Where to run these workflows:** | |
| 88 | + - **IDE Extensions**: Use Continue in VS Code, JetBrains, or other supported IDEs | |
| 89 | + - **Terminal (TUI mode)**: Run `cn` to enter interactive mode, then type your prompts | |
| 90 | + - **CLI (headless mode)**: Use `cn -p "your prompt"` for one-off commands | |
| 91 | + | |
| 92 | + **Test in Plan Mode First**: Before running security scans that might make | |
| 93 | + changes, test your prompts in plan mode (see the [Plan Mode | |
| 94 | + Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes in TUI/IDE). This | |
| 95 | + shows you what the agent will do without executing it. For example: `"Run a | |
| 96 | + Snyk Code scan and fix the top 3 issues"` | |
| 97 | +</Info> | |
| 98 | + | |
| 99 | +### Code Vulnerability Scanning ([SAST](https://snyk.io/learn/application-security/sast/)) | |
| 100 | + | |
| 101 | +<Card title="Static Application Security Testing" icon="code"> | |
| 102 | + Scan your source code for security vulnerabilities and code quality issues. | |
| 103 | + | |
| 104 | +**Example prompt:** | |
| 105 | +``` | |
| 106 | +Run a Snyk Code scan on this repo with severity threshold medium. | |
| 107 | +Summarize issues with file:line. Propose minimal diffs for the top 3 | |
| 108 | +and rerun to verify. | |
| 109 | +``` | |
| 110 | + | |
| 111 | +**Using Continue CLI:** | |
| 112 | +```bash | |
| 113 | +cn -p "Run a Snyk Code scan on this repo with severity threshold medium. Summarize issues with file:line. Propose minimal diffs for the top 3 and rerun to verify." | |
| 114 | +``` | |
| 115 | + | |
| 116 | +</Card> | |
| 117 | + | |
| 118 | +### Dependency Scanning ([SCA](https://snyk.io/learn/software-composition-analysis-sca/)) | |
| 119 | + | |
| 120 | +<Card title="Software Composition Analysis" icon="cube"> | |
| 121 | + Check open source dependencies for known vulnerabilities. | |
| 122 | + | |
| 123 | +**Example prompt:** | |
| 124 | +``` | |
| 125 | +Run Snyk Open Source on this repo (include dev deps). | |
| 126 | +Summarize vulnerable paths and propose a minimal-risk upgrade plan. | |
| 127 | +Re-test after the plan (dry run). | |
| 128 | +``` | |
| 129 | + | |
| 130 | +**Using Continue CLI:** | |
| 131 | +```bash | |
| 132 | +cn -p "Run Snyk Open Source on this repo (include dev deps). Summarize vulnerable paths and propose a minimal-risk upgrade plan. Re-test after the plan (dry run)." | |
| 133 | +``` | |
| 134 | + | |
| 135 | +</Card> | |
| 136 | + | |
| 137 | +### Infrastructure as Code ([IaC](https://snyk.io/learn/infrastructure-as-code-iac/)) | |
| 138 | + | |
| 139 | +<Card title="IaC Security" icon="cloud"> | |
| 140 | + Scan Terraform, CloudFormation, and Kubernetes configs for misconfigurations. | |
| 141 | + | |
| 142 | +**Example prompt:** | |
| 143 | +``` | |
| 144 | +Scan ./infra with Snyk IaC. Report high/critical misconfigs | |
| 145 | +with exact files/lines. Provide code changes and re-scan to confirm. | |
| 146 | +``` | |
| 147 | + | |
| 148 | +**Using Continue CLI:** | |
| 149 | +```bash | |
| 150 | +cn -p "Scan ./infra with Snyk IaC. Report high/critical misconfigs with exact files/lines. Provide code changes and re-scan to confirm." | |
| 151 | +``` | |
| 152 | + | |
| 153 | +</Card> | |
| 154 | + | |
| 155 | +### Container Scanning | |
| 156 | + | |
| 157 | +<Card title="Container Security" icon="docker"> | |
| 158 | + Analyze Docker images for vulnerabilities in base images and packages. | |
| 159 | + | |
| 160 | +**Example prompt:** | |
| 161 | +``` | |
| 162 | +Scan image my-api:latest. Exclude base image vulns. | |
| 163 | +Print dependency tree. Recommend a safer base image or upgrades. | |
| 164 | +Re-test after the change (dry run). | |
| 165 | +``` | |
| 166 | + | |
| 167 | +**Using Continue CLI:** | |
| 168 | +```bash | |
| 169 | +cn -p "Scan image my-api:latest. Exclude base image vulns. Print dependency tree. Recommend a safer base image or upgrades. Re-test after the change (dry run)." | |
| 170 | +``` | |
| 171 | + | |
| 172 | +</Card> | |
| 173 | + | |
| 174 | +### Pull Request Scanning | |
| 175 | + | |
| 176 | +<Card title="Changed Files Only" icon="code-branch"> | |
| 177 | + Focus scanning on modified files to catch issues before merging. | |
| 178 | + | |
| 179 | +**Example prompt:** | |
| 180 | +``` | |
| 181 | +Scan only files changed since origin/main with Snyk Code. | |
| 182 | +Block if new high issues would be introduced. Show deltas. | |
| 183 | +``` | |
| 184 | + | |
| 185 | +**Using Continue CLI:** | |
| 186 | +```bash | |
| 187 | +cn -p "Scan only files changed since origin/main with Snyk Code. Block if new high issues would be introduced. Show deltas." | |
| 188 | +``` | |
| 189 | + | |
| 190 | +</Card> | |
| 191 | + | |
| 192 | +### Security Learning | |
| 193 | + | |
| 194 | +<Card title="Snyk Learn Integration" icon="graduation-cap"> | |
| 195 | + Access security education resources based on identified vulnerabilities ([CWE](https://cwe.mitre.org/)). | |
| 196 | + | |
| 197 | +**Example prompt:** | |
| 198 | +``` | |
| 199 | +Open Snyk Learn lessons related to the top CWE(s) from this scan. | |
| 200 | +``` | |
| 201 | + | |
| 202 | +**Using Continue CLI:** | |
| 203 | +```bash | |
| 204 | +cn -p "Open Snyk Learn lessons related to the top CWE(s) from this scan." | |
| 205 | +``` | |
| 206 | + | |
| 207 | +</Card> | |
| 208 | + | |
| 209 | +## Continuous Security with GitHub Actions | |
| 210 | + | |
| 211 | +This example demonstrates a **Continuous AI workflow** where security scanning runs automatically in your CI/CD pipeline using Continue CLI in headless mode (`cn -p`) with Snyk MCP. | |
| 212 | + | |
| 213 | +### Add GitHub Secrets | |
| 214 | + | |
| 215 | +Navigate to **Repository Settings → Secrets and variables → Actions** and add: | |
| 216 | + | |
| 217 | +- `CONTINUE_API_KEY`: Your Continue API key from [hub.continue.dev/settings/api-keys](https://hub.continue.dev/settings/api-keys) | |
| 218 | + | |
| 219 | +### Create Workflow File | |
| 220 | + | |
| 221 | +Create `.github/workflows/snyk-security.yml` in your repository: | |
| 222 | + | |
| 223 | +```yaml | |
| 224 | +name: Security Scanning with Snyk MCP | |
| 225 | + | |
| 226 | +on: | |
| 227 | + pull_request: | |
| 228 | + branches: [main] | |
| 229 | + push: | |
| 230 | + branches: [main] | |
| 231 | + schedule: | |
| 232 | + - cron: "0 8 * * *" # Daily at 8 AM UTC | |
| 233 | + | |
| 234 | +jobs: | |
| 235 | + security-scan: | |
| 236 | + runs-on: ubuntu-latest | |
| 237 | + | |
| 238 | + steps: | |
| 239 | + - uses: actions/checkout@v4 | |
| 240 | + | |
| 241 | + - name: Set up Node.js | |
| 242 | + uses: actions/setup-node@v4 | |
| 243 | + with: | |
| 244 | + node-version: "18" | |
| 245 | + | |
| 246 | + - name: Install Continue CLI | |
| 247 | + run: | | |
| 248 | + npm install -g @continuedev/cli | |
| 249 | + echo "✅ Continue CLI installed" | |
| 250 | + | |
| 251 | + - name: Authenticate Continue CLI | |
| 252 | + run: | | |
| 253 | + cn auth login --api-key "${{ secrets.CONTINUE_API_KEY }}" | |
| 254 | + echo "✅ Continue CLI authenticated" | |
| 255 | + | |
| 256 | + - name: Run Security Scans | |
| 257 | + run: | | |
| 258 | + echo "🔍 Running code vulnerability scan..." | |
| 259 | + cn -p "Run Snyk Code scan with severity high on this repo. | |
| 260 | + Fail if any high issues are present." | |
| 261 | + | |
| 262 | + echo "📦 Checking dependencies..." | |
| 263 | + cn -p "Run Snyk Open Source on this repo. | |
| 264 | + Fail on fixable high issues." | |
| 265 | + | |
| 266 | + - name: Generate Security Report | |
| 267 | + if: always() | |
| 268 | + run: | | |
| 269 | + cn -p "Generate a markdown security report summarizing: | |
| 270 | + - Total vulnerabilities by severity | |
| 271 | + - Top 3 critical issues (if any) | |
| 272 | + - Recommended next steps | |
| 273 | + Save to security-report.md" | |
| 274 | + | |
| 275 | + - name: Upload Security Report | |
| 276 | + uses: actions/upload-artifact@v4 | |
| 277 | + if: always() | |
| 278 | + with: | |
| 279 | + name: security-report-${{ github.run_number }} | |
| 280 | + path: security-report.md | |
| 281 | + retention-days: 30 | |
| 282 | +``` | |
| 283 | + | |
| 284 | +<Info> | |
| 285 | + The Snyk MCP authentication is handled through Continue Hub. No need to manage | |
| 286 | + Snyk tokens directly in CI - the agent manages authentication. | |
| 287 | +</Info> | |
| 288 | + | |
| 289 | +## Security Guardrails | |
| 290 | + | |
| 291 | +Implement automated security policies using Continue's rule system. See the [Rules deep dive](/customize/deep-dives/rules) for authoring tips. | |
| 292 | + | |
| 293 | +<Note> | |
| 294 | + **Coming Soon**: These security guardrail prompts will be available as pre-configured rules on the Continue Hub for easy installation. | |
| 295 | +</Note> | |
| 296 | + | |
| 297 | +<Card title="Pre-commit Scanning" icon="lock"> | |
| 298 | + ```bash | |
| 299 | + "Always run Snyk Code before committing newly | |
| 300 | + generated code; refuse to proceed if high | |
| 301 | + issues remain." | |
| 302 | + ``` | |
| 303 | +</Card> | |
| 304 | + | |
| 305 | +<Card title="Dependency Safety" icon="shield-check"> | |
| 306 | + ```bash | |
| 307 | + "When adding/updating a dependency, run Snyk Open Source, choose the | |
| 308 | + lowest-risk upgrade, and re-test." | |
| 309 | + ``` | |
| 310 | +</Card> | |
| 311 | + | |
| 312 | +<Card title="Container Hardening" icon="box"> | |
| 313 | + ```bash | |
| 314 | + "Before building containers, scan base images and recommend | |
| 315 | + security-hardened alternatives." | |
| 316 | + ``` | |
| 317 | +</Card> | |
| 318 | + | |
| 319 | +<Card title="IaC Compliance" icon="clipboard-list"> | |
| 320 | + ```bash | |
| 321 | + "Scan all Terraform changes for compliance | |
| 322 | + violations before applying infrastructure." | |
| 323 | + ``` | |
| 324 | +</Card> | |
| 325 | + | |
| 326 | +<Tip> | |
| 327 | + Enable the **Secure-at-Inception** rules from the Hub to automatically apply | |
| 328 | + these guardrails to all code generation and modifications. | |
| 329 | +</Tip> | |
| 330 | + | |
| 331 | +## Troubleshooting | |
| 332 | + | |
| 333 | +### Authentication Issues | |
| 334 | + | |
| 335 | +```bash | |
| 336 | +"Check Snyk auth status and current org. If not authenticated, | |
| 337 | +help me authenticate. Then run a quick Code scan on ./ | |
| 338 | +with severity medium and print one example issue." | |
| 339 | +``` | |
| 340 | + | |
| 341 | +### Fix Validation | |
| 342 | + | |
| 343 | +```bash | |
| 344 | +"Propose minimal diffs only in affected files, | |
| 345 | +then rerun the same Snyk scan to confirm resolution." | |
| 346 | +``` | |
| 347 | + | |
| 348 | +### Connection Problems | |
| 349 | + | |
| 350 | +<Check> | |
| 351 | + **Verification Steps:** - Snyk MCP is installed via [Continue | |
| 352 | + Hub](https://hub.continue.dev/snyk/snyk-mcp) - Secure-at-Inception rules are | |
| 353 | + [enabled](https://hub.continue.dev/snyk/secure-at-inception) - Authentication | |
| 354 | + completed successfully - Project folder has been trusted | |
| 355 | +</Check> | |
| 356 | + | |
| 357 | +## What You've Built | |
| 358 | + | |
| 359 | +After completing this guide, you have a complete **AI-powered security system** that: | |
| 360 | + | |
| 361 | +✅ Uses natural language — Simple prompts instead of complex CLI commands | |
| 362 | +✅ Fixes automatically — AI suggests and validates security fixes | |
| 363 | +✅ Runs continuously — Automated scanning in CI/CD pipelines | |
| 364 | +✅ Enforces guardrails — Security rules prevent vulnerable code from shipping | |
| 365 | + | |
| 366 | +<Card title="Continuous AI" icon="rocket"> | |
| 367 | + Your security workflow now operates at **[Level 2 Continuous | |
| 368 | + AI](https://blog.continue.dev/what-is-continuous-ai-a-developers-guide/)** - | |
| 369 | + AI handles routine security scanning and remediation with human oversight | |
| 370 | + through review and approval of fixes. | |
| 371 | +</Card> | |
| 372 | + | |
| 373 | +## Next Steps | |
| 374 | + | |
| 375 | +1. **Run your first scan** - Try the [SAST](https://snyk.io/learn/application-security/sast/) prompt on your current project | |
| 376 | +2. **Review findings** - Analyze the security report and implement fixes | |
| 377 | +3. **Set up CI pipeline** - Add the GitHub Actions workflow to your repo | |
| 378 | +4. **Customize rules** - Add project-specific security policies | |
| 379 | +5. **Monitor trends** - Track [vulnerability](https://snyk.io/learn/security-vulnerability/) reduction over time | |
| 380 | + | |
| 381 | +## Additional Resources | |
| 382 | + | |
| 383 | +<CardGroup cols={2}> | |
| 384 | + <Card title="Snyk Documentation" icon="book" href="https://docs.snyk.io"> | |
| 385 | + Complete Snyk platform documentation | |
| 386 | + </Card> | |
| 387 | + <Card title="Continue Hub" icon="plug" href="https://hub.continue.dev"> | |
| 388 | + Explore more MCP integrations and agents | |
| 389 | + </Card> | |
| 390 | + <Card | |
| 391 | + title="Security Best Practices" | |
| 392 | + icon="shield" | |
| 393 | + href="https://snyk.io/learn" | |
| 394 | + > | |
| 395 | + Learn about secure coding practices | |
| 396 | + </Card> | |
| 397 | + <Card | |
| 398 | + title="MCP Concepts" | |
| 399 | + icon="puzzle-piece" | |
| 400 | + href="https://docs.snyk.io/integrations/developer-guardrails-for-agentic-workflows" | |
| 401 | + > | |
| 402 | + Understanding MCP architecture | |
| 403 | + </Card> | |
| 404 | +</CardGroup> |
modified docs/reference/yaml-migration.mdx +42 −27
| @@ -1,17 +1,16 @@ | ||
| 1 | 1 | --- |
| 2 | 2 | title: "Migrating Config to YAML" |
| 3 | -description: "Continue's YAML configuration format provides more readable, maintainable, consistent configuration files, as well as new configuration options and removal of some old configuration options. YAML is the preferred format and will be used to integrate with future Continue products. Below is a brief guide for migration from to ." | |
| 3 | +description: "Continue's YAML configuration format provides more readable, maintainable, consistent configuration files, as well as new configuration options and removal of some old configuration options. YAML is the preferred format and will be used to integrate with future Continue products. Below is a brief guide for migration from config.json to config.yaml." | |
| 4 | 4 | --- |
| 5 | 5 | |
| 6 | 6 | See also |
| 7 | 7 | |
| 8 | 8 | - [Intro to YAML](https://yaml.org/) |
| 9 | -- [JSON Continue Config Reference](/reference) | |
| 10 | 9 | - [YAML Continue Config Reference](/reference) |
| 11 | 10 | |
| 12 | 11 | ## Create YAML file |
| 13 | 12 | |
| 14 | -Create a `config.yaml` file in your Continue Global Directory (`~/.continue` on Mac, `%USERPROFILE%\.continue`) alongside your current `config.json` file. If a `config.yaml` file is present, it will be loaded instead of `config.json`. | |
| 13 | +Create a `config.yaml` file in your Continue Global Directory (`~/.continue` on Mac, `%USERPROFILE%\.continue`) alongside your current config.json file. If a `config.yaml` file is present, it will be loaded instead of config.json. | |
| 15 | 14 | |
| 16 | 15 | Give your configuration a `name` and a `version`: |
| 17 | 16 | |
| @@ -87,12 +86,12 @@ | ||
| 87 | 86 | |
| 88 | 87 | config.yaml |
| 89 | 88 | |
| 90 | -``` | |
| 89 | +```yaml | |
| 91 | 90 | models: |
| 92 | 91 | - name: GPT-4 |
| 93 | 92 | provider: openai |
| 94 | 93 | model: gpt-4 |
| 95 | - apiKey: <YOUR_OPENAI_KEY> | |
| 94 | + apiKey: <YOUR_OPENAI_API_KEY> | |
| 96 | 95 | defaultCompletionOptions: |
| 97 | 96 | temperature: 0.5 |
| 98 | 97 | maxTokens: 2000 |
| @@ -101,7 +100,8 @@ | ||
| 101 | 100 | - edit |
| 102 | 101 | - name: My Voyage Reranker |
| 103 | 102 | provider: voyage |
| 104 | - apiKey: <YOUR_VOYAGE_KEY> | |
| 103 | + model: rerank-2 | |
| 104 | + apiKey: <YOUR_VOYAGE_API_KEY> | |
| 105 | 105 | roles: |
| 106 | 106 | - rerank |
| 107 | 107 | - name: My Starcoder |
| @@ -111,22 +111,25 @@ | ||
| 111 | 111 | - autocomplete |
| 112 | 112 | - name: My Ada Embedder |
| 113 | 113 | provider: openai |
| 114 | - apiKey: <YOUR_ADA_API_KEY> | |
| 114 | + model: text-embedding-ada-002 | |
| 115 | + apiKey: <YOUR_OPENAI_API_KEY> | |
| 115 | 116 | roles: |
| 116 | 117 | - embed |
| 117 | 118 | embedOptions: |
| 118 | - - maxChunkSize: 256 | |
| 119 | - - maxBatchSize: 5 | |
| 119 | + maxChunkSize: 256 | |
| 120 | + maxBatchSize: 5 | |
| 120 | 121 | - name: Ollama Autodetect |
| 121 | 122 | provider: ollama |
| 122 | 123 | model: AUTODETECT |
| 123 | - - name: My Open AI Compatible Model - Apply | |
| 124 | + roles: | |
| 125 | + - chat | |
| 126 | + - name: My Open AI Compatible Model | |
| 124 | 127 | provider: openai |
| 125 | 128 | model: my-openai-compatible-model |
| 126 | 129 | apiBase: http://3.3.3.3/v1 |
| 127 | 130 | requestOptions: |
| 128 | 131 | headers: |
| 129 | - X-Auth-Token: <MY_API_KEY> | |
| 132 | + X-Auth-Token: <API_KEY> | |
| 130 | 133 | roles: |
| 131 | 134 | - chat |
| 132 | 135 | - apply |
| @@ -159,7 +162,7 @@ | ||
| 159 | 162 | |
| 160 | 163 | config.yaml |
| 161 | 164 | |
| 162 | -``` | |
| 165 | +```yaml | |
| 163 | 166 | context: |
| 164 | 167 | - provider: docs |
| 165 | 168 | - provider: codebase |
| @@ -178,14 +181,16 @@ | ||
| 178 | 181 | config.json |
| 179 | 182 | |
| 180 | 183 | ```json |
| 181 | -{ "systemMessage": "Always give concise responses" } | |
| 184 | +{ | |
| 185 | + "systemMessage": "Always give concise responses" | |
| 186 | +} | |
| 182 | 187 | ``` |
| 183 | 188 | |
| 184 | 189 | **After** |
| 185 | 190 | |
| 186 | 191 | config.yaml |
| 187 | 192 | |
| 188 | -``` | |
| 193 | +```yaml | |
| 189 | 194 | rules: |
| 190 | 195 | - Always give concise responses |
| 191 | 196 | ``` |
| @@ -214,7 +219,7 @@ | ||
| 214 | 219 | |
| 215 | 220 | config.yaml |
| 216 | 221 | |
| 217 | -``` | |
| 222 | +```yaml | |
| 218 | 223 | prompts: |
| 219 | 224 | - name: check |
| 220 | 225 | description: Check for mistakes in my code |
| @@ -239,8 +244,14 @@ | ||
| 239 | 244 | ```json |
| 240 | 245 | { |
| 241 | 246 | "docs": [ |
| 242 | - { "startUrl": "https://docs.nestjs.com/", "title": "nest.js" }, | |
| 243 | - { "startUrl": "https://mysite.com/docs/", "title": "My site" } | |
| 247 | + { | |
| 248 | + "startUrl": "https://docs.nestjs.com/", | |
| 249 | + "title": "nest.js" | |
| 250 | + }, | |
| 251 | + { | |
| 252 | + "startUrl": "https://mysite.com/docs/", | |
| 253 | + "title": "My site" | |
| 254 | + } | |
| 244 | 255 | ] |
| 245 | 256 | } |
| 246 | 257 | ``` |
| @@ -249,7 +260,7 @@ | ||
| 249 | 260 | |
| 250 | 261 | config.yaml |
| 251 | 262 | |
| 252 | -``` | |
| 263 | +```yaml | |
| 253 | 264 | docs: |
| 254 | 265 | - name: nest.js |
| 255 | 266 | startUrl: https://docs.nestjs.com/ |
| @@ -279,8 +290,14 @@ | ||
| 279 | 290 | "transport": { |
| 280 | 291 | "type": "stdio", |
| 281 | 292 | "command": "uvx", |
| 282 | - "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"], | |
| 283 | - "env": { "KEY": "<VALUE>" } | |
| 293 | + "args": [ | |
| 294 | + "mcp-server-sqlite", | |
| 295 | + "--db-path", | |
| 296 | + "/Users/NAME/test.db" | |
| 297 | + ], | |
| 298 | + "env": { | |
| 299 | + "KEY": "<VALUE>" | |
| 300 | + } | |
| 284 | 301 | } |
| 285 | 302 | } |
| 286 | 303 | ] |
| @@ -292,7 +309,7 @@ | ||
| 292 | 309 | |
| 293 | 310 | config.yaml |
| 294 | 311 | |
| 295 | -``` | |
| 312 | +```yaml | |
| 296 | 313 | mcpServers: |
| 297 | 314 | - name: My MCP Server |
| 298 | 315 | command: uvx |
| @@ -308,13 +325,11 @@ | ||
| 308 | 325 | |
| 309 | 326 | ## Deprecated configuration options |
| 310 | 327 | |
| 311 | -Some deprecated `config.json` settings are no longer stored in config and have been moved to be editable through the user settings (Gear Icon). If found in `config.json`, they will be auto-migrated to User Settings and removed from `config.json`. | |
| 312 | - | |
| 313 | -See the [JSON Config Reference](/reference) for more information on fully deprecated options. | |
| 328 | +Some deprecated config.json settings are no longer stored in config and have been moved to be editable through the user settings (Gear Icon). If found in config.json, they will be auto-migrated to User Settings and removed from config.json. | |
| 314 | 329 | |
| 315 | -The following top-level fields from `config.json` still work when using `config.json` but have been deprecated and don't have a YAML equivalent: | |
| 330 | +The following top-level fields from config.json have been deprecated and don't have a config.yaml equivalent: | |
| 316 | 331 | |
| 317 | -- Slash commands (JSON `slashCommands`) | |
| 332 | +- Slash commands (`slashCommands`) | |
| 318 | 333 | |
| 319 | 334 | - top-level `requestOptions` |
| 320 | 335 | |
| @@ -332,7 +347,7 @@ | ||
| 332 | 347 | |
| 333 | 348 | - `analytics` |
| 334 | 349 | |
| 335 | -The following top-level fields from `config.json` have been deprecated. Most UI-related and user-specific options will move into a settings page in the UI | |
| 350 | +The following top-level fields from config.json have been deprecated. Most UI-related and user-specific options will move into a settings page in the UI | |
| 336 | 351 | |
| 337 | 352 | - `customCommands` |
| 338 | 353 | - `experimental` |
modified extensions/cli/src/commands/serve.helpers.ts +0 −2
| @@ -119,9 +119,7 @@ | ||
| 119 | 119 | model: any; |
| 120 | 120 | isProcessing: boolean; |
| 121 | 121 | lastActivity: number; |
| 122 | - messageQueue: string[]; | |
| 123 | 122 | currentAbortController: AbortController | null; |
| 124 | - shouldInterrupt: boolean; | |
| 125 | 123 | serverRunning: boolean; |
| 126 | 124 | pendingPermission: PendingPermission | null; |
| 127 | 125 | systemMessage?: string; |
modified extensions/cli/src/commands/serve.ts +29 −28
| @@ -16,7 +16,8 @@ | ||
| 16 | 16 | ConfigServiceState, |
| 17 | 17 | ModelServiceState, |
| 18 | 18 | } from "../services/types.js"; |
| 19 | -import { createSession, getSessionPersistenceSnapshot } from "../session.js"; | |
| 19 | +import { createSession, getCompleteStateSnapshot } from "../session.js"; | |
| 20 | +import { messageQueue } from "../stream/messageQueue.js"; | |
| 20 | 21 | import { constructSystemMessage } from "../systemMessage.js"; |
| 21 | 22 | import { telemetryService } from "../telemetry/telemetryService.js"; |
| 22 | 23 | import { gracefulExit } from "../util/exit.js"; |
| @@ -138,9 +139,7 @@ | ||
| 138 | 139 | model, |
| 139 | 140 | isProcessing: false, |
| 140 | 141 | lastActivity: Date.now(), |
| 141 | - messageQueue: [], | |
| 142 | 142 | currentAbortController: null, |
| 143 | - shouldInterrupt: false, | |
| 144 | 143 | serverRunning: true, |
| 145 | 144 | pendingPermission: null, |
| 146 | 145 | }; |
| @@ -160,7 +159,13 @@ | ||
| 160 | 159 | storageOption: options.id, |
| 161 | 160 | accessToken, |
| 162 | 161 | syncSessionHistory, |
| 163 | - getSessionSnapshot: () => getSessionPersistenceSnapshot(state.session), | |
| 162 | + getCompleteStateSnapshot: () => | |
| 163 | + getCompleteStateSnapshot( | |
| 164 | + state.session, | |
| 165 | + state.isProcessing, | |
| 166 | + messageQueue.getQueueLength(), | |
| 167 | + state.pendingPermission, | |
| 168 | + ), | |
| 164 | 169 | isActive: () => state.serverRunning, |
| 165 | 170 | }); |
| 166 | 171 | |
| @@ -182,12 +187,13 @@ | ||
| 182 | 187 | app.get("/state", (_req: Request, res: Response) => { |
| 183 | 188 | state.lastActivity = Date.now(); |
| 184 | 189 | syncSessionHistory(); |
| 185 | - res.json({ | |
| 186 | - session: state.session, // Return session directly instead of converting | |
| 187 | - isProcessing: state.isProcessing, | |
| 188 | - messageQueueLength: state.messageQueue.length, | |
| 189 | - pendingPermission: state.pendingPermission, | |
| 190 | - }); | |
| 190 | + const stateSnapshot = getCompleteStateSnapshot( | |
| 191 | + state.session, | |
| 192 | + state.isProcessing, | |
| 193 | + messageQueue.getQueueLength(), | |
| 194 | + state.pendingPermission, | |
| 195 | + ); | |
| 196 | + res.json(stateSnapshot); | |
| 191 | 197 | }); |
| 192 | 198 | |
| 193 | 199 | // POST /message - Queue a message and potentially interrupt |
| @@ -200,17 +206,11 @@ | ||
| 200 | 206 | } |
| 201 | 207 | |
| 202 | 208 | // Queue the message |
| 203 | - state.messageQueue.push(message); | |
| 204 | - | |
| 205 | - // If currently processing, set interrupt flag | |
| 206 | - if (state.isProcessing && state.currentAbortController) { | |
| 207 | - state.shouldInterrupt = true; | |
| 208 | - } | |
| 209 | + await messageQueue.enqueueMessage(message); | |
| 209 | 210 | |
| 210 | 211 | res.json({ |
| 211 | 212 | queued: true, |
| 212 | - position: state.messageQueue.length, | |
| 213 | - willInterrupt: state.shouldInterrupt, | |
| 213 | + position: messageQueue.getQueueLength(), | |
| 214 | 214 | }); |
| 215 | 215 | |
| 216 | 216 | // Process messages if not already processing |
| @@ -303,9 +303,6 @@ | ||
| 303 | 303 | state.currentAbortController.abort(); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - // Clear the message queue | |
| 307 | - state.messageQueue = []; | |
| 308 | - | |
| 309 | 306 | // Clean up intervals |
| 310 | 307 | if (inactivityChecker) { |
| 311 | 308 | clearInterval(inactivityChecker); |
| @@ -325,7 +322,7 @@ | ||
| 325 | 322 | setTimeout(handleExitResponse, 100); |
| 326 | 323 | }); |
| 327 | 324 | |
| 328 | - const server = app.listen(port, () => { | |
| 325 | + const server = app.listen(port, async () => { | |
| 329 | 326 | console.log(chalk.green(`Server started on http://localhost:${port}`)); |
| 330 | 327 | console.log(chalk.dim("Endpoints:")); |
| 331 | 328 | console.log(chalk.dim(" GET /state - Get current agent state")); |
| @@ -354,7 +351,7 @@ | ||
| 354 | 351 | // If initial prompt provided, queue it for processing |
| 355 | 352 | if (actualPrompt) { |
| 356 | 353 | console.log(chalk.dim("\nProcessing initial prompt...")); |
| 357 | - state.messageQueue.push(actualPrompt); | |
| 354 | + await messageQueue.enqueueMessage(actualPrompt); | |
| 358 | 355 | processMessages(state, llmApi); |
| 359 | 356 | } |
| 360 | 357 | }); |
| @@ -383,10 +380,14 @@ | ||
| 383 | 380 | |
| 384 | 381 | async function processMessages(state: ServerState, llmApi: any) { |
| 385 | 382 | let processedMessage = false; |
| 386 | - while (state.messageQueue.length > 0 && state.serverRunning) { | |
| 387 | - const userMessage = state.messageQueue.shift()!; | |
| 383 | + while (state.serverRunning) { | |
| 384 | + const queuedMessage = messageQueue.getNextMessage(); | |
| 385 | + if (!queuedMessage) { | |
| 386 | + break; | |
| 387 | + } | |
| 388 | + | |
| 389 | + const userMessage = queuedMessage.message; | |
| 388 | 390 | state.isProcessing = true; |
| 389 | - state.shouldInterrupt = false; | |
| 390 | 391 | state.lastActivity = Date.now(); |
| 391 | 392 | processedMessage = true; |
| 392 | 393 | |
| @@ -410,7 +411,7 @@ | ||
| 410 | 411 | state, |
| 411 | 412 | llmApi, |
| 412 | 413 | state.currentAbortController, |
| 413 | - () => state.shouldInterrupt, | |
| 414 | + () => false, | |
| 414 | 415 | ); |
| 415 | 416 | |
| 416 | 417 | // No direct persistence here; ChatHistoryService handles persistence when appropriate |
| @@ -443,7 +444,7 @@ | ||
| 443 | 444 | if ( |
| 444 | 445 | processedMessage && |
| 445 | 446 | state.serverRunning && |
| 446 | - state.messageQueue.length === 0 | |
| 447 | + messageQueue.getQueueLength() === 0 | |
| 447 | 448 | ) { |
| 448 | 449 | await storageSyncService.markAgentStatusUnread(); |
| 449 | 450 | } |
modified extensions/cli/src/hubLoader.test.ts +45 −2
| @@ -1,12 +1,15 @@ | ||
| 1 | 1 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
| 2 | 2 | |
| 3 | -import { | |
| 3 | +import * as hubLoader from "./hubLoader.js"; | |
| 4 | + | |
| 5 | +const { | |
| 4 | 6 | loadPackageFromHub, |
| 5 | 7 | mcpProcessor, |
| 6 | 8 | modelProcessor, |
| 7 | 9 | promptProcessor, |
| 8 | 10 | ruleProcessor, |
| 9 | -} from "./hubLoader.js"; | |
| 11 | + processRule, | |
| 12 | +} = hubLoader; | |
| 10 | 13 | |
| 11 | 14 | // Store the original fetch before any mocking |
| 12 | 15 | const originalFetch = global.fetch; |
| @@ -136,6 +139,46 @@ | ||
| 136 | 139 | }); |
| 137 | 140 | }); |
| 138 | 141 | |
| 142 | + describe("processRule", () => { | |
| 143 | + beforeEach(() => { | |
| 144 | + // Ensure mocks are set up properly for processRule tests | |
| 145 | + global.fetch = mockFetch; | |
| 146 | + }); | |
| 147 | + | |
| 148 | + it("should treat multi-line strings as inline rules", async () => { | |
| 149 | + const loadRuleSpy = vi | |
| 150 | + .spyOn(hubLoader, "loadRuleFromHub") | |
| 151 | + .mockResolvedValue("hub-content"); | |
| 152 | + | |
| 153 | + const multilineRule = "Line one\nEnsure /tmp is ignored\nFinal line"; | |
| 154 | + const result = await processRule(multilineRule); | |
| 155 | + | |
| 156 | + expect(result).toBe(multilineRule); | |
| 157 | + expect(loadRuleSpy).not.toHaveBeenCalled(); | |
| 158 | + | |
| 159 | + loadRuleSpy.mockRestore(); | |
| 160 | + }); | |
| 161 | + | |
| 162 | + it("should still treat owner/package strings as hub slugs", async () => { | |
| 163 | + // Mock fetch to return a proper response for this test | |
| 164 | + const JSZip = (await import("jszip")).default; | |
| 165 | + const zip = new JSZip(); | |
| 166 | + zip.file("rule.md", "hub-content"); | |
| 167 | + const zipBuffer = await zip.generateAsync({ type: "arraybuffer" }); | |
| 168 | + | |
| 169 | + mockFetch.mockResolvedValueOnce({ | |
| 170 | + ok: true, | |
| 171 | + arrayBuffer: () => Promise.resolve(zipBuffer), | |
| 172 | + } as Response); | |
| 173 | + | |
| 174 | + const slug = "owner/package"; | |
| 175 | + const result = await processRule(slug); | |
| 176 | + | |
| 177 | + expect(result).toBe("hub-content"); | |
| 178 | + expect(mockFetch).toHaveBeenCalled(); | |
| 179 | + }); | |
| 180 | + }); | |
| 181 | + | |
| 139 | 182 | describe("processors", () => { |
| 140 | 183 | it("should define rule processor correctly", () => { |
| 141 | 184 | expect(ruleProcessor.type).toBe("rule"); |
modified extensions/cli/src/hubLoader.ts +35 −18
| @@ -3,6 +3,11 @@ | ||
| 3 | 3 | import { env } from "./env.js"; |
| 4 | 4 | import { logger } from "./util/logger.js"; |
| 5 | 5 | |
| 6 | +/** | |
| 7 | + * Pattern to match valid hub slugs (owner/package format) | |
| 8 | + */ | |
| 9 | +const HUB_SLUG_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/; | |
| 10 | + | |
| 6 | 11 | /** |
| 7 | 12 | * Hub package type definitions |
| 8 | 13 | */ |
| @@ -220,28 +225,23 @@ | ||
| 220 | 225 | * Process a rule specification - supports file paths, hub slugs, or direct content |
| 221 | 226 | */ |
| 222 | 227 | export async function processRule(ruleSpec: string): Promise<string> { |
| 223 | - // If it looks like a hub slug (contains / but doesn't start with . or /) | |
| 224 | - if ( | |
| 225 | - ruleSpec.includes("/") && | |
| 226 | - !ruleSpec.startsWith(".") && | |
| 227 | - !ruleSpec.startsWith("/") | |
| 228 | - ) { | |
| 229 | - return await loadRuleFromHub(ruleSpec); | |
| 230 | - } | |
| 231 | - | |
| 232 | - // If it looks like a file path | |
| 233 | - if ( | |
| 234 | - ruleSpec.startsWith(".") || | |
| 235 | - ruleSpec.startsWith("/") || | |
| 236 | - ruleSpec.includes("/") || | |
| 237 | - ruleSpec.includes("\\") || | |
| 238 | - /\.[a-zA-Z]+$/.test(ruleSpec) // Has file extension at the end | |
| 239 | - ) { | |
| 228 | + const trimmedRuleSpec = ruleSpec.trim(); | |
| 229 | + const hasNewline = /[\r\n]/.test(ruleSpec); | |
| 230 | + | |
| 231 | + // If it looks like a file path (single line, typical path indicators) | |
| 232 | + const looksLikePath = | |
| 233 | + !hasNewline && | |
| 234 | + (trimmedRuleSpec.startsWith(".") || | |
| 235 | + trimmedRuleSpec.startsWith("/") || | |
| 236 | + trimmedRuleSpec.includes("\\") || | |
| 237 | + /\.[a-zA-Z]+$/.test(trimmedRuleSpec)); | |
| 238 | + | |
| 239 | + if (looksLikePath) { | |
| 240 | 240 | const fs = await import("fs"); |
| 241 | 241 | const path = await import("path"); |
| 242 | 242 | |
| 243 | 243 | try { |
| 244 | - const absolutePath = path.resolve(ruleSpec); | |
| 244 | + const absolutePath = path.resolve(trimmedRuleSpec); | |
| 245 | 245 | if (!fs.existsSync(absolutePath)) { |
| 246 | 246 | throw new Error(`Rule file not found: ${ruleSpec}`); |
| 247 | 247 | } |
| @@ -253,6 +253,23 @@ | ||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | + // Check if it might be a hub slug (contains "/" and is a single line) | |
| 257 | + if (!hasNewline && trimmedRuleSpec.includes("/")) { | |
| 258 | + const parts = trimmedRuleSpec.split("/"); | |
| 259 | + | |
| 260 | + // If it's exactly 2 parts and matches hub slug pattern, treat as hub slug | |
| 261 | + if (parts.length === 2 && HUB_SLUG_PATTERN.test(trimmedRuleSpec)) { | |
| 262 | + return await loadRuleFromHub(trimmedRuleSpec); | |
| 263 | + } | |
| 264 | + | |
| 265 | + // If it has more than 2 parts, it's an invalid hub slug | |
| 266 | + if (parts.length > 2) { | |
| 267 | + throw new Error( | |
| 268 | + `Invalid hub slug format. Expected "owner/package", got: ${trimmedRuleSpec}`, | |
| 269 | + ); | |
| 270 | + } | |
| 271 | + } | |
| 272 | + | |
| 256 | 273 | // Otherwise, treat it as direct string content |
| 257 | 274 | return ruleSpec; |
| 258 | 275 | } |
modified extensions/cli/src/services/StorageSyncService.test.ts +10 −10
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 | storageOption: undefined, |
| 56 | 56 | accessToken: "token", |
| 57 | 57 | syncSessionHistory: vi.fn(), |
| 58 | - getSessionSnapshot: vi.fn(), | |
| 58 | + getCompleteStateSnapshot: vi.fn(), | |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | expect(result).toBe(false); |
| @@ -69,7 +69,7 @@ | ||
| 69 | 69 | storageOption: " ", |
| 70 | 70 | accessToken: "token", |
| 71 | 71 | syncSessionHistory: vi.fn(), |
| 72 | - getSessionSnapshot: vi.fn(), | |
| 72 | + getCompleteStateSnapshot: vi.fn(), | |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | 75 | expect(result).toBe(false); |
| @@ -86,7 +86,7 @@ | ||
| 86 | 86 | storageOption: "session-123", |
| 87 | 87 | accessToken: null, |
| 88 | 88 | syncSessionHistory: vi.fn(), |
| 89 | - getSessionSnapshot: vi.fn(), | |
| 89 | + getCompleteStateSnapshot: vi.fn(), | |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | 92 | expect(result).toBe(false); |
| @@ -98,7 +98,7 @@ | ||
| 98 | 98 | |
| 99 | 99 | it("starts syncing when presign succeeds", async () => { |
| 100 | 100 | const syncSessionHistory = vi.fn(); |
| 101 | - const getSessionSnapshot = vi.fn().mockReturnValue({ foo: "bar" }); | |
| 101 | + const getCompleteStateSnapshot = vi.fn().mockReturnValue({ foo: "bar" }); | |
| 102 | 102 | |
| 103 | 103 | fetchMock.mockResolvedValueOnce({ |
| 104 | 104 | ok: true, |
| @@ -114,13 +114,13 @@ | ||
| 114 | 114 | storageOption: "session-123", |
| 115 | 115 | accessToken: "token", |
| 116 | 116 | syncSessionHistory, |
| 117 | - getSessionSnapshot, | |
| 117 | + getCompleteStateSnapshot, | |
| 118 | 118 | isActive: () => true, |
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | expect(result).toBe(true); |
| 122 | 122 | expect(syncSessionHistory).toHaveBeenCalledTimes(1); |
| 123 | - expect(getSessionSnapshot).toHaveBeenCalledTimes(1); | |
| 123 | + expect(getCompleteStateSnapshot).toHaveBeenCalledTimes(1); | |
| 124 | 124 | expect(fetchMock).toHaveBeenCalledTimes(3); |
| 125 | 125 | const [presignUrl, presignOptions] = fetchMock.mock.calls[0]; |
| 126 | 126 | expect(presignUrl).toBeInstanceOf(URL); |
| @@ -152,7 +152,7 @@ | ||
| 152 | 152 | storageOption: "session-123", |
| 153 | 153 | accessToken: "token", |
| 154 | 154 | syncSessionHistory: vi.fn(), |
| 155 | - getSessionSnapshot: vi.fn(), | |
| 155 | + getCompleteStateSnapshot: vi.fn(), | |
| 156 | 156 | }); |
| 157 | 157 | |
| 158 | 158 | expect(result).toBe(false); |
| @@ -187,7 +187,7 @@ | ||
| 187 | 187 | storageOption: "session-123", |
| 188 | 188 | accessToken: "token", |
| 189 | 189 | syncSessionHistory: vi.fn(), |
| 190 | - getSessionSnapshot: vi.fn().mockReturnValue({}), | |
| 190 | + getCompleteStateSnapshot: vi.fn().mockReturnValue({}), | |
| 191 | 191 | }); |
| 192 | 192 | |
| 193 | 193 | expect(result).toBe(true); |
| @@ -235,7 +235,7 @@ | ||
| 235 | 235 | |
| 236 | 236 | it("includes server-side encryption header when required by signed headers", async () => { |
| 237 | 237 | const syncSessionHistory = vi.fn(); |
| 238 | - const getSessionSnapshot = vi.fn().mockReturnValue({ test: "data" }); | |
| 238 | + const getCompleteStateSnapshot = vi.fn().mockReturnValue({ test: "data" }); | |
| 239 | 239 | |
| 240 | 240 | // Mock presign response with server-side encryption in signed headers |
| 241 | 241 | const sessionUrlWithSSE = |
| @@ -256,7 +256,7 @@ | ||
| 256 | 256 | storageOption: "session-123", |
| 257 | 257 | accessToken: "token", |
| 258 | 258 | syncSessionHistory, |
| 259 | - getSessionSnapshot, | |
| 259 | + getCompleteStateSnapshot, | |
| 260 | 260 | isActive: () => true, |
| 261 | 261 | }); |
| 262 | 262 |
modified extensions/cli/src/services/StorageSyncService.ts +9 −5
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | accessToken: string; |
| 30 | 30 | intervalMs?: number; |
| 31 | 31 | syncSessionHistory: () => void; |
| 32 | - getSessionSnapshot: () => unknown; | |
| 32 | + getCompleteStateSnapshot: () => unknown; | |
| 33 | 33 | isActive?: () => boolean; |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -284,14 +284,18 @@ | ||
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | + // Capture references to prevent race condition with stop() | |
| 288 | + const targets = this.targets; | |
| 289 | + const options = this.options; | |
| 290 | + | |
| 287 | 291 | this.uploadInFlight = true; |
| 288 | 292 | |
| 289 | 293 | try { |
| 290 | - this.options.syncSessionHistory(); | |
| 291 | - const snapshot = this.options.getSessionSnapshot(); | |
| 294 | + options.syncSessionHistory(); | |
| 295 | + const snapshot = options.getCompleteStateSnapshot(); | |
| 292 | 296 | const sessionPayload = JSON.stringify(snapshot, null, 2); |
| 293 | 297 | await this.uploadToPresignedUrl( |
| 294 | - this.targets.sessionUrl, | |
| 298 | + targets.sessionUrl, | |
| 295 | 299 | sessionPayload, |
| 296 | 300 | "application/json", |
| 297 | 301 | ); |
| @@ -304,7 +308,7 @@ | ||
| 304 | 308 | this.missingRepoLogged = true; |
| 305 | 309 | } |
| 306 | 310 | await this.uploadToPresignedUrl( |
| 307 | - this.targets.diffUrl, | |
| 311 | + targets.diffUrl, | |
| 308 | 312 | diffResult.diff, |
| 309 | 313 | "text/plain", |
| 310 | 314 | ); |
modified extensions/cli/src/session.ts +24 −0
| @@ -161,6 +161,30 @@ | ||
| 161 | 161 | return modifySessionBeforeSave(session); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | +/** | |
| 165 | + * Get the complete state snapshot that matches the /state endpoint format | |
| 166 | + */ | |
| 167 | +export interface StateSnapshot { | |
| 168 | + session: Session; | |
| 169 | + isProcessing: boolean; | |
| 170 | + messageQueueLength: number; | |
| 171 | + pendingPermission: any; | |
| 172 | +} | |
| 173 | + | |
| 174 | +export function getCompleteStateSnapshot( | |
| 175 | + session: Session, | |
| 176 | + isProcessing: boolean = false, | |
| 177 | + messageQueueLength: number = 0, | |
| 178 | + pendingPermission: any = null, | |
| 179 | +): StateSnapshot { | |
| 180 | + return { | |
| 181 | + session: getSessionPersistenceSnapshot(session), | |
| 182 | + isProcessing, | |
| 183 | + messageQueueLength, | |
| 184 | + pendingPermission, | |
| 185 | + }; | |
| 186 | +} | |
| 187 | + | |
| 164 | 188 | /** |
| 165 | 189 | * Save the current session to file |
| 166 | 190 | */ |
modified extensions/cli/src/stream/messageQueue.test.ts +1 −32
| @@ -1,4 +1,4 @@ | ||
| 1 | -import { beforeEach, describe, expect, it, vi } from "vitest"; | |
| 1 | +import { describe, expect, it, vi } from "vitest"; | |
| 2 | 2 | |
| 3 | 3 | vi.mock("../util/logger.js", () => ({ |
| 4 | 4 | logger: { |
| @@ -16,11 +16,6 @@ | ||
| 16 | 16 | import { messageQueue } from "./messageQueue.js"; |
| 17 | 17 | |
| 18 | 18 | describe("messageQueue", () => { |
| 19 | - beforeEach(() => { | |
| 20 | - // Drain any leftover items from previous tests | |
| 21 | - while (messageQueue.getAllQueuedMessages()) {} | |
| 22 | - }); | |
| 23 | - | |
| 24 | 19 | it("enqueues and emits messageQueued", async () => { |
| 25 | 20 | const event = new Promise<any>((resolve) => |
| 26 | 21 | messageQueue.once("messageQueued", resolve), |
| @@ -33,30 +28,4 @@ | ||
| 33 | 28 | const queued = await event; |
| 34 | 29 | expect(queued.message).toBe("hello world"); |
| 35 | 30 | }); |
| 36 | - | |
| 37 | - it("combines messages, merges image maps, writes history, and clears queue", async () => { | |
| 38 | - const bufA = Buffer.from("A"); | |
| 39 | - const bufB = Buffer.from("B"); | |
| 40 | - | |
| 41 | - const img1 = new Map<string, Buffer>([["a", bufA]]); | |
| 42 | - const img2 = new Map<string, Buffer>([["b", bufB]]); | |
| 43 | - | |
| 44 | - const history = { addEntry: vi.fn() } as any; | |
| 45 | - | |
| 46 | - await messageQueue.enqueueMessage("one", img1); | |
| 47 | - await messageQueue.enqueueMessage("two", img2, history); | |
| 48 | - | |
| 49 | - const combined = messageQueue.getAllQueuedMessages(); | |
| 50 | - expect(combined).toBeTruthy(); | |
| 51 | - expect(combined!.message).toBe("one\ntwo"); | |
| 52 | - expect(combined!.imageMap).toBeDefined(); | |
| 53 | - expect(combined!.imageMap!.get("a")).toEqual(bufA); | |
| 54 | - expect(combined!.imageMap!.get("b")).toEqual(bufB); | |
| 55 | - | |
| 56 | - // queue should be cleared | |
| 57 | - expect(messageQueue.getQueueLength()).toBe(0); | |
| 58 | - | |
| 59 | - // input history should receive the combined message | |
| 60 | - expect(history.addEntry).toHaveBeenCalledWith("one\ntwo"); | |
| 61 | - }); | |
| 62 | 31 | }); |
modified extensions/cli/src/stream/messageQueue.ts +9 −41
| @@ -1,12 +1,13 @@ | ||
| 1 | 1 | import { EventEmitter } from "events"; |
| 2 | 2 | |
| 3 | -import { InputHistory } from "../util/inputHistory.js"; | |
| 3 | +import type { InputHistory } from "../util/inputHistory.js"; | |
| 4 | 4 | import { logger } from "../util/logger.js"; |
| 5 | 5 | |
| 6 | 6 | export interface QueuedMessage { |
| 7 | 7 | message: string; |
| 8 | 8 | imageMap?: Map<string, Buffer>; |
| 9 | 9 | timestamp: number; |
| 10 | + history?: InputHistory; | |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | export interface MessageProcessor { |
| @@ -18,7 +19,6 @@ | ||
| 18 | 19 | */ |
| 19 | 20 | class MessageQueue extends EventEmitter { |
| 20 | 21 | private queue: QueuedMessage[] = []; |
| 21 | - private inputHistory: InputHistory | undefined; | |
| 22 | 22 | |
| 23 | 23 | constructor() { |
| 24 | 24 | super(); |
| @@ -27,14 +27,13 @@ | ||
| 27 | 27 | async enqueueMessage( |
| 28 | 28 | message: string, |
| 29 | 29 | imageMap?: Map<string, Buffer>, |
| 30 | - inputHistory?: InputHistory, | |
| 30 | + history?: InputHistory, | |
| 31 | 31 | ): Promise<boolean> { |
| 32 | - this.inputHistory = inputHistory; | |
| 33 | - | |
| 34 | 32 | const queuedMessage: QueuedMessage = { |
| 35 | 33 | message, |
| 36 | 34 | imageMap, |
| 37 | 35 | timestamp: Date.now(), |
| 36 | + history, | |
| 38 | 37 | }; |
| 39 | 38 | |
| 40 | 39 | this.queue.push(queuedMessage); |
| @@ -48,42 +47,11 @@ | ||
| 48 | 47 | return true; |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | - public getAllQueuedMessages() { | |
| 52 | - if (this.queue.length === 0) return undefined; | |
| 53 | - | |
| 54 | - // Combine all queued messages into one | |
| 55 | - const combinedMessage = this.queue.map((msg) => msg.message).join("\n"); | |
| 56 | - const combinedImageMap = new Map<string, Buffer>(); | |
| 57 | - | |
| 58 | - // Merge all image maps | |
| 59 | - for (const queuedMsg of this.queue) { | |
| 60 | - if (queuedMsg.imageMap) { | |
| 61 | - for (const [key, value] of queuedMsg.imageMap) { | |
| 62 | - combinedImageMap.set(key, value); | |
| 63 | - } | |
| 64 | - } | |
| 65 | - } | |
| 66 | - | |
| 67 | - const result = { | |
| 68 | - message: combinedMessage, | |
| 69 | - imageMap: combinedImageMap.size > 0 ? combinedImageMap : undefined, | |
| 70 | - timestamp: Date.now(), | |
| 71 | - }; | |
| 72 | - | |
| 73 | - // Add to input history and clear the queue | |
| 74 | - this.inputHistory?.addEntry(combinedMessage); | |
| 75 | - this.queue = []; | |
| 76 | - | |
| 77 | - logger.debug("MessageQueue: All messages dequeued and combined", { | |
| 78 | - combinedLength: combinedMessage.length, | |
| 79 | - queueLength: this.queue.length, | |
| 80 | - }); | |
| 81 | - | |
| 82 | - return result; | |
| 83 | - } | |
| 84 | - | |
| 85 | - public getLatestMessage() { | |
| 86 | - return this.getAllQueuedMessages(); | |
| 50 | + /** | |
| 51 | + * Dequeues and returns the next message to be processed (FIFO - oldest first) | |
| 52 | + */ | |
| 53 | + public getNextMessage(): QueuedMessage | undefined { | |
| 54 | + return this.queue.shift(); | |
| 87 | 55 | } |
| 88 | 56 | |
| 89 | 57 | getQueueLength(): number { |
modified extensions/cli/src/ui/UserInput.tsx +5 −7
| @@ -548,16 +548,14 @@ | ||
| 548 | 548 | textBuffer.expandAllPasteBlocks(); |
| 549 | 549 | const submittedText = textBuffer.text.trim(); |
| 550 | 550 | |
| 551 | - if (isWaitingForResponse || isCompacting) { | |
| 551 | + inputHistory.addEntry(submittedText); | |
| 552 | + | |
| 553 | + // We don't queue, we just send in remote mode because the server handles queueing | |
| 554 | + if (!isRemoteMode && (isWaitingForResponse || isCompacting)) { | |
| 552 | 555 | // Process message later when LLM has responded or compaction is complete |
| 553 | - void messageQueue.enqueueMessage( | |
| 554 | - submittedText, | |
| 555 | - imageMap, | |
| 556 | - inputHistory, | |
| 557 | - ); | |
| 556 | + void messageQueue.enqueueMessage(submittedText, imageMap); | |
| 558 | 557 | } else { |
| 559 | 558 | // Submit with images |
| 560 | - inputHistory.addEntry(submittedText); | |
| 561 | 559 | onSubmit(submittedText, imageMap); |
| 562 | 560 | } |
| 563 | 561 |
modified extensions/cli/src/ui/hooks/useChat.ts +2 −2
| @@ -337,13 +337,13 @@ | ||
| 337 | 337 | |
| 338 | 338 | // Check if there are queued messages and process them after a microtask delay |
| 339 | 339 | // This ensures the GUI state has been updated before processing the next message |
| 340 | - const queuedMessageData = messageQueue.getLatestMessage(); | |
| 340 | + const queuedMessageData = messageQueue.getNextMessage(); | |
| 341 | 341 | if (queuedMessageData) { |
| 342 | 342 | const { message: latestQueuedMessage, imageMap } = queuedMessageData; |
| 343 | 343 | logger.debug("processing queued message", { latestQueuedMessage }); |
| 344 | 344 | |
| 345 | 345 | // Clear queued messages from display since they're about to be processed |
| 346 | - // Note: messageQueue.getLatestMessage() already cleared the actual queue | |
| 346 | + // Note: messageQueue.getNextMessage() already cleared the actual queue | |
| 347 | 347 | setQueuedMessages([]); |
| 348 | 348 | |
| 349 | 349 | await new Promise((resolve) => setTimeout(resolve, 100)); // add timeout for react to render the tui |