@bizibot/contracts 0.1.1 → 0.1.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/README.md CHANGED
@@ -5,10 +5,6 @@
5
5
  Map code to the docs that govern it. Version them like dependencies. Catch
6
6
  breaking changes before they ship.
7
7
 
8
- > **Status: pre-1.0.** Version `0.1.0` is published. Its `0.x` CLI is
9
- > implemented and may still receive compatibility changes before the first
10
- > stable release.
11
-
12
8
  ## The idea
13
9
 
14
10
  Your PRDs, ADRs, specs, designs, standards and procedures are contracts that
@@ -447,7 +447,7 @@ var readRegistryFiles = async (version, paths) => {
447
447
  };
448
448
  var loadManagedFileExpectations = async (contents, pin) => {
449
449
  const { readFile: readFile2 } = await import("fs/promises");
450
- const packageJson = await import("./package-I34IHQY5.js");
450
+ const packageJson = await import("./package-2EIOZLOH.js");
451
451
  const expected = {};
452
452
  const resources = /* @__PURE__ */ new Map();
453
453
  const versionFor = (source, path) => {
@@ -604,13 +604,28 @@ var readLocalChanges = async (root, base) => {
604
604
  const untracked = (await git(root, ["ls-files", "--others", "--exclude-standard"])).split("\n").filter(Boolean);
605
605
  return [...changes, ...untracked.filter((path) => !changed.has(path)).map((path) => ({ status: "added", path }))];
606
606
  };
607
- var readLocalBase = async (root) => {
607
+ var tryGit = async (root, args) => {
608
608
  try {
609
- const defaultRef = (await git(root, ["symbolic-ref", "refs/remotes/origin/HEAD"])).trim();
610
- return (await git(root, ["merge-base", "HEAD", defaultRef])).trim();
609
+ return (await git(root, args)).trim() || void 0;
611
610
  } catch {
612
- return "HEAD^";
611
+ return void 0;
612
+ }
613
+ };
614
+ var readDefaultBranchRef = async (root) => {
615
+ const remoteHead = await tryGit(root, ["symbolic-ref", "-q", "refs/remotes/origin/HEAD"]);
616
+ const configured = await tryGit(root, ["config", "--get", "init.defaultBranch"]);
617
+ const names = [...new Set([configured, "main", "master"].filter((name2) => Boolean(name2)))];
618
+ const candidates = [remoteHead, ...names.map((name2) => `refs/remotes/origin/${name2}`), ...names.map((name2) => `refs/heads/${name2}`)];
619
+ for (const ref of candidates.filter((candidate) => Boolean(candidate))) {
620
+ if (await tryGit(root, ["rev-parse", "-q", "--verify", `${ref}^{commit}`])) return ref;
613
621
  }
622
+ return void 0;
623
+ };
624
+ var readLocalBase = async (root) => {
625
+ const defaultRef = await readDefaultBranchRef(root);
626
+ const base = defaultRef && await tryGit(root, ["merge-base", "HEAD", defaultRef]);
627
+ if (!base) throw new Error("contracts: could not find the default branch to compare against; pass --base <revision>");
628
+ return base;
614
629
  };
615
630
 
616
631
  // src/ci.ts
@@ -706,4 +721,4 @@ export {
706
721
  JSON_SCHEMA_VERSION,
707
722
  toJsonEnvelope
708
723
  };
709
- //# sourceMappingURL=chunk-NAUOI6VM.js.map
724
+ //# sourceMappingURL=chunk-QAMA5XHN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/versioning/version.ts","../src/artifacts/discover.ts","../src/versioning/validate.ts","../src/check/version-transitions.ts","../src/contracts-file/matcher.ts","../src/contracts-file/parse.ts","../src/contracts-file/pin.ts","../src/contracts-file/resolve.ts","../src/check/repository.ts","../src/contracts-file/ranges.ts","../src/managed.ts","../src/check/snapshot.ts","../src/check/release.ts","../src/local.ts","../src/ci.ts","../src/index.ts"],"sourcesContent":["import { inc, valid } from \"semver\";\n\nimport { extractFrontmatter } from \"../artifacts/discover.js\";\n\nexport type BumpLevel = \"major\" | \"minor\" | \"patch\";\n\nexport const nextVersion = (version: string, level: BumpLevel): string => {\n if (!valid(version)) throw new Error(`${version} is not valid SemVer`);\n return inc(version, level)!;\n};\n\nexport const versionArtifactSource = (source: string, baseVersion: string, level: BumpLevel): string => {\n const target = nextVersion(baseVersion, level);\n const block = extractFrontmatter(source);\n if (block.source === undefined) throw new Error(\"artifact has no frontmatter version field\");\n const newline = source.startsWith(\"---\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const end = source.indexOf(`${newline}---`, 3);\n if (end === -1) throw new Error(\"artifact has no frontmatter version field\");\n const frontmatter = source.slice(0, end + newline.length);\n const versionLine = /^version:[ \\t]*(?:\"[^\"]*\"|'[^']*'|[^\\s#]+)(?<comment>[ \\t]*#.*)?[ \\t]*\\r?$/m;\n if (!versionLine.test(frontmatter)) throw new Error(\"artifact has no frontmatter version field\");\n const rewritten = frontmatter.replace(versionLine, (line, ...args) => {\n const groups = args.at(-1) as { comment?: string } | undefined;\n return `version: ${target}${groups?.comment ?? \"\"}${line.endsWith(\"\\r\") ? \"\\r\" : \"\"}`;\n });\n return rewritten + source.slice(end + newline.length);\n};\n","import { valid as validSemver } from \"semver\";\nimport { parseDocument } from \"yaml\";\n\nexport const DEFAULT_KIND_FOLDERS = { prd: \"docs/prds\", adr: \"docs/adr\", spec: \"docs/specs\", design: \"docs/designs\", standard: \"docs/standards\", procedure: \"docs/procedures\" } as const;\nexport type ArtifactKind = keyof typeof DEFAULT_KIND_FOLDERS;\nexport type Artifact = { id: `${ArtifactKind}/${string}`; kind: ArtifactKind; path: string; status?: \"proposed\" | \"accepted\" | \"deprecated\" | \"superseded\"; supersededBy?: string; version?: string };\nexport type ArtifactDiscovery = { artifact?: Artifact; errors: string[] };\n\nconst statuses = new Set([\"proposed\", \"accepted\", \"deprecated\", \"superseded\"]);\nconst slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*(?:\\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/;\nconst ignoredNames = new Set([\"INDEX\", \"README\"]);\n\nexport const extractFrontmatter = (source: string): { source?: string; error?: string } => {\n if (!source.startsWith(\"---\\n\") && !source.startsWith(\"---\\r\\n\")) return {};\n const newline = source.startsWith(\"---\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const openingLength = 3 + newline.length;\n const close = source.indexOf(`${newline}---`, openingLength - newline.length);\n const afterClose = close === -1 ? \"\" : source.slice(close + newline.length + 3);\n if (close === -1 || (afterClose !== \"\" && !afterClose.startsWith(newline))) {\n return { error: \"frontmatter is missing its closing delimiter\" };\n }\n return { source: source.slice(openingLength, close) };\n};\n\n/** Reads a canonical artifact version even when the file is not yet in a kind folder. */\nexport const versionFromSource = (source: string): string | undefined => {\n const block = extractFrontmatter(source);\n if (block.source === undefined || block.error) return undefined;\n const document = parseDocument(block.source);\n if (document.errors.length) return undefined;\n const version = (document.toJSON() as Record<string, unknown>).version;\n return typeof version === \"string\" && validSemver(version) === version ? version : undefined;\n};\n\nexport const discoverArtifact = (path: string, source: string, folders: Record<ArtifactKind, string> = DEFAULT_KIND_FOLDERS): ArtifactDiscovery => {\n const normalized = path.replace(/^\\.\\//, \"\").replace(/\\\\/g, \"/\");\n const matches = (Object.entries(folders) as Array<[ArtifactKind, string]>).filter(([, folder]) => normalized.startsWith(`${folder}/`) && normalized.endsWith(\".md\"));\n if (matches.length === 0) return { errors: [] };\n if (matches.length > 1) return { errors: [`${normalized} matches overlapping kind folders`] };\n const [kind, folder] = matches[0];\n const slug = normalized.slice(folder.length + 1, -3);\n if (ignoredNames.has(slug.split(\"/\").at(-1) ?? \"\")) return { errors: [] };\n if (!slugPattern.test(slug)) return { errors: [`${normalized} has an invalid kebab-case slug`] };\n const block = extractFrontmatter(source);\n if (block.error) return { errors: [block.error] };\n const document = block.source === undefined ? undefined : parseDocument(block.source);\n if (document?.errors.length) return { errors: document.errors.map((error) => error.message) };\n const fields = (document?.toJSON() ?? {}) as Record<string, unknown>;\n const errors: string[] = [];\n if (fields.status !== undefined && (typeof fields.status !== \"string\" || !statuses.has(fields.status))) errors.push(\"status must be proposed, accepted, deprecated, or superseded\");\n if (fields.version !== undefined && (typeof fields.version !== \"string\" || validSemver(fields.version) !== fields.version)) errors.push(\"version must be a valid canonical SemVer string\");\n if (errors.length) return { errors };\n return { artifact: { id: `${kind}/${slug}`, kind, path: normalized, status: fields.status as Artifact[\"status\"], ...(typeof fields.superseded_by === \"string\" ? { supersededBy: fields.superseded_by } : {}), version: fields.version as string | undefined }, errors: [] };\n};\n","import type { Artifact } from \"../artifacts/discover.js\";\n\nimport { nextVersion, type BumpLevel } from \"./version.js\";\n\nexport type ArtifactVersionDiagnostic = {\n artifact: string;\n message: string;\n};\n\nexport type ArtifactVersionTransition = {\n base?: Artifact;\n current?: Artifact;\n changed: boolean;\n changedBeyondVersion?: boolean;\n};\n\nconst name = (artifact: Artifact | undefined): string => artifact?.id ?? \"new artifact\";\n\n/** Validates an author-selected, one-step SemVer transition. */\nexport const validateArtifactVersionTransition = (\n transition: ArtifactVersionTransition\n): ArtifactVersionDiagnostic[] => {\n const { base, current, changed, changedBeyondVersion = false } = transition;\n if (!current || !changed) return [];\n\n if (!base) {\n return current.version === undefined || current.version === \"0.1.0\"\n ? []\n : [{ artifact: name(current), message: \"a new versioned artifact must start at 0.1.0\" }];\n }\n\n if (base.version === undefined) {\n return current.version === undefined || current.version === \"0.1.0\"\n ? []\n : [{ artifact: name(current), message: \"an existing artifact may opt into versioning only at 0.1.0\" }];\n }\n\n if (current.version === undefined) {\n return [{ artifact: name(current), message: \"an existing artifact version must not be removed\" }];\n }\n\n if (!changedBeyondVersion) {\n return current.version === base.version\n ? []\n : [{ artifact: name(current), message: `an unchanged artifact must retain its base version ${base.version}` }];\n }\n\n const expected = ([\"major\", \"minor\", \"patch\"] as BumpLevel[]).map((level) => nextVersion(base.version!, level));\n return expected.includes(current.version)\n ? []\n : [{ artifact: name(current), message: `a changed artifact version must move exactly one SemVer step from ${base.version}` }];\n};\n","import { versionFromSource, type Artifact } from \"../artifacts/discover.js\";\nimport { validateArtifactVersionTransition, type ArtifactVersionDiagnostic } from \"../versioning/validate.js\";\n\nexport type ArtifactChange = {\n base?: Artifact;\n current?: Artifact;\n status: \"added\" | \"modified\" | \"renamed\" | \"deleted\";\n /** Whether content other than the frontmatter version changed. */\n changedBeyondVersion?: boolean;\n /** Base content for a rename, including a move into a kind folder. */\n previousSource?: string;\n};\n\nexport type VersionTransitionCheck = {\n errors: ArtifactVersionDiagnostic[];\n};\n\nexport type VersionTransitionCheckOptions = {\n /** The version rules begin only after the repository has adopted CONTRACTS. */\n baseHasContracts?: boolean;\n};\n\n/**\n * Applies document-owned version rules to changes supplied by either the local\n * Git adapter or GitHub's authoritative PR-files API adapter.\n */\nexport const checkArtifactVersionTransitions = (\n changes: ArtifactChange[],\n { baseHasContracts = true }: VersionTransitionCheckOptions = {}\n): VersionTransitionCheck => {\n if (!baseHasContracts) return { errors: [] };\n const errors = changes.flatMap(({ base, current, status, changedBeyondVersion, previousSource }) => {\n const previousVersion = status === \"renamed\" && previousSource !== undefined ? versionFromSource(previousSource) : undefined;\n const renameBase = !base && current && previousVersion\n ? { ...current, version: previousVersion }\n : base;\n return (\n validateArtifactVersionTransition(\n {\n base: renameBase,\n current,\n changed: status !== \"deleted\",\n changedBeyondVersion\n }\n ));\n });\n return { errors };\n};\n","const normalizePath = (path: string): string => {\n if (!path || path.startsWith(\"/\") || path.startsWith(\"./\") || path.includes(\"\\\\\") || path.split(\"/\").some((part) => part === \".\" || part === \"..\" || !part)) throw new Error(`path must be normalized and repository-relative: ${path}`);\n return path;\n};\nconst splitSegments = (pattern: string): string[] => {\n const segments: string[] = [];\n let segment = \"\";\n let escaped = false;\n for (const character of pattern) {\n if (escaped) { segment += `\\\\${character}`; escaped = false; }\n else if (character === \"\\\\\") escaped = true;\n else if (character === \"/\") { segments.push(segment); segment = \"\"; }\n else segment += character;\n }\n if (escaped) segment += \"\\\\\";\n segments.push(segment);\n return segments;\n};\nconst matchSegment = (pattern: string, value: string): boolean => {\n const memo = new Map<string, boolean>();\n const visit = (patternIndex: number, valueIndex: number): boolean => {\n const key = `${patternIndex}:${valueIndex}`;\n const cached = memo.get(key);\n if (cached !== undefined) return cached;\n let result: boolean;\n if (patternIndex === pattern.length) result = valueIndex === value.length;\n else if (pattern[patternIndex] === \"\\\\\") result = valueIndex < value.length && pattern[patternIndex + 1] === value[valueIndex] && visit(patternIndex + 2, valueIndex + 1);\n else if (pattern[patternIndex] === \"*\") result = visit(patternIndex + 1, valueIndex) || (valueIndex < value.length && visit(patternIndex, valueIndex + 1));\n else if (pattern[patternIndex] === \"?\") result = valueIndex < value.length && visit(patternIndex + 1, valueIndex + 1);\n else result = valueIndex < value.length && pattern[patternIndex] === value[valueIndex] && visit(patternIndex + 1, valueIndex + 1);\n memo.set(key, result);\n return result;\n };\n return visit(0, 0);\n};\n\nexport const validatePattern = (rawPattern: string): void => {\n if (rawPattern.length === 0 || rawPattern.length > 1024) throw new Error(\"pattern must contain 1 to 1024 characters\");\n const pattern = rawPattern.startsWith(\"/\") ? rawPattern.slice(1) : rawPattern;\n if (pattern.includes(\"//\")) throw new Error(\"pattern must not contain an empty segment\");\n const segments = splitSegments(pattern.endsWith(\"/\") ? pattern.slice(0, -1) : pattern);\n if (segments.length > 128) throw new Error(\"pattern exceeds 128 segments\");\n for (const segment of segments) {\n let escaped = false;\n for (let index = 0; index < segment.length; index += 1) {\n const character = segment[index];\n if (escaped) { escaped = false; continue; }\n if (character === \"\\\\\") { escaped = true; continue; }\n if (character === \"*\" && segment[index + 1] === \"*\" && segment !== \"**\") throw new Error(\"globstar must occupy a complete segment\");\n }\n }\n};\n\nexport const matchesPattern = (path: string, rawPattern: string): boolean => {\n const normalizedPath = normalizePath(path);\n validatePattern(rawPattern);\n const rootAnchored = rawPattern.startsWith(\"/\");\n const pattern = rootAnchored ? rawPattern.slice(1) : rawPattern;\n const directory = pattern.endsWith(\"/\");\n const segments = splitSegments(directory ? pattern.slice(0, -1) : pattern).filter((segment, index, all) => segment !== \"**\" || all[index - 1] !== \"**\");\n const pathSegments = normalizedPath.split(\"/\");\n const anchored = rootAnchored || segments.length > 1;\n const starts = anchored ? [0] : pathSegments.map((_, index) => index);\n\n return starts.some((start) => {\n const memo = new Map<string, boolean>();\n const visit = (patternIndex: number, pathIndex: number): boolean => {\n const key = `${patternIndex}:${pathIndex}`;\n const cached = memo.get(key);\n if (cached !== undefined) return cached;\n let result: boolean;\n if (patternIndex === segments.length) result = directory ? pathIndex < pathSegments.length : true;\n else if (segments[patternIndex] === \"**\") result = visit(patternIndex + 1, pathIndex) || (pathIndex < pathSegments.length && visit(patternIndex, pathIndex + 1));\n else result = pathIndex < pathSegments.length && matchSegment(segments[patternIndex], pathSegments[pathIndex]) && visit(patternIndex + 1, pathIndex + 1);\n memo.set(key, result);\n return result;\n };\n return visit(0, start);\n });\n};\n","export type ContractEntry =\n | { kind: \"linked\"; path: string }\n | { kind: \"versioned\"; id: string; range: string }\n | { kind: \"external\"; repository: string; id: string; range: string };\n\nexport type ContractLine = {\n line: number;\n pattern: string;\n entries: ContractEntry[];\n};\n\nexport type ContractParseResult = {\n lines: ContractLine[];\n errors: Array<{ line: number; message: string }>;\n};\n\nimport { validatePattern } from \"./matcher.js\";\n\nconst entryPattern = /^(?:(?<repository>[a-z0-9_.-]+\\/[a-z0-9_.-]+):)?(?<id>[a-z]+\\/[a-z0-9_./-]+)@(?<range>.+)$/i;\n\nconst splitFields = (line: string): string[] => {\n const fields: string[] = [];\n let field = \"\";\n let escaped = false;\n\n for (const character of line.trim()) {\n if (escaped) {\n field += `\\\\${character}`;\n escaped = false;\n } else if (character === \"\\\\\") {\n escaped = true;\n } else if (/\\s/.test(character)) {\n if (field) fields.push(field);\n field = \"\";\n } else {\n field += character;\n }\n }\n if (escaped) field += \"\\\\\";\n if (field) fields.push(field);\n return fields;\n};\n\nexport const parseContractsFile = (source: string): ContractParseResult => {\n const lines: ContractLine[] = [];\n const errors: ContractParseResult[\"errors\"] = [];\n\n source.split(/\\r?\\n/).forEach((rawLine, index) => {\n const line = index + 1;\n const trimmed = rawLine.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) return;\n\n const [pattern, ...rawEntries] = splitFields(rawLine);\n if (!pattern || rawEntries.length === 0) {\n errors.push({ line, message: \"expected a path pattern and at least one entry\" });\n return;\n }\n if (pattern.startsWith(\"!\")) {\n errors.push({ line, message: \"negation is not valid in CONTRACTS\" });\n return;\n }\n try {\n validatePattern(pattern);\n } catch (error) {\n errors.push({ line, message: error instanceof Error ? error.message : \"invalid glob pattern\" });\n return;\n }\n\n const entries: ContractEntry[] = [];\n for (const rawEntry of rawEntries) {\n const match = entryPattern.exec(rawEntry);\n if (!match?.groups) {\n if (/^(?:prd|adr|spec|design|standard|procedure)\\//.test(rawEntry)) {\n errors.push({ line, message: `invalid versioned entry ${rawEntry}; did you mean <id>@<range>?` });\n continue;\n }\n entries.push({ kind: \"linked\", path: rawEntry.replace(/\\\\(.)/g, \"$1\") });\n continue;\n }\n const { repository, id, range } = match.groups;\n entries.push(repository\n ? { kind: \"external\", repository, id, range }\n : { kind: \"versioned\", id, range });\n }\n lines.push({ line, pattern, entries });\n });\n\n return { lines, errors };\n};\n","import { valid } from \"semver\";\n\nexport type ContractPin = { version?: string; error?: string };\n\n/** Parses the required, first-line package pin without interpreting any rules. */\nexport const parseContractsPin = (source: string): ContractPin => {\n const lines = source.split(/\\r?\\n/);\n const first = lines[0] ?? \"\";\n const match = /^# @bizibot\\/contracts (.+)$/.exec(first);\n if (match) return valid(match[1]!) === match[1] ? { version: match[1] } : { error: \"package pin must be an exact SemVer version\" };\n if (lines.some((line) => /^# @bizibot\\/contracts\\s/.test(line))) return { error: \"package pin must be the first line of CONTRACTS\" };\n return { error: \"missing first-line package pin (# @bizibot/contracts <version>)\" };\n};\n\n/** Replaces any old pin while preserving all adopter-owned CONTRACTS rules. */\nexport const withContractsPin = (source: string | undefined, version: string): string => {\n const body = (source ?? \"# path pattern governing artifacts\\n\").split(/\\r?\\n/)\n .filter((line) => !/^# @bizibot\\/contracts\\s/.test(line)).join(\"\\n\");\n return `# @bizibot/contracts ${version}\\n${body}`;\n};\n\n/** `init` only changes an adopted repository's pin when explicitly updating it. */\nexport const contractsSourceForInit = (source: string | undefined, version: string, update: boolean): string =>\n source !== undefined && parseContractsPin(source).version !== undefined && !update ? source : withContractsPin(source, version);\n","import type { ContractEntry, ContractLine } from \"./parse.js\";\nimport { matchesPattern } from \"./matcher.js\";\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport { validRange } from \"semver\";\n\nconst keyFor = (entry: ContractEntry): string => entry.kind === \"linked\"\n ? `path:${entry.path}`\n : entry.kind === \"external\"\n ? `external:${entry.repository}:${entry.id}`\n : `id:${entry.id}`;\n\nconst appliesToSelf = (entry: ContractEntry, path: string, artifact: Artifact | undefined): boolean =>\n (entry.kind === \"linked\" && entry.path === path) ||\n (artifact !== undefined && entry.kind === \"versioned\" && entry.id === artifact.id);\n\nexport type ResolvedContractEntry = { entry: ContractEntry; line: number };\n\nexport const resolveGoverningEntryDetails = (path: string, lines: ContractLine[], artifact?: Artifact): ResolvedContractEntry[] => {\n const resolved = new Map<string, ResolvedContractEntry>();\n for (const line of lines) {\n if (!matchesPattern(path, line.pattern)) continue;\n for (const entry of line.entries) if (!appliesToSelf(entry, path, artifact)) resolved.set(keyFor(entry), { entry, line: line.line });\n }\n return [...resolved.values()];\n};\n\nexport const resolveGoverningEntries = (path: string, lines: ContractLine[], artifact?: Artifact): ContractEntry[] =>\n resolveGoverningEntryDetails(path, lines, artifact).map(({ entry }) => entry);\n\nexport const resolveArtifactGoverningEntries = (artifact: Artifact, lines: ContractLine[]): ContractEntry[] =>\n resolveGoverningEntries(artifact.path, lines, artifact);\n\nexport const findDependentLines = (idOrPath: string, lines: ContractLine[]): ContractLine[] => lines.filter((line) =>\n line.entries.some((entry) => {\n if (entry.kind === \"linked\") return entry.path === idOrPath;\n if (entry.kind === \"external\") return `${entry.repository}:${entry.id}` === idOrPath;\n return entry.id === idOrPath;\n })\n);\n\nexport type ContractDiagnostic = { line: number; message: string };\n\nexport const findArtifactWarnings = (lines: ContractLine[], artifacts: Artifact[]): ContractDiagnostic[] => {\n const byPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]));\n const byId = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.id, artifact]));\n const warnings: ContractDiagnostic[] = [];\n for (const line of lines) for (const entry of line.entries) {\n const artifact = entry.kind === \"linked\" ? byPath.get(entry.path) : entry.kind === \"versioned\" ? byId.get(entry.id) : undefined;\n if (artifact?.status === \"deprecated\") warnings.push({ line: line.line, message: `${artifact.id} is deprecated` });\n if (artifact?.status === \"superseded\") warnings.push({ line: line.line, message: `${artifact.id} is superseded${artifact.supersededBy ? ` by ${artifact.supersededBy}` : \"\"}` });\n }\n return warnings;\n};\n\nexport const validateLinkedArtifactReferences = (lines: ContractLine[], artifacts: Artifact[]): ContractDiagnostic[] => {\n const artifactsByPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]));\n const referencesByArtifact = new Map<string, Array<{ line: number; form: \"linked\" | \"versioned\" }>>();\n const errors: ContractDiagnostic[] = [];\n for (const line of lines) {\n for (const entry of line.entries) {\n if (entry.kind === \"external\") {\n if (!validRange(entry.range)) errors.push({ line: line.line, message: `${entry.range} is not a valid SemVer range` });\n continue;\n }\n const artifact = entry.kind === \"linked\" ? artifactsByPath.get(entry.path) : artifacts.find((candidate) => candidate.id === entry.id);\n if (!artifact) {\n errors.push({ line: line.line, message: `${entry.kind === \"linked\" ? entry.path : entry.id} does not name a local governing artifact` });\n continue;\n }\n if (entry.kind === \"versioned\" && !artifact.version) errors.push({ line: line.line, message: `${artifact.id} has no version; use a linked path or add version: 0.1.0 to opt in` });\n if (entry.kind === \"versioned\" && !validRange(entry.range)) errors.push({ line: line.line, message: `${entry.range} is not a valid SemVer range` });\n const form = entry.kind === \"linked\" ? \"linked\" : \"versioned\";\n const prior = referencesByArtifact.get(artifact.id) ?? [];\n prior.push({ line: line.line, form });\n referencesByArtifact.set(artifact.id, prior);\n }\n }\n for (const [id, references] of referencesByArtifact) {\n if (references.some((reference) => reference.form === \"linked\") && references.some((reference) => reference.form === \"versioned\")) {\n errors.push({ line: references[0].line, message: `${id} mixes linked and versioned references on lines ${references.map((reference) => reference.line).join(\", \")}` });\n }\n }\n return errors;\n};\n","import { discoverArtifact, type Artifact } from \"../artifacts/discover.js\";\nimport { parseContractsFile } from \"../contracts-file/parse.js\";\nimport { parseContractsPin } from \"../contracts-file/pin.js\";\nimport type { ContractLine } from \"../contracts-file/parse.js\";\nimport { findArtifactWarnings, validateLinkedArtifactReferences } from \"../contracts-file/resolve.js\";\nimport { matchesPattern } from \"../contracts-file/matcher.js\";\n\nexport type RepositoryDiagnostic = {\n path: string;\n line?: number;\n message: string;\n};\n\nexport type RepositoryCheck = {\n pin?: string;\n artifacts: Artifact[];\n lines: ContractLine[];\n errors: RepositoryDiagnostic[];\n warnings: RepositoryDiagnostic[];\n};\n\n/**\n * Validates a complete repository snapshot supplied by a local filesystem or\n * a trusted CI adapter. File contents are parsed only as data.\n */\nexport const checkRepository = (files: Readonly<Record<string, string>>, paths: readonly string[] = Object.keys(files)): RepositoryCheck => {\n const artifacts: Artifact[] = [];\n const errors: RepositoryDiagnostic[] = [];\n const warnings: RepositoryDiagnostic[] = [];\n\n for (const [path, source] of Object.entries(files)) {\n const discovered = discoverArtifact(path, source);\n errors.push(...discovered.errors.map((message) => ({ path, message })));\n if (discovered.artifact) artifacts.push(discovered.artifact);\n }\n\n const ids = new Map<string, Artifact>();\n for (const artifact of artifacts) {\n const prior = ids.get(artifact.id);\n if (prior) errors.push({ path: artifact.path, message: `${artifact.id} duplicates ${prior.path}` });\n else ids.set(artifact.id, artifact);\n }\n\n const contracts = files.CONTRACTS;\n if (contracts === undefined) {\n errors.push({ path: \"CONTRACTS\", message: \"missing root CONTRACTS file\" });\n return { artifacts, lines: [], errors, warnings };\n }\n\n const pin = parseContractsPin(contracts);\n if (pin.error) errors.push({ path: \"CONTRACTS\", line: 1, message: pin.error });\n\n const parsed = parseContractsFile(contracts);\n errors.push(...parsed.errors.map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n errors.push(...validateLinkedArtifactReferences(parsed.lines, artifacts).map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n warnings.push(...findArtifactWarnings(parsed.lines, artifacts).map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n const normalizedPaths = paths.map((path) => path.replace(/^\\.\\//, \"\").replaceAll(\"\\\\\", \"/\"));\n warnings.push(...parsed.lines.filter((line) => !normalizedPaths.some((path) => matchesPattern(path, line.pattern))).map((line) => ({ path: \"CONTRACTS\", line: line.line, message: `dead pattern ${line.pattern}` })));\n return { artifacts, ...(pin.version ? { pin: pin.version } : {}), lines: parsed.lines, errors, warnings };\n};\n","import { satisfies } from \"semver\";\n\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport type { ContractLine } from \"./parse.js\";\nimport { resolveGoverningEntryDetails } from \"./resolve.js\";\n\nexport type RangeDiagnostic = { line: number; message: string };\n\n/**\n * Checks ranges actually selected for each path in a complete snapshot. Local\n * artifact files never select themselves, even through a broad pattern.\n */\nexport const validateContractRanges = (paths: Iterable<string>, lines: ContractLine[], artifacts: Artifact[]): RangeDiagnostic[] => {\n const byId = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.id, artifact]));\n const byPath = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.path, artifact]));\n const violations = new Map<string, { line: number; id: string; version: string; range: string; paths: string[] }>();\n\n for (const path of paths) {\n const subject = byPath.get(path);\n for (const { entry, line } of resolveGoverningEntryDetails(path, lines, subject)) {\n if (entry.kind !== \"versioned\") continue;\n const artifact = byId.get(entry.id);\n if (!artifact?.version || satisfies(artifact.version, entry.range)) continue;\n const key = `${line}:${entry.id}:${entry.range}`;\n const violation = violations.get(key) ?? { line, id: entry.id, version: artifact.version, range: entry.range, paths: [] };\n violation.paths.push(path);\n violations.set(key, violation);\n }\n }\n return [...violations.values()].sort((left, right) => left.line - right.line || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)).map(({ line, id, version, range, paths: matchedPaths }) => {\n const paths = [...matchedPaths].sort();\n const samples = paths.slice(0, 3).join(\", \");\n const example = paths.length > 3 ? `${samples}, …` : samples;\n const count = `${paths.length} ${paths.length === 1 ? \"path\" : \"paths\"}`;\n return { line, message: `${id}@${version} does not satisfy ${range} (${count}, e.g. ${example})` };\n });\n};\n","/** Canonical install folders used by `init --agents` and snapshot validation. */\nexport const AGENT_SKILL_FOLDERS = {\n claude: \".claude/skills\",\n copilot: \".github/skills\"\n} as const;\n\nexport const MANAGED_MARKER = \"@bizibot/contracts\";\n\nexport const managedProcedureSource = (version: string, workflow: string): string => `<!-- BEGIN ${MANAGED_MARKER} ${version} (managed: do not edit; run \\`contracts init --update\\`) -->\\n\\n${workflow.endsWith(\"\\n\") ? workflow : `${workflow}\\n`}<!-- END ${MANAGED_MARKER} -->\\n`;\n\nconst escapeRegex = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\nconst managedSkill = new RegExp(`^(?:${Object.values(AGENT_SKILL_FOLDERS).map(escapeRegex).join(\"|\")})/(contracts-[a-z0-9-]+)/SKILL\\\\.md$`);\nconst versionMarker = new RegExp(`${MANAGED_MARKER.replace(\"/\", \"\\\\/\")}\\\\s+(\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[0-9A-Za-z.-]+)?)`);\n\ntype RegistryPackage = { dist: { tarball: string; integrity: string } };\n\nconst tarEntry = (archive: Buffer, path: string): string => {\n let offset = 0;\n while (offset + 512 <= archive.length) {\n const header = archive.subarray(offset, offset + 512);\n const name = header.subarray(0, 100).toString(\"utf8\").replace(/\\0.*$/, \"\");\n const size = Number.parseInt(header.subarray(124, 136).toString(\"utf8\").replace(/\\0.*$/, \"\").trim() || \"0\", 8);\n const start = offset + 512;\n if (name === `package/${path}`) return archive.subarray(start, start + size).toString(\"utf8\");\n offset = start + Math.ceil(size / 512) * 512;\n }\n throw new Error(`managed package archive is missing ${path}`);\n};\n\n/** Reads package-owned bytes from an integrity-checked registry tarball as data. */\nconst readRegistryFiles = async (version: string, paths: readonly string[]): Promise<Record<string, string>> => {\n const { createHash, timingSafeEqual } = await import(\"node:crypto\");\n const { gunzipSync } = await import(\"node:zlib\");\n const registry = (process.env.npm_config_registry ?? \"https://registry.npmjs.org\").replace(/\\/$/, \"\");\n const metadataResponse = await fetch(`${registry}/${encodeURIComponent(\"@bizibot/contracts\")}/${version}`);\n if (!metadataResponse.ok) throw new Error(`cannot read @bizibot/contracts@${version} registry metadata (${metadataResponse.status})`);\n const metadata = await metadataResponse.json() as RegistryPackage;\n const archiveResponse = await fetch(metadata.dist.tarball);\n if (!archiveResponse.ok) throw new Error(`cannot read @bizibot/contracts@${version} archive (${archiveResponse.status})`);\n const compressed = Buffer.from(await archiveResponse.arrayBuffer());\n const [algorithm, encoded] = metadata.dist.integrity.split(\"-\", 2);\n if (algorithm !== \"sha512\" || !encoded) throw new Error(`@bizibot/contracts@${version} has no supported SHA-512 integrity`);\n const actual = createHash(\"sha512\").update(compressed).digest();\n const expected = Buffer.from(encoded, \"base64\");\n if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) throw new Error(`@bizibot/contracts@${version} archive failed integrity verification`);\n const archive = gunzipSync(compressed);\n return Object.fromEntries(paths.map((path) => [path, tarEntry(archive, path)]));\n};\n\n/**\n * Loads the exact package-owned bytes for managed files present in a snapshot.\n * The caller supplies them to the pure checker, so CI can inspect PR data\n * without executing or importing anything from the PR.\n */\nexport const loadManagedFileExpectations = async (contents: Readonly<Record<string, string>>, pin?: string): Promise<Record<string, string>> => {\n const { readFile } = await import(\"node:fs/promises\");\n const packageJson = await import(\"../package.json\", { with: { type: \"json\" } });\n const expected: Record<string, string> = {};\n const resources = new Map<string, { version: string; path: string; transform: (source: string) => string }>();\n const versionFor = (source: string, path: string): string => {\n const version = source.match(versionMarker)?.[1];\n if (!version) throw new Error(`${path} has an invalid @bizibot/contracts managed-file marker`);\n return version;\n };\n if (contents[\"AGENTS.md\"]?.includes(`BEGIN ${MANAGED_MARKER}`)) resources.set(\"AGENTS.md\", { version: versionFor(contents[\"AGENTS.md\"], \"AGENTS.md\"), path: \"templates/agents-section.md\", transform: (source) => source });\n if (contents[\"docs/procedures/contracts-workflow.md\"]?.includes(`BEGIN ${MANAGED_MARKER}`)) resources.set(\"docs/procedures/contracts-workflow.md\", { version: versionFor(contents[\"docs/procedures/contracts-workflow.md\"], \"docs/procedures/contracts-workflow.md\"), path: \"docs/workflow.md\", transform: (source) => managedProcedureSource(\"{{version}}\", source) });\n for (const path of Object.keys(contents)) {\n const skill = managedSkill.exec(path)?.[1];\n if (skill && contents[path]?.includes(MANAGED_MARKER)) resources.set(path, { version: versionFor(contents[path], path), path: `skills/${skill}/SKILL.md`, transform: (source) => source });\n }\n const cache = new Map<string, Record<string, string>>();\n for (const [target, resource] of resources) {\n if (pin && resource.version !== pin) throw new Error(`${target} has @bizibot/contracts marker ${resource.version}, which does not match CONTRACTS pin ${pin}`);\n let source: string;\n if (resource.version === packageJson.default.version) source = await readFile(new URL(`../${resource.path}`, import.meta.url), \"utf8\");\n else {\n if (!cache.has(resource.version)) cache.set(resource.version, await readRegistryFiles(resource.version, [...resources.values()].filter((entry) => entry.version === resource.version).map((entry) => entry.path)));\n source = cache.get(resource.version)![resource.path]!;\n }\n expected[target] = resource.transform(source).replaceAll(\"{{version}}\", resource.version);\n }\n return expected;\n};\n\nexport const managedFileDiagnostics = (contents: Readonly<Record<string, string>>, expected: Readonly<Record<string, string>>): { path: string; message: string }[] =>\n Object.entries(expected).flatMap(([path, source]) => contents[path] === undefined || (path === \"AGENTS.md\" ? contents[path].includes(source) : contents[path] === source) ? [] : [{ path, message: \"managed file differs from the installed @bizibot/contracts version; run contracts init --update\" }]);\n","import { validateContractRanges } from \"../contracts-file/ranges.js\";\n\nimport { checkRepository, type RepositoryDiagnostic } from \"./repository.js\";\nimport { checkArtifactVersionTransitions, type ArtifactChange } from \"./version-transitions.js\";\nimport type { ArtifactVersionDiagnostic } from \"../versioning/validate.js\";\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport { DEFAULT_KIND_FOLDERS } from \"../artifacts/discover.js\";\nimport { AGENT_SKILL_FOLDERS } from \"../managed.js\";\nimport { managedFileDiagnostics } from \"../managed.js\";\n\nexport type RepositorySnapshot = { paths: readonly string[]; contents: Readonly<Record<string, string>> };\nexport type FileChange = { status: \"added\" | \"modified\" | \"renamed\" | \"deleted\"; path: string; previousPath?: string };\nexport type SnapshotCheckInput = {\n snapshot: RepositorySnapshot;\n base: RepositorySnapshot;\n changes: FileChange[];\n targetIsDefaultBranch: boolean;\n managedFiles?: Readonly<Record<string, string>>;\n};\n\nconst versionLine = /^version:[^\\r\\n]*(?:\\r?\\n|$)/m;\nconst sameExceptVersion = (left: string, right: string): boolean => left.replace(versionLine, \"version: <contract-version>\\n\") === right.replace(versionLine, \"version: <contract-version>\\n\");\n\nexport const deriveArtifactChanges = (changes: FileChange[], base: RepositorySnapshot, current: RepositorySnapshot, baseArtifacts: Artifact[], currentArtifacts: Artifact[]): ArtifactChange[] => {\n const baseByPath = new Map(baseArtifacts.map((artifact) => [artifact.path, artifact]));\n const currentByPath = new Map(currentArtifacts.map((artifact) => [artifact.path, artifact]));\n return changes.map(({ status, path, previousPath }) => {\n const priorPath = previousPath ?? path;\n const previousSource = base.contents[priorPath];\n const currentSource = current.contents[path];\n return { status, base: baseByPath.get(priorPath), current: currentByPath.get(path), previousSource, changedBeyondVersion: previousSource !== undefined && currentSource !== undefined && !sameExceptVersion(previousSource, currentSource) };\n });\n};\n\nexport type SnapshotCheckDiagnostic =\n | ({ category: \"repository\" } & RepositoryDiagnostic)\n | ({ category: \"version\" } & ArtifactVersionDiagnostic)\n | { category: \"range\"; path: \"CONTRACTS\"; line: number; message: string };\n\nconst escapeRegex = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\nconst kindMarkdown = new RegExp(`^(?:${Object.values(DEFAULT_KIND_FOLDERS).map(escapeRegex).join(\"|\")})/.+\\\\.md$`);\nconst ignoredMarkdown = /\\/(?:INDEX|README)\\.md$/;\nconst managedSkill = new RegExp(`^(?:${Object.values(AGENT_SKILL_FOLDERS).map(escapeRegex).join(\"|\")})/contracts-[a-z0-9-]+/`);\nexport const requiresSnapshotContent = (path: string): boolean => path === \"CONTRACTS\" || path === \"AGENTS.md\" || managedSkill.test(path) || (kindMarkdown.test(path) && !ignoredMarkdown.test(path));\nexport const isGoverningArtifactPath = (path: string): boolean => kindMarkdown.test(path) && !ignoredMarkdown.test(path);\n\nconst incompleteSnapshotDiagnostics = (snapshot: RepositorySnapshot, changes: FileChange[], base: boolean): RepositoryDiagnostic[] => {\n const required = new Set(snapshot.paths.filter(requiresSnapshotContent));\n if (base) for (const change of changes) if (change.status === \"renamed\" && change.previousPath && kindMarkdown.test(change.path)) required.add(change.previousPath);\n return [...required].filter((path) => (snapshot.paths.includes(path) || (base && changes.some((change) => change.status === \"renamed\" && change.previousPath === path))) && snapshot.contents[path] === undefined)\n .sort().map((path) => ({ path, message: \"incomplete snapshot: required file content is missing\" }));\n};\n\nconst compareCodeUnits = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nconst diagnosticOrder = (left: SnapshotCheckDiagnostic, right: SnapshotCheckDiagnostic): number => {\n const category = compareCodeUnits(left.category, right.category);\n if (category !== 0) return category;\n const leftPath = \"path\" in left ? left.path : left.artifact;\n const rightPath = \"path\" in right ? right.path : right.artifact;\n const leftLine = \"line\" in left ? left.line ?? 0 : 0;\n const rightLine = \"line\" in right ? right.line ?? 0 : 0;\n return compareCodeUnits(leftPath, rightPath) || leftLine - rightLine || compareCodeUnits(left.message, right.message);\n};\n\nexport const checkSnapshot = (input: SnapshotCheckInput): { errors: SnapshotCheckDiagnostic[]; warnings: RepositoryDiagnostic[] } => {\n const repository = checkRepository(input.snapshot.contents, input.snapshot.paths);\n const baseRepository = checkRepository(input.base.contents, input.base.paths);\n const transitions = checkArtifactVersionTransitions(deriveArtifactChanges(input.changes, input.base, input.snapshot, baseRepository.artifacts, repository.artifacts), {\n baseHasContracts: input.base.contents.CONTRACTS !== undefined\n });\n const ranges = input.targetIsDefaultBranch\n ? validateContractRanges(input.snapshot.paths, repository.lines, repository.artifacts)\n : [];\n return {\n errors: [\n ...repository.errors.map((error) => ({ category: \"repository\" as const, ...error })),\n ...managedFileDiagnostics(input.snapshot.contents, input.managedFiles ?? {}).map((error) => ({ category: \"repository\" as const, ...error })),\n ...incompleteSnapshotDiagnostics(input.snapshot, input.changes, false).map((error) => ({ category: \"repository\" as const, ...error })),\n ...incompleteSnapshotDiagnostics(input.base, input.changes, true).map((error) => ({ category: \"repository\" as const, ...error })),\n ...transitions.errors.map((error) => ({ category: \"version\" as const, ...error })),\n ...ranges.map((error) => ({ category: \"range\" as const, path: \"CONTRACTS\" as const, ...error }))\n ].sort(diagnosticOrder),\n warnings: repository.warnings\n };\n};\n","import { lt, valid } from \"semver\";\n\nimport { validateContractRanges } from \"../contracts-file/ranges.js\";\nimport { checkRepository, type RepositoryDiagnostic } from \"./repository.js\";\nimport type { RepositorySnapshot } from \"./snapshot.js\";\n\n/** Validates the merged tree against durable artifact tags, never commit text. */\nexport const checkReleaseSnapshot = (snapshot: RepositorySnapshot, tags: readonly string[]): { errors: RepositoryDiagnostic[]; artifacts: ReturnType<typeof checkRepository>[\"artifacts\"] } => {\n const repository = checkRepository(snapshot.contents, snapshot.paths);\n const errors: RepositoryDiagnostic[] = [\n ...repository.errors,\n ...validateContractRanges(snapshot.paths, repository.lines, repository.artifacts).map((error) => ({ path: \"CONTRACTS\", line: error.line, message: error.message }))\n ];\n const byId = new Map(repository.artifacts.map((artifact) => [artifact.id, artifact]));\n for (const tag of tags) {\n const split = tag.lastIndexOf(\"@\");\n if (split <= 0 || !tag.includes(\"/\")) continue;\n const taggedVersion = tag.slice(split + 1);\n if (!valid(taggedVersion)) continue;\n const artifact = byId.get(tag.slice(0, split) as typeof repository.artifacts[number][\"id\"]);\n if (!artifact) continue;\n if (!artifact.version) errors.push({ path: artifact.path, message: `${artifact.id} removed its version after tag ${tag}` });\n else if (lt(artifact.version, taggedVersion)) errors.push({ path: artifact.path, message: `${artifact.id}@${artifact.version} is lower than existing tag ${tag}` });\n }\n return { errors, artifacts: repository.artifacts };\n};\n\n/** Tags each versioned artifact whose recorded version has no tag yet (spec §5.3). */\nexport const tagsToCreate = (artifacts: readonly { id: string; version?: string }[], tags: readonly string[]): string[] => {\n const existing = new Set(tags);\n return artifacts.flatMap((artifact) => artifact.version && !existing.has(`${artifact.id}@${artifact.version}`) ? [`${artifact.id}@${artifact.version}`] : []);\n};\n","import { execFile as execFileCallback } from \"node:child_process\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { promisify } from \"node:util\";\nimport { join, relative } from \"node:path\";\n\nimport type { RepositorySnapshot } from \"./check/snapshot.js\";\nimport type { FileChange } from \"./check/snapshot.js\";\nimport { requiresSnapshotContent } from \"./check/snapshot.js\";\n\nconst walk = async (root: string, directory = root): Promise<string[]> => {\n const entries = await readdir(directory, { withFileTypes: true });\n const paths: string[] = [];\n for (const entry of entries) {\n if (entry.name === \".git\" || entry.name === \"node_modules\" || entry.name === \"dist\") continue;\n const full = join(directory, entry.name);\n if (entry.isDirectory()) paths.push(...await walk(root, full));\n else if (entry.isFile()) paths.push(relative(root, full).replaceAll(\"\\\\\", \"/\"));\n }\n return paths;\n};\n\nexport const readLocalSnapshot = async (root: string): Promise<RepositorySnapshot> => {\n let paths: string[];\n try {\n paths = (await git(root, [\"ls-files\", \"--cached\", \"--others\", \"--exclude-standard\"])).split(\"\\n\").filter(Boolean).sort();\n } catch {\n paths = (await walk(root)).sort();\n }\n const contents = Object.fromEntries(await Promise.all(paths.filter(requiresSnapshotContent).map(async (path) => [path, await readFile(join(root, path), \"utf8\")] as const)));\n return { paths, contents };\n};\n\nconst execFile = promisify(execFileCallback);\nconst git = async (root: string, args: string[]): Promise<string> => (await execFile(\"git\", args, { cwd: root })).stdout;\nexport const runGit = git;\n\nexport const readGitSnapshot = async (root: string, revision: string, additionalContents: readonly string[] = []): Promise<RepositorySnapshot> => {\n const paths = (await git(root, [\"ls-tree\", \"-r\", \"--name-only\", revision])).split(\"\\n\").filter(Boolean).sort();\n const contentPaths = paths.filter((path) => requiresSnapshotContent(path) || additionalContents.includes(path));\n const contents = Object.fromEntries(await Promise.all(contentPaths.map(async (path) => [path, await git(root, [\"show\", `${revision}:${path}`])] as const)));\n return { paths, contents };\n};\n\nexport const readLocalChanges = async (root: string, base: string): Promise<FileChange[]> => {\n const output = await git(root, [\"diff\", \"--name-status\", \"-M\", base, \"--\"]);\n const changes: FileChange[] = output.split(\"\\n\").filter(Boolean).map((line): FileChange => {\n const [rawStatus, first, second] = line.split(\"\\t\");\n const status = rawStatus.startsWith(\"R\") ? \"renamed\" : rawStatus === \"A\" ? \"added\" : rawStatus === \"D\" ? \"deleted\" : \"modified\";\n return status === \"renamed\" ? { status, path: second!, previousPath: first! } : { status, path: first! };\n });\n const changed = new Set(changes.map((change) => change.path));\n const untracked = (await git(root, [\"ls-files\", \"--others\", \"--exclude-standard\"])).split(\"\\n\").filter(Boolean);\n return [...changes, ...untracked.filter((path) => !changed.has(path)).map((path) => ({ status: \"added\" as const, path }))];\n};\n\n/** Uses the remote default branch for branch-wide local preview, with a safe single-commit fallback. */\nexport const readLocalBase = async (root: string): Promise<string> => {\n try {\n const defaultRef = (await git(root, [\"symbolic-ref\", \"refs/remotes/origin/HEAD\"])).trim();\n return (await git(root, [\"merge-base\", \"HEAD\", defaultRef])).trim();\n } catch {\n return \"HEAD^\";\n }\n};\n","import type { FileChange, RepositorySnapshot } from \"./check/snapshot.js\";\nimport { requiresSnapshotContent } from \"./check/snapshot.js\";\n\nexport type CiFileOverlay = {\n status: \"added\" | \"modified\" | \"deleted\" | \"renamed\";\n path: string;\n previousPath?: string;\n /** Present only when snapshot validation requires the file's bytes. */\n content?: string;\n};\n\n/** Builds a post-PR sparse snapshot from trusted base data and inert API bytes. */\nexport const overlayCiSnapshot = (base: RepositorySnapshot, overlays: CiFileOverlay[]): { snapshot: RepositorySnapshot; changes: FileChange[] } => {\n const paths = new Set(base.paths);\n const contents: Record<string, string> = { ...base.contents };\n const changes: FileChange[] = [];\n for (const overlay of overlays) {\n if (overlay.status === \"deleted\") {\n paths.delete(overlay.path);\n delete contents[overlay.path];\n } else if (overlay.status === \"renamed\") {\n if (!overlay.previousPath) throw new Error(`renamed API file ${overlay.path} is missing previousPath`);\n paths.delete(overlay.previousPath);\n delete contents[overlay.previousPath];\n paths.add(overlay.path);\n } else paths.add(overlay.path);\n if (overlay.content !== undefined) contents[overlay.path] = overlay.content;\n changes.push({ status: overlay.status, path: overlay.path, previousPath: overlay.previousPath });\n }\n return { snapshot: { paths: [...paths].sort(), contents }, changes };\n};\n\ntype GitHubPull = { changed_files: number; base: { sha: string; ref: string }; head: { sha: string }; };\ntype GitHubFile = { filename: string; status: \"added\" | \"modified\" | \"removed\" | \"renamed\"; previous_filename?: string };\ntype GitHubRepository = { default_branch: string };\n\nexport type GitHubPullRequestData = {\n baseSha: string;\n targetIsDefaultBranch: boolean;\n overlays: CiFileOverlay[];\n};\n\nconst apiError = (response: Response, url: string): Error => new Error(`GitHub API ${response.status} for ${url}`);\nconst decodeContent = (content: string): string => Buffer.from(content.replace(/\\n/g, \"\"), \"base64\").toString(\"utf8\");\n\n/** Reads a pull request as inert API data; it never fetches or evaluates PR code. */\nexport const readGitHubPullRequest = async (repository: string, pullNumber: string, token: string, apiUrl = process.env.GITHUB_API_URL ?? \"https://api.github.com\", fetcher: typeof fetch = fetch): Promise<GitHubPullRequestData> => {\n const request = async <T>(path: string): Promise<T> => {\n const url = `${apiUrl.replace(/\\/$/, \"\")}${path}`;\n const response = await fetcher(url, { headers: { Accept: \"application/vnd.github+json\", Authorization: `Bearer ${token}`, \"X-GitHub-Api-Version\": \"2022-11-28\" } });\n if (!response.ok) throw apiError(response, url);\n return response.json() as Promise<T>;\n };\n const [pull, settings] = await Promise.all([request<GitHubPull>(`/repos/${repository}/pulls/${pullNumber}`), request<GitHubRepository>(`/repos/${repository}`)]);\n const files: GitHubFile[] = [];\n for (let page = 1; ; page += 1) {\n const result = await request<GitHubFile[]>(`/repos/${repository}/pulls/${pullNumber}/files?per_page=100&page=${page}`);\n files.push(...result);\n if (result.length < 100) break;\n }\n if (files.length !== pull.changed_files) throw new Error(`GitHub API returned ${files.length} of ${pull.changed_files} changed files; pull requests above GitHub's file-list limit cannot be checked safely`);\n const overlays: CiFileOverlay[] = [];\n for (const file of files) {\n const status = file.status === \"removed\" ? \"deleted\" : file.status;\n const overlay: CiFileOverlay = { status, path: file.filename, ...(file.previous_filename ? { previousPath: file.previous_filename } : {}) };\n if (status !== \"deleted\" && requiresSnapshotContent(file.filename)) {\n const value = await request<{ content: string; encoding: string }>(`/repos/${repository}/contents/${file.filename.split(\"/\").map(encodeURIComponent).join(\"/\")}?ref=${pull.head.sha}`);\n if (value.encoding !== \"base64\") throw new Error(`GitHub API returned unsupported ${value.encoding} encoding for ${file.filename}`);\n overlay.content = decodeContent(value.content);\n }\n overlays.push(overlay);\n }\n return {\n baseSha: pull.base.sha,\n targetIsDefaultBranch: pull.base.ref === settings.default_branch,\n overlays\n };\n};\n","export const JSON_SCHEMA_VERSION = 1;\n\nexport type JsonEnvelope<T> = {\n schemaVersion: typeof JSON_SCHEMA_VERSION;\n data: T;\n};\n\nexport const toJsonEnvelope = <T>(data: T): JsonEnvelope<T> => ({\n schemaVersion: JSON_SCHEMA_VERSION,\n data\n});\n\nexport { validateArtifactVersionTransition, type ArtifactVersionDiagnostic, type ArtifactVersionTransition } from \"./versioning/validate.js\";\nexport { checkArtifactVersionTransitions, type ArtifactChange, type VersionTransitionCheck, type VersionTransitionCheckOptions } from \"./check/version-transitions.js\";\nexport { checkRepository, type RepositoryCheck, type RepositoryDiagnostic } from \"./check/repository.js\";\nexport { checkSnapshot, type SnapshotCheckDiagnostic, type SnapshotCheckInput } from \"./check/snapshot.js\";\nexport { checkReleaseSnapshot } from \"./check/release.js\";\nexport { readGitSnapshot, readLocalBase, readLocalChanges, readLocalSnapshot, runGit } from \"./local.js\";\nexport { overlayCiSnapshot, readGitHubPullRequest, type CiFileOverlay, type GitHubPullRequestData } from \"./ci.js\";\nexport { validateContractRanges, type RangeDiagnostic } from \"./contracts-file/ranges.js\";\nexport { parseContractsPin, withContractsPin, contractsSourceForInit, type ContractPin } from \"./contracts-file/pin.js\";\n"],"mappings":";AAAA,SAAS,KAAK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AAC,CAAC;AAC/J,QAAM,QAAsB,CAAC;AAC7B,WAAS,OAAO,KAAK,QAAQ,GAAG;AAC9B,UAAM,SAAS,MAAM,QAAsB,UAAU,UAAU,UAAU,UAAU,4BAA4B,IAAI,EAAE;AACrH,UAAM,KAAK,GAAG,MAAM;AACpB,QAAI,OAAO,SAAS,IAAK;AAAA,EAC3B;AACA,MAAI,MAAM,WAAW,KAAK,cAAe,OAAM,IAAI,MAAM,uBAAuB,MAAM,MAAM,OAAO,KAAK,aAAa,uFAAuF;AAC5M,QAAM,WAA4B,CAAC;AACnC,aAAW,QAAQ,OAAO;AACxB,UAAM,SAAS,KAAK,WAAW,YAAY,YAAY,KAAK;AAC5D,UAAM,UAAyB,EAAE,QAAQ,MAAM,KAAK,UAAU,GAAI,KAAK,oBAAoB,EAAE,cAAc,KAAK,kBAAkB,IAAI,CAAC,EAAG;AAC1I,QAAI,WAAW,aAAa,wBAAwB,KAAK,QAAQ,GAAG;AAClE,YAAM,QAAQ,MAAM,QAA+C,UAAU,UAAU,aAAa,KAAK,SAAS,MAAM,GAAG,EAAE,IAAI,kBAAkB,EAAE,KAAK,GAAG,CAAC,QAAQ,KAAK,KAAK,GAAG,EAAE;AACrL,UAAI,MAAM,aAAa,SAAU,OAAM,IAAI,MAAM,mCAAmC,MAAM,QAAQ,iBAAiB,KAAK,QAAQ,EAAE;AAClI,cAAQ,UAAU,cAAc,MAAM,OAAO;AAAA,IAC/C;AACA,aAAS,KAAK,OAAO;AAAA,EACvB;AACA,SAAO;AAAA,IACL,SAAS,KAAK,KAAK;AAAA,IACnB,uBAAuB,KAAK,KAAK,QAAQ,SAAS;AAAA,IAClD;AAAA,EACF;AACF;;;AC7EO,IAAM,sBAAsB;AAO5B,IAAM,iBAAiB,CAAI,UAA8B;AAAA,EAC9D,eAAe;AAAA,EACf;AACF;","names":["folder","versionLine","valid","paths","name","readFile","escapeRegex","managedSkill","valid","valid"]}
1
+ {"version":3,"sources":["../src/versioning/version.ts","../src/artifacts/discover.ts","../src/versioning/validate.ts","../src/check/version-transitions.ts","../src/contracts-file/matcher.ts","../src/contracts-file/parse.ts","../src/contracts-file/pin.ts","../src/contracts-file/resolve.ts","../src/check/repository.ts","../src/contracts-file/ranges.ts","../src/managed.ts","../src/check/snapshot.ts","../src/check/release.ts","../src/local.ts","../src/ci.ts","../src/index.ts"],"sourcesContent":["import { inc, valid } from \"semver\";\n\nimport { extractFrontmatter } from \"../artifacts/discover.js\";\n\nexport type BumpLevel = \"major\" | \"minor\" | \"patch\";\n\nexport const nextVersion = (version: string, level: BumpLevel): string => {\n if (!valid(version)) throw new Error(`${version} is not valid SemVer`);\n return inc(version, level)!;\n};\n\nexport const versionArtifactSource = (source: string, baseVersion: string, level: BumpLevel): string => {\n const target = nextVersion(baseVersion, level);\n const block = extractFrontmatter(source);\n if (block.source === undefined) throw new Error(\"artifact has no frontmatter version field\");\n const newline = source.startsWith(\"---\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const end = source.indexOf(`${newline}---`, 3);\n if (end === -1) throw new Error(\"artifact has no frontmatter version field\");\n const frontmatter = source.slice(0, end + newline.length);\n const versionLine = /^version:[ \\t]*(?:\"[^\"]*\"|'[^']*'|[^\\s#]+)(?<comment>[ \\t]*#.*)?[ \\t]*\\r?$/m;\n if (!versionLine.test(frontmatter)) throw new Error(\"artifact has no frontmatter version field\");\n const rewritten = frontmatter.replace(versionLine, (line, ...args) => {\n const groups = args.at(-1) as { comment?: string } | undefined;\n return `version: ${target}${groups?.comment ?? \"\"}${line.endsWith(\"\\r\") ? \"\\r\" : \"\"}`;\n });\n return rewritten + source.slice(end + newline.length);\n};\n","import { valid as validSemver } from \"semver\";\nimport { parseDocument } from \"yaml\";\n\nexport const DEFAULT_KIND_FOLDERS = { prd: \"docs/prds\", adr: \"docs/adr\", spec: \"docs/specs\", design: \"docs/designs\", standard: \"docs/standards\", procedure: \"docs/procedures\" } as const;\nexport type ArtifactKind = keyof typeof DEFAULT_KIND_FOLDERS;\nexport type Artifact = { id: `${ArtifactKind}/${string}`; kind: ArtifactKind; path: string; status?: \"proposed\" | \"accepted\" | \"deprecated\" | \"superseded\"; supersededBy?: string; version?: string };\nexport type ArtifactDiscovery = { artifact?: Artifact; errors: string[] };\n\nconst statuses = new Set([\"proposed\", \"accepted\", \"deprecated\", \"superseded\"]);\nconst slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*(?:\\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/;\nconst ignoredNames = new Set([\"INDEX\", \"README\"]);\n\nexport const extractFrontmatter = (source: string): { source?: string; error?: string } => {\n if (!source.startsWith(\"---\\n\") && !source.startsWith(\"---\\r\\n\")) return {};\n const newline = source.startsWith(\"---\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n const openingLength = 3 + newline.length;\n const close = source.indexOf(`${newline}---`, openingLength - newline.length);\n const afterClose = close === -1 ? \"\" : source.slice(close + newline.length + 3);\n if (close === -1 || (afterClose !== \"\" && !afterClose.startsWith(newline))) {\n return { error: \"frontmatter is missing its closing delimiter\" };\n }\n return { source: source.slice(openingLength, close) };\n};\n\n/** Reads a canonical artifact version even when the file is not yet in a kind folder. */\nexport const versionFromSource = (source: string): string | undefined => {\n const block = extractFrontmatter(source);\n if (block.source === undefined || block.error) return undefined;\n const document = parseDocument(block.source);\n if (document.errors.length) return undefined;\n const version = (document.toJSON() as Record<string, unknown>).version;\n return typeof version === \"string\" && validSemver(version) === version ? version : undefined;\n};\n\nexport const discoverArtifact = (path: string, source: string, folders: Record<ArtifactKind, string> = DEFAULT_KIND_FOLDERS): ArtifactDiscovery => {\n const normalized = path.replace(/^\\.\\//, \"\").replace(/\\\\/g, \"/\");\n const matches = (Object.entries(folders) as Array<[ArtifactKind, string]>).filter(([, folder]) => normalized.startsWith(`${folder}/`) && normalized.endsWith(\".md\"));\n if (matches.length === 0) return { errors: [] };\n if (matches.length > 1) return { errors: [`${normalized} matches overlapping kind folders`] };\n const [kind, folder] = matches[0];\n const slug = normalized.slice(folder.length + 1, -3);\n if (ignoredNames.has(slug.split(\"/\").at(-1) ?? \"\")) return { errors: [] };\n if (!slugPattern.test(slug)) return { errors: [`${normalized} has an invalid kebab-case slug`] };\n const block = extractFrontmatter(source);\n if (block.error) return { errors: [block.error] };\n const document = block.source === undefined ? undefined : parseDocument(block.source);\n if (document?.errors.length) return { errors: document.errors.map((error) => error.message) };\n const fields = (document?.toJSON() ?? {}) as Record<string, unknown>;\n const errors: string[] = [];\n if (fields.status !== undefined && (typeof fields.status !== \"string\" || !statuses.has(fields.status))) errors.push(\"status must be proposed, accepted, deprecated, or superseded\");\n if (fields.version !== undefined && (typeof fields.version !== \"string\" || validSemver(fields.version) !== fields.version)) errors.push(\"version must be a valid canonical SemVer string\");\n if (errors.length) return { errors };\n return { artifact: { id: `${kind}/${slug}`, kind, path: normalized, status: fields.status as Artifact[\"status\"], ...(typeof fields.superseded_by === \"string\" ? { supersededBy: fields.superseded_by } : {}), version: fields.version as string | undefined }, errors: [] };\n};\n","import type { Artifact } from \"../artifacts/discover.js\";\n\nimport { nextVersion, type BumpLevel } from \"./version.js\";\n\nexport type ArtifactVersionDiagnostic = {\n artifact: string;\n message: string;\n};\n\nexport type ArtifactVersionTransition = {\n base?: Artifact;\n current?: Artifact;\n changed: boolean;\n changedBeyondVersion?: boolean;\n};\n\nconst name = (artifact: Artifact | undefined): string => artifact?.id ?? \"new artifact\";\n\n/** Validates an author-selected, one-step SemVer transition. */\nexport const validateArtifactVersionTransition = (\n transition: ArtifactVersionTransition\n): ArtifactVersionDiagnostic[] => {\n const { base, current, changed, changedBeyondVersion = false } = transition;\n if (!current || !changed) return [];\n\n if (!base) {\n return current.version === undefined || current.version === \"0.1.0\"\n ? []\n : [{ artifact: name(current), message: \"a new versioned artifact must start at 0.1.0\" }];\n }\n\n if (base.version === undefined) {\n return current.version === undefined || current.version === \"0.1.0\"\n ? []\n : [{ artifact: name(current), message: \"an existing artifact may opt into versioning only at 0.1.0\" }];\n }\n\n if (current.version === undefined) {\n return [{ artifact: name(current), message: \"an existing artifact version must not be removed\" }];\n }\n\n if (!changedBeyondVersion) {\n return current.version === base.version\n ? []\n : [{ artifact: name(current), message: `an unchanged artifact must retain its base version ${base.version}` }];\n }\n\n const expected = ([\"major\", \"minor\", \"patch\"] as BumpLevel[]).map((level) => nextVersion(base.version!, level));\n return expected.includes(current.version)\n ? []\n : [{ artifact: name(current), message: `a changed artifact version must move exactly one SemVer step from ${base.version}` }];\n};\n","import { versionFromSource, type Artifact } from \"../artifacts/discover.js\";\nimport { validateArtifactVersionTransition, type ArtifactVersionDiagnostic } from \"../versioning/validate.js\";\n\nexport type ArtifactChange = {\n base?: Artifact;\n current?: Artifact;\n status: \"added\" | \"modified\" | \"renamed\" | \"deleted\";\n /** Whether content other than the frontmatter version changed. */\n changedBeyondVersion?: boolean;\n /** Base content for a rename, including a move into a kind folder. */\n previousSource?: string;\n};\n\nexport type VersionTransitionCheck = {\n errors: ArtifactVersionDiagnostic[];\n};\n\nexport type VersionTransitionCheckOptions = {\n /** The version rules begin only after the repository has adopted CONTRACTS. */\n baseHasContracts?: boolean;\n};\n\n/**\n * Applies document-owned version rules to changes supplied by either the local\n * Git adapter or GitHub's authoritative PR-files API adapter.\n */\nexport const checkArtifactVersionTransitions = (\n changes: ArtifactChange[],\n { baseHasContracts = true }: VersionTransitionCheckOptions = {}\n): VersionTransitionCheck => {\n if (!baseHasContracts) return { errors: [] };\n const errors = changes.flatMap(({ base, current, status, changedBeyondVersion, previousSource }) => {\n const previousVersion = status === \"renamed\" && previousSource !== undefined ? versionFromSource(previousSource) : undefined;\n const renameBase = !base && current && previousVersion\n ? { ...current, version: previousVersion }\n : base;\n return (\n validateArtifactVersionTransition(\n {\n base: renameBase,\n current,\n changed: status !== \"deleted\",\n changedBeyondVersion\n }\n ));\n });\n return { errors };\n};\n","const normalizePath = (path: string): string => {\n if (!path || path.startsWith(\"/\") || path.startsWith(\"./\") || path.includes(\"\\\\\") || path.split(\"/\").some((part) => part === \".\" || part === \"..\" || !part)) throw new Error(`path must be normalized and repository-relative: ${path}`);\n return path;\n};\nconst splitSegments = (pattern: string): string[] => {\n const segments: string[] = [];\n let segment = \"\";\n let escaped = false;\n for (const character of pattern) {\n if (escaped) { segment += `\\\\${character}`; escaped = false; }\n else if (character === \"\\\\\") escaped = true;\n else if (character === \"/\") { segments.push(segment); segment = \"\"; }\n else segment += character;\n }\n if (escaped) segment += \"\\\\\";\n segments.push(segment);\n return segments;\n};\nconst matchSegment = (pattern: string, value: string): boolean => {\n const memo = new Map<string, boolean>();\n const visit = (patternIndex: number, valueIndex: number): boolean => {\n const key = `${patternIndex}:${valueIndex}`;\n const cached = memo.get(key);\n if (cached !== undefined) return cached;\n let result: boolean;\n if (patternIndex === pattern.length) result = valueIndex === value.length;\n else if (pattern[patternIndex] === \"\\\\\") result = valueIndex < value.length && pattern[patternIndex + 1] === value[valueIndex] && visit(patternIndex + 2, valueIndex + 1);\n else if (pattern[patternIndex] === \"*\") result = visit(patternIndex + 1, valueIndex) || (valueIndex < value.length && visit(patternIndex, valueIndex + 1));\n else if (pattern[patternIndex] === \"?\") result = valueIndex < value.length && visit(patternIndex + 1, valueIndex + 1);\n else result = valueIndex < value.length && pattern[patternIndex] === value[valueIndex] && visit(patternIndex + 1, valueIndex + 1);\n memo.set(key, result);\n return result;\n };\n return visit(0, 0);\n};\n\nexport const validatePattern = (rawPattern: string): void => {\n if (rawPattern.length === 0 || rawPattern.length > 1024) throw new Error(\"pattern must contain 1 to 1024 characters\");\n const pattern = rawPattern.startsWith(\"/\") ? rawPattern.slice(1) : rawPattern;\n if (pattern.includes(\"//\")) throw new Error(\"pattern must not contain an empty segment\");\n const segments = splitSegments(pattern.endsWith(\"/\") ? pattern.slice(0, -1) : pattern);\n if (segments.length > 128) throw new Error(\"pattern exceeds 128 segments\");\n for (const segment of segments) {\n let escaped = false;\n for (let index = 0; index < segment.length; index += 1) {\n const character = segment[index];\n if (escaped) { escaped = false; continue; }\n if (character === \"\\\\\") { escaped = true; continue; }\n if (character === \"*\" && segment[index + 1] === \"*\" && segment !== \"**\") throw new Error(\"globstar must occupy a complete segment\");\n }\n }\n};\n\nexport const matchesPattern = (path: string, rawPattern: string): boolean => {\n const normalizedPath = normalizePath(path);\n validatePattern(rawPattern);\n const rootAnchored = rawPattern.startsWith(\"/\");\n const pattern = rootAnchored ? rawPattern.slice(1) : rawPattern;\n const directory = pattern.endsWith(\"/\");\n const segments = splitSegments(directory ? pattern.slice(0, -1) : pattern).filter((segment, index, all) => segment !== \"**\" || all[index - 1] !== \"**\");\n const pathSegments = normalizedPath.split(\"/\");\n const anchored = rootAnchored || segments.length > 1;\n const starts = anchored ? [0] : pathSegments.map((_, index) => index);\n\n return starts.some((start) => {\n const memo = new Map<string, boolean>();\n const visit = (patternIndex: number, pathIndex: number): boolean => {\n const key = `${patternIndex}:${pathIndex}`;\n const cached = memo.get(key);\n if (cached !== undefined) return cached;\n let result: boolean;\n if (patternIndex === segments.length) result = directory ? pathIndex < pathSegments.length : true;\n else if (segments[patternIndex] === \"**\") result = visit(patternIndex + 1, pathIndex) || (pathIndex < pathSegments.length && visit(patternIndex, pathIndex + 1));\n else result = pathIndex < pathSegments.length && matchSegment(segments[patternIndex], pathSegments[pathIndex]) && visit(patternIndex + 1, pathIndex + 1);\n memo.set(key, result);\n return result;\n };\n return visit(0, start);\n });\n};\n","export type ContractEntry =\n | { kind: \"linked\"; path: string }\n | { kind: \"versioned\"; id: string; range: string }\n | { kind: \"external\"; repository: string; id: string; range: string };\n\nexport type ContractLine = {\n line: number;\n pattern: string;\n entries: ContractEntry[];\n};\n\nexport type ContractParseResult = {\n lines: ContractLine[];\n errors: Array<{ line: number; message: string }>;\n};\n\nimport { validatePattern } from \"./matcher.js\";\n\nconst entryPattern = /^(?:(?<repository>[a-z0-9_.-]+\\/[a-z0-9_.-]+):)?(?<id>[a-z]+\\/[a-z0-9_./-]+)@(?<range>.+)$/i;\n\nconst splitFields = (line: string): string[] => {\n const fields: string[] = [];\n let field = \"\";\n let escaped = false;\n\n for (const character of line.trim()) {\n if (escaped) {\n field += `\\\\${character}`;\n escaped = false;\n } else if (character === \"\\\\\") {\n escaped = true;\n } else if (/\\s/.test(character)) {\n if (field) fields.push(field);\n field = \"\";\n } else {\n field += character;\n }\n }\n if (escaped) field += \"\\\\\";\n if (field) fields.push(field);\n return fields;\n};\n\nexport const parseContractsFile = (source: string): ContractParseResult => {\n const lines: ContractLine[] = [];\n const errors: ContractParseResult[\"errors\"] = [];\n\n source.split(/\\r?\\n/).forEach((rawLine, index) => {\n const line = index + 1;\n const trimmed = rawLine.trim();\n if (!trimmed || trimmed.startsWith(\"#\")) return;\n\n const [pattern, ...rawEntries] = splitFields(rawLine);\n if (!pattern || rawEntries.length === 0) {\n errors.push({ line, message: \"expected a path pattern and at least one entry\" });\n return;\n }\n if (pattern.startsWith(\"!\")) {\n errors.push({ line, message: \"negation is not valid in CONTRACTS\" });\n return;\n }\n try {\n validatePattern(pattern);\n } catch (error) {\n errors.push({ line, message: error instanceof Error ? error.message : \"invalid glob pattern\" });\n return;\n }\n\n const entries: ContractEntry[] = [];\n for (const rawEntry of rawEntries) {\n const match = entryPattern.exec(rawEntry);\n if (!match?.groups) {\n if (/^(?:prd|adr|spec|design|standard|procedure)\\//.test(rawEntry)) {\n errors.push({ line, message: `invalid versioned entry ${rawEntry}; did you mean <id>@<range>?` });\n continue;\n }\n entries.push({ kind: \"linked\", path: rawEntry.replace(/\\\\(.)/g, \"$1\") });\n continue;\n }\n const { repository, id, range } = match.groups;\n entries.push(repository\n ? { kind: \"external\", repository, id, range }\n : { kind: \"versioned\", id, range });\n }\n lines.push({ line, pattern, entries });\n });\n\n return { lines, errors };\n};\n","import { valid } from \"semver\";\n\nexport type ContractPin = { version?: string; error?: string };\n\n/** Parses the required, first-line package pin without interpreting any rules. */\nexport const parseContractsPin = (source: string): ContractPin => {\n const lines = source.split(/\\r?\\n/);\n const first = lines[0] ?? \"\";\n const match = /^# @bizibot\\/contracts (.+)$/.exec(first);\n if (match) return valid(match[1]!) === match[1] ? { version: match[1] } : { error: \"package pin must be an exact SemVer version\" };\n if (lines.some((line) => /^# @bizibot\\/contracts\\s/.test(line))) return { error: \"package pin must be the first line of CONTRACTS\" };\n return { error: \"missing first-line package pin (# @bizibot/contracts <version>)\" };\n};\n\n/** Replaces any old pin while preserving all adopter-owned CONTRACTS rules. */\nexport const withContractsPin = (source: string | undefined, version: string): string => {\n const body = (source ?? \"# path pattern governing artifacts\\n\").split(/\\r?\\n/)\n .filter((line) => !/^# @bizibot\\/contracts\\s/.test(line)).join(\"\\n\");\n return `# @bizibot/contracts ${version}\\n${body}`;\n};\n\n/** `init` only changes an adopted repository's pin when explicitly updating it. */\nexport const contractsSourceForInit = (source: string | undefined, version: string, update: boolean): string =>\n source !== undefined && parseContractsPin(source).version !== undefined && !update ? source : withContractsPin(source, version);\n","import type { ContractEntry, ContractLine } from \"./parse.js\";\nimport { matchesPattern } from \"./matcher.js\";\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport { validRange } from \"semver\";\n\nconst keyFor = (entry: ContractEntry): string => entry.kind === \"linked\"\n ? `path:${entry.path}`\n : entry.kind === \"external\"\n ? `external:${entry.repository}:${entry.id}`\n : `id:${entry.id}`;\n\nconst appliesToSelf = (entry: ContractEntry, path: string, artifact: Artifact | undefined): boolean =>\n (entry.kind === \"linked\" && entry.path === path) ||\n (artifact !== undefined && entry.kind === \"versioned\" && entry.id === artifact.id);\n\nexport type ResolvedContractEntry = { entry: ContractEntry; line: number };\n\nexport const resolveGoverningEntryDetails = (path: string, lines: ContractLine[], artifact?: Artifact): ResolvedContractEntry[] => {\n const resolved = new Map<string, ResolvedContractEntry>();\n for (const line of lines) {\n if (!matchesPattern(path, line.pattern)) continue;\n for (const entry of line.entries) if (!appliesToSelf(entry, path, artifact)) resolved.set(keyFor(entry), { entry, line: line.line });\n }\n return [...resolved.values()];\n};\n\nexport const resolveGoverningEntries = (path: string, lines: ContractLine[], artifact?: Artifact): ContractEntry[] =>\n resolveGoverningEntryDetails(path, lines, artifact).map(({ entry }) => entry);\n\nexport const resolveArtifactGoverningEntries = (artifact: Artifact, lines: ContractLine[]): ContractEntry[] =>\n resolveGoverningEntries(artifact.path, lines, artifact);\n\nexport const findDependentLines = (idOrPath: string, lines: ContractLine[]): ContractLine[] => lines.filter((line) =>\n line.entries.some((entry) => {\n if (entry.kind === \"linked\") return entry.path === idOrPath;\n if (entry.kind === \"external\") return `${entry.repository}:${entry.id}` === idOrPath;\n return entry.id === idOrPath;\n })\n);\n\nexport type ContractDiagnostic = { line: number; message: string };\n\nexport const findArtifactWarnings = (lines: ContractLine[], artifacts: Artifact[]): ContractDiagnostic[] => {\n const byPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]));\n const byId = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.id, artifact]));\n const warnings: ContractDiagnostic[] = [];\n for (const line of lines) for (const entry of line.entries) {\n const artifact = entry.kind === \"linked\" ? byPath.get(entry.path) : entry.kind === \"versioned\" ? byId.get(entry.id) : undefined;\n if (artifact?.status === \"deprecated\") warnings.push({ line: line.line, message: `${artifact.id} is deprecated` });\n if (artifact?.status === \"superseded\") warnings.push({ line: line.line, message: `${artifact.id} is superseded${artifact.supersededBy ? ` by ${artifact.supersededBy}` : \"\"}` });\n }\n return warnings;\n};\n\nexport const validateLinkedArtifactReferences = (lines: ContractLine[], artifacts: Artifact[]): ContractDiagnostic[] => {\n const artifactsByPath = new Map(artifacts.map((artifact) => [artifact.path, artifact]));\n const referencesByArtifact = new Map<string, Array<{ line: number; form: \"linked\" | \"versioned\" }>>();\n const errors: ContractDiagnostic[] = [];\n for (const line of lines) {\n for (const entry of line.entries) {\n if (entry.kind === \"external\") {\n if (!validRange(entry.range)) errors.push({ line: line.line, message: `${entry.range} is not a valid SemVer range` });\n continue;\n }\n const artifact = entry.kind === \"linked\" ? artifactsByPath.get(entry.path) : artifacts.find((candidate) => candidate.id === entry.id);\n if (!artifact) {\n errors.push({ line: line.line, message: `${entry.kind === \"linked\" ? entry.path : entry.id} does not name a local governing artifact` });\n continue;\n }\n if (entry.kind === \"versioned\" && !artifact.version) errors.push({ line: line.line, message: `${artifact.id} has no version; use a linked path or add version: 0.1.0 to opt in` });\n if (entry.kind === \"versioned\" && !validRange(entry.range)) errors.push({ line: line.line, message: `${entry.range} is not a valid SemVer range` });\n const form = entry.kind === \"linked\" ? \"linked\" : \"versioned\";\n const prior = referencesByArtifact.get(artifact.id) ?? [];\n prior.push({ line: line.line, form });\n referencesByArtifact.set(artifact.id, prior);\n }\n }\n for (const [id, references] of referencesByArtifact) {\n if (references.some((reference) => reference.form === \"linked\") && references.some((reference) => reference.form === \"versioned\")) {\n errors.push({ line: references[0].line, message: `${id} mixes linked and versioned references on lines ${references.map((reference) => reference.line).join(\", \")}` });\n }\n }\n return errors;\n};\n","import { discoverArtifact, type Artifact } from \"../artifacts/discover.js\";\nimport { parseContractsFile } from \"../contracts-file/parse.js\";\nimport { parseContractsPin } from \"../contracts-file/pin.js\";\nimport type { ContractLine } from \"../contracts-file/parse.js\";\nimport { findArtifactWarnings, validateLinkedArtifactReferences } from \"../contracts-file/resolve.js\";\nimport { matchesPattern } from \"../contracts-file/matcher.js\";\n\nexport type RepositoryDiagnostic = {\n path: string;\n line?: number;\n message: string;\n};\n\nexport type RepositoryCheck = {\n pin?: string;\n artifacts: Artifact[];\n lines: ContractLine[];\n errors: RepositoryDiagnostic[];\n warnings: RepositoryDiagnostic[];\n};\n\n/**\n * Validates a complete repository snapshot supplied by a local filesystem or\n * a trusted CI adapter. File contents are parsed only as data.\n */\nexport const checkRepository = (files: Readonly<Record<string, string>>, paths: readonly string[] = Object.keys(files)): RepositoryCheck => {\n const artifacts: Artifact[] = [];\n const errors: RepositoryDiagnostic[] = [];\n const warnings: RepositoryDiagnostic[] = [];\n\n for (const [path, source] of Object.entries(files)) {\n const discovered = discoverArtifact(path, source);\n errors.push(...discovered.errors.map((message) => ({ path, message })));\n if (discovered.artifact) artifacts.push(discovered.artifact);\n }\n\n const ids = new Map<string, Artifact>();\n for (const artifact of artifacts) {\n const prior = ids.get(artifact.id);\n if (prior) errors.push({ path: artifact.path, message: `${artifact.id} duplicates ${prior.path}` });\n else ids.set(artifact.id, artifact);\n }\n\n const contracts = files.CONTRACTS;\n if (contracts === undefined) {\n errors.push({ path: \"CONTRACTS\", message: \"missing root CONTRACTS file\" });\n return { artifacts, lines: [], errors, warnings };\n }\n\n const pin = parseContractsPin(contracts);\n if (pin.error) errors.push({ path: \"CONTRACTS\", line: 1, message: pin.error });\n\n const parsed = parseContractsFile(contracts);\n errors.push(...parsed.errors.map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n errors.push(...validateLinkedArtifactReferences(parsed.lines, artifacts).map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n warnings.push(...findArtifactWarnings(parsed.lines, artifacts).map(({ line, message }) => ({ path: \"CONTRACTS\", line, message })));\n const normalizedPaths = paths.map((path) => path.replace(/^\\.\\//, \"\").replaceAll(\"\\\\\", \"/\"));\n warnings.push(...parsed.lines.filter((line) => !normalizedPaths.some((path) => matchesPattern(path, line.pattern))).map((line) => ({ path: \"CONTRACTS\", line: line.line, message: `dead pattern ${line.pattern}` })));\n return { artifacts, ...(pin.version ? { pin: pin.version } : {}), lines: parsed.lines, errors, warnings };\n};\n","import { satisfies } from \"semver\";\n\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport type { ContractLine } from \"./parse.js\";\nimport { resolveGoverningEntryDetails } from \"./resolve.js\";\n\nexport type RangeDiagnostic = { line: number; message: string };\n\n/**\n * Checks ranges actually selected for each path in a complete snapshot. Local\n * artifact files never select themselves, even through a broad pattern.\n */\nexport const validateContractRanges = (paths: Iterable<string>, lines: ContractLine[], artifacts: Artifact[]): RangeDiagnostic[] => {\n const byId = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.id, artifact]));\n const byPath = new Map<string, Artifact>(artifacts.map((artifact) => [artifact.path, artifact]));\n const violations = new Map<string, { line: number; id: string; version: string; range: string; paths: string[] }>();\n\n for (const path of paths) {\n const subject = byPath.get(path);\n for (const { entry, line } of resolveGoverningEntryDetails(path, lines, subject)) {\n if (entry.kind !== \"versioned\") continue;\n const artifact = byId.get(entry.id);\n if (!artifact?.version || satisfies(artifact.version, entry.range)) continue;\n const key = `${line}:${entry.id}:${entry.range}`;\n const violation = violations.get(key) ?? { line, id: entry.id, version: artifact.version, range: entry.range, paths: [] };\n violation.paths.push(path);\n violations.set(key, violation);\n }\n }\n return [...violations.values()].sort((left, right) => left.line - right.line || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0)).map(({ line, id, version, range, paths: matchedPaths }) => {\n const paths = [...matchedPaths].sort();\n const samples = paths.slice(0, 3).join(\", \");\n const example = paths.length > 3 ? `${samples}, …` : samples;\n const count = `${paths.length} ${paths.length === 1 ? \"path\" : \"paths\"}`;\n return { line, message: `${id}@${version} does not satisfy ${range} (${count}, e.g. ${example})` };\n });\n};\n","/** Canonical install folders used by `init --agents` and snapshot validation. */\nexport const AGENT_SKILL_FOLDERS = {\n claude: \".claude/skills\",\n copilot: \".github/skills\"\n} as const;\n\nexport const MANAGED_MARKER = \"@bizibot/contracts\";\n\nexport const managedProcedureSource = (version: string, workflow: string): string => `<!-- BEGIN ${MANAGED_MARKER} ${version} (managed: do not edit; run \\`contracts init --update\\`) -->\\n\\n${workflow.endsWith(\"\\n\") ? workflow : `${workflow}\\n`}<!-- END ${MANAGED_MARKER} -->\\n`;\n\nconst escapeRegex = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\nconst managedSkill = new RegExp(`^(?:${Object.values(AGENT_SKILL_FOLDERS).map(escapeRegex).join(\"|\")})/(contracts-[a-z0-9-]+)/SKILL\\\\.md$`);\nconst versionMarker = new RegExp(`${MANAGED_MARKER.replace(\"/\", \"\\\\/\")}\\\\s+(\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:-[0-9A-Za-z.-]+)?)`);\n\ntype RegistryPackage = { dist: { tarball: string; integrity: string } };\n\nconst tarEntry = (archive: Buffer, path: string): string => {\n let offset = 0;\n while (offset + 512 <= archive.length) {\n const header = archive.subarray(offset, offset + 512);\n const name = header.subarray(0, 100).toString(\"utf8\").replace(/\\0.*$/, \"\");\n const size = Number.parseInt(header.subarray(124, 136).toString(\"utf8\").replace(/\\0.*$/, \"\").trim() || \"0\", 8);\n const start = offset + 512;\n if (name === `package/${path}`) return archive.subarray(start, start + size).toString(\"utf8\");\n offset = start + Math.ceil(size / 512) * 512;\n }\n throw new Error(`managed package archive is missing ${path}`);\n};\n\n/** Reads package-owned bytes from an integrity-checked registry tarball as data. */\nconst readRegistryFiles = async (version: string, paths: readonly string[]): Promise<Record<string, string>> => {\n const { createHash, timingSafeEqual } = await import(\"node:crypto\");\n const { gunzipSync } = await import(\"node:zlib\");\n const registry = (process.env.npm_config_registry ?? \"https://registry.npmjs.org\").replace(/\\/$/, \"\");\n const metadataResponse = await fetch(`${registry}/${encodeURIComponent(\"@bizibot/contracts\")}/${version}`);\n if (!metadataResponse.ok) throw new Error(`cannot read @bizibot/contracts@${version} registry metadata (${metadataResponse.status})`);\n const metadata = await metadataResponse.json() as RegistryPackage;\n const archiveResponse = await fetch(metadata.dist.tarball);\n if (!archiveResponse.ok) throw new Error(`cannot read @bizibot/contracts@${version} archive (${archiveResponse.status})`);\n const compressed = Buffer.from(await archiveResponse.arrayBuffer());\n const [algorithm, encoded] = metadata.dist.integrity.split(\"-\", 2);\n if (algorithm !== \"sha512\" || !encoded) throw new Error(`@bizibot/contracts@${version} has no supported SHA-512 integrity`);\n const actual = createHash(\"sha512\").update(compressed).digest();\n const expected = Buffer.from(encoded, \"base64\");\n if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) throw new Error(`@bizibot/contracts@${version} archive failed integrity verification`);\n const archive = gunzipSync(compressed);\n return Object.fromEntries(paths.map((path) => [path, tarEntry(archive, path)]));\n};\n\n/**\n * Loads the exact package-owned bytes for managed files present in a snapshot.\n * The caller supplies them to the pure checker, so CI can inspect PR data\n * without executing or importing anything from the PR.\n */\nexport const loadManagedFileExpectations = async (contents: Readonly<Record<string, string>>, pin?: string): Promise<Record<string, string>> => {\n const { readFile } = await import(\"node:fs/promises\");\n const packageJson = await import(\"../package.json\", { with: { type: \"json\" } });\n const expected: Record<string, string> = {};\n const resources = new Map<string, { version: string; path: string; transform: (source: string) => string }>();\n const versionFor = (source: string, path: string): string => {\n const version = source.match(versionMarker)?.[1];\n if (!version) throw new Error(`${path} has an invalid @bizibot/contracts managed-file marker`);\n return version;\n };\n if (contents[\"AGENTS.md\"]?.includes(`BEGIN ${MANAGED_MARKER}`)) resources.set(\"AGENTS.md\", { version: versionFor(contents[\"AGENTS.md\"], \"AGENTS.md\"), path: \"templates/agents-section.md\", transform: (source) => source });\n if (contents[\"docs/procedures/contracts-workflow.md\"]?.includes(`BEGIN ${MANAGED_MARKER}`)) resources.set(\"docs/procedures/contracts-workflow.md\", { version: versionFor(contents[\"docs/procedures/contracts-workflow.md\"], \"docs/procedures/contracts-workflow.md\"), path: \"docs/workflow.md\", transform: (source) => managedProcedureSource(\"{{version}}\", source) });\n for (const path of Object.keys(contents)) {\n const skill = managedSkill.exec(path)?.[1];\n if (skill && contents[path]?.includes(MANAGED_MARKER)) resources.set(path, { version: versionFor(contents[path], path), path: `skills/${skill}/SKILL.md`, transform: (source) => source });\n }\n const cache = new Map<string, Record<string, string>>();\n for (const [target, resource] of resources) {\n if (pin && resource.version !== pin) throw new Error(`${target} has @bizibot/contracts marker ${resource.version}, which does not match CONTRACTS pin ${pin}`);\n let source: string;\n if (resource.version === packageJson.default.version) source = await readFile(new URL(`../${resource.path}`, import.meta.url), \"utf8\");\n else {\n if (!cache.has(resource.version)) cache.set(resource.version, await readRegistryFiles(resource.version, [...resources.values()].filter((entry) => entry.version === resource.version).map((entry) => entry.path)));\n source = cache.get(resource.version)![resource.path]!;\n }\n expected[target] = resource.transform(source).replaceAll(\"{{version}}\", resource.version);\n }\n return expected;\n};\n\nexport const managedFileDiagnostics = (contents: Readonly<Record<string, string>>, expected: Readonly<Record<string, string>>): { path: string; message: string }[] =>\n Object.entries(expected).flatMap(([path, source]) => contents[path] === undefined || (path === \"AGENTS.md\" ? contents[path].includes(source) : contents[path] === source) ? [] : [{ path, message: \"managed file differs from the installed @bizibot/contracts version; run contracts init --update\" }]);\n","import { validateContractRanges } from \"../contracts-file/ranges.js\";\n\nimport { checkRepository, type RepositoryDiagnostic } from \"./repository.js\";\nimport { checkArtifactVersionTransitions, type ArtifactChange } from \"./version-transitions.js\";\nimport type { ArtifactVersionDiagnostic } from \"../versioning/validate.js\";\nimport type { Artifact } from \"../artifacts/discover.js\";\nimport { DEFAULT_KIND_FOLDERS } from \"../artifacts/discover.js\";\nimport { AGENT_SKILL_FOLDERS } from \"../managed.js\";\nimport { managedFileDiagnostics } from \"../managed.js\";\n\nexport type RepositorySnapshot = { paths: readonly string[]; contents: Readonly<Record<string, string>> };\nexport type FileChange = { status: \"added\" | \"modified\" | \"renamed\" | \"deleted\"; path: string; previousPath?: string };\nexport type SnapshotCheckInput = {\n snapshot: RepositorySnapshot;\n base: RepositorySnapshot;\n changes: FileChange[];\n targetIsDefaultBranch: boolean;\n managedFiles?: Readonly<Record<string, string>>;\n};\n\nconst versionLine = /^version:[^\\r\\n]*(?:\\r?\\n|$)/m;\nconst sameExceptVersion = (left: string, right: string): boolean => left.replace(versionLine, \"version: <contract-version>\\n\") === right.replace(versionLine, \"version: <contract-version>\\n\");\n\nexport const deriveArtifactChanges = (changes: FileChange[], base: RepositorySnapshot, current: RepositorySnapshot, baseArtifacts: Artifact[], currentArtifacts: Artifact[]): ArtifactChange[] => {\n const baseByPath = new Map(baseArtifacts.map((artifact) => [artifact.path, artifact]));\n const currentByPath = new Map(currentArtifacts.map((artifact) => [artifact.path, artifact]));\n return changes.map(({ status, path, previousPath }) => {\n const priorPath = previousPath ?? path;\n const previousSource = base.contents[priorPath];\n const currentSource = current.contents[path];\n return { status, base: baseByPath.get(priorPath), current: currentByPath.get(path), previousSource, changedBeyondVersion: previousSource !== undefined && currentSource !== undefined && !sameExceptVersion(previousSource, currentSource) };\n });\n};\n\nexport type SnapshotCheckDiagnostic =\n | ({ category: \"repository\" } & RepositoryDiagnostic)\n | ({ category: \"version\" } & ArtifactVersionDiagnostic)\n | { category: \"range\"; path: \"CONTRACTS\"; line: number; message: string };\n\nconst escapeRegex = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\nconst kindMarkdown = new RegExp(`^(?:${Object.values(DEFAULT_KIND_FOLDERS).map(escapeRegex).join(\"|\")})/.+\\\\.md$`);\nconst ignoredMarkdown = /\\/(?:INDEX|README)\\.md$/;\nconst managedSkill = new RegExp(`^(?:${Object.values(AGENT_SKILL_FOLDERS).map(escapeRegex).join(\"|\")})/contracts-[a-z0-9-]+/`);\nexport const requiresSnapshotContent = (path: string): boolean => path === \"CONTRACTS\" || path === \"AGENTS.md\" || managedSkill.test(path) || (kindMarkdown.test(path) && !ignoredMarkdown.test(path));\nexport const isGoverningArtifactPath = (path: string): boolean => kindMarkdown.test(path) && !ignoredMarkdown.test(path);\n\nconst incompleteSnapshotDiagnostics = (snapshot: RepositorySnapshot, changes: FileChange[], base: boolean): RepositoryDiagnostic[] => {\n const required = new Set(snapshot.paths.filter(requiresSnapshotContent));\n if (base) for (const change of changes) if (change.status === \"renamed\" && change.previousPath && kindMarkdown.test(change.path)) required.add(change.previousPath);\n return [...required].filter((path) => (snapshot.paths.includes(path) || (base && changes.some((change) => change.status === \"renamed\" && change.previousPath === path))) && snapshot.contents[path] === undefined)\n .sort().map((path) => ({ path, message: \"incomplete snapshot: required file content is missing\" }));\n};\n\nconst compareCodeUnits = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n\nconst diagnosticOrder = (left: SnapshotCheckDiagnostic, right: SnapshotCheckDiagnostic): number => {\n const category = compareCodeUnits(left.category, right.category);\n if (category !== 0) return category;\n const leftPath = \"path\" in left ? left.path : left.artifact;\n const rightPath = \"path\" in right ? right.path : right.artifact;\n const leftLine = \"line\" in left ? left.line ?? 0 : 0;\n const rightLine = \"line\" in right ? right.line ?? 0 : 0;\n return compareCodeUnits(leftPath, rightPath) || leftLine - rightLine || compareCodeUnits(left.message, right.message);\n};\n\nexport const checkSnapshot = (input: SnapshotCheckInput): { errors: SnapshotCheckDiagnostic[]; warnings: RepositoryDiagnostic[] } => {\n const repository = checkRepository(input.snapshot.contents, input.snapshot.paths);\n const baseRepository = checkRepository(input.base.contents, input.base.paths);\n const transitions = checkArtifactVersionTransitions(deriveArtifactChanges(input.changes, input.base, input.snapshot, baseRepository.artifacts, repository.artifacts), {\n baseHasContracts: input.base.contents.CONTRACTS !== undefined\n });\n const ranges = input.targetIsDefaultBranch\n ? validateContractRanges(input.snapshot.paths, repository.lines, repository.artifacts)\n : [];\n return {\n errors: [\n ...repository.errors.map((error) => ({ category: \"repository\" as const, ...error })),\n ...managedFileDiagnostics(input.snapshot.contents, input.managedFiles ?? {}).map((error) => ({ category: \"repository\" as const, ...error })),\n ...incompleteSnapshotDiagnostics(input.snapshot, input.changes, false).map((error) => ({ category: \"repository\" as const, ...error })),\n ...incompleteSnapshotDiagnostics(input.base, input.changes, true).map((error) => ({ category: \"repository\" as const, ...error })),\n ...transitions.errors.map((error) => ({ category: \"version\" as const, ...error })),\n ...ranges.map((error) => ({ category: \"range\" as const, path: \"CONTRACTS\" as const, ...error }))\n ].sort(diagnosticOrder),\n warnings: repository.warnings\n };\n};\n","import { lt, valid } from \"semver\";\n\nimport { validateContractRanges } from \"../contracts-file/ranges.js\";\nimport { checkRepository, type RepositoryDiagnostic } from \"./repository.js\";\nimport type { RepositorySnapshot } from \"./snapshot.js\";\n\n/** Validates the merged tree against durable artifact tags, never commit text. */\nexport const checkReleaseSnapshot = (snapshot: RepositorySnapshot, tags: readonly string[]): { errors: RepositoryDiagnostic[]; artifacts: ReturnType<typeof checkRepository>[\"artifacts\"] } => {\n const repository = checkRepository(snapshot.contents, snapshot.paths);\n const errors: RepositoryDiagnostic[] = [\n ...repository.errors,\n ...validateContractRanges(snapshot.paths, repository.lines, repository.artifacts).map((error) => ({ path: \"CONTRACTS\", line: error.line, message: error.message }))\n ];\n const byId = new Map(repository.artifacts.map((artifact) => [artifact.id, artifact]));\n for (const tag of tags) {\n const split = tag.lastIndexOf(\"@\");\n if (split <= 0 || !tag.includes(\"/\")) continue;\n const taggedVersion = tag.slice(split + 1);\n if (!valid(taggedVersion)) continue;\n const artifact = byId.get(tag.slice(0, split) as typeof repository.artifacts[number][\"id\"]);\n if (!artifact) continue;\n if (!artifact.version) errors.push({ path: artifact.path, message: `${artifact.id} removed its version after tag ${tag}` });\n else if (lt(artifact.version, taggedVersion)) errors.push({ path: artifact.path, message: `${artifact.id}@${artifact.version} is lower than existing tag ${tag}` });\n }\n return { errors, artifacts: repository.artifacts };\n};\n\n/** Tags each versioned artifact whose recorded version has no tag yet (spec §5.3). */\nexport const tagsToCreate = (artifacts: readonly { id: string; version?: string }[], tags: readonly string[]): string[] => {\n const existing = new Set(tags);\n return artifacts.flatMap((artifact) => artifact.version && !existing.has(`${artifact.id}@${artifact.version}`) ? [`${artifact.id}@${artifact.version}`] : []);\n};\n","import { execFile as execFileCallback } from \"node:child_process\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { promisify } from \"node:util\";\nimport { join, relative } from \"node:path\";\n\nimport type { RepositorySnapshot } from \"./check/snapshot.js\";\nimport type { FileChange } from \"./check/snapshot.js\";\nimport { requiresSnapshotContent } from \"./check/snapshot.js\";\n\nconst walk = async (root: string, directory = root): Promise<string[]> => {\n const entries = await readdir(directory, { withFileTypes: true });\n const paths: string[] = [];\n for (const entry of entries) {\n if (entry.name === \".git\" || entry.name === \"node_modules\" || entry.name === \"dist\") continue;\n const full = join(directory, entry.name);\n if (entry.isDirectory()) paths.push(...await walk(root, full));\n else if (entry.isFile()) paths.push(relative(root, full).replaceAll(\"\\\\\", \"/\"));\n }\n return paths;\n};\n\nexport const readLocalSnapshot = async (root: string): Promise<RepositorySnapshot> => {\n let paths: string[];\n try {\n paths = (await git(root, [\"ls-files\", \"--cached\", \"--others\", \"--exclude-standard\"])).split(\"\\n\").filter(Boolean).sort();\n } catch {\n paths = (await walk(root)).sort();\n }\n const contents = Object.fromEntries(await Promise.all(paths.filter(requiresSnapshotContent).map(async (path) => [path, await readFile(join(root, path), \"utf8\")] as const)));\n return { paths, contents };\n};\n\nconst execFile = promisify(execFileCallback);\nconst git = async (root: string, args: string[]): Promise<string> => (await execFile(\"git\", args, { cwd: root })).stdout;\nexport const runGit = git;\n\nexport const readGitSnapshot = async (root: string, revision: string, additionalContents: readonly string[] = []): Promise<RepositorySnapshot> => {\n const paths = (await git(root, [\"ls-tree\", \"-r\", \"--name-only\", revision])).split(\"\\n\").filter(Boolean).sort();\n const contentPaths = paths.filter((path) => requiresSnapshotContent(path) || additionalContents.includes(path));\n const contents = Object.fromEntries(await Promise.all(contentPaths.map(async (path) => [path, await git(root, [\"show\", `${revision}:${path}`])] as const)));\n return { paths, contents };\n};\n\nexport const readLocalChanges = async (root: string, base: string): Promise<FileChange[]> => {\n const output = await git(root, [\"diff\", \"--name-status\", \"-M\", base, \"--\"]);\n const changes: FileChange[] = output.split(\"\\n\").filter(Boolean).map((line): FileChange => {\n const [rawStatus, first, second] = line.split(\"\\t\");\n const status = rawStatus.startsWith(\"R\") ? \"renamed\" : rawStatus === \"A\" ? \"added\" : rawStatus === \"D\" ? \"deleted\" : \"modified\";\n return status === \"renamed\" ? { status, path: second!, previousPath: first! } : { status, path: first! };\n });\n const changed = new Set(changes.map((change) => change.path));\n const untracked = (await git(root, [\"ls-files\", \"--others\", \"--exclude-standard\"])).split(\"\\n\").filter(Boolean);\n return [...changes, ...untracked.filter((path) => !changed.has(path)).map((path) => ({ status: \"added\" as const, path }))];\n};\n\nconst tryGit = async (root: string, args: string[]): Promise<string | undefined> => {\n try {\n return (await git(root, args)).trim() || undefined;\n } catch {\n return undefined;\n }\n};\n\n/**\n * The default-branch ref a local run compares against: `origin/HEAD`, then\n * `origin/<name>`, then a local `<name>`, where `<name>` is `init.defaultBranch`,\n * `main`, or `master`. Each candidate must resolve to a commit, so a stale\n * `origin/HEAD` (left behind by a remote branch rename) falls through.\n */\nconst readDefaultBranchRef = async (root: string): Promise<string | undefined> => {\n const remoteHead = await tryGit(root, [\"symbolic-ref\", \"-q\", \"refs/remotes/origin/HEAD\"]);\n const configured = await tryGit(root, [\"config\", \"--get\", \"init.defaultBranch\"]);\n const names = [...new Set([configured, \"main\", \"master\"].filter((name): name is string => Boolean(name)))];\n const candidates = [remoteHead, ...names.map((name) => `refs/remotes/origin/${name}`), ...names.map((name) => `refs/heads/${name}`)];\n for (const ref of candidates.filter((candidate): candidate is string => Boolean(candidate))) {\n if (await tryGit(root, [\"rev-parse\", \"-q\", \"--verify\", `${ref}^{commit}`])) return ref;\n }\n return undefined;\n};\n\n/** The merge base of HEAD and the default branch, for a branch-wide local preview. */\nexport const readLocalBase = async (root: string): Promise<string> => {\n const defaultRef = await readDefaultBranchRef(root);\n const base = defaultRef && await tryGit(root, [\"merge-base\", \"HEAD\", defaultRef]);\n if (!base) throw new Error(\"contracts: could not find the default branch to compare against; pass --base <revision>\");\n return base;\n};\n","import type { FileChange, RepositorySnapshot } from \"./check/snapshot.js\";\nimport { requiresSnapshotContent } from \"./check/snapshot.js\";\n\nexport type CiFileOverlay = {\n status: \"added\" | \"modified\" | \"deleted\" | \"renamed\";\n path: string;\n previousPath?: string;\n /** Present only when snapshot validation requires the file's bytes. */\n content?: string;\n};\n\n/** Builds a post-PR sparse snapshot from trusted base data and inert API bytes. */\nexport const overlayCiSnapshot = (base: RepositorySnapshot, overlays: CiFileOverlay[]): { snapshot: RepositorySnapshot; changes: FileChange[] } => {\n const paths = new Set(base.paths);\n const contents: Record<string, string> = { ...base.contents };\n const changes: FileChange[] = [];\n for (const overlay of overlays) {\n if (overlay.status === \"deleted\") {\n paths.delete(overlay.path);\n delete contents[overlay.path];\n } else if (overlay.status === \"renamed\") {\n if (!overlay.previousPath) throw new Error(`renamed API file ${overlay.path} is missing previousPath`);\n paths.delete(overlay.previousPath);\n delete contents[overlay.previousPath];\n paths.add(overlay.path);\n } else paths.add(overlay.path);\n if (overlay.content !== undefined) contents[overlay.path] = overlay.content;\n changes.push({ status: overlay.status, path: overlay.path, previousPath: overlay.previousPath });\n }\n return { snapshot: { paths: [...paths].sort(), contents }, changes };\n};\n\ntype GitHubPull = { changed_files: number; base: { sha: string; ref: string }; head: { sha: string }; };\ntype GitHubFile = { filename: string; status: \"added\" | \"modified\" | \"removed\" | \"renamed\"; previous_filename?: string };\ntype GitHubRepository = { default_branch: string };\n\nexport type GitHubPullRequestData = {\n baseSha: string;\n targetIsDefaultBranch: boolean;\n overlays: CiFileOverlay[];\n};\n\nconst apiError = (response: Response, url: string): Error => new Error(`GitHub API ${response.status} for ${url}`);\nconst decodeContent = (content: string): string => Buffer.from(content.replace(/\\n/g, \"\"), \"base64\").toString(\"utf8\");\n\n/** Reads a pull request as inert API data; it never fetches or evaluates PR code. */\nexport const readGitHubPullRequest = async (repository: string, pullNumber: string, token: string, apiUrl = process.env.GITHUB_API_URL ?? \"https://api.github.com\", fetcher: typeof fetch = fetch): Promise<GitHubPullRequestData> => {\n const request = async <T>(path: string): Promise<T> => {\n const url = `${apiUrl.replace(/\\/$/, \"\")}${path}`;\n const response = await fetcher(url, { headers: { Accept: \"application/vnd.github+json\", Authorization: `Bearer ${token}`, \"X-GitHub-Api-Version\": \"2022-11-28\" } });\n if (!response.ok) throw apiError(response, url);\n return response.json() as Promise<T>;\n };\n const [pull, settings] = await Promise.all([request<GitHubPull>(`/repos/${repository}/pulls/${pullNumber}`), request<GitHubRepository>(`/repos/${repository}`)]);\n const files: GitHubFile[] = [];\n for (let page = 1; ; page += 1) {\n const result = await request<GitHubFile[]>(`/repos/${repository}/pulls/${pullNumber}/files?per_page=100&page=${page}`);\n files.push(...result);\n if (result.length < 100) break;\n }\n if (files.length !== pull.changed_files) throw new Error(`GitHub API returned ${files.length} of ${pull.changed_files} changed files; pull requests above GitHub's file-list limit cannot be checked safely`);\n const overlays: CiFileOverlay[] = [];\n for (const file of files) {\n const status = file.status === \"removed\" ? \"deleted\" : file.status;\n const overlay: CiFileOverlay = { status, path: file.filename, ...(file.previous_filename ? { previousPath: file.previous_filename } : {}) };\n if (status !== \"deleted\" && requiresSnapshotContent(file.filename)) {\n const value = await request<{ content: string; encoding: string }>(`/repos/${repository}/contents/${file.filename.split(\"/\").map(encodeURIComponent).join(\"/\")}?ref=${pull.head.sha}`);\n if (value.encoding !== \"base64\") throw new Error(`GitHub API returned unsupported ${value.encoding} encoding for ${file.filename}`);\n overlay.content = decodeContent(value.content);\n }\n overlays.push(overlay);\n }\n return {\n baseSha: pull.base.sha,\n targetIsDefaultBranch: pull.base.ref === settings.default_branch,\n overlays\n };\n};\n","export const JSON_SCHEMA_VERSION = 1;\n\nexport type JsonEnvelope<T> = {\n schemaVersion: typeof JSON_SCHEMA_VERSION;\n data: T;\n};\n\nexport const toJsonEnvelope = <T>(data: T): JsonEnvelope<T> => ({\n schemaVersion: JSON_SCHEMA_VERSION,\n data\n});\n\nexport { validateArtifactVersionTransition, type ArtifactVersionDiagnostic, type ArtifactVersionTransition } from \"./versioning/validate.js\";\nexport { checkArtifactVersionTransitions, type ArtifactChange, type VersionTransitionCheck, type VersionTransitionCheckOptions } from \"./check/version-transitions.js\";\nexport { checkRepository, type RepositoryCheck, type RepositoryDiagnostic } from \"./check/repository.js\";\nexport { checkSnapshot, type SnapshotCheckDiagnostic, type SnapshotCheckInput } from \"./check/snapshot.js\";\nexport { checkReleaseSnapshot } from \"./check/release.js\";\nexport { readGitSnapshot, readLocalBase, readLocalChanges, readLocalSnapshot, runGit } from \"./local.js\";\nexport { overlayCiSnapshot, readGitHubPullRequest, type CiFileOverlay, type GitHubPullRequestData } from \"./ci.js\";\nexport { validateContractRanges, type RangeDiagnostic } from \"./contracts-file/ranges.js\";\nexport { parseContractsPin, withContractsP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YAAY,YAAY,KAAK;AAC5D,UAAM,UAAyB,EAAE,QAAQ,MAAM,KAAK,UAAU,GAAI,KAAK,oBAAoB,EAAE,cAAc,KAAK,kBAAkB,IAAI,CAAC,EAAG;AAC1I,QAAI,WAAW,aAAa,wBAAwB,KAAK,QAAQ,GAAG;AAClE,YAAM,QAAQ,MAAM,QAA+C,UAAU,UAAU,aAAa,KAAK,SAAS,MAAM,GAAG,EAAE,IAAI,kBAAkB,EAAE,KAAK,GAAG,CAAC,QAAQ,KAAK,KAAK,GAAG,EAAE;AACrL,UAAI,MAAM,aAAa,SAAU,OAAM,IAAI,MAAM,mCAAmC,MAAM,QAAQ,iBAAiB,KAAK,QAAQ,EAAE;AAClI,cAAQ,UAAU,cAAc,MAAM,OAAO;AAAA,IAC/C;AACA,aAAS,KAAK,OAAO;AAAA,EACvB;AACA,SAAO;AAAA,IACL,SAAS,KAAK,KAAK;AAAA,IACnB,uBAAuB,KAAK,KAAK,QAAQ,SAAS;AAAA,IAClD;AAAA,EACF;AACF;;;AC7EO,IAAM,sBAAsB;AAO5B,IAAM,iBAAiB,CAAI,UAA8B;AAAA,EAC9D,eAAe;AAAA,EACf;AACF;","names":["folder","versionLine","valid","paths","name","readFile","escapeRegex","managedSkill","valid","valid","name"]}
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@bizibot/contracts",
4
- version: "0.1.1",
4
+ version: "0.1.3",
5
5
  description: "Contract dependency checks for spec-driven delivery.",
6
6
  license: "MIT",
7
7
  publishConfig: {
@@ -48,4 +48,4 @@ var package_default = {
48
48
  export {
49
49
  package_default
50
50
  };
51
- //# sourceMappingURL=chunk-LBF4T2ZW.js.map
51
+ //# sourceMappingURL=chunk-W3U272RV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@bizibot/contracts\",\n \"version\": \"0.1.1\",\n \"description\": \"Contract dependency checks for spec-driven delivery.\",\n \"license\": \"MIT\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/bizibot-hq/bizibot.git\",\n \"directory\": \"packages/contracts\"\n },\n \"homepage\": \"https://github.com/bizibot-hq/bizibot/tree/main/packages/contracts\",\n \"type\": \"module\",\n \"bin\": {\n \"contracts\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\"dist\", \"docs\", \"skills\", \"templates\", \"conformance\"],\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"rimraf dist && tsup && tsc -p tsconfig.build.json\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"node --import tsx --test tests/*.test.ts\",\n \"clean\": \"rimraf dist\"\n },\n \"dependencies\": {\n \"semver\": \"^7.8.4\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20\",\n \"@types/semver\": \"^7.7.1\",\n \"rimraf\": \"^6.1.3\",\n \"tsup\": \"^8.5.1\",\n \"tsx\": \"^4.22.4\",\n \"typescript\": \"^5\"\n }\n}\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS,CAAC,QAAQ,QAAQ,UAAU,aAAa,aAAa;AAAA,EAC9D,aAAe;AAAA,EACf,SAAW;AAAA,IACT,OAAS;AAAA,IACT,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,OAAS;AAAA,EACX;AAAA,EACA,cAAgB;AAAA,IACd,QAAU;AAAA,IACV,MAAQ;AAAA,EACV;AAAA,EACA,iBAAmB;AAAA,IACjB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,YAAc;AAAA,EAChB;AACF;","names":[]}
1
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@bizibot/contracts\",\n \"version\": \"0.1.3\",\n \"description\": \"Contract dependency checks for spec-driven delivery.\",\n \"license\": \"MIT\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/bizibot-hq/bizibot.git\",\n \"directory\": \"packages/contracts\"\n },\n \"homepage\": \"https://github.com/bizibot-hq/bizibot/tree/main/packages/contracts\",\n \"type\": \"module\",\n \"bin\": {\n \"contracts\": \"./dist/cli.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"files\": [\"dist\", \"docs\", \"skills\", \"templates\", \"conformance\"],\n \"sideEffects\": false,\n \"scripts\": {\n \"build\": \"rimraf dist && tsup && tsc -p tsconfig.build.json\",\n \"typecheck\": \"tsc --noEmit\",\n \"test\": \"node --import tsx --test tests/*.test.ts\",\n \"clean\": \"rimraf dist\"\n },\n \"dependencies\": {\n \"semver\": \"^7.8.4\",\n \"yaml\": \"^2.9.0\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20\",\n \"@types/semver\": \"^7.7.1\",\n \"rimraf\": \"^6.1.3\",\n \"tsup\": \"^8.5.1\",\n \"tsx\": \"^4.22.4\",\n \"typescript\": \"^5\"\n }\n}\n"],"mappings":";AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,EACF;AAAA,EACA,OAAS,CAAC,QAAQ,QAAQ,UAAU,aAAa,aAAa;AAAA,EAC9D,aAAe;AAAA,EACf,SAAW;AAAA,IACT,OAAS;AAAA,IACT,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,OAAS;AAAA,EACX;AAAA,EACA,cAAgB;AAAA,IACd,QAAU;AAAA,IACV,MAAQ;AAAA,EACV;AAAA,EACA,iBAAmB;AAAA,IACjB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,YAAc;AAAA,EAChB;AACF;","names":[]}
package/dist/cli.js CHANGED
@@ -24,10 +24,10 @@ import {
24
24
  runGit,
25
25
  tagsToCreate,
26
26
  versionArtifactSource
27
- } from "./chunk-NAUOI6VM.js";
27
+ } from "./chunk-QAMA5XHN.js";
28
28
  import {
29
29
  package_default
30
- } from "./chunk-LBF4T2ZW.js";
30
+ } from "./chunk-W3U272RV.js";
31
31
 
32
32
  // src/cli.ts
33
33
  import { access, cp, readFile as readFile2, writeFile } from "fs/promises";
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  validateArtifactVersionTransition,
18
18
  validateContractRanges,
19
19
  withContractsPin
20
- } from "./chunk-NAUOI6VM.js";
20
+ } from "./chunk-QAMA5XHN.js";
21
21
  export {
22
22
  JSON_SCHEMA_VERSION,
23
23
  checkArtifactVersionTransitions,
@@ -0,0 +1,7 @@
1
+ import {
2
+ package_default
3
+ } from "./chunk-W3U272RV.js";
4
+ export {
5
+ package_default as default
6
+ };
7
+ //# sourceMappingURL=package-2EIOZLOH.js.map
@@ -4,5 +4,5 @@ export declare const readLocalSnapshot: (root: string) => Promise<RepositorySnap
4
4
  export declare const runGit: (root: string, args: string[]) => Promise<string>;
5
5
  export declare const readGitSnapshot: (root: string, revision: string, additionalContents?: readonly string[]) => Promise<RepositorySnapshot>;
6
6
  export declare const readLocalChanges: (root: string, base: string) => Promise<FileChange[]>;
7
- /** Uses the remote default branch for branch-wide local preview, with a safe single-commit fallback. */
7
+ /** The merge base of HEAD and the default branch, for a branch-wide local preview. */
8
8
  export declare const readLocalBase: (root: string) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bizibot/contracts",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Contract dependency checks for spec-driven delivery.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -1,7 +0,0 @@
1
- import {
2
- package_default
3
- } from "./chunk-LBF4T2ZW.js";
4
- export {
5
- package_default as default
6
- };
7
- //# sourceMappingURL=package-I34IHQY5.js.map