Skip to content

Commit acba6a7

Browse files
authored
feat(registry): vim and vix packages (drop-zone binaries, vim runtime via provides) (#248)
1 parent 84e8605 commit acba6a7

11 files changed

Lines changed: 187 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ registry/native/c/.cache/
4545
registry/native/c/sysroot/
4646
registry/software/*/bin/
4747
registry/software/*/wasm/
48+
registry/software/vim/share/
4849
registry/software/*/agent-os-package.meta.json
4950
registry/.last-publish-hash
5051
registry/software/*/.last-publish-hash

pnpm-lock.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "vim",
3+
"commands": [
4+
"vim"
5+
],
6+
"provides": {
7+
"env": {
8+
"VIM": "/usr/local/share/vim",
9+
"VIMRUNTIME": "/usr/local/share/vim/vim92"
10+
},
11+
"files": [
12+
{
13+
"source": "share/vim/vim92",
14+
"target": "/usr/local/share/vim/vim92"
15+
}
16+
]
17+
}
18+
}

registry/software/vim/package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "@agentos-software/vim",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"license": "Apache-2.0",
6+
"description": "vim for secure-exec VMs (wasm build + bundled runtime via provides)",
7+
"main": "./dist/index.js",
8+
"types": "./dist/index.d.ts",
9+
"files": [
10+
"dist"
11+
],
12+
"exports": {
13+
".": {
14+
"types": "./dist/index.d.ts",
15+
"import": "./dist/index.js",
16+
"default": "./dist/index.js"
17+
}
18+
},
19+
"scripts": {
20+
"build": "agentos-toolchain stage --commands-dir ../../native/target/wasm32-wasip1/release/commands --if-missing skip && node ./scripts/stage-runtime.mjs && tsc && agentos-toolchain build",
21+
"check-types": "tsc --noEmit"
22+
},
23+
"devDependencies": {
24+
"@agentos-software/manifest": "workspace:*",
25+
"@rivet-dev/agentos-toolchain": "workspace:*",
26+
"@types/node": "^22.10.2",
27+
"typescript": "^5.9.2"
28+
}
29+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env node
2+
// Stage vim's runtime tree into the gitignored `share/vim/vim92/` so
3+
// `agentos-toolchain build` ships it in dist/package and the manifest's
4+
// `provides.files` can overlay it read-only at /usr/local/share/vim/vim92
5+
// (VIMRUNTIME points straight at it, bypassing vim's version-dir search, so a
6+
// 9.0/9.1 host runtime sources cleanly under the 9.2 binary).
7+
//
8+
// Sources, in order: $VIM_RUNTIME_SRC, then the host vim runtimes. Bulky,
9+
// non-load-bearing subtrees (docs, tutor, spell dictionaries, translations)
10+
// are trimmed — the runtime here exists so `vim` starts clean (defaults.vim,
11+
// syntax, ftplugin, indent, autoload, colors), not to ship a manual.
12+
// Missing source → skip with a notice (the package stays a valid placeholder,
13+
// same contract as a missing command binary).
14+
import { cpSync, existsSync, mkdirSync, rmSync } from "node:fs";
15+
import { dirname, join, resolve } from "node:path";
16+
import { fileURLToPath } from "node:url";
17+
18+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
19+
const target = join(packageRoot, "share", "vim", "vim92");
20+
21+
const TRIM = new Set(["doc", "tutor", "spell", "lang", "print", "keymap"]);
22+
23+
const candidates = [
24+
process.env.VIM_RUNTIME_SRC,
25+
"/usr/share/vim/vim92",
26+
"/usr/share/vim/vim91",
27+
"/usr/share/vim/vim90",
28+
"/usr/local/share/vim/vim92",
29+
].filter(Boolean);
30+
31+
const source = candidates.find((dir) => existsSync(join(dir, "defaults.vim")));
32+
if (!source) {
33+
console.log(
34+
"stage-runtime: no vim runtime found (set VIM_RUNTIME_SRC or install vim) — skipping; package ships without the runtime tree",
35+
);
36+
process.exit(0);
37+
}
38+
39+
rmSync(join(packageRoot, "share"), { recursive: true, force: true });
40+
mkdirSync(target, { recursive: true });
41+
cpSync(source, target, {
42+
recursive: true,
43+
filter: (src) => {
44+
const rel = src.slice(source.length).split("/").filter(Boolean);
45+
return rel.length === 0 || !TRIM.has(rel[0]);
46+
},
47+
});
48+
console.log(`stage-runtime: ${source} -> share/vim/vim92 (trimmed: ${[...TRIM].join(", ")})`);

registry/software/vim/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { SoftwarePackageRef } from "@agentos-software/manifest";
2+
3+
const packageDir = new URL("./package/", import.meta.url).pathname;
4+
5+
export default { packageDir } satisfies SoftwarePackageRef;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "./dist",
5+
"rootDir": "./src"
6+
},
7+
"include": ["src/**/*"]
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "vix",
3+
"commands": [
4+
"vix"
5+
]
6+
}

registry/software/vix/package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "@agentos-software/vix",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"license": "Apache-2.0",
6+
"description": "vix editor for secure-exec VMs (wasm build)",
7+
"main": "./dist/index.js",
8+
"types": "./dist/index.d.ts",
9+
"files": [
10+
"dist"
11+
],
12+
"exports": {
13+
".": {
14+
"types": "./dist/index.d.ts",
15+
"import": "./dist/index.js",
16+
"default": "./dist/index.js"
17+
}
18+
},
19+
"scripts": {
20+
"build": "agentos-toolchain stage --commands-dir ../../native/target/wasm32-wasip1/release/commands --if-missing skip && tsc && agentos-toolchain build",
21+
"check-types": "tsc --noEmit"
22+
},
23+
"devDependencies": {
24+
"@agentos-software/manifest": "workspace:*",
25+
"@rivet-dev/agentos-toolchain": "workspace:*",
26+
"@types/node": "^22.10.2",
27+
"typescript": "^5.9.2"
28+
}
29+
}

registry/software/vix/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { SoftwarePackageRef } from "@agentos-software/manifest";
2+
3+
const packageDir = new URL("./package/", import.meta.url).pathname;
4+
5+
export default { packageDir } satisfies SoftwarePackageRef;

0 commit comments

Comments
 (0)