speclock 5.5.3 → 5.5.5
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 +264 -336
- package/package.json +217 -1
- package/src/cli/index.js +858 -39
- package/src/core/auth.js +8 -0
- package/src/core/compliance.js +1 -1
- package/src/core/enforcer.js +7 -1
- package/src/core/guardian.js +78 -5
- package/src/core/hooks.js +5 -2
- package/src/core/lock-author.js +8 -0
- package/src/core/mcp-install.js +484 -0
- package/src/core/telemetry.js +685 -114
- package/src/dashboard/index.html +2 -2
- package/src/mcp/http-server.js +2 -2
- package/src/mcp/server.js +1 -1
- package/src/templates/rule-packs/fastapi.md +22 -0
- package/src/templates/rule-packs/nextjs.md +22 -0
- package/src/templates/rule-packs/node.md +22 -0
- package/src/templates/rule-packs/python.md +22 -0
- package/src/templates/rule-packs/rails.md +22 -0
- package/src/templates/rule-packs/react.md +22 -0
package/src/dashboard/index.html
CHANGED
|
@@ -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.5.
|
|
92
|
+
<div class="meta">v5.5.5 — Your AI has rules. SpecLock makes them unbreakable.</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.5.
|
|
185
|
+
SpecLock v5.5.5 — Developed by Sandeep Roy — <a href="https://github.com/sgroy10/speclock" style="color:var(--accent)">GitHub</a>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
188
188
|
<script>
|
package/src/mcp/http-server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SpecLock MCP HTTP Server — for Railway / remote deployment
|
|
3
|
-
* Wraps the same
|
|
3
|
+
* Wraps the same 51 tools as the stdio server using Streamable HTTP transport.
|
|
4
4
|
* Developed by Sandeep Roy (https://github.com/sgroy10)
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -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.5.
|
|
116
|
+
const VERSION = "5.5.5";
|
|
117
117
|
const AUTHOR = "Sandeep Roy";
|
|
118
118
|
const START_TIME = Date.now();
|
|
119
119
|
|
package/src/mcp/server.js
CHANGED
|
@@ -126,7 +126,7 @@ const PROJECT_ROOT =
|
|
|
126
126
|
args.project || process.env.SPECLOCK_PROJECT_ROOT || process.cwd();
|
|
127
127
|
|
|
128
128
|
// --- MCP Server ---
|
|
129
|
-
const VERSION = "5.5.
|
|
129
|
+
const VERSION = "5.5.5";
|
|
130
130
|
const AUTHOR = "Sandeep Roy";
|
|
131
131
|
|
|
132
132
|
const server = new McpServer(
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# FastAPI Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for FastAPI + Python (async, Pydantic, JWT).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER bypass Pydantic validation on request bodies — every endpoint must declare a typed request model.
|
|
9
|
+
- NEVER expose database connection strings, API keys, or secrets in code — load them from environment variables or a secrets manager.
|
|
10
|
+
- ALWAYS use FastAPI dependency injection (`Depends`) for database sessions, auth, and shared services.
|
|
11
|
+
- NEVER write SQL queries with string concatenation or f-strings on user input — use parameterized queries or an ORM like SQLAlchemy.
|
|
12
|
+
- ALWAYS use `async def` for I/O-bound endpoints (database, HTTP, file) and sync `def` only for pure CPU work.
|
|
13
|
+
- NEVER catch broad `Exception` without logging the traceback — use `logger.exception` and re-raise when appropriate.
|
|
14
|
+
- ALWAYS validate and verify JWT tokens (signature, expiry, issuer, audience) before trusting any claim.
|
|
15
|
+
- NEVER store passwords in plaintext — use bcrypt, argon2, or passlib with a strong work factor.
|
|
16
|
+
- NEVER expose internal error messages, stack traces, or ORM errors to API responses — return sanitized error shapes.
|
|
17
|
+
- ALWAYS enforce HTTPS in production environments — redirect HTTP, set HSTS, and reject insecure cookies.
|
|
18
|
+
- NEVER use `eval()`, `exec()`, or `pickle.loads` on user-supplied input — all three are remote code execution vectors.
|
|
19
|
+
- ALWAYS rate-limit public API endpoints with `slowapi` or an upstream gateway to prevent abuse.
|
|
20
|
+
- ALWAYS pin dependency versions in `requirements.txt` or `pyproject.toml` and review with `pip-audit` / `safety`.
|
|
21
|
+
- NEVER commit `.env`, `credentials.json`, or private keys to version control — add them to `.gitignore`.
|
|
22
|
+
- ALWAYS configure CORS explicitly with allowed origins — never use `allow_origins=["*"]` together with credentials.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Next.js Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for Next.js 13+ (App Router, Server Components, TypeScript).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER use `getServerSideProps` for static pages — use `getStaticProps` or `generateStaticParams`.
|
|
9
|
+
- NEVER expose API keys or secrets to Client Components — keep them in Server Components or route handlers.
|
|
10
|
+
- NEVER use `dangerouslySetInnerHTML` without sanitizing input through DOMPurify or a vetted sanitizer.
|
|
11
|
+
- ALWAYS validate environment variables at startup in a typed `env.ts` (e.g. using zod or `@t3-oss/env-nextjs`).
|
|
12
|
+
- NEVER mutate React state directly — always use the setter returned from `useState` or `useReducer`.
|
|
13
|
+
- ALWAYS handle loading and error states in async Server Components with `loading.tsx` and `error.tsx`.
|
|
14
|
+
- NEVER bundle large dependencies (moment, lodash full build, charting libs) into Client Components — lazy-load with `next/dynamic`.
|
|
15
|
+
- NEVER use the `any` type in TypeScript — define proper interfaces and enable `strict: true` in tsconfig.
|
|
16
|
+
- ALWAYS use `next/image` instead of raw `<img>` tags for automatic optimization, lazy loading, and CLS prevention.
|
|
17
|
+
- NEVER hardcode database URLs, connection strings, or secrets in source files — read from `process.env`.
|
|
18
|
+
- ALWAYS default to Server Components; opt into Client Components only when you need browser APIs, state, or effects.
|
|
19
|
+
- NEVER ship `console.log`, `console.debug`, or `debugger` statements to production builds.
|
|
20
|
+
- NEVER skip middleware authentication checks on protected routes — centralize auth in `middleware.ts`.
|
|
21
|
+
- ALWAYS colocate route-specific code under `app/` and shared code under `lib/` or `components/`.
|
|
22
|
+
- NEVER call `fetch` without explicit `cache` or `next.revalidate` options on Server Components — be intentional about caching.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Node.js / Express Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for Node.js and Express (async, security, reliability).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER block the event loop with synchronous I/O (`fs.readFileSync`, `crypto.pbkdf2Sync`) on request paths — use async variants.
|
|
9
|
+
- NEVER use `eval()`, `new Function()`, or `vm.runInThisContext` on user-supplied input — they are remote code execution vectors.
|
|
10
|
+
- ALWAYS validate and sanitize request input with `zod`, `joi`, or `express-validator` before trusting it.
|
|
11
|
+
- NEVER concatenate user input into SQL or shell commands — use parameterized queries and `execFile` with argument arrays.
|
|
12
|
+
- ALWAYS store secrets in environment variables or a secrets manager — never commit them to the repo.
|
|
13
|
+
- NEVER catch promise rejections silently — always handle errors in `.catch()` or `try/await/catch` and log them.
|
|
14
|
+
- ALWAYS set security headers via `helmet` and enable strict CORS with an explicit origin allowlist.
|
|
15
|
+
- NEVER trust `req.body`, `req.query`, `req.params`, or `req.headers` without validation.
|
|
16
|
+
- ALWAYS hash passwords with `bcrypt`, `argon2`, or `scrypt` — never MD5, SHA1, or plain SHA256.
|
|
17
|
+
- NEVER use `dangerouslySetInnerHTML`, `eval`-based templating, or unescaped interpolation in server-rendered HTML.
|
|
18
|
+
- ALWAYS pin dependencies with `package-lock.json` and audit with `npm audit` / `snyk` in CI.
|
|
19
|
+
- NEVER ship `console.log` or `debugger` statements to production — use a proper logger like `pino` or `winston`.
|
|
20
|
+
- ALWAYS enforce rate limiting on public endpoints with `express-rate-limit` or an upstream gateway.
|
|
21
|
+
- NEVER log passwords, tokens, session IDs, or PII — redact sensitive fields before logging.
|
|
22
|
+
- ALWAYS handle `unhandledRejection` and `uncaughtException` at the process level and exit cleanly.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Python Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for generic Python projects (security, type hints, hygiene).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER use `eval()`, `exec()`, or `compile()` on user-supplied input — they are remote code execution vectors.
|
|
9
|
+
- NEVER use `pickle.loads`, `shelve`, or `marshal.loads` on untrusted data — use JSON or a schema-validated format.
|
|
10
|
+
- ALWAYS use `subprocess.run` with a list of arguments and `shell=False` — never `shell=True` on user input.
|
|
11
|
+
- NEVER hardcode secrets, API keys, or passwords in source files — read from environment variables or a secrets manager.
|
|
12
|
+
- ALWAYS add type hints to public functions and class methods and verify with `mypy` or `pyright` in CI.
|
|
13
|
+
- NEVER catch bare `except:` — always catch specific exception classes and log the traceback.
|
|
14
|
+
- ALWAYS use context managers (`with` statements) for files, sockets, locks, and database connections.
|
|
15
|
+
- NEVER write SQL with string concatenation or f-strings — use parameterized queries or an ORM.
|
|
16
|
+
- ALWAYS pin dependencies in `requirements.txt` / `pyproject.toml` and audit with `pip-audit` or `safety`.
|
|
17
|
+
- NEVER commit virtual environments, `.env` files, or credentials to version control.
|
|
18
|
+
- ALWAYS validate external input with `pydantic`, `marshmallow`, or explicit type checks before use.
|
|
19
|
+
- NEVER mutate function default arguments — use `None` and assign inside the function body.
|
|
20
|
+
- ALWAYS use `logging` instead of `print` for anything other than CLI output, and configure levels per environment.
|
|
21
|
+
- NEVER use `os.system` — use `subprocess` with explicit argument lists.
|
|
22
|
+
- ALWAYS format code with `black` / `ruff format` and lint with `ruff` / `flake8` in CI.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Ruby on Rails Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for Ruby on Rails (Strong Params, ActiveRecord, security).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER skip Strong Parameters in controllers — always whitelist with `params.require(...).permit(...)`.
|
|
9
|
+
- NEVER use `find_by_sql`, `where("..#{...}")`, or raw interpolation with user input — use parameterized ActiveRecord queries.
|
|
10
|
+
- ALWAYS use `find_by!` (or `find`) instead of `find_by` when the record is required, so missing records raise 404 cleanly.
|
|
11
|
+
- NEVER store secrets in `config/database.yml` or source files — use Rails encrypted credentials or environment variables.
|
|
12
|
+
- ALWAYS run destructive or multi-step migrations inside transactions and provide a `down` method.
|
|
13
|
+
- NEVER bypass CSRF protection except in `ActionController::API` controllers — keep `protect_from_forgery` on for HTML forms.
|
|
14
|
+
- ALWAYS validate models with appropriate validators (`presence`, `uniqueness`, `length`, `format`) at the model layer, not just the form.
|
|
15
|
+
- NEVER use `eval`, `instance_eval`, or `send` with user-supplied strings — they open arbitrary code execution.
|
|
16
|
+
- ALWAYS prefer safe navigation (`&.`) over `try` — it is faster and fails loudly on typos.
|
|
17
|
+
- NEVER ship code without tests for critical paths (auth, payments, data mutation) — enforce coverage in CI.
|
|
18
|
+
- NEVER use `Marshal.load`, `YAML.load` (without `safe_load`), or `Oj.load` on untrusted data — use safe loaders.
|
|
19
|
+
- ALWAYS set `force_ssl = true` in production and configure secure, HTTP-only cookies.
|
|
20
|
+
- NEVER log request parameters containing passwords, tokens, or credit card data — add them to `filter_parameters`.
|
|
21
|
+
- ALWAYS authorize actions with Pundit/CanCanCan — never rely on "hidden" routes for access control.
|
|
22
|
+
- NEVER use `update_all` or `delete_all` without an explicit scope — they bypass callbacks and validations.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# React Rule Pack
|
|
2
|
+
|
|
3
|
+
Curated SpecLock constraints for generic React projects (hooks, state, components).
|
|
4
|
+
These rules are enforced by SpecLock — do not remove without a migration plan.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
|
|
8
|
+
- NEVER mutate state directly — always use the setter returned by `useState` or reducers from `useReducer`.
|
|
9
|
+
- NEVER call hooks conditionally or inside loops — hooks must run in the same order on every render.
|
|
10
|
+
- ALWAYS include every reactive dependency in `useEffect`, `useMemo`, and `useCallback` dependency arrays.
|
|
11
|
+
- NEVER use array indexes as `key` props for dynamic lists — use a stable unique id.
|
|
12
|
+
- ALWAYS wrap expensive computations in `useMemo` and stable callbacks in `useCallback` only when profiling proves the need.
|
|
13
|
+
- NEVER fetch data inside render — use `useEffect`, a data-fetching library (React Query, SWR), or a framework loader.
|
|
14
|
+
- ALWAYS handle loading, error, and empty states explicitly in every async UI path.
|
|
15
|
+
- NEVER leak event listeners, timers, or subscriptions — always return a cleanup function from `useEffect`.
|
|
16
|
+
- ALWAYS prefer composition over inheritance — use hooks and component composition instead of class hierarchies.
|
|
17
|
+
- NEVER use `dangerouslySetInnerHTML` without sanitizing input first with DOMPurify or equivalent.
|
|
18
|
+
- ALWAYS type props and state with TypeScript (or `prop-types` for JS projects) and enable `strict` mode.
|
|
19
|
+
- NEVER store derived state in `useState` — compute it during render so it stays in sync.
|
|
20
|
+
- ALWAYS lift state to the lowest common ancestor that needs it — avoid global state for local concerns.
|
|
21
|
+
- NEVER ship `console.log` or `debugger` statements to production builds.
|
|
22
|
+
- ALWAYS wrap route-level components in error boundaries so one crash does not blank the whole app.
|