@rudderhq/cli 0.2.10-canary.13 → 0.2.10-canary.15

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
@@ -9085,13 +9085,13 @@ function buildImportSelectionCatalog(preview) {
9085
9085
  files: Array.from(organizationFiles).sort((left, right) => left.localeCompare(right))
9086
9086
  },
9087
9087
  projects: preview.manifest.projects.map((project) => {
9088
- const projectPath = normalizePortablePath(project.path);
9089
- const projectDir = projectPath.includes("/") ? projectPath.slice(0, projectPath.lastIndexOf("/")) : "";
9088
+ const projectPath2 = normalizePortablePath(project.path);
9089
+ const projectDir = projectPath2.includes("/") ? projectPath2.slice(0, projectPath2.lastIndexOf("/")) : "";
9090
9090
  return {
9091
9091
  key: project.slug,
9092
9092
  label: project.name,
9093
9093
  hint: project.slug,
9094
- files: collectEntityFiles(preview.files, projectPath, {
9094
+ files: collectEntityFiles(preview.files, projectPath2, {
9095
9095
  excludePrefixes: projectDir ? [`${projectDir}/issues`] : []
9096
9096
  })
9097
9097
  };
@@ -10456,6 +10456,54 @@ var AGENT_CLI_CAPABILITIES = [
10456
10456
  requiresRunId: false,
10457
10457
  attachesRunIdWhenAvailable: false
10458
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
+ },
10459
10507
  {
10460
10508
  id: "library.file.list",
10461
10509
  command: "rudder library file list [directory]",
@@ -10652,6 +10700,7 @@ var AGENT_CLI_CAPABILITIES = [
10652
10700
  var CATEGORY_TITLES = {
10653
10701
  agent: "Agent",
10654
10702
  issue: "Issue",
10703
+ project: "Project",
10655
10704
  approval: "Approval",
10656
10705
  skill: "Skill",
10657
10706
  library: "Library"
@@ -11274,6 +11323,96 @@ function formatIssueSearchMatch(match) {
11274
11323
  return `${match.field}${commentSuffix}: ${match.snippet}`;
11275
11324
  }
11276
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
+
11277
11416
  // src/commands/client/agent.ts
11278
11417
  init_dist();
11279
11418
 
@@ -11726,7 +11865,7 @@ function registerAgentCommands(program) {
11726
11865
  try {
11727
11866
  const ctx = resolveCommandContext(opts);
11728
11867
  const snapshot = await ctx.api.post(`/api/agents/${agentId}/skills/sync`, {
11729
- desiredSkills: parseCsv2(opts.desiredSkills)
11868
+ desiredSkills: parseCsv3(opts.desiredSkills)
11730
11869
  });
11731
11870
  printOutput(snapshot, { json: ctx.json });
11732
11871
  } catch (err) {
@@ -11848,7 +11987,7 @@ function registerAgentCommands(program) {
11848
11987
  { includeCompany: false }
11849
11988
  );
11850
11989
  }
11851
- function parseCsv2(value) {
11990
+ function parseCsv3(value) {
11852
11991
  if (!value) return [];
11853
11992
  return value.split(",").map((entry) => entry.trim()).filter(Boolean);
11854
11993
  }
@@ -11934,7 +12073,7 @@ function registerApprovalCommands(program) {
11934
12073
  type: opts.type,
11935
12074
  payload: payloadJson,
11936
12075
  requestedByAgentId: opts.requestedByAgentId,
11937
- issueIds: parseCsv3(opts.issueIds)
12076
+ issueIds: parseCsv4(opts.issueIds)
11938
12077
  });
11939
12078
  const created = await ctx.api.post(`/api/orgs/${ctx.orgId}/approvals`, payload);
11940
12079
  printOutput(created, { json: ctx.json });
@@ -12040,7 +12179,7 @@ async function readStdinText2() {
12040
12179
  }
12041
12180
  return Buffer.concat(chunks).toString("utf8");
12042
12181
  }
12043
- function parseCsv3(value) {
12182
+ function parseCsv4(value) {
12044
12183
  if (!value) return void 0;
12045
12184
  const rows = value.split(",").map((v) => v.trim()).filter(Boolean);
12046
12185
  return rows.length > 0 ? rows : void 0;
@@ -12198,7 +12337,7 @@ function registerSkillCommands(program) {
12198
12337
  try {
12199
12338
  const ctx = resolveCommandContext(opts, { requireCompany: true });
12200
12339
  const payload = organizationSkillLocalScanRequestSchema.parse({
12201
- roots: parseCsv4(opts.roots)
12340
+ roots: parseCsv5(opts.roots)
12202
12341
  });
12203
12342
  const result = await ctx.api.post(
12204
12343
  `/api/orgs/${ctx.orgId}/skills/scan-local`,
@@ -12216,8 +12355,8 @@ function registerSkillCommands(program) {
12216
12355
  try {
12217
12356
  const ctx = resolveCommandContext(opts, { requireCompany: true });
12218
12357
  const payload = organizationSkillProjectScanRequestSchema.parse({
12219
- projectIds: parseCsv4(opts.projectIds),
12220
- workspaceIds: parseCsv4(opts.workspaceIds)
12358
+ projectIds: parseCsv5(opts.projectIds),
12359
+ workspaceIds: parseCsv5(opts.workspaceIds)
12221
12360
  });
12222
12361
  const result = await ctx.api.post(
12223
12362
  `/api/orgs/${ctx.orgId}/skills/scan-projects`,
@@ -12231,7 +12370,7 @@ function registerSkillCommands(program) {
12231
12370
  { includeCompany: false }
12232
12371
  );
12233
12372
  }
12234
- function parseCsv4(value) {
12373
+ function parseCsv5(value) {
12235
12374
  if (!value) return void 0;
12236
12375
  const rows = value.split(",").map((entry) => entry.trim()).filter(Boolean);
12237
12376
  return rows.length > 0 ? rows : void 0;
@@ -12702,6 +12841,7 @@ function createProgram() {
12702
12841
  registerContextCommands(program);
12703
12842
  registerCompanyCommands(program);
12704
12843
  registerIssueCommands(program);
12844
+ registerProjectCommands(program);
12705
12845
  registerAgentCommands(program);
12706
12846
  registerApprovalCommands(program);
12707
12847
  registerActivityCommands(program);