@hyperdrive.bot/cli 1.0.13 → 1.0.16

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 (157) hide show
  1. package/README.md +1495 -474
  2. package/dist/commands/deploy.d.ts +18 -0
  3. package/dist/commands/deploy.js +239 -0
  4. package/dist/commands/deployment/create.js +10 -2
  5. package/dist/commands/domain/{switch.d.ts → set-production.d.ts} +1 -1
  6. package/dist/commands/domain/set-production.js +27 -0
  7. package/dist/commands/git/list-open-prs.d.ts +12 -0
  8. package/dist/commands/git/list-open-prs.js +87 -0
  9. package/dist/commands/hook/add.d.ts +22 -0
  10. package/dist/commands/hook/add.js +299 -0
  11. package/dist/commands/hook/list.d.ts +11 -0
  12. package/dist/commands/hook/list.js +111 -0
  13. package/dist/commands/hook/logs.d.ts +13 -0
  14. package/dist/commands/hook/logs.js +124 -0
  15. package/dist/commands/hook/remove.d.ts +12 -0
  16. package/dist/commands/hook/remove.js +115 -0
  17. package/dist/commands/hook/toggle.d.ts +12 -0
  18. package/dist/commands/hook/toggle.js +125 -0
  19. package/dist/commands/init.d.ts +1 -1
  20. package/dist/commands/init.js +49 -9
  21. package/dist/commands/module/bindings.d.ts +14 -0
  22. package/dist/commands/module/bindings.js +125 -0
  23. package/dist/commands/module/create.d.ts +3 -0
  24. package/dist/commands/module/create.js +156 -78
  25. package/dist/commands/module/list.d.ts +1 -0
  26. package/dist/commands/module/list.js +22 -1
  27. package/dist/commands/module/sync.d.ts +29 -0
  28. package/dist/commands/module/sync.js +409 -0
  29. package/dist/commands/module/unlink.d.ts +11 -0
  30. package/dist/commands/module/unlink.js +77 -0
  31. package/dist/commands/module/update.d.ts +10 -0
  32. package/dist/commands/module/update.js +168 -5
  33. package/dist/commands/network/discover.d.ts +12 -0
  34. package/dist/commands/network/discover.js +210 -0
  35. package/dist/commands/network/get.d.ts +13 -0
  36. package/dist/commands/network/get.js +90 -0
  37. package/dist/commands/{auth/logout.d.ts → network/list.d.ts} +2 -9
  38. package/dist/commands/network/list.js +71 -0
  39. package/dist/commands/network/register.d.ts +16 -0
  40. package/dist/commands/network/register.js +144 -0
  41. package/dist/commands/parameter/sync.d.ts +13 -0
  42. package/dist/commands/parameter/sync.js +69 -1
  43. package/dist/commands/project/sync.d.ts +5 -11
  44. package/dist/commands/project/sync.js +12 -381
  45. package/dist/commands/seed.d.ts +93 -0
  46. package/dist/commands/seed.js +324 -0
  47. package/dist/commands/service/backup.d.ts +17 -0
  48. package/dist/commands/service/backup.js +156 -0
  49. package/dist/commands/service/backups.d.ts +14 -0
  50. package/dist/commands/service/backups.js +110 -0
  51. package/dist/commands/service/bind.d.ts +16 -0
  52. package/dist/commands/service/bind.js +106 -0
  53. package/dist/commands/service/bindings.d.ts +13 -0
  54. package/dist/commands/service/bindings.js +78 -0
  55. package/dist/commands/service/clone.d.ts +19 -0
  56. package/dist/commands/service/clone.js +153 -0
  57. package/dist/commands/service/create.d.ts +16 -0
  58. package/dist/commands/service/create.js +212 -0
  59. package/dist/commands/service/get.d.ts +13 -0
  60. package/dist/commands/service/get.js +97 -0
  61. package/dist/commands/service/list.d.ts +12 -0
  62. package/dist/commands/service/list.js +86 -0
  63. package/dist/commands/service/register.d.ts +21 -0
  64. package/dist/commands/service/register.js +215 -0
  65. package/dist/commands/service/restore.d.ts +19 -0
  66. package/dist/commands/service/restore.js +158 -0
  67. package/dist/commands/service/seed.d.ts +17 -0
  68. package/dist/commands/service/seed.js +173 -0
  69. package/dist/commands/service/templates.d.ts +10 -0
  70. package/dist/commands/service/templates.js +66 -0
  71. package/dist/commands/service/unbind.d.ts +15 -0
  72. package/dist/commands/service/unbind.js +74 -0
  73. package/dist/commands/stage/create.d.ts +23 -0
  74. package/dist/commands/stage/create.js +145 -6
  75. package/dist/commands/stage/delete.d.ts +11 -0
  76. package/dist/commands/stage/delete.js +85 -0
  77. package/dist/commands/stage/deploy.d.ts +34 -0
  78. package/dist/commands/stage/deploy.js +294 -0
  79. package/dist/commands/stage/ensure-branches.d.ts +23 -0
  80. package/dist/commands/stage/ensure-branches.js +101 -0
  81. package/dist/commands/stage/list.js +4 -0
  82. package/dist/commands/stage/status.d.ts +14 -0
  83. package/dist/commands/stage/status.js +100 -0
  84. package/dist/commands/{jira → tracker}/connect.js +32 -23
  85. package/dist/commands/tracker/hook/add.d.ts +25 -0
  86. package/dist/commands/tracker/hook/add.js +284 -0
  87. package/dist/commands/{jira → tracker}/hook/list.js +20 -11
  88. package/dist/commands/{jira/hook/add.d.ts → tracker/hook/logs.d.ts} +2 -3
  89. package/dist/commands/tracker/hook/logs.js +126 -0
  90. package/dist/commands/{jira → tracker}/hook/remove.js +9 -8
  91. package/dist/commands/{jira → tracker}/hook/toggle.js +14 -12
  92. package/dist/commands/tracker/project/init.d.ts +17 -0
  93. package/dist/commands/tracker/project/init.js +178 -0
  94. package/dist/commands/tracker/project/link-module.d.ts +17 -0
  95. package/dist/commands/tracker/project/link-module.js +287 -0
  96. package/dist/commands/tracker/project/list-modules.d.ts +11 -0
  97. package/dist/commands/tracker/project/list-modules.js +117 -0
  98. package/dist/commands/tracker/project/list.d.ts +10 -0
  99. package/dist/commands/tracker/project/list.js +90 -0
  100. package/dist/commands/tracker/project/status.d.ts +13 -0
  101. package/dist/commands/tracker/project/status.js +168 -0
  102. package/dist/commands/tracker/project/unlink-module.d.ts +13 -0
  103. package/dist/commands/tracker/project/unlink-module.js +251 -0
  104. package/dist/commands/{jira → tracker}/status.js +3 -3
  105. package/dist/lib/ensure-branches.d.ts +53 -0
  106. package/dist/lib/ensure-branches.js +149 -0
  107. package/dist/lib/git-providers/github.d.ts +16 -0
  108. package/dist/lib/git-providers/github.js +157 -0
  109. package/dist/lib/git-providers/gitlab.d.ts +16 -0
  110. package/dist/lib/git-providers/gitlab.js +148 -0
  111. package/dist/lib/git-providers/index.d.ts +67 -0
  112. package/dist/lib/git-providers/index.js +39 -0
  113. package/dist/lib/lambda-warmer.d.ts +106 -0
  114. package/dist/lib/lambda-warmer.js +189 -0
  115. package/dist/services/hyperdrive-sigv4.d.ts +359 -5
  116. package/dist/services/hyperdrive-sigv4.js +177 -12
  117. package/dist/utils/hook-flow.d.ts +60 -3
  118. package/dist/utils/hook-flow.js +437 -2
  119. package/dist/utils/hook-normalize.d.ts +6 -0
  120. package/dist/utils/hook-normalize.js +33 -0
  121. package/dist/utils/lifecycle-poller.d.ts +32 -0
  122. package/dist/utils/lifecycle-poller.js +72 -0
  123. package/dist/utils/retry.d.ts +43 -0
  124. package/dist/utils/retry.js +88 -0
  125. package/dist/utils/summary-display.js +1 -1
  126. package/dist/utils/tracker-project-flow.d.ts +84 -0
  127. package/dist/utils/tracker-project-flow.js +564 -0
  128. package/package.json +35 -7
  129. package/dist/commands/auth/login.d.ts +0 -16
  130. package/dist/commands/auth/login.js +0 -179
  131. package/dist/commands/auth/logout.js +0 -116
  132. package/dist/commands/auth/refresh.d.ts +0 -6
  133. package/dist/commands/auth/refresh.js +0 -66
  134. package/dist/commands/auth/status.d.ts +0 -6
  135. package/dist/commands/auth/status.js +0 -63
  136. package/dist/commands/config/get.d.ts +0 -9
  137. package/dist/commands/config/get.js +0 -37
  138. package/dist/commands/config/set.d.ts +0 -10
  139. package/dist/commands/config/set.js +0 -48
  140. package/dist/commands/config/show.d.ts +0 -6
  141. package/dist/commands/config/show.js +0 -10
  142. package/dist/commands/domain/current.d.ts +0 -6
  143. package/dist/commands/domain/current.js +0 -18
  144. package/dist/commands/domain/list.d.ts +0 -6
  145. package/dist/commands/domain/list.js +0 -42
  146. package/dist/commands/domain/switch.js +0 -40
  147. package/dist/commands/jira/hook/add.js +0 -147
  148. package/dist/services/tenant-service.d.ts +0 -127
  149. package/dist/services/tenant-service.js +0 -396
  150. package/dist/utils/auth-flow.d.ts +0 -147
  151. package/dist/utils/auth-flow.js +0 -479
  152. package/oclif.manifest.json +0 -3519
  153. /package/dist/commands/{jira → tracker}/connect.d.ts +0 -0
  154. /package/dist/commands/{jira → tracker}/hook/list.d.ts +0 -0
  155. /package/dist/commands/{jira → tracker}/hook/remove.d.ts +0 -0
  156. /package/dist/commands/{jira → tracker}/hook/toggle.d.ts +0 -0
  157. /package/dist/commands/{jira → tracker}/status.d.ts +0 -0
@@ -1,40 +0,0 @@
1
- import { Args, Command } from '@oclif/core';
2
- import chalk from 'chalk';
3
- import { AuthService } from '../../services/auth-service.js';
4
- import { TenantService } from '../../services/tenant-service.js';
5
- export default class DomainSwitch extends Command {
6
- static args = {
7
- domain: Args.string({
8
- description: 'The domain to set as default',
9
- required: true,
10
- }),
11
- };
12
- static description = 'Switch the default domain for CLI commands';
13
- static examples = [
14
- '<%= config.bin %> <%= command.id %> acme.hyperdrive.bot',
15
- ];
16
- async run() {
17
- const { args } = await this.parse(DomainSwitch);
18
- const tenantService = new TenantService();
19
- const authService = new AuthService();
20
- // Verify domain exists
21
- const credentialDomains = authService.getCredentialDomains();
22
- const configuredDomains = tenantService.getConfiguredDomains();
23
- const allDomains = [...credentialDomains, ...configuredDomains];
24
- if (!allDomains.includes(args.domain)) {
25
- this.error(chalk.red(`Domain "${args.domain}" not found.\n\n`) +
26
- chalk.yellow('Available domains:\n') +
27
- (allDomains.length > 0
28
- ? allDomains.map(d => ` - ${d}`).join('\n')
29
- : chalk.gray(' No domains configured yet.')) +
30
- '\n\n' +
31
- chalk.gray('💡 Run `hd auth login --domain <domain>` to add a new domain.'));
32
- }
33
- // Set as default
34
- tenantService.setDefaultDomain(args.domain);
35
- this.log(chalk.green(`✅ Default domain switched to: ${chalk.cyan(args.domain)}`));
36
- this.log('');
37
- this.log(chalk.gray('All commands will now use this domain by default.'));
38
- this.log(chalk.gray('You can still use `--domain <domain>` to override temporarily.'));
39
- }
40
- }
@@ -1,147 +0,0 @@
1
- import { Args, Command, Flags } from '@oclif/core';
2
- import chalk from 'chalk';
3
- import ora from 'ora';
4
- import { HyperdriveSigV4Service } from '../../../services/hyperdrive-sigv4.js';
5
- import { promptActionConfig, promptActionType, promptTriggerStatus } from '../../../utils/hook-flow.js';
6
- const VALID_ACTION_TYPES = ['adhb-enrich', 'ci-trigger', 'slack-notify', 'webhook'];
7
- export default class HookAdd extends Command {
8
- static args = {
9
- project: Args.string({ description: 'Hyperdrive project ID or slug', required: true }),
10
- };
11
- static description = 'Add a status transition hook to a Jira-linked project';
12
- static examples = [
13
- '<%= config.bin %> jira hook add my-project',
14
- '<%= config.bin %> jira hook add my-project --status "In Progress" --action adhb-enrich --config \'{"priority":"high"}\'',
15
- '<%= config.bin %> jira hook add my-project --json',
16
- ];
17
- static flags = {
18
- action: Flags.string({
19
- description: 'Action type (slack-notify, adhb-enrich, webhook, ci-trigger)',
20
- }),
21
- config: Flags.string({
22
- description: 'Action config as JSON string',
23
- }),
24
- domain: Flags.string({
25
- char: 'd',
26
- description: 'Hyperdrive tenant domain',
27
- }),
28
- json: Flags.boolean({
29
- description: 'Output raw JSON',
30
- }),
31
- status: Flags.string({
32
- description: 'Trigger status (Jira status name or "*" for all)',
33
- }),
34
- };
35
- async run() {
36
- const { args, flags } = await this.parse(HookAdd);
37
- const isJson = flags.json;
38
- // Authenticate
39
- let apiService;
40
- const spinner = isJson ? null : ora('Checking authentication...').start();
41
- try {
42
- apiService = new HyperdriveSigV4Service(flags.domain);
43
- spinner?.succeed('Authenticated');
44
- }
45
- catch (error) {
46
- spinner?.fail('Not authenticated');
47
- this.error(`${error.message}\n\n` +
48
- `Please authenticate first with: ${chalk.cyan('hd auth login')}`);
49
- }
50
- // Determine interactive vs non-interactive mode
51
- const hasAllFlags = flags.status && flags.action && flags.config;
52
- const hasPartialFlags = flags.status || flags.action || flags.config;
53
- if (hasPartialFlags && !hasAllFlags) {
54
- this.error('Non-interactive mode requires all three flags: --status, --action, and --config\n' +
55
- `Missing: ${[!flags.status && '--status', !flags.action && '--action', !flags.config && '--config'].filter(Boolean).join(', ')}`);
56
- }
57
- let triggerStatus;
58
- let actionType;
59
- let actionConfig;
60
- if (hasAllFlags) {
61
- // Non-interactive mode
62
- triggerStatus = flags.status;
63
- if (!VALID_ACTION_TYPES.includes(flags.action)) {
64
- this.error(`Invalid action type: ${flags.action}. Must be one of: ${VALID_ACTION_TYPES.join(', ')}`);
65
- }
66
- actionType = flags.action;
67
- try {
68
- actionConfig = JSON.parse(flags.config);
69
- }
70
- catch {
71
- this.error('Invalid JSON in --config flag');
72
- }
73
- }
74
- else {
75
- // Interactive mode
76
- if (isJson) {
77
- this.error('Interactive mode not supported with --json. Provide --status, --action, and --config flags.');
78
- }
79
- // Fetch project statuses for the wizard
80
- spinner?.start('Fetching project statuses...');
81
- let statuses = [];
82
- try {
83
- const result = await apiService.projectGetJiraStatuses(args.project);
84
- statuses = result.statuses.map(s => s.name);
85
- spinner?.succeed(`Found ${statuses.length} statuses`);
86
- }
87
- catch {
88
- spinner?.warn('Could not fetch statuses — you can still enter a status manually');
89
- }
90
- this.log('');
91
- triggerStatus = await promptTriggerStatus(statuses);
92
- actionType = await promptActionType();
93
- actionConfig = await promptActionConfig(actionType);
94
- }
95
- // Create hook
96
- const createSpinner = isJson ? null : ora('Creating hook...').start();
97
- try {
98
- const body = {
99
- actionConfig,
100
- actionType,
101
- triggerStatus,
102
- };
103
- const hook = await apiService.hookCreate(args.project, body);
104
- createSpinner?.succeed('Hook created');
105
- if (isJson) {
106
- this.log(JSON.stringify(hook, null, 2));
107
- return;
108
- }
109
- this.log('');
110
- this.log(chalk.green('✅ Hook created successfully'));
111
- this.log('');
112
- this.log(` Hook ID: ${chalk.cyan(hook.hookId)}`);
113
- this.log(` Trigger Status: ${chalk.cyan(hook.triggerStatus)}`);
114
- this.log(` Action Type: ${chalk.cyan(hook.actionType)}`);
115
- this.log(` Enabled: ${hook.enabled ? chalk.green('yes') : chalk.red('no')}`);
116
- this.log(` Created: ${chalk.dim(hook.createdAt)}`);
117
- this.log('');
118
- }
119
- catch (error) {
120
- createSpinner?.fail('Failed to create hook');
121
- this.handleApiError(error);
122
- }
123
- }
124
- handleApiError(error) {
125
- let errorMessage = error.message;
126
- if (error.response) {
127
- const status = error.response.status;
128
- const data = error.response.data;
129
- if (status === 401) {
130
- errorMessage = 'Authentication failed — please run "hd auth login"';
131
- }
132
- else if (status === 403) {
133
- errorMessage = 'Access denied — check your permissions';
134
- }
135
- else if (status === 404) {
136
- errorMessage = 'Project not found — verify the project ID';
137
- }
138
- else if (data?.error) {
139
- errorMessage = data.error;
140
- }
141
- else if (data?.message) {
142
- errorMessage = data.message;
143
- }
144
- }
145
- this.error(errorMessage);
146
- }
147
- }
@@ -1,127 +0,0 @@
1
- export interface TenantConfig {
2
- apiUrl: string;
3
- cognitoClientId: string;
4
- cognitoDomain: string;
5
- cognitoIdentityPoolId: string;
6
- cognitoUserPoolId: string;
7
- displayName: string;
8
- region: string;
9
- tenantDomain: string;
10
- tenantId: string;
11
- /** All additional API URLs from bootstrap, keyed by module name */
12
- additionalApiUrls?: Record<string, string>;
13
- }
14
- export interface CLIConfig {
15
- apiUrl?: string;
16
- bootstrapUrl?: string;
17
- domains?: Record<string, {
18
- apiUrl?: string;
19
- bootstrapUrl?: string;
20
- region?: string;
21
- }>;
22
- region?: string;
23
- tenantDomain?: string;
24
- }
25
- /**
26
- * Tenant Service for CLI
27
- *
28
- * Handles tenant resolution and Cognito configuration discovery via bootstrap endpoint.
29
- * Supports environment variables and config file overrides.
30
- */
31
- export declare class TenantService {
32
- private readonly configDir;
33
- private readonly configPath;
34
- private readonly defaultBootstrapUrl;
35
- private readonly defaultDomainPath;
36
- private readonly domain?;
37
- constructor(domain?: string);
38
- /**
39
- * Clear cached tenant configuration
40
- */
41
- clearCache(): void;
42
- /**
43
- * Fetch tenant configuration from bootstrap endpoint
44
- */
45
- fetchTenantConfig(tenantDomain?: string): Promise<TenantConfig>;
46
- /**
47
- * Get all configured domains
48
- */
49
- getConfiguredDomains(): string[];
50
- /**
51
- * Get current tenant configuration (from cache or fetch)
52
- */
53
- getCurrentTenant(): Promise<TenantConfig>;
54
- /**
55
- * Get default domain from file
56
- */
57
- getDefaultDomain(): null | string;
58
- /**
59
- * Get tenant domain with fallback chain:
60
- * 1. Constructor domain parameter (from --domain flag)
61
- * 2. Environment variable
62
- * 3. Default domain file
63
- * 4. Legacy single domain from config
64
- * 5. Return null (caller should prompt user interactively)
65
- */
66
- getTenantDomain(): null | string;
67
- /**
68
- * Save CLI configuration to file
69
- */
70
- saveConfig(config: CLIConfig): void;
71
- /**
72
- * Clear the default domain file
73
- */
74
- clearDefaultDomain(): void;
75
- /**
76
- * Remove a specific domain from config.json domains map
77
- */
78
- removeDomainConfig(domain: string): void;
79
- /**
80
- * Remove the entire config file and default-domain file
81
- */
82
- clearAllConfig(): void;
83
- /**
84
- * Set default domain
85
- */
86
- setDefaultDomain(domain: string): void;
87
- /**
88
- * Set tenant domain in config file
89
- *
90
- * Public method for init wizard to persist tenant domain configuration.
91
- * Creates config directory if needed and applies 0o600 permissions.
92
- *
93
- * @param domain - The tenant domain to save
94
- */
95
- setTenantDomain(domain: string): void;
96
- /**
97
- * Display current configuration
98
- */
99
- showConfig(): void;
100
- /**
101
- * Get API URL for a region
102
- */
103
- private getApiUrl;
104
- /**
105
- * Extract all additional API URLs from bootstrap REST config.
106
- * Returns a map of module name → endpoint URL for every REST API
107
- * beyond the primary 'hyperdrive' endpoint. Services self-serve
108
- * by looking up the key they need (e.g., 'hyperdrive-projects', 'user-groups').
109
- */
110
- private extractAdditionalApiUrls;
111
- /**
112
- * Get bootstrap URL with fallback chain:
113
- * 1. Environment variable
114
- * 2. Config file
115
- * 3. Construct from tenant domain
116
- * 4. Default URL
117
- */
118
- private getBootstrapUrl;
119
- /**
120
- * Load CLI configuration from file
121
- */
122
- private loadConfigFile;
123
- /**
124
- * Save tenant domain to config file for future use
125
- */
126
- private saveTenantDomainToConfig;
127
- }