speclock 5.2.4 → 5.2.6

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  "name": "speclock",
4
4
 
5
- "version": "5.2.4",
5
+ "version": "5.2.6",
6
6
 
7
7
  "description": "AI Constraint Engine — AI Patch Firewall. Diff-native review (interface breaks, protected symbols, dependency drift, schema changes, API impact), Patch Gateway (ALLOW/WARN/BLOCK verdicts), Spec Compiler (NL→constraints), Code Graph (blast radius, lock-to-file mapping), Typed constraints, REST API v2, Python SDK, ROS2 integration. 42 MCP tools, Gemini LLM hybrid, HMAC audit chain, RBAC, encryption, SOC 2/HIPAA compliance.",
8
8
 
package/src/cli/index.js CHANGED
@@ -117,7 +117,7 @@ function refreshContext(root) {
117
117
 
118
118
  function printHelp() {
119
119
  console.log(`
120
- SpecLock v5.2.4 — AI Constraint Engine (Spec Compiler + Code Graph + Typed Constraints + Python SDK + ROS2 + REST API v2 + Gemini LLM + Policy-as-Code + Auth + RBAC + Encryption)
120
+ SpecLock v5.2.6 — AI Constraint Engine (Spec Compiler + Code Graph + Typed Constraints + Python SDK + ROS2 + REST API v2 + Gemini LLM + Policy-as-Code + Auth + RBAC + Encryption)
121
121
  Developed by Sandeep Roy (github.com/sgroy10)
122
122
 
123
123
  Usage: speclock <command> [options]
@@ -9,7 +9,7 @@
9
9
  import { readBrain, readEvents } from "./storage.js";
10
10
  import { verifyAuditChain } from "./audit.js";
11
11
 
12
- const VERSION = "5.2.4";
12
+ const VERSION = "5.2.6";
13
13
 
14
14
  // PHI-related keywords for HIPAA filtering
15
15
  const PHI_KEYWORDS = [
@@ -91,7 +91,7 @@ export const SYNONYM_GROUPS = [
91
91
  "private key", "access key", "api secret", "api token",
92
92
  "credentials", "credential"],
93
93
  ["frontend", "frontend code", "client-side", "client side",
94
- "browser", "react state", "ui component"],
94
+ "browser", "react state", "ui component", "ui"],
95
95
 
96
96
  // --- Dependencies ---
97
97
  ["dependency", "package", "library", "module", "import", "require",
@@ -239,6 +239,7 @@ export const EUPHEMISM_MAP = {
239
239
  "streamline": ["remove", "simplify", "modify", "reduce", "weaken", "bypass", "disable"],
240
240
  "optimize": ["modify", "change", "remove", "reduce"],
241
241
  "modernize": ["replace", "rewrite", "change"],
242
+ "reorganize": ["modify", "change", "tamper", "alter"],
242
243
  "revamp": ["replace", "rewrite", "change"],
243
244
  "overhaul": ["replace", "rewrite", "change", "modify"],
244
245
  "refresh": ["replace", "update", "change"],
@@ -771,6 +772,11 @@ export const CONCEPT_MAP = {
771
772
  "denied applications": ["application decisions", "application processing",
772
773
  "benefits decisions"],
773
774
 
775
+ // Privacy / data protection
776
+ "privacy": ["confidential", "pii", "personal data", "data protection",
777
+ "restricted access"],
778
+ "confidential": ["privacy", "private", "restricted", "pii", "data protection"],
779
+
774
780
  // Telecom / billing
775
781
  "call records": ["cdr", "call data", "telecom records", "billing records"],
776
782
  "subscriber data": ["customer data", "user data", "telecom records"],
@@ -782,12 +788,12 @@ export const CONCEPT_MAP = {
782
788
  "user location", "pii"],
783
789
 
784
790
  // Frontend frameworks (alternatives = change framework conflict)
785
- "react": ["frontend framework", "ui framework", "vue", "angular",
786
- "svelte", "sveltekit", "next.js", "nextjs"],
787
- "vue": ["frontend framework", "ui framework", "react", "angular",
788
- "svelte", "sveltekit", "nuxt"],
789
- "vue 3": ["frontend framework", "ui framework", "react", "angular",
790
- "svelte", "sveltekit", "nuxt", "vue"],
791
+ "react": ["frontend framework", "ui framework", "frontend", "ui",
792
+ "vue", "angular", "svelte", "sveltekit", "next.js", "nextjs"],
793
+ "vue": ["frontend framework", "ui framework", "frontend", "ui",
794
+ "react", "angular", "svelte", "sveltekit", "nuxt"],
795
+ "vue 3": ["frontend framework", "ui framework", "frontend", "ui",
796
+ "react", "angular", "svelte", "sveltekit", "nuxt", "vue"],
791
797
  "vue.js": ["frontend framework", "ui framework", "react", "angular",
792
798
  "svelte", "sveltekit", "nuxt", "vue"],
793
799
  "svelte": ["frontend framework", "ui framework", "react", "vue",
@@ -806,6 +812,11 @@ export const CONCEPT_MAP = {
806
812
  "ui framework", "next.js", "nuxt"],
807
813
  "ui framework": ["frontend framework", "react", "vue", "angular",
808
814
  "svelte", "sveltekit"],
815
+ "tech stack": ["frontend framework", "backend framework", "react", "vue",
816
+ "angular", "svelte", "express", "django", "technology stack"],
817
+ "technology stack": ["tech stack", "frontend framework", "backend framework"],
818
+ "application framework": ["frontend framework", "backend framework", "react",
819
+ "vue", "angular", "express", "django"],
809
820
 
810
821
  // Backend frameworks (alternatives = change backend conflict)
811
822
  "express": ["backend framework", "fastify", "koa", "hapi", "nestjs"],
@@ -1049,6 +1060,15 @@ export function tokenize(text) {
1049
1060
  }
1050
1061
  }
1051
1062
 
1063
+ // Split hyphenated tokens — "react-based" also adds "react", "based"
1064
+ for (const w of [...rawWords]) {
1065
+ if (w.includes('-')) {
1066
+ for (const part of w.split('-')) {
1067
+ if (part.length >= 2 && !rawWords.includes(part)) rawWords.push(part);
1068
+ }
1069
+ }
1070
+ }
1071
+
1052
1072
  // Basic plural normalization — add both singular and plural forms
1053
1073
  // so "databases" matches "database" and vice versa
1054
1074
  const words = [...rawWords];
@@ -2277,6 +2297,39 @@ export function scoreConflict({ actionText, lockText }) {
2277
2297
  intentAligned = true;
2278
2298
  reasons.push("intent alignment: adding a database index is a performance optimization — does not modify locked schema");
2279
2299
  }
2300
+
2301
+ // Pattern 6: Technology maintenance/refactoring vs exposure/secrets locks
2302
+ // "Refactor React component file structure" vs "never expose API keys in frontend code" → safe
2303
+ // "Update React Router to v7" vs "never expose API keys in frontend code" → safe
2304
+ // But: "Expose React state to window" → action mentions "expos" → NOT safe
2305
+ // But: "Add API key to React config" → action mentions "api key" → NOT safe
2306
+ // But: "Update endpoint to include email" vs "never expose email" → direct subject overlap → NOT safe
2307
+ // Root cause: concept map links react→frontend, matching "frontend" in exposure lock.
2308
+ // Fix: constructive tech verbs against exposure locks are safe when action doesn't touch secrets
2309
+ // AND there's no direct subject overlap (overlap is only through concept map expansion).
2310
+ if (!intentAligned && !_compoundDestructive) {
2311
+ const _isMaintenanceAction = /\b(?:refactor|restructure|reorganize|update|upgrade|bump|install|configure|optimize|improve|enhance|test|debug|fix|review|clean|format|lint|style|document|migrate)\b/i.test(_actionLowerSafe);
2312
+ const _lockMentionsExposure = /\b(?:expos(?:e|ed|es|ing)?|leak(?:s|ed|ing)?|secrets?|credentials?|api.?keys?|passwords?|tokens?|sensitive)\b/i.test(lockText);
2313
+ const _actionMentionsExposure = /\b(?:expos(?:e|ed|es|ing)?|leak(?:s|ed|ing)?|secrets?|credentials?|api.?keys?|passwords?|tokens?|sensitive|plain.?text|unencrypt)\b/i.test(_actionLowerSafe);
2314
+ // Guard: check for direct subject overlap between action and lock.
2315
+ // If the action directly mentions the lock's protected subjects (not via concept map),
2316
+ // Pattern 6 should not apply — the action touches the lock's domain.
2317
+ const _p6Exclude = /^(?:expos(?:e[ds]?|ing)?|leak(?:s|ed|ing)?|secrets?|credentials?|passwords?|tokens?|sensitive|never|must|should|always|code|dont|does|through|from|with|into|that|this)$/;
2318
+ const _lockSubjects = lockText.toLowerCase()
2319
+ .split(/[\s,]+/)
2320
+ .map(w => w.replace(/[^a-z0-9]/g, ''))
2321
+ .filter(w => w.length > 3 && !_p6Exclude.test(w));
2322
+ const _actionWords6 = new Set(
2323
+ _actionLowerSafe.split(/[\s,]+/)
2324
+ .map(w => w.replace(/[^a-z0-9]/g, ''))
2325
+ .filter(w => w.length > 3)
2326
+ );
2327
+ const _directSubjectOverlap = _lockSubjects.some(w => _actionWords6.has(w));
2328
+ if (_isMaintenanceAction && _lockMentionsExposure && !_actionMentionsExposure && !_directSubjectOverlap) {
2329
+ intentAligned = true;
2330
+ reasons.push("intent alignment: technology maintenance action does not involve secrets/exposure — safe against exposure lock");
2331
+ }
2332
+ }
2280
2333
  }
2281
2334
 
2282
2335
  // Check 3c: Working WITH locked technology (not replacing it)
@@ -2442,7 +2495,10 @@ export function scoreConflict({ actionText, lockText }) {
2442
2495
  if (!intentAligned && !hasStrongVocabMatch && !_hasStructuralVerbWithOverlap) {
2443
2496
  const actionLower = actionText.toLowerCase();
2444
2497
  const actionWords = actionLower.split(/\s+/).map(w => w.replace(/[^a-z]/g, ""));
2445
- const hasUISubject = actionWords.some(w => UI_COSMETIC_WORDS.has(w));
2498
+ // Guard: "background" in "background check/screening/process" is NOT cosmetic CSS
2499
+ const _hasNonCosmeticBackground = /\bbackground\s+(?:check|screening|investigation|process|task|job|worker|service)\b/i.test(actionLower);
2500
+ const hasUISubject = actionWords.some(w =>
2501
+ UI_COSMETIC_WORDS.has(w) && !(w === "background" && _hasNonCosmeticBackground));
2446
2502
  if (hasUISubject) {
2447
2503
  intentAligned = true;
2448
2504
  reasons.push(
@@ -89,7 +89,7 @@
89
89
  <div class="header">
90
90
  <div>
91
91
  <h1><span>SpecLock</span> Dashboard</h1>
92
- <div class="meta">v5.2.4 &mdash; AI Constraint Engine</div>
92
+ <div class="meta">v5.2.6 &mdash; AI Constraint Engine</div>
93
93
  </div>
94
94
  <div style="display:flex;align-items:center;gap:12px;">
95
95
  <span id="health-badge" class="status-badge healthy">Loading...</span>
@@ -182,7 +182,7 @@
182
182
  </div>
183
183
 
184
184
  <div style="text-align:center;padding:24px;color:var(--muted);font-size:12px;">
185
- SpecLock v5.2.4 &mdash; Developed by Sandeep Roy &mdash; <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
185
+ SpecLock v5.2.6 &mdash; Developed by Sandeep Roy &mdash; <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
186
186
  </div>
187
187
 
188
188
  <script>
@@ -113,7 +113,7 @@ import { fileURLToPath } from "url";
113
113
  import _path from "path";
114
114
 
115
115
  const PROJECT_ROOT = process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
116
- const VERSION = "5.2.4";
116
+ const VERSION = "5.2.6";
117
117
  const AUTHOR = "Sandeep Roy";
118
118
  const START_TIME = Date.now();
119
119
 
package/src/mcp/server.js CHANGED
@@ -120,7 +120,7 @@ const PROJECT_ROOT =
120
120
  args.project || process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
121
121
 
122
122
  // --- MCP Server ---
123
- const VERSION = "5.2.4";
123
+ const VERSION = "5.2.6";
124
124
  const AUTHOR = "Sandeep Roy";
125
125
 
126
126
  const server = new McpServer(