@aventara/cli 0.1.0-pilot.4 → 1.0.0-rc.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 (37) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +9 -4
  3. package/dist/cli.js +4 -0
  4. package/dist/command/command.parser.js +7 -0
  5. package/dist/run/command.runner.js +2 -0
  6. package/dist/run/init.orchestrator.js +33 -13
  7. package/dist/run/new.orchestrator.js +29 -11
  8. package/dist/run/step.reporter.js +87 -0
  9. package/package.json +4 -3
  10. package/dist/apply/app-module.anchor.d.ts +0 -24
  11. package/dist/apply/conflict.confirmer.d.ts +0 -15
  12. package/dist/apply/e2e-spec.anchor.d.ts +0 -18
  13. package/dist/apply/main-cors.anchor.d.ts +0 -50
  14. package/dist/apply/manifest.merger.d.ts +0 -51
  15. package/dist/aventara.bin.d.ts +0 -2
  16. package/dist/catalog/adapter.catalog.generated.d.ts +0 -20
  17. package/dist/catalog/catalog-entry.interface.d.ts +0 -54
  18. package/dist/catalog/catalog.matcher.d.ts +0 -40
  19. package/dist/catalog/range.reader.d.ts +0 -11
  20. package/dist/cli.d.ts +0 -29
  21. package/dist/command/command.parser.d.ts +0 -38
  22. package/dist/node-version.guard.d.ts +0 -8
  23. package/dist/plan/project.planner.d.ts +0 -53
  24. package/dist/project/package-manager.detector.d.ts +0 -5
  25. package/dist/project/project.inspector.d.ts +0 -32
  26. package/dist/project/service.detector.d.ts +0 -40
  27. package/dist/project/source.scanner.d.ts +0 -16
  28. package/dist/run/command.runner.d.ts +0 -15
  29. package/dist/run/init.orchestrator.d.ts +0 -27
  30. package/dist/run/new.orchestrator.d.ts +0 -20
  31. package/dist/run/scaffold.committer.d.ts +0 -28
  32. package/dist/templates/docs.links.d.ts +0 -8
  33. package/dist/templates/prisma7/prisma7.templates.d.ts +0 -34
  34. package/dist/templates/template.registry.d.ts +0 -152
  35. package/dist/wizard/answer.resolver.d.ts +0 -47
  36. package/dist/wizard/readline.prompter.d.ts +0 -22
  37. package/dist/wizard/wizard.questions.d.ts +0 -120
@@ -1,47 +0,0 @@
1
- import type { AnyWizardQuestion, QuestionId, WizardAnswers, WizardContext } from "./wizard.questions.js";
2
- /**
3
- * 1. **its flag**, validated by the question (a bad value is refused, never
4
- * re-asked);
5
- * 2. **the only choice there is**: shown on a terminal with no keypress;
6
- * 3. **`--yes`**: the question's default, when it has one;
7
- * 4. **the prompt**, when someone can answer (stdin is a terminal);
8
- * 5. otherwise the question is **unanswered**, and once every question has been
9
- * tried the run refuses in one sentence naming exactly those flags.
10
- *
11
- * `--yes` comes before the prompt because it means "accept each unanswered
12
- * question's default", on a terminal as much as anywhere; a question with no
13
- * default (`new`'s `<name>`) is still asked on a terminal.
14
- */
15
- /** The seam to a person: `node:readline/promises` on a terminal, a script in specs. */
16
- export type Prompter = {
17
- /** Whether someone can answer: stdin is a terminal. */
18
- readonly interactive: boolean;
19
- /** Asks once; resolves with what was typed, `""` for Enter alone. */
20
- readonly ask: (request: PromptRequest) => Promise<string>;
21
- /** Says one line without asking. */
22
- readonly say: (line: string) => void;
23
- };
24
- export type PromptRequest = {
25
- readonly label: string;
26
- /** The accepted values, shown with the label; absent for free text. */
27
- readonly choices?: readonly string[];
28
- readonly defaultValue?: string;
29
- };
30
- /** Nobody can answer and some questions are unanswered. A refusal: one sentence. */
31
- export declare class UnansweredQuestionsError extends Error {
32
- readonly name = "UnansweredQuestionsError";
33
- }
34
- export type AnswerSources = {
35
- /** Raw answers from the command line, by question. */
36
- readonly given: Readonly<Partial<Record<QuestionId, string>>>;
37
- readonly yes: boolean;
38
- readonly prompter: Prompter;
39
- readonly context: Omit<WizardContext, "answered">;
40
- };
41
- /**
42
- * Settles `questions` in order, each later question seeing the earlier answers.
43
- *
44
- * @throws WizardAnswerError when a flag's value is not an answer.
45
- * @throws UnansweredQuestionsError when nobody can answer and something is unanswered.
46
- */
47
- export declare function resolveAnswers(questions: readonly AnyWizardQuestion[], sources: AnswerSources): Promise<Partial<WizardAnswers>>;
@@ -1,22 +0,0 @@
1
- import type { Readable, Writable } from "node:stream";
2
- import type { Prompter } from "./answer.resolver.js";
3
- /**
4
- * Lines are **queued** as they arrive and handed to questions in order. A terminal
5
- * delivers whatever was typed ahead of a question — and a script piping answers
6
- * into a pseudo-terminal delivers them all at once — and readline drops a line
7
- * nobody is waiting for. Measured: with `readline/promises`' `question`, three
8
- * answers piped into `script(1)` reached the first question only.
9
- */
10
- /** Input ended while a question was open: the person closed the wizard. A refusal. */
11
- export declare class WizardCancelledError extends Error {
12
- readonly name = "WizardCancelledError";
13
- }
14
- export type ReadlinePrompter = Prompter & {
15
- readonly close: () => void;
16
- };
17
- export declare function createReadlinePrompter(streams: {
18
- readonly input: Readable & {
19
- readonly isTTY?: boolean;
20
- };
21
- readonly output: Writable;
22
- }): ReadlinePrompter;
@@ -1,120 +0,0 @@
1
- import type { AdapterCatalog, CatalogEntry } from "../catalog/catalog-entry.interface.js";
2
- import { type ExportReference, type ServiceScan } from "../project/service.detector.js";
3
- /**
4
- * The command-line grammar, the TTY prompt, the `--yes` defaults and the
5
- * non-interactive refusal sentence are all derived from it, so a question cannot
6
- * have a flag the parser does not know or a default the refusal does not mention.
7
- *
8
- * Choices that are an adapter's facts — which ORMs and majors exist, which
9
- * databases one supports — come from the generated catalog, never from a literal
10
- * here.
11
- */
12
- /** Yarn is not supported. */
13
- export declare const PACKAGE_MANAGERS: readonly ["npm", "pnpm"];
14
- export type PackageManager = (typeof PACKAGE_MANAGERS)[number];
15
- /** What the wizard settles. */
16
- export type WizardAnswers = {
17
- /** `new`'s project directory. */
18
- readonly name: string;
19
- /** The ORM and major, as the catalog entry that serves it. */
20
- readonly orm: CatalogEntry;
21
- /** One of `orm`'s providers. */
22
- readonly db: string;
23
- readonly packageManager: PackageManager;
24
- /** `init` over an existing ORM setup: the developer's service. */
25
- readonly service: ServiceChoice;
26
- /** The Nest module that provides and exports it. */
27
- readonly module: ExportReference;
28
- };
29
- /** The service `AventaraModule` is given, or the template's new one to be written. */
30
- export type ServiceChoice = ExportReference & {
31
- /** Set when the service holds its client in a member instead of extending it. */
32
- readonly clientMember?: string;
33
- /** The template's new service file, written because the project has none. */
34
- readonly isNew: boolean;
35
- };
36
- export type QuestionId = keyof WizardAnswers;
37
- /** What the scan of the developer's source found, for the service questions. */
38
- export type ServiceContext = {
39
- readonly scan: ServiceScan;
40
- /** The ORM's client class, as the scan looked for it. */
41
- readonly clientClass: string;
42
- /** The service and module init writes when the project has none. */
43
- readonly newService: ExportReference;
44
- readonly newModule: ExportReference;
45
- /** Whether a file already stands where the new service would be written. */
46
- readonly newServiceFileExists: boolean;
47
- /** How the ORM is named to the person, e.g. `Prisma`. */
48
- readonly label: string;
49
- };
50
- /** What a question may consult: the catalog, what was detected, what is already answered. */
51
- export type WizardContext = {
52
- readonly catalog: AdapterCatalog;
53
- readonly detectedPackageManager: PackageManager;
54
- readonly answered: Partial<WizardAnswers>;
55
- /** Present for `init` over an existing ORM setup. */
56
- readonly services?: ServiceContext;
57
- };
58
- export type Choice = {
59
- /** What the flag takes and the prompt accepts, e.g. `prisma7`. */
60
- readonly value: string;
61
- /** How it is shown, e.g. `Prisma 7`. */
62
- readonly label: string;
63
- };
64
- /** An answer the question cannot accept. A refusal: one sentence. */
65
- export declare class WizardAnswerError extends Error {
66
- readonly name = "WizardAnswerError";
67
- }
68
- export type WizardQuestion<K extends QuestionId> = {
69
- readonly id: K;
70
- /** How the command line answers it: a `--flag <value>`, or the positional `<name>`. */
71
- readonly flag: string;
72
- /** The prompt's label. */
73
- readonly label: string;
74
- /** How the usage text shows its value; `<value>` when absent. */
75
- readonly placeholder?: string;
76
- /** A question whose choices depend on an earlier answer is not asked before it. */
77
- readonly after?: QuestionId;
78
- /** The answers on offer, or `undefined` for free text. */
79
- readonly choices: (context: WizardContext) => readonly Choice[] | undefined;
80
- /**
81
- * Every value its flag takes before anything is answered — what `--help`
82
- * lists (pilot.3); absent for free text. From the catalog, never a literal.
83
- */
84
- readonly accepts?: (catalog: AdapterCatalog) => readonly string[];
85
- /** The answer `--yes` (or Enter at the prompt) takes; `undefined` when there is none. */
86
- readonly defaultFor: (context: WizardContext) => string | undefined;
87
- /** @throws WizardAnswerError when `raw` is not an answer to this question. */
88
- readonly parse: (raw: string, context: WizardContext) => WizardAnswers[K];
89
- /** How a settled answer is shown back. */
90
- readonly describe: (answer: WizardAnswers[K]) => string;
91
- };
92
- export type AnyWizardQuestion = {
93
- readonly [K in QuestionId]: WizardQuestion<K>;
94
- }[QuestionId];
95
- /**
96
- * What `--orm` takes: each adapter's alias, with what it is — the refusal's words,
97
- * and the usage's.
98
- */
99
- export declare function ormAliasesSentence(catalog: AdapterCatalog): string;
100
- export declare const NAME_QUESTION: WizardQuestion<"name">;
101
- /**
102
- * The prompt keeps the family-then-major order; every answer is an alias.
103
- */
104
- export declare const ORM_QUESTION: WizardQuestion<"orm">;
105
- export declare const DB_QUESTION: WizardQuestion<"db">;
106
- export declare const PACKAGE_MANAGER_QUESTION: WizardQuestion<"packageManager">;
107
- export declare const SERVICE_QUESTION: WizardQuestion<"service">;
108
- /** The module that provides and exports the chosen service (or is @Global). */
109
- export declare const MODULE_QUESTION: WizardQuestion<"module">;
110
- /** `aventara new`'s questions, in the order they are asked. */
111
- export declare const NEW_QUESTIONS: readonly [WizardQuestion<"name">, WizardQuestion<"orm">, WizardQuestion<"db">, WizardQuestion<"packageManager">];
112
- /** `aventara init`'s questions when the project has no ORM, in order. */
113
- export declare const INIT_QUESTIONS: readonly [WizardQuestion<"orm">, WizardQuestion<"db">, WizardQuestion<"packageManager">];
114
- /**
115
- * `aventara init`'s questions over an existing ORM setup: the ORM and database are
116
- * read, not asked.
117
- */
118
- export declare const REUSE_QUESTIONS: readonly [WizardQuestion<"service">, WizardQuestion<"module">, WizardQuestion<"packageManager">];
119
- /** Every flag `aventara init` takes for a question, either way. */
120
- export declare const INIT_FLAG_QUESTIONS: readonly [WizardQuestion<"orm">, WizardQuestion<"db">, WizardQuestion<"service">, WizardQuestion<"module">, WizardQuestion<"packageManager">];