255 lines
3.9 KiB
Markdown
255 lines
3.9 KiB
Markdown
# AGENT.md
|
|
|
|
## Scope
|
|
|
|
Applies to the full repository unless overridden by a deeper `AGENT.md`.
|
|
|
|
Stack:
|
|
- Angular 20
|
|
- Standalone components
|
|
- pnpm
|
|
- Docker
|
|
- RTK
|
|
|
|
---
|
|
|
|
|
|
# RTK RULES (MANDATORY)
|
|
|
|
Always prefer RTK commands.
|
|
|
|
Use:
|
|
|
|
- `rtk ls`
|
|
- `rtk grep`
|
|
- `rtk smart`
|
|
- `rtk read`
|
|
- `rtk git diff`
|
|
- `rtk git status`
|
|
|
|
Avoid raw:
|
|
- `cat`
|
|
- `grep`
|
|
- `rg`
|
|
- `tree`
|
|
- `git diff`
|
|
- recursive `find`
|
|
|
|
Use raw shell only for:
|
|
- builds
|
|
- runtime/debugging
|
|
- Docker
|
|
- pnpm
|
|
- commands RTK cannot perform
|
|
|
|
---
|
|
|
|
# FILE READING POLICY
|
|
|
|
Preferred order:
|
|
|
|
1. `rtk grep`
|
|
2. `rtk smart`
|
|
3. `rtk read`
|
|
|
|
Rules:
|
|
- Search before reading.
|
|
- Read only required files.
|
|
- Do not read TS/HTML/SCSS together unless required.
|
|
- Stop exploring once edit location is clear.
|
|
- Avoid rereading unchanged files.
|
|
|
|
Large files:
|
|
- `rtk read <file> -l aggressive`
|
|
|
|
---
|
|
|
|
# ANGULAR WORKFLOW
|
|
|
|
For components:
|
|
|
|
1. `rtk grep "<component-name>"`
|
|
2. `rtk smart component.ts`
|
|
3. Read template only if UI changes are required
|
|
4. Read styles only if styling changes are required
|
|
|
|
Avoid broad module inspection.
|
|
|
|
---
|
|
|
|
# TOKEN RULES
|
|
|
|
Do not:
|
|
- dump large files
|
|
- scan unrelated folders
|
|
- inspect generated directories
|
|
- perform repeated searches
|
|
- over-explain edits
|
|
|
|
Avoid:
|
|
- `dist/`
|
|
- `.angular/`
|
|
- `coverage/`
|
|
- `node_modules/`
|
|
- `.git/`
|
|
|
|
---
|
|
|
|
# CHANGE POLICY
|
|
|
|
- Keep changes minimal and scoped.
|
|
- Reuse existing patterns.
|
|
- Avoid unrelated refactors.
|
|
- Preserve tenant separation.
|
|
- Prefer root-cause fixes.
|
|
|
|
---
|
|
|
|
# PROJECT RULES
|
|
|
|
## Tenant Builds
|
|
|
|
- `default` → `dist/production`
|
|
- `tis` → `dist/tis`
|
|
|
|
Keep Docker `DIST_DIR` aligned with Angular output.
|
|
|
|
Do not use Angular `fileReplacements` for static assets.
|
|
|
|
---
|
|
|
|
## Input Component
|
|
|
|
File:
|
|
- `src/app/shared/components/input/input.component.ts`
|
|
|
|
For:
|
|
- `type="number"`
|
|
- `type="price"`
|
|
|
|
Requirements:
|
|
- normalize Persian/Arabic digits
|
|
- allow only digits and `.`
|
|
- support fixed precision
|
|
- keep identifier fields string-safe
|
|
|
|
---
|
|
|
|
## Shared Field Rules
|
|
|
|
When creating fields:
|
|
- use shared field wrappers
|
|
- reuse `app-input`
|
|
- register exports in shared indexes
|
|
- keep control names consistent
|
|
|
|
---
|
|
|
|
# VALIDATION
|
|
|
|
TypeScript:
|
|
- `pnpm -s exec tsc -p tsconfig.app.json --noEmit`
|
|
|
|
Docker:
|
|
- `docker compose build app_default`
|
|
- `docker compose build app_tis`
|
|
|
|
Validate only impacted areas when possible.
|
|
|
|
---
|
|
|
|
# FINAL RESPONSE RULES
|
|
|
|
Keep final responses under 10 lines unless:
|
|
- validation failed
|
|
- architecture changed
|
|
- user requested explanation
|
|
|
|
Prefer:
|
|
|
|
Updated:
|
|
- file1
|
|
- file2
|
|
|
|
Validation:
|
|
- tsc passed
|
|
|
|
|
|
# TARGETED READ RULES
|
|
|
|
Do not read files larger than 300 lines unless required.
|
|
|
|
For changes at a known location:
|
|
|
|
- read the surrounding symbol only
|
|
- avoid full-file reads
|
|
|
|
Prefer:
|
|
- rtk grep
|
|
- rtk smart
|
|
- targeted read
|
|
|
|
Avoid:
|
|
- opening 400+ line files for small edits
|
|
|
|
# REASONING OUTPUT RULES
|
|
|
|
Do not expose internal reasoning.
|
|
|
|
Never output:
|
|
- "I think..."
|
|
- "I'm considering..."
|
|
- "I wonder..."
|
|
- "Maybe..."
|
|
- implementation deliberation
|
|
- "It sounds..."
|
|
|
|
Never explain alternative approaches unless requested.
|
|
|
|
Use:
|
|
|
|
Inspecting confirmation dialog.
|
|
|
|
Updating async accept support.
|
|
|
|
Validation passed.
|
|
|
|
|
|
# INVESTIGATION LIMITS
|
|
|
|
For localized fixes:
|
|
|
|
- maximum 3 file reads before first edit
|
|
- maximum 1 related-file read unless required
|
|
|
|
Stop searching once the edit target is identified.
|
|
|
|
# REVIEW MODE
|
|
|
|
During reviews:
|
|
|
|
- inspect changed files only
|
|
- avoid loading unrelated dependencies
|
|
- avoid architecture exploration
|
|
- avoid repository-wide searches
|
|
|
|
Review only code directly affected by the diff.
|
|
|
|
|
|
# HARD TOKEN LIMITS
|
|
|
|
For localized fixes:
|
|
|
|
- Never read files larger than 300 lines unless the target symbol cannot be isolated.
|
|
- Never read an entire file when a symbol-level read is possible.
|
|
- Never read more than 5 total files before the first edit.
|
|
- Never open a file already summarized by `rtk smart` unless implementation details are required.
|
|
|
|
When a file exceeds 300 lines:
|
|
|
|
1. rtk grep
|
|
2. rtk smart
|
|
3. read only the relevant symbol/section
|
|
|
|
Avoid full-file reads.
|