replicas-cli 0.2.180 → 0.2.182

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +1097 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8105,6 +8105,1102 @@ function extractPrNumber(url) {
8105
8105
  return parsed ? String(parsed.number) : null;
8106
8106
  }
8107
8107
 
8108
+ // ../shared/src/default-skills/replicas-agent/abilities/docker.ts
8109
+ var SECTION = `### Docker
8110
+ Start and use the Docker daemon in Replicas workspaces. Docker is pre-installed but the daemon does not auto-start.
8111
+
8112
+ **Reference:** \`references/DOCKER.md\`
8113
+
8114
+ Use this when:
8115
+ - You need to run \`docker\` or \`docker compose\` commands
8116
+ - You need to build or run Docker containers
8117
+ - Your task involves containerized services or Docker-based workflows`;
8118
+ var REFERENCE = `# Docker
8119
+
8120
+ Docker is pre-installed in Replicas workspaces, but the daemon does **not** auto-start. You must start it manually before running any \`docker\` or \`docker compose\` commands.
8121
+
8122
+ ## Starting the Docker Daemon
8123
+
8124
+ \`\`\`bash
8125
+ sudo service docker start
8126
+ \`\`\`
8127
+
8128
+ After starting, verify the daemon is running:
8129
+
8130
+ \`\`\`bash
8131
+ docker info
8132
+ \`\`\`
8133
+
8134
+ ## Important Notes
8135
+
8136
+ - **Start once per session.** The daemon stays running until the workspace shuts down. You do not need to restart it between commands.
8137
+ - **Check before starting.** If you are unsure whether the daemon is already running, check first to avoid an unnecessary restart:
8138
+ \`\`\`bash
8139
+ docker info > /dev/null 2>&1 || sudo service docker start
8140
+ \`\`\`
8141
+ - **Sudo is required** for starting the daemon, but regular \`docker\` commands run without sudo (the user is in the \`docker\` group).
8142
+ `;
8143
+ var DOCKER_ABILITY = {
8144
+ label: "Docker",
8145
+ description: "Start the daemon, build/run containers, drive `docker compose`.",
8146
+ bullet: "- Using Docker (starting the daemon, running containers, docker compose)",
8147
+ section: SECTION,
8148
+ referenceFile: { name: "DOCKER.md", content: REFERENCE }
8149
+ };
8150
+
8151
+ // ../shared/src/default-skills/replicas-agent/abilities/github.ts
8152
+ var SECTION2 = `### GitHub
8153
+ Use the pre-authenticated \`gh\` CLI for pull requests, issues, actions, and API calls.
8154
+
8155
+ **Reference:** \`references/GITHUB.md\`
8156
+
8157
+ Use this when:
8158
+ - You need to create, review, or manage pull requests
8159
+ - You need to interact with GitHub issues or actions
8160
+ - You need to use the GitHub API for advanced operations
8161
+ - You need to include images in PR descriptions`;
8162
+ var REFERENCE2 = `# GitHub Integration
8163
+
8164
+ This guide covers how to interact with GitHub from within your Replicas workspace.
8165
+
8166
+ ## Prerequisites
8167
+
8168
+ The \`gh\` CLI is pre-installed and authenticated in your workspace. You can verify this:
8169
+
8170
+ \`\`\`bash
8171
+ gh auth status
8172
+ \`\`\`
8173
+
8174
+ If authenticated, you can immediately use \`gh\` for all GitHub operations. No additional setup is needed.
8175
+
8176
+ ## Using the \`gh\` CLI
8177
+
8178
+ The GitHub CLI (\`gh\`) is the recommended way to interact with GitHub. It handles authentication, pagination, and API formatting automatically.
8179
+
8180
+ ### Pull Requests
8181
+
8182
+ \`\`\`bash
8183
+ # Create a PR
8184
+ gh pr create --title "Title" --body "Description"
8185
+
8186
+ # List open PRs
8187
+ gh pr list
8188
+
8189
+ # View a specific PR
8190
+ gh pr view 123
8191
+
8192
+ # Review/check PR status
8193
+ gh pr checks 123
8194
+
8195
+ # Merge a PR
8196
+ gh pr merge 123
8197
+ \`\`\`
8198
+
8199
+ ### Issues
8200
+
8201
+ \`\`\`bash
8202
+ # Create an issue
8203
+ gh issue create --title "Title" --body "Description"
8204
+
8205
+ # View an issue
8206
+ gh issue view 123
8207
+
8208
+ # List issues
8209
+ gh issue list
8210
+
8211
+ # Close an issue
8212
+ gh issue close 123
8213
+
8214
+ # Add a comment
8215
+ gh issue comment 123 --body "Your comment"
8216
+ \`\`\`
8217
+
8218
+ ### Repository Operations
8219
+
8220
+ \`\`\`bash
8221
+ # View repo info
8222
+ gh repo view
8223
+
8224
+ # Clone a repo
8225
+ gh repo clone owner/repo
8226
+
8227
+ # List releases
8228
+ gh release list
8229
+ \`\`\`
8230
+
8231
+ ### GitHub Actions / Checks
8232
+
8233
+ \`\`\`bash
8234
+ # List workflow runs
8235
+ gh run list
8236
+
8237
+ # View a specific run
8238
+ gh run view RUN_ID
8239
+
8240
+ # Watch a run in progress
8241
+ gh run watch RUN_ID
8242
+
8243
+ # Re-run failed jobs
8244
+ gh run rerun RUN_ID --failed
8245
+ \`\`\`
8246
+
8247
+ ### GitHub API (Advanced)
8248
+
8249
+ For operations not covered by \`gh\` subcommands, use the API directly:
8250
+
8251
+ \`\`\`bash
8252
+ # GET request
8253
+ gh api repos/owner/repo/pulls/123/comments
8254
+
8255
+ # POST request
8256
+ gh api repos/owner/repo/issues/123/comments -f body="Comment text"
8257
+
8258
+ # GraphQL query
8259
+ gh api graphql -f query='{ repository(owner: "owner", name: "repo") { issues(first: 10) { nodes { title number } } } }'
8260
+ \`\`\`
8261
+
8262
+ ### Working with PR Reviews
8263
+
8264
+ \`\`\`bash
8265
+ # View PR comments
8266
+ gh api repos/owner/repo/pulls/123/comments
8267
+
8268
+ # View PR review comments
8269
+ gh api repos/owner/repo/pulls/123/reviews
8270
+
8271
+ # Submit a review
8272
+ gh pr review 123 --approve
8273
+ gh pr review 123 --request-changes --body "Changes needed"
8274
+ \`\`\`
8275
+
8276
+ ## Image Uploads in PRs
8277
+
8278
+ GitHub does NOT have a public API for uploading images to PRs/issues. When you need to include images:
8279
+ - Do NOT use placeholder image URLs
8280
+ - Do NOT commit screenshots as files to the repository
8281
+ - Upload images to Imgur (or another external host) and use the returned URLs in your PR markdown
8282
+ - If you were triggered from Slack, also upload the images to the Slack thread so the user can see them directly
8283
+ `;
8284
+ var GITHUB_ABILITY = {
8285
+ label: "GitHub",
8286
+ description: "Pre-authenticated `gh` CLI for PRs, issues, releases, and GraphQL.",
8287
+ bullet: "- Interacting with GitHub (creating PRs, managing issues, using the API, etc.)",
8288
+ section: SECTION2,
8289
+ referenceFile: { name: "GITHUB.md", content: REFERENCE2 }
8290
+ };
8291
+
8292
+ // ../shared/src/default-skills/replicas-agent/abilities/google.ts
8293
+ var SECTION3 = `### Google Workspace (Docs, Sheets, Forms, Drive)
8294
+ Create and edit Google Docs, Sheets, and Forms via the Replicas gateway. Files are owned by Replicas \u2014 the integration cannot access pre-existing Google content created outside of it.
8295
+
8296
+ **Reference:** \`references/GOOGLE.md\`
8297
+
8298
+ Use this when:
8299
+ - You need to create or edit a Google Doc, Sheet, or Form
8300
+ - You need to share, rename, move, or delete a Replicas-created Google file
8301
+ - You need to read responses from a Replicas-created Google Form`;
8302
+ var REFERENCE3 = `# Google Workspace (Docs, Sheets, Forms, Drive)
8303
+
8304
+ This guide covers how to create and edit Google Docs, Sheets, and Forms \u2014 plus do basic Drive file operations \u2014 from inside a Replicas workspace, using the monolith as a gateway to Google's APIs.
8305
+
8306
+ ## Prerequisites
8307
+
8308
+ The integration is configured at the org or user level by the Replicas admin. From inside a workspace you don't have a Google access token directly; instead you call the monolith's \`/v1/gdrive/*\` endpoints, authenticated with your workspace's engine secret. The monolith refreshes the org's (or user's) Google access token and proxies the call.
8309
+
8310
+ Quick check that the integration is connected:
8311
+
8312
+ \`\`\`bash
8313
+ curl -s -X GET "$MONOLITH_URL/v1/gdrive/credentials" \\
8314
+ -H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
8315
+ -H "X-Workspace-Id: $WORKSPACE_ID"
8316
+ \`\`\`
8317
+
8318
+ - If \`hasCredentials\` is \`true\`: you're good to go.
8319
+ - If \`hasCredentials\` is \`false\`: Google has not been connected for this org. Ask the user to go to **Settings \u2192 Integrations \u2192 Google** in the [Replicas dashboard](https://replicas.dev) and connect a Google account. Do not attempt Google operations until it's connected.
8320
+
8321
+ Standard auth headers used by every call below:
8322
+
8323
+ \`\`\`
8324
+ Authorization: Bearer $REPLICAS_ENGINE_SECRET
8325
+ X-Workspace-Id: $WORKSPACE_ID
8326
+ \`\`\`
8327
+
8328
+ For brevity the examples below use a shell variable:
8329
+
8330
+ \`\`\`bash
8331
+ GDRIVE_AUTH=(-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" -H "X-Workspace-Id: $WORKSPACE_ID")
8332
+ \`\`\`
8333
+
8334
+ ## Important constraint: drive.file scope
8335
+
8336
+ The integration uses the **sensitive-tier \`drive.file\` scope**. That means Replicas can only read and edit Google files **it created itself**. It **cannot**:
8337
+
8338
+ - Read or edit a user's pre-existing Google Docs, Sheets, or Forms \u2014 even ones that were shared with the connected Google account.
8339
+ - List or search the user's broader Drive.
8340
+ - Touch any file that was not created via these gateway endpoints.
8341
+
8342
+ If the user asks you to edit an existing doc that Replicas didn't create, tell them this constraint and offer to create a new doc that mirrors what they want.
8343
+
8344
+ ## Google Docs
8345
+
8346
+ ### Create a new doc
8347
+
8348
+ \`\`\`bash
8349
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/docs" "\${GDRIVE_AUTH[@]}" \\
8350
+ -H "Content-Type: application/json" \\
8351
+ -d '{"title":"Meeting notes 2026-05-14"}'
8352
+ \`\`\`
8353
+
8354
+ Returns the full Doc object; grab \`.documentId\` for follow-up calls.
8355
+
8356
+ ### Read a doc
8357
+
8358
+ \`\`\`bash
8359
+ curl -s "$MONOLITH_URL/v1/gdrive/docs/$DOC_ID" "\${GDRIVE_AUTH[@]}"
8360
+ \`\`\`
8361
+
8362
+ Returns the full document structure \u2014 \`body.content\` is an ordered list of structural elements (paragraphs, tables, etc.) with character indexes you can target for edits.
8363
+
8364
+ ### Edit a doc (batchUpdate)
8365
+
8366
+ The Docs API edits use a list of [structural requests](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request). Insert text, then style it; or insert tables, images, page breaks, etc.
8367
+
8368
+ \`\`\`bash
8369
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/docs/$DOC_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
8370
+ -H "Content-Type: application/json" \\
8371
+ -d '{
8372
+ "requests": [
8373
+ { "insertText": { "location": { "index": 1 }, "text": "Hello, world!\\n" } }
8374
+ ]
8375
+ }'
8376
+ \`\`\`
8377
+
8378
+ Common request types:
8379
+
8380
+ - \`insertText\` \u2014 insert plain text at a given index
8381
+ - \`deleteContentRange\` \u2014 delete a range
8382
+ - \`replaceAllText\` \u2014 find-and-replace
8383
+ - \`updateTextStyle\` \u2014 bold/italic/colors/fonts/sizes for a range
8384
+ - \`updateParagraphStyle\` \u2014 headings (\`HEADING_1\`..\`HEADING_6\`), alignment, spacing
8385
+ - \`createParagraphBullets\` \u2014 turn paragraphs into bulleted/numbered lists
8386
+ - \`insertTable\` \u2014 insert a table
8387
+ - \`insertInlineImage\` \u2014 insert an image from a URL
8388
+
8389
+ Edits are verbose but powerful. Prefer batching many requests into a single \`batchUpdate\` call rather than making many round trips \u2014 it's faster and keeps the doc state consistent.
8390
+
8391
+ ## Google Sheets
8392
+
8393
+ ### Create a new spreadsheet
8394
+
8395
+ \`\`\`bash
8396
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/sheets" "\${GDRIVE_AUTH[@]}" \\
8397
+ -H "Content-Type: application/json" \\
8398
+ -d '{"title":"Q2 metrics"}'
8399
+ \`\`\`
8400
+
8401
+ Returns the full Spreadsheet object; grab \`.spreadsheetId\`.
8402
+
8403
+ ### Read a range of cells
8404
+
8405
+ \`\`\`bash
8406
+ # Range is in A1 notation, e.g. "Sheet1!A1:C10"
8407
+ curl -s "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:C10' | jq -sRr @uri)" \\
8408
+ "\${GDRIVE_AUTH[@]}"
8409
+ \`\`\`
8410
+
8411
+ ### Write a range of cells
8412
+
8413
+ \`\`\`bash
8414
+ curl -s -X PUT \\
8415
+ "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/values/$(printf %s 'Sheet1!A1:B2' | jq -sRr @uri)?valueInputOption=USER_ENTERED" \\
8416
+ "\${GDRIVE_AUTH[@]}" \\
8417
+ -H "Content-Type: application/json" \\
8418
+ -d '{
8419
+ "range": "Sheet1!A1:B2",
8420
+ "majorDimension": "ROWS",
8421
+ "values": [
8422
+ ["Name", "Revenue"],
8423
+ ["Q1", "=SUM(B3:B100)"]
8424
+ ]
8425
+ }'
8426
+ \`\`\`
8427
+
8428
+ \`valueInputOption=USER_ENTERED\` makes formulas evaluate as if a human typed them. Use \`RAW\` to write literal strings.
8429
+
8430
+ ### Bulk operations (formatting, charts, new tabs, etc.)
8431
+
8432
+ \`\`\`bash
8433
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/sheets/$SHEET_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
8434
+ -H "Content-Type: application/json" \\
8435
+ -d '{ "requests": [ { "addSheet": { "properties": { "title": "Raw data" } } } ] }'
8436
+ \`\`\`
8437
+
8438
+ \`batchUpdate\` accepts an array of [Sheets API requests](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request) \u2014 addSheet, updateSheetProperties, repeatCell, addChart, autoResizeDimensions, etc.
8439
+
8440
+ ## Google Forms
8441
+
8442
+ ### Create a new form
8443
+
8444
+ \`\`\`bash
8445
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/forms" "\${GDRIVE_AUTH[@]}" \\
8446
+ -H "Content-Type: application/json" \\
8447
+ -d '{"title":"Customer feedback"}'
8448
+ \`\`\`
8449
+
8450
+ Returns the form. Grab \`.formId\`.
8451
+
8452
+ ### Add questions / edit form structure
8453
+
8454
+ The Forms API uses its own \`batchUpdate\`:
8455
+
8456
+ \`\`\`bash
8457
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/forms/$FORM_ID/batchUpdate" "\${GDRIVE_AUTH[@]}" \\
8458
+ -H "Content-Type: application/json" \\
8459
+ -d '{
8460
+ "requests": [
8461
+ {
8462
+ "createItem": {
8463
+ "item": {
8464
+ "title": "How likely are you to recommend us?",
8465
+ "questionItem": {
8466
+ "question": {
8467
+ "required": true,
8468
+ "scaleQuestion": { "low": 0, "high": 10, "lowLabel": "Not at all", "highLabel": "Very likely" }
8469
+ }
8470
+ }
8471
+ },
8472
+ "location": { "index": 0 }
8473
+ }
8474
+ }
8475
+ ]
8476
+ }'
8477
+ \`\`\`
8478
+
8479
+ See the [Forms API Request reference](https://developers.google.com/workspace/forms/api/reference/rest/v1/forms/request) for all supported request types \u2014 text questions, multiple choice, checkboxes, scale, grid, date, time, file upload, section breaks, branching logic, quiz settings, etc.
8480
+
8481
+ ### Read responses
8482
+
8483
+ \`\`\`bash
8484
+ curl -s "$MONOLITH_URL/v1/gdrive/forms/$FORM_ID/responses" "\${GDRIVE_AUTH[@]}"
8485
+ \`\`\`
8486
+
8487
+ Pagination: pass \`?pageToken=...&pageSize=...\` to walk through responses.
8488
+
8489
+ ## Drive operations (only on Replicas-created files)
8490
+
8491
+ ### Share a file with a person
8492
+
8493
+ \`\`\`bash
8494
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
8495
+ -H "Content-Type: application/json" \\
8496
+ -d '{
8497
+ "type": "user",
8498
+ "role": "writer",
8499
+ "emailAddress": "alice@example.com",
8500
+ "sendNotificationEmail": true
8501
+ }'
8502
+ \`\`\`
8503
+
8504
+ Roles: \`reader\`, \`commenter\`, \`writer\`. Types: \`user\`, \`group\`, \`domain\`, \`anyone\`.
8505
+
8506
+ ### Make a file viewable by anyone with the link
8507
+
8508
+ \`\`\`bash
8509
+ curl -s -X POST "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}" \\
8510
+ -H "Content-Type: application/json" \\
8511
+ -d '{ "type": "anyone", "role": "reader" }'
8512
+ \`\`\`
8513
+
8514
+ ### List existing permissions
8515
+
8516
+ \`\`\`bash
8517
+ curl -s "$MONOLITH_URL/v1/gdrive/files/$FILE_ID/permissions" "\${GDRIVE_AUTH[@]}"
8518
+ \`\`\`
8519
+
8520
+ ### Rename / move a file
8521
+
8522
+ \`\`\`bash
8523
+ curl -s -X PATCH "$MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}" \\
8524
+ -H "Content-Type: application/json" \\
8525
+ -d '{"name":"Final report.docx"}'
8526
+ \`\`\`
8527
+
8528
+ To move into a folder, also pass \`addParents\` and \`removeParents\` as query parameters per [Drive API docs](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/update).
8529
+
8530
+ ### Get file metadata
8531
+
8532
+ \`\`\`bash
8533
+ curl -s "$MONOLITH_URL/v1/gdrive/files/$FILE_ID?fields=id,name,mimeType,webViewLink,parents,modifiedTime" \\
8534
+ "\${GDRIVE_AUTH[@]}"
8535
+ \`\`\`
8536
+
8537
+ \`webViewLink\` is the human-shareable URL that opens in Google Docs/Sheets/Forms.
8538
+
8539
+ ### Delete a file
8540
+
8541
+ \`\`\`bash
8542
+ curl -s -X DELETE "$MONOLITH_URL/v1/gdrive/files/$FILE_ID" "\${GDRIVE_AUTH[@]}"
8543
+ \`\`\`
8544
+
8545
+ ### List Replicas-created files
8546
+
8547
+ \`\`\`bash
8548
+ curl -s "$MONOLITH_URL/v1/gdrive/files?pageSize=50" "\${GDRIVE_AUTH[@]}"
8549
+ \`\`\`
8550
+
8551
+ Pass \`?q=...\` to filter using [Drive API search syntax](https://developers.google.com/workspace/drive/api/guides/search-files). Only files the app created or was granted access to will appear.
8552
+
8553
+ ## Tips
8554
+
8555
+ - **Always return the \`webViewLink\`** to the user when you create or edit a file so they can open it. Get it from \`/v1/gdrive/files/$FILE_ID?fields=webViewLink\` or from \`documents.documentId\` \u2192 \`https://docs.google.com/document/d/$ID/edit\`.
8556
+ - **Batch your edits.** A single \`batchUpdate\` with 20 requests beats 20 round-trips.
8557
+ - **Watch error responses.** A 412 from the gateway means the org has no Google credentials connected \u2014 tell the user to connect Google in the dashboard. Other 4xx responses come straight from Google and usually explain the issue clearly.
8558
+ `;
8559
+ var GOOGLE_ABILITY = {
8560
+ label: "Google Workspace",
8561
+ description: "Create / edit Docs, Sheets, Forms, and Drive files via the Replicas gateway.",
8562
+ bullet: "- Interacting with Google Workspace (creating and editing Docs, Sheets, and Forms, sharing files, reading form responses, etc.)",
8563
+ section: SECTION3,
8564
+ referenceFile: { name: "GOOGLE.md", content: REFERENCE3 }
8565
+ };
8566
+
8567
+ // ../shared/src/default-skills/replicas-agent/abilities/linear.ts
8568
+ var SECTION4 = `### Linear
8569
+ Fetch issues, update state, add comments, and search via the Linear GraphQL API.
8570
+
8571
+ **Reference:** \`references/LINEAR.md\`
8572
+
8573
+ Use this when:
8574
+ - You encounter a Linear issue link and need to understand the task
8575
+ - You need to update an issue's state (e.g. mark as done)
8576
+ - You need to comment on or search for Linear issues`;
8577
+ var REFERENCE4 = `# Linear Integration
8578
+
8579
+ This guide covers how to interact with Linear from within your Replicas workspace.
8580
+
8581
+ ## Prerequisites
8582
+
8583
+ Check if the \`LINEAR_ACCESS_TOKEN\` environment variable is set:
8584
+
8585
+ \`\`\`bash
8586
+ echo "\${LINEAR_ACCESS_TOKEN:+set}"
8587
+ \`\`\`
8588
+
8589
+ - If **set**: Your workspace has Linear access. You can use the Linear GraphQL API as described below.
8590
+ - If **not set**: Linear has not been configured for this workspace. The user needs to connect Linear in the [Replicas dashboard](https://replicas.dev) under their organization's integration settings. Let the user know and do not attempt Linear operations.
8591
+
8592
+ ## Using the Linear API
8593
+
8594
+ Linear uses a GraphQL API at \`https://api.linear.app/graphql\`. All requests use the \`$LINEAR_ACCESS_TOKEN\` for authentication.
8595
+
8596
+ ### Fetching an Issue
8597
+
8598
+ If you encounter a Linear issue link (e.g. \`https://linear.app/team/issue/ENG-123\`), the identifier is the last path segment (\`ENG-123\`).
8599
+
8600
+ \`\`\`bash
8601
+ curl -s -X POST https://api.linear.app/graphql \\
8602
+ -H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
8603
+ -H "Content-Type: application/json" \\
8604
+ -d '{
8605
+ "query": "query { issues(filter: { identifier: { eq: \\"ENG-123\\" } }) { nodes { id identifier title description state { name } assignee { name } parent { identifier title description } } } }"
8606
+ }'
8607
+ \`\`\`
8608
+
8609
+ ### Updating Issue State
8610
+
8611
+ \`\`\`bash
8612
+ curl -s -X POST https://api.linear.app/graphql \\
8613
+ -H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
8614
+ -H "Content-Type: application/json" \\
8615
+ -d '{
8616
+ "query": "mutation { issueUpdate(id: \\"ISSUE_UUID\\", input: { stateId: \\"STATE_UUID\\" }) { success issue { identifier state { name } } } }"
8617
+ }'
8618
+ \`\`\`
8619
+
8620
+ To find available states, query: \`query { workflowStates { nodes { id name } } }\`
8621
+
8622
+ ### Adding a Comment
8623
+
8624
+ \`\`\`bash
8625
+ curl -s -X POST https://api.linear.app/graphql \\
8626
+ -H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
8627
+ -H "Content-Type: application/json" \\
8628
+ -d '{
8629
+ "query": "mutation { commentCreate(input: { issueId: \\"ISSUE_UUID\\", body: \\"Your comment here\\" }) { success comment { id } } }"
8630
+ }'
8631
+ \`\`\`
8632
+
8633
+ ### Searching Issues
8634
+
8635
+ \`\`\`bash
8636
+ curl -s -X POST https://api.linear.app/graphql \\
8637
+ -H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
8638
+ -H "Content-Type: application/json" \\
8639
+ -d '{
8640
+ "query": "query { issueSearch(query: \\"search terms\\", first: 10) { nodes { identifier title state { name } } } }"
8641
+ }'
8642
+ \`\`\`
8643
+
8644
+ ### Other Operations
8645
+
8646
+ The Linear GraphQL API supports creating issues, managing projects, labels, cycles, and more. For the full schema and documentation, see: https://developers.linear.app/docs/graphql/working-with-the-graphql-api
8647
+ `;
8648
+ var LINEAR_ABILITY = {
8649
+ label: "Linear",
8650
+ description: "Fetch issues, post comments, update states via the Linear GraphQL API.",
8651
+ bullet: "- Interacting with Linear (fetching issues, updating state, commenting, etc.)",
8652
+ section: SECTION4,
8653
+ referenceFile: { name: "LINEAR.md", content: REFERENCE4 }
8654
+ };
8655
+
8656
+ // ../shared/src/default-skills/replicas-agent/abilities/media.ts
8657
+ var SECTION5 = `### Media
8658
+ Share screenshots, screen recordings, generated diagrams, and audio clips inline in the Replicas chat (and as references in external messages).
8659
+
8660
+ **Reference:** \`references/MEDIA.md\`
8661
+
8662
+ Use this when:
8663
+ - You produce a screenshot, recording, generated image, or audio clip the user should see
8664
+ - You record video output (browser automation, screen capture) \u2014 including the recommended aspect ratio and FPS
8665
+ - You need to embed media in a Slack/Linear/GitHub message AND keep a referenceable copy in the Replicas dashboard`;
8666
+ var REFERENCE5 = `# Media (Screenshots, Recordings, Audio)
8667
+
8668
+ This guide covers how to share screenshots, screen recordings, generated diagrams, and audio clips with the user inline in the Replicas chat.
8669
+
8670
+ ## Prerequisites
8671
+
8672
+ The \`replicas\` CLI is pre-installed and authenticated in your workspace. No additional setup is needed.
8673
+
8674
+ ## When to upload
8675
+
8676
+ Upload to Replicas in these cases \u2014 and **only** these cases:
8677
+
8678
+ 1. **Media you produce.** Any screenshot, screen recording, generated diagram, or audio clip you create that the user might want to see. Upload before doing anything else with the file (analyzing, deleting, sending elsewhere). This applies even when you're also sending the file to Slack, Linear, GitHub, etc.
8679
+ 2. **Files the user explicitly asks you to upload.** If the user sends or points at a file (image, video, audio) and asks you to upload it, run \`replicas media upload\`. Otherwise leave it alone \u2014 files in the workspace the user did not ask about should not be auto-uploaded as media.
8680
+ 3. **Anything you plan to share externally (Slack, Linear, GitHub, etc.).** Upload to Replicas *in addition to* the platform's native upload. Never as a replacement.
8681
+
8682
+ If none of these apply, don't upload.
8683
+
8684
+ ## Uploading
8685
+
8686
+ \`\`\`bash
8687
+ replicas media upload <path-to-file> [<path-to-file> ...]
8688
+ \`\`\`
8689
+
8690
+ Pass one or more file paths. Uploading several files in a single invocation is preferred over running the command repeatedly \u2014 it's faster and keeps the output grouped.
8691
+
8692
+ For each file, the CLI prints two lines:
8693
+
8694
+ 1. \`![filename](<api-url>)\` \u2014 the chat embed (renders inline in Replicas chat only; see below).
8695
+ 2. \`View in Replicas: <deep-link>\` \u2014 a per-file dashboard URL of the form \`https://tryreplicas.com/workspaces/<workspace-id>?mode=media&media=<media-id>\` that opens directly to that specific file.
8696
+
8697
+ Match each "View in Replicas" line to the embed line directly above it \u2014 that's the deep link for that file.
8698
+
8699
+ ## How to use the output
8700
+
8701
+ ### CRITICAL: the markdown embed URL is for Replicas chat only
8702
+
8703
+ The URL inside \`![filename](...)\` points at \`api.tryreplicas.com/v1/media/<id>\`. This is **not a public URL** \u2014 it requires the Replicas chat's authenticated session, which resolves it to a presigned download. Anywhere else (Slack, Linear, GitHub, a browser tab the user opens directly, a customer copy-pasting from chat), it returns \`{"error":"Missing authorization token"}\` and renders as a broken image.
8704
+
8705
+ **Never paste this URL outside your Replicas chat reply.** Not in Slack messages, not in Linear comments, not in PR descriptions or commit messages, not in external docs \u2014 nowhere a non-Replicas surface will render it.
8706
+
8707
+ ### Always render dashboard URLs as \`[View in Replicas](<url>)\` hyperlinks
8708
+
8709
+ Whenever you share a workspace dashboard URL \u2014 in chat or anywhere else \u2014 format it as a markdown hyperlink labeled **View in Replicas**:
8710
+
8711
+ \`\`\`markdown
8712
+ [View in Replicas](https://tryreplicas.com/workspaces/<workspace-id>?mode=media&media=<media-id>)
8713
+ \`\`\`
8714
+
8715
+ Never paste the raw URL. Raw URLs look unpolished.
8716
+
8717
+ Two flavors of dashboard URL the CLI gives you:
8718
+
8719
+ - **Per-file deep link** (default \u2014 what \`replicas media upload\` prints): \`...?mode=media&media=<media-id>\` opens the dashboard scrolled to that specific file. Use this whenever you're linking to *one* file.
8720
+ - **Media tab link** (no \`media=\` param): \`...?mode=media\` opens the workspace's media tab listing all files. Use this only when you're pointing at the collection, not a specific file (rare \u2014 you almost always have a specific file in mind).
8721
+
8722
+ ### In your Replicas chat reply
8723
+
8724
+ Include each markdown embed line **verbatim** where you want that file to render inline. The chat substitutes each one with an embedded image, video, or audio player. Multiple embeds can appear in a single reply.
8725
+
8726
+ After (or alongside) the embeds, include a \`[View in Replicas](<deep-link>)\` hyperlink for each file using the per-file URL the CLI printed for that file. This lets the user jump to the specific item in the media tab.
8727
+
8728
+ ### On external platforms (Slack, Linear, GitHub, etc.)
8729
+
8730
+ Do **both** of these \u2014 neither alone is sufficient:
8731
+
8732
+ 1. Upload the raw bytes via that platform's own upload API (Slack \`files.upload\`, Linear attachments, Imgur for GitHub PR/issue images, etc.) so the recipient actually sees the media.
8733
+ 2. Include a \`[View in Replicas](<deep-link>)\` hyperlink \u2014 use the per-file deep link the CLI printed for that file (\`...?mode=media&media=<media-id>\`), so the recipient lands directly on that specific item.
8734
+
8735
+ Do **not** include the \`![filename](https://api.tryreplicas.com/...)\` markdown embed in external messages. It will render as a broken image / 401 for the recipient.
8736
+
8737
+ ## Recording defaults
8738
+
8739
+ When you record video (browser automation, screen capture, etc.):
8740
+
8741
+ - **Aspect ratio:** 16:9 (1920\xD71080 or 1280\xD7720)
8742
+ - **Frame rate:** 60 FPS or whatever the user specifies
8743
+
8744
+ Tools like Playwright default to a low frame rate that produces choppy playback \u2014 explicitly configure recording dimensions and FPS:
8745
+
8746
+ \`\`\`ts
8747
+ const context = await browser.newContext({
8748
+ recordVideo: { dir: './videos', size: { width: 1280, height: 720 } },
8749
+ });
8750
+ \`\`\`
8751
+
8752
+ For \`ffmpeg\` screen captures, pass \`-r 30\` (or \`-r 60\`) to set the frame rate.
8753
+
8754
+ ## Supported formats
8755
+
8756
+ Auto-detected from the filename extension:
8757
+
8758
+ | Extension | Kind |
8759
+ |---|---|
8760
+ | \`png\`, \`jpg\`, \`jpeg\`, \`webp\` | image |
8761
+ | \`mp4\`, \`webm\` | video |
8762
+ | \`mp3\`, \`wav\` | audio |
8763
+
8764
+ For other extensions, pass \`--kind image|video|audio\` explicitly. The kind applies to every file in that invocation, so group files of the same kind together:
8765
+
8766
+ \`\`\`bash
8767
+ replicas media upload diagram.svg --kind image
8768
+ replicas media upload chart-a.svg chart-b.svg --kind image
8769
+ \`\`\`
8770
+
8771
+ ## Options
8772
+
8773
+ - \`--kind <image|video|audio>\` \u2014 override auto-detection
8774
+ - \`--session-id <id>\` \u2014 associate the upload with a specific session
8775
+ `;
8776
+ var MEDIA_ABILITY = {
8777
+ label: "Media",
8778
+ description: "Share screenshots, recordings, generated images, and audio clips.",
8779
+ bullet: "- Sharing media (screenshots, screen recordings, generated diagrams, audio clips) \u2014 including in your Replicas chat reply and to external platforms",
8780
+ section: SECTION5,
8781
+ referenceFile: { name: "MEDIA.md", content: REFERENCE5 }
8782
+ };
8783
+
8784
+ // ../shared/src/default-skills/replicas-agent/abilities/previews.ts
8785
+ var SECTION6 = `### Previews
8786
+ Expose locally running services (web apps, APIs, databases) as public preview URLs so humans can interact with them directly.
8787
+
8788
+ **Reference:** \`references/PREVIEWS.md\`
8789
+
8790
+ Use this when:
8791
+ - You need to start a service that a human should view or interact with
8792
+ - The task involves UI work that benefits from human review
8793
+ - You are verifying frontend/backend integrations visually`;
8794
+ var REFERENCE6 = `# Preview URLs
8795
+
8796
+ When you run services on ports \u2014 such as a web app, API server, or database \u2014 humans may want to interact with them directly. You can expose your locally running services as public preview URLs.
8797
+
8798
+ ## Running Services for Preview
8799
+
8800
+ Services must run as detached background processes so they survive after your command session ends. Do not leave them attached to a foreground terminal.
8801
+
8802
+ Some potential methods:
8803
+ \`\`\`bash
8804
+ # Start a detached service with logging
8805
+ setsid -f bash -lc 'cd /path/to/app && exec yarn dev >> /tmp/app.log 2>&1'
8806
+
8807
+ # For daemons like Docker
8808
+ nohup dockerd > /tmp/dockerd.log 2>&1 &
8809
+ \`\`\`
8810
+
8811
+ After starting a service:
8812
+ 1. Verify the process is running: \`pgrep -af 'yarn dev'\`
8813
+ 2. Check logs for readiness: \`tail -f /tmp/app.log\`
8814
+ 3. Confirm it's actually serving: \`curl -s http://localhost:3000\` (or appropriate health check)
8815
+ 4. Only create the preview after the service is healthy
8816
+
8817
+ If a prior detached process exists on the same port, stop it before restarting.
8818
+
8819
+ ## Creating Previews
8820
+
8821
+ \`\`\`bash
8822
+ # Expose a local port as a public URL
8823
+ replicas preview create <port>
8824
+
8825
+ # Expose a port with authentication (requires Replicas login to access)
8826
+ replicas preview create <port> --authenticated
8827
+
8828
+ # List all active preview URLs
8829
+ replicas preview list
8830
+ \`\`\`
8831
+
8832
+ The \`create\` command prints the public URL. You can also read all active previews from \`~/.replicas/preview-ports.json\`.
8833
+
8834
+ ## Authenticated vs Unauthenticated Previews
8835
+
8836
+ Previews can optionally require cookie-based authentication. When \`--authenticated\` is set, only users who are logged in to replicas.dev can access the preview.
8837
+
8838
+ **When to use \`--authenticated\`:**
8839
+ - Frontends / web apps that humans will view directly in their browser. Since the user is already logged in to replicas.dev, the auth cookie is automatically present and the preview works seamlessly.
8840
+
8841
+ **When NOT to use \`--authenticated\`:**
8842
+ - Backend APIs and other services that are called by frontend code. The frontend runs in the user's browser under a different origin, so it cannot forward the Replicas auth cookie to the backend. Making backends authenticated will cause cross-service requests to fail with 401 errors.
8843
+
8844
+ **Rule of thumb:** Make frontend previews authenticated, leave backend/API previews unauthenticated.
8845
+
8846
+ ## Cross-Service References
8847
+
8848
+ When you expose multiple services that reference each other, you must update their configuration so they use preview URLs instead of \`localhost\`.
8849
+
8850
+ **Example:** You run a React frontend on port 3000 that makes API calls to a backend on port 8585.
8851
+
8852
+ 1. Create previews for both:
8853
+ \`\`\`bash
8854
+ replicas preview create 8585
8855
+ # Output: https://8585-<hash>.replicas.dev
8856
+ replicas preview create 3000 --authenticated
8857
+ # Output: https://3000-<hash>.replicas.dev
8858
+ \`\`\`
8859
+
8860
+ 2. Update the frontend's environment so its API base URL points to the backend's **preview URL**, not \`localhost:8585\`. For example, set \`REACT_APP_API_URL=https://8585-<hash>.replicas.dev\` or update the relevant config file.
8861
+
8862
+ **Why?** The frontend works on \`localhost\` for you because both services run on the same machine. But a human viewing the preview is on a different machine \u2014 requests to \`localhost:8585\` from their browser will fail. They need the public preview URL instead.
8863
+
8864
+ ## When to Create Previews
8865
+
8866
+ - After starting any service that a human should be able to view or interact with
8867
+ - When verifying frontend/backend integrations visually
8868
+ - When the task involves UI work that benefits from human review
8869
+
8870
+ It is your responsibility to make previews work for outsiders as well as they work for you on localhost. If at any time you need to see the public URLs that have been created, read \`~/.replicas/preview-ports.json\`.
8871
+ `;
8872
+ var PREVIEWS_ABILITY = {
8873
+ label: "Previews",
8874
+ description: "Expose locally running services on public preview URLs for humans.",
8875
+ bullet: "- Creating preview URLs for locally running services",
8876
+ section: SECTION6,
8877
+ referenceFile: { name: "PREVIEWS.md", content: REFERENCE6 }
8878
+ };
8879
+
8880
+ // ../shared/src/default-skills/replicas-agent/abilities/replicas.ts
8881
+ var SECTION7 = `### Replicas (in-workspace CLI)
8882
+ Take action *with* Replicas itself \u2014 manage automations, environments (variables, files), repos, and \`replicas.json\` config \u2014 using the pre-installed, pre-authenticated \`replicas\` CLI.
8883
+
8884
+ **Reference:** \`references/REPLICAS.md\`
8885
+
8886
+ Use this when:
8887
+ - The user asks you to create, edit, run, or delete an automation
8888
+ - The user asks you to manage environments, environment variables, or environment files
8889
+ - The user asks "what envs / repos / automations do I have?"
8890
+ - The user asks you to scaffold a \`replicas.json\` / \`replicas.yaml\` in a repo`;
8891
+ var REFERENCE7 = `# Replicas (in-workspace CLI)
8892
+
8893
+ This guide covers how to take action *with* Replicas itself from inside a Replicas workspace \u2014 managing automations, environments (and their variables/files), repos, previews, and the user's \`replicas.json\` config \u2014 using the pre-installed \`replicas\` CLI.
8894
+
8895
+ When the user asks _about_ Replicas (concepts, pricing, how a feature works), check https://docs.replicas.dev first. When the user asks you to _do_ something in their Replicas org, this is the file to use.
8896
+
8897
+ ## Prerequisites
8898
+
8899
+ The CLI is pre-installed in every workspace and pre-authenticated using the workspace's engine secret. You do **not** need to log in or set an API key. Verify:
8900
+
8901
+ \`\`\`bash
8902
+ replicas whoami
8903
+ \`\`\`
8904
+
8905
+ Expected output (in agent mode):
8906
+
8907
+ \`\`\`
8908
+ Workspace identity:
8909
+ Workspace ID: <uuid>
8910
+ Organization ID: <uuid>
8911
+ \`\`\`
8912
+
8913
+ If you get "Not logged in", the workspace is misconfigured \u2014 surface this to the user instead of trying to work around it.
8914
+
8915
+ In agent mode the CLI hides commands that don't make sense for in-workspace agents (\`login\`, \`logout\`, \`codex-auth\`, \`claude-auth\`, \`org switch\`, \`config\`, \`interact\`, \`code\`, replica/workspace top-level CRUD). What you have is:
8916
+
8917
+ | Command | What it does |
8918
+ | --- | --- |
8919
+ | \`replicas whoami\` | Print the workspace + org identity |
8920
+ | \`replicas init\` | Create a \`replicas.json\` / \`replicas.yaml\` in the current directory |
8921
+ | \`replicas connect <name>\` | SSH into another workspace (requires user creds \u2014 usually only useful when scripting locally) |
8922
+ | \`replicas repos\` | List repos connected to the org |
8923
+ | \`replicas environment ...\` | Manage environments, env vars, env files |
8924
+ | \`replicas automation ...\` | Manage automations (cron + GitHub event triggers) |
8925
+ | \`replicas preview ...\` | Register / list preview URLs (covered in \`PREVIEWS.md\`) |
8926
+ | \`replicas media ...\` | Upload screenshots, videos, audio (covered in \`MEDIA.md\`) |
8927
+
8928
+ \`replicas <command> --help\` is always the source of truth for flags.
8929
+
8930
+ ## Picking the right command for the user's request
8931
+
8932
+ | User says... | Run |
8933
+ | --- | --- |
8934
+ | "What environments do I have?" | \`replicas environment list\` |
8935
+ | "Add API key X to my staging env" | \`replicas environment vars set <env> <KEY> <VALUE>\` |
8936
+ | "Make me a \`.env\` file in the workspace with these vars" | \`replicas environment files set <env> .env --content "..."\` |
8937
+ | "Create a new env for my \`acme/web\` repo" | \`replicas environment create <name> -r acme/web\` |
8938
+ | "What automations do I have?" | \`replicas automation list\` |
8939
+ | "Run my nightly automation now" | \`replicas automation run <id>\` |
8940
+ | "Make an automation that runs every weekday at 9am" | \`replicas automation create\` (interactive) or \`--trigger-cron "0 9 * * 1-5"\` |
8941
+ | "Make an automation that runs when a PR opens on \`acme/web\`" | \`replicas automation create ... --trigger-github pull_request.opened --trigger-github-repos acme/web\` |
8942
+ | "What repos are connected?" | \`replicas repos\` |
8943
+ | "Set up a \`replicas.json\` in this repo" | \`replicas init\` (\`-y\` for YAML) |
8944
+
8945
+ ## Environments
8946
+
8947
+ Environments are the org-scoped *primitives* workspaces are built from. Each environment can bind to one repository (or repository set), carry environment variables, project files, enabled skills, and MCP servers. The \`Global\` environment is special \u2014 its vars/files/skills/MCPs apply to *every* workspace in the org, but it has no repo binding and can't back a workspace on its own.
8948
+
8949
+ ### List / get / create / edit / delete
8950
+
8951
+ \`\`\`bash
8952
+ replicas environment list
8953
+ replicas environment get <id-or-name> # use "global" for the Global env
8954
+ replicas environment create [name] \\
8955
+ --description "..." \\
8956
+ --repository <repo-name-or-id> \\
8957
+ --system-prompt "..."
8958
+ replicas environment edit <id-or-name> \\
8959
+ --name "..." --description "..." \\
8960
+ --repository <repo-name-or-id> # pass empty string to unbind
8961
+ replicas environment delete <id-or-name> [--force]
8962
+ \`\`\`
8963
+
8964
+ Notes:
8965
+ - Environments resolve by **name or UUID**. \`global\` is an alias for the org's Global env.
8966
+ - Non-global envs need a repo (or repo set) to back a workspace. If you \`create\` without \`--repository\`, the CLI prompts; in non-interactive contexts pass \`-r\`.
8967
+ - \`edit\` on the Global env is rejected by the API \u2014 manage its contents through the \`vars\` / \`files\` subcommands instead.
8968
+
8969
+ ### Environment variables
8970
+
8971
+ \`\`\`bash
8972
+ replicas environment vars list <env>
8973
+ replicas environment vars set <env> <KEY> <VALUE> # upsert (create or update)
8974
+ replicas environment vars delete <env> <KEY|VARIABLE_ID> [--force]
8975
+ \`\`\`
8976
+
8977
+ \`vars set\` is upsert: if a variable with that key already exists, it's updated; otherwise created. The CLI accepts either the variable's \`key\` or its UUID for \`delete\`.
8978
+
8979
+ These variables are injected into every workspace built from this environment as actual \`env\` vars \u2014 perfect for API keys, feature flags, etc. Anything you want available to the agent's tools (Claude, codex, your code, etc.) goes here.
8980
+
8981
+ ### Environment files
8982
+
8983
+ Files materialize on the workspace filesystem when a workspace starts, at the destination path you specify. Use this for things like \`.env\` files at the repo root, dotfiles in \`~\`, prompt files for agents, etc.
8984
+
8985
+ \`\`\`bash
8986
+ replicas environment files list <env>
8987
+ replicas environment files set <env> <destination-path> --content "..." # inline
8988
+ replicas environment files set <env> <destination-path> --file <local-path> # from local file
8989
+ replicas environment files set <env> <destination-path> --file <local-path> --name "Friendly name"
8990
+ replicas environment files delete <env> <destination-path|FILE_ID> [--force]
8991
+ \`\`\`
8992
+
8993
+ Constraints:
8994
+ - Each file is capped at 64KB.
8995
+ - \`set\` is upsert (matched by destination path).
8996
+ - The display \`--name\` defaults to the basename of the destination path; override only if it would be unclear in the dashboard list.
8997
+
8998
+ ## Automations
8999
+
9000
+ Automations are saved prompts with one or more triggers (cron schedules and/or GitHub events). When fired, they create a workspace using the configured environment and run the prompt with the user's coding agent.
9001
+
9002
+ ### List / get / run / delete
9003
+
9004
+ \`\`\`bash
9005
+ replicas automation list
9006
+ replicas automation get <id>
9007
+ replicas automation run <id> # cron-triggered automations only
9008
+ replicas automation delete <id> [--force]
9009
+ \`\`\`
9010
+
9011
+ ### Create
9012
+
9013
+ Either fully flag-driven or fully interactive \u2014 the CLI prompts for anything you don't pass.
9014
+
9015
+ \`\`\`bash
9016
+ # Cron trigger
9017
+ replicas automation create "Nightly typecheck" \\
9018
+ --prompt "Run \\\`bun typecheck\\\` and report any new errors" \\
9019
+ --environment <env-name-or-id> \\
9020
+ --trigger-cron "0 4 * * *" \\
9021
+ --trigger-cron-timezone "America/New_York"
9022
+
9023
+ # GitHub trigger (filter to specific repos)
9024
+ replicas automation create "Review my PRs" \\
9025
+ --prompt "Leave a code review on this PR" \\
9026
+ --environment <env-name-or-id> \\
9027
+ --trigger-github pull_request.opened \\
9028
+ --trigger-github-repos acme/web,acme/api
9029
+
9030
+ # Disable on creation
9031
+ replicas automation create ... --disabled
9032
+
9033
+ # Workspace lifecycle
9034
+ replicas automation create ... --lifecycle delete_when_done
9035
+ replicas automation create ... --lifecycle delete_after_inactivity --auto-stop-minutes 30
9036
+ \`\`\`
9037
+
9038
+ When the user says "make me an automation that...", default to **picking the environment for them by listing the available envs** and asking only when the user hasn't already pinned one. Same for repos in GitHub triggers. Don't pepper the user with questions you can answer by reading the existing config.
9039
+
9040
+ ### Edit
9041
+
9042
+ \`\`\`bash
9043
+ replicas automation edit <id> \\
9044
+ --name "..." \\
9045
+ --prompt "..." \\
9046
+ --enabled true|false \\
9047
+ --environment <env-name-or-id> \\
9048
+ --trigger-cron "0 4 * * *" # replaces existing triggers
9049
+ \`\`\`
9050
+
9051
+ \`replicas automation edit <id>\` with no flags drops into interactive mode.
9052
+
9053
+ ## Repositories
9054
+
9055
+ Read-only listing of repos connected to the org. Use when the user asks "what repos can I use?", or to validate a \`--repository\` value before passing it to \`environment create\` / \`automation create\`:
9056
+
9057
+ \`\`\`bash
9058
+ replicas repos
9059
+ \`\`\`
9060
+
9061
+ Repos are connected via the GitHub integration in the dashboard \u2014 not from the CLI. If the user wants a repo connected, point them at the dashboard rather than trying to do it yourself.
9062
+
9063
+ ## \`replicas.json\` / \`replicas.yaml\`
9064
+
9065
+ \`replicas init\` creates a starter config in the current directory. \`-y\` writes YAML, \`-f\` overwrites an existing file. This file controls per-repo workspace setup (warm hooks, start hooks, organization scoping for GitHub triggers). When the user asks to "set up Replicas in this repo", run \`replicas init\` and then edit the generated file based on what they need.
9066
+
9067
+ ## When NOT to use the CLI
9068
+
9069
+ - **Don't use the CLI to reach into other tools' state** (Linear, Slack, GitHub) \u2014 those have dedicated skill references in this directory.
9070
+ - **Don't try to install Replicas, log in, or switch orgs** \u2014 those flows are user-facing and aren't available in agent mode anyway.
9071
+ - **Don't create workspaces** from inside an existing workspace just to run a command. You're already in one.
9072
+
9073
+ ## Common errors
9074
+
9075
+ - \`Missing Replicas-Org-Id header\` \u2192 the workspace is hitting an older monolith that doesn't yet recognize agent auth on this endpoint. Surface this to the user; don't try to work around it by faking headers.
9076
+ - \`Workspace not found\` \u2192 the workspace was deleted while you were running. Stop and tell the user.
9077
+ - \`An environment with this name already exists\` \u2192 use \`environment edit\` instead, or pick a different name.
9078
+ - \`Cannot delete the global environment\` \u2192 there is exactly one Global env per org and it's permanent. Manage its *contents* (\`vars\`, \`files\`) instead.
9079
+ `;
9080
+ var REPLICAS_ABILITY = {
9081
+ label: "Replicas",
9082
+ description: "Teach the agent about Replicas itself \u2014 automations, environments, the in-workspace CLI.",
9083
+ // No bullet — help_instructions covers the `replicas` CLI surface in detail.
9084
+ bullet: "",
9085
+ section: SECTION7,
9086
+ referenceFile: { name: "REPLICAS.md", content: REFERENCE7 },
9087
+ locked: true
9088
+ };
9089
+
9090
+ // ../shared/src/default-skills/replicas-agent/abilities/slack.ts
9091
+ var SECTION8 = `### Slack
9092
+ Send messages, read threads, search conversations, and upload files via the Slack Web API.
9093
+
9094
+ **Reference:** \`references/SLACK.md\`
9095
+
9096
+ Use this when:
9097
+ - You need to send a message to a Slack channel or thread
9098
+ - You need to read or fetch a Slack conversation
9099
+ - You encounter a Slack message link and need to retrieve its content
9100
+ - The task asks you to notify, update, or communicate via Slack`;
9101
+ var REFERENCE8 = `# Slack Integration
9102
+
9103
+ This guide covers how to interact with Slack from within your Replicas workspace.
9104
+
9105
+ ## Prerequisites
9106
+
9107
+ Check if the \`SLACK_BOT_TOKEN\` environment variable is set:
9108
+
9109
+ \`\`\`bash
9110
+ echo "\${SLACK_BOT_TOKEN:+set}"
9111
+ \`\`\`
9112
+
9113
+ - If **set**: Your workspace has Slack access. You can use the Slack Web API as described below.
9114
+ - If **not set**: Slack has not been configured for this workspace. The user needs to connect Slack in the [Replicas dashboard](https://replicas.dev) under their organization's integration settings. Let the user know and do not attempt Slack operations.
9115
+
9116
+ ## Using the Slack API
9117
+
9118
+ All requests use the \`$SLACK_BOT_TOKEN\` for authentication via the Slack Web API.
9119
+
9120
+ ### Fetching a Thread from a Slack Link
9121
+
9122
+ If you encounter a Slack message link (e.g. \`https://team.slack.com/archives/C0123ABC/p1234567890123456\`), extract the channel ID and thread timestamp:
9123
+
9124
+ - **Channel ID**: The segment after \`/archives/\` (e.g. \`C0123ABC\`)
9125
+ - **Thread TS**: The \`p\` value with a dot inserted before the last 6 digits (e.g. \`p1234567890123456\` -> \`1234567890.123456\`)
9126
+
9127
+ \`\`\`bash
9128
+ curl -s "https://slack.com/api/conversations.replies?channel=CHANNEL_ID&ts=THREAD_TS" \\
9129
+ -H "Authorization: Bearer $SLACK_BOT_TOKEN"
9130
+ \`\`\`
9131
+
9132
+ ### Sending a Message
9133
+
9134
+ \`\`\`bash
9135
+ curl -s -X POST "https://slack.com/api/chat.postMessage" \\
9136
+ -H "Authorization: Bearer $SLACK_BOT_TOKEN" \\
9137
+ -H "Content-Type: application/json" \\
9138
+ -d '{
9139
+ "channel": "CHANNEL_ID",
9140
+ "text": "Your message here",
9141
+ "thread_ts": "OPTIONAL_THREAD_TS"
9142
+ }'
9143
+ \`\`\`
9144
+
9145
+ Omit \`thread_ts\` to post a new message to the channel. Include it to reply in a thread.
9146
+
9147
+ ### Searching Messages
9148
+
9149
+ \`\`\`bash
9150
+ curl -s "https://slack.com/api/search.messages?query=YOUR_SEARCH_QUERY" \\
9151
+ -H "Authorization: Bearer $SLACK_BOT_TOKEN"
9152
+ \`\`\`
9153
+
9154
+ ### Uploading Files
9155
+
9156
+ \`\`\`bash
9157
+ curl -s -X POST "https://slack.com/api/files.uploadV2" \\
9158
+ -H "Authorization: Bearer $SLACK_BOT_TOKEN" \\
9159
+ -F "channel_id=CHANNEL_ID" \\
9160
+ -F "file=@/path/to/file" \\
9161
+ -F "title=File title"
9162
+ \`\`\`
9163
+
9164
+ ### Other Operations
9165
+
9166
+ You can list channels, read channel history, add reactions, and perform any other operation supported by the Slack Web API using the same authentication pattern.
9167
+
9168
+ For full API documentation, see: https://docs.slack.dev/apis/web-api/
9169
+ `;
9170
+ var SLACK_ABILITY = {
9171
+ label: "Slack",
9172
+ description: "Send messages, read threads, search conversations, upload files.",
9173
+ bullet: "- Interacting with Slack (sending messages, reading threads, etc.)",
9174
+ section: SECTION8,
9175
+ referenceFile: { name: "SLACK.md", content: REFERENCE8 }
9176
+ };
9177
+
9178
+ // ../shared/src/default-skills/replicas-agent/registry.ts
9179
+ var REPLICAS_AGENT_ABILITY_REGISTRY = {
9180
+ replicas: REPLICAS_ABILITY,
9181
+ docker: DOCKER_ABILITY,
9182
+ github: GITHUB_ABILITY,
9183
+ google: GOOGLE_ABILITY,
9184
+ linear: LINEAR_ABILITY,
9185
+ media: MEDIA_ABILITY,
9186
+ previews: PREVIEWS_ABILITY,
9187
+ slack: SLACK_ABILITY
9188
+ };
9189
+ var REPLICAS_AGENT_ABILITIES = Object.keys(
9190
+ REPLICAS_AGENT_ABILITY_REGISTRY
9191
+ );
9192
+
9193
+ // ../shared/src/routes/preferences.ts
9194
+ var DEFAULT_REPLICAS_AGENT_ABILITIES = Object.fromEntries(
9195
+ REPLICAS_AGENT_ABILITIES.map((key) => [key, true])
9196
+ );
9197
+ var DEFAULT_DEFAULT_SKILLS = {
9198
+ replicas_agent: {
9199
+ enabled: true,
9200
+ abilities: { ...DEFAULT_REPLICAS_AGENT_ABILITIES }
9201
+ }
9202
+ };
9203
+
8108
9204
  // ../shared/src/prompts.ts
8109
9205
  var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
8110
9206
  function removeTag(text, tag) {
@@ -14843,7 +15939,7 @@ Deleted file ${pathOrId}.
14843
15939
  }
14844
15940
 
14845
15941
  // src/index.ts
14846
- var CLI_VERSION = "0.2.180";
15942
+ var CLI_VERSION = "0.2.182";
14847
15943
  function parseBooleanOption(value) {
14848
15944
  if (value === "true") return true;
14849
15945
  if (value === "false") return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.180",
3
+ "version": "0.2.182",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {