@hyperdrive.bot/cli 1.0.7 → 1.0.9

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 (41) hide show
  1. package/README.md +307 -59
  2. package/dist/commands/account/list.d.ts +3 -0
  3. package/dist/commands/account/list.js +9 -2
  4. package/dist/commands/auth/logout.d.ts +11 -0
  5. package/dist/commands/auth/logout.js +86 -9
  6. package/dist/commands/git/connect.js +1 -0
  7. package/dist/commands/init.d.ts +1 -0
  8. package/dist/commands/init.js +20 -19
  9. package/dist/commands/jira/connect.d.ts +1 -0
  10. package/dist/commands/jira/connect.js +17 -6
  11. package/dist/commands/jira/hook/add.d.ts +17 -0
  12. package/dist/commands/jira/hook/add.js +147 -0
  13. package/dist/commands/jira/hook/list.d.ts +14 -0
  14. package/dist/commands/jira/hook/list.js +105 -0
  15. package/dist/commands/jira/hook/remove.d.ts +15 -0
  16. package/dist/commands/jira/hook/remove.js +119 -0
  17. package/dist/commands/jira/hook/toggle.d.ts +15 -0
  18. package/dist/commands/jira/hook/toggle.js +136 -0
  19. package/dist/commands/jira/status.js +11 -2
  20. package/dist/commands/project/init.d.ts +21 -0
  21. package/dist/commands/project/init.js +576 -0
  22. package/dist/commands/project/list.d.ts +10 -0
  23. package/dist/commands/project/list.js +119 -0
  24. package/dist/commands/project/status.d.ts +13 -0
  25. package/dist/commands/project/status.js +163 -0
  26. package/dist/commands/project/sync.d.ts +26 -0
  27. package/dist/commands/project/sync.js +406 -0
  28. package/dist/services/hyperdrive-sigv4.d.ts +125 -0
  29. package/dist/services/hyperdrive-sigv4.js +45 -0
  30. package/dist/services/tenant-service.d.ts +12 -0
  31. package/dist/services/tenant-service.js +44 -1
  32. package/dist/utils/account-flow.d.ts +2 -2
  33. package/dist/utils/account-flow.js +4 -4
  34. package/dist/utils/git-flow.d.ts +1 -0
  35. package/dist/utils/git-flow.js +2 -2
  36. package/dist/utils/hook-flow.d.ts +21 -0
  37. package/dist/utils/hook-flow.js +154 -0
  38. package/dist/utils/jira-flow.d.ts +2 -2
  39. package/dist/utils/jira-flow.js +4 -4
  40. package/oclif.manifest.json +591 -119
  41. package/package.json +5 -1
@@ -42,7 +42,7 @@ export declare function promptAccountDetails(existingData?: Partial<AccountAddDa
42
42
  * @param accountData - Account details to register
43
43
  * @returns AccountResult indicating success or failure
44
44
  */
45
- export declare function registerAccount(accountData: AccountAddData): Promise<AccountResult>;
45
+ export declare function registerAccount(accountData: AccountAddData, tenantDomain?: string): Promise<AccountResult>;
46
46
  /**
47
47
  * Execute the AWS account add flow
48
48
  *
@@ -68,7 +68,7 @@ export declare function promptOpenCloudFormation(quickCreateUrl: string): Promis
68
68
  /**
69
69
  * Wait for role verification with polling
70
70
  */
71
- export declare function waitForRoleVerification(accountId: string, onProgress?: (message: string) => void): Promise<{
71
+ export declare function waitForRoleVerification(accountId: string, onProgress?: (message: string) => void, tenantDomain?: string): Promise<{
72
72
  message?: string;
73
73
  verified: boolean;
74
74
  }>;
@@ -97,10 +97,10 @@ export async function promptAccountDetails(existingData) {
97
97
  * @param accountData - Account details to register
98
98
  * @returns AccountResult indicating success or failure
99
99
  */
100
- export async function registerAccount(accountData) {
100
+ export async function registerAccount(accountData, tenantDomain) {
101
101
  try {
102
102
  // Initialize API service
103
- const service = new HyperdriveSigV4Service();
103
+ const service = new HyperdriveSigV4Service(tenantDomain);
104
104
  // Make API call to add account
105
105
  const result = await service.accountAdd({
106
106
  accountId: accountData.accountId,
@@ -190,8 +190,8 @@ const VERIFY_TIMEOUT = 300000; // 5 minutes
190
190
  /**
191
191
  * Wait for role verification with polling
192
192
  */
193
- export async function waitForRoleVerification(accountId, onProgress) {
194
- const service = new HyperdriveSigV4Service();
193
+ export async function waitForRoleVerification(accountId, onProgress, tenantDomain) {
194
+ const service = new HyperdriveSigV4Service(tenantDomain);
195
195
  const startTime = Date.now();
196
196
  let attemptCount = 0;
197
197
  while (Date.now() - startTime < VERIFY_TIMEOUT) {
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export interface GitConnectOptions {
5
5
  callbackPort?: number;
6
+ domain?: string;
6
7
  logger?: (message: string) => void;
7
8
  provider?: 'github' | 'gitlab';
8
9
  timeout?: number;
@@ -159,7 +159,7 @@ export function waitForCallback(expectedState, port = 8765, timeout = 5 * 60 * 1
159
159
  * @returns GitConnectResult indicating success or failure
160
160
  */
161
161
  export async function executeGitConnect(options = {}) {
162
- const { callbackPort = 8765, logger = () => { }, // No-op by default
162
+ const { callbackPort = 8765, domain, logger = () => { }, // No-op by default
163
163
  provider: initialProvider, timeout = 5 * 60 * 1000, } = options;
164
164
  try {
165
165
  // Step 1: Determine provider (prompt if not specified)
@@ -175,7 +175,7 @@ export async function executeGitConnect(options = {}) {
175
175
  provider = selected;
176
176
  }
177
177
  // Step 2: Initialize API service
178
- const service = new HyperdriveSigV4Service();
178
+ const service = new HyperdriveSigV4Service(domain);
179
179
  // Step 3: Initiate OAuth flow via API
180
180
  const authResponse = await service.gitAuthInitiate(provider);
181
181
  logger(`Opening browser for ${provider === 'github' ? 'GitHub' : 'GitLab'} authorization...`);
@@ -0,0 +1,21 @@
1
+ import type { HookActionType, HookResponse } from '../services/hyperdrive-sigv4.js';
2
+ /**
3
+ * Prompt user to select a trigger status from available Jira statuses
4
+ */
5
+ export declare function promptTriggerStatus(statuses: string[]): Promise<string>;
6
+ /**
7
+ * Prompt user to select an action type
8
+ */
9
+ export declare function promptActionType(): Promise<HookActionType>;
10
+ /**
11
+ * Prompt for action-specific configuration based on action type
12
+ */
13
+ export declare function promptActionConfig(actionType: HookActionType): Promise<Record<string, unknown>>;
14
+ /**
15
+ * Prompt user to select a hook from a list
16
+ */
17
+ export declare function promptSelectHook(hooks: HookResponse[]): Promise<HookResponse>;
18
+ /**
19
+ * Prompt user to confirm hook deletion
20
+ */
21
+ export declare function promptConfirmDelete(hook: HookResponse): Promise<boolean>;
@@ -0,0 +1,154 @@
1
+ import inquirer from 'inquirer';
2
+ /**
3
+ * Prompt user to select a trigger status from available Jira statuses
4
+ */
5
+ export async function promptTriggerStatus(statuses) {
6
+ const choices = [
7
+ { name: '* (any status)', value: '*' },
8
+ ...statuses.map(s => ({ name: s, value: s })),
9
+ ];
10
+ const { triggerStatus } = await inquirer.prompt([{
11
+ choices,
12
+ message: 'Select trigger status:',
13
+ name: 'triggerStatus',
14
+ type: 'list',
15
+ }]);
16
+ return triggerStatus;
17
+ }
18
+ /**
19
+ * Prompt user to select an action type
20
+ */
21
+ export async function promptActionType() {
22
+ const { actionType } = await inquirer.prompt([{
23
+ choices: [
24
+ { name: 'Slack notification', value: 'slack-notify' },
25
+ { name: 'ADHB enrichment', value: 'adhb-enrich' },
26
+ { name: 'Webhook', value: 'webhook' },
27
+ { name: 'CI trigger', value: 'ci-trigger' },
28
+ ],
29
+ message: 'Select action type:',
30
+ name: 'actionType',
31
+ type: 'list',
32
+ }]);
33
+ return actionType;
34
+ }
35
+ /**
36
+ * Prompt for action-specific configuration based on action type
37
+ */
38
+ export async function promptActionConfig(actionType) {
39
+ switch (actionType) {
40
+ case 'slack-notify': {
41
+ const answers = await inquirer.prompt([
42
+ {
43
+ message: 'Slack channel (e.g. #deploys):',
44
+ name: 'channel',
45
+ type: 'input',
46
+ validate: (input) => input.trim() ? true : 'Channel is required',
47
+ },
48
+ {
49
+ default: '',
50
+ message: 'Message template (optional):',
51
+ name: 'template',
52
+ type: 'input',
53
+ },
54
+ ]);
55
+ const config = { channel: answers.channel };
56
+ if (answers.template)
57
+ config.template = answers.template;
58
+ return config;
59
+ }
60
+ case 'adhb-enrich': {
61
+ const { priority } = await inquirer.prompt([{
62
+ choices: [
63
+ { name: 'high', value: 'high' },
64
+ { name: 'normal', value: 'normal' },
65
+ { name: 'low', value: 'low' },
66
+ ],
67
+ default: 'normal',
68
+ message: 'Priority:',
69
+ name: 'priority',
70
+ type: 'list',
71
+ }]);
72
+ return { priority };
73
+ }
74
+ case 'webhook': {
75
+ const answers = await inquirer.prompt([
76
+ {
77
+ message: 'Webhook URL:',
78
+ name: 'url',
79
+ type: 'input',
80
+ validate: (input) => input.trim().startsWith('http') ? true : 'Valid URL is required',
81
+ },
82
+ {
83
+ choices: [
84
+ { name: 'POST', value: 'POST' },
85
+ { name: 'PUT', value: 'PUT' },
86
+ ],
87
+ default: 'POST',
88
+ message: 'HTTP method:',
89
+ name: 'method',
90
+ type: 'list',
91
+ },
92
+ ]);
93
+ return { method: answers.method, url: answers.url };
94
+ }
95
+ case 'ci-trigger': {
96
+ const answers = await inquirer.prompt([
97
+ {
98
+ choices: [
99
+ { name: 'GitHub', value: 'github' },
100
+ { name: 'GitLab', value: 'gitlab' },
101
+ ],
102
+ message: 'Provider:',
103
+ name: 'provider',
104
+ type: 'list',
105
+ },
106
+ {
107
+ message: 'Pipeline identifier:',
108
+ name: 'pipeline',
109
+ type: 'input',
110
+ validate: (input) => input.trim() ? true : 'Pipeline identifier is required',
111
+ },
112
+ {
113
+ default: '',
114
+ message: 'Git ref (optional):',
115
+ name: 'ref',
116
+ type: 'input',
117
+ },
118
+ ]);
119
+ const config = { pipeline: answers.pipeline, provider: answers.provider };
120
+ if (answers.ref)
121
+ config.ref = answers.ref;
122
+ return config;
123
+ }
124
+ default:
125
+ throw new Error(`Unknown action type: ${actionType}`);
126
+ }
127
+ }
128
+ /**
129
+ * Prompt user to select a hook from a list
130
+ */
131
+ export async function promptSelectHook(hooks) {
132
+ const { selectedHook } = await inquirer.prompt([{
133
+ choices: hooks.map(h => ({
134
+ name: `[${h.triggerStatus}] ${h.actionType} (${h.enabled ? 'enabled' : 'disabled'})`,
135
+ value: h,
136
+ })),
137
+ message: 'Select a hook:',
138
+ name: 'selectedHook',
139
+ type: 'list',
140
+ }]);
141
+ return selectedHook;
142
+ }
143
+ /**
144
+ * Prompt user to confirm hook deletion
145
+ */
146
+ export async function promptConfirmDelete(hook) {
147
+ const { confirmed } = await inquirer.prompt([{
148
+ default: false,
149
+ message: `Delete hook [${hook.triggerStatus}] ${hook.actionType}?`,
150
+ name: 'confirmed',
151
+ type: 'confirm',
152
+ }]);
153
+ return confirmed;
154
+ }
@@ -59,7 +59,7 @@ export declare function promptJiraConnect(includeSkip?: boolean): Promise<'skip'
59
59
  * This function is separated from user input collection to allow
60
60
  * proper spinner timing and better separation of concerns.
61
61
  */
62
- export declare function registerJiraDomain(jiraDomain: string): Promise<JiraConnectResult>;
62
+ export declare function registerJiraDomain(jiraDomain: string, tenantDomain?: string): Promise<JiraConnectResult>;
63
63
  /**
64
64
  * Execute the Jira connect flow
65
65
  *
@@ -68,4 +68,4 @@ export declare function registerJiraDomain(jiraDomain: string): Promise<JiraConn
68
68
  * 2. Pre-registering the domain with Hyperdrive API
69
69
  * 3. Returning result with marketplace URL
70
70
  */
71
- export declare function executeJiraConnect(): Promise<JiraConnectResult>;
71
+ export declare function executeJiraConnect(tenantDomain?: string): Promise<JiraConnectResult>;
@@ -75,9 +75,9 @@ export async function promptJiraConnect(includeSkip = false) {
75
75
  * This function is separated from user input collection to allow
76
76
  * proper spinner timing and better separation of concerns.
77
77
  */
78
- export async function registerJiraDomain(jiraDomain) {
78
+ export async function registerJiraDomain(jiraDomain, tenantDomain) {
79
79
  try {
80
- const service = new HyperdriveSigV4Service();
80
+ const service = new HyperdriveSigV4Service(tenantDomain);
81
81
  // Use the public API method instead of accessing private method
82
82
  const response = await service.jiraPreRegister({ jiraDomain });
83
83
  return {
@@ -103,12 +103,12 @@ export async function registerJiraDomain(jiraDomain) {
103
103
  * 2. Pre-registering the domain with Hyperdrive API
104
104
  * 3. Returning result with marketplace URL
105
105
  */
106
- export async function executeJiraConnect() {
106
+ export async function executeJiraConnect(tenantDomain) {
107
107
  try {
108
108
  // Step 1: Prompt for Jira domain (no spinner - user needs to see prompts)
109
109
  const domainData = await promptJiraDomain();
110
110
  // Step 2: Register domain with API (caller should wrap this with spinner)
111
- return await registerJiraDomain(domainData.jiraDomain);
111
+ return await registerJiraDomain(domainData.jiraDomain, tenantDomain);
112
112
  }
113
113
  catch (error) {
114
114
  const errorMessage = error instanceof Error ? error.message : String(error);