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

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 (138) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +190 -37
  3. package/distribution/package.ts +36 -0
  4. package/distribution/plugin.ts +120 -0
  5. package/package.json +34 -40
  6. package/skills/c64-assembler/SKILL.md +73 -0
  7. package/skills/c64-assembler/scripts/assemble.ts +103 -0
  8. package/skills/c64-basic/SKILL.md +67 -0
  9. package/skills/c64-basic/scripts/basic.ts +46 -0
  10. package/skills/c64-disk/SKILL.md +79 -0
  11. package/skills/c64-disk/scripts/disk.ts +65 -0
  12. package/skills/c64-emulator/SKILL.md +124 -0
  13. package/skills/c64-knowledge/SKILL.md +102 -0
  14. package/skills/c64-knowledge/scripts/knowledge.ts +257 -0
  15. package/skills/c64-memory-map/SKILL.md +76 -0
  16. package/skills/c64-memory-map/scripts/memmap.ts +81 -0
  17. package/skills/c64-memory-map/scripts/platform.ts +424 -0
  18. package/skills/c64-provenance/SKILL.md +76 -0
  19. package/skills/c64-provenance/scripts/compare.ts +92 -0
  20. package/skills/c64-provenance/scripts/provenance.ts +83 -0
  21. package/skills/c64-reverse-engineering/SKILL.md +90 -0
  22. package/skills/c64-static-analysis/SKILL.md +96 -0
  23. package/skills/c64-static-analysis/scripts/analyze.ts +175 -0
  24. package/skills/c64-static-analysis/scripts/findings.ts +73 -0
  25. package/skills/c64-testing/SKILL.md +79 -0
  26. package/skills/c64-testing/references/scenario-format.md +76 -0
  27. package/skills/c64-testing/scripts/checklist.ts +51 -0
  28. package/skills/c64-testing/scripts/scenario.ts +473 -0
  29. package/skills/c64-testing/scripts/test.ts +55 -0
  30. package/skills/c64-unpacker/SKILL.md +82 -0
  31. package/skills/c64-unpacker/scripts/evidence.ts +135 -0
  32. package/skills/c64-unpacker/scripts/unpack.ts +216 -0
  33. package/src/c64.ts +281 -0
  34. package/src/cli/ap-sdk.ts +44 -0
  35. package/src/cli/cleanup.ts +194 -0
  36. package/src/cli/main.ts +122 -0
  37. package/src/cli/status.ts +34 -0
  38. package/src/host/main.ts +121 -0
  39. package/src/host/server.ts +409 -0
  40. package/src/host/tools/c1541.ts +255 -0
  41. package/src/host/tools/index.ts +31 -0
  42. package/src/host/tools/petcat.ts +70 -0
  43. package/src/host/tools/status.ts +30 -0
  44. package/src/host/tools/version.ts +41 -0
  45. package/src/host/vice/adapter.ts +761 -0
  46. package/src/host/vice/binary-monitor.ts +389 -0
  47. package/src/host/vice/chips.ts +108 -0
  48. package/src/host/vice/connect.ts +34 -0
  49. package/src/host/vice/process.ts +402 -0
  50. package/src/host/vice/screen.ts +183 -0
  51. package/src/host/vice/session.ts +1316 -0
  52. package/src/host/vice/text-monitor.ts +223 -0
  53. package/src/host-client/connect.ts +241 -0
  54. package/src/host-client/tools.ts +89 -0
  55. package/src/host-client/transfer.ts +100 -0
  56. package/src/host-client/vice-session.ts +254 -0
  57. package/src/knowledge/database.ts +132 -0
  58. package/src/knowledge/history.ts +128 -0
  59. package/src/knowledge/import.ts +344 -0
  60. package/src/knowledge/read.ts +191 -0
  61. package/src/knowledge/schema.ts +140 -0
  62. package/src/knowledge/write.ts +348 -0
  63. package/src/mcp/main.ts +109 -0
  64. package/src/mcp/server.ts +307 -0
  65. package/src/mcp/tools/debug.ts +237 -0
  66. package/src/mcp/tools/execution.ts +116 -0
  67. package/src/mcp/tools/input.ts +69 -0
  68. package/src/mcp/tools/machine.ts +97 -0
  69. package/src/mcp/tools/media.ts +106 -0
  70. package/src/mcp/tools/memory.ts +203 -0
  71. package/src/mcp/tools/video.ts +260 -0
  72. package/src/native/acme.ts +116 -0
  73. package/src/native/discover.ts +141 -0
  74. package/src/native/dxa.ts +166 -0
  75. package/src/native/ghidra/analyze.ts +86 -0
  76. package/src/native/ghidra/index.ts +157 -0
  77. package/src/native/ghidra/language/c64rt_6510.cspec +34 -0
  78. package/src/native/ghidra/language/c64rt_6510.ldefs +15 -0
  79. package/src/native/ghidra/language/c64rt_6510.pspec +15 -0
  80. package/src/native/ghidra/language/c64rt_6510.slaspec +596 -0
  81. package/src/native/ghidra/scripts/C64Export.java +242 -0
  82. package/src/native/ghidra/scripts/C64Prepare.java +60 -0
  83. package/src/native/local.ts +34 -0
  84. package/src/native/processes.ts +350 -0
  85. package/src/native/run.ts +172 -0
  86. package/src/native/staging.ts +83 -0
  87. package/src/native/status.ts +101 -0
  88. package/src/native/types.ts +228 -0
  89. package/src/native/watchdog.ts +78 -0
  90. package/src/project.ts +39 -0
  91. package/src/protocol/framing.ts +132 -0
  92. package/src/protocol/messages.ts +252 -0
  93. package/src/protocol/tools.ts +247 -0
  94. package/src/protocol/vice.ts +1235 -0
  95. package/src/script.ts +59 -0
  96. package/src/time.ts +15 -0
  97. package/src/trace.ts +162 -0
  98. package/THIRD-PARTY-NOTICES.md +0 -26
  99. package/bin/cli.mjs +0 -283
  100. package/skills/acme-build/SKILL.md +0 -260
  101. package/skills/acme-build/scripts/acme.mjs +0 -341
  102. package/skills/acme-build/template.a +0 -53
  103. package/skills/c64-disk-access/SKILL.md +0 -159
  104. package/skills/c64-disk-access/scripts/c1541.mjs +0 -569
  105. package/skills/c64-memory-mapping/SKILL.md +0 -631
  106. package/skills/c64-memory-mapping/memmap.json +0 -8800
  107. package/skills/c64-memory-mapping/scripts/driver.mjs +0 -553
  108. package/skills/c64-petcat/SKILL.md +0 -87
  109. package/skills/c64-petcat/scripts/petcat.mjs +0 -221
  110. package/skills/c64-program-recon/SKILL.md +0 -706
  111. package/skills/c64-program-recon/references/control-flow.md +0 -180
  112. package/skills/c64-program-recon/references/graphics.md +0 -79
  113. package/skills/c64-program-recon/references/observation-hazards.md +0 -143
  114. package/skills/c64-program-recon/references/reconstruction.md +0 -133
  115. package/skills/c64-program-recon/references/sound-and-input.md +0 -74
  116. package/skills/c64-program-recon/references/tool-selection.md +0 -78
  117. package/skills/c64-program-recon/scripts/derive.mjs +0 -364
  118. package/skills/c64-program-recon/scripts/packer-finding.mjs +0 -709
  119. package/skills/c64-program-recon/templates/memory-map.template.md +0 -101
  120. package/skills/c64-provenance-diff/SKILL.md +0 -292
  121. package/skills/c64-provenance-diff/scripts/diff-images.mjs +0 -984
  122. package/skills/c64-provenance-diff/scripts/recovery-schema.mjs +0 -395
  123. package/skills/c64-ram-capture/RELEASES.json.example +0 -17
  124. package/skills/c64-ram-capture/SKILL.md +0 -474
  125. package/skills/c64-ram-capture/scripts/compare-cross-binary.mjs +0 -525
  126. package/skills/c64-ram-capture/scripts/compare.mjs +0 -258
  127. package/skills/c64-ram-capture/scripts/derive-transients.mjs +0 -575
  128. package/skills/c64-ram-capture/scripts/dump-artifacts.mjs +0 -317
  129. package/skills/c64-ram-capture/scripts/mcp-module.mjs +0 -174
  130. package/skills/c64-ram-capture/scripts/project-paths.mjs +0 -81
  131. package/skills/c64-ram-capture/scripts/releases.mjs +0 -109
  132. package/skills/c64-ram-capture/scripts/vsf-slice.mjs +0 -147
  133. package/skills/c64-ram-capture/scripts/watch-loads.mjs +0 -581
  134. package/skills/c64-ram-capture/templates/capture-record.template.md +0 -99
  135. package/skills/c64-ram-capture/transients/README.md +0 -137
  136. package/skills/routine-queue-walker/SKILL.md +0 -394
  137. package/skills/routine-queue-walker/scripts/completeness-report.mjs +0 -465
  138. package/skills/vice-wedge-triage/SKILL.md +0 -269
@@ -1,159 +0,0 @@
1
- ---
2
- name: c64-disk-access
3
- description: Read a Commodore .d64 disk image's directory, block allocation map, a named file's sector chain, or a named file's raw bytes, using VICE's own c1541 disk tool as the reference implementation, and audit its directory for fabricated or corrupted entries. Use when asked to list what a disk image contains, check a disk's free blocks or block allocation map, trace which sectors a named file occupies on disk, extract a named file's raw bytes from a .d64, or check whether a disk's directory entries are genuine (a cracker-fabricated filename, a corrupted first track/sector, or a cyclic directory chain).
4
- ---
5
-
6
- # Reading C64 disk images with c1541
7
-
8
- Read-only. Six capabilities, one script, one binary (`c1541`) reached only
9
- through the host-tool execution seam:
10
-
11
- ```bash
12
- S=src/skills/c64-disk-access/scripts/c1541.mjs # from the repo root
13
-
14
- node $S bam --image path/to/image.d64 # block allocation map
15
- node $S dir --image path/to/image.d64 # what's on the disk
16
- node $S entry --image path/to/image.d64 --name FILENAME # one directory entry's raw fields
17
- node $S chain --image path/to/image.d64 --name FILENAME # a named file's sector chain
18
- node $S read --image path/to/image.d64 --name FILENAME # extract a named file's bytes
19
- node $S audit --image path/to/image.d64 # find fabricated/corrupted directory entries
20
- ```
21
-
22
- The script wraps `c1541` and nothing else — **read-only**. `bam`/`dir`/`audit`
23
- need only `--image`. `entry`/`chain`/`read` also need `--name`, a CBM
24
- filename or glob pattern (never a path). No `-format`, `-write`, `-bwrite`
25
- or `-delete` verb is reachable from here, deliberately: this skill only
26
- ever reads a disk image, never mutates one.
27
-
28
- Options: `--image PATH` `--name CBM-NAME` `--out-dir DIR` `--json`.
29
-
30
- `--out-dir` defaults to the image's own directory, exactly like
31
- `acme-build`'s own `--out-dir` default. Both `--image` and `--out-dir` are
32
- resolved **workspace-relative** to the smallest ancestor directory
33
- containing both, before the request reaches the seam. This is the same
34
- resolution `acme-build`'s `source`/`--out-dir` already go through. The seam
35
- passes `--name` straight through and never resolves it as a path. The seam
36
- refuses a value beginning with `-` before it spawns any child process.
37
- Otherwise `c1541`'s own CLI would read it as a flag.
38
-
39
- ## Directory listing
40
-
41
- ```bash
42
- node $S dir --image game.d64 --json
43
- ```
44
-
45
- Prints the seam's response verbatim as one line of JSON:
46
-
47
- ```json
48
- {"ok":true,"tool":"c1541.dir","exitStatus":0,"results":[{"path":"/abs/path/game.dir.txt","sha256":"...","byteLength":123}],"stderrTail":""}
49
- ```
50
-
51
- `results[0].path` names the listing file the seam wrote — `c1541`'s own
52
- `-dir` output, captured and digested.
53
-
54
- ## Block allocation map
55
-
56
- ```bash
57
- node $S bam --image game.d64 --json
58
- ```
59
-
60
- Same response shape as `dir`. `results[0].path` names a file carrying one
61
- per-sector allocation row per track. Each row is a run of `*`/`.`
62
- characters, `*` for an allocated sector.
63
-
64
- ## One directory entry's raw fields
65
-
66
- ```bash
67
- node $S entry --image game.d64 --name FILENAME --json
68
- ```
69
-
70
- `results[0].path` names a file carrying the entry's raw 32-byte directory
71
- record (as a hex dump). A `T/S: <t>/<s>, <n> blocks` summary line follows
72
- the record. This script also parses that line back and adds
73
- `firstTrack`/`firstSector` as numeric fields on the JSON response. These
74
- fields exist purely to show the values — the file itself is still the
75
- authoritative source.
76
-
77
- ## A named file's sector chain
78
-
79
- ```bash
80
- node $S chain --image game.d64 --name FILENAME --json
81
- ```
82
-
83
- `results[0].path` names a file listing every `(track,sector)` hop the file
84
- occupies, in order. A single-sector file's chain shows one hop with no
85
- second tuple on the arrow's right side. A multi-sector file's chain repeats
86
- the tuple at every hop.
87
-
88
- ## Extracting a named file's bytes
89
-
90
- ```bash
91
- node $S read --image game.d64 --name FILENAME --out-dir /scratch --json
92
- ```
93
-
94
- Writes the file's raw bytes. Unlike the other four capabilities, this one
95
- is NOT a captured-stdout listing — `c1541` writes the output file itself.
96
- `results[0]` carries that file's `path`/`sha256`/`byteLength`.
97
-
98
- ## Auditing for fabricated or corrupted entries
99
-
100
- ```bash
101
- node $S audit --image game.d64 --json
102
- ```
103
-
104
- The `audit` command composes `dir` (names and block counts) and `bam` (the
105
- per-sector allocation map). For each name, it also makes one `entry` call
106
- to get that file's own claimed first track/sector and its directory
107
- sector's "next directory" pointer. Together these calls form a ported,
108
- read-only detector — no `-format`/`-write`/mutating verb, and no seventh
109
- `host_tool` id. This is three existing capabilities composed client-side.
110
-
111
- The `audit` command flags a directory entry `suspicious`, with **named
112
- reasons, never a bare boolean**, on any of:
113
-
114
- 1. its block count is `0`.
115
- 2. its first track/sector lies outside the image's own geometry. There is
116
- no such track, or no such sector on that track.
117
- 3. the allocation map reports its first **sector** — not merely its whole
118
- track — free, meaning the file cannot really start there. This is
119
- sharper than checking only whether the whole track is free, because the
120
- per-sector map is available.
121
-
122
- A directory chain is cyclic or self-referential when two entries claim the
123
- same first track/sector. It is also cyclic or self-referential when a
124
- "next directory" pointer refers back to a sector already seen, including
125
- the directory's own starting sector. When this happens, the command stops
126
- treating the repeat as new information. Instead of looping, it reports a
127
- top-level `chain_error` naming the repeated pointer. Every remaining entry
128
- is still audited afterward — a chain error on one entry never hides another
129
- entry's own independent flag.
130
-
131
- ```json
132
- {"entries":[{"name":"basicstub","blocks":1,"first_track":17,"first_sector":0,"suspicious":false,"suspicious_reasons":[]}],"chain_error":null}
133
- ```
134
-
135
- **A flag is a signal to investigate, not a verdict.** A directory entry a
136
- cracker fabricated for a file never actually written, a genuinely
137
- corrupted image, and (rarely) an unusual-but-legitimate disk layout can
138
- all produce a flag. This command reports what it finds, named, and leaves
139
- the interpretation to whoever is looking at the disk.
140
-
141
- ## Failure shape
142
-
143
- The seam reports a nonexistent image, a nonexistent named entry, or any
144
- other call `c1541` cannot service as `{"ok":false,"message":"..."}` with a
145
- non-zero exit code. This is **never** a success envelope over an empty or
146
- partial result. `c1541` itself exits `0` even on a genuine failure (it
147
- prints its own `Error - ...` lines to stdout instead). The seam's own
148
- classifier, not the exit code, is what decides success here.
149
-
150
- ## What this skill does NOT do
151
-
152
- - **No mutating verb.** `-format`/`-write`/`-bwrite`/`-delete` are never
153
- reachable from this script, on the wire, or anywhere in this skill's tree
154
- — this skill exposes only the six read-only capabilities above.
155
- - **No direct binary spawn.** `c1541` runs host-side. This script only ever
156
- constructs a typed request and reads the produced files back off the
157
- shared workspace tree — the host-tool execution seam is the only route.
158
- - **No emulator dependency.** This skill names no VICE emulator tool at
159
- all — it works entirely on files, never on a running machine, by construction.