any2orca 0.9.1 → 0.10.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/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/dist/cli/commands/convert.js +4 -8
- package/dist/cli/main.js +6 -49
- package/dist/cli/surface.d.ts +353 -0
- package/dist/cli/surface.js +73 -0
- package/dist/diff/settingLimits.d.ts +12 -0
- package/dist/diff/settingLimits.js +37 -0
- package/dist/diff/settingsCatalog.d.ts +12 -2
- package/dist/diff/settingsCatalog.js +18 -4
- package/dist/engine/applyFilamentComplianceMode.d.ts +9 -1
- package/dist/engine/applyFilamentComplianceMode.js +17 -5
- package/dist/engine/applyFilamentPresets.d.ts +29 -0
- package/dist/engine/applyFilamentPresets.js +84 -0
- package/dist/engine/buildProjectSettings.d.ts +3 -1
- package/dist/engine/buildProjectSettings.js +10 -6
- package/dist/engine/runConvertPipeline.d.ts +5 -0
- package/dist/engine/runConvertPipeline.js +32 -3
- package/dist/explain/filamentNotes.d.ts +7 -0
- package/dist/explain/filamentNotes.js +60 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/node.js +2 -1
- package/dist/presets/extractPreset.js +1 -1
- package/dist/presets/preset.d.ts +1 -1
- package/dist/presets/preset.js +15 -13
- package/dist/profiles.d.ts +32 -0
- package/dist/profiles.js +42 -4
- package/dist/project.d.ts +19 -0
- package/dist/project.js +5 -1
- package/dist/schema.d.ts +9 -0
- package/dist/schema.js +3 -0
- package/dist/sources/prusa/convertSettings.js +3 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# any2orca
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Output-affecting
|
|
6
|
+
|
|
7
|
+
- **The Snapmaker and Generic filament options set each filament to its preset's own settings, and every option keeps what the file says when Snapmaker Orca opens it.** Snapmaker Orca's app resets a filament whose name matches one of its presets to that preset's settings when it opens a project, while its command line uses the file's own values, so a relabeled file printed differently depending on how it was sliced (the creator's 225 °C in the file, Snapmaker's 220 °C in the app). Now a slot set to a Snapmaker or Generic preset takes that preset's own settings, standard and high-flow values and its start and end G-code included, from the profile catalog, so the file, the app and the command line agree; colors and order stay. `report.filamentPresets` lists each such slot and the creator's values it replaced, and the new `filamentNotes(report)` says it in words, the same sentences the web app and the CLI show. Original keeps the creator's filaments exactly, and every filament's list of changed settings now names every filament setting, so Snapmaker Orca keeps the creator's values even for a filament named like one of its presets. In the quick corpus, Original changes only that list (no setting's value); the Snapmaker option changes the filament settings of every project with a filament it renames. With a profile catalog that has no preset settings, the options change names only and say so.
|
|
8
|
+
|
|
9
|
+
### Other
|
|
10
|
+
|
|
11
|
+
- Pins any2orca-profiles 0.4.0.
|
|
12
|
+
|
|
13
|
+
## 0.9.2
|
|
14
|
+
|
|
15
|
+
### Fixes
|
|
16
|
+
|
|
17
|
+
- **A preset's values are checked against the Snapmaker Orca release it converts for.** The check used the strictest limits of every supported release together, so a value the chosen release accepts could be left out: a raft initial layer expansion of -1 (2.4.1's own stock value) or a bridge density above 100% when converting for 2.4.1. Each release's own limits now apply; a PrusaSlicer project, read before a release is chosen, is still checked against what every supported release accepts. Converted files don't change.
|
|
18
|
+
|
|
3
19
|
## 0.9.1
|
|
4
20
|
|
|
5
21
|
### Other
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Useful options:
|
|
|
21
21
|
| `--snapmaker-orca-version <x.y.z>` | Convert for the Snapmaker Orca release you slice with (default: the newest) |
|
|
22
22
|
| `--high-flow`, `--high-flow-toolheads 1,3` | All toolheads, or only these, have the Liber High Flow Hotend |
|
|
23
23
|
| `--hardened-nozzle` | Your nozzles are hardened steel instead of the stock stainless 0.4 |
|
|
24
|
-
| `--filament-compliance generic\|snapmaker` |
|
|
24
|
+
| `--filament-compliance generic\|snapmaker` | Set filaments to Snapmaker or Generic presets, with their own settings, for Snapmaker Space |
|
|
25
25
|
| `--dry-run` | Show what would happen, without writing files |
|
|
26
26
|
| `--watch <folder>` | Convert each new file that appears in a folder |
|
|
27
27
|
| `--archive-dir <dir>`, `--skip-existing` | For batches: move finished originals away, or skip files already converted |
|
|
@@ -35,7 +35,7 @@ The full reference, with exit codes, the state file and `telemetry`, is in [`doc
|
|
|
35
35
|
|
|
36
36
|
Every exported function and type is in the [API reference](https://docs.any2orca.com). The common paths:
|
|
37
37
|
|
|
38
|
-
What stays stable: everything the library exports is supported, and a release only adds to it. A new option is optional, a result can gain fields, and a list of values the library returns (a source maker, an error code, a change reason, a conversion stage, a diff status) can gain values, so handle one you don't recognize; each list's known values are exported next to its type, for example `SOURCE_VENDORS` beside `SourceVendor`. A file format (the output stamp, a presets file, the profile catalog, the stats event) changes shape only with a new version number, and older ones keep being read. Nothing is removed or renamed outside a major release, and only after a deprecation notice. The same holds for the CLI's commands, flags, exit codes and JSON output, and for the partner hand-off.
|
|
38
|
+
What stays stable: everything the library exports is supported, and a release only adds to it. A new option is optional, a result can gain fields, an interface you implement yourself (such as `ProfileSource`) only gains optional members, and a list of values the library returns (a source maker, an error code, a change reason, a conversion stage, a diff status) can gain values, so handle one you don't recognize; each list's known values are exported next to its type, for example `SOURCE_VENDORS` beside `SourceVendor`. A file format (the output stamp, a presets file, the profile catalog, the stats event) changes shape only with a new version number, and older ones keep being read. Nothing is removed or renamed outside a major release, and only after a deprecation notice. The same holds for the CLI's commands, flags, exit codes and JSON output, and for the partner hand-off. Checks in CI compare the API's shape, and the CLI's commands and options, with committed records, so a change to either is deliberate.
|
|
39
39
|
|
|
40
40
|
Every filament in the source stays in the output: all of them, with their colors, brands, types and order, however many. The U1 loads four at a time, but a project can use many more, swapped in at the pauses the user plans in Snapmaker Orca, and that planning depends on the file's own order. `report.filaments` lists each slot with the name it had and the name it has. The model's own metadata in `3D/3dmodel.model` (designer, license, copyright, title, description) stays as it was; only `Application` changes, to the Snapmaker Orca release the file is made for.
|
|
41
41
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { existsSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
4
4
|
import { Any2orcaError } from "../../errors.js";
|
|
5
|
+
import { filamentNotes } from "../../explain/filamentNotes.js";
|
|
5
6
|
import { formatWhatChanged } from "../../explain/whatChanged.js";
|
|
6
7
|
import { openProject, unwrapBundle } from "../../project.js";
|
|
7
8
|
import { archiveOriginal } from "../archiveMove.js";
|
|
@@ -69,14 +70,9 @@ function logReport(report, verbose, logger) {
|
|
|
69
70
|
for (const c of report.preset.changes)
|
|
70
71
|
logger.log(` preset: ${c.key} ${c.stock} -> ${c.yours}${c.aboveStock ? " (above stock)" : ""}`);
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
logger.log(` note:
|
|
75
|
-
}
|
|
76
|
-
const unchanged = report.filamentComplianceUnchanged ?? [];
|
|
77
|
-
if (unchanged.length > 0) {
|
|
78
|
-
logger.log(` note: no Snapmaker or Generic preset fits ${unchanged.join(", ")} at this nozzle size, so ${unchanged.length === 1 ? "its name stays" : "those names stay"} as the creator had ${unchanged.length === 1 ? "it" : "them"}.`);
|
|
79
|
-
}
|
|
73
|
+
// The same sentences the web app shows (filamentNotes).
|
|
74
|
+
for (const note of filamentNotes(report))
|
|
75
|
+
logger.log(` note: ${note}`);
|
|
80
76
|
for (const w of report.warnings)
|
|
81
77
|
logger.log(` warning: ${w}`);
|
|
82
78
|
if (report.retiredProfile)
|
package/dist/cli/main.js
CHANGED
|
@@ -8,6 +8,7 @@ import { loadCatalog } from "../profiles.js";
|
|
|
8
8
|
import { VERSION } from "../version.js";
|
|
9
9
|
import { MAX_UNPACKED_BYTES_LIMIT } from "../archive/safeUnzip.js";
|
|
10
10
|
import { runConvert, runWatch } from "./commands/convert.js";
|
|
11
|
+
import { CONVERT_OPTIONS, DIFF_OPTIONS, PRESETS_OPTIONS, PROFILES_OPTIONS } from "./surface.js";
|
|
11
12
|
import { runDiff } from "./commands/diff.js";
|
|
12
13
|
import { presetForConvert, presetForDiff, runPresetsAdd, runPresetsExport, runPresetsImport, runPresetsList, runPresetsRemove, runPresetsShow, } from "./commands/presets.js";
|
|
13
14
|
import { resolveAboveStockChoice } from "../engine/aboveStock.js";
|
|
@@ -185,7 +186,7 @@ ${formatOptions([
|
|
|
185
186
|
["--keep <setting,...>", "A --preset file: keep only these settings above stock; the rest use stock"],
|
|
186
187
|
["--use-stock <setting,...>", "Use Snapmaker's stock value for these settings instead of the creator's faster one (print speeds, e.g. outer_wall_speed)"],
|
|
187
188
|
["--keep-higher <setting,...>", "Keep the creator's value for these settings even when higher than stock (accelerations, travel speed, filament_max_volumetric_speed). The U1's machine limits still apply"],
|
|
188
|
-
["--filament-compliance <mode>", '"generic" or "snapmaker":
|
|
189
|
+
["--filament-compliance <mode>", '"generic" or "snapmaker": set each filament to a preset Snapmaker Orca ships, with that preset\'s own settings, for marketplace uploads (e.g. Snapmaker Space); colors and order stay. Omit to keep the creator\'s filaments, names and settings'],
|
|
189
190
|
["--high-flow", "All four toolheads have the Snapmaker Liber High Flow Hotend. The converted file records it, so Snapmaker Orca matches your printer; colors you put on a high-flow nozzle when slicing use Snapmaker's high-flow speeds on profiles that have them (today only 0.20mm Standard, 0.4mm nozzle). Gains are largest on big prints with long, continuous paths. Ignored, with a note, on nozzle sizes with no high-flow option"],
|
|
190
191
|
["--high-flow-toolheads <list>", "Only these toolheads have the Liber hotend, numbered 1 to 4, e.g. 1 or 1,3. Otherwise the same as --high-flow; use one or the other"],
|
|
191
192
|
["--hardened-nozzle", "Your U1 has hardened steel nozzles instead of the stock stainless steel 0.4. The file records it, so Snapmaker Orca warns about abrasive filaments correctly. Only changes 0.4 nozzle conversions; Snapmaker's other sizes are hardened steel already"],
|
|
@@ -280,15 +281,7 @@ async function runCommand(command, rest, io) {
|
|
|
280
281
|
const { values, positionals } = parseArgs({
|
|
281
282
|
args,
|
|
282
283
|
allowPositionals: true,
|
|
283
|
-
options:
|
|
284
|
-
group: { type: "string", multiple: true },
|
|
285
|
-
all: { type: "boolean", default: false },
|
|
286
|
-
sort: { type: "string" },
|
|
287
|
-
json: { type: "boolean", default: false },
|
|
288
|
-
"profiles-dir": { type: "string" },
|
|
289
|
-
"snapmaker-orca-version": { type: "string" },
|
|
290
|
-
"against-preset": { type: "string" },
|
|
291
|
-
},
|
|
284
|
+
options: DIFF_OPTIONS,
|
|
292
285
|
});
|
|
293
286
|
const againstPreset = values["against-preset"] !== undefined ? presetForDiff(values["against-preset"], io.env) : undefined;
|
|
294
287
|
const allowed = ["print", "filament", "machine", "other"];
|
|
@@ -316,15 +309,7 @@ async function runCommand(command, rest, io) {
|
|
|
316
309
|
const { values, positionals } = parseArgs({
|
|
317
310
|
args,
|
|
318
311
|
allowPositionals: true,
|
|
319
|
-
options:
|
|
320
|
-
"above-stock": { type: "string" },
|
|
321
|
-
keep: { type: "string", multiple: true },
|
|
322
|
-
force: { type: "boolean", default: false },
|
|
323
|
-
json: { type: "boolean", default: false },
|
|
324
|
-
out: { type: "string" },
|
|
325
|
-
"profiles-dir": { type: "string" },
|
|
326
|
-
"snapmaker-orca-version": { type: "string" },
|
|
327
|
-
},
|
|
312
|
+
options: PRESETS_OPTIONS,
|
|
328
313
|
});
|
|
329
314
|
const options = {
|
|
330
315
|
env: io.env,
|
|
@@ -367,7 +352,7 @@ async function runCommand(command, rest, io) {
|
|
|
367
352
|
}
|
|
368
353
|
const { values } = parseArgs({
|
|
369
354
|
args: rest,
|
|
370
|
-
options:
|
|
355
|
+
options: PROFILES_OPTIONS,
|
|
371
356
|
});
|
|
372
357
|
const top = await openCatalog(values["profiles-dir"]);
|
|
373
358
|
runProfiles(await top.forRelease(values["snapmaker-orca-version"] ?? top.index.slicer.version), values.nozzle, io.out, top.releases());
|
|
@@ -399,35 +384,7 @@ async function runCommand(command, rest, io) {
|
|
|
399
384
|
const { values, positionals } = parseArgs({
|
|
400
385
|
args: rest,
|
|
401
386
|
allowPositionals: true,
|
|
402
|
-
options:
|
|
403
|
-
profile: { type: "string" },
|
|
404
|
-
preset: { type: "string" },
|
|
405
|
-
"above-stock": { type: "string" },
|
|
406
|
-
keep: { type: "string", multiple: true },
|
|
407
|
-
"use-stock": { type: "string", multiple: true },
|
|
408
|
-
"keep-higher": { type: "string", multiple: true },
|
|
409
|
-
"filament-compliance": { type: "string" },
|
|
410
|
-
"high-flow": { type: "boolean", default: false },
|
|
411
|
-
"high-flow-toolheads": { type: "string" },
|
|
412
|
-
"hardened-nozzle": { type: "boolean", default: false },
|
|
413
|
-
"no-stamp": { type: "boolean", default: false },
|
|
414
|
-
"max-unpacked": { type: "string" },
|
|
415
|
-
explain: { type: "boolean", default: false },
|
|
416
|
-
"explain-json": { type: "boolean", default: false },
|
|
417
|
-
"out-dir": { type: "string" },
|
|
418
|
-
suffix: { type: "string", default: "_U1" },
|
|
419
|
-
"dry-run": { type: "boolean", default: false },
|
|
420
|
-
verbose: { type: "boolean", default: false },
|
|
421
|
-
"skip-existing": { type: "boolean", default: false },
|
|
422
|
-
watch: { type: "string" },
|
|
423
|
-
"archive-dir": { type: "string" },
|
|
424
|
-
"log-file": { type: "string" },
|
|
425
|
-
quiet: { type: "boolean", default: false },
|
|
426
|
-
"profiles-dir": { type: "string" },
|
|
427
|
-
"snapmaker-orca-version": { type: "string" },
|
|
428
|
-
"dry-run-telemetry": { type: "boolean", default: false },
|
|
429
|
-
"stats-endpoint": { type: "string" },
|
|
430
|
-
},
|
|
387
|
+
options: CONVERT_OPTIONS,
|
|
431
388
|
});
|
|
432
389
|
if (values.watch !== undefined && positionals.length > 0) {
|
|
433
390
|
throw new Error("--watch takes no file arguments; pass the folder to watch as --watch <dir> (see: any2orca convert --help)");
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command line's surface: its commands, subcommands and every option each one accepts. The parser in
|
|
3
|
+
* main.ts reads its options from here, and `cliSurface.test.ts` records the whole table (with the environment
|
|
4
|
+
* variables the CLI reads) in `etc/cli-surface.json`, so a change to what the CLI accepts is deliberate.
|
|
5
|
+
*
|
|
6
|
+
* The surface only grows: add a command, subcommand or option; never rename or remove one outside a major
|
|
7
|
+
* release, and deprecate it first (it keeps working, prints a notice naming its replacement, and is documented).
|
|
8
|
+
*/
|
|
9
|
+
export declare const DIFF_OPTIONS: {
|
|
10
|
+
readonly "against-preset": {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
};
|
|
13
|
+
readonly "profiles-dir": {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
};
|
|
16
|
+
readonly "snapmaker-orca-version": {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly group: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
readonly multiple: true;
|
|
22
|
+
};
|
|
23
|
+
readonly all: {
|
|
24
|
+
readonly type: "boolean";
|
|
25
|
+
readonly default: false;
|
|
26
|
+
};
|
|
27
|
+
readonly sort: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
};
|
|
30
|
+
readonly json: {
|
|
31
|
+
readonly type: "boolean";
|
|
32
|
+
readonly default: false;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare const PRESETS_OPTIONS: {
|
|
36
|
+
readonly "profiles-dir": {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
};
|
|
39
|
+
readonly "snapmaker-orca-version": {
|
|
40
|
+
readonly type: "string";
|
|
41
|
+
};
|
|
42
|
+
readonly "above-stock": {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
};
|
|
45
|
+
readonly keep: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly multiple: true;
|
|
48
|
+
};
|
|
49
|
+
readonly force: {
|
|
50
|
+
readonly type: "boolean";
|
|
51
|
+
readonly default: false;
|
|
52
|
+
};
|
|
53
|
+
readonly json: {
|
|
54
|
+
readonly type: "boolean";
|
|
55
|
+
readonly default: false;
|
|
56
|
+
};
|
|
57
|
+
readonly out: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare const PROFILES_OPTIONS: {
|
|
62
|
+
readonly "profiles-dir": {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
};
|
|
65
|
+
readonly "snapmaker-orca-version": {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
readonly nozzle: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare const CONVERT_OPTIONS: {
|
|
73
|
+
readonly "dry-run-telemetry": {
|
|
74
|
+
readonly type: "boolean";
|
|
75
|
+
readonly default: false;
|
|
76
|
+
};
|
|
77
|
+
readonly "stats-endpoint": {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
};
|
|
80
|
+
readonly "profiles-dir": {
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
};
|
|
83
|
+
readonly "snapmaker-orca-version": {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
};
|
|
86
|
+
readonly profile: {
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
};
|
|
89
|
+
readonly preset: {
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
};
|
|
92
|
+
readonly "above-stock": {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
};
|
|
95
|
+
readonly keep: {
|
|
96
|
+
readonly type: "string";
|
|
97
|
+
readonly multiple: true;
|
|
98
|
+
};
|
|
99
|
+
readonly "use-stock": {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
readonly multiple: true;
|
|
102
|
+
};
|
|
103
|
+
readonly "keep-higher": {
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
readonly multiple: true;
|
|
106
|
+
};
|
|
107
|
+
readonly "filament-compliance": {
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
};
|
|
110
|
+
readonly "high-flow": {
|
|
111
|
+
readonly type: "boolean";
|
|
112
|
+
readonly default: false;
|
|
113
|
+
};
|
|
114
|
+
readonly "high-flow-toolheads": {
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
};
|
|
117
|
+
readonly "hardened-nozzle": {
|
|
118
|
+
readonly type: "boolean";
|
|
119
|
+
readonly default: false;
|
|
120
|
+
};
|
|
121
|
+
readonly "no-stamp": {
|
|
122
|
+
readonly type: "boolean";
|
|
123
|
+
readonly default: false;
|
|
124
|
+
};
|
|
125
|
+
readonly "max-unpacked": {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
};
|
|
128
|
+
readonly explain: {
|
|
129
|
+
readonly type: "boolean";
|
|
130
|
+
readonly default: false;
|
|
131
|
+
};
|
|
132
|
+
readonly "explain-json": {
|
|
133
|
+
readonly type: "boolean";
|
|
134
|
+
readonly default: false;
|
|
135
|
+
};
|
|
136
|
+
readonly "out-dir": {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
};
|
|
139
|
+
readonly suffix: {
|
|
140
|
+
readonly type: "string";
|
|
141
|
+
readonly default: "_U1";
|
|
142
|
+
};
|
|
143
|
+
readonly "dry-run": {
|
|
144
|
+
readonly type: "boolean";
|
|
145
|
+
readonly default: false;
|
|
146
|
+
};
|
|
147
|
+
readonly verbose: {
|
|
148
|
+
readonly type: "boolean";
|
|
149
|
+
readonly default: false;
|
|
150
|
+
};
|
|
151
|
+
readonly "skip-existing": {
|
|
152
|
+
readonly type: "boolean";
|
|
153
|
+
readonly default: false;
|
|
154
|
+
};
|
|
155
|
+
readonly watch: {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
};
|
|
158
|
+
readonly "archive-dir": {
|
|
159
|
+
readonly type: "string";
|
|
160
|
+
};
|
|
161
|
+
readonly "log-file": {
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
};
|
|
164
|
+
readonly quiet: {
|
|
165
|
+
readonly type: "boolean";
|
|
166
|
+
readonly default: false;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
/** Every command, the words it takes after it, and its options; main.ts dispatches on these names. */
|
|
170
|
+
export declare const CLI_SURFACE: {
|
|
171
|
+
readonly topLevel: readonly ["help", "--help", "-h", "version", "--version", "-v"];
|
|
172
|
+
readonly commands: {
|
|
173
|
+
readonly convert: {
|
|
174
|
+
readonly positionals: "<files...>";
|
|
175
|
+
readonly options: {
|
|
176
|
+
readonly "dry-run-telemetry": {
|
|
177
|
+
readonly type: "boolean";
|
|
178
|
+
readonly default: false;
|
|
179
|
+
};
|
|
180
|
+
readonly "stats-endpoint": {
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
};
|
|
183
|
+
readonly "profiles-dir": {
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
};
|
|
186
|
+
readonly "snapmaker-orca-version": {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
};
|
|
189
|
+
readonly profile: {
|
|
190
|
+
readonly type: "string";
|
|
191
|
+
};
|
|
192
|
+
readonly preset: {
|
|
193
|
+
readonly type: "string";
|
|
194
|
+
};
|
|
195
|
+
readonly "above-stock": {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
};
|
|
198
|
+
readonly keep: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
readonly multiple: true;
|
|
201
|
+
};
|
|
202
|
+
readonly "use-stock": {
|
|
203
|
+
readonly type: "string";
|
|
204
|
+
readonly multiple: true;
|
|
205
|
+
};
|
|
206
|
+
readonly "keep-higher": {
|
|
207
|
+
readonly type: "string";
|
|
208
|
+
readonly multiple: true;
|
|
209
|
+
};
|
|
210
|
+
readonly "filament-compliance": {
|
|
211
|
+
readonly type: "string";
|
|
212
|
+
};
|
|
213
|
+
readonly "high-flow": {
|
|
214
|
+
readonly type: "boolean";
|
|
215
|
+
readonly default: false;
|
|
216
|
+
};
|
|
217
|
+
readonly "high-flow-toolheads": {
|
|
218
|
+
readonly type: "string";
|
|
219
|
+
};
|
|
220
|
+
readonly "hardened-nozzle": {
|
|
221
|
+
readonly type: "boolean";
|
|
222
|
+
readonly default: false;
|
|
223
|
+
};
|
|
224
|
+
readonly "no-stamp": {
|
|
225
|
+
readonly type: "boolean";
|
|
226
|
+
readonly default: false;
|
|
227
|
+
};
|
|
228
|
+
readonly "max-unpacked": {
|
|
229
|
+
readonly type: "string";
|
|
230
|
+
};
|
|
231
|
+
readonly explain: {
|
|
232
|
+
readonly type: "boolean";
|
|
233
|
+
readonly default: false;
|
|
234
|
+
};
|
|
235
|
+
readonly "explain-json": {
|
|
236
|
+
readonly type: "boolean";
|
|
237
|
+
readonly default: false;
|
|
238
|
+
};
|
|
239
|
+
readonly "out-dir": {
|
|
240
|
+
readonly type: "string";
|
|
241
|
+
};
|
|
242
|
+
readonly suffix: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
readonly default: "_U1";
|
|
245
|
+
};
|
|
246
|
+
readonly "dry-run": {
|
|
247
|
+
readonly type: "boolean";
|
|
248
|
+
readonly default: false;
|
|
249
|
+
};
|
|
250
|
+
readonly verbose: {
|
|
251
|
+
readonly type: "boolean";
|
|
252
|
+
readonly default: false;
|
|
253
|
+
};
|
|
254
|
+
readonly "skip-existing": {
|
|
255
|
+
readonly type: "boolean";
|
|
256
|
+
readonly default: false;
|
|
257
|
+
};
|
|
258
|
+
readonly watch: {
|
|
259
|
+
readonly type: "string";
|
|
260
|
+
};
|
|
261
|
+
readonly "archive-dir": {
|
|
262
|
+
readonly type: "string";
|
|
263
|
+
};
|
|
264
|
+
readonly "log-file": {
|
|
265
|
+
readonly type: "string";
|
|
266
|
+
};
|
|
267
|
+
readonly quiet: {
|
|
268
|
+
readonly type: "boolean";
|
|
269
|
+
readonly default: false;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
readonly diff: {
|
|
274
|
+
readonly positionals: "<a.3mf> [<b.3mf>]";
|
|
275
|
+
readonly options: {
|
|
276
|
+
readonly "against-stock": {
|
|
277
|
+
readonly type: "string";
|
|
278
|
+
readonly optionalValue: true;
|
|
279
|
+
};
|
|
280
|
+
readonly "against-preset": {
|
|
281
|
+
readonly type: "string";
|
|
282
|
+
};
|
|
283
|
+
readonly "profiles-dir": {
|
|
284
|
+
readonly type: "string";
|
|
285
|
+
};
|
|
286
|
+
readonly "snapmaker-orca-version": {
|
|
287
|
+
readonly type: "string";
|
|
288
|
+
};
|
|
289
|
+
readonly group: {
|
|
290
|
+
readonly type: "string";
|
|
291
|
+
readonly multiple: true;
|
|
292
|
+
};
|
|
293
|
+
readonly all: {
|
|
294
|
+
readonly type: "boolean";
|
|
295
|
+
readonly default: false;
|
|
296
|
+
};
|
|
297
|
+
readonly sort: {
|
|
298
|
+
readonly type: "string";
|
|
299
|
+
};
|
|
300
|
+
readonly json: {
|
|
301
|
+
readonly type: "boolean";
|
|
302
|
+
readonly default: false;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
readonly presets: {
|
|
307
|
+
readonly subcommands: readonly ["add", "list", "show", "remove", "export", "import"];
|
|
308
|
+
readonly options: {
|
|
309
|
+
readonly "profiles-dir": {
|
|
310
|
+
readonly type: "string";
|
|
311
|
+
};
|
|
312
|
+
readonly "snapmaker-orca-version": {
|
|
313
|
+
readonly type: "string";
|
|
314
|
+
};
|
|
315
|
+
readonly "above-stock": {
|
|
316
|
+
readonly type: "string";
|
|
317
|
+
};
|
|
318
|
+
readonly keep: {
|
|
319
|
+
readonly type: "string";
|
|
320
|
+
readonly multiple: true;
|
|
321
|
+
};
|
|
322
|
+
readonly force: {
|
|
323
|
+
readonly type: "boolean";
|
|
324
|
+
readonly default: false;
|
|
325
|
+
};
|
|
326
|
+
readonly json: {
|
|
327
|
+
readonly type: "boolean";
|
|
328
|
+
readonly default: false;
|
|
329
|
+
};
|
|
330
|
+
readonly out: {
|
|
331
|
+
readonly type: "string";
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
readonly profiles: {
|
|
336
|
+
readonly options: {
|
|
337
|
+
readonly "profiles-dir": {
|
|
338
|
+
readonly type: "string";
|
|
339
|
+
};
|
|
340
|
+
readonly "snapmaker-orca-version": {
|
|
341
|
+
readonly type: "string";
|
|
342
|
+
};
|
|
343
|
+
readonly nozzle: {
|
|
344
|
+
readonly type: "string";
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
readonly telemetry: {
|
|
349
|
+
readonly subcommands: readonly ["show", "on", "off", "clear", "update-check on", "update-check off"];
|
|
350
|
+
readonly options: {};
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* The command line's surface: its commands, subcommands and every option each one accepts. The parser in
|
|
4
|
+
* main.ts reads its options from here, and `cliSurface.test.ts` records the whole table (with the environment
|
|
5
|
+
* variables the CLI reads) in `etc/cli-surface.json`, so a change to what the CLI accepts is deliberate.
|
|
6
|
+
*
|
|
7
|
+
* The surface only grows: add a command, subcommand or option; never rename or remove one outside a major
|
|
8
|
+
* release, and deprecate it first (it keeps working, prints a notice naming its replacement, and is documented).
|
|
9
|
+
*/
|
|
10
|
+
const PROFILE_OPTIONS = {
|
|
11
|
+
"profiles-dir": { type: "string" },
|
|
12
|
+
"snapmaker-orca-version": { type: "string" },
|
|
13
|
+
};
|
|
14
|
+
export const DIFF_OPTIONS = {
|
|
15
|
+
group: { type: "string", multiple: true },
|
|
16
|
+
all: { type: "boolean", default: false },
|
|
17
|
+
sort: { type: "string" },
|
|
18
|
+
json: { type: "boolean", default: false },
|
|
19
|
+
...PROFILE_OPTIONS,
|
|
20
|
+
"against-preset": { type: "string" },
|
|
21
|
+
};
|
|
22
|
+
export const PRESETS_OPTIONS = {
|
|
23
|
+
"above-stock": { type: "string" },
|
|
24
|
+
keep: { type: "string", multiple: true },
|
|
25
|
+
force: { type: "boolean", default: false },
|
|
26
|
+
json: { type: "boolean", default: false },
|
|
27
|
+
out: { type: "string" },
|
|
28
|
+
...PROFILE_OPTIONS,
|
|
29
|
+
};
|
|
30
|
+
export const PROFILES_OPTIONS = {
|
|
31
|
+
nozzle: { type: "string" },
|
|
32
|
+
...PROFILE_OPTIONS,
|
|
33
|
+
};
|
|
34
|
+
export const CONVERT_OPTIONS = {
|
|
35
|
+
profile: { type: "string" },
|
|
36
|
+
preset: { type: "string" },
|
|
37
|
+
"above-stock": { type: "string" },
|
|
38
|
+
keep: { type: "string", multiple: true },
|
|
39
|
+
"use-stock": { type: "string", multiple: true },
|
|
40
|
+
"keep-higher": { type: "string", multiple: true },
|
|
41
|
+
"filament-compliance": { type: "string" },
|
|
42
|
+
"high-flow": { type: "boolean", default: false },
|
|
43
|
+
"high-flow-toolheads": { type: "string" },
|
|
44
|
+
"hardened-nozzle": { type: "boolean", default: false },
|
|
45
|
+
"no-stamp": { type: "boolean", default: false },
|
|
46
|
+
"max-unpacked": { type: "string" },
|
|
47
|
+
explain: { type: "boolean", default: false },
|
|
48
|
+
"explain-json": { type: "boolean", default: false },
|
|
49
|
+
"out-dir": { type: "string" },
|
|
50
|
+
suffix: { type: "string", default: "_U1" },
|
|
51
|
+
"dry-run": { type: "boolean", default: false },
|
|
52
|
+
verbose: { type: "boolean", default: false },
|
|
53
|
+
"skip-existing": { type: "boolean", default: false },
|
|
54
|
+
watch: { type: "string" },
|
|
55
|
+
"archive-dir": { type: "string" },
|
|
56
|
+
"log-file": { type: "string" },
|
|
57
|
+
quiet: { type: "boolean", default: false },
|
|
58
|
+
...PROFILE_OPTIONS,
|
|
59
|
+
"dry-run-telemetry": { type: "boolean", default: false },
|
|
60
|
+
"stats-endpoint": { type: "string" },
|
|
61
|
+
};
|
|
62
|
+
/** Every command, the words it takes after it, and its options; main.ts dispatches on these names. */
|
|
63
|
+
export const CLI_SURFACE = {
|
|
64
|
+
topLevel: ["help", "--help", "-h", "version", "--version", "-v"],
|
|
65
|
+
commands: {
|
|
66
|
+
convert: { positionals: "<files...>", options: CONVERT_OPTIONS },
|
|
67
|
+
// --against-stock takes an optional value, so main.ts reads it before parseArgs.
|
|
68
|
+
diff: { positionals: "<a.3mf> [<b.3mf>]", options: { ...DIFF_OPTIONS, "against-stock": { type: "string", optionalValue: true } } },
|
|
69
|
+
presets: { subcommands: ["add", "list", "show", "remove", "export", "import"], options: PRESETS_OPTIONS },
|
|
70
|
+
profiles: { options: PROFILES_OPTIONS },
|
|
71
|
+
telemetry: { subcommands: ["show", "on", "off", "clear", "update-check on", "update-check off"], options: {} },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A setting's limits and choices: what Snapmaker Orca accepts for it. */
|
|
2
|
+
export interface SettingLimits {
|
|
3
|
+
readonly min: number | null;
|
|
4
|
+
readonly max: number | null;
|
|
5
|
+
readonly choices: readonly string[] | null;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* What Snapmaker Orca accepts for a setting: for the release given, or, with none, what every supported
|
|
9
|
+
* release accepts (the higher minimum, the lower maximum, the choices they share), for a check made before the
|
|
10
|
+
* release is known, such as reading a PrusaSlicer project. Undefined for a key Snapmaker Orca doesn't have.
|
|
11
|
+
*/
|
|
12
|
+
export declare function settingLimits(key: string, release?: string): SettingLimits | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
import { OLDER_RELEASE_LIMITS, SETTINGS_CATALOG } from "./settingsCatalog.js";
|
|
3
|
+
function forOlderRelease(key, release) {
|
|
4
|
+
if (!Object.hasOwn(OLDER_RELEASE_LIMITS, release) || !Object.hasOwn(OLDER_RELEASE_LIMITS[release], key))
|
|
5
|
+
return undefined;
|
|
6
|
+
const newest = SETTINGS_CATALOG[key];
|
|
7
|
+
const d = OLDER_RELEASE_LIMITS[release][key];
|
|
8
|
+
return {
|
|
9
|
+
min: "min" in d ? (d.min ?? null) : newest.min,
|
|
10
|
+
max: "max" in d ? (d.max ?? null) : newest.max,
|
|
11
|
+
choices: "choices" in d ? (d.choices ?? null) : newest.choices,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What Snapmaker Orca accepts for a setting: for the release given, or, with none, what every supported
|
|
16
|
+
* release accepts (the higher minimum, the lower maximum, the choices they share), for a check made before the
|
|
17
|
+
* release is known, such as reading a PrusaSlicer project. Undefined for a key Snapmaker Orca doesn't have.
|
|
18
|
+
*/
|
|
19
|
+
export function settingLimits(key, release) {
|
|
20
|
+
if (!Object.hasOwn(SETTINGS_CATALOG, key))
|
|
21
|
+
return undefined;
|
|
22
|
+
const { min, max, choices } = SETTINGS_CATALOG[key];
|
|
23
|
+
if (release !== undefined)
|
|
24
|
+
return forOlderRelease(key, release) ?? { min, max, choices };
|
|
25
|
+
let out = { min, max, choices };
|
|
26
|
+
for (const older of Object.keys(OLDER_RELEASE_LIMITS)) {
|
|
27
|
+
const o = forOlderRelease(key, older);
|
|
28
|
+
if (!o)
|
|
29
|
+
continue;
|
|
30
|
+
out = {
|
|
31
|
+
min: o.min === null ? out.min : out.min === null ? o.min : Math.max(out.min, o.min),
|
|
32
|
+
max: o.max === null ? out.max : out.max === null ? o.max : Math.min(out.max, o.max),
|
|
33
|
+
choices: o.choices === null ? out.choices : out.choices === null ? o.choices : out.choices.filter((c) => o.choices.includes(c)),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|