everything-dev 0.3.2 → 1.3.2
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 +64 -0
- package/cli.js +10 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/api-contract.cjs +172 -0
- package/dist/api-contract.cjs.map +1 -0
- package/dist/api-contract.mjs +171 -0
- package/dist/api-contract.mjs.map +1 -0
- package/dist/api.cjs +124 -0
- package/dist/api.cjs.map +1 -0
- package/dist/api.d.cts +36 -0
- package/dist/api.d.cts.map +1 -0
- package/dist/api.d.mts +36 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +119 -0
- package/dist/api.mjs.map +1 -0
- package/dist/app.cjs +156 -0
- package/dist/app.cjs.map +1 -0
- package/dist/app.mjs +153 -0
- package/dist/app.mjs.map +1 -0
- package/dist/cli/catalog.cjs +30 -0
- package/dist/cli/catalog.cjs.map +1 -0
- package/dist/cli/catalog.mjs +29 -0
- package/dist/cli/catalog.mjs.map +1 -0
- package/dist/cli/help.cjs +16 -0
- package/dist/cli/help.cjs.map +1 -0
- package/dist/cli/help.mjs +16 -0
- package/dist/cli/help.mjs.map +1 -0
- package/dist/cli/init.cjs +317 -0
- package/dist/cli/init.cjs.map +1 -0
- package/dist/cli/init.d.cts +36 -0
- package/dist/cli/init.d.cts.map +1 -0
- package/dist/cli/init.d.mts +36 -0
- package/dist/cli/init.d.mts.map +1 -0
- package/dist/cli/init.mjs +309 -0
- package/dist/cli/init.mjs.map +1 -0
- package/dist/cli/parse.cjs +96 -0
- package/dist/cli/parse.cjs.map +1 -0
- package/dist/cli/parse.mjs +95 -0
- package/dist/cli/parse.mjs.map +1 -0
- package/dist/cli/prompts.cjs +42 -0
- package/dist/cli/prompts.cjs.map +1 -0
- package/dist/cli/prompts.mjs +41 -0
- package/dist/cli/prompts.mjs.map +1 -0
- package/dist/cli.cjs +167 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +166 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/components/dev-view.cjs +307 -0
- package/dist/components/dev-view.cjs.map +1 -0
- package/dist/components/dev-view.mjs +306 -0
- package/dist/components/dev-view.mjs.map +1 -0
- package/dist/components/streaming-view.cjs +146 -0
- package/dist/components/streaming-view.cjs.map +1 -0
- package/dist/components/streaming-view.mjs +144 -0
- package/dist/components/streaming-view.mjs.map +1 -0
- package/dist/config.cjs +280 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +35 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +35 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +266 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract.cjs +209 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +490 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +490 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.meta.cjs +104 -0
- package/dist/contract.meta.cjs.map +1 -0
- package/dist/contract.meta.d.cts +141 -0
- package/dist/contract.meta.d.cts.map +1 -0
- package/dist/contract.meta.d.mts +141 -0
- package/dist/contract.meta.d.mts.map +1 -0
- package/dist/contract.meta.mjs +102 -0
- package/dist/contract.meta.mjs.map +1 -0
- package/dist/contract.mjs +186 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/dev-logs.cjs +53 -0
- package/dist/dev-logs.cjs.map +1 -0
- package/dist/dev-logs.mjs +51 -0
- package/dist/dev-logs.mjs.map +1 -0
- package/dist/dev-session.cjs +195 -0
- package/dist/dev-session.cjs.map +1 -0
- package/dist/dev-session.mjs +194 -0
- package/dist/dev-session.mjs.map +1 -0
- package/dist/fastkv.cjs +89 -0
- package/dist/fastkv.cjs.map +1 -0
- package/dist/fastkv.d.cts +11 -0
- package/dist/fastkv.d.cts.map +1 -0
- package/dist/fastkv.d.mts +11 -0
- package/dist/fastkv.d.mts.map +1 -0
- package/dist/fastkv.mjs +82 -0
- package/dist/fastkv.mjs.map +1 -0
- package/dist/federation.server.cjs +27 -0
- package/dist/federation.server.cjs.map +1 -0
- package/dist/federation.server.mjs +27 -0
- package/dist/federation.server.mjs.map +1 -0
- package/dist/host.cjs +367 -0
- package/dist/host.cjs.map +1 -0
- package/dist/host.d.cts +22 -0
- package/dist/host.d.cts.map +1 -0
- package/dist/host.d.mts +22 -0
- package/dist/host.d.mts.map +1 -0
- package/dist/host.mjs +364 -0
- package/dist/host.mjs.map +1 -0
- package/dist/index.cjs +122 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +9 -0
- package/dist/integrity.cjs +39 -0
- package/dist/integrity.cjs.map +1 -0
- package/dist/integrity.d.cts +7 -0
- package/dist/integrity.d.cts.map +1 -0
- package/dist/integrity.d.mts +7 -0
- package/dist/integrity.d.mts.map +1 -0
- package/dist/integrity.mjs +35 -0
- package/dist/integrity.mjs.map +1 -0
- package/dist/mf.cjs +77 -0
- package/dist/mf.cjs.map +1 -0
- package/dist/mf.d.cts +19 -0
- package/dist/mf.d.cts.map +1 -0
- package/dist/mf.d.mts +19 -0
- package/dist/mf.d.mts.map +1 -0
- package/dist/mf.mjs +71 -0
- package/dist/mf.mjs.map +1 -0
- package/dist/near-cli.cjs +196 -0
- package/dist/near-cli.cjs.map +1 -0
- package/dist/near-cli.mjs +193 -0
- package/dist/near-cli.mjs.map +1 -0
- package/dist/network.cjs +9 -0
- package/dist/network.cjs.map +1 -0
- package/dist/network.mjs +8 -0
- package/dist/network.mjs.map +1 -0
- package/dist/orchestrator.cjs +441 -0
- package/dist/orchestrator.cjs.map +1 -0
- package/dist/orchestrator.d.cts +40 -0
- package/dist/orchestrator.d.cts.map +1 -0
- package/dist/orchestrator.d.mts +40 -0
- package/dist/orchestrator.d.mts.map +1 -0
- package/dist/orchestrator.mjs +436 -0
- package/dist/orchestrator.mjs.map +1 -0
- package/dist/plugin.cjs +825 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +347 -0
- package/dist/plugin.d.cts.map +1 -0
- package/dist/plugin.d.mts +348 -0
- package/dist/plugin.d.mts.map +1 -0
- package/dist/plugin.mjs +822 -0
- package/dist/plugin.mjs.map +1 -0
- package/dist/process-registry.cjs +120 -0
- package/dist/process-registry.cjs.map +1 -0
- package/dist/process-registry.d.cts +25 -0
- package/dist/process-registry.d.cts.map +1 -0
- package/dist/process-registry.d.mts +25 -0
- package/dist/process-registry.d.mts.map +1 -0
- package/dist/process-registry.mjs +119 -0
- package/dist/process-registry.mjs.map +1 -0
- package/dist/sdk.cjs +61 -0
- package/dist/sdk.d.cts +5 -0
- package/dist/sdk.d.mts +5 -0
- package/dist/sdk.mjs +6 -0
- package/dist/shared.cjs +143 -0
- package/dist/shared.cjs.map +1 -0
- package/dist/shared.d.cts +33 -0
- package/dist/shared.d.cts.map +1 -0
- package/dist/shared.d.mts +33 -0
- package/dist/shared.d.mts.map +1 -0
- package/dist/shared.mjs +140 -0
- package/dist/shared.mjs.map +1 -0
- package/dist/types.cjs +160 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +269 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +269 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +144 -0
- package/dist/types.mjs.map +1 -0
- package/dist/ui/head.cjs +67 -0
- package/dist/ui/head.cjs.map +1 -0
- package/dist/ui/head.d.cts +19 -0
- package/dist/ui/head.d.cts.map +1 -0
- package/dist/ui/head.d.mts +19 -0
- package/dist/ui/head.d.mts.map +1 -0
- package/dist/ui/head.mjs +61 -0
- package/dist/ui/head.mjs.map +1 -0
- package/dist/ui/index.cjs +32 -0
- package/dist/ui/index.d.cts +7 -0
- package/dist/ui/index.d.mts +7 -0
- package/dist/ui/index.mjs +6 -0
- package/dist/ui/metadata.cjs +106 -0
- package/dist/ui/metadata.cjs.map +1 -0
- package/dist/ui/metadata.d.cts +35 -0
- package/dist/ui/metadata.d.cts.map +1 -0
- package/dist/ui/metadata.d.mts +35 -0
- package/dist/ui/metadata.d.mts.map +1 -0
- package/dist/ui/metadata.mjs +100 -0
- package/dist/ui/metadata.mjs.map +1 -0
- package/dist/ui/router.cjs +56 -0
- package/dist/ui/router.cjs.map +1 -0
- package/dist/ui/router.d.cts +11 -0
- package/dist/ui/router.d.cts.map +1 -0
- package/dist/ui/router.d.mts +11 -0
- package/dist/ui/router.d.mts.map +1 -0
- package/dist/ui/router.mjs +51 -0
- package/dist/ui/router.mjs.map +1 -0
- package/dist/ui/runtime.cjs +65 -0
- package/dist/ui/runtime.cjs.map +1 -0
- package/dist/ui/runtime.d.cts +29 -0
- package/dist/ui/runtime.d.cts.map +1 -0
- package/dist/ui/runtime.d.mts +29 -0
- package/dist/ui/runtime.d.mts.map +1 -0
- package/dist/ui/runtime.mjs +53 -0
- package/dist/ui/runtime.mjs.map +1 -0
- package/dist/ui/types.cjs +0 -0
- package/dist/ui/types.d.cts +52 -0
- package/dist/ui/types.d.cts.map +1 -0
- package/dist/ui/types.d.mts +52 -0
- package/dist/ui/types.d.mts.map +1 -0
- package/dist/ui/types.mjs +1 -0
- package/dist/utils/banner.cjs +24 -0
- package/dist/utils/banner.cjs.map +1 -0
- package/dist/utils/banner.mjs +23 -0
- package/dist/utils/banner.mjs.map +1 -0
- package/dist/utils/linkify.cjs +15 -0
- package/dist/utils/linkify.cjs.map +1 -0
- package/dist/utils/linkify.mjs +14 -0
- package/dist/utils/linkify.mjs.map +1 -0
- package/dist/utils/run.cjs +40 -0
- package/dist/utils/run.cjs.map +1 -0
- package/dist/utils/run.mjs +39 -0
- package/dist/utils/run.mjs.map +1 -0
- package/dist/utils/theme.cjs +44 -0
- package/dist/utils/theme.cjs.map +1 -0
- package/dist/utils/theme.mjs +37 -0
- package/dist/utils/theme.mjs.map +1 -0
- package/package.json +269 -80
- package/src/api-contract.ts +309 -0
- package/src/api.ts +181 -0
- package/src/app.ts +346 -0
- package/src/cli/catalog.ts +49 -0
- package/src/cli/help.ts +13 -0
- package/src/cli/init.ts +415 -0
- package/src/cli/parse.ts +130 -0
- package/src/cli/prompts.ts +64 -0
- package/src/cli.ts +203 -1507
- package/src/components/dev-view.tsx +104 -41
- package/src/components/streaming-view.ts +89 -22
- package/src/config.ts +462 -532
- package/src/contract.meta.ts +96 -0
- package/src/contract.ts +164 -561
- package/src/dev-logs.ts +85 -0
- package/src/dev-session.ts +318 -0
- package/src/fastkv.ts +153 -0
- package/src/federation.server.ts +43 -0
- package/src/host.ts +526 -0
- package/src/index.ts +6 -3
- package/src/integrity.ts +54 -0
- package/src/mf.ts +105 -0
- package/src/near-cli.ts +284 -0
- package/src/network.ts +3 -0
- package/src/orchestrator.ts +648 -0
- package/src/plugin.ts +1116 -2303
- package/src/process-registry.ts +154 -0
- package/src/scripts/sync-api-contract.ts +24 -0
- package/src/sdk.ts +14 -0
- package/src/shared.ts +206 -0
- package/src/types.ts +152 -206
- package/src/ui/head.ts +34 -27
- package/src/ui/index.ts +3 -3
- package/src/ui/metadata.ts +95 -0
- package/src/ui/router.ts +22 -6
- package/src/ui/runtime.ts +55 -6
- package/src/ui/types.ts +24 -11
- package/src/utils/banner.ts +10 -6
- package/src/utils/run.ts +26 -27
- package/src/utils/theme.ts +3 -66
- package/src/components/monitor-view.tsx +0 -475
- package/src/components/status-view.tsx +0 -173
- package/src/lib/env.ts +0 -109
- package/src/lib/near-cli.ts +0 -289
- package/src/lib/nova.ts +0 -266
- package/src/lib/orchestrator.ts +0 -276
- package/src/lib/process-registry.ts +0 -166
- package/src/lib/process.ts +0 -549
- package/src/lib/resource-monitor/assertions.ts +0 -234
- package/src/lib/resource-monitor/command.ts +0 -283
- package/src/lib/resource-monitor/diff.ts +0 -157
- package/src/lib/resource-monitor/errors.ts +0 -127
- package/src/lib/resource-monitor/index.ts +0 -305
- package/src/lib/resource-monitor/platform/darwin.ts +0 -306
- package/src/lib/resource-monitor/platform/index.ts +0 -35
- package/src/lib/resource-monitor/platform/linux.ts +0 -332
- package/src/lib/resource-monitor/platform/windows.ts +0 -298
- package/src/lib/resource-monitor/snapshot.ts +0 -217
- package/src/lib/resource-monitor/types.ts +0 -74
- package/src/lib/session-recorder/errors.ts +0 -102
- package/src/lib/session-recorder/flows/login.ts +0 -210
- package/src/lib/session-recorder/index.ts +0 -361
- package/src/lib/session-recorder/playwright.ts +0 -257
- package/src/lib/session-recorder/report.ts +0 -353
- package/src/lib/session-recorder/server.ts +0 -267
- package/src/lib/session-recorder/types.ts +0 -115
- package/src/lib/sync.ts +0 -1
- package/src/ui/files.ts +0 -134
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//#region src/contract.meta.d.ts
|
|
2
|
+
type CliCommandMeta = {
|
|
3
|
+
commandPath?: string[];
|
|
4
|
+
summary: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
examples?: string[];
|
|
7
|
+
interactive?: boolean;
|
|
8
|
+
longRunning?: boolean;
|
|
9
|
+
fields?: Record<string, {
|
|
10
|
+
positional?: boolean;
|
|
11
|
+
description?: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
declare const cliCommandMeta: {
|
|
15
|
+
readonly dev: {
|
|
16
|
+
readonly commandPath: ["dev"];
|
|
17
|
+
readonly summary: "Start a development session";
|
|
18
|
+
readonly interactive: true;
|
|
19
|
+
readonly longRunning: true;
|
|
20
|
+
};
|
|
21
|
+
readonly start: {
|
|
22
|
+
readonly commandPath: ["start"];
|
|
23
|
+
readonly summary: "Start the production host";
|
|
24
|
+
readonly interactive: false;
|
|
25
|
+
readonly longRunning: true;
|
|
26
|
+
readonly fields: {
|
|
27
|
+
readonly env: {
|
|
28
|
+
readonly description: "Environment: production or staging";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly build: {
|
|
33
|
+
readonly commandPath: ["build"];
|
|
34
|
+
readonly summary: "Build selected workspaces";
|
|
35
|
+
readonly interactive: false;
|
|
36
|
+
readonly fields: {
|
|
37
|
+
readonly packages: {
|
|
38
|
+
readonly positional: true;
|
|
39
|
+
readonly description: "Comma-separated package list";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly config: {
|
|
44
|
+
readonly commandPath: ["config"];
|
|
45
|
+
readonly summary: "Print the loaded BOS configuration";
|
|
46
|
+
readonly interactive: false;
|
|
47
|
+
};
|
|
48
|
+
readonly pluginAdd: {
|
|
49
|
+
readonly commandPath: ["plugin", "add"];
|
|
50
|
+
readonly summary: "Add a plugin attachment";
|
|
51
|
+
readonly interactive: false;
|
|
52
|
+
readonly fields: {
|
|
53
|
+
readonly source: {
|
|
54
|
+
readonly positional: true;
|
|
55
|
+
readonly description: "Plugin source (local:path or URL)";
|
|
56
|
+
};
|
|
57
|
+
readonly as: {
|
|
58
|
+
readonly description: "Plugin alias";
|
|
59
|
+
};
|
|
60
|
+
readonly production: {
|
|
61
|
+
readonly description: "Production URL override";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly pluginRemove: {
|
|
66
|
+
readonly commandPath: ["plugin", "remove"];
|
|
67
|
+
readonly summary: "Remove a plugin attachment";
|
|
68
|
+
readonly interactive: false;
|
|
69
|
+
readonly fields: {
|
|
70
|
+
readonly key: {
|
|
71
|
+
readonly positional: true;
|
|
72
|
+
readonly description: "Plugin key";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly pluginList: {
|
|
77
|
+
readonly commandPath: ["plugin", "list"];
|
|
78
|
+
readonly summary: "List configured plugins";
|
|
79
|
+
readonly interactive: false;
|
|
80
|
+
};
|
|
81
|
+
readonly pluginPublish: {
|
|
82
|
+
readonly commandPath: ["plugin", "publish"];
|
|
83
|
+
readonly summary: "Publish a single plugin";
|
|
84
|
+
readonly interactive: false;
|
|
85
|
+
readonly fields: {
|
|
86
|
+
readonly key: {
|
|
87
|
+
readonly positional: true;
|
|
88
|
+
readonly description: "Plugin key";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly publish: {
|
|
93
|
+
readonly commandPath: ["publish"];
|
|
94
|
+
readonly summary: "Publish the current workspace configuration";
|
|
95
|
+
readonly interactive: false;
|
|
96
|
+
};
|
|
97
|
+
readonly keyPublish: {
|
|
98
|
+
readonly commandPath: ["key", "publish"];
|
|
99
|
+
readonly summary: "Generate a publish access key";
|
|
100
|
+
readonly interactive: false;
|
|
101
|
+
};
|
|
102
|
+
readonly init: {
|
|
103
|
+
readonly commandPath: ["init"];
|
|
104
|
+
readonly summary: "Scaffold a new project from a bos template";
|
|
105
|
+
readonly interactive: true;
|
|
106
|
+
readonly fields: {
|
|
107
|
+
readonly account: {
|
|
108
|
+
readonly positional: true;
|
|
109
|
+
readonly description: "Parent NEAR account (defaults to dev.everything.near)";
|
|
110
|
+
};
|
|
111
|
+
readonly gateway: {
|
|
112
|
+
readonly positional: true;
|
|
113
|
+
readonly description: "Parent gateway ID (defaults to everything.dev)";
|
|
114
|
+
};
|
|
115
|
+
readonly destination: {
|
|
116
|
+
readonly description: "Target directory (defaults to ./gateway)";
|
|
117
|
+
};
|
|
118
|
+
readonly name: {
|
|
119
|
+
readonly description: "New project NEAR account";
|
|
120
|
+
};
|
|
121
|
+
readonly domain: {
|
|
122
|
+
readonly description: "New project domain";
|
|
123
|
+
};
|
|
124
|
+
readonly source: {
|
|
125
|
+
readonly description: "Local source dir (skips GitHub download)";
|
|
126
|
+
};
|
|
127
|
+
readonly withHost: {
|
|
128
|
+
readonly description: "Include host/ in template output";
|
|
129
|
+
};
|
|
130
|
+
readonly noInteractive: {
|
|
131
|
+
readonly description: "Skip prompts, use flags only";
|
|
132
|
+
};
|
|
133
|
+
readonly noInstall: {
|
|
134
|
+
readonly description: "Skip bun install";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { CliCommandMeta, cliCommandMeta };
|
|
141
|
+
//# sourceMappingURL=contract.meta.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.meta.d.cts","names":[],"sources":["../src/contract.meta.ts"],"mappings":";KAAY,cAAA;EACV,WAAA;EACA,OAAA;EACA,WAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,MAAA,GAAS,MAAA;IAAiB,UAAA;IAAsB,WAAA;EAAA;AAAA;AAAA,cAGrC,cAAA;EAAA"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//#region src/contract.meta.d.ts
|
|
2
|
+
type CliCommandMeta = {
|
|
3
|
+
commandPath?: string[];
|
|
4
|
+
summary: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
examples?: string[];
|
|
7
|
+
interactive?: boolean;
|
|
8
|
+
longRunning?: boolean;
|
|
9
|
+
fields?: Record<string, {
|
|
10
|
+
positional?: boolean;
|
|
11
|
+
description?: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
declare const cliCommandMeta: {
|
|
15
|
+
readonly dev: {
|
|
16
|
+
readonly commandPath: ["dev"];
|
|
17
|
+
readonly summary: "Start a development session";
|
|
18
|
+
readonly interactive: true;
|
|
19
|
+
readonly longRunning: true;
|
|
20
|
+
};
|
|
21
|
+
readonly start: {
|
|
22
|
+
readonly commandPath: ["start"];
|
|
23
|
+
readonly summary: "Start the production host";
|
|
24
|
+
readonly interactive: false;
|
|
25
|
+
readonly longRunning: true;
|
|
26
|
+
readonly fields: {
|
|
27
|
+
readonly env: {
|
|
28
|
+
readonly description: "Environment: production or staging";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly build: {
|
|
33
|
+
readonly commandPath: ["build"];
|
|
34
|
+
readonly summary: "Build selected workspaces";
|
|
35
|
+
readonly interactive: false;
|
|
36
|
+
readonly fields: {
|
|
37
|
+
readonly packages: {
|
|
38
|
+
readonly positional: true;
|
|
39
|
+
readonly description: "Comma-separated package list";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly config: {
|
|
44
|
+
readonly commandPath: ["config"];
|
|
45
|
+
readonly summary: "Print the loaded BOS configuration";
|
|
46
|
+
readonly interactive: false;
|
|
47
|
+
};
|
|
48
|
+
readonly pluginAdd: {
|
|
49
|
+
readonly commandPath: ["plugin", "add"];
|
|
50
|
+
readonly summary: "Add a plugin attachment";
|
|
51
|
+
readonly interactive: false;
|
|
52
|
+
readonly fields: {
|
|
53
|
+
readonly source: {
|
|
54
|
+
readonly positional: true;
|
|
55
|
+
readonly description: "Plugin source (local:path or URL)";
|
|
56
|
+
};
|
|
57
|
+
readonly as: {
|
|
58
|
+
readonly description: "Plugin alias";
|
|
59
|
+
};
|
|
60
|
+
readonly production: {
|
|
61
|
+
readonly description: "Production URL override";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly pluginRemove: {
|
|
66
|
+
readonly commandPath: ["plugin", "remove"];
|
|
67
|
+
readonly summary: "Remove a plugin attachment";
|
|
68
|
+
readonly interactive: false;
|
|
69
|
+
readonly fields: {
|
|
70
|
+
readonly key: {
|
|
71
|
+
readonly positional: true;
|
|
72
|
+
readonly description: "Plugin key";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly pluginList: {
|
|
77
|
+
readonly commandPath: ["plugin", "list"];
|
|
78
|
+
readonly summary: "List configured plugins";
|
|
79
|
+
readonly interactive: false;
|
|
80
|
+
};
|
|
81
|
+
readonly pluginPublish: {
|
|
82
|
+
readonly commandPath: ["plugin", "publish"];
|
|
83
|
+
readonly summary: "Publish a single plugin";
|
|
84
|
+
readonly interactive: false;
|
|
85
|
+
readonly fields: {
|
|
86
|
+
readonly key: {
|
|
87
|
+
readonly positional: true;
|
|
88
|
+
readonly description: "Plugin key";
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly publish: {
|
|
93
|
+
readonly commandPath: ["publish"];
|
|
94
|
+
readonly summary: "Publish the current workspace configuration";
|
|
95
|
+
readonly interactive: false;
|
|
96
|
+
};
|
|
97
|
+
readonly keyPublish: {
|
|
98
|
+
readonly commandPath: ["key", "publish"];
|
|
99
|
+
readonly summary: "Generate a publish access key";
|
|
100
|
+
readonly interactive: false;
|
|
101
|
+
};
|
|
102
|
+
readonly init: {
|
|
103
|
+
readonly commandPath: ["init"];
|
|
104
|
+
readonly summary: "Scaffold a new project from a bos template";
|
|
105
|
+
readonly interactive: true;
|
|
106
|
+
readonly fields: {
|
|
107
|
+
readonly account: {
|
|
108
|
+
readonly positional: true;
|
|
109
|
+
readonly description: "Parent NEAR account (defaults to dev.everything.near)";
|
|
110
|
+
};
|
|
111
|
+
readonly gateway: {
|
|
112
|
+
readonly positional: true;
|
|
113
|
+
readonly description: "Parent gateway ID (defaults to everything.dev)";
|
|
114
|
+
};
|
|
115
|
+
readonly destination: {
|
|
116
|
+
readonly description: "Target directory (defaults to ./gateway)";
|
|
117
|
+
};
|
|
118
|
+
readonly name: {
|
|
119
|
+
readonly description: "New project NEAR account";
|
|
120
|
+
};
|
|
121
|
+
readonly domain: {
|
|
122
|
+
readonly description: "New project domain";
|
|
123
|
+
};
|
|
124
|
+
readonly source: {
|
|
125
|
+
readonly description: "Local source dir (skips GitHub download)";
|
|
126
|
+
};
|
|
127
|
+
readonly withHost: {
|
|
128
|
+
readonly description: "Include host/ in template output";
|
|
129
|
+
};
|
|
130
|
+
readonly noInteractive: {
|
|
131
|
+
readonly description: "Skip prompts, use flags only";
|
|
132
|
+
};
|
|
133
|
+
readonly noInstall: {
|
|
134
|
+
readonly description: "Skip bun install";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { CliCommandMeta, cliCommandMeta };
|
|
141
|
+
//# sourceMappingURL=contract.meta.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.meta.d.mts","names":[],"sources":["../src/contract.meta.ts"],"mappings":";KAAY,cAAA;EACV,WAAA;EACA,OAAA;EACA,WAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,MAAA,GAAS,MAAA;IAAiB,UAAA;IAAsB,WAAA;EAAA;AAAA;AAAA,cAGrC,cAAA;EAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//#region src/contract.meta.ts
|
|
2
|
+
const cliCommandMeta = {
|
|
3
|
+
dev: {
|
|
4
|
+
commandPath: ["dev"],
|
|
5
|
+
summary: "Start a development session",
|
|
6
|
+
interactive: true,
|
|
7
|
+
longRunning: true
|
|
8
|
+
},
|
|
9
|
+
start: {
|
|
10
|
+
commandPath: ["start"],
|
|
11
|
+
summary: "Start the production host",
|
|
12
|
+
interactive: false,
|
|
13
|
+
longRunning: true,
|
|
14
|
+
fields: { env: { description: "Environment: production or staging" } }
|
|
15
|
+
},
|
|
16
|
+
build: {
|
|
17
|
+
commandPath: ["build"],
|
|
18
|
+
summary: "Build selected workspaces",
|
|
19
|
+
interactive: false,
|
|
20
|
+
fields: { packages: {
|
|
21
|
+
positional: true,
|
|
22
|
+
description: "Comma-separated package list"
|
|
23
|
+
} }
|
|
24
|
+
},
|
|
25
|
+
config: {
|
|
26
|
+
commandPath: ["config"],
|
|
27
|
+
summary: "Print the loaded BOS configuration",
|
|
28
|
+
interactive: false
|
|
29
|
+
},
|
|
30
|
+
pluginAdd: {
|
|
31
|
+
commandPath: ["plugin", "add"],
|
|
32
|
+
summary: "Add a plugin attachment",
|
|
33
|
+
interactive: false,
|
|
34
|
+
fields: {
|
|
35
|
+
source: {
|
|
36
|
+
positional: true,
|
|
37
|
+
description: "Plugin source (local:path or URL)"
|
|
38
|
+
},
|
|
39
|
+
as: { description: "Plugin alias" },
|
|
40
|
+
production: { description: "Production URL override" }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
pluginRemove: {
|
|
44
|
+
commandPath: ["plugin", "remove"],
|
|
45
|
+
summary: "Remove a plugin attachment",
|
|
46
|
+
interactive: false,
|
|
47
|
+
fields: { key: {
|
|
48
|
+
positional: true,
|
|
49
|
+
description: "Plugin key"
|
|
50
|
+
} }
|
|
51
|
+
},
|
|
52
|
+
pluginList: {
|
|
53
|
+
commandPath: ["plugin", "list"],
|
|
54
|
+
summary: "List configured plugins",
|
|
55
|
+
interactive: false
|
|
56
|
+
},
|
|
57
|
+
pluginPublish: {
|
|
58
|
+
commandPath: ["plugin", "publish"],
|
|
59
|
+
summary: "Publish a single plugin",
|
|
60
|
+
interactive: false,
|
|
61
|
+
fields: { key: {
|
|
62
|
+
positional: true,
|
|
63
|
+
description: "Plugin key"
|
|
64
|
+
} }
|
|
65
|
+
},
|
|
66
|
+
publish: {
|
|
67
|
+
commandPath: ["publish"],
|
|
68
|
+
summary: "Publish the current workspace configuration",
|
|
69
|
+
interactive: false
|
|
70
|
+
},
|
|
71
|
+
keyPublish: {
|
|
72
|
+
commandPath: ["key", "publish"],
|
|
73
|
+
summary: "Generate a publish access key",
|
|
74
|
+
interactive: false
|
|
75
|
+
},
|
|
76
|
+
init: {
|
|
77
|
+
commandPath: ["init"],
|
|
78
|
+
summary: "Scaffold a new project from a bos template",
|
|
79
|
+
interactive: true,
|
|
80
|
+
fields: {
|
|
81
|
+
account: {
|
|
82
|
+
positional: true,
|
|
83
|
+
description: "Parent NEAR account (defaults to dev.everything.near)"
|
|
84
|
+
},
|
|
85
|
+
gateway: {
|
|
86
|
+
positional: true,
|
|
87
|
+
description: "Parent gateway ID (defaults to everything.dev)"
|
|
88
|
+
},
|
|
89
|
+
destination: { description: "Target directory (defaults to ./gateway)" },
|
|
90
|
+
name: { description: "New project NEAR account" },
|
|
91
|
+
domain: { description: "New project domain" },
|
|
92
|
+
source: { description: "Local source dir (skips GitHub download)" },
|
|
93
|
+
withHost: { description: "Include host/ in template output" },
|
|
94
|
+
noInteractive: { description: "Skip prompts, use flags only" },
|
|
95
|
+
noInstall: { description: "Skip bun install" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
//#endregion
|
|
101
|
+
export { cliCommandMeta };
|
|
102
|
+
//# sourceMappingURL=contract.meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.meta.mjs","names":[],"sources":["../src/contract.meta.ts"],"sourcesContent":["export type CliCommandMeta = {\n commandPath?: string[];\n summary: string;\n description?: string;\n examples?: string[];\n interactive?: boolean;\n longRunning?: boolean;\n fields?: Record<string, { positional?: boolean; description?: string }>;\n};\n\nexport const cliCommandMeta = {\n dev: {\n commandPath: [\"dev\"],\n summary: \"Start a development session\",\n interactive: true,\n longRunning: true,\n },\n start: {\n commandPath: [\"start\"],\n summary: \"Start the production host\",\n interactive: false,\n longRunning: true,\n fields: {\n env: { description: \"Environment: production or staging\" },\n },\n },\n build: {\n commandPath: [\"build\"],\n summary: \"Build selected workspaces\",\n interactive: false,\n fields: {\n packages: { positional: true, description: \"Comma-separated package list\" },\n },\n },\n config: {\n commandPath: [\"config\"],\n summary: \"Print the loaded BOS configuration\",\n interactive: false,\n },\n pluginAdd: {\n commandPath: [\"plugin\", \"add\"],\n summary: \"Add a plugin attachment\",\n interactive: false,\n fields: {\n source: { positional: true, description: \"Plugin source (local:path or URL)\" },\n as: { description: \"Plugin alias\" },\n production: { description: \"Production URL override\" },\n },\n },\n pluginRemove: {\n commandPath: [\"plugin\", \"remove\"],\n summary: \"Remove a plugin attachment\",\n interactive: false,\n fields: { key: { positional: true, description: \"Plugin key\" } },\n },\n pluginList: {\n commandPath: [\"plugin\", \"list\"],\n summary: \"List configured plugins\",\n interactive: false,\n },\n pluginPublish: {\n commandPath: [\"plugin\", \"publish\"],\n summary: \"Publish a single plugin\",\n interactive: false,\n fields: { key: { positional: true, description: \"Plugin key\" } },\n },\n publish: {\n commandPath: [\"publish\"],\n summary: \"Publish the current workspace configuration\",\n interactive: false,\n },\n keyPublish: {\n commandPath: [\"key\", \"publish\"],\n summary: \"Generate a publish access key\",\n interactive: false,\n },\n init: {\n commandPath: [\"init\"],\n summary: \"Scaffold a new project from a bos template\",\n interactive: true,\n fields: {\n account: {\n positional: true,\n description: \"Parent NEAR account (defaults to dev.everything.near)\",\n },\n gateway: { positional: true, description: \"Parent gateway ID (defaults to everything.dev)\" },\n destination: { description: \"Target directory (defaults to ./gateway)\" },\n name: { description: \"New project NEAR account\" },\n domain: { description: \"New project domain\" },\n source: { description: \"Local source dir (skips GitHub download)\" },\n withHost: { description: \"Include host/ in template output\" },\n noInteractive: { description: \"Skip prompts, use flags only\" },\n noInstall: { description: \"Skip bun install\" },\n },\n },\n} as const satisfies Record<string, CliCommandMeta>;\n"],"mappings":";AAUA,MAAa,iBAAiB;CAC5B,KAAK;EACH,aAAa,CAAC,MAAM;EACpB,SAAS;EACT,aAAa;EACb,aAAa;EACd;CACD,OAAO;EACL,aAAa,CAAC,QAAQ;EACtB,SAAS;EACT,aAAa;EACb,aAAa;EACb,QAAQ,EACN,KAAK,EAAE,aAAa,sCAAsC,EAC3D;EACF;CACD,OAAO;EACL,aAAa,CAAC,QAAQ;EACtB,SAAS;EACT,aAAa;EACb,QAAQ,EACN,UAAU;GAAE,YAAY;GAAM,aAAa;GAAgC,EAC5E;EACF;CACD,QAAQ;EACN,aAAa,CAAC,SAAS;EACvB,SAAS;EACT,aAAa;EACd;CACD,WAAW;EACT,aAAa,CAAC,UAAU,MAAM;EAC9B,SAAS;EACT,aAAa;EACb,QAAQ;GACN,QAAQ;IAAE,YAAY;IAAM,aAAa;IAAqC;GAC9E,IAAI,EAAE,aAAa,gBAAgB;GACnC,YAAY,EAAE,aAAa,2BAA2B;GACvD;EACF;CACD,cAAc;EACZ,aAAa,CAAC,UAAU,SAAS;EACjC,SAAS;EACT,aAAa;EACb,QAAQ,EAAE,KAAK;GAAE,YAAY;GAAM,aAAa;GAAc,EAAE;EACjE;CACD,YAAY;EACV,aAAa,CAAC,UAAU,OAAO;EAC/B,SAAS;EACT,aAAa;EACd;CACD,eAAe;EACb,aAAa,CAAC,UAAU,UAAU;EAClC,SAAS;EACT,aAAa;EACb,QAAQ,EAAE,KAAK;GAAE,YAAY;GAAM,aAAa;GAAc,EAAE;EACjE;CACD,SAAS;EACP,aAAa,CAAC,UAAU;EACxB,SAAS;EACT,aAAa;EACd;CACD,YAAY;EACV,aAAa,CAAC,OAAO,UAAU;EAC/B,SAAS;EACT,aAAa;EACd;CACD,MAAM;EACJ,aAAa,CAAC,OAAO;EACrB,SAAS;EACT,aAAa;EACb,QAAQ;GACN,SAAS;IACP,YAAY;IACZ,aAAa;IACd;GACD,SAAS;IAAE,YAAY;IAAM,aAAa;IAAkD;GAC5F,aAAa,EAAE,aAAa,4CAA4C;GACxE,MAAM,EAAE,aAAa,4BAA4B;GACjD,QAAQ,EAAE,aAAa,sBAAsB;GAC7C,QAAQ,EAAE,aAAa,4CAA4C;GACnE,UAAU,EAAE,aAAa,oCAAoC;GAC7D,eAAe,EAAE,aAAa,gCAAgC;GAC9D,WAAW,EAAE,aAAa,oBAAoB;GAC/C;EACF;CACF"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { oc, z } from "./sdk.mjs";
|
|
2
|
+
import { BosConfigSchema, SourceModeSchema } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/contract.ts
|
|
5
|
+
const DevOptionsSchema = z.object({
|
|
6
|
+
host: SourceModeSchema.default("local"),
|
|
7
|
+
ui: SourceModeSchema.default("local"),
|
|
8
|
+
api: SourceModeSchema.default("local"),
|
|
9
|
+
proxy: z.boolean().default(false),
|
|
10
|
+
ssr: z.boolean().default(false),
|
|
11
|
+
port: z.number().optional(),
|
|
12
|
+
interactive: z.boolean().optional()
|
|
13
|
+
});
|
|
14
|
+
const DevResultSchema = z.object({
|
|
15
|
+
status: z.enum(["started", "error"]),
|
|
16
|
+
description: z.string(),
|
|
17
|
+
processes: z.array(z.string())
|
|
18
|
+
});
|
|
19
|
+
const StartOptionsSchema = z.object({
|
|
20
|
+
port: z.number().optional(),
|
|
21
|
+
interactive: z.boolean().optional(),
|
|
22
|
+
account: z.string().optional(),
|
|
23
|
+
domain: z.string().optional(),
|
|
24
|
+
env: z.enum(["production", "staging"]).default("production")
|
|
25
|
+
});
|
|
26
|
+
const StartResultSchema = z.object({
|
|
27
|
+
status: z.enum(["running", "error"]),
|
|
28
|
+
url: z.string()
|
|
29
|
+
});
|
|
30
|
+
const BuildOptionsSchema = z.object({
|
|
31
|
+
packages: z.string().default("all"),
|
|
32
|
+
force: z.boolean().default(false),
|
|
33
|
+
deploy: z.boolean().default(false)
|
|
34
|
+
});
|
|
35
|
+
const BuildResultSchema = z.object({
|
|
36
|
+
status: z.enum(["success", "error"]),
|
|
37
|
+
built: z.array(z.string()),
|
|
38
|
+
skipped: z.array(z.string()).optional(),
|
|
39
|
+
deployed: z.boolean().optional()
|
|
40
|
+
});
|
|
41
|
+
const ConfigResultSchema = z.object({
|
|
42
|
+
config: BosConfigSchema.nullable(),
|
|
43
|
+
packages: z.array(z.string()),
|
|
44
|
+
remotes: z.array(z.string())
|
|
45
|
+
});
|
|
46
|
+
const PluginAddOptionsSchema = z.object({
|
|
47
|
+
source: z.string(),
|
|
48
|
+
as: z.string().optional(),
|
|
49
|
+
production: z.string().optional()
|
|
50
|
+
});
|
|
51
|
+
const PluginAddResultSchema = z.object({
|
|
52
|
+
status: z.enum(["added", "error"]),
|
|
53
|
+
key: z.string(),
|
|
54
|
+
development: z.string().optional(),
|
|
55
|
+
production: z.string().optional(),
|
|
56
|
+
error: z.string().optional()
|
|
57
|
+
});
|
|
58
|
+
const PluginRemoveOptionsSchema = z.object({ key: z.string() });
|
|
59
|
+
const PluginRemoveResultSchema = z.object({
|
|
60
|
+
status: z.enum(["removed", "error"]),
|
|
61
|
+
key: z.string(),
|
|
62
|
+
error: z.string().optional()
|
|
63
|
+
});
|
|
64
|
+
const PluginListResultSchema = z.object({
|
|
65
|
+
status: z.enum(["listed", "error"]),
|
|
66
|
+
plugins: z.array(z.object({
|
|
67
|
+
key: z.string(),
|
|
68
|
+
development: z.string().optional(),
|
|
69
|
+
production: z.string().optional(),
|
|
70
|
+
localPath: z.string().optional(),
|
|
71
|
+
source: z.enum(["local", "remote"])
|
|
72
|
+
})),
|
|
73
|
+
error: z.string().optional()
|
|
74
|
+
});
|
|
75
|
+
const PluginPublishOptionsSchema = z.object({ key: z.string() });
|
|
76
|
+
const PluginPublishResultSchema = z.object({
|
|
77
|
+
status: z.enum(["published", "error"]),
|
|
78
|
+
key: z.string(),
|
|
79
|
+
path: z.string().optional(),
|
|
80
|
+
script: z.string().optional(),
|
|
81
|
+
production: z.string().optional(),
|
|
82
|
+
error: z.string().optional()
|
|
83
|
+
});
|
|
84
|
+
const PublishOptionsSchema = z.object({
|
|
85
|
+
deploy: z.boolean().default(false),
|
|
86
|
+
dryRun: z.boolean().default(false),
|
|
87
|
+
packages: z.string().default("all"),
|
|
88
|
+
network: z.enum(["mainnet", "testnet"]).optional(),
|
|
89
|
+
privateKey: z.string().optional()
|
|
90
|
+
});
|
|
91
|
+
const PublishResultSchema = z.object({
|
|
92
|
+
status: z.enum([
|
|
93
|
+
"published",
|
|
94
|
+
"error",
|
|
95
|
+
"dry-run"
|
|
96
|
+
]),
|
|
97
|
+
registryUrl: z.string(),
|
|
98
|
+
txHash: z.string().optional(),
|
|
99
|
+
error: z.string().optional(),
|
|
100
|
+
built: z.array(z.string()).optional(),
|
|
101
|
+
skipped: z.array(z.string()).optional()
|
|
102
|
+
});
|
|
103
|
+
const KeyPublishOptionsSchema = z.object({ allowance: z.string().default("0.25NEAR") });
|
|
104
|
+
const KeyPublishResultSchema = z.object({
|
|
105
|
+
status: z.enum(["published", "error"]),
|
|
106
|
+
account: z.string(),
|
|
107
|
+
network: z.enum(["mainnet", "testnet"]),
|
|
108
|
+
contract: z.string(),
|
|
109
|
+
allowance: z.string(),
|
|
110
|
+
functionNames: z.array(z.string()),
|
|
111
|
+
publicKey: z.string().optional(),
|
|
112
|
+
privateKey: z.string().optional(),
|
|
113
|
+
error: z.string().optional()
|
|
114
|
+
});
|
|
115
|
+
const InitOptionsSchema = z.object({
|
|
116
|
+
account: z.string().optional(),
|
|
117
|
+
gateway: z.string().optional(),
|
|
118
|
+
destination: z.string().optional(),
|
|
119
|
+
name: z.string().optional(),
|
|
120
|
+
domain: z.string().optional(),
|
|
121
|
+
source: z.string().optional(),
|
|
122
|
+
withHost: z.boolean().default(false),
|
|
123
|
+
noInteractive: z.boolean().default(false),
|
|
124
|
+
noInstall: z.boolean().default(false)
|
|
125
|
+
});
|
|
126
|
+
const InitResultSchema = z.object({
|
|
127
|
+
status: z.enum(["initialized", "error"]),
|
|
128
|
+
destination: z.string(),
|
|
129
|
+
parentAccount: z.string(),
|
|
130
|
+
parentGateway: z.string(),
|
|
131
|
+
name: z.string().optional(),
|
|
132
|
+
domain: z.string().optional(),
|
|
133
|
+
extends: z.string(),
|
|
134
|
+
filesCopied: z.number(),
|
|
135
|
+
error: z.string().optional()
|
|
136
|
+
});
|
|
137
|
+
const bosContract = oc.router({
|
|
138
|
+
dev: oc.route({
|
|
139
|
+
method: "POST",
|
|
140
|
+
path: "/dev"
|
|
141
|
+
}).input(DevOptionsSchema).output(DevResultSchema),
|
|
142
|
+
start: oc.route({
|
|
143
|
+
method: "POST",
|
|
144
|
+
path: "/start"
|
|
145
|
+
}).input(StartOptionsSchema).output(StartResultSchema),
|
|
146
|
+
build: oc.route({
|
|
147
|
+
method: "POST",
|
|
148
|
+
path: "/build"
|
|
149
|
+
}).input(BuildOptionsSchema).output(BuildResultSchema),
|
|
150
|
+
config: oc.route({
|
|
151
|
+
method: "GET",
|
|
152
|
+
path: "/config"
|
|
153
|
+
}).output(ConfigResultSchema),
|
|
154
|
+
pluginAdd: oc.route({
|
|
155
|
+
method: "POST",
|
|
156
|
+
path: "/plugin/add"
|
|
157
|
+
}).input(PluginAddOptionsSchema).output(PluginAddResultSchema),
|
|
158
|
+
pluginRemove: oc.route({
|
|
159
|
+
method: "POST",
|
|
160
|
+
path: "/plugin/remove"
|
|
161
|
+
}).input(PluginRemoveOptionsSchema).output(PluginRemoveResultSchema),
|
|
162
|
+
pluginList: oc.route({
|
|
163
|
+
method: "GET",
|
|
164
|
+
path: "/plugin/list"
|
|
165
|
+
}).output(PluginListResultSchema),
|
|
166
|
+
pluginPublish: oc.route({
|
|
167
|
+
method: "POST",
|
|
168
|
+
path: "/plugin/publish"
|
|
169
|
+
}).input(PluginPublishOptionsSchema).output(PluginPublishResultSchema),
|
|
170
|
+
publish: oc.route({
|
|
171
|
+
method: "POST",
|
|
172
|
+
path: "/publish"
|
|
173
|
+
}).input(PublishOptionsSchema).output(PublishResultSchema),
|
|
174
|
+
keyPublish: oc.route({
|
|
175
|
+
method: "POST",
|
|
176
|
+
path: "/key/publish"
|
|
177
|
+
}).input(KeyPublishOptionsSchema).output(KeyPublishResultSchema),
|
|
178
|
+
init: oc.route({
|
|
179
|
+
method: "POST",
|
|
180
|
+
path: "/init"
|
|
181
|
+
}).input(InitOptionsSchema).output(InitResultSchema)
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
//#endregion
|
|
185
|
+
export { BuildOptionsSchema, BuildResultSchema, ConfigResultSchema, DevOptionsSchema, DevResultSchema, InitOptionsSchema, InitResultSchema, KeyPublishOptionsSchema, KeyPublishResultSchema, PluginAddOptionsSchema, PluginAddResultSchema, PluginListResultSchema, PluginPublishOptionsSchema, PluginPublishResultSchema, PluginRemoveOptionsSchema, PluginRemoveResultSchema, PublishOptionsSchema, PublishResultSchema, StartOptionsSchema, StartResultSchema, bosContract };
|
|
186
|
+
//# sourceMappingURL=contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.mjs","names":[],"sources":["../src/contract.ts"],"sourcesContent":["import { oc, z } from \"./sdk\";\nimport { BosConfigSchema, SourceModeSchema } from \"./types\";\n\nexport const DevOptionsSchema = z.object({\n host: SourceModeSchema.default(\"local\"),\n ui: SourceModeSchema.default(\"local\"),\n api: SourceModeSchema.default(\"local\"),\n proxy: z.boolean().default(false),\n ssr: z.boolean().default(false),\n port: z.number().optional(),\n interactive: z.boolean().optional(),\n});\n\nexport const DevResultSchema = z.object({\n status: z.enum([\"started\", \"error\"]),\n description: z.string(),\n processes: z.array(z.string()),\n});\n\nexport const StartOptionsSchema = z.object({\n port: z.number().optional(),\n interactive: z.boolean().optional(),\n account: z.string().optional(),\n domain: z.string().optional(),\n env: z.enum([\"production\", \"staging\"]).default(\"production\"),\n});\n\nexport const StartResultSchema = z.object({\n status: z.enum([\"running\", \"error\"]),\n url: z.string(),\n});\n\nexport const BuildOptionsSchema = z.object({\n packages: z.string().default(\"all\"),\n force: z.boolean().default(false),\n deploy: z.boolean().default(false),\n});\n\nexport const BuildResultSchema = z.object({\n status: z.enum([\"success\", \"error\"]),\n built: z.array(z.string()),\n skipped: z.array(z.string()).optional(),\n deployed: z.boolean().optional(),\n});\n\nexport const ConfigResultSchema = z.object({\n config: BosConfigSchema.nullable(),\n packages: z.array(z.string()),\n remotes: z.array(z.string()),\n});\n\nexport const PluginAddOptionsSchema = z.object({\n source: z.string(),\n as: z.string().optional(),\n production: z.string().optional(),\n});\n\nexport const PluginAddResultSchema = z.object({\n status: z.enum([\"added\", \"error\"]),\n key: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n error: z.string().optional(),\n});\n\nexport const PluginRemoveOptionsSchema = z.object({\n key: z.string(),\n});\n\nexport const PluginRemoveResultSchema = z.object({\n status: z.enum([\"removed\", \"error\"]),\n key: z.string(),\n error: z.string().optional(),\n});\n\nexport const PluginListResultSchema = z.object({\n status: z.enum([\"listed\", \"error\"]),\n plugins: z.array(\n z.object({\n key: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n localPath: z.string().optional(),\n source: z.enum([\"local\", \"remote\"]),\n }),\n ),\n error: z.string().optional(),\n});\n\nexport const PluginPublishOptionsSchema = z.object({\n key: z.string(),\n});\n\nexport const PluginPublishResultSchema = z.object({\n status: z.enum([\"published\", \"error\"]),\n key: z.string(),\n path: z.string().optional(),\n script: z.string().optional(),\n production: z.string().optional(),\n error: z.string().optional(),\n});\n\nexport const PublishOptionsSchema = z.object({\n deploy: z.boolean().default(false),\n dryRun: z.boolean().default(false),\n packages: z.string().default(\"all\"),\n network: z.enum([\"mainnet\", \"testnet\"]).optional(),\n privateKey: z.string().optional(),\n});\n\nexport const PublishResultSchema = z.object({\n status: z.enum([\"published\", \"error\", \"dry-run\"]),\n registryUrl: z.string(),\n txHash: z.string().optional(),\n error: z.string().optional(),\n built: z.array(z.string()).optional(),\n skipped: z.array(z.string()).optional(),\n});\n\nexport const KeyPublishOptionsSchema = z.object({\n allowance: z.string().default(\"0.25NEAR\"),\n});\n\nexport const KeyPublishResultSchema = z.object({\n status: z.enum([\"published\", \"error\"]),\n account: z.string(),\n network: z.enum([\"mainnet\", \"testnet\"]),\n contract: z.string(),\n allowance: z.string(),\n functionNames: z.array(z.string()),\n publicKey: z.string().optional(),\n privateKey: z.string().optional(),\n error: z.string().optional(),\n});\n\nexport const InitOptionsSchema = z.object({\n account: z.string().optional(),\n gateway: z.string().optional(),\n destination: z.string().optional(),\n name: z.string().optional(),\n domain: z.string().optional(),\n source: z.string().optional(),\n withHost: z.boolean().default(false),\n noInteractive: z.boolean().default(false),\n noInstall: z.boolean().default(false),\n});\n\nexport const InitResultSchema = z.object({\n status: z.enum([\"initialized\", \"error\"]),\n destination: z.string(),\n parentAccount: z.string(),\n parentGateway: z.string(),\n name: z.string().optional(),\n domain: z.string().optional(),\n extends: z.string(),\n filesCopied: z.number(),\n error: z.string().optional(),\n});\n\nexport const bosContract = oc.router({\n dev: oc.route({ method: \"POST\", path: \"/dev\" }).input(DevOptionsSchema).output(DevResultSchema),\n start: oc\n .route({ method: \"POST\", path: \"/start\" })\n .input(StartOptionsSchema)\n .output(StartResultSchema),\n build: oc\n .route({ method: \"POST\", path: \"/build\" })\n .input(BuildOptionsSchema)\n .output(BuildResultSchema),\n config: oc.route({ method: \"GET\", path: \"/config\" }).output(ConfigResultSchema),\n pluginAdd: oc\n .route({ method: \"POST\", path: \"/plugin/add\" })\n .input(PluginAddOptionsSchema)\n .output(PluginAddResultSchema),\n pluginRemove: oc\n .route({ method: \"POST\", path: \"/plugin/remove\" })\n .input(PluginRemoveOptionsSchema)\n .output(PluginRemoveResultSchema),\n pluginList: oc.route({ method: \"GET\", path: \"/plugin/list\" }).output(PluginListResultSchema),\n pluginPublish: oc\n .route({ method: \"POST\", path: \"/plugin/publish\" })\n .input(PluginPublishOptionsSchema)\n .output(PluginPublishResultSchema),\n publish: oc\n .route({ method: \"POST\", path: \"/publish\" })\n .input(PublishOptionsSchema)\n .output(PublishResultSchema),\n keyPublish: oc\n .route({ method: \"POST\", path: \"/key/publish\" })\n .input(KeyPublishOptionsSchema)\n .output(KeyPublishResultSchema),\n init: oc\n .route({ method: \"POST\", path: \"/init\" })\n .input(InitOptionsSchema)\n .output(InitResultSchema),\n});\n\nexport type DevOptions = z.infer<typeof DevOptionsSchema>;\nexport type StartOptions = z.infer<typeof StartOptionsSchema>;\nexport type BuildOptions = z.infer<typeof BuildOptionsSchema>;\nexport type BosConfigResult = z.infer<typeof ConfigResultSchema>;\nexport type PluginAddOptions = z.infer<typeof PluginAddOptionsSchema>;\nexport type PluginAddResult = z.infer<typeof PluginAddResultSchema>;\nexport type PluginRemoveOptions = z.infer<typeof PluginRemoveOptionsSchema>;\nexport type PluginRemoveResult = z.infer<typeof PluginRemoveResultSchema>;\nexport type PluginListResult = z.infer<typeof PluginListResultSchema>;\nexport type PluginPublishOptions = z.infer<typeof PluginPublishOptionsSchema>;\nexport type PluginPublishResult = z.infer<typeof PluginPublishResultSchema>;\nexport type PublishOptions = z.infer<typeof PublishOptionsSchema>;\nexport type KeyPublishOptions = z.infer<typeof KeyPublishOptionsSchema>;\nexport type KeyPublishResult = z.infer<typeof KeyPublishResultSchema>;\nexport type InitOptions = z.infer<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zC,MAAM,mBAAmB,CACzB,OAAO,kBAAkB;CAC5B,QAAQ,GAAG,MAAM;EAAE,QAAQ;EAAO,MAAM;EAAW,CAAC,CAAC,OAAO,mBAAmB;CAC/E,WAAW,GACR,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAe,CAAC,CAC9C,MAAM,uBAAuB,CAC7B,OAAO,sBAAsB;CAChC,cAAc,GACX,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAkB,CAAC,CACjD,MAAM,0BAA0B,CAChC,OAAO,yBAAyB;CACnC,YAAY,GAAG,MAAM;EAAE,QAAQ;EAAO,MAAM;EAAgB,CAAC,CAAC,OAAO,uBAAuB;CAC5F,eAAe,GACZ,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAmB,CAAC,CAClD,MAAM,2BAA2B,CACjC,OAAO,0BAA0B;CACpC,SAAS,GACN,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAY,CAAC,CAC3C,MAAM,qBAAqB,CAC3B,OAAO,oBAAoB;CAC9B,YAAY,GACT,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAgB,CAAC,CAC/C,MAAM,wBAAwB,CAC9B,OAAO,uBAAuB;CACjC,MAAM,GACH,MAAM;EAAE,QAAQ;EAAQ,MAAM;EAAS,CAAC,CACxC,MAAM,kBAAkB,CACxB,OAAO,iBAAiB;CAC5B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
|
|
6
|
+
//#region src/dev-logs.ts
|
|
7
|
+
function getBosDir(configDir) {
|
|
8
|
+
return (0, node_path.join)(configDir, ".bos");
|
|
9
|
+
}
|
|
10
|
+
function getLogsDir(configDir) {
|
|
11
|
+
return (0, node_path.join)(getBosDir(configDir), "logs");
|
|
12
|
+
}
|
|
13
|
+
function formatLogLine(entry) {
|
|
14
|
+
const ts = new Date(entry.timestamp).toISOString();
|
|
15
|
+
const prefix = entry.isError ? "ERR" : "OUT";
|
|
16
|
+
return `[${ts}] [${entry.source}] [${prefix}] ${entry.line}`;
|
|
17
|
+
}
|
|
18
|
+
async function createDevLogger(configDir, description) {
|
|
19
|
+
const dir = getLogsDir(configDir);
|
|
20
|
+
if (!(0, node_fs.existsSync)(dir)) await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
21
|
+
const now = /* @__PURE__ */ new Date();
|
|
22
|
+
const logFile = (0, node_path.join)(dir, `dev-${now.toISOString().replace(/[:.]/g, "-").slice(0, 19)}.log`);
|
|
23
|
+
const latestFile = (0, node_path.join)(dir, "dev-latest.log");
|
|
24
|
+
const header = `# everything-dev dev session: ${description}\n# Started: ${now.toISOString()}\n\n`;
|
|
25
|
+
await (0, node_fs_promises.writeFile)(logFile, header, "utf8");
|
|
26
|
+
await (0, node_fs_promises.writeFile)(latestFile, header, "utf8");
|
|
27
|
+
let chain = Promise.resolve();
|
|
28
|
+
const enqueue = (fn) => {
|
|
29
|
+
chain = chain.then(fn, fn);
|
|
30
|
+
return chain;
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
logFile,
|
|
34
|
+
latestFile,
|
|
35
|
+
write: (entry) => enqueue(async () => {
|
|
36
|
+
const line = `${formatLogLine(entry)}\n`;
|
|
37
|
+
await (0, node_fs_promises.appendFile)(logFile, line);
|
|
38
|
+
await (0, node_fs_promises.appendFile)(latestFile, line);
|
|
39
|
+
}),
|
|
40
|
+
readLatest: async (opts) => {
|
|
41
|
+
const text = await (0, node_fs_promises.readFile)(latestFile, "utf8").catch(() => "");
|
|
42
|
+
const tail = opts?.tail;
|
|
43
|
+
if (!tail || tail <= 0) return text;
|
|
44
|
+
const lines = text.split("\n");
|
|
45
|
+
return lines.slice(Math.max(0, lines.length - tail)).join("\n");
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.createDevLogger = createDevLogger;
|
|
52
|
+
exports.getBosDir = getBosDir;
|
|
53
|
+
//# sourceMappingURL=dev-logs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-logs.cjs","names":[],"sources":["../src/dev-logs.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { appendFile, mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport interface LogEntry {\n timestamp: number;\n source: string;\n line: string;\n isError?: boolean;\n}\n\nexport interface DevLogger {\n logFile: string;\n latestFile: string;\n write: (entry: LogEntry) => Promise<void>;\n readLatest: (opts?: { tail?: number }) => Promise<string>;\n}\n\nexport function getBosDir(configDir: string): string {\n return join(configDir, \".bos\");\n}\n\nexport function getLogsDir(configDir: string): string {\n return join(getBosDir(configDir), \"logs\");\n}\n\nfunction formatLogLine(entry: LogEntry): string {\n const ts = new Date(entry.timestamp).toISOString();\n const prefix = entry.isError ? \"ERR\" : \"OUT\";\n return `[${ts}] [${entry.source}] [${prefix}] ${entry.line}`;\n}\n\nexport async function createDevLogger(configDir: string, description: string): Promise<DevLogger> {\n const dir = getLogsDir(configDir);\n if (!existsSync(dir)) {\n await mkdir(dir, { recursive: true });\n }\n\n const now = new Date();\n const ts = now.toISOString().replace(/[:.]/g, \"-\").slice(0, 19);\n const logFile = join(dir, `dev-${ts}.log`);\n const latestFile = join(dir, \"dev-latest.log\");\n\n const header =\n `# everything-dev dev session: ${description}\\n` + `# Started: ${now.toISOString()}\\n\\n`;\n // Overwrite each run so dev-latest.log is always actionable.\n await writeFile(logFile, header, \"utf8\");\n await writeFile(latestFile, header, \"utf8\");\n\n let chain = Promise.resolve();\n const enqueue = (fn: () => Promise<void>) => {\n chain = chain.then(fn, fn);\n return chain;\n };\n\n return {\n logFile,\n latestFile,\n write: (entry) =>\n enqueue(async () => {\n const line = `${formatLogLine(entry)}\\n`;\n await appendFile(logFile, line);\n await appendFile(latestFile, line);\n }),\n readLatest: async (opts) => {\n const text = await readFile(latestFile, \"utf8\").catch(() => \"\");\n const tail = opts?.tail;\n if (!tail || tail <= 0) return text;\n const lines = text.split(\"\\n\");\n return lines.slice(Math.max(0, lines.length - tail)).join(\"\\n\");\n },\n };\n}\n\nexport async function readDevLatestLog(\n configDir: string,\n opts?: { tail?: number },\n): Promise<string> {\n const latestFile = join(getLogsDir(configDir), \"dev-latest.log\");\n const text = await readFile(latestFile, \"utf8\").catch(() => \"\");\n const tail = opts?.tail;\n if (!tail || tail <= 0) return text;\n const lines = text.split(\"\\n\");\n return lines.slice(Math.max(0, lines.length - tail)).join(\"\\n\");\n}\n"],"mappings":";;;;;;AAkBA,SAAgB,UAAU,WAA2B;AACnD,4BAAY,WAAW,OAAO;;AAGhC,SAAgB,WAAW,WAA2B;AACpD,4BAAY,UAAU,UAAU,EAAE,OAAO;;AAG3C,SAAS,cAAc,OAAyB;CAC9C,MAAM,KAAK,IAAI,KAAK,MAAM,UAAU,CAAC,aAAa;CAClD,MAAM,SAAS,MAAM,UAAU,QAAQ;AACvC,QAAO,IAAI,GAAG,KAAK,MAAM,OAAO,KAAK,OAAO,IAAI,MAAM;;AAGxD,eAAsB,gBAAgB,WAAmB,aAAyC;CAChG,MAAM,MAAM,WAAW,UAAU;AACjC,KAAI,yBAAY,IAAI,CAClB,mCAAY,KAAK,EAAE,WAAW,MAAM,CAAC;CAGvC,MAAM,sBAAM,IAAI,MAAM;CAEtB,MAAM,8BAAe,KAAK,OADf,IAAI,aAAa,CAAC,QAAQ,SAAS,IAAI,CAAC,MAAM,GAAG,GAAG,CAC3B,MAAM;CAC1C,MAAM,iCAAkB,KAAK,iBAAiB;CAE9C,MAAM,SACJ,iCAAiC,YAAY,eAAoB,IAAI,aAAa,CAAC;AAErF,uCAAgB,SAAS,QAAQ,OAAO;AACxC,uCAAgB,YAAY,QAAQ,OAAO;CAE3C,IAAI,QAAQ,QAAQ,SAAS;CAC7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