@rudderhq/cli 0.3.4-canary.5 → 0.3.4-canary.6

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.js CHANGED
@@ -1649,12 +1649,12 @@ var init_project = __esm({
1649
1649
 
1650
1650
  // ../packages/shared/dist/validators/issue.js
1651
1651
  import { z as z14 } from "zod";
1652
- var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, updateIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema, createLibraryDocumentSchema, updateLibraryDocumentSchema, restoreLibraryDocumentRevisionSchema;
1652
+ var runWorkspaceStrategySchema, issueRunWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, updateIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema, createLibraryDocumentSchema, updateLibraryDocumentSchema, restoreLibraryDocumentRevisionSchema;
1653
1653
  var init_issue = __esm({
1654
1654
  "../packages/shared/dist/validators/issue.js"() {
1655
1655
  "use strict";
1656
1656
  init_constants();
1657
- executionWorkspaceStrategySchema2 = z14.object({
1657
+ runWorkspaceStrategySchema = z14.object({
1658
1658
  type: z14.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
1659
1659
  baseRef: z14.string().optional().nullable(),
1660
1660
  branchTemplate: z14.string().optional().nullable(),
@@ -1662,9 +1662,9 @@ var init_issue = __esm({
1662
1662
  provisionCommand: z14.string().optional().nullable(),
1663
1663
  teardownCommand: z14.string().optional().nullable()
1664
1664
  }).strict();
1665
- issueExecutionWorkspaceSettingsSchema = z14.object({
1665
+ issueRunWorkspaceSettingsSchema = z14.object({
1666
1666
  mode: z14.enum(["inherit", "shared_workspace", "isolated_workspace", "operator_branch", "reuse_existing", "agent_default"]).optional(),
1667
- workspaceStrategy: executionWorkspaceStrategySchema2.optional().nullable(),
1667
+ workspaceStrategy: runWorkspaceStrategySchema.optional().nullable(),
1668
1668
  workspaceRuntime: z14.record(z14.unknown()).optional().nullable()
1669
1669
  }).strict();
1670
1670
  issueAssigneeAdapterOverridesSchema = z14.object({
@@ -1687,7 +1687,19 @@ var init_issue = __esm({
1687
1687
  requestDepth: z14.number().int().nonnegative().optional().default(0),
1688
1688
  billingCode: z14.string().optional().nullable(),
1689
1689
  assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
1690
+ runWorkspaceId: z14.string().uuid().optional().nullable(),
1691
+ runWorkspacePreference: z14.enum([
1692
+ "inherit",
1693
+ "shared_workspace",
1694
+ "isolated_workspace",
1695
+ "operator_branch",
1696
+ "reuse_existing",
1697
+ "agent_default"
1698
+ ]).optional().nullable(),
1699
+ runWorkspaceSettings: issueRunWorkspaceSettingsSchema.optional().nullable(),
1700
+ /** @deprecated Use runWorkspaceId. */
1690
1701
  executionWorkspaceId: z14.string().uuid().optional().nullable(),
1702
+ /** @deprecated Use runWorkspacePreference. */
1691
1703
  executionWorkspacePreference: z14.enum([
1692
1704
  "inherit",
1693
1705
  "shared_workspace",
@@ -1696,7 +1708,8 @@ var init_issue = __esm({
1696
1708
  "reuse_existing",
1697
1709
  "agent_default"
1698
1710
  ]).optional().nullable(),
1699
- executionWorkspaceSettings: issueExecutionWorkspaceSettingsSchema.optional().nullable(),
1711
+ /** @deprecated Use runWorkspaceSettings. */
1712
+ executionWorkspaceSettings: issueRunWorkspaceSettingsSchema.optional().nullable(),
1700
1713
  labelIds: z14.array(z14.string().uuid()).optional()
1701
1714
  });
1702
1715
  createIssueLabelSchema = z14.object({
@@ -1814,6 +1827,8 @@ var init_work_product = __esm({
1814
1827
  ]);
1815
1828
  createIssueWorkProductSchema = z15.object({
1816
1829
  projectId: z15.string().uuid().optional().nullable(),
1830
+ runWorkspaceId: z15.string().uuid().optional().nullable(),
1831
+ /** @deprecated Use runWorkspaceId. */
1817
1832
  executionWorkspaceId: z15.string().uuid().optional().nullable(),
1818
1833
  runtimeServiceId: z15.string().uuid().optional().nullable(),
1819
1834
  type: issueWorkProductTypeSchema,
@@ -1835,19 +1850,19 @@ var init_work_product = __esm({
1835
1850
 
1836
1851
  // ../packages/shared/dist/validators/execution-workspace.js
1837
1852
  import { z as z16 } from "zod";
1838
- var executionWorkspaceStatusSchema, updateExecutionWorkspaceSchema;
1853
+ var runWorkspaceStatusSchema, updateRunWorkspaceSchema;
1839
1854
  var init_execution_workspace = __esm({
1840
1855
  "../packages/shared/dist/validators/execution-workspace.js"() {
1841
1856
  "use strict";
1842
- executionWorkspaceStatusSchema = z16.enum([
1857
+ runWorkspaceStatusSchema = z16.enum([
1843
1858
  "active",
1844
1859
  "idle",
1845
1860
  "in_review",
1846
1861
  "archived",
1847
1862
  "cleanup_failed"
1848
1863
  ]);
1849
- updateExecutionWorkspaceSchema = z16.object({
1850
- status: executionWorkspaceStatusSchema.optional(),
1864
+ updateRunWorkspaceSchema = z16.object({
1865
+ status: runWorkspaceStatusSchema.optional(),
1851
1866
  cleanupEligibleAt: z16.string().datetime().optional().nullable(),
1852
1867
  cleanupReason: z16.string().optional().nullable(),
1853
1868
  metadata: z16.record(z16.unknown()).optional().nullable()
@@ -2727,7 +2742,7 @@ var init_project_mentions = __esm({
2727
2742
  });
2728
2743
 
2729
2744
  // ../packages/shared/dist/issue-activity.js
2730
- var ISSUE_UPDATE_ACTIVITY_METADATA_KEYS, LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELDS, ISSUE_UPDATE_ACTIVITY_METADATA_KEY_SET, LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELD_SET;
2745
+ var ISSUE_UPDATE_ACTIVITY_METADATA_KEYS, LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELDS, INTERNAL_ISSUE_UPDATE_ACTIVITY_FIELDS, ISSUE_UPDATE_ACTIVITY_METADATA_KEY_SET, LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELD_SET, INTERNAL_ISSUE_UPDATE_ACTIVITY_FIELD_SET;
2731
2746
  var init_issue_activity = __esm({
2732
2747
  "../packages/shared/dist/issue-activity.js"() {
2733
2748
  "use strict";
@@ -2743,8 +2758,19 @@ var init_issue_activity = __esm({
2743
2758
  "normalizedReason"
2744
2759
  ];
2745
2760
  LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELDS = ["description", "title"];
2761
+ INTERNAL_ISSUE_UPDATE_ACTIVITY_FIELDS = [
2762
+ "executionWorkspaceId",
2763
+ "executionWorkspacePreference",
2764
+ "executionWorkspaceSettings",
2765
+ "currentExecutionWorkspace",
2766
+ "runWorkspaceId",
2767
+ "runWorkspacePreference",
2768
+ "runWorkspaceSettings",
2769
+ "currentRunWorkspace"
2770
+ ];
2746
2771
  ISSUE_UPDATE_ACTIVITY_METADATA_KEY_SET = new Set(ISSUE_UPDATE_ACTIVITY_METADATA_KEYS);
2747
2772
  LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELD_SET = new Set(LOW_SIGNAL_ISSUE_UPDATE_ACTIVITY_FIELDS);
2773
+ INTERNAL_ISSUE_UPDATE_ACTIVITY_FIELD_SET = new Set(INTERNAL_ISSUE_UPDATE_ACTIVITY_FIELDS);
2748
2774
  }
2749
2775
  });
2750
2776
 
@@ -10693,7 +10719,7 @@ var AGENT_CLI_CAPABILITIES = [
10693
10719
  id: "issue.documents.put",
10694
10720
  command: "rudder issue documents put <issue> <key> --body-file <path>",
10695
10721
  category: "issue",
10696
- description: "Legacy create or update of a DB-backed issue document; prefer `rudder library file put` for durable project files.",
10722
+ description: "Legacy create or update of a DB-backed issue document; prefer local project Library files under `$RUDDER_PROJECT_LIBRARY_ROOT` for durable project files.",
10697
10723
  mutating: true,
10698
10724
  contract: "compat",
10699
10725
  requiresOrgId: false,
@@ -10765,7 +10791,7 @@ var AGENT_CLI_CAPABILITIES = [
10765
10791
  id: "library.file.list",
10766
10792
  command: "rudder library file list [directory]",
10767
10793
  category: "library",
10768
- description: "List path-based Library files and folders.",
10794
+ description: "List Library files and folders; file rows include `libraryEntryId` when a strong reference can be generated.",
10769
10795
  mutating: false,
10770
10796
  contract: "agent-v1",
10771
10797
  requiresOrgId: true,
@@ -10777,7 +10803,31 @@ var AGENT_CLI_CAPABILITIES = [
10777
10803
  id: "library.file.get",
10778
10804
  command: "rudder library file get <path>",
10779
10805
  category: "library",
10780
- description: "Read one path-based Library file.",
10806
+ description: "Fallback read when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
10807
+ mutating: false,
10808
+ contract: "agent-v1",
10809
+ requiresOrgId: true,
10810
+ requiresAgentId: false,
10811
+ requiresRunId: false,
10812
+ attachesRunIdWhenAvailable: false
10813
+ },
10814
+ {
10815
+ id: "library.file.ref",
10816
+ command: "rudder library file ref <path>",
10817
+ category: "library",
10818
+ description: "Return the stable Markdown reference for one Library file without printing file content.",
10819
+ mutating: false,
10820
+ contract: "agent-v1",
10821
+ requiresOrgId: true,
10822
+ requiresAgentId: false,
10823
+ requiresRunId: false,
10824
+ attachesRunIdWhenAvailable: false
10825
+ },
10826
+ {
10827
+ id: "library.file.link",
10828
+ command: "rudder library file link <path>",
10829
+ category: "library",
10830
+ description: "Compatibility alias for `rudder library file ref <path>`.",
10781
10831
  mutating: false,
10782
10832
  contract: "agent-v1",
10783
10833
  requiresOrgId: true,
@@ -10789,7 +10839,7 @@ var AGENT_CLI_CAPABILITIES = [
10789
10839
  id: "library.file.put",
10790
10840
  command: "rudder library file put <path> --body-file <path>",
10791
10841
  category: "library",
10792
- description: "Create or update one path-based Library file.",
10842
+ description: "Fallback create/update when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
10793
10843
  mutating: true,
10794
10844
  contract: "agent-v1",
10795
10845
  requiresOrgId: true,
@@ -11706,10 +11756,14 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
11706
11756
  "- Personal skills live under `$AGENT_HOME/skills`.",
11707
11757
  "- Shared organization workspace root lives under `$RUDDER_ORG_WORKSPACE_ROOT`.",
11708
11758
  "- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
11709
- '- Library-backed project resources use `sourceType: "library"`; their `locator` points into `library:projects/<project-name>/`.',
11759
+ "- Project Library root lives under `$RUDDER_PROJECT_LIBRARY_ROOT` when the run has project context.",
11760
+ "- Project Library locator lives in `$RUDDER_PROJECT_LIBRARY_PATH` when the run has project context, for example `projects/<project-key>`.",
11761
+ '- Library-backed project resources use `sourceType: "library"`; their `locator` points into `library:projects/<project-key>/`.',
11710
11762
  "- Project Context is explicit operator-curated context, not the whole knowledge boundary. When it is insufficient, inspect broader Library and org workspace know-how before concluding context is missing.",
11711
- "- Durable generated project work files should be written under `library:projects/<project-name>/`.",
11712
- "- When you create or update a durable Library file, always include a user-visible Markdown link to that file in your final chat reply or issue comment. Use `library-file://file?p=<url-encoded-relative-path>&t=<url-encoded-title>` for Library file links.",
11763
+ "- In local trusted runs, durable generated project work files should be written directly under `$RUDDER_PROJECT_LIBRARY_ROOT` with normal filesystem tools.",
11764
+ "- `library:projects/<project-key>/...` is the Rudder product locator for those files, not the Markdown link syntax and not a reason to route ordinary local edits through the CLI.",
11765
+ '- When you create or update a durable Library file, always include a user-visible Markdown link to that file in your final chat reply or issue comment. Use `rudder library file ref "$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>" --json` and paste the returned `markdownLink`; do not pass the absolute `$RUDDER_PROJECT_LIBRARY_ROOT/...` path to `ref`, and do not hand-write `library-entry://...` or `library-file://...` links.',
11766
+ '- If `$RUDDER_PROJECT_LIBRARY_ROOT` is unset or inaccessible, use `rudder library file get/put "$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>"` as the remote or restricted runtime fallback.',
11713
11767
  "- Use `/tmp` only for transient scratch files and temporary verification files; do not put durable work product there.",
11714
11768
  "- Local trusted runtimes may expose the host operator home as `$RUDDER_OPERATOR_HOME`; use it only when a local skill or script intentionally needs operator-owned desktop app or CLI state. Do not replace `$HOME` with it.",
11715
11769
  "",
@@ -12703,9 +12757,27 @@ function parseCsv5(value) {
12703
12757
  // src/commands/client/library.ts
12704
12758
  import { readFile as readFile6 } from "node:fs/promises";
12705
12759
  import path20 from "node:path";
12760
+ function toLibraryFileLinkResult(detail) {
12761
+ return {
12762
+ filePath: detail.filePath,
12763
+ libraryEntryId: detail.libraryEntryId,
12764
+ mentionHref: detail.mentionHref,
12765
+ markdownLink: detail.markdownLink
12766
+ };
12767
+ }
12768
+ async function printLibraryFileReference(filePath, opts) {
12769
+ const ctx = resolveCommandContext(opts, { requireCompany: true });
12770
+ const search = new URLSearchParams();
12771
+ search.set("path", filePath.trim());
12772
+ const result = await ctx.api.get(
12773
+ `/api/orgs/${ctx.orgId}/workspace/file?${search.toString()}`
12774
+ );
12775
+ if (!result) throw new Error("Library file not found");
12776
+ printOutput(toLibraryFileLinkResult(result), { json: ctx.json });
12777
+ }
12706
12778
  function registerLibraryCommands(program) {
12707
12779
  const library = program.command("library").description("Library file operations");
12708
- const file = library.command("file").description("Path-based Library file operations");
12780
+ const file = library.command("file").description("Library file operations");
12709
12781
  addCommonClientOptions(
12710
12782
  file.command("list").description(getAgentCliCapabilityById("library.file.list").description).argument("[directoryPath]", "Library directory path", "projects").action(async (directoryPath, opts) => {
12711
12783
  try {
@@ -12740,6 +12812,26 @@ function registerLibraryCommands(program) {
12740
12812
  }),
12741
12813
  { includeCompany: true }
12742
12814
  );
12815
+ addCommonClientOptions(
12816
+ file.command("link").description(getAgentCliCapabilityById("library.file.link").description).argument("<filePath>", "Library file path").action(async (filePath, opts) => {
12817
+ try {
12818
+ await printLibraryFileReference(filePath, opts);
12819
+ } catch (err) {
12820
+ handleCommandError(err);
12821
+ }
12822
+ }),
12823
+ { includeCompany: true }
12824
+ );
12825
+ addCommonClientOptions(
12826
+ file.command("ref").description(getAgentCliCapabilityById("library.file.ref").description).argument("<filePath>", "Library file path").action(async (filePath, opts) => {
12827
+ try {
12828
+ await printLibraryFileReference(filePath, opts);
12829
+ } catch (err) {
12830
+ handleCommandError(err);
12831
+ }
12832
+ }),
12833
+ { includeCompany: true }
12834
+ );
12743
12835
  addCommonClientOptions(
12744
12836
  file.command("put").description(getAgentCliCapabilityById("library.file.put").description).argument("<filePath>", "Library file path").option("--body-file <path>", "Read file content from a file, or '-' for stdin").action(async (filePath, opts) => {
12745
12837
  try {