diff --git a/.agents/skills/Amazon-ad-console/SKILL.md b/.agents/skills/Amazon-ad-console/SKILL.md new file mode 100644 index 0000000..3f424e6 --- /dev/null +++ b/.agents/skills/Amazon-ad-console/SKILL.md @@ -0,0 +1,136 @@ +```markdown +# Amazon-ad-console Development Patterns + +> Auto-generated skill from repository analysis + +## Overview + +This skill teaches you the core development patterns, coding conventions, and workflows used in the `Amazon-ad-console` TypeScript codebase. You'll learn how to follow the repository's conventions for file naming, imports/exports, commit messages, and testing. You'll also get step-by-step guidance for common bugfix workflows, including how to ensure all fixes are properly tested and committed. + +## Coding Conventions + +### File Naming + +- **Files:** Use `camelCase` for file names. + - Example: `adEngine.ts`, `adConsoleStore.ts` + +### Import Style + +- **Mixed imports:** Both default and named imports are used as appropriate. + - Example: + ```typescript + import React from 'react'; + import { fetchAds, updateAd } from './adEngine'; + ``` + +### Export Style + +- **Named exports** are preferred. + - Example: + ```typescript + // adEngine.ts + export function fetchAds() { /* ... */ } + export function updateAd() { /* ... */ } + ``` + +### Commit Messages + +- **Conventional commits** are used. +- Prefixes like `fix` are common. +- Messages are concise (~63 characters on average). + - Example: `fix: correct ad targeting logic in engine` + +## Workflows + +### Engine Bugfix with Test + +**Trigger:** When you discover a bug in the core logic or feature engine and want to fix it and ensure it doesn't regress. +**Command:** `/engine-bugfix` + +1. **Identify and fix the bug** in the relevant engine or feature file: + - `src/engine/ad-console/core/engine/*.ts` + - `src/engine/ad-console/features/*/engine.ts` + - `src/engine/ad-console/features/*/store.ts` + - `src/engine/ad-console/core/slices/*.ts` +2. **Add or update a test** in the corresponding `__tests__` directory to cover the fixed behavior: + - `src/engine/ad-console/core/__tests__/*.test.ts` + - `src/engine/ad-console/features/*/__tests__/*.test.ts` +3. **Commit both the implementation and the test together.** + - Example commit message: `fix: handle edge case in ad budget calculation` + +**Example:** +```typescript +// src/engine/ad-console/core/engine/adBudget.ts +export function calculateBudget(ad) { + // fixed logic here +} + +// src/engine/ad-console/core/__tests__/adBudget.test.ts +import { calculateBudget } from '../engine/adBudget'; +import { describe, it, expect } from 'vitest'; + +describe('calculateBudget', () => { + it('handles zero budget', () => { + expect(calculateBudget({ budget: 0 })).toBe(0); + }); +}); +``` + +--- + +### API Route Bugfix with Test + +**Trigger:** When you need to fix a bug in an API endpoint's logic and ensure correct behavior with a test. +**Command:** `/api-bugfix` + +1. **Fix the bug** in the relevant API route file: + - `src/app/api/*/route.ts` +2. **Add or update a test** in the corresponding `__tests__` directory for that route: + - `src/app/api/*/__tests__/route.test.ts` +3. **Commit both the route and its test together.** + - Example commit message: `fix: correct response for ad stats API` + +**Example:** +```typescript +// src/app/api/stats/route.ts +export function getAdStats(req, res) { + // fixed API logic here +} + +// src/app/api/stats/__tests__/route.test.ts +import { getAdStats } from '../route'; +import { describe, it, expect } from 'vitest'; + +describe('getAdStats', () => { + it('returns correct stats for valid ad', () => { + // test logic here + }); +}); +``` + +## Testing Patterns + +- **Framework:** [vitest](https://vitest.dev/) +- **Test files:** Use the pattern `*.test.ts` and are located in `__tests__` directories adjacent to the code. +- **Test structure:** Use `describe`, `it`, and `expect` for organizing and writing tests. + +**Example:** +```typescript +// src/engine/ad-console/core/__tests__/adEngine.test.ts +import { someFunction } from '../engine/adEngine'; +import { describe, it, expect } from 'vitest'; + +describe('someFunction', () => { + it('returns expected result', () => { + expect(someFunction()).toBe('expected'); + }); +}); +``` + +## Commands + +| Command | Purpose | +|-----------------|-------------------------------------------------------| +| /engine-bugfix | Fix a bug in engine/feature logic and add a test | +| /api-bugfix | Fix a bug in an API route and add a test | +``` diff --git a/.agents/skills/Amazon-ad-console/agents/openai.yaml b/.agents/skills/Amazon-ad-console/agents/openai.yaml new file mode 100644 index 0000000..c6a4df7 --- /dev/null +++ b/.agents/skills/Amazon-ad-console/agents/openai.yaml @@ -0,0 +1,6 @@ +interface: + display_name: "Amazon Ad Console" + short_description: "Repo-specific patterns and workflows for Amazon-ad-console" + default_prompt: "Use the Amazon-ad-console repo skill to follow existing architecture, testing, and workflow conventions." +policy: + allow_implicit_invocation: true \ No newline at end of file diff --git a/.claude/commands/api-route-bugfix-with-test.md b/.claude/commands/api-route-bugfix-with-test.md new file mode 100644 index 0000000..619f742 --- /dev/null +++ b/.claude/commands/api-route-bugfix-with-test.md @@ -0,0 +1,36 @@ +--- +name: api-route-bugfix-with-test +description: Workflow command scaffold for api-route-bugfix-with-test in Amazon-ad-console. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /api-route-bugfix-with-test + +Use this workflow when working on **api-route-bugfix-with-test** in `Amazon-ad-console`. + +## Goal + +Fixes a bug in an API route handler and adds or updates a test to verify the fix. + +## Common Files + +- `src/app/api/*/route.ts` +- `src/app/api/*/__tests__/route.test.ts` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Fix the bug in the relevant API route file (e.g., /api/*/route.ts). +- Add or update a test in the corresponding __tests__ directory for that route. +- Commit both the route and its test together. + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/commands/engine-bugfix-with-test.md b/.claude/commands/engine-bugfix-with-test.md new file mode 100644 index 0000000..f4ea94e --- /dev/null +++ b/.claude/commands/engine-bugfix-with-test.md @@ -0,0 +1,40 @@ +--- +name: engine-bugfix-with-test +description: Workflow command scaffold for engine-bugfix-with-test in Amazon-ad-console. +allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"] +--- + +# /engine-bugfix-with-test + +Use this workflow when working on **engine-bugfix-with-test** in `Amazon-ad-console`. + +## Goal + +Fixes a bug in a core engine or feature logic file and adds or updates a corresponding test to cover the fixed behavior. + +## Common Files + +- `src/engine/ad-console/core/engine/*.ts` +- `src/engine/ad-console/features/*/engine.ts` +- `src/engine/ad-console/features/*/store.ts` +- `src/engine/ad-console/core/slices/*.ts` +- `src/engine/ad-console/core/__tests__/*.test.ts` +- `src/engine/ad-console/features/*/__tests__/*.test.ts` + +## Suggested Sequence + +1. Understand the current state and failure mode before editing. +2. Make the smallest coherent change that satisfies the workflow goal. +3. Run the most relevant verification for touched files. +4. Summarize what changed and what still needs review. + +## Typical Commit Signals + +- Identify and fix the bug in the relevant engine or feature file (e.g., core/engine/*.ts, features/*/engine.ts, features/*/store.ts). +- Add or update a test in the corresponding __tests__ directory to cover the fixed behavior. +- Commit both the implementation and the test together. + +## Notes + +- Treat this as a scaffold, not a hard-coded script. +- Update the command if the workflow evolves materially. \ No newline at end of file diff --git a/.claude/ecc-tools.json b/.claude/ecc-tools.json new file mode 100644 index 0000000..f9c61ce --- /dev/null +++ b/.claude/ecc-tools.json @@ -0,0 +1,273 @@ +{ + "version": "1.3", + "schemaVersion": "1.0", + "generatedBy": "ecc-tools", + "generatedAt": "2026-08-03T07:48:46.391Z", + "repo": "https://github.com/projectamazonph/Amazon-ad-console", + "referenceSetReadiness": { + "score": 0, + "present": 0, + "total": 7, + "items": [ + { + "id": "deep-analyzer-corpus", + "label": "Deep analyzer corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions." + }, + { + "id": "rag-evaluator", + "label": "RAG/evaluator comparison", + "status": "missing", + "evidence": [], + "recommendation": "Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior." + }, + { + "id": "pr-salvage", + "label": "PR salvage/review corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation." + }, + { + "id": "discussion-triage", + "label": "Discussion triage corpus", + "status": "missing", + "evidence": [], + "recommendation": "Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications." + }, + { + "id": "harness-compatibility", + "label": "Harness compatibility", + "status": "missing", + "evidence": [], + "recommendation": "Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces." + }, + { + "id": "security-evidence", + "label": "Security evidence", + "status": "missing", + "evidence": [], + "recommendation": "Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs." + }, + { + "id": "ci-failure-mode", + "label": "CI failure-mode evidence", + "status": "missing", + "evidence": [], + "recommendation": "Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes." + } + ] + }, + "profiles": { + "requested": "developer", + "recommended": "developer", + "effective": "developer", + "requestedAlias": "developer", + "recommendedAlias": "developer", + "effectiveAlias": "developer" + }, + "requestedProfile": "developer", + "profile": "developer", + "recommendedProfile": "developer", + "effectiveProfile": "developer", + "tier": "free", + "requestedComponents": [ + "repo-baseline", + "workflow-automation" + ], + "selectedComponents": [ + "repo-baseline", + "workflow-automation" + ], + "requestedAddComponents": [], + "requestedRemoveComponents": [], + "blockedRemovalComponents": [], + "tierFilteredComponents": [], + "requestedRootPackages": [ + "runtime-core", + "workflow-pack" + ], + "selectedRootPackages": [ + "runtime-core", + "workflow-pack" + ], + "requestedPackages": [ + "runtime-core", + "workflow-pack" + ], + "requestedAddPackages": [], + "requestedRemovePackages": [], + "selectedPackages": [ + "runtime-core", + "workflow-pack" + ], + "packages": [ + "runtime-core", + "workflow-pack" + ], + "blockedRemovalPackages": [], + "tierFilteredRootPackages": [], + "tierFilteredPackages": [], + "conflictingPackages": [], + "dependencyGraph": { + "runtime-core": [], + "workflow-pack": [ + "runtime-core" + ] + }, + "resolutionOrder": [ + "runtime-core", + "workflow-pack" + ], + "requestedModules": [ + "runtime-core", + "workflow-pack" + ], + "selectedModules": [ + "runtime-core", + "workflow-pack" + ], + "modules": [ + "runtime-core", + "workflow-pack" + ], + "managedFiles": [ + ".claude/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml", + ".claude/commands/engine-bugfix-with-test.md", + ".claude/commands/api-route-bugfix-with-test.md" + ], + "packageFiles": { + "runtime-core": [ + ".claude/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/engine-bugfix-with-test.md", + ".claude/commands/api-route-bugfix-with-test.md" + ] + }, + "moduleFiles": { + "runtime-core": [ + ".claude/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/SKILL.md", + ".agents/skills/Amazon-ad-console/agents/openai.yaml", + ".claude/identity.json", + ".codex/config.toml", + ".codex/AGENTS.md", + ".codex/agents/explorer.toml", + ".codex/agents/reviewer.toml", + ".codex/agents/docs-researcher.toml", + ".claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml" + ], + "workflow-pack": [ + ".claude/commands/engine-bugfix-with-test.md", + ".claude/commands/api-route-bugfix-with-test.md" + ] + }, + "files": [ + { + "moduleId": "runtime-core", + "path": ".claude/skills/Amazon-ad-console/SKILL.md", + "description": "Repository-specific Claude Code skill generated from git history." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/Amazon-ad-console/SKILL.md", + "description": "Codex-facing copy of the generated repository skill." + }, + { + "moduleId": "runtime-core", + "path": ".agents/skills/Amazon-ad-console/agents/openai.yaml", + "description": "Codex skill metadata so the repo skill appears cleanly in the skill interface." + }, + { + "moduleId": "runtime-core", + "path": ".claude/identity.json", + "description": "Suggested identity.json baseline derived from repository conventions." + }, + { + "moduleId": "runtime-core", + "path": ".codex/config.toml", + "description": "Repo-local Codex MCP and multi-agent baseline aligned with ECC defaults." + }, + { + "moduleId": "runtime-core", + "path": ".codex/AGENTS.md", + "description": "Codex usage guide that points at the generated repo skill and workflow bundle." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/explorer.toml", + "description": "Read-only explorer role config for Codex multi-agent work." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/reviewer.toml", + "description": "Read-only reviewer role config focused on correctness and security." + }, + { + "moduleId": "runtime-core", + "path": ".codex/agents/docs-researcher.toml", + "description": "Read-only docs researcher role config for API verification." + }, + { + "moduleId": "runtime-core", + "path": ".claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml", + "description": "Continuous-learning instincts derived from repository patterns." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/engine-bugfix-with-test.md", + "description": "Workflow command scaffold for engine-bugfix-with-test." + }, + { + "moduleId": "workflow-pack", + "path": ".claude/commands/api-route-bugfix-with-test.md", + "description": "Workflow command scaffold for api-route-bugfix-with-test." + } + ], + "workflows": [ + { + "command": "engine-bugfix-with-test", + "path": ".claude/commands/engine-bugfix-with-test.md" + }, + { + "command": "api-route-bugfix-with-test", + "path": ".claude/commands/api-route-bugfix-with-test.md" + } + ], + "adapters": { + "claudeCode": { + "skillPath": ".claude/skills/Amazon-ad-console/SKILL.md", + "identityPath": ".claude/identity.json", + "commandPaths": [ + ".claude/commands/engine-bugfix-with-test.md", + ".claude/commands/api-route-bugfix-with-test.md" + ] + }, + "codex": { + "configPath": ".codex/config.toml", + "agentsGuidePath": ".codex/AGENTS.md", + "skillPath": ".agents/skills/Amazon-ad-console/SKILL.md" + } + } +} \ No newline at end of file diff --git a/.claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml b/.claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml new file mode 100644 index 0000000..0cace79 --- /dev/null +++ b/.claude/homunculus/instincts/inherited/Amazon-ad-console-instincts.yaml @@ -0,0 +1,508 @@ +# Instincts generated from https://github.com/projectamazonph/Amazon-ad-console +# Generated: 2026-08-03T07:49:06.139Z +# Version: 2.0 +# NOTE: This file supplements (does not replace) any existing curated instincts. +# High-confidence manually curated instincts should be preserved alongside these. + +--- +id: Amazon-ad-console-commit-conventional +trigger: "when writing a commit message" +confidence: 0.85 +domain: git +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Commit Conventional + +## Action + +Use conventional commit format with prefixes: fix + +## Evidence + +- 13 commits analyzed +- Detected conventional commit pattern +- Examples: fix: persist all feature-slice state, not just core state, fix: duplicateCampaign no longer collapses multi-ad-group targets + +--- +id: Amazon-ad-console-commit-length +trigger: "when writing a commit message" +confidence: 0.6 +domain: git +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Commit Length + +## Action + +Write moderate-length commit messages (~63 characters) + +## Evidence + +- Average commit message length: 63 chars +- Based on 13 commits + +--- +id: Amazon-ad-console-naming-files +trigger: "when creating a new file" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Naming Files + +## Action + +Use camelCase naming convention + +## Evidence + +- Analyzed file naming patterns in repository +- Dominant pattern: camelCase + +--- +id: Amazon-ad-console-export-style +trigger: "when exporting from a module" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Export Style + +## Action + +Prefer named exports + +## Evidence + +- Export pattern analysis +- Dominant style: named + +--- +id: Amazon-ad-console-arch-type-based +trigger: "when adding new code" +confidence: 0.8 +domain: architecture +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Arch Type Based + +## Action + +Place code in the appropriate type folder (components/, services/, utils/, etc.) + +## Evidence + +- Type-based module organization detected +- Folders: app, engine, lib + +--- +id: Amazon-ad-console-test-framework +trigger: "when writing tests" +confidence: 0.9 +domain: testing +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Test Framework + +## Action + +Use vitest as the test framework + +## Evidence + +- Test framework detected: vitest +- File pattern: *.test.ts + +--- +id: Amazon-ad-console-test-naming +trigger: "when creating a test file" +confidence: 0.85 +domain: testing +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Test Naming + +## Action + +Name test files using the pattern: *.test.ts + +## Evidence + +- File pattern: *.test.ts +- Consistent across test files + +--- +id: Amazon-ad-console-test-mocking +trigger: "when mocking dependencies in tests" +confidence: 0.75 +domain: testing +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Test Mocking + +## Action + +Use vi.mock for mocking + +## Evidence + +- Mocking pattern detected: vi.mock +- Consistent across test files + +--- +id: Amazon-ad-console-test-types +trigger: "when planning tests for a feature" +confidence: 0.7 +domain: testing +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Test Types + +## Action + +Write unit, integration tests to match project standards + +## Evidence + +- Test types detected: unit, integration +- Coverage config: no + +--- +id: Amazon-ad-console-workflow-engine-bugfix-with-test +trigger: "when doing engine bugfix with test" +confidence: 0.7 +domain: workflow +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Workflow Engine Bugfix With Test + +## Action + +Follow the engine-bugfix-with-test workflow: +1. Identify and fix the bug in the relevant engine or feature file (e.g., core/engine/*.ts, features/*/engine.ts, features/*/store.ts). +2. Add or update a test in the corresponding __tests__ directory to cover the fixed behavior. +3. Commit both the implementation and the test together. + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~4x per month +- Files: src/engine/ad-console/core/engine/*.ts, src/engine/ad-console/features/*/engine.ts, src/engine/ad-console/features/*/store.ts + +--- +id: Amazon-ad-console-workflow-api-route-bugfix-with-test +trigger: "when doing api route bugfix with test" +confidence: 0.6 +domain: workflow +source: repo-analysis +source_repo: https://github.com/projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Workflow Api Route Bugfix With Test + +## Action + +Follow the api-route-bugfix-with-test workflow: +1. Fix the bug in the relevant API route file (e.g., /api/*/route.ts). +2. Add or update a test in the corresponding __tests__ directory for that route. +3. Commit both the route and its test together. + +## Evidence + +- Workflow detected from commit patterns +- Frequency: ~2x per month +- Files: src/app/api/*/route.ts, src/app/api/*/__tests__/route.test.ts + +--- +id: amazon-ad-console-instinct-file-naming +trigger: "When creating a new file in the codebase" +confidence: 0.85 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct File Naming + +## Action + +Name the file using camelCase + +## Evidence + +- Pattern in namingConventions.files +- Observed in src/app, src/engine, src/lib + +--- +id: amazon-ad-console-instinct-function-naming +trigger: "When defining a new function" +confidence: 0.85 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Function Naming + +## Action + +Use camelCase for the function name + +## Evidence + +- Pattern in namingConventions.functions + +--- +id: amazon-ad-console-instinct-class-naming +trigger: "When creating a new class" +confidence: 0.85 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Class Naming + +## Action + +Use PascalCase for the class name + +## Evidence + +- Pattern in namingConventions.classes + +--- +id: amazon-ad-console-instinct-constant-naming +trigger: "When declaring a constant" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Constant Naming + +## Action + +Use SCREAMING_SNAKE_CASE for the constant name + +## Evidence + +- Pattern in namingConventions.constants + +--- +id: amazon-ad-console-instinct-import-style +trigger: "When importing modules" +confidence: 0.7 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Import Style + +## Action + +Use a mixed import style as appropriate for the context + +## Evidence + +- Pattern in importStyle: mixed +- Seen in various src files + +--- +id: amazon-ad-console-instinct-export-style +trigger: "When exporting modules or functions" +confidence: 0.8 +domain: code-style +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Export Style + +## Action + +Prefer named exports + +## Evidence + +- Pattern in exportStyle: named + +--- +id: amazon-ad-console-instinct-test-file-pattern +trigger: "When adding a new test file" +confidence: 0.9 +domain: testing +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Test File Pattern + +## Action + +Name the test file with the pattern *.test.ts + +## Evidence + +- Pattern in testing.filePattern +- Files in __tests__ directories + +--- +id: amazon-ad-console-instinct-test-framework +trigger: "When writing tests" +confidence: 0.9 +domain: testing +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Test Framework + +## Action + +Use the vitest framework + +## Evidence + +- Pattern in testing.framework +- Seen in test imports + +--- +id: amazon-ad-console-instinct-mocking +trigger: "When mocking dependencies in tests" +confidence: 0.85 +domain: testing +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Mocking + +## Action + +Use vi.mock for mocking + +## Evidence + +- Pattern in testing.mockingStyle + +--- +id: amazon-ad-console-instinct-test-type +trigger: "When deciding on test granularity" +confidence: 0.8 +domain: testing +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Test Type + +## Action + +Write both unit and integration tests as appropriate + +## Evidence + +- Pattern in testing.testTypes + +--- +id: amazon-ad-console-instinct-git-commit-format +trigger: "When making a commit" +confidence: 0.9 +domain: git +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Git Commit Format + +## Action + +Use the conventional commit format with a prefix (e.g., fix: ...) + +## Evidence + +- Pattern in commits.type: conventional +- Examples: fix: ... + +--- +id: amazon-ad-console-instinct-git-commit-length +trigger: "When writing a commit message" +confidence: 0.7 +domain: git +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Git Commit Length + +## Action + +Keep the commit message concise, around 60 characters + +## Evidence + +- Pattern in commits.averageLength: 63 + +--- +id: amazon-ad-console-instinct-engine-bugfix-workflow +trigger: "When a bug is found in core engine or feature logic" +confidence: 0.95 +domain: workflow +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Engine Bugfix Workflow + +## Action + +Fix the bug and add or update a test in the corresponding __tests__ directory; commit both together + +## Evidence + +- Workflow: engine-bugfix-with-test +- Files: src/engine/ad-console/core/engine/*.ts, __tests__/*.test.ts + +--- +id: amazon-ad-console-instinct-api-route-bugfix-workflow +trigger: "When a bug is found in an API route handler" +confidence: 0.9 +domain: workflow +source: repo-analysis +source_repo: projectamazonph/Amazon-ad-console +--- + +# Amazon Ad Console Instinct Api Route Bugfix Workflow + +## Action + +Fix the bug and add or update a test in the corresponding __tests__ directory; commit both together + +## Evidence + +- Workflow: api-route-bugfix-with-test +- Files: src/app/api/*/route.ts, __tests__/route.test.ts + diff --git a/.claude/identity.json b/.claude/identity.json new file mode 100644 index 0000000..9ed23c3 --- /dev/null +++ b/.claude/identity.json @@ -0,0 +1,14 @@ +{ + "version": "2.0", + "technicalLevel": "technical", + "preferredStyle": { + "verbosity": "minimal", + "codeComments": true, + "explanations": true + }, + "domains": [ + "typescript" + ], + "suggestedBy": "ecc-tools-repo-analysis", + "createdAt": "2026-08-03T07:49:06.139Z" +} \ No newline at end of file diff --git a/.claude/skills/Amazon-ad-console/SKILL.md b/.claude/skills/Amazon-ad-console/SKILL.md new file mode 100644 index 0000000..3f424e6 --- /dev/null +++ b/.claude/skills/Amazon-ad-console/SKILL.md @@ -0,0 +1,136 @@ +```markdown +# Amazon-ad-console Development Patterns + +> Auto-generated skill from repository analysis + +## Overview + +This skill teaches you the core development patterns, coding conventions, and workflows used in the `Amazon-ad-console` TypeScript codebase. You'll learn how to follow the repository's conventions for file naming, imports/exports, commit messages, and testing. You'll also get step-by-step guidance for common bugfix workflows, including how to ensure all fixes are properly tested and committed. + +## Coding Conventions + +### File Naming + +- **Files:** Use `camelCase` for file names. + - Example: `adEngine.ts`, `adConsoleStore.ts` + +### Import Style + +- **Mixed imports:** Both default and named imports are used as appropriate. + - Example: + ```typescript + import React from 'react'; + import { fetchAds, updateAd } from './adEngine'; + ``` + +### Export Style + +- **Named exports** are preferred. + - Example: + ```typescript + // adEngine.ts + export function fetchAds() { /* ... */ } + export function updateAd() { /* ... */ } + ``` + +### Commit Messages + +- **Conventional commits** are used. +- Prefixes like `fix` are common. +- Messages are concise (~63 characters on average). + - Example: `fix: correct ad targeting logic in engine` + +## Workflows + +### Engine Bugfix with Test + +**Trigger:** When you discover a bug in the core logic or feature engine and want to fix it and ensure it doesn't regress. +**Command:** `/engine-bugfix` + +1. **Identify and fix the bug** in the relevant engine or feature file: + - `src/engine/ad-console/core/engine/*.ts` + - `src/engine/ad-console/features/*/engine.ts` + - `src/engine/ad-console/features/*/store.ts` + - `src/engine/ad-console/core/slices/*.ts` +2. **Add or update a test** in the corresponding `__tests__` directory to cover the fixed behavior: + - `src/engine/ad-console/core/__tests__/*.test.ts` + - `src/engine/ad-console/features/*/__tests__/*.test.ts` +3. **Commit both the implementation and the test together.** + - Example commit message: `fix: handle edge case in ad budget calculation` + +**Example:** +```typescript +// src/engine/ad-console/core/engine/adBudget.ts +export function calculateBudget(ad) { + // fixed logic here +} + +// src/engine/ad-console/core/__tests__/adBudget.test.ts +import { calculateBudget } from '../engine/adBudget'; +import { describe, it, expect } from 'vitest'; + +describe('calculateBudget', () => { + it('handles zero budget', () => { + expect(calculateBudget({ budget: 0 })).toBe(0); + }); +}); +``` + +--- + +### API Route Bugfix with Test + +**Trigger:** When you need to fix a bug in an API endpoint's logic and ensure correct behavior with a test. +**Command:** `/api-bugfix` + +1. **Fix the bug** in the relevant API route file: + - `src/app/api/*/route.ts` +2. **Add or update a test** in the corresponding `__tests__` directory for that route: + - `src/app/api/*/__tests__/route.test.ts` +3. **Commit both the route and its test together.** + - Example commit message: `fix: correct response for ad stats API` + +**Example:** +```typescript +// src/app/api/stats/route.ts +export function getAdStats(req, res) { + // fixed API logic here +} + +// src/app/api/stats/__tests__/route.test.ts +import { getAdStats } from '../route'; +import { describe, it, expect } from 'vitest'; + +describe('getAdStats', () => { + it('returns correct stats for valid ad', () => { + // test logic here + }); +}); +``` + +## Testing Patterns + +- **Framework:** [vitest](https://vitest.dev/) +- **Test files:** Use the pattern `*.test.ts` and are located in `__tests__` directories adjacent to the code. +- **Test structure:** Use `describe`, `it`, and `expect` for organizing and writing tests. + +**Example:** +```typescript +// src/engine/ad-console/core/__tests__/adEngine.test.ts +import { someFunction } from '../engine/adEngine'; +import { describe, it, expect } from 'vitest'; + +describe('someFunction', () => { + it('returns expected result', () => { + expect(someFunction()).toBe('expected'); + }); +}); +``` + +## Commands + +| Command | Purpose | +|-----------------|-------------------------------------------------------| +| /engine-bugfix | Fix a bug in engine/feature logic and add a test | +| /api-bugfix | Fix a bug in an API route and add a test | +``` diff --git a/.codex/AGENTS.md b/.codex/AGENTS.md new file mode 100644 index 0000000..6856194 --- /dev/null +++ b/.codex/AGENTS.md @@ -0,0 +1,27 @@ +# ECC for Codex CLI + +This supplements the root `AGENTS.md` with a repo-local ECC baseline. + +## Repo Skill + +- Repo-generated Codex skill: `.agents/skills/Amazon-ad-console/SKILL.md` +- Claude-facing companion skill: `.claude/skills/Amazon-ad-console/SKILL.md` +- Keep user-specific credentials and private MCPs in `~/.codex/config.toml`, not in this repo. + +## MCP Baseline + +Treat `.codex/config.toml` as the default ECC-safe baseline for work in this repository. +The generated baseline enables GitHub, Context7, Exa, Memory, Playwright, and Sequential Thinking. + +## Multi-Agent Support + +- Explorer: read-only evidence gathering +- Reviewer: correctness, security, and regression review +- Docs researcher: API and release-note verification + +## Workflow Files + +- `.claude/commands/engine-bugfix-with-test.md` +- `.claude/commands/api-route-bugfix-with-test.md` + +Use these workflow files as reusable task scaffolds when the detected repository workflows recur. \ No newline at end of file diff --git a/.codex/agents/docs-researcher.toml b/.codex/agents/docs-researcher.toml new file mode 100644 index 0000000..0daae57 --- /dev/null +++ b/.codex/agents/docs-researcher.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Verify APIs, framework behavior, and release-note claims against primary documentation before changes land. +Cite the exact docs or file paths that support each claim. +Do not invent undocumented behavior. +""" \ No newline at end of file diff --git a/.codex/agents/explorer.toml b/.codex/agents/explorer.toml new file mode 100644 index 0000000..732df7a --- /dev/null +++ b/.codex/agents/explorer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "medium" +sandbox_mode = "read-only" + +developer_instructions = """ +Stay in exploration mode. +Trace the real execution path, cite files and symbols, and avoid proposing fixes unless the parent agent asks for them. +Prefer targeted search and file reads over broad scans. +""" \ No newline at end of file diff --git a/.codex/agents/reviewer.toml b/.codex/agents/reviewer.toml new file mode 100644 index 0000000..b13ed9c --- /dev/null +++ b/.codex/agents/reviewer.toml @@ -0,0 +1,9 @@ +model = "gpt-5.4" +model_reasoning_effort = "high" +sandbox_mode = "read-only" + +developer_instructions = """ +Review like an owner. +Prioritize correctness, security, behavioral regressions, and missing tests. +Lead with concrete findings and avoid style-only feedback unless it hides a real bug. +""" \ No newline at end of file diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..bc1ee67 --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,48 @@ +#:schema https://developers.openai.com/codex/config-schema.json + +# ECC Tools generated Codex baseline +approval_policy = "on-request" +sandbox_mode = "workspace-write" +web_search = "live" + +[mcp_servers.github] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-github"] + +[mcp_servers.context7] +command = "npx" +args = ["-y", "@upstash/context7-mcp@latest"] + +[mcp_servers.exa] +url = "https://mcp.exa.ai/mcp" + +[mcp_servers.memory] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-memory"] + +[mcp_servers.playwright] +command = "npx" +args = ["-y", "@playwright/mcp@latest", "--extension"] + +[mcp_servers.sequential-thinking] +command = "npx" +args = ["-y", "@modelcontextprotocol/server-sequential-thinking"] + +[features] +multi_agent = true + +[agents] +max_threads = 6 +max_depth = 1 + +[agents.explorer] +description = "Read-only codebase explorer for gathering evidence before changes are proposed." +config_file = "agents/explorer.toml" + +[agents.reviewer] +description = "PR reviewer focused on correctness, security, and missing tests." +config_file = "agents/reviewer.toml" + +[agents.docs_researcher] +description = "Documentation specialist that verifies APIs, framework behavior, and release notes." +config_file = "agents/docs-researcher.toml" \ No newline at end of file