Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c3bcd75
fix(cli,nestjs): honor ignoreFindings in visualize and share the conf…
Kidkender Nov 10, 2026
8a90e63
feat(springboot-parser): read archmind.json guards for project annota…
Kidkender Nov 10, 2026
27a0dde
fix(laravel-parser,springboot-parser): report parse failures and pars…
Kidkender Nov 10, 2026
75449ec
feat(go-parser): detect tenant isolation for Gin + GORM
Kidkender Nov 10, 2026
56e574f
fix(build): build workspaces in dependency order so a clean checkout …
Kidkender Nov 10, 2026
85d12b2
feat(express-parser): add package skeleton for an Express.js parser
Kidkender Nov 11, 2026
6114a8e
feat(express-parser): extract routes, mounts and middleware chains
Kidkender Nov 11, 2026
6a16f28
feat(express-parser): classify middleware into auth, authorization an…
Kidkender Nov 11, 2026
2d36c79
feat(express-parser): service calls, transactions and ownership from …
Kidkender Nov 11, 2026
7ff5e6a
feat: wire the Express parser into analysis, the CLI and the MCP server
Kidkender Nov 11, 2026
29044d8
test(express-parser): cross-framework conformance; writes inside tran…
Kidkender Nov 11, 2026
7308237
feat(express-parser): measure on unseen projects, sharpen classificat…
Kidkender Nov 11, 2026
78e2026
fix: trace script path, flaky tree-sitter test workers, silent graph-…
Kidkender Nov 11, 2026
ac67aed
test(laravel-parser): a graph pass that throws inside a service is re…
Kidkender Nov 11, 2026
16bc3d5
fix(nestjs-parser): link transaction writes with ir:wraps, not "withi…
Kidkender Nov 11, 2026
b309337
fix(explainer): only a Laravel FormRequest counts as an authorization…
Kidkender Nov 11, 2026
16227d0
docs: changelog for the fix/minor-issues fixes
Kidkender Nov 12, 2026
671c629
test: one Jest process per test file where tests load tree-sitter par…
Kidkender Nov 12, 2026
de35447
perf(laravel-parser): parse each file once per run and stop walking w…
Kidkender Nov 12, 2026
1af2ba9
fix(cli): detect a Gin project whose go.mod is one directory down
Kidkender Nov 12, 2026
ff7a102
fix(laravel-parser): compare tree-sitter nodes by position, not identity
Kidkender Nov 12, 2026
c7bb79b
feat(go-parser): follow tenant isolation through registries, DAOs and…
Kidkender Nov 13, 2026
da8515c
fix(go-parser): join group prefixes and route paths the way Gin does
Kidkender Nov 13, 2026
d7ef077
Merge #12 (fix/build) into release/v0.10.0
Kidkender Nov 13, 2026
230dba1
Merge #13 (fix/minor-issues) into release/v0.10.0
Kidkender Nov 13, 2026
430fe31
Merge #14 (feat/springboot-user-config) into release/v0.10.0
Kidkender Nov 13, 2026
9ba12ca
Merge #15 (feat/go-tenant-isolation) into release/v0.10.0
Kidkender Nov 13, 2026
3a2a452
Merge #16 (feat/express-parser) into release/v0.10.0
Kidkender Nov 13, 2026
78fd79e
Merge #17 (fix/cli-go-subdir) into release/v0.10.0
Kidkender Nov 13, 2026
c68f0c9
Merge #18 (fix/go-route-path-join) into release/v0.10.0
Kidkender Nov 13, 2026
c4c14bf
chore: release v0.10.0
Kidkender Nov 13, 2026
38b8350
fix(lsp): declare analysis as a runtime dependency
Kidkender Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## [0.10.0] - 2026-11-13

### Added
- **`@kidkender/archmind-go-parser` 0.4.0: tenant isolation for Gin + GORM.** On a route that resolves a tenant (a tenant middleware, `c.Get("tenant_id")`, an accessor such as `GetTenantID(c)`, a tenant-named function handed the context such as `TenantScope(c)`, or a field such as `claims.TenantID`), an `ir:tenant_context` node and every query in the handler and two calls below it as `ir:scoped_query` or `ir:unscoped_query` / `ir:unscoped_write`; the explainer reports unscoped ones as `missing_tenant_scope`. Calls are followed through struct fields, typed locals, package-level registries and embedded structs; DAO / repository / model wrappers count as queries, judged at the call site when they take their conditions as arguments; GORM callbacks that set the tenant, shared tables without a tenant field and `Preload("Tenant")` are taken into account. Routes that resolve no tenant get none of these nodes. `archmind.json` `isolation.tenantSignals` / `isolation.tenantContextKeys` (`protocol` 0.6.0).
- **`@kidkender/archmind-springboot-parser` 0.5.0: `archmind.json` `guards`.** Annotation names under `guards.auth_gate` emit `ir:auth_gate`, under `guards.authz_check` `ir:auth_gate` → `ir:authz_check`, ahead of the built-in rules (a listed Shiro `@RequiresRoles` is no longer `ir:unknown_middleware`).
- **`@kidkender/archmind-express-parser` 0.1.0 (new package): Express.js, JavaScript and TypeScript.** One graph per route: routers mounted across files (`require` / `module.exports`, ES modules, `router.route()` chains, routers mounted from arrays in a `forEach`, registrar functions handed the app); the middleware chain in Express order, classified by npm package, name and — for project middleware — body into `ir:auth_gate`, `ir:authz_check` and `ir:validation_gate` (rate limiting, optional auth and CSRF as `ir:unknown_middleware` with that role; body parsers, logging, CORS left out); the handler through controller modules, class methods and wrappers; service calls, including class controllers with constructor-injected services; transactions (Sequelize, TypeORM, Prisma, Mongoose, Knex) in the handler or one call below, with the writes inside them as `ir:txn_write`; ownership checks from `archmind.json`.
- `analysis`, the CLI and the MCP server detect an Express project (`package.json` depends on `express`, not NestJS; at the root or one directory down when the root is not another backend) after every other framework. The MCP server caches Express graphs and re-parses when a JS/TS file changes; `archmind_get_dependents` indexes Express service calls (`userService` / `userService::createUser`).
- `research/cross-framework`: Express versions of auth-only, auth-authz, auth-validation, auth-service-call and auth-transaction; Express matches NestJS and Laravel on each.
- `research/express-corpus`: the projects, commits, scripts and results the parser was measured with.

### Changed
- `analysis`: a route counts as throttled when a node has role `rate_limiting` (Express rate limiters, Laravel `throttle:`), not only when an auth node is named so; without it every rate-limited login route reported `no_rate_limiting`.
- `@kidkender/archmind-laravel-parser`: each file is parsed once per run and method lookups no longer walk whole trees. On invoiceninja the CLI ran for over 10 minutes and ran out of memory once files over 32 KiB were parsed; it now takes 22 s.

### Measured, with limits
- On six projects read while building it: 163 of 163 route registration sites (regex count). On six it had not seen: 101 of 101 real registrations (the regex also counted three HTTP client calls), every route that opens a transaction in a production Sequelize app (sfbrigade/bats-server), and 9 of 15 security middleware classified correctly blind, 15 of 15 after fixes made on that same set.
- Decorator-based routing (routing-controllers, tsoa) is not read: such a project yields no routes. Not extracted: tenant isolation, side effects, response shaping. Not yet through the LLM accuracy benchmark.

### Fixed
- **`@kidkender/archmind-explainer`: input validation outside Laravel is no longer counted as an authorization layer.** `over_authorized_route` counted every `ir:validation_gate` as a third authorization layer ("FormRequest::authorize") and `delegated_validation` reported validators as delegating authorization. Both describe Laravel's `FormRequest::authorize()`; a NestJS `ValidationPipe`, Spring `@Valid`, Gin binding or Express celebrate / express-validator only checks the input, so ordinary authenticated, role-checked, validated routes on those frameworks got these findings. The FormRequest meaning now applies when the graph's framework is `laravel` or unset. Outside Laravel a route has at most two authorization layers, so `over_authorized_route` does not fire there.
- `@kidkender/archmind-nestjs-parser`: writes inside a transaction were linked to it by `within_transaction`, which is not an IR relation, so `validateGraph` reported it as unknown. They are now linked by `ir:wraps`, as in Laravel graphs. New conformance suite on a transaction fixture.
- `@kidkender/archmind-laravel-parser`: the transaction, isolation, audit-log and nested service-call passes inside a service method, and a queued job's `handle()`, swallowed any error silently. The parsers already turn unreadable files into empty results, so what reached these catches was a bug that read as "nothing found". It is now reported on stderr (`[archmind] laravel-parser: <pass> skipped for <file>: <error>`) and the pass is skipped as before.
- Flaky tests in `retrieval`, `nestjs-parser` and `mcp-server`: their tests load the tree-sitter parsers, whose module-level parser fails intermittently when Jest reuses one worker process across test files. Each test file now gets its own process (`maxWorkers`), as `laravel-parser` already did. Measured: `retrieval` with every file in one process failed 5 of 5 runs; with the fix it passed 10 of 10, as did `nestjs-parser`.
- `npm run trace` at the repository root pointed at `apps/cli/dist/index.js`; the CLI builds to `index.cjs`.
- **`laravel-parser` and `springboot-parser`: controllers and services over 32 KiB produced no auth, transaction, isolation or guard nodes.** tree-sitter 0.21 rejects input past its default buffer and only route parsing sized it; every read and parse now sizes the buffer to the source. A parse failure is printed on stderr with the file path instead of reading as an empty file.
- `laravel-parser`: output could differ between identical runs (koel 1943 / 1946 / 1943 nodes) because tree-sitter nodes were compared by object identity; they are compared by position now.
- `@kidkender/archmind-go-parser`: route paths were the plain concatenation of the group prefixes, so `Group("api").Group("v1").POST("device")` came out as `apiv1device`. Paths are joined the way Gin joins them (233 of 267 routes on one project were malformed, now none).
- The CLI did not detect a Gin project whose `go.mod` is one directory down (analysis and the MCP server already did).
- `archmind visualize` ignored `archmind.json` `ignoreFindings`.
- A clean checkout did not build: `npm run build` built the workspaces in alphabetical order, before the packages they depend on. It builds them in dependency order now, and CI passes on a fresh clone.

### Release notes
- Versions: CLI 0.10.0, `express-parser` 0.1.0 (new), `go-parser` 0.4.0, `springboot-parser` 0.5.0, `protocol` 0.6.0, `analysis` 0.3.0, `mcp-server` 0.8.0, `explainer` 0.3.4, `laravel-parser` 0.5.3, `nestjs-parser` 0.7.2, `lsp` 0.1.4, `lens` 0.2.1 (needs `go-parser` ^0.4.0). Packages that depended on `protocol` ^0.5 now need ^0.6.0.
- `lsp` 0.1.4 loads `analysis` from its own install instead of bundling it (`analysis` pulls in `go-parser`'s native tree-sitter-go, which cannot be bundled), so `analysis` ^0.3.0 is now a dependency of `lsp`.
- Publish order: `protocol`, `laravel-parser`, `springboot-parser`, `nestjs-parser`, `go-parser`, `express-parser`, `explainer`, `lens`, `analysis`, `lsp`, `mcp-server`, CLI.

## [0.9.1] - 2026-10-28

### Added
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ArchMind

**Semantic execution graph engine for Laravel, NestJS, Spring Boot, and Go/Gin — built for AI assistants and CI.**
**Semantic execution graph engine for Laravel, NestJS, Spring Boot, Go/Gin and Express — built for AI assistants and CI.**

ArchMind parses your app into a structured execution graph and gives AI assistants (Claude, Cursor, Copilot) the minimal relevant subgraph for a query — achieving comparable or better answer quality at a fraction of the tokens that naive file-dump RAG uses.

Expand Down Expand Up @@ -29,6 +29,8 @@ The difference compounds on large codebases where a single route touches dozens

**Go/Gin support is newer and not yet held to the same bar.** The numbers above are Laravel/NestJS/Spring Boot only, from hand-verified ground truth compared against real LLM calls. Go/Gin has been validated structurally — full-project parsing against 3 real Gin+GORM codebases with zero crashes and spot-checked node accuracy — but not yet run through the same hand-verified accuracy benchmark. Treat it as functional but less battle-tested until that benchmark exists.

**Express support is the newest, measured structurally only.** On six projects it had not seen it found every real route (101 of 101) and every transaction-opening route of a production app, and classified 9 of 15 security middleware correctly before fixes made on that same set (15 of 15 after) — see [`research/express-corpus`](research/express-corpus/README.md). It has not been through the LLM accuracy benchmark either.

---

## MCP Server (Claude Code / AI assistants)
Expand Down Expand Up @@ -226,12 +228,21 @@ DELETE /api/vaults/{id}

A handler that calls one of them (directly, or one hop into a helper method on the same receiver) is treated as authorized by ownership. A handler that acts on a URL `:id` without resolving the caller is still reported — that is the case worth looking at. `ignoreFindings` drops whole finding types (e.g. `["missing_authorization"]`) for a project where the rule does not apply at all.

### Express

- JavaScript and TypeScript; routers mounted across files through `require` / `module.exports` and ES modules, `router.route()` chains, routers mounted from arrays, registrar functions handed the app
- Middleware chain in Express order (global, path-scoped, per-router, per-route, arrays), classified by package, name and — for project middleware — body: passport / express-jwt / custom JWT checks as auth gates, role checks as authorization, celebrate / express-validator / Joi wrappers as validation, rate limiters, CSRF, optional auth; body parsers, logging, CORS and the like left out
- Handlers resolved through controller modules, class methods and wrappers (`catchAsync`); service calls, including class controllers with constructor-injected services
- Transactions (Sequelize, TypeORM, Prisma, Mongoose, Knex) in the handler or one call below, with the writes inside them
- Ownership authorization (as above) and `guards` from `archmind.json`
- Not read: decorator-based routing (routing-controllers, tsoa); tenant isolation and side effects are not extracted. Details: [`packages/express-parser`](packages/express-parser/README.md)

---

## Requirements

- Node.js ≥ 18
- A Laravel (≥8, tested on 10/11/12), NestJS, Spring Boot (Maven or Gradle), or Go/Gin project
- A Laravel (≥8, tested on 10/11/12), NestJS, Spring Boot (Maven or Gradle), Go/Gin, or Express project

## License

Expand Down
1 change: 1 addition & 0 deletions apps/cli/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ await build({
"@kidkender/archmind-laravel-parser",
"@kidkender/archmind-nestjs-parser",
"@kidkender/archmind-go-parser",
"@kidkender/archmind-express-parser",
"@kidkender/archmind-llm-client",
"@kidkender/archmind-orchestrator",
"@kidkender/archmind-protocol",
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kidkender/archmind",
"version": "0.9.1",
"version": "0.10.0",
"description": "Execution topology intelligence for Laravel, NestJS, and Go/Gin — trace routes, detect regressions, find security gaps. No LLM required.",
"type": "module",
"bin": {
Expand All @@ -19,6 +19,7 @@
"@kidkender/archmind-llm-client": "*",
"@kidkender/archmind-nestjs-parser": "*",
"@kidkender/archmind-go-parser": "*",
"@kidkender/archmind-express-parser": "*",
"@kidkender/archmind-orchestrator": "*",
"@kidkender/archmind-protocol": "*",
"@kidkender/archmind-retrieval": "*",
Expand Down
13 changes: 8 additions & 5 deletions apps/cli/src/commands/visualize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import { writeFileSync } from "fs"
import { join, resolve } from "path"
import { execSync } from "child_process"
import type { IntermediateExecutionGraph, ExecutionNode } from "@kidkender/archmind-protocol"
import { IR_NODE_TYPES, toIRNodeType } from "@kidkender/archmind-protocol"
import { IR_NODE_TYPES, toIRNodeType, loadUserConfig } from "@kidkender/archmind-protocol"
import { parseProject, requireProject } from "../utils/parse-project.js"

// ---------------------------------------------------------------------------
// Lazy import explainer (optional dep — visualize still works without findings)
// ---------------------------------------------------------------------------

function tryExplain(graph: IntermediateExecutionGraph): Finding[] {
function tryExplain(graph: IntermediateExecutionGraph, ignore?: string[]): Finding[] {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { explain } = require("@kidkender/archmind-explainer") as { explain: (g: IntermediateExecutionGraph) => Finding[] }
return explain(graph)
const { explain } = require("@kidkender/archmind-explainer") as {
explain: (g: IntermediateExecutionGraph, query?: string, opts?: { ignore?: string[] }) => Finding[]
}
return explain(graph, undefined, { ignore })
} catch {
return []
}
Expand Down Expand Up @@ -510,11 +512,12 @@ export async function runVisualize(flags: Record<string, string>): Promise<void>
const { graphs, routeCount } = parseProject(projectRoot)
console.log(`Parsed ${routeCount} routes`)

const ignore = loadUserConfig(projectRoot)?.ignoreFindings
const routes: RouteData[] = []
let criticalTotal = 0

for (const graph of graphs) {
const findings = tryExplain(graph)
const findings = tryExplain(graph, ignore)
const route = buildRouteData(graph, findings)
routes.push(route)
criticalTotal += route.criticalCount
Expand Down
16 changes: 13 additions & 3 deletions apps/cli/src/utils/parse-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import {
} from "@kidkender/archmind-laravel-parser"
import { parseNestJSProject } from "@kidkender/archmind-nestjs-parser"
import { parseGinProjectAt, isGinProject, findGoFiles } from "@kidkender/archmind-go-parser"
import { parseExpressProjectAt, isExpressProject, findExpressRoot, findSourceFiles } from "@kidkender/archmind-express-parser"
import type { IntermediateExecutionGraph } from "@kidkender/archmind-protocol"

export type Framework = "laravel" | "nestjs" | "springboot" | "go" | "unknown"
export type Framework = "laravel" | "nestjs" | "springboot" | "go" | "express" | "unknown"

function tryParseSpringBoot(root: string): { graphs: IntermediateExecutionGraph[]; fileCount: number } | null {
try {
Expand Down Expand Up @@ -96,13 +97,16 @@ export function detectFramework(projectRoot: string): Framework {

// go.mod is a strong, cheap-to-check signal unique to Go — checked before
// the fallback heuristics below so a Gin project never falls through to
// the Laravel default.
if (existsSync(join(projectRoot, "go.mod")) && isGinProject(projectRoot)) return "go"
// the Laravel default. isGinProject also finds a go.mod one directory down
// (api/, server/), as analysis and the MCP server do.
if (isGinProject(projectRoot)) return "go"

// Fallback heuristics
if (existsSync(join(projectRoot, "artisan"))) return "laravel"
if (existsSync(join(projectRoot, "nest-cli.json"))) return "nestjs"
if (existsSync(join(projectRoot, "pom.xml")) || existsSync(join(projectRoot, "build.gradle"))) return "springboot"
// last: express is a dependency of many Node projects, so every other signal wins
if (isExpressProject(projectRoot)) return "express"

return "unknown"
}
Expand All @@ -126,6 +130,12 @@ export function parseProject(projectRoot: string): ParsedProject {
return { graphs, routeCount: graphs.length, fileCount: findGoFiles(projectRoot).length, projectRoot, framework }
}

if (framework === "express") {
const graphs = parseExpressProjectAt(projectRoot)
const appRoot = findExpressRoot(projectRoot) ?? projectRoot
return { graphs, routeCount: graphs.length, fileCount: findSourceFiles(appRoot).length, projectRoot, framework }
}

// Default: Laravel
const config = loadProjectConfig(projectRoot)
const { aliasMap, routeFiles, routeWrapping, routeNamespaceWrapping, routePrefixWrapping } = resolveAliasMap(projectRoot, config)
Expand Down
Loading
Loading