@melra/cli 0.3.0-alpha.3
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 +202 -0
- package/README.md +13 -0
- package/dist/environment.d.ts +15 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +73 -0
- package/dist/environment.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +433 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# MELRA CLI
|
|
2
|
+
|
|
3
|
+
Install and initialize:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install --global @melra/cli
|
|
7
|
+
melra doctor
|
|
8
|
+
melra init --client generic
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The CLI starts with a local policy that allows reads outright and gates every
|
|
12
|
+
mutation: a consequential operation requires declared evidence and an exact,
|
|
13
|
+
task-scoped approval phrase before it runs.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CliEnvironment {
|
|
2
|
+
workspaceRoot: string;
|
|
3
|
+
dataDirectory: string;
|
|
4
|
+
policyPath?: string;
|
|
5
|
+
browserExecutablePath?: string;
|
|
6
|
+
browserCdpEndpoint?: string;
|
|
7
|
+
browserCdpContextIndex?: number;
|
|
8
|
+
browserHarPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CliEnvironmentDefaults {
|
|
11
|
+
cwd: string;
|
|
12
|
+
home: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseCliEnvironment(source: NodeJS.ProcessEnv, defaults?: CliEnvironmentDefaults): CliEnvironment;
|
|
15
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AA0CD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,QAAQ,GAAE,sBAGT,GACA,cAAc,CA+BhB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright 2026 XAGI Labs Private Limited
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
5
|
+
function cdpEndpoint(value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
let parsed;
|
|
9
|
+
try {
|
|
10
|
+
parsed = new URL(value);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
throw new Error("browser_cdp_endpoint_invalid");
|
|
14
|
+
}
|
|
15
|
+
if (!["http:", "https:"].includes(parsed.protocol) ||
|
|
16
|
+
parsed.username !== "" ||
|
|
17
|
+
parsed.password !== "" ||
|
|
18
|
+
parsed.search !== "" ||
|
|
19
|
+
parsed.hash !== "") {
|
|
20
|
+
throw new Error("browser_cdp_endpoint_invalid");
|
|
21
|
+
}
|
|
22
|
+
return parsed.href;
|
|
23
|
+
}
|
|
24
|
+
function cdpContextIndex(value) {
|
|
25
|
+
if (value === undefined)
|
|
26
|
+
return undefined;
|
|
27
|
+
if (!/^-?\d+$/.test(value)) {
|
|
28
|
+
throw new Error("browser_cdp_context_index_invalid");
|
|
29
|
+
}
|
|
30
|
+
const parsed = Number(value);
|
|
31
|
+
if (!Number.isSafeInteger(parsed) || parsed < -1) {
|
|
32
|
+
throw new Error("browser_cdp_context_index_invalid");
|
|
33
|
+
}
|
|
34
|
+
return parsed;
|
|
35
|
+
}
|
|
36
|
+
function harPath(value) {
|
|
37
|
+
if (value === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
if (!isAbsolute(value)) {
|
|
40
|
+
throw new Error("browser_har_path_must_be_absolute");
|
|
41
|
+
}
|
|
42
|
+
return resolve(value);
|
|
43
|
+
}
|
|
44
|
+
export function parseCliEnvironment(source, defaults = {
|
|
45
|
+
cwd: process.cwd(),
|
|
46
|
+
home: homedir(),
|
|
47
|
+
}) {
|
|
48
|
+
const endpoint = cdpEndpoint(source.MELRA_BROWSER_CDP_ENDPOINT);
|
|
49
|
+
const contextIndex = cdpContextIndex(source.MELRA_BROWSER_CDP_CONTEXT_INDEX);
|
|
50
|
+
const recordHarPath = harPath(source.MELRA_BROWSER_HAR_PATH);
|
|
51
|
+
if (endpoint !== undefined && recordHarPath !== undefined) {
|
|
52
|
+
throw new Error("browser_cdp_cannot_start_har_recording");
|
|
53
|
+
}
|
|
54
|
+
if (contextIndex !== undefined && endpoint === undefined) {
|
|
55
|
+
throw new Error("browser_cdp_context_requires_endpoint");
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
workspaceRoot: resolve(source.MELRA_WORKSPACE ?? defaults.cwd),
|
|
59
|
+
dataDirectory: resolve(source.MELRA_HOME ?? join(defaults.home, ".melra")),
|
|
60
|
+
...(source.MELRA_POLICY === undefined
|
|
61
|
+
? {}
|
|
62
|
+
: { policyPath: resolve(source.MELRA_POLICY) }),
|
|
63
|
+
...(source.MELRA_BROWSER === undefined
|
|
64
|
+
? {}
|
|
65
|
+
: { browserExecutablePath: resolve(source.MELRA_BROWSER) }),
|
|
66
|
+
...(endpoint === undefined ? {} : { browserCdpEndpoint: endpoint }),
|
|
67
|
+
...(contextIndex === undefined
|
|
68
|
+
? {}
|
|
69
|
+
: { browserCdpContextIndex: contextIndex }),
|
|
70
|
+
...(recordHarPath === undefined ? {} : { browserHarPath: recordHarPath }),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBtD,SAAS,WAAW,CAAC,KAAyB;IAC5C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,IACE,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC9C,MAAM,CAAC,QAAQ,KAAK,EAAE;QACtB,MAAM,CAAC,QAAQ,KAAK,EAAE;QACtB,MAAM,CAAC,MAAM,KAAK,EAAE;QACpB,MA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":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 XAGI Labs Private Limited
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
|
+
import { constants } from "node:fs";
|
|
6
|
+
import { basename, join, resolve } from "node:path";
|
|
7
|
+
import { createInterface } from "node:readline/promises";
|
|
8
|
+
import { DatabaseSync } from "node:sqlite";
|
|
9
|
+
import { ApprovalResponseSchema, TaskRequestSchema, WorkflowDefinitionSchema, PRODUCT_VERSION, } from "@melra/protocol";
|
|
10
|
+
import { createMelraRuntime, serveStdio, } from "@melra/server";
|
|
11
|
+
import { detectBrowserExecutable } from "@melra/browser-runtime";
|
|
12
|
+
import { createSystemComputerAdapter } from "@melra/computer-runtime";
|
|
13
|
+
import { createDefaultPolicy, evaluatePolicy } from "@melra/policy-core";
|
|
14
|
+
import { parseCliEnvironment, } from "./environment.js";
|
|
15
|
+
async function existingPolicyPath(env) {
|
|
16
|
+
if (env.policyPath !== undefined)
|
|
17
|
+
return env.policyPath;
|
|
18
|
+
const candidate = join(env.dataDirectory, "policy.json");
|
|
19
|
+
try {
|
|
20
|
+
await access(candidate, constants.R_OK);
|
|
21
|
+
return candidate;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function runtime(env) {
|
|
28
|
+
const policyPath = await existingPolicyPath(env);
|
|
29
|
+
return await createMelraRuntime({
|
|
30
|
+
workspaceRoot: env.workspaceRoot,
|
|
31
|
+
dataDirectory: env.dataDirectory,
|
|
32
|
+
...(policyPath === undefined ? {} : { policyPath }),
|
|
33
|
+
...(env.browserExecutablePath === undefined
|
|
34
|
+
? {}
|
|
35
|
+
: { browserExecutablePath: env.browserExecutablePath }),
|
|
36
|
+
...(env.browserCdpEndpoint === undefined
|
|
37
|
+
? {}
|
|
38
|
+
: { browserCdpEndpoint: env.browserCdpEndpoint }),
|
|
39
|
+
...(env.browserCdpContextIndex === undefined
|
|
40
|
+
? {}
|
|
41
|
+
: { browserCdpContextIndex: env.browserCdpContextIndex }),
|
|
42
|
+
...(env.browserHarPath === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: { browserHarPath: env.browserHarPath }),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function output(value) {
|
|
48
|
+
process.stdout.write(`${JSON.stringify(value, null, 2)}\n`);
|
|
49
|
+
}
|
|
50
|
+
function argument(name, args) {
|
|
51
|
+
const index = args.indexOf(name);
|
|
52
|
+
return index < 0 ? undefined : args[index + 1];
|
|
53
|
+
}
|
|
54
|
+
async function readTaskRequest(args) {
|
|
55
|
+
const requestPath = argument("--request", args);
|
|
56
|
+
if (requestPath !== undefined) {
|
|
57
|
+
return TaskRequestSchema.parse(JSON.parse(await readFile(resolve(requestPath), "utf8")));
|
|
58
|
+
}
|
|
59
|
+
if (!process.stdin.isTTY) {
|
|
60
|
+
let input = "";
|
|
61
|
+
for await (const chunk of process.stdin)
|
|
62
|
+
input += String(chunk);
|
|
63
|
+
return TaskRequestSchema.parse(JSON.parse(input));
|
|
64
|
+
}
|
|
65
|
+
throw new Error("provide --request <file> or pipe a JSON task request");
|
|
66
|
+
}
|
|
67
|
+
async function readWorkflowDefinition(args) {
|
|
68
|
+
const definitionPath = argument("--definition", args);
|
|
69
|
+
if (definitionPath === undefined) {
|
|
70
|
+
throw new Error("workflow plan requires --definition <file>");
|
|
71
|
+
}
|
|
72
|
+
return WorkflowDefinitionSchema.parse(JSON.parse(await readFile(resolve(definitionPath), "utf8")));
|
|
73
|
+
}
|
|
74
|
+
function workflowExitCode(status) {
|
|
75
|
+
if (status === "awaiting_approval")
|
|
76
|
+
return 3;
|
|
77
|
+
if ([
|
|
78
|
+
"failed",
|
|
79
|
+
"partially_complete",
|
|
80
|
+
"cancelled",
|
|
81
|
+
"recovery_required",
|
|
82
|
+
].includes(status)) {
|
|
83
|
+
return 2;
|
|
84
|
+
}
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
function workflowApprovals(args) {
|
|
88
|
+
const approvals = [];
|
|
89
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
90
|
+
if (args[index] !== "--approval")
|
|
91
|
+
continue;
|
|
92
|
+
const value = args[index + 1];
|
|
93
|
+
if (value === undefined)
|
|
94
|
+
throw new Error("--approval requires a value");
|
|
95
|
+
const separator = value.indexOf(":");
|
|
96
|
+
if (separator < 1 || separator === value.length - 1) {
|
|
97
|
+
throw new Error("--approval must be <approval-id>:<exact-phrase>");
|
|
98
|
+
}
|
|
99
|
+
approvals.push(ApprovalResponseSchema.parse({
|
|
100
|
+
approvalId: value.slice(0, separator),
|
|
101
|
+
phrase: value.slice(separator + 1),
|
|
102
|
+
}));
|
|
103
|
+
index += 1;
|
|
104
|
+
}
|
|
105
|
+
return approvals;
|
|
106
|
+
}
|
|
107
|
+
async function workflowCommand(args, env) {
|
|
108
|
+
const [action, ...actionArgs] = args;
|
|
109
|
+
const melra = await runtime(env);
|
|
110
|
+
try {
|
|
111
|
+
switch (action) {
|
|
112
|
+
case "plan": {
|
|
113
|
+
const run = melra.workflows.plan(await readWorkflowDefinition(actionArgs));
|
|
114
|
+
output(run);
|
|
115
|
+
return workflowExitCode(run.status);
|
|
116
|
+
}
|
|
117
|
+
case "advance": {
|
|
118
|
+
const workflowId = actionArgs[0];
|
|
119
|
+
if (workflowId === undefined) {
|
|
120
|
+
throw new Error("workflow advance requires a workflow ID");
|
|
121
|
+
}
|
|
122
|
+
const result = await melra.workflows.advance(workflowId, workflowApprovals(actionArgs.slice(1)));
|
|
123
|
+
output(result);
|
|
124
|
+
return workflowExitCode(result.run.status);
|
|
125
|
+
}
|
|
126
|
+
case "inspect": {
|
|
127
|
+
const workflowId = actionArgs[0];
|
|
128
|
+
if (workflowId === undefined) {
|
|
129
|
+
throw new Error("workflow inspect requires a workflow ID");
|
|
130
|
+
}
|
|
131
|
+
output(melra.workflows.status(workflowId));
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
case "cancel": {
|
|
135
|
+
const workflowId = actionArgs[0];
|
|
136
|
+
if (workflowId === undefined) {
|
|
137
|
+
throw new Error("workflow cancel requires a workflow ID");
|
|
138
|
+
}
|
|
139
|
+
const run = melra.workflows.cancel(workflowId);
|
|
140
|
+
output(run);
|
|
141
|
+
return workflowExitCode(run.status);
|
|
142
|
+
}
|
|
143
|
+
default:
|
|
144
|
+
throw new Error("workflow supports plan, advance, inspect, and cancel");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
await melra.close();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async function durableCoreDemo(env) {
|
|
152
|
+
const examplePath = resolve(import.meta.dirname, "../../../examples/workflows/restart-safe.json");
|
|
153
|
+
const melra = await runtime(env);
|
|
154
|
+
try {
|
|
155
|
+
const definition = WorkflowDefinitionSchema.parse(JSON.parse(await readFile(examplePath, "utf8")));
|
|
156
|
+
const planned = melra.workflows.plan(definition);
|
|
157
|
+
const advanced = await melra.workflows.advance(planned.id);
|
|
158
|
+
output({
|
|
159
|
+
examplePath,
|
|
160
|
+
workflow: advanced.run,
|
|
161
|
+
next: advanced.run.status === "verified_complete"
|
|
162
|
+
? "complete"
|
|
163
|
+
: `melra workflow advance ${planned.id}`,
|
|
164
|
+
});
|
|
165
|
+
return workflowExitCode(advanced.run.status);
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
await melra.close();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function doctor(env) {
|
|
172
|
+
const checks = [];
|
|
173
|
+
const major = Number(process.versions.node.split(".")[0]);
|
|
174
|
+
checks.push({
|
|
175
|
+
name: "node",
|
|
176
|
+
status: major >= 22 ? "pass" : "fail",
|
|
177
|
+
detail: process.version,
|
|
178
|
+
});
|
|
179
|
+
try {
|
|
180
|
+
await access(env.workspaceRoot, constants.R_OK | constants.W_OK);
|
|
181
|
+
checks.push({
|
|
182
|
+
name: "workspace",
|
|
183
|
+
status: "pass",
|
|
184
|
+
detail: env.workspaceRoot,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
checks.push({
|
|
189
|
+
name: "workspace",
|
|
190
|
+
status: "fail",
|
|
191
|
+
detail: `not readable and writable: ${env.workspaceRoot}`,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
await mkdir(env.dataDirectory, { recursive: true });
|
|
196
|
+
await access(env.dataDirectory, constants.R_OK | constants.W_OK);
|
|
197
|
+
checks.push({
|
|
198
|
+
name: "data-directory",
|
|
199
|
+
status: "pass",
|
|
200
|
+
detail: env.dataDirectory,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
checks.push({
|
|
205
|
+
name: "data-directory",
|
|
206
|
+
status: "fail",
|
|
207
|
+
detail: env.dataDirectory,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const database = new DatabaseSync(":memory:");
|
|
212
|
+
database.exec("CREATE TABLE readiness(value TEXT)");
|
|
213
|
+
database.close();
|
|
214
|
+
checks.push({ name: "sqlite", status: "pass", detail: "node:sqlite available" });
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
checks.push({
|
|
218
|
+
name: "sqlite",
|
|
219
|
+
status: "fail",
|
|
220
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
const browser = env.browserExecutablePath ?? (await detectBrowserExecutable());
|
|
224
|
+
checks.push({
|
|
225
|
+
name: "browser",
|
|
226
|
+
status: browser === undefined ? "warn" : "pass",
|
|
227
|
+
detail: browser ??
|
|
228
|
+
"Chrome, Chromium, or Edge not found; non-browser capabilities remain available",
|
|
229
|
+
});
|
|
230
|
+
const computer = await createSystemComputerAdapter().capabilities();
|
|
231
|
+
checks.push({
|
|
232
|
+
name: "computer",
|
|
233
|
+
status: computer.available ? "pass" : "warn",
|
|
234
|
+
detail: computer.available
|
|
235
|
+
? `${computer.adapter}: screenshot=${computer.screenshot}, pointer=${computer.pointer}, keyboard=${computer.keyboard}, scroll=${computer.scroll}`
|
|
236
|
+
: computer.limitations.join("; "),
|
|
237
|
+
});
|
|
238
|
+
try {
|
|
239
|
+
const path = await existingPolicyPath(env);
|
|
240
|
+
if (path !== undefined)
|
|
241
|
+
JSON.parse(await readFile(path, "utf8"));
|
|
242
|
+
checks.push({
|
|
243
|
+
name: "policy",
|
|
244
|
+
status: "pass",
|
|
245
|
+
detail: path ?? "using safe built-in defaults",
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
checks.push({
|
|
250
|
+
name: "policy",
|
|
251
|
+
status: "fail",
|
|
252
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
output({
|
|
256
|
+
product: "MELRA",
|
|
257
|
+
version: PRODUCT_VERSION,
|
|
258
|
+
ready: !checks.some((check) => check.status === "fail"),
|
|
259
|
+
checks,
|
|
260
|
+
});
|
|
261
|
+
return checks.some((check) => check.status === "fail") ? 1 : 0;
|
|
262
|
+
}
|
|
263
|
+
async function init(args, env) {
|
|
264
|
+
await mkdir(env.dataDirectory, { recursive: true });
|
|
265
|
+
const policyPath = join(env.dataDirectory, "policy.json");
|
|
266
|
+
try {
|
|
267
|
+
await access(policyPath, constants.F_OK);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
await writeFile(policyPath, `${JSON.stringify(createDefaultPolicy(env.workspaceRoot), null, 2)}\n`, { flag: "wx" });
|
|
271
|
+
}
|
|
272
|
+
const client = argument("--client", args) ?? "generic";
|
|
273
|
+
const config = {
|
|
274
|
+
mcpServers: {
|
|
275
|
+
melra: {
|
|
276
|
+
command: "melra",
|
|
277
|
+
args: ["serve"],
|
|
278
|
+
env: {
|
|
279
|
+
MELRA_WORKSPACE: env.workspaceRoot,
|
|
280
|
+
MELRA_HOME: env.dataDirectory,
|
|
281
|
+
MELRA_POLICY: policyPath,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
output({
|
|
287
|
+
initialized: true,
|
|
288
|
+
client,
|
|
289
|
+
policyPath,
|
|
290
|
+
config,
|
|
291
|
+
note: `Add the mcpServers.melra entry to ${client}'s MCP configuration.`,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
async function runTask(args, env) {
|
|
295
|
+
const melra = await runtime(env);
|
|
296
|
+
try {
|
|
297
|
+
const task = melra.controller.plan(await readTaskRequest(args));
|
|
298
|
+
if (task.status === "policy_blocked") {
|
|
299
|
+
output({ task });
|
|
300
|
+
return 4;
|
|
301
|
+
}
|
|
302
|
+
if (task.status === "awaiting_approval") {
|
|
303
|
+
if (!process.stdin.isTTY) {
|
|
304
|
+
output({ task, next: "rerun interactively to approve this scoped action" });
|
|
305
|
+
return 3;
|
|
306
|
+
}
|
|
307
|
+
const prompt = createInterface({ input: process.stdin, output: process.stderr });
|
|
308
|
+
const phrase = await prompt.question(`Type the exact approval phrase '${task.approval.phrase}' to continue: `);
|
|
309
|
+
prompt.close();
|
|
310
|
+
const execution = await melra.controller.execute(task.id, {
|
|
311
|
+
approvalId: task.approval.approvalId,
|
|
312
|
+
phrase,
|
|
313
|
+
});
|
|
314
|
+
output(execution);
|
|
315
|
+
return execution.task.status === "verified_success" ? 0 : 2;
|
|
316
|
+
}
|
|
317
|
+
const execution = await melra.controller.execute(task.id);
|
|
318
|
+
output(execution);
|
|
319
|
+
return execution.task.status === "verified_success" ? 0 : 2;
|
|
320
|
+
}
|
|
321
|
+
finally {
|
|
322
|
+
await melra.close();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
async function inspectTask(args, env) {
|
|
326
|
+
const taskId = args[0];
|
|
327
|
+
if (taskId === undefined)
|
|
328
|
+
throw new Error("inspect requires a task ID");
|
|
329
|
+
const melra = await runtime(env);
|
|
330
|
+
try {
|
|
331
|
+
output({
|
|
332
|
+
task: melra.controller.status(taskId),
|
|
333
|
+
...melra.controller.receipts({ taskId }),
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
finally {
|
|
337
|
+
await melra.close();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
async function policyTest(args, env) {
|
|
341
|
+
const request = await readTaskRequest(args);
|
|
342
|
+
const policy = createDefaultPolicy(env.workspaceRoot);
|
|
343
|
+
const taskId = "00000000-0000-4000-8000-000000000000";
|
|
344
|
+
output(evaluatePolicy(taskId, request, policy));
|
|
345
|
+
}
|
|
346
|
+
function help() {
|
|
347
|
+
process.stdout.write(`MELRA ${PRODUCT_VERSION}
|
|
348
|
+
|
|
349
|
+
Usage:
|
|
350
|
+
melra doctor
|
|
351
|
+
melra init --client <claude|cursor|vscode|codex|generic>
|
|
352
|
+
melra serve
|
|
353
|
+
melra run --request <task.json>
|
|
354
|
+
melra inspect <task-id>
|
|
355
|
+
melra workflow plan --definition <workflow.json>
|
|
356
|
+
melra workflow advance <workflow-id> [--approval <id>:<exact-phrase>]
|
|
357
|
+
melra workflow inspect <workflow-id>
|
|
358
|
+
melra workflow cancel <workflow-id>
|
|
359
|
+
melra demo durable-core
|
|
360
|
+
melra policy test --request <task.json>
|
|
361
|
+
melra version
|
|
362
|
+
|
|
363
|
+
Environment:
|
|
364
|
+
MELRA_WORKSPACE Workspace boundary (default: current directory)
|
|
365
|
+
MELRA_HOME Local database and artifact directory
|
|
366
|
+
MELRA_POLICY Optional local policy JSON
|
|
367
|
+
MELRA_BROWSER Optional Chrome/Chromium/Edge executable
|
|
368
|
+
MELRA_BROWSER_CDP_ENDPOINT Optional HTTP(S) CDP endpoint
|
|
369
|
+
MELRA_BROWSER_CDP_CONTEXT_INDEX External context index (-1 is last)
|
|
370
|
+
MELRA_BROWSER_HAR_PATH Absolute HAR output path
|
|
371
|
+
`);
|
|
372
|
+
}
|
|
373
|
+
async function main() {
|
|
374
|
+
const [command = "help", ...args] = process.argv.slice(2);
|
|
375
|
+
const env = parseCliEnvironment(process.env);
|
|
376
|
+
switch (command) {
|
|
377
|
+
case "doctor":
|
|
378
|
+
process.exitCode = await doctor(env);
|
|
379
|
+
return;
|
|
380
|
+
case "init":
|
|
381
|
+
await init(args, env);
|
|
382
|
+
return;
|
|
383
|
+
case "serve": {
|
|
384
|
+
const melra = await runtime(env);
|
|
385
|
+
const server = await serveStdio(melra);
|
|
386
|
+
const close = async () => {
|
|
387
|
+
await server.close();
|
|
388
|
+
await melra.close();
|
|
389
|
+
};
|
|
390
|
+
process.once("SIGINT", () => void close().finally(() => process.exit(0)));
|
|
391
|
+
process.once("SIGTERM", () => void close().finally(() => process.exit(0)));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
case "run":
|
|
395
|
+
process.exitCode = await runTask(args, env);
|
|
396
|
+
return;
|
|
397
|
+
case "inspect":
|
|
398
|
+
case "export":
|
|
399
|
+
await inspectTask(args, env);
|
|
400
|
+
return;
|
|
401
|
+
case "workflow":
|
|
402
|
+
process.exitCode = await workflowCommand(args, env);
|
|
403
|
+
return;
|
|
404
|
+
case "demo":
|
|
405
|
+
if (args[0] !== "durable-core") {
|
|
406
|
+
throw new Error("demo supports only 'durable-core'");
|
|
407
|
+
}
|
|
408
|
+
process.exitCode = await durableCoreDemo(env);
|
|
409
|
+
return;
|
|
410
|
+
case "policy":
|
|
411
|
+
if (args[0] !== "test")
|
|
412
|
+
throw new Error("policy supports only 'test'");
|
|
413
|
+
await policyTest(args.slice(1), env);
|
|
414
|
+
return;
|
|
415
|
+
case "version":
|
|
416
|
+
case "--version":
|
|
417
|
+
case "-v":
|
|
418
|
+
process.stdout.write(`${PRODUCT_VERSION}\n`);
|
|
419
|
+
return;
|
|
420
|
+
case "help":
|
|
421
|
+
case "--help":
|
|
422
|
+
case "-h":
|
|
423
|
+
help();
|
|
424
|
+
return;
|
|
425
|
+
default:
|
|
426
|
+
throw new Error(`unknown command: ${basename(command)}`);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
main().catch((error) => {
|
|
430
|
+
process.stderr.write(`melra: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
431
|
+
process.exitCode = 1;
|
|
432
|
+
});
|
|
433
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,2CAA2C;AAC3C,sCAAsC;AAEtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,GAKhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,UAAU,GAEX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAEL,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,UAAU,kBAAkB,CAAC,GAAmB;IACnD,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,UAAU,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,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vB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@melra/cli",
|
|
3
|
+
"version": "0.3.0-alpha.3",
|
|
4
|
+
"description": "MELRA local execution runtime and command-line interface.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/XAGI-Lab/melra.git",
|
|
9
|
+
"directory": "apps/cli"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/XAGI-Lab/melra#readme",
|
|
12
|
+
"bugs": "https://github.com/XAGI-Lab/melra/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"bin": {
|
|
15
|
+
"melra": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@melra/browser-runtime": "0.3.0-alpha.3",
|
|
29
|
+
"@melra/computer-runtime": "0.3.0-alpha.3",
|
|
30
|
+
"@melra/policy-core": "0.3.0-alpha.3",
|
|
31
|
+
"@melra/server": "0.3.0-alpha.3",
|
|
32
|
+
"@melra/protocol": "0.3.0-alpha.3",
|
|
33
|
+
"@melra/storage-sqlite": "0.3.0-alpha.3"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc -p tsconfig.json && chmod +x dist/index.js",
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"dev": "tsx src/index.ts",
|
|
39
|
+
"start": "tsx src/index.ts",
|
|
40
|
+
"pack:check": "npm pack --dry-run",
|
|
41
|
+
"test": "vitest run --testTimeout=20000",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
43
|
+
}
|
|
44
|
+
}
|