@revos/cli 0.2.3 → 0.3.0
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/README.md +15 -3
- package/dist/adapters/oclif/commands/action-runs/get.mjs +1 -1
- package/dist/adapters/oclif/commands/action-runs/list.mjs +1 -1
- package/dist/adapters/oclif/commands/actions/get-input-schema.mjs +2 -2
- package/dist/adapters/oclif/commands/actions/get-params-schema.mjs +2 -2
- package/dist/adapters/oclif/commands/actions/get.mjs +1 -1
- package/dist/adapters/oclif/commands/actions/list.mjs +2 -2
- package/dist/adapters/oclif/commands/ai-instructions/create.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/get.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/list.mjs +1 -1
- package/dist/adapters/oclif/commands/ai-instructions/update.mjs +1 -1
- package/dist/adapters/oclif/commands/api.mjs +2 -2
- package/dist/adapters/oclif/commands/apply.d.mts +1 -1
- package/dist/adapters/oclif/commands/apply.mjs +2 -2
- package/dist/adapters/oclif/commands/auth/login.mjs +8 -3
- package/dist/adapters/oclif/commands/auth/logout.mjs +2 -2
- package/dist/adapters/oclif/commands/auth/status.mjs +2 -2
- package/dist/adapters/oclif/commands/connections/create.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/get.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/list.mjs +1 -1
- package/dist/adapters/oclif/commands/connections/update.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/create.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/get.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/list.mjs +1 -1
- package/dist/adapters/oclif/commands/cubes/update.mjs +1 -1
- package/dist/adapters/oclif/commands/diff.d.mts +1 -1
- package/dist/adapters/oclif/commands/diff.mjs +2 -2
- package/dist/adapters/oclif/commands/gservice-account-keys/get.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-account-keys/reveal.mjs +2 -2
- package/dist/adapters/oclif/commands/gservice-accounts/create.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/get.mjs +1 -1
- package/dist/adapters/oclif/commands/gservice-accounts/list.mjs +1 -1
- package/dist/adapters/oclif/commands/init.d.mts +2 -0
- package/dist/adapters/oclif/commands/init.mjs +82 -3
- package/dist/adapters/oclif/commands/org/create.mjs +1 -1
- package/dist/adapters/oclif/commands/org/current.mjs +2 -2
- package/dist/adapters/oclif/commands/org/get.mjs +1 -1
- package/dist/adapters/oclif/commands/org/list.mjs +2 -2
- package/dist/adapters/oclif/commands/org/switch.mjs +2 -2
- package/dist/adapters/oclif/commands/pull.d.mts +1 -1
- package/dist/adapters/oclif/commands/pull.mjs +2 -2
- package/dist/adapters/oclif/commands/score-groups/create.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/get.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/list.mjs +1 -1
- package/dist/adapters/oclif/commands/score-groups/update.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/create.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/list.mjs +1 -1
- package/dist/adapters/oclif/commands/scores/update.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/create.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/evaluate.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get-evaluation-history.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get-version.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/get.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/list-versions.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/list.mjs +1 -1
- package/dist/adapters/oclif/commands/segments/restore-version.mjs +2 -2
- package/dist/adapters/oclif/commands/segments/update.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/create.mjs +2 -2
- package/dist/adapters/oclif/commands/sources/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/get.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/list-streams.mjs +2 -2
- package/dist/adapters/oclif/commands/sources/list.mjs +1 -1
- package/dist/adapters/oclif/commands/sources/update.mjs +2 -2
- package/dist/adapters/oclif/commands/status.d.mts +1 -1
- package/dist/adapters/oclif/commands/status.mjs +3 -3
- package/dist/adapters/oclif/commands/table-views/create.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/list.mjs +1 -1
- package/dist/adapters/oclif/commands/table-views/update.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/create.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/delete.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/get.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/list.mjs +1 -1
- package/dist/adapters/oclif/commands/tables/update.mjs +1 -1
- package/dist/{base.command-D8taHOFF.mjs → base.command-BLken6pU.mjs} +1 -1
- package/dist/{core-B-IdeRNl.mjs → core-DsGA_HuL.mjs} +31 -3
- package/dist/{factory-CCcimDhl.mjs → factory-eslVs9tN.mjs} +2 -2
- package/dist/{index-D0ax2I61.d.mts → index-Blr5iiwc.d.mts} +12 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{presets-Bb9gwgeh.mjs → presets-D0AIVsGO.mjs} +2 -2
- package/dist/templates/.devcontainer/Dockerfile +8 -0
- package/dist/templates/.devcontainer/devcontainer.json +10 -9
- package/dist/templates/.devcontainer/post-create.sh +46 -0
- package/dist/templates/.devcontainer/post-start.sh +65 -0
- package/dist/templates/.devcontainer/welcome.sh +27 -0
- package/dist/templates/README.md +81 -12
- package/package.json +1 -1
- package/dist/templates/.devcontainer/setup.sh +0 -35
package/README.md
CHANGED
|
@@ -73,19 +73,25 @@ destination Path or project name (default: current directory)
|
|
|
73
73
|
|
|
74
74
|
If the destination already exists and is not empty, you will be prompted to confirm before proceeding. Use `--yes` to skip this prompt.
|
|
75
75
|
|
|
76
|
-
**What it does:**
|
|
76
|
+
**What it does (greenfield — no `revos.yaml` discovered):**
|
|
77
77
|
|
|
78
78
|
1. Fetches your organizations and prompts you to select one (auto-selects if only one).
|
|
79
79
|
2. Provisions a GCP service account for your org (idempotent) and writes the key to `~/.revos/{project-name}-gsa-creds.json`.
|
|
80
80
|
3. Writes `revos.yaml` — the project marker that pins this directory to your organization. CLI commands like `revos status` walk up from the current directory to find this file.
|
|
81
81
|
4. Creates the project directory structure (medallion layout: bronze/silver/gold).
|
|
82
|
-
5. Generates `.devcontainer
|
|
82
|
+
5. Generates `.devcontainer/` (`devcontainer.json`, `Dockerfile`, `post-create.sh`, `post-start.sh`, `welcome.sh`) with Python, Node.js, Google Cloud SDK (`bq`), GitHub CLI (`gh`), `jq`, and dbt pre-installed. The Dev Container persists three per-project named Docker volumes — `revos-{slug}-credentials` (`~/.revos`), `revos-{slug}-gcloud` (`~/.config/gcloud`), and `revos-{slug}-claude` (`~/.claude`) — so CLI login, GSA key, gcloud auth state, and Claude Code state all survive `Rebuild Container`. No host bind mounts.
|
|
83
83
|
6. Generates `dbt/profiles.yml` pre-configured for BigQuery.
|
|
84
84
|
7. Generates `.gitignore` and `README.md`.
|
|
85
85
|
8. Scaffolds AI companion files: `CLAUDE.md`, `AGENTS.md`, and `.claude/skills/` with six pre-installed skills: `explore-lakehouse`, `create-connections`, `create-cubes`, `create-dbt-transformations`, `load-sample-data`, and `visualize-semantic-model`. Also writes `.claude/settings.json` with deny rules that block AI assistants from reading `~/.revos/` (CLI credentials and service account keys), `~/.config/gcloud/` (Google Cloud Application Default Credentials), from running `gcloud auth print-*-token` commands, and from editing the settings file itself (so the AI can't lift its own restrictions).
|
|
86
86
|
9. Discovers every Connection and Cube currently in the org and writes them under `connections/` and `cubes/` so a developer joining an org with existing pipelines and cubes starts from the live state. Pass `--no-pull` to skip. Sources are managed only through the API surface (see [Sources](#sources)) and are referenced from Connection YAML by their server id.
|
|
87
87
|
|
|
88
|
-
**
|
|
88
|
+
**What it does (in-project — re-run inside an existing `revos.yaml` tree):**
|
|
89
|
+
|
|
90
|
+
`revos init` becomes idempotent: it skips the org prompt, skips scaffolding (no overwriting of existing files), skips IaC discovery, and only provisions the GCP service account key if `~/.revos/{project-name}-gsa-creds.json` is missing. Useful inside the Dev Container — the named volume starts empty, so after `revos auth login` you run `revos init` to materialize the GSA key. Outside the container, re-running is a safe no-op if everything is already in place.
|
|
91
|
+
|
|
92
|
+
**Dev Container onboarding flow:** open project in VS Code → "Reopen in Container" → run `revos auth login` → run `revos init`. Subsequent container starts auto-activate the service account via `postStartCommand`.
|
|
93
|
+
|
|
94
|
+
**Requires:** `revos auth login` first (greenfield), or in-container login (in-project).
|
|
89
95
|
|
|
90
96
|
---
|
|
91
97
|
|
|
@@ -290,6 +296,12 @@ The CLI walks up from the current working directory to find `revos.yaml` (or set
|
|
|
290
296
|
revos auth login
|
|
291
297
|
```
|
|
292
298
|
|
|
299
|
+
After the OAuth flow completes, the CLI picks your default organization:
|
|
300
|
+
|
|
301
|
+
- **Inside a project** (`revos.yaml` discovered) — uses `metadata.orgId` from `revos.yaml`; no prompt.
|
|
302
|
+
- **Outside a project, one org** — auto-selects it.
|
|
303
|
+
- **Outside a project, multiple orgs** — prompts you to pick.
|
|
304
|
+
|
|
293
305
|
#### Logout
|
|
294
306
|
|
|
295
307
|
```bash
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-eslVs9tN.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/actions/get-input-schema.ts
|
|
5
5
|
var get_input_schema_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-eslVs9tN.mjs";
|
|
3
3
|
import { Args, Flags } from "@oclif/core";
|
|
4
4
|
//#region src/adapters/oclif/commands/actions/get-params-schema.ts
|
|
5
5
|
var get_params_schema_default = defineApiCommand({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { n as createListRender, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { n as createListRender, r as defineApiCommand } from "../../../../factory-eslVs9tN.mjs";
|
|
3
3
|
import { Flags } from "@oclif/core";
|
|
4
4
|
var list_default = defineApiCommand({
|
|
5
5
|
description: "List available actions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCommand } from "../../../../presets-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/create.ts
|
|
3
3
|
var create_default = createCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as deleteCommand } from "../../../../presets-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/delete.ts
|
|
3
3
|
var delete_default = deleteCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as updateCommand } from "../../../../presets-
|
|
1
|
+
import { a as updateCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/ai-instructions/update.ts
|
|
3
3
|
var update_default = updateCommand({
|
|
4
4
|
resource: "aiInstructions",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as ApiError } from "../../../core-
|
|
2
|
-
import { r as defineApiCommand, t as bodyFlag } from "../../../factory-
|
|
1
|
+
import { U as ApiError } from "../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { r as defineApiCommand, t as bodyFlag } from "../../../factory-eslVs9tN.mjs";
|
|
3
3
|
import { client } from "@revos/api-client";
|
|
4
4
|
import { Args, Flags } from "@oclif/core";
|
|
5
5
|
//#region src/adapters/oclif/commands/api.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as AppliedResource } from "../../../index-
|
|
1
|
+
import { f as AppliedResource } from "../../../index-Blr5iiwc.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, m as apply, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, m as apply, v as discoverProject, y as projectRoot } from "../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import { n as renderIacErrors, t as APPLY_ACTION_LABELS } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as generatePKCEChallenge, D as AUTH_ENVS, F as setAuthEnv, H as saveCredentials, I as tokenResponseToCredentials, L as startOAuthServer, M as getUserInfo, O as buildAuthorizationUrl, P as setAuthConfig, b as createApiClient, j as getActiveAuthConfig, k as exchangeCodeForTokens, n as selectOrganization, x as unwrap, z as getCredentialsPath } from "../../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { A as generatePKCEChallenge, D as AUTH_ENVS, F as setAuthEnv, H as saveCredentials, I as tokenResponseToCredentials, L as startOAuthServer, M as getUserInfo, O as buildAuthorizationUrl, P as setAuthConfig, b as createApiClient, j as getActiveAuthConfig, k as exchangeCodeForTokens, l as resolveProjectContext, n as selectOrganization, x as unwrap, z as getCredentialsPath } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { Flags } from "@oclif/core";
|
|
5
5
|
import open from "open";
|
|
@@ -51,7 +51,12 @@ var AuthLogin = class extends BaseCommand {
|
|
|
51
51
|
this.log(chalk.green(`\nAuthenticated as ${userInfo.email || userInfo.sub}`));
|
|
52
52
|
this.log(`\nCredentials saved to ${getCredentialsPath()}`);
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
const projectCtx = resolveProjectContext();
|
|
55
|
+
if (projectCtx) {
|
|
56
|
+
credentials.organizationId = projectCtx.orgId;
|
|
57
|
+
saveCredentials(credentials);
|
|
58
|
+
if (!this.jsonEnabled()) this.log(chalk.green(`\nUsing organization from revos.yaml: ${projectCtx.orgId}`));
|
|
59
|
+
} else try {
|
|
55
60
|
const orgs = unwrap(await createApiClient({
|
|
56
61
|
apiUrl,
|
|
57
62
|
token: tokenResponse.access_token
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as deleteCredentials } from "../../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { R as deleteCredentials } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
//#region src/adapters/oclif/commands/auth/logout.ts
|
|
5
5
|
var AuthLogout = class extends BaseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as isTokenExpired, V as loadCredentials, l as resolveProjectContext, z as getCredentialsPath } from "../../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { B as isTokenExpired, V as loadCredentials, l as resolveProjectContext, z as getCredentialsPath } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
//#region src/adapters/oclif/commands/auth/status.ts
|
|
5
5
|
var AuthStatus = class extends BaseCommand {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as AppliedResource } from "../../../index-
|
|
1
|
+
import { f as AppliedResource } from "../../../index-Blr5iiwc.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, h as formatDiffLine, m as apply, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, h as formatDiffLine, m as apply, v as discoverProject, y as projectRoot } from "../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import { n as renderIacErrors, t as APPLY_ACTION_LABELS } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getCommand } from "../../../../presets-
|
|
1
|
+
import { r as getCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-account-keys/get.ts
|
|
3
3
|
var get_default = getCommand({
|
|
4
4
|
resource: "gserviceAccountKeys",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as unwrap } from "../../../../core-
|
|
2
|
-
import { r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { r as defineApiCommand } from "../../../../factory-eslVs9tN.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-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-D0AIVsGO.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-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-D0AIVsGO.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 { i as listCommand } from "../../../../presets-
|
|
1
|
+
import { i as listCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/gservice-accounts/list.ts
|
|
3
3
|
var list_default = listCommand({
|
|
4
4
|
resource: "gserviceAccounts",
|
|
@@ -14,6 +14,8 @@ declare class Init extends BaseCommand<typeof Init> {
|
|
|
14
14
|
"no-pull": _$_oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
15
15
|
};
|
|
16
16
|
run(): Promise<void>;
|
|
17
|
+
private runInProject;
|
|
18
|
+
private activateGcloudInContainer;
|
|
17
19
|
}
|
|
18
20
|
//#endregion
|
|
19
21
|
export { Init as default };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { E as getConfig, U as ApiError, t as InitService } from "../../../core-
|
|
1
|
+
import { E as getConfig, U as ApiError, l as resolveProjectContext, t as InitService } from "../../../core-DsGA_HuL.mjs";
|
|
2
2
|
import { TEMPLATES_DIR } from "../../../templates/index.mjs";
|
|
3
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
3
|
+
import { t as BaseCommand } from "../../../base.command-BLken6pU.mjs";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
6
6
|
import chalk from "chalk";
|
|
7
|
+
import { execFileSync } from "child_process";
|
|
7
8
|
import { Args, Flags } from "@oclif/core";
|
|
8
9
|
import select from "@inquirer/select";
|
|
9
10
|
//#region src/adapters/oclif/commands/init.ts
|
|
@@ -35,6 +36,17 @@ var Init = class extends BaseCommand {
|
|
|
35
36
|
async run() {
|
|
36
37
|
const { apiUrl, token, organizationId } = await getConfig();
|
|
37
38
|
const projectDir = this.args.destination ? path.resolve(this.args.destination) : process.cwd();
|
|
39
|
+
const service = new InitService(TEMPLATES_DIR);
|
|
40
|
+
const projectCtx = fs.existsSync(projectDir) ? resolveProjectContext({ cwd: projectDir }) : null;
|
|
41
|
+
if (projectCtx) {
|
|
42
|
+
await this.runInProject({
|
|
43
|
+
apiUrl,
|
|
44
|
+
token,
|
|
45
|
+
service,
|
|
46
|
+
projectCtx
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
38
50
|
if (fs.existsSync(projectDir) && !isDirEmpty(projectDir) && !this.flags.yes) {
|
|
39
51
|
if (await select({
|
|
40
52
|
message: `Directory "${path.basename(projectDir)}" already exists and is not empty. What would you like to do?`,
|
|
@@ -50,7 +62,6 @@ var Init = class extends BaseCommand {
|
|
|
50
62
|
return;
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
|
-
const service = new InitService(TEMPLATES_DIR);
|
|
54
65
|
const org = await service.resolveOrganization(apiUrl, token, organizationId).catch((err) => {
|
|
55
66
|
const message = err instanceof Error ? err.message : String(err);
|
|
56
67
|
this.error(message, { exit: 1 });
|
|
@@ -102,6 +113,74 @@ var Init = class extends BaseCommand {
|
|
|
102
113
|
this.log(`\nNext step: open ${chalk.bold(result.projectDir)} in VS Code and click ${chalk.bold("Reopen in Container")}.`);
|
|
103
114
|
this.log(`\n${chalk.dim("Tip: once inside the Dev Container, ask Claude to \"load sample data\" if you need example datasets.")}\n`);
|
|
104
115
|
}
|
|
116
|
+
async runInProject(args) {
|
|
117
|
+
const { apiUrl, token, service, projectCtx } = args;
|
|
118
|
+
const projectSlug = projectCtx.projectFile.metadata.name;
|
|
119
|
+
const orgId = projectCtx.orgId;
|
|
120
|
+
if (!projectSlug) this.error(`revos.yaml at ${projectCtx.projectFile.path} is missing metadata.name — required to locate the GCP service account key.`, { exit: 1 });
|
|
121
|
+
if (this.flags["dry-run"]) {
|
|
122
|
+
this.log(`\nDetected existing RevOS project at ${chalk.dim(projectCtx.projectPath)}`);
|
|
123
|
+
this.log(` Org: ${chalk.bold(orgId)}`);
|
|
124
|
+
const keyPath = InitService.gcpKeyPath(projectSlug);
|
|
125
|
+
if (fs.existsSync(keyPath) && fs.statSync(keyPath).size > 0) this.log(chalk.dim("\nNothing to do — GCP service account key already present."));
|
|
126
|
+
else this.log(`\nWould provision GCP service account key at ${keyPath}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const org = await service.resolveOrganization(apiUrl, token, orgId).catch((err) => {
|
|
130
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
131
|
+
this.error(message, { exit: 1 });
|
|
132
|
+
});
|
|
133
|
+
this.log(`\nDetected existing RevOS project at ${chalk.dim(projectCtx.projectPath)}`);
|
|
134
|
+
this.log(` Org: ${chalk.bold(org.name)} (${org.id})\n`);
|
|
135
|
+
const result = await service.ensureGcpKey({
|
|
136
|
+
apiUrl,
|
|
137
|
+
token,
|
|
138
|
+
organization: org,
|
|
139
|
+
projectSlug
|
|
140
|
+
}).catch((err) => {
|
|
141
|
+
if (err instanceof ApiError) {
|
|
142
|
+
this.log(chalk.red(`\nAPI error: ${err.status} ${err.statusText}`));
|
|
143
|
+
this.log(chalk.red(`URL: ${err.url}`));
|
|
144
|
+
this.log(chalk.red(`Body: ${JSON.stringify(err.body, null, 2)}`));
|
|
145
|
+
}
|
|
146
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
147
|
+
this.error(message, { exit: 1 });
|
|
148
|
+
});
|
|
149
|
+
if (result.status === "created") {
|
|
150
|
+
this.log(chalk.green(`Provisioned GCP service account key: ${result.keyPath}`));
|
|
151
|
+
this.activateGcloudInContainer(result.keyPath);
|
|
152
|
+
} else this.log(chalk.dim(`Nothing to do — GCP service account key already present at ${result.keyPath}.`));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* After provisioning a key inside a Dev Container, the GSA still needs to
|
|
156
|
+
* be activated in gcloud's local config for `bq`, `dbt`, and direct
|
|
157
|
+
* `gcloud` commands to work in this shell — postStartCommand already ran
|
|
158
|
+
* with no key file. We do that activation here, but only inside a
|
|
159
|
+
* container (detected via /.dockerenv) so we never touch the user's
|
|
160
|
+
* personal gcloud config on the host.
|
|
161
|
+
*/
|
|
162
|
+
activateGcloudInContainer(keyPath) {
|
|
163
|
+
if (!fs.existsSync("/.dockerenv")) return;
|
|
164
|
+
try {
|
|
165
|
+
execFileSync("gcloud", [
|
|
166
|
+
"auth",
|
|
167
|
+
"activate-service-account",
|
|
168
|
+
"--key-file",
|
|
169
|
+
keyPath
|
|
170
|
+
], { stdio: "ignore" });
|
|
171
|
+
const project = process.env.GOOGLE_CLOUD_PROJECT;
|
|
172
|
+
if (project) execFileSync("gcloud", [
|
|
173
|
+
"config",
|
|
174
|
+
"set",
|
|
175
|
+
"project",
|
|
176
|
+
project
|
|
177
|
+
], { stdio: "ignore" });
|
|
178
|
+
this.log(chalk.green("Activated service account in gcloud."));
|
|
179
|
+
} catch (err) {
|
|
180
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
181
|
+
this.log(chalk.yellow(`Could not activate gcloud automatically (${msg}). Run manually:\n gcloud auth activate-service-account --key-file=${keyPath}`));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
105
184
|
};
|
|
106
185
|
//#endregion
|
|
107
186
|
export { Init as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, V as loadCredentials, b as createApiClient, l as resolveProjectContext, x as unwrap } from "../../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, V as loadCredentials, b as createApiClient, l as resolveProjectContext, x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
//#region src/adapters/oclif/commands/org/current.ts
|
|
5
5
|
var OrgCurrent = class extends BaseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveProjectContext, x as unwrap } from "../../../../core-
|
|
2
|
-
import { a as resolveColumns, i as renderList, r as defineApiCommand } from "../../../../factory-
|
|
1
|
+
import { l as resolveProjectContext, x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { a as resolveColumns, i as renderList, r as defineApiCommand } from "../../../../factory-eslVs9tN.mjs";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { Flags } from "@oclif/core";
|
|
5
5
|
//#region src/adapters/oclif/commands/org/list.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, H as saveCredentials, V as loadCredentials, a as formatInProjectSwitchWarning, b as createApiClient, l as resolveProjectContext, n as selectOrganization, x as unwrap } from "../../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../../base.command-
|
|
1
|
+
import { E as getConfig, H as saveCredentials, V as loadCredentials, a as formatInProjectSwitchWarning, b as createApiClient, l as resolveProjectContext, n as selectOrganization, x as unwrap } from "../../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import * as os from "os";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as PulledResource } from "../../../index-
|
|
1
|
+
import { d as PulledResource } from "../../../index-Blr5iiwc.mjs";
|
|
2
2
|
import { c as IacError } from "../../../context-D5uelKLe.mjs";
|
|
3
3
|
import { t as BaseCommand } from "../../../base.command-BmddDbHa.mjs";
|
|
4
4
|
import * as _$_oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, p as pull, v as discoverProject, y as projectRoot } from "../../../core-
|
|
2
|
-
import { t as BaseCommand } from "../../../base.command-
|
|
1
|
+
import { E as getConfig, _ as buildIacRegistry, b as createApiClient, p as pull, v as discoverProject, y as projectRoot } from "../../../core-DsGA_HuL.mjs";
|
|
2
|
+
import { t as BaseCommand } from "../../../base.command-BLken6pU.mjs";
|
|
3
3
|
import { n as renderIacErrors } from "../../../iac-render-BSZZEP0n.mjs";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createCommand } from "../../../../presets-
|
|
1
|
+
import { t as createCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/create.ts
|
|
3
3
|
var create_default = createCommand({
|
|
4
4
|
resource: "scoreGroups",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as deleteCommand } from "../../../../presets-
|
|
1
|
+
import { n as deleteCommand } from "../../../../presets-D0AIVsGO.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 { a as updateCommand } from "../../../../presets-
|
|
1
|
+
import { a as updateCommand } from "../../../../presets-D0AIVsGO.mjs";
|
|
2
2
|
//#region src/adapters/oclif/commands/score-groups/update.ts
|
|
3
3
|
var update_default = updateCommand({
|
|
4
4
|
resource: "scoreGroups",
|