@axtrabase/cli 0.1.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.
Files changed (154) hide show
  1. package/README.md +130 -0
  2. package/dist/active-project.d.ts +12 -0
  3. package/dist/active-project.d.ts.map +1 -0
  4. package/dist/active-project.js +27 -0
  5. package/dist/active-project.js.map +1 -0
  6. package/dist/api-types.d.ts +187 -0
  7. package/dist/api-types.d.ts.map +1 -0
  8. package/dist/api-types.js +9 -0
  9. package/dist/api-types.js.map +1 -0
  10. package/dist/commands/config.d.ts +3 -0
  11. package/dist/commands/config.d.ts.map +1 -0
  12. package/dist/commands/config.js +98 -0
  13. package/dist/commands/config.js.map +1 -0
  14. package/dist/commands/connection.d.ts +3 -0
  15. package/dist/commands/connection.d.ts.map +1 -0
  16. package/dist/commands/connection.js +58 -0
  17. package/dist/commands/connection.js.map +1 -0
  18. package/dist/commands/context.d.ts +3 -0
  19. package/dist/commands/context.d.ts.map +1 -0
  20. package/dist/commands/context.js +128 -0
  21. package/dist/commands/context.js.map +1 -0
  22. package/dist/commands/docs.d.ts +11 -0
  23. package/dist/commands/docs.d.ts.map +1 -0
  24. package/dist/commands/docs.js +39 -0
  25. package/dist/commands/docs.js.map +1 -0
  26. package/dist/commands/keys.d.ts +3 -0
  27. package/dist/commands/keys.d.ts.map +1 -0
  28. package/dist/commands/keys.js +92 -0
  29. package/dist/commands/keys.js.map +1 -0
  30. package/dist/commands/login.d.ts +3 -0
  31. package/dist/commands/login.d.ts.map +1 -0
  32. package/dist/commands/login.js +68 -0
  33. package/dist/commands/login.js.map +1 -0
  34. package/dist/commands/logout.d.ts +12 -0
  35. package/dist/commands/logout.d.ts.map +1 -0
  36. package/dist/commands/logout.js +77 -0
  37. package/dist/commands/logout.js.map +1 -0
  38. package/dist/commands/openapi.d.ts +4 -0
  39. package/dist/commands/openapi.d.ts.map +1 -0
  40. package/dist/commands/openapi.js +40 -0
  41. package/dist/commands/openapi.js.map +1 -0
  42. package/dist/commands/organisations.d.ts +3 -0
  43. package/dist/commands/organisations.d.ts.map +1 -0
  44. package/dist/commands/organisations.js +64 -0
  45. package/dist/commands/organisations.js.map +1 -0
  46. package/dist/commands/permissions.d.ts +9 -0
  47. package/dist/commands/permissions.d.ts.map +1 -0
  48. package/dist/commands/permissions.js +61 -0
  49. package/dist/commands/permissions.js.map +1 -0
  50. package/dist/commands/projects.d.ts +3 -0
  51. package/dist/commands/projects.d.ts.map +1 -0
  52. package/dist/commands/projects.js +99 -0
  53. package/dist/commands/projects.js.map +1 -0
  54. package/dist/commands/requests.d.ts +3 -0
  55. package/dist/commands/requests.d.ts.map +1 -0
  56. package/dist/commands/requests.js +91 -0
  57. package/dist/commands/requests.js.map +1 -0
  58. package/dist/commands/schema.d.ts +3 -0
  59. package/dist/commands/schema.d.ts.map +1 -0
  60. package/dist/commands/schema.js +80 -0
  61. package/dist/commands/schema.js.map +1 -0
  62. package/dist/commands/status.d.ts +10 -0
  63. package/dist/commands/status.d.ts.map +1 -0
  64. package/dist/commands/status.js +46 -0
  65. package/dist/commands/status.js.map +1 -0
  66. package/dist/commands/tables.d.ts +3 -0
  67. package/dist/commands/tables.d.ts.map +1 -0
  68. package/dist/commands/tables.js +129 -0
  69. package/dist/commands/tables.js.map +1 -0
  70. package/dist/commands/whoami.d.ts +3 -0
  71. package/dist/commands/whoami.d.ts.map +1 -0
  72. package/dist/commands/whoami.js +41 -0
  73. package/dist/commands/whoami.js.map +1 -0
  74. package/dist/concurrency.d.ts +18 -0
  75. package/dist/concurrency.d.ts.map +1 -0
  76. package/dist/concurrency.js +32 -0
  77. package/dist/concurrency.js.map +1 -0
  78. package/dist/config/credentials.d.ts +17 -0
  79. package/dist/config/credentials.d.ts.map +1 -0
  80. package/dist/config/credentials.js +77 -0
  81. package/dist/config/credentials.js.map +1 -0
  82. package/dist/config/paths.d.ts +12 -0
  83. package/dist/config/paths.d.ts.map +1 -0
  84. package/dist/config/paths.js +20 -0
  85. package/dist/config/paths.js.map +1 -0
  86. package/dist/config/resolve.d.ts +22 -0
  87. package/dist/config/resolve.d.ts.map +1 -0
  88. package/dist/config/resolve.js +41 -0
  89. package/dist/config/resolve.js.map +1 -0
  90. package/dist/config/store.d.ts +24 -0
  91. package/dist/config/store.d.ts.map +1 -0
  92. package/dist/config/store.js +72 -0
  93. package/dist/config/store.js.map +1 -0
  94. package/dist/exit-codes.d.ts +18 -0
  95. package/dist/exit-codes.d.ts.map +1 -0
  96. package/dist/exit-codes.js +40 -0
  97. package/dist/exit-codes.js.map +1 -0
  98. package/dist/generators/typescript.d.ts +5 -0
  99. package/dist/generators/typescript.d.ts.map +1 -0
  100. package/dist/generators/typescript.js +70 -0
  101. package/dist/generators/typescript.js.map +1 -0
  102. package/dist/http/authenticated-client.d.ts +10 -0
  103. package/dist/http/authenticated-client.d.ts.map +1 -0
  104. package/dist/http/authenticated-client.js +24 -0
  105. package/dist/http/authenticated-client.js.map +1 -0
  106. package/dist/http/client.d.ts +42 -0
  107. package/dist/http/client.d.ts.map +1 -0
  108. package/dist/http/client.js +86 -0
  109. package/dist/http/client.js.map +1 -0
  110. package/dist/http/errors.d.ts +29 -0
  111. package/dist/http/errors.d.ts.map +1 -0
  112. package/dist/http/errors.js +21 -0
  113. package/dist/http/errors.js.map +1 -0
  114. package/dist/index.d.ts +3 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +62 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/open-browser.d.ts +9 -0
  119. package/dist/open-browser.d.ts.map +1 -0
  120. package/dist/open-browser.js +32 -0
  121. package/dist/open-browser.js.map +1 -0
  122. package/dist/output/file-writer.d.ts +8 -0
  123. package/dist/output/file-writer.d.ts.map +1 -0
  124. package/dist/output/file-writer.js +28 -0
  125. package/dist/output/file-writer.js.map +1 -0
  126. package/dist/output/print.d.ts +15 -0
  127. package/dist/output/print.d.ts.map +1 -0
  128. package/dist/output/print.js +27 -0
  129. package/dist/output/print.js.map +1 -0
  130. package/dist/output/sanitize.d.ts +30 -0
  131. package/dist/output/sanitize.d.ts.map +1 -0
  132. package/dist/output/sanitize.js +40 -0
  133. package/dist/output/sanitize.js.map +1 -0
  134. package/dist/output/table.d.ts +9 -0
  135. package/dist/output/table.d.ts.map +1 -0
  136. package/dist/output/table.js +19 -0
  137. package/dist/output/table.js.map +1 -0
  138. package/dist/prompt-masked.d.ts +15 -0
  139. package/dist/prompt-masked.d.ts.map +1 -0
  140. package/dist/prompt-masked.js +75 -0
  141. package/dist/prompt-masked.js.map +1 -0
  142. package/dist/report-error.d.ts +18 -0
  143. package/dist/report-error.d.ts.map +1 -0
  144. package/dist/report-error.js +63 -0
  145. package/dist/report-error.js.map +1 -0
  146. package/dist/resolve-entity.d.ts +13 -0
  147. package/dist/resolve-entity.d.ts.map +1 -0
  148. package/dist/resolve-entity.js +18 -0
  149. package/dist/resolve-entity.js.map +1 -0
  150. package/dist/version.d.ts +4 -0
  151. package/dist/version.d.ts.map +1 -0
  152. package/dist/version.js +4 -0
  153. package/dist/version.js.map +1 -0
  154. package/package.json +51 -0
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @axtrabase/cli
2
+
3
+ The `axtrabase` CLI lets a human or a coding agent inspect an AxtraBase
4
+ project — schema, permissions, environment — and build against it through
5
+ `@axtrabase/sdk` or the REST API, without ever touching Dataverse or
6
+ Microsoft OAuth directly.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install -g @axtrabase/cli
12
+ # or, without installing:
13
+ npx @axtrabase/cli whoami
14
+ ```
15
+
16
+ ## Authenticate
17
+
18
+ ```bash
19
+ axtrabase login
20
+ ```
21
+
22
+ This is a **control-plane credential, not a Dataverse or Microsoft
23
+ credential** — the CLI never asks for, stores, or uses Dataverse/Entra
24
+ secrets. `login` opens (or prints) a dashboard URL where you generate a CLI
25
+ token, shown exactly once; paste it back into the terminal prompt (input is
26
+ masked). The token is stored at `~/.config/axtrabase/credentials.json` with
27
+ `0600` permissions.
28
+
29
+ ```bash
30
+ axtrabase logout # remove the local credential only
31
+ axtrabase logout --revoke # also revoke the token on AxtraBase
32
+ ```
33
+
34
+ ### Non-interactive / CI use
35
+
36
+ Set `AXTRABASE_CLI_TOKEN` and skip `login` entirely — every command reads it
37
+ first, before the local credential file, and never persists or logs it.
38
+ Useful for CI and for handing a coding agent a scoped, disposable token.
39
+
40
+ ```bash
41
+ AXTRABASE_CLI_TOKEN=axcli_... axtrabase context --agent
42
+ ```
43
+
44
+ ## Select an organisation and project
45
+
46
+ ```bash
47
+ axtrabase organisations list # alias: orgs
48
+ axtrabase orgs use axtraxia
49
+
50
+ axtrabase projects list
51
+ axtrabase projects use hr-portal
52
+ ```
53
+
54
+ Selection persists to `~/.config/axtrabase/config.json` (non-secret — base
55
+ URL, active org/project). Every project-scoped command after this is
56
+ concise:
57
+
58
+ ```bash
59
+ axtrabase tables list
60
+ ```
61
+
62
+ ## Commands
63
+
64
+ | Command | What it does |
65
+ | ---------------------------------------------------- | -------------------------------------------------------------------------------------------- |
66
+ | `login` / `logout` | Authenticate/de-authenticate the CLI. |
67
+ | `whoami` | Signed-in user, organisation, active API. |
68
+ | `organisations list` / `orgs use <org>` | Discover and select an organisation. |
69
+ | `projects list` / `show <project>` / `use <project>` | Discover, inspect, and select a project. |
70
+ | `connection status` / `verify` | The active project's Dataverse connection status; `verify` re-runs the live readiness check. |
71
+ | `tables list` / `describe <table>` | The Dataverse table catalog, and one table's full column/lookup metadata. |
72
+ | `context [--json\|--agent]` | The single most useful command — see below. |
73
+ | `schema export --format json\|typescript` | Export table metadata, or generate TypeScript interfaces from it. |
74
+ | `permissions list` | Table permission grants (read-only in v1). |
75
+ | `keys list` / `create` / `revoke` | API key metadata (never the raw key after creation), creation, revocation. |
76
+ | `requests list` / `get <request-id>` | Data-plane request telemetry — the debugging loop. |
77
+ | `config list` / `get` / `set` / `unset` | Local, non-secret CLI settings. |
78
+ | `docs` / `openapi` | Open developer docs / print the OpenAPI spec. |
79
+ | `status` | Fast "am I ready to work" summary — auth, org, project, connection, table/key counts. |
80
+
81
+ Every command supports `-h`/`--help`.
82
+
83
+ ## `context` — the one command to start with
84
+
85
+ ```bash
86
+ axtrabase context
87
+ axtrabase context --json # the full payload, machine-readable
88
+ axtrabase context --agent # compact, purpose-built for a coding agent
89
+ ```
90
+
91
+ Human output: project, organisation, connection health, table counts,
92
+ enabled tables (with per-key access if you pass `--api-key <id>`), whether
93
+ a usable API key exists, and the SDK/REST entry points. `--agent` output
94
+ includes an explicit `axtrabase.rules` array (use the SDK, not Dataverse;
95
+ keep keys server-side; respect the `access` field; don't fabricate
96
+ unresolved metadata).
97
+
98
+ ## Exit codes
99
+
100
+ | Code | Meaning |
101
+ | ---- | -------------------------------------------------------------- |
102
+ | 0 | Success |
103
+ | 1 | Generic failure |
104
+ | 2 | Authentication required (not logged in, revoked/expired token) |
105
+ | 3 | Authorization denied |
106
+ | 4 | Not found |
107
+ | 5 | Connection not ready |
108
+ | 6 | Invalid arguments (including "no active project selected") |
109
+
110
+ `--json` mode returns `{ "error": { "code", "message", "requestId"? } }` on
111
+ failure and never mixes a printed error with exit code 0.
112
+
113
+ ## Environment variables
114
+
115
+ | Variable | Purpose |
116
+ | ------------------------- | -------------------------------------------------------------------------------------- |
117
+ | `AXTRABASE_CLI_TOKEN` | Bypasses `login`/the local credential file. Never persisted or logged. |
118
+ | `AXTRABASE_API_URL` | Overrides the API origin (below saved config, above the production default). |
119
+ | `AXTRABASE_DASHBOARD_URL` | Overrides where `login` sends you to generate a token. |
120
+ | `AXTRABASE_PROJECT` | Overrides the active project (below an explicit `--project` flag, above saved config). |
121
+ | `AXTRABASE_CONFIG_DIR` | Overrides `~/.config/axtrabase/` — mainly for tests/isolated environments. |
122
+
123
+ Precedence everywhere it applies: **explicit flag > environment variable >
124
+ saved config > production default.**
125
+
126
+ ## Full documentation
127
+
128
+ The complete command reference, agent integration guide, and error model
129
+ live in [`docs/cli.md`](https://github.com/erdhem/axtrabase/blob/main/docs/cli.md)
130
+ and [`docs/agents.md`](https://github.com/erdhem/axtrabase/blob/main/docs/agents.md).
@@ -0,0 +1,12 @@
1
+ import type { ControlPlaneClient } from "./http/client.js";
2
+ /**
3
+ * Every project-scoped command calls this first. Resolves --project flag >
4
+ * AXTRABASE_PROJECT > saved config (build brief §9/§26), then — since a
5
+ * value from any of those three sources may be a slug, not just an id
6
+ * saved by `projects use` — resolves a non-UUID value against the live
7
+ * project list before it's ever sent to a `:projectId` path param the
8
+ * server validates as a UUID. A clear, actionable error beats a confusing
9
+ * 404/400 deep inside a request (build brief §27).
10
+ */
11
+ export declare function resolveActiveProjectId(client: ControlPlaneClient, flagValue?: string): Promise<string>;
12
+ //# sourceMappingURL=active-project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-project.d.ts","sourceRoot":"","sources":["../src/active-project.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
@@ -0,0 +1,27 @@
1
+ import { resolveProjectId } from "./config/resolve.js";
2
+ import { CliError } from "./http/errors.js";
3
+ import { looksLikeUuid, resolveByIdOrSlug } from "./resolve-entity.js";
4
+ /**
5
+ * Every project-scoped command calls this first. Resolves --project flag >
6
+ * AXTRABASE_PROJECT > saved config (build brief §9/§26), then — since a
7
+ * value from any of those three sources may be a slug, not just an id
8
+ * saved by `projects use` — resolves a non-UUID value against the live
9
+ * project list before it's ever sent to a `:projectId` path param the
10
+ * server validates as a UUID. A clear, actionable error beats a confusing
11
+ * 404/400 deep inside a request (build brief §27).
12
+ */
13
+ export async function resolveActiveProjectId(client, flagValue) {
14
+ const projectId = resolveProjectId(flagValue);
15
+ if (!projectId) {
16
+ throw new CliError("AXTRA_CLI_NO_ACTIVE_PROJECT", "No active project.\n\nRun:\n axtrabase projects list\n axtrabase projects use <project>\n\nOr pass --project <id-or-slug> to this command.", { status: 0 });
17
+ }
18
+ if (looksLikeUuid(projectId))
19
+ return projectId;
20
+ const { data } = await client.get("/api/v1/projects");
21
+ const match = resolveByIdOrSlug(projectId, data);
22
+ if (!match) {
23
+ throw new CliError("AXTRA_CLI_NOT_FOUND", `No project matches "${projectId}" in the active organisation. Run \`axtrabase projects list\` to see what's available.`, { status: 0 });
24
+ }
25
+ return match.id;
26
+ }
27
+ //# sourceMappingURL=active-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-project.js","sourceRoot":"","sources":["../src/active-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAA0B,EAC1B,SAAkB;IAElB,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,QAAQ,CAChB,6BAA6B,EAC7B,8IAA8I,EAC9I,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAC;IACJ,CAAC;IACD,IAAI,aAAa,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAE/C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAmB,kBAAkB,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,QAAQ,CAChB,qBAAqB,EACrB,uBAAuB,SAAS,wFAAwF,EACxH,EAAE,MAAM,EAAE,CAAC,EAAE,CACd,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * Response shapes this CLI reads from AxtraBase's control plane — kept in
3
+ * sync with apps/api's route handlers by hand (same "interim technical
4
+ * debt" tradeoff @axtrabase/openapi's hand-authored spec makes, see that
5
+ * package's top comment) rather than generated. Extend this file as later
6
+ * phases add commands; do not duplicate a shape already defined here.
7
+ */
8
+ export interface MeResponse {
9
+ user: {
10
+ id: string;
11
+ name: string;
12
+ email: string;
13
+ };
14
+ organisation: {
15
+ id: string;
16
+ name: string;
17
+ };
18
+ platformRole: "AXTRABASE_ADMIN" | null;
19
+ }
20
+ export interface OrganisationSummary {
21
+ id: string;
22
+ name: string;
23
+ slug: string;
24
+ role: "owner" | "admin" | "member";
25
+ }
26
+ export interface ProjectSummary {
27
+ id: string;
28
+ name: string;
29
+ slug: string;
30
+ createdAt: string;
31
+ }
32
+ export interface DataverseConnectionResponse {
33
+ connectionId: string;
34
+ projectId: string;
35
+ mode: "axtrabase_managed" | "bring_your_own_app";
36
+ status: "PENDING" | "PROVISIONING" | "CONNECTED" | "DEGRADED" | "DISCONNECTED" | "REVOKED";
37
+ tenantId: string | null;
38
+ tenantDisplayName: string | null;
39
+ environmentUrl: string | null;
40
+ environmentId: string | null;
41
+ environmentDisplayName: string | null;
42
+ environmentType: string | null;
43
+ lastVerifiedAt: string | null;
44
+ }
45
+ export interface TableCatalogEntry {
46
+ logicalName: string;
47
+ entitySetName: string;
48
+ displayName: string;
49
+ isCustom: boolean;
50
+ primaryKey: string;
51
+ isEnabled: boolean;
52
+ permissions: {
53
+ read: boolean;
54
+ create: boolean;
55
+ update: boolean;
56
+ delete: boolean;
57
+ };
58
+ pendingDataverseSync: boolean;
59
+ }
60
+ export interface TableColumn {
61
+ logicalName: string;
62
+ schemaName: string | null;
63
+ displayName: string;
64
+ type: string;
65
+ rawAttributeType: string;
66
+ isPrimaryId: boolean;
67
+ isPrimaryName: boolean;
68
+ isRequired: boolean;
69
+ lookupTargets: string[] | null;
70
+ }
71
+ export interface TablePermissionRow {
72
+ apiKeyId: string;
73
+ apiKeyName: string;
74
+ apiKeyPrefix: string;
75
+ canRead: boolean;
76
+ canCreate: boolean;
77
+ canUpdate: boolean;
78
+ canDelete: boolean;
79
+ }
80
+ export interface TableMetadataResponse {
81
+ logicalName: string;
82
+ schemaName: string | null;
83
+ entitySetName: string;
84
+ displayName: string;
85
+ primaryIdAttribute: string;
86
+ primaryNameAttribute: string | null;
87
+ isCustomEntity: boolean;
88
+ columns: TableColumn[];
89
+ permissions: TablePermissionRow[];
90
+ }
91
+ export type MetadataResolution = "resolved" | "partial" | "unresolved";
92
+ export interface ApiKeySummary {
93
+ id: string;
94
+ name: string;
95
+ prefix: string;
96
+ environment: "live" | "test";
97
+ lastUsedAt: string | null;
98
+ revokedAt: string | null;
99
+ createdAt: string;
100
+ }
101
+ export interface CreatedApiKey extends ApiKeySummary {
102
+ /** Present exactly once, in the response to the create call — never retrievable again. */
103
+ rawKey: string;
104
+ }
105
+ export interface TablePermissionRowFlat {
106
+ table: string;
107
+ isEnabled: boolean;
108
+ apiKeyId: string;
109
+ canRead: boolean;
110
+ canCreate: boolean;
111
+ canUpdate: boolean;
112
+ canDelete: boolean;
113
+ }
114
+ export interface RequestLogRow {
115
+ id: string;
116
+ requestId: string;
117
+ method: string;
118
+ path: string;
119
+ tableLogicalName: string | null;
120
+ recordId: string | null;
121
+ statusCode: number;
122
+ errorCode: string | null;
123
+ durationMs: number;
124
+ dataverseDurationMs: number | null;
125
+ retryCount: number;
126
+ client: string | null;
127
+ apiKeyId: string | null;
128
+ connectionId: string | null;
129
+ createdAt: string;
130
+ }
131
+ export interface ProjectContextResponse {
132
+ project: {
133
+ id: string;
134
+ name: string;
135
+ slug: string;
136
+ };
137
+ organisation: {
138
+ id: string;
139
+ name: string;
140
+ } | null;
141
+ connection: {
142
+ mode: string;
143
+ status: string;
144
+ tenantId: string | null;
145
+ environmentUrl: string | null;
146
+ lastVerifiedAt: string | null;
147
+ } | null;
148
+ /**
149
+ * `access` is *effective* access, not desired configuration — computed
150
+ * server-side from the same predicate that gates real data-plane requests
151
+ * (apps/api/src/table-access.ts's `isTableActionGranted`). A permission
152
+ * that's granted but not yet confirmed synced to Dataverse reports
153
+ * "----", never the requested CRUD flags. `null` means no `apiKeyId` was
154
+ * given at all (not evaluated); once one is given, every table gets a
155
+ * real "RCUD"-shorthand string, including an explicit "----" for zero
156
+ * access — never `null` for "we don't know."
157
+ */
158
+ tables: Array<{
159
+ logicalName: string;
160
+ displayName: string;
161
+ access: string | null;
162
+ }>;
163
+ tableCounts: {
164
+ available: number;
165
+ custom: number;
166
+ enabled: number;
167
+ };
168
+ tablesUnavailableReason: string | null;
169
+ apiKeys: Array<{
170
+ id: string;
171
+ name: string;
172
+ prefix: string;
173
+ }>;
174
+ metadataCapabilities: {
175
+ columns: MetadataResolution;
176
+ relationships: MetadataResolution;
177
+ choiceDefinitions: MetadataResolution;
178
+ choiceValues: MetadataResolution;
179
+ };
180
+ sdk: {
181
+ package: string;
182
+ };
183
+ api: {
184
+ tablesBasePath: string;
185
+ };
186
+ }
187
+ //# sourceMappingURL=api-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-types.d.ts","sourceRoot":"","sources":["../src/api-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,YAAY,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE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AM,GAAG,IAAI,CAAC;QACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,GAAG,IAAI,CAAC;IACT;;;;;;;;;OASG;IACH,MAAM,EAAE,KAAK,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACnF,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,oBAAoB,EAAE;QACpB,OAAO,EAAE,kBAAkB,CAAC;QAC5B,aAAa,EAAE,kBAAkB,CAAC;QAClC,iBAAiB,EAAE,kBAAkB,CAAC;QACtC,YAAY,EAAE,kBAAkB,CAAC;KAClC,CAAC;IACF,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,GAAG,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Response shapes this CLI reads from AxtraBase's control plane — kept in
3
+ * sync with apps/api's route handlers by hand (same "interim technical
4
+ * debt" tradeoff @axtrabase/openapi's hand-authored spec makes, see that
5
+ * package's top comment) rather than generated. Extend this file as later
6
+ * phases add commands; do not duplicate a shape already defined here.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=api-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-types.js","sourceRoot":"","sources":["../src/api-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerConfigCommand(program: Command): void;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgCzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkF5D"}
@@ -0,0 +1,98 @@
1
+ import { ConfigStore } from "../config/store.js";
2
+ import { CliError } from "../http/errors.js";
3
+ import { printJson, printLine } from "../output/print.js";
4
+ import { runWithErrorHandling } from "../report-error.js";
5
+ /** kebab-case (what a user types) <-> the CliConfig field it maps to. Deliberately a closed list — config set never accepts an arbitrary key (build brief §25: "do not allow arbitrary secret storage through generic config"). */
6
+ const KEY_ALIASES = {
7
+ "api-url": "apiUrl",
8
+ "dashboard-url": "dashboardUrl",
9
+ organisation: "organisationId",
10
+ org: "organisationId",
11
+ project: "projectId"
12
+ };
13
+ function resolveKey(input) {
14
+ const key = KEY_ALIASES[input];
15
+ if (!key) {
16
+ throw new CliError("AXTRA_CLI_VALIDATION_ERROR", `Unknown config key "${input}". Valid keys: ${Object.keys(KEY_ALIASES).join(", ")}.`, { status: 0 });
17
+ }
18
+ return key;
19
+ }
20
+ export function registerConfigCommand(program) {
21
+ const config = program.command("config").description("Inspect or change local CLI configuration");
22
+ config
23
+ .command("list")
24
+ .description("Show every configured value")
25
+ .action(async function () {
26
+ const options = this.optsWithGlobals();
27
+ await runWithErrorHandling(async () => {
28
+ const values = new ConfigStore().read();
29
+ if (options.json) {
30
+ printJson(values);
31
+ return;
32
+ }
33
+ const lines = [];
34
+ if (values.apiUrl)
35
+ lines.push(`api-url: ${values.apiUrl}`);
36
+ if (values.dashboardUrl)
37
+ lines.push(`dashboard-url: ${values.dashboardUrl}`);
38
+ if (values.organisationId) {
39
+ lines.push(`organisation: ${values.organisationSlug ?? values.organisationId} (${values.organisationId})`);
40
+ }
41
+ if (values.projectId) {
42
+ lines.push(`project: ${values.projectSlug ?? values.projectId} (${values.projectId})`);
43
+ }
44
+ if (lines.length === 0) {
45
+ printLine("No config set.");
46
+ return;
47
+ }
48
+ for (const line of lines)
49
+ printLine(line);
50
+ }, options);
51
+ });
52
+ config
53
+ .command("get <key>")
54
+ .description("Show one config value (api-url, dashboard-url, organisation, project)")
55
+ .action(async function (key, _opts, command) {
56
+ const options = command.optsWithGlobals();
57
+ await runWithErrorHandling(async () => {
58
+ const field = resolveKey(key);
59
+ const value = new ConfigStore().read()[field];
60
+ if (options.json) {
61
+ printJson({ [key]: value ?? null });
62
+ return;
63
+ }
64
+ printLine(value ?? "(not set)");
65
+ }, options);
66
+ });
67
+ config
68
+ .command("set <key> <value>")
69
+ .description("Set one config value")
70
+ .action(async function (key, value, _opts, command) {
71
+ const options = command.optsWithGlobals();
72
+ await runWithErrorHandling(async () => {
73
+ const field = resolveKey(key);
74
+ new ConfigStore().update({ [field]: value });
75
+ if (options.json) {
76
+ printJson({ [key]: value });
77
+ return;
78
+ }
79
+ printLine(`${key} = ${value}`);
80
+ }, options);
81
+ });
82
+ config
83
+ .command("unset <key>")
84
+ .description("Remove one config value, reverting it to the default")
85
+ .action(async function (key, _opts, command) {
86
+ const options = command.optsWithGlobals();
87
+ await runWithErrorHandling(async () => {
88
+ const field = resolveKey(key);
89
+ new ConfigStore().unset(field);
90
+ if (options.json) {
91
+ printJson({ [key]: null });
92
+ return;
93
+ }
94
+ printLine(`${key} unset.`);
95
+ }, options);
96
+ });
97
+ }
98
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;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CAAC;gBACjB,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC3B,OAAO;YACT,CAAC;YACD,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;QAC7B,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerConnectionCommand(program: Command): void;
3
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/commands/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAczC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsBhE"}
@@ -0,0 +1,58 @@
1
+ import { resolveActiveProjectId } from "../active-project.js";
2
+ import { requireControlPlaneClient } from "../http/authenticated-client.js";
3
+ import { printJson, printKeyValueBlock, printLine } from "../output/print.js";
4
+ import { runWithErrorHandling } from "../report-error.js";
5
+ export function registerConnectionCommand(program) {
6
+ const connection = program
7
+ .command("connection")
8
+ .description("Inspect the active project's Dataverse connection");
9
+ connection
10
+ .command("status")
11
+ .description("Show connection mode, status, and environment")
12
+ .option("--project <project>", "override the active project (id or slug)")
13
+ .action(async function () {
14
+ const options = this.optsWithGlobals();
15
+ await runWithErrorHandling(() => runStatus(options), options);
16
+ });
17
+ connection
18
+ .command("verify")
19
+ .description("Re-verify the connection is actually usable (WhoAmI + read checks)")
20
+ .option("--project <project>", "override the active project (id or slug)")
21
+ .action(async function () {
22
+ const options = this.optsWithGlobals();
23
+ await runWithErrorHandling(() => runVerify(options), options);
24
+ });
25
+ }
26
+ function printConnection(connection) {
27
+ printKeyValueBlock([
28
+ ["Project", connection.projectId],
29
+ ["Connection mode", connection.mode],
30
+ ["Status", connection.status],
31
+ ["Tenant", connection.tenantDisplayName ?? connection.tenantId ?? "—"],
32
+ ["Environment", connection.environmentDisplayName ?? connection.environmentUrl ?? "—"],
33
+ ["Environment type", connection.environmentType ?? "—"],
34
+ ["Last verified", connection.lastVerifiedAt ?? "never"]
35
+ ]);
36
+ }
37
+ async function runStatus(options) {
38
+ const client = requireControlPlaneClient({ apiUrl: options.apiUrl });
39
+ const projectId = await resolveActiveProjectId(client, options.project);
40
+ const { data } = await client.get(`/api/v1/projects/${projectId}/dataverse-connection`);
41
+ if (options.json) {
42
+ printJson(data);
43
+ return;
44
+ }
45
+ printConnection(data);
46
+ }
47
+ async function runVerify(options) {
48
+ const client = requireControlPlaneClient({ apiUrl: options.apiUrl });
49
+ const projectId = await resolveActiveProjectId(client, options.project);
50
+ const { data } = await client.post(`/api/v1/projects/${projectId}/dataverse-connection/verify`);
51
+ if (options.json) {
52
+ printJson(data);
53
+ return;
54
+ }
55
+ printLine(`Status: ${data.status}`);
56
+ printLine(`Last verified: ${data.lastVerifiedAt}`);
57
+ }
58
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/commands/connection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAS1D,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,UAAU,GAAG,OAAO;SACvB,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,mDAAmD,CAAC,CAAC;IAEpE,UAAU;SACP,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+CAA+C,CAAC;SAC5D,MAAM,CAAC,qBAAqB,EAAE,0CAA0C,CA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AM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAC/B,oBAAoB,SAAS,uBAAuB,CACrD,CAAC;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO;IACT,CAAC;IACD,eAAe,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,OAA0B;IACjD,MAAM,MAAM,GAAG,yBAAyB,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAK/B,oBAAoB,SAAS,8BAA8B,CAAC,CAAC;IAEhE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,OAAO;IACT,CAAC;IACD,SAAS,CAAC,WAAW,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACpC,SAAS,CAAC,kBAAkB,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerContextCommand(program: Command): void;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/commands/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAW7D"}