replicas-cli 0.3.620 → 0.3.622

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.cjs +36 -14
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -21193,6 +21193,9 @@ var init_sandbox = __esm({
21193
21193
  });
21194
21194
 
21195
21195
  // ../shared/src/pricing.ts
21196
+ function isClientMessageSource(value) {
21197
+ return typeof value === "string" && CLIENT_MESSAGE_SOURCES.some((source) => source === value);
21198
+ }
21196
21199
  var BILLING_BLOCK_TITLES, TRIAL_CREDIT_CENTS, SCOUT_SOURCE, WORKSPACE_SOURCES, CLIENT_MESSAGE_SOURCES, MESSAGE_SOURCES, AUTOMATED_SOURCES, AUTOMATED_SOURCES_SQL, EGRESS_MICRODOLLARS_PER_GB, EGRESS_RATE_LABEL, CREDIT_PLAN_UNITS, PLANS, TEAM_PLAN, ENTERPRISE_PLAN;
21197
21200
  var init_pricing = __esm({
21198
21201
  "../shared/src/pricing.ts"() {
@@ -21207,9 +21210,12 @@ var init_pricing = __esm({
21207
21210
  };
21208
21211
  TRIAL_CREDIT_CENTS = 1e4;
21209
21212
  SCOUT_SOURCE = "mothership";
21210
- WORKSPACE_SOURCES = ["api", "dashboard", "slack", "linear", "github", "gitlab", "automation", SCOUT_SOURCE];
21213
+ WORKSPACE_SOURCES = ["api", "dashboard", "mobile", "slack", "linear", "github", "gitlab", "automation", SCOUT_SOURCE];
21211
21214
  CLIENT_MESSAGE_SOURCES = ["web", "desktop", "mobile", "tui"];
21212
- MESSAGE_SOURCES = [...CLIENT_MESSAGE_SOURCES, ...WORKSPACE_SOURCES];
21215
+ MESSAGE_SOURCES = [
21216
+ ...CLIENT_MESSAGE_SOURCES,
21217
+ ...WORKSPACE_SOURCES.filter((source) => !isClientMessageSource(source))
21218
+ ];
21213
21219
  AUTOMATED_SOURCES = ["api", "automation"];
21214
21220
  AUTOMATED_SOURCES_SQL = AUTOMATED_SOURCES.map((s) => `'${s}'`).join(", ");
21215
21221
  EGRESS_MICRODOLLARS_PER_GB = 15e4;
@@ -24773,7 +24779,8 @@ function parseIssueContractRecord(schema, value, at, report) {
24773
24779
  }
24774
24780
  function parseIssueContractResponse(schema, value, report) {
24775
24781
  const rows = isRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, raw]) => {
24776
- const field2 = schema.shape[key];
24782
+ const shape = schema.shape[key];
24783
+ const field2 = shape instanceof external_exports.ZodOptional ? shape.unwrap() : shape;
24777
24784
  return [key, field2 instanceof external_exports.ZodArray && Array.isArray(raw) ? raw.filter((row) => parseIssueContractRecord(field2.element, row, key, report) !== void 0) : raw];
24778
24785
  })) : value;
24779
24786
  const parsed = external_exports.safeParse(schema, rows);
@@ -24855,7 +24862,7 @@ function mapIssueActors(value, map2) {
24855
24862
  return [key, mapIssueActors(inner, map2)];
24856
24863
  }));
24857
24864
  }
24858
- var ISSUE_STATUSES, ISSUE_PRIORITIES, ISSUE_ACTOR_TYPES, ISSUE_SUBSCRIBER_ROLES, ISSUE_RELATION_TYPES, ISSUE_PULL_REQUEST_STATES, normalizeIssueStatus, issueStatusSchema, issuePrioritySchema, issueSubscriberRoleSchema, issueRelationTypeSchema, issuePullRequestStateSchema, ISSUE_STATUS_LABELS, ISSUE_PRIORITY_LABELS, unknownValues, knownOrRaw, createIssueContractReport, knownIssueActorSchema, issueActorSchema, ISSUE_KEY_RE, ISSUE_MENTION_LINK, timestamp, nullableTimestamp, issueSchema, issueSubscriberSchema, issueRelationSchema, issuePullRequestSchema, issueCommentSchema, change, nullableId, issueEventDataSchemas, issueEventBase, v, issueEventVariants, created, laterVariants, issueEventSchema, issueActorDirectorySchema, clientMutationId, title, description, body, createIssueRequestSchema, updateIssueRequestSchema, issueActorRequestSchema, createIssueCommentRequestSchema, updateIssueCommentRequestSchema, createIssueRelationRequestSchema, linkIssuePullRequestRequestSchema, updateIssuePullRequestRequestSchema, issueMutationRequestSchema, updateIssueSettingsRequestSchema, listIssuesQuerySchema, issueDetailResponseSchema, listIssuesResponseSchema, issueDirectoryUserSchema, issueDirectoryWorkspaceSchema, issuesBootstrapResponseSchema, issuesDeltaQuerySchema, issuesDeltaResponseSchema, issueInboxQuerySchema, markIssueInboxReadRequestSchema, ISSUE_COMMANDS;
24865
+ var ISSUE_STATUSES, ISSUE_PRIORITIES, ISSUE_ACTOR_TYPES, ISSUE_SUBSCRIBER_ROLES, ISSUE_RELATION_TYPES, ISSUE_PULL_REQUEST_STATES, normalizeIssueStatus, issueStatusSchema, issuePrioritySchema, issueSubscriberRoleSchema, issueRelationTypeSchema, issuePullRequestStateSchema, ISSUE_STATUS_LABELS, ISSUE_PRIORITY_LABELS, unknownValues, knownOrRaw, createIssueContractReport, knownIssueActorSchema, issueActorSchema, ISSUE_KEY_RE, ISSUE_MENTION_LINK, timestamp, nullableTimestamp, issueSchema, issueSubscriberSchema, issueRelationSchema, issuePullRequestSchema, issueCommentSchema, change, nullableId, issueEventDataSchemas, issueEventBase, v, issueEventVariants, created, laterVariants, issueEventSchema, issueRelationKind, issueActorDirectorySchema, clientMutationId, title, description, body, createIssueRequestSchema, updateIssueRequestSchema, issueActorRequestSchema, createIssueCommentRequestSchema, updateIssueCommentRequestSchema, createIssueRelationRequestSchema, linkIssuePullRequestRequestSchema, updateIssuePullRequestRequestSchema, issueMutationRequestSchema, updateIssueSettingsRequestSchema, listIssuesQuerySchema, issueDetailResponseSchema, listIssuesResponseSchema, issueDirectoryUserSchema, issueDirectoryWorkspaceSchema, issuesBootstrapResponseSchema, issuesDeltaQuerySchema, issuesDeltaResponseSchema, issueInboxQuerySchema, markIssueInboxReadRequestSchema, ISSUE_COMMANDS;
24859
24866
  var init_issues = __esm({
24860
24867
  "../shared/src/routes/issues.ts"() {
24861
24868
  "use strict";
@@ -24990,6 +24997,7 @@ var init_issues = __esm({
24990
24997
  issueEventVariants = { created: v("created"), title_changed: v("title_changed"), description_changed: v("description_changed"), status_changed: v("status_changed"), priority_changed: v("priority_changed"), parent_changed: v("parent_changed"), manager_changed: v("manager_changed"), sort_order_changed: v("sort_order_changed"), assignee_added: v("assignee_added"), assignee_removed: v("assignee_removed"), subscriber_added: v("subscriber_added"), subscriber_removed: v("subscriber_removed"), relation_added: v("relation_added"), relation_removed: v("relation_removed"), pr_linked: v("pr_linked"), pr_unlinked: v("pr_unlinked"), pr_state_changed: v("pr_state_changed"), comment_added: v("comment_added"), comment_edited: v("comment_edited"), comment_deleted: v("comment_deleted"), archived: v("archived"), restored: v("restored") };
24991
24998
  ({ created, ...laterVariants } = issueEventVariants);
24992
24999
  issueEventSchema = external_exports.discriminatedUnion("type", [created, ...Object.values(laterVariants)]);
25000
+ issueRelationKind = (relation, issueId) => relation.type === "blocks" ? relation.issue_id === issueId ? "blocks" : "blocked_by" : relation.issue_id === issueId ? "duplicate_of" : "duplicated_by";
24993
25001
  issueActorDirectorySchema = external_exports.record(external_exports.string(), external_exports.object({ name: external_exports.string(), handle: external_exports.string() }));
24994
25002
  clientMutationId = external_exports.string().min(1).max(128).optional();
24995
25003
  title = external_exports.string().trim().min(1).max(500);
@@ -25067,7 +25075,8 @@ var init_issues = __esm({
25067
25075
  pull_requests: external_exports.array(issuePullRequestSchema),
25068
25076
  comments: external_exports.array(issueCommentSchema),
25069
25077
  events: external_exports.array(issueEventSchema),
25070
- sub_issues: external_exports.array(issueSchema)
25078
+ sub_issues: external_exports.array(issueSchema),
25079
+ related_issues: external_exports.array(issueSchema).optional()
25071
25080
  });
25072
25081
  listIssuesResponseSchema = external_exports.object({ issues: external_exports.array(issueSchema), next_cursor: external_exports.number().nullable() });
25073
25082
  issueDirectoryUserSchema = external_exports.object({
@@ -40793,7 +40802,7 @@ var CLI_VERSION;
40793
40802
  var init_cli_version = __esm({
40794
40803
  "../shared/src/cli-version.ts"() {
40795
40804
  "use strict";
40796
- CLI_VERSION = "0.3.620";
40805
+ CLI_VERSION = "0.3.622";
40797
40806
  }
40798
40807
  });
40799
40808
 
@@ -57609,9 +57618,6 @@ function readText(inline, file2, what) {
57609
57618
  if (inline !== void 0 && file2 !== void 0) throw new Error(`Pass either --${what} or --${what}-file, not both`);
57610
57619
  return file2 === void 0 ? inline : import_node_fs2.default.readFileSync(file2 === "-" ? 0 : file2, "utf8");
57611
57620
  }
57612
- function printIssueLine(issue3) {
57613
- console.log(`${import_chalk29.default.cyan(issue3.identifier.padEnd(9))} ${issue3.status.padEnd(11)} ${issue3.priority === "none" ? "" : import_chalk29.default.yellow(`${issue3.priority} `)}${issue3.title}`);
57614
- }
57615
57621
  async function issueCreateCommand(title3, options) {
57616
57622
  await callIssueTool(ISSUE_COMMANDS.create, {
57617
57623
  title: title3,
@@ -57646,14 +57652,29 @@ async function issueViewCommand(issue3) {
57646
57652
  ${renderIssueMentions(detail.issue.description, actors)}`);
57647
57653
  for (const pr2 of detail.pull_requests) console.log(`
57648
57654
  ${import_chalk29.default.magenta("PR")} ${pr2.url} (${pr2.state})`);
57649
- for (const sub of detail.sub_issues) printIssueLine(sub);
57655
+ const issueById = new Map([detail.issue, ...detail.sub_issues, ...detail.related_issues ?? []].map((related) => [related.id, related]));
57656
+ const identifierOf = (id) => issueById.get(id)?.identifier ?? (detail.related_issues ? "a deleted issue" : id);
57657
+ const links = [
57658
+ ...detail.issue.parent_id ? [{ label: "parent", id: detail.issue.parent_id }] : [],
57659
+ ...detail.relations.map((relation) => ({
57660
+ label: issueRelationKind(relation, detail.issue.id).replace("_", " "),
57661
+ id: relation.issue_id === detail.issue.id ? relation.related_issue_id : relation.issue_id
57662
+ })),
57663
+ ...detail.sub_issues.map((sub) => ({ label: "sub-issue", id: sub.id }))
57664
+ ];
57665
+ const linkLines = links.map(({ label, id }) => {
57666
+ const related = issueById.get(id);
57667
+ return `${import_chalk29.default.dim(label.padEnd(13))} ${related ? issueLine(related) : import_chalk29.default.dim(identifierOf(id))}`;
57668
+ });
57669
+ if (linkLines.length) console.log(`
57670
+ ${linkLines.join("\n")}`);
57650
57671
  for (const comment of detail.comments) {
57651
57672
  console.log(`
57652
57673
  ${import_chalk29.default.dim(`\u2014 ${name(comment.author)}, ${comment.created_at}`)}
57653
57674
  ${renderIssueMentions(comment.body, actors)}`);
57654
57675
  }
57655
57676
  const activity = detail.events.flatMap((event) => {
57656
- const change2 = describeIssueEvent(event, name, (id) => [detail.issue, ...detail.sub_issues].find((related) => related.id === id)?.identifier ?? id);
57677
+ const change2 = describeIssueEvent(event, name, identifierOf);
57657
57678
  return change2 ? [`${import_chalk29.default.dim(event.created_at)} ${name(event.actor)} ${change2}`] : [];
57658
57679
  });
57659
57680
  if (activity.length) console.log(`
@@ -57673,7 +57694,7 @@ async function issueListCommand(options) {
57673
57694
  limit: options.limit ? Number(options.limit) : void 0
57674
57695
  }, listIssuesResponseSchema, ({ issues, next_cursor }) => {
57675
57696
  if (issues.length === 0) console.log(import_chalk29.default.dim("No issues"));
57676
- issues.forEach(printIssueLine);
57697
+ issues.forEach((issue3) => console.log(issueLine(issue3)));
57677
57698
  if (next_cursor !== null) console.log(import_chalk29.default.dim("More issues exist; narrow the filters or raise --limit."));
57678
57699
  });
57679
57700
  }
@@ -57697,7 +57718,7 @@ async function issueUnlinkPrCommand(issue3, url2) {
57697
57718
  async function issueRelateCommand(issue3, type, related) {
57698
57719
  await callIssueTool(ISSUE_COMMANDS.relate, { issue: issue3, type, related_issue: related }, noData, () => console.log(`${import_chalk29.default.green("\u2713")} ${issue3} ${type.replace("_", " ")} ${related}`));
57699
57720
  }
57700
- var import_node_fs2, import_node_path2, import_chalk29, mutationSchema, noData, csv, printMutation;
57721
+ var import_node_fs2, import_node_path2, import_chalk29, mutationSchema, noData, csv, issueLine, printMutation;
57701
57722
  var init_issue = __esm({
57702
57723
  "src/commands/issue.ts"() {
57703
57724
  "use strict";
@@ -57713,6 +57734,7 @@ var init_issue = __esm({
57713
57734
  mutationSchema = external_exports.object({ issue: issueSchema });
57714
57735
  noData = external_exports.looseObject({});
57715
57736
  csv = (value) => value?.split(",").map((entry) => entry.trim()).filter(Boolean).join(",");
57737
+ issueLine = (issue3) => `${import_chalk29.default.cyan(issue3.identifier.padEnd(9))} ${issue3.status.padEnd(11)} ${issue3.priority === "none" ? "" : import_chalk29.default.yellow(`${issue3.priority} `)}${issue3.title}${issue3.archived_at ? import_chalk29.default.dim(" (archived)") : ""}`;
57716
57738
  printMutation = ({ issue: issue3 }) => console.log(`${import_chalk29.default.green("\u2713")} ${import_chalk29.default.cyan(issue3.identifier)} ${issue3.title} (${issue3.status})`);
57717
57739
  }
57718
57740
  });
@@ -59317,7 +59339,7 @@ var init_src2 = __esm({
59317
59339
  issue2 = program.command("issue", { hidden: !isAgentMode() }).description("File, update, and follow Replicas Issues (REP-42). Each command takes an identifier like REP-42 or an issue ID");
59318
59340
  issue2.command("create <title>").description("File an issue").option("-d, --description <markdown>", "What is wrong or wanted, with the evidence").option("--description-file <path>", "Read the description from a file (- for stdin)").option("-s, --status <status>", `${ISSUE_STATUSES.join(", ")} (default: backlog)`).option("-p, --priority <priority>", ISSUE_PRIORITIES.join(", ")).option("--parent <issue>", "Make it a sub-issue of this issue").option("-a, --assign <who>", "Assignee: user:<email>, workspace:<id> or me (repeatable)", collect, []).option("--manager <workspace>", "Manager whose issues it joins, as workspace:<id> (default: yours, inside a Manager or its ship); 'none' for none").option("--attach <file>", "Upload and embed a screenshot or recording (repeatable)", collect, []).action(run(issueCreateCommand));
59319
59341
  issue2.command("update <issue>").description("Change the title, description, status, priority or parent").option("-t, --title <title>", "New title").option("-d, --description <markdown>", "Replace the whole description").option("--description-file <path>", "Replace the description from a file (- for stdin)").option("-s, --status <status>", ISSUE_STATUSES.join(", ")).option("-p, --priority <priority>", ISSUE_PRIORITIES.join(", ")).option("--parent <issue>", "New parent issue, or 'none'").option("--attach <file>", "Upload and embed at the end of the description (repeatable)", collect, []).action(run(issueUpdateCommand));
59320
- issue2.command("view <issue>").description("Show an issue with its comments, activity, pull requests and sub-issues").action(run(issueViewCommand));
59342
+ issue2.command("view <issue>").description("Show an issue with its parent, relations, sub-issues, pull requests, comments and activity").action(run(issueViewCommand));
59321
59343
  issue2.command("list").description("List issues, newest first").option("-q, --query <text>", "Search titles and descriptions").option("-s, --status <statuses>", "Comma-separated statuses").option("-p, --priority <priorities>", "Comma-separated priorities").option("--mine", "Assigned to you (this workspace inside one)").option("--assignee <actor>", "user:<email>, workspace:<id> or me; comma-separate to match any").option("--manager <workspace>", "A Manager's issues, as workspace:<id>").option("--parent <issue>", "Sub-issues of this issue; 'none' for top-level only").option("--archived", "Include archived issues").option("-l, --limit <n>", "Page size (default 50, max 200)").action(run(issueListCommand));
59322
59344
  issue2.command("search <query>").description("Search issues by text or identifier").action(run((query) => issueListCommand({ query })));
59323
59345
  issue2.command("comment <issue> [body]").description("Comment on an issue. @Name or @email mentions a person or workspace").option("-f, --file <path>", "Read the comment from a file (- for stdin)").option("--attach <file>", "Upload and embed a screenshot or recording (repeatable)", collect, []).action(run(issueCommentCommand));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.620",
3
+ "version": "0.3.622",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {