Skip to content

Commit c358477

Browse files
committed
refactor(packages): add workspace dependency layering
1 parent defb19e commit c358477

15 files changed

Lines changed: 467 additions & 88 deletions

File tree

CLAUDE.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ content/ ← ALL input data
2222
probes-mux/ measured: multiplexer pass-through results
2323
2424
packages/ ← source code (internal tools)
25-
probes/ probe test files (*.probe.ts, setup.ts, vitest.config.ts)
26-
cli/
25+
probe-defs/ @terminfo/probe-defs: pure probe definitions + shared types
26+
probes/ @terminfo/probes: Vitest runner over Termless backends
27+
admin/ @terminfo/admin: dev/orchestration CLI (bun terminfo)
2728
src/ unified CLI (bun terminfo) — all 4 probe mechanisms
2829
index.ts entry point: probe {termless,server,app,here}, report, status, submit, detect
2930
termless.ts headless library probes (Vitest + Termless)
@@ -68,9 +69,14 @@ docs/ ← VitePress site (built → deployed)
6869
compare/[id].md comparison pages
6970
7071
versions.json backend version catalog (which versions to probe)
71-
package.json scripts, dependencies
72+
package.json private workspace root; packages/* are Bun workspaces
7273
```
7374

75+
`packages/*/package.json` manifests are load-bearing. Cross-package imports use
76+
package names (`@terminfo/probe-defs`, `terminfo.dev/src/...`) rather than
77+
relative paths like `../../probe-defs/src`; km's root workspace also includes
78+
`vendor/terminfo.dev/packages/*` so local repo commands resolve the same graph.
79+
7480
## Data Architecture
7581

7682
Three data layers with clean separation:

bun.lock

Lines changed: 396 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"name": "terminfo.dev",
2+
"name": "terminfo.dev-root",
33
"private": true,
44
"license": "CC-BY-4.0",
5+
"workspaces": [
6+
"packages/*"
7+
],
58
"type": "module",
69
"scripts": {
710
"terminfo": "bun packages/terminfo.dev/src/index.tsx",
@@ -30,15 +33,19 @@
3033
"fix": "oxfmt --write ."
3134
},
3235
"dependencies": {
33-
"@silvery/ansi": "^0.3.0",
34-
"@silvery/commander": "^0.6.0",
36+
"@silvery/ansi": "^0.19.0",
37+
"@silvery/commander": "^0.19.0",
3538
"@termless/core": "^0.4.0",
3639
"commander": "^13.1.0",
3740
"loggily": "^0.4.0",
38-
"silvery": "^0.4.1"
41+
"silvery": "^0.19.0"
3942
},
4043
"devDependencies": {
44+
"@terminfo/admin": "workspace:*",
45+
"@terminfo/probe-defs": "workspace:*",
46+
"@terminfo/probes": "workspace:*",
4147
"oxfmt": "^0.38.0",
48+
"terminfo.dev": "workspace:*",
4249
"vitepress": "^1.6.4",
4350
"vitepress-enrich": "^0.4.0",
4451
"vitest": "^4.1.1"

packages/admin/app-harness.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313

1414
import { readFileSync, writeFileSync } from "node:fs"
1515
import { createHash } from "node:crypto"
16-
import { ALL_PROBES } from "../terminfo.dev/src/probes/unified.ts"
17-
import { withRawMode, drainStdin } from "../terminfo.dev/src/tty.ts"
16+
import { fileURLToPath } from "node:url"
17+
import { ALL_PROBES } from "terminfo.dev/src/probes/unified.ts"
18+
import { withRawMode, drainStdin } from "terminfo.dev/src/tty.ts"
1819

1920
// ── Main ──
2021

@@ -26,7 +27,7 @@ async function main(): Promise<void> {
2627
}
2728

2829
// Compute probe hash from the shared probe definitions
29-
const probesPath = new URL("../terminfo.dev/src/probes/unified.ts", import.meta.url).pathname
30+
const probesPath = fileURLToPath(import.meta.resolve("terminfo.dev/src/probes/unified.ts"))
3031
const probesContent = readFileSync(probesPath)
3132
const probeHash = createHash("md5").update(probesContent).digest("hex").slice(0, 12)
3233

packages/admin/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@terminfo/admin",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"dependencies": {
7+
"@silvery/commander": "^0.19.0",
8+
"@termless/core": "^0.4.0",
9+
"loggily": "^0.4.0",
10+
"react": "^19.1.1",
11+
"silvery": "^0.19.0",
12+
"terminfo.dev": "workspace:*"
13+
}
14+
}

packages/admin/src/detect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
export async function handleDetect(opts: { json?: boolean }): Promise<void> {
6-
const { detectTerminal } = await import("../../terminfo.dev/src/detect.ts")
6+
const { detectTerminal } = await import("terminfo.dev/src/detect.ts")
77
const terminal = detectTerminal()
88

99
if (opts.json) {

packages/admin/src/here.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function link(url: string, text: string): string {
3636

3737
export async function handleHere(opts: { json?: boolean }): Promise<void> {
3838
// Dynamic imports — these modules need real TTY access
39-
const { detectTerminal } = await import("../../terminfo.dev/src/detect.ts")
40-
const { ALL_PROBES } = await import("../../terminfo.dev/src/probes/unified.ts")
41-
const { withRawMode, drainStdin } = await import("../../terminfo.dev/src/tty.ts")
39+
const { detectTerminal } = await import("terminfo.dev/src/detect.ts")
40+
const { ALL_PROBES } = await import("terminfo.dev/src/probes/unified.ts")
41+
const { withRawMode, drainStdin } = await import("terminfo.dev/src/tty.ts")
4242

4343
const terminal = detectTerminal()
4444
const results: Record<string, boolean> = {}

packages/admin/src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ export async function handleServer(
2020
): Promise<void> {
2121
if (opts.start) {
2222
// Start daemon in this terminal
23-
const { startDaemon } = await import("../../terminfo.dev/src/serve.ts")
23+
const { startDaemon } = await import("terminfo.dev/src/serve.ts")
2424
await startDaemon(opts.port ?? 0)
2525
return
2626
}
2727

2828
// Import daemon listing
29-
const { listDaemons } = await import("../../terminfo.dev/src/serve.ts")
29+
const { listDaemons } = await import("terminfo.dev/src/serve.ts")
3030
const daemons = listDaemons()
3131

3232
if (!opts.all && !daemon) {

packages/admin/src/status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function handleStatus(): Promise<void> {
133133

134134
// List running daemons
135135
try {
136-
const { listDaemons } = await import("../../terminfo.dev/src/serve.ts")
136+
const { listDaemons } = await import("terminfo.dev/src/serve.ts")
137137
const daemons = listDaemons()
138138
if (daemons.length > 0) {
139139
console.log("\n Running daemons:")

packages/admin/src/submit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66

77
export async function handleSubmit(opts: { terminalName?: string; terminalVersion?: string }): Promise<void> {
8-
const { detectTerminal } = await import("../../terminfo.dev/src/detect.ts")
9-
const { ALL_PROBES } = await import("../../terminfo.dev/src/probes/unified.ts")
10-
const { withRawMode, drainStdin } = await import("../../terminfo.dev/src/tty.ts")
11-
const { submitResults } = await import("../../terminfo.dev/src/submit.ts")
8+
const { detectTerminal } = await import("terminfo.dev/src/detect.ts")
9+
const { ALL_PROBES } = await import("terminfo.dev/src/probes/unified.ts")
10+
const { withRawMode, drainStdin } = await import("terminfo.dev/src/tty.ts")
11+
const { submitResults } = await import("terminfo.dev/src/submit.ts")
1212

1313
// Confirm details BEFORE probes (stdin is still clean)
1414
const terminal = detectTerminal()

0 commit comments

Comments
 (0)