agent-enderun 1.10.4 → 1.11.1
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 +13 -7
- 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 +9 -7
- package/dist/src/cli/commands/orchestrate.js +40 -4
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- 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/adapters/definitions.js +1 -1
- package/dist/src/modules/adapters/definitions.js.map +1 -1
- package/dist/src/modules/adapters/shared.js +7 -4
- package/dist/src/modules/adapters/shared.js.map +1 -1
- package/dist/src/modules/agents/definitions.d.ts +1 -1
- package/dist/src/modules/agents/definitions.js +129 -69
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/analyst.js +5 -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/devops.js +2 -0
- package/dist/src/modules/agents/registry/devops.js.map +1 -1
- package/dist/src/modules/agents/registry/explorer.js +1 -0
- package/dist/src/modules/agents/registry/explorer.js.map +1 -1
- package/dist/src/modules/agents/registry/git.js +3 -1
- package/dist/src/modules/agents/registry/git.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +8 -2
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/agents/registry/native.js +5 -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/src/shared/constants.d.ts +1 -1
- package/dist/src/shared/constants.js +10 -9
- package/dist/src/shared/constants.js.map +1 -1
- package/dist/tests/approve.test.js +4 -9
- package/dist/tests/approve.test.js.map +1 -1
- package/dist/tests/integration/agent_flow.test.js +2 -2
- package/dist/tests/integration/agent_flow.test.js.map +1 -1
- package/dist/tests/orchestrate.test.js +2 -7
- package/dist/tests/orchestrate.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 +20 -7
- package/src/cli/commands/init/scaffold-core.ts +45 -6
- package/src/cli/commands/init.ts +31 -2
- package/src/cli/commands/orchestrate.ts +41 -4
- 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/adapters/definitions.ts +1 -1
- package/src/modules/adapters/shared.ts +7 -4
- package/src/modules/agents/definitions.ts +140 -73
- package/src/modules/agents/registry/analyst.ts +5 -1
- package/src/modules/agents/registry/backend.ts +5 -4
- package/src/modules/agents/registry/database.ts +2 -1
- package/src/modules/agents/registry/devops.ts +2 -0
- package/src/modules/agents/registry/explorer.ts +1 -0
- package/src/modules/agents/registry/git.ts +3 -1
- package/src/modules/agents/registry/manager.ts +8 -2
- package/src/modules/agents/registry/native.ts +5 -1
- package/src/modules/agents/registry/security.ts +1 -0
- package/src/shared/constants.ts +14 -13
- 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
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import type { AppSpec } from "./app-inferrer.js";
|
|
3
|
-
import { createBaseTypeFiles } from "./app-types.js";
|
|
4
|
-
import { writeJsonFile, writeTextFile } from "./fs.js";
|
|
5
|
-
import { getConfiguredPaths } from "./memory.js";
|
|
6
|
-
|
|
7
|
-
const targetDir = process.cwd();
|
|
8
|
-
|
|
9
|
-
export function createMobileFiles(spec: AppSpec): void {
|
|
10
|
-
const pathsMap = getConfiguredPaths();
|
|
11
|
-
// Defaulting mobile to apps/mobile if not configured
|
|
12
|
-
const mobileDir = pathsMap.mobile || "apps/mobile";
|
|
13
|
-
|
|
14
|
-
createBaseTypeFiles(path.join(targetDir, mobileDir, "src"));
|
|
15
|
-
|
|
16
|
-
writeJsonFile(path.join(targetDir, mobileDir, "package.json"), {
|
|
17
|
-
name: "@agent-enderun/mobile",
|
|
18
|
-
version: "0.1.0",
|
|
19
|
-
private: true,
|
|
20
|
-
scripts: {
|
|
21
|
-
"start": "expo start",
|
|
22
|
-
"android": "expo start --android",
|
|
23
|
-
"ios": "expo start --ios",
|
|
24
|
-
"web": "expo start --web"
|
|
25
|
-
},
|
|
26
|
-
dependencies: {
|
|
27
|
-
"expo": "~52.0.0",
|
|
28
|
-
"expo-status-bar": "~2.0.0",
|
|
29
|
-
"react": "18.3.1",
|
|
30
|
-
"react-native": "0.76.0",
|
|
31
|
-
"lucide-react-native": "^0.468.0"
|
|
32
|
-
},
|
|
33
|
-
devDependencies: {
|
|
34
|
-
"@babel/core": "^7.25.2",
|
|
35
|
-
"@types/react": "~18.3.12",
|
|
36
|
-
"typescript": "^5.3.3"
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
writeTextFile(path.join(targetDir, mobileDir, "App.tsx"), [
|
|
41
|
-
"import React from 'react';",
|
|
42
|
-
"import { StyleSheet, Text, View, SafeAreaView, ScrollView } from 'react-native';",
|
|
43
|
-
"import { StatusBar } from 'expo-status-bar';",
|
|
44
|
-
"import { BarChart3, Users, Shield } from 'lucide-react-native';",
|
|
45
|
-
"",
|
|
46
|
-
"export default function App() {",
|
|
47
|
-
" return (",
|
|
48
|
-
" <SafeAreaView style={styles.container}>",
|
|
49
|
-
" <StatusBar style=\"auto\" />",
|
|
50
|
-
" <View style={styles.header}>",
|
|
51
|
-
" <Text style={styles.subtitle}>{'" + spec.domain + "'}</Text>",
|
|
52
|
-
" <Text style={styles.title}>{'" + spec.title + "'}</Text>",
|
|
53
|
-
" </View>",
|
|
54
|
-
" <ScrollView style={styles.content}>",
|
|
55
|
-
" <View style={styles.metricRow}>",
|
|
56
|
-
" <View style={[styles.card, { borderLeftColor: '#49a078' }]}>",
|
|
57
|
-
" <BarChart3 color=\"#49a078\" size={20} />",
|
|
58
|
-
" <Text style={styles.cardLabel}>Pipeline</Text>",
|
|
59
|
-
" <Text style={styles.cardValue}>$261K</Text>",
|
|
60
|
-
" </View>",
|
|
61
|
-
" <View style={[styles.card, { borderLeftColor: '#3f7cac' }]}>",
|
|
62
|
-
" <Users color=\"#3f7cac\" size={20} />",
|
|
63
|
-
" <Text style={styles.cardLabel}>Customers</Text>",
|
|
64
|
-
" <Text style={styles.cardValue}>18</Text>",
|
|
65
|
-
" </View>",
|
|
66
|
-
" </View>",
|
|
67
|
-
" <View style={styles.panel}>",
|
|
68
|
-
" <Text style={styles.panelTitle}>Recent Activity</Text>",
|
|
69
|
-
" <View style={styles.row}>",
|
|
70
|
-
" <Text style={styles.rowText}>Northwind updated by Manager</Text>",
|
|
71
|
-
" </View>",
|
|
72
|
-
" <View style={styles.row}>",
|
|
73
|
-
" <Text style={styles.rowText}>Acme Corp status changed to Lead</Text>",
|
|
74
|
-
" </View>",
|
|
75
|
-
" </View>",
|
|
76
|
-
" </ScrollView>",
|
|
77
|
-
" </SafeAreaView>",
|
|
78
|
-
" );",
|
|
79
|
-
"}",
|
|
80
|
-
"",
|
|
81
|
-
"const styles = StyleSheet.create({",
|
|
82
|
-
" container: { flex: 1, backgroundColor: '#f4f7f6' },",
|
|
83
|
-
" header: { padding: 24, backgroundColor: '#fff', borderBottomWidth: 1, borderBottomColor: '#d9e3e0' },",
|
|
84
|
-
" subtitle: { fontSize: 14, color: '#58666a', marginBottom: 4 },",
|
|
85
|
-
" title: { fontSize: 28, fontWeight: '800', color: '#172026' },",
|
|
86
|
-
" content: { flex: 1, padding: 16 },",
|
|
87
|
-
" metricRow: { flexDirection: 'row', gap: 12, marginBottom: 16 },",
|
|
88
|
-
" card: { flex: 1, backgroundColor: '#fff', padding: 16, borderRadius: 12, borderLeftWidth: 4, elevation: 2, shadowColor: '#000', shadowOffset: { width: 0, height: 1 }, shadowOpacity: 0.1, shadowRadius: 2 },",
|
|
89
|
-
" cardLabel: { fontSize: 12, color: '#58666a', marginVertical: 4 },",
|
|
90
|
-
" cardValue: { fontSize: 20, fontWeight: '700', color: '#172026' },",
|
|
91
|
-
" panel: { backgroundColor: '#fff', padding: 16, borderRadius: 12, borderWidth: 1, borderColor: '#d9e3e0' },",
|
|
92
|
-
" panelTitle: { fontSize: 18, fontWeight: '700', color: '#172026', marginBottom: 12 },",
|
|
93
|
-
" row: { paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: '#f0f4f3' },",
|
|
94
|
-
" rowText: { color: '#58666a' }",
|
|
95
|
-
"});"
|
|
96
|
-
].join("\n"));
|
|
97
|
-
|
|
98
|
-
writeTextFile(path.join(targetDir, mobileDir, ".env.example"), [
|
|
99
|
-
"# Agent Enderun - Mobile Environment Variables",
|
|
100
|
-
"EXPO_PUBLIC_API_URL=http://localhost:4000/api/v1",
|
|
101
|
-
"EXPO_PUBLIC_APP_VARIANT=development",
|
|
102
|
-
].join("\n"));
|
|
103
|
-
|
|
104
|
-
writeTextFile(path.join(targetDir, mobileDir, "README.md"), [
|
|
105
|
-
`# ${spec.title} Mobile`,
|
|
106
|
-
"",
|
|
107
|
-
"Expo / React Native app generated by Agent Enderun.",
|
|
108
|
-
"",
|
|
109
|
-
"## Commands",
|
|
110
|
-
"",
|
|
111
|
-
"- `npx expo start`",
|
|
112
|
-
].join("\n"));
|
|
113
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { computeTypesHash, ensureDir, writeTextFile, writeJsonFile } from "./fs.js";
|
|
4
|
-
import { getConfiguredPaths } from "./memory.js";
|
|
5
|
-
import { UI } from "./ui.js";
|
|
6
|
-
|
|
7
|
-
const targetDir = process.cwd();
|
|
8
|
-
|
|
9
|
-
export function buildSharedTypesContent(existingContent: string): string {
|
|
10
|
-
const marker = "// --- Generated Application Contract ---";
|
|
11
|
-
const generated = [
|
|
12
|
-
marker,
|
|
13
|
-
"export type RoleID = Brand<string, \"RoleID\">;",
|
|
14
|
-
"export type ReportID = Brand<string, \"ReportID\">;",
|
|
15
|
-
"export type CustomerID = Brand<string, \"CustomerID\">;",
|
|
16
|
-
"",
|
|
17
|
-
"export interface AuthSession {",
|
|
18
|
-
" user: User;",
|
|
19
|
-
" token: string;",
|
|
20
|
-
" expiresAt: string;",
|
|
21
|
-
"}",
|
|
22
|
-
"",
|
|
23
|
-
"export interface Role {",
|
|
24
|
-
" id: RoleID;",
|
|
25
|
-
" name: string;",
|
|
26
|
-
" permissions: string[];",
|
|
27
|
-
"}",
|
|
28
|
-
"",
|
|
29
|
-
"export interface Customer {",
|
|
30
|
-
" id: CustomerID;",
|
|
31
|
-
" name: string;",
|
|
32
|
-
" ownerId: UserID;",
|
|
33
|
-
" status: \"LEAD\" | \"ACTIVE\" | \"AT_RISK\";",
|
|
34
|
-
" annualValue: number;",
|
|
35
|
-
" createdAt: string;",
|
|
36
|
-
"}",
|
|
37
|
-
"",
|
|
38
|
-
"export interface ReportMetric {",
|
|
39
|
-
" id: ReportID;",
|
|
40
|
-
" label: string;",
|
|
41
|
-
" value: number;",
|
|
42
|
-
" trend: \"UP\" | \"DOWN\" | \"FLAT\";",
|
|
43
|
-
"}",
|
|
44
|
-
"",
|
|
45
|
-
"export interface DashboardSummary {",
|
|
46
|
-
" customers: Customer[];",
|
|
47
|
-
" users: User[];",
|
|
48
|
-
" roles: Role[];",
|
|
49
|
-
" reports: ReportMetric[];",
|
|
50
|
-
"}",
|
|
51
|
-
].join("\n");
|
|
52
|
-
|
|
53
|
-
if (existingContent.includes(marker)) return existingContent;
|
|
54
|
-
return `${existingContent.trim()}\n\n${generated}\n`;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function updateContractHashFile(): void {
|
|
58
|
-
const pathsMap = getConfiguredPaths();
|
|
59
|
-
const sharedDir = path.join(targetDir, pathsMap.backend, "src/types");
|
|
60
|
-
const contractPath = path.join(targetDir, pathsMap.backend, "contract.version.json");
|
|
61
|
-
if (!fs.existsSync(sharedDir) || !fs.existsSync(contractPath)) return;
|
|
62
|
-
|
|
63
|
-
const currentHash = computeTypesHash(targetDir, sharedDir);
|
|
64
|
-
|
|
65
|
-
const contract = JSON.parse(fs.readFileSync(contractPath, "utf8"));
|
|
66
|
-
contract.contract_hash = currentHash;
|
|
67
|
-
contract.last_updated = new Date().toISOString();
|
|
68
|
-
writeJsonFile(contractPath, contract);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function createBaseTypeFiles(baseDir: string): void {
|
|
72
|
-
const typesDir = path.join(baseDir, "types");
|
|
73
|
-
ensureDir(typesDir);
|
|
74
|
-
|
|
75
|
-
writeTextFile(path.join(typesDir, "api.ts"), `import { TraceID } from "./brands.js";
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* API Response Wrappers
|
|
79
|
-
*/
|
|
80
|
-
export interface ApiResponse<T> {
|
|
81
|
-
data: T;
|
|
82
|
-
meta?: {
|
|
83
|
-
requestId: TraceID;
|
|
84
|
-
timestamp: string;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface ApiError {
|
|
89
|
-
error: {
|
|
90
|
-
code: string;
|
|
91
|
-
message: string;
|
|
92
|
-
details?: unknown;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
`);
|
|
96
|
-
|
|
97
|
-
writeTextFile(path.join(typesDir, "brands.ts"), `/**
|
|
98
|
-
* Branded Type Utility
|
|
99
|
-
*/
|
|
100
|
-
export type Brand<K, T> = K & { __brand: T };
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Entity IDs (Branded)
|
|
104
|
-
*/
|
|
105
|
-
export type TraceID = Brand<string, "TraceID">;
|
|
106
|
-
export type AgentID = Brand<string, "AgentID">;
|
|
107
|
-
export type ProjectID = Brand<string, "ProjectID">;
|
|
108
|
-
export type UserID = Brand<string, "UserID">;
|
|
109
|
-
`);
|
|
110
|
-
|
|
111
|
-
writeTextFile(path.join(typesDir, "constants.ts"), `import { TraceID } from "./brands.js";
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Project Phases
|
|
115
|
-
*/
|
|
116
|
-
export const PROJECT_PHASES = ["PHASE_0", "PHASE_1", "PHASE_2", "PHASE_3", "PHASE_4"] as const;
|
|
117
|
-
export type ProjectPhase = (typeof PROJECT_PHASES)[number];
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Execution Profiles
|
|
121
|
-
*/
|
|
122
|
-
export const EXECUTION_PROFILES = ["Lightweight", "Full"] as const;
|
|
123
|
-
export type ExecutionProfile = (typeof EXECUTION_PROFILES)[number];
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Task Priorities
|
|
127
|
-
*/
|
|
128
|
-
export const TASK_PRIORITIES = ["P0", "P1", "P2", "P3"] as const;
|
|
129
|
-
export type TaskPriority = (typeof TASK_PRIORITIES)[number];
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Task Statuses
|
|
133
|
-
*/
|
|
134
|
-
export const TASK_STATUSES = ["PENDING", "IN_PROGRESS", "BLOCKED", "COMPLETED", "FAILED"] as const;
|
|
135
|
-
export type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Action Types & Status
|
|
139
|
-
*/
|
|
140
|
-
export const ACTION_TYPES = ["CREATE", "MODIFY", "DELETE", "RESEARCH", "ORCHESTRATE"] as const;
|
|
141
|
-
export type ActionType = (typeof ACTION_TYPES)[number];
|
|
142
|
-
|
|
143
|
-
export const ACTION_STATUSES = ["SUCCESS", "FAILURE", "WAITING"] as const;
|
|
144
|
-
export type ActionStatus = (typeof ACTION_STATUSES)[number];
|
|
145
|
-
`);
|
|
146
|
-
|
|
147
|
-
writeTextFile(path.join(typesDir, "index.ts"), `/**
|
|
148
|
-
* Agent Enderun — App-Local Types (Modular)
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
export * from "./brands.js";
|
|
152
|
-
export * from "./constants.js";
|
|
153
|
-
export * from "./models.js";
|
|
154
|
-
export * from "./api.js";
|
|
155
|
-
export * from "./logs.js";
|
|
156
|
-
`);
|
|
157
|
-
|
|
158
|
-
writeTextFile(path.join(typesDir, "logs.ts"), `import { TraceID, AgentID } from "./brands.js";
|
|
159
|
-
import { ActionType, ActionStatus } from "./constants.js";
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Audit & Agent Logging Types
|
|
163
|
-
*/
|
|
164
|
-
export interface AgentActionLog {
|
|
165
|
-
timestamp: string;
|
|
166
|
-
agent: AgentID;
|
|
167
|
-
action: ActionType;
|
|
168
|
-
requestId: TraceID | "—";
|
|
169
|
-
status: ActionStatus;
|
|
170
|
-
summary: string;
|
|
171
|
-
files?: string[];
|
|
172
|
-
details?: Record<string, unknown>;
|
|
173
|
-
}
|
|
174
|
-
`);
|
|
175
|
-
|
|
176
|
-
const modelsPath = path.join(typesDir, "models.ts");
|
|
177
|
-
const baseModelsContent = `import { UserID, TraceID, AgentID } from "./brands.js";
|
|
178
|
-
import { ProjectPhase, ExecutionProfile, TaskPriority, TaskStatus } from "./constants.js";
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Base Entity Fields
|
|
182
|
-
*/
|
|
183
|
-
export interface BaseEntity {
|
|
184
|
-
id: string; // Usually ULID
|
|
185
|
-
createdAt: string;
|
|
186
|
-
updatedAt: string;
|
|
187
|
-
deletedAt?: string | null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Audit Log Model
|
|
192
|
-
*/
|
|
193
|
-
export interface AuditLog extends BaseEntity {
|
|
194
|
-
entityName: string;
|
|
195
|
-
entityId: string;
|
|
196
|
-
action: "CREATE" | "UPDATE" | "DELETE" | "RESTORE";
|
|
197
|
-
userId: UserID;
|
|
198
|
-
previousState?: Record<string, unknown> | null;
|
|
199
|
-
newState?: Record<string, unknown> | null;
|
|
200
|
-
traceId: TraceID;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* User Model
|
|
205
|
-
*/
|
|
206
|
-
export interface User extends BaseEntity {
|
|
207
|
-
id: UserID;
|
|
208
|
-
email: string;
|
|
209
|
-
fullName: string;
|
|
210
|
-
role: "ADMIN" | "DEVELOPER" | "VIEWER";
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export interface UserProfile extends User {
|
|
214
|
-
avatarUrl?: string;
|
|
215
|
-
bio?: string;
|
|
216
|
-
preferences: Record<string, unknown>;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Project Status
|
|
221
|
-
*/
|
|
222
|
-
export interface ProjectStatus {
|
|
223
|
-
phase: ProjectPhase;
|
|
224
|
-
profile: ExecutionProfile;
|
|
225
|
-
lastUpdate: string;
|
|
226
|
-
activeTraceId: TraceID | null;
|
|
227
|
-
blockers: string[];
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Task Model
|
|
232
|
-
*/
|
|
233
|
-
export interface Task {
|
|
234
|
-
id: TraceID;
|
|
235
|
-
description: string;
|
|
236
|
-
agent: AgentID;
|
|
237
|
-
priority: TaskPriority;
|
|
238
|
-
status: TaskStatus;
|
|
239
|
-
createdAt: string;
|
|
240
|
-
updatedAt: string;
|
|
241
|
-
}
|
|
242
|
-
`;
|
|
243
|
-
// Append generated application contract types
|
|
244
|
-
const finalModelsContent = buildSharedTypesContent(baseModelsContent);
|
|
245
|
-
writeTextFile(modelsPath, finalModelsContent);
|
|
246
|
-
|
|
247
|
-
UI.success(`Base types created in ${path.relative(targetDir, typesDir)}`);
|
|
248
|
-
}
|