@nova-energy/openamx 0.14.0 → 0.16.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 +136 -513
- package/dist/diagnostics/errors.js +9 -0
- package/dist/editor/completion.js +100 -5
- package/dist/editor/highlighting.js +26 -3
- package/dist/editor/symbols.js +122 -2
- package/dist/formatter/formatAmx.js +2 -2
- package/dist/parser/parseFor.js +2 -5
- package/dist/parser/parseStatements.js +225 -66
- package/dist/runtime/evaluateExpression.js +69 -8
- package/dist/typechecker/checkDocument.js +68 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,29 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
OpenAMX is a text-based format and toolset for **computable documents**.
|
|
6
|
-
|
|
7
|
-
`{{ expressions }}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## What
|
|
15
|
-
|
|
16
|
-
- Write
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
OpenAMX is a text-based format and toolset for **computable documents**. Write
|
|
6
|
+
an explanation in Markdown, add calculations in executable `amx` code blocks,
|
|
7
|
+
and refer to their results inline with `{{ expressions }}`. The document,
|
|
8
|
+
analysis, and report stay together in a readable, versionable `.amx` file.
|
|
9
|
+
|
|
10
|
+
OpenAMX is domain-neutral: you define the calculations and data structures for
|
|
11
|
+
your work. The included asset-management examples are optional demonstrations,
|
|
12
|
+
not certified risk models or industry standards.
|
|
13
|
+
|
|
14
|
+
## What you can do
|
|
15
|
+
|
|
16
|
+
- **Write and calculate in one document.** Markdown provides the narrative;
|
|
17
|
+
only exact, case-sensitive `amx` fences execute. Inline expressions display
|
|
18
|
+
evaluated results in the report.
|
|
19
|
+
- **Model real data.** Use typed records, enums, pure functions, local modules,
|
|
20
|
+
and explicitly mapped JSON or CSV inputs. Validate inputs and export named
|
|
21
|
+
results as JSON or CSV.
|
|
22
|
+
- **Build visual explanations.** Create tables, charts, and formula-driven 2D
|
|
23
|
+
diagrams alongside the narrative.
|
|
24
|
+
- **Use the latest language additions.** V0.16 adds statement-bodied
|
|
25
|
+
functions while preserving expression-bodied functions. V0.14 adds runtime
|
|
26
|
+
type predicates, mathematical functions, text helpers, and bounded numeric
|
|
27
|
+
formatting with `en-US`, `de-DE`, and `fr-FR` locales. Earlier additions
|
|
28
|
+
include record inheritance, enums, and braced conditionals.
|
|
29
|
+
- **Publish reports in familiar formats.** Render standalone, offline HTML or
|
|
30
|
+
export PDF and DOCX. Charts are interactive in HTML; PDF charts are static
|
|
31
|
+
with their data retained in tables. DOCX charts are editable native charts
|
|
32
|
+
when the chart can be represented.
|
|
33
|
+
- **Choose your authoring environment.** Use the command-line interface (CLI),
|
|
34
|
+
the offline-first desktop workbench, or the VS Code extension.
|
|
35
|
+
|
|
36
|
+
## A small example
|
|
28
37
|
|
|
29
38
|
Save this as `analysis.amx`:
|
|
30
39
|
|
|
@@ -39,531 +48,145 @@ score += 5
|
|
|
39
48
|
```
|
|
40
49
|
````
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
narrative
|
|
44
|
-
results.
|
|
51
|
+
The inline expression displays `15`. Ordinary Markdown and other code fences
|
|
52
|
+
remain narrative; they are not executed.
|
|
45
53
|
|
|
46
|
-
##
|
|
54
|
+
## Install
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Release builds are unsigned, so your operating system may show a warning
|
|
51
|
-
installing them.
|
|
56
|
+
Choose the tool that fits your workflow. Prebuilt downloads are available from
|
|
57
|
+
the [GitHub Releases page](https://github.com/NovaEnergyConsulting/openamx/releases).
|
|
58
|
+
Release builds are unsigned, so your operating system may show a warning.
|
|
52
59
|
|
|
53
|
-
###
|
|
60
|
+
### CLI
|
|
54
61
|
|
|
55
62
|
The CLI is published to npm as `@nova-energy/openamx` and runs on
|
|
56
63
|
[Bun](https://bun.sh/) 1.0 or newer. Node.js and Deno are not supported.
|
|
57
64
|
|
|
58
|
-
1. Install Bun
|
|
59
|
-
2. Install
|
|
65
|
+
1. Install Bun using the instructions at [bun.sh](https://bun.sh/).
|
|
66
|
+
2. Install OpenAMX:
|
|
60
67
|
|
|
61
68
|
```sh
|
|
62
69
|
bun add -g @nova-energy/openamx
|
|
63
70
|
```
|
|
64
71
|
|
|
65
|
-
3.
|
|
72
|
+
3. Verify it:
|
|
66
73
|
|
|
67
74
|
```sh
|
|
68
75
|
openamx --version
|
|
69
76
|
openamx --help
|
|
70
77
|
```
|
|
71
78
|
|
|
72
|
-
To
|
|
73
|
-
`
|
|
74
|
-
`npm install -g @nova-energy/openamx` also works, provided Bun is on your
|
|
75
|
-
`PATH`. To remove it, run `bun remove -g @nova-energy/openamx`.
|
|
79
|
+
To try it without a global install, run `bunx @nova-energy/openamx --help`.
|
|
80
|
+
To uninstall the global package, run `bun remove -g @nova-energy/openamx`.
|
|
76
81
|
|
|
77
|
-
### Desktop
|
|
82
|
+
### Desktop app
|
|
78
83
|
|
|
79
84
|
Download the installer for your platform from the
|
|
80
|
-
[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **Linux (x64):** download `OpenAMX-Desktop-<version>-linux-x64.tar.gz`, then
|
|
84
|
-
extract it and run the installer:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
mkdir openamx-setup
|
|
88
|
-
tar -xzf OpenAMX-Desktop-<version>-linux-x64.tar.gz -C openamx-setup
|
|
89
|
-
cd openamx-setup && ./installer
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
The application uses your system's WebKitGTK 4.1 and GTK libraries; install
|
|
93
|
-
them with your distribution's package manager if they are missing. To
|
|
94
|
-
uninstall, run `uninstall --quiet` from the application's data directory
|
|
95
|
-
(`~/.local/share/dev.openamx.desktop/stable/`). Your project documents are
|
|
96
|
-
not removed.
|
|
97
|
-
- **Windows:** download the Setup `.zip`, extract it, and run the Setup
|
|
98
|
-
program it contains.
|
|
99
|
-
- **macOS:** download the `.dmg`, open it, and follow the installer.
|
|
100
|
-
|
|
101
|
-
Windows and macOS builds have not yet been formally verified. See the
|
|
102
|
-
[desktop guide](desktop-app/README.md) for details.
|
|
85
|
+
[Releases page](https://github.com/NovaEnergyConsulting/openamx/releases). The
|
|
86
|
+
app includes its own runtime; Bun and Node.js are not required.
|
|
103
87
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
[releases page](https://github.com/NovaEnergyConsulting/openamx/releases).
|
|
111
|
-
2. Install it from a terminal:
|
|
112
|
-
|
|
113
|
-
```sh
|
|
114
|
-
code --install-extension openamx-vscode-<version>.vsix
|
|
115
|
-
```
|
|
88
|
+
- **Linux x64:** extract the `OpenAMX-Desktop-<version>-linux-x64.tar.gz`
|
|
89
|
+
archive and run `./installer`. The app requires WebKitGTK 4.1, GTK, and
|
|
90
|
+
related system libraries. The current Linux x64 installer has been reported
|
|
91
|
+
to launch and work, but broad Linux compatibility has not been established.
|
|
92
|
+
- **Windows:** extract the Setup `.zip` and run the Setup program it contains.
|
|
93
|
+
- **macOS:** open the `.dmg` and follow the installer.
|
|
116
94
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
completion and diagnostics.
|
|
95
|
+
Windows, macOS, and Linux arm64 builds have not been formally verified. See the
|
|
96
|
+
[desktop guide](desktop-app/README.md) for current platform notes and
|
|
97
|
+
installation details.
|
|
121
98
|
|
|
122
|
-
|
|
123
|
-
and the [desktop](desktop-app/README.md) and [extension](vscode-extension/README.md)
|
|
124
|
-
guides.
|
|
125
|
-
|
|
126
|
-
## Get Started
|
|
127
|
-
|
|
128
|
-
Install [Bun](https://bun.sh/), then install dependencies and build from the
|
|
129
|
-
repository root:
|
|
130
|
-
|
|
131
|
-
```sh
|
|
132
|
-
bun install
|
|
133
|
-
bun run build
|
|
134
|
-
```
|
|
99
|
+
### VS Code extension
|
|
135
100
|
|
|
136
|
-
|
|
101
|
+
The extension requires VS Code 1.85.0 or newer. It is not yet available on the
|
|
102
|
+
Visual Studio Marketplace; install the VSIX from the
|
|
103
|
+
[Releases page](https://github.com/NovaEnergyConsulting/openamx/releases):
|
|
137
104
|
|
|
138
105
|
```sh
|
|
139
|
-
|
|
140
|
-
bun run dist/cli.js render examples/hello-world.amx --out hello-world.html
|
|
141
|
-
bun run dist/cli.js export pdf examples/typed-asset-analysis.amx --out analysis.pdf \
|
|
142
|
-
--input asset=examples/typed-asset.json \
|
|
143
|
-
--input screenings=examples/typed-screenings.csv \
|
|
144
|
-
--input reviewedAt=examples/typed-reviewed-at.json
|
|
106
|
+
code --install-extension openamx-vscode-<version>.vsix
|
|
145
107
|
```
|
|
146
108
|
|
|
147
|
-
The
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
Charts are interactive in standalone HTML and the desktop live preview; their
|
|
153
|
-
runtime is bundled, so reports work offline. PDF charts are static, and the
|
|
154
|
-
complete chart data remains in report tables. DOCX charts are native and editable
|
|
155
|
-
with embedded data when representable; approved deferrals use a clear notice and
|
|
156
|
-
complete data table rather than a static-image substitute.
|
|
157
|
-
|
|
158
|
-
Run the test suite with:
|
|
109
|
+
The extension provides OpenAMX editing support, including formatting,
|
|
110
|
+
completion, diagnostics, hover, navigation, outline, references, and contextual
|
|
111
|
+
fixes. It analyzes source; running documents and validating CSV/JSON inputs are
|
|
112
|
+
CLI or desktop workbench tasks. See the
|
|
113
|
+
[VS Code guide](vscode-extension/README.md).
|
|
159
114
|
|
|
160
|
-
|
|
161
|
-
bun test
|
|
162
|
-
```
|
|
115
|
+
## Try OpenAMX
|
|
163
116
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- **Desktop workbench:** local project browsing, AMX editing and analysis, live
|
|
167
|
-
preview, structured JSON/CSV editing, input mapping, and HTML/PDF/DOCX export.
|
|
168
|
-
See the [desktop guide](desktop-app/README.md).
|
|
169
|
-
- **VS Code extension:** formatting, completion, diagnostics, hover, navigation,
|
|
170
|
-
symbols, references, and code actions. See the
|
|
171
|
-
[extension guide](vscode-extension/README.md).
|
|
172
|
-
- **CLI:** evaluate documents, render HTML, and export PDF or DOCX reports.
|
|
173
|
-
|
|
174
|
-
## Examples and Specifications
|
|
175
|
-
|
|
176
|
-
Start with [Hello OpenAMX](examples/hello-world.amx) for the document basics.
|
|
177
|
-
Other [examples](examples/) show calculations, tables and charts, typed JSON/CSV
|
|
178
|
-
inputs, local modules, and JSON/CSV outputs. The Asset Management schemas are
|
|
179
|
-
opt-in examples, not domain-certified standards.
|
|
180
|
-
|
|
181
|
-
The [V0.14 language specification](docs/language-spec-v0.14.md) documents the
|
|
182
|
-
runtime type-checking, mathematical, text, and numeric-formatting additions.
|
|
183
|
-
Try the [runtime type checks](examples/v0.14-runtime-type-checks.amx),
|
|
184
|
-
[math and Measurements](examples/v0.14-math-and-measurements.amx), and
|
|
185
|
-
[text and formatting](examples/v0.14-text-and-formatting.amx) examples.
|
|
186
|
-
V0.14 integrated acceptance, release, and publication are tracked separately;
|
|
187
|
-
this documentation does not claim them. The [V0.12 language specification](docs/language-spec-v0.12.md)
|
|
188
|
-
documents its additive language contract. Try the [record inheritance and enums](examples/v0.12-records-and-enums.amx)
|
|
189
|
-
and [braced conditional](examples/v0.12-braced-if.amx) examples. The
|
|
190
|
-
[V0.13 diagram specification](docs/language-spec-v0.13.md) records the approved
|
|
191
|
-
diagram syntax and its implementation limits. Try the
|
|
192
|
-
[crank-slider](examples/v0.13-crank-slider.amx) and
|
|
193
|
-
[battery-resistor](examples/v0.13-battery-resistor.amx) examples.
|
|
194
|
-
[V0.9 language specification](docs/language-spec-v0.9.md) and [V0.9 migration guide](docs/migrating-to-v0.9.md)
|
|
195
|
-
remain historical references for the earlier language contract and its approved compatibility changes. Earlier specifications describe
|
|
196
|
-
the language's evolution: [V0.5](docs/language-spec-v0.5.md),
|
|
197
|
-
[V0.2](docs/language-spec-v0.2.md),
|
|
198
|
-
[V0.3](docs/language-spec-v0.3.md), and [V0.4](docs/language-spec-v0.4.md).
|
|
199
|
-
|
|
200
|
-
## Design Boundaries
|
|
201
|
-
|
|
202
|
-
OpenAMX is intended for local documents, local modules, and explicitly mapped
|
|
203
|
-
data files. It does not load remote packages or data. Hiding source in a report
|
|
204
|
-
is a presentation choice, not a confidentiality boundary; source files and
|
|
205
|
-
inputs should be protected independently. Report output is designed to work
|
|
206
|
-
offline, but exact visual parity across HTML, PDF, DOCX, and office applications
|
|
207
|
-
is not guaranteed.# OpenAMX
|
|
208
|
-
|
|
209
|
-
Status: V0.6 is COMPLETE and approved for release with Lead Developer-accepted
|
|
210
|
-
exceptions. The CLI, shared report identity, HTML/PDF/DOCX exports, desktop
|
|
211
|
-
workbench and VS Code productivity providers are present. Native macOS 14+,
|
|
212
|
-
Windows 11+, native Ubuntu 24.04+, Hutch packaging/launch, broad Office
|
|
213
|
-
compatibility, project licensing/Marketplace publication, formal accessibility,
|
|
214
|
-
V0.5 report-mobile overflow, and VS Code apply-time action safety were not
|
|
215
|
-
verified as passes; they are accepted release exceptions and follow-up
|
|
216
|
-
requirements for V0.7 planning. Release approval is not a claim that artifacts
|
|
217
|
-
have been published or that these certifications were completed. Root, desktop,
|
|
218
|
-
and extension package metadata are aligned to 0.6.0.
|
|
219
|
-
|
|
220
|
-
OpenAMX combines Markdown narrative, executable `amx` fences, and inline
|
|
221
|
-
`{{ expression }}` calculations in plain-text `.amx` documents. The TypeScript
|
|
222
|
-
core remains domain-neutral; asset-management examples use ordinary values.
|
|
223
|
-
See the [V0.2 language specification](docs/language-spec-v0.2.md) for the
|
|
224
|
-
historical contract, the [V0.3 language specification](docs/language-spec-v0.3.md)
|
|
225
|
-
for typed-data workflows, and the [V0.4 language specification](docs/language-spec-v0.4.md)
|
|
226
|
-
for typed visualizations and their historical export behavior. The
|
|
227
|
-
[V0.5 product and report contract](docs/language-spec-v0.5.md) defines additive
|
|
228
|
-
report identity, source visibility and product boundaries; it does not mean every
|
|
229
|
-
acceptance or release gate has passed.
|
|
230
|
-
|
|
231
|
-
## Install and verify
|
|
232
|
-
|
|
233
|
-
Install [Bun](https://bun.sh/), then from the repository root run:
|
|
117
|
+
With the CLI installed, run a document, render it to HTML, or export a PDF:
|
|
234
118
|
|
|
235
119
|
```sh
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
120
|
+
openamx run examples/01_First_Computable_Document.amx
|
|
121
|
+
openamx render examples/01_First_Computable_Document.amx --out first-computable-document.html
|
|
122
|
+
openamx export pdf examples/01_First_Computable_Document.amx --out first-computable-document.pdf
|
|
239
123
|
```
|
|
240
124
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## CLI usage
|
|
307
|
-
|
|
308
|
-
Build first. Render a document to standalone HTML (by default next to its source):
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
bun run dist/cli.js render examples/hello-world.amx --out examples/hello-world.html
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
Or use the bundled script:
|
|
315
|
-
|
|
316
|
-
```bash
|
|
317
|
-
bun run render:hello
|
|
318
|
-
bun run render:transformer
|
|
319
|
-
bun run render:fleet
|
|
320
|
-
bun run render:typed
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
Run a document and print the evaluated context as JSON:
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
bun run dist/cli.js run examples/transformer-strategy.amx
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
The `run` command prints final variable bindings as JSON.
|
|
330
|
-
|
|
331
|
-
Typed documents accept repeated logical input mappings and named export mappings:
|
|
332
|
-
|
|
333
|
-
```bash
|
|
334
|
-
bun run dist/cli.js run examples/typed-asset-analysis.amx \
|
|
335
|
-
--input asset=examples/typed-asset.json \
|
|
336
|
-
--input screenings=examples/typed-screenings.csv \
|
|
337
|
-
--input reviewedAt=examples/typed-reviewed-at.json \
|
|
338
|
-
--output summary=out/summary.json \
|
|
339
|
-
--output resultRows=out/result-rows.csv
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Use `--validation fail-fast` to stop at the first ordered input diagnostic;
|
|
343
|
-
aggregate validation is the default. `render` accepts the same mappings and
|
|
344
|
-
adds `--out` for the HTML destination.
|
|
345
|
-
|
|
346
|
-
`render` and `export pdf|docx` accept `--project-root <dir>` to load report
|
|
347
|
-
identity defaults from that project's `.openamx/project.json`. This option does
|
|
348
|
-
not supply input mappings or change their process-working-directory path base;
|
|
349
|
-
`run` does not read project report configuration. Without the option, project
|
|
350
|
-
configuration is not discovered. Frontmatter identity without a logo remains
|
|
351
|
-
available.
|
|
352
|
-
|
|
353
|
-
Export an offline PDF or editable DOCX report. The commands analyze once, prepare
|
|
354
|
-
the complete report before writing, and require an existing parent:
|
|
355
|
-
|
|
356
|
-
```bash
|
|
357
|
-
bun run dist/cli.js export docx examples/typed-asset-analysis.amx --out out/analysis.docx \
|
|
358
|
-
--input asset=examples/typed-asset.json \
|
|
359
|
-
--input screenings=examples/typed-screenings.csv \
|
|
360
|
-
--input reviewedAt=examples/typed-reviewed-at.json
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
DOCX contains editable semantic headings, paragraphs, lists, tables, and native
|
|
364
|
-
charts with embedded data for representable cases. Numeric-X line charts use
|
|
365
|
-
straight-line XY scatter. Unsupported axis counts, charts with no plottable
|
|
366
|
-
points, and mixed-group scatter with a null-only group are omitted with a notice
|
|
367
|
-
and complete table; a numeric-X line series with no plottable pairs is omitted
|
|
368
|
-
from the chart, disclosed, and retained in the table. These mappings do not
|
|
369
|
-
promise pixel parity or broad native Office compatibility.
|
|
370
|
-
|
|
371
|
-
Report narratives support headings, formatted paragraphs, lists, blockquotes,
|
|
372
|
-
tables, code, rules, and visible source line breaks; authored raw HTML remains
|
|
373
|
-
inert text. Narrative images must be project-contained PNG or JPEG files with
|
|
374
|
-
nonempty alternative text, no more than 4 MiB and 4,000,000 decoded pixels per
|
|
375
|
-
image. They are sanitized and embedded, so reports do not fetch remote images.
|
|
376
|
-
Image width is optional in Report Settings at either project-default or
|
|
377
|
-
current-document scope. Enter a fixed width such as `640px` or a content-width
|
|
378
|
-
percentage such as `75%`; for example, `.openamx/project.json` may contain
|
|
379
|
-
`"report": { "imageWidth": "75%" }`, while document front matter may contain
|
|
380
|
-
`report: { imageWidth: 640px }`. Images keep their aspect ratio; widths are
|
|
381
|
-
clamped to the available report/page bounds. Fixed CSS pixels map to 0.75 PDF
|
|
382
|
-
points. With no width setting, the existing fit-to-bounds sizing is used.
|
|
383
|
-
Report Settings can also select a project-contained `.css` stylesheet at
|
|
384
|
-
project-default or current-document scope. Its contents are embedded in live
|
|
385
|
-
preview and standalone HTML exports, so those HTML files retain the styling
|
|
386
|
-
without loading the original CSS file; stylesheet changes do not affect PDF or
|
|
387
|
-
DOCX output.
|
|
388
|
-
CSS files are editable project tabs in the desktop explorer. Use **New CSS** to
|
|
389
|
-
create a stylesheet, edit it in the source editor, and select it in Report
|
|
390
|
-
Settings. Switching back to an AMX tab previews unsaved CSS edits; HTML export
|
|
391
|
-
also uses the open stylesheet buffer.
|
|
392
|
-
External links are limited to HTTP(S); local companion links in reports are
|
|
393
|
-
limited to PDF, PNG, JPEG, TXT, CSV, and JSON targets contained by the project.
|
|
394
|
-
They are relative to the final report location, and companion files are not
|
|
395
|
-
copied; keep them at the corresponding relative paths when moving a report.
|
|
396
|
-
In the desktop live preview, a Markdown link such as
|
|
397
|
-
`[Related analysis](../other.amx)` opens a visible AMX file in the same project
|
|
398
|
-
in a workbench tab; `../` paths are allowed only while they remain inside the project. These AMX links are not
|
|
399
|
-
navigable in exported reports. Desktop preview routes activated external and
|
|
400
|
-
companion links through host confirmation. Viewer behavior varies: Word for the
|
|
401
|
-
Web rewrote tested relative DOCX links as HTTPS targets, so local companion-file
|
|
402
|
-
opening there is not claimed.
|
|
403
|
-
|
|
404
|
-
Run the V0.5 typed example with its local imports, JSON/CSV inputs, table and
|
|
405
|
-
chart. Copy the sample project config into a temporary project because the CLI
|
|
406
|
-
intentionally does not discover parent projects:
|
|
407
|
-
|
|
408
|
-
```bash
|
|
409
|
-
review=$(mktemp -d)
|
|
410
|
-
mkdir -p "$review/.openamx"
|
|
411
|
-
cp examples/v05-asset-screening.amx "$review/"
|
|
412
|
-
cp -R examples/libraries "$review/"
|
|
413
|
-
cp examples/v05-project.json "$review/.openamx/project.json"
|
|
414
|
-
bun run dist/cli.js run "$review/v05-asset-screening.amx" \
|
|
415
|
-
--input asset=examples/typed-asset.json \
|
|
416
|
-
--input screenings=examples/typed-screenings.csv
|
|
417
|
-
bun run dist/cli.js render "$review/v05-asset-screening.amx" \
|
|
418
|
-
--out "$review/report.html" --project-root "$review" \
|
|
419
|
-
--input asset=examples/typed-asset.json \
|
|
420
|
-
--input screenings=examples/typed-screenings.csv
|
|
421
|
-
bun run dist/cli.js export pdf "$review/v05-asset-screening.amx" \
|
|
422
|
-
--out "$review/report.pdf" --project-root "$review" \
|
|
423
|
-
--input asset=examples/typed-asset.json \
|
|
424
|
-
--input screenings=examples/typed-screenings.csv
|
|
425
|
-
bun run dist/cli.js export docx "$review/v05-asset-screening.amx" \
|
|
426
|
-
--out "$review/report.docx" --project-root "$review" \
|
|
427
|
-
--input asset=examples/typed-asset.json \
|
|
428
|
-
--input screenings=examples/typed-screenings.csv
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
The example calculation is illustrative, not a domain-standard risk formula.
|
|
432
|
-
`sourceVisible` defaults to true; hiding source is a presentation choice, not a
|
|
433
|
-
confidentiality boundary. Logo assets must be contained local PNG/JPEG files and
|
|
434
|
-
are validated and re-encoded before report output is written.
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
## Example files
|
|
439
|
-
|
|
440
|
-
The canonical examples are:
|
|
441
|
-
|
|
442
|
-
- [Hello OpenAMX](examples/hello-world.amx), with generated
|
|
443
|
-
[HTML](examples/hello-world.html), introduces executable fences and score 15.
|
|
444
|
-
- [Kitchen Sink](examples/kitchen-sink.amx), contains a comprehensive explanation of every construct in the AMX framework.
|
|
445
|
-
- [Power Transformer Failure Mode Analysis](examples/transformer-strategy.amx)
|
|
446
|
-
computes mode scores `[24, 18, 27]`, initial aggregate 69, then adjusted
|
|
447
|
-
aggregate 60. Its [HTML](examples/transformer-strategy.html) shows the final
|
|
448
|
-
value even in an earlier paragraph.
|
|
449
|
-
- [Asset Fleet Risk Analysis](examples/asset-fleet-risk-analysis.amx) computes
|
|
450
|
-
`[5, 10, 15]`, total 30, then 35 after an access adjustment. Its
|
|
451
|
-
[HTML](examples/asset-fleet-risk-analysis.html) displays the default decision
|
|
452
|
-
"Schedule review" and the final score 35; ordinary fences and bare
|
|
453
|
-
declarations are visible but never executed.
|
|
454
|
-
- [Typed Asset Screening Analysis](examples/typed-asset-analysis.amx) imports
|
|
455
|
-
opt-in Asset Management and screening schemas, consumes nested JSON and CSV,
|
|
456
|
-
computes scores with a typed pure function, and exports summary JSON plus
|
|
457
|
-
result CSV. Its [HTML](examples/typed-asset-analysis.html) is generated by
|
|
458
|
-
the production CLI.
|
|
459
|
-
- [Branded Asset Screening Snapshot](examples/v05-asset-screening.amx) reuses
|
|
460
|
-
typed inputs, local libraries and V0.4 table/chart constructs;
|
|
461
|
-
[project identity defaults](examples/v05-project.json) apply only when the
|
|
462
|
-
CLI receives an explicit `--project-root`.
|
|
463
|
-
|
|
464
|
-
```sh
|
|
465
|
-
bun run dist/cli.js run examples/transformer-strategy.amx
|
|
466
|
-
bun run dist/cli.js run examples/asset-fleet-risk-analysis.amx
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
## Current limits
|
|
472
|
-
|
|
473
|
-
No nested loops, range steps, `break`/`continue`, match guards/destructuring,
|
|
474
|
-
or chained `else if`. A record constructor directly in a `match` arm remains a
|
|
475
|
-
known core parser limitation and is not claimed as supported. Editor
|
|
476
|
-
diagnostics cover parsing, static checks, and local module links, not CSV/JSON
|
|
477
|
-
runtime validation. Modules and data files are local and entry-root-contained;
|
|
478
|
-
there are no remote packages, units/currency, or broad multi-file workflows.
|
|
479
|
-
PDF and DOCX exports are local and offline. DOCX charts are editable native
|
|
480
|
-
objects with embedded data for representable cases; explicit no-chart notices
|
|
481
|
-
and complete tables cover the approved deferrals. Word desktop open and
|
|
482
|
-
chart-edit persistence have been exercised on the build recorded in the sprint
|
|
483
|
-
evidence, but broad Office compatibility, the Word for the Web numeric-X
|
|
484
|
-
null-gap visual, and a formal screen-reader review are not claimed. The Asset
|
|
485
|
-
Management library remains provisional pending domain review.
|
|
486
|
-
|
|
487
|
-
---
|
|
488
|
-
|
|
489
|
-
## OpenAMX Licensing
|
|
490
|
-
|
|
491
|
-
This project is dual licensed.
|
|
492
|
-
|
|
493
|
-
You may use this software under either:
|
|
494
|
-
|
|
495
|
-
1. The GNU Affero General Public License v3.0 (AGPLv3)
|
|
496
|
-
2. A Commercial License from Nova Energy Consulting Pty Ltd
|
|
497
|
-
|
|
498
|
-
By using this software, you agree to comply with the terms of one of these licences.
|
|
499
|
-
|
|
500
|
-
### Open Source Licence (AGPLv3)
|
|
501
|
-
|
|
502
|
-
The Community Edition of this software is licensed under the GNU Affero General Public License Version 3 (AGPLv3).
|
|
503
|
-
|
|
504
|
-
The AGPLv3 permits you to:
|
|
505
|
-
|
|
506
|
-
- Use the software for any purpose
|
|
507
|
-
- Study and modify the software
|
|
508
|
-
- Distribute original or modified versions
|
|
509
|
-
- Use the software within an organisation
|
|
510
|
-
- Deploy the software as a network service
|
|
511
|
-
|
|
512
|
-
Subject to the conditions of the AGPLv3, including making source code available where required by the licence.
|
|
513
|
-
|
|
514
|
-
See the LICENSE file for the full licence text.
|
|
515
|
-
|
|
516
|
-
### Commercial Licence
|
|
517
|
-
|
|
518
|
-
A commercial licence is available for organisations that wish to:
|
|
519
|
-
|
|
520
|
-
- Keep modifications proprietary
|
|
521
|
-
- Distribute the software as part of a closed-source product
|
|
522
|
-
- Embed the software within commercial solutions
|
|
523
|
-
- Avoid AGPLv3 source disclosure obligations
|
|
524
|
-
- Obtain commercial support arrangements
|
|
525
|
-
|
|
526
|
-
See COMMERCIAL-LICENSE.md for details.
|
|
527
|
-
|
|
528
|
-
### Which Licence Should I Choose?
|
|
529
|
-
|
|
530
|
-
#### Use AGPLv3 if:
|
|
531
|
-
|
|
532
|
-
- You are an individual user
|
|
533
|
-
- You are happy to comply with AGPL obligations
|
|
534
|
-
- You wish to participate in the open-source community
|
|
535
|
-
- Your project is also open source
|
|
536
|
-
|
|
537
|
-
#### Use a Commercial Licence if:
|
|
538
|
-
|
|
539
|
-
- You require proprietary use rights
|
|
540
|
-
- Your organisation cannot comply with AGPL obligations
|
|
541
|
-
- You wish to distribute closed-source derivative works
|
|
542
|
-
- You require contractual warranties, support or indemnities
|
|
543
|
-
|
|
544
|
-
### Commercial Enquiries
|
|
545
|
-
|
|
546
|
-
For commercial licensing and support enquiries:
|
|
547
|
-
|
|
548
|
-
**Nova Energy Consulting Pty Ltd**
|
|
549
|
-
|
|
550
|
-
Email: licensing@novaenergy.digital
|
|
551
|
-
|
|
552
|
-
---
|
|
125
|
+
For documents that use external data, map each declared logical input
|
|
126
|
+
explicitly with `--input name=path`. See the
|
|
127
|
+
[mapped-data lesson](examples/06_Mapped_Data_and_Validation.amx) and the CLI
|
|
128
|
+
help for all options. The desktop workbench offers project browsing, live
|
|
129
|
+
preview, structured JSON/CSV editing, input mapping, report settings, and a
|
|
130
|
+
unified HTML/PDF/DOCX export workflow.
|
|
131
|
+
|
|
132
|
+
## Examples and documentation
|
|
133
|
+
|
|
134
|
+
- [OpenAMX learning guide](examples/00_Table_of_Contents.amx) is the offline,
|
|
135
|
+
numbered path from the first computable document to a complete report.
|
|
136
|
+
- [First computable document](examples/01_First_Computable_Document.amx) is
|
|
137
|
+
the guide's small, input-free first lesson.
|
|
138
|
+
- [Mapped data and validation](examples/06_Mapped_Data_and_Validation.amx)
|
|
139
|
+
introduces explicit JSON/CSV input mappings.
|
|
140
|
+
- [Complete asset screening report](examples/12_Complete_Asset_Screening_Report.amx)
|
|
141
|
+
is the guided destination; [route measurements](examples/13_Route_Measurement_Report.amx),
|
|
142
|
+
the [battery-resistor circuit](examples/14_Battery_Resistor_Circuit.amx), and
|
|
143
|
+
[function bodies](examples/15_Function_Bodies.amx) are standalone references.
|
|
144
|
+
- V0.12 features: [records and enums](examples/04_Typed_Records_Enums_and_Modules.amx)
|
|
145
|
+
and [expressions and decisions](examples/02_Expressions_and_Decisions.amx).
|
|
146
|
+
- V0.13 diagrams: [formula-driven diagrams](examples/08_Formula_Driven_Diagrams.amx)
|
|
147
|
+
and the [battery-resistor reference](examples/14_Battery_Resistor_Circuit.amx).
|
|
148
|
+
- V0.14 examples: [runtime type checks](examples/09_Runtime_Type_Checks.amx),
|
|
149
|
+
[math and Measurements](examples/10_Mathematics_and_Measurement_Operations.amx),
|
|
150
|
+
and [text and formatting](examples/11_Text_and_Numeric_Formatting.amx).
|
|
151
|
+
|
|
152
|
+
Read the [V0.9 language specification](docs/language-spec-v0.9.md) and
|
|
153
|
+
[V0.9 migration guide](docs/migrating-to-v0.9.md), then the additive
|
|
154
|
+
[V0.12 language specification](docs/language-spec-v0.12.md),
|
|
155
|
+
[V0.13 diagram specification](docs/language-spec-v0.13.md), and
|
|
156
|
+
[V0.14 language specification](docs/language-spec-v0.14.md) and
|
|
157
|
+
[V0.16 language specification](docs/language-spec-v0.16.md) for the current
|
|
158
|
+
language contract. Browse the [examples](examples/) and [documentation](docs/). The
|
|
159
|
+
[desktop guide](desktop-app/README.md) and
|
|
160
|
+
[VS Code guide](vscode-extension/README.md) cover their respective tools.
|
|
161
|
+
|
|
162
|
+
## Licensing
|
|
163
|
+
|
|
164
|
+
OpenAMX is offered under a dual-licensing model. You may use it under either:
|
|
165
|
+
|
|
166
|
+
1. The [GNU Affero General Public License v3.0 (AGPLv3)](LICENSE.md), subject
|
|
167
|
+
to its terms, including the source-code obligations that apply to covered
|
|
168
|
+
modified versions used over a network.
|
|
169
|
+
2. A separate written commercial license from Nova Energy Consulting Pty Ltd,
|
|
170
|
+
for organizations that need rights outside the AGPLv3 terms.
|
|
171
|
+
|
|
172
|
+
The [commercial license overview](COMMERCIAL-LICENSE.md) describes the
|
|
173
|
+
commercial option; the definitive terms are set out in a separately executed
|
|
174
|
+
agreement. For inquiries, contact
|
|
175
|
+
[licensing@novaenergy.digital](mailto:licensing@novaenergy.digital).
|
|
176
|
+
|
|
177
|
+
## Scope and limitations
|
|
178
|
+
|
|
179
|
+
OpenAMX is designed for local documents, local modules, and explicitly mapped
|
|
180
|
+
local data files; it does not load remote packages or data. Hiding source in a
|
|
181
|
+
report is a presentation choice, not a confidentiality boundary. Protect source
|
|
182
|
+
files and inputs independently. Report formats work offline, but exact visual
|
|
183
|
+
parity across HTML, PDF, DOCX, and office applications is not guaranteed.
|
|
184
|
+
|
|
185
|
+
The Asset Management library and examples are opt-in demonstrations and have
|
|
186
|
+
not been domain-certified. Review the calculations and obtain appropriate
|
|
187
|
+
domain validation before relying on results.
|
|
553
188
|
|
|
554
189
|
## Contributing
|
|
555
190
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
- AGPLv3
|
|
559
|
-
- The commercial licensing program for this project
|
|
560
|
-
|
|
561
|
-
See CONTRIBUTING.md and the contributor agreement (if applicable) for details.
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
## Disclaimer
|
|
566
|
-
|
|
567
|
-
This software is provided "as is" without warranty of any kind.
|
|
568
|
-
|
|
569
|
-
See the applicable licence for full terms and conditions.
|
|
191
|
+
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for
|
|
192
|
+
development and contribution guidance.
|