vit 0.1.0 → 0.1.3
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/LICENSE +21 -661
- package/README.md +56 -78
- package/bin/vit.js +1 -1
- package/package.json +6 -2
- package/src/cli.js +11 -1
- package/src/cmd/adopt.js +1 -1
- package/src/cmd/beacon.js +1 -1
- package/src/cmd/config.js +1 -1
- package/src/cmd/doctor.js +150 -16
- package/src/cmd/explore.js +477 -0
- package/src/cmd/firehose.js +20 -9
- package/src/cmd/follow.js +59 -10
- package/src/cmd/hack.js +83 -0
- package/src/cmd/init.js +95 -13
- package/src/cmd/learn.js +244 -0
- package/src/cmd/link.js +75 -0
- package/src/cmd/login.js +95 -13
- package/src/cmd/remix.js +82 -37
- package/src/cmd/scan.js +207 -0
- package/src/cmd/setup.js +1 -1
- package/src/cmd/ship.js +564 -149
- package/src/cmd/skim.js +106 -36
- package/src/cmd/vet.js +565 -97
- package/src/cmd/vouch.js +231 -88
- package/src/lib/agent.js +11 -1
- package/src/lib/beacon.js +1 -1
- package/src/lib/brand.js +1 -1
- package/src/lib/cap-ref.js +1 -1
- package/src/lib/compat.js +1 -1
- package/src/lib/config.js +11 -2
- package/src/lib/constants.js +4 -1
- package/src/lib/json-output.js +13 -0
- package/src/lib/oauth.js +49 -6
- package/src/lib/paths.js +1 -1
- package/src/lib/pds.js +79 -0
- package/src/lib/sandbox.js +1 -1
- package/src/lib/skill-ref.js +37 -0
- package/src/lib/trust-gate.js +39 -0
- package/src/lib/vit-dir.js +9 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2026 sol pbc
|
|
3
|
+
|
|
4
|
+
// Skill ref format: skill-{name}
|
|
5
|
+
// Name: lowercase letters, numbers, hyphens. No leading hyphen, no consecutive hyphens. Max 64 chars.
|
|
6
|
+
|
|
7
|
+
export const SKILL_NAME_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
8
|
+
export const SKILL_REF_PATTERN = /^skill-[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
9
|
+
export const SKILL_NAME_MAX = 64;
|
|
10
|
+
|
|
11
|
+
export function isValidSkillName(name) {
|
|
12
|
+
if (!name || typeof name !== 'string') return false;
|
|
13
|
+
if (name.length > SKILL_NAME_MAX) return false;
|
|
14
|
+
return SKILL_NAME_PATTERN.test(name);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isSkillRef(ref) {
|
|
18
|
+
if (!ref || typeof ref !== 'string') return false;
|
|
19
|
+
return ref.startsWith('skill-');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function skillRefFromName(name) {
|
|
23
|
+
return `skill-${name}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function nameFromSkillRef(ref) {
|
|
27
|
+
if (!isSkillRef(ref)) return null;
|
|
28
|
+
return ref.slice(6);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isValidSkillRef(ref) {
|
|
32
|
+
if (!ref || typeof ref !== 'string') return false;
|
|
33
|
+
// skill- prefix + valid name, total ref max 71 chars (6 + 64 + 1 for the hyphen in prefix)
|
|
34
|
+
if (!SKILL_REF_PATTERN.test(ref)) return false;
|
|
35
|
+
const name = nameFromSkillRef(ref);
|
|
36
|
+
return name.length <= SKILL_NAME_MAX;
|
|
37
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// Copyright (c) 2026 sol pbc
|
|
3
|
+
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { vitDir } from './vit-dir.js';
|
|
7
|
+
|
|
8
|
+
const ACCEPT_FILE = 'dangerous-accept';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Check if dangerous-accept flag is active.
|
|
12
|
+
* Returns { accepted: true } or { accepted: false }.
|
|
13
|
+
* No TTL — once set, it's permanent until deleted.
|
|
14
|
+
*/
|
|
15
|
+
export function checkDangerousAccept() {
|
|
16
|
+
const p = join(vitDir(), ACCEPT_FILE);
|
|
17
|
+
if (!existsSync(p)) return { accepted: false };
|
|
18
|
+
try {
|
|
19
|
+
JSON.parse(readFileSync(p, 'utf-8'));
|
|
20
|
+
return { accepted: true };
|
|
21
|
+
} catch {
|
|
22
|
+
return { accepted: false };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Check if the vet gate should be bypassed.
|
|
28
|
+
* Returns { bypass: true, reason } or { bypass: false }.
|
|
29
|
+
*
|
|
30
|
+
* Bypass condition: dangerous-accept flag is active.
|
|
31
|
+
* Caller checks trusted.jsonl before calling this.
|
|
32
|
+
*/
|
|
33
|
+
export function shouldBypassVet() {
|
|
34
|
+
const accept = checkDangerousAccept();
|
|
35
|
+
if (accept.accepted) {
|
|
36
|
+
return { bypass: true, reason: 'dangerous-accept' };
|
|
37
|
+
}
|
|
38
|
+
return { bypass: false };
|
|
39
|
+
}
|
package/src/lib/vit-dir.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
2
|
// Copyright (c) 2026 sol pbc
|
|
3
3
|
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, appendFileSync } from 'node:fs';
|
|
@@ -18,6 +18,14 @@ export function readProjectConfig() {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export function readBeaconSet() {
|
|
22
|
+
const config = readProjectConfig();
|
|
23
|
+
const set = new Set();
|
|
24
|
+
if (config.beacon) set.add(config.beacon);
|
|
25
|
+
if (config.secondaryBeacon) set.add(config.secondaryBeacon);
|
|
26
|
+
return set;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
export function writeProjectConfig(obj, baseDir) {
|
|
22
30
|
const dir = baseDir ? join(baseDir, '.vit') : vitDir();
|
|
23
31
|
mkdirSync(dir, { recursive: true });
|