@c4a/extract 0.6.0-beta.5 → 0.6.0-beta.7

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.
Files changed (3) hide show
  1. package/README.md +6 -1
  2. package/index.js +26 -7
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -131,7 +131,7 @@ When `snapshot` input is provided, the runner builds these files:
131
131
  During projection, code-owned Sections receive code `source_ref` values derived from these rows:
132
132
 
133
133
  - package rows: `src-N#package:<package>@<hash>`
134
- - symbol rows: `src-N#symbol:<locator>:<kind>@<hash>`
134
+ - symbol rows: `src-N#symbol:<file>:<symbol>:<kind>@<hash>`
135
135
 
136
136
  These refs are verified against the raw code snapshot JSONL indexes. They are
137
137
  separate from prose evidence refs, because code snapshots use
@@ -212,6 +212,11 @@ project flow: better symbols/relations produce better draft candidates, stable
212
212
  `repo:<source>#symbol:...` source refs, review evidence, approved Markdown, and
213
213
  package output.
214
214
 
215
+ Approved codegraph Markdown localizes canonical refs as
216
+ `src-N#symbol:<file>:<symbol>:<kind>@<digest>`. The file segment is part of the
217
+ deterministic evidence identity used by verification; agents copy the complete
218
+ ref as an opaque token.
219
+
215
220
  ## Development
216
221
 
217
222
  ```bash
package/index.js CHANGED
@@ -15474,7 +15474,8 @@ var DEFAULT_SOURCE_SPAN_HASH_LENGTH = 12;
15474
15474
  var BOM = "\uFEFF";
15475
15475
  var HASH_ID_RE = /^(?:sha256:)?[a-f0-9]{64}$/u;
15476
15476
  var SOURCE_SPAN_HASH_RE = /^[a-f0-9]{8,64}$/u;
15477
- var DOCUMENT_SOURCE_NAME_RE = /^[a-z0-9][a-z0-9._-]*$/u;
15477
+ var DOCUMENT_SOURCE_SLUG_RE = /^[a-z0-9][a-z0-9._-]*$/u;
15478
+ var DOCUMENT_SOURCE_BATCH_RE = /^\d{8}\/[a-z0-9][a-z0-9._-]*$/u;
15478
15479
  function isRecord(value) {
15479
15480
  return value !== null && typeof value === "object" && !Array.isArray(value);
15480
15481
  }
@@ -15499,8 +15500,20 @@ function assertDocumentSourceType(value) {
15499
15500
  }
15500
15501
  function normalizeDocumentSourceName(name) {
15501
15502
  const value = name.trim();
15502
- if (!DOCUMENT_SOURCE_NAME_RE.test(value)) {
15503
- throw new TypeError(`document source name must be a lowercase path-safe slug: ${name}`);
15503
+ if (!DOCUMENT_SOURCE_SLUG_RE.test(value) && !DOCUMENT_SOURCE_BATCH_RE.test(value)) {
15504
+ throw new TypeError(`document source name must be a lowercase path-safe slug or YYYYMMDD/module identity: ${name}`);
15505
+ }
15506
+ if (DOCUMENT_SOURCE_BATCH_RE.test(value)) {
15507
+ const dateName = value.slice(0, 8);
15508
+ const year = Number(dateName.slice(0, 4));
15509
+ const month = Number(dateName.slice(4, 6));
15510
+ const day = Number(dateName.slice(6, 8));
15511
+ const date = new Date(0);
15512
+ date.setUTCHours(0, 0, 0, 0);
15513
+ date.setUTCFullYear(year, month - 1, day);
15514
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month - 1 || date.getUTCDate() !== day) {
15515
+ throw new TypeError(`document source batch must be a valid calendar date: ${name}`);
15516
+ }
15504
15517
  }
15505
15518
  return value;
15506
15519
  }
@@ -15530,14 +15543,20 @@ function decodeSnapshotLocatorPath(path2) {
15530
15543
  }
15531
15544
  }
15532
15545
  function parseDocumentSourceLocator(source2) {
15533
- const match = /^(file|lark):([^/]+)\/(.+)$/u.exec(source2);
15534
- if (match?.[1] === undefined || match[2] === undefined || match[3] === undefined)
15546
+ const match = /^(file|lark):(.+)$/u.exec(source2);
15547
+ if (match?.[1] === undefined || match[2] === undefined)
15548
+ return null;
15549
+ const segments = match[2].split("/");
15550
+ const batched = /^\d{8}$/u.test(segments[0] ?? "") && segments.length >= 3;
15551
+ const sourceName = batched ? `${segments[0]}/${segments[1]}` : segments[0];
15552
+ const documentPath = segments.slice(batched ? 2 : 1).join("/");
15553
+ if (sourceName === undefined || documentPath.length === 0)
15535
15554
  return null;
15536
15555
  try {
15537
15556
  return {
15538
15557
  sourceType: match[1],
15539
- sourceName: normalizeDocumentSourceName(match[2]),
15540
- documentPath: decodeSnapshotLocatorPath(match[3])
15558
+ sourceName: normalizeDocumentSourceName(sourceName),
15559
+ documentPath: decodeSnapshotLocatorPath(documentPath)
15541
15560
  };
15542
15561
  } catch {
15543
15562
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/extract",
3
- "version": "0.6.0-beta.5",
3
+ "version": "0.6.0-beta.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "c4a-extract-code": "./bin/c4a-extract-code.js"