@git.zone/cli 8.2.0 → 8.2.1

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 (53) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts/helpers.prompts.d.ts +23 -0
  3. package/dist_ts/helpers.prompts.js +30 -0
  4. package/dist_ts/mod_commit/index.js +30 -41
  5. package/dist_ts/mod_commit/mod.plugins.d.ts +1 -2
  6. package/dist_ts/mod_commit/mod.plugins.js +2 -3
  7. package/dist_ts/mod_config/index.js +45 -61
  8. package/dist_ts/mod_deprecate/index.js +9 -10
  9. package/dist_ts/mod_deprecate/mod.plugins.d.ts +1 -2
  10. package/dist_ts/mod_deprecate/mod.plugins.js +2 -3
  11. package/dist_ts/mod_docker/index.js +4 -4
  12. package/dist_ts/mod_format/formatters/smartconfig.formatter.js +10 -16
  13. package/dist_ts/mod_format/index.js +6 -6
  14. package/dist_ts/mod_format/mod.plugins.d.ts +1 -2
  15. package/dist_ts/mod_format/mod.plugins.js +2 -3
  16. package/dist_ts/mod_meta/meta.classes.meta.js +5 -4
  17. package/dist_ts/mod_meta/meta.plugins.d.ts +1 -2
  18. package/dist_ts/mod_meta/meta.plugins.js +2 -3
  19. package/dist_ts/mod_release/index.js +5 -4
  20. package/dist_ts/mod_services/classes.servicemanager.js +9 -13
  21. package/dist_ts/mod_services/index.js +10 -17
  22. package/dist_ts/mod_services/mod.plugins.d.ts +1 -2
  23. package/dist_ts/mod_services/mod.plugins.js +2 -3
  24. package/dist_ts/mod_standard/index.js +3 -4
  25. package/dist_ts/mod_template/index.js +5 -6
  26. package/dist_ts/mod_template/mod.plugins.d.ts +1 -2
  27. package/dist_ts/mod_template/mod.plugins.js +2 -3
  28. package/dist_ts/mod_tools/index.js +5 -10
  29. package/dist_ts/plugins.d.ts +2 -3
  30. package/dist_ts/plugins.js +3 -4
  31. package/package.json +3 -4
  32. package/ts/00_commitinfo_data.ts +1 -1
  33. package/ts/helpers.prompts.ts +70 -0
  34. package/ts/mod_commit/index.ts +37 -48
  35. package/ts/mod_commit/mod.plugins.ts +1 -2
  36. package/ts/mod_config/index.ts +44 -63
  37. package/ts/mod_deprecate/index.ts +8 -9
  38. package/ts/mod_deprecate/mod.plugins.ts +1 -2
  39. package/ts/mod_docker/index.ts +3 -3
  40. package/ts/mod_format/formatters/smartconfig.formatter.ts +15 -22
  41. package/ts/mod_format/index.ts +9 -5
  42. package/ts/mod_format/mod.plugins.ts +0 -2
  43. package/ts/mod_meta/meta.classes.meta.ts +7 -3
  44. package/ts/mod_meta/meta.plugins.ts +1 -2
  45. package/ts/mod_release/index.ts +4 -3
  46. package/ts/mod_services/classes.servicemanager.ts +8 -14
  47. package/ts/mod_services/index.ts +17 -24
  48. package/ts/mod_services/mod.plugins.ts +1 -2
  49. package/ts/mod_standard/index.ts +2 -4
  50. package/ts/mod_template/index.ts +4 -5
  51. package/ts/mod_template/mod.plugins.ts +1 -2
  52. package/ts/mod_tools/index.ts +4 -10
  53. package/ts/plugins.ts +2 -4
@@ -6,6 +6,7 @@ import { CommitConfig } from "./classes.commitconfig.js";
6
6
  import { runFormatter, type ICheckResult } from "../mod_format/index.js";
7
7
  import type { ICliMode } from "../helpers.climode.js";
8
8
  import { getCliMode, printJson } from "../helpers.climode.js";
9
+ import { ask, confirm, stringChoices } from "../helpers.prompts.js";
9
10
  import {
10
11
  CLI_NAMESPACE,
11
12
  getCliConfigValueFromData,
@@ -67,7 +68,7 @@ async function formatSmartconfigWithDiff(mode: ICliMode): Promise<void> {
67
68
 
68
69
  if (checkResult && checkResult.hasDiff) {
69
70
  const shouldApply =
70
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
71
+ await confirm(
71
72
  "Apply formatting changes to .smartconfig.json?",
72
73
  true,
73
74
  );
@@ -169,8 +170,7 @@ async function handleInteractiveMenu(): Promise<void> {
169
170
  );
170
171
  console.log("");
171
172
 
172
- const interactInstance = new plugins.smartinteract.SmartInteract();
173
- const response = await interactInstance.askQuestion({
173
+ const action = await ask({
174
174
  type: "list",
175
175
  name: "action",
176
176
  message: "What would you like to do?",
@@ -193,8 +193,6 @@ async function handleInteractiveMenu(): Promise<void> {
193
193
  ],
194
194
  });
195
195
 
196
- const action = (response as any).value;
197
-
198
196
  switch (action) {
199
197
  case "show":
200
198
  await handleShow(defaultCliMode);
@@ -371,8 +369,7 @@ async function handleAdd(
371
369
  }
372
370
 
373
371
  // Interactive mode
374
- const interactInstance = new plugins.smartinteract.SmartInteract();
375
- const response = await interactInstance.askQuestion({
372
+ url = await ask({
376
373
  type: "input",
377
374
  name: "registryUrl",
378
375
  message: "Enter npm target registry URL:",
@@ -381,7 +378,6 @@ async function handleAdd(
381
378
  return !!(input && input.trim() !== "");
382
379
  },
383
380
  });
384
- url = (response as any).value;
385
381
  }
386
382
 
387
383
  const config = await ReleaseConfig.fromCwd();
@@ -429,15 +425,13 @@ async function handleRemove(
429
425
  }
430
426
 
431
427
  // Interactive mode - show list to select from
432
- const interactInstance = new plugins.smartinteract.SmartInteract();
433
- const response = await interactInstance.askQuestion({
428
+ url = await ask({
434
429
  type: "list",
435
430
  name: "registryUrl",
436
431
  message: "Select npm target registry to remove:",
437
- choices: registries,
432
+ choices: stringChoices(registries),
438
433
  default: registries[0],
439
434
  });
440
- url = (response as any).value;
441
435
  }
442
436
 
443
437
  const removed = config.removeRegistry(url!);
@@ -473,7 +467,7 @@ async function handleClear(mode: ICliMode): Promise<void> {
473
467
 
474
468
  // Confirm before clearing
475
469
  const confirmed = mode.interactive
476
- ? await plugins.smartinteract.SmartInteract.getCliConfirmation(
470
+ ? await confirm(
477
471
  "Clear all configured npm target registries?",
478
472
  false,
479
473
  )
@@ -509,15 +503,13 @@ async function handleAccessLevel(
509
503
  }
510
504
 
511
505
  // Interactive mode - toggle or ask
512
- const interactInstance = new plugins.smartinteract.SmartInteract();
513
- const response = await interactInstance.askQuestion({
506
+ level = await ask<string>({
514
507
  type: "list",
515
508
  name: "accessLevel",
516
509
  message: "Select npm access level for publishing:",
517
- choices: ["public", "private"],
510
+ choices: stringChoices(["public", "private"]),
518
511
  default: currentLevel,
519
512
  });
520
- level = (response as any).value;
521
513
  }
522
514
 
523
515
  // Validate the level
@@ -593,8 +585,7 @@ async function handleCommitInteractive(config: CommitConfig): Promise<void> {
593
585
  );
594
586
  console.log("");
595
587
 
596
- const interactInstance = new plugins.smartinteract.SmartInteract();
597
- const response = await interactInstance.askQuestion({
588
+ const selected = await ask({
598
589
  type: "checkbox",
599
590
  name: "commitOptions",
600
591
  message: "Select commit options to enable:",
@@ -607,8 +598,6 @@ async function handleCommitInteractive(config: CommitConfig): Promise<void> {
607
598
  ...(config.getAlwaysBuild() ? ["alwaysBuild"] : []),
608
599
  ],
609
600
  });
610
-
611
- const selected = (response as any).value || [];
612
601
  config.setAlwaysTest(selected.includes("alwaysTest"));
613
602
  config.setAlwaysBuild(selected.includes("alwaysBuild"));
614
603
  syncCommitStepsFromBooleans(config);
@@ -685,40 +674,39 @@ async function handleProject(mode: ICliMode): Promise<void> {
685
674
  const cliConfig = getCliConfigValueFromData(smartconfigData, "") || {};
686
675
  const moduleConfig = cliConfig.module || {};
687
676
  const packageJson = await readPackageJson();
688
- const interactInstance = new plugins.smartinteract.SmartInteract();
689
677
 
690
- const projectType = await askValue<string>(interactInstance, {
678
+ const projectType = await ask<string>({
691
679
  type: "list",
692
680
  name: "projectType",
693
681
  message: "What kind of project is this?",
694
- choices: ["npm", "service", "wcc", "website"],
682
+ choices: stringChoices(["npm", "service", "wcc", "website"]),
695
683
  default: cliConfig.projectType || "npm",
696
684
  });
697
- const githost = await askValue<string>(interactInstance, {
685
+ const githost = await ask({
698
686
  type: "input",
699
687
  name: "githost",
700
688
  message: "Git host:",
701
689
  default: moduleConfig.githost || "code.foss.global",
702
690
  });
703
- const gitscope = await askValue<string>(interactInstance, {
691
+ const gitscope = await ask({
704
692
  type: "input",
705
693
  name: "gitscope",
706
694
  message: "Git scope/owner:",
707
695
  default: moduleConfig.gitscope || "git.zone",
708
696
  });
709
- const gitrepo = await askValue<string>(interactInstance, {
697
+ const gitrepo = await ask({
710
698
  type: "input",
711
699
  name: "gitrepo",
712
700
  message: "Git repository name:",
713
701
  default: moduleConfig.gitrepo || inferRepoName(packageJson.name),
714
702
  });
715
- const description = await askValue<string>(interactInstance, {
703
+ const description = await ask({
716
704
  type: "input",
717
705
  name: "description",
718
706
  message: "Project description:",
719
707
  default: moduleConfig.description || packageJson.description || "",
720
708
  });
721
- const npmPackagename = await askValue<string>(interactInstance, {
709
+ const npmPackagename = await ask({
722
710
  type: "input",
723
711
  name: "npmPackagename",
724
712
  message: "npm package name:",
@@ -728,13 +716,13 @@ async function handleProject(mode: ICliMode): Promise<void> {
728
716
  packageJson.name ||
729
717
  "",
730
718
  });
731
- const license = await askValue<string>(interactInstance, {
719
+ const license = await ask({
732
720
  type: "input",
733
721
  name: "license",
734
722
  message: "License:",
735
723
  default: moduleConfig.license || packageJson.license || "MIT",
736
724
  });
737
- const keywords = await askValue<string>(interactInstance, {
725
+ const keywords = await ask({
738
726
  type: "input",
739
727
  name: "keywords",
740
728
  message: "Keywords (comma-separated):",
@@ -775,22 +763,21 @@ async function handleCli(mode: ICliMode): Promise<void> {
775
763
 
776
764
  const smartconfigData = await readSmartconfigFile();
777
765
  const cliConfig = getCliConfigValueFromData(smartconfigData, "cli") || {};
778
- const interactInstance = new plugins.smartinteract.SmartInteract();
779
766
 
780
- const output = await askValue<string>(interactInstance, {
767
+ const output = await ask<string>({
781
768
  type: "list",
782
769
  name: "output",
783
770
  message: "Default output mode:",
784
- choices: ["human", "plain", "json"],
771
+ choices: stringChoices(["human", "plain", "json"]),
785
772
  default: cliConfig.output || "human",
786
773
  });
787
- const interactive = await askValue<boolean>(interactInstance, {
774
+ const interactive = await ask({
788
775
  type: "confirm",
789
776
  name: "interactive",
790
777
  message: "Enable interactive prompts by default?",
791
778
  default: cliConfig.interactive ?? true,
792
779
  });
793
- const checkUpdates = await askValue<boolean>(interactInstance, {
780
+ const checkUpdates = await ask({
794
781
  type: "confirm",
795
782
  name: "checkUpdates",
796
783
  message: "Check for gitzone updates in human mode?",
@@ -823,41 +810,40 @@ async function handleRelease(mode: ICliMode): Promise<void> {
823
810
  const currentRelease =
824
811
  getCliConfigValueFromData(smartconfigData, "release") || {};
825
812
  const currentTargets = currentRelease.targets || {};
826
- const interactInstance = new plugins.smartinteract.SmartInteract();
827
813
 
828
- const confirmation = await askValue<string>(interactInstance, {
814
+ const confirmation = await ask<string>({
829
815
  type: "list",
830
816
  name: "confirmation",
831
817
  message: "Release confirmation mode:",
832
- choices: ["prompt", "auto", "plan"],
818
+ choices: stringChoices(["prompt", "auto", "plan"]),
833
819
  default: currentRelease.confirmation || "prompt",
834
820
  });
835
- const runTests = await askValue<boolean>(interactInstance, {
821
+ const runTests = await ask({
836
822
  type: "confirm",
837
823
  name: "runTests",
838
824
  message: "Run tests during release preflight?",
839
825
  default: currentRelease.preflight?.test ?? false,
840
826
  });
841
- const runBuild = await askValue<boolean>(interactInstance, {
827
+ const runBuild = await ask({
842
828
  type: "confirm",
843
829
  name: "runBuild",
844
830
  message: "Run build during release?",
845
831
  default: currentRelease.preflight?.build ?? true,
846
832
  });
847
- const testCommand = await askValue<string>(interactInstance, {
833
+ const testCommand = await ask({
848
834
  type: "input",
849
835
  name: "testCommand",
850
836
  message: "Release test command:",
851
837
  default: currentRelease.preflight?.testCommand || "pnpm test",
852
838
  });
853
- const buildCommand = await askValue<string>(interactInstance, {
839
+ const buildCommand = await ask({
854
840
  type: "input",
855
841
  name: "buildCommand",
856
842
  message: "Release build command:",
857
843
  default: currentRelease.preflight?.buildCommand || "pnpm build",
858
844
  });
859
845
 
860
- const enabledTargets = await askValue<string[]>(interactInstance, {
846
+ const enabledTargets = await ask<string>({
861
847
  type: "checkbox",
862
848
  name: "targets",
863
849
  message: "Enable release targets:",
@@ -875,7 +861,7 @@ async function handleRelease(mode: ICliMode): Promise<void> {
875
861
  releaseTargets.git = {
876
862
  ...(currentTargets.git || {}),
877
863
  enabled: true,
878
- remote: await askValue<string>(interactInstance, {
864
+ remote: await ask({
879
865
  type: "input",
880
866
  name: "gitRemote",
881
867
  message: "Git remote:",
@@ -889,7 +875,7 @@ async function handleRelease(mode: ICliMode): Promise<void> {
889
875
  }
890
876
 
891
877
  if (enabledTargets.includes("npm")) {
892
- const registries = await askValue<string>(interactInstance, {
878
+ const registries = await ask({
893
879
  type: "input",
894
880
  name: "npmRegistries",
895
881
  message: "npm registries (comma-separated):",
@@ -901,18 +887,18 @@ async function handleRelease(mode: ICliMode): Promise<void> {
901
887
  ...(currentTargets.npm || {}),
902
888
  enabled: true,
903
889
  registries: parseCsv(registries).map(normalizeRegistryUrl),
904
- accessLevel: await askValue<string>(interactInstance, {
890
+ accessLevel: await ask<string>({
905
891
  type: "list",
906
892
  name: "npmAccessLevel",
907
893
  message: "npm publish access level:",
908
- choices: ["public", "private"],
894
+ choices: stringChoices(["public", "private"]),
909
895
  default: currentTargets.npm?.accessLevel || "public",
910
896
  }),
911
- alreadyPublished: await askValue<string>(interactInstance, {
897
+ alreadyPublished: await ask<string>({
912
898
  type: "list",
913
899
  name: "alreadyPublished",
914
900
  message: "When a package version is already published:",
915
- choices: ["success", "error"],
901
+ choices: stringChoices(["success", "error"]),
916
902
  default: currentTargets.npm?.alreadyPublished || "success",
917
903
  }),
918
904
  };
@@ -921,14 +907,14 @@ async function handleRelease(mode: ICliMode): Promise<void> {
921
907
  }
922
908
 
923
909
  if (enabledTargets.includes("docker")) {
924
- const registry = await askValue<string>(interactInstance, {
910
+ const registry = await ask({
925
911
  type: "input",
926
912
  name: "dockerRegistry",
927
913
  message:
928
914
  "Single tsdocker registry target (empty means all configured registries):",
929
915
  default: currentTargets.docker?.registry || "",
930
916
  });
931
- const buildRegistries = await askValue<string>(interactInstance, {
917
+ const buildRegistries = await ask({
932
918
  type: "input",
933
919
  name: "dockerBuildRegistries",
934
920
  message:
@@ -937,7 +923,7 @@ async function handleRelease(mode: ICliMode): Promise<void> {
937
923
  ? currentTargets.docker.buildRegistries.join(", ")
938
924
  : "",
939
925
  });
940
- const patterns = await askValue<string>(interactInstance, {
926
+ const patterns = await ask({
941
927
  type: "input",
942
928
  name: "dockerPatterns",
943
929
  message:
@@ -946,25 +932,25 @@ async function handleRelease(mode: ICliMode): Promise<void> {
946
932
  ? currentTargets.docker.patterns.join(", ")
947
933
  : "",
948
934
  });
949
- const test = await askValue<boolean>(interactInstance, {
935
+ const test = await ask({
950
936
  type: "confirm",
951
937
  name: "dockerTest",
952
938
  message: "Run configured image tests before destination publication?",
953
939
  default: currentTargets.docker?.test ?? false,
954
940
  });
955
- const cached = await askValue<boolean>(interactInstance, {
941
+ const cached = await ask({
956
942
  type: "confirm",
957
943
  name: "dockerCached",
958
944
  message: "Use tsdocker cached builds?",
959
945
  default: currentTargets.docker?.cached ?? false,
960
946
  });
961
- const parallel = await askValue<string>(interactInstance, {
947
+ const parallel = await ask({
962
948
  type: "input",
963
949
  name: "dockerParallel",
964
950
  message: "tsdocker parallel mode (false, true, or concurrency number):",
965
951
  default: formatDockerParallel(currentTargets.docker?.parallel ?? false),
966
952
  });
967
- const context = await askValue<string>(interactInstance, {
953
+ const context = await ask({
968
954
  type: "input",
969
955
  name: "dockerContext",
970
956
  message: "Docker context for tsdocker (empty for default):",
@@ -1045,7 +1031,7 @@ async function handleFix(argvArg: any, mode: ICliMode): Promise<void> {
1045
1031
  );
1046
1032
  }
1047
1033
  const confirmed =
1048
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
1034
+ await confirm(
1049
1035
  `Run configuration fixes for .smartconfig.json? (${counts.error} error, ${counts.warn} warning)`,
1050
1036
  true,
1051
1037
  );
@@ -1633,11 +1619,6 @@ function formatTarget(enabled: unknown, targetConfig: any): string {
1633
1619
  return details.length > 0 ? `${state} (${details.join(", ")})` : state;
1634
1620
  }
1635
1621
 
1636
- async function askValue<T>(interactInstance: any, options: any): Promise<T> {
1637
- const response = await interactInstance.askQuestion(options);
1638
- return response.value as T;
1639
- }
1640
-
1641
1622
  async function readPackageJson(): Promise<Record<string, any>> {
1642
1623
  const packageJsonPath = plugins.path.join(process.cwd(), "package.json");
1643
1624
  if (!(await plugins.smartfs.file(packageJsonPath).exists())) {
@@ -2,6 +2,7 @@ import * as plugins from "./mod.plugins.js";
2
2
 
3
3
  import { logger } from "../gitzone.logging.js";
4
4
  import { getCliMode, printJson } from "../helpers.climode.js";
5
+ import { ask, confirm, withPrompts } from "../helpers.prompts.js";
5
6
  import {
6
7
  createDeprecationPlan,
7
8
  describeDeprecationPlan,
@@ -35,7 +36,7 @@ export const run = async (argvArg: any = {}) => {
35
36
  throw new Error(
36
37
  "Specify --package, --registries, and --replacement or --message.",
37
38
  );
38
- const smartInteract = new plugins.smartinteract.SmartInteract([
39
+ const answers = await withPrompts((prompts) => prompts.askAll([
39
40
  {
40
41
  name: `registryUrls`,
41
42
  message: `What are the comma separated registry URLs?`,
@@ -63,14 +64,13 @@ export const run = async (argvArg: any = {}) => {
63
64
  return !process.env.CI;
64
65
  },
65
66
  },
66
- ]);
67
- const answerBucket = await smartInteract.runQueue();
68
- registryInput = answerBucket.getAnswerFor("registryUrls");
69
- oldPackageName = answerBucket.getAnswerFor("oldPackageName");
70
- const newPackageAnswer = answerBucket.getAnswerFor("newPackageName");
67
+ ]));
68
+ registryInput = answers.registryUrls;
69
+ oldPackageName = answers.oldPackageName;
70
+ const newPackageAnswer = answers.newPackageName;
71
71
  newPackageName = newPackageAnswer === "" ? undefined : newPackageAnswer;
72
72
  if (newPackageName === undefined && message === undefined) {
73
- const messageAnswer = await smartInteract.askQuestion({
73
+ message = await ask({
74
74
  name: `message`,
75
75
  message: `What deprecation message guides users of the OLD package?`,
76
76
  type: `input`,
@@ -79,7 +79,6 @@ export const run = async (argvArg: any = {}) => {
79
79
  return stringInput !== "" && !process.env.CI;
80
80
  },
81
81
  });
82
- message = messageAnswer.value;
83
82
  }
84
83
  }
85
84
  if (
@@ -106,7 +105,7 @@ export const run = async (argvArg: any = {}) => {
106
105
  if (!mode.interactive)
107
106
  throw new Error("Deprecation requires -y or interactive confirmation.");
108
107
  if (
109
- !(await plugins.smartinteract.SmartInteract.getCliConfirmation(
108
+ !(await confirm(
110
109
  `Deprecate every version of ${plan.packageName}?`,
111
110
  false,
112
111
  ))
@@ -1,6 +1,5 @@
1
1
  export * from '../plugins.js';
2
2
 
3
- import * as smartinteract from '@push.rocks/smartinteract';
4
3
  import * as smartshell from '@push.rocks/smartshell';
5
4
 
6
- export { smartinteract, smartshell };
5
+ export { smartshell };
@@ -2,6 +2,7 @@ import * as plugins from './mod.plugins.js';
2
2
  import { logger } from '../gitzone.logging.js';
3
3
  import type { ICliMode } from '../helpers.climode.js';
4
4
  import { getCliMode, printJson } from '../helpers.climode.js';
5
+ import { ask } from '../helpers.prompts.js';
5
6
  import {
6
7
  DockerPruner,
7
8
  pruneConsentLabelKey,
@@ -51,14 +52,13 @@ async function handlePrune(argvArg: any, mode: ICliMode) {
51
52
  '`docker prune --volumes --apply` destroys persisted data. Re-run with --yes to confirm non-interactively.',
52
53
  );
53
54
  }
54
- const smartinteraction = new plugins.smartinteract.SmartInteract();
55
- const confirmAnswer = await smartinteraction.askQuestion({
55
+ const confirmAnswer = await ask({
56
56
  name: 'confirm',
57
57
  type: 'input',
58
58
  message: `Type "yes" to permanently delete ${reclaimableVolumes.length} volume(s) and their data:`,
59
59
  default: 'no',
60
60
  });
61
- return confirmAnswer.value === 'yes';
61
+ return confirmAnswer === 'yes';
62
62
  };
63
63
 
64
64
  if (mode.json) {
@@ -3,6 +3,10 @@ import type { IPlannedChange } from "../interfaces.format.js";
3
3
  import * as plugins from "../mod.plugins.js";
4
4
  import { logger, logVerbose } from "../../gitzone.logging.js";
5
5
  import { migrateSmartconfigData } from "../../helpers.smartconfigmigrations.js";
6
+ import {
7
+ answerDefaultsWithoutTerminal,
8
+ withPrompts,
9
+ } from "../../helpers.prompts.js";
6
10
 
7
11
  const CONFIG_FILE = ".smartconfig.json";
8
12
 
@@ -68,7 +72,6 @@ export class SmartconfigFormatter extends BaseFormatter {
68
72
  "module.license",
69
73
  ];
70
74
 
71
- const interactInstance = new plugins.smartinteract.SmartInteract();
72
75
  const missingRepoInformation = expectedRepoInformation.filter(
73
76
  (expectedRepoInformationItem) => {
74
77
  return !plugins.smartobject.smartGet(
@@ -84,29 +87,19 @@ export class SmartconfigFormatter extends BaseFormatter {
84
87
  );
85
88
  }
86
89
 
87
- for (const expectedRepoInformationItem of expectedRepoInformation) {
88
- if (
89
- !plugins.smartobject.smartGet(
90
- smartconfigJson["@git.zone/cli"],
91
- expectedRepoInformationItem,
92
- )
93
- ) {
94
- interactInstance.addQuestions([
95
- {
96
- message: `What is the value of ${expectedRepoInformationItem}`,
97
- name: expectedRepoInformationItem,
98
- type: "input",
99
- default: "undefined variable",
100
- },
101
- ]);
102
- }
103
- }
90
+ const missingRepoQuestions: plugins.smartconsole.IInputQuestion[] =
91
+ missingRepoInformation.map((missingRepoInformationItem) => ({
92
+ message: `What is the value of ${missingRepoInformationItem}`,
93
+ name: missingRepoInformationItem,
94
+ type: "input",
95
+ default: "undefined variable",
96
+ }));
104
97
 
105
- const answerbucket = await interactInstance.runQueue();
98
+ const answers = await withPrompts((prompts) =>
99
+ prompts.add(missingRepoQuestions).runQueue(answerDefaultsWithoutTerminal),
100
+ );
106
101
  for (const expectedRepoInformationItem of expectedRepoInformation) {
107
- const cliProvidedValue = answerbucket.getAnswerFor(
108
- expectedRepoInformationItem,
109
- );
102
+ const cliProvidedValue = answers[expectedRepoInformationItem];
110
103
  if (cliProvidedValue) {
111
104
  plugins.smartobject.smartAdd(
112
105
  smartconfigJson["@git.zone/cli"],
@@ -1,6 +1,11 @@
1
1
  import * as plugins from "./mod.plugins.js";
2
2
  import { Project } from "../classes.project.js";
3
3
  import { FormatContext } from "./classes.formatcontext.js";
4
+ import {
5
+ answerDefaultsWithoutTerminal,
6
+ ask,
7
+ confirm,
8
+ } from "../helpers.prompts.js";
4
9
  import { FormatPlanner } from "./classes.formatplanner.js";
5
10
  import { BaseFormatter } from "./classes.baseformatter.js";
6
11
  import { logger, setVerboseMode } from "../gitzone.logging.js";
@@ -297,7 +302,7 @@ const handleFormatFix = async (
297
302
  "Format fix requires an interactive terminal or `-y` to run non-interactively.",
298
303
  );
299
304
  }
300
- const confirmed = await plugins.smartinteract.SmartInteract.getCliConfirmation(
305
+ const confirmed = await confirm(
301
306
  `Run format fixes? (${plan.summary.totalFiles} planned change(s), ${status.errorCount} error warning(s))`,
302
307
  true,
303
308
  );
@@ -549,15 +554,14 @@ export let run = async (
549
554
 
550
555
  // Interactive confirmation
551
556
  if (interactive && !autoApprove) {
552
- const interactInstance = new plugins.smartinteract.SmartInteract();
553
- const response = await interactInstance.askQuestion({
557
+ const proceed = await ask({
554
558
  type: "confirm",
555
559
  name: "proceed",
556
560
  message: "Proceed with formatting?",
557
561
  default: true,
558
- });
562
+ }, answerDefaultsWithoutTerminal);
559
563
 
560
- if (!(response as any).value) {
564
+ if (!proceed) {
561
565
  logger.log("info", "Format operation cancelled by user");
562
566
  return;
563
567
  }
@@ -2,7 +2,6 @@ export * from '../plugins.js';
2
2
 
3
3
  import * as path from 'path';
4
4
  import * as smartfile from '@push.rocks/smartfile';
5
- import * as smartinteract from '@push.rocks/smartinteract';
6
5
  import * as smartlegal from '@push.rocks/smartlegal';
7
6
  import * as smartobject from '@push.rocks/smartobject';
8
7
  import * as smartconfig from '@push.rocks/smartconfig';
@@ -12,7 +11,6 @@ import * as smartscaf from '@push.rocks/smartscaf';
12
11
  export {
13
12
  path,
14
13
  smartfile,
15
- smartinteract,
16
14
  smartlegal,
17
15
  smartobject,
18
16
  smartconfig,
@@ -3,6 +3,7 @@ import * as paths from '../paths.js';
3
3
  import * as interfaces from './meta.interfaces.js';
4
4
 
5
5
  import { logger } from '../gitzone.logging.js';
6
+ import { answerDefaultsWithoutTerminal, confirm } from '../helpers.prompts.js';
6
7
 
7
8
  export class Meta {
8
9
  public cwd: string;
@@ -143,9 +144,10 @@ export class Meta {
143
144
  }
144
145
 
145
146
  const shouldClean =
146
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
147
+ await confirm(
147
148
  'Delete these untracked paths?',
148
149
  false,
150
+ answerDefaultsWithoutTerminal,
149
151
  );
150
152
  if (!shouldClean) {
151
153
  logger.log('note', 'keeping untracked paths');
@@ -188,9 +190,10 @@ export class Meta {
188
190
  )
189
191
  ) {
190
192
  const response =
191
- await plugins.smartinteraction.SmartInteract.getCliConfirmation(
193
+ await confirm(
192
194
  `Do you want to delete superfluous directory >>${preExistingFolderArg}<< ?`,
193
195
  true,
196
+ answerDefaultsWithoutTerminal,
194
197
  );
195
198
  if (response) {
196
199
  logger.log('warn', `Deleting >>${preExistingFolderArg}<<!`);
@@ -365,9 +368,10 @@ export class Meta {
365
368
  const targetExists = await plugins.smartfs.directory(targetDirectory).exists();
366
369
  if (targetExists) {
367
370
  const shouldContinue =
368
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
371
+ await confirm(
369
372
  `Delete directory ${targetDirectory} and everything in it?`,
370
373
  false,
374
+ answerDefaultsWithoutTerminal,
371
375
  );
372
376
  if (!shouldContinue) {
373
377
  logger.log('note', 'Cancelled — nothing was removed');
@@ -1,8 +1,7 @@
1
1
  export * from '../plugins.js';
2
2
 
3
3
  import * as smartfile from '@push.rocks/smartfile';
4
- import * as smartinteraction from '@push.rocks/smartinteract';
5
4
  import * as smartjson from '@push.rocks/smartjson';
6
5
  import * as smartshell from '@push.rocks/smartshell';
7
6
 
8
- export { smartfile, smartinteraction, smartjson, smartshell };
7
+ export { smartfile, smartjson, smartshell };
@@ -3,6 +3,7 @@ import * as paths from "../paths.js";
3
3
  import { logger } from "../gitzone.logging.js";
4
4
  import type { ICliMode } from "../helpers.climode.js";
5
5
  import { getCliMode, printJson } from "../helpers.climode.js";
6
+ import { confirm } from "../helpers.prompts.js";
6
7
  import {
7
8
  movePendingToVersion,
8
9
  readPendingChangelog,
@@ -284,7 +285,7 @@ const runInternal = async (argvArg: any): Promise<void> => {
284
285
  );
285
286
  }
286
287
  const confirmed =
287
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
288
+ await confirm(
288
289
  `Release v${newVersion} now?`,
289
290
  true,
290
291
  );
@@ -1305,7 +1306,7 @@ const runReleaseRecover = async (
1305
1306
  "Release recovery requires an interactive terminal or -y.",
1306
1307
  );
1307
1308
  if (
1308
- !(await plugins.smartinteract.SmartInteract.getCliConfirmation(
1309
+ !(await confirm(
1309
1310
  `Recover and publish existing v${version}?`,
1310
1311
  false,
1311
1312
  ))
@@ -1632,7 +1633,7 @@ const confirmReleaseResume = async (
1632
1633
  throw new Error("Release resume requires an interactive terminal or -y.");
1633
1634
  }
1634
1635
  const confirmed =
1635
- await plugins.smartinteract.SmartInteract.getCliConfirmation(
1636
+ await confirm(
1636
1637
  questionArg,
1637
1638
  true,
1638
1639
  );