speclock 5.0.0 → 5.0.2

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.
@@ -1,5 +1,7 @@
1
1
  # SpecLock Project Instructions — Copy-Paste Templates
2
2
 
3
+ > Developed by **Sandeep Roy** ([github.com/sgroy10](https://github.com/sgroy10))
4
+
3
5
  These are **project-level instructions** that you paste into your AI coding platform's settings. They force the AI to use SpecLock on every action — turning it from a passive notepad into an active guardrail.
4
6
 
5
7
  ---
package/bin/speclock.js CHANGED
@@ -1,2 +1,4 @@
1
1
  #!/usr/bin/env node
2
+ // SpecLock CLI — AI Constraint Engine
3
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
2
4
  import "../src/cli/index.js";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  "name": "speclock",
4
4
 
5
- "version": "5.0.0",
5
+ "version": "5.0.2",
6
6
 
7
7
  "description": "AI Constraint Engine for autonomous systems governance. Spec Compiler (NL→constraints), Code Graph (blast radius, lock-to-file mapping), Typed constraints (numerical, range, state, temporal), REST API v2, Python SDK, ROS2 integration. 39 MCP tools, Gemini LLM hybrid, HMAC audit chain, RBAC, encryption, SOC 2/HIPAA compliance.",
8
8
 
@@ -12,130 +12,91 @@
12
12
 
13
13
  "bin": {
14
14
 
15
-
16
- "speclock": "./bin/speclock.js"
15
+ "speclock": "./bin/speclock.js"
17
16
 
18
17
  },
19
18
 
20
19
  "scripts": {
21
20
 
22
-
23
- "start": "node src/mcp/server.js",
21
+ "start": "node src/mcp/server.js",
24
22
 
25
-
26
- "serve": "node src/mcp/server.js",
23
+ "serve": "node src/mcp/server.js",
27
24
 
28
-
29
- "test": "node --experimental-vm-modules node_modules/.bin/jest"
25
+ "test": "node --experimental-vm-modules node_modules/.bin/jest"
30
26
 
31
27
  },
32
28
 
33
29
  "keywords": [
34
30
 
35
-
36
- "mcp",
31
+ "mcp",
37
32
 
38
-
39
- "mcp-server",
33
+ "mcp-server",
40
34
 
41
-
42
- "ai",
35
+ "ai",
43
36
 
44
-
45
- "ai-memory",
37
+ "ai-memory",
46
38
 
47
-
48
- "ai-continuity",
39
+ "ai-continuity",
49
40
 
50
-
51
- "context",
41
+ "context",
52
42
 
53
-
54
- "memory",
43
+ "memory",
55
44
 
56
-
57
- "claude",
45
+ "claude",
58
46
 
59
-
60
- "claude-code",
47
+ "claude-code",
61
48
 
62
-
63
- "cursor",
49
+ "cursor",
64
50
 
65
-
66
- "codex",
51
+ "codex",
67
52
 
68
-
69
- "windsurf",
53
+ "windsurf",
70
54
 
71
-
72
- "cline",
55
+ "cline",
73
56
 
74
-
75
- "speclock",
57
+ "speclock",
76
58
 
77
-
78
- "ai-amnesia",
59
+ "ai-amnesia",
79
60
 
80
-
81
- "model-context-protocol",
61
+ "model-context-protocol",
82
62
 
83
-
84
- "drift-detection",
63
+ "drift-detection",
85
64
 
86
-
87
- "constraint-enforcement",
65
+ "constraint-enforcement",
88
66
 
89
-
90
- "enterprise",
67
+ "enterprise",
91
68
 
92
-
93
- "soc2",
69
+ "soc2",
94
70
 
95
-
96
- "hipaa",
71
+ "hipaa",
97
72
 
98
-
99
- "compliance",
73
+ "compliance",
100
74
 
101
-
102
- "audit-trail",
75
+ "audit-trail",
103
76
 
104
-
105
- "hmac",
77
+ "hmac",
106
78
 
107
-
108
- "encryption",
79
+ "encryption",
109
80
 
110
-
111
- "aes-256",
81
+ "aes-256",
112
82
 
113
-
114
- "api-key",
83
+ "api-key",
115
84
 
116
-
117
- "authentication",
85
+ "authentication",
118
86
 
119
-
120
- "rbac",
87
+ "rbac",
121
88
 
122
-
123
- "policy-as-code",
89
+ "policy-as-code",
124
90
 
125
-
126
- "sso",
91
+ "sso",
127
92
 
128
-
129
- "oauth",
93
+ "oauth",
130
94
 
131
-
132
- "oidc",
95
+ "oidc",
133
96
 
134
-
135
- "dashboard",
97
+ "dashboard",
136
98
 
137
-
138
- "telemetry"
99
+ "telemetry"
139
100
 
140
101
  ],
141
102
 
@@ -147,104 +108,79 @@
147
108
 
148
109
  "bugs": {
149
110
 
150
-
151
- "url": "https://github.com/sgroy10/speclock/issues"
111
+ "url": "https://github.com/sgroy10/speclock/issues"
152
112
 
153
113
  },
154
114
 
155
115
  "repository": {
156
116
 
157
-
158
- "type": "git",
117
+ "type": "git",
159
118
 
160
-
161
- "url": "git+https://github.com/sgroy10/speclock.git"
119
+ "url": "git+https://github.com/sgroy10/speclock.git"
162
120
 
163
121
  },
164
122
 
165
123
  "engines": {
166
124
 
167
-
168
- "node": ">=18"
125
+ "node": ">=18"
169
126
 
170
127
  },
171
128
 
172
129
  "dependencies": {
173
130
 
174
-
175
- "@modelcontextprotocol/sdk": "^1.26.0",
131
+ "@modelcontextprotocol/sdk": "^1.26.0",
176
132
 
177
-
178
- "chokidar": "^3.6.0",
133
+ "chokidar": "^3.6.0",
179
134
 
180
-
181
- "zod": "^3.25.0"
135
+ "zod": "^3.25.0"
182
136
 
183
137
  },
184
138
 
185
139
  "files": [
186
140
 
187
-
188
- "bin/",
141
+ "bin/",
189
142
 
190
-
191
- "src/",
143
+ "src/",
192
144
 
193
-
194
- "src/dashboard/",
145
+ "src/dashboard/",
195
146
 
196
-
197
- "README.md",
147
+ "README.md",
198
148
 
199
-
200
- "SPECLOCK-INSTRUCTIONS.md",
149
+ "SPECLOCK-INSTRUCTIONS.md",
201
150
 
202
-
203
- "LICENSE"
151
+ "LICENSE"
204
152
 
205
153
  ],
206
154
 
207
155
  "devDependencies": {
208
156
 
209
-
210
- "esbuild": "^0.27.3",
157
+ "esbuild": "^0.27.3",
211
158
 
212
-
213
- "jest": "^30.2.0"
159
+ "jest": "^30.2.0"
214
160
 
215
161
  },
216
162
 
217
163
  "speclock": {
218
164
 
219
-
220
- "active": true,
165
+ "active": true,
221
166
 
222
-
223
- "message": "STOP — This project has SpecLock constraints. Read SPECLOCK.md and .speclock/context/latest.md BEFORE making ANY changes. Run 'npx speclock check' before ALL code changes. If a lock below is violated, STOP and ask user to unlock.",
167
+ "message": "STOP — This project has SpecLock constraints. Read SPECLOCK.md and .speclock/context/latest.md BEFORE making ANY changes. Run 'npx speclock check' before ALL code changes. If a lock below is violated, STOP and ask user to unlock.",
224
168
 
225
-
226
- "locks": [
169
+ "locks": [
227
170
 
228
-
229
-
230
- "Game balance configuration must not be changed",
171
+ "Game balance configuration must not be changed",
231
172
 
232
-
233
-
234
- "Patient records must never be deleted",
173
+ "Patient records must never be deleted",
235
174
 
236
-
237
-
238
- "No breaking changes to public API"
175
+ "No breaking changes to public API"
239
176
 
240
-
241
- ],
177
+ ],
242
178
 
243
-
244
- "context": ".speclock/context/latest.md",
179
+ "context": ".speclock/context/latest.md",
245
180
 
246
-
247
- "rules": "SPECLOCK.md"
181
+ "rules": "SPECLOCK.md"
248
182
 
249
183
  }
184
+
250
185
  }
186
+
package/src/core/git.js CHANGED
@@ -1,3 +1,6 @@
1
+ // SpecLock Git Integration — Checkpoints, diffs, repo status
2
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
3
+
1
4
  import fs from "fs";
2
5
  import path from "path";
3
6
  import { spawnSync } from "child_process";
package/src/core/hooks.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // SpecLock Git Hook Management
2
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
2
3
 
3
4
  import fs from "fs";
4
5
  import path from "path";
@@ -2,6 +2,7 @@
2
2
  // SpecLock Semantic Analysis Engine v3
3
3
  // Subject-aware conflict detection with scope matching.
4
4
  // Zero external dependencies — pure JavaScript.
5
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
5
6
  // ===================================================================
6
7
 
7
8
  // ===================================================================
@@ -1,3 +1,6 @@
1
+ // SpecLock Storage — brain.json and events.log read/write with encryption support
2
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
3
+
1
4
  import fs from "fs";
2
5
  import path from "path";
3
6
  import crypto from "crypto";
@@ -1,4 +1,5 @@
1
1
  // SpecLock Constraint Templates — Pre-built lock packs for common frameworks
2
+ // Developed by Sandeep Roy (https://github.com/sgroy10)
2
3
 
3
4
  export const TEMPLATES = {
4
5
  nextjs: {
@@ -881,7 +881,7 @@ app.get("/health", (req, res) => {
881
881
  status: "healthy",
882
882
  version: VERSION,
883
883
  uptime: Math.floor((Date.now() - START_TIME) / 1000),
884
- tools: 35,
884
+ tools: 39,
885
885
  auditChain: auditStatus,
886
886
  authEnabled: isAuthEnabled(PROJECT_ROOT),
887
887
  rateLimit: { limit: RATE_LIMIT, windowMs: RATE_WINDOW_MS },
@@ -895,8 +895,8 @@ app.get("/", (req, res) => {
895
895
  name: "speclock",
896
896
  version: VERSION,
897
897
  author: AUTHOR,
898
- description: "AI Constraint Engine for autonomous systems governance. Typed constraints (numerical, range, state, temporal) + REST API v2 with batch checking & SSE streaming. Python SDK + ROS2 integration. Policy-as-Code, OAuth/OIDC SSO, admin dashboard, telemetry, RBAC, AES-256-GCM encryption, hard enforcement, HMAC audit chain, SOC 2/HIPAA compliance. 35 MCP tools.",
899
- tools: 35,
898
+ description: "AI Constraint Engine for autonomous systems governance. Spec Compiler (NL→constraints), Code Graph (blast radius, lock-to-file mapping), Typed constraints (numerical, range, state, temporal), REST API v2 with batch checking & SSE streaming. Python SDK + ROS2 integration. Policy-as-Code, RBAC, AES-256-GCM encryption, hard enforcement, HMAC audit chain, SOC 2/HIPAA compliance. 39 MCP tools. 940 tests, 99.4% accuracy.",
899
+ tools: 39,
900
900
  mcp_endpoint: "/mcp",
901
901
  health_endpoint: "/health",
902
902
  npm: "https://www.npmjs.com/package/speclock",
@@ -910,7 +910,7 @@ app.get("/.well-known/mcp/server-card.json", (req, res) => {
910
910
  res.json({
911
911
  name: "SpecLock",
912
912
  version: VERSION,
913
- description: "AI Constraint Engine for autonomous systems governance. Typed constraints + REST API v2 with batch checking & SSE streaming. Python SDK (pip install speclock) + ROS2 Guardian Node. Hybrid heuristic + Gemini LLM. Policy-as-Code, OAuth/OIDC SSO, admin dashboard, telemetry, RBAC, AES-256-GCM encryption, hard enforcement, HMAC audit chain, SOC 2/HIPAA compliance. 35 MCP tools + CLI. Works with Claude Code, Cursor, Windsurf, Cline, Bolt.new, Lovable.",
913
+ description: "AI Constraint Engine for autonomous systems governance. Spec Compiler (NL→constraints via Gemini Flash), Code Graph (dependency parsing, blast radius, lock-to-file mapping), Typed constraints (numerical, range, state, temporal), REST API v2, Python SDK + ROS2 Guardian Node. Hybrid heuristic + Gemini LLM. Policy-as-Code, RBAC, AES-256-GCM encryption, hard enforcement, HMAC audit chain, SOC 2/HIPAA compliance. 39 MCP tools. 940 tests, 99.4% accuracy. Works with Claude Code, Cursor, Windsurf, Cline, Bolt.new, Lovable.",
914
914
  author: {
915
915
  name: "Sandeep Roy",
916
916
  url: "https://github.com/sgroy10",
@@ -919,7 +919,7 @@ app.get("/.well-known/mcp/server-card.json", (req, res) => {
919
919
  homepage: "https://sgroy10.github.io/speclock/",
920
920
  license: "MIT",
921
921
  capabilities: {
922
- tools: 35,
922
+ tools: 39,
923
923
  categories: [
924
924
  "Memory Management",
925
925
  "Change Tracking",
@@ -1411,8 +1411,10 @@ app.get("/api/v2/status", (req, res) => {
1411
1411
 
1412
1412
  app.post("/api/v2/compiler/compile", async (req, res) => {
1413
1413
  setCorsHeaders(res);
1414
- if (!checkAuth(req, res)) return;
1415
- if (!checkRateLimit(req, res)) return;
1414
+ const clientIp = req.headers["x-forwarded-for"]?.split(",")[0]?.trim() || req.socket?.remoteAddress || "unknown";
1415
+ if (!checkRateLimit(clientIp)) {
1416
+ return res.status(429).json({ error: "Rate limit exceeded", api_version: "v2" });
1417
+ }
1416
1418
 
1417
1419
  try {
1418
1420
  ensureInit(PROJECT_ROOT);
@@ -1451,7 +1453,6 @@ app.post("/api/v2/compiler/compile", async (req, res) => {
1451
1453
 
1452
1454
  app.get("/api/v2/graph", (req, res) => {
1453
1455
  setCorsHeaders(res);
1454
- if (!checkAuth(req, res)) return;
1455
1456
 
1456
1457
  try {
1457
1458
  ensureInit(PROJECT_ROOT);
@@ -1464,7 +1465,6 @@ app.get("/api/v2/graph", (req, res) => {
1464
1465
 
1465
1466
  app.post("/api/v2/graph/build", (req, res) => {
1466
1467
  setCorsHeaders(res);
1467
- if (!checkAuth(req, res)) return;
1468
1468
 
1469
1469
  try {
1470
1470
  ensureInit(PROJECT_ROOT);
@@ -1482,7 +1482,6 @@ app.post("/api/v2/graph/build", (req, res) => {
1482
1482
 
1483
1483
  app.get("/api/v2/graph/blast-radius", (req, res) => {
1484
1484
  setCorsHeaders(res);
1485
- if (!checkAuth(req, res)) return;
1486
1485
 
1487
1486
  try {
1488
1487
  ensureInit(PROJECT_ROOT);
@@ -1500,7 +1499,6 @@ app.get("/api/v2/graph/blast-radius", (req, res) => {
1500
1499
 
1501
1500
  app.get("/api/v2/graph/lock-map", (req, res) => {
1502
1501
  setCorsHeaders(res);
1503
- if (!checkAuth(req, res)) return;
1504
1502
 
1505
1503
  try {
1506
1504
  ensureInit(PROJECT_ROOT);