figmanage 1.0.1 → 1.2.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 (98) hide show
  1. package/README.md +74 -59
  2. package/dist/cli/analytics.d.ts +3 -0
  3. package/dist/cli/analytics.js +48 -0
  4. package/dist/cli/branching.d.ts +3 -0
  5. package/dist/cli/branching.js +56 -0
  6. package/dist/cli/comments.d.ts +3 -0
  7. package/dist/cli/comments.js +86 -0
  8. package/dist/cli/completion.d.ts +7 -0
  9. package/dist/cli/completion.js +160 -0
  10. package/dist/cli/components.d.ts +3 -0
  11. package/dist/cli/components.js +82 -0
  12. package/dist/cli/compound-commands.d.ts +14 -0
  13. package/dist/cli/compound-commands.js +291 -0
  14. package/dist/cli/export.d.ts +3 -0
  15. package/dist/cli/export.js +51 -0
  16. package/dist/cli/files.d.ts +3 -0
  17. package/dist/cli/files.js +156 -0
  18. package/dist/cli/format.js +147 -2
  19. package/dist/cli/helpers.d.ts +7 -0
  20. package/dist/cli/helpers.js +43 -0
  21. package/dist/cli/index.js +68 -89
  22. package/dist/cli/libraries.d.ts +3 -0
  23. package/dist/cli/libraries.js +26 -0
  24. package/dist/cli/navigate.d.ts +3 -0
  25. package/dist/cli/navigate.js +192 -0
  26. package/dist/cli/org.d.ts +3 -0
  27. package/dist/cli/org.js +227 -0
  28. package/dist/cli/permissions.d.ts +3 -0
  29. package/dist/cli/permissions.js +133 -0
  30. package/dist/cli/projects.d.ts +3 -0
  31. package/dist/cli/projects.js +110 -0
  32. package/dist/cli/reading.d.ts +3 -0
  33. package/dist/cli/reading.js +51 -0
  34. package/dist/cli/teams.d.ts +3 -0
  35. package/dist/cli/teams.js +56 -0
  36. package/dist/cli/variables.d.ts +3 -0
  37. package/dist/cli/variables.js +80 -0
  38. package/dist/cli/versions.d.ts +3 -0
  39. package/dist/cli/versions.js +46 -0
  40. package/dist/cli/webhooks.d.ts +3 -0
  41. package/dist/cli/webhooks.js +100 -0
  42. package/dist/operations/analytics.d.ts +10 -0
  43. package/dist/operations/analytics.js +15 -0
  44. package/dist/operations/branching.d.ts +24 -0
  45. package/dist/operations/branching.js +41 -0
  46. package/dist/operations/comments.d.ts +43 -0
  47. package/dist/operations/comments.js +65 -0
  48. package/dist/operations/components.d.ts +24 -0
  49. package/dist/operations/components.js +30 -0
  50. package/dist/operations/compound-manager.d.ts +101 -0
  51. package/dist/operations/compound-manager.js +629 -0
  52. package/dist/operations/compound.d.ts +102 -0
  53. package/dist/operations/compound.js +595 -0
  54. package/dist/operations/export.d.ts +19 -0
  55. package/dist/operations/export.js +27 -0
  56. package/dist/operations/files.d.ts +55 -0
  57. package/dist/operations/files.js +89 -0
  58. package/dist/operations/libraries.d.ts +5 -0
  59. package/dist/operations/libraries.js +10 -0
  60. package/dist/operations/navigate.d.ts +99 -0
  61. package/dist/operations/navigate.js +266 -0
  62. package/dist/operations/org.d.ts +95 -0
  63. package/dist/operations/org.js +205 -0
  64. package/dist/operations/permissions.d.ts +59 -0
  65. package/dist/operations/permissions.js +112 -0
  66. package/dist/operations/projects.d.ts +29 -0
  67. package/dist/operations/projects.js +40 -0
  68. package/dist/operations/reading.d.ts +12 -0
  69. package/dist/operations/reading.js +20 -0
  70. package/dist/operations/teams.d.ts +17 -0
  71. package/dist/operations/teams.js +17 -0
  72. package/dist/operations/variables.d.ts +17 -0
  73. package/dist/operations/variables.js +39 -0
  74. package/dist/operations/versions.d.ts +23 -0
  75. package/dist/operations/versions.js +27 -0
  76. package/dist/operations/webhooks.d.ts +25 -0
  77. package/dist/operations/webhooks.js +38 -0
  78. package/dist/tools/analytics.js +6 -16
  79. package/dist/tools/branching.js +7 -36
  80. package/dist/tools/comments.js +9 -56
  81. package/dist/tools/components.js +7 -19
  82. package/dist/tools/compound-manager.js +21 -644
  83. package/dist/tools/compound.js +32 -566
  84. package/dist/tools/export.js +4 -23
  85. package/dist/tools/files.js +21 -68
  86. package/dist/tools/libraries.js +4 -11
  87. package/dist/tools/navigate.js +23 -246
  88. package/dist/tools/org.js +29 -245
  89. package/dist/tools/permissions.js +18 -97
  90. package/dist/tools/projects.js +8 -27
  91. package/dist/tools/reading.js +5 -15
  92. package/dist/tools/teams.js +8 -16
  93. package/dist/tools/variables.js +13 -30
  94. package/dist/tools/versions.js +6 -24
  95. package/dist/tools/webhooks.js +7 -24
  96. package/package.json +1 -1
  97. package/dist/cli/commands.d.ts +0 -47
  98. package/dist/cli/commands.js +0 -1204
@@ -0,0 +1,227 @@
1
+ import { Command } from 'commander';
2
+ import { listAdmins, listOrgTeams, seatUsage, listTeamMembers, billingOverview, listInvoices, orgDomains, aiCreditUsage, exportMembers, listOrgMembers, contractRates, changeSeat, } from '../operations/org.js';
3
+ import { output, error } from './format.js';
4
+ import { requireCookie } from './helpers.js';
5
+ export function orgCommand() {
6
+ const org = new Command('org')
7
+ .description('Org administration and billing');
8
+ org
9
+ .command('list-admins')
10
+ .description('List org admins with permission levels and seat status')
11
+ .option('--org-id <id>', 'Org ID override')
12
+ .option('--include-license-admins', 'Include license admins')
13
+ .option('--json', 'Force JSON output')
14
+ .action(async (options) => {
15
+ try {
16
+ const config = requireCookie();
17
+ const result = await listAdmins(config, {
18
+ org_id: options.orgId,
19
+ include_license_admins: options.includeLicenseAdmins,
20
+ });
21
+ output(result, options);
22
+ }
23
+ catch (e) {
24
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
25
+ process.exit(1);
26
+ }
27
+ });
28
+ org
29
+ .command('list-teams')
30
+ .description('List all teams in the org')
31
+ .option('--org-id <id>', 'Org ID override')
32
+ .option('--include-secret-teams', 'Include secret teams')
33
+ .option('--json', 'Force JSON output')
34
+ .action(async (options) => {
35
+ try {
36
+ const config = requireCookie();
37
+ const result = await listOrgTeams(config, {
38
+ org_id: options.orgId,
39
+ include_secret_teams: options.includeSecretTeams,
40
+ });
41
+ output(result, options);
42
+ }
43
+ catch (e) {
44
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
45
+ process.exit(1);
46
+ }
47
+ });
48
+ org
49
+ .command('seat-usage')
50
+ .description('Seat usage breakdown by type and activity')
51
+ .option('--org-id <id>', 'Org ID override')
52
+ .option('--search <query>', 'Filter counts by user search query')
53
+ .option('--json', 'Force JSON output')
54
+ .action(async (options) => {
55
+ try {
56
+ const config = requireCookie();
57
+ const result = await seatUsage(config, {
58
+ org_id: options.orgId,
59
+ search_query: options.search,
60
+ });
61
+ output(result, options);
62
+ }
63
+ catch (e) {
64
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
65
+ process.exit(1);
66
+ }
67
+ });
68
+ org
69
+ .command('team-members <team-id>')
70
+ .description('List members of a team')
71
+ .option('--json', 'Force JSON output')
72
+ .action(async (teamId, options) => {
73
+ try {
74
+ const config = requireCookie();
75
+ const result = await listTeamMembers(config, { team_id: teamId });
76
+ output(result, options);
77
+ }
78
+ catch (e) {
79
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
80
+ process.exit(1);
81
+ }
82
+ });
83
+ org
84
+ .command('billing')
85
+ .description('Org billing data including invoice history and amounts')
86
+ .option('--org-id <id>', 'Org ID override')
87
+ .option('--json', 'Force JSON output')
88
+ .action(async (options) => {
89
+ try {
90
+ const config = requireCookie();
91
+ const result = await billingOverview(config, { org_id: options.orgId });
92
+ output(result, options);
93
+ }
94
+ catch (e) {
95
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
96
+ process.exit(1);
97
+ }
98
+ });
99
+ org
100
+ .command('invoices')
101
+ .description('List open and upcoming invoices')
102
+ .option('--org-id <id>', 'Org ID override')
103
+ .option('--json', 'Force JSON output')
104
+ .action(async (options) => {
105
+ try {
106
+ const config = requireCookie();
107
+ const result = await listInvoices(config, { org_id: options.orgId });
108
+ output(result, options);
109
+ }
110
+ catch (e) {
111
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
112
+ process.exit(1);
113
+ }
114
+ });
115
+ org
116
+ .command('domains')
117
+ .description('Org domain configuration and SSO/SAML settings')
118
+ .option('--org-id <id>', 'Org ID override')
119
+ .option('--json', 'Force JSON output')
120
+ .action(async (options) => {
121
+ try {
122
+ const config = requireCookie();
123
+ const result = await orgDomains(config, { org_id: options.orgId });
124
+ output(result, options);
125
+ }
126
+ catch (e) {
127
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
128
+ process.exit(1);
129
+ }
130
+ });
131
+ org
132
+ .command('ai-credits <plan-id>')
133
+ .description('AI credit usage summary for a billing plan')
134
+ .option('--json', 'Force JSON output')
135
+ .action(async (planId, options) => {
136
+ try {
137
+ const config = requireCookie();
138
+ const result = await aiCreditUsage(config, { plan_id: planId });
139
+ output(result, options);
140
+ }
141
+ catch (e) {
142
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
143
+ process.exit(1);
144
+ }
145
+ });
146
+ org
147
+ .command('export-members')
148
+ .description('Trigger async CSV export of all org members')
149
+ .option('--org-id <id>', 'Org ID override')
150
+ .option('--json', 'Force JSON output')
151
+ .action(async (options) => {
152
+ try {
153
+ const config = requireCookie();
154
+ const msg = await exportMembers(config, { org_id: options.orgId });
155
+ output({ message: msg }, options);
156
+ }
157
+ catch (e) {
158
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
159
+ process.exit(1);
160
+ }
161
+ });
162
+ org
163
+ .command('members')
164
+ .description('List org members with seat type, permission, and activity')
165
+ .option('--org-id <id>', 'Org ID override')
166
+ .option('--search <query>', 'Filter members by name or email')
167
+ .option('--json', 'Force JSON output')
168
+ .action(async (options) => {
169
+ try {
170
+ const config = requireCookie();
171
+ const result = await listOrgMembers(config, {
172
+ org_id: options.orgId,
173
+ search_query: options.search,
174
+ });
175
+ output(result, options);
176
+ }
177
+ catch (e) {
178
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
179
+ process.exit(1);
180
+ }
181
+ });
182
+ org
183
+ .command('contract-rates')
184
+ .description('Seat pricing per type (expert, developer, collaborator)')
185
+ .option('--org-id <id>', 'Org ID override')
186
+ .option('--json', 'Force JSON output')
187
+ .action(async (options) => {
188
+ try {
189
+ const config = requireCookie();
190
+ const result = await contractRates(config, { org_id: options.orgId });
191
+ output(result, options);
192
+ }
193
+ catch (e) {
194
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
195
+ process.exit(1);
196
+ }
197
+ });
198
+ org
199
+ .command('change-seat <user-id> <seat-type>')
200
+ .description("Change a user's seat type (full, dev, collab, view)")
201
+ .option('--org-id <id>', 'Org ID override')
202
+ .option('--confirm', 'Authorize billing change for upgrades')
203
+ .option('--json', 'Force JSON output')
204
+ .action(async (userId, seatType, options) => {
205
+ try {
206
+ const config = requireCookie();
207
+ const result = await changeSeat(config, {
208
+ user_id: userId,
209
+ seat_type: seatType,
210
+ org_id: options.orgId,
211
+ confirm: options.confirm,
212
+ });
213
+ if (typeof result === 'string') {
214
+ output({ message: result }, options);
215
+ }
216
+ else {
217
+ output(result, options);
218
+ }
219
+ }
220
+ catch (e) {
221
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
222
+ process.exit(1);
223
+ }
224
+ });
225
+ return org;
226
+ }
227
+ //# sourceMappingURL=org.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function permissionsCommand(): Command;
3
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1,133 @@
1
+ import { Command } from 'commander';
2
+ import { getPermissions, setPermissions, share, revokeAccess, listRoleRequests, approveRoleRequest, denyRoleRequest, } from '../operations/permissions.js';
3
+ import { output, error } from './format.js';
4
+ import { requireCookie } from './helpers.js';
5
+ export function permissionsCommand() {
6
+ const permissions = new Command('permissions')
7
+ .description('Manage file, project, and team permissions');
8
+ permissions
9
+ .command('get <resource-type> <resource-id>')
10
+ .description('See who has access to a file, project, or team')
11
+ .option('--json', 'Force JSON output')
12
+ .action(async (resourceType, resourceId, options) => {
13
+ try {
14
+ const config = requireCookie();
15
+ const result = await getPermissions(config, {
16
+ resource_type: resourceType,
17
+ resource_id: resourceId,
18
+ });
19
+ output(result, options);
20
+ }
21
+ catch (e) {
22
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
23
+ process.exit(1);
24
+ }
25
+ });
26
+ permissions
27
+ .command('set <resource-type> <resource-id> <user-id> <role>')
28
+ .description('Change access level for a user on a file, project, or team')
29
+ .option('--json', 'Force JSON output')
30
+ .action(async (resourceType, resourceId, userId, role, options) => {
31
+ try {
32
+ const config = requireCookie();
33
+ const msg = await setPermissions(config, {
34
+ resource_type: resourceType,
35
+ resource_id: resourceId,
36
+ user_id: userId,
37
+ role,
38
+ });
39
+ output({ message: msg }, options);
40
+ }
41
+ catch (e) {
42
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
43
+ process.exit(1);
44
+ }
45
+ });
46
+ permissions
47
+ .command('share <resource-type> <resource-id> <email>')
48
+ .description('Share a file or project with someone by email')
49
+ .option('--role <role>', 'Role to grant (editor or viewer)', 'viewer')
50
+ .option('--json', 'Force JSON output')
51
+ .action(async (resourceType, resourceId, email, options) => {
52
+ try {
53
+ const config = requireCookie();
54
+ const result = await share(config, {
55
+ resource_type: resourceType,
56
+ resource_id: resourceId,
57
+ email,
58
+ role: options.role,
59
+ });
60
+ output(result, options);
61
+ }
62
+ catch (e) {
63
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
64
+ process.exit(1);
65
+ }
66
+ });
67
+ permissions
68
+ .command('revoke <resource-type> <resource-id> <user-id>')
69
+ .description("Remove someone's access to a file, project, or team")
70
+ .option('--json', 'Force JSON output')
71
+ .action(async (resourceType, resourceId, userId, options) => {
72
+ try {
73
+ const config = requireCookie();
74
+ const msg = await revokeAccess(config, {
75
+ resource_type: resourceType,
76
+ resource_id: resourceId,
77
+ user_id: userId,
78
+ });
79
+ output({ message: msg }, options);
80
+ }
81
+ catch (e) {
82
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
83
+ process.exit(1);
84
+ }
85
+ });
86
+ permissions
87
+ .command('requests')
88
+ .description('List pending file access requests')
89
+ .option('--json', 'Force JSON output')
90
+ .action(async (options) => {
91
+ try {
92
+ const config = requireCookie();
93
+ const result = await listRoleRequests(config);
94
+ output(result, options);
95
+ }
96
+ catch (e) {
97
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
98
+ process.exit(1);
99
+ }
100
+ });
101
+ permissions
102
+ .command('approve <notification-id>')
103
+ .description('Approve a pending file access request')
104
+ .option('--json', 'Force JSON output')
105
+ .action(async (notificationId, options) => {
106
+ try {
107
+ const config = requireCookie();
108
+ const msg = await approveRoleRequest(config, { notification_id: notificationId });
109
+ output({ message: msg }, options);
110
+ }
111
+ catch (e) {
112
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
113
+ process.exit(1);
114
+ }
115
+ });
116
+ permissions
117
+ .command('deny <notification-id>')
118
+ .description('Decline a pending file access request')
119
+ .option('--json', 'Force JSON output')
120
+ .action(async (notificationId, options) => {
121
+ try {
122
+ const config = requireCookie();
123
+ const msg = await denyRoleRequest(config, { notification_id: notificationId });
124
+ output({ message: msg }, options);
125
+ }
126
+ catch (e) {
127
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
128
+ process.exit(1);
129
+ }
130
+ });
131
+ return permissions;
132
+ }
133
+ //# sourceMappingURL=permissions.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function projectsCommand(): Command;
3
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1,110 @@
1
+ import { Command } from 'commander';
2
+ import { createProject, renameProject, moveProject, trashProject, restoreProject, setProjectDescription, } from '../operations/projects.js';
3
+ import { output, error } from './format.js';
4
+ import { requireCookie } from './helpers.js';
5
+ export function projectsCommand() {
6
+ const projects = new Command('projects')
7
+ .description('Manage Figma projects');
8
+ projects
9
+ .command('create <team-id>')
10
+ .description('Create a new project in a team')
11
+ .requiredOption('--name <name>', 'Project name')
12
+ .option('--json', 'Force JSON output')
13
+ .action(async (teamId, options) => {
14
+ try {
15
+ const config = requireCookie();
16
+ const result = await createProject(config, { team_id: teamId, name: options.name });
17
+ output(result, options);
18
+ }
19
+ catch (e) {
20
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
21
+ process.exit(1);
22
+ }
23
+ });
24
+ projects
25
+ .command('rename <project-id>')
26
+ .description('Rename a project')
27
+ .requiredOption('--name <name>', 'New name')
28
+ .option('--json', 'Force JSON output')
29
+ .action(async (projectId, options) => {
30
+ try {
31
+ const config = requireCookie();
32
+ await renameProject(config, { project_id: projectId, name: options.name });
33
+ output({ renamed: projectId, name: options.name }, options);
34
+ }
35
+ catch (e) {
36
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
37
+ process.exit(1);
38
+ }
39
+ });
40
+ projects
41
+ .command('move <project-id>')
42
+ .description('Move a project to a different team')
43
+ .requiredOption('--destination <team-id>', 'Destination team ID')
44
+ .option('--json', 'Force JSON output')
45
+ .action(async (projectId, options) => {
46
+ try {
47
+ const config = requireCookie();
48
+ await moveProject(config, {
49
+ project_id: projectId,
50
+ destination_team_id: options.destination,
51
+ });
52
+ output({ moved: projectId, destination_team_id: options.destination }, options);
53
+ }
54
+ catch (e) {
55
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
56
+ process.exit(1);
57
+ }
58
+ });
59
+ projects
60
+ .command('trash <project-id>')
61
+ .description('Move a project to trash')
62
+ .option('--json', 'Force JSON output')
63
+ .action(async (projectId, options) => {
64
+ try {
65
+ const config = requireCookie();
66
+ await trashProject(config, { project_id: projectId });
67
+ output({ trashed: projectId }, options);
68
+ }
69
+ catch (e) {
70
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
71
+ process.exit(1);
72
+ }
73
+ });
74
+ projects
75
+ .command('restore <project-id>')
76
+ .description('Restore a project from trash')
77
+ .option('--json', 'Force JSON output')
78
+ .action(async (projectId, options) => {
79
+ try {
80
+ const config = requireCookie();
81
+ await restoreProject(config, { project_id: projectId });
82
+ output({ restored: projectId }, options);
83
+ }
84
+ catch (e) {
85
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
86
+ process.exit(1);
87
+ }
88
+ });
89
+ projects
90
+ .command('set-description <project-id>')
91
+ .description('Set or update a project description')
92
+ .requiredOption('--description <text>', 'Description text')
93
+ .option('--json', 'Force JSON output')
94
+ .action(async (projectId, options) => {
95
+ try {
96
+ const config = requireCookie();
97
+ await setProjectDescription(config, {
98
+ project_id: projectId,
99
+ description: options.description,
100
+ });
101
+ output({ updated: projectId }, options);
102
+ }
103
+ catch (e) {
104
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
105
+ process.exit(1);
106
+ }
107
+ });
108
+ return projects;
109
+ }
110
+ //# sourceMappingURL=projects.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function readingCommand(): Command;
3
+ //# sourceMappingURL=reading.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { Command } from 'commander';
2
+ import { getFile, getNodes } from '../operations/reading.js';
3
+ import { output, error } from './format.js';
4
+ import { requirePat } from './helpers.js';
5
+ export function readingCommand() {
6
+ const reading = new Command('reading')
7
+ .description('Read file contents and node trees');
8
+ reading
9
+ .command('get-file <file-key>')
10
+ .description('Read file contents as a node tree')
11
+ .option('--depth <n>', 'Tree depth limit (0=root, 1=pages, 2=top-level frames)')
12
+ .option('--node-id <id>', 'Start from a specific node instead of document root')
13
+ .option('--json', 'Force JSON output')
14
+ .action(async (fileKey, options) => {
15
+ try {
16
+ const config = requirePat();
17
+ const result = await getFile(config, {
18
+ file_key: fileKey,
19
+ depth: options.depth !== undefined ? parseInt(options.depth, 10) : undefined,
20
+ node_id: options.nodeId,
21
+ });
22
+ output(result, options);
23
+ }
24
+ catch (e) {
25
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
26
+ process.exit(1);
27
+ }
28
+ });
29
+ reading
30
+ .command('get-nodes <file-key> <node-ids...>')
31
+ .description('Read specific nodes from a file')
32
+ .option('--depth <n>', 'Depth limit per node')
33
+ .option('--json', 'Force JSON output')
34
+ .action(async (fileKey, nodeIds, options) => {
35
+ try {
36
+ const config = requirePat();
37
+ const result = await getNodes(config, {
38
+ file_key: fileKey,
39
+ node_ids: nodeIds,
40
+ depth: options.depth !== undefined ? parseInt(options.depth, 10) : undefined,
41
+ });
42
+ output(result, options);
43
+ }
44
+ catch (e) {
45
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
46
+ process.exit(1);
47
+ }
48
+ });
49
+ return reading;
50
+ }
51
+ //# sourceMappingURL=reading.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function teamsCommand(): Command;
3
+ //# sourceMappingURL=teams.d.ts.map
@@ -0,0 +1,56 @@
1
+ import { Command } from 'commander';
2
+ import { createTeam, renameTeam, deleteTeam } from '../operations/teams.js';
3
+ import { output, error } from './format.js';
4
+ import { requireCookie } from './helpers.js';
5
+ export function teamsCommand() {
6
+ const teams = new Command('teams')
7
+ .description('Create, rename, and delete teams');
8
+ teams
9
+ .command('create <name>')
10
+ .description('Create a new team in the org')
11
+ .option('--org-id <id>', 'Org ID override')
12
+ .option('--json', 'Force JSON output')
13
+ .action(async (name, options) => {
14
+ try {
15
+ const config = requireCookie();
16
+ const result = await createTeam(config, { name, org_id: options.orgId });
17
+ output(result, options);
18
+ }
19
+ catch (e) {
20
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
21
+ process.exit(1);
22
+ }
23
+ });
24
+ teams
25
+ .command('rename <team-id> <name>')
26
+ .description('Rename an existing team')
27
+ .option('--json', 'Force JSON output')
28
+ .action(async (teamId, name, options) => {
29
+ try {
30
+ const config = requireCookie();
31
+ const msg = await renameTeam(config, { team_id: teamId, name });
32
+ output({ message: msg }, options);
33
+ }
34
+ catch (e) {
35
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
36
+ process.exit(1);
37
+ }
38
+ });
39
+ teams
40
+ .command('delete <team-id>')
41
+ .description('Delete a team (destructive, cannot be undone)')
42
+ .option('--json', 'Force JSON output')
43
+ .action(async (teamId, options) => {
44
+ try {
45
+ const config = requireCookie();
46
+ const msg = await deleteTeam(config, { team_id: teamId });
47
+ output({ message: msg }, options);
48
+ }
49
+ catch (e) {
50
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
51
+ process.exit(1);
52
+ }
53
+ });
54
+ return teams;
55
+ }
56
+ //# sourceMappingURL=teams.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function variablesCommand(): Command;
3
+ //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { Command } from 'commander';
2
+ import { listLocalVariables, listPublishedVariables, updateVariables, isEnterpriseScopeError, ENTERPRISE_ERROR, } from '../operations/variables.js';
3
+ import { output, error } from './format.js';
4
+ import { requirePat } from './helpers.js';
5
+ export function variablesCommand() {
6
+ const variables = new Command('variables')
7
+ .description('Manage file variables (Enterprise)');
8
+ variables
9
+ .command('list-local <file-key>')
10
+ .description('List local variables and variable collections in a file')
11
+ .option('--json', 'Force JSON output')
12
+ .action(async (fileKey, options) => {
13
+ try {
14
+ const config = requirePat();
15
+ const result = await listLocalVariables(config, { file_key: fileKey });
16
+ output(result, options);
17
+ }
18
+ catch (e) {
19
+ if (isEnterpriseScopeError(e)) {
20
+ error(ENTERPRISE_ERROR);
21
+ }
22
+ else {
23
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
24
+ }
25
+ process.exit(1);
26
+ }
27
+ });
28
+ variables
29
+ .command('list-published <file-key>')
30
+ .description('List published variables from a library file')
31
+ .option('--json', 'Force JSON output')
32
+ .action(async (fileKey, options) => {
33
+ try {
34
+ const config = requirePat();
35
+ const result = await listPublishedVariables(config, { file_key: fileKey });
36
+ output(result, options);
37
+ }
38
+ catch (e) {
39
+ if (isEnterpriseScopeError(e)) {
40
+ error(ENTERPRISE_ERROR);
41
+ }
42
+ else {
43
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
44
+ }
45
+ process.exit(1);
46
+ }
47
+ });
48
+ variables
49
+ .command('update <file-key>')
50
+ .description('Bulk create, update, or delete variables, collections, modes, and mode values')
51
+ .option('--variable-collections <json>', 'Collection operations as JSON array')
52
+ .option('--variable-modes <json>', 'Mode operations as JSON array')
53
+ .option('--variables <json>', 'Variable operations as JSON array')
54
+ .option('--variable-mode-values <json>', 'Value assignments as JSON array')
55
+ .option('--json', 'Force JSON output')
56
+ .action(async (fileKey, options) => {
57
+ try {
58
+ const config = requirePat();
59
+ const result = await updateVariables(config, {
60
+ file_key: fileKey,
61
+ variable_collections: options.variableCollections ? JSON.parse(options.variableCollections) : undefined,
62
+ variable_modes: options.variableModes ? JSON.parse(options.variableModes) : undefined,
63
+ variables: options.variables ? JSON.parse(options.variables) : undefined,
64
+ variable_mode_values: options.variableModeValues ? JSON.parse(options.variableModeValues) : undefined,
65
+ });
66
+ output(result, options);
67
+ }
68
+ catch (e) {
69
+ if (isEnterpriseScopeError(e)) {
70
+ error(ENTERPRISE_ERROR);
71
+ }
72
+ else {
73
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
74
+ }
75
+ process.exit(1);
76
+ }
77
+ });
78
+ return variables;
79
+ }
80
+ //# sourceMappingURL=variables.js.map