@nova-energy/openamx 0.10.1 → 0.11.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 CHANGED
@@ -1,514 +1,537 @@
1
- # OpenAMX
2
-
3
- ![OpenAMX](./docs/images/open_amx_screenshot.png)
4
-
5
- OpenAMX is a text-based format and toolset for **computable documents**. It
6
- combines Markdown narrative with executable `amx` code blocks and inline
7
- `{{ expressions }}` so a document can explain an analysis and calculate its
8
- results in one readable, versionable file.
9
-
10
- The core is domain-neutral: authors define calculations and data structures for
11
- their own work. Optional libraries and examples demonstrate asset-management
12
- workflows, but OpenAMX does not prescribe a risk model or certify domain rules.
13
-
14
- ## What You Can Do
15
-
16
- - Write narrative reports with executable calculations, reusable local modules,
17
- typed records and pure functions.
18
- - Read local JSON and CSV data through declared logical inputs, validate it
19
- against document types, and export named results as JSON or CSV.
20
- - Add data tables and charts to a document, then render the narrative,
21
- calculations and views together.
22
- - Create standalone HTML reports, or export offline PDF and editable DOCX
23
- reports.
24
- - Author in the desktop workbench or use OpenAMX language features in VS Code.
25
- - Run the TypeScript-based engine and command-line tools in local workflows.
26
-
27
- ## A Small Example
28
-
29
- Save this as `analysis.amx`:
30
-
31
- ````markdown
32
- # Review
33
-
34
- The adjusted score is {{ score }}.
35
-
36
- ```amx
37
- let score = 10
38
- score += 5
39
- ```
40
- ````
41
-
42
- Only exact, case-sensitive `amx` fenced blocks execute. Markdown remains
43
- narrative, and inline expressions resolve using the document's evaluated
44
- results.
45
-
46
- ## Installation
47
-
48
- OpenAMX has three independent components. Install whichever you need; release
49
- downloads are on the [GitHub releases page](https://github.com/NovaEnergyConsulting/openamx/releases).
50
- Release builds are unsigned, so your operating system may show a warning before
51
- installing them.
52
-
53
- ### Command-line tool (CLI)
54
-
55
- The CLI is published to npm as `@nova-energy/openamx` and runs on
56
- [Bun](https://bun.sh/) 1.0 or newer. Node.js and Deno are not supported.
57
-
58
- 1. Install Bun by following the instructions at [bun.sh](https://bun.sh/).
59
- 2. Install the CLI globally:
60
-
61
- ```sh
62
- bun add -g @nova-energy/openamx
63
- ```
64
-
65
- 3. Check the installation:
66
-
67
- ```sh
68
- openamx --version
69
- openamx --help
70
- ```
71
-
72
- To run it once without installing, use
73
- `bunx @nova-energy/openamx render analysis.amx`. Installing with
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`.
76
-
77
- ### Desktop application
78
-
79
- Download the installer for your platform from the
80
- [releases page](https://github.com/NovaEnergyConsulting/openamx/releases). The
81
- installed application includes its own runtime; you do not need Bun or Node.js.
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.
103
-
104
- ### VS Code extension
105
-
106
- The extension requires VS Code 1.85.0 or newer. It is not yet on the Visual
107
- Studio Marketplace, so install it from the VSIX file:
108
-
109
- 1. Download `openamx-vscode-<version>.vsix` from the
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
- ```
116
-
117
- Or, in VS Code, open the Extensions view, choose **...** >
118
- **Install from VSIX...**, and select the downloaded file.
119
- 3. Open any `.amx` file to activate syntax highlighting, formatting,
120
- completion and diagnostics.
121
-
122
- To build any component from source instead, see [Get Started](#get-started)
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
- ```
135
-
136
- Run a document, render it to standalone HTML, or export a report:
137
-
138
- ```sh
139
- bun run dist/cli.js run examples/hello-world.amx
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
145
- ```
146
-
147
- The `run` command prints evaluated bindings as JSON. `render` produces a
148
- standalone HTML document; `export` supports `pdf` and `docx`. Data inputs are
149
- explicitly mapped with `--input name=path`. See `bun run dist/cli.js --help` for
150
- the available commands and options.
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 chart behavior is unchanged.
155
-
156
- Run the test suite with:
157
-
158
- ```sh
159
- bun test
160
- ```
161
-
162
- ## Tooling
163
-
164
- - **Desktop workbench:** local project browsing, AMX editing and analysis, live
165
- preview, structured JSON/CSV editing, input mapping, and HTML/PDF/DOCX export.
166
- See the [desktop guide](desktop-app/README.md).
167
- - **VS Code extension:** formatting, completion, diagnostics, hover, navigation,
168
- symbols, references, and code actions. See the
169
- [extension guide](vscode-extension/README.md).
170
- - **CLI:** evaluate documents, render HTML, and export PDF or DOCX reports.
171
-
172
- ## Examples and Specifications
173
-
174
- Start with [Hello OpenAMX](examples/hello-world.amx) for the document basics.
175
- Other [examples](examples/) show calculations, tables and charts, typed JSON/CSV
176
- inputs, local modules, and JSON/CSV outputs. The Asset Management schemas are
177
- opt-in examples, not domain-certified standards.
178
-
179
- The [V0.9 language specification](docs/language-spec-v0.9.md) documents the
180
- current language and compatibility contract. See the [V0.9 migration guide](docs/migrating-to-v0.9.md)
181
- for the three approved compatibility changes. Earlier specifications describe
182
- the language's evolution: [V0.5](docs/language-spec-v0.5.md),
183
- [V0.2](docs/language-spec-v0.2.md),
184
- [V0.3](docs/language-spec-v0.3.md), and [V0.4](docs/language-spec-v0.4.md).
185
-
186
- ## Design Boundaries
187
-
188
- OpenAMX is intended for local documents, local modules, and explicitly mapped
189
- data files. It does not load remote packages or data. Hiding source in a report
190
- is a presentation choice, not a confidentiality boundary; source files and
191
- inputs should be protected independently. Report output is designed to work
192
- offline, but exact visual parity across HTML, PDF, DOCX, and office applications
193
- is not guaranteed.# OpenAMX
194
-
195
- Status: V0.6 is COMPLETE and approved for release with Lead Developer-accepted
196
- exceptions. The CLI, shared report identity, HTML/PDF/DOCX exports, desktop
197
- workbench and VS Code productivity providers are present. Native macOS 14+,
198
- Windows 11+, native Ubuntu 24.04+, Hutch packaging/launch, broad Office
199
- compatibility, project licensing/Marketplace publication, formal accessibility,
200
- V0.5 report-mobile overflow, and VS Code apply-time action safety were not
201
- verified as passes; they are accepted release exceptions and follow-up
202
- requirements for V0.7 planning. Release approval is not a claim that artifacts
203
- have been published or that these certifications were completed. Root, desktop,
204
- and extension package metadata are aligned to 0.6.0.
205
-
206
- OpenAMX combines Markdown narrative, executable `amx` fences, and inline
207
- `{{ expression }}` calculations in plain-text `.amx` documents. The TypeScript
208
- core remains domain-neutral; asset-management examples use ordinary values.
209
- See the [V0.2 language specification](docs/language-spec-v0.2.md) for the
210
- historical contract, the [V0.3 language specification](docs/language-spec-v0.3.md)
211
- for typed-data workflows, and the [V0.4 language specification](docs/language-spec-v0.4.md)
212
- for typed visualizations and their historical export behavior. The
213
- [V0.5 product and report contract](docs/language-spec-v0.5.md) defines additive
214
- report identity, source visibility and product boundaries; it does not mean every
215
- acceptance or release gate has passed.
216
-
217
- ## Install and verify
218
-
219
- Install [Bun](https://bun.sh/), then from the repository root run:
220
-
221
- ```sh
222
- bun install
223
- bun run build
224
- bun test
225
- ```
226
-
227
- ## Desktop Workbench
228
-
229
- The repository includes an offline-first desktop authoring workbench with active-document preview, project recovery, AMX editor intelligence, structured CSV/JSON editing, logical inputs, report settings, and a unified export workflow. Sprint 043 is completing onboarding, migration, and integrated acceptance; native target certification and release readiness are not implied. See the [desktop development guide](desktop-app/README.md) for current workflows, privacy limits, and verification status.
230
-
231
- ## Write a document
232
-
233
- An optional YAML front matter and a Markdown heading can precede executable
234
- blocks. A narrative sentence such as `The final score is {{ score }}.` resolves
235
- against the final environment, even when the following block appears later:
236
-
237
- ```amx
238
- let score = 10
239
- score += 5
240
- ```
241
-
242
- The paragraph displays 15. Executable source is visible as escaped, canonically
243
- formatted code in the standalone HTML. V0.2 supports mutable `let` bindings
244
- (including repeated declarations), `=` and `+=`, arithmetic, comparisons,
245
- logicals, single-line `if ... then ... else ...`, lists, inclusive integer
246
- `[start to end]` ranges, statement loops, expression loops with one per-iteration
247
- `return`, literal-case `match` with exactly one `default`, and the `sum`, `min`,
248
- `max`, `mean`, `round`, `abs`, `sqrt`, and `pow` functions. Loops iterate over
249
- lists or ranges; their iterator does not persist in the final environment.
250
-
251
- V0.3 adds records, typed pure functions, local imports/exports, JSON and CSV
252
- inputs, aggregate or fail-fast validation, and named JSON/CSV exports. The six
253
- initial Asset Management schemas are an opt-in structural library, not
254
- domain-certified standards.
255
-
256
- **Migration from V0.1:** bare `let score = 10` lines outside exact, case-sensitive
257
- `amx` backtick fences are narrative and do not execute. Move old declarations
258
- into ` ```amx ` fences. Ordinary Markdown code fences also do not execute;
259
- there is no V0.1 compatibility mode.
260
-
261
- ## VS Code Extension
262
-
263
- The [VS Code extension](vscode-extension/README.md) requires VS Code 1.85.0 or
264
- newer and runs in the Node extension host. The workspace implementation includes
265
- formatting, completion, static diagnostics, hover, definition, outline,
266
- references and a diagnostic-backed quick fix. Runtime CSV/JSON validation remains
267
- a CLI concern. The quick fix is guarded when resolved; VS Code 1.85 cannot attach
268
- an apply-time document-version precondition, and that limitation still requires a
269
- Lead Developer disposition.
270
-
271
- From the repository root, develop, test, package, and install a local VSIX:
272
-
273
- ```bash
274
- cd vscode-extension
275
- bun install
276
- bun run compile
277
- bun run test
278
- CI=1 bun run package
279
- bun run install-local
280
- code --list-extensions --show-versions
281
- ```
282
-
283
- `bun run test` launches the VS Code 1.85.0 Extension Development Host; a display
284
- or headless display server is required. For manual launch, open the extension
285
- directory and select **Run OpenAMX Extension**. The locally installed package is
286
- `engineerstools.openamx-vscode@0.4.0`. This repository has no license file;
287
- Marketplace publication is deferred until the project chooses a license and adds
288
- the corresponding file. Packaging may prompt about the missing license.
289
-
290
- ---
291
-
292
- ## CLI usage
293
-
294
- Build first. Render a document to standalone HTML (by default next to its source):
295
-
296
- ```bash
297
- bun run dist/cli.js render examples/hello-world.amx --out examples/hello-world.html
298
- ```
299
-
300
- Or use the bundled script:
301
-
302
- ```bash
303
- bun run render:hello
304
- bun run render:transformer
305
- bun run render:fleet
306
- bun run render:typed
307
- ```
308
-
309
- Run a document and print the evaluated context as JSON:
310
-
311
- ```bash
312
- bun run dist/cli.js run examples/transformer-strategy.amx
313
- ```
314
-
315
- The `run` command prints final variable bindings as JSON.
316
-
317
- Typed documents accept repeated logical input mappings and named export mappings:
318
-
319
- ```bash
320
- bun run dist/cli.js run examples/typed-asset-analysis.amx \
321
- --input asset=examples/typed-asset.json \
322
- --input screenings=examples/typed-screenings.csv \
323
- --input reviewedAt=examples/typed-reviewed-at.json \
324
- --output summary=out/summary.json \
325
- --output resultRows=out/result-rows.csv
326
- ```
327
-
328
- Use `--validation fail-fast` to stop at the first ordered input diagnostic;
329
- aggregate validation is the default. `render` accepts the same mappings and
330
- adds `--out` for the HTML destination.
331
-
332
- `render` and `export pdf|docx` accept `--project-root <dir>` to load report
333
- identity defaults from that project's `.openamx/project.json`. This option does
334
- not supply input mappings or change their process-working-directory path base;
335
- `run` does not read project report configuration. Without the option, project
336
- configuration is not discovered. Frontmatter identity without a logo remains
337
- available.
338
-
339
- Export an offline PDF or editable DOCX report. The commands analyze once, prepare
340
- the complete report before writing, and require an existing parent:
341
-
342
- ```bash
343
- bun run dist/cli.js export docx examples/typed-asset-analysis.amx --out out/analysis.docx \
344
- --input asset=examples/typed-asset.json \
345
- --input screenings=examples/typed-screenings.csv \
346
- --input reviewedAt=examples/typed-reviewed-at.json
347
- ```
348
-
349
- DOCX contains editable semantic headings, paragraphs, lists, tables, and
350
- static chart images. Interactive charts, editable chart data, pixel parity,
351
- and broad native Office compatibility are not promised.
352
-
353
- Run the V0.5 typed example with its local imports, JSON/CSV inputs, table and
354
- chart. Copy the sample project config into a temporary project because the CLI
355
- intentionally does not discover parent projects:
356
-
357
- ```bash
358
- review=$(mktemp -d)
359
- mkdir -p "$review/.openamx"
360
- cp examples/v05-asset-screening.amx "$review/"
361
- cp -R examples/libraries "$review/"
362
- cp examples/v05-project.json "$review/.openamx/project.json"
363
- bun run dist/cli.js run "$review/v05-asset-screening.amx" \
364
- --input asset=examples/typed-asset.json \
365
- --input screenings=examples/typed-screenings.csv
366
- bun run dist/cli.js render "$review/v05-asset-screening.amx" \
367
- --out "$review/report.html" --project-root "$review" \
368
- --input asset=examples/typed-asset.json \
369
- --input screenings=examples/typed-screenings.csv
370
- bun run dist/cli.js export pdf "$review/v05-asset-screening.amx" \
371
- --out "$review/report.pdf" --project-root "$review" \
372
- --input asset=examples/typed-asset.json \
373
- --input screenings=examples/typed-screenings.csv
374
- bun run dist/cli.js export docx "$review/v05-asset-screening.amx" \
375
- --out "$review/report.docx" --project-root "$review" \
376
- --input asset=examples/typed-asset.json \
377
- --input screenings=examples/typed-screenings.csv
378
- ```
379
-
380
- The example calculation is illustrative, not a domain-standard risk formula.
381
- `sourceVisible` defaults to true; hiding source is a presentation choice, not a
382
- confidentiality boundary. Logo assets must be contained local PNG/JPEG files and
383
- are validated and re-encoded before report output is written.
384
-
385
- ---
386
-
387
- ## Example files
388
-
389
- The canonical examples are:
390
-
391
- - [Hello OpenAMX](examples/hello-world.amx), with generated
392
- [HTML](examples/hello-world.html), introduces executable fences and score 15.
393
- - [Kitchen Sink](examples/kitchen-sink.amx), contains a comprehensive explanation of every construct in the AMX framework.
394
- - [Power Transformer Failure Mode Analysis](examples/transformer-strategy.amx)
395
- computes mode scores `[24, 18, 27]`, initial aggregate 69, then adjusted
396
- aggregate 60. Its [HTML](examples/transformer-strategy.html) shows the final
397
- value even in an earlier paragraph.
398
- - [Asset Fleet Risk Analysis](examples/asset-fleet-risk-analysis.amx) computes
399
- `[5, 10, 15]`, total 30, then 35 after an access adjustment. Its
400
- [HTML](examples/asset-fleet-risk-analysis.html) displays the default decision
401
- "Schedule review" and the final score 35; ordinary fences and bare
402
- declarations are visible but never executed.
403
- - [Typed Asset Screening Analysis](examples/typed-asset-analysis.amx) imports
404
- opt-in Asset Management and screening schemas, consumes nested JSON and CSV,
405
- computes scores with a typed pure function, and exports summary JSON plus
406
- result CSV. Its [HTML](examples/typed-asset-analysis.html) is generated by
407
- the production CLI.
408
- - [Branded Asset Screening Snapshot](examples/v05-asset-screening.amx) reuses
409
- typed inputs, local libraries and V0.4 table/chart constructs;
410
- [project identity defaults](examples/v05-project.json) apply only when the
411
- CLI receives an explicit `--project-root`.
412
-
413
- ```sh
414
- bun run dist/cli.js run examples/transformer-strategy.amx
415
- bun run dist/cli.js run examples/asset-fleet-risk-analysis.amx
416
- ```
417
-
418
- ---
419
-
420
- ## Current limits
421
-
422
- No nested loops, range steps, `break`/`continue`, match guards/destructuring,
423
- or chained `else if`. A record constructor directly in a `match` arm remains a
424
- known core parser limitation and is not claimed as supported. Editor
425
- diagnostics cover parsing, static checks, and local module links, not CSV/JSON
426
- runtime validation. Modules and data files are local and entry-root-contained;
427
- there are no remote packages, units/currency, or broad multi-file workflows.
428
- DOCX/PDF exports are local and offline; DOCX charts are static images and
429
- office compatibility beyond package inspection remains open. The Asset
430
- Management library remains provisional pending domain review.
431
-
432
- ---
433
-
434
- ## OpenAMX Licensing
435
-
436
- This project is dual licensed.
437
-
438
- You may use this software under either:
439
-
440
- 1. The GNU Affero General Public License v3.0 (AGPLv3)
441
- 2. A Commercial License from Nova Energy Consulting Pty Ltd
442
-
443
- By using this software, you agree to comply with the terms of one of these licences.
444
-
445
- ### Open Source Licence (AGPLv3)
446
-
447
- The Community Edition of this software is licensed under the GNU Affero General Public License Version 3 (AGPLv3).
448
-
449
- The AGPLv3 permits you to:
450
-
451
- - Use the software for any purpose
452
- - Study and modify the software
453
- - Distribute original or modified versions
454
- - Use the software within an organisation
455
- - Deploy the software as a network service
456
-
457
- Subject to the conditions of the AGPLv3, including making source code available where required by the licence.
458
-
459
- See the LICENSE file for the full licence text.
460
-
461
- ### Commercial Licence
462
-
463
- A commercial licence is available for organisations that wish to:
464
-
465
- - Keep modifications proprietary
466
- - Distribute the software as part of a closed-source product
467
- - Embed the software within commercial solutions
468
- - Avoid AGPLv3 source disclosure obligations
469
- - Obtain commercial support arrangements
470
-
471
- See COMMERCIAL-LICENSE.md for details.
472
-
473
- ### Which Licence Should I Choose?
474
-
475
- #### Use AGPLv3 if:
476
-
477
- - You are an individual user
478
- - You are happy to comply with AGPL obligations
479
- - You wish to participate in the open-source community
480
- - Your project is also open source
481
-
482
- #### Use a Commercial Licence if:
483
-
484
- - You require proprietary use rights
485
- - Your organisation cannot comply with AGPL obligations
486
- - You wish to distribute closed-source derivative works
487
- - You require contractual warranties, support or indemnities
488
-
489
- ### Commercial Enquiries
490
-
491
- For commercial licensing and support enquiries:
492
-
493
- **Nova Energy Consulting Pty Ltd**
494
-
495
- Email: licensing@novaenergy.digital
496
-
497
- ---
498
-
499
- ## Contributing
500
-
501
- By submitting a contribution to this project, you agree that your contribution may be distributed under both:
502
-
503
- - AGPLv3
504
- - The commercial licensing program for this project
505
-
506
- See CONTRIBUTING.md and the contributor agreement (if applicable) for details.
507
-
508
- ---
509
-
510
- ## Disclaimer
511
-
512
- This software is provided "as is" without warranty of any kind.
513
-
1
+ # OpenAMX
2
+
3
+ ![OpenAMX](./docs/images/open_amx_screenshot.png)
4
+
5
+ OpenAMX is a text-based format and toolset for **computable documents**. It
6
+ combines Markdown narrative with executable `amx` code blocks and inline
7
+ `{{ expressions }}` so a document can explain an analysis and calculate its
8
+ results in one readable, versionable file.
9
+
10
+ The core is domain-neutral: authors define calculations and data structures for
11
+ their own work. Optional libraries and examples demonstrate asset-management
12
+ workflows, but OpenAMX does not prescribe a risk model or certify domain rules.
13
+
14
+ ## What You Can Do
15
+
16
+ - Write narrative reports with executable calculations, reusable local modules,
17
+ typed records and pure functions.
18
+ - Read local JSON and CSV data through declared logical inputs, validate it
19
+ against document types, and export named results as JSON or CSV.
20
+ - Add data tables and charts to a document, then render the narrative,
21
+ calculations and views together.
22
+ - Create standalone HTML reports, or export offline PDF and editable DOCX
23
+ reports.
24
+ - Author in the desktop workbench or use OpenAMX language features in VS Code.
25
+ - Run the TypeScript-based engine and command-line tools in local workflows.
26
+
27
+ ## A Small Example
28
+
29
+ Save this as `analysis.amx`:
30
+
31
+ ````markdown
32
+ # Review
33
+
34
+ The adjusted score is {{ score }}.
35
+
36
+ ```amx
37
+ let score = 10
38
+ score += 5
39
+ ```
40
+ ````
41
+
42
+ Only exact, case-sensitive `amx` fenced blocks execute. Markdown remains
43
+ narrative, and inline expressions resolve using the document's evaluated
44
+ results.
45
+
46
+ ## Installation
47
+
48
+ OpenAMX has three independent components. Install whichever you need; release
49
+ downloads are on the [GitHub releases page](https://github.com/NovaEnergyConsulting/openamx/releases).
50
+ Release builds are unsigned, so your operating system may show a warning before
51
+ installing them.
52
+
53
+ ### Command-line tool (CLI)
54
+
55
+ The CLI is published to npm as `@nova-energy/openamx` and runs on
56
+ [Bun](https://bun.sh/) 1.0 or newer. Node.js and Deno are not supported.
57
+
58
+ 1. Install Bun by following the instructions at [bun.sh](https://bun.sh/).
59
+ 2. Install the CLI globally:
60
+
61
+ ```sh
62
+ bun add -g @nova-energy/openamx
63
+ ```
64
+
65
+ 3. Check the installation:
66
+
67
+ ```sh
68
+ openamx --version
69
+ openamx --help
70
+ ```
71
+
72
+ To run it once without installing, use
73
+ `bunx @nova-energy/openamx render analysis.amx`. Installing with
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`.
76
+
77
+ ### Desktop application
78
+
79
+ Download the installer for your platform from the
80
+ [releases page](https://github.com/NovaEnergyConsulting/openamx/releases). The
81
+ installed application includes its own runtime; you do not need Bun or Node.js.
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.
103
+
104
+ ### VS Code extension
105
+
106
+ The extension requires VS Code 1.85.0 or newer. It is not yet on the Visual
107
+ Studio Marketplace, so install it from the VSIX file:
108
+
109
+ 1. Download `openamx-vscode-<version>.vsix` from the
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
+ ```
116
+
117
+ Or, in VS Code, open the Extensions view, choose **...** >
118
+ **Install from VSIX...**, and select the downloaded file.
119
+ 3. Open any `.amx` file to activate syntax highlighting, formatting,
120
+ completion and diagnostics.
121
+
122
+ To build any component from source instead, see [Get Started](#get-started)
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
+ ```
135
+
136
+ Run a document, render it to standalone HTML, or export a report:
137
+
138
+ ```sh
139
+ bun run dist/cli.js run examples/hello-world.amx
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
145
+ ```
146
+
147
+ The `run` command prints evaluated bindings as JSON. `render` produces a
148
+ standalone HTML document; `export` supports `pdf` and `docx`. Data inputs are
149
+ explicitly mapped with `--input name=path`. See `bun run dist/cli.js --help` for
150
+ the available commands and options.
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:
159
+
160
+ ```sh
161
+ bun test
162
+ ```
163
+
164
+ ## Tooling
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.9 language specification](docs/language-spec-v0.9.md) documents the
182
+ current language and compatibility contract. See the [V0.9 migration guide](docs/migrating-to-v0.9.md)
183
+ for the three approved compatibility changes. Earlier specifications describe
184
+ the language's evolution: [V0.5](docs/language-spec-v0.5.md),
185
+ [V0.2](docs/language-spec-v0.2.md),
186
+ [V0.3](docs/language-spec-v0.3.md), and [V0.4](docs/language-spec-v0.4.md).
187
+
188
+ ## Design Boundaries
189
+
190
+ OpenAMX is intended for local documents, local modules, and explicitly mapped
191
+ data files. It does not load remote packages or data. Hiding source in a report
192
+ is a presentation choice, not a confidentiality boundary; source files and
193
+ inputs should be protected independently. Report output is designed to work
194
+ offline, but exact visual parity across HTML, PDF, DOCX, and office applications
195
+ is not guaranteed.# OpenAMX
196
+
197
+ Status: V0.6 is COMPLETE and approved for release with Lead Developer-accepted
198
+ exceptions. The CLI, shared report identity, HTML/PDF/DOCX exports, desktop
199
+ workbench and VS Code productivity providers are present. Native macOS 14+,
200
+ Windows 11+, native Ubuntu 24.04+, Hutch packaging/launch, broad Office
201
+ compatibility, project licensing/Marketplace publication, formal accessibility,
202
+ V0.5 report-mobile overflow, and VS Code apply-time action safety were not
203
+ verified as passes; they are accepted release exceptions and follow-up
204
+ requirements for V0.7 planning. Release approval is not a claim that artifacts
205
+ have been published or that these certifications were completed. Root, desktop,
206
+ and extension package metadata are aligned to 0.6.0.
207
+
208
+ OpenAMX combines Markdown narrative, executable `amx` fences, and inline
209
+ `{{ expression }}` calculations in plain-text `.amx` documents. The TypeScript
210
+ core remains domain-neutral; asset-management examples use ordinary values.
211
+ See the [V0.2 language specification](docs/language-spec-v0.2.md) for the
212
+ historical contract, the [V0.3 language specification](docs/language-spec-v0.3.md)
213
+ for typed-data workflows, and the [V0.4 language specification](docs/language-spec-v0.4.md)
214
+ for typed visualizations and their historical export behavior. The
215
+ [V0.5 product and report contract](docs/language-spec-v0.5.md) defines additive
216
+ report identity, source visibility and product boundaries; it does not mean every
217
+ acceptance or release gate has passed.
218
+
219
+ ## Install and verify
220
+
221
+ Install [Bun](https://bun.sh/), then from the repository root run:
222
+
223
+ ```sh
224
+ bun install
225
+ bun run build
226
+ bun test
227
+ ```
228
+
229
+ ## Desktop Workbench
230
+
231
+ The repository includes an offline-first desktop authoring workbench with active-document preview, project recovery, AMX editor intelligence, structured CSV/JSON editing, logical inputs, report settings, and a unified export workflow. Sprint 043 is completing onboarding, migration, and integrated acceptance; native target certification and release readiness are not implied. See the [desktop development guide](desktop-app/README.md) for current workflows, privacy limits, and verification status.
232
+
233
+ ## Write a document
234
+
235
+ An optional YAML front matter and a Markdown heading can precede executable
236
+ blocks. A narrative sentence such as `The final score is {{ score }}.` resolves
237
+ against the final environment, even when the following block appears later:
238
+
239
+ ```amx
240
+ let score = 10
241
+ score += 5
242
+ ```
243
+
244
+ The paragraph displays 15. Executable source is visible as escaped, canonically
245
+ formatted code in the standalone HTML. V0.2 supports mutable `let` bindings
246
+ (including repeated declarations), `=` and `+=`, arithmetic, comparisons,
247
+ logicals, single-line `if ... then ... else ...`, lists, inclusive integer
248
+ `[start to end]` ranges, statement loops, expression loops with one per-iteration
249
+ `return`, literal-case `match` with exactly one `default`, and the `sum`, `min`,
250
+ `max`, `mean`, `round`, `abs`, `sqrt`, and `pow` functions. Loops iterate over
251
+ lists or ranges; their iterator does not persist in the final environment.
252
+
253
+ V0.3 adds records, typed pure functions, local imports/exports, JSON and CSV
254
+ inputs, aggregate or fail-fast validation, and named JSON/CSV exports. The six
255
+ initial Asset Management schemas are an opt-in structural library, not
256
+ domain-certified standards.
257
+
258
+ **Migration from V0.1:** bare `let score = 10` lines outside exact, case-sensitive
259
+ `amx` backtick fences are narrative and do not execute. Move old declarations
260
+ into ` ```amx ` fences. Ordinary Markdown code fences also do not execute;
261
+ there is no V0.1 compatibility mode.
262
+
263
+ ## VS Code Extension
264
+
265
+ The [VS Code extension](vscode-extension/README.md) requires VS Code 1.85.0 or
266
+ newer and runs in the Node extension host. The workspace implementation includes
267
+ formatting, completion, static diagnostics, hover, definition, outline,
268
+ references and a diagnostic-backed quick fix. Runtime CSV/JSON validation remains
269
+ a CLI concern. The quick fix is guarded when resolved; VS Code 1.85 cannot attach
270
+ an apply-time document-version precondition, and that limitation still requires a
271
+ Lead Developer disposition.
272
+
273
+ From the repository root, develop, test, package, and install a local VSIX:
274
+
275
+ ```bash
276
+ cd vscode-extension
277
+ bun install
278
+ bun run compile
279
+ bun run test
280
+ CI=1 bun run package
281
+ bun run install-local
282
+ code --list-extensions --show-versions
283
+ ```
284
+
285
+ `bun run test` launches the VS Code 1.85.0 Extension Development Host; a display
286
+ or headless display server is required. For manual launch, open the extension
287
+ directory and select **Run OpenAMX Extension**. The locally installed package is
288
+ `engineerstools.openamx-vscode@0.4.0`. This repository has no license file;
289
+ Marketplace publication is deferred until the project chooses a license and adds
290
+ the corresponding file. Packaging may prompt about the missing license.
291
+
292
+ ---
293
+
294
+ ## CLI usage
295
+
296
+ Build first. Render a document to standalone HTML (by default next to its source):
297
+
298
+ ```bash
299
+ bun run dist/cli.js render examples/hello-world.amx --out examples/hello-world.html
300
+ ```
301
+
302
+ Or use the bundled script:
303
+
304
+ ```bash
305
+ bun run render:hello
306
+ bun run render:transformer
307
+ bun run render:fleet
308
+ bun run render:typed
309
+ ```
310
+
311
+ Run a document and print the evaluated context as JSON:
312
+
313
+ ```bash
314
+ bun run dist/cli.js run examples/transformer-strategy.amx
315
+ ```
316
+
317
+ The `run` command prints final variable bindings as JSON.
318
+
319
+ Typed documents accept repeated logical input mappings and named export mappings:
320
+
321
+ ```bash
322
+ bun run dist/cli.js run examples/typed-asset-analysis.amx \
323
+ --input asset=examples/typed-asset.json \
324
+ --input screenings=examples/typed-screenings.csv \
325
+ --input reviewedAt=examples/typed-reviewed-at.json \
326
+ --output summary=out/summary.json \
327
+ --output resultRows=out/result-rows.csv
328
+ ```
329
+
330
+ Use `--validation fail-fast` to stop at the first ordered input diagnostic;
331
+ aggregate validation is the default. `render` accepts the same mappings and
332
+ adds `--out` for the HTML destination.
333
+
334
+ `render` and `export pdf|docx` accept `--project-root <dir>` to load report
335
+ identity defaults from that project's `.openamx/project.json`. This option does
336
+ not supply input mappings or change their process-working-directory path base;
337
+ `run` does not read project report configuration. Without the option, project
338
+ configuration is not discovered. Frontmatter identity without a logo remains
339
+ available.
340
+
341
+ Export an offline PDF or editable DOCX report. The commands analyze once, prepare
342
+ the complete report before writing, and require an existing parent:
343
+
344
+ ```bash
345
+ bun run dist/cli.js export docx examples/typed-asset-analysis.amx --out out/analysis.docx \
346
+ --input asset=examples/typed-asset.json \
347
+ --input screenings=examples/typed-screenings.csv \
348
+ --input reviewedAt=examples/typed-reviewed-at.json
349
+ ```
350
+
351
+ DOCX contains editable semantic headings, paragraphs, lists, tables, and native
352
+ charts with embedded data for representable cases. Numeric-X line charts use
353
+ straight-line XY scatter. Unsupported axis counts, charts with no plottable
354
+ points, and mixed-group scatter with a null-only group are omitted with a notice
355
+ and complete table; a numeric-X line series with no plottable pairs is omitted
356
+ from the chart, disclosed, and retained in the table. These mappings do not
357
+ promise pixel parity or broad native Office compatibility.
358
+
359
+ Report narratives support headings, formatted paragraphs, lists, blockquotes,
360
+ tables, code, rules, and visible source line breaks; authored raw HTML remains
361
+ inert text. Narrative images must be project-contained PNG or JPEG files with
362
+ nonempty alternative text, no more than 4 MiB and 4,000,000 decoded pixels per
363
+ image. They are sanitized and embedded, so reports do not fetch remote images.
364
+ External links are limited to HTTP(S); local links are limited to PDF, PNG,
365
+ JPEG, TXT, CSV, and JSON targets contained by the project. Local links are
366
+ relative to the final report location, and companion files are not copied; keep
367
+ them at the corresponding relative paths when moving a report. Desktop preview
368
+ routes activated external/local links through host confirmation. Viewer behavior
369
+ varies: Word for the Web rewrote tested relative DOCX links as HTTPS targets, so
370
+ local companion-file opening there is not claimed.
371
+
372
+ Run the V0.5 typed example with its local imports, JSON/CSV inputs, table and
373
+ chart. Copy the sample project config into a temporary project because the CLI
374
+ intentionally does not discover parent projects:
375
+
376
+ ```bash
377
+ review=$(mktemp -d)
378
+ mkdir -p "$review/.openamx"
379
+ cp examples/v05-asset-screening.amx "$review/"
380
+ cp -R examples/libraries "$review/"
381
+ cp examples/v05-project.json "$review/.openamx/project.json"
382
+ bun run dist/cli.js run "$review/v05-asset-screening.amx" \
383
+ --input asset=examples/typed-asset.json \
384
+ --input screenings=examples/typed-screenings.csv
385
+ bun run dist/cli.js render "$review/v05-asset-screening.amx" \
386
+ --out "$review/report.html" --project-root "$review" \
387
+ --input asset=examples/typed-asset.json \
388
+ --input screenings=examples/typed-screenings.csv
389
+ bun run dist/cli.js export pdf "$review/v05-asset-screening.amx" \
390
+ --out "$review/report.pdf" --project-root "$review" \
391
+ --input asset=examples/typed-asset.json \
392
+ --input screenings=examples/typed-screenings.csv
393
+ bun run dist/cli.js export docx "$review/v05-asset-screening.amx" \
394
+ --out "$review/report.docx" --project-root "$review" \
395
+ --input asset=examples/typed-asset.json \
396
+ --input screenings=examples/typed-screenings.csv
397
+ ```
398
+
399
+ The example calculation is illustrative, not a domain-standard risk formula.
400
+ `sourceVisible` defaults to true; hiding source is a presentation choice, not a
401
+ confidentiality boundary. Logo assets must be contained local PNG/JPEG files and
402
+ are validated and re-encoded before report output is written.
403
+
404
+ ---
405
+
406
+ ## Example files
407
+
408
+ The canonical examples are:
409
+
410
+ - [Hello OpenAMX](examples/hello-world.amx), with generated
411
+ [HTML](examples/hello-world.html), introduces executable fences and score 15.
412
+ - [Kitchen Sink](examples/kitchen-sink.amx), contains a comprehensive explanation of every construct in the AMX framework.
413
+ - [Power Transformer Failure Mode Analysis](examples/transformer-strategy.amx)
414
+ computes mode scores `[24, 18, 27]`, initial aggregate 69, then adjusted
415
+ aggregate 60. Its [HTML](examples/transformer-strategy.html) shows the final
416
+ value even in an earlier paragraph.
417
+ - [Asset Fleet Risk Analysis](examples/asset-fleet-risk-analysis.amx) computes
418
+ `[5, 10, 15]`, total 30, then 35 after an access adjustment. Its
419
+ [HTML](examples/asset-fleet-risk-analysis.html) displays the default decision
420
+ "Schedule review" and the final score 35; ordinary fences and bare
421
+ declarations are visible but never executed.
422
+ - [Typed Asset Screening Analysis](examples/typed-asset-analysis.amx) imports
423
+ opt-in Asset Management and screening schemas, consumes nested JSON and CSV,
424
+ computes scores with a typed pure function, and exports summary JSON plus
425
+ result CSV. Its [HTML](examples/typed-asset-analysis.html) is generated by
426
+ the production CLI.
427
+ - [Branded Asset Screening Snapshot](examples/v05-asset-screening.amx) reuses
428
+ typed inputs, local libraries and V0.4 table/chart constructs;
429
+ [project identity defaults](examples/v05-project.json) apply only when the
430
+ CLI receives an explicit `--project-root`.
431
+
432
+ ```sh
433
+ bun run dist/cli.js run examples/transformer-strategy.amx
434
+ bun run dist/cli.js run examples/asset-fleet-risk-analysis.amx
435
+ ```
436
+
437
+ ---
438
+
439
+ ## Current limits
440
+
441
+ No nested loops, range steps, `break`/`continue`, match guards/destructuring,
442
+ or chained `else if`. A record constructor directly in a `match` arm remains a
443
+ known core parser limitation and is not claimed as supported. Editor
444
+ diagnostics cover parsing, static checks, and local module links, not CSV/JSON
445
+ runtime validation. Modules and data files are local and entry-root-contained;
446
+ there are no remote packages, units/currency, or broad multi-file workflows.
447
+ PDF and DOCX exports are local and offline. DOCX charts are editable native
448
+ objects with embedded data for representable cases; explicit no-chart notices
449
+ and complete tables cover the approved deferrals. Word desktop open and
450
+ chart-edit persistence have been exercised on the build recorded in the sprint
451
+ evidence, but broad Office compatibility, the Word for the Web numeric-X
452
+ null-gap visual, and a formal screen-reader review are not claimed. The Asset
453
+ Management library remains provisional pending domain review.
454
+
455
+ ---
456
+
457
+ ## OpenAMX Licensing
458
+
459
+ This project is dual licensed.
460
+
461
+ You may use this software under either:
462
+
463
+ 1. The GNU Affero General Public License v3.0 (AGPLv3)
464
+ 2. A Commercial License from Nova Energy Consulting Pty Ltd
465
+
466
+ By using this software, you agree to comply with the terms of one of these licences.
467
+
468
+ ### Open Source Licence (AGPLv3)
469
+
470
+ The Community Edition of this software is licensed under the GNU Affero General Public License Version 3 (AGPLv3).
471
+
472
+ The AGPLv3 permits you to:
473
+
474
+ - Use the software for any purpose
475
+ - Study and modify the software
476
+ - Distribute original or modified versions
477
+ - Use the software within an organisation
478
+ - Deploy the software as a network service
479
+
480
+ Subject to the conditions of the AGPLv3, including making source code available where required by the licence.
481
+
482
+ See the LICENSE file for the full licence text.
483
+
484
+ ### Commercial Licence
485
+
486
+ A commercial licence is available for organisations that wish to:
487
+
488
+ - Keep modifications proprietary
489
+ - Distribute the software as part of a closed-source product
490
+ - Embed the software within commercial solutions
491
+ - Avoid AGPLv3 source disclosure obligations
492
+ - Obtain commercial support arrangements
493
+
494
+ See COMMERCIAL-LICENSE.md for details.
495
+
496
+ ### Which Licence Should I Choose?
497
+
498
+ #### Use AGPLv3 if:
499
+
500
+ - You are an individual user
501
+ - You are happy to comply with AGPL obligations
502
+ - You wish to participate in the open-source community
503
+ - Your project is also open source
504
+
505
+ #### Use a Commercial Licence if:
506
+
507
+ - You require proprietary use rights
508
+ - Your organisation cannot comply with AGPL obligations
509
+ - You wish to distribute closed-source derivative works
510
+ - You require contractual warranties, support or indemnities
511
+
512
+ ### Commercial Enquiries
513
+
514
+ For commercial licensing and support enquiries:
515
+
516
+ **Nova Energy Consulting Pty Ltd**
517
+
518
+ Email: licensing@novaenergy.digital
519
+
520
+ ---
521
+
522
+ ## Contributing
523
+
524
+ By submitting a contribution to this project, you agree that your contribution may be distributed under both:
525
+
526
+ - AGPLv3
527
+ - The commercial licensing program for this project
528
+
529
+ See CONTRIBUTING.md and the contributor agreement (if applicable) for details.
530
+
531
+ ---
532
+
533
+ ## Disclaimer
534
+
535
+ This software is provided "as is" without warranty of any kind.
536
+
514
537
  See the applicable licence for full terms and conditions.