@hypersoniclabs/helix-cli 0.1.0
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/README.md +61 -0
- package/dist/ability.d.ts +73 -0
- package/dist/ability.js +120 -0
- package/dist/ability.js.map +1 -0
- package/dist/api.d.ts +24 -0
- package/dist/api.js +83 -0
- package/dist/api.js.map +1 -0
- package/dist/bundle.d.ts +12 -0
- package/dist/bundle.js +75 -0
- package/dist/bundle.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +62 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +274 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +1 -0
- package/dist/init.js +87 -0
- package/dist/init.js.map +1 -0
- package/dist/initAbility.d.ts +1 -0
- package/dist/initAbility.js +71 -0
- package/dist/initAbility.js.map +1 -0
- package/dist/install.d.ts +51 -0
- package/dist/install.js +201 -0
- package/dist/install.js.map +1 -0
- package/dist/lib.d.ts +82 -0
- package/dist/lib.js +258 -0
- package/dist/lib.js.map +1 -0
- package/dist/package.d.ts +11 -0
- package/dist/package.js +136 -0
- package/dist/package.js.map +1 -0
- package/dist/prompt.d.ts +2 -0
- package/dist/prompt.js +55 -0
- package/dist/prompt.js.map +1 -0
- package/dist/resolve.d.ts +57 -0
- package/dist/resolve.js +103 -0
- package/dist/resolve.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +48 -0
- package/vendor/ability-manifest.mjs +558 -0
- package/vendor/installed-index.mjs +71 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const lib_1 = require("./lib");
|
|
7
|
+
const bundle_1 = require("./bundle");
|
|
8
|
+
const ability_1 = require("./ability");
|
|
9
|
+
const initAbility_1 = require("./initAbility");
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
const init_1 = require("./init");
|
|
12
|
+
const prompt_1 = require("./prompt");
|
|
13
|
+
const program = new commander_1.Command();
|
|
14
|
+
program
|
|
15
|
+
.name('helix')
|
|
16
|
+
.description('HELIX creator CLI — scaffold, validate, and publish Instant Worlds')
|
|
17
|
+
.version((0, lib_1.cliVersion)());
|
|
18
|
+
function fail(message) {
|
|
19
|
+
console.error(message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
function requireAuth() {
|
|
23
|
+
const creds = (0, config_1.loadCredentials)();
|
|
24
|
+
if (!creds)
|
|
25
|
+
fail('Not logged in (or token expired). Run: helix login');
|
|
26
|
+
return creds;
|
|
27
|
+
}
|
|
28
|
+
program
|
|
29
|
+
.command('login')
|
|
30
|
+
.description('Store a HELIX client token for the CLI')
|
|
31
|
+
.option('--api-url <url>', 'platform API base URL', config_1.DEFAULT_API_URL)
|
|
32
|
+
.option('--token <token>', 'client token (otherwise prompted)')
|
|
33
|
+
.action(async (opts) => {
|
|
34
|
+
try {
|
|
35
|
+
console.log('Generate a client token in the Creator Hub (Settings → Client Tokens),\n' +
|
|
36
|
+
'then paste it here. It is stored in ~/.helix/credentials.json.');
|
|
37
|
+
const token = opts.token ?? (await (0, prompt_1.askHidden)('Client token: '));
|
|
38
|
+
if (!token)
|
|
39
|
+
fail('✖ No token provided.');
|
|
40
|
+
const api = new lib_1.HelixApi(opts.apiUrl, token);
|
|
41
|
+
const user = await (0, lib_1.whoAmI)(api); // validates the token
|
|
42
|
+
const expiresAt = (0, config_1.jwtExpiresAtIso)(token);
|
|
43
|
+
(0, config_1.saveCredentials)({
|
|
44
|
+
apiUrl: opts.apiUrl,
|
|
45
|
+
token,
|
|
46
|
+
expiresAt,
|
|
47
|
+
username: user.username,
|
|
48
|
+
});
|
|
49
|
+
const until = expiresAt ? ` (valid until ${expiresAt.slice(0, 10)})` : '';
|
|
50
|
+
console.log(`✔ Logged in as ${user.username}${until}`);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
fail(err instanceof lib_1.ApiError
|
|
54
|
+
? `${err.render()}\n (is the token valid and not expired?)`
|
|
55
|
+
: `✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
program
|
|
59
|
+
.command('logout')
|
|
60
|
+
.description('Remove the stored client token')
|
|
61
|
+
.action(() => {
|
|
62
|
+
(0, config_1.clearCredentials)();
|
|
63
|
+
console.log('✔ Logged out.');
|
|
64
|
+
});
|
|
65
|
+
program
|
|
66
|
+
.command('whoami')
|
|
67
|
+
.description('Show the current login status')
|
|
68
|
+
.action(() => {
|
|
69
|
+
const status = (0, lib_1.authStatus)();
|
|
70
|
+
if (!status.loggedIn) {
|
|
71
|
+
console.log('Not logged in. Run: helix login');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const until = status.expiresAt ? ` (until ${status.expiresAt.slice(0, 10)})` : '';
|
|
75
|
+
console.log(`${status.username} @ ${status.apiUrl}${until}`);
|
|
76
|
+
});
|
|
77
|
+
program
|
|
78
|
+
.command('init')
|
|
79
|
+
.description('Scaffold a minimal HELIX Instant world (or, with --ability, a humanoid-character ability) in a new directory')
|
|
80
|
+
.argument('<directory>', 'directory to create')
|
|
81
|
+
.option('--ability', 'scaffold an ability bundle for the humanoid-character system instead of a world')
|
|
82
|
+
.action((directory, opts) => {
|
|
83
|
+
try {
|
|
84
|
+
if (opts.ability) {
|
|
85
|
+
const created = (0, initAbility_1.initAbilityTemplate)((0, node_path_1.resolve)(directory));
|
|
86
|
+
console.log(`✔ Created ${created.length} files in ${directory}`);
|
|
87
|
+
console.log(`\nNext steps:\n 1. Edit ${directory}/ability.json — pick your own id\n` +
|
|
88
|
+
` 2. helix validate-bundle ${directory}\n 3. From your world project: helix install ${directory} --first-party`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const created = (0, init_1.initTemplate)((0, node_path_1.resolve)(directory));
|
|
92
|
+
console.log(`✔ Created ${created.length} files in ${directory}`);
|
|
93
|
+
console.log(`\nNext steps:\n 1. Edit ${directory}/helix.json — pick your own slug\n` +
|
|
94
|
+
` 2. helix validate ${directory}\n 3. helix publish ${directory}`);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
fail(`✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
program
|
|
101
|
+
.command('validate-bundle')
|
|
102
|
+
.description('Validate an ability bundle against the frozen ability-v1 contract (the same module the runtime loader runs)')
|
|
103
|
+
.argument('[directory]', 'bundle directory (the built dist/)', '.')
|
|
104
|
+
.action(async (directory) => {
|
|
105
|
+
const validator = await (0, ability_1.loadVendoredValidator)();
|
|
106
|
+
const result = (0, ability_1.checkAbilityBundle)((0, node_path_1.resolve)(directory), validator);
|
|
107
|
+
if (result.errors.length || result.manifest === null) {
|
|
108
|
+
fail(`✖ ${result.errors.length} problem(s):\n${result.errors
|
|
109
|
+
.map((e) => ` - ${e}`)
|
|
110
|
+
.join('\n')}`);
|
|
111
|
+
}
|
|
112
|
+
const m = result.manifest;
|
|
113
|
+
console.log(`✔ Valid ability bundle: "${m.title}" (${m.id}@${m.version}, activation: ${m.activation.mode}, ${(m.clips ?? []).length} clips)`);
|
|
114
|
+
});
|
|
115
|
+
program
|
|
116
|
+
.command('install')
|
|
117
|
+
.description("Resolve this v0.2 world's system/ability pins, download their code, and write installed.json + helix.lock.json")
|
|
118
|
+
.argument('[path]', 'a local ability bundle to copy in (requires --first-party); omit for the world resolve+install')
|
|
119
|
+
.option('--update', 're-resolve pins against the live catalog and rewrite the lock (else the existing lock is replayed)')
|
|
120
|
+
.option('--first-party', 'FIRST-PARTY only: copy the local <path> bundle (code AND clips) into helix_modules — for engine devs testing co-located assets')
|
|
121
|
+
.option('--local', 'alias of --first-party (deprecated)')
|
|
122
|
+
.option('--api-url <url>', 'platform API base URL', config_1.DEFAULT_API_URL)
|
|
123
|
+
.action(async (path, opts) => {
|
|
124
|
+
const firstParty = Boolean(opts.firstParty || opts.local);
|
|
125
|
+
if (path !== undefined || firstParty) {
|
|
126
|
+
if (!path) {
|
|
127
|
+
fail('✖ --first-party needs a bundle path: helix install <bundle> --first-party');
|
|
128
|
+
}
|
|
129
|
+
if (!firstParty) {
|
|
130
|
+
fail("✖ to copy a local ability bundle use: helix install <bundle> --first-party\n (a bare `helix install` resolves this world's pins)");
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
const [validator, indexValidator] = await Promise.all([
|
|
134
|
+
(0, ability_1.loadVendoredValidator)(),
|
|
135
|
+
(0, ability_1.loadInstalledIndexValidator)(),
|
|
136
|
+
]);
|
|
137
|
+
const result = (0, ability_1.installLocalAbility)((0, node_path_1.resolve)(path), process.cwd(), validator, indexValidator);
|
|
138
|
+
console.log(`✔ Installed (first-party) ${result.id}@${result.version} -> ${ability_1.MODULES_DIR}/${result.path}/ (${result.installedCount} installed)`);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
fail(`✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
142
|
+
}
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const result = await (0, lib_1.installWorld)(process.cwd(), {
|
|
147
|
+
apiUrl: opts.apiUrl,
|
|
148
|
+
update: opts.update,
|
|
149
|
+
onProgress: (msg) => console.log(msg),
|
|
150
|
+
});
|
|
151
|
+
const sys = result.systems.map((s) => `${s.slug}@${s.version}`).join(', ') || '(none)';
|
|
152
|
+
const abl = result.abilities.map((a) => `${a.slug}@${a.version}`).join(', ') || '(none)';
|
|
153
|
+
console.log(`✔ ${result.reresolved ? 'Resolved' : 'Replayed lock'} — systems: ${sys}; abilities: ${abl}`);
|
|
154
|
+
console.log(` code -> public/${ability_1.MODULES_DIR}/ · assets stream from the CDN · lock -> ${lib_1.LOCKFILE}`);
|
|
155
|
+
if (result.runtime) {
|
|
156
|
+
console.log(` three ${result.runtime.threeVersion} -> import map + src/helix.runtime.ts wired to the hosted runtime`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
fail(err instanceof lib_1.ApiError
|
|
161
|
+
? err.render()
|
|
162
|
+
: `✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
program
|
|
166
|
+
.command('validate')
|
|
167
|
+
.description('Validate a world bundle locally (same rules the server enforces)')
|
|
168
|
+
.argument('[directory]', 'bundle directory', '.')
|
|
169
|
+
.action((directory) => {
|
|
170
|
+
const result = (0, bundle_1.checkBundle)((0, node_path_1.resolve)(directory));
|
|
171
|
+
if (result.errors.length) {
|
|
172
|
+
fail(`✖ ${result.errors.length} problem(s):\n${result.errors
|
|
173
|
+
.map((e) => ` - ${e}`)
|
|
174
|
+
.join('\n')}`);
|
|
175
|
+
}
|
|
176
|
+
const total = result.files.reduce((sum, f) => sum + f.size, 0);
|
|
177
|
+
console.log(`✔ Valid bundle: "${result.manifest.title}" (${result.files.length} files, ${(total / 1024).toFixed(1)} KiB)`);
|
|
178
|
+
});
|
|
179
|
+
program
|
|
180
|
+
.command('publish')
|
|
181
|
+
.description('Publish a world to HELIX Instant')
|
|
182
|
+
.argument('[directory]', 'bundle directory', '.')
|
|
183
|
+
.action(async (directory) => {
|
|
184
|
+
const creds = requireAuth();
|
|
185
|
+
try {
|
|
186
|
+
const result = await (0, lib_1.publishWorld)((0, node_path_1.resolve)(directory), creds, (msg) => console.log(msg));
|
|
187
|
+
console.log(`✔ Published "${result.title}" build ${result.buildNumber}`);
|
|
188
|
+
if (result.playUrl)
|
|
189
|
+
console.log(` play: ${result.playUrl}`);
|
|
190
|
+
console.log(` api: ${result.worldUrl}`);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
fail(err instanceof lib_1.ApiError
|
|
194
|
+
? err.render()
|
|
195
|
+
: `✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
program
|
|
199
|
+
.command('publish-package')
|
|
200
|
+
.description('Publish a system / ability / asset-pack bundle (requires an admin account)')
|
|
201
|
+
.argument('[directory]', 'bundle directory (the built dist/)', '.')
|
|
202
|
+
.action(async (directory) => {
|
|
203
|
+
const creds = requireAuth();
|
|
204
|
+
try {
|
|
205
|
+
const result = await (0, lib_1.publishPackage)((0, node_path_1.resolve)(directory), creds, (msg) => console.log(msg));
|
|
206
|
+
console.log(`✔ Published ${result.kind} ${result.slug}@${result.version} (revision ${result.revision})`);
|
|
207
|
+
console.log(` code: ${result.codeBaseUrl}`);
|
|
208
|
+
if (result.assetBaseUrl)
|
|
209
|
+
console.log(` assets: ${result.assetBaseUrl}`);
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
fail(err instanceof lib_1.ApiError
|
|
213
|
+
? err.render()
|
|
214
|
+
: `✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
async function printCatalog(kind, system, apiUrlOpt) {
|
|
218
|
+
const apiUrl = apiUrlOpt ?? (0, config_1.loadCredentials)()?.apiUrl ?? config_1.DEFAULT_API_URL;
|
|
219
|
+
try {
|
|
220
|
+
const res = await (0, lib_1.listPackages)(apiUrl, kind, system);
|
|
221
|
+
const plural = kind === 'ability' ? 'abilities' : kind === 'asset-pack' ? 'asset-packs' : `${kind}s`;
|
|
222
|
+
if (res.data.length === 0) {
|
|
223
|
+
console.log(`No ${plural} published yet.`);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
for (const p of res.data) {
|
|
227
|
+
const sys = p.targetSystem
|
|
228
|
+
? ` [system: ${p.targetSystem.id}${p.targetSystem.range ? `@${p.targetSystem.range}` : ''}]`
|
|
229
|
+
: '';
|
|
230
|
+
console.log(`- ${p.slug}@${p.latestVersion ?? '?'} — ${p.title}${sys}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
fail(err instanceof lib_1.ApiError
|
|
235
|
+
? err.render()
|
|
236
|
+
: `✖ ${err instanceof Error ? err.message : String(err)}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
program
|
|
240
|
+
.command('list-systems')
|
|
241
|
+
.description('List the systems published on HELIX Instant')
|
|
242
|
+
.option('--api-url <url>', 'platform API base URL')
|
|
243
|
+
.action((opts) => printCatalog('system', undefined, opts.apiUrl));
|
|
244
|
+
program
|
|
245
|
+
.command('list-abilities')
|
|
246
|
+
.description('List the abilities published on HELIX Instant')
|
|
247
|
+
.option('--system <id>', 'only abilities targeting this system id')
|
|
248
|
+
.option('--api-url <url>', 'platform API base URL')
|
|
249
|
+
.action((opts) => printCatalog('ability', opts.system, opts.apiUrl));
|
|
250
|
+
program
|
|
251
|
+
.command('doctor')
|
|
252
|
+
.description('Health check: login state + whether the @helix toolchain (CLI/MCP/SDK/manifest) is up to date')
|
|
253
|
+
.option('--project <dir>', 'a world/ability project dir to also check its pinned @helix deps', '.')
|
|
254
|
+
.action(async (opts) => {
|
|
255
|
+
const status = (0, lib_1.authStatus)();
|
|
256
|
+
console.log(status.loggedIn
|
|
257
|
+
? `✔ Logged in as ${status.username} (${status.apiUrl})`
|
|
258
|
+
: '• Not logged in — run: helix login');
|
|
259
|
+
const rows = await (0, lib_1.checkForUpdates)({ projectDir: (0, node_path_1.resolve)(opts.project) });
|
|
260
|
+
console.log('\n@helix toolchain:');
|
|
261
|
+
for (const r of rows) {
|
|
262
|
+
const mark = r.status === 'current' ? '✔' : r.status === 'update-available' ? '⬆' : '•';
|
|
263
|
+
const line = ` ${mark} ${r.name.padEnd(20)} ${(r.installed ?? '—').padEnd(8)} (latest ${r.latest ?? '?'})`;
|
|
264
|
+
console.log(r.status === 'update-available' ? `${line} → ${r.updateHint}` : line);
|
|
265
|
+
}
|
|
266
|
+
const stale = rows.filter((r) => r.status === 'update-available');
|
|
267
|
+
console.log(stale.length
|
|
268
|
+
? `\n${stale.length} update(s) available.`
|
|
269
|
+
: '\nAll detected packages are current.');
|
|
270
|
+
});
|
|
271
|
+
program
|
|
272
|
+
.parseAsync()
|
|
273
|
+
.catch((err) => fail(`✖ ${err instanceof Error ? err.message : String(err)}`));
|
|
274
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AACpC,yCAAoC;AACpC,+BAYe;AACf,qCAAuC;AACvC,uCAMmB;AACnB,+CAAoD;AACpD,qCAMkB;AAClB,iCAAsC;AACtC,qCAAqC;AAErC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,oEAAoE,CAAC;KACjF,OAAO,CAAC,IAAA,gBAAU,GAAE,CAAC,CAAC;AAEzB,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,KAAK,GAAG,IAAA,wBAAe,GAAE,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACvE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,wCAAwC,CAAC;KACrD,MAAM,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,wBAAe,CAAC;KACnE,MAAM,CAAC,iBAAiB,EAAE,mCAAmC,CAAC;KAC9D,MAAM,CAAC,KAAK,EAAE,IAAwC,EAAE,EAAE;IACzD,IAAI,CAAC;QACH,OAAO,CAAC,GAA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,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,IAAI,GAAG,GAAG,CAAC;QAC5G,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACrF,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,kBAAkB,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,MAAM;QACV,CAAC,CAAC,KAAK,KAAK,CAAC,MAAM,uBAAuB;QAC1C,CAAC,CAAC,sCAAsC,CAC3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,UAAU,EAAE;KACZ,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CACb,IAAI,CAAC,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAC9D,CAAC"}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initTemplate(targetDir: string): string[];
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initTemplate = initTemplate;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
// Minimal no-build starter: plain Three.js from a CDN import map, no bundler.
|
|
7
|
+
// The SDK-integrated Vite templates (template-spinning-scene, template-hangout)
|
|
8
|
+
// are the real starting points; this exists so `helix init` works standalone.
|
|
9
|
+
const TEMPLATE_FILES = {
|
|
10
|
+
'helix.json': (slug) => JSON.stringify({
|
|
11
|
+
helixVersion: '0.1',
|
|
12
|
+
title: 'My HELIX World',
|
|
13
|
+
slug,
|
|
14
|
+
entry: 'index.html',
|
|
15
|
+
maxPlayers: 1,
|
|
16
|
+
permissions: [],
|
|
17
|
+
supportsMobile: true,
|
|
18
|
+
contentRating: 'everyone',
|
|
19
|
+
}, null, 2) + '\n',
|
|
20
|
+
'index.html': () => `<!doctype html>
|
|
21
|
+
<html lang="en">
|
|
22
|
+
<head>
|
|
23
|
+
<meta charset="utf-8" />
|
|
24
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
25
|
+
<title>My HELIX World</title>
|
|
26
|
+
<style>html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0a12; }</style>
|
|
27
|
+
<script type="importmap">
|
|
28
|
+
{ "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.172.0/build/three.module.js" } }
|
|
29
|
+
</script>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<script type="module" src="main.js"></script>
|
|
33
|
+
</body>
|
|
34
|
+
</html>
|
|
35
|
+
`,
|
|
36
|
+
'main.js': () => `import * as THREE from 'three';
|
|
37
|
+
|
|
38
|
+
const scene = new THREE.Scene();
|
|
39
|
+
const camera = new THREE.PerspectiveCamera(70, innerWidth / innerHeight, 0.1, 100);
|
|
40
|
+
camera.position.z = 3;
|
|
41
|
+
|
|
42
|
+
const renderer = new THREE.WebGLRenderer({ antialias: true });
|
|
43
|
+
renderer.setSize(innerWidth, innerHeight);
|
|
44
|
+
document.body.appendChild(renderer.domElement);
|
|
45
|
+
|
|
46
|
+
const cube = new THREE.Mesh(
|
|
47
|
+
new THREE.BoxGeometry(),
|
|
48
|
+
new THREE.MeshStandardMaterial({ color: 0x7c4dff }),
|
|
49
|
+
);
|
|
50
|
+
scene.add(cube);
|
|
51
|
+
scene.add(new THREE.AmbientLight(0xffffff, 0.4));
|
|
52
|
+
const light = new THREE.DirectionalLight(0xffffff, 1.2);
|
|
53
|
+
light.position.set(2, 3, 4);
|
|
54
|
+
scene.add(light);
|
|
55
|
+
|
|
56
|
+
addEventListener('resize', () => {
|
|
57
|
+
camera.aspect = innerWidth / innerHeight;
|
|
58
|
+
camera.updateProjectionMatrix();
|
|
59
|
+
renderer.setSize(innerWidth, innerHeight);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
renderer.setAnimationLoop(() => {
|
|
63
|
+
cube.rotation.x += 0.01;
|
|
64
|
+
cube.rotation.y += 0.013;
|
|
65
|
+
renderer.render(scene, camera);
|
|
66
|
+
});
|
|
67
|
+
`,
|
|
68
|
+
};
|
|
69
|
+
function initTemplate(targetDir) {
|
|
70
|
+
if ((0, node_fs_1.existsSync)(targetDir))
|
|
71
|
+
throw new Error(`directory already exists: ${targetDir}`);
|
|
72
|
+
const slug = (0, node_path_1.basename)(targetDir)
|
|
73
|
+
.toLowerCase()
|
|
74
|
+
.replace(/[^a-z0-9-]+/g, '-')
|
|
75
|
+
.replace(/^-+|-+$/g, '')
|
|
76
|
+
.slice(0, 50)
|
|
77
|
+
.padEnd(3, '0');
|
|
78
|
+
const created = [];
|
|
79
|
+
for (const [path, render] of Object.entries(TEMPLATE_FILES)) {
|
|
80
|
+
const absolute = (0, node_path_1.join)(targetDir, path);
|
|
81
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(absolute), { recursive: true });
|
|
82
|
+
(0, node_fs_1.writeFileSync)(absolute, render(slug), 'utf8');
|
|
83
|
+
created.push(path);
|
|
84
|
+
}
|
|
85
|
+
return created;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;AAwEA,oCAiBC;AAzFD,qCAA+D;AAC/D,yCAAoD;AAEpD,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,MAAM,cAAc,GAA6C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M,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initAbilityTemplate(targetDir: string): string[];
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initAbilityTemplate = initAbilityTemplate;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
// Minimal no-build ability scaffold for the humanoid-character system: plain-JS entry, directly
|
|
7
|
+
// installable (`helix install <dir> --local`) with no build step. The TS template with vendored
|
|
8
|
+
// system types (helix-instant-templates/humanoid-character-ability) is the real starting point;
|
|
9
|
+
// this exists so `helix init --ability` works standalone — mirroring the world `init` pattern.
|
|
10
|
+
const TEMPLATE_FILES = {
|
|
11
|
+
'ability.json': (id) => JSON.stringify({
|
|
12
|
+
$schema: 'https://helix.dev/schemas/ability-v1.schema.json',
|
|
13
|
+
schemaVersion: 1,
|
|
14
|
+
id,
|
|
15
|
+
version: '0.1.0',
|
|
16
|
+
title: 'My Ability',
|
|
17
|
+
description: 'Describe what the ability does and any blackboard params the world must publish.',
|
|
18
|
+
system: { id: 'humanoid-character', version: '^0.1.0', skeleton: 'helix-humanoid@1' },
|
|
19
|
+
activation: { mode: 'manual', action: `${id}.toggle`, style: 'toggle' },
|
|
20
|
+
actions: [{ id: `${id}.toggle`, kind: 'button', defaultBinding: { keys: ['KeyG'] } }],
|
|
21
|
+
configSchema: 'schema/config.schema.json',
|
|
22
|
+
entry: 'index.js',
|
|
23
|
+
}, null, 2) + '\n',
|
|
24
|
+
'schema/config.schema.json': () => JSON.stringify({
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
power: { type: 'number', default: 1, minimum: 0, maximum: 10, description: 'Example tunable; agents set it live as <abilityId>.power.' },
|
|
28
|
+
},
|
|
29
|
+
}, null, 2) + '\n',
|
|
30
|
+
'index.js': (id) => `// Ability entry — the default export implements the system Ability interface.
|
|
31
|
+
// No runtime imports: bare specifiers don't resolve when the platform import()s this file;
|
|
32
|
+
// everything the ability touches comes through the AbilityContext (ctx) the system passes in.
|
|
33
|
+
export default class MyAbility {
|
|
34
|
+
manifest = { id: '${id}' };
|
|
35
|
+
|
|
36
|
+
onActivate(ctx) {
|
|
37
|
+
// Activated by the manifest action (KeyG). Channels declared in ability.json are claimed.
|
|
38
|
+
void ctx;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
onTick(dt, ctx) {
|
|
42
|
+
const power = ctx.config.get('power'); // agents see this as '${id}.power'
|
|
43
|
+
void dt;
|
|
44
|
+
void power;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onDeactivate(ctx) {
|
|
48
|
+
void ctx;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`,
|
|
52
|
+
};
|
|
53
|
+
function initAbilityTemplate(targetDir) {
|
|
54
|
+
if ((0, node_fs_1.existsSync)(targetDir))
|
|
55
|
+
throw new Error(`directory already exists: ${targetDir}`);
|
|
56
|
+
const id = (0, node_path_1.basename)(targetDir)
|
|
57
|
+
.toLowerCase()
|
|
58
|
+
.replace(/[^a-z0-9-]+/g, '-')
|
|
59
|
+
.replace(/^-+|-+$/g, '')
|
|
60
|
+
.slice(0, 50)
|
|
61
|
+
.padEnd(3, '0');
|
|
62
|
+
const created = [];
|
|
63
|
+
for (const [path, render] of Object.entries(TEMPLATE_FILES)) {
|
|
64
|
+
const absolute = (0, node_path_1.join)(targetDir, path);
|
|
65
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(absolute), { recursive: true });
|
|
66
|
+
(0, node_fs_1.writeFileSync)(absolute, render(id), 'utf8');
|
|
67
|
+
created.push(path);
|
|
68
|
+
}
|
|
69
|
+
return created;
|
|
70
|
+
}
|
|
71
|
+
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AI;IACV,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;;;;sBAIA,EAAE;;;;;;;;oEAQ4C,EAAE;;;;;;;;;CASrE;CACA,CAAC;AAEF,SAAgB,mBAAmB,CAAC,SAAiB;IACnD,IAAI,IAAA,oBAAU,EAAC,SAAS,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;IACrF,MAAM,EAAE,GAAG,IAAA,oBAAQ,EAAC,SAAS,CAAC;SAC3B,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;SACZ,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAElB,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QAC5D,MAAM,QAAQ,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACvC,IAAA,mBAAS,EAAC,IAAA,mBAAO,EAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,IAAA,uBAAa,EAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ManifestIssue } from './ability';
|
|
2
|
+
import { type ResolvedPackage, type ResolvedPins, type WorldPins } from './resolve';
|
|
3
|
+
export declare const MODULES_DIR = "helix_modules";
|
|
4
|
+
export declare const INSTALLED_INDEX = "installed.json";
|
|
5
|
+
export declare const LOCKFILE = "helix.lock.json";
|
|
6
|
+
export declare const RUNTIME_MODULE = "helix.runtime.ts";
|
|
7
|
+
/** A v2 install-index entry: code from a (here local, root-absolute) base; clips from the CDN. */
|
|
8
|
+
export type InstalledEntry = {
|
|
9
|
+
id: string;
|
|
10
|
+
version: string;
|
|
11
|
+
codeUrl: string;
|
|
12
|
+
assetBaseUrl: string;
|
|
13
|
+
};
|
|
14
|
+
export type WorldLock = {
|
|
15
|
+
lockfileVersion: 1;
|
|
16
|
+
systems: ResolvedPackage[];
|
|
17
|
+
abilities: ResolvedPackage[];
|
|
18
|
+
};
|
|
19
|
+
export type InstallWorldResult = {
|
|
20
|
+
manifestPath: string;
|
|
21
|
+
modulesDir: string;
|
|
22
|
+
systems: Array<{
|
|
23
|
+
slug: string;
|
|
24
|
+
version: string;
|
|
25
|
+
}>;
|
|
26
|
+
abilities: Array<{
|
|
27
|
+
slug: string;
|
|
28
|
+
version: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** true when --update re-resolved the catalog; false when the existing lock was replayed. */
|
|
31
|
+
reresolved: boolean;
|
|
32
|
+
/** The hosted-three URLs install wired into index.html + src/helix.runtime.ts (null if no system pinned). */
|
|
33
|
+
runtime: {
|
|
34
|
+
threeVersion: string;
|
|
35
|
+
threeModuleUrl: string;
|
|
36
|
+
transcoderPath: string;
|
|
37
|
+
} | null;
|
|
38
|
+
};
|
|
39
|
+
export type InstallDeps = {
|
|
40
|
+
resolve(pins: WorldPins): Promise<ResolvedPins>;
|
|
41
|
+
download(codeBaseUrl: string, files: string[], destDir: string): Promise<void>;
|
|
42
|
+
satisfies(version: string, normalizedRange: string): boolean;
|
|
43
|
+
validateIndex(value: unknown): ManifestIssue[];
|
|
44
|
+
};
|
|
45
|
+
export type InstallWorldOptions = {
|
|
46
|
+
apiUrl: string;
|
|
47
|
+
update?: boolean;
|
|
48
|
+
onProgress?: (msg: string) => void;
|
|
49
|
+
deps?: InstallDeps;
|
|
50
|
+
};
|
|
51
|
+
export declare function installWorld(worldDir: string, opts: InstallWorldOptions): Promise<InstallWorldResult>;
|