Files
Lucas Rayan eb09fa0ced #1: implement F0 foundation - monorepo, migrations, Go domain layer, service skeletons, CI
Stands up the LambdaMail monorepo per PLAN.md's F0 milestone: local dev
scaffolding (.env.example, Makefile, .gitignore excluding PLAN.md/docs/
.superpowers/), the full initial Postgres schema as a golang-migrate
migration, the complete Go domain layer for services/protocols (value
objects, entities, domain events - zero external imports beyond
github.com/google/uuid) with unit tests, health-checked service skeletons
for auth/storage (TypeScript) and webmail (Next.js), a local
docker-compose.yaml wiring all services together, a language-enforcement
lint script, and a GitHub Actions CI workflow.

Built via 11 sequential tasks under subagent-driven development, each with
an independent implementer + reviewer cycle. Fixes applied during review:
DomainName.IsPunycode() added to satisfy the promised interface; ioredis
default-import typing under NodeNext; next.js bumped 15.0.3->15.5.21 to
resolve high/critical CVEs; lang-lint.mjs corrected to not flag its own
banned-terms list; web service healthcheck added so compose --wait
actually waits on it; webmail Dockerfile's missing public/ directory:
protocols go.mod version aligned with CI's Go 1.22 pin.

Known follow-ups for later phases (not blocking F0): go-arch-lint isn't
wired into CI yet; live docker compose up and migration apply have not
been exercised in this dev environment (no Docker/psql available here)
and will get their first real run in CI, which does have Docker.
2026-07-23 05:05:46 -03:00

53 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
// Fails the build if tracked source contains non-ASCII characters or common
// Portuguese terms in identifiers/comments (PLAN.md section 21.1: "all code in
// English, no exceptions - enforced by CI, not by human review").
import { execSync } from "node:child_process";
import { readFileSync } from "node:fs";
const BANNED_TERMS = [
"usuario", "senha", "endereco", "mensagem", "dominio", "caixa",
"remetente", "destinatario", "cadastro", "autenticacao",
];
const SCANNED_PREFIXES = ["services/", "migrations/", "scripts/"];
const SCANNED_EXTENSIONS = [".go", ".ts", ".tsx", ".sql", ".mjs", ".js"];
function trackedFiles() {
return execSync("git ls-files", { encoding: "utf8" })
.split("\n")
.filter(Boolean)
.filter((f) => SCANNED_PREFIXES.some((p) => f.startsWith(p)))
.filter((f) => SCANNED_EXTENSIONS.some((ext) => f.endsWith(ext))); // tests are scanned too - same rule applies
}
let failures = [];
for (const file of trackedFiles()) {
const isSelf = file === "scripts/lang-lint.mjs";
const content = readFileSync(file, "utf8");
const lines = content.split("\n");
lines.forEach((line, i) => {
if (/[^\x00-\x7F]/.test(line)) {
failures.push(`${file}:${i + 1}: non-ASCII character`);
}
if (!isSelf) {
const lower = line.toLowerCase();
for (const term of BANNED_TERMS) {
if (lower.includes(term)) {
failures.push(`${file}:${i + 1}: banned Portuguese term "${term}"`);
}
}
}
});
}
if (failures.length > 0) {
console.error(`lang-lint: ${failures.length} violation(s) found:\n`);
for (const f of failures.slice(0, 50)) console.error(` ${f}`);
if (failures.length > 50) console.error(` ... and ${failures.length - 50} more`);
process.exit(1);
}
console.log("lang-lint: clean");