@neocompose/cli 0.21.0 → 0.21.2

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.21.2] - 2026-08-03
4
+
5
+ ### Fixed
6
+
7
+ - Canonical pull emits `@id` only for structurally ambiguous positions such
8
+ as list entries. Class fields, dictionary entries, and constructor arguments
9
+ recover their value rows from the owning value and role instead of exposing
10
+ redundant P61 creation or localization-link identities.
11
+ - Long and nested constructor calls emitted by `neo pull --reset` wrap at a
12
+ stable 88-column default with one named argument per indented line.
13
+
14
+ ## [0.21.1] - 2026-08-03
15
+
16
+ ### Fixed
17
+
18
+ - `neo pull --reset` reuses typed project indexes while replaying stored
19
+ constructors instead of rescanning the full value graph for every created
20
+ row. Large projects such as Neowyn now finish canonical regeneration instead
21
+ of pinning one CPU core for many minutes.
22
+ - A reset pull now displays progress immediately and updates its phase while
23
+ downloading files, regenerating sources, and saving pull state.
24
+
3
25
  ## [0.21.0] - 2026-08-02
4
26
 
5
27
  ### Changed
package/dist/neo.mjs CHANGED
@@ -42525,7 +42525,7 @@ function cloneDefaultValueForMember(args) {
42525
42525
  return value;
42526
42526
  }
42527
42527
  function findValueInDocument(document, valueId, referenceLocation) {
42528
- const value = document.values.find((candidate) => candidate.id === valueId);
42528
+ const value = document.valueById?.(valueId) ?? document.values.find((candidate) => candidate.id === valueId);
42529
42529
  if (value === void 0) {
42530
42530
  throw new Error(
42531
42531
  `Default value "${valueId}" in ${referenceLocation} does not exist.`
@@ -42569,9 +42569,7 @@ function isStringRecord(value) {
42569
42569
  return Object.values(value).every((entry) => typeof entry === "string");
42570
42570
  }
42571
42571
  function findMemberInDocument(document, memberId) {
42572
- const member = document.members.find(
42573
- (candidate) => candidate.id === memberId
42574
- );
42572
+ const member = document.memberById?.(memberId) ?? document.members.find((candidate) => candidate.id === memberId);
42575
42573
  if (member === void 0) {
42576
42574
  throw new Error(`Member "${memberId}" does not exist.`);
42577
42575
  }
@@ -54614,12 +54612,7 @@ var init_value_row_owner_members = __esm({
54614
54612
  });
54615
54613
 
54616
54614
  // ../src/database/constructor-argument-ownership.ts
54617
- function requiredConstructorParameterTypes(root, document) {
54618
- return new MaterializedValueGraphContext(document).constructorParameterTypes(
54619
- root
54620
- );
54621
- }
54622
- function createTypedValueNormalizer(rows, document, childrenByContainerId = indexChildrenByContainerId(rows), parameterTypesForRow = (root) => requiredConstructorParameterTypes(root, document), memberById = (memberId) => document.members.find((candidate) => candidate.id === memberId), memberTypeInfo = (member, env) => tryMemberTypeInfo(document, member, env)) {
54615
+ function createTypedValueNormalizer(rows, document, childrenByContainerId, parameterTypesForRow, memberById, memberTypeInfo) {
54623
54616
  const visiting = /* @__PURE__ */ new Set();
54624
54617
  const normalizeLiteral = (value) => {
54625
54618
  if (Array.isArray(value)) return value.map(normalizeLiteral);
@@ -54953,20 +54946,22 @@ var init_constructor_argument_ownership = __esm({
54953
54946
  constructorParameterTypes(root) {
54954
54947
  const cached = this.parameterTypesByValueId.get(root.id);
54955
54948
  if (cached !== void 0) return cached;
54949
+ const result = this.resolveConstructorParameterTypes(root);
54950
+ this.parameterTypesByValueId.set(root.id, result);
54951
+ return result;
54952
+ }
54953
+ resolveConstructorParameterTypes(root) {
54956
54954
  const result = /* @__PURE__ */ new Map();
54957
54955
  if (typeof root.classId !== "string") {
54958
- this.parameterTypesByValueId.set(root.id, result);
54959
54956
  return result;
54960
54957
  }
54961
54958
  const schemaClass2 = this.classesById.get(root.classId);
54962
54959
  const requiredConstructorId2 = schemaClass2?.requiredConstructorId;
54963
54960
  if (requiredConstructorId2 === void 0 || requiredConstructorId2 === null) {
54964
- this.parameterTypesByValueId.set(root.id, result);
54965
54961
  return result;
54966
54962
  }
54967
54963
  const constructor2 = this.constructorsById.get(requiredConstructorId2);
54968
54964
  if (constructor2 === void 0 || constructor2.classId !== root.classId) {
54969
- this.parameterTypesByValueId.set(root.id, result);
54970
54965
  return result;
54971
54966
  }
54972
54967
  const env = rowGenericEnvironment(this.document, root);
@@ -54977,7 +54972,6 @@ var init_constructor_argument_ownership = __esm({
54977
54972
  const typeInfo = this.resolveTypeInfo(rawTypeInfo, env);
54978
54973
  if (typeInfo !== null) result.set(parameterId, typeInfo);
54979
54974
  }
54980
- this.parameterTypesByValueId.set(root.id, result);
54981
54975
  return result;
54982
54976
  }
54983
54977
  constructorEdges(row) {
@@ -55005,6 +54999,51 @@ var init_constructor_argument_ownership = __esm({
55005
54999
  normalizeTypedRow(valueId, typeInfo) {
55006
55000
  return this.normalizer().normalizeTypedRow(valueId, typeInfo);
55007
55001
  }
55002
+ /**
55003
+ * Build a typed normalizer for a small replay graph over this durable graph.
55004
+ *
55005
+ * Constructor replay replaces only the root and rows it creates. Keeping
55006
+ * those rows as a lazy overlay avoids rescanning every durable value for
55007
+ * every reconstructed instance while preserving references from the replay
55008
+ * into independently owned durable rows.
55009
+ */
55010
+ withRowOverrides(overrides) {
55011
+ const overrideChildren = indexChildrenByContainerId(overrides);
55012
+ const rows = {
55013
+ get: (valueId) => overrides.get(valueId) ?? this.valuesById.get(valueId)
55014
+ };
55015
+ const children = {
55016
+ get: (containerId) => {
55017
+ if (overrides.has(containerId)) {
55018
+ return overrideChildren.get(containerId) ?? [];
55019
+ }
55020
+ const replayChildren = overrideChildren.get(containerId);
55021
+ if (replayChildren === void 0) {
55022
+ return this.childrenByContainerId.get(containerId);
55023
+ }
55024
+ const durableChildren = this.childrenByContainerId.get(containerId) ?? [];
55025
+ return [
55026
+ ...durableChildren.filter((child) => !overrides.has(child.id)),
55027
+ ...replayChildren
55028
+ ];
55029
+ }
55030
+ };
55031
+ const parameterTypesByRow = /* @__PURE__ */ new WeakMap();
55032
+ return createTypedValueNormalizer(
55033
+ rows,
55034
+ this.document,
55035
+ children,
55036
+ (row) => {
55037
+ const cached = parameterTypesByRow.get(row);
55038
+ if (cached !== void 0) return cached;
55039
+ const resolved = this.resolveConstructorParameterTypes(row);
55040
+ parameterTypesByRow.set(row, resolved);
55041
+ return resolved;
55042
+ },
55043
+ (memberId) => this.membersById.get(memberId),
55044
+ (member, env) => this.memberTypeInfo(member, env)
55045
+ );
55046
+ }
55008
55047
  ownerForValue(valueId) {
55009
55048
  return this.ownershipFacts().owners.get(valueId);
55010
55049
  }
@@ -56075,15 +56114,22 @@ var init_project2 = __esm({
56075
56114
  function isCatchableNSRuntimeError(error) {
56076
56115
  return error instanceof NSGetterRuntimeError && !(error instanceof NonCatchableNSGetterRuntimeError);
56077
56116
  }
56078
- function makeEvaluatorLookups(members, values) {
56117
+ function makeEvaluatorLookups(members, values, options = {}) {
56079
56118
  const attrMap = /* @__PURE__ */ new Map();
56080
56119
  for (const a of members) attrMap.set(a.id, a);
56081
56120
  const valMap = /* @__PURE__ */ new Map();
56082
56121
  for (const v of values) valMap.set(v.id, v);
56083
- return {
56122
+ const lookups = {
56084
56123
  memberById: (id2) => attrMap.get(id2) ?? null,
56085
56124
  valueById: (id2) => valMap.get(id2) ?? null
56086
56125
  };
56126
+ if (options.includeValueGraphIndexes === true) {
56127
+ return {
56128
+ ...lookups,
56129
+ evaluatorIndexes: buildEvaluatorBaseIndexes(members, values, valMap)
56130
+ };
56131
+ }
56132
+ return lookups;
56087
56133
  }
56088
56134
  function evalMemberById(vm, id2) {
56089
56135
  if (vm.databaseVM?.memberById) return vm.databaseVM.memberById(id2);
@@ -56128,6 +56174,39 @@ function liveListIndexRegistry(ctx) {
56128
56174
  liveListIndexesByProject.set(projectKey, created);
56129
56175
  return created;
56130
56176
  }
56177
+ function buildEvaluatorBaseIndexes(members, values, valueById = new Map(
56178
+ values.map((row) => [row.id, row])
56179
+ )) {
56180
+ const indexes = {
56181
+ rowByValueReference: /* @__PURE__ */ new WeakMap(),
56182
+ memberByValueId: /* @__PURE__ */ new Map(),
56183
+ parentLinksByChildId: /* @__PURE__ */ new Map(),
56184
+ indexedRowIds: /* @__PURE__ */ new Set(),
56185
+ indexedOverlayValues: /* @__PURE__ */ new Map(),
56186
+ shadowedBaseRowIds: /* @__PURE__ */ new Set(),
56187
+ listIdentityByArray: /* @__PURE__ */ new WeakMap(),
56188
+ declaredListByArray: /* @__PURE__ */ new WeakMap()
56189
+ };
56190
+ const membersByValueId = /* @__PURE__ */ new Map();
56191
+ for (const member of members) {
56192
+ if (typeof member.valueId === "string") {
56193
+ indexes.memberByValueId.set(member.valueId, member);
56194
+ const bucket = membersByValueId.get(member.valueId) ?? [];
56195
+ bucket.push(member);
56196
+ membersByValueId.set(member.valueId, bucket);
56197
+ }
56198
+ }
56199
+ for (const row of values) indexEvaluatorRow(indexes, row);
56200
+ return {
56201
+ rows: values,
56202
+ valueById,
56203
+ rowByValueReference: indexes.rowByValueReference,
56204
+ memberByValueId: indexes.memberByValueId,
56205
+ membersByValueId,
56206
+ parentLinksByChildId: indexes.parentLinksByChildId,
56207
+ indexedRowIds: indexes.indexedRowIds
56208
+ };
56209
+ }
56131
56210
  function evaluatorIndexes(ctx) {
56132
56211
  const overlayRevision = ctx.__valueOverlay instanceof LazyValueOverlay ? ctx.__valueOverlay.revision : void 0;
56133
56212
  if (ctx.__indexes !== void 0 && ctx.__indexes.overlayRevision === overlayRevision) {
@@ -56135,22 +56214,38 @@ function evaluatorIndexes(ctx) {
56135
56214
  return ctx.__indexes;
56136
56215
  }
56137
56216
  const liveListIndexes = liveListIndexRegistry(ctx);
56217
+ const base = ctx.vm.databaseVM?.evaluatorIndexes;
56138
56218
  const indexes = {
56139
56219
  rowByValueReference: /* @__PURE__ */ new WeakMap(),
56140
- memberByValueId: /* @__PURE__ */ new Map(),
56220
+ baseRowByValueReference: base?.rowByValueReference,
56221
+ memberByValueId: base?.memberByValueId ?? /* @__PURE__ */ new Map(),
56141
56222
  parentLinksByChildId: /* @__PURE__ */ new Map(),
56223
+ baseParentLinksByChildId: base?.parentLinksByChildId,
56142
56224
  indexedRowIds: /* @__PURE__ */ new Set(),
56225
+ baseIndexedRowIds: base?.indexedRowIds,
56143
56226
  indexedOverlayValues: /* @__PURE__ */ new Map(),
56227
+ shadowedBaseRowIds: /* @__PURE__ */ new Set(),
56144
56228
  overlayRevision,
56145
56229
  listIdentityByArray: liveListIndexes?.identity ?? /* @__PURE__ */ new WeakMap(),
56146
56230
  declaredListByArray: liveListIndexes?.declared ?? /* @__PURE__ */ new WeakMap()
56147
56231
  };
56148
- for (const member of ctx.vm.members) {
56149
- if (typeof member.valueId === "string") {
56150
- indexes.memberByValueId.set(member.valueId, member);
56232
+ if (base === void 0) {
56233
+ for (const member of ctx.vm.members) {
56234
+ if (typeof member.valueId === "string") {
56235
+ indexes.memberByValueId.set(member.valueId, member);
56236
+ }
56237
+ }
56238
+ for (const row of evaluatorValues(ctx)) indexEvaluatorRow(indexes, row);
56239
+ } else {
56240
+ for (const row of ctx.__runtimeSessionValues?.values() ?? []) {
56241
+ indexes.shadowedBaseRowIds.add(row.id);
56242
+ indexEvaluatorRow(indexes, row, true);
56243
+ }
56244
+ for (const row of ctx.__valueOverlay?.values() ?? []) {
56245
+ indexes.shadowedBaseRowIds.add(row.id);
56246
+ indexEvaluatorRow(indexes, row, true);
56151
56247
  }
56152
56248
  }
56153
- for (const row of evaluatorValues(ctx)) indexEvaluatorRow(indexes, row);
56154
56249
  syncLazyOverlayReferences(indexes, ctx.__valueOverlay);
56155
56250
  ctx.__indexes = indexes;
56156
56251
  return indexes;
@@ -56165,8 +56260,10 @@ function syncLazyOverlayReferences(indexes, overlay) {
56165
56260
  }
56166
56261
  }
56167
56262
  }
56168
- function indexEvaluatorRow(indexes, row) {
56169
- if (indexes.indexedRowIds.has(row.id)) return;
56263
+ function indexEvaluatorRow(indexes, row, allowBaseShadow = false) {
56264
+ if (indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true) {
56265
+ return;
56266
+ }
56170
56267
  indexes.indexedRowIds.add(row.id);
56171
56268
  if (typeof row.value === "object" && row.value !== null) {
56172
56269
  indexes.rowByValueReference.set(row.value, row);
@@ -56191,6 +56288,16 @@ function addEvaluatorParentLink(indexes, childId, parentId, key) {
56191
56288
  links.push({ parentId, key });
56192
56289
  indexes.parentLinksByChildId.set(childId, links);
56193
56290
  }
56291
+ function evaluatorParentLinks(indexes, childId) {
56292
+ const unfilteredBase = indexes.baseParentLinksByChildId?.get(childId) ?? [];
56293
+ const base = indexes.shadowedBaseRowIds.size === 0 ? unfilteredBase : unfilteredBase.filter(
56294
+ (link) => !indexes.shadowedBaseRowIds.has(link.parentId)
56295
+ );
56296
+ const local = indexes.parentLinksByChildId.get(childId) ?? [];
56297
+ if (base.length === 0) return local;
56298
+ if (local.length === 0) return base;
56299
+ return [...base, ...local];
56300
+ }
56194
56301
  function invalidateEvaluatorIndexes(ctx) {
56195
56302
  if (ctx.__valueOverlay instanceof LazyValueOverlay) {
56196
56303
  ctx.__valueOverlay.markMutated();
@@ -56199,7 +56306,8 @@ function invalidateEvaluatorIndexes(ctx) {
56199
56306
  }
56200
56307
  function trackedRowForValueReference(value, ctx) {
56201
56308
  if (typeof value !== "object" || value === null) return null;
56202
- return evaluatorIndexes(ctx).rowByValueReference.get(value) ?? null;
56309
+ const indexes = evaluatorIndexes(ctx);
56310
+ return indexes.rowByValueReference.get(value) ?? indexes.baseRowByValueReference?.get(value) ?? null;
56203
56311
  }
56204
56312
  function pushConstructionFrame(ctx, label) {
56205
56313
  const state = ctx.__executionState;
@@ -58360,9 +58468,10 @@ function delegateClosureLexicalThis(closure, ctx) {
58360
58468
  );
58361
58469
  }
58362
58470
  const owners = /* @__PURE__ */ new Map();
58363
- for (const link of evaluatorIndexes(ctx).parentLinksByChildId.get(
58471
+ for (const link of evaluatorParentLinks(
58472
+ evaluatorIndexes(ctx),
58364
58473
  closureRow.id
58365
- ) ?? []) {
58474
+ )) {
58366
58475
  const parent = evalValueById(
58367
58476
  ctx.vm,
58368
58477
  link.parentId,
@@ -58515,7 +58624,7 @@ function runtimeGenericEnvForValueRow(row, ctx, visited) {
58515
58624
  }
58516
58625
  function runtimeParentGenericEnv(row, ctx, visited) {
58517
58626
  const result = /* @__PURE__ */ new Map();
58518
- for (const link of evaluatorIndexes(ctx).parentLinksByChildId.get(row.id) ?? []) {
58627
+ for (const link of evaluatorParentLinks(evaluatorIndexes(ctx), row.id)) {
58519
58628
  const parent = evalValueById(
58520
58629
  ctx.vm,
58521
58630
  link.parentId,
@@ -59251,7 +59360,7 @@ function memberForValueRow(row, ctx, visited = /* @__PURE__ */ new Set()) {
59251
59360
  if (syntheticMemberId !== null) {
59252
59361
  return evalMemberById(ctx.vm, syntheticMemberId);
59253
59362
  }
59254
- for (const link of indexes.parentLinksByChildId.get(row.id) ?? []) {
59363
+ for (const link of evaluatorParentLinks(indexes, row.id)) {
59255
59364
  const parent = evalValueById(
59256
59365
  ctx.vm,
59257
59366
  link.parentId,
@@ -60359,7 +60468,12 @@ function constructClassValueWithinFrame(descriptor, scope, ctx) {
60359
60468
  members: ctx.vm.members,
60360
60469
  classes: ctx.vm.classes,
60361
60470
  enums: ctx.vm.enums,
60362
- values: [...evaluatorValues(ctx)],
60471
+ // Declaration defaults only reference durable rows. Supplying the
60472
+ // immutable base plus its indexes avoids copying and linearly scanning
60473
+ // the entire project for every constructor replay.
60474
+ values: ctx.vm.values,
60475
+ memberById: ctx.vm.databaseVM?.memberById,
60476
+ valueById: ctx.vm.databaseVM?.valueById,
60363
60477
  projectFiles: ctx.vm.projectFiles ?? [],
60364
60478
  textureTemplates: ctx.vm.textureTemplates ?? []
60365
60479
  },
@@ -60936,7 +61050,9 @@ function constructDeclaredClassValueWithinFrame(descriptor, record3, info, scope
60936
61050
  members: ctx.vm.members,
60937
61051
  classes: ctx.vm.classes,
60938
61052
  enums: ctx.vm.enums,
60939
- values: [...evaluatorValues(ctx)],
61053
+ values: ctx.vm.values,
61054
+ memberById: ctx.vm.databaseVM?.memberById,
61055
+ valueById: ctx.vm.databaseVM?.valueById,
60940
61056
  projectFiles: ctx.vm.projectFiles ?? [],
60941
61057
  textureTemplates: ctx.vm.textureTemplates ?? []
60942
61058
  },
@@ -61133,8 +61249,8 @@ function currentOwnedValueAttachments(valueId, ctx) {
61133
61249
  label: `static:${activeStaticRoot.member.id}`
61134
61250
  });
61135
61251
  }
61136
- for (const member of ctx.vm.members) {
61137
- if (member.valueId !== valueId) continue;
61252
+ const directlyBoundMembers = ctx.vm.databaseVM?.evaluatorIndexes?.membersByValueId.get(valueId) ?? ctx.vm.members.filter((member) => member.valueId === valueId);
61253
+ for (const member of directlyBoundMembers) {
61138
61254
  const identity2 = member.isStatic ? `static:${member.id}` : `member:${member.id}`;
61139
61255
  add({ identity: identity2, label: identity2 });
61140
61256
  }
@@ -61147,7 +61263,19 @@ function currentOwnedValueAttachments(valueId, ctx) {
61147
61263
  });
61148
61264
  }
61149
61265
  }
61150
- for (const parent of evaluatorValues(ctx)) {
61266
+ const parentIds = new Set(
61267
+ evaluatorParentLinks(evaluatorIndexes(ctx), valueId).map(
61268
+ (link) => link.parentId
61269
+ )
61270
+ );
61271
+ for (const parentId of parentIds) {
61272
+ const parent = evalValueById(
61273
+ ctx.vm,
61274
+ parentId,
61275
+ ctx.__runtimeSessionValues,
61276
+ ctx.__valueOverlay
61277
+ );
61278
+ if (parent === null) continue;
61151
61279
  if (parent.id === valueId) continue;
61152
61280
  let member = activeStaticBindingRoot(parent.id, ctx)?.member ?? memberForValueRow(parent, ctx);
61153
61281
  if (member !== null) {
@@ -62096,6 +62224,16 @@ var init_evaluateNSGetter = __esm({
62096
62224
  }
62097
62225
  ensureSourceIndexes() {
62098
62226
  if (this.sourceIndexes !== void 0) return this.sourceIndexes;
62227
+ const evaluatorIndexes2 = this.vm.databaseVM?.evaluatorIndexes;
62228
+ if (evaluatorIndexes2 !== void 0) {
62229
+ const indexes2 = {
62230
+ rows: evaluatorIndexes2.rows,
62231
+ byId: evaluatorIndexes2.valueById,
62232
+ byReference: evaluatorIndexes2.rowByValueReference
62233
+ };
62234
+ this.sourceIndexes = indexes2;
62235
+ return indexes2;
62236
+ }
62099
62237
  const rows = [];
62100
62238
  const byId = /* @__PURE__ */ new Map();
62101
62239
  const byReference = /* @__PURE__ */ new WeakMap();
@@ -62118,6 +62256,22 @@ var init_evaluateNSGetter = __esm({
62118
62256
  });
62119
62257
 
62120
62258
  // ../src/view-models/neoscript-evaluator/evaluateInitializer.ts
62259
+ function initializerEvaluatorLookups(document) {
62260
+ const key = document;
62261
+ const cached = evaluatorLookupsByDocument.get(key);
62262
+ if (cached !== void 0 && cached.members === document.members && cached.values === document.values) {
62263
+ return cached.lookups;
62264
+ }
62265
+ const lookups = makeEvaluatorLookups(document.members, document.values, {
62266
+ includeValueGraphIndexes: true
62267
+ });
62268
+ evaluatorLookupsByDocument.set(key, {
62269
+ members: document.members,
62270
+ values: document.values,
62271
+ lookups
62272
+ });
62273
+ return lookups;
62274
+ }
62121
62275
  function buildInitializerRootValue(document) {
62122
62276
  const rootValue = {};
62123
62277
  const memberById = new Map(
@@ -62154,7 +62308,8 @@ function evaluateMemberInitializer(args) {
62154
62308
  textureTemplates: args.document.textureTemplates,
62155
62309
  constructors: args.document.constructors,
62156
62310
  interfaces: args.document.interfaces,
62157
- localizedTexts: args.document.localizedTexts
62311
+ localizedTexts: args.document.localizedTexts,
62312
+ databaseVM: initializerEvaluatorLookups(args.document)
62158
62313
  },
62159
62314
  thisValue: null,
62160
62315
  rootValue: buildInitializerRootValue(args.document),
@@ -62178,12 +62333,14 @@ function evaluateMemberInitializer(args) {
62178
62333
  ...constructorArgs === void 0 ? {} : { constructorArgs: structuredClone(constructorArgs) }
62179
62334
  };
62180
62335
  }
62336
+ var evaluatorLookupsByDocument;
62181
62337
  var init_evaluateInitializer = __esm({
62182
62338
  "../src/view-models/neoscript-evaluator/evaluateInitializer.ts"() {
62183
62339
  "use strict";
62184
62340
  init_project2();
62185
62341
  init_NSGetterRuntimeError();
62186
62342
  init_evaluateNSGetter();
62343
+ evaluatorLookupsByDocument = /* @__PURE__ */ new WeakMap();
62187
62344
  }
62188
62345
  });
62189
62346
 
@@ -75204,10 +75361,14 @@ function buildValueEmitContext(records2, manifest) {
75204
75361
  return {
75205
75362
  records: records2,
75206
75363
  readDocument,
75207
- readMaterializedGraph: () => materializedGraph ??= new MaterializedValueGraphContext(
75208
- readDocument(),
75209
- memberValueRowMap(values, "stored value graph")
75210
- ),
75364
+ readMaterializedGraph: () => {
75365
+ if (materializedGraph !== void 0) return materializedGraph;
75366
+ materializedGraph = new MaterializedValueGraphContext(
75367
+ readDocument(),
75368
+ memberValueRowMap(values, "stored value graph")
75369
+ );
75370
+ return materializedGraph;
75371
+ },
75211
75372
  members,
75212
75373
  classes,
75213
75374
  manifestMembers: new Map(
@@ -75231,7 +75392,6 @@ function buildValueEmitContext(records2, manifest) {
75231
75392
  )
75232
75393
  ),
75233
75394
  fileSymbols: projectFileSymbols(records2),
75234
- referencedValueIds: externallyReferencedValueIds(records2),
75235
75395
  localizedTextIds: /* @__PURE__ */ new Set(),
75236
75396
  constructionReplays: /* @__PURE__ */ new Map()
75237
75397
  };
@@ -79010,16 +79170,28 @@ function classValue(context, member, value, visited, targetTyped, outerEnvironme
79010
79170
  visited,
79011
79171
  targetTyped
79012
79172
  );
79013
- const replayRows = storedConstruction === null || typeof value.id !== "string" || Object.keys(value.value).length === 0 ? null : storedConstructionReplayRows(
79173
+ const replayConstruction = storedConstruction === null ? null : storedConstructorCallSource(
79174
+ context,
79175
+ schemaClass2,
79176
+ value,
79177
+ name,
79178
+ environment,
79179
+ visited,
79180
+ targetTyped,
79181
+ true
79182
+ );
79183
+ const replayRows = replayConstruction === null || typeof value.id !== "string" || Object.keys(value.value).length === 0 ? null : storedConstructionReplayRows(
79014
79184
  context,
79015
79185
  value.id,
79016
- storedConstruction,
79186
+ replayConstruction,
79017
79187
  member
79018
79188
  );
79019
79189
  const replayRoot = replayRows === null || typeof value.id !== "string" ? void 0 : replayRows.get(value.id);
79020
- const replayGraph = replayRows === null || typeof value.id !== "string" ? null : new MaterializedValueGraphContext(
79021
- context.readDocument(),
79022
- memberValueRowMap(replayRows, `construction replay for ${value.id}`)
79190
+ const replayGraph = replayRows === null || typeof value.id !== "string" ? null : context.readMaterializedGraph().withRowOverrides(
79191
+ memberValueRowMap(
79192
+ replayRows,
79193
+ `construction replay for ${value.id}`
79194
+ )
79023
79195
  );
79024
79196
  const replayBody = isObjectRecord2(replayRoot?.value) ? replayRoot.value : {};
79025
79197
  const order = Array.isArray(schemaClass2.schemaKeyOrder) ? schemaClass2.schemaKeyOrder.filter(
@@ -79062,7 +79234,10 @@ function classValue(context, member, value, visited, targetTyped, outerEnvironme
79062
79234
  `${key} = ${emitValue(context, emittedChildMember, childId, {
79063
79235
  environment,
79064
79236
  definitionSite: !context.symbolsByValueId.has(childId),
79065
- writeIdentity: !context.symbolsByValueId.has(childId) && context.referencedValueIds.has(childId),
79237
+ // A class slot recovers this row from the owning value and schema key.
79238
+ // P61 creation metadata and localization back-pointers must not turn
79239
+ // that structural child into an explicitly identified source value.
79240
+ writeIdentity: false,
79066
79241
  visited
79067
79242
  })}`
79068
79243
  );
@@ -79072,7 +79247,7 @@ function classValue(context, member, value, visited, targetTyped, outerEnvironme
79072
79247
  ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
79073
79248
  }`;
79074
79249
  }
79075
- const constructor2 = storedConstruction !== null ? storedConstruction : projection.arguments.length > 0 ? `new ${name}(${projection.arguments.join(", ")})` : targetTyped ? "new()" : `new ${name}()`;
79250
+ const constructor2 = storedConstruction !== null ? storedConstruction : projection.arguments.length > 0 ? constructorCallSource(`new ${name}`, projection.arguments) : targetTyped ? "new()" : `new ${name}()`;
79076
79251
  return fields.length === 0 ? constructor2 : `${storedConstruction !== null || projection.arguments.length > 0 ? constructor2 : targetTyped ? "new()" : `new ${name}`} {
79077
79252
  ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
79078
79253
  }`;
@@ -79092,14 +79267,13 @@ function storedConstructionReplayRows(context, valueId, code, member) {
79092
79267
  if (cached !== void 0) return cached;
79093
79268
  const replay = replayStoredConstructionV4({
79094
79269
  records: context.records,
79270
+ document: context.readDocument(),
79095
79271
  valueId,
79096
79272
  code,
79097
79273
  member
79098
79274
  });
79099
- const combined = new Map(context.values);
79100
- for (const [id2, row] of replay) combined.set(id2, row);
79101
- context.constructionReplays.set(valueId, combined);
79102
- return combined;
79275
+ context.constructionReplays.set(valueId, replay);
79276
+ return replay;
79103
79277
  }
79104
79278
  function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, currentId, replayId, member, environment) {
79105
79279
  const resolvedMember = resolveGenericValueMember(
@@ -79122,7 +79296,7 @@ function materializedValueSubgraphsEqual(context, currentGraph, replayGraph, cur
79122
79296
  replayGraph.normalizeTypedRow(replayId, typeInfo)
79123
79297
  );
79124
79298
  }
79125
- function storedConstructorCallSource(context, schemaClass2, value, className, environment, visited, targetTyped) {
79299
+ function storedConstructorCallSource(context, schemaClass2, value, className, environment, visited, targetTyped, cloneAggregateArguments = false) {
79126
79300
  const constructorArgs = value.constructorArgs;
79127
79301
  if (!isObjectRecord2(constructorArgs)) return null;
79128
79302
  const manifestClass = context.manifestClasses.get(
@@ -79146,10 +79320,20 @@ function storedConstructorCallSource(context, schemaClass2, value, className, en
79146
79320
  argument2.type,
79147
79321
  constructorArgs[key],
79148
79322
  environment,
79149
- visited
79323
+ visited,
79324
+ cloneAggregateArguments
79150
79325
  )}`;
79151
79326
  });
79152
- return argumentsValue.length === 0 && targetTyped ? "new()" : `new ${className}(${argumentsValue.join(", ")})`;
79327
+ return argumentsValue.length === 0 && targetTyped ? "new()" : constructorCallSource(`new ${className}`, argumentsValue);
79328
+ }
79329
+ function constructorCallSource(callee, argumentsValue) {
79330
+ const inline = `${callee}(${argumentsValue.join(", ")})`;
79331
+ if (!argumentsValue.some((argument2) => argument2.includes("\n")) && inline.length <= CANONICAL_CONSTRUCTOR_INLINE_WIDTH) {
79332
+ return inline;
79333
+ }
79334
+ return `${callee}(
79335
+ ${argumentsValue.map((argument2) => `${indentNeoSourceNonEmptyLines(argument2, 2)},`).join("\n")}
79336
+ )`;
79153
79337
  }
79154
79338
  function storedValueConstructor(context, schemaClass2, constructorArgs) {
79155
79339
  const requiredId = schemaClass2.requiredConstructorId;
@@ -79179,7 +79363,7 @@ function storedValueConstructor(context, schemaClass2, constructorArgs) {
79179
79363
  }
79180
79364
  return selected2;
79181
79365
  }
79182
- function storedConstructorArgumentSource(context, type, value, environment, visited) {
79366
+ function storedConstructorArgumentSource(context, type, value, environment, visited, cloneAggregateArguments = false) {
79183
79367
  if (value === null) return "null";
79184
79368
  switch (type.kind) {
79185
79369
  case "null":
@@ -79243,7 +79427,17 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
79243
79427
  `Stored Class constructor argument for ${type.classId} is not a value-row reference.`
79244
79428
  );
79245
79429
  }
79246
- return storedTypedRowSource(context, type, value, environment, visited);
79430
+ if (cloneAggregateArguments) {
79431
+ return storedAggregateCloneSource(context, type, value, environment);
79432
+ }
79433
+ return storedTypedRowSource(
79434
+ context,
79435
+ type,
79436
+ value,
79437
+ environment,
79438
+ visited,
79439
+ false
79440
+ );
79247
79441
  }
79248
79442
  case "interface":
79249
79443
  case "generic":
@@ -79254,7 +79448,17 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
79254
79448
  `Stored ${type.kind} constructor argument is not a value-row reference.`
79255
79449
  );
79256
79450
  }
79257
- return storedTypedRowSource(context, type, value, environment, visited);
79451
+ if (cloneAggregateArguments) {
79452
+ return storedAggregateCloneSource(context, type, value, environment);
79453
+ }
79454
+ return storedTypedRowSource(
79455
+ context,
79456
+ type,
79457
+ value,
79458
+ environment,
79459
+ visited,
79460
+ false
79461
+ );
79258
79462
  case "lookup":
79259
79463
  return referenceValue(
79260
79464
  context,
@@ -79287,7 +79491,93 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
79287
79491
  );
79288
79492
  }
79289
79493
  }
79290
- function storedTypedRowSource(context, type, valueId, environment, visited) {
79494
+ function storedAggregateCloneSource(context, type, valueId, environment) {
79495
+ if (!context.values.has(valueId)) {
79496
+ throw new Error(
79497
+ `Stored ${type.kind} constructor argument references missing value row ${valueId}.`
79498
+ );
79499
+ }
79500
+ const typeName = storedSchemaTypeName(context, type, environment, valueId);
79501
+ return `Reference<${typeName}>(id: ${quote4(valueId)}).Clone()`;
79502
+ }
79503
+ function storedSchemaTypeName(context, type, environment, valueId) {
79504
+ switch (type.kind) {
79505
+ case "unknown":
79506
+ return "object";
79507
+ case "class": {
79508
+ const schemaClass2 = context.manifestClasses.get(type.classId);
79509
+ if (schemaClass2 === void 0) {
79510
+ throw new Error(`Stored Class type ${type.classId} was not pulled.`);
79511
+ }
79512
+ const argumentsValue = schemaClass2.genericParameters.flatMap(
79513
+ (parameter3) => {
79514
+ const argument2 = type.classArguments[parameter3.id];
79515
+ return argument2 === void 0 ? [] : [storedSchemaTypeName(context, argument2, environment)];
79516
+ }
79517
+ );
79518
+ return `${schemaClass2.name}${argumentsValue.length === 0 ? "" : `<${argumentsValue.join(", ")}>`}`;
79519
+ }
79520
+ case "interface": {
79521
+ const row = valueId === void 0 ? void 0 : context.values.get(valueId);
79522
+ if (typeof row?.classId === "string") {
79523
+ const schemaClass2 = context.manifestClasses.get(row.classId);
79524
+ if (schemaClass2 !== void 0) return schemaClass2.name;
79525
+ }
79526
+ const record3 = context.records.get(`interface:${type.interfaceId}`);
79527
+ return stringField3(
79528
+ isObjectRecord2(record3?.data) ? record3.data : {},
79529
+ "name"
79530
+ );
79531
+ }
79532
+ case "generic": {
79533
+ const memberId = environment.get(type.genericParamId);
79534
+ const member = memberId === void 0 ? void 0 : context.manifestMembers.get(memberId);
79535
+ if (member === void 0) {
79536
+ throw new Error(
79537
+ `Stored Generic constructor argument has no concrete binding for ${type.genericParamId}.`
79538
+ );
79539
+ }
79540
+ return manifestMemberTypeName(context, member);
79541
+ }
79542
+ case "list":
79543
+ return `List<${storedSchemaTypeName(context, type.entryType, environment)}>`;
79544
+ case "dictionary": {
79545
+ const keyType = type.keyEnumId === null ? "string" : stringField3(context.enums.get(type.keyEnumId) ?? {}, "name");
79546
+ return `Dictionary<${keyType}, ${storedSchemaTypeName(context, type.entryType, environment)}>`;
79547
+ }
79548
+ case "bool":
79549
+ case "int":
79550
+ case "string":
79551
+ case "float":
79552
+ case "decimal":
79553
+ return type.kind;
79554
+ case "sprite":
79555
+ return "SpriteInfo";
79556
+ case "audio":
79557
+ return "AudioClipInfo";
79558
+ case "vector2":
79559
+ return "Vector2";
79560
+ case "vector2Int":
79561
+ return "Vector2Int";
79562
+ case "vector3":
79563
+ return "Vector3";
79564
+ case "vector3Int":
79565
+ return "Vector3Int";
79566
+ case "color":
79567
+ return "Color";
79568
+ case "enum":
79569
+ return stringField3(context.enums.get(type.enumId) ?? {}, "name");
79570
+ case "lookup":
79571
+ return storedSchemaTypeName(context, type.entryType, environment);
79572
+ case "dialogueLookup":
79573
+ return "Dialogue";
79574
+ case "delegate":
79575
+ return "object";
79576
+ case "null":
79577
+ return "null";
79578
+ }
79579
+ }
79580
+ function storedTypedRowSource(context, type, valueId, environment, visited, writeIdentity) {
79291
79581
  const symbol = context.symbolsByValueId.get(valueId);
79292
79582
  if (symbol !== void 0) return symbol;
79293
79583
  const row = context.values.get(valueId);
@@ -79310,32 +79600,34 @@ function storedTypedRowSource(context, type, valueId, environment, visited) {
79310
79600
  `Stored ${type.kind} constructor argument ${valueId} has no concrete class.`
79311
79601
  );
79312
79602
  }
79313
- return `@id(${quote4(valueId)})
79314
- ${classValue(
79315
- context,
79316
- {
79317
- id: `__constructor_arg__:${valueId}`,
79318
- name: "argument",
79319
- kind: 7 /* Class */,
79320
- classId,
79321
- classArguments: {},
79322
- partial: false
79323
- },
79324
- row,
79325
- visited,
79326
- false,
79327
- environment
79328
- )}`;
79603
+ return storedRowIdentitySource(
79604
+ valueId,
79605
+ writeIdentity,
79606
+ classValue(
79607
+ context,
79608
+ {
79609
+ id: `__constructor_arg__:${valueId}`,
79610
+ name: "argument",
79611
+ kind: 7 /* Class */,
79612
+ classId,
79613
+ classArguments: {},
79614
+ partial: false
79615
+ },
79616
+ row,
79617
+ visited,
79618
+ false,
79619
+ environment
79620
+ )
79621
+ );
79329
79622
  }
79330
79623
  if (type.kind === "list") {
79331
- if (row.value === null) return "null";
79624
+ if (row.value === null) {
79625
+ return storedRowIdentitySource(valueId, writeIdentity, "null");
79626
+ }
79332
79627
  const ids = Array.isArray(row.value) ? row.value.filter(
79333
79628
  (entry) => typeof entry === "string"
79334
79629
  ) : [...context.values].filter(([, candidate]) => candidate.containerId === valueId).map(([id2]) => id2).sort(compareCodePoints);
79335
- if (ids.length === 0) return `@id(${quote4(valueId)})
79336
- []`;
79337
- return `@id(${quote4(valueId)})
79338
- [
79630
+ const expression = ids.length === 0 ? "[]" : `[
79339
79631
  ${ids.map(
79340
79632
  (id2) => indentNeoSourceNonEmptyLines(
79341
79633
  storedTypedRowSource(
@@ -79343,22 +79635,26 @@ ${ids.map(
79343
79635
  type.entryType,
79344
79636
  id2,
79345
79637
  environment,
79346
- visited
79638
+ visited,
79639
+ true
79347
79640
  ),
79348
79641
  2
79349
79642
  )
79350
79643
  ).join(",\n\n")}
79351
79644
  ]`;
79645
+ return storedRowIdentitySource(valueId, writeIdentity, expression);
79352
79646
  }
79353
79647
  if (type.kind === "dictionary") {
79354
- if (row.value === null) return "null";
79355
- if (!isObjectRecord2(row.value)) return "{}";
79648
+ if (row.value === null) {
79649
+ return storedRowIdentitySource(valueId, writeIdentity, "null");
79650
+ }
79651
+ if (!isObjectRecord2(row.value)) {
79652
+ return storedRowIdentitySource(valueId, writeIdentity, "{}");
79653
+ }
79356
79654
  const entries = Object.entries(row.value).sort(
79357
79655
  ([left], [right]) => compareCodePoints(left, right)
79358
79656
  );
79359
- return entries.length === 0 ? `@id(${quote4(valueId)})
79360
- {}` : `@id(${quote4(valueId)})
79361
- {
79657
+ const expression = entries.length === 0 ? "{}" : `{
79362
79658
  ${entries.flatMap(
79363
79659
  ([key, id2]) => typeof id2 === "string" ? [
79364
79660
  indentNeoSourceNonEmptyLines(
@@ -79367,53 +79663,71 @@ ${entries.flatMap(
79367
79663
  type.entryType,
79368
79664
  id2,
79369
79665
  environment,
79370
- visited
79666
+ visited,
79667
+ false
79371
79668
  )}`,
79372
79669
  2
79373
79670
  )
79374
79671
  ] : []
79375
79672
  ).join(",\n")}
79376
79673
  }`;
79674
+ return storedRowIdentitySource(valueId, writeIdentity, expression);
79377
79675
  }
79378
79676
  if (type.kind === "lookup") {
79379
- return referenceValue(
79380
- context,
79381
- {
79382
- id: `__constructor_arg__:${valueId}`,
79383
- name: "argument",
79384
- kind: 9 /* Lookup */,
79385
- collectionMemberId: type.collectionMemberId,
79386
- collectionValueId: type.collectionValueId,
79387
- multiselect: false
79388
- },
79389
- row.value,
79390
- false
79677
+ return storedRowIdentitySource(
79678
+ valueId,
79679
+ writeIdentity,
79680
+ referenceValue(
79681
+ context,
79682
+ {
79683
+ id: `__constructor_arg__:${valueId}`,
79684
+ name: "argument",
79685
+ kind: 9 /* Lookup */,
79686
+ collectionMemberId: type.collectionMemberId,
79687
+ collectionValueId: type.collectionValueId,
79688
+ multiselect: false
79689
+ },
79690
+ row.value,
79691
+ false
79692
+ )
79391
79693
  );
79392
79694
  }
79393
79695
  if (type.kind === "dialogueLookup") {
79394
- return referenceValue(
79395
- context,
79396
- {
79397
- id: `__constructor_arg__:${valueId}`,
79398
- name: "argument",
79399
- kind: 18 /* DialogueLookup */,
79400
- multiselect: false
79401
- },
79402
- row.value,
79403
- true
79696
+ return storedRowIdentitySource(
79697
+ valueId,
79698
+ writeIdentity,
79699
+ referenceValue(
79700
+ context,
79701
+ {
79702
+ id: `__constructor_arg__:${valueId}`,
79703
+ name: "argument",
79704
+ kind: 18 /* DialogueLookup */,
79705
+ multiselect: false
79706
+ },
79707
+ row.value,
79708
+ true
79709
+ )
79404
79710
  );
79405
79711
  }
79406
- return storedConstructorArgumentSource(
79407
- context,
79408
- type,
79409
- row.value,
79410
- environment,
79411
- visited
79712
+ return storedRowIdentitySource(
79713
+ valueId,
79714
+ writeIdentity,
79715
+ storedConstructorArgumentSource(
79716
+ context,
79717
+ type,
79718
+ row.value,
79719
+ environment,
79720
+ visited
79721
+ )
79412
79722
  );
79413
79723
  } finally {
79414
79724
  visited.delete(valueId);
79415
79725
  }
79416
79726
  }
79727
+ function storedRowIdentitySource(valueId, writeIdentity, expression) {
79728
+ return `${writeIdentity ? `@id(${quote4(valueId)})
79729
+ ` : ""}${expression}`;
79730
+ }
79417
79731
  function storedVectorSource(value, name, keys) {
79418
79732
  if (!isObjectRecord2(value)) {
79419
79733
  throw new Error(`Stored ${name} constructor argument is not an object.`);
@@ -79736,7 +80050,9 @@ ${entries.flatMap(
79736
80050
  `${quote4(key)}: ${emitValue(context, entryMember, id2, {
79737
80051
  environment,
79738
80052
  definitionSite: !context.symbolsByValueId.has(id2),
79739
- writeIdentity: !context.symbolsByValueId.has(id2) && context.referencedValueIds.has(id2),
80053
+ // Dictionary keys, like class schema keys, recover entry
80054
+ // identity from the owning row. Only list entries need an id.
80055
+ writeIdentity: false,
79740
80056
  visited
79741
80057
  })}`,
79742
80058
  2
@@ -79950,33 +80266,6 @@ function projectFileSymbols(records2) {
79950
80266
  });
79951
80267
  return assignDeterministicFileSymbols(files);
79952
80268
  }
79953
- function externallyReferencedValueIds(records2) {
79954
- const counts = /* @__PURE__ */ new Map();
79955
- const visit = (value) => {
79956
- if (typeof value === "string") {
79957
- if (records2.has(`value:${value}`))
79958
- counts.set(value, (counts.get(value) ?? 0) + 1);
79959
- return;
79960
- }
79961
- if (Array.isArray(value)) {
79962
- value.forEach((entry) => visit(entry));
79963
- return;
79964
- }
79965
- if (isObjectRecord2(value)) {
79966
- for (const [childKey, child] of Object.entries(value)) {
79967
- if (childKey === "id") continue;
79968
- if (childKey === "sourceValueId") continue;
79969
- visit(child);
79970
- }
79971
- }
79972
- };
79973
- for (const record3 of records2.values()) {
79974
- if (!record3.deleted) visit(record3.data);
79975
- }
79976
- return new Set(
79977
- [...counts].filter(([, count]) => count > 1).map(([id2]) => id2)
79978
- );
79979
- }
79980
80269
  function projectMainLocale(records2) {
79981
80270
  const config = [...records2.values()].find(
79982
80271
  (record3) => !record3.deleted && record3.recordKind === "localization-config"
@@ -80065,7 +80354,7 @@ function memberDefaultBody(member) {
80065
80354
  if (!("value" in defaultValue)) return null;
80066
80355
  return defaultValue.value;
80067
80356
  }
80068
- var INFERRED_GENERIC_CLASS_PREFIX, MEMBER_KIND_DICTIONARY, MEMBER_KIND_LIST, MEMBER_KIND_CLASS;
80357
+ var INFERRED_GENERIC_CLASS_PREFIX, MEMBER_KIND_DICTIONARY, MEMBER_KIND_LIST, MEMBER_KIND_CLASS, CANONICAL_CONSTRUCTOR_INLINE_WIDTH;
80069
80358
  var init_value_sources = __esm({
80070
80359
  "src/project-source/value-sources.ts"() {
80071
80360
  "use strict";
@@ -80091,6 +80380,7 @@ var init_value_sources = __esm({
80091
80380
  MEMBER_KIND_DICTIONARY = 5;
80092
80381
  MEMBER_KIND_LIST = 6;
80093
80382
  MEMBER_KIND_CLASS = 7;
80383
+ CANONICAL_CONSTRUCTOR_INLINE_WIDTH = 88;
80094
80384
  }
80095
80385
  });
80096
80386
 
@@ -85113,7 +85403,11 @@ import {
85113
85403
  } from "node:fs";
85114
85404
  import { dirname as dirname5, join as join9 } from "node:path";
85115
85405
  async function runPull(workspace, options) {
85116
- const destructive = options.force || options.reset;
85406
+ if (options.reset) {
85407
+ await runResetPull(workspace);
85408
+ return;
85409
+ }
85410
+ const destructive = options.force;
85117
85411
  const hasBaseline = Object.keys(workspace.state.records).length > 0;
85118
85412
  let localByKey = /* @__PURE__ */ new Map();
85119
85413
  let localStatus = null;
@@ -85160,37 +85454,6 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
85160
85454
  }
85161
85455
  }
85162
85456
  const document = await fetchProjectDocument(workspace);
85163
- if (options.reset) {
85164
- const previousRecords = workspace.state.records;
85165
- const binaries = await pullProjectBinariesV4({
85166
- workspace,
85167
- document,
85168
- previousRecords,
85169
- destructive: true
85170
- });
85171
- const reset = resetWorkspaceToProjectSourcesV4(workspace, document, {
85172
- regenerateSourceNames: true
85173
- });
85174
- for (const [key, state] of binaries.states) {
85175
- const record3 = workspace.state.records[key];
85176
- if (record3) record3.projectBinary = state;
85177
- }
85178
- try {
85179
- const convex = await createConvexClient(workspace);
85180
- const signal = await convex.query(api2.projectExportData.schemaSignal, {
85181
- projectId: workspace.config.projectId,
85182
- versionId: workspace.config.versionId
85183
- });
85184
- workspace.state.headTransactionHash = signal?.transactionHash ?? null;
85185
- } catch {
85186
- workspace.state.headTransactionHash = null;
85187
- }
85188
- writeWorkspaceState(workspace.root, workspace.state);
85189
- console.log(
85190
- `Pulled ${document.records.size} records \u2014 ${reset.written} file(s) updated \u2014 ${reset.removed} removed.`
85191
- );
85192
- return;
85193
- }
85194
85457
  const plans = /* @__PURE__ */ new Map();
85195
85458
  let mergedCount = 0;
85196
85459
  let conflictCount = 0;
@@ -85313,6 +85576,46 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
85313
85576
  regenerateSourceNames: destructive || options.regenerateSourceNames
85314
85577
  });
85315
85578
  }
85579
+ async function runResetPull(workspace) {
85580
+ const progress = spinner("Pulling project snapshot\u2026");
85581
+ try {
85582
+ const document = await fetchProjectDocument(workspace);
85583
+ progress.update("Downloading project files\u2026");
85584
+ const previousRecords = workspace.state.records;
85585
+ const binaries = await pullProjectBinariesV4({
85586
+ workspace,
85587
+ document,
85588
+ previousRecords,
85589
+ destructive: true
85590
+ });
85591
+ progress.update("Regenerating Neo sources\u2026");
85592
+ const reset = resetWorkspaceToProjectSourcesV4(workspace, document, {
85593
+ regenerateSourceNames: true
85594
+ });
85595
+ for (const [key, state] of binaries.states) {
85596
+ const record3 = workspace.state.records[key];
85597
+ if (record3) record3.projectBinary = state;
85598
+ }
85599
+ progress.update("Finalizing pull state\u2026");
85600
+ try {
85601
+ const convex = await createConvexClient(workspace);
85602
+ const signal = await convex.query(api2.projectExportData.schemaSignal, {
85603
+ projectId: workspace.config.projectId,
85604
+ versionId: workspace.config.versionId
85605
+ });
85606
+ workspace.state.headTransactionHash = signal?.transactionHash ?? null;
85607
+ } catch {
85608
+ workspace.state.headTransactionHash = null;
85609
+ }
85610
+ writeWorkspaceState(workspace.root, workspace.state);
85611
+ progress.succeed(
85612
+ `Pulled ${document.records.size} records \u2014 ${reset.written} file(s) updated \u2014 ${reset.removed} removed.`
85613
+ );
85614
+ } catch (error) {
85615
+ progress.fail("Pull failed.");
85616
+ throw error;
85617
+ }
85618
+ }
85316
85619
  async function finishFormat4Pull(args) {
85317
85620
  const {
85318
85621
  workspace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ description: >-
9
9
  `@neocompose/cli` or `node cli/bin/neo.mjs` in the neo-compose repository.
10
10
  ---
11
11
 
12
- <!-- reviewed-through-cli: 0.21.0 -->
12
+ <!-- reviewed-through-cli: 0.21.2 -->
13
13
 
14
14
  # Neo Compose CLI
15
15
 
@@ -73,7 +73,7 @@ wrappers.
73
73
  The marker near the top of `SKILL.md` must exactly match the package version:
74
74
 
75
75
  ```html
76
- <!-- reviewed-through-cli: 0.21.0 -->
76
+ <!-- reviewed-through-cli: 0.21.2 -->
77
77
  ```
78
78
 
79
79
  The quoted version above is checked too, so this instruction cannot go stale