@c4a/context-cli 0.7.107 → 0.7.108

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/cli.js CHANGED
@@ -70242,6 +70242,12 @@ function approvedContextSectionsInMarkdown(content3) {
70242
70242
  }
70243
70243
 
70244
70244
  // src/lib/gitProgress.ts
70245
+ var exports_gitProgress = {};
70246
+ __export(exports_gitProgress, {
70247
+ runGitWithProgress: () => runGitWithProgress,
70248
+ redactRemoteCredentials: () => redactRemoteCredentials,
70249
+ GitProgressError: () => GitProgressError
70250
+ });
70245
70251
  import { spawn as spawn2 } from "node:child_process";
70246
70252
  function redactRemoteCredentials(text5) {
70247
70253
  return text5.replace(/\/\/[^/@\s]+@/gu, "//");
@@ -71074,6 +71080,9 @@ function createSourcegraphClient(site, fetchImpl = fetch) {
71074
71080
  throw new SourcegraphRequestError("Sourcegraph returned trailing bytes after raw frames", response.status);
71075
71081
  return frames;
71076
71082
  },
71083
+ refs(repository2, after) {
71084
+ return json(send(sourcegraphEndpoint(site.url, `/v1/repo/refs?repo=${encodeURIComponent(repository2)}&kind=all&first=100${after ? `&after=${encodeURIComponent(after)}` : ""}`), { headers: headers() }, fetchImpl));
71085
+ },
71077
71086
  async job(repository2, jobId) {
71078
71087
  const view = await json(send(sourcegraphEndpoint(site.url, `/v1/repo/availability?repo=${encodeURIComponent(repository2)}`), { headers: headers() }, fetchImpl));
71079
71088
  return view.jobs?.find((item) => item.job_id === jobId);
@@ -71215,6 +71224,21 @@ var init_sourcegraphAuthorization = __esm(() => {
71215
71224
  });
71216
71225
 
71217
71226
  // src/project/remoteSourceAccess.ts
71227
+ var exports_remoteSourceAccess = {};
71228
+ __export(exports_remoteSourceAccess, {
71229
+ sourceMode: () => sourceMode,
71230
+ repositoryAccess: () => repositoryAccess,
71231
+ remoteRefHead: () => remoteRefHead,
71232
+ recordedSourceAuthorization: () => recordedSourceAuthorization,
71233
+ recordedSourceAccess: () => recordedSourceAccess,
71234
+ parseRepositoryRemote: () => parseRepositoryRemote,
71235
+ createRemoteRepository: () => createRemoteRepository,
71236
+ applySourceModeOption: () => applySourceModeOption,
71237
+ AUTHORIZATION_REQUIRED: () => AUTHORIZATION_REQUIRED
71238
+ });
71239
+ function checkoutFallbackHint() {
71240
+ return sourceMode() === "remote" ? "." : "; otherwise restore the local checkout.";
71241
+ }
71218
71242
  function sourceMode() {
71219
71243
  const value = process.env.CONTEXT_SOURCE_MODE?.trim() || "local";
71220
71244
  if (value === "local" || value === "remote" || value === "auto")
@@ -71486,6 +71510,48 @@ function createRemoteRepository(client, repository2, subpath, options) {
71486
71510
  return directories;
71487
71511
  }
71488
71512
  }
71513
+ async function remoteRefHead(projectRoot, entry, options = {}) {
71514
+ const { resolution, client } = await commandSite(projectRoot);
71515
+ const remote = parseRepositoryRemote(entry.remote);
71516
+ if (!client || !remote)
71517
+ return { state: "unverifiable", reason: "Sourcegraph is not available for this repository." };
71518
+ const wait = options.wait ?? ((seconds) => new Promise((resolve8) => setTimeout(resolve8, seconds * 1000)));
71519
+ const cursors = new Set;
71520
+ let after;
71521
+ for (let page = 0, requests = 0;page < REF_PAGES; ) {
71522
+ let result;
71523
+ try {
71524
+ requests++;
71525
+ result = await client.refs(remote.name, after);
71526
+ } catch (error) {
71527
+ const failed = requestFailure(error);
71528
+ if (failed.status === 401) {
71529
+ if (resolution.state === "ready" && resolution.origin === "authorization") {
71530
+ await forgetSourcegraphToken(projectRoot);
71531
+ return { state: "unauthorized", reason: "Sourcegraph rejected the saved temporary token (expired or revoked)." };
71532
+ }
71533
+ return { state: "unverifiable", reason: "Sourcegraph rejected SOURCEGRAPH_API_TOKEN." };
71534
+ }
71535
+ if (failed.code === "REFS_CATALOG_PREPARING" && requests < REF_PREPARING_REQUESTS) {
71536
+ await wait(Math.min(failed.retryAfter ?? 5, 10));
71537
+ continue;
71538
+ }
71539
+ return { state: "unverifiable", reason: `Sourcegraph could not list the branches and tags of ${remote.name}: ${failureText(failed)}.` };
71540
+ }
71541
+ const head = result.refs?.find((item) => item.commit === entry.ref);
71542
+ if (head)
71543
+ return { state: "head", ref: head.ref ?? head.name ?? "a branch or tag" };
71544
+ if (!result.has_more || !result.next_cursor) {
71545
+ return result.catalog?.truncated ? { state: "unverifiable", reason: `Sourcegraph lists only part of the branches and tags of ${remote.name}.` } : { state: "absent" };
71546
+ }
71547
+ if (cursors.has(result.next_cursor))
71548
+ break;
71549
+ cursors.add(result.next_cursor);
71550
+ after = result.next_cursor;
71551
+ page++;
71552
+ }
71553
+ return { state: "unverifiable", reason: `The branches and tags of ${remote.name} could not be listed to the end.` };
71554
+ }
71489
71555
  async function prepareCommit(client, repository2, commit, subpath, availability, options) {
71490
71556
  const group = availability.Paths?.find((item) => item.Path === subpath)?.Group;
71491
71557
  const seconds = Math.round(availability.PreviousSyncSeconds ?? 0);
@@ -71546,7 +71612,7 @@ async function repositoryAccess(projectRoot, sourceRef, entry, options = {}) {
71546
71612
  return decided;
71547
71613
  }
71548
71614
  async function decide(projectRoot, entry, mode, options) {
71549
- const unavailable = (reason_code, reason) => mode === "auto" ? { access: "local", reason: `${reason} Using the local checkout.` } : { access: "skipped", reason_code, reason };
71615
+ const unavailable = (reason_code, reason) => mode === "auto" ? { access: "local", reason: `${reason} Using the local checkout.`, cause: reason, reason_code } : { access: "skipped", reason_code, reason };
71550
71616
  const authorize = (reason) => ({
71551
71617
  access: "skipped",
71552
71618
  reason_code: AUTHORIZATION_REQUIRED,
@@ -71607,7 +71673,7 @@ async function decide(projectRoot, entry, mode, options) {
71607
71673
  if (prepared && !prepared.ready && prepared.unauthorized)
71608
71674
  return unauthorized();
71609
71675
  if (!prepared?.ready) {
71610
- return unavailable("revision-unavailable", prepared?.reason ?? `Sourcegraph cannot read ${remote.name} at the registered commit ${entry.ref} yet. ` + "context update --pending prepares it when the site allows; otherwise restore the local checkout.");
71676
+ return unavailable("revision-unavailable", prepared?.reason ?? `Sourcegraph cannot read ${remote.name} at the registered commit ${entry.ref} yet. ` + `context update --pending prepares it when the site allows${checkoutFallbackHint()}`);
71611
71677
  }
71612
71678
  }
71613
71679
  return {
@@ -71618,7 +71684,7 @@ async function decide(projectRoot, entry, mode, options) {
71618
71684
  reader: createRemoteRepository(client, remote.name, subpath, { operations, onUnauthorized })
71619
71685
  };
71620
71686
  }
71621
- var FULL_COMMIT2, REQUIRED_OPERATIONS, BATCH_PATHS = 100, SPLIT_DEPTH = 3, MAX_BATCH_ROUNDS = 1e4, FAILED_JOB_STATES, AUTHORIZATION_REQUIRED = "sourcegraph-authorization-required", normalizedSubpath = (subpath) => (subpath ?? "").replace(/^\.\/?/u, "").replace(/\/+$/u, "");
71687
+ var FULL_COMMIT2, REQUIRED_OPERATIONS, BATCH_PATHS = 100, SPLIT_DEPTH = 3, MAX_BATCH_ROUNDS = 1e4, FAILED_JOB_STATES, AUTHORIZATION_REQUIRED = "sourcegraph-authorization-required", normalizedSubpath = (subpath) => (subpath ?? "").replace(/^\.\/?/u, "").replace(/\/+$/u, ""), REF_PAGES = 200, REF_PREPARING_REQUESTS = 3;
71622
71688
  var init_remoteSourceAccess = __esm(() => {
71623
71689
  init_errors3();
71624
71690
  init_cliFeedback();
@@ -80260,6 +80326,27 @@ function validPinnedRef(ref2, diagnostics) {
80260
80326
  }
80261
80327
  return true;
80262
80328
  }
80329
+ async function assertCommitInCheckout(input) {
80330
+ const { sourceMode: sourceMode2 } = await Promise.resolve().then(() => (init_remoteSourceAccess(), exports_remoteSourceAccess));
80331
+ if (sourceMode2() !== "local")
80332
+ return;
80333
+ const present = () => execFileAsync2("git", ["-C", input.gitRoot, "cat-file", "-e", `${input.ref}^{commit}`], { env: { ...process.env, GIT_NO_LAZY_FETCH: "1" } }).then(() => true, () => false);
80334
+ if (await present())
80335
+ return;
80336
+ const { redactRemoteCredentials: redactRemoteCredentials2, runGitWithProgress: runGitWithProgress2 } = await Promise.resolve().then(() => (init_gitProgress(), exports_gitProgress));
80337
+ const fetched = await runGitWithProgress2(["-C", input.gitRoot, "fetch", "--depth=1", "origin", input.ref], { env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }, label: `git fetch of commit ${input.ref.slice(0, 12)}` }).then(() => {
80338
+ return;
80339
+ }, (error) => error instanceof Error ? error.message : String(error));
80340
+ if (fetched === undefined && await present())
80341
+ return;
80342
+ throw new ContextError(ExitCode.UserError, `repo source ref ${input.ref} is not a commit of the local checkout or its origin`, {
80343
+ category: ErrorCategory.UserInputInvalid,
80344
+ sourceName: input.sourceName,
80345
+ ref: input.ref,
80346
+ ...fetched ? { fetch: redactRemoteCredentials2(fetched).slice(0, 400) } : {},
80347
+ next: "Check the commit SHA. If it is correct and origin is unreachable from here, fetch it into the checkout first, then rerun this command."
80348
+ });
80349
+ }
80263
80350
  async function normalizeAddInput(input, existing) {
80264
80351
  const sourceName = `${input.namespace}/${input.module}`;
80265
80352
  const explicitRemote = nonEmpty(input.remote);
@@ -80334,6 +80421,8 @@ async function normalizeAddInput(input, existing) {
80334
80421
  ref: rawRef,
80335
80422
  ...local !== undefined ? { local } : {}
80336
80423
  });
80424
+ if (gitRootAbs !== null)
80425
+ await assertCommitInCheckout({ gitRoot: gitRootAbs, ref: ref2, sourceName });
80337
80426
  return {
80338
80427
  name: sourceName,
80339
80428
  namespace: input.namespace,
@@ -80377,7 +80466,7 @@ async function inspectRepoCheckout(input) {
80377
80466
  if (pinnedScopeHash === undefined) {
80378
80467
  const commitLocal = await execFileAsync2("git", ["-C", gitRoot, "cat-file", "-e", `${input.source.git.ref}^{commit}`], { env: { ...process.env, GIT_NO_LAZY_FETCH: "1" } }).then(() => true, () => false);
80379
80468
  if (!commitLocal) {
80380
- input.diagnostics.push(`pinned commit ${input.source.git.ref} is not in the local checkout yet; ` + "context update --pending fetches it (if that fetch fails, check that the commit SHA exists)");
80469
+ input.diagnostics.push(`pinned commit ${input.source.git.ref} is not in the local checkout yet; context update --pending fetches it (if that fetch fails, check that the commit SHA exists)`);
80381
80470
  } else {
80382
80471
  input.diagnostics.push(`source boundary ${input.subpath ?? "."} is missing at pinned ref ${input.source.git.ref}`);
80383
80472
  input.agentHints.push("repo-pinned-boundary-invalid");
@@ -80498,17 +80587,72 @@ async function addRepoSourceUnlocked(input) {
80498
80587
  registry2.repos.push(source2);
80499
80588
  else
80500
80589
  registry2.repos[index2] = source2;
80590
+ const checked = await verifyRemoteRef(input.projectRoot, source2, input.allowUnverifiedRef === true);
80501
80591
  await writeRepoRegistry(input.projectRoot, registry2);
80502
- const status = await ensureRepoSource({ projectRoot: input.projectRoot, source: source2 });
80592
+ const status = await remoteSourceStatus(input.projectRoot, await ensureRepoSource({ projectRoot: input.projectRoot, source: source2 }));
80503
80593
  const { pendingSourceUpdateScopes: pendingSourceUpdateScopes2 } = await Promise.resolve().then(() => (init_pendingSourceUpdates(), exports_pendingSourceUpdates));
80504
80594
  const pending = existing && existing.git.ref !== next.git.ref && (await pendingSourceUpdateScopes2(input.projectRoot)).some((scope2) => scope2.source_ref === `repo:${source2.name}`);
80505
80595
  return {
80506
80596
  registryPath: DEFAULT_REPO_SOURCES_REGISTRY_PATH,
80507
80597
  source: source2,
80508
80598
  status,
80599
+ ...checked.warning ? { warning: checked.warning } : {},
80600
+ ...checked.info ? { info: checked.info } : {},
80509
80601
  ...pending ? { next: "Approved knowledge was processed at the previous commit. Run context update --pending --format json to process this commit." } : {}
80510
80602
  };
80511
80603
  }
80604
+ async function verifyRemoteRef(projectRoot, source2, allowUnverified) {
80605
+ const remoteAccess = await Promise.resolve().then(() => (init_remoteSourceAccess(), exports_remoteSourceAccess));
80606
+ if (remoteAccess.sourceMode() === "local")
80607
+ return {};
80608
+ const entry = {
80609
+ id: source2.id ?? source2.name,
80610
+ name: source2.name,
80611
+ namespace: source2.namespace,
80612
+ module: source2.module,
80613
+ materializedAt: source2.materializedAt ?? defaultRepoMaterializedAt(source2),
80614
+ remote: source2.git.remote,
80615
+ ref: source2.git.ref,
80616
+ ...source2.subpath === undefined ? {} : { subpath: source2.subpath }
80617
+ };
80618
+ const access2 = await remoteAccess.repositoryAccess(projectRoot, `repo:${source2.name}`, entry);
80619
+ if (access2.access === "remote")
80620
+ return {};
80621
+ if (remoteAccess.sourceMode() === "auto" && await checkoutHasCommit(projectRoot, source2))
80622
+ return {};
80623
+ const reasonCode = access2.reason_code;
80624
+ const head = reasonCode === "revision-unavailable" ? await remoteAccess.remoteRefHead(projectRoot, entry) : undefined;
80625
+ if (head?.state === "head") {
80626
+ return { info: `Commit ${source2.git.ref} is the head of ${head.ref}, but Sourcegraph cannot read it yet; context update --pending prepares it when the site allows.` };
80627
+ }
80628
+ const reason = head?.state === "unverifiable" || head?.state === "unauthorized" ? head.reason : head?.state === "absent" ? "Sourcegraph has not observed the commit, and no branch or tag of the remote points at it." : (access2.access === "local" ? access2.cause : access2.reason) ?? "Sourcegraph is not available.";
80629
+ if (allowUnverified)
80630
+ return { warning: `Sourcegraph cannot confirm commit ${source2.git.ref}: ${reason} It was registered as requested.` };
80631
+ const { SOURCEGRAPH_AUTHORIZATION_ACTION: SOURCEGRAPH_AUTHORIZATION_ACTION2 } = await Promise.resolve().then(() => (init_sourcegraphAuthorization(), exports_sourcegraphAuthorization));
80632
+ const authorization = reasonCode === remoteAccess.AUTHORIZATION_REQUIRED || head?.state === "unauthorized" ? { reason, next_action: SOURCEGRAPH_AUTHORIZATION_ACTION2 } : undefined;
80633
+ throw new ContextError(ExitCode.UserError, `Sourcegraph cannot confirm commit ${source2.git.ref}: ${reason}`, {
80634
+ category: ErrorCategory.UserInputInvalid,
80635
+ reason_code: "source-ref-unverified",
80636
+ sourceName: source2.name,
80637
+ ref: source2.git.ref,
80638
+ ...authorization ? { source_authorization: authorization, next_action: authorization.next_action } : {},
80639
+ next: authorization ? "Authorize Sourcegraph access as source_authorization describes, then rerun this command." : "Check the SHA. If it is an older commit that is not a branch or tag head, rerun with --allow-unverified-ref."
80640
+ });
80641
+ }
80642
+ async function remoteSourceStatus(projectRoot, status) {
80643
+ const { sourceMode: sourceMode2 } = await Promise.resolve().then(() => (init_remoteSourceAccess(), exports_remoteSourceAccess));
80644
+ if (sourceMode2() === "local")
80645
+ return status;
80646
+ const { withSourceAccess } = await Promise.resolve().then(() => (init_statusReaders(), exports_statusReaders));
80647
+ return (await withSourceAccess(projectRoot, [status]))[0] ?? status;
80648
+ }
80649
+ async function checkoutHasCommit(projectRoot, source2) {
80650
+ const localAbs = resolveLocalPath(projectRoot, source2.local);
80651
+ const gitRoot = localAbs !== null && existsSync8(localAbs) ? await resolveGitRoot(localAbs) : null;
80652
+ if (gitRoot === null)
80653
+ return false;
80654
+ return execFileAsync2("git", ["-C", gitRoot, "cat-file", "-e", `${source2.git.ref}^{commit}`], { env: { ...process.env, GIT_NO_LAZY_FETCH: "1" } }).then(() => true, () => false);
80655
+ }
80512
80656
  async function addRepoSource(input) {
80513
80657
  return withProjectWriteLock(input.projectRoot, "source-add-repo", () => addRepoSourceUnlocked(input));
80514
80658
  }
@@ -87530,7 +87674,9 @@ async function beginKnowledgeUpdate(projectRoot, value, options = {}) {
87530
87674
  const allScopes = [...new Set(articles.flatMap((article) => article.sections.flatMap((section) => section.references.map((reference2) => reference2.source_ref))))];
87531
87675
  const outsideScopes = allScopes.filter((source2) => !scopes.some((scope2) => repoContentScopeMatches(scope2.source_ref, source2)));
87532
87676
  const outside = outsideScopes.length ? await inspectSettledReferences(projectRoot, articles, outsideScopes, settled, { advisory: true }) : undefined;
87533
- const outsideReferences = outside?.observations.filter((item) => item.state !== "current") ?? [];
87677
+ const unread = recordedSourceAccess().filter((item) => item.access === "skipped" && outsideScopes.includes(item.source_ref) && !skipped.some((entry) => entry.source_ref === item.source_ref));
87678
+ skipped.push(...unread.map((item) => ({ source_ref: item.source_ref, reason_code: item.reason_code ?? "skipped", reason: item.reason ?? "" })));
87679
+ const outsideReferences = outside?.observations.filter((item) => item.state !== "current" && !skipped.some((entry) => entry.source_ref === item.reference.source_ref)) ?? [];
87534
87680
  const missingResources = (await readMissingLarkResources(projectRoot)).filter((item) => scopes.some((scope2) => repoContentScopeMatches(scope2.source_ref, item.source)));
87535
87681
  const unavailable = new Set(inspected.unresolved.filter((item) => item.state === "unavailable").map((item) => item.path));
87536
87682
  const groups = {
@@ -87570,7 +87716,8 @@ async function beginKnowledgeUpdate(projectRoot, value, options = {}) {
87570
87716
  ...item.reason ? { reason: item.reason } : {}
87571
87717
  })) },
87572
87718
  previous_versions: scopes.map((scope2) => processedVersionForScope(settled, scope2) ?? null),
87573
- ...input.changes === undefined ? {} : { changes: input.changes }
87719
+ ...input.changes === undefined ? {} : { changes: input.changes },
87720
+ ...input.more_batches ? { more_batches: true } : {}
87574
87721
  };
87575
87722
  const request = updateSchema.parse({ ...payload, revision: indexerProtocolDigest(payload) });
87576
87723
  await recordFormatOnlyRelocations(projectRoot, await migrateUnchangedScopeReferences(projectRoot, scopes.map((scope2) => scope2.source_ref)));
@@ -87707,6 +87854,7 @@ async function completeKnowledgeUpdate(input) {
87707
87854
  pending_targets: remaining,
87708
87855
  processed_scopes: request.scopes,
87709
87856
  requirements: request.requirements,
87857
+ version_deferred: request.more_batches === true,
87710
87858
  ...first.supporting_sources === undefined ? {} : { supporting_sources: first.supporting_sources },
87711
87859
  ...first.create === undefined ? {} : { create: first.create }
87712
87860
  });
@@ -87778,7 +87926,8 @@ var init_knowledgeUpdate = __esm(() => {
87778
87926
  module_refs: exports_external.array(exports_external.string().min(1)).min(1).optional(),
87779
87927
  processed_version: exports_external.string().min(1).optional()
87780
87928
  }).strict()).min(1),
87781
- changes: exports_external.string().optional()
87929
+ changes: exports_external.string().optional(),
87930
+ more_batches: exports_external.literal(true).optional()
87782
87931
  }).strict();
87783
87932
  updateSchema = exports_external.object({
87784
87933
  protocol: exports_external.literal("context.source-update/v1"),
@@ -87795,6 +87944,7 @@ var init_knowledgeUpdate = __esm(() => {
87795
87944
  structure_proposal: indexerCurrentActionInputDefinitions.sourceUpdate.omit({ stage: true }).optional(),
87796
87945
  previous_versions: exports_external.array(exports_external.string().nullable()),
87797
87946
  changes: exports_external.string().optional(),
87947
+ more_batches: exports_external.literal(true).optional(),
87798
87948
  repo_content: exports_external.unknown().optional(),
87799
87949
  scope_pages: exports_external.array(exports_external.string()).optional(),
87800
87950
  changed_references: exports_external.array(exports_external.object({
@@ -99374,12 +99524,15 @@ ${import_yaml47.default.stringify({ ...import_yaml47.default.parse(fields), type
99374
99524
  const programBlocks = regenerationScopes ? await prepareRevisionProgramBlocks2(input.projectRoot, target.source_refs, regenerationScopes, target.sections.flatMap((section) => section.references)) : undefined;
99375
99525
  if (input.regenerate && !programBlocks?.length)
99376
99526
  throw new TypeError("No applicable program blocks in the selected page sources. Inspect its Provider/materials; do not submit the old table as regenerated. Cancel or adjust this maintenance request before continuing.");
99377
- const buildPending = input.build_pending || input.replace_current && (await readApprovedRevision(input.projectRoot))?.build_pending;
99527
+ const current3 = input.replace_current ? await readApprovedRevision(input.projectRoot) : undefined;
99528
+ const buildPending = input.build_pending || current3?.build_pending;
99529
+ const versionDeferred = input.version_deferred || current3?.version_deferred;
99378
99530
  const payload = {
99379
99531
  target,
99380
99532
  instruction: input.instruction.trim(),
99381
99533
  requirements,
99382
99534
  ...buildPending ? { build_pending: true } : {},
99535
+ ...versionDeferred ? { version_deferred: true } : {},
99383
99536
  ...input.regenerate ? { regenerate: true } : {},
99384
99537
  ...programBlocks === undefined ? {} : { program_blocks: programBlocks },
99385
99538
  ...input.batch_candidates === undefined ? {} : { batch_candidates: input.batch_candidates },
@@ -99823,6 +99976,7 @@ var init_approvedRevision = __esm(() => {
99823
99976
  batch_candidates: exports_external.array(exports_external.unknown()).optional(),
99824
99977
  review_ready: exports_external.boolean().optional(),
99825
99978
  build_pending: exports_external.boolean().optional(),
99979
+ version_deferred: exports_external.literal(true).optional(),
99826
99980
  program_blocks: exports_external.array(exports_external.object({ token: exports_external.string(), source_ref: exports_external.string(), fact_ref: exports_external.string(), markdown: exports_external.string(), declaration_status: exports_external.string().optional() }).strict()).optional(),
99827
99981
  refresh_sources: exports_external.array(exports_external.string().min(1)).min(1).optional(),
99828
99982
  merge_context: exports_external.object({ approved_markdown: exports_external.string().nullable(), draft_markdown: exports_external.string() }).strict().optional(),
@@ -100837,6 +100991,7 @@ var init_managedDocumentStatus = __esm(() => {
100837
100991
  // src/project/statusReaders.ts
100838
100992
  var exports_statusReaders = {};
100839
100993
  __export(exports_statusReaders, {
100994
+ withSourceAccess: () => withSourceAccess,
100840
100995
  readVerifyStatus: () => readVerifyStatus,
100841
100996
  readSourceStatus: () => readSourceStatus,
100842
100997
  readPackageFreshnessStatus: () => readPackageFreshnessStatus,
@@ -100972,6 +101127,16 @@ async function withSourceAccess(projectRoot, statuses) {
100972
101127
  agent_hints: status.agent_hints.filter((hint) => !hint.startsWith("repo-local-checkout"))
100973
101128
  };
100974
101129
  }
101130
+ if (access7.access === "skipped" && sourceMode() === "remote") {
101131
+ return {
101132
+ ...status,
101133
+ access: "skipped",
101134
+ access_reason: access7.reason,
101135
+ access_reason_code: access7.reason_code,
101136
+ diagnostics: [`not read in remote mode: ${access7.reason}`],
101137
+ agent_hints: []
101138
+ };
101139
+ }
100975
101140
  return {
100976
101141
  ...status,
100977
101142
  access: access7.access,
@@ -101465,7 +101630,7 @@ function createContextWorkflowFacts(observation, authorities) {
101465
101630
  translation: { route_satisfied: partialDelivery || observation.maintenanceQueued === true || observation.translationRouteSatisfied !== false },
101466
101631
  version: {
101467
101632
  current: observation.versionCurrent !== false,
101468
- recording_satisfied: partialDelivery || observation.maintenanceQueued === true || (deliveryReady || outputOnlyMaintenance) && observation.unfinishedIndexerTasks === true || observation.versionCurrent !== false
101633
+ recording_satisfied: partialDelivery || observation.maintenanceQueued === true || observation.versionDeferred === true || (deliveryReady || outputOnlyMaintenance) && observation.unfinishedIndexerTasks === true || observation.versionCurrent !== false
101469
101634
  },
101470
101635
  logs: {
101471
101636
  configured: runtimeEvents.configured,
@@ -103187,6 +103352,7 @@ async function collectProjectStatusSnapshotInternal(projectRoot, options = {}) {
103187
103352
  const observation = {
103188
103353
  versionCurrent: phaseStatus.projectEntryValid && !deferDeliveryChecks ? (await inspectWorkspaceVersion(projectRoot)).current : false,
103189
103354
  maintenanceQueued: maintenanceState.pending.length > 0,
103355
+ versionDeferred: localRevision?.version_deferred === true,
103190
103356
  translationRouteSatisfied: phaseStatus.projectEntryValid && !deferDeliveryChecks ? await inspectSiteTranslations(projectRoot, packages).then((result) => result.route_satisfied, () => false) : true,
103191
103357
  taskPreparation,
103192
103358
  localRevisionActive: !!localRevision || !!localUpdate,
@@ -125570,7 +125736,7 @@ Resume performs registration only unless --configure is explicitly supplied.
125570
125736
  }
125571
125737
  writeFormatted(result, format2);
125572
125738
  });
125573
- sourceAdd.command("repo [date]").description("Add or update a repo module under a valid YYYYMMDD batch in sources/repo/index.yaml").option("--configure", "Also select this source in a simple src/index.ts; does not capture").requiredOption("--module <name>", "concrete repo/package module name").option("--remote <url>", "repo remote URL; inferred from local origin when omitted").option("--ref <sha>", "pinned commit/ref; inferred from local HEAD when omitted").option("--local <path>", "local checkout path; may point at a monorepo subdirectory").option("--subpath <dir>", "repo-relative module directory; use with --remote/--ref or a --local repository root").option("--format <format>", "output format: json | yaml | table", "table").action(async (namespace, ...args) => {
125739
+ sourceAdd.command("repo [date]").description("Add or update a repo module under a valid YYYYMMDD batch in sources/repo/index.yaml").option("--configure", "Also select this source in a simple src/index.ts; does not capture").requiredOption("--module <name>", "concrete repo/package module name").option("--remote <url>", "repo remote URL; inferred from local origin when omitted").option("--ref <sha>", "pinned commit/ref; inferred from local HEAD when omitted").option("--local <path>", "local checkout path; may point at a monorepo subdirectory").option("--subpath <dir>", "repo-relative module directory; use with --remote/--ref or a --local repository root").option("--allow-unverified-ref", "remote/auto source modes: register a commit Sourcegraph cannot confirm (an older commit no branch or tag points at)").option("--format <format>", "output format: json | yaml | table", "table").action(async (namespace, ...args) => {
125574
125740
  const options = actionOptions(...args);
125575
125741
  const format2 = assertChoice(options.format, DATA_FORMATS, "--format");
125576
125742
  const projectRoot2 = requireProjectRoot3(process.cwd(), "source add repo");
@@ -125593,7 +125759,8 @@ Resume performs registration only unless --configure is explicitly supplied.
125593
125759
  ...local !== undefined ? { local } : {},
125594
125760
  ...remote !== undefined ? { remote } : {},
125595
125761
  ...ref2 !== undefined ? { ref: ref2 } : {},
125596
- ...subpath !== undefined ? { subpath } : {}
125762
+ ...subpath !== undefined ? { subpath } : {},
125763
+ ...options.allowUnverifiedRef === true ? { allowUnverifiedRef: true } : {}
125597
125764
  });
125598
125765
  writeFormatted(options.configure ? { ...result, configuration: await configureRegisteredSources(projectRoot2, [{ type: "repo", name: `${sourceNamespace.name}/${module}` }]) } : result, format2);
125599
125766
  });