@atolis-hq/corum 0.1.7 → 0.1.9
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/dist/src/bin/corum.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { readFile as fsReadFile } from 'node:fs/promises';
|
|
5
|
+
import { createRequire } from 'node:module';
|
|
5
6
|
import path from 'node:path';
|
|
6
7
|
import { parse as parseYaml } from 'yaml';
|
|
7
8
|
import { buildOpenAPIConfig, loadImportConfig } from '../import/config.js';
|
|
@@ -15,11 +16,13 @@ import { readManifest, upsertPack } from '../pack/manifest.js';
|
|
|
15
16
|
import { fetchRegistry, findPack, resolveRef } from '../pack/registry.js';
|
|
16
17
|
import { createGraphRuntimeConfig } from '../source/config.js';
|
|
17
18
|
import { startWebServer } from '../web/server.js';
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
const { version } = require('../../../package.json');
|
|
18
21
|
const program = new Command();
|
|
19
22
|
program
|
|
20
23
|
.name('corum')
|
|
21
24
|
.description('Corum graph CLI')
|
|
22
|
-
.version(
|
|
25
|
+
.version(version);
|
|
23
26
|
program
|
|
24
27
|
.command('mcp')
|
|
25
28
|
.description('Start the MCP stdio server (+ web UI by default)')
|
|
@@ -17,4 +17,13 @@ export async function installPackFiles(baseUrl, destDir, fetchFn = fetch) {
|
|
|
17
17
|
throw new Error(`Failed to fetch template ${templateName}: ${res.status} ${res.statusText}`);
|
|
18
18
|
await writeFile(path.join(destDir, 'templates', `${templateName}.yaml`), await res.text());
|
|
19
19
|
}
|
|
20
|
+
for (const filePath of meta.files ?? []) {
|
|
21
|
+
const fileUrl = `${baseUrl}/${filePath}`;
|
|
22
|
+
const res = await fetchFn(fileUrl);
|
|
23
|
+
if (!res.ok)
|
|
24
|
+
throw new Error(`Failed to fetch file ${filePath}: ${res.status} ${res.statusText}`);
|
|
25
|
+
const dest = path.join(destDir, filePath);
|
|
26
|
+
await mkdir(path.dirname(dest), { recursive: true });
|
|
27
|
+
await writeFile(dest, await res.text());
|
|
28
|
+
}
|
|
20
29
|
}
|