octwin-cli 0.1.2 → 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/README.md +1 -0
- package/dist/index.js +50 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,7 @@ octwin status # "✓ live and current" once it's warm
|
|
|
66
66
|
| `octwin whoami` | Verify the saved/passed token is valid for a tenant. `--url`, `--tenant`. |
|
|
67
67
|
| `octwin deploy` | Upload + install the pack onto your tenant's project. `--seed` also runs the pack's demo seed. |
|
|
68
68
|
| `octwin status` | Report what the platform has live for this pack — installed vs. loaded version, and its flows. |
|
|
69
|
+
| `octwin platform-kb pull` | Pull the platform's capability reference (built-ins, primitives, render intents, flow-DSL — as markdown + JSON) into `.octwin/platform-kb/`, for the **`octwin-pack`** Claude Code authoring plugin to consult. |
|
|
69
70
|
| `octwin test` | Validate locally and print how to try the pack on your tenant. |
|
|
70
71
|
| `octwin help` | Show usage. |
|
|
71
72
|
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* octwin whoami [--url <url>] [--tenant <slug>]
|
|
14
14
|
* octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
|
|
15
15
|
* octwin status [--dir .] # did my deploy land? which version is live?
|
|
16
|
+
* octwin platform-kb [pull] [--dir .] # pull the platform capability reference for the authoring skill
|
|
16
17
|
* octwin test [--dir .] # local validate + how to chat on your tenant
|
|
17
18
|
*
|
|
18
19
|
* Config resolution (deploy): flags > pack.json (in the pack dir) > env
|
|
@@ -142,7 +143,7 @@ function cmdInit(flags) {
|
|
|
142
143
|
tenant: 'your-tenant-slug',
|
|
143
144
|
project: 'main',
|
|
144
145
|
}, null, 2) + '\n', 'utf8');
|
|
145
|
-
writeFileSync(join(dir, '.gitignore'), 'node_modules/\n.pack-bundles/\n', 'utf8');
|
|
146
|
+
writeFileSync(join(dir, '.gitignore'), 'node_modules/\n.pack-bundles/\n.octwin/\n', 'utf8');
|
|
146
147
|
if (!existsSync(join(dir, 'README.md'))) {
|
|
147
148
|
writeFileSync(join(dir, 'README.md'), `# ${id}\n\nA pure-YAML pack for the Octwin platform.\n\n- Edit \`manifest.yaml\`, \`flows/tools/main.flow.yaml\`, \`prompts/identity.md\`\n- \`octwin validate\` — check it locally\n- \`octwin deploy\` — deploy + install onto your tenant\n`, 'utf8');
|
|
148
149
|
}
|
|
@@ -284,6 +285,49 @@ async function cmdStatus(flags) {
|
|
|
284
285
|
console.log(` (local manifest is ${localVersion}; deployed is ${json.installed_version} — \`octwin deploy\` to push local edits.)`);
|
|
285
286
|
}
|
|
286
287
|
}
|
|
288
|
+
async function cmdPlatformKb(flags) {
|
|
289
|
+
const packDir = resolve(flags.dir ?? '.');
|
|
290
|
+
const { url, tenant, token } = resolveTarget(flags, packDir);
|
|
291
|
+
const res = await fetch(`${url}/api/admin/tenants/${tenant}/octwin-platform-kb`, {
|
|
292
|
+
headers: { authorization: `Bearer ${token}` },
|
|
293
|
+
});
|
|
294
|
+
const text = await res.text();
|
|
295
|
+
if (!res.ok) {
|
|
296
|
+
let j;
|
|
297
|
+
try {
|
|
298
|
+
j = JSON.parse(text);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
j = text;
|
|
302
|
+
}
|
|
303
|
+
console.error(`✗ platform-kb pull failed (HTTP ${res.status})`);
|
|
304
|
+
console.error(typeof j === 'string' ? j : JSON.stringify(j, null, 2));
|
|
305
|
+
process.exit(1);
|
|
306
|
+
}
|
|
307
|
+
const bundle = JSON.parse(text);
|
|
308
|
+
// Write the reference into <packDir>/.octwin/platform-kb/ — markdown docs (the
|
|
309
|
+
// skill reads these first) + JSON catalogs (precise field schemas). Gitignored.
|
|
310
|
+
const outDir = join(packDir, '.octwin', 'platform-kb');
|
|
311
|
+
mkdirSync(outDir, { recursive: true });
|
|
312
|
+
let mdCount = 0;
|
|
313
|
+
let jsonCount = 0;
|
|
314
|
+
for (const [key, val] of Object.entries(bundle.docs ?? {})) {
|
|
315
|
+
if (val == null)
|
|
316
|
+
continue;
|
|
317
|
+
writeFileSync(join(outDir, `${key}.md`), val, 'utf8');
|
|
318
|
+
mdCount++;
|
|
319
|
+
}
|
|
320
|
+
for (const [key, val] of Object.entries(bundle.sources ?? {})) {
|
|
321
|
+
if (val == null)
|
|
322
|
+
continue;
|
|
323
|
+
writeFileSync(join(outDir, `${key}.json`), JSON.stringify(val, null, 2) + '\n', 'utf8');
|
|
324
|
+
jsonCount++;
|
|
325
|
+
}
|
|
326
|
+
writeFileSync(join(outDir, 'index.json'), JSON.stringify({ version: bundle.version, generated_at: bundle.generated_at, index: bundle.index }, null, 2) + '\n', 'utf8');
|
|
327
|
+
console.log(`✓ Pulled the Octwin platform KB → ${outDir}`);
|
|
328
|
+
console.log(` ${mdCount} markdown docs + ${jsonCount} JSON catalogs (reference version ${bundle.version ?? '?'})`);
|
|
329
|
+
console.log(' The octwin-pack authoring skill reads these as the source of truth for what the platform supports.');
|
|
330
|
+
}
|
|
287
331
|
function cmdTest(flags) {
|
|
288
332
|
const packDir = resolve(flags.dir ?? '.');
|
|
289
333
|
const { id, version } = localValidate(packDir);
|
|
@@ -300,9 +344,11 @@ function help() {
|
|
|
300
344
|
octwin whoami [--url <url>] [--tenant <slug>] # verify the token works
|
|
301
345
|
octwin deploy [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>] [--seed]
|
|
302
346
|
octwin status [--dir .] [--url <url>] [--tenant <slug>] [--project <slug>] [--token <t>]
|
|
347
|
+
octwin platform-kb [pull] [--dir .] [--url <url>] [--tenant <slug>] [--token <t>]
|
|
303
348
|
octwin test [--dir .]
|
|
304
349
|
|
|
305
350
|
Get a deploy token: console → your workspace → Settings → API tokens → Generate.
|
|
351
|
+
octwin platform-kb pull → writes the platform capability reference into .octwin/platform-kb/ (for the octwin-pack skill).
|
|
306
352
|
Config (deploy): flags > pack.json > env (PACK_PLATFORM_URL/PACK_TENANT/PACK_PROJECT/PACK_TOKEN) > saved login.`);
|
|
307
353
|
}
|
|
308
354
|
async function main() {
|
|
@@ -327,6 +373,9 @@ async function main() {
|
|
|
327
373
|
case 'status':
|
|
328
374
|
await cmdStatus(flags);
|
|
329
375
|
break;
|
|
376
|
+
case 'platform-kb':
|
|
377
|
+
await cmdPlatformKb(flags);
|
|
378
|
+
break;
|
|
330
379
|
case 'test':
|
|
331
380
|
cmdTest(flags);
|
|
332
381
|
break;
|
package/package.json
CHANGED