Files
iptvnator/AGENTS.md
T
4gray faad8fd8fd docs(agents): compact root guidance and preserve task-specific knowledge (#1645)
* docs(agents): compact root guidance and preserve task-specific knowledge

* fix(agents): parse guidance navigation with Markdown tokens

* fix(agents): validate generic literal repository paths

* fix(agents): distinguish code symbols and shortcut images

* fix(agents): recognize SCSS filename literals

* fix(agents): handle fenced imports and encoded paths

* fix(agents): parse prose and rendered HTML anchors

* fix(agents): validate rendered HTML navigation

* fix(agents): use GitHub-compatible heading slugs

* fix(agents): require standalone top-level Claude import

* fix(agents): exclude HTML-contained guidance imports

* fix(agents): handle image fragments and quoted imports

* fix(agents): validate visible HTML and image source sets

* fix(agents): recognize package scopes and route source work

* fix(agents): parse JSONC and constrain package exemptions

* fix(agents): decode link entities and allow package subpaths

* fix(agents): route source work and check extensionless files

* fix(agents): support package versions and source fragments

* fix(agents): accept qualified package prose

* fix(agents): retain rendered context for Markdown references

* fix(agents): validate visible headings and spaced paths

* fix(agents): validate media and hyphenated literal paths

* fix(agents): decode full HTML entities and media assets

* fix(agents): recognize possessive package mentions

* fix(agents): validate extensionless imports and version comparators

* fix(agents): retain visible backticks and explicit path punctuation

* fix(agents): validate image-map navigation targets

* fix(agents): count all Markdown line endings in budgets

* fix(agents): delimit package prose at Unicode punctuation

* fix(agents): normalize punctuation for extensionless imports

* fix(agents): preserve filenames across prose punctuation

* fix(agents): validate iframe document references

* fix(agents): inspect document suffix before URL fragments

* fix(agents): unify Markdown suffix and encoded import guards

* fix(agents): handle wildcard versions and alternate documents

* fix(agents): validate document formats and trim HTML URLs

* fix(agents): cover document families and guidance basenames

* fix(agents): require files for media references

* fix(agents): preserve block boundaries and validate embeds

* fix(agents): normalize internal HTML URL whitespace

* fix(agents): reject empty media and ignore URL at-signs

* fix(agents): validate srcdoc references and empty srcset

* fix(agents): honor HTML bases and preserve adjacent imports

* fix(agents): convert base file URLs to native paths

* fix(agents): preserve imports after bare URL punctuation

* fix(agents): exclude opaque URI prose from import scans

* fix(agents): keep import tokens outside URI scheme matches

* fix(agents): restrict opaque URI exemptions to parsed links

* fix(agents): handle opening prose delimiters

* fix(agents): scan nested imports and share document suffixes

* fix(agents): reject pathless media and direct file URLs

* fix(agents): reject file bases and preserve quoted URL boundaries

* fix(agents): distinguish URL quotes and cover guidance variants

* fix(agents): validate SVG images and conventional guides

* fix(agents): handle declared package names handles and SVG use

* fix(agents): normalize closing punctuation on federated handles

* fix(agents): normalize Unicode punctuation on handles

* fix(agents): normalize possessive federated handles

* fix(agents): separate parenthetical prose from handles

* fix(agents): exclude www autolinks from import scanning

* ci: allow manual CodeQL validation of PR branches

* fix(agents): reject nonportable Windows drive links
2026-09-21 18:07:14 +02:00

129 lines
8.1 KiB
Markdown

# Repository guidance
IPTVnator is an Angular/Electron IPTV player with a browser/PWA runtime.
These are the common instructions for all coding agents. Read the relevant
contracts below before changing a subsystem; do not load every document.
## Bootstrap and commands
- Use the Node version in `.nvmrc` and the repository's pnpm version.
- In a fresh worktree, run `pnpm install --frozen-lockfile` before Nx discovery,
tests, lint or builds. Each worktree needs its own install.
- Repeat the install after checkout changes, pulls, resets or rebases. Compare
`pnpm-lock.yaml` with `node_modules/.pnpm/lock.yaml`; a difference means stale
dependencies. Do not diagnose stale modules as application failures.
- Verify discovery with `pnpm nx show projects`. Inspect the owning project's
targets before choosing checks. Prefer the smallest relevant Nx target.
- Development: `pnpm run serve:frontend` or `pnpm run serve:backend`.
- Tests: `pnpm nx test <project>`; lint: `pnpm nx lint <project>`.
- Find checks and E2E commands in the [validation map](docs/architecture/validation-map.md).
- Packaging, native dependencies and runtime patches have additional contracts
in the context map; read them before dependency or release changes.
## Implementation invariants
- Use scoped aliases from `tsconfig.base.json`, such as `@iptvnator/services`.
Do not introduce legacy bare aliases or bypass public project boundaries.
- Nx projects keep `scope:*`, `domain:*` and `type:*` tags. Shared cross-project
files must belong to a project. SCSS imports need explicit hash dependencies.
- Target under 300 production TypeScript lines; the hard limit is 400 (1200
for tests), excluding comments/blanks. Never add entries to the legacy baseline.
- Preserve existing persisted data. Users may skip releases: migrations must
apply in dependency order, preserve data and be safe on repeated startup.
Test actual historical SQLite schemas, not only SQL mocks.
- Choose runtime behavior through the relevant capability contract; a generic
`window.electron` check does not prove that a particular bridge is available.
- Use shared redacting logging before emitting settings, portal or trace data.
Never log credentials or expanded SQL/bound values.
- Keep UI consistent with the shared guidelines. Read the repository UI/theme
skills before changing user-visible Angular views or shared styles.
## Validation and completion
- Before finishing, assess affected projects and test impact. Bug fixes normally
include regression coverage that fails before the fix and passes afterwards.
- Update stale tests, fixtures and E2E flows when behavior changes. Run targeted
unit checks and affected E2E for routing, persistence, playback and user flows.
- Electron-only IPC, database, packaging, players and filesystem changes need
Electron E2E where available, otherwise CDP/manual validation with a reason.
- Report checks and results, any skipped checks with reasons, documentation
changes, and whether a release note was added or why it was unnecessary.
- Every user-visible change needs a note under `.changes/`; follow the
[release-note format](.changes/README.md) and the repository release-notes skill.
Docs, tests, CI and behavior-preserving refactors do not need a note. Apply
`no-release-note` on exempt PRs touching runtime code.
- Validate notes with `pnpm run release:notes:validate`. Release publication has
separate ordered gates; follow the release-cut skill and release contract.
## Keep guidance small and canonical
- Update the affected subsystem's canonical document after meaningful changes.
Prefer an existing authoritative doc; keep user/developer entry points in
README and detailed contracts in architecture docs or a module README.
- Add to this file only repository-wide rules and navigation. Implementation
details, incident history and multi-step procedures belong in linked docs.
Do not duplicate subsystem contracts here or in CLAUDE.md.
- `AGENTS.md` is the single source of common rules. `CLAUDE.md` imports it and
contains only Claude-specific guidance. Limits: 200 lines / 16 KiB here,
30 lines / 2 KiB for CLAUDE.md. Do not raise loading limits to fit more prose.
- Read the [context map](docs/maintenance/agent-context-map.md) when ownership
is unclear. Read each affected domain for cross-domain tasks, not the whole map's documents.
- Preserve exceptions and rationale when moving knowledge. Correct stale facts
against code; do not silently discard a contract. Maintenance details are in
the [agent workflow](docs/development/agent-workflow.md).
- Never run whole-file `prettier --write` on AGENTS.md, CLAUDE.md or `docs/**`.
Edit only intended lines; upstream Markdown is not uniformly Prettier-clean.
- After changing guidance, run `pnpm run agents:validate`; after editing a
repository skill or a literal path it documents, run `pnpm run skills:validate`.
Keep release-cut and release-notes copies byte-identical for Codex and Claude.
- Save finalized plans only in `.plans/YYYY-MM-DD-short-topic.md`; if a filename
exists, append `-2`, `-3`, etc. Respect active mode restrictions on file writes;
if writing is forbidden, save the approved plan when execution starts.
## Read by task
| Task | Required starting point |
| --- | --- |
| Project layout, imports, dependencies, lint configuration | [Nx boundaries](docs/architecture/nx-workspace-boundaries.md) |
| Angular conventions, docs and skills maintenance | [Agent workflow](docs/development/agent-workflow.md) |
| Electron debugging, CDP, trace flags | [Electron debugging](docs/development/electron-debugging.md) |
| SQLite, worker IPC, persistence migrations | [DB worker](docs/architecture/sqlite-db-worker.md), [database migrations](libs/shared/database/README.md) |
| M3U, XMLTV, startup, source health, OS playlist opening | [M3U contracts](docs/architecture/m3u-playlist-module.md), [adding sources across layers](docs/development/agent-workflow.md#adding-behavior-across-layers) |
| Xtream / Stalker | [Xtream compatibility](docs/architecture/xtream-portal-compatibility.md), [Stalker contracts](docs/architecture/stalker-portal.md) (affected provider only) |
| Player controls, diagnostics, radio, keep-awake | [Controls contract](docs/architecture/player-controls-contract.md) |
| Embedded MPV, native runtime and packaging | [Embedded MPV](docs/architecture/embedded-mpv-native.md) |
| UI, keyboard, detail navigation, remote control | [UI guidelines](docs/architecture/iptvnator-ui-guidelines.md), then matching topic in context map |
| PWA, backend networking, connectivity guard | [PWA contract](docs/architecture/pwa-self-hosted.md), [host connectivity](docs/architecture/host-connectivity-guard.md) |
| Downloads, TMDB, multi-source, workspace, backup, website | [Context map](docs/maintenance/agent-context-map.md) |
| Release or packaging metadata | [Release pipeline](docs/architecture/release-pipeline.md), release-cut skill |
Repository skills live in `.codex/skills/`. Their frontmatter owns trigger
conditions; use the context map to locate a relevant skill. Read its linked
contract before editing. A missing optional global skill/tool is not a blocker:
use repository documentation and available CLI discovery.
<!-- nx configuration start-->
<!-- Leave the start & end comments to automatically receive updates. -->
## General Guidelines for working with Nx
- For workspace exploration, use the `nx-workspace` skill when available;
otherwise inspect project-local project.json files, `pnpm nx show projects` and `pnpm nx graph`.
- Run project tasks through local `pnpm nx`, not a global Nx installation.
- Use the Nx MCP server when available; otherwise use CLI discovery.
- Check `node_modules/@nx/<plugin>/PLUGIN.md` for plugin guidance when present.
- Never guess unfamiliar flags: consult `--help` or available `nx_docs`.
## Scaffolding and generators
- Use the `nx-generate` skill first when available. Otherwise discover the
generator with local Nx help and follow repository boundary rules.
## When to use nx_docs
- Use available `nx_docs` for migrations, unfamiliar configuration and flags.
- Basic task syntax does not require a docs lookup; generator discovery belongs
to the generator skill or local CLI help.
<!-- nx configuration end-->