scribe-cms 0.0.20 → 0.0.22

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/dist/cli/index.js CHANGED
@@ -1152,18 +1152,18 @@ function parseTokenInner(inner) {
1152
1152
  }
1153
1153
  case "relation": {
1154
1154
  const parts = rest.split(":");
1155
- if (parts.length < 2 || parts.length > 3) {
1155
+ if (parts.length !== 3) {
1156
1156
  return {
1157
1157
  ok: false,
1158
- reason: `relation must be relation:<typeId>:<enSlug> or relation:<typeId>:<enSlug>:slug`
1158
+ reason: `relation must be relation:<typeId>:<enSlug>:href or relation:<typeId>:<enSlug>:slug`
1159
1159
  };
1160
1160
  }
1161
1161
  const [targetTypeId, enSlug, mode] = parts;
1162
1162
  if (!targetTypeId || !enSlug) {
1163
1163
  return { ok: false, reason: `relation is missing a typeId or enSlug` };
1164
1164
  }
1165
- if (mode !== void 0 && mode !== "slug") {
1166
- return { ok: false, reason: `relation mode must be "slug" (got "${mode}")` };
1165
+ if (mode !== "href" && mode !== "slug") {
1166
+ return { ok: false, reason: `relation mode must be "href" or "slug" (got "${mode}")` };
1167
1167
  }
1168
1168
  return {
1169
1169
  ok: true,
@@ -1171,7 +1171,7 @@ function parseTokenInner(inner) {
1171
1171
  kind: "relation",
1172
1172
  targetTypeId,
1173
1173
  enSlug,
1174
- mode: mode === "slug" ? "slug" : "url"
1174
+ mode
1175
1175
  }
1176
1176
  };
1177
1177
  }
@@ -1277,7 +1277,9 @@ function isStringRecord(value) {
1277
1277
  if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1278
1278
  return Object.values(value).every((v) => typeof v === "string");
1279
1279
  }
1280
- function createInlineResolver(config) {
1280
+ function createInlineResolver(config, options = {}) {
1281
+ const linkStyle = options.linkStyle ?? "app";
1282
+ const exportExtension = options.exportExtension ?? ".md";
1281
1283
  const urlBuilder = createUrlBuilder(config);
1282
1284
  const typeById = new Map(config.types.map((t) => [t.id, t]));
1283
1285
  const storePath = resolveStorePath(config);
@@ -1338,7 +1340,10 @@ function createInlineResolver(config) {
1338
1340
  if (token.mode === "slug") return token.enSlug;
1339
1341
  if (!isRoutableType(type)) return "";
1340
1342
  const slug = localizedSlug(token.targetTypeId, token.enSlug, locale);
1341
- return urlBuilder.resolvePath(type.path, slug, locale);
1343
+ if (linkStyle === "export") {
1344
+ return urlBuilder.resolvePath(type.path, `${slug}${exportExtension}`, locale);
1345
+ }
1346
+ return type.path.replace("{slug}", slug);
1342
1347
  }
1343
1348
  }
1344
1349
  }
@@ -1879,7 +1884,10 @@ function createProject(config, options = {}) {
1879
1884
  }
1880
1885
  return runtime;
1881
1886
  };
1882
- const inlineResolver = options.resolveInlineTokens ? createInlineResolver(config) : void 0;
1887
+ const inlineResolver = options.resolveInlineTokens ? createInlineResolver(config, {
1888
+ linkStyle: options.inlineLinkStyle,
1889
+ exportExtension: options.exportLinkExtension
1890
+ }) : void 0;
1883
1891
  for (const type of config.types) {
1884
1892
  runtimes.set(
1885
1893
  type.id,
@@ -2635,7 +2643,7 @@ function validateInlineTokens(config) {
2635
2643
  });
2636
2644
  break;
2637
2645
  }
2638
- if (token.mode === "url") {
2646
+ if (token.mode === "href") {
2639
2647
  const targetType = typeById.get(token.targetTypeId);
2640
2648
  if (!isRoutableType(targetType)) {
2641
2649
  issues.push({
@@ -3339,10 +3347,10 @@ var LOCALE_NAMES = {
3339
3347
  };
3340
3348
  function defaultLocalizationPrompt(localeName, locale) {
3341
3349
  return [
3342
- `Localize the content above into natural ${localeName} (${locale}).`,
3343
- "Do not translate word-for-word.",
3344
- "Preserve the source tone and brand voice.",
3345
- "Write as if a native speaker authored it for the target market."
3350
+ `Write the content above in natural ${localeName} (${locale}), as if it had been originally authored by a native ${localeName} copywriter for that market.`,
3351
+ `Preserve the source tone and brand voice, but express every idea the way ${localeName} copy actually reads \u2014 never word-for-word.`,
3352
+ `Use native ${localeName} typographic conventions for quotation marks, apostrophes, and spacing around punctuation \u2014 not the source language's.`,
3353
+ `Before returning, re-read each ${localeName} sentence on its own: if it is ambiguous, unidiomatic, or reads like a translation, rewrite it.`
3346
3354
  ].join(" ");
3347
3355
  }
3348
3356
  function buildLocalizationPrompt(promptOverride, localeName, locale) {
@@ -3352,7 +3360,12 @@ function buildLocalizationPrompt(promptOverride, localeName, locale) {
3352
3360
 
3353
3361
  ${localeDirective}`;
3354
3362
  }
3355
- var TASK_FRAMING = "You are localizing the content below into a target language specified at the end of this prompt.";
3363
+ var TASK_FRAMING = [
3364
+ "You are a native-speaker marketing copywriter producing the localized edition of the content below. The target language is specified at the end of this prompt.",
3365
+ "You are NOT translating a document. Each sentence in the source tells you the INTENT \u2014 what it must make the reader feel or understand. Write copy that accomplishes the same thing, the way a native copywriter would have written it from scratch.",
3366
+ "Never mirror the source sentence structure when the target language would naturally phrase the idea differently. Calqued syntax is the #1 failure mode.",
3367
+ "When the source uses wordplay, an idiom, or a punchy rhetorical device, recreate the effect rather than the words. If no natural equivalent exists, write a plain, confident line that carries the same message \u2014 never a literal rendering that sounds odd or ambiguous in the target language."
3368
+ ].join("\n");
3356
3369
  function buildOutputFormatLine(hasFrontmatter, slugStrategy) {
3357
3370
  if (!hasFrontmatter) {
3358
3371
  return slugStrategy === "localized" ? "`body` (string, full MDX body), `slug` (string)." : "`body` (string, full MDX body).";