@ouispec/cli 0.1.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/dist/analyze.d.ts +282 -0
  4. package/dist/analyze.d.ts.map +1 -0
  5. package/dist/analyze.js +1421 -0
  6. package/dist/analyze.js.map +1 -0
  7. package/dist/assemble.d.ts +50 -0
  8. package/dist/assemble.d.ts.map +1 -0
  9. package/dist/assemble.js +555 -0
  10. package/dist/assemble.js.map +1 -0
  11. package/dist/cli.d.ts +12 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +54 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/config.d.ts +54 -0
  16. package/dist/config.d.ts.map +1 -0
  17. package/dist/config.js +126 -0
  18. package/dist/config.js.map +1 -0
  19. package/dist/contract.d.ts +10 -0
  20. package/dist/contract.d.ts.map +1 -0
  21. package/dist/contract.js +15 -0
  22. package/dist/contract.js.map +1 -0
  23. package/dist/generate.d.ts +49 -0
  24. package/dist/generate.d.ts.map +1 -0
  25. package/dist/generate.js +178 -0
  26. package/dist/generate.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +8 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/inputs.d.ts +134 -0
  32. package/dist/inputs.d.ts.map +1 -0
  33. package/dist/inputs.js +705 -0
  34. package/dist/inputs.js.map +1 -0
  35. package/dist/knowledge.d.ts +19 -0
  36. package/dist/knowledge.d.ts.map +1 -0
  37. package/dist/knowledge.js +366 -0
  38. package/dist/knowledge.js.map +1 -0
  39. package/dist/program.d.ts +60 -0
  40. package/dist/program.d.ts.map +1 -0
  41. package/dist/program.js +302 -0
  42. package/dist/program.js.map +1 -0
  43. package/dist/recipes.d.ts +17 -0
  44. package/dist/recipes.d.ts.map +1 -0
  45. package/dist/recipes.js +48 -0
  46. package/dist/recipes.js.map +1 -0
  47. package/dist/tier2.d.ts +74 -0
  48. package/dist/tier2.d.ts.map +1 -0
  49. package/dist/tier2.js +303 -0
  50. package/dist/tier2.js.map +1 -0
  51. package/package.json +62 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The declarations the generator reads besides the page trees: each
3
+ * design-system package's control table, each room package's catalog, the
4
+ * API's operations (from its OpenAPI document), the navigation and the routes.
5
+ */
6
+ import ts from 'typescript';
7
+ import { type ControlDescriptor, type RoomCatalogData } from '@ouispec/bindings';
8
+ import type { Finding } from './analyze.js';
9
+ import { type GeneratorConfig } from './config.js';
10
+ import { type Source } from './program.js';
11
+ /**
12
+ * The components a package says only the person may use (`oui.personOnly`:
13
+ * export name → why), such as the approval card (ADR-0228): the assistant
14
+ * must never be offered a way to operate them, so the generator refuses an
15
+ * `agent` binding on one. Read on first use of each package the app imports;
16
+ * a package that declares none has none.
17
+ */
18
+ export declare function personOnlyLookup(config: GeneratorConfig): (pkg: string) => ReadonlyMap<string, string>;
19
+ /** `package#Export` → how the generator reads that control. */
20
+ export type Controls = ReadonlyMap<string, ControlDescriptor>;
21
+ /**
22
+ * Every listed design-system package's control table. A package the app
23
+ * cannot resolve, one with no table, or one whose table is missing is an
24
+ * error: skipping it would leave its controls unread and the build green.
25
+ */
26
+ export declare function loadControls(config: GeneratorConfig): {
27
+ controls: Controls;
28
+ /** The packages whose tables were read: an error for any other names it, so its uses are not reported again. */
29
+ loaded: ReadonlySet<string>;
30
+ errors: Finding[];
31
+ };
32
+ export interface LoadedCatalog {
33
+ /** The package that declares it, or `app:<module>#<export>` for one the app declares. */
34
+ package: string;
35
+ /** For an app catalog: the module's absolute path and the export, to find where it is registered. */
36
+ appModule?: {
37
+ file: string;
38
+ export: string;
39
+ };
40
+ hosts: readonly string[];
41
+ catalog: RoomCatalogData;
42
+ }
43
+ /** Why an app room catalog cannot be loaded without Vite, and what to do. */
44
+ export declare const VITE_REQUIRED: string;
45
+ /**
46
+ * The room catalogs the app declares itself (`appCatalogs`), loaded through
47
+ * the app's Vite config and reduced to their declarations. A catalog is code
48
+ * (its entries may be made by functions), and its imports resolve only as
49
+ * the app's build resolves them, so the app's own Vite loads it.
50
+ */
51
+ export declare function loadAppCatalogs(config: GeneratorConfig): Promise<LoadedCatalog[]>;
52
+ /** Every room catalog among the app's dependencies (`oui.agentCatalog`, or `closure.agentCatalog`). */
53
+ export declare function loadCatalogs(config: GeneratorConfig): {
54
+ catalogs: LoadedCatalog[];
55
+ errors: Finding[];
56
+ };
57
+ export interface ApiOperation {
58
+ /** The operation's `operationId`, which a `mutate` effect names. */
59
+ name: string;
60
+ method: string;
61
+ url: string;
62
+ summary: string;
63
+ }
64
+ /** The API as the app declares it: its document, whether it could be read, and its operations. */
65
+ export interface ApiOperations {
66
+ /** `apiSpec` as written; `null` for an app with no API. */
67
+ spec: string | null;
68
+ /** Whether the document was read: when not, the error says why, and no operation is checked against it. */
69
+ readable: boolean;
70
+ operations: ReadonlyMap<string, ApiOperation>;
71
+ errors: Finding[];
72
+ }
73
+ /**
74
+ * The API's operations, from its OpenAPI 3 document (`apiSpec`), by
75
+ * `operationId`: method, path and summary line. The document is named by
76
+ * module path, so it is the one the installed API client ships; a path
77
+ * inside the app is also read. `apiSpec: null` is an app with no API.
78
+ */
79
+ export declare function loadApiOperations(config: GeneratorConfig): ApiOperations;
80
+ export interface NavEntry {
81
+ label: string;
82
+ route: string;
83
+ group: string;
84
+ }
85
+ /** The navigation entries: every `{ label, route }` object literal in the nav files. */
86
+ export declare function loadNav(source: Source, files: readonly string[]): NavEntry[];
87
+ /** The frame components the config names, each with the declaration that renders it. */
88
+ export declare function loadShell(source: Source, config: GeneratorConfig): {
89
+ component: string;
90
+ routes: string[];
91
+ declaration: ts.Node | null;
92
+ }[];
93
+ export interface RouteEntry {
94
+ path: string;
95
+ /** The page component's name as the routes name it (a lazy route module's, its file's). */
96
+ component: string;
97
+ /** The declaration of the page component. */
98
+ declaration: ts.Node | null;
99
+ }
100
+ /** A layout route's element: rendered around the pages under it, as the app's frame is. */
101
+ export interface LayoutEntry {
102
+ component: string;
103
+ declaration: ts.Node;
104
+ /** The routes it is rendered on: its pages', and its own when nothing renders in its place there. */
105
+ routes: string[];
106
+ }
107
+ export interface AppRoutes {
108
+ pages: RouteEntry[];
109
+ layouts: LayoutEntry[];
110
+ /** Routes the generator cannot read: each would otherwise be a page the assistant never knows. */
111
+ errors: Finding[];
112
+ }
113
+ /**
114
+ * The app's routes, from the routes file: `<Route>` elements (nested ones
115
+ * joined to their parent, `index` routes at their parent's path) and data
116
+ * routers (`createBrowserRouter([...])` and its kin, `useRoutes`), with
117
+ * `element`, `Component` and `lazy` route modules. Wrappers are resolved to
118
+ * the page, `lazy` and `React.lazy` to the component they load.
119
+ *
120
+ * Not pages: splats, and redirects — a `<Navigate>`, and a component that
121
+ * only ever renders one (a redirect that keeps the id). A redirect is not a
122
+ * page, and naming it as one teaches an address that is not the destination.
123
+ * A route's element that has child routes is a layout: it frames them.
124
+ */
125
+ export declare function loadRoutes(source: Source, config: GeneratorConfig): AppRoutes;
126
+ /** Whether a call is `lazy(...)` or `React.lazy(...)`. */
127
+ export declare function isLazyCall(expr: ts.Expression): expr is ts.CallExpression;
128
+ /**
129
+ * The function that renders a component a JSX tag names: through imports and
130
+ * re-exports, `lazy(() => import('./X'))` and `React.lazy(...)` (a default
131
+ * export, or `.then(m => ({ default: m.X }))`), `forwardRef` and `memo`.
132
+ */
133
+ export declare function componentDeclaration(source: Source, tag: ts.JsxTagNameExpression): ts.Node | null;
134
+ //# sourceMappingURL=inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../src/inputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAUL,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,OAAO,E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