@nebulr-group/bridge-cli 0.1.0-beta.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 (78) hide show
  1. package/README.md +202 -0
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/bin.js +6 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +33 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands/app.command.d.ts +3 -0
  11. package/dist/commands/app.command.d.ts.map +1 -0
  12. package/dist/commands/app.command.js +59 -0
  13. package/dist/commands/app.command.js.map +1 -0
  14. package/dist/commands/auth.command.d.ts +3 -0
  15. package/dist/commands/auth.command.d.ts.map +1 -0
  16. package/dist/commands/auth.command.js +58 -0
  17. package/dist/commands/auth.command.js.map +1 -0
  18. package/dist/commands/branding.command.d.ts +3 -0
  19. package/dist/commands/branding.command.d.ts.map +1 -0
  20. package/dist/commands/branding.command.js +42 -0
  21. package/dist/commands/branding.command.js.map +1 -0
  22. package/dist/commands/event.command.d.ts +3 -0
  23. package/dist/commands/event.command.d.ts.map +1 -0
  24. package/dist/commands/event.command.js +27 -0
  25. package/dist/commands/event.command.js.map +1 -0
  26. package/dist/commands/flag.command.d.ts +3 -0
  27. package/dist/commands/flag.command.d.ts.map +1 -0
  28. package/dist/commands/flag.command.js +76 -0
  29. package/dist/commands/flag.command.js.map +1 -0
  30. package/dist/commands/guide.command.d.ts +3 -0
  31. package/dist/commands/guide.command.d.ts.map +1 -0
  32. package/dist/commands/guide.command.js +168 -0
  33. package/dist/commands/guide.command.js.map +1 -0
  34. package/dist/commands/info.command.d.ts +3 -0
  35. package/dist/commands/info.command.d.ts.map +1 -0
  36. package/dist/commands/info.command.js +70 -0
  37. package/dist/commands/info.command.js.map +1 -0
  38. package/dist/commands/integrate.command.d.ts +3 -0
  39. package/dist/commands/integrate.command.d.ts.map +1 -0
  40. package/dist/commands/integrate.command.js +49 -0
  41. package/dist/commands/integrate.command.js.map +1 -0
  42. package/dist/commands/plan.command.d.ts +3 -0
  43. package/dist/commands/plan.command.d.ts.map +1 -0
  44. package/dist/commands/plan.command.js +52 -0
  45. package/dist/commands/plan.command.js.map +1 -0
  46. package/dist/commands/role.command.d.ts +3 -0
  47. package/dist/commands/role.command.d.ts.map +1 -0
  48. package/dist/commands/role.command.js +65 -0
  49. package/dist/commands/role.command.js.map +1 -0
  50. package/dist/commands/setup.command.d.ts +3 -0
  51. package/dist/commands/setup.command.d.ts.map +1 -0
  52. package/dist/commands/setup.command.js +65 -0
  53. package/dist/commands/setup.command.js.map +1 -0
  54. package/dist/commands/tenant.command.d.ts +3 -0
  55. package/dist/commands/tenant.command.d.ts.map +1 -0
  56. package/dist/commands/tenant.command.js +74 -0
  57. package/dist/commands/tenant.command.js.map +1 -0
  58. package/dist/commands/token.command.d.ts +3 -0
  59. package/dist/commands/token.command.d.ts.map +1 -0
  60. package/dist/commands/token.command.js +45 -0
  61. package/dist/commands/token.command.js.map +1 -0
  62. package/dist/commands/user.command.d.ts +3 -0
  63. package/dist/commands/user.command.d.ts.map +1 -0
  64. package/dist/commands/user.command.js +83 -0
  65. package/dist/commands/user.command.js.map +1 -0
  66. package/dist/config.d.ts +9 -0
  67. package/dist/config.d.ts.map +1 -0
  68. package/dist/config.js +30 -0
  69. package/dist/config.js.map +1 -0
  70. package/dist/index.d.ts +4 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +4 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/output.d.ts +3 -0
  75. package/dist/output.d.ts.map +1 -0
  76. package/dist/output.js +34 -0
  77. package/dist/output.js.map +1 -0
  78. package/package.json +49 -0
@@ -0,0 +1,168 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { outputSuccess, outputError } from '../output.js';
4
+ const GUIDE_BASE_URL = 'https://raw.githubusercontent.com/nebulr-group';
5
+ const GUIDE_REPOS = {
6
+ react: 'bridge-react/main',
7
+ svelte: 'bridge-svelte/main',
8
+ angular: 'bridge-angular/main',
9
+ nextjs: 'bridge-nextjs/main',
10
+ express: 'bridge-express/main',
11
+ nestjs: 'bridge-nestjs/main',
12
+ };
13
+ const AVAILABLE_FEATURES = {
14
+ svelte: ['sdk-auth', 'feature-flags', 'payments', 'team'],
15
+ };
16
+ function guideFilename(feature) {
17
+ if (!feature)
18
+ return 'integration-prompt.md';
19
+ return `${feature}-prompt.md`;
20
+ }
21
+ const guideCache = new Map();
22
+ const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
23
+ export function registerGuideCommands(program) {
24
+ const guide = program.command('guide')
25
+ .description('Integration guides — run with no arguments for the master integration prompt')
26
+ .action(async () => {
27
+ try {
28
+ const content = await fetchMasterPrompt();
29
+ outputSuccess({ guide: content });
30
+ }
31
+ catch (err) {
32
+ outputError(err);
33
+ }
34
+ });
35
+ const technologies = [...Object.keys(GUIDE_REPOS), 'custom'];
36
+ guide.command('list')
37
+ .description('List available integration guides and feature guides')
38
+ .action(() => {
39
+ outputSuccess({ technologies, features: AVAILABLE_FEATURES });
40
+ });
41
+ for (const tech of Object.keys(GUIDE_REPOS)) {
42
+ guide.command(tech)
43
+ .argument('[feature]', 'Feature guide (e.g. sdk-auth, feature-flags, payments, team)')
44
+ .description(`Integration guide for ${tech}`)
45
+ .action(async (feature) => {
46
+ try {
47
+ const content = await fetchGuide(tech, feature);
48
+ outputSuccess({ technology: tech, feature: feature ?? 'default', guide: content });
49
+ }
50
+ catch (err) {
51
+ outputError(err);
52
+ }
53
+ });
54
+ }
55
+ guide.command('custom')
56
+ .description('Universal integration guide for any technology using REST API + JWKS')
57
+ .action(() => {
58
+ outputSuccess({
59
+ technology: 'custom',
60
+ guide: CUSTOM_GUIDE,
61
+ });
62
+ });
63
+ }
64
+ async function fetchGuide(tech, feature) {
65
+ const cacheKey = feature ? `${tech}:${feature}` : tech;
66
+ const cached = guideCache.get(cacheKey);
67
+ if (cached && Date.now() - cached.fetchedAt < CACHE_TTL_MS) {
68
+ return cached.content;
69
+ }
70
+ const repoPrefix = GUIDE_REPOS[tech];
71
+ if (!repoPrefix)
72
+ throw new Error(`Unknown technology: ${tech}`);
73
+ const filename = guideFilename(feature);
74
+ // Local override for development: reads from filesystem before hitting GitHub
75
+ const localDir = process.env.BRIDGE_GUIDE_LOCAL_DIR;
76
+ if (localDir) {
77
+ const localPath = join(localDir, `bridge-${tech}`, 'mcp', filename);
78
+ try {
79
+ const content = await readFile(localPath, 'utf-8');
80
+ guideCache.set(cacheKey, { content, fetchedAt: Date.now() });
81
+ return content;
82
+ }
83
+ catch {
84
+ // Local file not found — fall through to remote fetch
85
+ }
86
+ }
87
+ const url = `${GUIDE_BASE_URL}/${repoPrefix}/mcp/${filename}`;
88
+ const response = await fetch(url);
89
+ if (!response.ok) {
90
+ const label = feature ? `${tech}/${feature}` : tech;
91
+ throw new Error(`Guide not available for ${label} (HTTP ${response.status}). The prompt file may not exist yet in the plugin repo.`);
92
+ }
93
+ const content = await response.text();
94
+ guideCache.set(cacheKey, { content, fetchedAt: Date.now() });
95
+ return content;
96
+ }
97
+ const MASTER_PROMPT_GITHUB_URL = 'https://raw.githubusercontent.com/nebulr-group/bridge-cli/main/prompts/master-integration-prompt.md';
98
+ async function fetchMasterPrompt() {
99
+ // Local override for development
100
+ const localDir = process.env.BRIDGE_GUIDE_LOCAL_DIR;
101
+ if (localDir) {
102
+ const localPath = join(localDir, 'bridge-cli', 'bridge-cli', 'prompts', 'master-integration-prompt.md');
103
+ try {
104
+ return await readFile(localPath, 'utf-8');
105
+ }
106
+ catch { /* fall through */ }
107
+ }
108
+ // Remote fetch
109
+ const response = await fetch(MASTER_PROMPT_GITHUB_URL);
110
+ if (!response.ok) {
111
+ throw new Error(`Master integration prompt not available (HTTP ${response.status})`);
112
+ }
113
+ return response.text();
114
+ }
115
+ const CUSTOM_GUIDE = `# Universal Bridge Integration Guide
116
+
117
+ This guide covers integrating Bridge into any language/framework using the REST API directly.
118
+
119
+ ## 1. Authentication — JWKS-based JWT Verification
120
+
121
+ Bridge issues JWTs signed with PS256. Verify them using your app's JWKS endpoint:
122
+
123
+ \`\`\`
124
+ GET https://account-api.thebridge.dev/v1/account/app/.well-known/jwks.json
125
+ \`\`\`
126
+
127
+ Use a JWT library in your language that supports JWKS auto-refresh:
128
+ - Node.js: \`jose\`
129
+ - Python: \`PyJWKClient\` from \`PyJWT\`
130
+ - Go: \`github.com/lestrrat-go/jwx\`
131
+ - Java: \`com.nimbusds:nimbus-jose-jwt\`
132
+ - Ruby: \`jwt\` gem
133
+
134
+ ## 2. Token Structure
135
+
136
+ The access token contains:
137
+ - \`sub\` — User ID
138
+ - \`tid\` — Tenant ID
139
+ - \`role\` — User's role
140
+ - \`privileges\` — Array of privilege strings
141
+ - \`plan\` — Tenant's plan key
142
+
143
+ ## 3. Feature Flags
144
+
145
+ Evaluate flags server-side:
146
+ \`\`\`
147
+ POST https://account-api.thebridge.dev/cloud-views/flags/bulkEvaluate/{appId}
148
+ Authorization: Bearer <user-access-token>
149
+ \`\`\`
150
+
151
+ ## 4. User/Tenant Management
152
+
153
+ Use the Bridge REST API with an API token:
154
+ \`\`\`
155
+ GET https://account-api.thebridge.dev/v1/account/tenant
156
+ x-api-key: <your-api-token>
157
+ \`\`\`
158
+
159
+ ## 5. Webhooks
160
+
161
+ Configure a webhook URL in your app settings to receive events:
162
+ - User created/updated/deleted
163
+ - Tenant created/updated
164
+ - Subscription changes
165
+
166
+ See the Bridge API documentation for the full webhook payload format.
167
+ `;
168
+ //# sourceMappingURL=guide.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guide.command.js","sourceRoot":"","sources":["../../src/commands/guide.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO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AAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACtC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,wBAAwB,GAC5B,qGAAqG,CAAC;AAExG,KAAK,UAAU,iBAAiB;IAC9B,iCAAiC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,8BAA8B,CAAC,CAAC;QACxG,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAChC,CAAC;IAED,eAAe;IACf,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,iDAAiD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDpB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerInfoCommands(program: Command): void;
3
+ //# sourceMappingURL=info.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.command.d.ts","sourceRoot":"","sources":["../../src/commands/info.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoD3D"}
@@ -0,0 +1,70 @@
1
+ import { getManagementClient } from '../config.js';
2
+ import { outputSuccess, outputError } from '../output.js';
3
+ export function registerInfoCommands(program) {
4
+ const info = program.command('info').description('Get contextual information (for AI agents)');
5
+ info.command('app')
6
+ .description('Full app configuration snapshot')
7
+ .action(async () => {
8
+ try {
9
+ outputSuccess(await getManagementClient().app.get());
10
+ }
11
+ catch (err) {
12
+ outputError(err);
13
+ }
14
+ });
15
+ info.command('auth-config')
16
+ .description('Current authentication configuration')
17
+ .action(async () => {
18
+ try {
19
+ const app = await getManagementClient().app.get();
20
+ outputSuccess({
21
+ mfaEnabled: app.mfaEnabled,
22
+ passkeysEnabled: app.passkeysEnabled,
23
+ magicLinkEnabled: app.magicLinkEnabled,
24
+ googleSsoEnabled: app.googleSsoEnabled,
25
+ azureAdSsoEnabled: app.azureAdSsoEnabled,
26
+ githubSsoEnabled: app.githubSsoEnabled,
27
+ linkedinSsoEnabled: app.linkedinSsoEnabled,
28
+ facebookSsoEnabled: app.facebookSsoEnabled,
29
+ appleSsoEnabled: app.appleSsoEnabled,
30
+ stripeEnabled: app.stripeEnabled,
31
+ tenantSelfSignup: app.tenantSelfSignup,
32
+ onboardingFlow: app.onboardingFlow,
33
+ });
34
+ }
35
+ catch (err) {
36
+ outputError(err);
37
+ }
38
+ });
39
+ info.command('flags')
40
+ .description('All feature flags with current state')
41
+ .action(async () => {
42
+ try {
43
+ outputSuccess(await getManagementClient().flags.list());
44
+ }
45
+ catch (err) {
46
+ outputError(err);
47
+ }
48
+ });
49
+ info.command('plans')
50
+ .description('Subscription plans')
51
+ .action(async () => {
52
+ try {
53
+ outputSuccess(await getManagementClient().plans.list());
54
+ }
55
+ catch (err) {
56
+ outputError(err);
57
+ }
58
+ });
59
+ info.command('roles')
60
+ .description('Access roles and privileges')
61
+ .action(async () => {
62
+ try {
63
+ outputSuccess(await getManagementClient().roles.list());
64
+ }
65
+ catch (err) {
66
+ outputError(err);
67
+ }
68
+ });
69
+ }
70
+ //# sourceMappingURL=info.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info.command.js","sourceRoot":"","sources":["../../src/commands/info.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,4CAA4C,CAAC,CAAC;IAE/F,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;SAChB,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YAAC,aAAa,CAAC,MAAM,mBAAmB,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;SACxB,WAAW,CAAC,sCAAsC,CAAC;SACnD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,mBAAmB,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;YAClD,aAAa,CAAC;gBACZ,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,eAAe,EAAE,GAAG,CAAC,eAAe;gBACpC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;gBACxC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB;gBACtC,kBAAkB,E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AAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerIntegrateCommand(program: Command): void;
3
+ //# sourceMappingURL=integrate.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrate.command.d.ts","sourceRoot":"","sources":["../../src/commands/integrate.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAY/D"}
@@ -0,0 +1,49 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join, dirname } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { outputSuccess, outputError } from '../output.js';
5
+ const MASTER_PROMPT_GITHUB_URL = 'https://raw.githubusercontent.com/nebulr-group/bridge-cli/main/prompts/master-integration-prompt.md';
6
+ export function registerIntegrateCommand(program) {
7
+ program
8
+ .command('integrate')
9
+ .description('Get the master integration prompt — detects your project and guides you through Bridge setup')
10
+ .action(async () => {
11
+ try {
12
+ const content = await fetchMasterPrompt();
13
+ outputSuccess({ guide: content });
14
+ }
15
+ catch (err) {
16
+ outputError(err);
17
+ }
18
+ });
19
+ }
20
+ async function fetchMasterPrompt() {
21
+ // Local override for development
22
+ const localDir = process.env.BRIDGE_GUIDE_LOCAL_DIR;
23
+ if (localDir) {
24
+ // The master prompt lives alongside the CLI, not in a plugin repo
25
+ const localPath = join(localDir, 'bridge-cli', 'bridge-cli', 'prompts', 'master-integration-prompt.md');
26
+ try {
27
+ return await readFile(localPath, 'utf-8');
28
+ }
29
+ catch {
30
+ // Fall through to bundled copy
31
+ }
32
+ }
33
+ // Try bundled copy (relative to dist/)
34
+ try {
35
+ const __dirname = dirname(fileURLToPath(import.meta.url));
36
+ const bundledPath = join(__dirname, '..', 'prompts', 'master-integration-prompt.md');
37
+ return await readFile(bundledPath, 'utf-8');
38
+ }
39
+ catch {
40
+ // Fall through to remote fetch
41
+ }
42
+ // Remote fetch as last resort
43
+ const response = await fetch(MASTER_PROMPT_GITHUB_URL);
44
+ if (!response.ok) {
45
+ throw new Error(`Master integration prompt not available (HTTP ${response.status})`);
46
+ }
47
+ return response.text();
48
+ }
49
+ //# sourceMappingURL=integrate.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrate.command.js","sourceRoot":"","sources":["../../src/commands/integrate.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,wBAAwB,GAC5B,qGAAqG,CAAC;AAExG,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,8FAA8F,CAAC;SAC3G,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAC;YAC1C,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,KAAK,UAAU,iBAAiB;IAC9B,iCAAiC;IACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ,EAAE,CAAC;QACb,kEAAkE;QAClE,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,8BAA8B,CAAC,CAAC;QACxG,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,+BAA+B;QACjC,CAAC;IACH,CAAC;IAED,uCAAuC;IACvC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,8BAA8B,CAAC,CAAC;QACrF,OAAO,MAAM,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;IAED,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACvD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,iDAAiD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerPlanCommands(program: Command): void;
3
+ //# sourceMappingURL=plan.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../src/commands/plan.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyC3D"}
@@ -0,0 +1,52 @@
1
+ import { getManagementClient } from '../config.js';
2
+ import { outputSuccess, outputError } from '../output.js';
3
+ export function registerPlanCommands(program) {
4
+ const plan = program.command('plan').description('Manage subscription plans');
5
+ plan.command('list')
6
+ .description('List all subscription plans')
7
+ .action(async () => {
8
+ try {
9
+ outputSuccess(await getManagementClient().plans.list());
10
+ }
11
+ catch (err) {
12
+ outputError(err);
13
+ }
14
+ });
15
+ plan.command('create')
16
+ .description('Create a new plan')
17
+ .requiredOption('--key <key>', 'Plan key')
18
+ .requiredOption('--name <name>', 'Plan name')
19
+ .option('--description <desc>', 'Description')
20
+ .option('--trial', 'Include trial period', false)
21
+ .option('--trial-days <days>', 'Trial period in days', parseInt)
22
+ .action(async (opts) => {
23
+ try {
24
+ outputSuccess(await getManagementClient().plans.create({
25
+ key: opts.key,
26
+ name: opts.name,
27
+ description: opts.description,
28
+ trial: opts.trial,
29
+ trialDays: opts.trialDays,
30
+ }));
31
+ }
32
+ catch (err) {
33
+ outputError(err);
34
+ }
35
+ });
36
+ plan.command('update')
37
+ .description('Update a plan')
38
+ .requiredOption('--key <key>', 'Plan key')
39
+ .option('--name <name>', 'Plan name')
40
+ .option('--description <desc>', 'Description')
41
+ .action(async (opts) => {
42
+ try {
43
+ const { key, ...data } = opts;
44
+ const cleaned = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
45
+ outputSuccess(await getManagementClient().plans.update(key, cleaned));
46
+ }
47
+ catch (err) {
48
+ outputError(err);
49
+ }
50
+ });
51
+ }
52
+ //# sourceMappingURL=plan.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.command.js","sourceRoot":"","sources":["../../src/commands/plan.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAE9E,IAAI,CAAC,OAAO,CAAC,MAA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SACpC,MAAM,CAAC,sBAAsB,EAAE,aAAa,CAAC;SAC7C,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;YAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;YAC5F,aAAa,CAAC,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;QACxE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerRoleCommands(program: Command): void;
3
+ //# sourceMappingURL=role.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.command.d.ts","sourceRoot":"","sources":["../../src/commands/role.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoD3D"}
@@ -0,0 +1,65 @@
1
+ import { getManagementClient } from '../config.js';
2
+ import { outputSuccess, outputError } from '../output.js';
3
+ export function registerRoleCommands(program) {
4
+ const role = program.command('role').description('Manage access roles');
5
+ role.command('list')
6
+ .description('List all access roles')
7
+ .action(async () => {
8
+ try {
9
+ outputSuccess(await getManagementClient().roles.list());
10
+ }
11
+ catch (err) {
12
+ outputError(err);
13
+ }
14
+ });
15
+ role.command('create')
16
+ .description('Create a new access role')
17
+ .requiredOption('--name <name>', 'Role name')
18
+ .requiredOption('--key <key>', 'Role key')
19
+ .option('--description <desc>', 'Description')
20
+ .option('--privileges <list>', 'Comma-separated privilege keys', (v) => v.split(','))
21
+ .option('--is-default', 'Set as default role', false)
22
+ .action(async (opts) => {
23
+ try {
24
+ outputSuccess(await getManagementClient().roles.create({
25
+ name: opts.name,
26
+ key: opts.key,
27
+ description: opts.description,
28
+ privileges: opts.privileges ?? [],
29
+ isDefault: opts.isDefault,
30
+ }));
31
+ }
32
+ catch (err) {
33
+ outputError(err);
34
+ }
35
+ });
36
+ role.command('update')
37
+ .description('Update an access role')
38
+ .requiredOption('--id <id>', 'Role ID')
39
+ .option('--name <name>', 'Role name')
40
+ .option('--description <desc>', 'Description')
41
+ .option('--privileges <list>', 'Comma-separated privilege keys', (v) => v.split(','))
42
+ .action(async (opts) => {
43
+ try {
44
+ const { id, ...data } = opts;
45
+ const cleaned = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
46
+ outputSuccess(await getManagementClient().roles.update(id, cleaned));
47
+ }
48
+ catch (err) {
49
+ outputError(err);
50
+ }
51
+ });
52
+ role.command('delete')
53
+ .description('Delete an access role')
54
+ .requiredOption('--id <id>', 'Role ID')
55
+ .action(async (opts) => {
56
+ try {
57
+ await getManagementClient().roles.delete(opts.id);
58
+ outputSuccess({ deleted: true, id: opts.id });
59
+ }
60
+ catch (err) {
61
+ outputError(err);
62
+ }
63
+ });
64
+ }
65
+ //# sourceMappingURL=role.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.command.js","sourceRoot":"","sources":["../../src/commands/role.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CA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AAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerSetupCommands(program: Command): void;
3
+ //# sourceMappingURL=setup.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.command.d.ts","sourceRoot":"","sources":["../../src/commands/setup.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuD5D"}
@@ -0,0 +1,65 @@
1
+ import { getManagementClient } from '../config.js';
2
+ import { outputSuccess, outputError } from '../output.js';
3
+ export function registerSetupCommands(program) {
4
+ const setup = program.command('setup').description('Run setup workflows (multi-step operations)');
5
+ setup.command('sso')
6
+ .description('Enable an SSO provider and get callback URL')
7
+ .requiredOption('--provider <provider>', 'SSO provider: google, azure, github, linkedin, facebook, saml, oidc')
8
+ .option('--client-id <id>', 'OAuth client ID')
9
+ .option('--client-secret <secret>', 'OAuth client secret')
10
+ .option('--metadata-url <url>', 'SAML metadata URL')
11
+ .option('--discovery-url <url>', 'OIDC discovery URL')
12
+ .action(async (opts) => {
13
+ try {
14
+ outputSuccess(await getManagementClient().workflows.setupSSO({
15
+ provider: opts.provider,
16
+ config: {
17
+ clientId: opts.clientId,
18
+ clientSecret: opts.clientSecret,
19
+ metadataUrl: opts.metadataUrl,
20
+ discoveryUrl: opts.discoveryUrl,
21
+ },
22
+ }));
23
+ }
24
+ catch (err) {
25
+ outputError(err);
26
+ }
27
+ });
28
+ setup.command('payments')
29
+ .description('Connect Stripe and optionally create plans')
30
+ .requiredOption('--stripe-key <key>', 'Stripe secret key')
31
+ .option('--stripe-public-key <key>', 'Stripe public key')
32
+ .action(async (opts) => {
33
+ try {
34
+ outputSuccess(await getManagementClient().workflows.setupPayments({
35
+ stripeSecretKey: opts.stripeKey,
36
+ stripePublicKey: opts.stripePublicKey,
37
+ }));
38
+ }
39
+ catch (err) {
40
+ outputError(err);
41
+ }
42
+ });
43
+ setup.command('communication')
44
+ .description('Configure email/communication provider')
45
+ .requiredOption('--provider <provider>', 'Provider name (e.g., sendgrid)')
46
+ .requiredOption('--api-key <key>', 'Provider API key')
47
+ .option('--from-address <email>', 'Sender email address')
48
+ .option('--from-name <name>', 'Sender name')
49
+ .action(async (opts) => {
50
+ try {
51
+ outputSuccess(await getManagementClient().workflows.setupCommunication({
52
+ provider: opts.provider,
53
+ config: {
54
+ apiKey: opts.apiKey,
55
+ fromAddress: opts.fromAddress,
56
+ fromName: opts.fromName,
57
+ },
58
+ }));
59
+ }
60
+ catch (err) {
61
+ outputError(err);
62
+ }
63
+ });
64
+ }
65
+ //# sourceMappingURL=setup.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.command.js","sourceRoot":"","sources":["../../src/commands/setup.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG1D,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,6CAA6C,CAAC,CAAC;IAElG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;SACjB,WAAW,CAAC,6CAA6C,CAAC;SAC1D,cAAc,CAAC,uBAAuB,EAAE,qEAAqE,CAAC;SAC9G,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAAC;SAC7C,MAAM,CAAC,0BAA0B,EAAE,qBAAqB,CAAC;SACzD,MAAM,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;SACnD,MAAM,CAAC,uBAAuB,EAAE,oBAAoB,CAAC;SACrD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,aA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AAE,EAAE;QACrB,IAAI,CAAC;YACH,aAAa,CAAC,MAAM,mBAAmB,EAAE,CAAC,SAAS,CAAC,kBAAkB,CAAC;gBACrE,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB;aACF,CAAC,CAAC,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTenantCommands(program: Command): void;
3
+ //# sourceMappingURL=tenant.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant.command.d.ts","sourceRoot":"","sources":["../../src/commands/tenant.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0D7D"}
@@ -0,0 +1,74 @@
1
+ import { getManagementClient } from '../config.js';
2
+ import { outputSuccess, outputError } from '../output.js';
3
+ export function registerTenantCommands(program) {
4
+ const tenant = program.command('tenant').description('Manage tenants');
5
+ tenant.command('list')
6
+ .description('List all tenants')
7
+ .action(async () => {
8
+ try {
9
+ outputSuccess(await getManagementClient().tenants.list());
10
+ }
11
+ catch (err) {
12
+ outputError(err);
13
+ }
14
+ });
15
+ tenant.command('get')
16
+ .description('Get tenant by ID')
17
+ .requiredOption('--id <id>', 'Tenant ID')
18
+ .action(async (opts) => {
19
+ try {
20
+ outputSuccess(await getManagementClient().tenants.get(opts.id));
21
+ }
22
+ catch (err) {
23
+ outputError(err);
24
+ }
25
+ });
26
+ tenant.command('create')
27
+ .description('Create a new tenant')
28
+ .requiredOption('--owner-email <email>', 'Owner email address')
29
+ .option('--name <name>', 'Tenant name')
30
+ .option('--plan <plan>', 'Plan key')
31
+ .option('--locale <locale>', 'Locale (ISO 639-1)')
32
+ .action(async (opts) => {
33
+ try {
34
+ outputSuccess(await getManagementClient().tenants.create({
35
+ owner: { email: opts.ownerEmail },
36
+ name: opts.name,
37
+ plan: opts.plan,
38
+ locale: opts.locale,
39
+ }));
40
+ }
41
+ catch (err) {
42
+ outputError(err);
43
+ }
44
+ });
45
+ tenant.command('update')
46
+ .description('Update a tenant')
47
+ .requiredOption('--id <id>', 'Tenant ID')
48
+ .option('--name <name>', 'Tenant name')
49
+ .option('--locale <locale>', 'Locale')
50
+ .option('--logo <url>', 'Logo URL')
51
+ .action(async (opts) => {
52
+ try {
53
+ const { id, ...data } = opts;
54
+ const cleaned = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
55
+ outputSuccess(await getManagementClient().tenants.update(id, cleaned));
56
+ }
57
+ catch (err) {
58
+ outputError(err);
59
+ }
60
+ });
61
+ tenant.command('delete')
62
+ .description('Delete a tenant')
63
+ .requiredOption('--id <id>', 'Tenant ID')
64
+ .action(async (opts) => {
65
+ try {
66
+ await getManagementClient().tenants.delete(opts.id);
67
+ outputSuccess({ deleted: true, id: opts.id });
68
+ }
69
+ catch (err) {
70
+ outputError(err);
71
+ }
72
+ });
73
+ }
74
+ //# sourceMappingURL=tenant.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant.command.js","sourceRoot":"","sources":["../../src/commands/tenant.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAEv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