@ogygie/generate 0.0.0-stage → 0.19.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.
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/behavior-binding.d.ts +47 -0
- package/dist/behavior-grammar.d.ts +53 -0
- package/dist/check-spec.d.ts +53 -0
- package/dist/chunk-WVFHAPGC.js +10992 -0
- package/dist/cli/check-command.d.ts +3 -0
- package/dist/cli/fill-command.d.ts +39 -0
- package/dist/cli/generate-command.d.ts +8 -0
- package/dist/cli/generate-screen-command.d.ts +6 -0
- package/dist/cli/output.d.ts +9 -0
- package/dist/cli/preview-command.d.ts +19 -0
- package/dist/cli/project.d.ts +97 -0
- package/dist/cli/run.d.ts +13 -0
- package/dist/cli/run.js +1127 -0
- package/dist/cli/schemas-command.d.ts +31 -0
- package/dist/cli/verify-command.d.ts +3 -0
- package/dist/consumed-feature.d.ts +32 -0
- package/dist/emit/db.d.ts +27 -0
- package/dist/emit/factories.d.ts +14 -0
- package/dist/emit/hole-doc.d.ts +18 -0
- package/dist/emit/hole-tests.d.ts +28 -0
- package/dist/emit/manifest-entry.d.ts +44 -0
- package/dist/emit/mssql/migration.d.ts +2 -0
- package/dist/emit/mssql/repository.d.ts +17 -0
- package/dist/emit/mssql/sql-types.d.ts +23 -0
- package/dist/emit/mssql/statements.d.ts +55 -0
- package/dist/emit/mssql/stub.d.ts +17 -0
- package/dist/emit/names.d.ts +34 -0
- package/dist/emit/plan.d.ts +428 -0
- package/dist/emit/repository.d.ts +16 -0
- package/dist/emit/routes.d.ts +22 -0
- package/dist/emit/runtime.d.ts +47 -0
- package/dist/emit/screen/container.d.ts +17 -0
- package/dist/emit/screen/fixtures.d.ts +14 -0
- package/dist/emit/screen/hole-doc.d.ts +2 -0
- package/dist/emit/screen/previews.d.ts +24 -0
- package/dist/emit/screen/queries.d.ts +10 -0
- package/dist/emit/screen/shared.d.ts +35 -0
- package/dist/emit/screen/spec-contracts.d.ts +10 -0
- package/dist/emit/screen/tests-static.d.ts +21 -0
- package/dist/emit/screen/tests.d.ts +19 -0
- package/dist/emit/screen/views.d.ts +10 -0
- package/dist/emit/screen/writes.d.ts +9 -0
- package/dist/emit/screen-plan.d.ts +187 -0
- package/dist/emit/service.d.ts +18 -0
- package/dist/emit/spec-contracts.d.ts +27 -0
- package/dist/emit/tests.d.ts +3 -0
- package/dist/fill/body.d.ts +26 -0
- package/dist/fill/fill.d.ts +97 -0
- package/dist/fill/model-draw.d.ts +25 -0
- package/dist/generate-feature.d.ts +23 -0
- package/dist/generate-screen.d.ts +19 -0
- package/dist/generation-block.schema.d.ts +1279 -0
- package/dist/hole-shape.d.ts +100 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +401 -0
- package/dist/manifest-generation.schema.d.ts +239 -0
- package/dist/motif-catalog.d.ts +175 -0
- package/dist/package-root.d.ts +5 -0
- package/dist/prompt-card.d.ts +3 -0
- package/dist/schema-checks.d.ts +32 -0
- package/dist/schemas/draft.d.ts +111 -0
- package/dist/screen-block.schema.d.ts +146 -0
- package/dist/screen-checks.d.ts +34 -0
- package/dist/screen-grammar.d.ts +36 -0
- package/dist/screen-vocabulary.d.ts +47 -0
- package/dist/spec-sections.d.ts +51 -0
- package/dist/verify-generation.d.ts +93 -0
- package/dist/vocabulary.d.ts +39 -0
- package/dist/zod-introspection.d.ts +119 -0
- package/holes-library/27560e1760bb184c.json +28 -0
- package/holes-library/2c26136fc6bff99a.json +30 -0
- package/holes-library/43a27770407bb38a.json +27 -0
- package/holes-library/46e67880a81012bc.json +27 -0
- package/holes-library/48dc5c44dc2cf3b7.json +32 -0
- package/holes-library/63d0825a61f6f5d3.json +27 -0
- package/holes-library/6784ed6c8e353dac.json +27 -0
- package/holes-library/8b4e4c8f04a5fc6a.json +31 -0
- package/holes-library/README.md +33 -0
- package/holes-library/d3597f50c265ba0c.json +27 -0
- package/holes-library/e48695e16221ff1a.json +32 -0
- package/package.json +59 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type HoleLibraryEntry } from "../hole-shape.js";
|
|
2
|
+
import { type FillOptions } from "../fill/fill.js";
|
|
3
|
+
import { type FillModels } from "../fill/model-draw.js";
|
|
4
|
+
import type { CommandOutput } from "./output.js";
|
|
5
|
+
import { type GenerateProject } from "./project.js";
|
|
6
|
+
export interface FillCommandFlags {
|
|
7
|
+
options: FillOptions;
|
|
8
|
+
models: FillModels;
|
|
9
|
+
}
|
|
10
|
+
/** `--candidates <n> --rounds <n> --draw <model> --escalate <model> --library-only`. */
|
|
11
|
+
export declare function parseFillFlags(argv: readonly string[]): FillCommandFlags;
|
|
12
|
+
/** The variables a subprocess that runs a candidate body may see: the path to its tools, its home, nothing that is a secret. */
|
|
13
|
+
export declare function scrubbedEnvironment(env: Readonly<Record<string, string | undefined>>): Record<string, string>;
|
|
14
|
+
export interface HoleTestRunner {
|
|
15
|
+
(input: {
|
|
16
|
+
projectRoot: string;
|
|
17
|
+
testPath: string;
|
|
18
|
+
holeId: string;
|
|
19
|
+
}): {
|
|
20
|
+
green: boolean;
|
|
21
|
+
lines: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** The real runner: the product's Vitest on the hole's own describe, in a process that holds no secret. */
|
|
25
|
+
export declare const vitestHoleRunner: HoleTestRunner;
|
|
26
|
+
export interface FillCommandDeps {
|
|
27
|
+
runner?: HoleTestRunner;
|
|
28
|
+
/** The model key — absent, the command fills from the library alone and says so. */
|
|
29
|
+
modelApiKey?: string | undefined;
|
|
30
|
+
fetchImpl?: typeof fetch;
|
|
31
|
+
libraryDir?: string;
|
|
32
|
+
/** `$GITHUB_STEP_SUMMARY` when CI offers one: the usage table lands there (B8). */
|
|
33
|
+
summaryPath?: string | undefined;
|
|
34
|
+
repo?: string;
|
|
35
|
+
today?: () => string;
|
|
36
|
+
}
|
|
37
|
+
/** An entry recorded in the library: a new file, or the provenance of an existing one extended. */
|
|
38
|
+
export declare function recordLibraryEntry(libraryDir: string, entry: HoleLibraryEntry): "created" | "extended" | "unchanged";
|
|
39
|
+
export declare function runFillCommand(project: GenerateProject, featureId: string | undefined, argv: readonly string[], out: CommandOutput, deps?: FillCommandDeps): Promise<number>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandOutput } from "./output.js";
|
|
2
|
+
import { type GenerateProject } from "./project.js";
|
|
3
|
+
/**
|
|
4
|
+
* `generate --all`: every generated spec of the map, one after the other; the project is reloaded between two features
|
|
5
|
+
* because each one may rewrite the map. Code 1 when any of them refused, after the others ran.
|
|
6
|
+
*/
|
|
7
|
+
export declare function runGenerateAllCommand(project: GenerateProject, out: CommandOutput): Promise<number>;
|
|
8
|
+
export declare function runGenerateFeatureCommand(project: GenerateProject, featureId: string | undefined, out: CommandOutput): Promise<number>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ConsumedFeatureInput } from "../emit/screen-plan.js";
|
|
2
|
+
import type { CommandOutput } from "./output.js";
|
|
3
|
+
import { type GenerateProject, type LoadedConsumedFeature } from "./project.js";
|
|
4
|
+
/** The consumed features a plan can be built on: every one with its schemas — with or without a block (D41 precision) — `check` refused the rest. */
|
|
5
|
+
export declare function consumedInputsOf(loaded: ReadonlyMap<string, LoadedConsumedFeature>): ConsumedFeatureInput[];
|
|
6
|
+
export declare function runGenerateScreenCommand(project: GenerateProject, featureId: string, out: CommandOutput): Promise<number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @intent Where a command of the generator writes: two sinks the caller
|
|
3
|
+
* provides — the CLI relay gives the console, a test gives arrays — so the
|
|
4
|
+
* commands never touch `process` themselves and return their exit code.
|
|
5
|
+
*/
|
|
6
|
+
export interface CommandOutput {
|
|
7
|
+
log: (line: string) => void;
|
|
8
|
+
error: (line: string) => void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CommandOutput } from "./output.js";
|
|
2
|
+
import { type GenerateProject } from "./project.js";
|
|
3
|
+
export declare const PREVIEWS_ROOT = "previews";
|
|
4
|
+
/** Where a screen's pages go: its folder, then the composition's when the spec declares one (D53). */
|
|
5
|
+
export declare function previewsDirOf(featureId: string, composition: string | null): string;
|
|
6
|
+
export interface PreviewRunner {
|
|
7
|
+
/** Runs the emitted previews test with the output directory in its environment; returns the runner's exit code and its lines. */
|
|
8
|
+
(input: {
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
testPath: string;
|
|
11
|
+
outDir: string;
|
|
12
|
+
}): {
|
|
13
|
+
code: number;
|
|
14
|
+
lines: string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** The real runner: the product's Vitest, from the project root, as `pnpm test -- <path>` would. */
|
|
18
|
+
export declare const vitestPreviewRunner: PreviewRunner;
|
|
19
|
+
export declare function runPreviewCommand(project: GenerateProject, featureId: string | undefined, out: CommandOutput, runner?: PreviewRunner): Promise<number>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { OgygieManifestSchema } from "@ogygie/core/manifest";
|
|
2
|
+
import { type OgygieError } from "@ogygie/core/errors";
|
|
3
|
+
import { type FrontTarget, type ManifestGeneration } from "../manifest-generation.schema.js";
|
|
4
|
+
import type { ConsumedRoute } from "../emit/screen-plan.js";
|
|
5
|
+
import type { GenerationBlock } from "../generation-block.schema.js";
|
|
6
|
+
import type { ScreenBlock } from "../screen-block.schema.js";
|
|
7
|
+
import type { SpecOwnerFolder } from "../verify-generation.js";
|
|
8
|
+
import { type SchemaModels } from "../zod-introspection.js";
|
|
9
|
+
export declare const MANIFEST_FILE = "ogygie.manifest.json";
|
|
10
|
+
export declare const GENERATE_PROJECT_INVALID = "OGYGIE_GENERATE_PROJECT_INVALID";
|
|
11
|
+
type Manifest = ReturnType<typeof OgygieManifestSchema.parse>;
|
|
12
|
+
type Feature = Manifest["features"][number];
|
|
13
|
+
export interface GenerateProject {
|
|
14
|
+
root: string;
|
|
15
|
+
/** The manifest as parsed, every key kept — what `generate` writes back. */
|
|
16
|
+
rawManifest: unknown;
|
|
17
|
+
manifest: Manifest;
|
|
18
|
+
/** The `generation` block, null when the product declares none. */
|
|
19
|
+
generation: ManifestGeneration | null;
|
|
20
|
+
apiApp: Manifest["apps"][number] | undefined;
|
|
21
|
+
/** Folder of the specs, as the manifest declares it. */
|
|
22
|
+
specsFolder: string;
|
|
23
|
+
/** Where generated files may live: every app and package the map declares, once each. */
|
|
24
|
+
scanDirs: string[];
|
|
25
|
+
/** Spec → owning feature folder and the generated fields of its entry. */
|
|
26
|
+
owners: SpecOwnerFolder[];
|
|
27
|
+
}
|
|
28
|
+
export type ProjectOutcome = {
|
|
29
|
+
ok: true;
|
|
30
|
+
project: GenerateProject;
|
|
31
|
+
} | {
|
|
32
|
+
ok: false;
|
|
33
|
+
problems: OgygieError[];
|
|
34
|
+
};
|
|
35
|
+
/** Reads the project once; a manifest the core refuses, or a generation block the package refuses, is a refusal here too. */
|
|
36
|
+
export declare function loadGenerateProject(root: string): ProjectOutcome;
|
|
37
|
+
/** A feature the generator can work on: on the map, with a spec, under the api app, with a tenant column to scope its table. */
|
|
38
|
+
export interface FeatureTarget {
|
|
39
|
+
feature: Feature;
|
|
40
|
+
featureId: string;
|
|
41
|
+
/** Repo-relative folder of the feature. */
|
|
42
|
+
folder: string;
|
|
43
|
+
specPath: string;
|
|
44
|
+
appPath: string;
|
|
45
|
+
tenantColumn: string | undefined;
|
|
46
|
+
generation: ManifestGeneration;
|
|
47
|
+
}
|
|
48
|
+
export declare function featureTargetOf(project: GenerateProject, featureId: string): {
|
|
49
|
+
ok: true;
|
|
50
|
+
target: FeatureTarget;
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
problem: OgygieError;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Imports a module of the PRODUCT — TypeScript on disk (D19, D55): the native
|
|
57
|
+
* import when the host runs the TypeScript (tsx, vitest, a node that strips
|
|
58
|
+
* types and finds the files), else `tsImport` of tsx's API, which the package
|
|
59
|
+
* carries so `node dist/cli.js` never depends on the host's loader. The
|
|
60
|
+
* `.js` specifiers of a product's TypeScript are what plain node trips on.
|
|
61
|
+
*/
|
|
62
|
+
export declare function importProductModule(url: string): Promise<Record<string, unknown>>;
|
|
63
|
+
/** Imports a schemas module as the app would and models its *Schema exports; null when absent. */
|
|
64
|
+
export declare function schemaModelsLoader(root: string): (modulePath: string) => Promise<SchemaModels | null>;
|
|
65
|
+
/** Stable output for a problem — one JSON document per line block, the shape every Ogygie gate prints. */
|
|
66
|
+
export declare function formatProblem(problem: OgygieError): string;
|
|
67
|
+
/** D40, D41: a SCREEN the generator can work on — a feature carried by a front app, with a spec, under a front target. */
|
|
68
|
+
export interface ScreenTarget {
|
|
69
|
+
feature: Feature;
|
|
70
|
+
featureId: string;
|
|
71
|
+
/** Repo-relative folder of the screen feature. */
|
|
72
|
+
folder: string;
|
|
73
|
+
specPath: string;
|
|
74
|
+
/** Path of the front app carrying the feature, relative to the repo root. */
|
|
75
|
+
appPath: string;
|
|
76
|
+
front: FrontTarget;
|
|
77
|
+
generation: ManifestGeneration;
|
|
78
|
+
}
|
|
79
|
+
/** Which kind of target a feature of the map is: a feature under the api app, or a screen under a front app. */
|
|
80
|
+
export declare function targetKindOf(project: GenerateProject, featureId: string): "feature" | "screen" | null;
|
|
81
|
+
export declare function screenTargetOf(project: GenerateProject, featureId: string): {
|
|
82
|
+
ok: true;
|
|
83
|
+
target: ScreenTarget;
|
|
84
|
+
} | {
|
|
85
|
+
ok: false;
|
|
86
|
+
problem: OgygieError;
|
|
87
|
+
};
|
|
88
|
+
/** A consumed feature as a screen needs it: its block (null when its spec has none), its schemas (null when absent), its routes on the map. */
|
|
89
|
+
export interface LoadedConsumedFeature {
|
|
90
|
+
featureId: string;
|
|
91
|
+
block: GenerationBlock | null;
|
|
92
|
+
schemas: SchemaModels | null;
|
|
93
|
+
routes: ConsumedRoute[];
|
|
94
|
+
}
|
|
95
|
+
/** Resolves every feature a screen block consumes: spec read and checked, schemas introspected, routes read from the map. A feature the map does not know is absent from the result — the checks name it. */
|
|
96
|
+
export declare function loadConsumedFeatures(project: GenerateProject, block: ScreenBlock): Promise<Map<string, LoadedConsumedFeature>>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const GENERATE_COMMANDS: readonly ["check", "generate", "verify", "preview", "fill", "schemas"];
|
|
2
|
+
export type GenerateCommandName = (typeof GENERATE_COMMANDS)[number];
|
|
3
|
+
export declare const GENERATE_USAGE = "OGYGIE_GENERATE_USAGE";
|
|
4
|
+
export interface RunGenerateCommandInput {
|
|
5
|
+
/** Root of the project — where ogygie.manifest.json lives. */
|
|
6
|
+
projectRoot: string;
|
|
7
|
+
/** Everything after `ogygie generate`: the subcommand, then its arguments. */
|
|
8
|
+
argv: readonly string[];
|
|
9
|
+
log: (line: string) => void;
|
|
10
|
+
error: (line: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Runs one command of the generator and returns its exit code — 0 when the judgment is clean. */
|
|
13
|
+
export declare function runGenerateCommand(input: RunGenerateCommandInput): Promise<number>;
|