@henols/c64-re-tools 2.6.0-rc.6 → 2.6.0-rc.8

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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/skills/c64-knowledge/SKILL.md +1 -1
  3. package/skills/c64-knowledge/scripts/knowledge.ts +2 -0
  4. package/skills/c64-knowledge/scripts/lib/listing.ts +18 -3
  5. package/skills/c64-reverse-engineering/SKILL.md +1 -1
  6. package/skills/c64-source/SKILL.md +5 -5
  7. package/skills/c64-source/scripts/source.ts +22 -20
  8. package/skills/c64-static-analysis/SKILL.md +3 -3
  9. package/skills/c64-static-analysis/scripts/lib/instructions.ts +22 -20
  10. package/skills/c64-static-analysis/scripts/static-analysis.ts +1 -8
  11. package/skills/c64-testing/SKILL.md +1 -0
  12. package/skills/c64-testing/references/recording-format.md +8 -0
  13. package/skills/c64-testing/scripts/lib/keys.ts +36 -0
  14. package/skills/c64-testing/scripts/lib/play.ts +2 -6
  15. package/skills/c64-testing/scripts/lib/recording.ts +13 -4
  16. package/skills/emulator/SKILL.md +6 -8
  17. package/src/cli/main.ts +3 -29
  18. package/src/host/main.ts +1 -1
  19. package/src/host/tools/index.ts +1 -6
  20. package/src/host/vice/session.ts +1 -1
  21. package/src/host-client/tools.ts +2 -7
  22. package/src/knowledge/read.ts +16 -1
  23. package/src/mcp/server.ts +0 -1
  24. package/src/mcp/tools/machine.ts +3 -42
  25. package/src/mcp/tools/media.ts +1 -1
  26. package/src/native/dxa.ts +12 -1
  27. package/src/native/ghidra/analyze.ts +74 -63
  28. package/src/native/ghidra/c64rt-wasm.ts +4 -0
  29. package/src/native/ghidra/language/c64rt_6510.sla +0 -0
  30. package/src/native/ghidra/pcode.ts +222 -0
  31. package/src/native/ghidra/walk.ts +205 -0
  32. package/src/native/ghidra/wasm.ts +98 -0
  33. package/src/native/processes.ts +1 -1
  34. package/src/native/types.ts +2 -2
  35. package/src/project.ts +4 -3
  36. package/src/protocol/tools.ts +1 -45
  37. package/src/script.ts +1 -1
  38. package/tools/install-container.sh +1 -2
  39. package/src/cli/status.ts +0 -127
  40. package/src/host/tools/status.ts +0 -47
  41. package/src/native/ghidra/index.ts +0 -170
  42. package/src/native/ghidra/scripts/C64Export.java +0 -274
  43. package/src/native/ghidra/scripts/C64Prepare.java +0 -66
  44. package/src/native/status.ts +0 -135
  45. package/tools/install-ghidra.sh +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henols/c64-re-tools",
3
- "version": "2.6.0-rc.6",
3
+ "version": "2.6.0-rc.8",
4
4
  "description": "Agent-friendly Commodore 64 engineering toolkit for reverse engineering, debugging, development and testing.",
5
5
  "license": "MIT",
6
6
  "author": "Henrik Olsson",
@@ -73,7 +73,7 @@ The knowledge is text in `.c64-re-tools/knowledge/` of the project. Commit that
73
73
  - An analyzer name is a second name from DXA, Ghidra or an idiom search, for example `FUN_17e2`. Each analyzer keeps its own name at an address. Get them from `at`, `search` or `symbols --analyzer`.
74
74
  - The generated source uses only the symbols. To use an analyzer name in the source, give the address that name with `rename`.
75
75
  - A symbol name is a label for ACME: a letter or an underscore, then letters, digits or underscores. The knowledge refuses the name of a 6502 instruction, for example `lda`, in upper or lower case.
76
- - A space is `c64` (the default), `drive8` for code in the 1541 drive, `loading` or `bank0` to `bank255`. `loading` is the captured stage of the loading that shows the start screen. `bank0` to `bank255` are cartridge banks. Drive code, the stage and banks use the same addresses as the C64. Thus each space has its own knowledge. A name is unique in one space.
76
+ - A space is `c64` (the default), `drive8` for code in the 1541 drive, `loading` or `bank0` to `bank255`. `loading` is the captured stage of the loading that shows the start screen. `bank0` to `bank255` are cartridge banks, or other memory images of the program, for example a file that the program loads later. Drive code, the stage and banks use the same addresses as the C64. Thus each space has its own knowledge. A name is unique in one space.
77
77
  - A revision id has the form `20261015T214501.123-k3f9qz`. It starts with the date and the time. Give the full id, or a start of the id that only one revision has. Get the ids from `revisions`, or from the `revision` field of a result. The revision `0` is the knowledge before the first revision.
78
78
  - A file of a capture is the `image.json` that the capture of a packed program wrote. The other files of the capture must be next to it.
79
79
 
@@ -271,8 +271,10 @@ function listingSource(db: DatabaseSync | undefined, space: string): ListingSour
271
271
  const coverage = programCoverage(db, space)?.map;
272
272
  const inside = (at: number) => image.segments.some((segment) => at >= segment.start && at <= segment.end);
273
273
  const platform = new Map(space === DEFAULT_SPACE ? platformNames().map((entry) => [entry.address, entry.name]) : []);
274
+ const entries = space === DEFAULT_SPACE ? platformNames().filter((entry) => entry.end > entry.address) : [];
274
275
  return {
275
276
  byteAt: (at) => (inside(at) ? image.byteAt(at) : undefined),
277
+ entryStart: (at) => (inside(at) ? undefined : entries.find((entry) => at > entry.address && at <= entry.end)?.address),
276
278
  // A user or LLM name, else the platform name; an analyzer name in symbols (knowledge from an older version) gives way to it.
277
279
  nameOf: (at) => {
278
280
  const own = symbolAt(db, at, space);
@@ -11,6 +11,8 @@ export interface ListingSource {
11
11
  byteAt: (address: number) => number | undefined;
12
12
  /** The name of an address: a symbol, else a platform name. */
13
13
  nameOf: (address: number) => string | undefined;
14
+ /** The start of the platform entry of more bytes that holds an address outside the image (NMINV for its high byte), or undefined. */
15
+ entryStart?: (address: number) => number | undefined;
14
16
  /** The analyzer names of an address, for reference. */
15
17
  secondNames: (address: number) => string[];
16
18
  /** The knowledge regions, in address order. */
@@ -52,9 +54,22 @@ function accessOf(coverage: Uint8Array | undefined, start: number, length: numbe
52
54
  return text === "" ? "-" : text;
53
55
  }
54
56
 
57
+ /**
58
+ * The name of an operand target, as c64-source writes it: its own name, else
59
+ * name+offset inside a named data region, or inside a platform entry of more bytes.
60
+ */
61
+ function targetName(target: number, source: ListingSource): string | undefined {
62
+ const own = source.nameOf(target);
63
+ if (own !== undefined) return own;
64
+ const region = source.regions.find((row) => target > row.start && target <= row.end && !CODE.has(row.type) && row.type !== "dual-use");
65
+ const start = region?.start ?? source.entryStart?.(target);
66
+ const name = start === undefined ? undefined : source.nameOf(start);
67
+ return name === undefined ? undefined : `${name}+${target - start!}`;
68
+ }
69
+
55
70
  /** The operand value of an instruction as an expression: the name of its target where one exists, else the number. Empty for no operand. */
56
- function operandOf(mode: Mode, address: number, low: number, high: number, nameOf: ListingSource["nameOf"]): string {
57
- const named = (target: number, digits: 2 | 4) => nameOf(target) ?? (digits === 2 ? formatC64Byte(target) : formatC64Address(target));
71
+ function operandOf(mode: Mode, address: number, low: number, high: number, source: ListingSource): string {
72
+ const named = (target: number, digits: 2 | 4) => targetName(target, source) ?? (digits === 2 ? formatC64Byte(target) : formatC64Address(target));
58
73
  if (mode === "imp") return "";
59
74
  if (mode === "imm") return formatC64Byte(low);
60
75
  if (mode === "rel") return named((address + 2 + (low < 0x80 ? low : low - 0x100)) & 0xffff, 4);
@@ -108,7 +123,7 @@ export function listing(source: ListingSource, start: number, end: number): List
108
123
  const bytes = Array.from({ length: length - 1 }, (_, offset) => source.byteAt(address + 1 + offset));
109
124
  if (address + length - 1 <= region.end && bytes.every((value) => value !== undefined)) {
110
125
  // The operand expression of the knowledge in the syntax of the addressing mode, as c64-source writes it.
111
- const operand = source.operand(address) ?? operandOf(opcode.mode, address, bytes[0] ?? 0, bytes[1] ?? 0, source.nameOf);
126
+ const operand = source.operand(address) ?? operandOf(opcode.mode, address, bytes[0] ?? 0, bytes[1] ?? 0, source);
112
127
  if (address >= start) lines.push(line(address, length, instructionWith(byte, operand)));
113
128
  address += length;
114
129
  continue;
@@ -93,7 +93,7 @@ Do the stages in this sequence. Go to the next stage only when its exit check is
93
93
  | 6. Analyze | Analyze the program statically. The analysis reads the program and the coverage from the project knowledge. | No coverage conflict is open. |
94
94
  | 7. Name | If the workspace has a routine library, match the program against it. Write the names of the matches to the project knowledge. Then name each routine in the scope and give it a comment. Find the platform addresses in the memory map of the C64. Record the modules. Put the modules of one part of the program in one folder, for example `music/`, `irq/` or `graphics/`. When the scope has hundreds of routines, ask the user which routines to name. The source gives the other routines an `l_xxxx` label. | Each routine that the user selected has a name and a comment. |
95
95
  | 8. Releases and switches | Record the original file, or the capture of it, as the base release in the project knowledge. The project knowledge keeps the bytes of each release. Record each other release. Compare the releases. Find the leftovers. Record a switch for each copy protection, trainer, cheat, crack change and correction. Record a patch for each range of a switch. Record each leftover as a region with a comment. | The project knowledge lists each switch. Each difference between the releases is in a patch, or the answer gives it as an exception. |
96
- | 9. Generate | Generate the source from the project knowledge into `src`. For an unpacked program, also generate the loader. | The result of the generation is PASS. Each release with the result `layout differs` is a version with a project of its own, or an exception in the answer. See "Versions of one program". |
96
+ | 9. Generate | Generate the source from the project knowledge into `src`. For an unpacked program, also generate the loader. | The result of the generation is PASS. A release whose code is at other addresses is a version with a project of its own, or an exception in the answer. See "Versions of one program". |
97
97
  | 10. Build and test | Build the base release into `build/`, and compare it with the original. Build the default build. Run the test scenarios in `tests/`. Replay each recording on the rebuild. For each replay, give the checkpoint routine, the state and the random state with the names of stage 7. | The criteria of stage 1 are true. |
98
98
  | 11. Document | When the criteria ask for documentation, generate it into `README.md` and `docs/`. For versions in a group folder, also write the shared pages of the group folder. Then link the pages. | The link check of the documentation gives PASS. |
99
99
  | 12. Hand over | Find each file that you made outside `.c64-re-tools/local/` and that is not a deliverable. Move it into `.c64-re-tools/local/`. Then give the answer (below). | Each file that you made outside `.c64-re-tools/local/` is a deliverable. |
@@ -119,7 +119,7 @@ To make the source better, change the project knowledge. Then generate again.
119
119
  - `patchesNotWritten`: each patch that the source does not have, with its range, `switch` and `reason`.
120
120
  - `switches`, `default`, `releases`: the checks of the switches. See "Switches and releases".
121
121
  - `loader`: the check of the loader. See "The loader".
122
- - `staleLoader`: a run without `--loader` kept `loader.asm` and the loader program of another knowledge revision. `files` gives the files. `revision` gives the revision of `loader.asm`. Without `revision`, `loader.asm` does not give one. `noEntryState: true` tells that the knowledge has no entry state for a new loader.
122
+ - `staleLoader`: a run without `--loader` kept `loader.asm` and the loader program of another knowledge revision. `files` gives the files. `revision` gives the revision of `loader.asm`. Without `revision`, `loader.asm` does not give one. `noEntryState: true` tells that the knowledge has no entry state for a new loader. A change in a space that the loader does not hold does not make the loader stale. The loader holds space `c64` and the space of the stage of the start screen.
123
123
 
124
124
  `result` is `FAIL` for each of these:
125
125
 
@@ -127,7 +127,7 @@ To make the source better, change the project knowledge. Then generate again.
127
127
  - The entry is in no segment of the program.
128
128
  - A patch is in `patchesNotWritten`.
129
129
  - A switch or the default build does not fit.
130
- - A release does not give its bytes. A release with `layout differs` does not give `FAIL`. But the base release must be `identical`.
130
+ - A release does not give its bytes.
131
131
  - The loader is not verified.
132
132
 
133
133
  `hint` gives the action for each finding. When a change of the project knowledge corrects a finding, `nextAction` is the same `generate` command. Run it after the change. A `PASS` without findings gives a `hint` and no `nextAction`.
@@ -227,12 +227,12 @@ Each item of `switches` has `name`, `kind`, `default`, `base`, `define` and the
227
227
 
228
228
  `default` has `in`, `result` and `changedBytes`, as in `switches`. When `default` has `overflow` and the message `turn on one of them`, two alternatives are in the default build. Give one of the switches the default of the base release.
229
229
 
230
- Each item of `releases` has `label`, `base`, `define` and `result`:
230
+ Each item of `releases` has `label`, `base`, `define` and `result`. The check compares the build with each segment of the release. The build compare of the assembler does the same.
231
231
 
232
- - `identical`: the build gives the bytes of the release.
232
+ - `identical`: the build gives the bytes of each segment of the release.
233
233
  - `different`: the release has bytes that no patch gives. Compare the release with the program. Then record a switch and a patch for each difference.
234
- - `layout differs`: the release has other segments than the program. Patches cannot move code. This result does not fail the run.
235
234
  - `does not assemble`: read the ACME diagnostics.
235
+ - `notInRelease`: the ranges of the program that the release does not have. The check does not compare them.
236
236
 
237
237
  The script writes a patch only when its range is complete items of one file. A patch cannot cut an instruction. Its switch name cannot be a name of the source.
238
238
  The script writes a macro use only when the use gives the bytes of the program. A label inside the range of a use also keeps the instructions. The macro line has no place for the label.
@@ -25,7 +25,7 @@ import { conflicts } from "#src/knowledge/conflicts.ts";
25
25
  import { openForRead, withWrite } from "#src/knowledge/database.ts";
26
26
  import { identifiers } from "#src/knowledge/expression.ts";
27
27
  import { analyzedBytes, memoryRows, programCoverage, releaseImage, requireProgram, type ProgramImage } from "#src/knowledge/program.ts";
28
- import { ANALYZER_NAME_ORDER, baseValue, currentRevision, currentStartScreen, startScreenRanges, type StartScreenRow, listAnalyzerNames, listComments, listMacros, listMacroUses, listModules, listOperands, listPatches, listReferences, listRegions, listReleases, listSpaces, listSwitches, listSymbols, type ReleaseRow, type SymbolRow } from "#src/knowledge/read.ts";
28
+ import { ANALYZER_NAME_ORDER, baseValue, currentRevision, currentStartScreen, spacesRevision, startScreenRanges, type StartScreenRow, listAnalyzerNames, listComments, listMacros, listMacroUses, listModules, listOperands, listPatches, listReferences, listRegions, listReleases, listSpaces, listSwitches, listSymbols, type ReleaseRow, type SymbolRow } from "#src/knowledge/read.ts";
29
29
  import { CODE_REGION_TYPES, DEFAULT_SPACE, isSemantic, LEFTOVER_FOLDER, LEFTOVERS_SWITCH, RELEASE_DEFINE, START_SCREEN_SWITCH, type Space } from "#src/knowledge/schema.ts";
30
30
  import { subtract, write } from "#src/knowledge/write.ts";
31
31
  import { assemble, symbolsFileText } from "#src/native/acme.ts";
@@ -92,8 +92,11 @@ function readKnowledge(space: Space, analyzerNames = false) {
92
92
  const second = listAnalyzerNames(db, undefined, undefined, undefined, space);
93
93
  const releases = listReleases(db, undefined, space);
94
94
  const base = releases.find((release) => release.base)?.label;
95
+ const startScreen = space === DEFAULT_SPACE ? currentStartScreen(db, space) : undefined;
95
96
  return {
96
97
  revision: currentRevision(db),
98
+ // The loader holds the program of this space and the stage of its start screen: a change elsewhere does not change it.
99
+ loaderRevision: spacesRevision(db, [space, ...(startScreen?.stage === undefined ? [] : [startScreen.stage])]),
97
100
  program: requireProgram(db, space),
98
101
  // The coverage of the space: a run of the C64, or of a captured stage that coverage put into that space.
99
102
  coverage: programCoverage(db, space)?.map,
@@ -112,7 +115,7 @@ function readKnowledge(space: Space, analyzerNames = false) {
112
115
  macros: listMacros(db, undefined, space),
113
116
  macroUses: listMacroUses(db, undefined, undefined, undefined, space),
114
117
  // The start screen is of the C64 program: the loader shows it.
115
- startScreen: space === DEFAULT_SPACE ? currentStartScreen(db, space) : undefined,
118
+ startScreen,
116
119
  };
117
120
  } finally {
118
121
  db?.close();
@@ -484,28 +487,27 @@ interface ReleaseCheck {
484
487
  label: string;
485
488
  base: boolean;
486
489
  define: string;
487
- result: "identical" | "different" | "layout differs" | "does not assemble";
488
- reason?: string;
490
+ result: "identical" | "different" | "does not assemble";
489
491
  segments?: SegmentCheck[];
492
+ /** The ranges of the program that the release does not have: the check does not compare them. */
493
+ notInRelease?: Array<{ start: string; end: string }>;
490
494
  diagnostics?: Diagnostic[];
491
495
  }
492
496
 
493
497
  /**
494
- * Builds a release with RELEASE_<label> and compares it with its bytes. A
495
- * release whose segments are not the segments of the program has moved code,
496
- * which patches cannot give: it is shown and does not fail the run.
498
+ * Builds a release with RELEASE_<label> and compares it with its bytes, in
499
+ * each segment of the release, as the build compare of the assembler does. A
500
+ * part of the program that the release does not have is listed, not compared.
497
501
  */
498
502
  async function checkRelease(release: ReleaseRow & { image: Pick<ProgramImage, "segments" | "byteAt"> }, files: Array<{ name: string; text: string }>, program: ProgramImage): Promise<ReleaseCheck> {
499
503
  const shown = { label: release.label, base: release.base, define: `--define ${RELEASE_DEFINE}${release.label}=1` };
500
504
  const { image } = release;
501
- if (JSON.stringify(image.segments) !== JSON.stringify(program.segments)) {
502
- const segments = (list: readonly AddressRange[]) => list.map((segment) => `${formatC64Address(segment.start)}-${formatC64Address(segment.end)}`).join(", ");
503
- return { ...shown, result: "layout differs", reason: `The release has the segments ${segments(image.segments)}, and the program has ${segments(program.segments)}. Patches change bytes in place; they cannot move code.` };
504
- }
505
+ const missing = program.segments.flatMap((segment) => subtract(segment, [...image.segments])).map((range) => ({ start: formatC64Address(range.start), end: formatC64Address(range.end) }));
506
+ const notInRelease = missing.length === 0 ? {} : { notInRelease: missing };
505
507
  const built = await assembleFiles(files, "main.asm", { [`${RELEASE_DEFINE}${release.label}`]: 1 });
506
- if (built.program === undefined) return { ...shown, result: "does not assemble", diagnostics: built.diagnostics.slice(0, MAX_DIAGNOSTICS) };
508
+ if (built.program === undefined) return { ...shown, result: "does not assemble", diagnostics: built.diagnostics.slice(0, MAX_DIAGNOSTICS), ...notInRelease };
507
509
  const checked = check(built.program, built.start!, image);
508
- return { ...shown, result: checked.identical ? "identical" : "different", ...(checked.identical ? {} : { segments: checked.segments.filter((segment) => segment.result !== "identical") }) };
510
+ return { ...shown, result: checked.identical ? "identical" : "different", ...(checked.identical ? {} : { segments: checked.segments.filter((segment) => segment.result !== "identical") }), ...notInRelease };
509
511
  }
510
512
 
511
513
  /** Reads RAM in parts. */
@@ -713,7 +715,7 @@ function loaderPrograms(): string[] {
713
715
  .filter((path) => existsSync(resolveProjectPath(path)));
714
716
  }
715
717
 
716
- /** The start of the line of loader.asm that gives the knowledge revision of the loader. */
718
+ /** The start of the line of loader.asm that gives the newest knowledge revision of the spaces that the loader holds. */
717
719
  const LOADER_REVISION = "Loader generated by c64-source from knowledge revision ";
718
720
 
719
721
  /**
@@ -1138,7 +1140,7 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
1138
1140
  const configNames = new Set([...knowledge.switches.map((row) => row.name), START_SCREEN_SWITCH, LEFTOVERS_SWITCH]);
1139
1141
  const loaderValues = new Map([...given].filter(([name]) => configNames.has(name)));
1140
1142
  const header = [`Generated by c64-source from knowledge revision ${knowledge.revision}${space === DEFAULT_SPACE ? "" : ` in space ${space}`}.`, "Change names, comments, regions and modules in knowledge, then generate again."];
1141
- const loaderHeader = [`${LOADER_REVISION}${knowledge.revision}.`, "It copies the segments into place, sets the entry state and jumps to the entry."];
1143
+ const loaderHeader = [`${LOADER_REVISION}${knowledge.loaderRevision}.`, "It copies the segments into place, sets the entry state and jumps to the entry."];
1142
1144
  const { romUse, dataOnly, laid, rendered, files, built, loader, loaderMain, missingEntry, loaderRefused } = await buildSource(knowledge, {
1143
1145
  space,
1144
1146
  entries,
@@ -1158,7 +1160,7 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
1158
1160
  // Read before the old files go: the leftovers of the earlier run, to tell what changed.
1159
1161
  const earlier = earlierLeftovers(out);
1160
1162
  const removed = removeOldFiles(out, new Set(files.map((file) => file.name)), loaderWanted);
1161
- const stale = loaderWanted || space !== DEFAULT_SPACE ? undefined : staleLoader(out, knowledge.revision);
1163
+ const stale = loaderWanted || space !== DEFAULT_SPACE ? undefined : staleLoader(out, knowledge.loaderRevision);
1162
1164
  const written: Written[] = withValues(files, laid, kept).map((file) => writeReported(`${out}/${file.name}`, file.text, { what: "--out" }));
1163
1165
  // The reports go to the local folder: the source folder holds only source files.
1164
1166
  const reports = generatedDirectory(projectRelative(out));
@@ -1279,7 +1281,7 @@ async function generate(call: Call): Promise<{ output: Record<string, unknown>;
1279
1281
  const releases: ReleaseCheck[] = [];
1280
1282
  for (const release of knowledge.releases) releases.push(await checkRelease(release, files, image));
1281
1283
  if (releases.length > 0) output.releases = releases;
1282
- const releasesFailed = releases.some((item) => item.result !== "identical" && (item.base || item.result !== "layout differs"));
1284
+ const releasesFailed = releases.some((item) => item.result !== "identical");
1283
1285
  const sourceFailed = laid.patchesNotWritten.length > 0 || switches.some((item) => item.result !== "fits") || defaultFailed || releasesFailed;
1284
1286
  if (loaderRefused !== undefined) return { output: { ...output, loader: notVerified({ reason: loaderRefused }) }, removed, failed: true };
1285
1287
  if (loader === undefined || loaderMain === undefined || state === undefined) return { output, removed, failed: missingEntry !== undefined || sourceFailed };
@@ -1752,9 +1754,9 @@ function generateReply(call: Call, body: Record<string, unknown>): Reply {
1752
1754
  steps.push("Read the reason of each item in patchesNotWritten, and the result of each switch and of the default build. Correct the patches and the switches in the project knowledge.");
1753
1755
  again = true;
1754
1756
  }
1755
- const releases = body.releases as Array<{ result: string; base: boolean }> | undefined;
1756
- if (releases?.some((item) => item.result !== "identical" && (item.base || item.result !== "layout differs")) === true) {
1757
- steps.push("Read the result of each release. Put back a changed file, or record a switch and a patch in the project knowledge for each difference.");
1757
+ const releases = body.releases as Array<{ result: string }> | undefined;
1758
+ if (releases?.some((item) => item.result !== "identical") === true) {
1759
+ steps.push("Read the result of each release. Record a switch and a patch in the project knowledge for each difference.");
1758
1760
  again = true;
1759
1761
  }
1760
1762
  if ((body.loader as { verified?: boolean } | undefined)?.verified === false) steps.push("The loader is not verified. Read loader.reason, loader.differences and loader.stop.");
@@ -127,7 +127,7 @@ The `hint` gives each of these cases:
127
127
 
128
128
  - `conflicts` is not empty. Find the correct answer in the emulator. Then correct the project knowledge.
129
129
  - `coverageConflicts` is not empty. Classify each range as code in the project knowledge, or as `dual-use` when its bytes are also data. For many ranges, write all classifications in one batch of changes.
130
- - `macros` has candidates, and the run had no `--apply-macros`. Examine the candidates. To write them to the project knowledge, run the analysis again with `--apply-macros`. Then generate the source again.
130
+ - `idioms.candidates.macros` has candidates, and the run had no `--apply-macros`. Examine the candidates. To write them to the project knowledge, run the analysis again with `--apply-macros`. Then generate the source again.
131
131
  - A list is cut. Give a larger `--max-listed`. The project knowledge has all `labels` and `functions` as analyzer names.
132
132
 
133
133
  There is no `nextAction`.
@@ -140,7 +140,7 @@ The script does not record the candidates. Examine each candidate and decide.
140
140
  - `selfModified`: opcodes that the program wrote and then executed. The write and the execution must be in one coverage file. A coverage file does not record the order. Thus a candidate can also be code that ran first, and that the program then wrote over. To prevent this, save one coverage file for each part of the program, for example the intro, the game, or a loader that copies code. Clear the memory map between the parts.
141
141
  - `pointers`: code that makes an address from immediates. A `vector` or a `zero-page pointer` candidate stores a low byte (`low`) and a high byte (`high`) to a vector or to a zero-page pair. A `sprite pointer` candidate stores an immediate (`at`) to a sprite pointer of the screen at `$0400` in VIC bank 0. For each correct candidate, record a low and a high operand expression to its `target` in the project knowledge. Then a rebuild can move the target.
142
142
  - `pitfalls`: code that a C64 runs in a different way than it reads. For `raster-bit-8`, the instruction at `at` reads `$D011`, and the instruction at `store` writes the value back. The write can move the raster interrupt to line 256 or later. On PAL, past line 311, the interrupt never comes. Where the code must not keep bit 7, add a comment and test the program.
143
- - `macros`: runs of instructions that one macro line can replace, for example `+inc16 ptr`. Each candidate has `macro`, `start`, `end`, `args` and `text`. The macros are `inc16`, `dec16`, `add16_8`, `add16`, `sub16`, `set16`, `mov16` and `wait_line`. An arg is a name of the user or the LLM, or a platform name of a ROM that the program uses. `known` counts the uses that the project knowledge has. `leftOut` counts the candidates with a label inside, or with a patch or a use over them. With `--apply-macros`, `revision` gives the revision of the writes, and `writes` counts them. The writes hold the macros that the project knowledge does not have, and the uses. `otherMacros` names each macro that the project knowledge has with another body. The writes do not have the uses of that macro.
143
+ - `macros`: runs of instructions that one macro line can replace, for example `+inc16 ptr`. Each candidate has `macro`, `start`, `end`, `args` and `text`. The macros are `inc16`, `dec16`, `add16_8`, `add16`, `sub16`, `set16`, `mov16` and `wait_line`. An arg is a name of the user or the LLM, or a platform name of a ROM that the program uses. `known` counts the uses that the project knowledge has. `leftOut` counts the candidates with a label inside, or with a patch over them, or with another use of the project knowledge over them. With `--apply-macros`, `revision` gives the revision of the writes, and `writes` counts them. The writes hold the macros that the project knowledge does not have, with their bodies, and the uses. Do not write these macros yourself. `otherMacros` names each macro that the project knowledge has with another body. The writes do not have the uses of that macro.
144
144
 
145
145
  #### Which facts the analysis replaces
146
146
 
@@ -165,7 +165,7 @@ The script does not record the candidates. Examine each candidate and decide.
165
165
  - `coverageGaps` has starts. Normally its count is 0. Each start is not in `--out-instructions` and not in the generated source. Examine the code at the start. Overlapped instructions and self-modified code can cause a gap. A start in a `dual-use` region is a known overlap, for example a BIT skip, and is not in the list.
166
166
  - `coverageSeeds.used` is smaller than `coverageSeeds.entryPoints`. The analysis did not use all entry points of the coverage. Give the important entry points with `--entry`, or record them as routines in the project knowledge. These come first.
167
167
  - `romOnlyUsed` is smaller than `romOnlyRanges`. The analysis did not keep all RAM under ROM as data. Classify the RAM under ROM that is not code as data in the project knowledge.
168
- - `notDecompiled` has a reason that the decompiler did not start. Give the remedy in the reason to the user.
168
+ - `notDecompiled` has a routine. The `reason` tells why the decompiler did not decompile it. Read the instructions of that routine in the file of `--out-instructions`.
169
169
 
170
170
  #### Failures
171
171
 
@@ -3,6 +3,7 @@
3
3
  // with a coverage file, whether the instruction ran.
4
4
 
5
5
  import { COVERAGE, formatC64Address } from "#src/c64.ts";
6
+ import { OPCODES, type Mode as OpcodeMode } from "#src/opcodes.ts";
6
7
  import type { GhidraInstruction } from "#src/native/types.ts";
7
8
 
8
9
  export type Mode =
@@ -20,26 +21,27 @@ export type Mode =
20
21
  | "(indirect),y"
21
22
  | "relative";
22
23
 
23
- const BRANCHES = new Set([0x10, 0x30, 0x50, 0x70, 0x90, 0xb0, 0xd0, 0xf0]);
24
- const JMP_INDIRECT = 0x6c;
24
+ /** ASL, ROL, LSR and ROR of the accumulator: the implied forms that work on A. */
25
+ const ACCUMULATOR = new Set([0x0a, 0x2a, 0x4a, 0x6a]);
25
26
 
26
- /**
27
- * The addressing mode from Ghidra's operand text and the instruction length.
28
- * Ghidra prints zero page and absolute alike, and JMP (indirect) as an
29
- * address, so the length and the opcode decide those.
30
- */
31
- export function modeOf(opcode: number, length: number, operands: string): Mode {
32
- const text = operands.toUpperCase();
33
- if (text === "") return "implied";
34
- if (text === "A") return "accumulator";
35
- if (text.startsWith("#")) return "immediate";
36
- if (text.startsWith("(") && text.endsWith(",X)")) return "(indirect,x)";
37
- if (text.startsWith("(") && text.endsWith("),Y")) return "(indirect),y";
38
- if (text.endsWith(",X")) return length === 2 ? "zeropage,x" : "absolute,x";
39
- if (text.endsWith(",Y")) return length === 2 ? "zeropage,y" : "absolute,y";
40
- if (BRANCHES.has(opcode)) return "relative";
41
- if (opcode === JMP_INDIRECT) return "(indirect)";
42
- return length === 2 ? "zeropage" : "absolute";
27
+ const MODES: Record<OpcodeMode, Mode> = {
28
+ imp: "implied",
29
+ imm: "immediate",
30
+ zp: "zeropage",
31
+ zpx: "zeropage,x",
32
+ zpy: "zeropage,y",
33
+ abs: "absolute",
34
+ abx: "absolute,x",
35
+ aby: "absolute,y",
36
+ ind: "(indirect)",
37
+ izx: "(indirect,x)",
38
+ izy: "(indirect),y",
39
+ rel: "relative",
40
+ };
41
+
42
+ /** The addressing mode of an opcode. */
43
+ export function modeOf(opcode: number): Mode {
44
+ return ACCUMULATOR.has(opcode) ? "accumulator" : MODES[OPCODES[opcode]!.mode];
43
45
  }
44
46
 
45
47
  /** The operand in 6502 syntax, from the instruction bytes; empty for implied. */
@@ -90,7 +92,7 @@ export interface ListedInstruction {
90
92
  export function instructionList(instructions: GhidraInstruction[], coverage?: Uint8Array): ListedInstruction[] {
91
93
  return instructions.map((instruction) => {
92
94
  const bytes = Buffer.from(instruction.bytes, "hex");
93
- const mode = modeOf(bytes[0]!, bytes.length, instruction.operands);
95
+ const mode = modeOf(bytes[0]!);
94
96
  const [target] = instruction.flows;
95
97
  return {
96
98
  address: formatC64Address(instruction.address),
@@ -119,13 +119,6 @@ function macroCandidates(space: string, byteAt: ImageByte, romUse: RomUse) {
119
119
  }
120
120
  }
121
121
 
122
- /** A decompiler that did not start gets the remedy: Ghidra ships no native decompiler for macOS. */
123
- function withRemedy(reason: string): string {
124
- return reason.startsWith("the Ghidra decompiler did not start")
125
- ? `${reason} On macOS, build the native decompiler once: in <Ghidra>/support/gradle run ./gradlew buildNatives.`
126
- : reason;
127
- }
128
-
129
122
  /** One conflict: what the knowledge has, and what the analyzer found, under the analyzer's name. */
130
123
  function showConflict(conflict: ImportConflict, analyzer: Analyzer): Record<string, unknown> {
131
124
  if (conflict.category === "code-evidence") {
@@ -340,7 +333,7 @@ async function analyze(call: Call): Promise<unknown> {
340
333
  decompilations: result.decompilations.map((item) => ({ entry: formatC64Address(item.entry), text: item.text, ...(item.truncated ? { truncated: true } : {}) })),
341
334
  ...((result.notDecompiled ?? []).length === 0
342
335
  ? {}
343
- : { notDecompiled: result.notDecompiled!.map((item) => ({ entry: formatC64Address(item.entry), reason: withRemedy(item.reason) })) }),
336
+ : { notDecompiled: result.notDecompiled!.map((item) => ({ entry: formatC64Address(item.entry), reason: item.reason })) }),
344
337
  };
345
338
  return withHint(body, imported.conflicts.length + found.idioms.conflicts.length, body.coverageConflicts?.length ?? 0, { candidates: found.idioms.candidates.macros.count, applied: applyMacros, revision: found.idioms.candidates.macros.revision });
346
339
  }
@@ -42,6 +42,7 @@ To get the command list, run the script with no arguments.
42
42
  - The original gets its names from the project knowledge. Give `"symbols": "knowledge"` for the original.
43
43
  - The rebuild gets its names from the symbol file of its build. Build the rebuild with a symbol file that has all symbols, also the constants that the source does not use.
44
44
  - You write the scenario file, the run file and the record file. Their formats are in the files of the section "Reference".
45
+ - A file in `tests/` is a scenario or a run file with expected values. Give a scenario to `test` and a run file to `run`. `test` refuses a run file.
45
46
  - `<recording>` is the `--out` folder of `record`.
46
47
  - `--checkpoint` is a routine that the program executes one time in each pass of its game logic, for example the main loop. Do not use an interrupt handler. Get the name from the project knowledge.
47
48
  - `--state` and `--pin` take a name or a `$` address, with `:size` for more than one byte, for example `room:2`. Use the names that the project knowledge has at the time of the replay.
@@ -54,6 +54,14 @@ A record file has no `raster` target and no `condition`. `write` and `runUntil`
54
54
 
55
55
  A `press` step can press A to Z, 0 to 9, space, return (`\n`) and `+-.:@,*;=/!"#$%&'()[]<>?`. It presses a to z as A to Z.
56
56
 
57
+ A key without a character has its name in braces, in upper or lower case. `{STOP}` is RUN/STOP, and `{CBM}` is the Commodore key. The names are:
58
+
59
+ - `{F1}` to `{F8}`, `{RETURN}`, `{SPACE}`, `{DEL}`, `{INST}`, `{HOME}`, `{CLR}`
60
+ - `{STOP}`, `{RUN}`, `{CTRL}`, `{CBM}`, `{LSHIFT}`, `{RSHIFT}`
61
+ - `{UP}`, `{DOWN}`, `{LEFT}`, `{RIGHT}`, `{POUND}`, `{UPARROW}`, `{LEFTARROW}`
62
+
63
+ For example, `{ "press": "{F1}" }` presses F1. The step presses each key alone, one after the other. It cannot hold two keys at the same time.
64
+
57
65
  The keyboard queue of the KERNAL holds 10 keys. If the keys of a `type` step and the keys that wait in the queue do not fit, the session stops. A program that reads the keyboard hardware does not see the keys of a `type` step. Use `press` for that program.
58
66
 
59
67
  `joystick`, `press` and `frames` steps are input and time. The recording keeps their effect in the reads, so a replay does not do these steps again.
@@ -0,0 +1,36 @@
1
+ // The keys of the keyboard matrix that the replay core presses: the key codes
2
+ // of chips c64.h, and 11, 12 and 5e of c64run. The play page and the press
3
+ // step of a record file use the same codes.
4
+
5
+ /** The key codes of the keys that have no character of their own. */
6
+ export const C64_KEYS = {
7
+ del: 0x01, clr: 0x02, stop: 0x03, leftArrow: 0x04, run: 0x07, csrLeft: 0x08, csrRight: 0x09, csrDown: 0x0a, csrUp: 0x0b,
8
+ home: 0x0c, return: 0x0d, ctrl: 0x0e, cbm: 0x0f, inst: 0x10, leftShift: 0x11, rightShift: 0x12, space: 0x20, upArrow: 0x5e, pound: 0x7e,
9
+ } as const;
10
+
11
+ /** F1 to F8: F2, F4, F6 and F8 press SHIFT with the key. */
12
+ export const F_KEYS = [0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8];
13
+
14
+ /** The keys that a press step names in braces, for example {F1}. */
15
+ export const NAMED_KEYS: Readonly<Record<string, number>> = {
16
+ ...Object.fromEntries(F_KEYS.map((key, index) => [`F${index + 1}`, key])),
17
+ RETURN: C64_KEYS.return,
18
+ SPACE: C64_KEYS.space,
19
+ DEL: C64_KEYS.del,
20
+ INST: C64_KEYS.inst,
21
+ HOME: C64_KEYS.home,
22
+ CLR: C64_KEYS.clr,
23
+ STOP: C64_KEYS.stop,
24
+ RUN: C64_KEYS.run,
25
+ CTRL: C64_KEYS.ctrl,
26
+ CBM: C64_KEYS.cbm,
27
+ LSHIFT: C64_KEYS.leftShift,
28
+ RSHIFT: C64_KEYS.rightShift,
29
+ UP: C64_KEYS.csrUp,
30
+ DOWN: C64_KEYS.csrDown,
31
+ LEFT: C64_KEYS.csrLeft,
32
+ RIGHT: C64_KEYS.csrRight,
33
+ POUND: C64_KEYS.pound,
34
+ UPARROW: C64_KEYS.upArrow,
35
+ LEFTARROW: C64_KEYS.leftArrow,
36
+ };
@@ -9,6 +9,7 @@
9
9
  import { createServer, type ServerResponse } from "node:http";
10
10
 
11
11
  import { PAL_FRAME_CYCLES, type C64RunSession } from "#src/native/c64run.ts";
12
+ import { C64_KEYS, F_KEYS } from "./keys.ts";
12
13
 
13
14
  const FRAME_MS = 20;
14
15
 
@@ -26,12 +27,7 @@ export interface PlayOptions {
26
27
  restore: () => Promise<string | undefined>;
27
28
  }
28
29
 
29
- /** The key codes of the replay core: chips c64.h, and 11, 12 and 5e of c64run. */
30
- const C64 = {
31
- del: 0x01, clr: 0x02, stop: 0x03, leftArrow: 0x04, run: 0x07, csrLeft: 0x08, csrRight: 0x09, csrDown: 0x0a, csrUp: 0x0b,
32
- home: 0x0c, return: 0x0d, ctrl: 0x0e, cbm: 0x0f, inst: 0x10, leftShift: 0x11, rightShift: 0x12, space: 0x20, upArrow: 0x5e, pound: 0x7e,
33
- } as const;
34
- const F_KEYS = [0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8];
30
+ const C64 = C64_KEYS;
35
31
  const LETTERS = [..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
36
32
  const DIGITS = [..."0123456789"];
37
33
  const code = (character: string) => character.charCodeAt(0);
@@ -19,6 +19,7 @@ import { readProjectFile, type Written } from "#src/host-client/transfer.ts";
19
19
  import { START_SCREEN_CONTINUE, START_SCREEN_WAIT } from "#src/knowledge/start-screen.ts";
20
20
  import { PAL_FRAME_CYCLES, type C64RunSession, type CoreStatus } from "#src/native/c64run.ts";
21
21
  import type { Workspace } from "#src/native/staging.ts";
22
+ import { NAMED_KEYS } from "./keys.ts";
22
23
  import { namesOf, type Outcome } from "./scenario.ts";
23
24
 
24
25
  export const RECORDING_FORMAT = 1;
@@ -144,11 +145,19 @@ const KEY_CODES = new Map<string, number>([
144
145
  ["\n", 0x0d],
145
146
  ]);
146
147
 
147
- /** The key codes of a text; a-z type as A-Z, as the C64 shows them after power-on. */
148
+ /**
149
+ * The key codes of a text; a-z type as A-Z, as the C64 shows them after
150
+ * power-on. A key without a character has its name in braces, for example {F1}.
151
+ */
148
152
  export function keyCodes(text: string): number[] {
149
- return [...text.replace(/\r\n?/g, "\n")].map((character) => {
150
- const code = KEY_CODES.get(character.toUpperCase());
151
- if (code === undefined) throw new Refusal("invalid-input", `press cannot press ${JSON.stringify(character)} on the C64 keyboard`);
153
+ return (text.replace(/\r\n?/g, "\n").match(/\{[^{}]*\}|[^]/g) ?? []).map((part) => {
154
+ if (part.length > 1) {
155
+ const named = NAMED_KEYS[part.slice(1, -1).toUpperCase()];
156
+ if (named === undefined) throw new Refusal("invalid-input", `press has no key ${part}. The keys in braces are ${Object.keys(NAMED_KEYS).map((name) => `{${name}}`).join(", ")}`);
157
+ return named;
158
+ }
159
+ const code = KEY_CODES.get(part.toUpperCase());
160
+ if (code === undefined) throw new Refusal("invalid-input", `press cannot press ${JSON.stringify(part)} on the C64 keyboard`);
152
161
  return code;
153
162
  });
154
163
  }
@@ -27,7 +27,6 @@ Use only the MCP tools. Each MCP session has its own machine. Nothing else can c
27
27
 
28
28
  | Need | C64 tool |
29
29
  |---|---|
30
- | Run state, warp mode, window | `c64_status` |
31
30
  | Reset, power cycle | `c64_reset` |
32
31
  | Fast emulation | `c64_warp` |
33
32
  | Show the machine to the user in a window, hide it again | `c64_window` |
@@ -64,12 +63,11 @@ To keep a coverage run:
64
63
  ## Workflow
65
64
 
66
65
  1. Read the project knowledge for the addresses in the question.
67
- 2. Get the machine state with `c64_status`.
68
- 3. Load the subject if it is not loaded. Use `c64_autostart` to start it as a user does. Use `c64_program_load` to put a program in memory with no start.
69
- 4. Set the stop condition. Use a breakpoint, a watchpoint or a `c64_run_until` target. Add a condition when the stop must occur only in one state.
70
- 5. Run, step or give input. Prefer `c64_run_until` and `advance-frames` to waits. They stop at the same emulated time on every run.
71
- 6. Read only the state that answers the question. To read several things from one moment, use `c64_observe`.
72
- 7. Interpret the evidence. Keep the observed facts apart from your conclusions.
66
+ 2. Load the subject if it is not loaded. Use `c64_autostart` to start it as a user does. Use `c64_program_load` to put a program in memory with no start.
67
+ 3. Set the stop condition. Use a breakpoint, a watchpoint or a `c64_run_until` target. Add a condition when the stop must occur only in one state.
68
+ 4. Run, step or give input. Prefer `c64_run_until` and `advance-frames` to waits. They stop at the same emulated time on every run.
69
+ 5. Read only the state that answers the question. To read several things from one moment, use `c64_observe`.
70
+ 6. Interpret the evidence. Keep the observed facts apart from your conclusions.
73
71
 
74
72
  Before a risky experiment, save the state with `c64_snapshot`. Restore it to try again from the same point.
75
73
 
@@ -78,7 +76,7 @@ Before a risky experiment, save the state with `c64_snapshot`. Restore it to try
78
76
  Some programs read input in a way that the input tools cannot give. The tool description tells when. Then use one of these ways:
79
77
 
80
78
  - Open the window and ask the user to give the input.
81
- - Record a test session with a `press` step.
79
+ - Record a test session with a `press` step. A `press` step presses one key of the keyboard matrix at a time, for example `{F1}` or `{STOP}`, in a session of a PRG file.
82
80
 
83
81
  Do not change the program to make it accept the input.
84
82
 
package/src/cli/main.ts CHANGED
@@ -1,20 +1,16 @@
1
1
  #!/usr/bin/env tsx
2
2
  // The human CLI: installs the skills and the VICE MCP
3
- // declaration into agent harnesses through AP SDK, and reports status. It is
4
- // thin: AP SDK does the harness-specific work.
3
+ // declaration into agent harnesses through AP SDK. It is thin: AP SDK does
4
+ // the harness-specific work.
5
5
 
6
- import { dirname, join } from "node:path";
7
- import { fileURLToPath } from "node:url";
8
6
  import { parseArgs } from "node:util";
9
7
 
10
8
  import { oldNodeRefusal, PACKAGE } from "../package.ts";
11
9
  import { localToolContext } from "../native/local.ts";
12
- import { localToolStatus } from "../native/status.ts";
13
10
  import { isRefusal } from "../errors.ts";
14
11
  import { startTrace } from "../trace.ts";
15
12
  import { runApSdk } from "./ap-sdk.ts";
16
13
  import { installedItems, parseTargets, removeDroppedItems, tidyAfterUninstall, type Scope, undoWindsurfProjectMcp, windsurfBefore, withoutWindsurfMcp } from "./cleanup.ts";
17
- import { hostStatusLines, installedLines, toolLines } from "./status.ts";
18
14
 
19
15
  const HELP = `c64-re-tools: Commodore 64 reverse engineering and development
20
16
 
@@ -22,7 +18,6 @@ Usage:
22
18
  c64-re-tools install [--target <harnesses>] [--global] install the skills and the VICE MCP
23
19
  c64-re-tools update [--target <harnesses>] [--global] install this version over an earlier one
24
20
  c64-re-tools uninstall [--target <harnesses>] [--global] remove them
25
- c64-re-tools status version, package, tools and the Host Runtime
26
21
  c64-re-tools --help
27
22
 
28
23
  Harnesses: claude, codex, pi, opencode, gemini, copilot, cursor, windsurf
@@ -36,9 +31,8 @@ project folder below the root uses that install; a project is a folder with
36
31
  through npx. The Host Runtime runs on the machine with VICE: start it there
37
32
  with npx -y --package=${PACKAGE.name}@${PACKAGE.tag} c64-re-tools-host.
38
33
  It runs VICE and the tools that come with it (c1541, petcat). The skill
39
- scripts run ACME, DXA, Exomizer, Ghidra and c64run in the dev container.`;
34
+ scripts run ACME, DXA, Exomizer and c64run in the dev container.`;
40
35
 
41
- const here = dirname(fileURLToPath(import.meta.url));
42
36
 
43
37
  /** Runs the AP SDK CLI. Writes its error output to stderr and returns its exit status and its report. */
44
38
  async function apSdk(command: "install" | "uninstall", flags: readonly string[]): Promise<{ code: number; output: string }> {
@@ -48,20 +42,6 @@ async function apSdk(command: "install" | "uninstall", flags: readonly string[])
48
42
  return { code: run.code, output: run.stdout };
49
43
  }
50
44
 
51
- async function status(): Promise<number> {
52
- console.log(`c64-re-tools ${PACKAGE.version}`);
53
- console.log(`Package: ${join(here, "..", "..")}`);
54
- console.log(`Node: ${process.version} (${process.execPath})`);
55
- for (const line of installedLines()) console.log(line);
56
- // The skill scripts run these tools here, on this machine.
57
- const local = await localToolStatus(localToolContext());
58
- for (const line of toolLines("Tools here:", local)) console.log(line);
59
- const host = await hostStatusLines();
60
- for (const line of host.lines) console.log(line);
61
- // A script or a CI check can tell a ready setup from a broken one.
62
- return host.ready && local.every((tool) => tool.runs) ? 0 : 1;
63
- }
64
-
65
45
  async function main(argv: string[]): Promise<number> {
66
46
  startTrace("cli", { warn: (line) => console.error(line) });
67
47
  const { values, positionals } = parseArgs({
@@ -106,12 +86,6 @@ async function main(argv: string[]): Promise<number> {
106
86
  if (code === 0) tidyAfterUninstall(items, scope);
107
87
  return code;
108
88
  }
109
- case "status":
110
- if (flags.length > 0) {
111
- console.error(`status takes no --target or --global.\n\n${HELP}`);
112
- return 2;
113
- }
114
- return status();
115
89
  default:
116
90
  console.error(`Unknown command ${command}.\n\n${HELP}`);
117
91
  return 2;
package/src/host/main.ts CHANGED
@@ -126,7 +126,7 @@ async function main(): Promise<number> {
126
126
  return result.action === "directory" ? result.entries : [];
127
127
  },
128
128
  }),
129
- tools: createToolDispatcher({ supervisor, log, vice }),
129
+ tools: createToolDispatcher({ supervisor, log }),
130
130
  });
131
131
  } catch (error) {
132
132
  if (error instanceof ListenError && error.code === "EADDRINUSE") {