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