@rudderhq/cli 0.2.10-canary.2 → 0.2.10-canary.21
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 +401 -51
- 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
|
|
|
@@ -877,6 +933,7 @@ var init_chat = __esm({
|
|
|
877
933
|
chatIssueProposalSchema = z8.object({
|
|
878
934
|
title: z8.string().trim().min(1).max(200),
|
|
879
935
|
description: z8.string().trim().min(1).max(2e4),
|
|
936
|
+
status: z8.enum(ISSUE_STATUSES).optional().default("todo"),
|
|
880
937
|
priority: z8.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
881
938
|
projectId: z8.string().uuid().optional().nullable(),
|
|
882
939
|
goalId: z8.string().uuid().optional().nullable(),
|
|
@@ -1588,7 +1645,7 @@ var init_project = __esm({
|
|
|
1588
1645
|
|
|
1589
1646
|
// ../packages/shared/dist/validators/issue.js
|
|
1590
1647
|
import { z as z14 } from "zod";
|
|
1591
|
-
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;
|
|
1592
1649
|
var init_issue = __esm({
|
|
1593
1650
|
"../packages/shared/dist/validators/issue.js"() {
|
|
1594
1651
|
"use strict";
|
|
@@ -1697,6 +1754,22 @@ var init_issue = __esm({
|
|
|
1697
1754
|
changeSummary: z14.string().trim().max(500).nullable().optional(),
|
|
1698
1755
|
baseRevisionId: z14.string().uuid().nullable().optional()
|
|
1699
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
|
+
});
|
|
1700
1773
|
}
|
|
1701
1774
|
});
|
|
1702
1775
|
|
|
@@ -1859,7 +1932,7 @@ var init_automation = __esm({
|
|
|
1859
1932
|
status: z20.enum(AUTOMATION_STATUSES).optional().default("active"),
|
|
1860
1933
|
concurrencyPolicy: z20.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
|
|
1861
1934
|
catchUpPolicy: z20.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed"),
|
|
1862
|
-
outputMode: z20.enum(AUTOMATION_OUTPUT_MODES).optional().default("
|
|
1935
|
+
outputMode: z20.enum(AUTOMATION_OUTPUT_MODES).optional().default("chat_output"),
|
|
1863
1936
|
chatConversationId: z20.string().uuid().optional().nullable().default(null)
|
|
1864
1937
|
});
|
|
1865
1938
|
createAutomationSchema = automationBodySchema.superRefine((value, ctx) => {
|
|
@@ -2627,12 +2700,16 @@ var init_organization_skill_reference = __esm({
|
|
|
2627
2700
|
});
|
|
2628
2701
|
|
|
2629
2702
|
// ../packages/shared/dist/project-mentions.js
|
|
2630
|
-
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;
|
|
2631
2704
|
var init_project_mentions = __esm({
|
|
2632
2705
|
"../packages/shared/dist/project-mentions.js"() {
|
|
2633
2706
|
"use strict";
|
|
2634
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");
|
|
2635
2711
|
PROJECT_COLOR_VALUES = new Set(PROJECT_COLORS);
|
|
2712
|
+
AGENT_AVATAR_BACKGROUND_VALUES = new Set(AGENT_AVATAR_BACKGROUND_PRESET_IDS);
|
|
2636
2713
|
}
|
|
2637
2714
|
});
|
|
2638
2715
|
|
|
@@ -8147,41 +8224,41 @@ var RudderApiClient = class {
|
|
|
8147
8224
|
this.runId = opts.runId?.trim() || void 0;
|
|
8148
8225
|
this.recoverAuth = opts.recoverAuth;
|
|
8149
8226
|
}
|
|
8150
|
-
get(
|
|
8151
|
-
return this.request(
|
|
8227
|
+
get(path23, opts) {
|
|
8228
|
+
return this.request(path23, { method: "GET" }, opts);
|
|
8152
8229
|
}
|
|
8153
|
-
post(
|
|
8154
|
-
return this.request(
|
|
8230
|
+
post(path23, body, opts) {
|
|
8231
|
+
return this.request(path23, {
|
|
8155
8232
|
method: "POST",
|
|
8156
8233
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8157
8234
|
}, opts);
|
|
8158
8235
|
}
|
|
8159
|
-
postForm(
|
|
8160
|
-
return this.request(
|
|
8236
|
+
postForm(path23, form, opts) {
|
|
8237
|
+
return this.request(path23, {
|
|
8161
8238
|
method: "POST",
|
|
8162
8239
|
body: form
|
|
8163
8240
|
}, opts);
|
|
8164
8241
|
}
|
|
8165
|
-
patch(
|
|
8166
|
-
return this.request(
|
|
8242
|
+
patch(path23, body, opts) {
|
|
8243
|
+
return this.request(path23, {
|
|
8167
8244
|
method: "PATCH",
|
|
8168
8245
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8169
8246
|
}, opts);
|
|
8170
8247
|
}
|
|
8171
|
-
put(
|
|
8172
|
-
return this.request(
|
|
8248
|
+
put(path23, body, opts) {
|
|
8249
|
+
return this.request(path23, {
|
|
8173
8250
|
method: "PUT",
|
|
8174
8251
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
8175
8252
|
}, opts);
|
|
8176
8253
|
}
|
|
8177
|
-
delete(
|
|
8178
|
-
return this.request(
|
|
8254
|
+
delete(path23, opts) {
|
|
8255
|
+
return this.request(path23, { method: "DELETE" }, opts);
|
|
8179
8256
|
}
|
|
8180
8257
|
setApiKey(apiKey) {
|
|
8181
8258
|
this.apiKey = apiKey?.trim() || void 0;
|
|
8182
8259
|
}
|
|
8183
|
-
async request(
|
|
8184
|
-
const url = buildUrl(this.apiBase,
|
|
8260
|
+
async request(path23, init, opts, hasRetriedAuth = false) {
|
|
8261
|
+
const url = buildUrl(this.apiBase, path23);
|
|
8185
8262
|
const headers = {
|
|
8186
8263
|
accept: "application/json",
|
|
8187
8264
|
...toStringRecord(init.headers)
|
|
@@ -8211,13 +8288,13 @@ var RudderApiClient = class {
|
|
|
8211
8288
|
const apiError = await toApiError(response);
|
|
8212
8289
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
8213
8290
|
const recoveredToken = await this.recoverAuth({
|
|
8214
|
-
path:
|
|
8291
|
+
path: path23,
|
|
8215
8292
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
8216
8293
|
error: apiError
|
|
8217
8294
|
});
|
|
8218
8295
|
if (recoveredToken) {
|
|
8219
8296
|
this.setApiKey(recoveredToken);
|
|
8220
|
-
return this.request(
|
|
8297
|
+
return this.request(path23, init, opts, true);
|
|
8221
8298
|
}
|
|
8222
8299
|
}
|
|
8223
8300
|
throw apiError;
|
|
@@ -8236,8 +8313,8 @@ function shouldAttachAgentContext(method) {
|
|
|
8236
8313
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
8237
8314
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
8238
8315
|
}
|
|
8239
|
-
function buildUrl(apiBase,
|
|
8240
|
-
const normalizedPath =
|
|
8316
|
+
function buildUrl(apiBase, path23) {
|
|
8317
|
+
const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
|
|
8241
8318
|
const [pathname, query] = normalizedPath.split("?");
|
|
8242
8319
|
const url = new URL2(apiBase);
|
|
8243
8320
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -9008,13 +9085,13 @@ function buildImportSelectionCatalog(preview) {
|
|
|
9008
9085
|
files: Array.from(organizationFiles).sort((left, right) => left.localeCompare(right))
|
|
9009
9086
|
},
|
|
9010
9087
|
projects: preview.manifest.projects.map((project) => {
|
|
9011
|
-
const
|
|
9012
|
-
const projectDir =
|
|
9088
|
+
const projectPath2 = normalizePortablePath(project.path);
|
|
9089
|
+
const projectDir = projectPath2.includes("/") ? projectPath2.slice(0, projectPath2.lastIndexOf("/")) : "";
|
|
9013
9090
|
return {
|
|
9014
9091
|
key: project.slug,
|
|
9015
9092
|
label: project.name,
|
|
9016
9093
|
hint: project.slug,
|
|
9017
|
-
files: collectEntityFiles(preview.files,
|
|
9094
|
+
files: collectEntityFiles(preview.files, projectPath2, {
|
|
9018
9095
|
excludePrefixes: projectDir ? [`${projectDir}/issues`] : []
|
|
9019
9096
|
})
|
|
9020
9097
|
};
|
|
@@ -10359,9 +10436,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10359
10436
|
id: "issue.documents.put",
|
|
10360
10437
|
command: "rudder issue documents put <issue> <key> --body-file <path>",
|
|
10361
10438
|
category: "issue",
|
|
10362
|
-
description: "
|
|
10439
|
+
description: "Legacy create or update of a DB-backed issue document; prefer `rudder library file put` for new docs.",
|
|
10363
10440
|
mutating: true,
|
|
10364
|
-
contract: "
|
|
10441
|
+
contract: "compat",
|
|
10365
10442
|
requiresOrgId: false,
|
|
10366
10443
|
requiresAgentId: false,
|
|
10367
10444
|
requiresRunId: false,
|
|
@@ -10379,6 +10456,90 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10379
10456
|
requiresRunId: false,
|
|
10380
10457
|
attachesRunIdWhenAvailable: false
|
|
10381
10458
|
},
|
|
10459
|
+
{
|
|
10460
|
+
id: "project.list",
|
|
10461
|
+
command: "rudder project list --org-id <id>",
|
|
10462
|
+
category: "project",
|
|
10463
|
+
description: "List projects in an organization.",
|
|
10464
|
+
mutating: false,
|
|
10465
|
+
contract: "agent-v1",
|
|
10466
|
+
requiresOrgId: true,
|
|
10467
|
+
requiresAgentId: false,
|
|
10468
|
+
requiresRunId: false,
|
|
10469
|
+
attachesRunIdWhenAvailable: false
|
|
10470
|
+
},
|
|
10471
|
+
{
|
|
10472
|
+
id: "project.get",
|
|
10473
|
+
command: "rudder project get <project-id-or-shortname> [--org-id <id>]",
|
|
10474
|
+
category: "project",
|
|
10475
|
+
description: "Read one project by ID or shortname.",
|
|
10476
|
+
mutating: false,
|
|
10477
|
+
contract: "agent-v1",
|
|
10478
|
+
requiresOrgId: false,
|
|
10479
|
+
requiresAgentId: false,
|
|
10480
|
+
requiresRunId: false,
|
|
10481
|
+
attachesRunIdWhenAvailable: false
|
|
10482
|
+
},
|
|
10483
|
+
{
|
|
10484
|
+
id: "project.create",
|
|
10485
|
+
command: "rudder project create --org-id <id> --name <name>",
|
|
10486
|
+
category: "project",
|
|
10487
|
+
description: "Create a project in the organization.",
|
|
10488
|
+
mutating: true,
|
|
10489
|
+
contract: "agent-v1",
|
|
10490
|
+
requiresOrgId: true,
|
|
10491
|
+
requiresAgentId: false,
|
|
10492
|
+
requiresRunId: false,
|
|
10493
|
+
attachesRunIdWhenAvailable: true
|
|
10494
|
+
},
|
|
10495
|
+
{
|
|
10496
|
+
id: "project.update",
|
|
10497
|
+
command: "rudder project update <project-id-or-shortname> [--org-id <id>]",
|
|
10498
|
+
category: "project",
|
|
10499
|
+
description: "Update mutable project fields such as name, description, status, goals, lead agent, target date, color, or archivedAt.",
|
|
10500
|
+
mutating: true,
|
|
10501
|
+
contract: "agent-v1",
|
|
10502
|
+
requiresOrgId: false,
|
|
10503
|
+
requiresAgentId: false,
|
|
10504
|
+
requiresRunId: false,
|
|
10505
|
+
attachesRunIdWhenAvailable: true
|
|
10506
|
+
},
|
|
10507
|
+
{
|
|
10508
|
+
id: "library.file.list",
|
|
10509
|
+
command: "rudder library file list [directory]",
|
|
10510
|
+
category: "library",
|
|
10511
|
+
description: "List path-based Library files and folders.",
|
|
10512
|
+
mutating: false,
|
|
10513
|
+
contract: "agent-v1",
|
|
10514
|
+
requiresOrgId: true,
|
|
10515
|
+
requiresAgentId: false,
|
|
10516
|
+
requiresRunId: false,
|
|
10517
|
+
attachesRunIdWhenAvailable: false
|
|
10518
|
+
},
|
|
10519
|
+
{
|
|
10520
|
+
id: "library.file.get",
|
|
10521
|
+
command: "rudder library file get <path>",
|
|
10522
|
+
category: "library",
|
|
10523
|
+
description: "Read one path-based Library file.",
|
|
10524
|
+
mutating: false,
|
|
10525
|
+
contract: "agent-v1",
|
|
10526
|
+
requiresOrgId: true,
|
|
10527
|
+
requiresAgentId: false,
|
|
10528
|
+
requiresRunId: false,
|
|
10529
|
+
attachesRunIdWhenAvailable: false
|
|
10530
|
+
},
|
|
10531
|
+
{
|
|
10532
|
+
id: "library.file.put",
|
|
10533
|
+
command: "rudder library file put <path> --body-file <path>",
|
|
10534
|
+
category: "library",
|
|
10535
|
+
description: "Create or update one path-based Library file.",
|
|
10536
|
+
mutating: true,
|
|
10537
|
+
contract: "agent-v1",
|
|
10538
|
+
requiresOrgId: true,
|
|
10539
|
+
requiresAgentId: false,
|
|
10540
|
+
requiresRunId: false,
|
|
10541
|
+
attachesRunIdWhenAvailable: true
|
|
10542
|
+
},
|
|
10382
10543
|
{
|
|
10383
10544
|
id: "issue.create",
|
|
10384
10545
|
command: "rudder issue create --org-id <id> ... [--label-id <id> ...] [--label <name> ...]",
|
|
@@ -10539,8 +10700,10 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10539
10700
|
var CATEGORY_TITLES = {
|
|
10540
10701
|
agent: "Agent",
|
|
10541
10702
|
issue: "Issue",
|
|
10703
|
+
project: "Project",
|
|
10542
10704
|
approval: "Approval",
|
|
10543
|
-
skill: "Skill"
|
|
10705
|
+
skill: "Skill",
|
|
10706
|
+
library: "Library"
|
|
10544
10707
|
};
|
|
10545
10708
|
function getAgentCliCapabilities() {
|
|
10546
10709
|
return AGENT_CLI_CAPABILITIES.map((entry) => ({ ...entry }));
|
|
@@ -11160,6 +11323,96 @@ function formatIssueSearchMatch(match) {
|
|
|
11160
11323
|
return `${match.field}${commentSuffix}: ${match.snippet}`;
|
|
11161
11324
|
}
|
|
11162
11325
|
|
|
11326
|
+
// src/commands/client/project.ts
|
|
11327
|
+
init_dist();
|
|
11328
|
+
function registerProjectCommands(program) {
|
|
11329
|
+
const project = program.command("project").description("Project operations");
|
|
11330
|
+
addCommonClientOptions(
|
|
11331
|
+
project.command("list").description(getAgentCliCapabilityById("project.list").description).option("-O, --org-id <id>", "Organization ID").action(async (opts) => {
|
|
11332
|
+
try {
|
|
11333
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
11334
|
+
const rows = await ctx.api.get(`/api/orgs/${ctx.orgId}/projects`) ?? [];
|
|
11335
|
+
printOutput(rows, { json: ctx.json });
|
|
11336
|
+
} catch (err) {
|
|
11337
|
+
handleCommandError(err);
|
|
11338
|
+
}
|
|
11339
|
+
}),
|
|
11340
|
+
{ includeCompany: false }
|
|
11341
|
+
);
|
|
11342
|
+
addCommonClientOptions(
|
|
11343
|
+
project.command("get").description(getAgentCliCapabilityById("project.get").description).argument("<projectIdOrShortname>", "Project ID or shortname").option("-O, --org-id <id>", "Organization ID for shortname resolution").action(async (projectRef, opts) => {
|
|
11344
|
+
try {
|
|
11345
|
+
const ctx = resolveCommandContext(opts);
|
|
11346
|
+
const row = await ctx.api.get(projectPath(projectRef, ctx.orgId));
|
|
11347
|
+
printOutput(row, { json: ctx.json });
|
|
11348
|
+
} catch (err) {
|
|
11349
|
+
handleCommandError(err);
|
|
11350
|
+
}
|
|
11351
|
+
}),
|
|
11352
|
+
{ includeCompany: false }
|
|
11353
|
+
);
|
|
11354
|
+
addCommonClientOptions(
|
|
11355
|
+
project.command("create").description(getAgentCliCapabilityById("project.create").description).option("-O, --org-id <id>", "Organization ID").requiredOption("--name <name>", "Project name").option("--description <text>", "Project description").option("--status <status>", "Project status").option("--goal-id <id>", "Primary goal ID").option("--goal-ids <csv>", "Comma-separated goal IDs").option("--lead-agent-id <id>", "Lead agent ID").option("--target-date <date>", "Target date").option("--color <value>", "Project color or supported gradient token").action(async (opts) => {
|
|
11356
|
+
try {
|
|
11357
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
11358
|
+
const payload = createProjectSchema.parse({
|
|
11359
|
+
name: opts.name,
|
|
11360
|
+
description: opts.description,
|
|
11361
|
+
status: opts.status,
|
|
11362
|
+
goalId: opts.goalId,
|
|
11363
|
+
goalIds: parseCsv2(opts.goalIds),
|
|
11364
|
+
leadAgentId: opts.leadAgentId,
|
|
11365
|
+
targetDate: opts.targetDate,
|
|
11366
|
+
color: opts.color
|
|
11367
|
+
});
|
|
11368
|
+
const created = await ctx.api.post(`/api/orgs/${ctx.orgId}/projects`, payload);
|
|
11369
|
+
printOutput(created, { json: ctx.json });
|
|
11370
|
+
} catch (err) {
|
|
11371
|
+
handleCommandError(err);
|
|
11372
|
+
}
|
|
11373
|
+
}),
|
|
11374
|
+
{ includeCompany: false }
|
|
11375
|
+
);
|
|
11376
|
+
addCommonClientOptions(
|
|
11377
|
+
project.command("update").description(getAgentCliCapabilityById("project.update").description).argument("<projectIdOrShortname>", "Project ID or shortname").option("-O, --org-id <id>", "Organization ID for shortname resolution").option("--name <name>", "Project name").option("--description <text>", "Project description").option("--status <status>", "Project status").option("--goal-id <id>", "Primary goal ID").option("--goal-ids <csv>", "Comma-separated goal IDs").option("--lead-agent-id <id>", "Lead agent ID").option("--target-date <date>", "Target date").option("--color <value>", "Project color or supported gradient token").option("--archived-at <iso8601|null>", "Set archivedAt timestamp or literal 'null'").action(async (projectRef, opts) => {
|
|
11378
|
+
try {
|
|
11379
|
+
const ctx = resolveCommandContext(opts);
|
|
11380
|
+
const payload = updateProjectSchema.parse({
|
|
11381
|
+
name: opts.name,
|
|
11382
|
+
description: opts.description,
|
|
11383
|
+
status: opts.status,
|
|
11384
|
+
goalId: opts.goalId,
|
|
11385
|
+
goalIds: parseCsv2(opts.goalIds),
|
|
11386
|
+
leadAgentId: opts.leadAgentId,
|
|
11387
|
+
targetDate: opts.targetDate,
|
|
11388
|
+
color: opts.color,
|
|
11389
|
+
archivedAt: parseNullableOption(opts.archivedAt)
|
|
11390
|
+
});
|
|
11391
|
+
const updated = await ctx.api.patch(projectPath(projectRef, ctx.orgId), payload);
|
|
11392
|
+
printOutput(updated, { json: ctx.json });
|
|
11393
|
+
} catch (err) {
|
|
11394
|
+
handleCommandError(err);
|
|
11395
|
+
}
|
|
11396
|
+
}),
|
|
11397
|
+
{ includeCompany: false }
|
|
11398
|
+
);
|
|
11399
|
+
}
|
|
11400
|
+
function parseCsv2(value) {
|
|
11401
|
+
if (!value) return void 0;
|
|
11402
|
+
const items = value.split(",").map((item) => item.trim()).filter(Boolean);
|
|
11403
|
+
return items.length > 0 ? items : void 0;
|
|
11404
|
+
}
|
|
11405
|
+
function parseNullableOption(value) {
|
|
11406
|
+
if (value === void 0) return void 0;
|
|
11407
|
+
return value === "null" ? null : value;
|
|
11408
|
+
}
|
|
11409
|
+
function projectPath(projectRef, orgId) {
|
|
11410
|
+
const params = new URLSearchParams();
|
|
11411
|
+
if (orgId) params.set("orgId", orgId);
|
|
11412
|
+
const query = params.toString();
|
|
11413
|
+
return `/api/projects/${encodeURIComponent(projectRef)}${query ? `?${query}` : ""}`;
|
|
11414
|
+
}
|
|
11415
|
+
|
|
11163
11416
|
// src/commands/client/agent.ts
|
|
11164
11417
|
init_dist();
|
|
11165
11418
|
|
|
@@ -11195,7 +11448,10 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
11195
11448
|
"- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
|
|
11196
11449
|
"- Shared organization plans live under `$RUDDER_ORG_PLANS_DIR`.",
|
|
11197
11450
|
"- Shared organization artifacts live under `$RUDDER_ORG_ARTIFACTS_DIR`.",
|
|
11198
|
-
|
|
11451
|
+
'- 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.',
|
|
11452
|
+
"- 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.",
|
|
11453
|
+
"- 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`.",
|
|
11454
|
+
"- 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.",
|
|
11199
11455
|
"- Use `/tmp` only for transient scratch files and temporary verification artifacts; do not put durable work product there.",
|
|
11200
11456
|
"- 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.",
|
|
11201
11457
|
"- Durable shared work output should prefer these managed workspace paths instead of ad-hoc top-level `projects/` folders.",
|
|
@@ -11609,7 +11865,7 @@ function registerAgentCommands(program) {
|
|
|
11609
11865
|
try {
|
|
11610
11866
|
const ctx = resolveCommandContext(opts);
|
|
11611
11867
|
const snapshot = await ctx.api.post(`/api/agents/${agentId}/skills/sync`, {
|
|
11612
|
-
desiredSkills:
|
|
11868
|
+
desiredSkills: parseCsv3(opts.desiredSkills)
|
|
11613
11869
|
});
|
|
11614
11870
|
printOutput(snapshot, { json: ctx.json });
|
|
11615
11871
|
} catch (err) {
|
|
@@ -11731,7 +11987,7 @@ function registerAgentCommands(program) {
|
|
|
11731
11987
|
{ includeCompany: false }
|
|
11732
11988
|
);
|
|
11733
11989
|
}
|
|
11734
|
-
function
|
|
11990
|
+
function parseCsv3(value) {
|
|
11735
11991
|
if (!value) return [];
|
|
11736
11992
|
return value.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
11737
11993
|
}
|
|
@@ -11817,7 +12073,7 @@ function registerApprovalCommands(program) {
|
|
|
11817
12073
|
type: opts.type,
|
|
11818
12074
|
payload: payloadJson,
|
|
11819
12075
|
requestedByAgentId: opts.requestedByAgentId,
|
|
11820
|
-
issueIds:
|
|
12076
|
+
issueIds: parseCsv4(opts.issueIds)
|
|
11821
12077
|
});
|
|
11822
12078
|
const created = await ctx.api.post(`/api/orgs/${ctx.orgId}/approvals`, payload);
|
|
11823
12079
|
printOutput(created, { json: ctx.json });
|
|
@@ -11923,7 +12179,7 @@ async function readStdinText2() {
|
|
|
11923
12179
|
}
|
|
11924
12180
|
return Buffer.concat(chunks).toString("utf8");
|
|
11925
12181
|
}
|
|
11926
|
-
function
|
|
12182
|
+
function parseCsv4(value) {
|
|
11927
12183
|
if (!value) return void 0;
|
|
11928
12184
|
const rows = value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
11929
12185
|
return rows.length > 0 ? rows : void 0;
|
|
@@ -11952,8 +12208,8 @@ function registerActivityCommands(program) {
|
|
|
11952
12208
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
11953
12209
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
11954
12210
|
const query = params.toString();
|
|
11955
|
-
const
|
|
11956
|
-
const rows = await ctx.api.get(
|
|
12211
|
+
const path23 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
12212
|
+
const rows = await ctx.api.get(path23) ?? [];
|
|
11957
12213
|
if (ctx.json) {
|
|
11958
12214
|
printOutput(rows, { json: true });
|
|
11959
12215
|
return;
|
|
@@ -12081,7 +12337,7 @@ function registerSkillCommands(program) {
|
|
|
12081
12337
|
try {
|
|
12082
12338
|
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12083
12339
|
const payload = organizationSkillLocalScanRequestSchema.parse({
|
|
12084
|
-
roots:
|
|
12340
|
+
roots: parseCsv5(opts.roots)
|
|
12085
12341
|
});
|
|
12086
12342
|
const result = await ctx.api.post(
|
|
12087
12343
|
`/api/orgs/${ctx.orgId}/skills/scan-local`,
|
|
@@ -12099,8 +12355,8 @@ function registerSkillCommands(program) {
|
|
|
12099
12355
|
try {
|
|
12100
12356
|
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12101
12357
|
const payload = organizationSkillProjectScanRequestSchema.parse({
|
|
12102
|
-
projectIds:
|
|
12103
|
-
workspaceIds:
|
|
12358
|
+
projectIds: parseCsv5(opts.projectIds),
|
|
12359
|
+
workspaceIds: parseCsv5(opts.workspaceIds)
|
|
12104
12360
|
});
|
|
12105
12361
|
const result = await ctx.api.post(
|
|
12106
12362
|
`/api/orgs/${ctx.orgId}/skills/scan-projects`,
|
|
@@ -12114,19 +12370,111 @@ function registerSkillCommands(program) {
|
|
|
12114
12370
|
{ includeCompany: false }
|
|
12115
12371
|
);
|
|
12116
12372
|
}
|
|
12117
|
-
function
|
|
12373
|
+
function parseCsv5(value) {
|
|
12118
12374
|
if (!value) return void 0;
|
|
12119
12375
|
const rows = value.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
12120
12376
|
return rows.length > 0 ? rows : void 0;
|
|
12121
12377
|
}
|
|
12122
12378
|
|
|
12379
|
+
// src/commands/client/library.ts
|
|
12380
|
+
import { readFile as readFile6 } from "node:fs/promises";
|
|
12381
|
+
import path20 from "node:path";
|
|
12382
|
+
function registerLibraryCommands(program) {
|
|
12383
|
+
const library = program.command("library").description("Library file operations");
|
|
12384
|
+
const file = library.command("file").description("Path-based Library file operations");
|
|
12385
|
+
addCommonClientOptions(
|
|
12386
|
+
file.command("list").description(getAgentCliCapabilityById("library.file.list").description).argument("[directoryPath]", "Library directory path", "docs").action(async (directoryPath, opts) => {
|
|
12387
|
+
try {
|
|
12388
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12389
|
+
const search = new URLSearchParams();
|
|
12390
|
+
const normalizedPath = directoryPath.trim();
|
|
12391
|
+
if (normalizedPath) search.set("path", normalizedPath);
|
|
12392
|
+
const query = search.toString();
|
|
12393
|
+
const result = await ctx.api.get(
|
|
12394
|
+
`/api/orgs/${ctx.orgId}/workspace/files${query ? `?${query}` : ""}`
|
|
12395
|
+
);
|
|
12396
|
+
printOutput(result, { json: ctx.json });
|
|
12397
|
+
} catch (err) {
|
|
12398
|
+
handleCommandError(err);
|
|
12399
|
+
}
|
|
12400
|
+
}),
|
|
12401
|
+
{ includeCompany: true }
|
|
12402
|
+
);
|
|
12403
|
+
addCommonClientOptions(
|
|
12404
|
+
file.command("get").description(getAgentCliCapabilityById("library.file.get").description).argument("<filePath>", "Library file path").action(async (filePath, opts) => {
|
|
12405
|
+
try {
|
|
12406
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12407
|
+
const search = new URLSearchParams();
|
|
12408
|
+
search.set("path", filePath.trim());
|
|
12409
|
+
const result = await ctx.api.get(
|
|
12410
|
+
`/api/orgs/${ctx.orgId}/workspace/file?${search.toString()}`
|
|
12411
|
+
);
|
|
12412
|
+
printOutput(result, { json: ctx.json });
|
|
12413
|
+
} catch (err) {
|
|
12414
|
+
handleCommandError(err);
|
|
12415
|
+
}
|
|
12416
|
+
}),
|
|
12417
|
+
{ includeCompany: true }
|
|
12418
|
+
);
|
|
12419
|
+
addCommonClientOptions(
|
|
12420
|
+
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) => {
|
|
12421
|
+
try {
|
|
12422
|
+
const ctx = resolveCommandContext(opts, { requireCompany: true });
|
|
12423
|
+
const body = await resolveBodyFileInput(opts.bodyFile);
|
|
12424
|
+
const search = new URLSearchParams();
|
|
12425
|
+
search.set("path", filePath.trim());
|
|
12426
|
+
const updatePath = `/api/orgs/${ctx.orgId}/workspace/file?${search.toString()}`;
|
|
12427
|
+
const updated = await ctx.api.patch(
|
|
12428
|
+
updatePath,
|
|
12429
|
+
{ content: body },
|
|
12430
|
+
{ ignoreNotFound: true }
|
|
12431
|
+
);
|
|
12432
|
+
if (updated) {
|
|
12433
|
+
printOutput(updated, { json: ctx.json });
|
|
12434
|
+
return;
|
|
12435
|
+
}
|
|
12436
|
+
const created = await ctx.api.post(
|
|
12437
|
+
`/api/orgs/${ctx.orgId}/workspace/file`,
|
|
12438
|
+
{ filePath: filePath.trim(), content: body }
|
|
12439
|
+
);
|
|
12440
|
+
printOutput(created, { json: ctx.json });
|
|
12441
|
+
} catch (err) {
|
|
12442
|
+
handleCommandError(err);
|
|
12443
|
+
}
|
|
12444
|
+
}),
|
|
12445
|
+
{ includeCompany: true }
|
|
12446
|
+
);
|
|
12447
|
+
}
|
|
12448
|
+
async function resolveBodyFileInput(inputPath) {
|
|
12449
|
+
if (process.argv.includes("--body")) {
|
|
12450
|
+
throw new Error("--body was removed; write the body to a file and use --body-file <path> or --body-file - for stdin");
|
|
12451
|
+
}
|
|
12452
|
+
if (inputPath === void 0) {
|
|
12453
|
+
throw new Error("Provide --body-file <path>; use --body-file - for stdin");
|
|
12454
|
+
}
|
|
12455
|
+
if (inputPath === "-") {
|
|
12456
|
+
return readStdinText3();
|
|
12457
|
+
}
|
|
12458
|
+
const resolvedPath = path20.resolve(process.cwd(), inputPath);
|
|
12459
|
+
return readFile6(resolvedPath, "utf8").catch((err) => {
|
|
12460
|
+
throw new Error(`Unable to read --body-file ${inputPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
12461
|
+
});
|
|
12462
|
+
}
|
|
12463
|
+
async function readStdinText3() {
|
|
12464
|
+
const chunks = [];
|
|
12465
|
+
for await (const chunk of process.stdin) {
|
|
12466
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
12467
|
+
}
|
|
12468
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
12469
|
+
}
|
|
12470
|
+
|
|
12123
12471
|
// src/config/data-dir.ts
|
|
12124
12472
|
init_home();
|
|
12125
|
-
import
|
|
12473
|
+
import path21 from "node:path";
|
|
12126
12474
|
function applyDataDirOverride(options, support = {}) {
|
|
12127
12475
|
const rawDataDir = options.dataDir?.trim();
|
|
12128
12476
|
if (!rawDataDir) return null;
|
|
12129
|
-
const resolvedDataDir =
|
|
12477
|
+
const resolvedDataDir = path21.resolve(expandHomePrefix(rawDataDir));
|
|
12130
12478
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
12131
12479
|
if (support.hasConfigOption) {
|
|
12132
12480
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -12150,16 +12498,16 @@ init_env();
|
|
|
12150
12498
|
init_local_env();
|
|
12151
12499
|
|
|
12152
12500
|
// src/commands/client/plugin.ts
|
|
12153
|
-
import
|
|
12501
|
+
import path22 from "node:path";
|
|
12154
12502
|
import pc15 from "picocolors";
|
|
12155
12503
|
function resolvePackageArg(packageArg, isLocal) {
|
|
12156
12504
|
if (!isLocal) return packageArg;
|
|
12157
|
-
if (
|
|
12505
|
+
if (path22.isAbsolute(packageArg)) return packageArg;
|
|
12158
12506
|
if (packageArg.startsWith("~")) {
|
|
12159
12507
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
12160
|
-
return
|
|
12508
|
+
return path22.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
12161
12509
|
}
|
|
12162
|
-
return
|
|
12510
|
+
return path22.resolve(process.cwd(), packageArg);
|
|
12163
12511
|
}
|
|
12164
12512
|
function formatPlugin(p16) {
|
|
12165
12513
|
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);
|
|
@@ -12493,11 +12841,13 @@ function createProgram() {
|
|
|
12493
12841
|
registerContextCommands(program);
|
|
12494
12842
|
registerCompanyCommands(program);
|
|
12495
12843
|
registerIssueCommands(program);
|
|
12844
|
+
registerProjectCommands(program);
|
|
12496
12845
|
registerAgentCommands(program);
|
|
12497
12846
|
registerApprovalCommands(program);
|
|
12498
12847
|
registerActivityCommands(program);
|
|
12499
12848
|
registerDashboardCommands(program);
|
|
12500
12849
|
registerSkillCommands(program);
|
|
12850
|
+
registerLibraryCommands(program);
|
|
12501
12851
|
registerLazyWorktreeCommands(program);
|
|
12502
12852
|
registerPluginCommands(program);
|
|
12503
12853
|
registerLazyBenchmarkCommands(program);
|