@canonical/summon 0.37.0 → 0.40.0

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/dist/src/index.d.ts +15 -0
  2. package/dist/src/index.js +16 -0
  3. package/dist/src/index.js.map +1 -0
  4. package/package.json +17 -12
  5. package/src/bin.tsx +238 -0
  6. package/src/completion.test.ts +202 -0
  7. package/src/completion.ts +492 -0
  8. package/src/components/App.askMissing.test.tsx +164 -0
  9. package/src/components/App.confirmGate.test.tsx +111 -0
  10. package/src/components/App.escBack.test.tsx +98 -0
  11. package/src/components/App.invalidAnswer.test.tsx +71 -0
  12. package/src/components/App.tsx +1305 -0
  13. package/src/components/ExecutionProgress.tsx +222 -0
  14. package/src/components/FileTreePreview.tsx +97 -0
  15. package/src/components/PromptSequence.tsx +558 -0
  16. package/src/components/Spinner.tsx +36 -0
  17. package/src/components/index.ts +16 -0
  18. package/src/components/undoPlan.test.ts +99 -0
  19. package/src/components/undoPlan.ts +70 -0
  20. package/src/discovery/index.ts +1 -0
  21. package/src/discovery/loadGenerator.ts +40 -0
  22. package/src/display/index.ts +2 -0
  23. package/src/display/printGeneratorHelp.ts +130 -0
  24. package/src/display/printNode.ts +76 -0
  25. package/src/index.ts +16 -0
  26. package/src/registration/buildCommandBarrel.test.ts +80 -0
  27. package/src/registration/buildCommandBarrel.ts +66 -0
  28. package/src/registration/conformance.subprocess.test.ts +192 -0
  29. package/src/registration/index.ts +2 -0
  30. package/src/registration/interaction.subprocess.test.ts +458 -0
  31. package/src/registration/registerFromBarrel.tsx +501 -0
  32. package/src/registration/resolveMode.test.ts +118 -0
  33. package/src/registration/resolveMode.ts +52 -0
  34. package/src/testing/globalSetup.test.ts +165 -0
  35. package/src/testing/globalSetup.ts +501 -0
  36. package/src/ui/index.tsx +31 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Public UI entry point for summon's interactive Ink experience.
3
+ *
4
+ * Exposes the same `App` the summon binary renders, plus a {@link renderApp}
5
+ * helper that mounts it and resolves when the user finishes, so other CLIs
6
+ * (e.g. pragma's `create`/`setup`) can reuse the exact prompt/preview/execute
7
+ * flow instead of duplicating it.
8
+ *
9
+ * @module
10
+ */
11
+
12
+ import { render } from "ink";
13
+ import { App, type AppProps } from "../components/App.js";
14
+
15
+ export type { AppProps, AppState } from "../components/App.js";
16
+ export { App } from "../components/App.js";
17
+
18
+ /**
19
+ * Render the interactive generator UI and resolve when it exits.
20
+ *
21
+ * Mounts summon's Ink `App` (prompt sequence → preview/confirm → execution)
22
+ * and awaits `waitUntilExit`, matching how the summon binary drives a run.
23
+ *
24
+ * @param props - The App props (generator, preview, answers, stamp, …).
25
+ * @returns A promise that resolves once the UI has fully exited.
26
+ * @note Impure — takes over the terminal via Ink and performs the run's effects.
27
+ */
28
+ export async function renderApp(props: AppProps): Promise<void> {
29
+ const { waitUntilExit } = render(<App {...props} />);
30
+ await waitUntilExit();
31
+ }