spine-parts 2.40.0 → 2.42.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
@@ -329,6 +329,7 @@ Command details and config saving are in the [command reference](docs/AUTHORING.
329
329
  | `layers` | [Inspect wrapper layers or a PSD](docs/AUTHORING.md#command-reference) |
330
330
  | `sheet` | [Make a contact sheet](docs/AUTHORING.md#command-reference) |
331
331
  | `assemble` | [Merge layers into measured parts](docs/AUTHORING.md#command-reference) |
332
+ | `edited-part` | [Record an edited part receipt](docs/AUTHORING.md#edited-rig-space-parts-assembleedited_parts-issue-1278) |
332
333
  | `propose` | [Draft or inspect a character config](docs/AUTHORING.md#command-reference) |
333
334
  | `compare` | [Compare two skeletons by name](docs/AUTHORING.md#command-reference) |
334
335
  | `rig` | [Author gated rig and motion specs](docs/AUTHORING.md#command-reference) |
package/cli.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { diffComponentsCommand } from './src/diffcomponents.ts';
3
3
  import { applyTakenLayers } from './src/takelayers.ts';
4
4
  import { applyDepth, bindDepthMap, prepareDepth } from './src/depthworkflow.ts';
5
+ import { writeEditedPart } from './tools/edited-part-cli.ts';
5
6
  /**
6
7
  * rig-parts — one painting and its See-through layers in, Spine-ready parts
7
8
  * and rig specs out, verified through rig-c.
@@ -23,7 +24,7 @@ import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarme
23
24
  import { proposeNeck } from './tools/neck-propose.ts';
24
25
  import { parseAltArg } from './tools/alternate-cli.ts';
25
26
  import { type AlternateCliInput, assembleStage, build, checkStage, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
26
- import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
27
+ import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK_PAGE_SIZE, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
27
28
  import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
28
29
  import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
29
30
  import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loadPaintConfig } from './src/config.ts';
@@ -73,6 +74,10 @@ const LATER: ReadonlyArray<[string, string]> = [];
73
74
  const HELP = `rig-parts ${version()} — Spine-ready parts from one painting and its See-through layers
74
75
 
75
76
  usage:
77
+ rig-parts edited-part --config <config.json> --part <name> --file <edited.png> --from <assembled.png> --editor <text> [--rig-config <config.json>]
78
+ Record both file hashes and the declared editor in one edited_parts receipt.
79
+ Update only explicitly named configs; build verifies the assembled baseline.
80
+
76
81
  rig-parts diff-components --stack <png> --painting <png> --parts <parts.json> --floor <px>
77
82
  [--threshold <channel>] [--figure <binary-png>] [--owners] (--out <json> | --verify <json>)
78
83
  Exhaustive native difference inventory; default max RGB channel > 40.
@@ -391,7 +396,7 @@ usage:
391
396
  a figure and exits 0.
392
397
 
393
398
  rig-parts rig --config <config.json> --parts <dir> --out <dir> [--idle-keys ctl|direct]
394
- [--page-edges pot|free] [--pack-shape rect|polygon]
399
+ [--page-edges pot|free] [--pack-shape rect|polygon] [--page-size <px>]
395
400
  Author the rig: bones at the config's landmarks (a chain makes
396
401
  <chain>0..n, each link turned along its chain with its length, so a
397
402
  physics constraint added later has a lever; every offset under a turned
@@ -427,7 +432,7 @@ usage:
427
432
  stage prints that SKIP line). The pose is the same to one level of float
428
433
  rounding, and so is the per-frame mesh work (AUTHORING §5).
429
434
  rig-parts mesh-draft --config <config.json> --parts <dir> --out <dir> [--requirements <file.json>]
430
- [--idle-keys ctl|direct] [--page-edges pot|free] [--pack-shape rect|polygon]
435
+ [--idle-keys ctl|direct] [--page-edges pot|free] [--pack-shape rect|polygon] [--page-size <px>]
431
436
  [--more-triangles]
432
437
  Draft a traced outline around a coarse grid for every lattice mesh the
433
438
  config states, and keep it only where it holds against that part's
@@ -484,7 +489,7 @@ usage:
484
489
  rig-parts remesh --rig <dir> --config <config.json> --parts <dir> --part <name>
485
490
  --mesh <entry.json> --out <dir> [--requirements <file.json>]
486
491
  (or --delta <mesh-edit.json> in place of --mesh)
487
- [--idle-keys ctl|direct] [--page-edges pot|free] [--pack-shape rect|polygon]
492
+ [--idle-keys ctl|direct] [--page-edges pot|free] [--pack-shape rect|polygon] [--page-size <px>]
488
493
  [--record-input-check] [--input-check <input-check.json>]
489
494
  Re-fit one part's mesh of a gated rig (the directory rig writes) under
490
495
  the mesh entry --mesh holds — what config.json would hold at
@@ -545,7 +550,7 @@ usage:
545
550
 
546
551
  rig-parts retune --rig <dir> --config <config.json> --parts <dir> --out <dir>
547
552
  [--requirements <file.json>] [--idle-keys ctl|direct]
548
- [--page-edges pot|free] [--pack-shape rect|polygon]
553
+ [--page-edges pot|free] [--pack-shape rect|polygon] [--page-size <px>]
549
554
  [--record-input-check] [--input-check <input-check.json>]
550
555
  Splice the constraints and the idle a config states onto a gated rig
551
556
  (the directory rig writes) and write a new revision into --out, which
@@ -579,7 +584,7 @@ usage:
579
584
  --json prints the completed report only, with the recorded exit code.
580
585
 
581
586
  rig-parts check --rig <dir> --out <dir> [--parts <dir>] [--source <painting.png>] [--no-extremes]
582
- [--page-edges pot|free] [--pack-shape rect|polygon]
587
+ [--page-edges pot|free] [--pack-shape rect|polygon] [--page-size <px>]
583
588
  [--requirements <file.json>] [--seam-pairs] [--keep-stills]
584
589
  [--set <name> | --all-sets] [--environment <schedule.json>]
585
590
  [--wind-band <spec.json>] [--json]
@@ -685,6 +690,9 @@ usage:
685
690
  writes the page earlier releases wrote. rigc's pack line ends
686
691
  ", shape rect" or ", shape polygon"; a line that disagrees with the
687
692
  value passed is refused, CHECK_PACK_SHAPE.
693
+ --page-size <px> is handed to rigc verbatim when given (a positive
694
+ integer, refused as ${PACK_PAGE_SIZE} otherwise; rigc's default when
695
+ absent) and recorded as check.json's pack_mode.page_size.
688
696
  ${REQUIREMENTS_SENTENCE} (AUTHORING §7, Declared requirements). It is
689
697
  read and every name in it resolved against rig.json and motion.json
690
698
  before anything is built: a bone, constraint, slot, mesh attachment or
@@ -908,7 +916,7 @@ usage:
908
916
  rig-parts build --config <config.json> --source <painting.png> --full <dir|psd>
909
917
  [--head <dir|psd>] --out <dir> [--seam near-white|silhouette]
910
918
  [--project core|visible] [--page-edges pot|free]
911
- [--pack-shape rect|polygon] [--loop] [--requirements <file.json>]
919
+ [--pack-shape rect|polygon] [--page-size <px>] [--loop] [--requirements <file.json>]
912
920
  [--idle-keys ctl|direct] [--lead-in <periods>] [--seam-pairs] [--keep-stills] [--no-extremes]
913
921
  [--alt <name>=<source>:<full>[:<head>]] [--set <name> | --all-sets]
914
922
  [--environment <schedule.json>] [--wind-band <spec.json>]
@@ -1182,6 +1190,7 @@ function printLayerTable(set: LayerSet): void {
1182
1190
  * no row; `layers` takes one positional path beside its flags (issue #359).
1183
1191
  */
1184
1192
  const TAKES = {
1193
+ 'edited-part': { valued: ['--config', '--part', '--file', '--from', '--editor', '--rig-config'], switches: [] },
1185
1194
  'check-parts': { valued: ['--parts', '--out'], switches: ['--json'] },
1186
1195
  'diff-components': { valued: ['--stack', '--painting', '--parts', '--figure', '--floor', '--threshold', '--out', '--verify'], switches: ['--owners'] },
1187
1196
  'depth-bind': { valued: ['--map', '--input', '--part'], switches: [] },
@@ -1189,10 +1198,10 @@ const TAKES = {
1189
1198
  'depth-apply': { valued: ['--parts', '--manifest', '--config', '--rig-config', '--out'], switches: [] },
1190
1199
  layers: { valued: ['--export', '--template', '--canvas', '--full', '--source', '--config'], switches: [] },
1191
1200
  sheet: { valued: ['--source', '--layers', '--out', '--cell', '--cols'], switches: [] },
1192
- rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
1201
+ rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: [] },
1193
1202
  propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config', '--from', '--bust-landmarks', '--no-bust'], switches: ['--head-box', '--no-back-hair', '--only-missing'] },
1194
1203
  compare: { valued: ['--left', '--right', '--map'], switches: [] },
1195
- check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--requirements', '--set', '--environment', '--wind-band'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json'] },
1204
+ check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--set', '--environment', '--wind-band'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json'] },
1196
1205
  loop: { valued: ['--frames', '--out'], switches: ['--palette'] },
1197
1206
  assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--emit-fill-masks', '--seam', '--project', '--alt', '--write-config', '--requirements'], switches: ['--propose-plan'] },
1198
1207
  'comfy seethrough': { valued: ['--image', '--out', '--resolution', '--steps', '--seed', '--prefix', '--host', '--wait', '--timeout', '--poll', '--config', '--depth-run'], switches: ['--offload', '--no-offload', '--lama', '--nf4'] },
@@ -1200,12 +1209,12 @@ const TAKES = {
1200
1209
  'comfy matte': { valued: ['--painting', '--out', '--node', '--model', '--checkpoint-sha256', '--resolution', '--threshold', '--host', '--wait', '--timeout', '--poll'], switches: [] },
1201
1210
  'comfy plate': { valued: ['--mode', '--painting', '--mask-from', '--occluder', '--out', '--graph', '--model', '--checkpoint-sha256', '--seed', '--grow', '--steps', '--cfg', '--prompt', '--negative', '--host', '--wait', '--timeout', '--poll'], switches: ['--holes'] },
1202
1211
  inputs: { valued: ['--source', '--config', '--out'], switches: [] },
1203
- build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set', '--environment', '--wind-band'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes'] },
1212
+ build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set', '--environment', '--wind-band'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes'] },
1204
1213
  compose: { valued: ['--scene', '--out', '--requirements', '--accept'], switches: [] },
1205
- 'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: ['--more-triangles'] },
1214
+ 'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--more-triangles'] },
1206
1215
  'mesh-stats': { valued: ['--config', '--parts'], switches: [] },
1207
- remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
1208
- retune: { valued: ['--rig', '--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
1216
+ remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size', '--input-check'], switches: ['--record-input-check'] },
1217
+ retune: { valued: ['--rig', '--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--page-size', '--input-check'], switches: ['--record-input-check'] },
1209
1218
  'head-crop-preflight': { valued: ['--full', '--canvas', '--head-box'], switches: [] },
1210
1219
  painting: { valued: ['--keypoints', '--person', '--form'], switches: [] },
1211
1220
  } as const satisfies Record<string, { valued: readonly string[]; switches: readonly string[] }>;
@@ -1382,6 +1391,7 @@ function cmdRig(args: string[]): number {
1382
1391
  let idleKeys: string | null = null;
1383
1392
  let pageEdges: string | null = null;
1384
1393
  let packShape: string | null = null;
1394
+ let pageSize: string | null = null;
1385
1395
  for (let i = 0; i < args.length; i++) {
1386
1396
  const flag = args[i];
1387
1397
  const value = args[i + 1];
@@ -1399,6 +1409,9 @@ function cmdRig(args: string[]): number {
1399
1409
  } else if (flag === '--pack-shape') {
1400
1410
  if (packShape !== null) return usage('--pack-shape is given twice');
1401
1411
  packShape = value;
1412
+ } else if (flag === '--page-size') {
1413
+ if (pageSize !== null) return usage('--page-size is given twice');
1414
+ pageSize = value;
1402
1415
  } else out = value;
1403
1416
  }
1404
1417
  if (config === null) return usage('rig needs --config <config.json>');
@@ -1410,6 +1423,12 @@ function cmdRig(args: string[]): number {
1410
1423
  if (!isPageEdges(edges)) return usage(edges);
1411
1424
  const shape = packShapeOf(packShape ?? undefined);
1412
1425
  if (!isPackShape(shape)) return usage(shape);
1426
+ let size: number | undefined;
1427
+ try {
1428
+ size = parsePageSize(pageSize ?? undefined);
1429
+ } catch (err) {
1430
+ return printRefusal(err);
1431
+ }
1413
1432
  clearRunStamp(out);
1414
1433
  let bin: string;
1415
1434
  try {
@@ -1421,7 +1440,7 @@ function cmdRig(args: string[]): number {
1421
1440
  const startedAt = fixedClock ?? new Date().toISOString();
1422
1441
  try {
1423
1442
  const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
1424
- const rig = rigStage({ config, parts: partsDir, out, idleKeys: keys, pageEdges: edges, packShape: shape }, rigcRunner(bin), scratch, console.log);
1443
+ const rig = rigStage({ config, parts: partsDir, out, idleKeys: keys, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }) }, rigcRunner(bin), scratch, console.log);
1425
1444
  const finishedAt = fixedClock ?? new Date().toISOString();
1426
1445
  writeRunStamp({ pkg, command: 'rig', startedAt, finishedAt, outDir: out, configPath: config, outputPaths: rigOutputFiles(rig) });
1427
1446
  return EXIT_OK;
@@ -1500,9 +1519,10 @@ function cmdCheck(args: string[]): number {
1500
1519
  const shape = packShapeOf(f.get('--pack-shape'));
1501
1520
  if (!isPackShape(shape)) return usage(shape);
1502
1521
  try {
1522
+ const size = parsePageSize(f.get('--page-size'));
1503
1523
  const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
1504
1524
  const r = checkStage(
1505
- { rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}), ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}) },
1525
+ { rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}), ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}) },
1506
1526
  rigcRunner(bin),
1507
1527
  bin,
1508
1528
  json === 1 ? () => {} : console.log,
@@ -1966,7 +1986,7 @@ function cmdAssemble(args: string[]): number {
1966
1986
  console.log,
1967
1987
  );
1968
1988
  const finishedAt = fixedClock ?? new Date().toISOString();
1969
- writeRunStamp({ pkg, command: 'assemble', startedAt, finishedAt, outDir: out, configPath: config, outputPaths: assembleOutputFiles(out, result) });
1989
+ writeRunStamp({ pkg, command: 'assemble', startedAt, finishedAt, outDir: out, configPath: config, inputs: { cwd: process.cwd(), source, full, head }, outputPaths: assembleOutputFiles(out, result) });
1970
1990
  return EXIT_OK;
1971
1991
  } catch (err) {
1972
1992
  if (staged !== null) {
@@ -2241,6 +2261,12 @@ function cmdBuild(args: string[]): number {
2241
2261
  const leadText = flags.get('--lead-in');
2242
2262
  if (leadText !== undefined && !/^[1-9][0-9]*$/.test(leadText)) return usage(`--lead-in ${leadText}; a whole number of idle periods, 1 or more, is required`);
2243
2263
  if (leadText !== undefined && !loop) return usage('--lead-in needs --loop; it says which frames the loop is encoded from');
2264
+ let size: number | undefined;
2265
+ try {
2266
+ size = parsePageSize(flags.get('--page-size'));
2267
+ } catch (err) {
2268
+ return printRefusal(err);
2269
+ }
2244
2270
  const [config, source, full, out] = ['--config', '--source', '--full', '--out'].map((f) => flags.get(f) as string);
2245
2271
  const head = flags.get('--head') ?? null;
2246
2272
  let bin: string;
@@ -2252,7 +2278,7 @@ function cmdBuild(args: string[]): number {
2252
2278
  const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
2253
2279
  try {
2254
2280
  const r = build(
2255
- { config, source, full, head, out, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), loop, pageEdges: edges, packShape: shape, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), noExtremes: on.has('--no-extremes'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(flags.has('--environment') ? { environment: flags.get('--environment') as string } : {}), ...(flags.has('--wind-band') ? { windBand: flags.get('--wind-band') as string } : {}) },
2281
+ { config, source, full, head, out, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), loop, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), noExtremes: on.has('--no-extremes'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(flags.has('--environment') ? { environment: flags.get('--environment') as string } : {}), ...(flags.has('--wind-band') ? { windBand: flags.get('--wind-band') as string } : {}) },
2256
2282
  { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate'), stages: {
2257
2283
  assemble: (input, outputs) => runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers')),
2258
2284
  rig: (input, _rigc, gateScratch) => runBuildProcess({ stage: 'rig', bin, input, scratch: gateScratch }, join(scratch, 'workers')),
@@ -2306,6 +2332,12 @@ function cmdMeshDraft(args: string[]): number {
2306
2332
  if (!isPageEdges(edges)) return usage(edges);
2307
2333
  const shape = packShapeOf(f.get('--pack-shape'));
2308
2334
  if (!isPackShape(shape)) return usage(shape);
2335
+ let size: number | undefined;
2336
+ try {
2337
+ size = parsePageSize(f.get('--page-size'));
2338
+ } catch (err) {
2339
+ return printRefusal(err);
2340
+ }
2309
2341
  let bin: string;
2310
2342
  try {
2311
2343
  bin = findRigc(import.meta.dir, process.env.PATH ?? '');
@@ -2316,7 +2348,7 @@ function cmdMeshDraft(args: string[]): number {
2316
2348
  try {
2317
2349
  const req = f.get('--requirements');
2318
2350
  meshDraftStage(
2319
- { config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }), ...(more === 1 ? { moreTriangles: true } : {}) },
2351
+ { config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(req === undefined ? {} : { requirements: req }), ...(more === 1 ? { moreTriangles: true } : {}) },
2320
2352
  rigcRunner(bin),
2321
2353
  bin,
2322
2354
  scratch,
@@ -2356,6 +2388,12 @@ function cmdRemesh(args: string[]): number {
2356
2388
  if (!isPageEdges(edges)) return usage(edges);
2357
2389
  const shape = packShapeOf(f.get('--pack-shape'));
2358
2390
  if (!isPackShape(shape)) return usage(shape);
2391
+ let size: number | undefined;
2392
+ try {
2393
+ size = parsePageSize(f.get('--page-size'));
2394
+ } catch (err) {
2395
+ return printRefusal(err);
2396
+ }
2359
2397
  let bin: string;
2360
2398
  try {
2361
2399
  bin = findRigc(import.meta.dir, process.env.PATH ?? '');
@@ -2371,7 +2409,7 @@ function cmdRemesh(args: string[]): number {
2371
2409
  const req = f.get('--requirements');
2372
2410
  const ic = f.get('--input-check');
2373
2411
  remeshStage(
2374
- { rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, part: f.get('--part') as string, ...(f.has('--mesh') ? { mesh: f.get('--mesh') as string } : { delta: f.get('--delta') as string }), out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
2412
+ { rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, part: f.get('--part') as string, ...(f.has('--mesh') ? { mesh: f.get('--mesh') as string } : { delta: f.get('--delta') as string }), out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
2375
2413
  runner,
2376
2414
  bin,
2377
2415
  { parts: version(), rigc: rigcVersion },
@@ -2399,6 +2437,12 @@ function cmdRetune(args: string[]): number {
2399
2437
  if (!isPageEdges(edges)) return usage(edges);
2400
2438
  const shape = packShapeOf(f.get('--pack-shape'));
2401
2439
  if (!isPackShape(shape)) return usage(shape);
2440
+ let size: number | undefined;
2441
+ try {
2442
+ size = parsePageSize(f.get('--page-size'));
2443
+ } catch (err) {
2444
+ return printRefusal(err);
2445
+ }
2402
2446
  let bin: string;
2403
2447
  try {
2404
2448
  bin = findRigc(import.meta.dir, process.env.PATH ?? '');
@@ -2414,7 +2458,7 @@ function cmdRetune(args: string[]): number {
2414
2458
  const req = f.get('--requirements');
2415
2459
  const ic = f.get('--input-check');
2416
2460
  retuneStage(
2417
- { rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
2461
+ { rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
2418
2462
  runner,
2419
2463
  bin,
2420
2464
  { parts: version(), rigc: rigcVersion },
@@ -2492,6 +2536,17 @@ function cmdDepthPrepare(args: string[]): number {
2492
2536
  } catch (error) { return printRefusal(error); }
2493
2537
  }
2494
2538
 
2539
+ function cmdEditedPart(args: string[]): number {
2540
+ const f = flags(args, 'edited-part', ['--config', '--part', '--file', '--from', '--editor']);
2541
+ if (typeof f === 'string') return usage(f);
2542
+ try {
2543
+ const { receipt, writes } = writeEditedPart({ config: f.get('--config')!, part: f.get('--part')!, file: f.get('--file')!, from: f.get('--from')!, editor: f.get('--editor')!, rigConfig: f.get('--rig-config') });
2544
+ for (const { target, changes } of writes) for (const line of configWriteLines(target, changes)) console.error(line);
2545
+ console.log(`edited-part: part ${JSON.stringify(receipt.part)} sha256=${receipt.sha256} from_sha256=${receipt.from_sha256} editor=${JSON.stringify(receipt.editor)}`);
2546
+ return EXIT_OK;
2547
+ } catch (error) { return printRefusal(error); }
2548
+ }
2549
+
2495
2550
  function cmdDepthBind(args: string[]): number {
2496
2551
  const f = flags(args, 'depth-bind', ['--map', '--input', '--part']);
2497
2552
  if (typeof f === 'string') return usage(f);
@@ -2527,6 +2582,7 @@ function main(argv: string[]): number | Promise<number> {
2527
2582
  if (command === 'diff-components') return cmdDiffComponents(rest);
2528
2583
  if (command === 'layers') return cmdLayers(rest);
2529
2584
  if (command === 'depth-prepare') return cmdDepthPrepare(rest);
2585
+ if (command === 'edited-part') return cmdEditedPart(rest);
2530
2586
  if (command === 'depth-bind') return cmdDepthBind(rest);
2531
2587
  if (command === 'depth-apply') return cmdDepthApply(rest);
2532
2588
  if (command === 'sheet') return cmdSheet(rest);