@oml/cli 0.13.0 → 0.14.1
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 +28 -21
- package/out/{auth.d.ts → auth/auth.d.ts} +7 -0
- package/out/{auth.js → auth/auth.js} +42 -3
- package/out/auth/auth.js.map +1 -0
- package/out/{platform-constants.js → auth/constants.js} +1 -1
- package/out/auth/constants.js.map +1 -0
- package/out/{platform.d.ts → auth/platform.d.ts} +5 -7
- package/out/{platform.js → auth/platform.js} +13 -19
- package/out/auth/platform.js.map +1 -0
- package/out/cli.d.ts +6 -0
- package/out/cli.js +175 -62
- package/out/cli.js.map +1 -1
- package/out/commands/export.d.ts +8 -0
- package/out/commands/export.js +27 -0
- package/out/commands/export.js.map +1 -0
- package/out/commands/lint.d.ts +22 -2
- package/out/commands/lint.js +64 -18
- package/out/commands/lint.js.map +1 -1
- package/out/commands/reason.d.ts +2 -9
- package/out/commands/reason.js +52 -48
- package/out/commands/reason.js.map +1 -1
- package/out/commands/render.d.ts +1 -9
- package/out/commands/render.js +15 -726
- package/out/commands/render.js.map +1 -1
- package/out/commands/server/actions.d.ts +22 -0
- package/out/commands/server/actions.js +394 -0
- package/out/commands/server/actions.js.map +1 -0
- package/out/commands/server/require.d.ts +1 -0
- package/out/commands/server/require.js +89 -0
- package/out/commands/server/require.js.map +1 -0
- package/out/commands/server/rest.d.ts +2 -0
- package/out/commands/server/rest.js +117 -0
- package/out/commands/server/rest.js.map +1 -0
- package/out/commands/validate.d.ts +3 -3
- package/out/commands/validate.js +35 -171
- package/out/commands/validate.js.map +1 -1
- package/package.json +5 -7
- package/src/{auth.ts → auth/auth.ts} +54 -3
- package/src/{platform.ts → auth/platform.ts} +13 -19
- package/src/cli.ts +207 -63
- package/src/commands/export.ts +54 -0
- package/src/commands/lint.ts +88 -18
- package/src/commands/reason.ts +69 -56
- package/src/commands/render.ts +23 -995
- package/src/commands/server/actions.ts +480 -0
- package/src/commands/server/require.ts +99 -0
- package/src/commands/server/rest.ts +135 -0
- package/src/commands/validate.ts +46 -207
- package/out/auth.js.map +0 -1
- package/out/backend/backend-types.d.ts +0 -21
- package/out/backend/backend-types.js +0 -3
- package/out/backend/backend-types.js.map +0 -1
- package/out/backend/create-backend.d.ts +0 -2
- package/out/backend/create-backend.js +0 -6
- package/out/backend/create-backend.js.map +0 -1
- package/out/backend/direct-backend.d.ts +0 -20
- package/out/backend/direct-backend.js +0 -150
- package/out/backend/direct-backend.js.map +0 -1
- package/out/backend/reasoned-output.d.ts +0 -38
- package/out/backend/reasoned-output.js +0 -568
- package/out/backend/reasoned-output.js.map +0 -1
- package/out/commands/closure.d.ts +0 -33
- package/out/commands/closure.js +0 -537
- package/out/commands/closure.js.map +0 -1
- package/out/commands/compile.d.ts +0 -11
- package/out/commands/compile.js +0 -63
- package/out/commands/compile.js.map +0 -1
- package/out/platform-constants.js.map +0 -1
- package/out/platform.js.map +0 -1
- package/src/backend/backend-types.ts +0 -27
- package/src/backend/create-backend.ts +0 -8
- package/src/backend/direct-backend.ts +0 -169
- package/src/backend/reasoned-output.ts +0 -697
- package/src/commands/closure.ts +0 -624
- package/src/commands/compile.ts +0 -88
- /package/out/{platform-constants.d.ts → auth/constants.d.ts} +0 -0
- /package/src/{platform-constants.ts → auth/constants.ts} +0 -0
package/out/commands/reason.js
CHANGED
|
@@ -1,60 +1,64 @@
|
|
|
1
1
|
// Copyright (c) 2026 Modelware. All rights reserved.
|
|
2
|
-
import { createOmlServices } from '@oml/language';
|
|
3
2
|
import chalk from 'chalk';
|
|
4
|
-
import { NodeFileSystem } from 'langium/node';
|
|
5
|
-
import { URI } from 'langium';
|
|
6
|
-
import * as fs from 'node:fs/promises';
|
|
7
3
|
import * as path from 'node:path';
|
|
8
|
-
import { buildWorkspaceDocuments, collectWorkspaceOntologyEntries, normalizeFormatExtension, OntologyInconsistencyError, reasonWorkspaceOntologies } from '../backend/reasoned-output.js';
|
|
9
4
|
import { failCli } from '../cli-error.js';
|
|
10
5
|
import { formatDuration } from '../util.js';
|
|
11
|
-
import {
|
|
6
|
+
import { restPost } from './server/rest.js';
|
|
7
|
+
import { formatLintSummary, printLintDiagnostics } from './lint.js';
|
|
12
8
|
export const reasonAction = async (opts) => {
|
|
13
|
-
const workspaceRoot = resolveCompileWorkspaceRoot(opts.workspace);
|
|
14
|
-
const outputRoot = resolveCompileOutputRoot(workspaceRoot, opts.owl);
|
|
15
|
-
const format = normalizeFormatExtension(opts.format);
|
|
16
|
-
if (opts.only && opts.clean) {
|
|
17
|
-
failCli(chalk.red('Cannot combine --only with --clean for reason.'));
|
|
18
|
-
}
|
|
19
|
-
if (!opts.only) {
|
|
20
|
-
await compileAction({
|
|
21
|
-
workspace: workspaceRoot,
|
|
22
|
-
owl: outputRoot,
|
|
23
|
-
format,
|
|
24
|
-
clean: opts.clean,
|
|
25
|
-
pretty: opts.pretty
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
const outputStat = await fs.stat(outputRoot).catch(() => undefined);
|
|
29
|
-
if (!outputStat || !outputStat.isDirectory()) {
|
|
30
|
-
failCli(chalk.red(`OWL output folder does not exist: ${outputRoot}`));
|
|
31
|
-
}
|
|
32
9
|
const startedAt = Date.now();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
10
|
+
const result = await restPost('/v0/reason', opts, opts.authToken);
|
|
11
|
+
if (result.validate?.lint) {
|
|
12
|
+
const lint = result.validate.lint;
|
|
13
|
+
if (lint.filesChecked <= 0) {
|
|
14
|
+
console.log(chalk.yellow('No .oml files found in server workspace.'));
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
printLintDiagnostics(lint);
|
|
18
|
+
const lintElapsedMs = typeof lint.elapsedMs === 'number' && Number.isFinite(lint.elapsedMs) && lint.elapsedMs >= 0
|
|
19
|
+
? lint.elapsedMs
|
|
20
|
+
: Date.now() - startedAt;
|
|
21
|
+
const lintSummary = formatLintSummary(lint, lintElapsedMs);
|
|
22
|
+
if (lint.errors > 0) {
|
|
23
|
+
failCli(chalk.red(lintSummary));
|
|
24
|
+
}
|
|
25
|
+
if (lint.warnings > 0) {
|
|
26
|
+
failCli(chalk.yellow(lintSummary));
|
|
27
|
+
}
|
|
28
|
+
console.log(chalk.green(lintSummary));
|
|
29
|
+
}
|
|
50
30
|
}
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
|
|
31
|
+
if (result.validate && result.validate.success) {
|
|
32
|
+
if (result.validate.filesChecked === 0) {
|
|
33
|
+
console.log(chalk.yellow('No markdown/table-editor targets found in server workspace.'));
|
|
54
34
|
}
|
|
55
|
-
|
|
35
|
+
else {
|
|
36
|
+
const validateElapsedMs = typeof result.validate.elapsedMs === 'number'
|
|
37
|
+
&& Number.isFinite(result.validate.elapsedMs)
|
|
38
|
+
&& result.validate.elapsedMs >= 0
|
|
39
|
+
? result.validate.elapsedMs
|
|
40
|
+
: Date.now() - startedAt;
|
|
41
|
+
console.log(chalk.green(`validate: ${result.validate.filesChecked} item(s) checked. [${formatDuration(validateElapsedMs)}]`));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!result.success) {
|
|
45
|
+
for (const item of result.failed) {
|
|
46
|
+
const modelUri = String(item.modelUri ?? '').trim();
|
|
47
|
+
console.log(chalk.red(`reason failed: ${modelUri || '<workspace>'}: ${item.error}`));
|
|
48
|
+
}
|
|
49
|
+
for (const item of result.inconsistent) {
|
|
50
|
+
const warnings = item.validationWarnings.length > 0 ? ` warnings=${item.validationWarnings.join('; ')}` : '';
|
|
51
|
+
console.log(chalk.red(`reason inconsistency detected: ${item.modelUri}.${warnings}`));
|
|
52
|
+
}
|
|
53
|
+
failCli(chalk.red(result.validate?.error?.trim() || 'reason failed.'));
|
|
54
|
+
}
|
|
55
|
+
if (result.ontologiesReasoned === 0) {
|
|
56
|
+
console.log(chalk.yellow(`No .oml files found under ${path.resolve('.')}.`));
|
|
57
|
+
return;
|
|
56
58
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
+
const reasonElapsedMs = typeof result.elapsedMs === 'number' && Number.isFinite(result.elapsedMs) && result.elapsedMs >= 0
|
|
60
|
+
? result.elapsedMs
|
|
61
|
+
: Date.now() - startedAt;
|
|
62
|
+
console.log(chalk.green(`reason: ${result.ontologiesReasoned} ontology file(s) checked [${formatDuration(reasonElapsedMs)}]`));
|
|
59
63
|
};
|
|
60
64
|
//# sourceMappingURL=reason.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reason.js","sourceRoot":"","sources":["../../src/commands/reason.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,
|
|
1
|
+
{"version":3,"file":"reason.js","sourceRoot":"","sources":["../../src/commands/reason.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAoB,MAAM,WAAW,CAAC;AAQtF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,IAAmB,EAAiB,EAAE;IACrE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,QAAQ,CAgB1B,YAAY,EAAE,IAA0C,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAE7E,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;Q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C,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,MAAM,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,6BAA6B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7E,OAAO;IACX,CAAC;IAED,MAAM,eAAe,GAAG,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC;QACtH,CAAC,CAAC,MAAM,CAAC,SAAS;QAClB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,kBAAkB,8BAA8B,cAAc,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC;AACnI,CAAC,CAAC"}
|
package/out/commands/render.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export type RenderOptions = {
|
|
2
|
-
workspace?: string;
|
|
3
2
|
md: string;
|
|
4
3
|
web: string;
|
|
5
|
-
owl?: string;
|
|
6
|
-
format?: string;
|
|
7
4
|
context?: string;
|
|
8
|
-
|
|
9
|
-
only?: boolean;
|
|
10
|
-
pretty?: boolean;
|
|
11
|
-
uniqueNamesAssumption?: boolean;
|
|
12
|
-
explanations?: boolean;
|
|
13
|
-
profile?: boolean;
|
|
5
|
+
authToken?: string;
|
|
14
6
|
};
|
|
15
7
|
export declare const renderAction: (opts: RenderOptions) => Promise<void>;
|