figmanage 1.0.1 → 1.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 (95) 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/components.d.ts +3 -0
  9. package/dist/cli/components.js +82 -0
  10. package/dist/cli/compound-commands.d.ts +14 -0
  11. package/dist/cli/compound-commands.js +291 -0
  12. package/dist/cli/export.d.ts +3 -0
  13. package/dist/cli/export.js +51 -0
  14. package/dist/cli/files.d.ts +3 -0
  15. package/dist/cli/files.js +156 -0
  16. package/dist/cli/helpers.d.ts +7 -0
  17. package/dist/cli/helpers.js +43 -0
  18. package/dist/cli/index.js +65 -89
  19. package/dist/cli/libraries.d.ts +3 -0
  20. package/dist/cli/libraries.js +26 -0
  21. package/dist/cli/navigate.d.ts +3 -0
  22. package/dist/cli/navigate.js +192 -0
  23. package/dist/cli/org.d.ts +3 -0
  24. package/dist/cli/org.js +227 -0
  25. package/dist/cli/permissions.d.ts +3 -0
  26. package/dist/cli/permissions.js +133 -0
  27. package/dist/cli/projects.d.ts +3 -0
  28. package/dist/cli/projects.js +110 -0
  29. package/dist/cli/reading.d.ts +3 -0
  30. package/dist/cli/reading.js +51 -0
  31. package/dist/cli/teams.d.ts +3 -0
  32. package/dist/cli/teams.js +56 -0
  33. package/dist/cli/variables.d.ts +3 -0
  34. package/dist/cli/variables.js +80 -0
  35. package/dist/cli/versions.d.ts +3 -0
  36. package/dist/cli/versions.js +46 -0
  37. package/dist/cli/webhooks.d.ts +3 -0
  38. package/dist/cli/webhooks.js +100 -0
  39. package/dist/operations/analytics.d.ts +10 -0
  40. package/dist/operations/analytics.js +15 -0
  41. package/dist/operations/branching.d.ts +24 -0
  42. package/dist/operations/branching.js +41 -0
  43. package/dist/operations/comments.d.ts +43 -0
  44. package/dist/operations/comments.js +65 -0
  45. package/dist/operations/components.d.ts +24 -0
  46. package/dist/operations/components.js +30 -0
  47. package/dist/operations/compound-manager.d.ts +101 -0
  48. package/dist/operations/compound-manager.js +629 -0
  49. package/dist/operations/compound.d.ts +102 -0
  50. package/dist/operations/compound.js +595 -0
  51. package/dist/operations/export.d.ts +19 -0
  52. package/dist/operations/export.js +27 -0
  53. package/dist/operations/files.d.ts +55 -0
  54. package/dist/operations/files.js +89 -0
  55. package/dist/operations/libraries.d.ts +5 -0
  56. package/dist/operations/libraries.js +10 -0
  57. package/dist/operations/navigate.d.ts +99 -0
  58. package/dist/operations/navigate.js +266 -0
  59. package/dist/operations/org.d.ts +95 -0
  60. package/dist/operations/org.js +205 -0
  61. package/dist/operations/permissions.d.ts +59 -0
  62. package/dist/operations/permissions.js +112 -0
  63. package/dist/operations/projects.d.ts +29 -0
  64. package/dist/operations/projects.js +40 -0
  65. package/dist/operations/reading.d.ts +12 -0
  66. package/dist/operations/reading.js +20 -0
  67. package/dist/operations/teams.d.ts +17 -0
  68. package/dist/operations/teams.js +17 -0
  69. package/dist/operations/variables.d.ts +17 -0
  70. package/dist/operations/variables.js +39 -0
  71. package/dist/operations/versions.d.ts +23 -0
  72. package/dist/operations/versions.js +27 -0
  73. package/dist/operations/webhooks.d.ts +25 -0
  74. package/dist/operations/webhooks.js +38 -0
  75. package/dist/tools/analytics.js +6 -16
  76. package/dist/tools/branching.js +7 -36
  77. package/dist/tools/comments.js +9 -56
  78. package/dist/tools/components.js +7 -19
  79. package/dist/tools/compound-manager.js +21 -644
  80. package/dist/tools/compound.js +32 -566
  81. package/dist/tools/export.js +4 -23
  82. package/dist/tools/files.js +21 -68
  83. package/dist/tools/libraries.js +4 -11
  84. package/dist/tools/navigate.js +23 -246
  85. package/dist/tools/org.js +29 -245
  86. package/dist/tools/permissions.js +18 -97
  87. package/dist/tools/projects.js +8 -27
  88. package/dist/tools/reading.js +5 -15
  89. package/dist/tools/teams.js +8 -16
  90. package/dist/tools/variables.js +13 -30
  91. package/dist/tools/versions.js +6 -24
  92. package/dist/tools/webhooks.js +7 -24
  93. package/package.json +1 -1
  94. package/dist/cli/commands.d.ts +0 -47
  95. package/dist/cli/commands.js +0 -1204
package/dist/cli/index.js CHANGED
@@ -1,5 +1,22 @@
1
+ import { navigateCommand } from './navigate.js';
2
+ import { filesCommand } from './files.js';
3
+ import { projectsCommand } from './projects.js';
4
+ import { permissionsCommand } from './permissions.js';
5
+ import { versionsCommand } from './versions.js';
6
+ import { branchingCommand } from './branching.js';
7
+ import { commentsCommand } from './comments.js';
8
+ import { exportCommand } from './export.js';
9
+ import { readingCommand } from './reading.js';
10
+ import { componentsCommand } from './components.js';
11
+ import { webhooksCommand } from './webhooks.js';
12
+ import { variablesCommand } from './variables.js';
13
+ import { analyticsCommand } from './analytics.js';
14
+ import { orgCommand } from './org.js';
15
+ import { librariesCommand } from './libraries.js';
16
+ import { teamsCommand } from './teams.js';
17
+ import { fileSummaryCommand, workspaceOverviewCommand, openCommentsCommand, cleanupStaleFilesCommand, organizeProjectCommand, setupProjectStructureCommand, seatOptimizationCommand, permissionAuditCommand, branchCleanupCommand, offboardUserCommand, onboardUserCommand, quarterlyReportCommand, } from './compound-commands.js';
1
18
  export function registerCliCommands(program) {
2
- // Auth commands -- handlers live in cli/login.ts (built by another agent)
19
+ // Auth commands (flat -- not resource-scoped)
3
20
  program
4
21
  .command('login')
5
22
  .description('Authenticate with Figma')
@@ -23,93 +40,52 @@ export function registerCliCommands(program) {
23
40
  const { handleLogout } = await import('./login.js');
24
41
  await handleLogout();
25
42
  });
26
- // Workspace management commands
27
- program
28
- .command('seat-optimization')
29
- .description('Identify inactive paid seats and calculate savings')
30
- .option('--days-inactive <days>', 'Days threshold (default: 90)', '90')
31
- .option('--no-cost', 'Skip cost analysis')
32
- .option('--json', 'Force JSON output')
33
- .action(async (options) => {
34
- const { runSeatOptimization } = await import('./commands.js');
35
- await runSeatOptimization(options);
36
- });
37
- program
38
- .command('offboard <user>')
39
- .description('Audit or execute user offboarding')
40
- .option('--execute', 'Execute the offboarding (default: audit only)')
41
- .option('--transfer-to <user>', 'Transfer file ownership to this user')
42
- .option('--json', 'Force JSON output')
43
- .action(async (user, options) => {
44
- const { runOffboard } = await import('./commands.js');
45
- await runOffboard(user, options);
46
- });
47
- program
48
- .command('onboard <email>')
49
- .description('Invite user to teams and set up access')
50
- .option('--teams <ids>', 'Comma-separated team IDs', (v) => v.split(','))
51
- .option('--role <role>', 'Role: editor or viewer (default: editor)', 'editor')
52
- .option('--share-files <keys>', 'Comma-separated file keys to share (viewer access)', (v) => v.split(','))
53
- .option('--seat <type>', 'Seat type: full, dev, collab, view')
54
- .option('--confirm', 'Confirm seat change')
55
- .option('--json', 'Force JSON output')
56
- .action(async (email, options) => {
57
- const { runOnboard } = await import('./commands.js');
58
- await runOnboard(email, options);
59
- });
60
- program
61
- .command('quarterly-report')
62
- .description('Org-wide design ops snapshot')
63
- .option('--days <days>', 'Lookback period (default: 90)', '90')
64
- .option('--json', 'Force JSON output')
65
- .action(async (options) => {
66
- const { runQuarterlyReport } = await import('./commands.js');
67
- await runQuarterlyReport(options);
68
- });
69
- program
70
- .command('members')
71
- .description('List org members')
72
- .option('--search <query>', 'Filter by name or email')
73
- .option('--json', 'Force JSON output')
74
- .action(async (options) => {
75
- const { runMembers } = await import('./commands.js');
76
- await runMembers(options);
77
- });
78
- program
79
- .command('teams')
80
- .description('List org teams')
81
- .option('--json', 'Force JSON output')
82
- .action(async (options) => {
83
- const { runTeams } = await import('./commands.js');
84
- await runTeams(options);
85
- });
86
- program
87
- .command('permissions <type> <id>')
88
- .description('Show who has access to a file, project, or team')
89
- .option('--json', 'Force JSON output')
90
- .action(async (type, id, options) => {
91
- const { runPermissions } = await import('./commands.js');
92
- await runPermissions(type, id, options);
93
- });
94
- program
95
- .command('permission-audit')
96
- .description('Audit permissions across a team or project')
97
- .option('--scope <type>', 'Scope: team or project', 'team')
98
- .option('--id <id>', 'Team or project ID')
99
- .option('--json', 'Force JSON output')
100
- .action(async (options) => {
101
- const { runPermissionAudit } = await import('./commands.js');
102
- await runPermissionAudit(options);
103
- });
104
- program
105
- .command('branch-cleanup <project-id>')
106
- .description('Find and optionally archive stale branches')
107
- .option('--days-stale <days>', 'Days threshold (default: 60)', '60')
108
- .option('--execute', 'Archive stale branches (default: dry run)')
109
- .option('--json', 'Force JSON output')
110
- .action(async (projectId, options) => {
111
- const { runBranchCleanup } = await import('./commands.js');
112
- await runBranchCleanup(projectId, options);
113
- });
43
+ // Noun-verb subcommand groups
44
+ const navigate = navigateCommand();
45
+ const files = filesCommand();
46
+ const projects = projectsCommand();
47
+ const permissions = permissionsCommand();
48
+ const versions = versionsCommand();
49
+ const branches = branchingCommand();
50
+ const comments = commentsCommand();
51
+ const exp = exportCommand();
52
+ const reading = readingCommand();
53
+ const components = componentsCommand();
54
+ const webhooks = webhooksCommand();
55
+ const variables = variablesCommand();
56
+ const analytics = analyticsCommand();
57
+ const org = orgCommand();
58
+ const libraries = librariesCommand();
59
+ const teams = teamsCommand();
60
+ // Route compound commands into noun groups
61
+ files.addCommand(fileSummaryCommand());
62
+ files.addCommand(cleanupStaleFilesCommand());
63
+ projects.addCommand(organizeProjectCommand());
64
+ projects.addCommand(setupProjectStructureCommand());
65
+ comments.addCommand(openCommentsCommand());
66
+ permissions.addCommand(permissionAuditCommand());
67
+ branches.addCommand(branchCleanupCommand());
68
+ org.addCommand(workspaceOverviewCommand());
69
+ org.addCommand(seatOptimizationCommand());
70
+ org.addCommand(offboardUserCommand());
71
+ org.addCommand(onboardUserCommand());
72
+ org.addCommand(quarterlyReportCommand());
73
+ // Register all groups
74
+ program.addCommand(navigate);
75
+ program.addCommand(files);
76
+ program.addCommand(projects);
77
+ program.addCommand(permissions);
78
+ program.addCommand(versions);
79
+ program.addCommand(branches);
80
+ program.addCommand(comments);
81
+ program.addCommand(exp);
82
+ program.addCommand(reading);
83
+ program.addCommand(components);
84
+ program.addCommand(webhooks);
85
+ program.addCommand(variables);
86
+ program.addCommand(analytics);
87
+ program.addCommand(org);
88
+ program.addCommand(libraries);
89
+ program.addCommand(teams);
114
90
  }
115
91
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function librariesCommand(): Command;
3
+ //# sourceMappingURL=libraries.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { Command } from 'commander';
2
+ import { listOrgLibraries } from '../operations/libraries.js';
3
+ import { output, error } from './format.js';
4
+ import { requireCookie } from './helpers.js';
5
+ export function librariesCommand() {
6
+ const libraries = new Command('libraries')
7
+ .description('Manage org design system libraries');
8
+ libraries
9
+ .command('list')
10
+ .description('List all design system libraries in the org')
11
+ .option('--org-id <id>', 'Org ID override (defaults to current workspace)')
12
+ .option('--json', 'Force JSON output')
13
+ .action(async (options) => {
14
+ try {
15
+ const config = requireCookie();
16
+ const result = await listOrgLibraries(config, { 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
+ return libraries;
25
+ }
26
+ //# sourceMappingURL=libraries.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function navigateCommand(): Command;
3
+ //# sourceMappingURL=navigate.d.ts.map
@@ -0,0 +1,192 @@
1
+ import { Command } from 'commander';
2
+ import { checkAuthStatus, listOrgs, switchOrg, listTeams, listProjects, listFiles, listRecentFiles, search, getFileInfo, listFavorites, } from '../operations/navigate.js';
3
+ import { output, error } from './format.js';
4
+ import { requireAuth, requireCookie } from './helpers.js';
5
+ export function navigateCommand() {
6
+ const nav = new Command('navigate')
7
+ .description('Browse workspaces, teams, projects, and files');
8
+ nav
9
+ .command('check-auth')
10
+ .description('Check authentication status for PAT and session cookie')
11
+ .option('--json', 'Force JSON output')
12
+ .action(async (options) => {
13
+ try {
14
+ const config = requireAuth();
15
+ const result = await checkAuthStatus(config);
16
+ if (options.json) {
17
+ output(result.status, options);
18
+ }
19
+ else {
20
+ console.log(result.formatted);
21
+ }
22
+ }
23
+ catch (e) {
24
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
25
+ process.exit(1);
26
+ }
27
+ });
28
+ nav
29
+ .command('list-orgs')
30
+ .description('List all workspaces you belong to')
31
+ .option('--json', 'Force JSON output')
32
+ .action(async (options) => {
33
+ try {
34
+ const config = requireCookie();
35
+ const orgs = await listOrgs(config);
36
+ if (orgs.length === 0) {
37
+ console.log('No workspaces found. You may be on a free/starter plan.');
38
+ return;
39
+ }
40
+ output(orgs, options);
41
+ }
42
+ catch (e) {
43
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
44
+ process.exit(1);
45
+ }
46
+ });
47
+ nav
48
+ .command('switch-org <org>')
49
+ .description('Switch active workspace (name or ID)')
50
+ .option('--json', 'Force JSON output')
51
+ .action(async (org, options) => {
52
+ try {
53
+ const config = requireCookie();
54
+ const result = await switchOrg(config, { org });
55
+ output({
56
+ previous: result.previous,
57
+ current: result.current,
58
+ }, options);
59
+ }
60
+ catch (e) {
61
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
62
+ process.exit(1);
63
+ }
64
+ });
65
+ nav
66
+ .command('list-teams')
67
+ .description('List all teams you belong to')
68
+ .option('--json', 'Force JSON output')
69
+ .action(async (options) => {
70
+ try {
71
+ const config = requireCookie();
72
+ const teams = await listTeams(config);
73
+ output(teams, options);
74
+ }
75
+ catch (e) {
76
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
77
+ process.exit(1);
78
+ }
79
+ });
80
+ nav
81
+ .command('list-projects <team-id>')
82
+ .description('List projects (folders) in a team')
83
+ .option('--json', 'Force JSON output')
84
+ .action(async (teamId, options) => {
85
+ try {
86
+ const config = requireAuth();
87
+ const projects = await listProjects(config, { team_id: teamId });
88
+ output(projects, options);
89
+ }
90
+ catch (e) {
91
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
92
+ process.exit(1);
93
+ }
94
+ });
95
+ nav
96
+ .command('list-files <project-id>')
97
+ .description('List files in a project')
98
+ .option('--page-size <n>', 'Results per page (default 25, max 100)')
99
+ .option('--page-token <token>', 'Pagination token from previous response')
100
+ .option('--json', 'Force JSON output')
101
+ .action(async (projectId, options) => {
102
+ try {
103
+ const config = requireAuth();
104
+ const result = await listFiles(config, {
105
+ project_id: projectId,
106
+ page_size: options.pageSize ? parseInt(options.pageSize, 10) : undefined,
107
+ page_token: options.pageToken,
108
+ });
109
+ output(result, options);
110
+ }
111
+ catch (e) {
112
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
113
+ process.exit(1);
114
+ }
115
+ });
116
+ nav
117
+ .command('list-recent-files')
118
+ .description('List recently viewed/edited files')
119
+ .option('--json', 'Force JSON output')
120
+ .action(async (options) => {
121
+ try {
122
+ const config = requireCookie();
123
+ const files = await listRecentFiles(config);
124
+ output(files, options);
125
+ }
126
+ catch (e) {
127
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
128
+ process.exit(1);
129
+ }
130
+ });
131
+ nav
132
+ .command('search <query>')
133
+ .description('Search for files across the workspace')
134
+ .option('--sort <order>', 'Sort order: relevancy or last_modified')
135
+ .option('--org-id <id>', 'Org ID override')
136
+ .option('--json', 'Force JSON output')
137
+ .action(async (query, options) => {
138
+ try {
139
+ const config = requireCookie();
140
+ const results = await search(config, {
141
+ query,
142
+ sort: options.sort,
143
+ org_id: options.orgId,
144
+ });
145
+ if (results.length === 0) {
146
+ console.log('No results found.');
147
+ return;
148
+ }
149
+ output(results, options);
150
+ }
151
+ catch (e) {
152
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
153
+ process.exit(1);
154
+ }
155
+ });
156
+ nav
157
+ .command('file-info <file-key>')
158
+ .description('Get metadata for a file')
159
+ .option('--json', 'Force JSON output')
160
+ .action(async (fileKey, options) => {
161
+ try {
162
+ const config = requireAuth();
163
+ const info = await getFileInfo(config, { file_key: fileKey });
164
+ output(info, options);
165
+ }
166
+ catch (e) {
167
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
168
+ process.exit(1);
169
+ }
170
+ });
171
+ nav
172
+ .command('list-favorites')
173
+ .description('List starred/favorited files')
174
+ .option('--json', 'Force JSON output')
175
+ .action(async (options) => {
176
+ try {
177
+ const config = requireCookie();
178
+ const favorites = await listFavorites(config);
179
+ if (favorites.length === 0) {
180
+ console.log('No favorites found.');
181
+ return;
182
+ }
183
+ output(favorites, options);
184
+ }
185
+ catch (e) {
186
+ error(e.response?.status ? `API error: ${e.response.status}` : e.message);
187
+ process.exit(1);
188
+ }
189
+ });
190
+ return nav;
191
+ }
192
+ //# sourceMappingURL=navigate.js.map
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function orgCommand(): Command;
3
+ //# sourceMappingURL=org.d.ts.map
@@ -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