@oprt/cli 0.0.0-stage → 0.3.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 +116 -2
- package/dist/bin.js +2730 -0
- package/dist/contract.json +1 -0
- package/dist/index.cjs +2530 -0
- package/dist/index.d.cts +380 -0
- package/dist/index.d.ts +380 -0
- package/dist/index.js +2473 -0
- package/dist/read-C7rE5UlY.d.cts +273 -0
- package/dist/read-C7rE5UlY.d.ts +273 -0
- package/dist/read.cjs +284 -0
- package/dist/read.d.cts +1 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +251 -0
- package/dist/registry.json +1 -0
- package/package.json +65 -3
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
interface ContractProp {
|
|
2
|
+
type: string;
|
|
3
|
+
values?: string[];
|
|
4
|
+
types?: string[];
|
|
5
|
+
default?: string | number | boolean;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
interface ContractComponent {
|
|
10
|
+
description: string;
|
|
11
|
+
props: Record<string, ContractProp>;
|
|
12
|
+
slots?: Record<string, {
|
|
13
|
+
type: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
composable_with?: string[];
|
|
17
|
+
never_inside?: string[];
|
|
18
|
+
example: string;
|
|
19
|
+
}
|
|
20
|
+
interface CompositionRule {
|
|
21
|
+
allowed_children: string[];
|
|
22
|
+
children?: Record<string, CompositionRule>;
|
|
23
|
+
}
|
|
24
|
+
interface ContractRecipe {
|
|
25
|
+
description: string;
|
|
26
|
+
composed_of: string[];
|
|
27
|
+
layout: string;
|
|
28
|
+
install: string;
|
|
29
|
+
dependencies?: string[];
|
|
30
|
+
files?: Record<string, number>;
|
|
31
|
+
}
|
|
32
|
+
interface GuidanceRule {
|
|
33
|
+
id: string;
|
|
34
|
+
rule: string;
|
|
35
|
+
wrong?: string;
|
|
36
|
+
right?: string;
|
|
37
|
+
}
|
|
38
|
+
interface ComponentGuidance {
|
|
39
|
+
use_for?: string[];
|
|
40
|
+
part_of?: string;
|
|
41
|
+
not_for?: {
|
|
42
|
+
need: string;
|
|
43
|
+
use: string;
|
|
44
|
+
}[];
|
|
45
|
+
values?: Record<string, Record<string, string>>;
|
|
46
|
+
}
|
|
47
|
+
/** What a project needs besides the source it copies or the package it imports. */
|
|
48
|
+
interface ContractSetup {
|
|
49
|
+
tailwind: string;
|
|
50
|
+
packages: {
|
|
51
|
+
name: string;
|
|
52
|
+
dev: boolean;
|
|
53
|
+
why: string;
|
|
54
|
+
range?: string;
|
|
55
|
+
}[];
|
|
56
|
+
stylesheet: {
|
|
57
|
+
line: string;
|
|
58
|
+
why: string;
|
|
59
|
+
}[];
|
|
60
|
+
package_source: {
|
|
61
|
+
when: string;
|
|
62
|
+
line: string;
|
|
63
|
+
why: string;
|
|
64
|
+
};
|
|
65
|
+
root_import: string;
|
|
66
|
+
root_import_note: string;
|
|
67
|
+
not_needed: {
|
|
68
|
+
name: string;
|
|
69
|
+
why: string;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
interface Contract {
|
|
73
|
+
version: string;
|
|
74
|
+
components: Record<string, ContractComponent>;
|
|
75
|
+
composition_rules?: Record<string, CompositionRule>;
|
|
76
|
+
patterns?: Record<string, ContractRecipe>;
|
|
77
|
+
guidance: {
|
|
78
|
+
setup: ContractSetup;
|
|
79
|
+
rules: GuidanceRule[];
|
|
80
|
+
components: Record<string, ComponentGuidance>;
|
|
81
|
+
};
|
|
82
|
+
/** Every value @oprt/react exports: components, hooks, helpers and manifests. */
|
|
83
|
+
exports: string[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface RegistryEntry {
|
|
87
|
+
name: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
kind: "component" | "recipe";
|
|
90
|
+
description: string;
|
|
91
|
+
/** Source paths relative to the selected output directory. */
|
|
92
|
+
files: string[];
|
|
93
|
+
/** External packages used by this entry's complete source closure, runtime and type-only alike. */
|
|
94
|
+
dependencies: string[];
|
|
95
|
+
/**
|
|
96
|
+
* The subset of `dependencies` that the closure imports only for types. They are needed to
|
|
97
|
+
* type-check the copied source, not to run it. Absent in registries from older builds.
|
|
98
|
+
*/
|
|
99
|
+
devDependencies?: string[];
|
|
100
|
+
}
|
|
101
|
+
interface Registry {
|
|
102
|
+
version: string;
|
|
103
|
+
entries: RegistryEntry[];
|
|
104
|
+
files: Record<string, string>;
|
|
105
|
+
/** The version range each external package was verified against. Absent in older registries. */
|
|
106
|
+
ranges?: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
interface AddOptions {
|
|
109
|
+
names: string[];
|
|
110
|
+
out?: string;
|
|
111
|
+
dryRun?: boolean;
|
|
112
|
+
overwrite?: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface InstallFile {
|
|
115
|
+
path: string;
|
|
116
|
+
destination: string;
|
|
117
|
+
action: "create" | "overwrite" | "skip";
|
|
118
|
+
}
|
|
119
|
+
interface InstallResult {
|
|
120
|
+
outputDirectory: string;
|
|
121
|
+
entries: string[];
|
|
122
|
+
/** Every external package the selected sources import, runtime and type-only alike. */
|
|
123
|
+
dependencies: string[];
|
|
124
|
+
/** The subset of `dependencies` that no selected source imports a value from. */
|
|
125
|
+
devDependencies: string[];
|
|
126
|
+
/** The version range of each package in `dependencies`, where the registry records one. */
|
|
127
|
+
ranges: Record<string, string>;
|
|
128
|
+
files: InstallFile[];
|
|
129
|
+
dryRun: boolean;
|
|
130
|
+
}
|
|
131
|
+
type Command = {
|
|
132
|
+
command: "help";
|
|
133
|
+
} | {
|
|
134
|
+
command: "version";
|
|
135
|
+
} | {
|
|
136
|
+
command: "list";
|
|
137
|
+
json: boolean;
|
|
138
|
+
} | ({
|
|
139
|
+
command: "add";
|
|
140
|
+
json: boolean;
|
|
141
|
+
} & Required<AddOptions>) | {
|
|
142
|
+
command: "component";
|
|
143
|
+
names: string[];
|
|
144
|
+
list: boolean;
|
|
145
|
+
dense: boolean;
|
|
146
|
+
json: boolean;
|
|
147
|
+
} | {
|
|
148
|
+
command: "search";
|
|
149
|
+
query: string;
|
|
150
|
+
limit: number;
|
|
151
|
+
json: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
command: "init";
|
|
154
|
+
agent?: string;
|
|
155
|
+
path?: string;
|
|
156
|
+
remove: boolean;
|
|
157
|
+
dryRun: boolean;
|
|
158
|
+
json: boolean;
|
|
159
|
+
} | {
|
|
160
|
+
command: "doctor";
|
|
161
|
+
json: boolean;
|
|
162
|
+
} | {
|
|
163
|
+
command: "check";
|
|
164
|
+
paths: string[];
|
|
165
|
+
strict: boolean;
|
|
166
|
+
json: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
command: "mcp";
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* A failure the program reports and exits on. `code` is stable and only ever added to: a caller
|
|
172
|
+
* that reads `--json` output branches on it, never on the wording of the message. `suggestions`
|
|
173
|
+
* are the nearest valid choices, when there are any.
|
|
174
|
+
*/
|
|
175
|
+
declare class CliError extends Error {
|
|
176
|
+
readonly exitCode: number;
|
|
177
|
+
readonly code: string;
|
|
178
|
+
readonly suggestions?: string[];
|
|
179
|
+
constructor(message: string, exitCode?: number, details?: {
|
|
180
|
+
code?: string;
|
|
181
|
+
suggestions?: string[];
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface IndexEntry {
|
|
186
|
+
name: string;
|
|
187
|
+
/** What it is for, in the words a person would ask with. */
|
|
188
|
+
purpose: string;
|
|
189
|
+
/** The parts that only live inside it. */
|
|
190
|
+
parts: string[];
|
|
191
|
+
}
|
|
192
|
+
interface DetailProp {
|
|
193
|
+
name: string;
|
|
194
|
+
type: string;
|
|
195
|
+
values?: string[];
|
|
196
|
+
types?: string[];
|
|
197
|
+
default?: string | number | boolean;
|
|
198
|
+
required?: boolean;
|
|
199
|
+
description?: string;
|
|
200
|
+
/** For an option prop: what each value is for. */
|
|
201
|
+
notes?: Record<string, string>;
|
|
202
|
+
}
|
|
203
|
+
interface ComponentDetail {
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
use_for: string[];
|
|
207
|
+
not_for: {
|
|
208
|
+
need: string;
|
|
209
|
+
use: string;
|
|
210
|
+
}[];
|
|
211
|
+
part_of?: string;
|
|
212
|
+
parts: string[];
|
|
213
|
+
props: DetailProp[];
|
|
214
|
+
slots?: Record<string, {
|
|
215
|
+
type: string;
|
|
216
|
+
required?: boolean;
|
|
217
|
+
}>;
|
|
218
|
+
composable_with: string[];
|
|
219
|
+
never_inside: string[];
|
|
220
|
+
/** What may go directly inside it, where the contract restricts that. */
|
|
221
|
+
allowed_children?: string[];
|
|
222
|
+
example: string;
|
|
223
|
+
}
|
|
224
|
+
interface SearchResult {
|
|
225
|
+
kind: "component" | "recipe";
|
|
226
|
+
name: string;
|
|
227
|
+
purpose: string;
|
|
228
|
+
score: number;
|
|
229
|
+
/** Why it matched, when that is not plain from the purpose. */
|
|
230
|
+
why?: string;
|
|
231
|
+
/** The command that reads on from here. */
|
|
232
|
+
next: string;
|
|
233
|
+
}
|
|
234
|
+
/** Every component a person would choose, by name, each with its parts. */
|
|
235
|
+
declare function componentIndex(contract: Contract): IndexEntry[];
|
|
236
|
+
/** One component: its contract, with the notes on when to choose it and each of its options. */
|
|
237
|
+
declare function componentDetail(contract: Contract, wanted: string): ComponentDetail;
|
|
238
|
+
/**
|
|
239
|
+
* A component as text. Dense is the short form for an agent: what it is for, what to use instead,
|
|
240
|
+
* every option with what each value is for, the nesting rules and the example. The full form adds
|
|
241
|
+
* the description and each prop's whole description.
|
|
242
|
+
*/
|
|
243
|
+
declare function renderComponent(detail: ComponentDetail, { dense }: {
|
|
244
|
+
dense: boolean;
|
|
245
|
+
}): string;
|
|
246
|
+
/**
|
|
247
|
+
* Components and recipes that answer a need, best first. A need that one component's guidance
|
|
248
|
+
* sends elsewhere ("go to another page" is not for Button: use Link) counts for the component it
|
|
249
|
+
* is sent to.
|
|
250
|
+
*/
|
|
251
|
+
declare function search(contract: Contract, registry: Registry, query: string, limit?: number): SearchResult[];
|
|
252
|
+
|
|
253
|
+
declare const START = "<!-- OPERATOR:START -->";
|
|
254
|
+
declare const END = "<!-- OPERATOR:END -->";
|
|
255
|
+
/** The block for this contract, markers included, ending in a newline. */
|
|
256
|
+
declare function renderAgentBlock(contract: Contract): string;
|
|
257
|
+
/** The version of the installer that wrote the block in a text, if it holds one. */
|
|
258
|
+
declare function blockVersion(text: string): string | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Put the block into a file's text. A file without one gains it at the end; a file with one has
|
|
261
|
+
* only that part replaced, so whatever else the file says is kept.
|
|
262
|
+
*/
|
|
263
|
+
declare function applyBlock(existing: string | null, block: string): {
|
|
264
|
+
text: string;
|
|
265
|
+
action: "create" | "append" | "update" | "unchanged";
|
|
266
|
+
};
|
|
267
|
+
/** Take the block out of a file's text, with the blank line that set it apart. */
|
|
268
|
+
declare function removeBlock(existing: string): {
|
|
269
|
+
text: string;
|
|
270
|
+
found: boolean;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export { type AddOptions as A, type Contract as C, type DetailProp as D, END as E, type InstallResult as I, type Registry as R, type SearchResult as S, type ComponentDetail as a, type Command as b, type RegistryEntry as c, CliError as d, type IndexEntry as e, type InstallFile as f, applyBlock as g, blockVersion as h, componentDetail as i, componentIndex as j, renderAgentBlock as k, renderComponent as l, START as m, removeBlock as r, search as s };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
interface ContractProp {
|
|
2
|
+
type: string;
|
|
3
|
+
values?: string[];
|
|
4
|
+
types?: string[];
|
|
5
|
+
default?: string | number | boolean;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
interface ContractComponent {
|
|
10
|
+
description: string;
|
|
11
|
+
props: Record<string, ContractProp>;
|
|
12
|
+
slots?: Record<string, {
|
|
13
|
+
type: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
composable_with?: string[];
|
|
17
|
+
never_inside?: string[];
|
|
18
|
+
example: string;
|
|
19
|
+
}
|
|
20
|
+
interface CompositionRule {
|
|
21
|
+
allowed_children: string[];
|
|
22
|
+
children?: Record<string, CompositionRule>;
|
|
23
|
+
}
|
|
24
|
+
interface ContractRecipe {
|
|
25
|
+
description: string;
|
|
26
|
+
composed_of: string[];
|
|
27
|
+
layout: string;
|
|
28
|
+
install: string;
|
|
29
|
+
dependencies?: string[];
|
|
30
|
+
files?: Record<string, number>;
|
|
31
|
+
}
|
|
32
|
+
interface GuidanceRule {
|
|
33
|
+
id: string;
|
|
34
|
+
rule: string;
|
|
35
|
+
wrong?: string;
|
|
36
|
+
right?: string;
|
|
37
|
+
}
|
|
38
|
+
interface ComponentGuidance {
|
|
39
|
+
use_for?: string[];
|
|
40
|
+
part_of?: string;
|
|
41
|
+
not_for?: {
|
|
42
|
+
need: string;
|
|
43
|
+
use: string;
|
|
44
|
+
}[];
|
|
45
|
+
values?: Record<string, Record<string, string>>;
|
|
46
|
+
}
|
|
47
|
+
/** What a project needs besides the source it copies or the package it imports. */
|
|
48
|
+
interface ContractSetup {
|
|
49
|
+
tailwind: string;
|
|
50
|
+
packages: {
|
|
51
|
+
name: string;
|
|
52
|
+
dev: boolean;
|
|
53
|
+
why: string;
|
|
54
|
+
range?: string;
|
|
55
|
+
}[];
|
|
56
|
+
stylesheet: {
|
|
57
|
+
line: string;
|
|
58
|
+
why: string;
|
|
59
|
+
}[];
|
|
60
|
+
package_source: {
|
|
61
|
+
when: string;
|
|
62
|
+
line: string;
|
|
63
|
+
why: string;
|
|
64
|
+
};
|
|
65
|
+
root_import: string;
|
|
66
|
+
root_import_note: string;
|
|
67
|
+
not_needed: {
|
|
68
|
+
name: string;
|
|
69
|
+
why: string;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
interface Contract {
|
|
73
|
+
version: string;
|
|
74
|
+
components: Record<string, ContractComponent>;
|
|
75
|
+
composition_rules?: Record<string, CompositionRule>;
|
|
76
|
+
patterns?: Record<string, ContractRecipe>;
|
|
77
|
+
guidance: {
|
|
78
|
+
setup: ContractSetup;
|
|
79
|
+
rules: GuidanceRule[];
|
|
80
|
+
components: Record<string, ComponentGuidance>;
|
|
81
|
+
};
|
|
82
|
+
/** Every value @oprt/react exports: components, hooks, helpers and manifests. */
|
|
83
|
+
exports: string[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface RegistryEntry {
|
|
87
|
+
name: string;
|
|
88
|
+
slug: string;
|
|
89
|
+
kind: "component" | "recipe";
|
|
90
|
+
description: string;
|
|
91
|
+
/** Source paths relative to the selected output directory. */
|
|
92
|
+
files: string[];
|
|
93
|
+
/** External packages used by this entry's complete source closure, runtime and type-only alike. */
|
|
94
|
+
dependencies: string[];
|
|
95
|
+
/**
|
|
96
|
+
* The subset of `dependencies` that the closure imports only for types. They are needed to
|
|
97
|
+
* type-check the copied source, not to run it. Absent in registries from older builds.
|
|
98
|
+
*/
|
|
99
|
+
devDependencies?: string[];
|
|
100
|
+
}
|
|
101
|
+
interface Registry {
|
|
102
|
+
version: string;
|
|
103
|
+
entries: RegistryEntry[];
|
|
104
|
+
files: Record<string, string>;
|
|
105
|
+
/** The version range each external package was verified against. Absent in older registries. */
|
|
106
|
+
ranges?: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
interface AddOptions {
|
|
109
|
+
names: string[];
|
|
110
|
+
out?: string;
|
|
111
|
+
dryRun?: boolean;
|
|
112
|
+
overwrite?: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface InstallFile {
|
|
115
|
+
path: string;
|
|
116
|
+
destination: string;
|
|
117
|
+
action: "create" | "overwrite" | "skip";
|
|
118
|
+
}
|
|
119
|
+
interface InstallResult {
|
|
120
|
+
outputDirectory: string;
|
|
121
|
+
entries: string[];
|
|
122
|
+
/** Every external package the selected sources import, runtime and type-only alike. */
|
|
123
|
+
dependencies: string[];
|
|
124
|
+
/** The subset of `dependencies` that no selected source imports a value from. */
|
|
125
|
+
devDependencies: string[];
|
|
126
|
+
/** The version range of each package in `dependencies`, where the registry records one. */
|
|
127
|
+
ranges: Record<string, string>;
|
|
128
|
+
files: InstallFile[];
|
|
129
|
+
dryRun: boolean;
|
|
130
|
+
}
|
|
131
|
+
type Command = {
|
|
132
|
+
command: "help";
|
|
133
|
+
} | {
|
|
134
|
+
command: "version";
|
|
135
|
+
} | {
|
|
136
|
+
command: "list";
|
|
137
|
+
json: boolean;
|
|
138
|
+
} | ({
|
|
139
|
+
command: "add";
|
|
140
|
+
json: boolean;
|
|
141
|
+
} & Required<AddOptions>) | {
|
|
142
|
+
command: "component";
|
|
143
|
+
names: string[];
|
|
144
|
+
list: boolean;
|
|
145
|
+
dense: boolean;
|
|
146
|
+
json: boolean;
|
|
147
|
+
} | {
|
|
148
|
+
command: "search";
|
|
149
|
+
query: string;
|
|
150
|
+
limit: number;
|
|
151
|
+
json: boolean;
|
|
152
|
+
} | {
|
|
153
|
+
command: "init";
|
|
154
|
+
agent?: string;
|
|
155
|
+
path?: string;
|
|
156
|
+
remove: boolean;
|
|
157
|
+
dryRun: boolean;
|
|
158
|
+
json: boolean;
|
|
159
|
+
} | {
|
|
160
|
+
command: "doctor";
|
|
161
|
+
json: boolean;
|
|
162
|
+
} | {
|
|
163
|
+
command: "check";
|
|
164
|
+
paths: string[];
|
|
165
|
+
strict: boolean;
|
|
166
|
+
json: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
command: "mcp";
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* A failure the program reports and exits on. `code` is stable and only ever added to: a caller
|
|
172
|
+
* that reads `--json` output branches on it, never on the wording of the message. `suggestions`
|
|
173
|
+
* are the nearest valid choices, when there are any.
|
|
174
|
+
*/
|
|
175
|
+
declare class CliError extends Error {
|
|
176
|
+
readonly exitCode: number;
|
|
177
|
+
readonly code: string;
|
|
178
|
+
readonly suggestions?: string[];
|
|
179
|
+
constructor(message: string, exitCode?: number, details?: {
|
|
180
|
+
code?: string;
|
|
181
|
+
suggestions?: string[];
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface IndexEntry {
|
|
186
|
+
name: string;
|
|
187
|
+
/** What it is for, in the words a person would ask with. */
|
|
188
|
+
purpose: string;
|
|
189
|
+
/** The parts that only live inside it. */
|
|
190
|
+
parts: string[];
|
|
191
|
+
}
|
|
192
|
+
interface DetailProp {
|
|
193
|
+
name: string;
|
|
194
|
+
type: string;
|
|
195
|
+
values?: string[];
|
|
196
|
+
types?: string[];
|
|
197
|
+
default?: string | number | boolean;
|
|
198
|
+
required?: boolean;
|
|
199
|
+
description?: string;
|
|
200
|
+
/** For an option prop: what each value is for. */
|
|
201
|
+
notes?: Record<string, string>;
|
|
202
|
+
}
|
|
203
|
+
interface ComponentDetail {
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
use_for: string[];
|
|
207
|
+
not_for: {
|
|
208
|
+
need: string;
|
|
209
|
+
use: string;
|
|
210
|
+
}[];
|
|
211
|
+
part_of?: string;
|
|
212
|
+
parts: string[];
|
|
213
|
+
props: DetailProp[];
|
|
214
|
+
slots?: Record<string, {
|
|
215
|
+
type: string;
|
|
216
|
+
required?: boolean;
|
|
217
|
+
}>;
|
|
218
|
+
composable_with: string[];
|
|
219
|
+
never_inside: string[];
|
|
220
|
+
/** What may go directly inside it, where the contract restricts that. */
|
|
221
|
+
allowed_children?: string[];
|
|
222
|
+
example: string;
|
|
223
|
+
}
|
|
224
|
+
interface SearchResult {
|
|
225
|
+
kind: "component" | "recipe";
|
|
226
|
+
name: string;
|
|
227
|
+
purpose: string;
|
|
228
|
+
score: number;
|
|
229
|
+
/** Why it matched, when that is not plain from the purpose. */
|
|
230
|
+
why?: string;
|
|
231
|
+
/** The command that reads on from here. */
|
|
232
|
+
next: string;
|
|
233
|
+
}
|
|
234
|
+
/** Every component a person would choose, by name, each with its parts. */
|
|
235
|
+
declare function componentIndex(contract: Contract): IndexEntry[];
|
|
236
|
+
/** One component: its contract, with the notes on when to choose it and each of its options. */
|
|
237
|
+
declare function componentDetail(contract: Contract, wanted: string): ComponentDetail;
|
|
238
|
+
/**
|
|
239
|
+
* A component as text. Dense is the short form for an agent: what it is for, what to use instead,
|
|
240
|
+
* every option with what each value is for, the nesting rules and the example. The full form adds
|
|
241
|
+
* the description and each prop's whole description.
|
|
242
|
+
*/
|
|
243
|
+
declare function renderComponent(detail: ComponentDetail, { dense }: {
|
|
244
|
+
dense: boolean;
|
|
245
|
+
}): string;
|
|
246
|
+
/**
|
|
247
|
+
* Components and recipes that answer a need, best first. A need that one component's guidance
|
|
248
|
+
* sends elsewhere ("go to another page" is not for Button: use Link) counts for the component it
|
|
249
|
+
* is sent to.
|
|
250
|
+
*/
|
|
251
|
+
declare function search(contract: Contract, registry: Registry, query: string, limit?: number): SearchResult[];
|
|
252
|
+
|
|
253
|
+
declare const START = "<!-- OPERATOR:START -->";
|
|
254
|
+
declare const END = "<!-- OPERATOR:END -->";
|
|
255
|
+
/** The block for this contract, markers included, ending in a newline. */
|
|
256
|
+
declare function renderAgentBlock(contract: Contract): string;
|
|
257
|
+
/** The version of the installer that wrote the block in a text, if it holds one. */
|
|
258
|
+
declare function blockVersion(text: string): string | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Put the block into a file's text. A file without one gains it at the end; a file with one has
|
|
261
|
+
* only that part replaced, so whatever else the file says is kept.
|
|
262
|
+
*/
|
|
263
|
+
declare function applyBlock(existing: string | null, block: string): {
|
|
264
|
+
text: string;
|
|
265
|
+
action: "create" | "append" | "update" | "unchanged";
|
|
266
|
+
};
|
|
267
|
+
/** Take the block out of a file's text, with the blank line that set it apart. */
|
|
268
|
+
declare function removeBlock(existing: string): {
|
|
269
|
+
text: string;
|
|
270
|
+
found: boolean;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export { type AddOptions as A, type Contract as C, type DetailProp as D, END as E, type InstallResult as I, type Registry as R, type SearchResult as S, type ComponentDetail as a, type Command as b, type RegistryEntry as c, CliError as d, type IndexEntry as e, type InstallFile as f, applyBlock as g, blockVersion as h, componentDetail as i, componentIndex as j, renderAgentBlock as k, renderComponent as l, START as m, removeBlock as r, search as s };
|