@revos/cli 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +286 -41
  3. package/dist/adapters/oclif/commands/action-runs/get.mjs +1 -1
  4. package/dist/adapters/oclif/commands/action-runs/list.mjs +8 -2
  5. package/dist/adapters/oclif/commands/actions/get-input-schema.mjs +2 -2
  6. package/dist/adapters/oclif/commands/actions/get-params-schema.mjs +2 -2
  7. package/dist/adapters/oclif/commands/actions/get.mjs +1 -1
  8. package/dist/adapters/oclif/commands/actions/list.mjs +8 -4
  9. package/dist/adapters/oclif/commands/ai-instructions/create.mjs +1 -1
  10. package/dist/adapters/oclif/commands/ai-instructions/delete.mjs +1 -1
  11. package/dist/adapters/oclif/commands/ai-instructions/get.mjs +1 -1
  12. package/dist/adapters/oclif/commands/ai-instructions/list.mjs +8 -2
  13. package/dist/adapters/oclif/commands/ai-instructions/update.mjs +1 -1
  14. package/dist/adapters/oclif/commands/api.d.mts +11 -0
  15. package/dist/adapters/oclif/commands/api.mjs +112 -0
  16. package/dist/adapters/oclif/commands/apply.d.mts +28 -0
  17. package/dist/adapters/oclif/commands/apply.mjs +77 -0
  18. package/dist/adapters/oclif/commands/auth/login.d.mts +5 -4
  19. package/dist/adapters/oclif/commands/auth/login.mjs +22 -11
  20. package/dist/adapters/oclif/commands/auth/logout.d.mts +1 -1
  21. package/dist/adapters/oclif/commands/auth/logout.mjs +7 -3
  22. package/dist/adapters/oclif/commands/auth/status.d.mts +2 -2
  23. package/dist/adapters/oclif/commands/auth/status.mjs +2 -2
  24. package/dist/adapters/oclif/commands/connections/create.d.mts +6 -0
  25. package/dist/adapters/oclif/commands/connections/create.mjs +8 -0
  26. package/dist/adapters/oclif/commands/connections/delete.d.mts +6 -0
  27. package/dist/adapters/oclif/commands/connections/delete.mjs +8 -0
  28. package/dist/adapters/oclif/commands/connections/get.d.mts +6 -0
  29. package/dist/adapters/oclif/commands/connections/get.mjs +8 -0
  30. package/dist/adapters/oclif/commands/connections/list.d.mts +6 -0
  31. package/dist/adapters/oclif/commands/connections/list.mjs +14 -0
  32. package/dist/adapters/oclif/commands/connections/update.d.mts +6 -0
  33. package/dist/adapters/oclif/commands/connections/update.mjs +8 -0
  34. package/dist/adapters/oclif/commands/cubes/create.d.mts +6 -0
  35. package/dist/adapters/oclif/commands/cubes/create.mjs +8 -0
  36. package/dist/adapters/oclif/commands/cubes/delete.d.mts +6 -0
  37. package/dist/adapters/oclif/commands/cubes/delete.mjs +8 -0
  38. package/dist/adapters/oclif/commands/cubes/get.d.mts +6 -0
  39. package/dist/adapters/oclif/commands/cubes/get.mjs +8 -0
  40. package/dist/adapters/oclif/commands/cubes/list.d.mts +6 -0
  41. package/dist/adapters/oclif/commands/cubes/list.mjs +13 -0
  42. package/dist/adapters/oclif/commands/cubes/update.d.mts +6 -0
  43. package/dist/adapters/oclif/commands/cubes/update.mjs +8 -0
  44. package/dist/adapters/oclif/commands/diff.d.mts +27 -0
  45. package/dist/adapters/oclif/commands/diff.mjs +66 -0
  46. package/dist/adapters/oclif/commands/gservice-account-keys/get.mjs +1 -1
  47. package/dist/adapters/oclif/commands/gservice-account-keys/reveal.mjs +2 -2
  48. package/dist/adapters/oclif/commands/gservice-accounts/create.mjs +1 -1
  49. package/dist/adapters/oclif/commands/gservice-accounts/delete.mjs +1 -1
  50. package/dist/adapters/oclif/commands/gservice-accounts/get.mjs +1 -1
  51. package/dist/adapters/oclif/commands/gservice-accounts/list.mjs +7 -2
  52. package/dist/adapters/oclif/commands/init.d.mts +2 -1
  53. package/dist/adapters/oclif/commands/init.mjs +28 -24
  54. package/dist/adapters/oclif/commands/org/create.mjs +1 -1
  55. package/dist/adapters/oclif/commands/org/current.d.mts +2 -2
  56. package/dist/adapters/oclif/commands/org/current.mjs +2 -2
  57. package/dist/adapters/oclif/commands/org/get.mjs +1 -1
  58. package/dist/adapters/oclif/commands/org/list.d.mts +3 -11
  59. package/dist/adapters/oclif/commands/org/list.mjs +26 -26
  60. package/dist/adapters/oclif/commands/org/switch.d.mts +3 -2
  61. package/dist/adapters/oclif/commands/org/switch.mjs +13 -5
  62. package/dist/adapters/oclif/commands/pull.d.mts +28 -0
  63. package/dist/adapters/oclif/commands/pull.mjs +88 -0
  64. package/dist/adapters/oclif/commands/score-groups/create.mjs +3 -2
  65. package/dist/adapters/oclif/commands/score-groups/delete.mjs +1 -1
  66. package/dist/adapters/oclif/commands/score-groups/get.mjs +1 -1
  67. package/dist/adapters/oclif/commands/score-groups/list.mjs +3 -2
  68. package/dist/adapters/oclif/commands/score-groups/update.mjs +1 -1
  69. package/dist/adapters/oclif/commands/scores/create.mjs +3 -2
  70. package/dist/adapters/oclif/commands/scores/delete.mjs +1 -1
  71. package/dist/adapters/oclif/commands/scores/list.mjs +3 -2
  72. package/dist/adapters/oclif/commands/scores/update.mjs +1 -1
  73. package/dist/adapters/oclif/commands/segments/create.mjs +1 -1
  74. package/dist/adapters/oclif/commands/segments/delete.mjs +1 -1
  75. package/dist/adapters/oclif/commands/segments/evaluate.mjs +2 -2
  76. package/dist/adapters/oclif/commands/segments/get-evaluation-history.mjs +2 -2
  77. package/dist/adapters/oclif/commands/segments/get-version.mjs +2 -2
  78. package/dist/adapters/oclif/commands/segments/get.mjs +1 -1
  79. package/dist/adapters/oclif/commands/segments/list-versions.mjs +16 -5
  80. package/dist/adapters/oclif/commands/segments/list.mjs +9 -2
  81. package/dist/adapters/oclif/commands/segments/restore-version.mjs +2 -2
  82. package/dist/adapters/oclif/commands/segments/update.mjs +1 -1
  83. package/dist/adapters/oclif/commands/sources/create.d.mts +11 -0
  84. package/dist/adapters/oclif/commands/sources/create.mjs +16 -0
  85. package/dist/adapters/oclif/commands/sources/delete.d.mts +6 -0
  86. package/dist/adapters/oclif/commands/sources/delete.mjs +8 -0
  87. package/dist/adapters/oclif/commands/sources/get.d.mts +6 -0
  88. package/dist/adapters/oclif/commands/sources/get.mjs +8 -0
  89. package/dist/adapters/oclif/commands/sources/list-streams.d.mts +6 -0
  90. package/dist/adapters/oclif/commands/sources/list-streams.mjs +31 -0
  91. package/dist/adapters/oclif/commands/sources/list.d.mts +6 -0
  92. package/dist/adapters/oclif/commands/sources/list.mjs +13 -0
  93. package/dist/adapters/oclif/commands/sources/update.d.mts +15 -0
  94. package/dist/adapters/oclif/commands/sources/update.mjs +21 -0
  95. package/dist/adapters/oclif/commands/status.d.mts +26 -0
  96. package/dist/adapters/oclif/commands/status.mjs +77 -0
  97. package/dist/adapters/oclif/commands/table-views/create.mjs +3 -2
  98. package/dist/adapters/oclif/commands/table-views/delete.mjs +1 -1
  99. package/dist/adapters/oclif/commands/table-views/list.mjs +3 -2
  100. package/dist/adapters/oclif/commands/table-views/update.mjs +1 -1
  101. package/dist/adapters/oclif/commands/tables/create.mjs +1 -1
  102. package/dist/adapters/oclif/commands/tables/delete.mjs +1 -1
  103. package/dist/adapters/oclif/commands/tables/get.mjs +1 -1
  104. package/dist/adapters/oclif/commands/tables/list.mjs +3 -2
  105. package/dist/adapters/oclif/commands/tables/update.mjs +1 -1
  106. package/dist/{base.command-d7VW6WTp.d.mts → base.command-D7X3ZNtY.d.mts} +0 -1
  107. package/dist/{base.command-DlVQ9Cqa.mjs → base.command-cV5d65r8.mjs} +15 -12
  108. package/dist/chunk-CfYAbeIz.mjs +13 -0
  109. package/dist/core-CMrP5BQS.mjs +2378 -0
  110. package/dist/{factory-D9sR_S_g.mjs → factory-C6XLqhT9.mjs} +44 -10
  111. package/dist/iac-render-BSZZEP0n.mjs +17 -0
  112. package/dist/index-BqKwXXAo.d.mts +598 -0
  113. package/dist/index.d.mts +3 -4
  114. package/dist/index.mjs +2 -2
  115. package/dist/{presets-Cvazkjmu.mjs → presets-CJbFbHlw.mjs} +35 -8
  116. package/dist/templates/.claude/settings.json +39 -0
  117. package/dist/templates/.devcontainer/devcontainer.json +2 -2
  118. package/dist/templates/.devcontainer/setup.sh +3 -0
  119. package/dist/templates/AGENTS.md +36 -13
  120. package/dist/templates/dbt/dbt_project.yml +2 -2
  121. package/dist/templates/skills/create-connections/SKILL.md +210 -0
  122. package/dist/templates/skills/create-connections/references/mappers.md +152 -0
  123. package/dist/templates/skills/{create-semantic-model → create-cubes}/SKILL.md +28 -26
  124. package/dist/templates/skills/create-cubes/references/bq-pk-fk-conventions.md +183 -0
  125. package/dist/templates/skills/{create-semantic-model → create-cubes}/references/cube-examples.md +85 -7
  126. package/dist/templates/skills/create-cubes/references/hubspot-entities.md +289 -0
  127. package/dist/templates/skills/create-cubes/references/jira-entities.md +201 -0
  128. package/dist/templates/skills/create-cubes/references/netsuite-entities.md +121 -0
  129. package/dist/templates/skills/create-cubes/references/stripe-entities.md +114 -0
  130. package/dist/templates/skills/create-dbt-transformations/SKILL.md +62 -33
  131. package/dist/templates/skills/create-dbt-transformations/references/edge-cases.md +21 -3
  132. package/dist/templates/skills/create-dbt-transformations/references/schema-conventions.md +21 -7
  133. package/dist/templates/skills/create-dbt-transformations/references/sql-templates.md +34 -20
  134. package/dist/templates/skills/explore-lakehouse/SKILL.md +8 -4
  135. package/dist/templates/skills/load-sample-data/SKILL.md +119 -0
  136. package/dist/templates/skills/visualize-semantic-model/SKILL.md +159 -0
  137. package/dist/templates/skills/visualize-semantic-model/scripts/render_graph.py +186 -0
  138. package/dist/{types-Y_ht_ja5.d.mts → types-CGjxcj4L.d.mts} +3 -0
  139. package/package.json +48 -6
  140. package/dist/adapters/oclif/commands/overlays/diff.d.mts +0 -19
  141. package/dist/adapters/oclif/commands/overlays/diff.mjs +0 -80
  142. package/dist/adapters/oclif/commands/overlays/pull.d.mts +0 -15
  143. package/dist/adapters/oclif/commands/overlays/pull.mjs +0 -44
  144. package/dist/adapters/oclif/commands/overlays/push.d.mts +0 -18
  145. package/dist/adapters/oclif/commands/overlays/push.mjs +0 -59
  146. package/dist/adapters/oclif/commands/overlays/status.d.mts +0 -18
  147. package/dist/adapters/oclif/commands/overlays/status.mjs +0 -53
  148. package/dist/core-gKJ_V-K5.mjs +0 -973
  149. package/dist/index-KAzwt5vr.d.mts +0 -190
  150. package/dist/types-C_p_6rkj.d.mts +0 -69
  151. /package/dist/templates/skills/{create-semantic-model → create-cubes}/references/key-patterns.md +0 -0
  152. /package/dist/templates/skills/{create-semantic-model → create-cubes}/references/validation-queries.md +0 -0
@@ -1,5 +1,5 @@
1
- import { m as unwrap } from "../../../../core-gKJ_V-K5.mjs";
2
- import { n as defineApiCommand } from "../../../../factory-D9sR_S_g.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import { Args } from "@oclif/core";
4
4
  //#region src/adapters/oclif/commands/gservice-account-keys/reveal.ts
5
5
  var reveal_default = defineApiCommand({
@@ -1,4 +1,4 @@
1
- import { t as createCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { t as createCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/gservice-accounts/create.ts
3
3
  var create_default = createCommand({
4
4
  resource: "gserviceAccounts",
@@ -1,4 +1,4 @@
1
- import { n as deleteCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { n as deleteCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/gservice-accounts/delete.ts
3
3
  var delete_default = deleteCommand({
4
4
  resource: "gserviceAccounts",
@@ -1,4 +1,4 @@
1
- import { r as getCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { r as getCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/gservice-accounts/get.ts
3
3
  var get_default = getCommand({
4
4
  resource: "gserviceAccounts",
@@ -1,8 +1,13 @@
1
- import { i as listCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { i as listCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/gservice-accounts/list.ts
3
3
  var list_default = listCommand({
4
4
  resource: "gserviceAccounts",
5
- description: "List Google service accounts"
5
+ description: "List Google service accounts",
6
+ defaultColumns: [
7
+ "id",
8
+ "name",
9
+ "email"
10
+ ]
6
11
  });
7
12
  //#endregion
8
13
  export { list_default as default };
@@ -1,4 +1,4 @@
1
- import { t as BaseCommand } from "../../../base.command-d7VW6WTp.mjs";
1
+ import { t as BaseCommand } from "../../../base.command-D7X3ZNtY.mjs";
2
2
  import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/adapters/oclif/commands/init.d.ts
@@ -10,6 +10,7 @@ declare class Init extends BaseCommand<typeof Init> {
10
10
  static flags: {
11
11
  yes: _$_oclif_core_interfaces0.BooleanFlag<boolean>;
12
12
  "dry-run": _$_oclif_core_interfaces0.BooleanFlag<boolean>;
13
+ "no-pull": _$_oclif_core_interfaces0.BooleanFlag<boolean>;
13
14
  };
14
15
  run(): Promise<void>;
15
16
  }
@@ -1,11 +1,11 @@
1
- import { P as ApiError, t as InitService, y as getConfig } from "../../../core-gKJ_V-K5.mjs";
1
+ import { F as ApiError, t as InitService, v as getConfig } from "../../../core-CMrP5BQS.mjs";
2
2
  import { TEMPLATES_DIR } from "../../../templates/index.mjs";
3
- import { t as BaseCommand } from "../../../base.command-DlVQ9Cqa.mjs";
3
+ import { t as BaseCommand } from "../../../base.command-cV5d65r8.mjs";
4
4
  import * as fs from "fs";
5
5
  import * as path from "path";
6
- import select from "@inquirer/select";
7
6
  import chalk from "chalk";
8
7
  import { Args, Flags } from "@oclif/core";
8
+ import select from "@inquirer/select";
9
9
  //#region src/adapters/oclif/commands/init.ts
10
10
  function isDirEmpty(dirPath) {
11
11
  return fs.readdirSync(dirPath).length === 0;
@@ -25,26 +25,18 @@ var Init = class extends BaseCommand {
25
25
  "dry-run": Flags.boolean({
26
26
  description: "Show what would be created without making any changes",
27
27
  default: false
28
+ }),
29
+ "no-pull": Flags.boolean({
30
+ description: "Skip discovering existing remote Sources, Connections, and Cubes from the org",
31
+ default: false
28
32
  })
29
33
  };
30
34
  async run() {
31
35
  const { apiUrl, token, organizationId } = await getConfig();
32
- let projectName;
33
- let targetDir;
34
- if (this.args.destination) {
35
- const resolved = path.resolve(this.args.destination);
36
- projectName = path.basename(resolved);
37
- targetDir = path.dirname(resolved);
38
- } else {
39
- const cwd = process.cwd();
40
- projectName = path.basename(cwd);
41
- targetDir = path.dirname(cwd);
42
- }
43
- if (!projectName) this.error("Could not determine project name from path", { exit: 1 });
44
- const projectDir = path.join(targetDir, projectName);
36
+ const projectDir = this.args.destination ? path.resolve(this.args.destination) : process.cwd();
45
37
  if (fs.existsSync(projectDir) && !isDirEmpty(projectDir) && !this.flags.yes) {
46
38
  if (await select({
47
- message: `Directory "${projectName}" already exists and is not empty. What would you like to do?`,
39
+ message: `Directory "${path.basename(projectDir)}" already exists and is not empty. What would you like to do?`,
48
40
  choices: [{
49
41
  name: "Initialize in this directory",
50
42
  value: "init"
@@ -63,8 +55,8 @@ var Init = class extends BaseCommand {
63
55
  this.error(message, { exit: 1 });
64
56
  });
65
57
  if (this.flags["dry-run"]) {
66
- const preview = service.dryRun(projectName, targetDir);
67
- this.log(`\nWould create project ${chalk.bold(projectName)} for organization ${chalk.bold(org.name)}`);
58
+ const preview = service.dryRun(projectDir);
59
+ this.log(`\nWould create RevOS project for organization ${chalk.bold(`"${org.name}"`)}`);
68
60
  this.log(` Path: ${chalk.dim(preview.projectDir)}\n`);
69
61
  this.log("Directories:");
70
62
  for (const dir of preview.dirs) this.log(` ${dir}/`);
@@ -73,16 +65,16 @@ var Init = class extends BaseCommand {
73
65
  this.log(chalk.dim("\nNo files created, no GCP resources provisioned."));
74
66
  return;
75
67
  }
76
- this.log(`\nCreating project ${chalk.bold(projectName)} for organization ${chalk.bold(org.name)}`);
68
+ this.log(`\nCreating RevOS project for organization ${chalk.bold(`"${org.name}"`)}...`);
77
69
  this.log(` Path: ${chalk.dim(projectDir)}\n`);
78
70
  const result = await service.run({
79
- projectName,
80
- targetDir,
71
+ projectDir,
81
72
  apiUrl,
82
73
  token,
83
74
  organizationId,
84
75
  organization: org,
85
- allowExistingDir: true
76
+ allowExistingDir: true,
77
+ pullIac: !this.flags["no-pull"]
86
78
  }).catch((err) => {
87
79
  if (err instanceof ApiError) {
88
80
  this.log(chalk.red(`\nAPI error: ${err.status} ${err.statusText}`));
@@ -95,7 +87,19 @@ var Init = class extends BaseCommand {
95
87
  this.log(chalk.green(`\nProject created at ${result.projectDir}`));
96
88
  this.log("\nGenerated files:");
97
89
  for (const f of result.createdFiles) this.log(` ${f}`);
98
- this.log(`\nNext step: open ${chalk.bold(result.projectDir)} in VS Code and click ${chalk.bold("Reopen in Container")}.\n`);
90
+ const iacPull = result.pulledIac;
91
+ const discovered = iacPull.pulled.filter((p) => p.action === "discovered");
92
+ const byKind = discovered.reduce((acc, p) => {
93
+ acc[p.kind] = (acc[p.kind] ?? 0) + 1;
94
+ return acc;
95
+ }, {});
96
+ if (discovered.length > 0) {
97
+ const summary = Object.entries(byKind).map(([k, v]) => `${v} ${k.toLowerCase()}${v === 1 ? "" : "s"}`).join(", ");
98
+ this.log(`\nDiscovered ${summary} from the API.`);
99
+ }
100
+ if (iacPull.errors.length > 0) this.log(chalk.yellow(`\nWarning: could not discover remote resources — ${iacPull.errors[0].message}`));
101
+ this.log(`\nNext step: open ${chalk.bold(result.projectDir)} in VS Code and click ${chalk.bold("Reopen in Container")}.`);
102
+ this.log(`\n${chalk.dim("Tip: once inside the Dev Container, ask Claude to \"load sample data\" if you need example datasets.")}\n`);
99
103
  }
100
104
  };
101
105
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as createCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { t as createCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/org/create.ts
3
3
  var create_default = createCommand({
4
4
  resource: "organizations",
@@ -1,5 +1,5 @@
1
- import { s as OrganizationInfo } from "../../../../types-Y_ht_ja5.mjs";
2
- import { t as BaseCommand } from "../../../../base.command-d7VW6WTp.mjs";
1
+ import { s as OrganizationInfo } from "../../../../types-CGjxcj4L.mjs";
2
+ import { t as BaseCommand } from "../../../../base.command-D7X3ZNtY.mjs";
3
3
 
4
4
  //#region src/adapters/oclif/commands/org/current.d.ts
5
5
  interface CurrentOrgResult {
@@ -1,5 +1,5 @@
1
- import { M as loadCredentials, m as unwrap, p as createApiClient, y as getConfig } from "../../../../core-gKJ_V-K5.mjs";
2
- import { t as BaseCommand } from "../../../../base.command-DlVQ9Cqa.mjs";
1
+ import { N as loadCredentials, f as createApiClient, p as unwrap, v as getConfig } from "../../../../core-CMrP5BQS.mjs";
2
+ import { t as BaseCommand } from "../../../../base.command-cV5d65r8.mjs";
3
3
  //#region src/adapters/oclif/commands/org/current.ts
4
4
  var OrgCurrent = class extends BaseCommand {
5
5
  static description = "Show currently selected organization";
@@ -1,4 +1,4 @@
1
- import { r as getCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { r as getCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/org/get.ts
3
3
  var get_default = getCommand({
4
4
  resource: "organizations",
@@ -1,14 +1,6 @@
1
- import { a as OrgListResult } from "../../../../types-Y_ht_ja5.mjs";
2
- import { t as BaseCommand } from "../../../../base.command-d7VW6WTp.mjs";
3
- import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
1
+ import * as _$_oclif_core0 from "@oclif/core";
4
2
 
5
3
  //#region src/adapters/oclif/commands/org/list.d.ts
6
- declare class OrgList extends BaseCommand<typeof OrgList> {
7
- static description: string;
8
- static flags: {
9
- columns: _$_oclif_core_interfaces0.OptionFlag<string | undefined, _$_oclif_core_interfaces0.CustomOptions>;
10
- };
11
- run(): Promise<OrgListResult>;
12
- }
4
+ declare const _default: typeof _$_oclif_core0.Command;
13
5
  //#endregion
14
- export { OrgList as default };
6
+ export { _default as default };
@@ -1,34 +1,34 @@
1
- import { m as unwrap, p as createApiClient, y as getConfig } from "../../../../core-gKJ_V-K5.mjs";
2
- import { t as BaseCommand } from "../../../../base.command-DlVQ9Cqa.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { a as resolveColumns, i as renderList, r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import chalk from "chalk";
4
4
  import { Flags } from "@oclif/core";
5
5
  //#region src/adapters/oclif/commands/org/list.ts
6
- const ALL_COLUMNS = ["name", "id"];
7
- var OrgList = class extends BaseCommand {
8
- static description = "List organizations you belong to";
9
- static flags = { columns: Flags.string({
10
- description: `Columns to display (comma-separated). Available: ${ALL_COLUMNS.join(", ")}`,
11
- helpValue: "name,id"
12
- }) };
13
- async run() {
14
- const { flags } = this;
15
- const config = await getConfig();
16
- const organizations = unwrap(await createApiClient(config).organizations.list());
17
- const result = {
18
- organizations,
6
+ const DEFAULT_COLUMNS = ["id", "name"];
7
+ var list_default = defineApiCommand({
8
+ description: "List organizations you belong to",
9
+ flags: { columns: Flags.string({
10
+ description: "Columns to display in table output (comma-separated). Overrides the resource default. Ignored with --json.",
11
+ helpValue: "a,b,c"
12
+ }) },
13
+ call: async ({ api, config }) => {
14
+ return {
15
+ organizations: unwrap(await api.organizations.list()),
19
16
  currentOrgId: config.organizationId
20
17
  };
21
- if (!this.jsonEnabled()) if (organizations.length === 0) this.warn("You don't belong to any organizations.");
22
- else {
23
- const cols = flags.columns?.split(",").map((c) => c.trim()).filter((c) => ALL_COLUMNS.includes(c)) ?? [...ALL_COLUMNS];
24
- const rows = organizations.map((org) => ({
25
- name: org.id === config.organizationId ? `${org.name} ${chalk.green("✓")}` : org.name,
26
- id: org.id
27
- }));
28
- this.table(rows, { columns: cols.map((c) => ({ key: c })) });
18
+ },
19
+ render: (data, command) => {
20
+ const { organizations, currentOrgId } = data;
21
+ if (organizations.length === 0) {
22
+ command.warn("You don't belong to any organizations.");
23
+ return;
29
24
  }
30
- return result;
25
+ const rows = organizations.map((org) => ({
26
+ id: org.id,
27
+ name: org.id === currentOrgId ? `${org.name} ${chalk.green("✓")}` : org.name
28
+ }));
29
+ const flags = command.flags;
30
+ renderList(command, rows, { columns: resolveColumns(flags.columns, DEFAULT_COLUMNS) });
31
31
  }
32
- };
32
+ });
33
33
  //#endregion
34
- export { OrgList as default };
34
+ export { list_default as default };
@@ -1,4 +1,5 @@
1
- import { t as BaseCommand } from "../../../../base.command-d7VW6WTp.mjs";
1
+ import { o as OrgSwitchResult } from "../../../../types-CGjxcj4L.mjs";
2
+ import { t as BaseCommand } from "../../../../base.command-D7X3ZNtY.mjs";
2
3
  import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
3
4
 
4
5
  //#region src/adapters/oclif/commands/org/switch.d.ts
@@ -7,7 +8,7 @@ declare class OrgSwitch extends BaseCommand<typeof OrgSwitch> {
7
8
  static args: {
8
9
  id: _$_oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
9
10
  };
10
- run(): Promise<void>;
11
+ run(): Promise<OrgSwitchResult>;
11
12
  }
12
13
  //#endregion
13
14
  export { OrgSwitch as default };
@@ -1,5 +1,6 @@
1
- import { M as loadCredentials, N as saveCredentials, m as unwrap, n as selectOrganization, p as createApiClient, y as getConfig } from "../../../../core-gKJ_V-K5.mjs";
2
- import { t as BaseCommand } from "../../../../base.command-DlVQ9Cqa.mjs";
1
+ import { N as loadCredentials, P as saveCredentials, f as createApiClient, n as selectOrganization, p as unwrap, v as getConfig } from "../../../../core-CMrP5BQS.mjs";
2
+ import { t as BaseCommand } from "../../../../base.command-cV5d65r8.mjs";
3
+ import * as os from "os";
3
4
  import chalk from "chalk";
4
5
  import { Args } from "@oclif/core";
5
6
  //#region src/adapters/oclif/commands/org/switch.ts
@@ -11,14 +12,16 @@ var OrgSwitch = class extends BaseCommand {
11
12
  }) };
12
13
  async run() {
13
14
  const { args } = this;
15
+ const json = this.jsonEnabled();
16
+ if (json && !args.id) this.error("Pass an organization id when using --json (interactive selection requires a TTY).", { exit: 1 });
14
17
  const organizations = unwrap(await createApiClient(await getConfig()).organizations.list());
15
18
  if (organizations.length === 0) this.error("You don't belong to any organizations.", { exit: 1 });
16
19
  let selected;
17
20
  if (args.id) {
18
21
  selected = organizations.find((o) => o.id === args.id);
19
22
  if (!selected) {
20
- const available = organizations.map((o) => ` ${o.name} (${o.id})`).join("\n");
21
- this.error(`Organization "${args.id}" not found.\n\nAvailable organizations:\n${available}`, { exit: 1 });
23
+ const available = organizations.map((o) => ` ${o.name} (${o.id})`).join(os.EOL);
24
+ this.error(`Organization "${args.id}" not found.${os.EOL}${os.EOL}Available organizations:${os.EOL}${available}`, { exit: 1 });
22
25
  }
23
26
  } else selected = await selectOrganization(organizations);
24
27
  const credentials = loadCredentials();
@@ -26,7 +29,12 @@ var OrgSwitch = class extends BaseCommand {
26
29
  ...credentials,
27
30
  organizationId: selected.id
28
31
  });
29
- this.log(chalk.green(`Switched to organization: ${selected.name}`));
32
+ if (!json) this.log(chalk.green(`Switched to organization: ${selected.name}`));
33
+ return {
34
+ success: true,
35
+ organizationId: selected.id,
36
+ organizationName: selected.name
37
+ };
30
38
  }
31
39
  };
32
40
  //#endregion
@@ -0,0 +1,28 @@
1
+ import { c as IacError, o as PulledResource } from "../../../index-BqKwXXAo.mjs";
2
+ import { t as BaseCommand } from "../../../base.command-D7X3ZNtY.mjs";
3
+ import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
4
+
5
+ //#region src/adapters/oclif/commands/pull.d.ts
6
+ interface PullJsonOutput {
7
+ project: {
8
+ path: string;
9
+ orgId: string;
10
+ };
11
+ pulled: PulledResource[];
12
+ errors: IacError[];
13
+ }
14
+ declare class Pull extends BaseCommand<typeof Pull> {
15
+ static description: string;
16
+ static flags: {
17
+ project: _$_oclif_core_interfaces0.OptionFlag<string | undefined, _$_oclif_core_interfaces0.CustomOptions>;
18
+ "dry-run": _$_oclif_core_interfaces0.BooleanFlag<boolean>;
19
+ force: _$_oclif_core_interfaces0.BooleanFlag<boolean>;
20
+ };
21
+ static args: {
22
+ path: _$_oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
23
+ };
24
+ run(): Promise<PullJsonOutput>;
25
+ private renderHuman;
26
+ }
27
+ //#endregion
28
+ export { PullJsonOutput, Pull as default };
@@ -0,0 +1,88 @@
1
+ import { a as pull, d as projectRoot, f as createApiClient, l as buildIacRegistry, u as discoverProject, v as getConfig } from "../../../core-CMrP5BQS.mjs";
2
+ import { t as BaseCommand } from "../../../base.command-cV5d65r8.mjs";
3
+ import { n as renderIacErrors } from "../../../iac-render-BSZZEP0n.mjs";
4
+ import chalk from "chalk";
5
+ import { Args, Flags } from "@oclif/core";
6
+ //#region src/adapters/oclif/commands/pull.ts
7
+ const ACTION_LABELS = {
8
+ pulled: chalk.green("pulled"),
9
+ discovered: chalk.cyan("discovered"),
10
+ unchanged: chalk.dim("unchanged"),
11
+ "skipped-dirty": chalk.yellow("skipped (dirty)"),
12
+ "skipped-no-id": chalk.dim("skipped (no id)"),
13
+ "skipped-not-found": chalk.red("skipped (not found)")
14
+ };
15
+ var Pull = class extends BaseCommand {
16
+ static description = "Reconcile local YAML to match the API. Lists every remote resource for each registered kind: known resources (matched by metadata.id) get their spec rewritten in place; previously-unknown resources are discovered and a new YAML file is written under <kind>s/<name>.yaml. Refuses to overwrite local files with uncommitted changes unless --force; new files are always created.";
17
+ static flags = {
18
+ project: Flags.string({ description: "Path to the project root (defaults to walking up from cwd)" }),
19
+ "dry-run": Flags.boolean({
20
+ description: "Show what would be pulled without writing files",
21
+ default: false
22
+ }),
23
+ force: Flags.boolean({
24
+ description: "Pull even when the target file has uncommitted git changes",
25
+ default: false
26
+ })
27
+ };
28
+ static args = { path: Args.string({
29
+ description: "Restrict scan to a sub-path within the project",
30
+ required: false
31
+ }) };
32
+ async run() {
33
+ const project = discoverProject({
34
+ cwd: process.cwd(),
35
+ projectPath: this.flags.project
36
+ });
37
+ const config = await getConfig();
38
+ const result = await pull({
39
+ project,
40
+ registry: buildIacRegistry(createApiClient({
41
+ apiUrl: config.apiUrl,
42
+ token: config.token,
43
+ organizationId: project.metadata.orgId
44
+ })),
45
+ startPath: this.args.path ?? projectRoot(project),
46
+ force: this.flags.force,
47
+ dryRun: this.flags["dry-run"]
48
+ });
49
+ if (!this.jsonEnabled()) this.renderHuman(result);
50
+ if (result.errors.length > 0) this.exit(2);
51
+ return {
52
+ project: {
53
+ path: project.path,
54
+ orgId: project.metadata.orgId
55
+ },
56
+ pulled: result.pulled,
57
+ errors: result.errors
58
+ };
59
+ }
60
+ renderHuman(result) {
61
+ if (result.errors.length > 0) {
62
+ renderIacErrors(result.errors, (msg) => this.log(msg));
63
+ return;
64
+ }
65
+ if (result.pulled.length === 0) {
66
+ this.log(chalk.dim("No resources found."));
67
+ return;
68
+ }
69
+ this.table(result.pulled.map((p) => ({
70
+ address: p.address,
71
+ action: ACTION_LABELS[p.action] ?? p.action,
72
+ id: p.id ?? chalk.dim("—")
73
+ })), { columns: [
74
+ { key: "address" },
75
+ { key: "action" },
76
+ { key: "id" }
77
+ ] });
78
+ const counts = result.pulled.reduce((acc, p) => {
79
+ acc[p.action] = (acc[p.action] ?? 0) + 1;
80
+ return acc;
81
+ }, {});
82
+ const summary = Object.entries(counts).map(([k, v]) => `${k}: ${v}`).join(", ");
83
+ this.log(chalk.dim(`\n${summary}`));
84
+ if (counts["skipped-dirty"]) this.log(chalk.yellow("\nSome files have uncommitted changes and were skipped. Commit or stash them, or re-run with --force to overwrite."));
85
+ }
86
+ };
87
+ //#endregion
88
+ export { Pull as default };
@@ -1,8 +1,9 @@
1
- import { t as createCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { t as createCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/score-groups/create.ts
3
3
  var create_default = createCommand({
4
4
  resource: "scoreGroups",
5
- description: "Create a new score group"
5
+ description: "Create a new score group",
6
+ pathParams: ["tableId"]
6
7
  });
7
8
  //#endregion
8
9
  export { create_default as default };
@@ -1,4 +1,4 @@
1
- import { n as deleteCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { n as deleteCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/score-groups/delete.ts
3
3
  var delete_default = deleteCommand({
4
4
  resource: "scoreGroups",
@@ -1,4 +1,4 @@
1
- import { r as getCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { r as getCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/score-groups/get.ts
3
3
  var get_default = getCommand({
4
4
  resource: "scoreGroups",
@@ -1,8 +1,9 @@
1
- import { i as listCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { i as listCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/score-groups/list.ts
3
3
  var list_default = listCommand({
4
4
  resource: "scoreGroups",
5
- description: "List score groups"
5
+ description: "List score groups",
6
+ pathParams: ["tableId"]
6
7
  });
7
8
  //#endregion
8
9
  export { list_default as default };
@@ -1,4 +1,4 @@
1
- import { a as updateCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { a as updateCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/score-groups/update.ts
3
3
  var update_default = updateCommand({
4
4
  resource: "scoreGroups",
@@ -1,8 +1,9 @@
1
- import { t as createCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { t as createCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/scores/create.ts
3
3
  var create_default = createCommand({
4
4
  resource: "scores",
5
- description: "Create a new score"
5
+ description: "Create a new score",
6
+ pathParams: ["tableId"]
6
7
  });
7
8
  //#endregion
8
9
  export { create_default as default };
@@ -1,4 +1,4 @@
1
- import { n as deleteCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { n as deleteCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/scores/delete.ts
3
3
  var delete_default = deleteCommand({
4
4
  resource: "scores",
@@ -1,8 +1,9 @@
1
- import { i as listCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { i as listCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/scores/list.ts
3
3
  var list_default = listCommand({
4
4
  resource: "scores",
5
- description: "List scores"
5
+ description: "List scores",
6
+ pathParams: ["tableId"]
6
7
  });
7
8
  //#endregion
8
9
  export { list_default as default };
@@ -1,4 +1,4 @@
1
- import { a as updateCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { a as updateCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/scores/update.ts
3
3
  var update_default = updateCommand({
4
4
  resource: "scores",
@@ -1,4 +1,4 @@
1
- import { t as createCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { t as createCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/segments/create.ts
3
3
  var create_default = createCommand({
4
4
  resource: "segments",
@@ -1,4 +1,4 @@
1
- import { n as deleteCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { n as deleteCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/segments/delete.ts
3
3
  var delete_default = deleteCommand({
4
4
  resource: "segments",
@@ -1,5 +1,5 @@
1
- import { m as unwrap } from "../../../../core-gKJ_V-K5.mjs";
2
- import { n as defineApiCommand } from "../../../../factory-D9sR_S_g.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import { Args } from "@oclif/core";
4
4
  //#region src/adapters/oclif/commands/segments/evaluate.ts
5
5
  var evaluate_default = defineApiCommand({
@@ -1,5 +1,5 @@
1
- import { m as unwrap } from "../../../../core-gKJ_V-K5.mjs";
2
- import { n as defineApiCommand } from "../../../../factory-D9sR_S_g.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import { Args } from "@oclif/core";
4
4
  //#region src/adapters/oclif/commands/segments/get-evaluation-history.ts
5
5
  var get_evaluation_history_default = defineApiCommand({
@@ -1,5 +1,5 @@
1
- import { m as unwrap } from "../../../../core-gKJ_V-K5.mjs";
2
- import { n as defineApiCommand } from "../../../../factory-D9sR_S_g.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import { Args } from "@oclif/core";
4
4
  //#region src/adapters/oclif/commands/segments/get-version.ts
5
5
  var get_version_default = defineApiCommand({
@@ -1,4 +1,4 @@
1
- import { r as getCommand } from "../../../../presets-Cvazkjmu.mjs";
1
+ import { r as getCommand } from "../../../../presets-CJbFbHlw.mjs";
2
2
  //#region src/adapters/oclif/commands/segments/get.ts
3
3
  var get_default = getCommand({
4
4
  resource: "segments",
@@ -1,7 +1,6 @@
1
- import { m as unwrap } from "../../../../core-gKJ_V-K5.mjs";
2
- import { n as defineApiCommand } from "../../../../factory-D9sR_S_g.mjs";
1
+ import { p as unwrap } from "../../../../core-CMrP5BQS.mjs";
2
+ import { n as createListRender, r as defineApiCommand } from "../../../../factory-C6XLqhT9.mjs";
3
3
  import { Args, Flags } from "@oclif/core";
4
- //#region src/adapters/oclif/commands/segments/list-versions.ts
5
4
  var list_versions_default = defineApiCommand({
6
5
  description: "List versions of a segment",
7
6
  args: { id: Args.string({
@@ -13,7 +12,11 @@ var list_versions_default = defineApiCommand({
13
12
  "page-token": Flags.string({ description: "Token for the next page" }),
14
13
  "order-by": Flags.string({ description: "Field to order results by" }),
15
14
  filter: Flags.string({ description: "Filter expression" }),
16
- fields: Flags.string({ description: "Comma-separated fields to include" })
15
+ fields: Flags.string({ description: "Comma-separated fields to include" }),
16
+ columns: Flags.string({
17
+ description: "Columns to display in table output (comma-separated). Overrides the resource default. Ignored with --json.",
18
+ helpValue: "a,b,c"
19
+ })
17
20
  },
18
21
  call: async ({ api, args, flags }) => {
19
22
  const params = { id: args.id };
@@ -23,7 +26,15 @@ var list_versions_default = defineApiCommand({
23
26
  if (flags.filter !== void 0) params.filter = flags.filter;
24
27
  if (flags.fields !== void 0) params.fields = flags.fields;
25
28
  return unwrap(await api.segments.listVersions(params));
26
- }
29
+ },
30
+ render: createListRender([
31
+ "id",
32
+ "version",
33
+ "name",
34
+ "createdAt",
35
+ "createdBy",
36
+ "isCurrent"
37
+ ])
27
38
  });
28
39
  //#endregion
29
40
  export { list_versions_default as default };