@oprt/cli 0.1.0 → 0.4.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/README.md +49 -23
- package/dist/babel-parser.cjs +14339 -0
- package/dist/bin.js +1950 -743
- package/dist/contract.json +1 -1
- package/dist/index.cjs +1662 -459
- package/dist/index.d.cts +250 -97
- package/dist/index.d.ts +250 -97
- package/dist/index.js +1652 -461
- package/dist/{read-8a9euzJx.d.cts → read-C7rE5UlY.d.cts} +48 -21
- package/dist/{read-8a9euzJx.d.ts → read-C7rE5UlY.d.ts} +48 -21
- package/dist/read.cjs +2 -1
- package/dist/read.d.cts +1 -1
- package/dist/read.d.ts +1 -1
- package/dist/read.js +2 -1
- package/dist/registry.json +1 -1
- package/package.json +4 -1
|
@@ -44,12 +44,38 @@ interface ComponentGuidance {
|
|
|
44
44
|
}[];
|
|
45
45
|
values?: Record<string, Record<string, string>>;
|
|
46
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
|
+
}
|
|
47
72
|
interface Contract {
|
|
48
73
|
version: string;
|
|
49
74
|
components: Record<string, ContractComponent>;
|
|
50
75
|
composition_rules?: Record<string, CompositionRule>;
|
|
51
76
|
patterns?: Record<string, ContractRecipe>;
|
|
52
77
|
guidance: {
|
|
78
|
+
setup: ContractSetup;
|
|
53
79
|
rules: GuidanceRule[];
|
|
54
80
|
components: Record<string, ComponentGuidance>;
|
|
55
81
|
};
|
|
@@ -111,6 +137,7 @@ type Command = {
|
|
|
111
137
|
json: boolean;
|
|
112
138
|
} | ({
|
|
113
139
|
command: "add";
|
|
140
|
+
json: boolean;
|
|
114
141
|
} & Required<AddOptions>) | {
|
|
115
142
|
command: "component";
|
|
116
143
|
names: string[];
|
|
@@ -155,26 +182,6 @@ declare class CliError extends Error {
|
|
|
155
182
|
});
|
|
156
183
|
}
|
|
157
184
|
|
|
158
|
-
declare const START = "<!-- OPERATOR:START -->";
|
|
159
|
-
declare const END = "<!-- OPERATOR:END -->";
|
|
160
|
-
/** The block for this contract, markers included, ending in a newline. */
|
|
161
|
-
declare function renderAgentBlock(contract: Contract): string;
|
|
162
|
-
/** The version of the installer that wrote the block in a text, if it holds one. */
|
|
163
|
-
declare function blockVersion(text: string): string | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Put the block into a file's text. A file without one gains it at the end; a file with one has
|
|
166
|
-
* only that part replaced, so whatever else the file says is kept.
|
|
167
|
-
*/
|
|
168
|
-
declare function applyBlock(existing: string | null, block: string): {
|
|
169
|
-
text: string;
|
|
170
|
-
action: "create" | "append" | "update" | "unchanged";
|
|
171
|
-
};
|
|
172
|
-
/** Take the block out of a file's text, with the blank line that set it apart. */
|
|
173
|
-
declare function removeBlock(existing: string): {
|
|
174
|
-
text: string;
|
|
175
|
-
found: boolean;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
185
|
interface IndexEntry {
|
|
179
186
|
name: string;
|
|
180
187
|
/** What it is for, in the words a person would ask with. */
|
|
@@ -243,4 +250,24 @@ declare function renderComponent(detail: ComponentDetail, { dense }: {
|
|
|
243
250
|
*/
|
|
244
251
|
declare function search(contract: Contract, registry: Registry, query: string, limit?: number): SearchResult[];
|
|
245
252
|
|
|
246
|
-
|
|
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 };
|
|
@@ -44,12 +44,38 @@ interface ComponentGuidance {
|
|
|
44
44
|
}[];
|
|
45
45
|
values?: Record<string, Record<string, string>>;
|
|
46
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
|
+
}
|
|
47
72
|
interface Contract {
|
|
48
73
|
version: string;
|
|
49
74
|
components: Record<string, ContractComponent>;
|
|
50
75
|
composition_rules?: Record<string, CompositionRule>;
|
|
51
76
|
patterns?: Record<string, ContractRecipe>;
|
|
52
77
|
guidance: {
|
|
78
|
+
setup: ContractSetup;
|
|
53
79
|
rules: GuidanceRule[];
|
|
54
80
|
components: Record<string, ComponentGuidance>;
|
|
55
81
|
};
|
|
@@ -111,6 +137,7 @@ type Command = {
|
|
|
111
137
|
json: boolean;
|
|
112
138
|
} | ({
|
|
113
139
|
command: "add";
|
|
140
|
+
json: boolean;
|
|
114
141
|
} & Required<AddOptions>) | {
|
|
115
142
|
command: "component";
|
|
116
143
|
names: string[];
|
|
@@ -155,26 +182,6 @@ declare class CliError extends Error {
|
|
|
155
182
|
});
|
|
156
183
|
}
|
|
157
184
|
|
|
158
|
-
declare const START = "<!-- OPERATOR:START -->";
|
|
159
|
-
declare const END = "<!-- OPERATOR:END -->";
|
|
160
|
-
/** The block for this contract, markers included, ending in a newline. */
|
|
161
|
-
declare function renderAgentBlock(contract: Contract): string;
|
|
162
|
-
/** The version of the installer that wrote the block in a text, if it holds one. */
|
|
163
|
-
declare function blockVersion(text: string): string | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Put the block into a file's text. A file without one gains it at the end; a file with one has
|
|
166
|
-
* only that part replaced, so whatever else the file says is kept.
|
|
167
|
-
*/
|
|
168
|
-
declare function applyBlock(existing: string | null, block: string): {
|
|
169
|
-
text: string;
|
|
170
|
-
action: "create" | "append" | "update" | "unchanged";
|
|
171
|
-
};
|
|
172
|
-
/** Take the block out of a file's text, with the blank line that set it apart. */
|
|
173
|
-
declare function removeBlock(existing: string): {
|
|
174
|
-
text: string;
|
|
175
|
-
found: boolean;
|
|
176
|
-
};
|
|
177
|
-
|
|
178
185
|
interface IndexEntry {
|
|
179
186
|
name: string;
|
|
180
187
|
/** What it is for, in the words a person would ask with. */
|
|
@@ -243,4 +250,24 @@ declare function renderComponent(detail: ComponentDetail, { dense }: {
|
|
|
243
250
|
*/
|
|
244
251
|
declare function search(contract: Contract, registry: Registry, query: string, limit?: number): SearchResult[];
|
|
245
252
|
|
|
246
|
-
|
|
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 };
|
package/dist/read.cjs
CHANGED
|
@@ -45,6 +45,7 @@ var CliError = class extends Error {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
// src/lookup.ts
|
|
48
|
+
var SEARCH_LIMIT_DEFAULT = 10;
|
|
48
49
|
var squash = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
49
50
|
var firstSentence = (text) => /^.*?[.!?](?=\s|$)/.exec(text)?.[0] ?? text;
|
|
50
51
|
function distance(a, b) {
|
|
@@ -171,7 +172,7 @@ var matched = (query, text) => {
|
|
|
171
172
|
const present = new Set(words(text));
|
|
172
173
|
return query.filter((word) => present.has(word)).length;
|
|
173
174
|
};
|
|
174
|
-
function search(contract, registry, query, limit =
|
|
175
|
+
function search(contract, registry, query, limit = SEARCH_LIMIT_DEFAULT) {
|
|
175
176
|
const wanted = words(query);
|
|
176
177
|
if (wanted.length === 0) return [];
|
|
177
178
|
const whole = squash(query);
|
package/dist/read.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as ComponentDetail, C as Contract, D as DetailProp, E as END, e as IndexEntry, m as START, S as SearchResult, i as componentDetail, j as componentIndex, k as renderAgentBlock, l as renderComponent, s as search } from './read-C7rE5UlY.cjs';
|
package/dist/read.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a as ComponentDetail, C as Contract, D as DetailProp, E as END, e as IndexEntry, m as START, S as SearchResult, i as componentDetail, j as componentIndex, k as renderAgentBlock, l as renderComponent, s as search } from './read-C7rE5UlY.js';
|
package/dist/read.js
CHANGED
|
@@ -13,6 +13,7 @@ var CliError = class extends Error {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
// src/lookup.ts
|
|
16
|
+
var SEARCH_LIMIT_DEFAULT = 10;
|
|
16
17
|
var squash = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
17
18
|
var firstSentence = (text) => /^.*?[.!?](?=\s|$)/.exec(text)?.[0] ?? text;
|
|
18
19
|
function distance(a, b) {
|
|
@@ -139,7 +140,7 @@ var matched = (query, text) => {
|
|
|
139
140
|
const present = new Set(words(text));
|
|
140
141
|
return query.filter((word) => present.has(word)).length;
|
|
141
142
|
};
|
|
142
|
-
function search(contract, registry, query, limit =
|
|
143
|
+
function search(contract, registry, query, limit = SEARCH_LIMIT_DEFAULT) {
|
|
143
144
|
const wanted = words(query);
|
|
144
145
|
if (wanted.length === 0) return [];
|
|
145
146
|
const whole = squash(query);
|