@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 x10sion LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ogygie/generate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Le générateur d'Ogygie : il lit une spec portant une section `# Génération`
|
|
4
|
+
(D18) et le `schemas.ts` de la feature (D19), produit tout ce qui se déduit
|
|
5
|
+
— routes, pipeline, base, fabriques, tests — de façon déterministe et sans
|
|
6
|
+
modèle (D21, D22), et réserve ce qui se pense sous forme de **trous typés**
|
|
7
|
+
dans `logic.ts`, chacun livré avec sa signature, ses exemples, son test rouge
|
|
8
|
+
et son contexte (D23). Les trous se remplissent par bibliothèque, puis
|
|
9
|
+
tirage-vérification, puis escalade (D24).
|
|
10
|
+
|
|
11
|
+
Sixième paquet du lockstep (D55), publié construit : `ogygie generate
|
|
12
|
+
<check|generate|verify|preview|fill|schemas>` le relaie depuis le projet
|
|
13
|
+
(installé en `devDependencies` à la version du framework), le TypeScript du
|
|
14
|
+
produit est chargé par l'API de `tsx` quand `node` nu ne le sait pas. Les
|
|
15
|
+
fixtures dorées et le banc de test restent dans le dépôt, hors du paquet.
|
|
16
|
+
|
|
17
|
+
## Lot 1 — ce que le paquet sait faire aujourd'hui
|
|
18
|
+
|
|
19
|
+
| Module | Rôle |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `spec-sections.ts` | isole le bloc YAML de `# Génération` et recolle les lignes de `# Comportements` |
|
|
22
|
+
| `generation-block.schema.ts` | schéma Zod des quatre clés (`contracts`, `operations`, `motifs`, `holes`) et leurs références croisées — `OGYGIE_GENERATION_BLOCK_INVALID` |
|
|
23
|
+
| `motif-catalog.ts` | le catalogue fermé des motifs (`appendOnlySupersedes`, `allOrNothingImport`) : méthodes, statuts, vocabulaire |
|
|
24
|
+
| `behavior-grammar.ts` | le parseur de la grammaire D20 (`ÉTANT DONNÉ … ALORS … [et …] [[hole:…]]`) |
|
|
25
|
+
| `vocabulary.ts` | le vocabulaire d'une opération : cas, valeurs nommées, phrases, codes et statuts |
|
|
26
|
+
| `behavior-binding.ts` | lie une ligne à son opération : dérivable, portée par un trou, ou `OGYGIE_BEHAVIOR_UNBOUND` |
|
|
27
|
+
| `manifest-generation.schema.ts` | le bloc `generation.guards` du manifeste (ce qui est produit, pas feature) |
|
|
28
|
+
| `check-spec.ts` | la commande `check` : section → bloc → lignes → liaison, avec son décompte |
|
|
29
|
+
| `verify-generation.ts` | la commande `verify` (D27) telle que le lot 1 peut la tenir : `check` de chaque spec du repo, et toute dérive — ce générateur ne reproduit rien encore, donc tout fichier généré en est une ; périmètre déclaré (D12) ; appelée par `pnpm verify` |
|
|
30
|
+
| `vocabulary-leak.test.ts` | rejoue sur ce paquet le gate de vocabulaire du framework, jusqu'au gate de promotion Phase 3 (D25) |
|
|
31
|
+
|
|
32
|
+
La fixture jumelle `fixtures/publication-de-taux.spec.md` rejoue, dans un
|
|
33
|
+
domaine neutre, la forme exacte de la feature réelle sur laquelle la thèse se
|
|
34
|
+
prouve ; la spec du paquet est elle-même parsée par le paquet dans ses tests.
|
|
35
|
+
|
|
36
|
+
## Hors périmètre du lot 1
|
|
37
|
+
|
|
38
|
+
Génération des fichiers, introspection de `schemas.ts`, bibliothèque et
|
|
39
|
+
tirage-vérification, relais `ogygie generate` dans le CLI : lot 2, après
|
|
40
|
+
validation humaine de la spec, des grammaires et de D25 — faite le 2026-10-17.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @intent Binds a parsed behavior line to the block it belongs to
|
|
3
|
+
* (DECISIONS.md D20) and answers one of three things: the line is DERIVABLE
|
|
4
|
+
* (every word has a factory behind it — its test needs no model), the line is
|
|
5
|
+
* CARRIED BY A HOLE (it names `[hole:<id>]`, a hole the operation lists — its
|
|
6
|
+
* test is generated with a `todo` body), or the line is UNBOUND —
|
|
7
|
+
* `OGYGIE_BEHAVIOR_UNBOUND`, with the offending part in `details` (`operation`,
|
|
8
|
+
* `status`, `code`, `hole`, `case`, `expectation`, `line`) and, for a case or
|
|
9
|
+
* an expectation, the vocabulary of the operation as the suggested fix.
|
|
10
|
+
*
|
|
11
|
+
* Order of the checks is the order of what is cheapest to fix: the grammar,
|
|
12
|
+
* the operation, the status against the kind, the code and its status, the
|
|
13
|
+
* hole marker, then the vocabulary — and the vocabulary is only demanded of
|
|
14
|
+
* HTTP operations: a `command` writes its tests by hand, one per line (D20).
|
|
15
|
+
* The hole marker excuses cases and expectations outside the vocabulary and
|
|
16
|
+
* NOTHING else: a carried line still parses `ÉTANT DONNÉ <op> … ALORS
|
|
17
|
+
* <statut> [<code>]`, names a declared operation and a carried code.
|
|
18
|
+
*/
|
|
19
|
+
import { type OgygieError } from "@ogygie/core/errors";
|
|
20
|
+
import type { BehaviorParseResult } from "./behavior-grammar.js";
|
|
21
|
+
import { type GenerationBlock, type Operation } from "./generation-block.schema.js";
|
|
22
|
+
import { type GuardRegistry } from "./manifest-generation.schema.js";
|
|
23
|
+
export declare const BEHAVIOR_UNBOUND = "OGYGIE_BEHAVIOR_UNBOUND";
|
|
24
|
+
export interface BindingContext {
|
|
25
|
+
block: GenerationBlock;
|
|
26
|
+
guards?: GuardRegistry;
|
|
27
|
+
/** D37: the code the target answers to a violated contract; CONTRACT_VALIDATION_FAILED in a line always means it. */
|
|
28
|
+
contractViolationCode?: string;
|
|
29
|
+
/** Spec path, relative to the repo root — the `file` of a refusal. */
|
|
30
|
+
specPath: string;
|
|
31
|
+
/** 1-based line of the behavior in the spec file. */
|
|
32
|
+
line: number;
|
|
33
|
+
}
|
|
34
|
+
export type BindingOutcome = {
|
|
35
|
+
ok: true;
|
|
36
|
+
status: "derivable";
|
|
37
|
+
operation: Operation;
|
|
38
|
+
} | {
|
|
39
|
+
ok: true;
|
|
40
|
+
status: "hole";
|
|
41
|
+
hole: string;
|
|
42
|
+
operation: Operation;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
error: OgygieError;
|
|
46
|
+
};
|
|
47
|
+
export declare function bindBehavior(parse: BehaviorParseResult, context: BindingContext): BindingOutcome;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @intent The parser of the closed behavior grammar (DECISIONS.md D20):
|
|
3
|
+
*
|
|
4
|
+
* ÉTANT DONNÉ <op> (avec|sans) <cas>[, [avec|sans] <cas>]* ALORS <statut> [<CODE>] [et <attendu>[, <attendu>]*] [[hole:<id>]]
|
|
5
|
+
*
|
|
6
|
+
* Pure text in, structure out — no vocabulary here (that is the binder's
|
|
7
|
+
* job, behavior-binding.ts): this module only says whether a line HAS the
|
|
8
|
+
* shape, and when it has not, WHY, in one sentence an agent can act on. The
|
|
9
|
+
* keywords are French because a spec is for the humans of the project
|
|
10
|
+
* (AGENTS.md principle 8); the identifiers a line cites — operation ids,
|
|
11
|
+
* error codes, output paths — are the code's, hence English.
|
|
12
|
+
*/
|
|
13
|
+
export interface BehaviorCase {
|
|
14
|
+
polarity: "with" | "without";
|
|
15
|
+
phrase: string;
|
|
16
|
+
}
|
|
17
|
+
export interface BehaviorExpectation {
|
|
18
|
+
raw: string;
|
|
19
|
+
/** `details.errors[].line` — null when the expectation is a bare phrase. */
|
|
20
|
+
path: string | null;
|
|
21
|
+
/** Right side of `=`, raw — a literal or a named value of the vocabulary. */
|
|
22
|
+
value: string | null;
|
|
23
|
+
}
|
|
24
|
+
export type BehaviorOutcome = {
|
|
25
|
+
kind: "http";
|
|
26
|
+
status: number;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "command";
|
|
29
|
+
result: "success" | "refusal";
|
|
30
|
+
};
|
|
31
|
+
export interface ParsedBehavior {
|
|
32
|
+
raw: string;
|
|
33
|
+
operation: string;
|
|
34
|
+
cases: BehaviorCase[];
|
|
35
|
+
outcome: BehaviorOutcome;
|
|
36
|
+
code: string | null;
|
|
37
|
+
expectations: BehaviorExpectation[];
|
|
38
|
+
hole: string | null;
|
|
39
|
+
}
|
|
40
|
+
export type BehaviorParseResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
behavior: ParsedBehavior;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
raw: string;
|
|
46
|
+
hole: string | null;
|
|
47
|
+
reason: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const OPENING_KEYWORD = "\u00C9TANT DONN\u00C9";
|
|
50
|
+
/** A JSON-ish literal a `<path> = …` may compare to without any vocabulary. */
|
|
51
|
+
export declare function isLiteralValue(value: string): boolean;
|
|
52
|
+
export declare function parseExpectation(raw: string): BehaviorExpectation;
|
|
53
|
+
export declare function parseBehavior(input: string): BehaviorParseResult;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @intent The `check` command of the generator (spec ogygie-generate B1, B2):
|
|
3
|
+
* section → block → behavior lines → binding, without writing anything. A
|
|
4
|
+
* spec without a `# Génération` section is not generated and passes as such
|
|
5
|
+
* (`generated: false`); a spec with one must carry a valid block and bind
|
|
6
|
+
* every behavior line, or the report names each refusal as an OgygieError.
|
|
7
|
+
* The tally (derivable / hole / unbound) is the measure the thesis rests on
|
|
8
|
+
* (spec ogygie-generate, « Épreuve de vérité »).
|
|
9
|
+
*/
|
|
10
|
+
import type { OgygieError } from "@ogygie/core/errors";
|
|
11
|
+
import { type BindingOutcome } from "./behavior-binding.js";
|
|
12
|
+
import { type GenerationBlock } from "./generation-block.schema.js";
|
|
13
|
+
import { type ScreenBlock } from "./screen-block.schema.js";
|
|
14
|
+
import { type ConsumedFeatureCheckInput } from "./screen-checks.js";
|
|
15
|
+
import { type ScreenBindingOutcome } from "./screen-vocabulary.js";
|
|
16
|
+
import { type GuardRegistry, type ManifestGeneration } from "./manifest-generation.schema.js";
|
|
17
|
+
import type { SchemaModels } from "./zod-introspection.js";
|
|
18
|
+
export interface CheckSpecInput {
|
|
19
|
+
markdown: string;
|
|
20
|
+
/** Spec path relative to the repo root — the `file` of every refusal. */
|
|
21
|
+
specPath: string;
|
|
22
|
+
guards?: GuardRegistry;
|
|
23
|
+
/** The manifest's generation block when known: its guards, and what a motif requires of it (signedWrite → signature). */
|
|
24
|
+
generation?: ManifestGeneration | null;
|
|
25
|
+
/** The introspected schemas module (D19); absent, the module-level checks do not run. */
|
|
26
|
+
schemas?: SchemaModels | null;
|
|
27
|
+
/** For a SCREEN spec (D41): the consumed features as the project resolved them; absent, the consumption checks do not run. */
|
|
28
|
+
consumed?: ReadonlyMap<string, ConsumedFeatureCheckInput> | null;
|
|
29
|
+
}
|
|
30
|
+
export interface CheckedBehavior {
|
|
31
|
+
raw: string;
|
|
32
|
+
line: number;
|
|
33
|
+
outcome: BindingOutcome | ScreenBindingOutcome;
|
|
34
|
+
}
|
|
35
|
+
export interface CheckTally {
|
|
36
|
+
derivable: number;
|
|
37
|
+
hole: number;
|
|
38
|
+
unbound: number;
|
|
39
|
+
}
|
|
40
|
+
export interface CheckSpecReport {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
/** True when the spec carries a `# Génération` section. */
|
|
43
|
+
generated: boolean;
|
|
44
|
+
/** D41: a feature block (`contracts`) or a screen block (`consumes`); null when the section is absent or unreadable. */
|
|
45
|
+
kind: "feature" | "screen" | null;
|
|
46
|
+
block: GenerationBlock | null;
|
|
47
|
+
/** The screen block, when the spec is a screen's. */
|
|
48
|
+
screen: ScreenBlock | null;
|
|
49
|
+
behaviors: CheckedBehavior[];
|
|
50
|
+
problems: OgygieError[];
|
|
51
|
+
tally: CheckTally;
|
|
52
|
+
}
|
|
53
|
+
export declare function checkSpec(input: CheckSpecInput): CheckSpecReport;
|