@claudexor/harness-opencode 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 joi-lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @claudexor/harness-opencode
2
+
3
+ Internal package of [Claudexor](https://github.com/razzant/claudexor) — OpenCode adapter (opencode run --format json).
4
+
5
+ Published as part of the Claudexor toolchain; it follows the monorepo's
6
+ lockstep version and has no separate semver contract. Use the `claudexor`
7
+ CLI (or `@claudexor/cli`) as the supported entry point.
@@ -0,0 +1,3 @@
1
+ import type { HarnessAdapter } from "@claudexor/core";
2
+ export declare function createOpenCodeAdapter(): HarnessAdapter;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA0DlE,wBAAgB,qBAAqB,IAAI,cAAc,CAkGtD"}
package/dist/index.js ADDED
@@ -0,0 +1,194 @@
1
+ import { ConformanceReport as ConformanceReportSchema, HarnessManifest as HarnessManifestSchema } from "@claudexor/schema";
2
+ import { HarnessUnavailableError, providerScrubEnv, runCapture, runCliHarness } from "@claudexor/core";
3
+ import { resolveSecret } from "@claudexor/secrets";
4
+ import { CLAUDEXOR_VERSION, redactSecrets } from "@claudexor/util";
5
+ import { parseOpenCodeEvent } from "./parse.js";
6
+ const BIN = process.env.CLAUDEXOR_OPENCODE_BIN || "opencode";
7
+ function accessArgs(access) {
8
+ switch (access) {
9
+ case "full":
10
+ case "external_sandbox_full":
11
+ return ["--dangerously-skip-permissions"];
12
+ case "readonly":
13
+ case "inherit_native":
14
+ return [];
15
+ case "workspace_write":
16
+ // Unreachable: runOpenCode rejects workspace_write up front (no proven
17
+ // scoped confinement). Returning the full-access flag here would silently
18
+ // upgrade the access, so refuse loudly instead.
19
+ throw new HarnessUnavailableError("opencode workspace_write has no conformance-proven scoped confinement; this profile is rejected before run");
20
+ }
21
+ }
22
+ async function detectVersion() {
23
+ try {
24
+ const r = await runCapture(BIN, ["--version"], { timeoutMs: 10_000 });
25
+ return r.stdout.trim() || `${BIN} (version unknown)`;
26
+ }
27
+ catch {
28
+ return null;
29
+ }
30
+ }
31
+ const PROVIDER_KEY_ENV = ["OPENCODE_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY"];
32
+ function providerKey(env = process.env) {
33
+ for (const envVar of PROVIDER_KEY_ENV) {
34
+ if (env[envVar])
35
+ return { envVar, value: env[envVar] };
36
+ }
37
+ // Resolve each stored candidate once (the store may spawn a keychain read
38
+ // per call); the hermetic kill switch is honored inside resolveSecret.
39
+ for (const [name, envVar] of [
40
+ ["opencode", "OPENCODE_API_KEY"],
41
+ ["openai", "OPENAI_API_KEY"],
42
+ ["anthropic", "ANTHROPIC_API_KEY"],
43
+ ]) {
44
+ const value = resolveSecret(name);
45
+ if (value)
46
+ return { envVar, value };
47
+ }
48
+ return null;
49
+ }
50
+ function providerKeyAvailable() {
51
+ return providerKey() !== null;
52
+ }
53
+ export function createOpenCodeAdapter() {
54
+ return {
55
+ id: "opencode",
56
+ async discover() {
57
+ const version = await detectVersion();
58
+ if (version === null) {
59
+ throw new HarnessUnavailableError("opencode not found on PATH (set CLAUDEXOR_OPENCODE_BIN)");
60
+ }
61
+ const authReady = providerKeyAvailable();
62
+ return HarnessManifestSchema.parse({
63
+ id: "opencode",
64
+ display_name: "OpenCode",
65
+ kind: "local_cli",
66
+ version,
67
+ adapter_version: CLAUDEXOR_VERSION,
68
+ provider_family: "opencode",
69
+ capabilities: {
70
+ // Capabilities are ABILITIES; auth readiness lives in auth_modes and
71
+ // doctor. opencode can draft plans whenever it can run at all.
72
+ plan: true,
73
+ implement: true,
74
+ create_from_scratch: true,
75
+ review: true,
76
+ verify: true,
77
+ synthesize: true,
78
+ read_files: true,
79
+ // No browser-MCP injection path exists for opencode yet —
80
+ // honest false until that path exists + is verified.
81
+ browser_tool: false,
82
+ web_policy: "uncontrolled",
83
+ // opencode exposes no reasoning-effort flag -> effort is not tunable.
84
+ effort_levels: [],
85
+ },
86
+ capability_profile: {
87
+ auth: {
88
+ supported_sources: ["api_key_env"],
89
+ preferred_source: authReady ? "api_key_env" : null,
90
+ credential_transports: [{ source: "api_key_env", kind: "env_var", relocatable_by: ["ENV"] }],
91
+ },
92
+ // HONEST access surface: the only permission flag the adapter drives
93
+ // is `--dangerously-skip-permissions` (full access), so there is no
94
+ // scoped readonly mechanism to declare (see access_profiles below).
95
+ access_control: { readonly_mechanism: "none" },
96
+ isolation: { supported_containment: ["env_or_file_injection"] },
97
+ // No proven headless image input surface — attach is gated off until verified.
98
+ image_input: "none",
99
+ },
100
+ auth_modes: authReady ? ["api_key"] : [],
101
+ access_profiles_supported: ["full", "inherit_native"],
102
+ });
103
+ },
104
+ async doctor(_spec) {
105
+ const version = await detectVersion();
106
+ if (version === null) {
107
+ return ConformanceReportSchema.parse({
108
+ harness_id: "opencode",
109
+ status: "unavailable",
110
+ checks: [{ id: "installed", status: "fail", detail: "opencode not found" }],
111
+ reasons: ["opencode not found (install OpenCode or set CLAUDEXOR_OPENCODE_BIN)"],
112
+ });
113
+ }
114
+ const authReady = providerKeyAvailable();
115
+ // A key STRING is source availability, not readiness: without an isolated
116
+ // smoke proving the route, the honest status is degraded (cursor parity).
117
+ return ConformanceReportSchema.parse({
118
+ harness_id: "opencode",
119
+ // No auth source at all = unavailable; key-present-but-unproven = degraded.
120
+ status: authReady ? "degraded" : "unavailable",
121
+ checks: [
122
+ { id: "installed", status: "pass", detail: version },
123
+ { id: "provider_auth", status: authReady ? "pass" : "fail", detail: authReady ? "provider key available (unproven without isolated smoke)" : undefined },
124
+ { id: "isolated_smoke", status: "skip", detail: "no isolated smoke implemented for opencode yet" },
125
+ { id: "readonly_conformance", status: "skip", detail: "readonly not proven for opencode adapter yet" },
126
+ ],
127
+ // COMPLETE intent bookkeeping: every declared-capability intent is in
128
+ // exactly one list, so routing can never lose an intent to a gap
129
+ // (review/plan/spec stay gated until an isolated smoke proves the
130
+ // route — the same conformance bar explain/audit wait on).
131
+ enabled_intents: authReady ? ["implement", "repair", "create_from_scratch", "verify", "synthesize"] : [],
132
+ disabled_intents: authReady
133
+ ? ["explain", "audit", "plan", "spec", "review", "orchestrate"]
134
+ : ["implement", "repair", "create_from_scratch", "verify", "synthesize", "explain", "audit", "plan", "spec", "review", "orchestrate"],
135
+ reasons: authReady
136
+ ? ["key present but route unproven (no isolated smoke); read-only and reviewer intents stay disabled until conformance-proven"]
137
+ : ["opencode provider auth not configured"],
138
+ });
139
+ },
140
+ run(spec) {
141
+ return runOpenCode(spec);
142
+ },
143
+ review(spec) {
144
+ return runOpenCode(spec);
145
+ },
146
+ };
147
+ }
148
+ async function* runOpenCode(spec) {
149
+ // The manifest declares readonly unsupported; running it with default
150
+ // (write-capable) permissions would be a silent access downgrade. Same
151
+ // typed throw as workspace_write below — an unsupported access profile is
152
+ // a routing error, not a stream that "completed".
153
+ if (spec.access === "readonly") {
154
+ throw new HarnessUnavailableError("opencode does not support a conformance-proven readonly profile; use another harness for read-only intents");
155
+ }
156
+ // The only permission flag the adapter drives is --dangerously-skip-permissions
157
+ // (full access). A workspace_write request has NO proven scoped confinement, so
158
+ // honoring it would SILENTLY grant full. Reject loudly instead of downgrading
159
+ // the access guarantee (manifest advertises full-only).
160
+ if (spec.access === "workspace_write") {
161
+ throw new HarnessUnavailableError("opencode does not support a conformance-proven workspace_write (scoped) profile; it can only run with full access (--dangerously-skip-permissions). Use full access explicitly or another harness for confined writes.");
162
+ }
163
+ const args = ["run", "--format", "json", ...accessArgs(spec.access)];
164
+ if (spec.model_hint)
165
+ args.push("--model", spec.model_hint);
166
+ // Resume the thread's native opencode session (ses_...) as a follow-up turn.
167
+ if (spec.resume_session_id)
168
+ args.push("--session", spec.resume_session_id);
169
+ args.push(spec.prompt);
170
+ // Doctor/run symmetry: resolve the key from the same sources doctor credits
171
+ // (spec env first, then process env, then stored secrets) so a doctor "ok"
172
+ // cannot precede a guaranteed-unauthenticated run.
173
+ const key = providerKey({ ...process.env, ...spec.env });
174
+ // Unified provider scrub (cross-provider leak fix): clear EVERY known provider
175
+ // secret/redirect from the child, then re-add ONLY the single key opencode's
176
+ // chosen provider route needs. The shared runner starts from process.env, so
177
+ // an adapter-local partial denylist would leak unrelated host credentials.
178
+ const env = {
179
+ ...spec.env,
180
+ ...providerScrubEnv(),
181
+ };
182
+ if (key)
183
+ env[key.envVar] = key.value;
184
+ yield* runCliHarness({
185
+ bin: BIN,
186
+ args,
187
+ spec,
188
+ env,
189
+ label: "opencode",
190
+ redact: redactSecrets,
191
+ parseEvent: parseOpenCodeEvent,
192
+ });
193
+ }
194
+ //# sourceMappingURL=index.js.map
@@ -0,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,CAAC,CAAC;IACvB,4EAA4E;IAC5E,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,+EAA+E;IAC/E,6EAA6E;IAC7E,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,GAAG,GAA8C;QACrD,GAAG,IAAI,CAAC,GAAG;QACX,GAAG,gBAAgB,EAAE;KACtB,CAAC;IACF,IAAI,GAAG;QAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;IAErC,KAAK,CAAC,CAAC,aAAa,CAAC;QACnB,GAAG,EAAE,GAAG;QACR,IAAI;QACJ,IAAI;QACJ,GAAG;QACH,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,aAAa;QACrB,UAAU,EAAE,kBAAkB;KAC/B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { HarnessEvent } from "@claudexor/schema";
2
+ type Json = any;
3
+ /**
4
+ * Map an OpenCode `run --format json` ND-JSON event to normalized events
5
+ * (best-effort across versions; validated against recorded fixtures).
6
+ * Returns `null` for unrecognized shapes so the run loop can COUNT drops
7
+ * instead of silently degrading to an empty stream.
8
+ */
9
+ export declare function parseOpenCodeEvent(obj: Json, sessionId: string): HarnessEvent[] | null;
10
+ export {};
11
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,mBAAmB,CAAC;AAGzE,KAAK,IAAI,GAAG,GAAG,CAAC;AAchB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CA6FtF"}
package/dist/parse.js ADDED
@@ -0,0 +1,135 @@
1
+ import { nowIso, redactSecrets } from "@claudexor/util";
2
+ function toolKindFor(name) {
3
+ const n = name.toLowerCase();
4
+ if (n.includes("webfetch") || n.includes("websearch") || n === "fetch")
5
+ return "web";
6
+ if (n.includes("bash") || n.includes("shell") || n.includes("command"))
7
+ return "command";
8
+ if (n.includes("glob") || n.includes("grep") || n.includes("search"))
9
+ return "search";
10
+ if (n.includes("edit") || n.includes("write") || n.includes("patch") || n.includes("read") || n.includes("file") || n === "ls")
11
+ return "file";
12
+ if (n.includes("mcp"))
13
+ return "mcp";
14
+ return "other";
15
+ }
16
+ const EDIT_TOOLS = /edit|write|patch/i;
17
+ /**
18
+ * Map an OpenCode `run --format json` ND-JSON event to normalized events
19
+ * (best-effort across versions; validated against recorded fixtures).
20
+ * Returns `null` for unrecognized shapes so the run loop can COUNT drops
21
+ * instead of silently degrading to an empty stream.
22
+ */
23
+ export function parseOpenCodeEvent(obj, sessionId) {
24
+ const ts = nowIso();
25
+ const type = String(obj?.type ?? "");
26
+ if (type === "error") {
27
+ return [{ type: "error", session_id: sessionId, ts, error: String(obj.error ?? obj.message ?? "opencode error") }];
28
+ }
29
+ if (type === "session" || type === "start" || type === "init") {
30
+ // Surface the native session id (ses_...) so the engine can resume this thread.
31
+ const nativeId = typeof obj.sessionID === "string" ? obj.sessionID : typeof obj.session_id === "string" ? obj.session_id : typeof obj.session?.id === "string" ? obj.session.id : undefined;
32
+ return [{
33
+ type: "started",
34
+ session_id: sessionId,
35
+ ts,
36
+ observed_model: typeof obj.model === "string" ? obj.model : undefined,
37
+ ...(nativeId ? { payload: { native_session_id: nativeId } } : {}),
38
+ }];
39
+ }
40
+ // Text parts can arrive under several shapes across versions.
41
+ const text = obj.text ?? obj.part?.text ?? obj.message?.text ?? obj.delta?.text;
42
+ if ((type === "message" || type === "text" || type === "assistant" || type === "part" || type.startsWith("message.part")) && typeof text === "string" && text) {
43
+ return [{ type: "message", session_id: sessionId, ts, text }];
44
+ }
45
+ // Tool lifecycle: flat `tool`/`tool_call` events and part-based shapes with a state.
46
+ const partTool = obj.part?.tool ?? obj.part?.name;
47
+ if (type === "tool" || type === "tool_call" || (typeof partTool === "string" && partTool)) {
48
+ const name = String(obj.tool ?? obj.name ?? partTool ?? "tool");
49
+ const status = String(obj.status ?? obj.part?.state?.status ?? obj.state?.status ?? "");
50
+ const target = boundedTarget(obj.path ?? obj.args?.path ?? obj.part?.path ?? obj.args?.command ?? obj.part?.state?.input?.command);
51
+ const useId = stringOrUndef(obj.id ?? obj.call_id ?? obj.part?.id);
52
+ const tool = { name, kind: toolKindFor(name), use_id: useId, target };
53
+ if (status === "error" || status === "failed") {
54
+ const detail = summarize(obj.error ?? obj.part?.state?.error ?? obj.part?.state?.output);
55
+ return [
56
+ {
57
+ type: "tool_result",
58
+ session_id: sessionId,
59
+ ts,
60
+ text: `tool_result: error${detail ? `: ${detail}` : ""}`,
61
+ tool: { ...tool, status: "error", error_summary: detail || "tool call failed" },
62
+ },
63
+ ];
64
+ }
65
+ if (status === "completed" || status === "done" || status === "success") {
66
+ const detail = summarize(obj.part?.state?.output ?? obj.output);
67
+ const events = [
68
+ {
69
+ type: "tool_result",
70
+ session_id: sessionId,
71
+ ts,
72
+ text: "tool_result",
73
+ tool: { ...tool, status: "ok", content_summary: detail || undefined },
74
+ },
75
+ ];
76
+ if (EDIT_TOOLS.test(name)) {
77
+ const path = obj.path ?? obj.args?.path ?? obj.part?.path ?? obj.part?.state?.input?.filePath;
78
+ events.push({ type: "file_change", session_id: sessionId, ts, tool: { name, kind: "file", use_id: useId }, payload: { path, tool: name } });
79
+ }
80
+ return events;
81
+ }
82
+ // Pending/running (or legacy shape without status): a tool call start.
83
+ if (EDIT_TOOLS.test(name) && !status) {
84
+ const path = obj.path ?? obj.args?.path ?? obj.part?.path;
85
+ return [{ type: "file_change", session_id: sessionId, ts, tool, payload: { path, tool: name } }];
86
+ }
87
+ return [{ type: "tool_call", session_id: sessionId, ts, text: name, tool }];
88
+ }
89
+ if (type === "usage" || type === "finish" || typeof obj.cost === "number") {
90
+ // Token counts arrive under two recorded shapes across opencode versions:
91
+ // - flat: { tokens: { input, output, cache } }
92
+ // - nested: { usage: { input_tokens, output_tokens, cache_read_input_tokens } }
93
+ // (the `finish` event uses this nested form). Read both so a nested-shape
94
+ // finish does not silently drop its token counts.
95
+ const tokens = obj.tokens ?? {};
96
+ const nested = obj.usage ?? {};
97
+ const usage = {};
98
+ if (typeof obj.cost === "number")
99
+ usage.cost_usd = obj.cost;
100
+ const input = firstNumber(tokens.input, nested.input_tokens);
101
+ const output = firstNumber(tokens.output, nested.output_tokens);
102
+ const cache = firstNumber(tokens.cache, nested.cache_read_input_tokens, nested.cache);
103
+ if (input !== undefined)
104
+ usage.input_tokens = input;
105
+ if (output !== undefined)
106
+ usage.output_tokens = output;
107
+ if (cache !== undefined)
108
+ usage.cached_input_tokens = cache;
109
+ if (Object.keys(usage).length === 0)
110
+ return [];
111
+ return [{ type: "usage", session_id: sessionId, ts, usage }];
112
+ }
113
+ return null;
114
+ }
115
+ function summarize(value) {
116
+ if (typeof value !== "string" || !value.trim())
117
+ return "";
118
+ return redactSecrets(value).trim().replace(/\s+/g, " ").slice(0, 1000);
119
+ }
120
+ function boundedTarget(value) {
121
+ if (typeof value !== "string" || !value.trim())
122
+ return undefined;
123
+ return redactSecrets(value).slice(0, 500);
124
+ }
125
+ function stringOrUndef(v) {
126
+ return typeof v === "string" && v ? v : undefined;
127
+ }
128
+ /** First numeric value among the candidates (lets one usage branch read multiple recorded shapes). */
129
+ function firstNumber(...values) {
130
+ for (const v of values)
131
+ if (typeof v === "number")
132
+ return v;
133
+ return undefined;
134
+ }
135
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIxD,SAAS,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AS,CAAC;IACjE,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC;AAED,sGAAsG;AACtG,SAAS,WAAW,CAAC,GAAG,MAAiB;IACvC,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,IAAI,OAAO,CAAC,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@claudexor/harness-opencode",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "description": "OpenCode adapter (opencode run --format json).",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "dependencies": {
19
+ "@claudexor/core": "1.0.0",
20
+ "@claudexor/schema": "1.0.0",
21
+ "@claudexor/secrets": "1.0.0",
22
+ "@claudexor/util": "1.0.0"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/razzant/claudexor.git",
27
+ "directory": "packages/harness-opencode"
28
+ },
29
+ "homepage": "https://github.com/razzant/claudexor#readme",
30
+ "bugs": {
31
+ "url": "https://github.com/razzant/claudexor/issues"
32
+ },
33
+ "engines": {
34
+ "node": ">=20.19"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc",
41
+ "typecheck": "tsc --noEmit"
42
+ }
43
+ }