@nm-lang/cli 0.3.0 → 0.4.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 +166 -140
- package/dist/index.js +18 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,140 +1,166 @@
|
|
|
1
|
-
# @nm-lang/cli
|
|
2
|
-
|
|
3
|
-
N/M 0.2.0 Preview command-line tools for running, formatting, linting, testing,
|
|
4
|
-
exporting and managing local N/M workspaces.
|
|
5
|
-
|
|
6
|
-
Package
|
|
7
|
-
|
|
8
|
-
## Install / Kurulum
|
|
9
|
-
|
|
10
|
-
Requires Node.js 20 or newer. Release checks use Node.js 22.23.1.
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
npm install --global @nm-lang/cli
|
|
14
|
-
nm --version
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Or run without a global install:
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npx --package=@nm-lang/cli nm --version
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
An untagged install selects npm's `latest` channel. To pin this version
|
|
24
|
-
|
|
25
|
-
Preview independently of the npm channel. npm installs the matching Core dependency.
|
|
26
|
-
No repository checkout or TypeScript build is needed to use a published package.
|
|
27
|
-
|
|
28
|
-
Türkçe: Etiketsiz kurulum npm'in `latest` kanalını seçer.
|
|
29
|
-
`@0.
|
|
30
|
-
olarak Önizleme durumundadır. Core bağımlılığı otomatik kurulur; depoyu
|
|
31
|
-
indirmeniz gerekmez.
|
|
32
|
-
|
|
33
|
-
## First program / İlk program
|
|
34
|
-
|
|
35
|
-
Save the following as `bell.nm`:
|
|
36
|
-
|
|
37
|
-
```nm
|
|
38
|
-
module npm_bell;
|
|
39
|
-
fn main() {
|
|
40
|
-
let q = qreg[2];
|
|
41
|
-
H(q[0]);
|
|
42
|
-
CNOT(q[0], q[1]);
|
|
43
|
-
let a = measure(q[0]);
|
|
44
|
-
let b = measure(q[1]);
|
|
45
|
-
return (a, b);
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
nm run bell.nm --json
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
The program creates and measures a Bell pair using a local simulator.
|
|
54
|
-
Türkçe: Kodu `bell.nm` olarak kaydedip komutla çalıştırın. Sonuç yerel
|
|
55
|
-
simülasyondan gelir; gerçek kuantum donanımı kanıtı değildir.
|
|
56
|
-
|
|
57
|
-
## Language options / Dil seçenekleri
|
|
58
|
-
|
|
59
|
-
### Selected tests and CI reports / Test seçimi ve CI raporları
|
|
60
|
-
|
|
61
|
-
The `0.3.0` package adds test selection, watch mode and JSON, JUnit and SARIF
|
|
62
|
-
reports for CI integrations.
|
|
63
|
-
|
|
64
|
-
Türkçe: `0.3.0` paketi test seçimini, izleme modunu ve CI entegrasyonları için
|
|
65
|
-
JSON, JUnit ve SARIF raporlarını içerir.
|
|
66
|
-
|
|
67
|
-
```sh
|
|
68
|
-
nm test main.nm --name "Bell contract" --json
|
|
69
|
-
nm test main.nm --id nmtest-0123456789abcdef
|
|
70
|
-
nm test main.nm --report-format junit --output results.xml
|
|
71
|
-
nm test main.nm --report-format sarif --output results.sarif
|
|
72
|
-
nm test main.nm --watch --json
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
`--name` matches the exact declared name; repeat `--name` or `--id` to select a
|
|
76
|
-
union. Copy real IDs from a JSON report for the same input path and source lines.
|
|
77
|
-
Selection happens before execution, preserving surrounding setup and original
|
|
78
|
-
source locations; unknown/stale IDs or names fail with `NM-TEST-SELECT-001`.
|
|
79
|
-
Direct selection of a nested check fails with `NM-TEST-SELECT-002`; select its
|
|
80
|
-
top-level enclosing check. Source syntax and capability validation still cover
|
|
81
|
-
the complete file, including its original register allocation and qubit limits.
|
|
82
|
-
Empty suites and failed execution exit 1.
|
|
83
|
-
|
|
84
|
-
`--report-format json|junit|sarif` writes that format to stdout. `--output` also
|
|
85
|
-
replaces the explicitly named `.json`, `.xml` or `.sarif` report on each run;
|
|
86
|
-
parent directories must already exist. The default output remains human readable.
|
|
87
|
-
`--json` cannot be combined with a non-JSON report format.
|
|
88
|
-
|
|
89
|
-
`--watch` is available in the Node command-line host. It runs immediately, then
|
|
90
|
-
debounces source and workspace-manifest changes, including imported modules,
|
|
91
|
-
clears the workspace cache and queues runs without overlap. Ctrl+C/SIGTERM closes
|
|
92
|
-
watchers. With `--json`, stdout is NDJSON: each `event:"run"` has a sequence,
|
|
93
|
-
exitCode, report (or null for invocation errors) and diagnostics; lifecycle errors
|
|
94
|
-
and stopping also have event objects. JUnit/SARIF watch mode requires `--output`
|
|
95
|
-
and prints run summaries while replacing the report file. The exit status follows
|
|
96
|
-
the latest run; signal termination uses 130/143.
|
|
97
|
-
|
|
98
|
-
Türkçe: Tam test adı veya mevcut rapordaki kimlikle seçim yapın; seçenekler
|
|
99
|
-
tekrarlanabilir. Seçilmeyen test blokları yürütülmez, ortak kurulum korunur.
|
|
100
|
-
İç içe kontrolleri doğrudan seçmek yerine üst kontrolü seçin. Kaynağın tamamındaki
|
|
101
|
-
kayıt tahsisi ve qubit sınırları seçimden sonra da geçerlidir. İzleme modu bağımlı
|
|
102
|
-
`.nm` dosyaları ve manifest değişince yeniden çalışır. `--output` belirtilen rapor
|
|
103
|
-
dosyasını her çalıştırmada yeniler.
|
|
104
|
-
|
|
105
|
-
### Toolchain doctor / Araç zinciri kontrolü
|
|
106
|
-
|
|
107
|
-
The `0.3.0` CLI provides `nm doctor --json` and `nm doctor --locale tr`.
|
|
108
|
-
It compares the loaded CLI/Core and locally resolvable LSP/MCP packages, reporting
|
|
109
|
-
package, language and protocol versions separately. Missing optional packages and
|
|
110
|
-
the VS Code installation remain unobserved; this is not a check of running servers.
|
|
111
|
-
Exit code 1 means an observed mismatch or failed package probe; 0 may still mean
|
|
112
|
-
partial coverage. The report format is `nm-toolchain-doctor` version `0.1`.
|
|
113
|
-
|
|
114
|
-
Türkçe: `nm doctor` yüklenen CLI/Core ile yerelden çözümlenebilen LSP/MCP
|
|
115
|
-
paketlerini karşılaştırır. Paket, dil ve protokol sürümleri ayrı değerlendirilir.
|
|
116
|
-
Gözlenmeyen isteğe bağlı araçlar ve VS Code kurulumu doğrulanmış sayılmaz.
|
|
117
|
-
Çıkış kodu 1 uyuşmazlık veya paket sorgusu hatasıdır; 0 kısmi gözlem anlamına da
|
|
118
|
-
gelebilir. Bu komutlar `0.3.0` paketinin parçasıdır.
|
|
119
|
-
|
|
120
|
-
New CLI invocations enable the default language profile: classical functions,
|
|
121
|
-
typed values/Result, module visibility, parameter groups and compute/apply.
|
|
122
|
-
Use `--legacy-features` for the previous opt-in behavior. Other experimental
|
|
123
|
-
features still require their own flags; export/backend limits remain enforced.
|
|
124
|
-
|
|
125
|
-
Türkçe: Yeni CLI çağrılarında varsayılan dil profili açıktır. Eski davranış için
|
|
126
|
-
`--legacy-features` kullanın. Diğer deneysel özellikler ayrıca açılmalıdır.
|
|
127
|
-
|
|
128
|
-
- [CLI documentation](https://quantumsoftware.tech/en/docs/nm-language/cli)
|
|
129
|
-
- [Türkçe CLI rehberi](https://quantumsoftware.tech/tr/docs/nm-language/cli)
|
|
130
|
-
- [Support / Destek](https://quantumsoftware.tech/en/#contact)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1
|
+
# @nm-lang/cli
|
|
2
|
+
|
|
3
|
+
N/M 0.2.0 Preview command-line tools for running, formatting, linting, testing,
|
|
4
|
+
exporting and managing local N/M workspaces.
|
|
5
|
+
|
|
6
|
+
Package **0.4.0** targets the N/M **0.2.0** language contract.
|
|
7
|
+
|
|
8
|
+
## Install / Kurulum
|
|
9
|
+
|
|
10
|
+
Requires Node.js 20 or newer. Release checks use Node.js 22.23.1.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install --global @nm-lang/cli
|
|
14
|
+
nm --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or run without a global install:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx --package=@nm-lang/cli nm --version
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
An untagged install selects npm's `latest` channel. To pin this version,
|
|
24
|
+
append `@0.4.0` to the package name. The N/M language remains
|
|
25
|
+
Preview independently of the npm channel. npm installs the matching Core dependency.
|
|
26
|
+
No repository checkout or TypeScript build is needed to use a published package.
|
|
27
|
+
|
|
28
|
+
Türkçe: Etiketsiz kurulum npm'in `latest` kanalını seçer.
|
|
29
|
+
`@0.4.0` ile sürümü sabitleyebilirsiniz. N/M dili, npm kanalından bağımsız
|
|
30
|
+
olarak Önizleme durumundadır. Core bağımlılığı otomatik kurulur; depoyu
|
|
31
|
+
indirmeniz gerekmez.
|
|
32
|
+
|
|
33
|
+
## First program / İlk program
|
|
34
|
+
|
|
35
|
+
Save the following as `bell.nm`:
|
|
36
|
+
|
|
37
|
+
```nm
|
|
38
|
+
module npm_bell;
|
|
39
|
+
fn main() {
|
|
40
|
+
let q = qreg[2];
|
|
41
|
+
H(q[0]);
|
|
42
|
+
CNOT(q[0], q[1]);
|
|
43
|
+
let a = measure(q[0]);
|
|
44
|
+
let b = measure(q[1]);
|
|
45
|
+
return (a, b);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
nm run bell.nm --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The program creates and measures a Bell pair using a local simulator.
|
|
54
|
+
Türkçe: Kodu `bell.nm` olarak kaydedip komutla çalıştırın. Sonuç yerel
|
|
55
|
+
simülasyondan gelir; gerçek kuantum donanımı kanıtı değildir.
|
|
56
|
+
|
|
57
|
+
## Language options / Dil seçenekleri
|
|
58
|
+
|
|
59
|
+
### Selected tests and CI reports / Test seçimi ve CI raporları
|
|
60
|
+
|
|
61
|
+
The `0.3.0` package adds test selection, watch mode and JSON, JUnit and SARIF
|
|
62
|
+
reports for CI integrations.
|
|
63
|
+
|
|
64
|
+
Türkçe: `0.3.0` paketi test seçimini, izleme modunu ve CI entegrasyonları için
|
|
65
|
+
JSON, JUnit ve SARIF raporlarını içerir.
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
nm test main.nm --name "Bell contract" --json
|
|
69
|
+
nm test main.nm --id nmtest-0123456789abcdef
|
|
70
|
+
nm test main.nm --report-format junit --output results.xml
|
|
71
|
+
nm test main.nm --report-format sarif --output results.sarif
|
|
72
|
+
nm test main.nm --watch --json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`--name` matches the exact declared name; repeat `--name` or `--id` to select a
|
|
76
|
+
union. Copy real IDs from a JSON report for the same input path and source lines.
|
|
77
|
+
Selection happens before execution, preserving surrounding setup and original
|
|
78
|
+
source locations; unknown/stale IDs or names fail with `NM-TEST-SELECT-001`.
|
|
79
|
+
Direct selection of a nested check fails with `NM-TEST-SELECT-002`; select its
|
|
80
|
+
top-level enclosing check. Source syntax and capability validation still cover
|
|
81
|
+
the complete file, including its original register allocation and qubit limits.
|
|
82
|
+
Empty suites and failed execution exit 1.
|
|
83
|
+
|
|
84
|
+
`--report-format json|junit|sarif` writes that format to stdout. `--output` also
|
|
85
|
+
replaces the explicitly named `.json`, `.xml` or `.sarif` report on each run;
|
|
86
|
+
parent directories must already exist. The default output remains human readable.
|
|
87
|
+
`--json` cannot be combined with a non-JSON report format.
|
|
88
|
+
|
|
89
|
+
`--watch` is available in the Node command-line host. It runs immediately, then
|
|
90
|
+
debounces source and workspace-manifest changes, including imported modules,
|
|
91
|
+
clears the workspace cache and queues runs without overlap. Ctrl+C/SIGTERM closes
|
|
92
|
+
watchers. With `--json`, stdout is NDJSON: each `event:"run"` has a sequence,
|
|
93
|
+
exitCode, report (or null for invocation errors) and diagnostics; lifecycle errors
|
|
94
|
+
and stopping also have event objects. JUnit/SARIF watch mode requires `--output`
|
|
95
|
+
and prints run summaries while replacing the report file. The exit status follows
|
|
96
|
+
the latest run; signal termination uses 130/143.
|
|
97
|
+
|
|
98
|
+
Türkçe: Tam test adı veya mevcut rapordaki kimlikle seçim yapın; seçenekler
|
|
99
|
+
tekrarlanabilir. Seçilmeyen test blokları yürütülmez, ortak kurulum korunur.
|
|
100
|
+
İç içe kontrolleri doğrudan seçmek yerine üst kontrolü seçin. Kaynağın tamamındaki
|
|
101
|
+
kayıt tahsisi ve qubit sınırları seçimden sonra da geçerlidir. İzleme modu bağımlı
|
|
102
|
+
`.nm` dosyaları ve manifest değişince yeniden çalışır. `--output` belirtilen rapor
|
|
103
|
+
dosyasını her çalıştırmada yeniler.
|
|
104
|
+
|
|
105
|
+
### Toolchain doctor / Araç zinciri kontrolü
|
|
106
|
+
|
|
107
|
+
The `0.3.0` CLI provides `nm doctor --json` and `nm doctor --locale tr`.
|
|
108
|
+
It compares the loaded CLI/Core and locally resolvable LSP/MCP packages, reporting
|
|
109
|
+
package, language and protocol versions separately. Missing optional packages and
|
|
110
|
+
the VS Code installation remain unobserved; this is not a check of running servers.
|
|
111
|
+
Exit code 1 means an observed mismatch or failed package probe; 0 may still mean
|
|
112
|
+
partial coverage. The report format is `nm-toolchain-doctor` version `0.1`.
|
|
113
|
+
|
|
114
|
+
Türkçe: `nm doctor` yüklenen CLI/Core ile yerelden çözümlenebilen LSP/MCP
|
|
115
|
+
paketlerini karşılaştırır. Paket, dil ve protokol sürümleri ayrı değerlendirilir.
|
|
116
|
+
Gözlenmeyen isteğe bağlı araçlar ve VS Code kurulumu doğrulanmış sayılmaz.
|
|
117
|
+
Çıkış kodu 1 uyuşmazlık veya paket sorgusu hatasıdır; 0 kısmi gözlem anlamına da
|
|
118
|
+
gelebilir. Bu komutlar `0.3.0` paketinin parçasıdır.
|
|
119
|
+
|
|
120
|
+
New CLI invocations enable the default language profile: classical functions,
|
|
121
|
+
typed values/Result, module visibility, parameter groups and compute/apply.
|
|
122
|
+
Use `--legacy-features` for the previous opt-in behavior. Other experimental
|
|
123
|
+
features still require their own flags; export/backend limits remain enforced.
|
|
124
|
+
|
|
125
|
+
Türkçe: Yeni CLI çağrılarında varsayılan dil profili açıktır. Eski davranış için
|
|
126
|
+
`--legacy-features` kullanın. Diğer deneysel özellikler ayrıca açılmalıdır.
|
|
127
|
+
|
|
128
|
+
- [CLI documentation](https://quantumsoftware.tech/en/docs/nm-language/cli)
|
|
129
|
+
- [Türkçe CLI rehberi](https://quantumsoftware.tech/tr/docs/nm-language/cli)
|
|
130
|
+
- [Support / Destek](https://quantumsoftware.tech/en/#contact)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
## Hamiltonian 0.4.0 candidate / Hamiltonian 0.4.0 adayı
|
|
134
|
+
|
|
135
|
+
This unpublished 0.4.0 candidate includes Hamiltonian evolution and shared-shot
|
|
136
|
+
QWC expectations. Published npm 0.3.0 and earlier extension releases do not
|
|
137
|
+
include these additions.
|
|
138
|
+
Both `hamiltonianEvolution` and `measurementGrouping` require explicit permission.
|
|
139
|
+
Source printing and N/M IR v0.5 preserve original source, parser context, seed and
|
|
140
|
+
shot plans. Imports rebuild with caller permissions; stored flags never grant them.
|
|
141
|
+
QASM/framework export and source optimization/transpilation reject these semantics.
|
|
142
|
+
|
|
143
|
+
CLI: `--experimental-hamiltonian-evolution`, `--experimental-measurement-grouping`,
|
|
144
|
+
`--from-ir` for a saved v0.5 IR, `--locale en|tr` for diagnostics. MCP: the matching
|
|
145
|
+
`experimentalHamiltonianEvolution` / `experimentalMeasurementGrouping` booleans,
|
|
146
|
+
`nm_export` target `ir` and `nm_import_ir`. LSP initialization uses
|
|
147
|
+
`initializationOptions.nm.experimental`; VS Code uses
|
|
148
|
+
`nm.experimental.hamiltonianEvolution` / `nm.experimental.measurementGrouping`.
|
|
149
|
+
The editor offers completion/hover, closed-default diagnostics and original
|
|
150
|
+
source columns for generated gates in the recorded debugger.
|
|
151
|
+
|
|
152
|
+
Türkçe: Bunlar yayımlanmamış yerel geliştirmelerdir; iki yeni izin varsayılan
|
|
153
|
+
kapalıdır. Yazdırma/IR özgün kaynağı ve ortak ölçüm bütçesini korur; içe aktarım
|
|
154
|
+
kaydı çalıştırma yetkisi saymaz. CLI/MCP/LSP/Monaco/VS Code aynı izinleri taşır;
|
|
155
|
+
tanılar ve ayarlar TR/EN destekler. TR/EN laboratuvarı sitede erişilebilirdir;
|
|
156
|
+
yeni npm/eklenti paketinin yayını ayrı aşamadır.
|
|
157
|
+
|
|
158
|
+
## License / Lisans
|
|
159
|
+
|
|
160
|
+
Free personal, educational and commercial use; source-code rights are reserved.
|
|
161
|
+
Modification or redistribution of QuantumSoftware-owned package code requires
|
|
162
|
+
separate permission. Your N/M programs and results remain yours. See
|
|
163
|
+
[LICENSE.txt](./LICENSE.txt) and [NOTICE.txt](./NOTICE.txt).
|
|
164
|
+
|
|
165
|
+
Türkçe: Kullanım ücretsizdir; açık kaynak lisansı verilmez. Paket kodunu
|
|
166
|
+
değiştirme ve yeniden dağıtma için ayrıca izin gerekir.
|