@parall/cli 1.35.0 → 1.36.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/dist/lib/wiki.js CHANGED
@@ -23,7 +23,7 @@ const OBJECTS_DIR = 'objects';
23
23
  const REMOTE_CONFLICT_SUFFIX = '.remote';
24
24
  const REMOTE_DELETED_MARKER_SUFFIX = '.remote-deleted';
25
25
  /** Server-side text ceiling for changeset file content (mirrors filetype.TextMaxBytes). */
26
- const TEXT_MAX_BYTES = 10 * 1024 * 1024;
26
+ export const TEXT_MAX_BYTES = 10 * 1024 * 1024;
27
27
  // ---------------------------------------------------------------------------
28
28
  // Wiki resolution helpers
29
29
  // ---------------------------------------------------------------------------
@@ -762,10 +762,7 @@ export async function syncSingleWiki(ctx, wiki, mountPath) {
762
762
  const metaDir = path.join(mountPath, PRLL_WIKI_DIR);
763
763
  await fs.mkdir(metaDir, { recursive: true });
764
764
  const token = resolveApiToken(ctx);
765
- const baseUrl = (ctx.baseUrl ??
766
- process.env.PRLL_WIKI_URL ??
767
- process.env.PRLL_API_URL ??
768
- '').replace(/\/+$/, '');
765
+ const baseUrl = resolveWikiServiceBaseUrl(ctx);
769
766
  const manifestUrl = `${baseUrl}/wiki/v1/orgs/${ctx.orgId}/wikis/${wiki.id}/manifest`;
770
767
  const bulkDownloadUrl = `${baseUrl}/wiki/v1/orgs/${ctx.orgId}/wikis/${wiki.id}/files/bulk-download`;
771
768
  // 1. Fetch server manifest + read local manifest.
@@ -1193,13 +1190,25 @@ async function loadBaselineContent(mount, relPath, expectedSha) {
1193
1190
  // ---------------------------------------------------------------------------
1194
1191
  // REST helpers for wiki-service
1195
1192
  // ---------------------------------------------------------------------------
1196
- function resolveApiToken(ctx) {
1193
+ // Exported so the binary-file raw-byte download (wiki-files.ts) authenticates
1194
+ // the same way as sync/bulk-download — bearer from the client or PRLL_API_KEY.
1195
+ export function resolveApiToken(ctx) {
1197
1196
  const token = ctx?.client.getToken()?.trim() || process.env.PRLL_API_KEY?.trim();
1198
1197
  if (!token) {
1199
1198
  throw new Error('API token is required via ctx.client.getToken() or PRLL_API_KEY for wiki operations');
1200
1199
  }
1201
1200
  return token;
1202
1201
  }
1202
+ /**
1203
+ * Resolve the wiki-service base URL (trailing slashes trimmed): explicit ctx
1204
+ * override, then PRLL_WIKI_URL, then PRLL_API_URL. SSOT for the raw-fetch wiki
1205
+ * endpoints (sync / bulk-download / binary file download). Hosted/staging/prod
1206
+ * collapse these to one gateway host; local dev can split api (:8080) and wiki
1207
+ * (:8090). Returns '' when none is set — callers decide whether that's fatal.
1208
+ */
1209
+ export function resolveWikiServiceBaseUrl(ctx) {
1210
+ return (ctx.baseUrl ?? process.env.PRLL_WIKI_URL ?? process.env.PRLL_API_URL ?? '').replace(/\/+$/, '');
1211
+ }
1203
1212
  function tryResolveApiToken(ctx) {
1204
1213
  return ctx?.client.getToken()?.trim() || process.env.PRLL_API_KEY?.trim() || undefined;
1205
1214
  }
@@ -1488,10 +1497,7 @@ async function resolveLocalWikiMount(ctx, wiki) {
1488
1497
  if (!(await pathExists(root))) {
1489
1498
  return null;
1490
1499
  }
1491
- const baseUrl = (ctx.baseUrl ??
1492
- process.env.PRLL_WIKI_URL ??
1493
- process.env.PRLL_API_URL ??
1494
- '').replace(/\/+$/, '');
1500
+ const baseUrl = resolveWikiServiceBaseUrl(ctx);
1495
1501
  const wikiBase = `${baseUrl}/wiki/v1/orgs/${ctx.orgId}/wikis/${wiki.id}`;
1496
1502
  return {
1497
1503
  root,
@@ -2258,12 +2264,17 @@ export function detectFrontMatterEnd(lines) {
2258
2264
  if (lines.length === 0) {
2259
2265
  return 0;
2260
2266
  }
2261
- const first = lines[0].trim();
2267
+ // Fences must sit at the line start; only trailing spaces / tabs / CR are
2268
+ // allowed (right-trim, NOT trim). An indented ` ---` is legal content — e.g.
2269
+ // inside a YAML block scalar — and must not open or close the block. Mirrors
2270
+ // server/pkg/markdown/section.go and the micromark frontmatter grammar.
2271
+ const rtrim = (s) => s.replace(/[ \t\r]+$/, '');
2272
+ const first = rtrim(lines[0]);
2262
2273
  if (first !== '---' && first !== '+++') {
2263
2274
  return 0;
2264
2275
  }
2265
2276
  for (let i = 1; i < lines.length; i += 1) {
2266
- if (lines[i].trim() === first) {
2277
+ if (rtrim(lines[i]) === first) {
2267
2278
  return i + 1;
2268
2279
  }
2269
2280
  }
@@ -2332,7 +2343,9 @@ function normalizeWikiPath(value) {
2332
2343
  .replace(/^\/+/, '');
2333
2344
  return normalized === '.' ? '' : normalized.replace(/\/+$/, '');
2334
2345
  }
2335
- function normalizeRequiredWikiPath(value) {
2346
+ // Exported so the binary-file helpers (wiki-files.ts) normalize repo paths
2347
+ // through the exact same rules as every other CLI path entry point.
2348
+ export function normalizeRequiredWikiPath(value) {
2336
2349
  const normalized = normalizeWikiPath(value);
2337
2350
  if (!normalized) {
2338
2351
  throw new Error('path is required');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/cli",
3
- "version": "1.35.0",
3
+ "version": "1.36.0",
4
4
  "description": "CLI client for Parall — universal agent & human access to Parall API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,13 +36,13 @@
36
36
  "diff": "^8.0.3",
37
37
  "js-yaml": "^4.1.0",
38
38
  "zod": "^4.3.6",
39
- "@parall/sdk": "1.35.0"
39
+ "@parall/sdk": "1.36.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/js-yaml": "^4.0.9",
43
43
  "@types/node": "^22.0.0",
44
44
  "typescript": "^5.7.0",
45
- "@parall/agent-core": "1.35.0"
45
+ "@parall/agent-core": "1.36.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsc",