1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
;;; Copyright (c) 2026 Nicholas Vermeulen
;;; SPDX-License-Identifier: AGPL-3.0-or-later
;; pkg.lisp — a registry-less package manager (Phase 5.2, pure Lisp).
;;
;; A PACKAGE is any git repository with a `package.lisp` manifest at its
;; root — one alist:
;; ((name "mylib") (version "0.1.0") (main "mylib.lisp")
;; (deps ("https://github.com/user/otherlib" ...))) ; deps optional
;;
;; Install = `git clone` into ~/.rusty/packages/<name>. Any URL git
;; understands works — https, ssh, file:// — so there is no central
;; registry to stand up or trust (the Go-modules lesson); a hosted index
;; can layer on later without changing this format.
;;
;; (pkg-install url [tag]) clone (optionally at a tag) + install deps
;; (pkg-load name) load an installed package's main file
;; (require-package url [tag]) install-if-missing, then load
;; (pkg-list) / (pkg-remove name)
;; ── Integrity ────────────────────────────────────────────────────────────
;; What you install from a git URL is whatever that URL served you. A
;; fingerprint gives an installed package a comparable identity: every file
;; under it with its SHA-256, sorted by path (dir-list sorts, so two machines
;; that installed the same bytes agree exactly).
;;
;; HONEST SCOPE, twice over:
;; 1. A fingerprint proves SAMENESS, not safety. Identical bytes to a
;; malicious package are still malicious. It answers "is this what I
;; installed / what the publisher meant?" — never "is this good?".
;; 2. A fingerprint is only worth WHERE IT CAME FROM. One the package hands
;; you itself — in its own manifest, in its own repo — proves nothing:
;; whoever changes the files changes the manifest in the same commit.
;; That is why there is no (files ...) hash key in the manifest format;
;; it would look like a guarantee and be none. An expected fingerprint has
;; to reach you another way: the publisher's site, a release note, a
;; counterparty, or your own record from install day (that last one is
;; what pkg-lock! keeps, and it detects local drift only — an attacker on
;; your machine can rewrite the lock as easily as the package).
;;
;; .git is skipped: two clones of the same commit are not byte-identical there,
;; so including it would make every fingerprint disagree with every other.
;; Symlinks are followed (file-hash follows them), so a package that symlinks
;; outside its own tree fingerprints its target's bytes, not the link.
;; No is-a-directory? builtin exists; dir-list raises on a regular file, and
;; that raise is the test.
;; -> ((relpath sha256) ...) sorted, or #f if not installed
;; Name what moved, per file: changed / missing / added. A verdict of "this
;; package differs" without saying WHERE is not worth printing.
;; 'verified | (changed ((path what) ...)) | (not-installed name)
;; Locks live OUTSIDE the package directory on purpose: a lock inside the tree
;; it vouches for would be rewritten by the same `git pull` (or hand-edit) it
;; is supposed to notice, and would change its own fingerprint besides.
;; Has anything under an installed package changed since it was installed?
;; 'verified | (changed ...) | (no-lock name) | (not-installed name)
;; Give the package manager its own help category (embedded + auto-loaded into
;; every env, so these appear in (help)/(apropos)/(command-registry) unprefixed).
;; Without this the 24 pkg-* names all fall into "other".