chore(packages): rename packages to trapos
This commit is contained in:
parent
65d8a927b8
commit
b2a68fc11a
@ -35,8 +35,8 @@ Use [`docs/README.md`](docs/README.md) as the entrypoint for CC:Tweaked, CraftOS
|
||||
- `startup/servers.lua` starts `/programs`, the shell, and configured servers via `parallel.waitForAll`.
|
||||
- Preserve `periphemu` guards used for CraftOS-PC emulation; see [`docs/craftos_pc_glossary.md`](docs/craftos_pc_glossary.md) for upstream emulator references.
|
||||
- TrapOS ships as packages, each described by `packages/<name>/ccpm.json` (`name`, `version`, `dependencies`, `files`, `autostart`); `packages/index.json` lists them. Source files stay in place — descriptors only reference them. To ship a new file, add it to the right package's `files` (and `autostart` if it is a server). `packages/trapos/ccpm.json` is the full OS meta-package. See [ADR-0010](docs/adrs/adr-0010-ccpm-package-manager.md).
|
||||
- `install-ccpm.lua` is the one-time wget bootstrap. It installs only `tos-core`/`ccpm`, seeds the default `guillaumearm/cc-libs` registry on `master` (or `next` with `--beta`), and tells users to run `ccpm update` then `ccpm install trapos`.
|
||||
- `ccpm` (in `tos-core`) is the package manager: `apis/libccpm.lua` is the testable core (factory with injectable `http`/`stateDir`/`installRoot`), `programs/ccpm.lua` the CLI. State: `/trapos/ccpm.json` (registries), `/trapos/ccpm.lock.json` (installed packages), and `/trapos/ccpm.cache.json` (available packages from `ccpm update`). Never use the word "manifest" in ccpm — it is reserved for the OS manifest.
|
||||
- `install-ccpm.lua` is the one-time wget bootstrap. It installs only `trapos-core`/`ccpm`, seeds the default `guillaumearm/cc-libs` registry on `master` (or `next` with `--beta`), and tells users to run `ccpm update` then `ccpm install trapos`.
|
||||
- `ccpm` (in `trapos-core`) is the package manager: `apis/libccpm.lua` is the testable core (factory with injectable `http`/`stateDir`/`installRoot`), `programs/ccpm.lua` the CLI. State: `/trapos/ccpm.json` (registries), `/trapos/ccpm.lock.json` (installed packages), and `/trapos/ccpm.cache.json` (available packages from `ccpm update`). Never use the word "manifest" in ccpm — it is reserved for the OS manifest.
|
||||
- Add new servers to `startup/servers.lua` as needed.
|
||||
|
||||
## Conventions
|
||||
|
||||
19
README.md
19
README.md
@ -17,8 +17,8 @@ ccpm install trapos
|
||||
|
||||
Install individual packages instead if you want to cherry-pick:
|
||||
```
|
||||
> ccpm install tos-net
|
||||
> ccpm install tos-ui
|
||||
> ccpm install trapos-net
|
||||
> ccpm install trapos-ui
|
||||
```
|
||||
|
||||
Install `ccpm` from the beta branch (one-time opt-in, asks for confirmation):
|
||||
@ -34,12 +34,13 @@ After install, every boot shows a colored MOTD with the installed version and br
|
||||
|
||||
TrapOS is split into packages, each described by a `packages/<name>/ccpm.json`:
|
||||
|
||||
- `tos-core`: the package manager (`ccpm`), event loop, `upgrade`, `events`.
|
||||
- `tos-test`: the test framework (`libtest`) and suite runner (`runtest`).
|
||||
- `tos-boot`: the startup MOTD and autostart server launcher.
|
||||
- `tos-net`: routed modem networking (`net`, `router`, `ping`, `ping-server`).
|
||||
- `tos-ui`: the terminal UI toolkit (`libtui`, `tuidemo`).
|
||||
- `trapos`: full TrapOS meta-package (`tos-boot`, `tos-net`, `tos-ui`, and `tos-test` during beta).
|
||||
- `trapos-core`: the package manager (`ccpm`), event loop, `upgrade`, `events`.
|
||||
- `trapos-test`: the test framework (`libtest`) and suite runner (`runtest`).
|
||||
- `trapos-boot`: the startup MOTD and autostart server launcher.
|
||||
- `trapos-net`: routed modem networking (`net`, `router`, `ping`, `ping-server`).
|
||||
- `trapos-ui`: the terminal UI toolkit (`libtui`, `tuidemo`).
|
||||
- `trapos-ai`: the AI client for `opencode serve`.
|
||||
- `trapos`: full TrapOS meta-package (`trapos-boot`, `trapos-net`, `trapos-ui`, `trapos-test`, and `trapos-ai` during beta).
|
||||
|
||||
The `trapos` meta-package is the user-facing full install. Package descriptors list
|
||||
files and autostart servers; installed state is tracked under `/trapos`.
|
||||
@ -47,7 +48,7 @@ files and autostart servers; installed state is tracked under `/trapos`.
|
||||
## ccpm
|
||||
|
||||
`ccpm` is the TrapOS package manager. `install-ccpm.lua` installs it by installing
|
||||
the required `tos-core` package and configures the default registry
|
||||
the required `trapos-core` package and configures the default registry
|
||||
(`guillaumearm/cc-libs`).
|
||||
|
||||
```
|
||||
|
||||
@ -17,7 +17,7 @@ the OS after the initial install.
|
||||
|
||||
We want a package manager, `ccpm` ("ComputerCraft Package Manager"), installed first
|
||||
as a standalone user-facing step. After that, a machine can `ccpm update`,
|
||||
`ccpm install trapos`, `ccpm install tos-net`, `ccpm uninstall tos-ui`, and manage
|
||||
`ccpm install trapos`, `ccpm install trapos-net`, `ccpm uninstall trapos-ui`, and manage
|
||||
where packages come from. TrapOS itself is installed through a `trapos` meta-package;
|
||||
the `wget run .../install-ccpm.lua` bootstrap exists only to install `ccpm`.
|
||||
|
||||
@ -36,12 +36,13 @@ The split is finer-grained than the install examples imply:
|
||||
|
||||
| package | contents | deps |
|
||||
|----------|-----------------------------------------------------------------|----------|
|
||||
| tos-core | ccpm, libccpm, eventloop, upgrade, events | — |
|
||||
| tos-test | libtest, runtest | tos-core |
|
||||
| tos-boot | motd, servers (startup) | tos-core |
|
||||
| tos-net | net, router, ping, ping-server | tos-core |
|
||||
| tos-ui | libtui, tuidemo | tos-core |
|
||||
| trapos | full TrapOS meta-package | tos-boot, tos-net, tos-ui, tos-test |
|
||||
| trapos-core | ccpm, libccpm, eventloop, upgrade, events | — |
|
||||
| trapos-test | libtest, runtest | trapos-core |
|
||||
| trapos-boot | motd, servers (startup) | trapos-core |
|
||||
| trapos-net | net, router, ping, ping-server | trapos-core |
|
||||
| trapos-ui | libtui, tuidemo | trapos-core |
|
||||
| trapos-ai | AI client for opencode serve | trapos-core |
|
||||
| trapos | full TrapOS meta-package | trapos-boot, trapos-net, trapos-ui, trapos-test, trapos-ai |
|
||||
|
||||
### Two files for ccpm, "manifest" reserved for the OS
|
||||
|
||||
@ -62,24 +63,24 @@ are injectable for tests). `programs/ccpm.lua` is a thin CLI over it.
|
||||
|
||||
### The bootstrap installs only ccpm
|
||||
|
||||
`install-ccpm.lua` resolves only the `tos-core` package descriptor (pulling any future
|
||||
`install-ccpm.lua` resolves only the `trapos-core` package descriptor (pulling any future
|
||||
dependencies), downloads its files, and writes:
|
||||
|
||||
- `/trapos/manifest.json` — the aggregated `{ name, version, branch, files, autostart }`
|
||||
still consumed by `startup/motd.lua` and `startup/servers.lua` after boot packages
|
||||
are installed;
|
||||
- `/trapos/ccpm.lock.json` — so right after a fresh install `ccpm install tos-core`
|
||||
- `/trapos/ccpm.lock.json` — so right after a fresh install `ccpm install trapos-core`
|
||||
correctly reports "already installed";
|
||||
- `/trapos/ccpm.json` — seeding/refreshing the default `guillaumearm/cc-libs` registry
|
||||
to track the install branch.
|
||||
|
||||
The install path is:
|
||||
|
||||
- `wget run .../install-ccpm.lua` — install `ccpm` (`tos-core`) and seed the default
|
||||
- `wget run .../install-ccpm.lua` — install `ccpm` (`trapos-core`) and seed the default
|
||||
registry.
|
||||
- `ccpm update` — refresh the local package cache.
|
||||
- `ccpm install trapos` — install the full OS. During beta, `trapos` includes
|
||||
`tos-test` by default.
|
||||
`trapos-test` by default.
|
||||
|
||||
On a subsequent `upgrade`, `programs/upgrade.lua` delegates to `ccpm upgrade`, which
|
||||
upgrades installed packages using `/trapos/ccpm.cache.json`. Users run `ccpm update`
|
||||
|
||||
@ -20,7 +20,6 @@ On a fresh CC computer (beta branch):
|
||||
wget run https://raw.githubusercontent.com/guillaumearm/cc-libs/next/install-ccpm.lua --beta
|
||||
ccpm update
|
||||
ccpm install trapos
|
||||
ccpm install tos-ai
|
||||
```
|
||||
|
||||
## 1. Start `opencode serve`
|
||||
|
||||
@ -170,7 +170,7 @@ if not manifest then
|
||||
return;
|
||||
end
|
||||
|
||||
local requested = { 'tos-core' };
|
||||
local requested = { 'trapos-core' };
|
||||
|
||||
local resolved, resolveErr = resolvePackages(branch, requested);
|
||||
if not resolved then
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TrapOS",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"branch": "next",
|
||||
"packages": [
|
||||
"trapos"
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
{
|
||||
"packages": {
|
||||
"tos-core": "0.3.0",
|
||||
"tos-test": "0.2.0",
|
||||
"tos-boot": "0.2.1",
|
||||
"tos-net": "0.2.0",
|
||||
"tos-ui": "0.2.0",
|
||||
"tos-ai": "0.3.0",
|
||||
"trapos": "0.5.1"
|
||||
"trapos-core": "0.3.0",
|
||||
"trapos-test": "0.2.0",
|
||||
"trapos-boot": "0.2.1",
|
||||
"trapos-net": "0.2.0",
|
||||
"trapos-ui": "0.2.0",
|
||||
"trapos-ai": "0.3.0",
|
||||
"trapos": "0.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tos-ai",
|
||||
"name": "trapos-ai",
|
||||
"version": "0.3.0",
|
||||
"description": "TrapOS AI client for opencode serve",
|
||||
"dependencies": ["tos-core"],
|
||||
"dependencies": ["trapos-core"],
|
||||
"files": [
|
||||
"apis/libai.lua",
|
||||
"programs/ai.lua"
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tos-boot",
|
||||
"name": "trapos-boot",
|
||||
"version": "0.2.1",
|
||||
"description": "TrapOS boot: startup MOTD and autostart server launcher",
|
||||
"dependencies": ["tos-core"],
|
||||
"dependencies": ["trapos-core"],
|
||||
"files": [
|
||||
"startup/motd.lua",
|
||||
"startup/servers.lua"
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "tos-core",
|
||||
"name": "trapos-core",
|
||||
"version": "0.3.0",
|
||||
"description": "TrapOS base: package manager, event loop, upgrade and event tools",
|
||||
"dependencies": [],
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tos-net",
|
||||
"name": "trapos-net",
|
||||
"version": "0.2.0",
|
||||
"description": "TrapOS networking: routed modem messaging, router, ping",
|
||||
"dependencies": ["tos-core"],
|
||||
"dependencies": ["trapos-core"],
|
||||
"files": [
|
||||
"apis/net.lua",
|
||||
"programs/router.lua",
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tos-test",
|
||||
"name": "trapos-test",
|
||||
"version": "0.2.0",
|
||||
"description": "TrapOS test framework and CraftOS-PC suite runner",
|
||||
"dependencies": ["tos-core"],
|
||||
"dependencies": ["trapos-core"],
|
||||
"files": [
|
||||
"apis/libtest.lua",
|
||||
"programs/runtest.lua"
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tos-ui",
|
||||
"name": "trapos-ui",
|
||||
"version": "0.2.0",
|
||||
"description": "TrapOS terminal UI toolkit and demo",
|
||||
"dependencies": ["tos-core"],
|
||||
"dependencies": ["trapos-core"],
|
||||
"files": [
|
||||
"apis/libtui.lua",
|
||||
"programs/tuidemo.lua"
|
||||
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "trapos",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "TrapOS full install meta-package",
|
||||
"dependencies": ["tos-boot", "tos-net", "tos-ui", "tos-test"],
|
||||
"dependencies": ["trapos-boot", "trapos-net", "trapos-ui", "trapos-test", "trapos-ai"],
|
||||
"files": [],
|
||||
"autostart": []
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ testlib.test('registry urls resolve an http base', function()
|
||||
'http://example.com/repo/'
|
||||
);
|
||||
testlib.assertEquals(
|
||||
ccpm.descriptorUrl({ name = 'http://example.com/repo/', type = 'http' }, 'tos-net'),
|
||||
'http://example.com/repo/packages/tos-net/ccpm.json'
|
||||
ccpm.descriptorUrl({ name = 'http://example.com/repo/', type = 'http' }, 'trapos-net'),
|
||||
'http://example.com/repo/packages/trapos-net/ccpm.json'
|
||||
);
|
||||
end);
|
||||
|
||||
@ -103,8 +103,8 @@ end);
|
||||
testlib.test('install downloads files and records the lock', function()
|
||||
local base = ghBase('me/repo', 'master');
|
||||
local routes = {
|
||||
[base .. 'packages/tos-core/ccpm.json'] = textutils.serializeJSON({ name = 'tos-core', version = '1', dependencies = {}, files = { 'apis/eventloop.lua' } }),
|
||||
[base .. 'packages/tos-net/ccpm.json'] = textutils.serializeJSON({ name = 'tos-net', version = '1', dependencies = { 'tos-core' }, files = { 'apis/net.lua' } }),
|
||||
[base .. 'packages/trapos-core/ccpm.json'] = textutils.serializeJSON({ name = 'trapos-core', version = '1', dependencies = {}, files = { 'apis/eventloop.lua' } }),
|
||||
[base .. 'packages/trapos-net/ccpm.json'] = textutils.serializeJSON({ name = 'trapos-net', version = '1', dependencies = { 'trapos-core' }, files = { 'apis/net.lua' } }),
|
||||
[base .. 'apis/eventloop.lua'] = 'eventloop-body',
|
||||
[base .. 'apis/net.lua'] = 'net-body',
|
||||
};
|
||||
@ -112,7 +112,7 @@ testlib.test('install downloads files and records the lock', function()
|
||||
local ccpm = createCcpm({ stateDir = sd, installRoot = root, http = fakeHttp(routes) });
|
||||
ccpm.writeConfig({ registries = { { name = 'me/repo', type = 'github', branch = 'master' } } });
|
||||
|
||||
local ok = ccpm.install('tos-net', {});
|
||||
local ok = ccpm.install('trapos-net', {});
|
||||
testlib.assertTrue(ok);
|
||||
testlib.assertTrue(fs.exists(root .. '/apis/net.lua'));
|
||||
testlib.assertTrue(fs.exists(root .. '/apis/eventloop.lua'));
|
||||
@ -123,17 +123,17 @@ testlib.test('install downloads files and records the lock', function()
|
||||
testlib.assertEquals(body, 'net-body');
|
||||
|
||||
local lock = ccpm.readLock();
|
||||
testlib.assertTrue(lock.packages['tos-net']);
|
||||
testlib.assertTrue(lock.packages['tos-core']);
|
||||
testlib.assertEquals(lock.packages['tos-net'].registry, 'me/repo');
|
||||
testlib.assertTrue(lock.packages['trapos-net']);
|
||||
testlib.assertTrue(lock.packages['trapos-core']);
|
||||
testlib.assertEquals(lock.packages['trapos-net'].registry, 'me/repo');
|
||||
end);
|
||||
|
||||
testlib.test('installing trapos writes aggregated os state', function()
|
||||
local base = ghBase('me/repo', 'master');
|
||||
local routes = {
|
||||
[base .. 'packages/trapos/ccpm.json'] = textutils.serializeJSON({ name = 'trapos', version = '1', dependencies = { 'tos-net' }, files = {} }),
|
||||
[base .. 'packages/tos-core/ccpm.json'] = textutils.serializeJSON({ name = 'tos-core', version = '1', dependencies = {}, files = { 'programs/ccpm.lua' } }),
|
||||
[base .. 'packages/tos-net/ccpm.json'] = textutils.serializeJSON({ name = 'tos-net', version = '1', dependencies = { 'tos-core' }, files = { 'apis/net.lua' }, autostart = { 'servers/ping-server' } }),
|
||||
[base .. 'packages/trapos/ccpm.json'] = textutils.serializeJSON({ name = 'trapos', version = '1', dependencies = { 'trapos-net' }, files = {} }),
|
||||
[base .. 'packages/trapos-core/ccpm.json'] = textutils.serializeJSON({ name = 'trapos-core', version = '1', dependencies = {}, files = { 'programs/ccpm.lua' } }),
|
||||
[base .. 'packages/trapos-net/ccpm.json'] = textutils.serializeJSON({ name = 'trapos-net', version = '1', dependencies = { 'trapos-core' }, files = { 'apis/net.lua' }, autostart = { 'servers/ping-server' } }),
|
||||
[base .. 'programs/ccpm.lua'] = 'ccpm-body',
|
||||
[base .. 'apis/net.lua'] = 'net-body',
|
||||
};
|
||||
@ -255,13 +255,13 @@ end);
|
||||
testlib.test('uninstall refuses a package with dependents', function()
|
||||
local ccpm = createCcpm({ stateDir = freshDirs() });
|
||||
ccpm.writeLock({ packages = {
|
||||
['tos-core'] = { version = '1', files = {}, dependencies = {} },
|
||||
['tos-net'] = { version = '1', files = {}, dependencies = { 'tos-core' } },
|
||||
['trapos-core'] = { version = '1', files = {}, dependencies = {} },
|
||||
['trapos-net'] = { version = '1', files = {}, dependencies = { 'trapos-core' } },
|
||||
} });
|
||||
local ok, err = ccpm.uninstall('tos-core', {});
|
||||
local ok, err = ccpm.uninstall('trapos-core', {});
|
||||
testlib.assertTrue(not ok);
|
||||
testlib.assertTrue(string.find(err, 'required by', 1, true));
|
||||
testlib.assertTrue(string.find(err, 'tos-net', 1, true));
|
||||
testlib.assertTrue(string.find(err, 'trapos-net', 1, true));
|
||||
end);
|
||||
|
||||
testlib.test('uninstall removes a leaf package and its files', function()
|
||||
@ -273,14 +273,14 @@ testlib.test('uninstall removes a leaf package and its files', function()
|
||||
|
||||
local ccpm = createCcpm({ stateDir = sd, installRoot = root });
|
||||
ccpm.writeLock({ packages = {
|
||||
['tos-core'] = { version = '1', files = {}, dependencies = {} },
|
||||
['tos-net'] = { version = '1', files = { 'apis/net.lua' }, dependencies = { 'tos-core' } },
|
||||
['trapos-core'] = { version = '1', files = {}, dependencies = {} },
|
||||
['trapos-net'] = { version = '1', files = { 'apis/net.lua' }, dependencies = { 'trapos-core' } },
|
||||
} });
|
||||
|
||||
testlib.assertTrue(ccpm.uninstall('tos-net', {}));
|
||||
testlib.assertTrue(ccpm.uninstall('trapos-net', {}));
|
||||
testlib.assertTrue(not fs.exists(root .. '/apis/net.lua'));
|
||||
testlib.assertTrue(ccpm.readLock().packages['tos-net'] == nil);
|
||||
testlib.assertTrue(ccpm.readLock().packages['tos-core'] ~= nil);
|
||||
testlib.assertTrue(ccpm.readLock().packages['trapos-net'] == nil);
|
||||
testlib.assertTrue(ccpm.readLock().packages['trapos-core'] ~= nil);
|
||||
end);
|
||||
|
||||
testlib.run();
|
||||
|
||||
@ -51,7 +51,7 @@ testlib.test('programs path resolves the ccpm command', function()
|
||||
testlib.assertEquals(resolved, 'programs/ccpm.lua');
|
||||
end);
|
||||
|
||||
testlib.test('fresh beta bootstrap leaves ccpm runnable without tos-boot', function()
|
||||
testlib.test('fresh beta bootstrap leaves ccpm runnable without trapos-boot', function()
|
||||
local root = '/install-ccpm-test/fresh-beta';
|
||||
fs.delete(root);
|
||||
fs.makeDir(root);
|
||||
@ -59,8 +59,8 @@ testlib.test('fresh beta bootstrap leaves ccpm runnable without tos-boot', funct
|
||||
local base = 'https://raw.githubusercontent.com/guillaumearm/cc-libs/next/';
|
||||
local routes = {
|
||||
[base .. 'manifest.json'] = textutils.serializeJSON({ name = 'TrapOS', version = 'test' }),
|
||||
[base .. 'packages/tos-core/ccpm.json'] = textutils.serializeJSON({
|
||||
name = 'tos-core',
|
||||
[base .. 'packages/trapos-core/ccpm.json'] = textutils.serializeJSON({
|
||||
name = 'trapos-core',
|
||||
version = '1',
|
||||
dependencies = {},
|
||||
files = { 'apis/libccpm.lua', 'programs/ccpm.lua' },
|
||||
|
||||
Loading…
Reference in New Issue
Block a user