@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.
Files changed (77) hide show
  1. package/README.md +28 -21
  2. package/out/{auth.d.ts → auth/auth.d.ts} +7 -0
  3. package/out/{auth.js → auth/auth.js} +42 -3
  4. package/out/auth/auth.js.map +1 -0
  5. package/out/{platform-constants.js → auth/constants.js} +1 -1
  6. package/out/auth/constants.js.map +1 -0
  7. package/out/{platform.d.ts → auth/platform.d.ts} +5 -7
  8. package/out/{platform.js → auth/platform.js} +13 -19
  9. package/out/auth/platform.js.map +1 -0
  10. package/out/cli.d.ts +6 -0
  11. package/out/cli.js +175 -62
  12. package/out/cli.js.map +1 -1
  13. package/out/commands/export.d.ts +8 -0
  14. package/out/commands/export.js +27 -0
  15. package/out/commands/export.js.map +1 -0
  16. package/out/commands/lint.d.ts +22 -2
  17. package/out/commands/lint.js +64 -18
  18. package/out/commands/lint.js.map +1 -1
  19. package/out/commands/reason.d.ts +2 -9
  20. package/out/commands/reason.js +52 -48
  21. package/out/commands/reason.js.map +1 -1
  22. package/out/commands/render.d.ts +1 -9
  23. package/out/commands/render.js +15 -726
  24. package/out/commands/render.js.map +1 -1
  25. package/out/commands/server/actions.d.ts +22 -0
  26. package/out/commands/server/actions.js +394 -0
  27. package/out/commands/server/actions.js.map +1 -0
  28. package/out/commands/server/require.d.ts +1 -0
  29. package/out/commands/server/require.js +89 -0
  30. package/out/commands/server/require.js.map +1 -0
  31. package/out/commands/server/rest.d.ts +2 -0
  32. package/out/commands/server/rest.js +117 -0
  33. package/out/commands/server/rest.js.map +1 -0
  34. package/out/commands/validate.d.ts +3 -3
  35. package/out/commands/validate.js +35 -171
  36. package/out/commands/validate.js.map +1 -1
  37. package/package.json +5 -7
  38. package/src/{auth.ts → auth/auth.ts} +54 -3
  39. package/src/{platform.ts → auth/platform.ts} +13 -19
  40. package/src/cli.ts +207 -63
  41. package/src/commands/export.ts +54 -0
  42. package/src/commands/lint.ts +88 -18
  43. package/src/commands/reason.ts +69 -56
  44. package/src/commands/render.ts +23 -995
  45. package/src/commands/server/actions.ts +480 -0
  46. package/src/commands/server/require.ts +99 -0
  47. package/src/commands/server/rest.ts +135 -0
  48. package/src/commands/validate.ts +46 -207
  49. package/out/auth.js.map +0 -1
  50. package/out/backend/backend-types.d.ts +0 -21
  51. package/out/backend/backend-types.js +0 -3
  52. package/out/backend/backend-types.js.map +0 -1
  53. package/out/backend/create-backend.d.ts +0 -2
  54. package/out/backend/create-backend.js +0 -6
  55. package/out/backend/create-backend.js.map +0 -1
  56. package/out/backend/direct-backend.d.ts +0 -20
  57. package/out/backend/direct-backend.js +0 -150
  58. package/out/backend/direct-backend.js.map +0 -1
  59. package/out/backend/reasoned-output.d.ts +0 -38
  60. package/out/backend/reasoned-output.js +0 -568
  61. package/out/backend/reasoned-output.js.map +0 -1
  62. package/out/commands/closure.d.ts +0 -33
  63. package/out/commands/closure.js +0 -537
  64. package/out/commands/closure.js.map +0 -1
  65. package/out/commands/compile.d.ts +0 -11
  66. package/out/commands/compile.js +0 -63
  67. package/out/commands/compile.js.map +0 -1
  68. package/out/platform-constants.js.map +0 -1
  69. package/out/platform.js.map +0 -1
  70. package/src/backend/backend-types.ts +0 -27
  71. package/src/backend/create-backend.ts +0 -8
  72. package/src/backend/direct-backend.ts +0 -169
  73. package/src/backend/reasoned-output.ts +0 -697
  74. package/src/commands/closure.ts +0 -624
  75. package/src/commands/compile.ts +0 -88
  76. /package/out/{platform-constants.d.ts → auth/constants.d.ts} +0 -0
  77. /package/src/{platform-constants.ts → auth/constants.ts} +0 -0
@@ -1,88 +0,0 @@
1
- // Copyright (c) 2026 Modelware. All rights reserved.
2
-
3
- import { createOmlServices } from '@oml/language';
4
- import chalk from 'chalk';
5
- import { NodeFileSystem } from 'langium/node';
6
- import { URI } from 'langium';
7
- import * as fs from 'node:fs/promises';
8
- import * as path from 'node:path';
9
- import { normalizeFormatExtension, writeCompiledWorkspace } from '../backend/reasoned-output.js';
10
- import { failCli } from '../cli-error.js';
11
- import { formatDuration } from '../util.js';
12
- import { lintAction } from './lint.js';
13
-
14
- export type CompileOptions = {
15
- workspace?: string,
16
- owl?: string,
17
- format?: string,
18
- clean?: boolean,
19
- pretty?: boolean,
20
- only?: boolean
21
- };
22
-
23
- export const compileAction = async (opts: CompileOptions): Promise<void> => {
24
- const workspaceRoot = resolveCompileWorkspaceRoot(opts.workspace);
25
- const outputRoot = resolveCompileOutputRoot(workspaceRoot, opts.owl);
26
- const format = normalizeFormatExtension(opts.format);
27
-
28
- if (!opts.only) {
29
- await lintAction({ workspace: workspaceRoot });
30
- }
31
-
32
- const workspaceStat = await fs.stat(workspaceRoot).catch(() => undefined);
33
- if (!workspaceStat || !workspaceStat.isDirectory()) {
34
- failCli(chalk.red(`Workspace folder does not exist: ${workspaceRoot}`));
35
- }
36
-
37
- const sourceFiles = await findOmlFiles(workspaceRoot);
38
- if (sourceFiles.length === 0) {
39
- console.log(chalk.yellow(`No .oml files found under ${workspaceRoot}.`));
40
- return;
41
- }
42
-
43
- if (opts.clean) {
44
- await fs.rm(outputRoot, { recursive: true, force: true });
45
- }
46
-
47
- const startedAt = Date.now();
48
- const servicesBundle = createOmlServices(NodeFileSystem);
49
- await servicesBundle.Oml.shared.workspace.WorkspaceManager.initializeWorkspace([
50
- { uri: URI.file(workspaceRoot).toString(), name: path.basename(workspaceRoot) }
51
- ]);
52
- const entries = await writeCompiledWorkspace(servicesBundle.Oml, workspaceRoot, outputRoot, format, opts.pretty === true);
53
-
54
- console.log(
55
- chalk.green(
56
- `compile: ${entries.length} OML file(s) converted to .${format} in ${path.relative(process.cwd(), outputRoot) || outputRoot} [${formatDuration(Date.now() - startedAt)}]`
57
- )
58
- );
59
- };
60
-
61
- export function resolveCompileWorkspaceRoot(workspace: string | undefined): string {
62
- return path.resolve(workspace ?? '.');
63
- }
64
-
65
- export function resolveCompileOutputRoot(workspaceRoot: string, owl: string | undefined): string {
66
- return path.resolve(owl ?? path.join(workspaceRoot, 'build', 'owl'));
67
- }
68
-
69
- async function findOmlFiles(root: string): Promise<string[]> {
70
- const entries = await fs.readdir(root, { withFileTypes: true });
71
- const results: string[] = [];
72
-
73
- for (const entry of entries) {
74
- const fullPath = path.join(root, entry.name);
75
- if (entry.isDirectory()) {
76
- if (entry.name === 'node_modules' || entry.name.startsWith('.')) {
77
- continue;
78
- }
79
- results.push(...await findOmlFiles(fullPath));
80
- continue;
81
- }
82
- if (entry.isFile() && entry.name.toLowerCase().endsWith('.oml')) {
83
- results.push(fullPath);
84
- }
85
- }
86
-
87
- return results;
88
- }