@hyperdrive.bot/cli 1.0.7 → 1.0.8

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 (36) hide show
  1. package/README.md +298 -56
  2. package/dist/commands/account/list.d.ts +3 -0
  3. package/dist/commands/account/list.js +9 -2
  4. package/dist/commands/git/connect.js +1 -0
  5. package/dist/commands/init.d.ts +1 -0
  6. package/dist/commands/init.js +20 -19
  7. package/dist/commands/jira/connect.d.ts +1 -0
  8. package/dist/commands/jira/connect.js +17 -6
  9. package/dist/commands/jira/hook/add.d.ts +17 -0
  10. package/dist/commands/jira/hook/add.js +147 -0
  11. package/dist/commands/jira/hook/list.d.ts +14 -0
  12. package/dist/commands/jira/hook/list.js +105 -0
  13. package/dist/commands/jira/hook/remove.d.ts +15 -0
  14. package/dist/commands/jira/hook/remove.js +119 -0
  15. package/dist/commands/jira/hook/toggle.d.ts +15 -0
  16. package/dist/commands/jira/hook/toggle.js +136 -0
  17. package/dist/commands/project/init.d.ts +21 -0
  18. package/dist/commands/project/init.js +576 -0
  19. package/dist/commands/project/list.d.ts +10 -0
  20. package/dist/commands/project/list.js +119 -0
  21. package/dist/commands/project/status.d.ts +13 -0
  22. package/dist/commands/project/status.js +163 -0
  23. package/dist/commands/project/sync.d.ts +26 -0
  24. package/dist/commands/project/sync.js +388 -0
  25. package/dist/services/hyperdrive-sigv4.d.ts +125 -0
  26. package/dist/services/hyperdrive-sigv4.js +45 -0
  27. package/dist/utils/account-flow.d.ts +2 -2
  28. package/dist/utils/account-flow.js +4 -4
  29. package/dist/utils/git-flow.d.ts +1 -0
  30. package/dist/utils/git-flow.js +2 -2
  31. package/dist/utils/hook-flow.d.ts +21 -0
  32. package/dist/utils/hook-flow.js +154 -0
  33. package/dist/utils/jira-flow.d.ts +2 -2
  34. package/dist/utils/jira-flow.js +4 -4
  35. package/oclif.manifest.json +590 -128
  36. package/package.json +5 -1
@@ -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);