@jterrats/open-orchestra 0.1.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 (93) hide show
  1. package/AGENTS.md +151 -0
  2. package/CLAUDE.md +157 -0
  3. package/README.md +60 -0
  4. package/bin/orchestra.js +8 -0
  5. package/dist/args.d.ts +3 -0
  6. package/dist/args.js +30 -0
  7. package/dist/args.js.map +1 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +190 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/commands.d.ts +44 -0
  12. package/dist/commands.js +883 -0
  13. package/dist/commands.js.map +1 -0
  14. package/dist/constants.d.ts +15 -0
  15. package/dist/constants.js +69 -0
  16. package/dist/constants.js.map +1 -0
  17. package/dist/defaults.d.ts +72 -0
  18. package/dist/defaults.js +694 -0
  19. package/dist/defaults.js.map +1 -0
  20. package/dist/fs-utils.d.ts +8 -0
  21. package/dist/fs-utils.js +35 -0
  22. package/dist/fs-utils.js.map +1 -0
  23. package/dist/model-providers.d.ts +19 -0
  24. package/dist/model-providers.js +78 -0
  25. package/dist/model-providers.js.map +1 -0
  26. package/dist/types.d.ts +550 -0
  27. package/dist/types.js +2 -0
  28. package/dist/types.js.map +1 -0
  29. package/dist/validation.d.ts +10 -0
  30. package/dist/validation.js +163 -0
  31. package/dist/validation.js.map +1 -0
  32. package/dist/web-api.d.ts +16 -0
  33. package/dist/web-api.js +220 -0
  34. package/dist/web-api.js.map +1 -0
  35. package/dist/web-chart-contracts.d.ts +13 -0
  36. package/dist/web-chart-contracts.js +13 -0
  37. package/dist/web-chart-contracts.js.map +1 -0
  38. package/dist/web-console.d.ts +1 -0
  39. package/dist/web-console.js +232 -0
  40. package/dist/web-console.js.map +1 -0
  41. package/dist/web-evidence.d.ts +25 -0
  42. package/dist/web-evidence.js +67 -0
  43. package/dist/web-evidence.js.map +1 -0
  44. package/dist/web-playwright.d.ts +3 -0
  45. package/dist/web-playwright.js +14 -0
  46. package/dist/web-playwright.js.map +1 -0
  47. package/dist/web-roles.d.ts +33 -0
  48. package/dist/web-roles.js +70 -0
  49. package/dist/web-roles.js.map +1 -0
  50. package/dist/workflow-gates.d.ts +7 -0
  51. package/dist/workflow-gates.js +291 -0
  52. package/dist/workflow-gates.js.map +1 -0
  53. package/dist/workflow-services.d.ts +56 -0
  54. package/dist/workflow-services.js +1240 -0
  55. package/dist/workflow-services.js.map +1 -0
  56. package/dist/workspace-validator.d.ts +6 -0
  57. package/dist/workspace-validator.js +189 -0
  58. package/dist/workspace-validator.js.map +1 -0
  59. package/dist/workspace.d.ts +10 -0
  60. package/dist/workspace.js +72 -0
  61. package/dist/workspace.js.map +1 -0
  62. package/docs/multi-agent-orchestrator-backlog.md +445 -0
  63. package/docs/multi-agent-orchestrator-sprint-1.md +433 -0
  64. package/docs/orchestra-mvp.md +176 -0
  65. package/package.json +63 -0
  66. package/rules/agent-collaboration.mdc +58 -0
  67. package/rules/agent-roles.mdc +105 -0
  68. package/rules/ai-assisted-development.mdc +31 -0
  69. package/rules/api-design.mdc +31 -0
  70. package/rules/architecture-decisions.mdc +27 -0
  71. package/rules/code-review-engineering.mdc +34 -0
  72. package/rules/concurrency-async.mdc +32 -0
  73. package/rules/configuration-management.mdc +31 -0
  74. package/rules/data-modeling-domain.mdc +31 -0
  75. package/rules/delivery-quality-gates.mdc +40 -0
  76. package/rules/dependency-management.mdc +31 -0
  77. package/rules/devops-tooling.mdc +55 -0
  78. package/rules/documentation-standards.mdc +26 -0
  79. package/rules/dry-clean-code.mdc +30 -0
  80. package/rules/error-handling.mdc +28 -0
  81. package/rules/frontend-engineering.mdc +32 -0
  82. package/rules/git-discipline.mdc +39 -0
  83. package/rules/infra-data-encryption.mdc +81 -0
  84. package/rules/performance-reliability.mdc +32 -0
  85. package/rules/readiness-done.mdc +32 -0
  86. package/rules/release-rollback.mdc +32 -0
  87. package/rules/rule-composition.mdc +28 -0
  88. package/rules/security-guardrails.mdc +37 -0
  89. package/rules/solid-architecture.mdc +32 -0
  90. package/rules/static-analysis-githooks.mdc +32 -0
  91. package/rules/testing-discipline.mdc +42 -0
  92. package/rules/ux-ui-product-experience.mdc +51 -0
  93. package/rules/work-intake-sequencing.mdc +39 -0
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Git workflow and commit hygiene — stack-agnostic
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Git Discipline
7
+
8
+ ## Commits
9
+ - Each commit must compile and pass tests. Never commit broken code.
10
+ - Ask for a **Backlog Item ID** before suggesting a commit message.
11
+ - Use Conventional Commits with the backlog item as scope: `type(ID): short description` (e.g., `feat(SA-42): add profile auto-detection`).
12
+ - Use imperative, lowercase summaries under 72 characters when practical.
13
+ - Body: numbered list of changes + a paragraph explaining the value proposition.
14
+ - Valid types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `perf`, `ci`, `build`, `style`, `revert`.
15
+ - Mark breaking changes with `!` after the type or scope and include a `BREAKING CHANGE:` footer.
16
+ - Do not mix unrelated semantic types in one commit. Split mixed work into separate commits.
17
+
18
+ ## Git Hooks
19
+ - A version-controlled pre-commit hook must run static analysis before every commit.
20
+ - Never bypass hooks with `--no-verify` unless the user explicitly approves and a follow-up item records the reason.
21
+ - For hook tooling and required checks, see **static-analysis-githooks.mdc**.
22
+
23
+ ## Atomic Changes
24
+ - One logical change per commit. Don't mix a bug fix with a refactor with a new feature.
25
+ - If a refactor is needed before a feature, commit the refactor first, then the feature.
26
+
27
+ ## Branches
28
+ - Branch from the latest main/develop. Rebase before opening a PR if your branch is stale.
29
+ - Branch names: `type/ID-short-description` (e.g., `feat/SA-42-profile-detection`).
30
+
31
+ ## Pull Requests
32
+ - PR title follows the same `type(ID): description` format as commits.
33
+ - PR body must include: summary (1-3 bullets), test plan, and any manual verification steps.
34
+ - Keep PRs small (<400 lines changed). If larger, split into stacked PRs or feature flags.
35
+ - PRs must link the backlog item and list any breaking changes, migrations, feature flags, or risk acceptances.
36
+
37
+ ## Code Review
38
+ - Review your own diff before requesting review. Catch the obvious issues yourself.
39
+ - Never approve a PR with unresolved conversations, failing CI, or missing tests.
@@ -0,0 +1,81 @@
1
+ ---
2
+ description: Infrastructure, data handling, encryption, and environment rules — stack-agnostic
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Infrastructure, Data & Encryption
7
+
8
+ When a project involves databases, cloud infrastructure, sensitive data, or multi-environment deployments, these rules apply without exception.
9
+
10
+ For DevOps tool categories, observability, SLOs, downtime strategy, scalability gates, and infrastructure reporting, see **devops-tooling.mdc**.
11
+
12
+ ## Environment Segregation
13
+
14
+ - **Isolated environments**: dev, staging, and production must be fully isolated — separate accounts/subscriptions, separate credentials, separate network boundaries.
15
+ - **No credential sharing**: each environment has its own secrets, service accounts, and IAM roles. Never reuse production credentials in dev/staging.
16
+ - **Promotion flow**: code moves through environments via CI/CD pipelines only. No manual deploys to staging or production.
17
+ - **Feature flags over environment branches**: prefer runtime feature flags to long-lived environment branches.
18
+
19
+ ## Infrastructure as Code (IaC)
20
+
21
+ - **All infrastructure must be reproducible**: use Terraform, Pulumi, CloudFormation, Bicep, or equivalent. No manual console/portal changes in staging or production.
22
+ - **State management**: IaC state files must be stored remotely (S3 + DynamoDB, Azure Blob, GCS) with locking. Never commit `.tfstate` to git.
23
+ - **Modular composition**: extract reusable modules for networking, compute, storage. Follow the same SRP principle as application code.
24
+ - **Drift detection**: run plan/preview in CI on every PR that touches infra. Alert on drift between declared and actual state.
25
+ - **Tagging & cost visibility**: every resource must be tagged with `project`, `environment`, and `owner`. Enable cost alerts per tag.
26
+
27
+ ## Database
28
+
29
+ - **Migrations are version-controlled**: use a migration framework (Flyway, Liquibase, Alembic, Prisma Migrate, knex). Never run DDL manually in production.
30
+ - **Migrations must be idempotent and reversible**: every `up` must have a corresponding `down`. Test rollbacks in staging.
31
+ - **Schema reviews**: DDL changes require the same review rigor as application code. Assess impact on indexes, constraints, and existing data.
32
+ - **Connection pooling**: always use connection pools (PgBouncer, HikariCP, etc.). Never open unbounded connections from application code.
33
+ - **Read replicas & caching**: for read-heavy workloads, use replicas. Cache hot data (Redis, Memcached) with explicit TTLs and invalidation strategies.
34
+
35
+ ## Encryption
36
+
37
+ ### At Rest
38
+ - **Default-on**: all databases, object storage (S3, Blob, GCS), and backups must have encryption at rest enabled. Use AES-256 or equivalent.
39
+ - **Key management**: use cloud KMS (AWS KMS, Azure Key Vault, GCP Cloud KMS). Application-managed keys only when KMS is not available.
40
+ - **Key rotation**: automate key rotation (annually minimum). Document the rotation procedure.
41
+
42
+ ### In Transit
43
+ - **TLS 1.2+ everywhere**: no plain HTTP, no self-signed certificates in staging or production. Enforce HSTS where applicable.
44
+ - **mTLS for service-to-service**: when services communicate over a network, prefer mutual TLS or service mesh (Istio, Linkerd).
45
+ - **Certificate management**: automate certificate provisioning (Let's Encrypt, ACM, cert-manager). Never commit private keys to repositories.
46
+
47
+ ### Sensitive Fields
48
+ - **Passwords**: never store plaintext. Use bcrypt, scrypt, or argon2 with per-user salt. Never MD5 or SHA-family for password hashing.
49
+ - **PII classification**: classify data fields at design time (public, internal, confidential, restricted). Document the classification in the data model.
50
+ - **Column-level encryption / tokenization**: for SSN, credit card numbers, health data — apply field-level encryption or tokenize before storage.
51
+ - **Audit trail**: log access to sensitive data (who, when, what). Use database audit logging or application-level audit events.
52
+
53
+ ## Secrets Management
54
+
55
+ - **Use a vault**: AWS Secrets Manager, Azure Key Vault, HashiCorp Vault, or GCP Secret Manager. Never `.env` files baked into container images.
56
+ - **Inject at runtime**: secrets are injected as environment variables at deployment time, never embedded in source code, config files, or CI logs.
57
+ - **Rotate on schedule**: automated rotation for database passwords, API keys, and service account credentials. Define rotation cadence per sensitivity.
58
+ - **Least privilege for secrets**: services access only the secrets they need. Use IAM policies / access policies to restrict scope.
59
+
60
+ ## Scalability
61
+
62
+ - **Horizontal over vertical**: design stateless services that scale out. Externalize state to databases, caches, or queues.
63
+ - **Rate limiting & throttling**: all public-facing APIs must implement rate limits. Internal services should have circuit breakers.
64
+ - **Async where possible**: offload long-running work to queues (SQS, Service Bus, RabbitMQ, Pub/Sub). Keep HTTP request handlers fast.
65
+ - **Observability**: metrics (latency, throughput, error rate), structured logs, and distributed tracing (OpenTelemetry) are mandatory for production services.
66
+ - **Load testing**: run load tests in staging before major releases. Define SLOs (latency p95/p99, availability %) and alert when breached.
67
+
68
+ ## Vulnerability Management
69
+
70
+ - **Dependency scanning**: run `npm audit`, `pip audit`, Snyk, or Dependabot on every PR. Block merge on critical/high CVEs.
71
+ - **Container scanning**: scan images for OS and library vulnerabilities before pushing to registry.
72
+ - **SAST/DAST**: integrate static analysis (CodeQL, SonarQube, Semgrep) and dynamic analysis in CI pipelines.
73
+ - **Patch cadence**: critical CVEs patched within 48 hours. High within 1 week. Medium within 1 sprint.
74
+ - **Incident response**: document the runbook for security incidents. Include contacts, escalation paths, and communication templates.
75
+
76
+ ## Backup & Disaster Recovery
77
+
78
+ - **Automated backups**: daily minimum for databases. Retention per compliance requirements (minimum 30 days).
79
+ - **Tested restores**: restore from backup at least quarterly. An untested backup is not a backup.
80
+ - **RPO/RTO per environment**: define Recovery Point Objective and Recovery Time Objective. Production RPO < 1 hour is a common baseline.
81
+ - **Multi-region for critical workloads**: if uptime SLA requires it, deploy active-passive or active-active across regions.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Performance budgets, reliability design, caching, and scalability safeguards
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Performance & Reliability
7
+
8
+ Performance and reliability must be designed, measured, and protected. Do not optimize blindly or defer obvious scalability risks.
9
+
10
+ ## Budgets
11
+ - Define expected latency, throughput, payload size, memory, storage, and concurrency for high-impact flows.
12
+ - User-facing flows should consider p95 and p99 latency, not only averages.
13
+ - Establish performance budgets for page weight, render time, API latency, and query count when applicable.
14
+ - If no budget exists, propose one before making risky design choices.
15
+
16
+ ## Hot Paths
17
+ - Avoid N+1 queries, unbounded loops with I/O, repeated serialization, and large synchronous work on request paths.
18
+ - Paginate or stream large datasets. Do not load unbounded result sets into memory.
19
+ - Keep expensive work outside user-facing request paths through queues, jobs, or precomputation.
20
+ - Measure before and after performance changes and report the evidence.
21
+
22
+ ## Caching
23
+ - Cache only with clear ownership, TTL, invalidation strategy, and stale-data behavior.
24
+ - Do not cache sensitive data unless storage, access, and expiration controls are explicit.
25
+ - Prefer simple, observable cache strategies before multi-layer cache complexity.
26
+ - Document cache keys and invalidation triggers for shared caches.
27
+
28
+ ## Reliability
29
+ - Design for graceful degradation when dependencies fail.
30
+ - Add timeouts, retries, backoff, and circuit breakers for networked dependencies.
31
+ - Use bulkheads or queues to protect critical paths from non-critical workload spikes.
32
+ - Reliability-sensitive changes need load, stress, or synthetic tests when practical.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Definition of Ready and Definition of Done for agent delivery
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Readiness & Done
7
+
8
+ Work must not start or finish by intuition. Use explicit entry and exit criteria so agents, users, and reviewers share the same expectations.
9
+
10
+ ## Definition of Ready
11
+ - Backlog item ID, user goal, acceptance criteria, non-goals, constraints, and priority are known.
12
+ - Backlog item exists as a GitHub issue and is technically refined before implementation.
13
+ - The proposed solution and architecture have been discussed with the user when the task is non-trivial.
14
+ - Required roles are identified, including the lead role and any mandatory reviewers.
15
+ - Data, API, UI, security, infrastructure, and migration impacts are either understood or explicitly marked as out of scope.
16
+ - Test strategy, expected evidence, and QA handoff expectations are clear.
17
+ - Implementation order is clear: models/domain first, service/integration second, controllers/entry points third.
18
+
19
+ ## Not Ready
20
+ - Do not start implementation when acceptance criteria, target user behavior, data contracts, or security implications are ambiguous.
21
+ - Do not start implementation from chat context alone when no refined GitHub issue exists.
22
+ - Do not fill missing product decisions with hidden implementation assumptions.
23
+ - If blocked, state the missing decision and propose the smallest useful next step.
24
+
25
+ ## Definition of Done
26
+ - Acceptance criteria are met and any deviations are documented.
27
+ - Code is implemented with focused unit tests for changed business logic.
28
+ - QA has a test plan, execution result, evidence, and unresolved risk list.
29
+ - User-facing work has responsive, accessibility, copy, and state checks when applicable.
30
+ - Documentation, ADRs, migrations, release notes, or runbooks are updated when impacted.
31
+ - Security, DevOps, and QA blockers are resolved or explicitly risk-accepted by the Product Owner.
32
+ - Final handoff includes changed files or components, commands run, test results, evidence, known gaps, and follow-up backlog items.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Release readiness, rollout, rollback, and post-release monitoring
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Release & Rollback
7
+
8
+ Every release must be deployable, observable, and reversible. A feature is not ready if the team cannot monitor it or recover from it.
9
+
10
+ For rollout tooling, synthetic monitoring, SLOs, on-call, and operational reporting categories, see **devops-tooling.mdc**.
11
+
12
+ ## Release Readiness
13
+ - Confirm Definition of Done, QA evidence, security review, migration status, and unresolved risks before release.
14
+ - Identify deployment target, release owner, release window, affected users, and communication needs.
15
+ - List feature flags, configuration changes, migrations, background jobs, and third-party dependencies.
16
+ - Verify observability exists for the changed behavior: logs, metrics, traces, dashboards, and alerts when applicable.
17
+
18
+ ## Rollout Strategy
19
+ - Prefer small, reversible releases over large batches.
20
+ - Use feature flags, canaries, phased rollout, or dark launch for risky user-facing or infrastructure changes.
21
+ - Database changes must be backward compatible when possible and safe across rolling deploys.
22
+ - Long-running migrations must have progress monitoring and an interruption plan.
23
+
24
+ ## Rollback Plan
25
+ - Every release must state how to rollback code, configuration, feature flags, and migrations.
26
+ - If rollback is not possible, document the forward-fix plan and get Product Owner risk acceptance before release.
27
+ - Do not release when rollback depends on manual guesswork or undocumented production console changes.
28
+
29
+ ## Post-Release
30
+ - Monitor agreed signals after release: errors, latency, saturation, conversion, usage, and user-facing failures.
31
+ - Define who watches the release and for how long.
32
+ - Capture incidents, regressions, and follow-up work as backlog items.
@@ -0,0 +1,28 @@
1
+ ---
2
+ description: Rule file composition and modular loading strategy for agent instructions
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Rule Composition
7
+
8
+ Prefer small, focused rule files referenced from a concise root file. Large monolithic instruction files are harder to maintain, easier to contradict, and waste context on rules that may not apply to the current task.
9
+
10
+ ## Root Files
11
+ - Root files such as `AGENTS.md` and `CLAUDE.md` must act as entry points, not full manuals.
12
+ - Keep root files limited to universal rules, role summaries, and pointers to specialized rule files.
13
+ - If a section grows beyond a short summary, extract it to `rules/*.mdc` and keep only the operating principle in the root file.
14
+
15
+ ## Specialized Rules
16
+ - Use one rule file per responsibility area: architecture, API design, data modeling, frontend, performance, concurrency, testing, security, delivery, collaboration, infrastructure, DevOps tooling, or product.
17
+ - Each rule file must have a clear `description` and a single reason to change.
18
+ - Avoid duplicating detailed guidance across files. Put the source of truth in one rule and summarize it elsewhere.
19
+
20
+ ## Skill-Like Loading
21
+ - Treat specialized rule files like skills: load the relevant rule only when the task needs that domain.
22
+ - For broad delivery work, load roles, collaboration, readiness/done, API design, data modeling, frontend, performance, concurrency, testing, security, delivery quality gates, UX/UI, release/rollback, DevOps tooling, documentation, dependency, config, code review, and AI-assisted development rules together.
23
+ - For narrow edits, load the smallest set of rules that can govern the change safely.
24
+
25
+ ## Maintenance
26
+ - Prefer adding a new focused rule file over expanding an unrelated one.
27
+ - Review root files periodically and remove details that have moved into specialized rules.
28
+ - If two rules conflict, keep the stricter safety, security, or quality requirement and record the decision.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Security non-negotiables for all codebases — stack-agnostic
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Security Guardrails
7
+
8
+ These are non-negotiable. Violations must be fixed before code review.
9
+
10
+ ## Input Handling
11
+ - **No shell interpolation.** Use array-based APIs (`execFile`, `spawn` with args array) instead of `exec` with template literals. This prevents command injection.
12
+ - **No raw innerHTML with dynamic data.** Escape all user-provided values or use `textContent` + `createElement`. This prevents XSS.
13
+ - **Validate external input.** URLs must start with `https://` before `fetch()`. File paths must be within expected directories (no path traversal).
14
+ - Security review is required for auth, authorization, identity, secrets, PII, payments, file paths, shell/process execution, network calls, dependency changes, encryption, TLS, cookies, sessions, CORS, webhooks, or infrastructure.
15
+
16
+ ## Secrets
17
+ - **Never hardcode credentials, tokens, API keys, or connection strings.** Use environment variables, secret managers, or Named Credentials.
18
+ - Files that may contain secrets (`.env`, `credentials.json`, `*.pem`, `*.key`) must be in `.gitignore`.
19
+ - If a secret is accidentally committed, rotate it immediately — removing from git history is not enough.
20
+
21
+ ## Dependencies
22
+ - Pin dependency versions in lockfiles. Review changelogs before major upgrades.
23
+ - Never install packages from untrusted sources or run `npx` on unvetted packages in CI.
24
+ - For full dependency policy, supply chain review, and update workflow, see **dependency-management.mdc**.
25
+
26
+ ## Static Analysis
27
+ - Static analysis and secret scanning must run before commit and in CI.
28
+ - For hook policy and tool categories, see **static-analysis-githooks.mdc**.
29
+
30
+ ## Error Exposure
31
+ - Never return stack traces, internal paths, or database errors to end users. Log them server-side, show a generic message client-side.
32
+ - Distinguish between expected errors (user input) and unexpected errors (bugs). Only unexpected errors should alert/log at error level.
33
+
34
+ ## Infrastructure & Data
35
+
36
+ - For databases, encryption, IaC, environment segregation, secrets management, scalability, and vulnerability management, see **infra-data-encryption.mdc**.
37
+ - Production networked services must consider TLS 1.2+, certificate management, HSTS where applicable, secure cookies, least privilege, and secret rotation.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: SOLID principles and clean architecture guardrails — stack-agnostic
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # SOLID & Clean Architecture
7
+
8
+ ## Single Responsibility (SRP)
9
+ - One module = one reason to change. If a file mixes UI rendering with business logic, data access with orchestration, or config with behavior — split it.
10
+ - Max **300 lines per file**. Max **30 lines per function**. Max **5 parameters** (use options object beyond that).
11
+ - Template literals embedding >20 lines of CSS, JS, or HTML must be extracted to separate files.
12
+
13
+ ## Open/Closed (OCP)
14
+ - Prefer data-driven designs over per-variant functions. Use config maps + one generic function instead of N nearly-identical functions.
15
+ - Use handler/strategy maps (`Record<EventType, Handler>`) instead of `switch` statements with >5 cases.
16
+
17
+ ## Liskov Substitution (LSP)
18
+ - Subclasses/implementations must honor the contract of their parent. Never override a method to throw "not supported" — redesign the hierarchy instead.
19
+
20
+ ## Interface Segregation (ISP)
21
+ - No `Record<string, unknown>`, `any`, or `object` in public APIs. Define narrow, purpose-specific types.
22
+ - Use TypeScript generics (`<T>`) instead of loose types + inline `as` casts.
23
+
24
+ ## Dependency Inversion (DIP)
25
+ - Import from barrel exports (`index.ts`), not deep internal paths. Every public symbol must be re-exported from the package barrel.
26
+ - Use static `import` statements. Never use `require()` in TypeScript unless technically justified and documented.
27
+ - Depend on abstractions (interfaces/types), not concrete implementations, when crossing module boundaries.
28
+
29
+ ## Separation of Concerns
30
+ - **View layer**: layout and event binding only. No business logic, no data fetching.
31
+ - **Service layer**: orchestration, external calls, state mutations.
32
+ - **Data layer**: queries, I/O, serialization. No UI references.
@@ -0,0 +1,32 @@
1
+ ---
2
+ description: Static analysis tooling and mandatory pre-commit hook policy
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Static Analysis & Git Hooks
7
+
8
+ Every project must run fast static analysis before commit and deeper analysis in CI. Hooks are guardrails, not replacements for review or tests.
9
+
10
+ ## Required Tooling
11
+ - TypeScript/JavaScript: TypeScript typecheck, ESLint, Prettier or project formatter, dependency audit, and secret scanning.
12
+ - Web/UI: lint accessibility rules where available and keep Playwright smoke checks available for critical flows.
13
+ - Python: Ruff, mypy or pyright, Bandit, dependency audit, and formatter when Python code exists.
14
+ - Infrastructure: Checkov, tfsec, or equivalent IaC scanner when Terraform, OpenTofu, Bicep, CloudFormation, or Kubernetes manifests exist.
15
+ - Security: Semgrep or CodeQL for SAST, plus Trivy or Grype for containers when images are built.
16
+
17
+ ## Pre-Commit Hook
18
+ - A pre-commit hook is mandatory before any commit.
19
+ - The hook must run only fast checks suitable for local feedback: formatting check, lint, typecheck for touched packages when practical, secret scan, and staged-file validation.
20
+ - The hook must fail closed. If analysis fails, the commit must not proceed.
21
+ - Do not bypass hooks with `--no-verify` unless the user explicitly approves and a follow-up item records the reason.
22
+ - Hook configuration must be version-controlled and reproducible for every contributor.
23
+
24
+ ## Pre-Push / CI
25
+ - Slower checks belong in pre-push or CI: full test suite, Playwright E2E, SAST, dependency scan, container scan, IaC scan, and build.
26
+ - CI must run at least the same checks as local hooks, plus deeper project-wide checks.
27
+ - PRs cannot be approved when static analysis, typecheck, security scan, or required hooks fail.
28
+
29
+ ## Evidence
30
+ - Developer handoff must include exact static analysis commands run and results.
31
+ - CI evidence must link failed checks to logs and responsible owners.
32
+ - Any deferred static analysis finding needs severity, owner, rationale, and follow-up backlog item.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: TDD, BDD, and testing best practices — stack-agnostic
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Testing Discipline
7
+
8
+ ## Test-Driven Development (TDD)
9
+ - Write the test **before** or **alongside** the implementation. At minimum, tests must exist before the PR.
10
+ - Red → Green → Refactor. Start with a failing test, make it pass with minimal code, then clean up.
11
+ - Every development task must include unit tests for new or changed business logic before it is handed to QA.
12
+
13
+ ## Behavior-Driven Development (BDD)
14
+ - Test **behavior**, not implementation. Test what the function does, not how it does it.
15
+ - Name tests as specifications: `it('rejects orders with zero quantity')`, not `it('test1')`.
16
+ - One assertion per test method. If you need multiple, it's multiple behaviors — split them.
17
+
18
+ ## Test Structure
19
+ - **Arrange → Act → Assert.** Separate setup, execution, and verification with blank lines.
20
+ - Use factory functions or builders for test data — never copy-paste fixtures across test files.
21
+ - Tests must be deterministic. No reliance on system clock, network, or random values without seeding.
22
+
23
+ ## Sync Tests
24
+ - If data is duplicated across packages (e.g., type definitions, config arrays), a test must assert both copies are identical.
25
+ - Schema changes in a source of truth must break a test somewhere — if they don't, add one.
26
+
27
+ ## Coverage
28
+ - Target **90%+ line coverage** for business logic. Infrastructure/glue code can be lower.
29
+ - Coverage is a floor, not a goal. 100% coverage with bad assertions is worse than 80% with good ones.
30
+
31
+ ## E2E / Integration
32
+ - Prefer Playwright for browser-based E2E, smoke, and regression automation.
33
+ - Use the Page Object pattern for UI tests. Selectors live in page objects, not test bodies.
34
+ - Tag tests by speed/scope (`@smoke`, `@regression`) so CI can run fast feedback loops.
35
+ - Capture evidence for E2E failures with traces, screenshots, or videos when supported by the framework.
36
+
37
+ ## QA Handoff
38
+ - Developer must provide QA with test commands run, pass/fail results, covered scenarios, and known gaps.
39
+ - QA must produce a test plan before release approval.
40
+ - QA and Developer must decide which manual checks should be automated, preferring Playwright for browser flows.
41
+ - User-facing QA plans must include responsive, accessibility, copy, tooltip, loading, empty, error, success, and recovery-state checks.
42
+ - API, data, async, performance, and config changes must include targeted regression checks for contract, migration, idempotency, latency, and environment behavior when applicable.
@@ -0,0 +1,51 @@
1
+ ---
2
+ description: Mobile-first UX/UI, responsive design, user flows, and game guidance
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # UX/UI Product Experience
7
+
8
+ User-facing work must be designed around real user flows, not isolated screens. Every interface must be usable, responsive, accessible, and clear for the intended audience.
9
+
10
+ ## Mobile First
11
+ - Design the smallest practical viewport first, then enhance for tablet and desktop.
12
+ - Primary actions must remain reachable on mobile without awkward scrolling or hidden controls.
13
+ - Text, buttons, forms, modals, menus, and navigation must not overflow or overlap at common mobile widths.
14
+ - Touch targets must be large enough for fingers and spaced to avoid accidental taps.
15
+
16
+ ## Responsive Behavior
17
+ - Define responsive layouts intentionally: stacking, wrapping, truncation, sticky areas, and overflow behavior must be planned.
18
+ - Test key screens at mobile, tablet, and desktop breakpoints before considering UI work complete.
19
+ - Avoid fixed-width layouts unless the format requires it. Use responsive constraints, flexible grids, and sensible max widths.
20
+ - Dynamic content, translated text, loading states, empty states, and error states must fit without breaking the layout.
21
+
22
+ ## User Flows
23
+ - Start UX work by identifying the end user, their goal, entry point, success path, failure path, and exit path.
24
+ - Do not optimize a screen while ignoring the full workflow before and after it.
25
+ - Every critical flow must include loading, empty, error, success, validation, and recovery states.
26
+ - Navigation should make the user's current location, available actions, and next step obvious.
27
+
28
+ ## UI Copy
29
+ - Use friendly, descriptive text that tells users what happened and what they can do next.
30
+ - Buttons should describe the action, not the implementation detail.
31
+ - Error messages must be specific, human-readable, and safe to show publicly.
32
+ - Tooltips should clarify unfamiliar icons, disabled controls, abbreviations, and advanced options.
33
+
34
+ ## Accessibility
35
+ - Preserve keyboard navigation, focus states, semantic structure, and readable contrast.
36
+ - Forms need labels, validation messages, and clear relationships between fields and errors.
37
+ - Do not rely on color alone to communicate status or severity.
38
+ - Motion and animation must not block comprehension and should respect reduced-motion preferences when the platform supports it.
39
+
40
+ ## Game UX/UI
41
+ - Games must teach controls, objectives, feedback loops, and failure recovery inside the experience.
42
+ - Provide contextual guides, tutorials, onboarding hints, or progressive prompts when mechanics are introduced.
43
+ - HUD elements must prioritize player state, goals, available actions, and urgent threats without covering gameplay.
44
+ - Menus, pause screens, settings, inventory, upgrades, and dialogs must be navigable with the target input methods.
45
+ - Feedback must be immediate and readable: input response, hit/miss, damage, rewards, progress, cooldowns, and blocked actions.
46
+ - Difficulty, accessibility, and assistive options should be available when they meaningfully improve player inclusion.
47
+
48
+ ## Evidence
49
+ - UI delivery must include screenshots or recordings for the primary responsive breakpoints when practical.
50
+ - Game UI delivery must include evidence of onboarding, HUD readability, and input flow on the target device or viewport.
51
+ - QA plans for user-facing work must include UX checks, not only functional assertions.
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Work intake, GitHub issue readiness, technical refinement, and implementation sequencing
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Work Intake & Sequencing
7
+
8
+ Every work block must start from a refined GitHub issue and follow a safe implementation order. Do not start coding from chat context alone.
9
+
10
+ ## GitHub Issue Gate
11
+ - Before starting a work block, confirm the GitHub issue exists and record its issue number.
12
+ - The issue must include user story or job-to-be-done, acceptance criteria, priority, scope, non-goals, technical notes, test expectations, and risk areas.
13
+ - If the issue is missing or vague, create or refine it before implementation.
14
+ - Use the issue number as the Backlog Item ID for commits and PRs.
15
+
16
+ ## Technical Refinement
17
+ - Refine the solution with expected files/modules, domain model changes, service/integration changes, controller/CLI/API changes, data flow, failure modes, and test plan.
18
+ - Identify impacted roles before coding: Architect, Developer, QA, Security, DevOps, SRE, DBA, UX/UI, Compliance/Privacy, Technical Writer, or Game Designer.
19
+ - Record assumptions and open questions. Block implementation when a decision affects user behavior, data contracts, security, deployment, or compliance.
20
+
21
+ ## Implementation Order
22
+ - Start with models and domain: types, schemas, entities, value objects, invariants, and validation.
23
+ - Then implement service and integration layer: orchestration, repositories, adapters, provider interfaces, external APIs, and side effects.
24
+ - Then implement controllers and entry points: CLI commands, API routes, UI handlers, jobs, and web controllers.
25
+ - Finally wire evidence: unit tests, integration tests, Playwright or smoke tests, static analysis, docs, and handoff.
26
+
27
+ ## Security Review Trigger
28
+ - Run a security review when work touches auth, authorization, identity, secrets, PII, payments, file paths, shell/process execution, network calls, dependency changes, encryption, TLS, cookies, sessions, CORS, webhooks, or infrastructure.
29
+ - Production networked services must consider TLS 1.2+, certificate management, HSTS where applicable, secure cookies, least privilege, and secret rotation.
30
+ - If security is out of scope, state why. If uncertain, involve Security before implementation.
31
+
32
+ ## Block Start Checklist
33
+ - GitHub issue exists and is refined.
34
+ - User alignment gate is complete for non-trivial work.
35
+ - Domain/model changes are understood.
36
+ - Service/integration boundaries are understood.
37
+ - Controller/entry-point changes are understood.
38
+ - Test, QA, static analysis, and evidence plan are clear.
39
+ - Security/DevOps/SRE/DBA/Compliance review needs are explicitly included or excluded with rationale.