replicas-cli 0.2.306 → 0.2.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +57 -42
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -8521,41 +8521,59 @@ This guide covers how to interact with Linear from within your Replicas workspac
|
|
|
8521
8521
|
|
|
8522
8522
|
## Prerequisites
|
|
8523
8523
|
|
|
8524
|
-
Check
|
|
8524
|
+
Check that the workspace has the Replicas engine credentials needed to proxy Linear requests:
|
|
8525
8525
|
|
|
8526
8526
|
\`\`\`bash
|
|
8527
|
-
echo
|
|
8527
|
+
test -n "$MONOLITH_URL" && test -n "$REPLICAS_ENGINE_SECRET" && test -n "$WORKSPACE_ID" && echo set
|
|
8528
8528
|
\`\`\`
|
|
8529
8529
|
|
|
8530
|
-
- If **set**:
|
|
8531
|
-
- If **not set**:
|
|
8530
|
+
- If **set**: Use the Replicas Linear proxy below. It refreshes Linear OAuth tokens for you.
|
|
8531
|
+
- If **not set**: The workspace cannot authenticate to Replicas. Let the user know and do not attempt Linear operations.
|
|
8532
|
+
|
|
8533
|
+
Then verify Linear is connected:
|
|
8534
|
+
|
|
8535
|
+
\`\`\`bash
|
|
8536
|
+
curl -fsS -X POST "$MONOLITH_URL/v1/engine/linear/refresh-token" \\
|
|
8537
|
+
-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
|
|
8538
|
+
-H "X-Workspace-Id: $WORKSPACE_ID" \\
|
|
8539
|
+
-H "Content-Type: application/json" \\
|
|
8540
|
+
-d '{}' >/dev/null
|
|
8541
|
+
\`\`\`
|
|
8542
|
+
|
|
8543
|
+
If this fails because no Linear credential is connected, the user needs to connect Linear in the [Replicas dashboard](https://replicas.dev) under their organization's integration settings.
|
|
8532
8544
|
|
|
8533
8545
|
## Using the Linear API
|
|
8534
8546
|
|
|
8535
|
-
Linear uses a GraphQL API
|
|
8547
|
+
Linear uses a GraphQL API. Always call it through Replicas so the access token stays fresh:
|
|
8548
|
+
|
|
8549
|
+
\`\`\`bash
|
|
8550
|
+
linear_graphql() {
|
|
8551
|
+
curl -sS -X POST "$MONOLITH_URL/v1/engine/linear/graphql" \\
|
|
8552
|
+
-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
|
|
8553
|
+
-H "X-Workspace-Id: $WORKSPACE_ID" \\
|
|
8554
|
+
-H "Content-Type: application/json" \\
|
|
8555
|
+
--data-binary @-
|
|
8556
|
+
}
|
|
8557
|
+
\`\`\`
|
|
8536
8558
|
|
|
8537
8559
|
### Fetching an Issue
|
|
8538
8560
|
|
|
8539
8561
|
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\`).
|
|
8540
8562
|
|
|
8541
8563
|
\`\`\`bash
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
"query": "query { issues(filter: { identifier: { eq: \\"ENG-123\\" } }) { nodes { id identifier title description state { name } assignee { name } parent { identifier title description } } } }"
|
|
8547
|
-
}'
|
|
8564
|
+
jq -n --arg identifier "ENG-123" '{
|
|
8565
|
+
query: "query($identifier: String!) { issues(filter: { identifier: { eq: $identifier } }) { nodes { id identifier title description state { name } assignee { name } parent { identifier title description } } } }",
|
|
8566
|
+
variables: { identifier: $identifier }
|
|
8567
|
+
}' | linear_graphql
|
|
8548
8568
|
\`\`\`
|
|
8549
8569
|
|
|
8550
8570
|
### Updating Issue State
|
|
8551
8571
|
|
|
8552
8572
|
\`\`\`bash
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
"query": "mutation { issueUpdate(id: \\"ISSUE_UUID\\", input: { stateId: \\"STATE_UUID\\" }) { success issue { identifier state { name } } } }"
|
|
8558
|
-
}'
|
|
8573
|
+
jq -n --arg issueId "ISSUE_UUID" --arg stateId "STATE_UUID" '{
|
|
8574
|
+
query: "mutation($issueId: String!, $stateId: String!) { issueUpdate(id: $issueId, input: { stateId: $stateId }) { success issue { identifier state { name } } } }",
|
|
8575
|
+
variables: { issueId: $issueId, stateId: $stateId }
|
|
8576
|
+
}' | linear_graphql
|
|
8559
8577
|
\`\`\`
|
|
8560
8578
|
|
|
8561
8579
|
To find available states, query: \`query { workflowStates { nodes { id name } } }\`
|
|
@@ -8563,23 +8581,19 @@ To find available states, query: \`query { workflowStates { nodes { id name } }
|
|
|
8563
8581
|
### Adding a Comment
|
|
8564
8582
|
|
|
8565
8583
|
\`\`\`bash
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
"query": "mutation { commentCreate(input: { issueId: \\"ISSUE_UUID\\", body: \\"Your comment here\\" }) { success comment { id } } }"
|
|
8571
|
-
}'
|
|
8584
|
+
jq -n --arg issueId "ISSUE_UUID" --arg body "Your comment here" '{
|
|
8585
|
+
query: "mutation($issueId: String!, $body: String!) { commentCreate(input: { issueId: $issueId, body: $body }) { success comment { id } } }",
|
|
8586
|
+
variables: { issueId: $issueId, body: $body }
|
|
8587
|
+
}' | linear_graphql
|
|
8572
8588
|
\`\`\`
|
|
8573
8589
|
|
|
8574
8590
|
### Searching Issues
|
|
8575
8591
|
|
|
8576
8592
|
\`\`\`bash
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
"query": "query { issueSearch(query: \\"search terms\\", first: 10) { nodes { identifier title state { name } } } }"
|
|
8582
|
-
}'
|
|
8593
|
+
jq -n --arg query "search terms" '{
|
|
8594
|
+
query: "query($query: String!) { issueSearch(query: $query, first: 10) { nodes { identifier title state { name } } } }",
|
|
8595
|
+
variables: { query: $query }
|
|
8596
|
+
}' | linear_graphql
|
|
8583
8597
|
\`\`\`
|
|
8584
8598
|
|
|
8585
8599
|
### Other Operations
|
|
@@ -8747,21 +8761,25 @@ FILENAME=$(basename "$FILE")
|
|
|
8747
8761
|
SIZE=$(stat -c%s "$FILE" 2>/dev/null || stat -f%z "$FILE")
|
|
8748
8762
|
CONTENT_TYPE=image/png
|
|
8749
8763
|
ISSUE_UUID=... # the Linear issue's UUID
|
|
8750
|
-
WORKSPACE_ID=... # the Replicas workspace ID
|
|
8751
8764
|
MEDIA_ID=... # the media ID printed by \`replicas media upload\`
|
|
8752
8765
|
|
|
8766
|
+
linear_graphql() {
|
|
8767
|
+
curl -sS -X POST "$MONOLITH_URL/v1/engine/linear/graphql" \\
|
|
8768
|
+
-H "Authorization: Bearer $REPLICAS_ENGINE_SECRET" \\
|
|
8769
|
+
-H "X-Workspace-Id: $WORKSPACE_ID" \\
|
|
8770
|
+
-H "Content-Type: application/json" \\
|
|
8771
|
+
--data-binary @-
|
|
8772
|
+
}
|
|
8773
|
+
|
|
8753
8774
|
# 1. Ask Linear for an upload URL + assetUrl.
|
|
8754
|
-
RESERVE=$(
|
|
8755
|
-
-H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
|
|
8756
|
-
-H "Content-Type: application/json" \\
|
|
8757
|
-
-d "$(jq -n \\
|
|
8775
|
+
RESERVE=$(jq -n \\
|
|
8758
8776
|
--argjson size "$SIZE" \\
|
|
8759
8777
|
--arg contentType "$CONTENT_TYPE" \\
|
|
8760
8778
|
--arg filename "$FILENAME" \\
|
|
8761
8779
|
'{
|
|
8762
8780
|
query: "mutation($size: Int!, $contentType: String!, $filename: String!) { fileUpload(size: $size, contentType: $contentType, filename: $filename) { uploadFile { uploadUrl assetUrl headers { key value } } } }",
|
|
8763
8781
|
variables: { size: $size, contentType: $contentType, filename: $filename }
|
|
8764
|
-
}')
|
|
8782
|
+
}' | linear_graphql)
|
|
8765
8783
|
UPLOAD_URL=$(echo "$RESERVE" | jq -r '.data.fileUpload.uploadFile.uploadUrl')
|
|
8766
8784
|
ASSET_URL=$(echo "$RESERVE" | jq -r '.data.fileUpload.uploadFile.assetUrl')
|
|
8767
8785
|
|
|
@@ -8781,16 +8799,13 @@ curl -s -X PUT "$UPLOAD_URL" \\
|
|
|
8781
8799
|
BODY=$(printf '\\n\\n[View in Replicas](https://tryreplicas.com/workspaces/%s?mode=media&media=%s)' \\
|
|
8782
8800
|
"$ASSET_URL" "$WORKSPACE_ID" "$MEDIA_ID")
|
|
8783
8801
|
|
|
8784
|
-
|
|
8785
|
-
-H "Authorization: Bearer $LINEAR_ACCESS_TOKEN" \\
|
|
8786
|
-
-H "Content-Type: application/json" \\
|
|
8787
|
-
-d "$(jq -n \\
|
|
8802
|
+
jq -n \\
|
|
8788
8803
|
--arg issueId "$ISSUE_UUID" \\
|
|
8789
8804
|
--arg body "$BODY" \\
|
|
8790
8805
|
'{
|
|
8791
8806
|
query: "mutation($issueId: String!, $body: String!) { commentCreate(input: { issueId: $issueId, body: $body }) { success } }",
|
|
8792
8807
|
variables: { issueId: $issueId, body: $body }
|
|
8793
|
-
}'
|
|
8808
|
+
}' | linear_graphql
|
|
8794
8809
|
\`\`\`
|
|
8795
8810
|
|
|
8796
8811
|
The same flow works for issue bodies (use \`issueCreate\` / \`issueUpdate\` with the same markdown body).
|
|
@@ -9345,13 +9360,13 @@ var HOOK_EXEC_MAX_BUFFER_BYTES = 10 * 1024 * 1024;
|
|
|
9345
9360
|
var REPLICAS_CONFIG_FILENAMES = ["replicas.json", "replicas.yaml", "replicas.yml"];
|
|
9346
9361
|
|
|
9347
9362
|
// ../shared/src/cli-version.ts
|
|
9348
|
-
var CLI_VERSION = "0.2.
|
|
9363
|
+
var CLI_VERSION = "0.2.308";
|
|
9349
9364
|
|
|
9350
9365
|
// ../shared/src/engine/environment.ts
|
|
9351
9366
|
var DESKTOP_NOVNC_PORT = 6080;
|
|
9352
9367
|
function getDesktopViewerUrl(publicUrl) {
|
|
9353
9368
|
const url = new URL(`${publicUrl.replace(/\/$/, "")}/`);
|
|
9354
|
-
url.searchParams.set("v", "
|
|
9369
|
+
url.searchParams.set("v", "11");
|
|
9355
9370
|
return url.toString();
|
|
9356
9371
|
}
|
|
9357
9372
|
var DESKTOP_VIEWER_WIDTH = 1920;
|