@lightdash-tools/cli 0.2.5 → 0.2.6
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 +2 -2
- package/dist/commands/space-access.d.ts +8 -0
- package/dist/commands/space-access.js +94 -0
- package/dist/index.js +4 -2
- package/dist/index.test.js +6 -2
- package/package.json +3 -3
- package/src/commands/space-access.ts +126 -0
- package/src/index.test.ts +6 -2
- package/src/index.ts +4 -2
package/README.md
CHANGED
|
@@ -155,9 +155,9 @@ The CLI implements a hierarchical safety model to prevent accidental destructive
|
|
|
155
155
|
|
|
156
156
|
You can control the safety mode via the `LIGHTDASH_TOOL_SAFETY_MODE` environment variable or the global `--safety-mode` flag.
|
|
157
157
|
|
|
158
|
-
- `read-only
|
|
158
|
+
- `read-only` (default): Only allows non-modifying operations (e.g., list, get).
|
|
159
159
|
- `write-idempotent`: Allows read operations and non-destructive writes (e.g., upsert, validate run).
|
|
160
|
-
- `write-destructive
|
|
160
|
+
- `write-destructive`: Allows all operations, including deletions.
|
|
161
161
|
|
|
162
162
|
### Enforcement
|
|
163
163
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Space access (v1) command implementation.
|
|
3
|
+
*/
|
|
4
|
+
import type { Command } from 'commander';
|
|
5
|
+
/**
|
|
6
|
+
* Registers the space access subcommands under the existing projects command.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerSpaceAccessCommand(program: Command): void;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Space access (v1) command implementation.
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.registerSpaceAccessCommand = registerSpaceAccessCommand;
|
|
16
|
+
const common_1 = require("@lightdash-tools/common");
|
|
17
|
+
const client_1 = require("../utils/client");
|
|
18
|
+
const safety_1 = require("../utils/safety");
|
|
19
|
+
/**
|
|
20
|
+
* Registers the space access subcommands under the existing projects command.
|
|
21
|
+
*/
|
|
22
|
+
function registerSpaceAccessCommand(program) {
|
|
23
|
+
const projectsCmd = program.commands.find((c) => c.name() === 'projects');
|
|
24
|
+
if (!projectsCmd) {
|
|
25
|
+
throw new Error('projects command must be registered before space-access');
|
|
26
|
+
}
|
|
27
|
+
const spaceAccessCmd = projectsCmd
|
|
28
|
+
.command('space-access')
|
|
29
|
+
.description('Manage space access (v1)');
|
|
30
|
+
const userCmd = spaceAccessCmd.command('user').description('Manage user access to a space');
|
|
31
|
+
userCmd
|
|
32
|
+
.command('grant <projectUuid> <spaceUuid> <userUuid> <role>')
|
|
33
|
+
.description('Grant a user access to a space')
|
|
34
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (projectUuid, spaceUuid, userUuid, role) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
try {
|
|
36
|
+
const client = (0, client_1.getClient)();
|
|
37
|
+
yield client.v1.spaces.grantUserAccessToSpace(projectUuid, spaceUuid, {
|
|
38
|
+
userUuid,
|
|
39
|
+
spaceRole: role,
|
|
40
|
+
});
|
|
41
|
+
console.error(`Successfully granted ${role} access to user ${userUuid} in space ${spaceUuid}`);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error('Error granting user access to space:', error instanceof Error ? error.message : String(error));
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
})));
|
|
48
|
+
userCmd
|
|
49
|
+
.command('revoke <projectUuid> <spaceUuid> <userUuid>')
|
|
50
|
+
.description("Revoke a user's access to a space")
|
|
51
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, (projectUuid, spaceUuid, userUuid) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
try {
|
|
53
|
+
const client = (0, client_1.getClient)();
|
|
54
|
+
yield client.v1.spaces.revokeUserAccessToSpace(projectUuid, spaceUuid, userUuid);
|
|
55
|
+
console.error(`Successfully revoked access for user ${userUuid} in space ${spaceUuid}`);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error('Error revoking user access from space:', error instanceof Error ? error.message : String(error));
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
})));
|
|
62
|
+
const groupCmd = spaceAccessCmd.command('group').description('Manage group access to a space');
|
|
63
|
+
groupCmd
|
|
64
|
+
.command('grant <projectUuid> <spaceUuid> <groupUuid> <role>')
|
|
65
|
+
.description('Grant a group access to a space')
|
|
66
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_IDEMPOTENT, (projectUuid, spaceUuid, groupUuid, role) => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
const client = (0, client_1.getClient)();
|
|
69
|
+
yield client.v1.spaces.grantGroupAccessToSpace(projectUuid, spaceUuid, {
|
|
70
|
+
groupUuid,
|
|
71
|
+
spaceRole: role,
|
|
72
|
+
});
|
|
73
|
+
console.error(`Successfully granted ${role} access to group ${groupUuid} in space ${spaceUuid}`);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error('Error granting group access to space:', error instanceof Error ? error.message : String(error));
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
})));
|
|
80
|
+
groupCmd
|
|
81
|
+
.command('revoke <projectUuid> <spaceUuid> <groupUuid>')
|
|
82
|
+
.description("Revoke a group's access to a space")
|
|
83
|
+
.action((0, safety_1.wrapAction)(common_1.WRITE_DESTRUCTIVE, (projectUuid, spaceUuid, groupUuid) => __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
try {
|
|
85
|
+
const client = (0, client_1.getClient)();
|
|
86
|
+
yield client.v1.spaces.revokeGroupAccessToSpace(projectUuid, spaceUuid, groupUuid);
|
|
87
|
+
console.error(`Successfully revoked access for group ${groupUuid} in space ${spaceUuid}`);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Error revoking group access from space:', error instanceof Error ? error.message : String(error));
|
|
91
|
+
process.exit(1);
|
|
92
|
+
}
|
|
93
|
+
})));
|
|
94
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const projects_1 = require("./commands/projects");
|
|
|
11
11
|
const project_role_assignments_1 = require("./commands/project-role-assignments");
|
|
12
12
|
const project_access_1 = require("./commands/project-access");
|
|
13
13
|
const spaces_1 = require("./commands/spaces");
|
|
14
|
+
const space_access_1 = require("./commands/space-access");
|
|
14
15
|
const charts_1 = require("./commands/charts");
|
|
15
16
|
const dashboards_1 = require("./commands/dashboards");
|
|
16
17
|
const ai_agents_1 = require("./commands/ai-agents");
|
|
@@ -26,8 +27,8 @@ const program = new commander_1.Command();
|
|
|
26
27
|
program
|
|
27
28
|
.name('lightdash-ai')
|
|
28
29
|
.description('CLI for Lightdash AI')
|
|
29
|
-
.version('
|
|
30
|
-
.option('--safety-mode <mode>', 'Safety mode (read-only, write-idempotent, write-destructive)', '
|
|
30
|
+
.version('0.2.6')
|
|
31
|
+
.option('--safety-mode <mode>', 'Safety mode (read-only, write-idempotent, write-destructive)', 'read-only');
|
|
31
32
|
// Register all commands (organization and projects first so subcommands can attach)
|
|
32
33
|
(0, organization_1.registerOrganizationCommand)(program);
|
|
33
34
|
(0, organization_roles_1.registerOrganizationRolesCommand)(program);
|
|
@@ -35,6 +36,7 @@ program
|
|
|
35
36
|
(0, project_role_assignments_1.registerProjectRoleAssignmentsCommand)(program);
|
|
36
37
|
(0, project_access_1.registerProjectAccessCommand)(program);
|
|
37
38
|
(0, spaces_1.registerSpacesCommand)(program);
|
|
39
|
+
(0, space_access_1.registerSpaceAccessCommand)(program);
|
|
38
40
|
(0, charts_1.registerChartsCommand)(program);
|
|
39
41
|
(0, dashboards_1.registerDashboardsCommand)(program);
|
|
40
42
|
(0, ai_agents_1.registerAiAgentsCommand)(program);
|
package/dist/index.test.js
CHANGED
|
@@ -8,6 +8,7 @@ const projects_1 = require("./commands/projects");
|
|
|
8
8
|
const project_role_assignments_1 = require("./commands/project-role-assignments");
|
|
9
9
|
const project_access_1 = require("./commands/project-access");
|
|
10
10
|
const spaces_1 = require("./commands/spaces");
|
|
11
|
+
const space_access_1 = require("./commands/space-access");
|
|
11
12
|
const charts_1 = require("./commands/charts");
|
|
12
13
|
const dashboards_1 = require("./commands/dashboards");
|
|
13
14
|
const ai_agents_1 = require("./commands/ai-agents");
|
|
@@ -96,16 +97,18 @@ const explores_1 = require("./commands/explores");
|
|
|
96
97
|
(0, vitest_1.expect)(rolesCmd === null || rolesCmd === void 0 ? void 0 : rolesCmd.commands.some((c) => c.name() === 'get')).toBe(true);
|
|
97
98
|
(0, vitest_1.expect)(rolesCmd === null || rolesCmd === void 0 ? void 0 : rolesCmd.commands.some((c) => c.name() === 'assign')).toBe(true);
|
|
98
99
|
});
|
|
99
|
-
(0, vitest_1.it)('should register projects roles, access, spaces subcommands', () => {
|
|
100
|
+
(0, vitest_1.it)('should register projects roles, access, spaces, and space-access subcommands', () => {
|
|
100
101
|
const program = new commander_1.Command();
|
|
101
102
|
(0, projects_1.registerProjectsCommand)(program);
|
|
102
103
|
(0, project_role_assignments_1.registerProjectRoleAssignmentsCommand)(program);
|
|
103
104
|
(0, project_access_1.registerProjectAccessCommand)(program);
|
|
104
105
|
(0, spaces_1.registerSpacesCommand)(program);
|
|
106
|
+
(0, space_access_1.registerSpaceAccessCommand)(program);
|
|
105
107
|
const projectsCmd = program.commands.find((cmd) => cmd.name() === 'projects');
|
|
106
108
|
(0, vitest_1.expect)(projectsCmd === null || projectsCmd === void 0 ? void 0 : projectsCmd.commands.some((c) => c.name() === 'roles')).toBe(true);
|
|
107
109
|
(0, vitest_1.expect)(projectsCmd === null || projectsCmd === void 0 ? void 0 : projectsCmd.commands.some((c) => c.name() === 'access')).toBe(true);
|
|
108
110
|
(0, vitest_1.expect)(projectsCmd === null || projectsCmd === void 0 ? void 0 : projectsCmd.commands.some((c) => c.name() === 'spaces')).toBe(true);
|
|
111
|
+
(0, vitest_1.expect)(projectsCmd === null || projectsCmd === void 0 ? void 0 : projectsCmd.commands.some((c) => c.name() === 'space-access')).toBe(true);
|
|
109
112
|
});
|
|
110
113
|
(0, vitest_1.it)('should register projects charts and dashboards subcommands', () => {
|
|
111
114
|
const program = new commander_1.Command();
|
|
@@ -155,6 +158,7 @@ const explores_1 = require("./commands/explores");
|
|
|
155
158
|
(0, project_role_assignments_1.registerProjectRoleAssignmentsCommand)(program);
|
|
156
159
|
(0, project_access_1.registerProjectAccessCommand)(program);
|
|
157
160
|
(0, spaces_1.registerSpacesCommand)(program);
|
|
161
|
+
(0, space_access_1.registerSpaceAccessCommand)(program);
|
|
158
162
|
(0, charts_1.registerChartsCommand)(program);
|
|
159
163
|
(0, dashboards_1.registerDashboardsCommand)(program);
|
|
160
164
|
(0, ai_agents_1.registerAiAgentsCommand)(program);
|
|
@@ -172,7 +176,7 @@ const explores_1 = require("./commands/explores");
|
|
|
172
176
|
});
|
|
173
177
|
(0, vitest_1.it)('should have --safety-mode option', () => {
|
|
174
178
|
const program = new commander_1.Command();
|
|
175
|
-
program.option('--safety-mode <mode>', 'description', '
|
|
179
|
+
program.option('--safety-mode <mode>', 'description', 'read-only');
|
|
176
180
|
const option = program.options.find((opt) => opt.long === '--safety-mode');
|
|
177
181
|
(0, vitest_1.expect)(option).toBeDefined();
|
|
178
182
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash-tools/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "CLI for Lightdash AI.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"commander": "^14.0.3",
|
|
15
|
-
"@lightdash-tools/client": "0.2.
|
|
16
|
-
"@lightdash-tools/common": "0.2.
|
|
15
|
+
"@lightdash-tools/client": "0.2.6",
|
|
16
|
+
"@lightdash-tools/common": "0.2.6"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/node": "^25.2.3"
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Space access (v1) command implementation.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Command } from 'commander';
|
|
6
|
+
import { WRITE_IDEMPOTENT, WRITE_DESTRUCTIVE, type SpaceMemberRole } from '@lightdash-tools/common';
|
|
7
|
+
import { getClient } from '../utils/client';
|
|
8
|
+
import { wrapAction } from '../utils/safety';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Registers the space access subcommands under the existing projects command.
|
|
12
|
+
*/
|
|
13
|
+
export function registerSpaceAccessCommand(program: Command): void {
|
|
14
|
+
const projectsCmd = program.commands.find((c) => c.name() === 'projects');
|
|
15
|
+
if (!projectsCmd) {
|
|
16
|
+
throw new Error('projects command must be registered before space-access');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const spaceAccessCmd = projectsCmd
|
|
20
|
+
.command('space-access')
|
|
21
|
+
.description('Manage space access (v1)');
|
|
22
|
+
|
|
23
|
+
const userCmd = spaceAccessCmd.command('user').description('Manage user access to a space');
|
|
24
|
+
|
|
25
|
+
userCmd
|
|
26
|
+
.command('grant <projectUuid> <spaceUuid> <userUuid> <role>')
|
|
27
|
+
.description('Grant a user access to a space')
|
|
28
|
+
.action(
|
|
29
|
+
wrapAction(
|
|
30
|
+
WRITE_IDEMPOTENT,
|
|
31
|
+
async (projectUuid: string, spaceUuid: string, userUuid: string, role: string) => {
|
|
32
|
+
try {
|
|
33
|
+
const client = getClient();
|
|
34
|
+
await client.v1.spaces.grantUserAccessToSpace(projectUuid, spaceUuid, {
|
|
35
|
+
userUuid,
|
|
36
|
+
spaceRole: role as SpaceMemberRole,
|
|
37
|
+
});
|
|
38
|
+
console.error(
|
|
39
|
+
`Successfully granted ${role} access to user ${userUuid} in space ${spaceUuid}`,
|
|
40
|
+
);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(
|
|
43
|
+
'Error granting user access to space:',
|
|
44
|
+
error instanceof Error ? error.message : String(error),
|
|
45
|
+
);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
userCmd
|
|
53
|
+
.command('revoke <projectUuid> <spaceUuid> <userUuid>')
|
|
54
|
+
.description("Revoke a user's access to a space")
|
|
55
|
+
.action(
|
|
56
|
+
wrapAction(
|
|
57
|
+
WRITE_DESTRUCTIVE,
|
|
58
|
+
async (projectUuid: string, spaceUuid: string, userUuid: string) => {
|
|
59
|
+
try {
|
|
60
|
+
const client = getClient();
|
|
61
|
+
await client.v1.spaces.revokeUserAccessToSpace(projectUuid, spaceUuid, userUuid);
|
|
62
|
+
console.error(`Successfully revoked access for user ${userUuid} in space ${spaceUuid}`);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.error(
|
|
65
|
+
'Error revoking user access from space:',
|
|
66
|
+
error instanceof Error ? error.message : String(error),
|
|
67
|
+
);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const groupCmd = spaceAccessCmd.command('group').description('Manage group access to a space');
|
|
75
|
+
|
|
76
|
+
groupCmd
|
|
77
|
+
.command('grant <projectUuid> <spaceUuid> <groupUuid> <role>')
|
|
78
|
+
.description('Grant a group access to a space')
|
|
79
|
+
.action(
|
|
80
|
+
wrapAction(
|
|
81
|
+
WRITE_IDEMPOTENT,
|
|
82
|
+
async (projectUuid: string, spaceUuid: string, groupUuid: string, role: string) => {
|
|
83
|
+
try {
|
|
84
|
+
const client = getClient();
|
|
85
|
+
await client.v1.spaces.grantGroupAccessToSpace(projectUuid, spaceUuid, {
|
|
86
|
+
groupUuid,
|
|
87
|
+
spaceRole: role as SpaceMemberRole,
|
|
88
|
+
});
|
|
89
|
+
console.error(
|
|
90
|
+
`Successfully granted ${role} access to group ${groupUuid} in space ${spaceUuid}`,
|
|
91
|
+
);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error(
|
|
94
|
+
'Error granting group access to space:',
|
|
95
|
+
error instanceof Error ? error.message : String(error),
|
|
96
|
+
);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
groupCmd
|
|
104
|
+
.command('revoke <projectUuid> <spaceUuid> <groupUuid>')
|
|
105
|
+
.description("Revoke a group's access to a space")
|
|
106
|
+
.action(
|
|
107
|
+
wrapAction(
|
|
108
|
+
WRITE_DESTRUCTIVE,
|
|
109
|
+
async (projectUuid: string, spaceUuid: string, groupUuid: string) => {
|
|
110
|
+
try {
|
|
111
|
+
const client = getClient();
|
|
112
|
+
await client.v1.spaces.revokeGroupAccessToSpace(projectUuid, spaceUuid, groupUuid);
|
|
113
|
+
console.error(
|
|
114
|
+
`Successfully revoked access for group ${groupUuid} in space ${spaceUuid}`,
|
|
115
|
+
);
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error(
|
|
118
|
+
'Error revoking group access from space:',
|
|
119
|
+
error instanceof Error ? error.message : String(error),
|
|
120
|
+
);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
}
|
package/src/index.test.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { registerProjectsCommand } from './commands/projects';
|
|
|
6
6
|
import { registerProjectRoleAssignmentsCommand } from './commands/project-role-assignments';
|
|
7
7
|
import { registerProjectAccessCommand } from './commands/project-access';
|
|
8
8
|
import { registerSpacesCommand } from './commands/spaces';
|
|
9
|
+
import { registerSpaceAccessCommand } from './commands/space-access';
|
|
9
10
|
import { registerChartsCommand } from './commands/charts';
|
|
10
11
|
import { registerDashboardsCommand } from './commands/dashboards';
|
|
11
12
|
import { registerAiAgentsCommand } from './commands/ai-agents';
|
|
@@ -125,17 +126,19 @@ describe('CLI Command Registration', () => {
|
|
|
125
126
|
expect(rolesCmd?.commands.some((c) => c.name() === 'assign')).toBe(true);
|
|
126
127
|
});
|
|
127
128
|
|
|
128
|
-
it('should register projects roles, access, spaces subcommands', () => {
|
|
129
|
+
it('should register projects roles, access, spaces, and space-access subcommands', () => {
|
|
129
130
|
const program = new Command();
|
|
130
131
|
registerProjectsCommand(program);
|
|
131
132
|
registerProjectRoleAssignmentsCommand(program);
|
|
132
133
|
registerProjectAccessCommand(program);
|
|
133
134
|
registerSpacesCommand(program);
|
|
135
|
+
registerSpaceAccessCommand(program);
|
|
134
136
|
|
|
135
137
|
const projectsCmd = program.commands.find((cmd) => cmd.name() === 'projects');
|
|
136
138
|
expect(projectsCmd?.commands.some((c) => c.name() === 'roles')).toBe(true);
|
|
137
139
|
expect(projectsCmd?.commands.some((c) => c.name() === 'access')).toBe(true);
|
|
138
140
|
expect(projectsCmd?.commands.some((c) => c.name() === 'spaces')).toBe(true);
|
|
141
|
+
expect(projectsCmd?.commands.some((c) => c.name() === 'space-access')).toBe(true);
|
|
139
142
|
});
|
|
140
143
|
|
|
141
144
|
it('should register projects charts and dashboards subcommands', () => {
|
|
@@ -194,6 +197,7 @@ describe('CLI Command Registration', () => {
|
|
|
194
197
|
registerProjectRoleAssignmentsCommand(program);
|
|
195
198
|
registerProjectAccessCommand(program);
|
|
196
199
|
registerSpacesCommand(program);
|
|
200
|
+
registerSpaceAccessCommand(program);
|
|
197
201
|
registerChartsCommand(program);
|
|
198
202
|
registerDashboardsCommand(program);
|
|
199
203
|
registerAiAgentsCommand(program);
|
|
@@ -213,7 +217,7 @@ describe('CLI Command Registration', () => {
|
|
|
213
217
|
|
|
214
218
|
it('should have --safety-mode option', () => {
|
|
215
219
|
const program = new Command();
|
|
216
|
-
program.option('--safety-mode <mode>', 'description', '
|
|
220
|
+
program.option('--safety-mode <mode>', 'description', 'read-only');
|
|
217
221
|
const option = program.options.find((opt) => opt.long === '--safety-mode');
|
|
218
222
|
expect(option).toBeDefined();
|
|
219
223
|
});
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { registerProjectsCommand } from './commands/projects';
|
|
|
10
10
|
import { registerProjectRoleAssignmentsCommand } from './commands/project-role-assignments';
|
|
11
11
|
import { registerProjectAccessCommand } from './commands/project-access';
|
|
12
12
|
import { registerSpacesCommand } from './commands/spaces';
|
|
13
|
+
import { registerSpaceAccessCommand } from './commands/space-access';
|
|
13
14
|
import { registerChartsCommand } from './commands/charts';
|
|
14
15
|
import { registerDashboardsCommand } from './commands/dashboards';
|
|
15
16
|
import { registerAiAgentsCommand } from './commands/ai-agents';
|
|
@@ -27,11 +28,11 @@ const program = new Command();
|
|
|
27
28
|
program
|
|
28
29
|
.name('lightdash-ai')
|
|
29
30
|
.description('CLI for Lightdash AI')
|
|
30
|
-
.version('
|
|
31
|
+
.version('0.2.6')
|
|
31
32
|
.option(
|
|
32
33
|
'--safety-mode <mode>',
|
|
33
34
|
'Safety mode (read-only, write-idempotent, write-destructive)',
|
|
34
|
-
'
|
|
35
|
+
'read-only',
|
|
35
36
|
);
|
|
36
37
|
|
|
37
38
|
// Register all commands (organization and projects first so subcommands can attach)
|
|
@@ -41,6 +42,7 @@ registerProjectsCommand(program);
|
|
|
41
42
|
registerProjectRoleAssignmentsCommand(program);
|
|
42
43
|
registerProjectAccessCommand(program);
|
|
43
44
|
registerSpacesCommand(program);
|
|
45
|
+
registerSpaceAccessCommand(program);
|
|
44
46
|
registerChartsCommand(program);
|
|
45
47
|
registerDashboardsCommand(program);
|
|
46
48
|
registerAiAgentsCommand(program);
|