ai-engineering-loop 1.0.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +272 -0
  3. package/adapters/dot/README.md +55 -0
  4. package/adapters/dot/coreview.md +88 -0
  5. package/adapters/dot/gitlab.md +128 -0
  6. package/adapters/dot/mattermost.md +102 -0
  7. package/adapters/dot/multi-branch.md +89 -0
  8. package/agents/devil-advocate.md +111 -0
  9. package/agents/judge.md +69 -0
  10. package/agents/maker.md +66 -0
  11. package/bin/ai-engineering-loop.js +633 -0
  12. package/core/configuration-precedence.md +102 -0
  13. package/core/context-impact-assessment.md +127 -0
  14. package/core/context-refresh-policy.md +116 -0
  15. package/core/definition-of-done.md +79 -0
  16. package/core/escalation-policy.md +99 -0
  17. package/core/goal-contract.md +88 -0
  18. package/core/iteration-policy.md +108 -0
  19. package/core/judge-policy.md +123 -0
  20. package/core/project-initialization.md +97 -0
  21. package/core/repo-config-schema.md +72 -0
  22. package/core/verification-loop.md +97 -0
  23. package/docs/antigravity-feasibility.md +90 -0
  24. package/docs/migration-plan.md +70 -0
  25. package/examples/backend-api/payment-idempotency/README.md +33 -0
  26. package/examples/backend-api/payment-idempotency/goal-contract.md +33 -0
  27. package/examples/backend-api/payment-idempotency/judge-verdict.md +28 -0
  28. package/examples/backend-api/payment-idempotency/review-findings.md +50 -0
  29. package/examples/dot/attendance-confirmation/README.md +22 -0
  30. package/examples/dot/attendance-confirmation/delivery-report.md +51 -0
  31. package/examples/dot/attendance-confirmation/goal-contract.md +39 -0
  32. package/examples/dot/attendance-confirmation/judge-verdict.md +43 -0
  33. package/examples/dot/attendance-confirmation/review-findings.md +57 -0
  34. package/examples/initialization/README.md +19 -0
  35. package/examples/initialization/discovery-trace.md +63 -0
  36. package/examples/initialization/generated-context.md +110 -0
  37. package/examples/mobile-app/offline-sync-queue/README.md +33 -0
  38. package/examples/mobile-app/offline-sync-queue/goal-contract.md +32 -0
  39. package/examples/mobile-app/offline-sync-queue/judge-verdict.md +27 -0
  40. package/examples/mobile-app/offline-sync-queue/review-findings.md +30 -0
  41. package/package.json +31 -0
  42. package/policies/discovery-safety-policy.md +51 -0
  43. package/policies/evidence-policy.md +70 -0
  44. package/policies/finding-policy.md +102 -0
  45. package/policies/no-progress-policy.md +92 -0
  46. package/profiles/README.md +42 -0
  47. package/profiles/backend-api.md +64 -0
  48. package/profiles/library.md +51 -0
  49. package/profiles/mobile-app.md +59 -0
  50. package/profiles/monorepo.md +46 -0
  51. package/profiles/web-app.md +65 -0
  52. package/scripts/init.sh +85 -0
  53. package/templates/repo-config/adapter.md +11 -0
  54. package/templates/repo-config/architecture.md +15 -0
  55. package/templates/repo-config/config.md +11 -0
  56. package/templates/repo-config/conventions.md +16 -0
  57. package/templates/repo-config/verification.md +13 -0
@@ -0,0 +1,65 @@
1
+ # Project Profile: `web-app`
2
+
3
+ ## 1. Profile Definition
4
+
5
+ - **Archetype**: Frontend Web Applications, Single-Page Applications (SPAs), SSR/SSG Portals (Next.js, Remix, Vite, React, Vue, Svelte, Angular).
6
+ - **Core Environment**: Modern web browser runtimes, DOM APIs, CSSOM, client-side rendering engines.
7
+
8
+ ---
9
+
10
+ ## 2. Engineering & Architecture Characteristics
11
+
12
+ - **Design System & Tokens**: Strict adherence to design tokens (colors, spacing, typography, elevation). Zero arbitrary hardcoded hex codes or ad-hoc margins.
13
+ - **Component Hierarchy**: Clear separation between dumb presentational components, smart container components, and global state hooks.
14
+ - **Semantic HTML**: Proper use of `<main>`, `<nav>`, `<article>`, `<header>`, `<button>`, `<dialog>` rather than nested `<div>` soup.
15
+ - **Client State Management**: Explicit tracking of loading, error, empty, and populated UI states.
16
+
17
+ ---
18
+
19
+ ## 3. Verification Expectations
20
+
21
+ When working in a `web-app` repository, deterministic verification should prioritize:
22
+
23
+ 1. **Component & Unit Testing**: Vitest / Jest + React Testing Library (verifying user-facing interactions, role queries, and state transitions).
24
+ 2. **Type Safety**: `tsc --noEmit` on frontend types, props, and API response shapes.
25
+ 3. **Linting & Accessibility**: `eslint-plugin-jsx-a11y`, CSS linting.
26
+ 4. **Build & Bundling**: Production bundle build (`npm run build`) ensuring zero missing assets, broken imports, or bundle size regressions.
27
+ 5. **Browser Verification**: When visual changes occur, run Playwright / Cypress smoke tests or DOM inspections.
28
+
29
+ ---
30
+
31
+ ## 4. Active Review Domains for Devil's Advocate
32
+
33
+ When reviewing diffs in a `web-app` project, the [Devil's Advocate](file:///Users/egagofur/Development/work/ai-engineering-loop/agents/devil-advocate.md) activates these targeted checks:
34
+
35
+ ```mermaid
36
+ flowchart LR
37
+ DA[Devil's Advocate] --> R1[1. UI & Responsive Layout]
38
+ DA --> R2[2. Accessibility: a11y & ARIA]
39
+ DA --> R3[3. Client State & Lifecycle]
40
+ DA --> R4[4. Core Web Vitals & Performance]
41
+ DA --> R5[5. Web Security: XSS & CSRF]
42
+ DA --> R6[6. Component Testing Gaps]
43
+ ```
44
+
45
+ ### 1. UI & Responsive Layout
46
+ - Does the layout break or overflow horizontally on small viewport widths (320px–390px)?
47
+ - Are modal dialogs, popovers, and dropdowns properly trapped or positioned using standard APIs?
48
+ - Are dark/light theme tokens respected?
49
+
50
+ ### 2. Accessibility (a11y)
51
+ - Are interactive elements accessible via keyboard (`Tab`, `Enter`, `Escape`)?
52
+ - Do icons have `aria-hidden="true"` or descriptive text for screen readers?
53
+ - Are color contrast ratios compliant with WCAG AA standards?
54
+
55
+ ### 3. Client State & Lifecycle
56
+ - Are event listeners, interval timers, and WebSocket subscriptions cleaned up on unmount?
57
+ - Are loading skeletons and error retry banners implemented for async network fetches?
58
+
59
+ ### 4. Core Web Vitals & Performance
60
+ - Are images optimized with explicit `width`, `height`, and modern formats (`webp`, `avif`)?
61
+ - Does the change introduce heavy client-side dependencies that inflate bundle size?
62
+
63
+ ### 5. Web Security
64
+ - Is user-generated content safely escaped to prevent Cross-Site Scripting (XSS)?
65
+ - Are sensitive auth tokens kept in `HttpOnly` cookies rather than `localStorage` where appropriate?
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # AI Engineering Loop — One-line Project Initializer
4
+ # Usage: curl -fsSL https://raw.githubusercontent.com/egagofur/ai-engineering-loop/main/scripts/init.sh | bash
5
+
6
+ set -e
7
+
8
+ echo -e "\033[1;36m==> AI Engineering Loop: Initializing Project Context...\033[0m"
9
+
10
+ if [ -d ".ai-engineering-loop" ]; then
11
+ echo -e "\033[1;32m✓ .ai-engineering-loop/ already exists in this repository.\033[0m"
12
+ exit 0
13
+ fi
14
+
15
+ mkdir -p .ai-engineering-loop
16
+
17
+ # Detect project name
18
+ PROJECT_NAME=$(basename "$PWD")
19
+ PROFILE="backend-api"
20
+
21
+ # Infer basic profile
22
+ if [ -f "pnpm-workspace.yaml" ] || [ -f "turbo.json" ] || [ -d "apps" ]; then
23
+ PROFILE="monorepo"
24
+ elif [ -f "next.config.js" ] || [ -f "next.config.mjs" ] || [ -f "vite.config.ts" ]; then
25
+ PROFILE="web-app"
26
+ elif [ -f "pubspec.yaml" ]; then
27
+ PROFILE="mobile-app"
28
+ elif [ -f "go.mod" ] || [ -f "Cargo.toml" ] || [ -f "requirements.txt" ]; then
29
+ PROFILE="backend-api"
30
+ fi
31
+
32
+ echo "Creating .ai-engineering-loop/ with profile: $PROFILE"
33
+
34
+ cat <<EOF > .ai-engineering-loop/config.md
35
+ # Project Configuration
36
+
37
+ ## Metadata
38
+ - **project_name**: "$PROJECT_NAME"
39
+ - **project_profile**: "$PROFILE"
40
+ - **default_base_branch**: "main"
41
+ EOF
42
+
43
+ cat <<EOF > .ai-engineering-loop/architecture.md
44
+ # Project Architecture
45
+
46
+ ## System Overview
47
+ Discovered architecture for $PROJECT_NAME ($PROFILE).
48
+
49
+ ## Boundary Invariants
50
+ - Preserve existing component boundaries and module isolation.
51
+ - Zero cyclic dependencies.
52
+ EOF
53
+
54
+ cat <<EOF > .ai-engineering-loop/conventions.md
55
+ # Project Conventions
56
+
57
+ ## Code Standards
58
+ - File naming: kebab-case or standard project convention.
59
+ - Error handling: Use domain-specific errors; zero empty catch blocks.
60
+
61
+ ## Forbidden Anti-Patterns
62
+ - Zero speculative TODOs or dead code.
63
+ - Never commit private secrets or credentials.
64
+ EOF
65
+
66
+ cat <<EOF > .ai-engineering-loop/verification.md
67
+ # Project Verification Commands
68
+
69
+ ## Commands
70
+ - **test_unit**: \`npm test\`
71
+ - **typecheck**: \`npx tsc --noEmit\`
72
+ - **lint**: \`npx eslint --fix\`
73
+ - **build**: \`npm run build\`
74
+ EOF
75
+
76
+ cat <<EOF > .ai-engineering-loop/adapter.md
77
+ # Project Delivery Adapter Configuration
78
+
79
+ ## Delivery Pipeline
80
+ - **adapter_type**: "standard"
81
+ - **default_target_branch**: "main"
82
+ EOF
83
+
84
+ echo -e "\033[1;32m✓ .ai-engineering-loop/ successfully initialized!\033[0m"
85
+ echo -e "You can now run the AI Engineering Loop on this repository."
@@ -0,0 +1,11 @@
1
+ # Project Delivery Adapter Configuration
2
+
3
+ ## Delivery Settings
4
+ - **adapter_type**: "github" # dot | github | gitlab | custom
5
+ - **repository**: "organization/my-service"
6
+ - **default_target_branch**: "main"
7
+ - **notification_webhook**: "https://hooks.slack.com/services/..." # Optional
8
+
9
+ ## Multi-Branch Settings (If applicable)
10
+ - **enable_multi_branch**: false
11
+ - **branches**: []
@@ -0,0 +1,15 @@
1
+ # Project Architecture
2
+
3
+ ## System Overview
4
+ [Brief summary of what this project does and its core domain responsibility.]
5
+
6
+ ## Layers & Directory Boundaries
7
+ - `src/controllers/`: Ingress HTTP / RPC controllers. Validates input schemas, delegates to services.
8
+ - `src/services/`: Pure business logic and domain lifecycle workflows.
9
+ - `src/repositories/`: Database queries and ORM operations.
10
+ - `src/integrations/`: Third-party API clients and message brokers.
11
+
12
+ ## Critical Invariants
13
+ - Controllers must never execute direct database queries.
14
+ - Repositories must never handle HTTP request or response objects.
15
+ - All transactional workflows spanning $>1$ repository write must use `prisma.$transaction`.
@@ -0,0 +1,11 @@
1
+ # Project Configuration
2
+
3
+ ## Metadata
4
+ - **project_name**: "my-service"
5
+ - **project_profile**: "backend-api" # web-app | backend-api | mobile-app | library | monorepo
6
+ - **languages**:
7
+ - TypeScript (Node.js 20.x)
8
+ - **frameworks**:
9
+ - NestJS
10
+ - Prisma ORM
11
+ - **default_base_branch**: "main"
@@ -0,0 +1,16 @@
1
+ # Project Conventions
2
+
3
+ ## Code Standards & Style
4
+ - File naming: `kebab-case.ts` (e.g. `user-service.ts`, `auth-guard.ts`).
5
+ - Test file placement: Colocated `*.spec.ts` alongside implementation.
6
+ - Types: Explicit return types on all exported service functions.
7
+
8
+ ## Error Handling
9
+ - Use domain errors inheriting from `AppException(message, status, code)`.
10
+ - Never throw generic `new Error()`.
11
+ - Never leave empty catch blocks.
12
+
13
+ ## Forbidden Anti-Patterns
14
+ - Zero `any` types (use `unknown` with type guards).
15
+ - Zero raw unescaped SQL strings.
16
+ - Do not import external modules directly into domain entities.
@@ -0,0 +1,13 @@
1
+ # Project Verification Commands
2
+
3
+ ## Commands
4
+ - **test_unit**: `npm run test:unit`
5
+ - **test_all**: `npm run test`
6
+ - **typecheck**: `npx tsc --noEmit`
7
+ - **lint**: `npx eslint --fix`
8
+ - **build**: `npm run build`
9
+ - **e2e**: `npm run test:e2e` # Optional
10
+
11
+ ## Verification Notes
12
+ - Unit test suite should complete within 30 seconds.
13
+ - Database integration tests require test container (`docker compose up -d postgres-test`).