@git.zone/cli 8.2.0 → 8.2.2

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 (64) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/gitzone.cli.js +8 -2
  3. package/dist_ts/gitzone.logging.js +2 -2
  4. package/dist_ts/helpers.prompts.d.ts +23 -0
  5. package/dist_ts/helpers.prompts.js +30 -0
  6. package/dist_ts/mod_commit/index.js +30 -41
  7. package/dist_ts/mod_commit/mod.plugins.d.ts +1 -2
  8. package/dist_ts/mod_commit/mod.plugins.js +2 -3
  9. package/dist_ts/mod_config/index.js +45 -61
  10. package/dist_ts/mod_deprecate/helpers.deprecation.d.ts +1 -1
  11. package/dist_ts/mod_deprecate/helpers.deprecation.js +32 -9
  12. package/dist_ts/mod_deprecate/index.js +9 -10
  13. package/dist_ts/mod_deprecate/mod.plugins.d.ts +1 -2
  14. package/dist_ts/mod_deprecate/mod.plugins.js +2 -3
  15. package/dist_ts/mod_docker/index.js +4 -4
  16. package/dist_ts/mod_format/formatters/smartconfig.formatter.js +10 -16
  17. package/dist_ts/mod_format/index.js +6 -6
  18. package/dist_ts/mod_format/mod.plugins.d.ts +1 -2
  19. package/dist_ts/mod_format/mod.plugins.js +2 -3
  20. package/dist_ts/mod_meta/meta.classes.meta.js +5 -4
  21. package/dist_ts/mod_meta/meta.plugins.d.ts +1 -2
  22. package/dist_ts/mod_meta/meta.plugins.js +2 -3
  23. package/dist_ts/mod_release/helpers.npmartifact.d.ts +2 -0
  24. package/dist_ts/mod_release/helpers.npmartifact.js +3 -2
  25. package/dist_ts/mod_release/index.js +5 -4
  26. package/dist_ts/mod_services/classes.servicemanager.js +9 -13
  27. package/dist_ts/mod_services/index.js +10 -17
  28. package/dist_ts/mod_services/mod.plugins.d.ts +1 -2
  29. package/dist_ts/mod_services/mod.plugins.js +2 -3
  30. package/dist_ts/mod_standard/index.js +3 -4
  31. package/dist_ts/mod_template/index.js +5 -6
  32. package/dist_ts/mod_template/mod.plugins.d.ts +1 -2
  33. package/dist_ts/mod_template/mod.plugins.js +2 -3
  34. package/dist_ts/mod_tools/index.js +5 -10
  35. package/dist_ts/plugins.d.ts +2 -3
  36. package/dist_ts/plugins.js +3 -4
  37. package/package.json +4 -5
  38. package/readme.md +8 -4
  39. package/ts/00_commitinfo_data.ts +1 -1
  40. package/ts/gitzone.cli.ts +8 -5
  41. package/ts/gitzone.logging.ts +1 -1
  42. package/ts/helpers.prompts.ts +70 -0
  43. package/ts/mod_commit/index.ts +37 -48
  44. package/ts/mod_commit/mod.plugins.ts +1 -2
  45. package/ts/mod_config/index.ts +44 -63
  46. package/ts/mod_deprecate/helpers.deprecation.ts +63 -15
  47. package/ts/mod_deprecate/index.ts +8 -9
  48. package/ts/mod_deprecate/mod.plugins.ts +1 -2
  49. package/ts/mod_docker/index.ts +3 -3
  50. package/ts/mod_format/formatters/smartconfig.formatter.ts +15 -22
  51. package/ts/mod_format/index.ts +9 -5
  52. package/ts/mod_format/mod.plugins.ts +0 -2
  53. package/ts/mod_meta/meta.classes.meta.ts +7 -3
  54. package/ts/mod_meta/meta.plugins.ts +1 -2
  55. package/ts/mod_release/helpers.npmartifact.ts +2 -1
  56. package/ts/mod_release/index.ts +4 -3
  57. package/ts/mod_services/classes.servicemanager.ts +8 -14
  58. package/ts/mod_services/index.ts +17 -24
  59. package/ts/mod_services/mod.plugins.ts +1 -2
  60. package/ts/mod_standard/index.ts +2 -4
  61. package/ts/mod_template/index.ts +4 -5
  62. package/ts/mod_template/mod.plugins.ts +1 -2
  63. package/ts/mod_tools/index.ts +4 -10
  64. package/ts/plugins.ts +2 -4
@@ -10,7 +10,7 @@ import * as fsSync from 'node:fs';
10
10
  import * as childProcess from 'node:child_process';
11
11
  import * as tty from 'node:tty';
12
12
  import * as projectinfo from '@push.rocks/projectinfo';
13
- import * as smartcli from '@push.rocks/smartcli';
13
+ import * as smartconsole from '@push.rocks/smartconsole';
14
14
  import * as smartpath from '@push.rocks/smartpath';
15
15
  import * as smartpromise from '@push.rocks/smartpromise';
16
16
  import * as smartupdate from '@push.rocks/smartupdate';
@@ -18,7 +18,6 @@ import * as smartshell from '@push.rocks/smartshell';
18
18
  import * as smartnetwork from '@push.rocks/smartnetwork';
19
19
  import * as smartfile from '@push.rocks/smartfile';
20
20
  import { SmartFs, SmartFsProviderNode } from '@push.rocks/smartfs';
21
- import * as smartinteract from '@push.rocks/smartinteract';
22
21
  import * as smartdelay from '@push.rocks/smartdelay';
23
22
  // @lossless.org scope
24
23
  import * as objectstorage from '@lossless.org/client/objectstorage';
@@ -28,5 +27,5 @@ import * as tspublish from '@git.zone/tspublish';
28
27
  // Create smartfs instance for filesystem operations
29
28
  export const smartfs = new SmartFs(new SmartFsProviderNode());
30
29
  export const loadDcrouterApi = () => import('@serve.zone/dcrouter-apiclient');
31
- export { smartlog, smartlogDestinationLocal, smartconfig, path, os, fs, fsConstants, crypto, fsSync, childProcess, tty, projectinfo, smartcli, smartpath, smartpromise, smartupdate, smartshell, smartnetwork, smartfile, smartinteract, smartdelay, objectstorage, s3, tsdockerReleaseProtocol, tspublish, };
32
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssd0JBQXdCLE1BQU0sd0NBQXdDLENBQUM7QUFDbkYsT0FBTyxLQUFLLFdBQVcsTUFBTSx5QkFBeUIsQ0FBQztBQUN2RCxPQUFPLEtBQUssSUFBSSxNQUFNLE1BQU0sQ0FBQztBQUM3QixPQUFPLEtBQUssRUFBRSxNQUFNLFNBQVMsQ0FBQztBQUM5QixPQUFPLEtBQUssRUFB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akcsT0FBTyxLQUFLLFNBQVMsTUFBTSxxQkFBcUIsQ0FBQztBQWdCakQsb0RBQW9EO0FBQ3BELE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxJQUFJLG1CQUFtQixFQUFFLENBQUMsQ0FBQztBQUU5RCxNQUFNLENBQUMsTUFBTSxlQUFlLEdBQUcsR0FBRyxFQUFFLENBQUMsTUFBTSxDQUFDLGdDQUFnQyxDQUFDLENBQUM7QUFJOUUsT0FBTyxFQUNMLFFBQVEsRUFDUix3QkFBd0IsRUFDeEIsV0FBVyxFQUNYLElBQUksRUFDSixFQUFFLEVBQ0YsRUFBRSxFQUNGLFdBQVcsRUFDWCxNQUFNLEVBQ04sTUFBTSxFQUNOLFlBQVksRUFDWixHQUFHLEVBQ0gsV0FBVyxFQUNYLFFBQVEsRUFDUixTQUFTLEVBQ1QsWUFBWSxFQUNaLFdBQVcsRUFDWCxVQUFVLEVBQ1YsWUFBWSxFQUNaLFNBQVMsRUFDVCxhQUFhLEVBQ2IsVUFBVSxFQUNWLGFBQWEsRUFDYixFQUFFLEVBQ0YsdUJBQXVCLEVBQ3ZCLFNBQVMsR0FDVixDQUFDIn0=
30
+ export { smartlog, smartlogDestinationLocal, smartconfig, path, os, fs, fsConstants, crypto, fsSync, childProcess, tty, projectinfo, smartconsole, smartpath, smartpromise, smartupdate, smartshell, smartnetwork, smartfile, smartdelay, objectstorage, s3, tsdockerReleaseProtocol, tspublish, };
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL3BsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLFFBQVEsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRCxPQUFPLEtBQUssd0JBQXdCLE1BQU0sd0NBQXdDL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NLG9DQUFvQyxDQUFDO0FBRXBFLE9BQU8sS0FBSyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDekMsT0FBTyxLQUFLLHVCQUF1QixNQUFNLHVEQUF1RCxDQUFDO0FBQ2pHLE9BQU8sS0FBSyxTQUFTLE1BQU0scUJBQXFCLENBQUM7QUFnQmpELG9EQUFvRDtBQUNwRCxNQUFNLENBQUMsTUFBTSxPQUFPLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxtQkFBbUIsRUFBRSxDQUFDLENBQUM7QUFFOUQsTUFBTSxDQUFDLE1BQU0sZUFBZSxHQUFHLEdBQUcsRUFBRSxDQUFDLE1BQU0sQ0FBQyxnQ0FBZ0MsQ0FBQyxDQUFDO0FBSTlFLE9BQU8sRUFDTCxRQUFRLEVBQ1Isd0JBQXdCLEVBQ3hCLFdBQVcsRUFDWCxJQUFJLEVBQ0osRUFBRSxFQUNGLEVBQUUsRUFDRixXQUFXLEVBQ1gsTUFBTSxFQUNOLE1BQU0sRUFDTixZQUFZLEVBQ1osR0FBRyxFQUNILFdBQVcsRUFDWCxZQUFZLEVBQ1osU0FBUyxFQUNULFlBQVksRUFDWixXQUFXLEVBQ1gsVUFBVSxFQUNWLFlBQVksRUFDWixTQUFTLEVBQ1QsVUFBVSxFQUNWLGFBQWEsRUFDYixFQUFFLEVBQ0YsdUJBQXVCLEVBQ3ZCLFNBQVMsR0FDVixDQUFDIn0=
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@git.zone/cli",
3
3
  "private": false,
4
- "version": "8.2.0",
4
+ "version": "8.2.2",
5
5
  "description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
6
6
  "main": "dist_ts/index.js",
7
7
  "typings": "dist_ts/index.d.ts",
@@ -48,25 +48,23 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@aws-sdk/client-s3": "3.1095.0",
51
- "@git.zone/tsdoc": "^2.2.2",
51
+ "@git.zone/tsdoc": "^3.0.0",
52
52
  "@git.zone/tsdocker": "3.8.1",
53
53
  "@git.zone/tspublish": "^2.1.0",
54
54
  "@lossless.org/client": "1.5.1",
55
55
  "@push.rocks/commitinfo": "^1.1.1",
56
56
  "@push.rocks/early": "^4.0.4",
57
57
  "@push.rocks/projectinfo": "^5.1.0",
58
- "@push.rocks/smartcli": "^4.3.1",
59
58
  "@push.rocks/smartconfig": "^6.2.4",
59
+ "@push.rocks/smartconsole": "^2.0.1",
60
60
  "@push.rocks/smartdelay": "^3.0.5",
61
61
  "@push.rocks/smartdiff": "^1.1.0",
62
62
  "@push.rocks/smartfile": "^13.1.2",
63
63
  "@push.rocks/smartfs": "^1.5.0",
64
- "@push.rocks/smartinteract": "^2.0.16",
65
64
  "@push.rocks/smartjson": "^6.0.0",
66
65
  "@push.rocks/smartlegal": "^1.0.27",
67
66
  "@push.rocks/smartlog": "^3.2.1 || ^4.0.0",
68
67
  "@push.rocks/smartlog-destination-local": "^9.0.2",
69
- "@push.rocks/smartmustache": "^3.0.2",
70
68
  "@push.rocks/smartnetwork": "^4.4.0",
71
69
  "@push.rocks/smartnpm": "^2.0.6",
72
70
  "@push.rocks/smartobject": "^1.0.12",
@@ -78,6 +76,7 @@
78
76
  "@push.rocks/smartunique": "^3.0.9",
79
77
  "@push.rocks/smartupdate": "^2.0.7",
80
78
  "@serve.zone/dcrouter-apiclient": "32.3.0",
79
+ "inquirer": "^12.11.1",
81
80
  "prettier": "^3.9.6"
82
81
  },
83
82
  "files": [
package/readme.md CHANGED
@@ -1872,10 +1872,14 @@ asks for the message. Deprecation applies to every version. GitZone verifies
1872
1872
  that the old package exists on all registries, and that the replacement, when
1873
1873
  named, has an active latest version there, before issuing any change, invokes
1874
1874
  `pnpm deprecate` with literal arguments, and verifies the old versions' metadata
1875
- after each registry operation. Verification uses up to five fresh metadata reads,
1876
- one second apart, to allow registry propagation. A rerun skips any registry where
1877
- every version already has the exact requested message, so accepted deprecations
1878
- are not submitted again. `--json` prints the plan without changing it.
1875
+ after each registry operation. Every metadata read carries a unique cache-busting
1876
+ query, because the CDN in front of npmjs ignores `no-cache` request headers.
1877
+ Because npmjs serves an accepted deprecation only after replication, verification
1878
+ waits up to ninety seconds per registry, probing with doubling backoff from two
1879
+ seconds up to twenty and reporting each wait. If the window ends first, GitZone
1880
+ stops before the next registry and says that rerunning is safe. A rerun skips any
1881
+ registry where every version already has the exact requested message, so accepted
1882
+ deprecations are not submitted again. `--json` prints the plan without changing it.
1879
1883
 
1880
1884
  ## Troubleshooting
1881
1885
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/cli',
6
- version: '8.2.0',
6
+ version: '8.2.2',
7
7
  description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
8
8
  }
package/ts/gitzone.cli.ts CHANGED
@@ -117,11 +117,14 @@ export let run = async () => {
117
117
  if (rawCliMode.checkUpdates) {
118
118
  const smartupdateInstance = new plugins.smartupdate.SmartUpdate();
119
119
  try {
120
- await smartupdateInstance.check(
121
- "gitzone",
122
- packageVersion,
123
- "http://gitzone.gitlab.io/gitzone/changelog.html",
124
- );
120
+ await smartupdateInstance.checkForUpdate({
121
+ packageName: commitinfo.name,
122
+ currentVersion: packageVersion,
123
+ changelogUrl:
124
+ "https://code.foss.global/api/v1/repos/git.zone/cli/raw/changelog.md",
125
+ openChangelog: false,
126
+ cacheStrategy: "never",
127
+ });
125
128
  } catch {
126
129
  // Update checks must never block actual CLI commands.
127
130
  }
@@ -1,5 +1,5 @@
1
- import { commitinfo } from '@push.rocks/commitinfo';
2
1
  import * as plugins from './plugins.js';
2
+ import { commitinfo } from './00_commitinfo_data.js';
3
3
 
4
4
  // Create logger instance
5
5
  export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo);
@@ -0,0 +1,70 @@
1
+ import * as plugins from "./plugins.js";
2
+
3
+ type TPromptOptions = plugins.smartconsole.IPromptOptions;
4
+
5
+ /**
6
+ * Without an interactive terminal the question takes its declared default, as gitzone's prompts
7
+ * did in CI. Only for questions whose default is the safe answer.
8
+ */
9
+ export const answerDefaultsWithoutTerminal: TPromptOptions = {
10
+ nonInteractive: { mode: "defaults" },
11
+ };
12
+
13
+ /**
14
+ * Asks on a console that lives for the call, so the terminal input is released as soon as the
15
+ * questions are answered. Without an interactive terminal the questions reject unless the
16
+ * options name a non-interactive policy.
17
+ */
18
+ export const withPrompts = async <T>(
19
+ askArg: (promptsArg: plugins.smartconsole.ConsolePrompts) => Promise<T>,
20
+ ): Promise<T> => {
21
+ const out = new plugins.smartconsole.SmartConsole();
22
+ try {
23
+ return await askArg(out.prompts);
24
+ } finally {
25
+ await out.dispose();
26
+ }
27
+ };
28
+
29
+ /** Asks one question and resolves its answer. */
30
+ export function ask(
31
+ questionArg: plugins.smartconsole.TTextQuestion,
32
+ optionsArg?: TPromptOptions,
33
+ ): Promise<string>;
34
+ export function ask(
35
+ questionArg: plugins.smartconsole.IConfirmQuestion,
36
+ optionsArg?: TPromptOptions,
37
+ ): Promise<boolean>;
38
+ export function ask<T>(
39
+ questionArg:
40
+ | plugins.smartconsole.ISelectQuestion<T>
41
+ | plugins.smartconsole.IExpandQuestion<T>,
42
+ optionsArg?: TPromptOptions,
43
+ ): Promise<T>;
44
+ export function ask<T>(
45
+ questionArg: plugins.smartconsole.ICheckboxQuestion<T>,
46
+ optionsArg?: TPromptOptions,
47
+ ): Promise<T[]>;
48
+ export function ask(
49
+ questionArg: plugins.smartconsole.TQuestion,
50
+ optionsArg?: TPromptOptions,
51
+ ): Promise<unknown> {
52
+ return withPrompts((promptsArg) => promptsArg.ask(questionArg, optionsArg));
53
+ }
54
+
55
+ /** Asks a yes/no question. */
56
+ export const confirm = (
57
+ messageArg: string,
58
+ defaultArg: boolean,
59
+ optionsArg?: TPromptOptions,
60
+ ): Promise<boolean> =>
61
+ ask(
62
+ { type: "confirm", name: "confirm", message: messageArg, default: defaultArg },
63
+ optionsArg,
64
+ );
65
+
66
+ /** Choices whose label is their value. */
67
+ export const stringChoices = <T extends string>(
68
+ valuesArg: readonly T[],
69
+ ): plugins.smartconsole.IPromptChoice<T>[] =>
70
+ valuesArg.map((valueArg) => ({ name: valueArg, value: valueArg }));
@@ -23,6 +23,14 @@ import {
23
23
  loadManualCommitInput,
24
24
  type IManualCommitInput,
25
25
  } from "./helpers.manual.js";
26
+ import { confirm, stringChoices, withPrompts } from "../helpers.prompts.js";
27
+
28
+ /** The commit the workflow creates: accepted AI recommendations, interactive answers or manual input. */
29
+ interface ICommitAnswers {
30
+ commitType: string;
31
+ commitScope: string;
32
+ commitDescription: string;
33
+ }
26
34
 
27
35
  const isNoChangesError = (error: unknown): boolean => {
28
36
  return error instanceof Error && error.name === "NoChangesError";
@@ -76,7 +84,7 @@ export const run = async (argvArg: any) => {
76
84
  });
77
85
 
78
86
  let nextCommitObject: any;
79
- let answerBucket: plugins.smartinteract.AnswerBucket | undefined;
87
+ let commitAnswers: ICommitAnswers | undefined;
80
88
  if (manual && !(await hasManualCommitChanges(smartshellInstance))) return;
81
89
  if (manual && !(await confirmManualCommit(manual, workflow, mode))) return;
82
90
 
@@ -112,7 +120,7 @@ export const run = async (argvArg: any) => {
112
120
  }
113
121
  throw error;
114
122
  }
115
- answerBucket = await buildAnswerBucket(
123
+ commitAnswers = await buildCommitAnswers(
116
124
  nextCommitObject,
117
125
  workflow,
118
126
  mode,
@@ -123,15 +131,15 @@ export const run = async (argvArg: any) => {
123
131
  if (!manual) throw new Error("Manual commit input is required.");
124
132
  if (!(await hasManualCommitChanges(smartshellInstance))) return;
125
133
  nextCommitObject = { manual: true };
126
- answerBucket = createAnswerBucket({
134
+ commitAnswers = {
127
135
  commitType: manual.type,
128
136
  commitScope: manual.scope,
129
137
  commitDescription: manual.summary,
130
- });
138
+ };
131
139
  break;
132
140
  }
133
141
  case "changelog":
134
- assertAnalysisComplete(answerBucket, nextCommitObject);
142
+ assertAnalysisComplete(commitAnswers, nextCommitObject);
135
143
  if (manual) {
136
144
  await appendPendingChangelogMarkdown(
137
145
  plugins.path.join(paths.cwd, workflow.changelogFile),
@@ -143,12 +151,12 @@ export const run = async (argvArg: any) => {
143
151
  `Updated ${workflow.changelogFile} pending section.`,
144
152
  );
145
153
  } else {
146
- await runChangelogStep(workflow, answerBucket!, nextCommitObject);
154
+ await runChangelogStep(workflow, commitAnswers!, nextCommitObject);
147
155
  }
148
156
  break;
149
157
  case "commit":
150
- assertAnalysisComplete(answerBucket, nextCommitObject);
151
- await runCommitStep(smartshellInstance, answerBucket!, manual?.message);
158
+ assertAnalysisComplete(commitAnswers, nextCommitObject);
159
+ await runCommitStep(smartshellInstance, commitAnswers!, manual?.message);
152
160
  break;
153
161
  case "push":
154
162
  await runPushStep(smartshellInstance, workflow);
@@ -163,9 +171,9 @@ export const run = async (argvArg: any) => {
163
171
  ui.printSummary({
164
172
  projectType: "source",
165
173
  branch: currentBranch,
166
- commitType: answerBucket!.getAnswerFor("commitType"),
167
- commitScope: answerBucket!.getAnswerFor("commitScope"),
168
- commitMessage: answerBucket!.getAnswerFor("commitDescription"),
174
+ commitType: commitAnswers!.commitType,
175
+ commitScope: commitAnswers!.commitScope,
176
+ commitMessage: commitAnswers!.commitDescription,
169
177
  commitSha: commitShaResult.stdout.trim(),
170
178
  pushed: workflow.steps.includes("push"),
171
179
  });
@@ -203,7 +211,7 @@ async function confirmManualCommit(
203
211
  : "Commit confirmation requires an interactive terminal. Use `-y` or set commit.confirmation to `auto`.",
204
212
  );
205
213
  }
206
- return plugins.smartinteract.SmartInteract.getCliConfirmation(
214
+ return confirm(
207
215
  manual.breaking
208
216
  ? "Create this breaking commit and changelog entry?"
209
217
  : "Create this commit and changelog entry?",
@@ -251,12 +259,12 @@ async function runAnalyzeStep(): Promise<any> {
251
259
  }
252
260
  }
253
261
 
254
- async function buildAnswerBucket(
262
+ async function buildCommitAnswers(
255
263
  nextCommitObject: any,
256
264
  workflow: IResolvedCommitWorkflow,
257
265
  mode: ICliMode,
258
266
  argvArg: any,
259
- ): Promise<plugins.smartinteract.AnswerBucket> {
267
+ ): Promise<ICommitAnswers> {
260
268
  const isBreakingChange =
261
269
  nextCommitObject.recommendedNextVersionLevel === "BREAKING CHANGE";
262
270
  const canAutoAccept =
@@ -270,11 +278,11 @@ async function buildAnswerBucket(
270
278
  ? "Auto-accepting BREAKING CHANGE recommendation because --allow-breaking was provided"
271
279
  : "Auto-accepting AI recommendations",
272
280
  );
273
- return createAnswerBucket({
281
+ return {
274
282
  commitType: nextCommitObject.recommendedNextVersionLevel,
275
283
  commitScope: nextCommitObject.recommendedNextVersionScope,
276
284
  commitDescription: nextCommitObject.recommendedNextVersionMessage,
277
- });
285
+ };
278
286
  }
279
287
 
280
288
  if (
@@ -298,13 +306,12 @@ async function buildAnswerBucket(
298
306
  );
299
307
  }
300
308
 
301
- const commitInteract = new plugins.smartinteract.SmartInteract();
302
- commitInteract.addQuestions([
309
+ return await withPrompts((prompts) => prompts.askAll([
303
310
  {
304
311
  type: "list",
305
312
  name: "commitType",
306
313
  message: "Choose TYPE of the commit:",
307
- choices: ["fix", "feat", "BREAKING CHANGE"],
314
+ choices: stringChoices(["fix", "feat", "BREAKING CHANGE"]),
308
315
  default: nextCommitObject.recommendedNextVersionLevel,
309
316
  },
310
317
  {
@@ -319,34 +326,21 @@ async function buildAnswerBucket(
319
326
  message: "What is the DESCRIPTION of the commit?",
320
327
  default: nextCommitObject.recommendedNextVersionMessage,
321
328
  },
322
- ]);
323
- return await commitInteract.runQueue();
324
- }
325
-
326
- function createAnswerBucket(answers: {
327
- commitType: string;
328
- commitScope: string;
329
- commitDescription: string;
330
- }): plugins.smartinteract.AnswerBucket {
331
- const answerBucket = new plugins.smartinteract.AnswerBucket();
332
- for (const [name, value] of Object.entries(answers)) {
333
- answerBucket.addAnswer({ name, value });
334
- }
335
- return answerBucket;
329
+ ]));
336
330
  }
337
331
 
338
332
  async function runChangelogStep(
339
333
  workflow: IResolvedCommitWorkflow,
340
- answerBucket: plugins.smartinteract.AnswerBucket,
334
+ commitAnswers: ICommitAnswers,
341
335
  nextCommitObject: any,
342
336
  ): Promise<void> {
343
337
  await appendPendingChangelogEntry(
344
338
  plugins.path.join(paths.cwd, workflow.changelogFile),
345
339
  workflow.changelogSection,
346
340
  {
347
- type: answerBucket.getAnswerFor("commitType"),
348
- scope: answerBucket.getAnswerFor("commitScope"),
349
- message: answerBucket.getAnswerFor("commitDescription"),
341
+ type: commitAnswers.commitType,
342
+ scope: commitAnswers.commitScope,
343
+ message: commitAnswers.commitDescription,
350
344
  details: nextCommitObject.recommendedNextVersionDetails || [],
351
345
  },
352
346
  );
@@ -355,12 +349,12 @@ async function runChangelogStep(
355
349
 
356
350
  async function runCommitStep(
357
351
  smartshellInstance: plugins.smartshell.Smartshell,
358
- answerBucket: plugins.smartinteract.AnswerBucket,
352
+ commitAnswers: ICommitAnswers,
359
353
  manualMessage?: string,
360
354
  ): Promise<void> {
361
355
  ui.printHeader("Creating Semantic Commit");
362
356
  const commitString =
363
- manualMessage ?? createCommitStringFromAnswerBucket(answerBucket);
357
+ manualMessage ?? createCommitString(commitAnswers);
364
358
  ui.printCommitMessage(commitString);
365
359
  let messageDirectory: string | undefined;
366
360
  try {
@@ -417,10 +411,10 @@ async function detectCurrentBranch(
417
411
  }
418
412
 
419
413
  function assertAnalysisComplete(
420
- answerBucket: plugins.smartinteract.AnswerBucket | undefined,
414
+ commitAnswers: ICommitAnswers | undefined,
421
415
  nextCommitObject: any,
422
416
  ): void {
423
- if (!answerBucket || !nextCommitObject) {
417
+ if (!commitAnswers || !nextCommitObject) {
424
418
  throw new Error(
425
419
  "Commit workflow requires analyze before changelog and commit steps.",
426
420
  );
@@ -492,13 +486,8 @@ async function handleRecommend(mode: ICliMode): Promise<void> {
492
486
  );
493
487
  }
494
488
 
495
- const createCommitStringFromAnswerBucket = (
496
- answerBucket: plugins.smartinteract.AnswerBucket,
497
- ) => {
498
- const commitType = answerBucket.getAnswerFor("commitType");
499
- const commitScope = answerBucket.getAnswerFor("commitScope");
500
- const commitDescription = answerBucket.getAnswerFor("commitDescription");
501
- return `${commitType}(${commitScope}): ${commitDescription}`;
489
+ const createCommitString = (commitAnswers: ICommitAnswers) => {
490
+ return `${commitAnswers.commitType}(${commitAnswers.commitScope}): ${commitAnswers.commitDescription}`;
502
491
  };
503
492
 
504
493
  export function showHelp(mode?: ICliMode): void {
@@ -2,10 +2,9 @@ export * from "../plugins.js";
2
2
 
3
3
  import * as commitinfo from "@push.rocks/commitinfo";
4
4
  import * as smartfile from "@push.rocks/smartfile";
5
- import * as smartinteract from "@push.rocks/smartinteract";
6
5
  import * as smartshell from "@push.rocks/smartshell";
7
6
 
8
7
  // Manual commits must not load or initialize the AI dependency chain.
9
8
  export const loadTsdoc = () => import("@git.zone/tsdoc");
10
9
 
11
- export { commitinfo, smartfile, smartinteract, smartshell };
10
+ export { commitinfo, smartfile, smartshell };