@neocompose/cli 0.6.2 → 0.6.3

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.3] - 2026-07-20
4
+
5
+ ### Fixed
6
+
7
+ - Generate readable NeoFlow linked-value aliases from custom values' non-empty
8
+ `Name` string members, using PascalCase for dialogue members and camelCase
9
+ for node-scoped bindings.
10
+
3
11
  ## [0.6.2] - 2026-07-19
4
12
 
5
13
  ### Fixed
package/README.md CHANGED
@@ -372,6 +372,9 @@ neo status
372
372
  neo push --dry-run
373
373
  ```
374
374
 
375
+ Custom linked values prefer a non-empty string member named `Name`, using
376
+ PascalCase at dialogue scope and camelCase inside nodes.
377
+
375
378
  The reset leaves the regenerated names as local changes. IDs are unchanged,
376
379
  and nothing is written to the server until `neo push` succeeds.
377
380
 
package/dist/neo.mjs CHANGED
@@ -38039,8 +38039,9 @@ function regenerateDialogueSourceNamesV4(records2) {
38039
38039
  const nodeNames = regeneratedNodeNames(nodes, triggerId, classMembers);
38040
38040
  const dialogueLinks = regenerateBindingSourceNames(
38041
38041
  dialogue.linkedValues,
38042
- new DialogueSourceNameAllocator(),
38043
- placements
38042
+ classMembers,
38043
+ placements,
38044
+ "pascal"
38044
38045
  );
38045
38046
  const dialogueBindingNames = new Map(
38046
38047
  dialogueLinks.map((link) => [
@@ -38048,9 +38049,6 @@ function regenerateDialogueSourceNamesV4(records2) {
38048
38049
  stringField(link, "sourceName")
38049
38050
  ])
38050
38051
  );
38051
- for (const link of dialogueLinks) {
38052
- classMembers.reserve(stringField(link, "sourceName"));
38053
- }
38054
38052
  const functionNames = regeneratedSourceFunctionNames(nodes, classMembers);
38055
38053
  const nextDialogue = rewriteFunctionSourceNames(
38056
38054
  { ...dialogue, sourceName: className, linkedValues: dialogueLinks },
@@ -38123,7 +38121,7 @@ function regeneratedNodeNames(nodes, triggerId, allocator) {
38123
38121
  }
38124
38122
  return result;
38125
38123
  }
38126
- function regenerateBindingSourceNames(rawLinks, allocator, placements) {
38124
+ function regenerateBindingSourceNames(rawLinks, allocator, placements, casing) {
38127
38125
  if (!Array.isArray(rawLinks)) return [];
38128
38126
  return rawLinks.map((rawLink, index) => {
38129
38127
  if (!isObjectRecord2(rawLink) || typeof rawLink.valueId !== "string") {
@@ -38131,7 +38129,8 @@ function regenerateBindingSourceNames(rawLinks, allocator, placements) {
38131
38129
  }
38132
38130
  const preferred = placements.preferredBindingName(
38133
38131
  rawLink.valueId,
38134
- optionalString2(rawLink.declaredTypeName) ?? `value${index + 1}`
38132
+ optionalString2(rawLink.declaredTypeName) ?? `value${index + 1}`,
38133
+ casing
38135
38134
  );
38136
38135
  return { ...rawLink, sourceName: allocator.claim(preferred) };
38137
38136
  });
@@ -38144,25 +38143,47 @@ function regenerateNodeBindingSourceNames(rawLinks, placements, dialogueNamesByV
38144
38143
  }
38145
38144
  return rawLink;
38146
38145
  });
38146
+ const inheritedValueIds = new Set(
38147
+ links.flatMap((link) => {
38148
+ const valueId = stringField(link, "valueId");
38149
+ return dialogueNamesByValueId.has(valueId) ? [valueId] : [];
38150
+ })
38151
+ );
38147
38152
  const allocator = new DialogueSourceNameAllocator(
38148
- dialogueNamesByValueId.values()
38153
+ [...dialogueNamesByValueId].filter(([valueId]) => !inheritedValueIds.has(valueId)).map(([, name]) => name)
38149
38154
  );
38150
- return links.map((link, index) => {
38155
+ const namesByValueId = /* @__PURE__ */ new Map();
38156
+ const allocate = (link, index) => {
38151
38157
  const valueId = stringField(link, "valueId");
38152
- const inherited = dialogueNamesByValueId.get(valueId);
38153
- if (inherited !== void 0) {
38154
- return { ...link, sourceName: inherited };
38155
- }
38156
- return {
38157
- ...link,
38158
- sourceName: allocator.claim(
38158
+ namesByValueId.set(
38159
+ valueId,
38160
+ allocator.claim(
38159
38161
  placements.preferredBindingName(
38160
38162
  valueId,
38161
- optionalString2(link.declaredTypeName) ?? `value${index + 1}`
38163
+ optionalString2(link.declaredTypeName) ?? `value${index + 1}`,
38164
+ "camel"
38162
38165
  )
38163
38166
  )
38164
- };
38167
+ );
38168
+ };
38169
+ links.forEach((link, index) => {
38170
+ if (dialogueNamesByValueId.has(stringField(link, "valueId"))) {
38171
+ allocate(link, index);
38172
+ }
38165
38173
  });
38174
+ links.forEach((link, index) => {
38175
+ if (!dialogueNamesByValueId.has(stringField(link, "valueId"))) {
38176
+ allocate(link, index);
38177
+ }
38178
+ });
38179
+ return links.map((link) => ({
38180
+ ...link,
38181
+ sourceName: requiredMap(
38182
+ namesByValueId,
38183
+ stringField(link, "valueId"),
38184
+ "dialogue-node linked value"
38185
+ )
38186
+ }));
38166
38187
  }
38167
38188
  function regenerateTextChildren(node) {
38168
38189
  if (!isObjectRecord2(node.optionSettings)) return node;
@@ -39193,6 +39214,12 @@ function lowerIdentifier(value) {
39193
39214
  const result = pascalIdentifier2(value);
39194
39215
  return `${result[0]?.toLowerCase() ?? "v"}${result.slice(1)}`;
39195
39216
  }
39217
+ function bindingIdentifier(value, casing) {
39218
+ const cased = casing === "camel" ? lowerIdentifier(value) : value;
39219
+ if (isDialogueSourceIdentifier(cased)) return cased;
39220
+ const escaped = `_${cased}`;
39221
+ return isDialogueSourceIdentifier(escaped) ? escaped : "_Value";
39222
+ }
39196
39223
  function ensureStatement(value) {
39197
39224
  const trimmed = value.trim();
39198
39225
  return trimmed.endsWith(";") ? trimmed : `${trimmed};`;
@@ -39274,8 +39301,10 @@ var init_dialogue_sources = __esm({
39274
39301
  classes = /* @__PURE__ */ new Map();
39275
39302
  classesByName = /* @__PURE__ */ new Map();
39276
39303
  values = /* @__PURE__ */ new Map();
39304
+ localizedTexts = /* @__PURE__ */ new Map();
39277
39305
  ownerClassIdsByMemberId = /* @__PURE__ */ new Map();
39278
39306
  parentValueIdsByChildId = /* @__PURE__ */ new Map();
39307
+ mainLocale;
39279
39308
  constructor(records2) {
39280
39309
  for (const record3 of records2) {
39281
39310
  if (record3.recordKind === "member")
@@ -39284,7 +39313,13 @@ var init_dialogue_sources = __esm({
39284
39313
  this.classes.set(record3.recordId, recordData2(record3));
39285
39314
  else if (record3.recordKind === "value")
39286
39315
  this.values.set(record3.recordId, recordData2(record3));
39316
+ else if (record3.recordKind === "localized-text")
39317
+ this.localizedTexts.set(record3.recordId, recordData2(record3));
39287
39318
  }
39319
+ const localization = records2.find(
39320
+ (record3) => record3.recordKind === "localization-config"
39321
+ );
39322
+ this.mainLocale = localization ? optionalString2(recordData2(localization).mainLocale) ?? "en-US" : "en-US";
39288
39323
  for (const schemaClass2 of this.classes.values()) {
39289
39324
  const name = optionalString2(schemaClass2.name);
39290
39325
  if (name && !this.classesByName.has(name)) {
@@ -39339,34 +39374,48 @@ var init_dialogue_sources = __esm({
39339
39374
  get(valueId) {
39340
39375
  return this.symbols.get(valueId) ?? this.inferClassStamped(valueId) ?? this.inferDetached(valueId);
39341
39376
  }
39342
- preferredBindingName(valueId, fallback) {
39343
- const displayName = this.valueDisplayName(valueId);
39377
+ preferredBindingName(valueId, fallback, casing) {
39378
+ const symbol = this.get(valueId);
39379
+ const displayName = this.valueDisplayName(
39380
+ valueId,
39381
+ symbol?.type ?? fallback
39382
+ );
39344
39383
  if (displayName !== null) {
39345
- return lowerIdentifier(
39346
- dialogueSourceNameFromDisplayName(displayName, fallback)
39384
+ return bindingIdentifier(
39385
+ dialogueSourceNameFromDisplayName(displayName, fallback),
39386
+ casing
39347
39387
  );
39348
39388
  }
39349
- const symbol = this.get(valueId);
39350
39389
  const placedName = symbol?.expression.includes(".") === true ? symbol.expression.split(".").at(-1) : null;
39351
- return lowerIdentifier(
39352
- dialogueSourceNameFromDisplayName(placedName, symbol?.type ?? fallback)
39390
+ return bindingIdentifier(
39391
+ dialogueSourceNameFromDisplayName(placedName, symbol?.type ?? fallback),
39392
+ casing
39353
39393
  );
39354
39394
  }
39355
- valueDisplayName(valueId) {
39395
+ valueDisplayName(valueId, typeName) {
39356
39396
  const value = this.values.get(valueId);
39357
39397
  if (!value || !isObjectRecord2(value.value)) return null;
39358
39398
  const classId = optionalString2(value.classId);
39359
- const schemaClass2 = classId ? this.classes.get(classId) : void 0;
39399
+ const schemaClass2 = classId ? this.classes.get(classId) : this.classesByName.get(typeName);
39360
39400
  if (!schemaClass2 || !isObjectRecord2(schemaClass2.schema)) return null;
39361
39401
  const nameEntry = Object.entries(schemaClass2.schema).find(
39362
39402
  ([memberName2]) => memberName2.toLocaleLowerCase("en-US") === "name"
39363
39403
  );
39364
39404
  if (nameEntry === void 0) return null;
39365
- const [memberName] = nameEntry;
39405
+ const [memberName, memberId] = nameEntry;
39406
+ if (typeof memberId !== "string") return null;
39407
+ const nameMember = this.members.get(memberId);
39408
+ if (nameMember?.kind !== 3) return null;
39366
39409
  const childValueId = value.value[memberName];
39367
39410
  if (typeof childValueId !== "string") return null;
39368
39411
  const child = this.values.get(childValueId);
39369
- return typeof child?.value === "string" && child.value.trim().length > 0 ? child.value : null;
39412
+ if (typeof child?.value !== "string") return null;
39413
+ const localizedText = this.localizedTexts.get(child.value);
39414
+ const localeValues = isObjectRecord2(localizedText?.localeValues) ? localizedText.localeValues : null;
39415
+ const mainLocaleEntry = localeValues?.[this.mainLocale];
39416
+ const mainLocaleValue = isObjectRecord2(mainLocaleEntry) ? mainLocaleEntry.value : null;
39417
+ const displayName = typeof mainLocaleValue === "string" ? mainLocaleValue : child.value;
39418
+ return displayName.trim().length > 0 ? displayName : null;
39370
39419
  }
39371
39420
  inferClassStamped(valueId) {
39372
39421
  const value = this.values.get(valueId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",