agent-enderun 1.10.4 → 1.11.0
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 +34 -45
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js +1 -1
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js.map +1 -1
- package/dist/src/cli/adapters/core.d.ts +1 -1
- package/dist/src/cli/adapters/core.js +0 -1
- package/dist/src/cli/adapters/core.js.map +1 -1
- package/dist/src/cli/adapters/index.d.ts +1 -0
- package/dist/src/cli/adapters/index.js +1 -0
- package/dist/src/cli/adapters/index.js.map +1 -1
- package/dist/src/cli/adapters/scaffold.d.ts +1 -1
- package/dist/src/cli/adapters/scaffold.js +8 -6
- package/dist/src/cli/adapters/scaffold.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-core.d.ts +5 -2
- package/dist/src/cli/commands/init/scaffold-core.js +28 -6
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init.js +31 -4
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +6 -6
- package/dist/src/cli/commands/plan.d.ts +3 -1
- package/dist/src/cli/commands/plan.js +79 -22
- package/dist/src/cli/commands/plan.js.map +1 -1
- package/dist/src/cli/index.js +11 -15
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/utils/compliance.js +0 -1
- package/dist/src/cli/utils/compliance.js.map +1 -1
- package/dist/src/cli/utils/config-schema.d.ts +7 -7
- package/dist/src/cli/utils/pkg.d.ts +19 -0
- package/dist/src/cli/utils/pkg.js +29 -5
- package/dist/src/cli/utils/pkg.js.map +1 -1
- package/dist/src/modules/agents/registry/analyst.js +1 -1
- package/dist/src/modules/agents/registry/analyst.js.map +1 -1
- package/dist/src/modules/agents/registry/backend.js +5 -4
- package/dist/src/modules/agents/registry/backend.js.map +1 -1
- package/dist/src/modules/agents/registry/database.js +2 -1
- package/dist/src/modules/agents/registry/database.js.map +1 -1
- package/dist/src/modules/agents/registry/git.js +1 -1
- package/dist/src/modules/agents/registry/git.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +3 -2
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/agents/registry/native.js +1 -1
- package/dist/src/modules/agents/registry/native.js.map +1 -1
- package/dist/src/modules/agents/registry/security.js +1 -0
- package/dist/src/modules/agents/registry/security.js.map +1 -1
- package/dist/tests/approve.test.js +4 -9
- package/dist/tests/approve.test.js.map +1 -1
- package/framework-mcp/dist/constants.js +64 -0
- package/framework-mcp/dist/index.js +109 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +64 -0
- package/framework-mcp/dist/tools/control_plane/registry.js +34 -0
- package/framework-mcp/dist/tools/dashboard/start_dashboard.js +29 -0
- package/framework-mcp/dist/tools/definitions.js +300 -0
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +59 -0
- package/framework-mcp/dist/tools/file_system/patch_file.js +25 -0
- package/framework-mcp/dist/tools/file_system/read_file.js +51 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +43 -0
- package/framework-mcp/dist/tools/file_system/write_file.js +38 -0
- package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/tools/index.js +62 -0
- package/framework-mcp/dist/tools/memory/get_insights.js +34 -0
- package/framework-mcp/dist/tools/memory/read_memory.js +28 -0
- package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
- package/framework-mcp/dist/tools/messaging/send_message.js +87 -0
- package/framework-mcp/dist/tools/observability/check_ports.js +26 -0
- package/framework-mcp/dist/tools/observability/get_health.js +19 -0
- package/framework-mcp/dist/tools/quality/check_lint.js +28 -0
- package/framework-mcp/dist/tools/search/get_gaps.js +48 -0
- package/framework-mcp/dist/tools/search/get_map.js +43 -0
- package/framework-mcp/dist/tools/search/grep_search.js +76 -0
- package/framework-mcp/dist/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/tools/shell/run_command.js +46 -0
- package/framework-mcp/dist/tools/types.js +1 -0
- package/framework-mcp/dist/utils/cli.js +20 -0
- package/framework-mcp/dist/utils/compliance.js +29 -0
- package/framework-mcp/dist/utils/fs.js +44 -0
- package/framework-mcp/dist/utils/metrics.js +56 -0
- package/framework-mcp/dist/utils/security.js +60 -0
- package/framework-mcp/package.json +19 -0
- package/framework-mcp/src/constants.ts +78 -0
- package/framework-mcp/src/declarations.d.ts +17 -0
- package/framework-mcp/src/index.ts +132 -0
- package/framework-mcp/src/tools/control_plane/locking.ts +71 -0
- package/framework-mcp/src/tools/control_plane/registry.ts +38 -0
- package/framework-mcp/src/tools/dashboard/start_dashboard.ts +33 -0
- package/framework-mcp/src/tools/definitions.ts +302 -0
- package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +79 -0
- package/framework-mcp/src/tools/file_system/patch_file.ts +33 -0
- package/framework-mcp/src/tools/file_system/read_file.ts +58 -0
- package/framework-mcp/src/tools/file_system/replace_text.ts +52 -0
- package/framework-mcp/src/tools/file_system/write_file.ts +45 -0
- package/framework-mcp/src/tools/framework/audit_deps.ts +49 -0
- package/framework-mcp/src/tools/framework/get_status.ts +7 -0
- package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
- package/framework-mcp/src/tools/framework/run_tests.ts +28 -0
- package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
- package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
- package/framework-mcp/src/tools/index.ts +66 -0
- package/framework-mcp/src/tools/memory/get_insights.ts +41 -0
- package/framework-mcp/src/tools/memory/read_memory.ts +31 -0
- package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
- package/framework-mcp/src/tools/messaging/send_message.ts +89 -0
- package/framework-mcp/src/tools/observability/check_ports.ts +30 -0
- package/framework-mcp/src/tools/observability/get_health.ts +24 -0
- package/framework-mcp/src/tools/quality/check_lint.ts +33 -0
- package/framework-mcp/src/tools/search/get_gaps.ts +54 -0
- package/framework-mcp/src/tools/search/get_map.ts +48 -0
- package/framework-mcp/src/tools/search/grep_search.ts +76 -0
- package/framework-mcp/src/tools/search/list_dir.ts +34 -0
- package/framework-mcp/src/tools/shell/run_command.ts +56 -0
- package/framework-mcp/src/tools/types.ts +89 -0
- package/framework-mcp/src/utils/cli.ts +20 -0
- package/framework-mcp/src/utils/compliance.ts +37 -0
- package/framework-mcp/src/utils/fs.ts +45 -0
- package/framework-mcp/src/utils/metrics.ts +73 -0
- package/framework-mcp/src/utils/security.ts +66 -0
- package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +212 -0
- package/framework-mcp/tests/tools/messaging/send_message.test.ts +136 -0
- package/framework-mcp/tests/tools/quality/check_lint.test.ts +46 -0
- package/framework-mcp/tests/tools/shell/run_command.test.ts +55 -0
- package/framework-mcp/tsconfig.json +14 -0
- package/package.json +5 -3
- package/src/cli/adapters/core.ts +2 -3
- package/src/cli/adapters/index.ts +1 -0
- package/src/cli/adapters/scaffold.ts +15 -6
- package/src/cli/commands/init/scaffold-core.ts +45 -6
- package/src/cli/commands/init.ts +31 -2
- package/src/cli/commands/plan.ts +89 -23
- package/src/cli/index.ts +14 -19
- package/src/cli/utils/compliance.ts +8 -9
- package/src/cli/utils/pkg.ts +42 -13
- package/src/modules/agents/registry/analyst.ts +1 -1
- package/src/modules/agents/registry/backend.ts +5 -4
- package/src/modules/agents/registry/database.ts +2 -1
- package/src/modules/agents/registry/git.ts +1 -1
- package/src/modules/agents/registry/manager.ts +3 -2
- package/src/modules/agents/registry/native.ts +1 -1
- package/src/modules/agents/registry/security.ts +1 -0
- package/templates/prompts/bug-fix-recipe.md +20 -0
- package/templates/prompts/contract-design-recipe.md +21 -0
- package/templates/prompts/db-management-recipe.md +25 -0
- package/templates/prompts/deployment-recipe.md +23 -0
- package/templates/prompts/new-feature-recipe.md +19 -0
- package/templates/prompts/performance-optimization-recipe.md +23 -0
- package/templates/prompts/pull-request-template.md +21 -0
- package/templates/prompts/refactoring-recipe.md +21 -0
- package/templates/prompts/security-audit-recipe.md +20 -0
- package/templates/standards/architecture-standards.md +23 -0
- package/templates/standards/auth-standards.md +125 -0
- package/templates/standards/crud-governance.md +21 -0
- package/templates/standards/deployment-standards.md +21 -0
- package/templates/standards/frontend-standards.md +37 -0
- package/templates/standards/github-actions-standards.md +43 -0
- package/templates/standards/i18n-standards.md +17 -0
- package/templates/standards/kysely-standards.md +47 -0
- package/templates/standards/llm-governance.md +15 -0
- package/templates/standards/logging-and-secrets.md +34 -0
- package/templates/standards/mobile-standards.md +23 -0
- package/templates/standards/observability-standards.md +15 -0
- package/templates/standards/performance-standards.md +15 -0
- package/templates/standards/pino-standards.md +46 -0
- package/templates/standards/playwright-standards.md +54 -0
- package/templates/standards/quality-standards.md +31 -0
- package/templates/standards/react-query-standards.md +72 -0
- package/templates/standards/react-router-standards.md +62 -0
- package/templates/standards/security-audit-standards.md +16 -0
- package/templates/standards/security-standards.md +21 -0
- package/templates/standards/swagger-standards.md +50 -0
- package/templates/standards/tailwind-standards.md +20 -0
- package/templates/standards/testing-standards.md +31 -0
- package/templates/standards/typeorm-standards.md +49 -0
- package/templates/standards/vitest-standards.md +110 -0
- package/src/cli/commands/app.ts +0 -56
- package/src/cli/utils/app-backend.ts +0 -257
- package/src/cli/utils/app-docs.ts +0 -83
- package/src/cli/utils/app-frontend.ts +0 -263
- package/src/cli/utils/app-inferrer.ts +0 -63
- package/src/cli/utils/app-mobile.ts +0 -113
- package/src/cli/utils/app-types.ts +0 -248
- package/src/cli/utils/app.ts +0 -6
package/src/cli/utils/pkg.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
3
|
+
import { writeJsonFile, writeTextFile } from "./fs.js";
|
|
4
4
|
|
|
5
5
|
export function getPackageVersion() {
|
|
6
6
|
const root = getPackageRoot();
|
|
@@ -21,7 +21,7 @@ export function getPackageManager() {
|
|
|
21
21
|
// Check for lockfiles in target directory
|
|
22
22
|
if (fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml")) || fs.existsSync(path.join(process.cwd(), "pnpm-workspace.yaml"))) return "pnpm";
|
|
23
23
|
if (fs.existsSync(path.join(process.cwd(), "yarn.lock"))) return "yarn";
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
return "npm";
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -74,28 +74,57 @@ export function getDependencyVersions() {
|
|
|
74
74
|
const dependencies = pkg.dependencies || {};
|
|
75
75
|
|
|
76
76
|
return {
|
|
77
|
-
// Backend
|
|
77
|
+
// ── Backend Core ──────────────────────────────────────────
|
|
78
78
|
"fastify": dependencies["fastify"] || "^5.0.0",
|
|
79
79
|
"@fastify/cors": dependencies["@fastify/cors"] || "^11.0.0",
|
|
80
|
+
"@fastify/swagger": dependencies["@fastify/swagger"] || "^9.0.0",
|
|
81
|
+
"@fastify/swagger-ui": dependencies["@fastify/swagger-ui"] || "^5.0.0",
|
|
82
|
+
"@fastify/rate-limit": dependencies["@fastify/rate-limit"] || "^10.0.0",
|
|
83
|
+
"@fastify/static": dependencies["@fastify/static"] || "^8.0.0",
|
|
80
84
|
"zod": dependencies["zod"] || "^3.24.2",
|
|
81
85
|
|
|
86
|
+
// ── Database / ORM ────────────────────────────────────────
|
|
87
|
+
"kysely": dependencies["kysely"] || "^0.27.0",
|
|
88
|
+
"typeorm": dependencies["typeorm"] || "^0.3.0",
|
|
89
|
+
"reflect-metadata": dependencies["reflect-metadata"] || "^0.2.0",
|
|
90
|
+
"pg": dependencies["pg"] || "^8.13.0",
|
|
91
|
+
"better-sqlite3": dependencies["better-sqlite3"] || "^11.0.0",
|
|
92
|
+
|
|
93
|
+
// ── Authentication ────────────────────────────────────────
|
|
94
|
+
"bcrypt": dependencies["bcrypt"] || "^5.1.0",
|
|
95
|
+
"@types/bcrypt": devDependencies["@types/bcrypt"] || "^5.0.0",
|
|
96
|
+
"jsonwebtoken": dependencies["jsonwebtoken"] || "^9.0.0",
|
|
97
|
+
"@types/jsonwebtoken": devDependencies["@types/jsonwebtoken"] || "^9.0.0",
|
|
98
|
+
|
|
99
|
+
// ── Logging ───────────────────────────────────────────────
|
|
100
|
+
"pino": dependencies["pino"] || "^9.0.0",
|
|
101
|
+
"pino-pretty": devDependencies["pino-pretty"] || "^12.0.0",
|
|
102
|
+
|
|
103
|
+
// ── Validation ────────────────────────────────────────────
|
|
104
|
+
"@fastify/type-provider-typebox": dependencies["@fastify/type-provider-typebox"] || "^5.0.0",
|
|
105
|
+
|
|
82
106
|
// Backend devDependencies
|
|
83
107
|
"@types/node": devDependencies["@types/node"] || "^22.13.4",
|
|
84
108
|
"tsx": devDependencies["tsx"] || "^4.19.4",
|
|
85
109
|
"typescript": devDependencies["typescript"] || "^5.9.3",
|
|
86
|
-
"vitest-backend": devDependencies["vitest"] || "^3.0.5",
|
|
110
|
+
"vitest-backend": devDependencies["vitest"] || "^3.0.5",
|
|
87
111
|
|
|
88
|
-
// Frontend
|
|
112
|
+
// ── Frontend Core ─────────────────────────────────────────
|
|
89
113
|
"@vitejs/plugin-react": dependencies["@vitejs/plugin-react"] || "^5.0.0",
|
|
90
114
|
"vite": dependencies["vite"] || "^7.0.0",
|
|
91
115
|
"react": dependencies["react"] || "^19.0.0",
|
|
92
116
|
"react-dom": dependencies["react-dom"] || "^19.0.0",
|
|
93
117
|
"lucide-react": dependencies["lucide-react"] || "^0.468.0",
|
|
94
|
-
|
|
118
|
+
"react-router-dom": dependencies["react-router-dom"] || "^7.0.0",
|
|
119
|
+
"@tanstack/react-query": dependencies["@tanstack/react-query"] || "^5.0.0",
|
|
120
|
+
|
|
95
121
|
// Frontend devDependencies
|
|
96
122
|
"@types/react": devDependencies["@types/react"] || "^19.0.0",
|
|
97
123
|
"@types/react-dom": devDependencies["@types/react-dom"] || "^19.0.0",
|
|
98
|
-
"vitest-frontend": devDependencies["vitest"] || "^3.0.5",
|
|
124
|
+
"vitest-frontend": devDependencies["vitest"] || "^3.0.5",
|
|
125
|
+
|
|
126
|
+
// ── Testing ───────────────────────────────────────────────
|
|
127
|
+
"@playwright/test": devDependencies["@playwright/test"] || "^1.50.0",
|
|
99
128
|
};
|
|
100
129
|
}
|
|
101
130
|
|
|
@@ -113,7 +142,7 @@ interface PackageJson {
|
|
|
113
142
|
}
|
|
114
143
|
|
|
115
144
|
export function mergePackageJson(targetPath: string, sourcePath: string): void {
|
|
116
|
-
let targetPkg: PackageJson = {};
|
|
145
|
+
let targetPkg: PackageJson = {};
|
|
117
146
|
if (fs.existsSync(targetPath)) {
|
|
118
147
|
try {
|
|
119
148
|
targetPkg = JSON.parse(fs.readFileSync(targetPath, "utf8"));
|
|
@@ -123,7 +152,7 @@ export function mergePackageJson(targetPath: string, sourcePath: string): void {
|
|
|
123
152
|
}
|
|
124
153
|
|
|
125
154
|
const sourcePkg: PackageJson = JSON.parse(fs.readFileSync(sourcePath, "utf8"));
|
|
126
|
-
|
|
155
|
+
|
|
127
156
|
type PackageMap = Record<string, string>;
|
|
128
157
|
const sanitizeDeps = (deps: PackageMap | Record<string, unknown> | undefined): Record<string, string> | undefined => {
|
|
129
158
|
if (!deps) return deps as undefined;
|
|
@@ -159,7 +188,7 @@ export function mergePackageJson(targetPath: string, sourcePath: string): void {
|
|
|
159
188
|
// Merge scripts
|
|
160
189
|
const pkgMgr = getPackageManager();
|
|
161
190
|
const runCmd = pkgMgr === "yarn" ? "yarn" : (pkgMgr === "pnpm" ? "pnpm" : "npm run");
|
|
162
|
-
|
|
191
|
+
|
|
163
192
|
targetPkg.scripts = {
|
|
164
193
|
...targetPkg.scripts,
|
|
165
194
|
"enderun:status": "agent-enderun status",
|
|
@@ -242,12 +271,12 @@ export function sanitizeJson(obj: unknown, targetScope = ""): unknown {
|
|
|
242
271
|
if (typeof value === "string" && value.startsWith("agent-enderun-")) {
|
|
243
272
|
finalValue = value.replace("agent-enderun-", `${scopeName}-`);
|
|
244
273
|
}
|
|
245
|
-
|
|
274
|
+
|
|
246
275
|
// Handle agent-enderun -> target (ONLY for the package name)
|
|
247
276
|
if (key === "name" && value === "agent-enderun") {
|
|
248
277
|
finalValue = scopeName;
|
|
249
278
|
}
|
|
250
|
-
|
|
279
|
+
|
|
251
280
|
// Preserve agent-enderun in dependencies and bin
|
|
252
281
|
// (No action needed as finalKey/finalValue default to original)
|
|
253
282
|
|
|
@@ -265,7 +294,7 @@ export function sanitizeJson(obj: unknown, targetScope = ""): unknown {
|
|
|
265
294
|
|
|
266
295
|
export function deepCleanProtocols(dir: string, targetScope = ""): void {
|
|
267
296
|
if (!fs.existsSync(dir)) return;
|
|
268
|
-
|
|
297
|
+
|
|
269
298
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
270
299
|
for (const entry of entries) {
|
|
271
300
|
const fullPath = path.join(dir, entry.name);
|
|
@@ -10,7 +10,7 @@ export const analyst: AgentDefinition = {
|
|
|
10
10
|
"Specs verification and Contract Audit specialist. " +
|
|
11
11
|
"Audits truth and contracts within the Army.",
|
|
12
12
|
capability: 9,
|
|
13
|
-
tier: "
|
|
13
|
+
tier: "recon",
|
|
14
14
|
tags: ["core", "strategy"],
|
|
15
15
|
stateMachine: STATE_MACHINE,
|
|
16
16
|
tools: [
|
|
@@ -28,20 +28,21 @@ export const backend: AgentDefinition = {
|
|
|
28
28
|
instructions: {
|
|
29
29
|
identity: "Backend Domain Engineer and Database Management Owner",
|
|
30
30
|
mission:
|
|
31
|
-
"Deliver reliable, type-safe server logic that upholds
|
|
31
|
+
"Deliver reliable, type-safe server logic that upholds Kysely/TypeORM " +
|
|
32
32
|
"data access and strict repository/service separation.",
|
|
33
33
|
chainOfThought: "1. Analyze: Read the task, context, and relevant governance documents.\n" +
|
|
34
34
|
"2. Validate: Cross-reference with project rules, contracts, and architecture standards.\n" +
|
|
35
35
|
"3. Plan: Break down the task into small, atomic, and verifiable steps.\n" +
|
|
36
36
|
"4. Execute: Perform the task using approved tools, adhering to quality and security constraints.",
|
|
37
37
|
rules: [
|
|
38
|
-
"BRANDED TYPES:
|
|
39
|
-
"KYSELY ONLY: All database access via Kysely — raw SQL strings are unconditionally forbidden.",
|
|
38
|
+
"STRICT BRANDED TYPES: Absolute enforcement of branded types for ALL domain IDs (e.g., UserId, ProjectId). Raw 'string' or 'number' for IDs is a Nizam violation and will cause task rejection.",
|
|
39
|
+
"KYSELY ONLY: All database access via Kysely — raw SQL strings are unconditionally forbidden. No exceptions.",
|
|
40
40
|
"LAYER SEPARATION: Isolate queries in repository/service layers — direct DB calls in controllers are forbidden.",
|
|
41
41
|
"ERROR HANDLING: Wrap all async logic in robust try/catch blocks with typed error responses.",
|
|
42
|
+
"PII PROTECTION: Never log or store real user data. Use anonymized hashes for debugging tasks.",
|
|
42
43
|
"HIGH-RISK OPS: Refuse User/Role management, bulk deletes, schema alterations, and billing changes autonomously. " +
|
|
43
44
|
"Return a standard refusal, send a managerApproval request to @manager, and shift to WAITING status.",
|
|
44
45
|
],
|
|
45
|
-
knowledgeFiles: ["crud-governance.md"],
|
|
46
|
+
knowledgeFiles: ["crud-governance.md", "kysely-standards.md", "typeorm-standards.md"],
|
|
46
47
|
},
|
|
47
48
|
};
|
|
@@ -21,6 +21,7 @@ export const database: AgentDefinition = {
|
|
|
21
21
|
"list_dir",
|
|
22
22
|
"grep_search",
|
|
23
23
|
"read_project_memory",
|
|
24
|
+
"send_agent_message",
|
|
24
25
|
],
|
|
25
26
|
instructions: {
|
|
26
27
|
identity: "Database Architect and Migration Integrity Owner",
|
|
@@ -37,6 +38,6 @@ export const database: AgentDefinition = {
|
|
|
37
38
|
"DETERMINISTIC MIGRATIONS: Every migration must be reversible and produce identical results across environments.",
|
|
38
39
|
"PERFORMANCE FIRST: Design indexes proactively — never retroactively after a performance incident.",
|
|
39
40
|
],
|
|
40
|
-
knowledgeFiles: ["
|
|
41
|
+
knowledgeFiles: ["kysely-standards.md", "typeorm-standards.md", "quality-standards.md"],
|
|
41
42
|
},
|
|
42
43
|
};
|
|
@@ -40,8 +40,9 @@ export const manager: AgentDefinition = {
|
|
|
40
40
|
"4. Execute: Delegate sub-tasks to appropriate specialists and verify compliance at each step.",
|
|
41
41
|
rules: [
|
|
42
42
|
"ABSOLUTE COMPLIANCE: Freeze project and block task on any Nizam violation " +
|
|
43
|
-
"(e.g. 'any' type, 'console.log',
|
|
44
|
-
"
|
|
43
|
+
"(e.g. 'any' type, 'console.log', PII leakage, or raw ID usage). No further action until breach is purged.",
|
|
44
|
+
"PII AUDIT: Proactively scan all specialist logs and memories for PII (Emails, Names). Purge immediately if detected.",
|
|
45
|
+
"PHASE WALL: Gate every phase transition — reject if even one TODO, lint error, or unbranded ID exists in scope.",
|
|
45
46
|
"ORCHESTRATION AUDIT: Audit every specialist message for constitutional compliance before delegating next sub-task.",
|
|
46
47
|
"STRATEGIC RECIPES: Direct specialists to '.enderun/prompts/' for all refactor, bug-fix, or feature tasks.",
|
|
47
48
|
"SURGICAL PRECISION: Reject any full-file overwrite proposal unless the file is under 50 lines.",
|
|
@@ -10,7 +10,7 @@ export const native: AgentDefinition = {
|
|
|
10
10
|
"Desktop apps and system-level logic specialist. " +
|
|
11
11
|
"Handles OS deep layers with paramount security.",
|
|
12
12
|
capability: 9,
|
|
13
|
-
tier: "
|
|
13
|
+
tier: "recon",
|
|
14
14
|
tags: ["core", "native"],
|
|
15
15
|
stateMachine: STATE_MACHINE,
|
|
16
16
|
tools: [
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 🐞 Scientific Debugging (Bug-Fix) Recipe
|
|
2
|
+
|
|
3
|
+
This recipe defines how to autonomously detect and permanently resolve a bug.
|
|
4
|
+
|
|
5
|
+
## 1. Reproduction
|
|
6
|
+
- Analyze the logs (`audit_log.md`) that reported the error.
|
|
7
|
+
- Write the smallest test case (failing test) that triggers the error.
|
|
8
|
+
|
|
9
|
+
## 2. Root Cause Analysis
|
|
10
|
+
- Check system resources with `get_system_health`.
|
|
11
|
+
- Verify the status of services with `check_active_ports`.
|
|
12
|
+
- Examine relevant code blocks line by line using `read_file`.
|
|
13
|
+
|
|
14
|
+
## 3. Surgical Fix
|
|
15
|
+
- Perform only the surgical intervention that will fix the error.
|
|
16
|
+
- Check if there is a missing variable in ".env".
|
|
17
|
+
|
|
18
|
+
## 4. Permanent Solution
|
|
19
|
+
- Verify that the test you wrote passes.
|
|
20
|
+
- If `quality-standards.md` needs to be updated to prevent similar errors, submit a proposal.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 📜 Engineering Recipe: Contract-First Design
|
|
2
|
+
|
|
3
|
+
This recipe governs the @architect agent's protocol for creating type-safe agreements between system layers.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Requirement Alignment
|
|
6
|
+
1. **Analysis:** Read user requirements and Business Analyst (@analyst) reports.
|
|
7
|
+
2. **Scope Discovery:** Identify the domain objects, actions, and events required for the feature.
|
|
8
|
+
|
|
9
|
+
## 📐 Phase 2: Technical Modeling
|
|
10
|
+
1. **Branded Types:** Define semantic IDs in `src/types/brands.ts` (e.g., `OrderId`, `ProductSKU`).
|
|
11
|
+
2. **Domain Models:** Create or update interfaces in `src/types/models.ts`. Ensure they extend `BaseEntity`.
|
|
12
|
+
3. **Constants:** Update `src/types/constants.ts` for enums and fixed state values.
|
|
13
|
+
|
|
14
|
+
## 🔏 Phase 3: Hash Sealing
|
|
15
|
+
1. **Integrity Check:** Run `agent-enderun verify-contract` to check existing state.
|
|
16
|
+
2. **Commitment:** Run `agent-enderun update-contract` to generate new SHA-256 signatures for the updated types.
|
|
17
|
+
3. **Audit:** Verify that `contract.version.json` accurately reflects the new architecture.
|
|
18
|
+
|
|
19
|
+
## 📡 Phase 4: Synchronization
|
|
20
|
+
1. **Distribution:** Ensure the updated `src/types` directory is correctly linked or copied to both Frontend and Backend projects.
|
|
21
|
+
2. **Verification:** Trigger @backend and @frontend agents to read the new contract and plan their implementations.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 🗄️ Engineering Recipe: Database Management & Migrations
|
|
2
|
+
|
|
3
|
+
This recipe governs the @database agent's protocol for schema creation, table modifications, and data integrity.
|
|
4
|
+
|
|
5
|
+
## 📐 Phase 1: Contract-First Definition
|
|
6
|
+
1. **Type Mapping:** Define the new table or column in `src/types/models.ts` using Branded Types for IDs.
|
|
7
|
+
2. **Validation:** Ensure the interface extends `BaseEntity` (id, createdAt, updatedAt).
|
|
8
|
+
|
|
9
|
+
## 🚀 Phase 2: Migration Generation
|
|
10
|
+
1. **Scripting:** Write a reversible migration (up/down) using the project's migration tool (e.g., Kysely or SQL).
|
|
11
|
+
2. **Atomic Changes:** One migration per logical feature. Never bundle unrelated schema changes.
|
|
12
|
+
3. **Naming:** Use timestamp-prefixed naming (e.g., `20240101_add_customers_table.ts`).
|
|
13
|
+
|
|
14
|
+
## 🧱 Phase 3: Infrastructure Setup (If New DB)
|
|
15
|
+
1. **Initialization:** Verify the connection string in `.env`.
|
|
16
|
+
2. **Health Check:** Run `check_active_ports` to ensure the DB engine is reachable.
|
|
17
|
+
|
|
18
|
+
## 🛠️ Phase 4: Implementation & Repository Update
|
|
19
|
+
1. **Repo Layer:** Create or update the Repository class to include the new query logic.
|
|
20
|
+
2. **Strict Mode:** Ensure no raw SQL is used; leverage the query builder exclusively.
|
|
21
|
+
|
|
22
|
+
## ✅ Phase 5: Verification & Zero-Downtime Audit
|
|
23
|
+
1. **Dry Run:** If supported, dry-run the migration to check for locking issues.
|
|
24
|
+
2. **Validation:** Run `agent-enderun verify-contract` to ensure code and schema are synced.
|
|
25
|
+
3. **Handoff:** Update `PROJECT_MEMORY.md` with the new schema version.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 🚀 Engineering Recipe: Infrastructure Deployment
|
|
2
|
+
|
|
3
|
+
This recipe governs the @devops agent's protocol for safe, traceable, and reversible system rollouts.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Pre-Deployment Environment Audit
|
|
6
|
+
1. **Integrity Check:** Run `agent-enderun check` to ensure all discipline rules are met.
|
|
7
|
+
2. **Health Scan:** Execute `get_system_health` and `check_active_ports` on the target environment.
|
|
8
|
+
3. **Config Sync:** Verify that all keys in `.env.example` are present in the target environment's secrets manager.
|
|
9
|
+
|
|
10
|
+
## 🧱 Phase 2: Build & Validation
|
|
11
|
+
1. **Compilation:** Run `npm run build` and capture any stderr.
|
|
12
|
+
2. **Contract Verify:** Run `agent-enderun verify-contract` to ensure FE/BE synchronization.
|
|
13
|
+
3. **Test Suite:** Execute the full test battery. Failure in a single test blocks deployment.
|
|
14
|
+
|
|
15
|
+
## 📡 Phase 3: Controlled Rollout
|
|
16
|
+
1. **Atomic Swap:** Deploy the new bundle/service using the project's orchestration scripts.
|
|
17
|
+
2. **Database Sync:** If migrations are pending, follow the `db-management-recipe.md` first.
|
|
18
|
+
3. **Log Monitoring:** Tail `logs/manager.json` for immediate post-deploy spikes in errors.
|
|
19
|
+
|
|
20
|
+
## ✅ Phase 4: Post-Deploy & Rollback Readiness
|
|
21
|
+
1. **Observability:** Verify system metrics stabilize within 5 minutes.
|
|
22
|
+
2. **Traceability:** Record the deployment Trace ID and commit hash in `PROJECT_MEMORY.md`.
|
|
23
|
+
3. **Rollback Check:** Ensure the previous stable version is tagged and reachable in Git.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ✨ New Feature Development Recipe
|
|
2
|
+
|
|
3
|
+
The "Nizam-ı Enderun" steps to follow when adding a new module or feature.
|
|
4
|
+
|
|
5
|
+
## 1. Contract Design (Phase 1)
|
|
6
|
+
- First, update the `contract.version.json` file and the relevant TypeScript types.
|
|
7
|
+
- Do not start writing code without getting approval from `@architect`.
|
|
8
|
+
|
|
9
|
+
## 2. Mock-Free Development (Phase 2)
|
|
10
|
+
- Add the new feature to the correct directory under `apps/backend` or `apps/web`.
|
|
11
|
+
- If database changes are required, coordinate with the `@database` agent.
|
|
12
|
+
|
|
13
|
+
## 3. Responsive & i18n (Phase 3)
|
|
14
|
+
- Use `{ base: '...', md: '...' }` responsive syntax in frontend developments.
|
|
15
|
+
- Move all texts to the `locales/` directory immediately.
|
|
16
|
+
|
|
17
|
+
## 4. Completion (Phase 4)
|
|
18
|
+
- Ensure no TODOs remain using `get_project_gaps`.
|
|
19
|
+
- Verify that you haven't created any new package pollution with `audit_dependencies`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ⚡ Engineering Recipe: Performance Optimization
|
|
2
|
+
|
|
3
|
+
This recipe governs the protocol for identifying and resolving system bottlenecks (Frontend, Backend, or Database).
|
|
4
|
+
|
|
5
|
+
## 📊 Phase 1: Profiling & Bottleneck Identification
|
|
6
|
+
1. **Metric Collection:** Read `observability/metrics.json` or run `get_system_health`.
|
|
7
|
+
2. **Log Audit:** Scan `logs/manager.json` for slow actions or timeouts.
|
|
8
|
+
3. **Trace Analysis:** Use `TraceID` to follow a slow request through all layers.
|
|
9
|
+
|
|
10
|
+
## 🧠 Phase 2: Root Cause Analysis
|
|
11
|
+
1. **SQL Audit:** Check for N+1 query patterns or missing indexes in `repository/` files.
|
|
12
|
+
2. **Algorithm Audit:** Scan for O(n²) loops or heavy synchronous operations.
|
|
13
|
+
3. **Frontend Audit:** Check for unnecessary re-renders or massive bundle sizes.
|
|
14
|
+
|
|
15
|
+
## 🛠️ Phase 3: Surgical Optimization
|
|
16
|
+
1. **DB Level:** Add missing indexes or refactor complex joins.
|
|
17
|
+
2. **Logic Level:** Implement caching (e.g., Redis or in-memory) for frequent read operations.
|
|
18
|
+
3. **UI Level:** Apply memoization, virtualization (FlashList), or code-splitting.
|
|
19
|
+
|
|
20
|
+
## ✅ Phase 4: Validation & Comparison
|
|
21
|
+
1. **Benchmarking:** Re-run the action and compare new metrics with the baseline.
|
|
22
|
+
2. **Regression Check:** Run `agent-enderun check` and existing tests to ensure logic is intact.
|
|
23
|
+
3. **Knowledge Update:** Record the optimization strategy in `knowledge/performance-history.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 📦 Pull Request Title: [TRC-{TraceId}] Brief Description
|
|
2
|
+
|
|
3
|
+
## 📝 Summary
|
|
4
|
+
<!-- What did you change and why? -->
|
|
5
|
+
|
|
6
|
+
## 🔗 Related Tasks
|
|
7
|
+
- **Trace ID:** [Link to Trace/Task or ID]
|
|
8
|
+
- **Issue:** [Link to issue if applicable]
|
|
9
|
+
|
|
10
|
+
## 🛡️ Governance & Compliance Checklist
|
|
11
|
+
- [ ] Code passes `npm run enderun:test`.
|
|
12
|
+
- [ ] Code passes `npm run enderun:check` (Compliance Scanner).
|
|
13
|
+
- [ ] No `any` type usage added.
|
|
14
|
+
- [ ] No secrets or hardcoded API keys.
|
|
15
|
+
- [ ] New functionality is registered in `src/modules/agents/definitions.ts` (if applicable).
|
|
16
|
+
|
|
17
|
+
## 🧪 Testing Notes
|
|
18
|
+
<!-- How did you verify the fix? -->
|
|
19
|
+
|
|
20
|
+
## 🛠️ Risk Assessment
|
|
21
|
+
<!-- Any potential side effects? -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🛠️ Surgical Refactoring Recipe
|
|
2
|
+
|
|
3
|
+
This recipe defines how to modernize existing code without breaking other parts of the project.
|
|
4
|
+
|
|
5
|
+
## 1. Reconnaissance
|
|
6
|
+
- Use `grep_search` to find all references to the function to be refactored.
|
|
7
|
+
- Understand the module's dependency graph with `get_project_map`.
|
|
8
|
+
- Verify the baseline by running existing tests (`run_tests`).
|
|
9
|
+
|
|
10
|
+
## 2. Planning (Strategy)
|
|
11
|
+
- Break the change into small, atomic steps.
|
|
12
|
+
- Define new types and interfaces first.
|
|
13
|
+
|
|
14
|
+
## 3. Surgical Execution
|
|
15
|
+
- **RULE:** Never delete a file completely. Only use `replace_text` or `batch_surgical_edit`.
|
|
16
|
+
- Maintain type safety (ban on `any`) at every step.
|
|
17
|
+
- Update `PROJECT_MEMORY.md` after every major change.
|
|
18
|
+
|
|
19
|
+
## 4. Validation
|
|
20
|
+
- Ensure no regressions occurred using `run_tests`.
|
|
21
|
+
- Audit code quality with the `@quality` agent.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 🛡️ Engineering Recipe: Advanced Security Audit
|
|
2
|
+
|
|
3
|
+
This recipe governs the @security agent's protocol for identifying and mitigating vulnerabilities within the Agent Enderun framework.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Automated Reconnaissance
|
|
6
|
+
1. **Secret Scan:** Run `grep_search` for keywords: `apiKey`, `secret`, `password`, `token`, `private_key`.
|
|
7
|
+
2. **SQL Injection Audit:** Scan for `raw SQL` or template literals bypassing the query builder.
|
|
8
|
+
3. **Auth Check:** Verify that all sensitive routes have active `auth` guards and Role-Based Access Control (RBAC).
|
|
9
|
+
|
|
10
|
+
## 🧠 Phase 2: Contextual Analysis
|
|
11
|
+
1. **Impact Mapping:** For every identified risk, read the surrounding code to determine if it's exposed to the public internet.
|
|
12
|
+
2. **Configuration Check:** Verify `.env.example` contains all required keys and no real secrets are committed to Git.
|
|
13
|
+
|
|
14
|
+
## 🛠️ Phase 3: Surgical Mitigation
|
|
15
|
+
1. **Fix:** Use `replace_text` to move hardcoded secrets to `.env` or refactor raw SQL to Kysely.
|
|
16
|
+
2. **Sanitization:** Apply input validation using Zod schemas for all external data.
|
|
17
|
+
|
|
18
|
+
## ✅ Phase 4: Verification & Logging
|
|
19
|
+
1. **Discipline Check:** Run `agent-enderun check` to ensure no new violations were introduced.
|
|
20
|
+
2. **Action Log:** Execute `log_agent_action` with a summary of found vs. fixed vulnerabilities.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 📐 Corporate Architecture Standards (AL Framework)
|
|
2
|
+
|
|
3
|
+
This project is developed in accordance with the "Nizam-ı Mimari" (Architectural Order) rules defined by Agent Enderun.
|
|
4
|
+
|
|
5
|
+
## 1. Directory Structure (Monorepo Standard)
|
|
6
|
+
- `apps/backend/`: Business logic, API, and database layers.
|
|
7
|
+
- `apps/web/`: Frontend (React/Next.js) layer.
|
|
8
|
+
- `packages/shared/`: Type definitions and helpers shared between Backend and Frontend.
|
|
9
|
+
|
|
10
|
+
## 2. Layered Architecture
|
|
11
|
+
All business logic must follow this hierarchy:
|
|
12
|
+
1. **Routes/Controllers:** API entry points and request validation.
|
|
13
|
+
2. **Services:** Where business logic is coordinated.
|
|
14
|
+
3. **Repositories/Models:** Database access and raw data mutations.
|
|
15
|
+
|
|
16
|
+
## 3. Type Safety and Contracts
|
|
17
|
+
- The hash in the `contract.version.json` file must always match the active code.
|
|
18
|
+
- The use of the `any` type is strictly forbidden.
|
|
19
|
+
- All asynchronous operations must be wrapped in `try-catch` blocks and proper error management (ErrorHandler).
|
|
20
|
+
|
|
21
|
+
## 4. AL (Agent Lifecycle) Phase Discipline
|
|
22
|
+
- Development progresses sequentially from Phase 0 to Phase 4.
|
|
23
|
+
- Application code (Phase 2) cannot be written before contracts are approved (Phase 1).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Authentication & Authorization Standards
|
|
2
|
+
|
|
3
|
+
> JWT + bcrypt authentication and role-based access control for Fastify APIs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Enterprise-grade authentication system using JSON Web Tokens (JWT) for stateless authentication and bcrypt for secure password hashing.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Required dependencies
|
|
13
|
+
npm install bcrypt jsonwebtoken
|
|
14
|
+
npm install -D @types/bcrypt @types/jsonwebtoken
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Token Management
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import jwt from "jsonwebtoken";
|
|
21
|
+
|
|
22
|
+
const JWT_SECRET = process.env.JWT_SECRET || "change-me-in-production";
|
|
23
|
+
const JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || "24h";
|
|
24
|
+
|
|
25
|
+
interface AuthPayload {
|
|
26
|
+
sub: string; // User ID
|
|
27
|
+
email: string; // User email
|
|
28
|
+
role: string; // User role (ADMIN, DEVELOPER, VIEWER)
|
|
29
|
+
iat?: number; // Issued at
|
|
30
|
+
exp?: number; // Expires at
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function generateToken(payload: AuthPayload): string {
|
|
34
|
+
return jwt.sign(payload, JWT_SECRET, { expiresIn: JWT_EXPIRES_IN });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function verifyToken(token: string): AuthPayload {
|
|
38
|
+
return jwt.verify(token, JWT_SECRET) as AuthPayload;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Middleware
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import type { FastifyRequest, FastifyReply } from "fastify";
|
|
46
|
+
|
|
47
|
+
export async function authenticate(
|
|
48
|
+
request: FastifyRequest,
|
|
49
|
+
reply: FastifyReply,
|
|
50
|
+
): Promise<void> {
|
|
51
|
+
const authHeader = request.headers.authorization;
|
|
52
|
+
if (!authHeader?.startsWith("Bearer ")) {
|
|
53
|
+
throw new UnauthorizedError("Missing authorization header");
|
|
54
|
+
}
|
|
55
|
+
const token = authHeader.slice(7);
|
|
56
|
+
const payload = verifyToken(token);
|
|
57
|
+
(request as any).user = payload;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function requireRole(...roles: string[]) {
|
|
61
|
+
return async (request: FastifyRequest, reply: FastifyReply) => {
|
|
62
|
+
const user = (request as any).user as AuthPayload;
|
|
63
|
+
if (!user || !roles.includes(user.role)) {
|
|
64
|
+
throw new ForbiddenError("Insufficient permissions");
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Password Security
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import bcrypt from "bcrypt";
|
|
74
|
+
|
|
75
|
+
const SALT_ROUNDS = 12;
|
|
76
|
+
|
|
77
|
+
// Hash password for storage
|
|
78
|
+
export async function hashPassword(password: string): Promise<string> {
|
|
79
|
+
return bcrypt.hash(password, SALT_ROUNDS);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Verify password against hash
|
|
83
|
+
export async function verifyPassword(
|
|
84
|
+
password: string,
|
|
85
|
+
hash: string,
|
|
86
|
+
): Promise<boolean> {
|
|
87
|
+
return bcrypt.compare(password, hash);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## CRUD Governance Integration
|
|
92
|
+
|
|
93
|
+
Admin-level mutations (user creation, role changes, schema modifications) **MUST** follow the CRUD Governance protocol:
|
|
94
|
+
- Route through `@manager` for approval
|
|
95
|
+
- Require human sign-off via `agent-enderun approve <traceId>`
|
|
96
|
+
- Log all authorization decisions
|
|
97
|
+
|
|
98
|
+
## API Endpoints
|
|
99
|
+
|
|
100
|
+
| Method | Path | Auth Required | Role Required | Description |
|
|
101
|
+
|--------|------|:------------:|:------------:|-------------|
|
|
102
|
+
| POST | `/api/v1/auth/register` | No | No | Create new user |
|
|
103
|
+
| POST | `/api/v1/auth/login` | No | No | Login & get token |
|
|
104
|
+
| GET | `/api/v1/auth/me` | Yes | No | Get current user |
|
|
105
|
+
| PUT | `/api/v1/auth/password` | Yes | No | Change password |
|
|
106
|
+
|
|
107
|
+
## Environment Variables
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
JWT_SECRET=your-secret-key-at-least-32-chars-long
|
|
111
|
+
JWT_EXPIRES_IN=24h
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
1. **Password Hashing**: Always use bcrypt with minimum 12 salt rounds
|
|
117
|
+
2. **Token Expiry**: Use short-lived tokens (24h max). Implement refresh tokens for longer sessions
|
|
118
|
+
3. **Secret Rotation**: Rotate JWT_SECRET periodically in production
|
|
119
|
+
4. **Rate Limiting**: Apply rate limiting on login/register endpoints to prevent brute force
|
|
120
|
+
5. **HTTPS Only**: Never transmit tokens over unencrypted connections
|
|
121
|
+
6. **Password Strength**: Enforce minimum password requirements (8+ chars, mixed case, numbers)
|
|
122
|
+
7. **Audit Logging**: Log all authentication attempts (success/failure) for security monitoring
|
|
123
|
+
8. **No Plain Text**: Never log or store passwords in plain text
|
|
124
|
+
9. **Token Storage**: Store tokens securely (httpOnly cookies for web, secure storage for mobile)
|
|
125
|
+
10. **Role Hierarchy**: ADMIN > MANAGER > DEVELOPER > VIEWER — validate permissions at each level
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🏛️ Corporate CRUD and Governance Standards
|
|
2
|
+
|
|
3
|
+
This document defines the strict rules applicable to data mutation and administrative operations in projects managed by the Agent Enderun army.
|
|
4
|
+
|
|
5
|
+
## 1. High-Risk Operations
|
|
6
|
+
The following operations are considered "High-Risk" and cannot be performed autonomously by specialist agents (@backend, @database, etc.):
|
|
7
|
+
- Database schema changes (DDL).
|
|
8
|
+
- Bulk data deletion or purging (Bulk Delete/Purge).
|
|
9
|
+
- User authorization and role assignment systems.
|
|
10
|
+
- Payment system (Billing) integrations.
|
|
11
|
+
- PII (Personal Data) export.
|
|
12
|
+
|
|
13
|
+
## 2. Approval Flow
|
|
14
|
+
- When a specialist agent receives a high-risk operation request, they must reject the operation and report the status to `@manager`.
|
|
15
|
+
- `@manager` analyzes the request and creates a task awaiting `managerApproval`.
|
|
16
|
+
- The operation is held until a human overseer (Human-in-the-Loop) grants approval via the `agent-enderun approve [TraceID]` command.
|
|
17
|
+
|
|
18
|
+
## 3. Data Discipline
|
|
19
|
+
- **Branded Types:** All IDs (UserID, OrderID, etc.) must strictly follow the branded types format.
|
|
20
|
+
- **Kysely Only:** Raw SQL queries are forbidden. Only the type-safe Kysely query builder may be used.
|
|
21
|
+
- **Repository Pattern:** Database operations cannot be performed directly within controllers; they must pass through the service and repository layers.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🚀 Deployment and Release Standards
|
|
2
|
+
|
|
3
|
+
This document outlines the protocols for deploying, updating, and rolling back services managed by Agent Enderun.
|
|
4
|
+
|
|
5
|
+
## 1. Release Strategy
|
|
6
|
+
- **Version Control:** All releases must follow Semantic Versioning (SemVer) and be tagged in Git with the format `vX.Y.Z`.
|
|
7
|
+
- **Atomic Commits:** Each deployment must be linked to a specific Git commit, which itself must contain a `Trace ID` in the commit message.
|
|
8
|
+
|
|
9
|
+
## 2. Deployment Workflow
|
|
10
|
+
- **CI/CD Integration:** Every deployment must pass the `npm run enderun:test` and `npm run enderun:check` pipeline.
|
|
11
|
+
- **Environment Isolation:** Deployments must use environment-specific configurations (.env.{env}) and never cross-pollinate variables.
|
|
12
|
+
|
|
13
|
+
## 3. Rollback Procedures (The Hermes Safety Valve)
|
|
14
|
+
- **Immediate Rollback:** If a deployment causes an escalation alert from an agent or a production failure, a rollback must be initiated within 5 minutes.
|
|
15
|
+
- **Git Revert Strategy:**
|
|
16
|
+
- Rollbacks are executed by checking out the previous stable tag (e.g., `git checkout v1.0.9`).
|
|
17
|
+
- A "Fix-Forward" approach is only allowed for P0 security patches; otherwise, "Revert-First" is the law.
|
|
18
|
+
- **Database Safety:**
|
|
19
|
+
- Every Migration script must strictly include a corresponding `down()` or `revert()` path.
|
|
20
|
+
- Database rollbacks must be tested in the staging environment before production execution.
|
|
21
|
+
- **Post-Mortem Requirement:** Every rollback triggers an automatic `@manager` task to create a `docs/post-mortems/TRACE_ID.md` report.
|