@henols/c64-re-tools 1.1.0 → 2.0.0-rc.10

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +154 -37
  3. package/distribution/package.ts +21 -0
  4. package/distribution/plugin.ts +122 -0
  5. package/package.json +34 -40
  6. package/skills/c64-assembler/SKILL.md +76 -0
  7. package/skills/c64-assembler/scripts/assemble.ts +110 -0
  8. package/skills/c64-assembler/scripts/compare.ts +84 -0
  9. package/skills/c64-basic/SKILL.md +66 -0
  10. package/skills/c64-basic/scripts/basic.ts +46 -0
  11. package/skills/c64-disk/SKILL.md +93 -0
  12. package/skills/c64-disk/scripts/containers.ts +124 -0
  13. package/skills/c64-disk/scripts/disk.ts +120 -0
  14. package/skills/c64-emulator/SKILL.md +134 -0
  15. package/skills/c64-knowledge/SKILL.md +166 -0
  16. package/skills/c64-knowledge/scripts/knowledge.ts +492 -0
  17. package/skills/c64-memory-map/SKILL.md +79 -0
  18. package/skills/c64-memory-map/scripts/memmap.ts +92 -0
  19. package/skills/c64-provenance/SKILL.md +110 -0
  20. package/skills/c64-provenance/scripts/compare.ts +152 -0
  21. package/skills/c64-provenance/scripts/provenance.ts +334 -0
  22. package/skills/c64-provenance/scripts/runtime.ts +191 -0
  23. package/skills/c64-provenance/scripts/separate.ts +140 -0
  24. package/skills/c64-reverse-engineering/SKILL.md +144 -0
  25. package/skills/c64-source/SKILL.md +126 -0
  26. package/skills/c64-source/scripts/generate.ts +490 -0
  27. package/skills/c64-source/scripts/loader.ts +571 -0
  28. package/skills/c64-source/scripts/opcodes.ts +61 -0
  29. package/skills/c64-source/scripts/source.ts +595 -0
  30. package/skills/c64-static-analysis/SKILL.md +119 -0
  31. package/skills/c64-static-analysis/scripts/analyze.ts +275 -0
  32. package/skills/c64-static-analysis/scripts/coverage.ts +78 -0
  33. package/skills/c64-static-analysis/scripts/findings.ts +75 -0
  34. package/skills/c64-static-analysis/scripts/idioms.ts +149 -0
  35. package/skills/c64-static-analysis/scripts/instructions.ts +105 -0
  36. package/skills/c64-testing/SKILL.md +103 -0
  37. package/skills/c64-testing/references/scenario-format.md +116 -0
  38. package/skills/c64-testing/scripts/checklist.ts +51 -0
  39. package/skills/c64-testing/scripts/run.ts +189 -0
  40. package/skills/c64-testing/scripts/scenario.ts +493 -0
  41. package/skills/c64-testing/scripts/test.ts +65 -0
  42. package/skills/c64-unpacker/SKILL.md +135 -0
  43. package/skills/c64-unpacker/scripts/evidence.ts +207 -0
  44. package/skills/c64-unpacker/scripts/loads.ts +209 -0
  45. package/skills/c64-unpacker/scripts/machine.ts +80 -0
  46. package/skills/c64-unpacker/scripts/stages.ts +130 -0
  47. package/skills/c64-unpacker/scripts/unpack.ts +683 -0
  48. package/src/c64.ts +411 -0
  49. package/src/cli/ap-sdk.ts +44 -0
  50. package/src/cli/cleanup.ts +194 -0
  51. package/src/cli/main.ts +125 -0
  52. package/src/cli/status.ts +61 -0
  53. package/src/host/main.ts +134 -0
  54. package/src/host/server.ts +392 -0
  55. package/src/host/tools/c1541.ts +284 -0
  56. package/src/host/tools/index.ts +35 -0
  57. package/src/host/tools/petcat.ts +77 -0
  58. package/src/host/tools/status.ts +47 -0
  59. package/src/host/tools/version.ts +41 -0
  60. package/src/host/vice/adapter.ts +804 -0
  61. package/src/host/vice/binary-monitor.ts +389 -0
  62. package/src/host/vice/chips.ts +118 -0
  63. package/src/host/vice/connect.ts +34 -0
  64. package/src/host/vice/process.ts +413 -0
  65. package/src/host/vice/screen.ts +184 -0
  66. package/src/host/vice/session.ts +1426 -0
  67. package/src/host/vice/text-monitor.ts +223 -0
  68. package/src/host-client/autostart.ts +55 -0
  69. package/src/host-client/connect.ts +241 -0
  70. package/src/host-client/coverage.ts +63 -0
  71. package/src/host-client/steps.ts +170 -0
  72. package/src/host-client/tools.ts +89 -0
  73. package/src/host-client/transfer.ts +126 -0
  74. package/src/host-client/vice-session.ts +316 -0
  75. package/src/knowledge/database.ts +132 -0
  76. package/src/knowledge/history.ts +163 -0
  77. package/src/knowledge/import.ts +391 -0
  78. package/src/knowledge/read.ts +342 -0
  79. package/src/knowledge/schema.ts +229 -0
  80. package/src/knowledge/write.ts +663 -0
  81. package/src/mcp/main.ts +134 -0
  82. package/src/mcp/output.ts +32 -0
  83. package/src/mcp/server.ts +316 -0
  84. package/src/mcp/tools/debug.ts +327 -0
  85. package/src/mcp/tools/execution.ts +117 -0
  86. package/src/mcp/tools/input.ts +72 -0
  87. package/src/mcp/tools/machine.ts +100 -0
  88. package/src/mcp/tools/media.ts +129 -0
  89. package/src/mcp/tools/memory.ts +250 -0
  90. package/src/mcp/tools/video.ts +271 -0
  91. package/src/native/acme.ts +116 -0
  92. package/src/native/discover.ts +179 -0
  93. package/src/native/dxa.ts +166 -0
  94. package/src/native/ghidra/analyze.ts +86 -0
  95. package/src/native/ghidra/index.ts +173 -0
  96. package/src/native/ghidra/language/c64rt_6510.cspec +34 -0
  97. package/src/native/ghidra/language/c64rt_6510.ldefs +15 -0
  98. package/src/native/ghidra/language/c64rt_6510.pspec +15 -0
  99. package/src/native/ghidra/language/c64rt_6510.slaspec +596 -0
  100. package/src/native/ghidra/scripts/C64Export.java +274 -0
  101. package/src/native/ghidra/scripts/C64Prepare.java +60 -0
  102. package/src/native/local.ts +34 -0
  103. package/src/native/processes.ts +350 -0
  104. package/src/native/run.ts +172 -0
  105. package/src/native/staging.ts +83 -0
  106. package/src/native/status.ts +113 -0
  107. package/src/native/types.ts +257 -0
  108. package/src/native/watchdog.ts +78 -0
  109. package/src/package.ts +21 -0
  110. package/src/platform.ts +441 -0
  111. package/src/project.ts +39 -0
  112. package/src/protocol/framing.ts +132 -0
  113. package/src/protocol/messages.ts +259 -0
  114. package/src/protocol/tools.ts +266 -0
  115. package/src/protocol/vice.ts +1348 -0
  116. package/src/script.ts +60 -0
  117. package/src/time.ts +15 -0
  118. package/src/trace.ts +194 -0
  119. package/THIRD-PARTY-NOTICES.md +0 -26
  120. package/bin/cli.mjs +0 -283
  121. package/skills/acme-build/SKILL.md +0 -260
  122. package/skills/acme-build/scripts/acme.mjs +0 -341
  123. package/skills/acme-build/template.a +0 -53
  124. package/skills/c64-disk-access/SKILL.md +0 -159
  125. package/skills/c64-disk-access/scripts/c1541.mjs +0 -569
  126. package/skills/c64-memory-mapping/SKILL.md +0 -631
  127. package/skills/c64-memory-mapping/memmap.json +0 -8800
  128. package/skills/c64-memory-mapping/scripts/driver.mjs +0 -553
  129. package/skills/c64-petcat/SKILL.md +0 -87
  130. package/skills/c64-petcat/scripts/petcat.mjs +0 -221
  131. package/skills/c64-program-recon/SKILL.md +0 -706
  132. package/skills/c64-program-recon/references/control-flow.md +0 -180
  133. package/skills/c64-program-recon/references/graphics.md +0 -79
  134. package/skills/c64-program-recon/references/observation-hazards.md +0 -143
  135. package/skills/c64-program-recon/references/reconstruction.md +0 -133
  136. package/skills/c64-program-recon/references/sound-and-input.md +0 -74
  137. package/skills/c64-program-recon/references/tool-selection.md +0 -78
  138. package/skills/c64-program-recon/scripts/derive.mjs +0 -364
  139. package/skills/c64-program-recon/scripts/packer-finding.mjs +0 -709
  140. package/skills/c64-program-recon/templates/memory-map.template.md +0 -101
  141. package/skills/c64-provenance-diff/SKILL.md +0 -292
  142. package/skills/c64-provenance-diff/scripts/diff-images.mjs +0 -984
  143. package/skills/c64-provenance-diff/scripts/recovery-schema.mjs +0 -395
  144. package/skills/c64-ram-capture/RELEASES.json.example +0 -17
  145. package/skills/c64-ram-capture/SKILL.md +0 -474
  146. package/skills/c64-ram-capture/scripts/compare-cross-binary.mjs +0 -525
  147. package/skills/c64-ram-capture/scripts/compare.mjs +0 -258
  148. package/skills/c64-ram-capture/scripts/derive-transients.mjs +0 -575
  149. package/skills/c64-ram-capture/scripts/dump-artifacts.mjs +0 -317
  150. package/skills/c64-ram-capture/scripts/mcp-module.mjs +0 -174
  151. package/skills/c64-ram-capture/scripts/project-paths.mjs +0 -81
  152. package/skills/c64-ram-capture/scripts/releases.mjs +0 -109
  153. package/skills/c64-ram-capture/scripts/vsf-slice.mjs +0 -147
  154. package/skills/c64-ram-capture/scripts/watch-loads.mjs +0 -581
  155. package/skills/c64-ram-capture/templates/capture-record.template.md +0 -99
  156. package/skills/c64-ram-capture/transients/README.md +0 -137
  157. package/skills/routine-queue-walker/SKILL.md +0 -394
  158. package/skills/routine-queue-walker/scripts/completeness-report.mjs +0 -465
  159. package/skills/vice-wedge-triage/SKILL.md +0 -269
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env node
2
- // Slice a flat 64K RAM image out of a VICE `.vsf` snapshot, with no
3
- // transcription step anywhere.
4
- //
5
- // A WRAPPER, DELIBERATELY EMPTY OF LAYOUT KNOWLEDGE. Not one snapshot byte
6
- // offset, module name or body length appears in this file. Every such fact
7
- // lives in `src/mcp/vice/vsf-slice.ts`, which this script resolves and
8
- // invokes. If you came here looking for the layout, you are in the wrong
9
- // file, and that is the design.
10
- //
11
- // WHY IT INVOKES THE OTHER PACKAGE'S MODULE INSTEAD OF CARRYING A COPY.
12
- // THE CONSTRAINT, MEASURED rather than assumed: the MCP server ships as
13
- // `@henols/vice-mcp`, whose `files[]` lists only `src/mcp/vice/` contents,
14
- // while `src/skills/**` ships in the other package (`@henols/c64-re-tools`).
15
- // A plain `import` from a skill script into the MCP tree resolves on neither
16
- // npm-installer route, and a transitive
17
- // closure walk over `files[]` would fail the pack the moment a reachable
18
- // module sat outside the listed set.
19
- //
20
- // That leaves two answers, and this file takes the second:
21
- //
22
- // (a) a self-contained skill-side script carrying its own copy of the
23
- // layout -- the retired skill-side/MCP-side disk-image-reader pair's
24
- // own precedent (two independent copies of the sector-chain walk,
25
- // both deleted once the c1541 host-tool seam took over their one job).
26
- // (b) a CLI entry point on the MCP-side module, which the skill invokes.
27
- //
28
- // (b), because the two cases are not alike. That retired pair's own
29
- // duplicate was of a STABLE, PUBLISHED disk format that has not changed in
30
- // forty years. The
31
- // `.vsf` layout is version-sensitive: a second magic block moved the first
32
- // module offset, the memory module's body length differs between two module
33
- // minors that are both in the wild, and this project already had ONE stale
34
- // copy of those numbers -- a prototype carrying a first-module offset that
35
- // predates that second magic block, which survived only through a
36
- // byte-by-byte rescan fallback that can lock onto a false module name inside
37
- // 64 KB of RAM data. The real values, and their derivations, are in
38
- // `vsf-slice.ts` where they belong. A second copy of the one
39
- // authoritative reading of a version-sensitive format is precisely the
40
- // divergence hazard the single-seam convention exists to remove. Recorded
41
- // here as a decision so the next reader sees a choice rather than an
42
- // oversight.
43
- //
44
- // IT SPAWNS `node` ON AN IN-TREE MODULE, AND NOTHING ELSE. `process.execPath`
45
- // is the interpreter already running this script, and the target is a
46
- // JavaScript/TypeScript file inside one of this project's own two packages.
47
- // No external host binary is reached, so the host-tool execution seam is not
48
- // involved here and must not be pre-empted -- that seam is for binaries that
49
- // live on the host outside any container, which this is not.
50
- //
51
- // WHAT NOT TO DO:
52
- // - Never add a fallback that slices the snapshot here. If no rung of the
53
- // resolution ladder resolves, this script exits non-zero naming every
54
- // path it tried. A local re-implementation would turn a resolution
55
- // failure into a WRONG IMAGE, which is the one outcome the whole slicing
56
- // route exists to avoid.
57
- // - Never rewrite, prefix or summarise the target module's stderr. It is
58
- // inherited straight through, so a refusal reaches you in the words of
59
- // the code that refused.
60
- // - Never copy a snapshot byte offset, a module body length or a module
61
- // name into this file, not even in a comment as documentation, and not
62
- // even into the usage text. The next person to update the layout will
63
- // update `vsf-slice.ts` and will not know to look here. Its colocated
64
- // test asserts the absence mechanically, so this is a red gate rather
65
- // than a promise. (The `$D000-$DFFF` range in the usage below is a C64
66
- // address range and a fact about the memory-read route, not a snapshot
67
- // layout constant.)
68
- import { spawnSync } from "node:child_process";
69
-
70
- // The resolution ladder used to live HERE,
71
- // as this file's own `ladder()`/`resolveTarget()` pair. It is now extracted
72
- // to `mcp-module.mjs` (`resolveMcpModule()`/`refusalMessage()`), because two
73
- // MORE skill scripts (`acme.mjs`, `packer-finding.mjs`) needed the identical
74
- // lookup to reach the host-tool execution seam's `host-tool-client.ts`, and
75
- // three copies of one ladder is exactly the divergence hazard this file's own
76
- // header (below) already warns about for the `.vsf` layout itself. Import
77
- // the ladder rather than re-adding a copy here.
78
- import { resolveMcpModule, refusalMessage, TARGET_PACKAGE } from "./mcp-module.mjs";
79
-
80
- /** The MCP-side module's file name, in one place. */
81
- const TARGET_FILE = "vsf-slice.ts";
82
-
83
- /** Forwards argv to the MCP-side entry point with stdio inherited, so its
84
- * stdout and stderr reach the caller unmodified and its exit status is this
85
- * script's exit status. */
86
- function forward(argv) {
87
- const resolved = resolveMcpModule(TARGET_FILE);
88
-
89
- if (!resolved.ok) {
90
- console.error(
91
- `vsf-slice.mjs: ${refusalMessage(TARGET_FILE, resolved.rungs)}\n` +
92
- `${TARGET_FILE} is where the .vsf layout lives. Refusing rather than slicing the snapshot ` +
93
- `here: a second copy of a version-sensitive byte layout is how a wrong image gets produced ` +
94
- `with no error.`,
95
- );
96
- return 1;
97
- }
98
-
99
- const run = spawnSync(process.execPath, [resolved.path, ...argv], { stdio: "inherit" });
100
- if (run.error) {
101
- console.error(`vsf-slice.mjs: could not run ${resolved.path}: ${run.error.message}`);
102
- return 1;
103
- }
104
- if (run.signal) {
105
- console.error(`vsf-slice.mjs: ${resolved.path} was killed by ${run.signal}`);
106
- return 1;
107
- }
108
- return run.status ?? 1;
109
- }
110
-
111
- // Both verbs forward identically. The table exists so an unknown verb is
112
- // answered here, with this script's usage, rather than by a subprocess whose
113
- // own usage names a file the caller did not run.
114
- //
115
- // Prototype-less, via Object.create(null). A plain object
116
- // literal inherits Object.prototype, so `commands["constructor"]` and
117
- // `commands["toString"]` are truthy FUNCTIONS: an unknown verb that happens to
118
- // be a prototype member passed the known-verb test and was then CALLED, so the
119
- // documented usage was never printed and the failure surfaced as a confusing
120
- // message from process.exit() about its argument type instead. Same idiom this
121
- // file already uses for its flag bag, applied one level up.
122
- const commands = Object.assign(Object.create(null), { slice: forward, digest: forward });
123
-
124
- const [cmd, ...rest] = process.argv.slice(2);
125
- if (!cmd || !commands[cmd]) {
126
- console.error(`usage: node vsf-slice.mjs <command>
127
-
128
- slice <snapshot.vsf> --out <image.bin> [--json] write the flat 64K image
129
- digest <snapshot.vsf> sha256 of the sliced image, writing no file
130
-
131
- Produces a flat 64K image by slicing the snapshot's memory module body. There
132
- is no transcription step on this route, so the \`$D000-$DFFF\` volatility rule
133
- that governs the memory-read route does NOT apply to an image produced this
134
- way: the snapshot array is RAM under I/O, not the register read view.
135
-
136
- The layout lives in ${TARGET_FILE} on the MCP side; this script resolves it via
137
- VICE_MCP_DIR, the in-repo path, or ${TARGET_PACKAGE}, and refuses by name when
138
- no rung resolves. A malformed snapshot is refused, never truncated.`);
139
- process.exit(cmd ? 1 : 0);
140
- }
141
-
142
- try {
143
- process.exit(commands[cmd]([cmd, ...rest]));
144
- } catch (e) {
145
- console.error(`error: ${e.message}`);
146
- process.exit(1);
147
- }