snipara-companion 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +68 -44
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19612,7 +19612,7 @@ async function agentReadinessAuditCommand(options) {
19612
19612
  var fs21 = __toESM(require("fs"));
19613
19613
  var path20 = __toESM(require("path"));
19614
19614
 
19615
- // ../project-intelligence-contracts/src/index.ts
19615
+ // ../project-intelligence-contracts/src/engineering-lead.ts
19616
19616
  var PROJECT_HEALTH_COCKPIT_STATUSES = ["healthy", "watch", "risk", "unknown"];
19617
19617
  var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PLAN_VERSION = "project-intelligence-engineering-lead-plan-v0";
19618
19618
  var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_CONTRACT_VERSION = "engineering-lead-contract-v1";
@@ -19686,9 +19686,8 @@ var PROJECT_INTELLIGENCE_ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES = [
19686
19686
  "manual",
19687
19687
  "unknown"
19688
19688
  ];
19689
- var PROJECT_REALITY_CHECK_VERSION = "project-reality-check-v0";
19690
- var PROJECT_INTENT_LEDGER_VERSION = "intent-ledger-v1";
19691
- var PROJECT_UNKNOWN_REGISTRY_VERSION = "unknown-registry-v1";
19689
+
19690
+ // ../project-intelligence-contracts/src/shared.ts
19692
19691
  var SENSITIVE_SURFACES = [
19693
19692
  {
19694
19693
  key: "billing_atomicity",
@@ -19764,23 +19763,11 @@ function hasPattern(values, patterns) {
19764
19763
  function matchesAnyText(text, patterns) {
19765
19764
  return patterns.some((pattern) => pattern.test(text));
19766
19765
  }
19767
- function findingSeverityScore(severity) {
19768
- if (severity === "blocking") return 0;
19769
- if (severity === "review_required") return 30;
19770
- if (severity === "watch") return 70;
19771
- return 90;
19772
- }
19773
- function resultStatusFromFindings(findings) {
19774
- if (findings.some((finding) => finding.severity === "blocking")) return "blocking";
19775
- if (findings.some((finding) => finding.severity === "review_required")) return "review_required";
19776
- if (findings.some((finding) => finding.severity === "watch")) return "advisory";
19777
- return "pass";
19778
- }
19779
- function makeFindingId(type, key, files) {
19766
+ function makeScopedId(prefix, type, key, files) {
19780
19767
  const compactFiles = files.slice(0, 3).map(
19781
19768
  (file) => file.replace(/[^a-z0-9]+/gi, "-").replace(/^-|-$/g, "").toLowerCase()
19782
19769
  ).filter(Boolean).join("-");
19783
- return ["reality", type, key, compactFiles || "project"].join(":").slice(0, 180);
19770
+ return [prefix, type, key, compactFiles || "project"].join(":").slice(0, 180);
19784
19771
  }
19785
19772
  function decisionMatchesChangedFiles(decision, changedFiles) {
19786
19773
  const anchors = decision.affectedAnchors ?? [];
@@ -19807,13 +19794,37 @@ function normalizeConfidenceScore(value, fallback) {
19807
19794
  if (typeof value !== "number" || Number.isNaN(value)) return fallback;
19808
19795
  return Math.max(0, Math.min(1, value));
19809
19796
  }
19797
+ function anchorMatchesFile(anchor, file) {
19798
+ const normalizedAnchor = anchor.replace(/^\.\//, "").trim();
19799
+ const normalizedFile = file.replace(/^\.\//, "").trim();
19800
+ return normalizedAnchor.length > 0 && normalizedFile.length > 0 && (normalizedFile.includes(normalizedAnchor) || normalizedAnchor.includes(normalizedFile));
19801
+ }
19802
+ function surfaceFiles(surface, changedFiles) {
19803
+ return changedFiles.filter((file) => surface.patterns.some((pattern) => pattern.test(file)));
19804
+ }
19805
+
19806
+ // ../project-intelligence-contracts/src/intent-ledger.ts
19807
+ var PROJECT_INTENT_LEDGER_VERSION = "intent-ledger-v1";
19808
+ var PROJECT_INTENT_LEDGER_FRESHNESS_HORIZON_DAYS = 90;
19809
+ var DECISION_STATUS_RULES = [
19810
+ { status: "contradicted", patterns: [/contradict/i, /conflict/i] },
19811
+ { status: "superseded", patterns: [/supersed/i, /replac/i] },
19812
+ { status: "stale", patterns: [/stale/i, /expired/i, /deprecated/i] },
19813
+ { status: "approved", patterns: [/approved/i, /accepted/i, /active/i, /confirmed/i] }
19814
+ ];
19815
+ var INTENT_PHRASE_SPLIT_PATTERN = /[;\n]/g;
19816
+ var INTENT_MARKDOWN_LIST_MARKER_PATTERN = /^[-*]\s*/;
19817
+ var INTENT_NUMBERED_LIST_MARKER_PATTERN = /^\d+\.\s*/;
19818
+ var INTENT_TEXT_EXTRACTORS = {
19819
+ antiGoals: [/\b(?:avoid|forbid|prevent|do not|don't)\b[^.;\n]*/gi],
19820
+ rejectedAlternatives: [/\b(?:rejected|instead of|rather than|not use|not using)\b[^.;\n]*/gi]
19821
+ };
19810
19822
  function intentStatusFromDecision(decision) {
19811
19823
  const status = normalizeText(decision.status);
19812
- if (/contradict|conflict/.test(status)) return "contradicted";
19813
- if (/supersed|replac/.test(status)) return "superseded";
19814
- if (/stale|expired|deprecated/.test(status)) return "stale";
19815
- if (/approved|accepted|active|confirmed/.test(status)) return "approved";
19816
- return "review_pending";
19824
+ const matchedRule = DECISION_STATUS_RULES.find(
19825
+ (rule) => rule.patterns.some((pattern) => pattern.test(status))
19826
+ );
19827
+ return matchedRule?.status ?? "review_pending";
19817
19828
  }
19818
19829
  function intentConfidence(score, status, reasonCodes) {
19819
19830
  return {
@@ -19836,12 +19847,7 @@ function stalenessFromStatus(status) {
19836
19847
  reason: "The intent has not been reviewed as current project truth."
19837
19848
  };
19838
19849
  }
19839
- return { state: "fresh", horizonDays: 90 };
19840
- }
19841
- function anchorMatchesFile(anchor, file) {
19842
- const normalizedAnchor = anchor.replace(/^\.\//, "").trim();
19843
- const normalizedFile = file.replace(/^\.\//, "").trim();
19844
- return normalizedAnchor.length > 0 && normalizedFile.length > 0 && (normalizedFile.includes(normalizedAnchor) || normalizedAnchor.includes(normalizedFile));
19850
+ return { state: "fresh", horizonDays: PROJECT_INTENT_LEDGER_FRESHNESS_HORIZON_DAYS };
19845
19851
  }
19846
19852
  function intentEntryMatchesFile(entry, file) {
19847
19853
  return entry.affectedAnchors.some((anchor) => anchorMatchesFile(anchor, file));
@@ -19855,23 +19861,26 @@ function inferDecisionAnchors(decision, changedFiles) {
19855
19861
  );
19856
19862
  return uniqueStrings8(inferred);
19857
19863
  }
19864
+ function normalizeIntentPhrase(value) {
19865
+ return value.replace(INTENT_MARKDOWN_LIST_MARKER_PATTERN, "").replace(INTENT_NUMBERED_LIST_MARKER_PATTERN, "").trim();
19866
+ }
19858
19867
  function splitIntentPhrases(value) {
19859
19868
  if (!value) return [];
19860
19869
  return uniqueStrings8(
19861
- value.split(/[;\n]/g).map((item) => item.replace(/^[-*]\s*/, "").trim()).filter(Boolean)
19870
+ value.split(INTENT_PHRASE_SPLIT_PATTERN).map(normalizeIntentPhrase).filter(Boolean)
19862
19871
  ).slice(0, 6);
19863
19872
  }
19864
- function extractAntiGoals(text) {
19865
- const matches = [...text.matchAll(/\b(?:avoid|forbid|prevent|do not|don't)\b[^.;\n]*/gi)].map(
19866
- (match) => match[0].trim()
19873
+ function extractTextMatches(text, patterns, limit) {
19874
+ const matches = patterns.flatMap(
19875
+ (pattern) => [...text.matchAll(pattern)].map((match) => match[0].trim())
19867
19876
  );
19868
- return uniqueStrings8(matches).slice(0, 5);
19877
+ return uniqueStrings8(matches).slice(0, limit);
19878
+ }
19879
+ function extractAntiGoals(text) {
19880
+ return extractTextMatches(text, INTENT_TEXT_EXTRACTORS.antiGoals, 5);
19869
19881
  }
19870
19882
  function extractRejectedAlternatives(text) {
19871
- const matches = [
19872
- ...text.matchAll(/\b(?:rejected|instead of|rather than|not use|not using)\b[^.;\n]*/gi)
19873
- ].map((match) => match[0].trim());
19874
- return uniqueStrings8(matches).slice(0, 5);
19883
+ return extractTextMatches(text, INTENT_TEXT_EXTRACTORS.rejectedAlternatives, 5);
19875
19884
  }
19876
19885
  function documentLooksLikeIntent(doc) {
19877
19886
  const text = normalizeText([doc.path, doc.title, doc.contentPreview, doc.kind].join(" "));
@@ -20006,11 +20015,11 @@ function buildProjectIntentLedger(input, changedFilesOverride) {
20006
20015
  ].filter((item) => Boolean(item))
20007
20016
  };
20008
20017
  }
20018
+
20019
+ // ../project-intelligence-contracts/src/unknown-registry.ts
20020
+ var PROJECT_UNKNOWN_REGISTRY_VERSION = "unknown-registry-v1";
20009
20021
  function unknownId(category, key, scope) {
20010
- return makeFindingId("decision_vs_code", `${category}:${key}`, scope).replace(
20011
- "reality:decision-vs-code",
20012
- "unknown"
20013
- );
20022
+ return makeScopedId("unknown", category, key, scope);
20014
20023
  }
20015
20024
  function unknownStatusFromSeverity(unknowns) {
20016
20025
  if (unknowns.some(
@@ -20236,8 +20245,23 @@ function buildProjectUnknownRegistry(input) {
20236
20245
  ].filter((item) => Boolean(item))
20237
20246
  };
20238
20247
  }
20239
- function surfaceFiles(surface, changedFiles) {
20240
- return changedFiles.filter((file) => surface.patterns.some((pattern) => pattern.test(file)));
20248
+
20249
+ // ../project-intelligence-contracts/src/reality-check.ts
20250
+ var PROJECT_REALITY_CHECK_VERSION = "project-reality-check-v0";
20251
+ function findingSeverityScore(severity) {
20252
+ if (severity === "blocking") return 0;
20253
+ if (severity === "review_required") return 30;
20254
+ if (severity === "watch") return 70;
20255
+ return 90;
20256
+ }
20257
+ function resultStatusFromFindings(findings) {
20258
+ if (findings.some((finding) => finding.severity === "blocking")) return "blocking";
20259
+ if (findings.some((finding) => finding.severity === "review_required")) return "review_required";
20260
+ if (findings.some((finding) => finding.severity === "watch")) return "advisory";
20261
+ return "pass";
20262
+ }
20263
+ function makeFindingId(type, key, files) {
20264
+ return makeScopedId("reality", type, key, files);
20241
20265
  }
20242
20266
  function testFiles(changedFiles) {
20243
20267
  return changedFiles.filter(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snipara-companion",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Local-first CLI that asks your repo what breaks before an AI coding agent edits it.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {