@rudderhq/cli 0.2.10-canary.11 → 0.2.10-canary.12
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 +248 -39
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// ../packages/shared/dist/constants.js
|
|
13
|
-
var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
13
|
+
var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, ORGANIZATION_RESOURCE_SOURCE_TYPES, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
14
14
|
var init_constants = __esm({
|
|
15
15
|
"../packages/shared/dist/constants.js"() {
|
|
16
16
|
"use strict";
|
|
@@ -150,6 +150,10 @@ var init_constants = __esm({
|
|
|
150
150
|
"url",
|
|
151
151
|
"connector_object"
|
|
152
152
|
];
|
|
153
|
+
ORGANIZATION_RESOURCE_SOURCE_TYPES = [
|
|
154
|
+
"external",
|
|
155
|
+
"library"
|
|
156
|
+
];
|
|
153
157
|
PROJECT_RESOURCE_ATTACHMENT_ROLES = [
|
|
154
158
|
"working_set",
|
|
155
159
|
"reference",
|
|
@@ -511,7 +515,7 @@ var init_budget = __esm({
|
|
|
511
515
|
|
|
512
516
|
// ../packages/shared/dist/validators/organization.js
|
|
513
517
|
import { z as z3 } from "zod";
|
|
514
|
-
var logoAssetIdSchema, brandColorSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
|
|
518
|
+
var logoAssetIdSchema, brandColorSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema, createOrganizationWorkspaceFileSchema, createOrganizationWorkspaceDirectorySchema, renameOrganizationWorkspaceEntrySchema, moveOrganizationWorkspaceEntrySchema;
|
|
515
519
|
var init_organization = __esm({
|
|
516
520
|
"../packages/shared/dist/validators/organization.js"() {
|
|
517
521
|
"use strict";
|
|
@@ -543,6 +547,19 @@ var init_organization = __esm({
|
|
|
543
547
|
updateOrganizationWorkspaceFileSchema = z3.object({
|
|
544
548
|
content: z3.string()
|
|
545
549
|
});
|
|
550
|
+
createOrganizationWorkspaceFileSchema = z3.object({
|
|
551
|
+
filePath: z3.string().trim().min(1).max(1e3),
|
|
552
|
+
content: z3.string().optional().default("")
|
|
553
|
+
});
|
|
554
|
+
createOrganizationWorkspaceDirectorySchema = z3.object({
|
|
555
|
+
directoryPath: z3.string().trim().min(1).max(1e3)
|
|
556
|
+
});
|
|
557
|
+
renameOrganizationWorkspaceEntrySchema = z3.object({
|
|
558
|
+
name: z3.string().trim().min(1).max(255)
|
|
559
|
+
});
|
|
560
|
+
moveOrganizationWorkspaceEntrySchema = z3.object({
|
|
561
|
+
destinationDirectoryPath: z3.string().trim().max(1e3).default("")
|
|
562
|
+
});
|
|
546
563
|
}
|
|
547
564
|
});
|
|
548
565
|
|
|
@@ -706,27 +723,66 @@ var init_organization_intelligence_profile = __esm({
|
|
|
706
723
|
|
|
707
724
|
// ../packages/shared/dist/validators/resource.js
|
|
708
725
|
import { z as z7 } from "zod";
|
|
709
|
-
|
|
726
|
+
function isValidLibraryRelativePath(locator) {
|
|
727
|
+
const trimmed = locator.trim();
|
|
728
|
+
if (!trimmed)
|
|
729
|
+
return false;
|
|
730
|
+
if (LIBRARY_PATH_SCHEME_RE.test(trimmed))
|
|
731
|
+
return false;
|
|
732
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("\\") || trimmed.startsWith("~"))
|
|
733
|
+
return false;
|
|
734
|
+
if (trimmed.includes("\\"))
|
|
735
|
+
return false;
|
|
736
|
+
const parts = trimmed.split("/");
|
|
737
|
+
if (!parts.every((part) => part.length > 0 && part !== "." && part !== ".."))
|
|
738
|
+
return false;
|
|
739
|
+
return !PROTECTED_LIBRARY_RESOURCE_ROOTS.has(parts[0] ?? "");
|
|
740
|
+
}
|
|
741
|
+
function validateLibraryResourceContract(value, ctx) {
|
|
742
|
+
if (value.sourceType !== "library")
|
|
743
|
+
return;
|
|
744
|
+
if (value.kind !== void 0 && value.kind !== "file" && value.kind !== "directory") {
|
|
745
|
+
ctx.addIssue({
|
|
746
|
+
code: z7.ZodIssueCode.custom,
|
|
747
|
+
message: "Library resources must be file or directory resources.",
|
|
748
|
+
path: ["kind"]
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
if (value.locator !== void 0 && !isValidLibraryRelativePath(value.locator)) {
|
|
752
|
+
ctx.addIssue({
|
|
753
|
+
code: z7.ZodIssueCode.custom,
|
|
754
|
+
message: "Library resource locator must be a normalized relative path inside the organization Library.",
|
|
755
|
+
path: ["locator"]
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
var organizationResourceKindSchema, organizationResourceSourceTypeSchema, projectResourceAttachmentRoleSchema, LIBRARY_PATH_SCHEME_RE, PROTECTED_LIBRARY_RESOURCE_ROOTS, createOrganizationResourceBaseSchema, createOrganizationResourceSchema, updateOrganizationResourceSchema, projectResourceAttachmentInputSchema, updateProjectResourceAttachmentSchema, createProjectInlineResourceSchema;
|
|
710
760
|
var init_resource = __esm({
|
|
711
761
|
"../packages/shared/dist/validators/resource.js"() {
|
|
712
762
|
"use strict";
|
|
713
763
|
init_constants();
|
|
714
764
|
organizationResourceKindSchema = z7.enum(ORGANIZATION_RESOURCE_KINDS);
|
|
765
|
+
organizationResourceSourceTypeSchema = z7.enum(ORGANIZATION_RESOURCE_SOURCE_TYPES);
|
|
715
766
|
projectResourceAttachmentRoleSchema = z7.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
|
|
716
|
-
|
|
767
|
+
LIBRARY_PATH_SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
768
|
+
PROTECTED_LIBRARY_RESOURCE_ROOTS = /* @__PURE__ */ new Set(["agents", "artifacts", "plans", "skills"]);
|
|
769
|
+
createOrganizationResourceBaseSchema = z7.object({
|
|
717
770
|
name: z7.string().min(1),
|
|
718
771
|
kind: organizationResourceKindSchema,
|
|
772
|
+
sourceType: organizationResourceSourceTypeSchema.optional().default("external"),
|
|
719
773
|
locator: z7.string().min(1),
|
|
720
774
|
description: z7.string().optional().nullable(),
|
|
721
775
|
metadata: z7.record(z7.unknown()).optional().nullable()
|
|
722
776
|
});
|
|
777
|
+
createOrganizationResourceSchema = createOrganizationResourceBaseSchema.superRefine(validateLibraryResourceContract);
|
|
723
778
|
updateOrganizationResourceSchema = z7.object({
|
|
724
779
|
name: z7.string().min(1).optional(),
|
|
725
780
|
kind: organizationResourceKindSchema.optional(),
|
|
781
|
+
sourceType: organizationResourceSourceTypeSchema.optional(),
|
|
726
782
|
locator: z7.string().min(1).optional(),
|
|
727
783
|
description: z7.string().optional().nullable(),
|
|
728
784
|
metadata: z7.record(z7.unknown()).optional().nullable()
|
|
729
|
-
}).strict();
|
|
785
|
+
}).strict().superRefine(validateLibraryResourceContract);
|
|
730
786
|
projectResourceAttachmentInputSchema = z7.object({
|
|
731
787
|
resourceId: z7.string().uuid(),
|
|
732
788
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
@@ -738,11 +794,11 @@ var init_resource = __esm({
|
|
|
738
794
|
note: z7.string().optional().nullable(),
|
|
739
795
|
sortOrder: z7.number().int().nonnegative().optional()
|
|
740
796
|
}).strict();
|
|
741
|
-
createProjectInlineResourceSchema =
|
|
797
|
+
createProjectInlineResourceSchema = createOrganizationResourceBaseSchema.extend({
|
|
742
798
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
743
799
|
note: z7.string().optional().nullable(),
|
|
744
800
|
sortOrder: z7.number().int().nonnegative().optional()
|
|
745
|
-
}).strict();
|
|
801
|
+
}).strict().superRefine(validateLibraryResourceContract);
|
|
746
802
|
}
|
|
747
803
|
});
|
|
748
804
|
|
|
@@ -1589,7 +1645,7 @@ var init_project = __esm({
|
|
|
1589
1645
|
|
|
1590
1646
|
// ../packages/shared/dist/validators/issue.js
|
|
1591
1647
|
import { z as z14 } from "zod";
|
|
1592
|
-
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
|
|
1648
|
+
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, reportIssueCommitSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema, createLibraryDocumentSchema, updateLibraryDocumentSchema, restoreLibraryDocumentRevisionSchema;
|
|
1593
1649
|
var init_issue = __esm({
|
|
1594
1650
|
"../packages/shared/dist/validators/issue.js"() {
|
|
1595
1651
|
"use strict";
|
|
@@ -1698,6 +1754,22 @@ var init_issue = __esm({
|
|
|
1698
1754
|
changeSummary: z14.string().trim().max(500).nullable().optional(),
|
|
1699
1755
|
baseRevisionId: z14.string().uuid().nullable().optional()
|
|
1700
1756
|
});
|
|
1757
|
+
createLibraryDocumentSchema = z14.object({
|
|
1758
|
+
title: z14.string().trim().max(200).nullable().optional(),
|
|
1759
|
+
format: issueDocumentFormatSchema.optional().default("markdown"),
|
|
1760
|
+
body: z14.string().max(524288).optional().default(""),
|
|
1761
|
+
changeSummary: z14.string().trim().max(500).nullable().optional()
|
|
1762
|
+
});
|
|
1763
|
+
updateLibraryDocumentSchema = z14.object({
|
|
1764
|
+
title: z14.string().trim().max(200).nullable().optional(),
|
|
1765
|
+
format: issueDocumentFormatSchema.optional().default("markdown"),
|
|
1766
|
+
body: z14.string().max(524288),
|
|
1767
|
+
changeSummary: z14.string().trim().max(500).nullable().optional(),
|
|
1768
|
+
baseRevisionId: z14.string().uuid().nullable().optional()
|
|
1769
|
+
});
|
|
1770
|
+
restoreLibraryDocumentRevisionSchema = z14.object({
|
|
1771
|
+
changeSummary: z14.string().trim().max(500).nullable().optional()
|
|
1772
|
+
});
|
|
1701
1773
|
}
|
|
1702
1774
|
});
|
|
1703
1775
|
|
|
@@ -2628,12 +2700,16 @@ var init_organization_skill_reference = __esm({
|
|
|
2628
2700
|
});
|
|
2629
2701
|
|
|
2630
2702
|
// ../packages/shared/dist/project-mentions.js
|
|
2631
|
-
var PROJECT_COLOR_VALUES;
|
|
2703
|
+
var AGENT_AVATAR_UUID_RE, AGENT_ASSET_ICON_RE, AGENT_DICEBEAR_NOTIONISTS_ICON_RE, PROJECT_COLOR_VALUES, AGENT_AVATAR_BACKGROUND_VALUES;
|
|
2632
2704
|
var init_project_mentions = __esm({
|
|
2633
2705
|
"../packages/shared/dist/project-mentions.js"() {
|
|
2634
2706
|
"use strict";
|
|
2635
2707
|
init_constants();
|
|
2708
|
+
AGENT_AVATAR_UUID_RE = "[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}";
|
|
2709
|
+
AGENT_ASSET_ICON_RE = new RegExp(`^asset:${AGENT_AVATAR_UUID_RE}(?:\\?bg=([a-z0-9-]+))?$`, "i");
|
|
2710
|
+
AGENT_DICEBEAR_NOTIONISTS_ICON_RE = new RegExp(`^${AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX}${AGENT_AVATAR_UUID_RE}(?:\\?bg=([a-z0-9-]+))?$`, "i");
|
|
2636
2711
|
PROJECT_COLOR_VALUES = new Set(PROJECT_COLORS);
|
|
2712
|
+
AGENT_AVATAR_BACKGROUND_VALUES = new Set(AGENT_AVATAR_BACKGROUND_PRESET_IDS);
|
|
2637
2713
|
}
|
|
2638
2714
|
});
|
|
2639
2715
|
|
|
@@ -8148,41 +8224,41 @@ var RudderApiClient = class {
|
|
|
8148
8224
|
this.runId = opts.runId?.trim() || void 0;
|
|
8149
8225
|
this.recoverAuth = opts.recoverAuth;
|
|
8150
8226
|
}
|
|
8151
|
-
get(
|
|
8152
|
-
return this.request(
|
|
8227
|
+
get(path23, opts) {
|
|
8228
|
+
return this.request(path23, { method: "GET" }, opts);
|
|
8153
8229
|
}
|
|
8154
|
-
post(
|
|
8155
|
-
return this.request(
|
|
8230
|
+
post(path23, body, opts) {
|
|
8231
|
+
return this.request(path23, {
|
|
8156
8232
|
method: "POST",
|
|
8157
8233
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8158
8234
|
}, opts);
|
|
8159
8235
|
}
|
|
8160
|
-
postForm(
|
|
8161
|
-
return this.request(
|
|
8236
|
+
postForm(path23, form, opts) {
|
|
8237
|
+
return this.request(path23, {
|
|
8162
8238
|
method: "POST",
|
|
8163
8239
|
body: form
|
|
8164
8240
|
}, opts);
|
|
8165
8241
|
}
|
|
8166
|
-
patch(
|
|
8167
|
-
return this.request(
|
|
8242
|
+
patch(path23, body, opts) {
|
|
8243
|
+
return this.request(path23, {
|
|
8168
8244
|
method: "PATCH",
|
|
8169
8245
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8170
8246
|
}, opts);
|
|
8171
8247
|
}
|
|
8172
|
-
put(
|
|
8173
|
-
return this.request(
|
|
8248
|
+
put(path23, body, opts) {
|
|
8249
|
+
return this.request(path23, {
|
|
8174
8250
|
method: "PUT",
|
|
8175
8251
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8176
8252
|
}, opts);
|
|
8177
8253
|
}
|
|
8178
|
-
delete(
|
|
8179
|
-
return this.request(
|
|
8254
|
+
delete(path23, opts) {
|
|
8255
|
+
return this.request(path23, { method: "DELETE" }, opts);
|
|
8180
8256
|
}
|
|
8181
8257
|
setApiKey(apiKey) {
|
|
8182
8258
|
this.apiKey = apiKey?.trim() || void 0;
|
|
8183
8259
|
}
|
|
8184
|
-
async request(
|
|
8185
|
-
const url = buildUrl(this.apiBase,
|
|
8260
|
+
async request(path23, init, opts, hasRetriedAuth = false) {
|
|
8261
|
+
const url = buildUrl(this.apiBase, path23);
|
|
8186
8262
|
const headers = {
|
|
8187
8263
|
accept: "application/json",
|
|
8188
8264
|
...toStringRecord(init.headers)
|
|
@@ -8212,13 +8288,13 @@ var RudderApiClient = class {
|
|
|
8212
8288
|
const apiError = await toApiError(response);
|
|
8213
8289
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
8214
8290
|
const recoveredToken = await this.recoverAuth({
|
|
8215
|
-
path:
|
|
8291
|
+
path: path23,
|
|
8216
8292
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
8217
8293
|
error: apiError
|
|
8218
8294
|
});
|
|
8219
8295
|
if (recoveredToken) {
|
|
8220
8296
|
this.setApiKey(recoveredToken);
|
|
8221
|
-
return this.request(
|
|
8297
|
+
return this.request(path23, init, opts, true);
|
|
8222
8298
|
}
|
|
8223
8299
|
}
|
|
8224
8300
|
throw apiError;
|
|
@@ -8237,8 +8313,8 @@ function shouldAttachAgentContext(method) {
|
|
|
8237
8313
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
8238
8314
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
8239
8315
|
}
|
|
8240
|
-
function buildUrl(apiBase,
|
|
8241
|
-
const normalizedPath =
|
|
8316
|
+
function buildUrl(apiBase, path23) {
|
|
8317
|
+
const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
|
|
8242
8318
|
const [pathname, query] = normalizedPath.split("?");
|
|
8243
8319
|
const url = new URL2(apiBase);
|
|
8244
8320
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -10360,9 +10436,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10360
10436
|
id: "issue.documents.put",
|
|
10361
10437
|
command: "rudder issue documents put <issue> <key> --body-file <path>",
|
|
10362
10438
|
category: "issue",
|
|
10363
|
-
description: "
|
|
10439
|
+
description: "Legacy create or update of a DB-backed issue document; prefer `rudder library file put` for new docs.",
|
|
10364
10440
|
mutating: true,
|
|
10365
|
-
contract: "
|
|
10441
|
+
contract: "compat",
|
|
10366
10442
|
requiresOrgId: false,
|
|
10367
10443
|
requiresAgentId: false,
|
|
10368
10444
|
requiresRunId: false,
|
|
@@ -10380,6 +10456,42 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10380
10456
|
requiresRunId: false,
|
|
10381
10457
|
attachesRunIdWhenAvailable: false
|
|
10382
10458
|
},
|
|
10459
|
+
{
|
|
10460
|
+
id: "library.file.list",
|
|
10461
|
+
command: "rudder library file list [directory]",
|
|
10462
|
+
category: "library",
|
|
10463
|
+
description: "List path-based Library files and folders.",
|
|
10464
|
+
mutating: false,
|
|
10465
|
+
contract: "agent-v1",
|
|
10466
|
+
requiresOrgId: true,
|
|
10467
|
+
requiresAgentId: false,
|
|
10468
|
+
requiresRunId: false,
|
|
10469
|
+
attachesRunIdWhenAvailable: false
|
|
10470
|
+
},
|
|
10471
|
+
{
|
|
10472
|
+
id: "library.file.get",
|
|
10473
|
+
command: "rudder library file get <path>",
|
|
10474
|
+
category: "library",
|
|
10475
|
+
description: "Read one path-based Library file.",
|
|
10476
|
+
mutating: false,
|
|
10477
|
+
contract: "agent-v1",
|
|
10478
|
+
requiresOrgId: true,
|
|
10479
|
+
requiresAgentId: false,
|
|
10480
|
+
requiresRunId: false,
|
|
10481
|
+
attachesRunIdWhenAvailable: false
|
|
10482
|
+
},
|
|
10483
|
+
{
|
|
10484
|
+
id: "library.file.put",
|
|
10485
|
+
command: "rudder library file put <path> --body-file <path>",
|
|
10486
|
+
category: "library",
|
|
10487
|
+
description: "Create or update one path-based Library file.",
|
|
10488
|
+
mutating: true,
|
|
10489
|
+
contract: "agent-v1",
|
|
10490
|
+
requiresOrgId: true,
|
|
10491
|
+
requiresAgentId: false,
|
|
10492
|
+
requiresRunId: false,
|
|
10493
|
+
attachesRunIdWhenAvailable: true
|
|
10494
|
+
},
|
|
10383
10495
|
{
|
|
10384
10496
|
id: "issue.create",
|
|
10385
10497
|
command: "rudder issue create --org-id <id> ... [--label-id <id> ...] [--label <name> ...]",
|
|
@@ -10541,7 +10653,8 @@ var CATEGORY_TITLES = {
|
|
|
10541
10653
|
agent: "Agent",
|
|
10542
10654
|
issue: "Issue",
|
|
10543
10655
|
approval: "Approval",
|
|
10544
|
-
skill: "Skill"
|
|
10656
|
+
skill: "Skill",
|
|
10657
|
+
library: "Library"
|
|
10545
10658
|
};
|
|
10546
10659
|
function getAgentCliCapabilities() {
|
|
10547
10660
|
return AGENT_CLI_CAPABILITIES.map((entry) => ({ ...entry }));
|
|
@@ -11196,7 +11309,10 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
11196
11309
|
"- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
|
|
11197
11310
|
"- Shared organization plans live under `$RUDDER_ORG_PLANS_DIR`.",
|
|
11198
11311
|
"- Shared organization artifacts live under `$RUDDER_ORG_ARTIFACTS_DIR`.",
|
|
11199
|
-
|
|
11312
|
+
'- Library-backed project resources use `sourceType: "library"`; their `locator` is a safe path relative to `$RUDDER_ORG_WORKSPACE_ROOT`, usually under `docs/`, so read them from `$RUDDER_ORG_WORKSPACE_ROOT/<locator>` when that root is available. Rudder does not use protected system roots such as `agents/`, `artifacts/`, `plans/`, or `skills/` as project Library resources.',
|
|
11313
|
+
"- Project Context is explicit operator-curated context, not the whole knowledge boundary. When it is insufficient, inspect broader Library docs and org workspace know-how before concluding context is missing.",
|
|
11314
|
+
"- Durable generated Markdown documents, plans, design docs, and decision notes should be written under `$RUDDER_ORG_WORKSPACE_ROOT/docs/` when available, preferably through `rudder library file put docs/<file>.md --body-file <path> --json`.",
|
|
11315
|
+
"- Durable generated assets such as screenshots, images, mockups, reports, CSVs, handoff logs, and other user-visible non-doc files should be written under `$RUDDER_ORG_ARTIFACTS_DIR` when available.",
|
|
11200
11316
|
"- Use `/tmp` only for transient scratch files and temporary verification artifacts; do not put durable work product there.",
|
|
11201
11317
|
"- 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.",
|
|
11202
11318
|
"- Durable shared work output should prefer these managed workspace paths instead of ad-hoc top-level `projects/` folders.",
|
|
@@ -11953,8 +12069,8 @@ function registerActivityCommands(program) {
|
|
|
11953
12069
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
11954
12070
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
11955
12071
|
const query = params.toString();
|
|
11956
|
-
const
|
|
11957
|
-
const rows = await ctx.api.get(
|
|
12072
|
+
const path23 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
12073
|
+
const rows = await ctx.api.get(path23) ?? [];
|
|
11958
12074
|
if (ctx.json) {
|
|
11959
12075
|
printOutput(rows, { json: true });
|
|
11960
12076
|
return;
|
|
@@ -12121,13 +12237,105 @@ function parseCsv4(value) {
|
|
|
12121
12237
|
return rows.length > 0 ? rows : void 0;
|
|
12122
12238
|
}
|
|
12123
12239
|
|
|
12240
|
+
// src/commands/client/library.ts
|
|
12241
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
12242
|
+
import path20 from "node:path";
|
|
12243
|
+
function registerLibraryCommands(program) {
|
|
12244
|
+
const library = program.command("library").description("Library file operations");
|
|
12245
|
+
const file = library.command("file").description("Path-based Library file operations");
|
|
12246
|
+
addCommonClientOptions(
|
|
12247
|
+
file.command("list").description(getAgentCliCapabilityById("library.file.list").description).argument("[directoryPath]", "Library directory path", "docs").action(async (directoryPath, opts) => {
|
|
12248
|
+
try {
|
|
12249
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12250
|
+
const search = new URLSearchParams();
|
|
12251
|
+
const normalizedPath = directoryPath.trim();
|
|
12252
|
+
if (normalizedPath) search.set("path", normalizedPath);
|
|
12253
|
+
const query = search.toString();
|
|
12254
|
+
const result = await ctx.api.get(
|
|
12255
|
+
`/api/orgs/${ctx.orgId}/workspace/files${query ? `?${query}` : ""}`
|
|
12256
|
+
);
|
|
12257
|
+
printOutput(result, { json: ctx.json });
|
|
12258
|
+
} catch (err) {
|
|
12259
|
+
handleCommandError(err);
|
|
12260
|
+
}
|
|
12261
|
+
}),
|
|
12262
|
+
{ includeCompany: true }
|
|
12263
|
+
);
|
|
12264
|
+
addCommonClientOptions(
|
|
12265
|
+
file.command("get").description(getAgentCliCapabilityById("library.file.get").description).argument("<filePath>", "Library file path").action(async (filePath, opts) => {
|
|
12266
|
+
try {
|
|
12267
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12268
|
+
const search = new URLSearchParams();
|
|
12269
|
+
search.set("path", filePath.trim());
|
|
12270
|
+
const result = await ctx.api.get(
|
|
12271
|
+
`/api/orgs/${ctx.orgId}/workspace/file?${search.toString()}`
|
|
12272
|
+
);
|
|
12273
|
+
printOutput(result, { json: ctx.json });
|
|
12274
|
+
} catch (err) {
|
|
12275
|
+
handleCommandError(err);
|
|
12276
|
+
}
|
|
12277
|
+
}),
|
|
12278
|
+
{ includeCompany: true }
|
|
12279
|
+
);
|
|
12280
|
+
addCommonClientOptions(
|
|
12281
|
+
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) => {
|
|
12282
|
+
try {
|
|
12283
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12284
|
+
const body = await resolveBodyFileInput(opts.bodyFile);
|
|
12285
|
+
const search = new URLSearchParams();
|
|
12286
|
+
search.set("path", filePath.trim());
|
|
12287
|
+
const updatePath = `/api/orgs/${ctx.orgId}/workspace/file?${search.toString()}`;
|
|
12288
|
+
const updated = await ctx.api.patch(
|
|
12289
|
+
updatePath,
|
|
12290
|
+
{ content: body },
|
|
12291
|
+
{ ignoreNotFound: true }
|
|
12292
|
+
);
|
|
12293
|
+
if (updated) {
|
|
12294
|
+
printOutput(updated, { json: ctx.json });
|
|
12295
|
+
return;
|
|
12296
|
+
}
|
|
12297
|
+
const created = await ctx.api.post(
|
|
12298
|
+
`/api/orgs/${ctx.orgId}/workspace/file`,
|
|
12299
|
+
{ filePath: filePath.trim(), content: body }
|
|
12300
|
+
);
|
|
12301
|
+
printOutput(created, { json: ctx.json });
|
|
12302
|
+
} catch (err) {
|
|
12303
|
+
handleCommandError(err);
|
|
12304
|
+
}
|
|
12305
|
+
}),
|
|
12306
|
+
{ includeCompany: true }
|
|
12307
|
+
);
|
|
12308
|
+
}
|
|
12309
|
+
async function resolveBodyFileInput(inputPath) {
|
|
12310
|
+
if (process.argv.includes("--body")) {
|
|
12311
|
+
throw new Error("--body was removed; write the body to a file and use --body-file <path> or --body-file - for stdin");
|
|
12312
|
+
}
|
|
12313
|
+
if (inputPath === void 0) {
|
|
12314
|
+
throw new Error("Provide --body-file <path>; use --body-file - for stdin");
|
|
12315
|
+
}
|
|
12316
|
+
if (inputPath === "-") {
|
|
12317
|
+
return readStdinText3();
|
|
12318
|
+
}
|
|
12319
|
+
const resolvedPath = path20.resolve(process.cwd(), inputPath);
|
|
12320
|
+
return readFile6(resolvedPath, "utf8").catch((err) => {
|
|
12321
|
+
throw new Error(`Unable to read --body-file ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
12322
|
+
});
|
|
12323
|
+
}
|
|
12324
|
+
async function readStdinText3() {
|
|
12325
|
+
const chunks = [];
|
|
12326
|
+
for await (const chunk of process.stdin) {
|
|
12327
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
12328
|
+
}
|
|
12329
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
12330
|
+
}
|
|
12331
|
+
|
|
12124
12332
|
// src/config/data-dir.ts
|
|
12125
12333
|
init_home();
|
|
12126
|
-
import
|
|
12334
|
+
import path21 from "node:path";
|
|
12127
12335
|
function applyDataDirOverride(options, support = {}) {
|
|
12128
12336
|
const rawDataDir = options.dataDir?.trim();
|
|
12129
12337
|
if (!rawDataDir) return null;
|
|
12130
|
-
const resolvedDataDir =
|
|
12338
|
+
const resolvedDataDir = path21.resolve(expandHomePrefix(rawDataDir));
|
|
12131
12339
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
12132
12340
|
if (support.hasConfigOption) {
|
|
12133
12341
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -12151,16 +12359,16 @@ init_env();
|
|
|
12151
12359
|
init_local_env();
|
|
12152
12360
|
|
|
12153
12361
|
// src/commands/client/plugin.ts
|
|
12154
|
-
import
|
|
12362
|
+
import path22 from "node:path";
|
|
12155
12363
|
import pc15 from "picocolors";
|
|
12156
12364
|
function resolvePackageArg(packageArg, isLocal) {
|
|
12157
12365
|
if (!isLocal) return packageArg;
|
|
12158
|
-
if (
|
|
12366
|
+
if (path22.isAbsolute(packageArg)) return packageArg;
|
|
12159
12367
|
if (packageArg.startsWith("~")) {
|
|
12160
12368
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
12161
|
-
return
|
|
12369
|
+
return path22.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
12162
12370
|
}
|
|
12163
|
-
return
|
|
12371
|
+
return path22.resolve(process.cwd(), packageArg);
|
|
12164
12372
|
}
|
|
12165
12373
|
function formatPlugin(p16) {
|
|
12166
12374
|
const statusColor = p16.status === "ready" ? pc15.green(p16.status) : p16.status === "error" ? pc15.red(p16.status) : p16.status === "disabled" ? pc15.dim(p16.status) : pc15.yellow(p16.status);
|
|
@@ -12499,6 +12707,7 @@ function createProgram() {
|
|
|
12499
12707
|
registerActivityCommands(program);
|
|
12500
12708
|
registerDashboardCommands(program);
|
|
12501
12709
|
registerSkillCommands(program);
|
|
12710
|
+
registerLibraryCommands(program);
|
|
12502
12711
|
registerLazyWorktreeCommands(program);
|
|
12503
12712
|
registerPluginCommands(program);
|
|
12504
12713
|
registerLazyBenchmarkCommands(program);
|