vit 0.6.2 → 0.6.4
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.
- package/package.json +1 -1
- package/skills/vit/SKILL.md +5 -1
- package/src/cli.js +9 -0
- package/src/cmd/doctor.js +9 -0
- package/src/cmd/init.js +15 -1
- package/src/cmd/remix.js +10 -5
- package/src/cmd/vet.js +10 -5
- package/src/lib/beacon.js +19 -0
- package/src/lib/constants.js +1 -0
package/package.json
CHANGED
package/skills/vit/SKILL.md
CHANGED
|
@@ -28,6 +28,10 @@ Dependency chain: `login → init → follow → skim/ship`.
|
|
|
28
28
|
|
|
29
29
|
Handoffs:
|
|
30
30
|
- If no DID is configured, tell the user to run `vit login <handle>`.
|
|
31
|
+
- If `vit login <handle>` says “Already logged in” but a session has been
|
|
32
|
+
revoked or later fails server authentication, tell the user to rerun
|
|
33
|
+
`vit login <handle> --force`. The ordinary login check only sees local
|
|
34
|
+
session material and can false-green a revoked token.
|
|
31
35
|
- If the user wants to review a cap, tell them to run `vit vet <ref>` in their terminal.
|
|
32
36
|
|
|
33
37
|
## 4. Commands the Agent Runs
|
|
@@ -166,7 +170,7 @@ When the user says "ship it", "vit ship", or asks you to publish a cap for work
|
|
|
166
170
|
## 5. Commands the Agent Must NOT Run
|
|
167
171
|
|
|
168
172
|
These commands require human interaction. Tell the user exactly what to run:
|
|
169
|
-
- `vit login <handle>` - Tell user: "Run `vit login <handle>` in your terminal to authenticate via browser OAuth."
|
|
173
|
+
- `vit login <handle>` - Tell user: "Run `vit login <handle>` in your terminal to authenticate via browser OAuth." If it falsely reports an existing login after revocation or a server-auth failure, add `--force` to restart authentication.
|
|
170
174
|
- `vit adopt <beacon>` - Tell user: "Run `vit adopt <beacon>` in your terminal to fork and clone a project."
|
|
171
175
|
- `vit vet <ref>` - Human review command. Tell the user to run it in their terminal.
|
|
172
176
|
**Exception: sandboxed sub-agent vetting.** If you are a dedicated sub-agent
|
package/src/cli.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Command } from 'commander';
|
|
5
5
|
import { readFileSync } from 'node:fs';
|
|
6
6
|
import { brand } from './lib/brand.js';
|
|
7
|
+
import { USING_VIT_REMINDER } from './lib/constants.js';
|
|
7
8
|
import registerAdopt from './cmd/adopt.js';
|
|
8
9
|
import registerBeacon from './cmd/beacon.js';
|
|
9
10
|
import registerConfig from './cmd/config.js';
|
|
@@ -52,4 +53,12 @@ registerHack(program);
|
|
|
52
53
|
registerLink(program);
|
|
53
54
|
registerInbox(program);
|
|
54
55
|
|
|
56
|
+
program.addHelpText('after', USING_VIT_REMINDER);
|
|
57
|
+
program.configureOutput({
|
|
58
|
+
outputError(str, write) {
|
|
59
|
+
write(str);
|
|
60
|
+
write(`${USING_VIT_REMINDER}\n`);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
55
64
|
export { program };
|
package/src/cmd/doctor.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { loadConfig } from '../lib/config.js';
|
|
5
5
|
import { restoreAgent } from '../lib/oauth.js';
|
|
6
6
|
import { readProjectConfig } from '../lib/vit-dir.js';
|
|
7
|
+
import { looksLikeIdentityBeacon } from '../lib/beacon.js';
|
|
7
8
|
import { existsSync, lstatSync, readdirSync, readFileSync } from 'node:fs';
|
|
8
9
|
import { join } from 'node:path';
|
|
9
10
|
import { homedir } from 'node:os';
|
|
@@ -94,11 +95,18 @@ export default function register(program) {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
|
|
98
|
+
let beaconIdentityWarning = false;
|
|
97
99
|
try {
|
|
98
100
|
const projConfig = readProjectConfig();
|
|
99
101
|
beacon = projConfig.beacon || null;
|
|
100
102
|
if (projConfig.beacon) {
|
|
101
103
|
if (!opts.json) console.log(`${mark} beacon: ${projConfig.beacon}`);
|
|
104
|
+
if (looksLikeIdentityBeacon(projConfig.beacon)) {
|
|
105
|
+
beaconIdentityWarning = true;
|
|
106
|
+
if (!opts.json) {
|
|
107
|
+
console.log(`${mark} beacon looks like a person/identity URL, not a repo URL -- every repo hosted the same way would collapse onto this one beacon. Run vit init --beacon <the repo's own URL> to repair it.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
102
110
|
} else {
|
|
103
111
|
if (!opts.json) console.log(`${mark} beacon: not set (run vit init)`);
|
|
104
112
|
}
|
|
@@ -202,6 +210,7 @@ export default function register(program) {
|
|
|
202
210
|
bluesky: { ok: blueskyOk, did: effectiveDid || null, pds, source: identitySource, authType },
|
|
203
211
|
};
|
|
204
212
|
if (beaconError) result.beaconError = beaconError;
|
|
213
|
+
if (beaconIdentityWarning) result.beaconIdentityWarning = true;
|
|
205
214
|
jsonOk(result);
|
|
206
215
|
}
|
|
207
216
|
if (beaconError) process.exitCode = 1;
|
package/src/cmd/init.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { existsSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { execSync } from 'node:child_process';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
|
-
import { normalizeBeacon, tryNormalizeBeacon } from '../lib/beacon.js';
|
|
7
|
+
import { normalizeBeacon, tryNormalizeBeacon, looksLikeIdentityBeacon } from '../lib/beacon.js';
|
|
8
8
|
import { vitDir, readProjectConfig, readRawProjectConfig, writeProjectConfig } from '../lib/vit-dir.js';
|
|
9
9
|
import { requireAgent } from '../lib/agent.js';
|
|
10
10
|
import { mark, name, DOT_VIT_README } from '../lib/brand.js';
|
|
@@ -12,6 +12,17 @@ import { jsonOk, jsonError } from '../lib/json-output.js';
|
|
|
12
12
|
import { errorMessage, formatError } from '../lib/error-format.js';
|
|
13
13
|
|
|
14
14
|
const BEACON_REPAIR_HINT = 'run vit init --beacon <canonical-git-url> to repair it';
|
|
15
|
+
const IDENTITY_BEACON_HINT = 'use the repo\'s own URL, not a bare host+identity URL (e.g. a Tangled knot URL with no repo path)';
|
|
16
|
+
|
|
17
|
+
function assertNotIdentityBeacon(beacon, source) {
|
|
18
|
+
if (!looksLikeIdentityBeacon(beacon)) return;
|
|
19
|
+
const err = new Error(
|
|
20
|
+
`${source} looks like a person/identity URL, not a repo URL (derived beacon: ${beacon}). ` +
|
|
21
|
+
'Every repo hosted the same way would collapse onto this one beacon.'
|
|
22
|
+
);
|
|
23
|
+
err.hint = IDENTITY_BEACON_HINT;
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
15
26
|
|
|
16
27
|
export default function register(program) {
|
|
17
28
|
program
|
|
@@ -176,6 +187,7 @@ export default function register(program) {
|
|
|
176
187
|
throw err;
|
|
177
188
|
}
|
|
178
189
|
const secondary = normalizeBeacon(opts.secondary, '--secondary');
|
|
190
|
+
assertNotIdentityBeacon(secondary, '--secondary');
|
|
179
191
|
const merged = { ...config, beacon: primary, secondaryBeacon: secondary };
|
|
180
192
|
writeProjectConfig(merged);
|
|
181
193
|
if (opts.json) {
|
|
@@ -226,11 +238,13 @@ export default function register(program) {
|
|
|
226
238
|
}
|
|
227
239
|
|
|
228
240
|
const beacon = normalizeBeacon(gitUrl, '--beacon');
|
|
241
|
+
assertNotIdentityBeacon(beacon, '--beacon');
|
|
229
242
|
if (verbose) vlog(`[verbose] Computed beacon: ${beacon}`);
|
|
230
243
|
const existing = readRawProjectConfig();
|
|
231
244
|
const merged = { ...existing, beacon };
|
|
232
245
|
if (opts.secondary) {
|
|
233
246
|
merged.secondaryBeacon = normalizeBeacon(opts.secondary, '--secondary');
|
|
247
|
+
assertNotIdentityBeacon(merged.secondaryBeacon, '--secondary');
|
|
234
248
|
} else if (Object.hasOwn(existing, 'secondaryBeacon')) {
|
|
235
249
|
// Tolerant normalization is deliberate on this repair path: an invalid secondary
|
|
236
250
|
// must be dropped with a warning, not block repair of the primary beacon.
|
package/src/cmd/remix.js
CHANGED
|
@@ -115,12 +115,17 @@ export default function register(program) {
|
|
|
115
115
|
let match = null;
|
|
116
116
|
for (const records of allRecords) {
|
|
117
117
|
for (const rec of records) {
|
|
118
|
-
if (!beaconSet.has(tryNormalizeBeacon(rec.value.beacon))) continue;
|
|
119
118
|
const recRef = resolveRef(rec.value, rec.cid);
|
|
120
|
-
if (recRef
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
if (recRef !== ref) continue;
|
|
120
|
+
// Your own caps are exempt from the project-beacon filter: the beacon
|
|
121
|
+
// scopes which OTHER accounts' caps a project will trust, but you
|
|
122
|
+
// already unconditionally query your own DID regardless of following
|
|
123
|
+
// -- there's no equivalent trust question about your own content, and
|
|
124
|
+
// the error hint below has always promised this ("and your own").
|
|
125
|
+
const isSelf = rec.uri?.split('/')[2] === did;
|
|
126
|
+
if (!isSelf && !beaconSet.has(tryNormalizeBeacon(rec.value.beacon))) continue;
|
|
127
|
+
if (!match || (rec.value.createdAt || '') > (match.value.createdAt || '')) {
|
|
128
|
+
match = rec;
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
}
|
package/src/cmd/vet.js
CHANGED
|
@@ -291,12 +291,17 @@ export default function register(program) {
|
|
|
291
291
|
let match = null;
|
|
292
292
|
for (const records of allRecords) {
|
|
293
293
|
for (const rec of records) {
|
|
294
|
-
if (!beaconSet.has(tryNormalizeBeacon(rec.value.beacon))) continue;
|
|
295
294
|
const recRef = resolveRef(rec.value, rec.cid);
|
|
296
|
-
if (recRef
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
295
|
+
if (recRef !== ref) continue;
|
|
296
|
+
// Your own caps are exempt from the project-beacon filter: the beacon
|
|
297
|
+
// scopes which OTHER accounts' caps a project will trust, but you
|
|
298
|
+
// already unconditionally query your own DID regardless of following
|
|
299
|
+
// -- there's no equivalent trust question about your own content, and
|
|
300
|
+
// the error hint below has always promised this ("and your own").
|
|
301
|
+
const isSelf = rec.uri?.split('/')[2] === did;
|
|
302
|
+
if (!isSelf && !beaconSet.has(tryNormalizeBeacon(rec.value.beacon))) continue;
|
|
303
|
+
if (!match || (rec.value.createdAt || '') > (match.value.createdAt || '')) {
|
|
304
|
+
match = rec;
|
|
300
305
|
}
|
|
301
306
|
}
|
|
302
307
|
}
|
package/src/lib/beacon.js
CHANGED
|
@@ -86,6 +86,25 @@ function toBeacon(input) {
|
|
|
86
86
|
return org ? `${host}/${org}/${repo}` : `${host}//${repo}`;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
const DID_LIKE = /^did:[a-z0-9]+:/i;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* True when a canonical beacon's org or repo segment looks like an AT Protocol DID
|
|
93
|
+
* rather than a real repository name -- the shape produced when a bare identity URL
|
|
94
|
+
* (e.g. a Tangled *knot* host plus a DID, with no repo path) is fed to `vit init`
|
|
95
|
+
* instead of the actual repo URL. A beacon in this shape identifies a person, not a
|
|
96
|
+
* project, so every repo that person hosts the same mistaken way collapses onto one
|
|
97
|
+
* indistinguishable beacon.
|
|
98
|
+
*/
|
|
99
|
+
export function looksLikeIdentityBeacon(beacon) {
|
|
100
|
+
if (typeof beacon !== 'string') return false;
|
|
101
|
+
const body = beacon.startsWith('vit:') ? beacon.slice(4) : beacon;
|
|
102
|
+
const slash = body.indexOf('/');
|
|
103
|
+
if (slash === -1) return false;
|
|
104
|
+
const segments = body.slice(slash + 1).split('/').filter(Boolean);
|
|
105
|
+
return segments.some(seg => DID_LIKE.test(seg));
|
|
106
|
+
}
|
|
107
|
+
|
|
89
108
|
export const BEACON_ACCEPTED_FORMS = 'vit:host/owner/repo or a git URL (a scheme URL such as https://host/owner/repo, ssh://git@host/owner/repo, or git://host/owner/repo; SCP-style git@host:owner/repo; or host/owner/repo)';
|
|
90
109
|
|
|
91
110
|
export function normalizeBeacon(input, source) {
|
package/src/lib/constants.js
CHANGED
|
@@ -6,3 +6,4 @@ export const VOUCH_COLLECTION = 'org.v-it.vouch';
|
|
|
6
6
|
export const SKILL_COLLECTION = 'org.v-it.skill';
|
|
7
7
|
export const DEFAULT_JETSTREAM_URL = 'wss://jetstream2.us-east.bsky.network/subscribe';
|
|
8
8
|
export const DEFAULT_EXPLORE_URL = 'https://explore.v-it.org';
|
|
9
|
+
export const USING_VIT_REMINDER = 'Load the using-vit skill before using this CLI.';
|