Skip to content

Commit 1d93f80

Browse files
committed
fix(zcode-protocol): consume from source via transpilePackages
Clean-checkout CI failed: package.json exports pointed at a gitignored dist/ that no build step produced, so next typecheck/build on a fresh clone could not resolve @html-anything/zcode-protocol. Consume the package from TS source instead — exports/main/types point at src/*.ts, next lists it in transpilePackages, cli resolves via tsx. Intra-package imports dropped .js extensions (bundler style) so Next's bundler resolves them from source. No runtime behaviour change; zcode-protocol (83/1skip), next+cli typecheck, next build, next agents (77) all green with dist removed.
1 parent 882b023 commit 1d93f80

14 files changed

Lines changed: 28 additions & 29 deletions

next/next.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
4-
/* config options here */
4+
transpilePackages: ["@html-anything/zcode-protocol"],
55
};
66

77
export default nextConfig;

packages/zcode-protocol/package.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
"license": "Apache-2.0",
66
"type": "module",
77
"exports": {
8-
".": "./dist/zcode-protocol.js",
9-
"./zcode-protocol": "./dist/zcode-protocol.js",
10-
"./zcode-config": "./dist/zcode-config.js",
11-
"./zcode-model-picker": "./dist/zcode-model-picker.js",
12-
"./zcode-session": "./dist/zcode-session.js",
13-
"./zcode-stream": "./dist/zcode-stream.js"
8+
".": "./src/zcode-protocol.ts",
9+
"./zcode-protocol": "./src/zcode-protocol.ts",
10+
"./zcode-config": "./src/zcode-config.ts",
11+
"./zcode-model-picker": "./src/zcode-model-picker.ts",
12+
"./zcode-session": "./src/zcode-session.ts",
13+
"./zcode-stream": "./src/zcode-stream.ts"
1414
},
15-
"main": "./dist/zcode-protocol.js",
16-
"types": "./dist/zcode-protocol.d.ts",
15+
"main": "./src/zcode-protocol.ts",
16+
"types": "./src/zcode-protocol.ts",
1717
"files": [
18-
"dist",
1918
"src"
2019
],
2120
"scripts": {

packages/zcode-protocol/src/zcode-config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
parseZcodeConfig,
77
readZcodeConfig,
88
defaultZcodeConfigPath,
9-
} from "./zcode-config.js";
9+
} from "./zcode-config";
1010

1111
/**
1212
* #14: the config reader reads the GUI's RESOLVED `~/.zcode/v2/config.json`

packages/zcode-protocol/src/zcode-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import { readFileSync } from "node:fs";
3232
import { homedir } from "node:os";
3333
import { join } from "node:path";
34-
import { isRecord } from "./internal.js";
34+
import { isRecord } from "./internal";
3535

3636
/**
3737
* The API-key credential object the app-server's `workspace/upsertModelProvider`

packages/zcode-protocol/src/zcode-model-picker.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, expect } from "vitest";
22
import {
33
parseZcodePickerModels,
44
resolveZcodeDefaultSelection,
5-
} from "./zcode-model-picker.js";
5+
} from "./zcode-model-picker";
66

77
// A config shape mirroring the live GUI's resolved config (redacted): two
88
// enabled providers (one with 2 models, one with 1) + one disabled provider

packages/zcode-protocol/src/zcode-model-picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import { readFileSync } from "node:fs";
2727
import { homedir } from "node:os";
2828
import { join } from "node:path";
29-
import { isRecord } from "./internal.js";
29+
import { isRecord } from "./internal";
3030

3131
/**
3232
* A picker entry. Mirrors the app's `ModelOption` shape (`{ id, label }`) and

packages/zcode-protocol/src/zcode-protocol.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
22
import { PassThrough } from "node:stream";
33
import { EventEmitter } from "node:events";
44
import type { ChildProcess } from "node:child_process";
5-
import { createZcodeProtocolClient } from "./zcode-protocol.js";
5+
import { createZcodeProtocolClient } from "./zcode-protocol";
66

77
/**
88
* A fake `app-server` child built from PassThrough streams. The protocol client

packages/zcode-protocol/src/zcode-protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929

3030
import type { ChildProcess } from "node:child_process";
31-
import { isRecord, type JsonRecord } from "./internal.js";
31+
import { isRecord, type JsonRecord } from "./internal";
3232

3333
/** A request we send to the app-server. The caller chooses the `id`. */
3434
export interface ZcodeProtocolRequest {

packages/zcode-protocol/src/zcode-real-server.integration.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
2222
import { existsSync } from "node:fs";
2323
import { homedir } from "node:os";
2424
import { join } from "node:path";
25-
import { createZcodeProtocolClient } from "./zcode-protocol.js";
25+
import { createZcodeProtocolClient } from "./zcode-protocol";
2626
import {
2727
ensureWorkspaceModel,
2828
startZcodeProtocolTurn,
2929
type EnsuredWorkspaceModel,
30-
} from "./zcode-session.js";
31-
import { readZcodeConfig } from "./zcode-config.js";
30+
} from "./zcode-session";
31+
import { readZcodeConfig } from "./zcode-config";
3232

3333
/**
3434
* Resolve the Electron binary + zcode.cjs path. The Electron binary is the

packages/zcode-protocol/src/zcode-session.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, vi, beforeEach } from "vitest";
2-
import type { ZcodeProtocolClientLike } from "./zcode-session.js";
3-
import { startZcodeProtocolTurn, ensureWorkspaceModel } from "./zcode-session.js";
2+
import type { ZcodeProtocolClientLike } from "./zcode-session";
3+
import { startZcodeProtocolTurn, ensureWorkspaceModel } from "./zcode-session";
44

55
// Mock the config reader so tests don't touch disk. The relay's job is to
66
// send the right frames; the config reader is tested separately.

0 commit comments

Comments
 (0)