@ryuenn3123/agentic-senior-core 4.0.3 → 4.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.
- package/.agent-context/rules/api-docs.md +14 -0
- package/.agent-context/rules/api-versioning.md +93 -0
- package/.agent-context/rules/background-jobs.md +93 -0
- package/.agent-context/rules/config-and-flags.md +79 -0
- package/.agent-context/rules/database-design.md +32 -0
- package/.agent-context/rules/frontend-architecture.md +35 -0
- package/.agent-context/rules/migrations.md +84 -0
- package/.agent-context/rules/observability.md +69 -0
- package/.agent-context/rules/resilience.md +78 -0
- package/.agent-context/rules/security.md +28 -0
- package/AGENTS.md +8 -8
- package/README.md +42 -9
- package/package.json +3 -4
- package/scripts/audit-cache-layer-contract.mjs +5 -0
- package/scripts/audit-caching-scope-hygiene.mjs +5 -0
- package/scripts/clean-local-artifacts.mjs +0 -1
- package/scripts/frontend-usability-audit.mjs +5 -8
- package/scripts/release-gate/static-checks.mjs +7 -7
- package/scripts/validate/config.mjs +0 -2
- package/scripts/validate/coverage-checks.mjs +1 -42
- package/scripts/validate.mjs +9 -7
- package/scripts/migrate-rule-format/id-prefix-table.mjs +0 -37
- package/scripts/migrate-rule-format/parse-legacy.mjs +0 -180
- package/scripts/migrate-rule-format/render-new.mjs +0 -169
- package/scripts/migrate-rule-format/roundtrip-validate.mjs +0 -89
- package/scripts/migrate-rule-format.mjs +0 -192
- package/scripts/v3-purge-audit.mjs +0 -236
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
id_prefix: RES
|
|
3
|
+
domain: resilience
|
|
4
|
+
priority: critical
|
|
5
|
+
scope: backend
|
|
6
|
+
last_validated: 2026-05-17
|
|
7
|
+
applies_to:
|
|
8
|
+
- backend
|
|
9
|
+
- fullstack
|
|
10
|
+
keywords:
|
|
11
|
+
- resilience
|
|
12
|
+
- timeout
|
|
13
|
+
- retry
|
|
14
|
+
- deadline
|
|
15
|
+
- degradation
|
|
16
|
+
- backpressure
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Resilience Boundary
|
|
20
|
+
|
|
21
|
+
The system must remain useful when a dependency is slow, partial, or unavailable. Resilience is the property that the user-facing operation either completes within an agreed budget, fails fast with a clear outcome, or runs in a documented degraded mode; it is not the absence of failure. Vendor names and library names that may appear in commentary (timeout libraries, service meshes, adaptive-concurrency runtimes) are not authority for this rule.
|
|
22
|
+
|
|
23
|
+
## RES-001: Timeouts and deadlines (Mandatory)
|
|
24
|
+
|
|
25
|
+
1. Every outbound network or inter-process call must carry an explicit timeout derived from the user-facing operation's worst-acceptable latency. Library defaults and "no timeout" are not acceptable.
|
|
26
|
+
2. The timeout must be smaller than the upstream caller's remaining latency budget. A request handler that has 800 ms of remaining budget must not issue a downstream call configured to wait 5 seconds.
|
|
27
|
+
3. The system must propagate the caller's remaining deadline downstream so a downstream operation cannot continue past the upstream's expiration. If the platform exposes a deadline header or a context cancellation primitive, use it; otherwise, transmit the remaining budget as an explicit field on the call.
|
|
28
|
+
4. Connect, read, and idle timeouts must be set independently. A combined "request timeout" that hides which phase exceeded the budget makes failure analysis ambiguous.
|
|
29
|
+
5. Reject reliance on default timeouts. Reject "infinite" or platform-maximum timeouts on user-facing call paths. Reject configuring a downstream timeout larger than the upstream caller's remaining budget.
|
|
30
|
+
|
|
31
|
+
## RES-002: Retries (Mandatory)
|
|
32
|
+
|
|
33
|
+
1. Retries are allowed only on operations that are idempotent on the target, or on operations that carry an idempotency identifier the target honors within a documented retention window.
|
|
34
|
+
2. Retries must use exponential backoff with jitter and a documented attempt cap. Fixed-interval retries are forbidden because they synchronize callers during incidents.
|
|
35
|
+
3. Each retry must inherit the caller's remaining deadline; the sum of attempts plus backoff must not exceed the original budget.
|
|
36
|
+
4. Retries must distinguish retriable failures (transient network, explicit retry-after, documented `5xx` semantics) from non-retriable failures (validation, authorization, business-rule rejection); non-retriable failures must surface immediately without consuming retry budget.
|
|
37
|
+
5. Reject retries on non-idempotent writes that lack an idempotency identifier on the target. Reject retry storms: any pattern where many callers retry on the same schedule, without jitter, and without a global cap, is a defect even if each caller is locally well-behaved.
|
|
38
|
+
|
|
39
|
+
## RES-003: Failing fast on unhealthy dependencies (Mandatory)
|
|
40
|
+
|
|
41
|
+
1. When a dependency's failure rate, latency, or queue depth indicates it cannot serve traffic within the user-facing latency budget, the calling component must shed load on that dependency rather than continue to issue calls that will time out.
|
|
42
|
+
2. Load shedding is an outcome, not a named pattern. The system may achieve it through any mechanism appropriate to the platform: a service mesh fault-tolerance policy, an adaptive-concurrency limiter, an in-process state machine that rejects calls during a recovery window, or a rate limiter informed by health probes. Choose what the platform supports; do not write a custom mechanism when the platform provides one.
|
|
43
|
+
3. The shedding component must emit a telemetry event when it transitions between healthy, degraded, and shedding states, so an operator can correlate user impact with the decision to shed.
|
|
44
|
+
4. The shedding component must have a documented recovery path: how it re-admits traffic to the dependency, how it confirms the dependency is healthy, and how it bounds the rate of recovery to avoid a thundering herd.
|
|
45
|
+
5. Reject open-loop retry behavior against an upstream that has been unhealthy for longer than its documented recovery window. Reject "fail open" defaults on security-relevant calls (authorization, license enforcement); those must fail closed and the user-facing impact must be a documented degraded mode, not silent permission.
|
|
46
|
+
|
|
47
|
+
## RES-004: Dependency isolation (Mandatory)
|
|
48
|
+
|
|
49
|
+
1. Independent dependencies must use independent resource pools (connection pools, thread pools, semaphore quotas, or platform-equivalent admission control) so the saturation of one upstream cannot exhaust the pools used by another.
|
|
50
|
+
2. The size of each pool must be derived from the dependency's documented capacity and the caller's latency budget, not from a default.
|
|
51
|
+
3. The system must expose the in-flight count, the queue depth, and the rejection count for each pool as telemetry, so an operator can distinguish "dependency slow" from "caller's pool exhausted".
|
|
52
|
+
4. Reject sharing one global pool across unrelated downstream calls when the platform supports separation. Reject silent unbounded queueing in front of a saturated pool; bounded queues with explicit rejection are mandatory.
|
|
53
|
+
|
|
54
|
+
## RES-005: Graceful degradation (Mandatory)
|
|
55
|
+
|
|
56
|
+
1. For each dependency, the implementation must answer one question explicitly in code or in a runbook: "what does the caller still do for the user when this dependency is unavailable?" A generic catch-all error response is not an answer.
|
|
57
|
+
2. Acceptable degraded behaviors include: serving a cached or older version of the data with a freshness indicator, returning a partial result with the unavailable section labelled as such, queueing the request for later processing with a documented user-visible acknowledgement, or refusing the operation with a clear error that names the unavailable subsystem.
|
|
58
|
+
3. The user-facing error path must distinguish "we cannot do this right now, retry later" from "we will not do this, do not retry"; clients reading these responses act differently on the two.
|
|
59
|
+
4. Degraded behavior must be observable: a request served from a fallback path must emit telemetry that records which fallback fired, why, and how stale or partial the result was.
|
|
60
|
+
5. Reject silent degradation. A response that hides a fallback from the caller, or that omits a stale-data marker when the data is stale, is a defect.
|
|
61
|
+
|
|
62
|
+
## RES-006: Backpressure across producers and consumers (Mandatory)
|
|
63
|
+
|
|
64
|
+
1. Any boundary between an unbounded producer (user requests, upstream events, ingestion stream) and a bounded consumer must apply backpressure: shed load, throttle the producer, or expose lag back to the producer. Silent unbounded growth of an in-memory or on-disk queue is forbidden.
|
|
65
|
+
2. The boundary must expose its current lag, drop rate, and rejection reason as telemetry, so an operator can choose between scaling the consumer, slowing the producer, or shedding low-value traffic.
|
|
66
|
+
3. Reject "queue grows until OOM" as an acceptable failure mode. Reject "we will scale later" as a substitute for explicit backpressure on a path that already takes user traffic.
|
|
67
|
+
|
|
68
|
+
## RES-007: Citations and freshness
|
|
69
|
+
|
|
70
|
+
Authority and background reading for the rules in this file:
|
|
71
|
+
|
|
72
|
+
- AWS Well-Architected Framework, Reliability Pillar (REL05 and surrounding controls): authority on dependency isolation, timeouts, retries with backoff, and graceful degradation as deployment-architecture concerns. Verify against the Reliability Pillar version current at audit time.
|
|
73
|
+
- Google SRE Workbook chapters on overload and addressing cascading failures: background reading on load shedding, graceful degradation, and the difference between transient and persistent failure modes.
|
|
74
|
+
- IETF RFC 7231 and successor specifications for HTTP semantics: authority for which response statuses are safe to retry by default.
|
|
75
|
+
- IETF RFC 7234 and `Retry-After` semantics: authority for cooperating with explicit retry-control signals from upstreams.
|
|
76
|
+
|
|
77
|
+
Vendor-specific resilience libraries (circuit-breaker libraries, service-mesh fault-tolerance modules, language-runtime cancellation primitives) are illustrative implementations of the outcomes above; they are not authority. Choose the implementation appropriate to the platform.
|
|
78
|
+
<!-- DURABILITY CHECK: Rule relies exclusively on architectural invariants and relative operational thresholds. Valid beyond standard tooling lifecycles. -->
|
|
@@ -3,6 +3,7 @@ id_prefix: SEC
|
|
|
3
3
|
domain: security
|
|
4
4
|
priority: critical
|
|
5
5
|
scope: all-tasks
|
|
6
|
+
last_validated: 2026-05-17
|
|
6
7
|
applies_to:
|
|
7
8
|
- backend
|
|
8
9
|
- frontend
|
|
@@ -43,3 +44,30 @@ Use the security model and libraries already present in the project. If security
|
|
|
43
44
|
4. Sanitization must match the sink: SQL, shell, file path, log, HTML, template, and URL contexts need different protections.
|
|
44
45
|
5. Authorization must be resource-aware when data ownership matters. Prefer row, tenant, account, organization, or resource-level checks over role-only checks for sensitive records.
|
|
45
46
|
6. For high-risk changes, check current framework security docs and record the relevant source or assumption in the implementation notes.
|
|
47
|
+
|
|
48
|
+
## SEC-003: Authentication versus authorization
|
|
49
|
+
|
|
50
|
+
1. Authentication proves identity (this caller is who they claim to be); authorization grants capability (this identity may perform this action on this resource). The two are different concerns and must be implemented as distinct layers.
|
|
51
|
+
2. Request-handling code must not conflate them. A handler that checks "is this caller logged in?" and treats the answer as permission to mutate the resource is a defect, regardless of how strong the authentication check is.
|
|
52
|
+
3. The authorization decision layer must be independently testable from the request-handling layer. The system must support tests that pass an authenticated principal plus a target resource and a requested action and assert the decision, without standing up the full HTTP transport.
|
|
53
|
+
4. Authorization decisions must be recorded as audit events [REF:OBS-004]: who acted, what was acted upon, the requested action, and the decision. A "permitted" decision and a "denied" decision both belong on the audit stream.
|
|
54
|
+
5. Reject controllers that mix authentication checks, business policy, and persistence in one block. Reject role-only authorization on resources that have owners; ownership-, tenant-, or relationship-aware authorization is required when records have owners.
|
|
55
|
+
|
|
56
|
+
## SEC-004: Credential storage
|
|
57
|
+
|
|
58
|
+
1. Passwords and other reversible-equivalent credentials must be hashed with a memory-hard, computationally-tunable algorithm intended for password storage. Argon2id is the current widely accepted default; bcrypt remains acceptable on platforms where a memory-hard implementation is unavailable or on platforms where the operational surface has already standardized on it. The mechanism must be tunable: as hardware improves, the work factor must be raised without a code change.
|
|
59
|
+
2. General-purpose hash functions (MD5, SHA-1, SHA-256, SHA-3 by themselves) are forbidden for password storage. They are designed to be fast; password storage requires a function designed to be slow under attacker hardware.
|
|
60
|
+
3. Stored credentials must include a per-credential random salt at the size and shape the chosen algorithm specifies; global pepper, if used, must come from the secret manager [REF:CFG-002], not from source.
|
|
61
|
+
4. Verification must be constant-time for the comparison step where the platform supports it, to limit timing-side-channel inference about partial matches.
|
|
62
|
+
5. Credential rotation must be supported as a runtime operation: the system must be able to re-hash a credential at the next successful authentication when the work factor or algorithm changes, without forcing a coordinated reset.
|
|
63
|
+
6. Reject storing credentials with a general-purpose hash. Reject storing credentials in plaintext for any reason, including "for support recovery". Reject pinning a work factor that the platform's hardware has outpaced; the work factor is a tuning parameter, not a constant.
|
|
64
|
+
|
|
65
|
+
## SEC-005: Service-to-service authentication
|
|
66
|
+
|
|
67
|
+
1. Service-to-service identity must be cryptographically verifiable at the receiving end. Acceptable mechanisms include mutual TLS with verified peer certificates, OIDC client-credentials flow with short-lived tokens, signed bearer tokens with a documented issuer and verifiable signature, or platform-equivalent verifiable identity (workload identity, signed JWT-over-mTLS).
|
|
68
|
+
2. Tokens used between services must carry a short time-to-live (the value depends on the platform's revocation latency and the operation's blast radius; record the chosen TTL and the rationale, do not inherit a default).
|
|
69
|
+
3. The receiving service must validate the token's issuer, signature, audience, expiration, and not-before fields on every request. A cached "yes this is valid" decision that bypasses signature validation is a defect.
|
|
70
|
+
4. Reject shared static tokens (a single long-lived API key embedded in every caller) as the sole identity mechanism between services. Static tokens are acceptable only as one factor inside a stronger mechanism, or as a deliberate fallback for narrowly-scoped, audit-logged emergency access.
|
|
71
|
+
5. Reject IP-allow-list as a substitute for cryptographic identity on networks the producer does not exclusively control. Reject "trusted network" as a substitute for verifying the caller; zero-trust is the default at the service boundary.
|
|
72
|
+
6. Authority for the rules above includes OWASP ASVS sections on authentication and session management, IETF RFC 6749 (OAuth 2.0) and successors for token-based identity, and the platform's current workload-identity documentation. Verify the current versions at audit time.
|
|
73
|
+
<!-- DURABILITY CHECK: Rule relies exclusively on architectural invariants and relative operational thresholds. Valid beyond standard tooling lifecycles. -->
|
package/AGENTS.md
CHANGED
|
@@ -31,21 +31,21 @@ Keep it short. Do not load every rule just to fill it out.
|
|
|
31
31
|
Avoid repeated command output. Do not rerun broad inspections unless edits changed the result. Prefer targeted reads, targeted searches, concise diffs, and final validation gates.
|
|
32
32
|
|
|
33
33
|
## Layer Index
|
|
34
|
-
### Layer 1: Rules (
|
|
34
|
+
### Layer 1: Rules (21 Files) [SCOPE-RESOLVED]
|
|
35
35
|
Location: `.agent-context/rules/`.
|
|
36
36
|
|
|
37
37
|
Load only relevant rule files. Do not read the entire rule directory by default.
|
|
38
38
|
|
|
39
|
-
Available rules: `naming-conv.md` (`NAME-*`, v4), `architecture.md` (`ARCH-*`, v4), `security.md` (`SEC-*`, v4), `performance.md` (`PERF-*`, v4), `error-handling.md` (`ERR-*`, v4), `testing.md` (`TEST-*`, v4), `git-workflow.md` (`GIT-*`, v4), `efficiency-vs-hype.md` (`DEP-*`, v4), `api-docs.md` (`API-*`, v4), `microservices.md` (`SVC-*`, v4), `event-driven.md` (`EVT-*`, v4), `database-design.md` (`DATA-*`, v4), `realtime.md` (`RT-*`, v4), `frontend-architecture.md` (`FE-*`, v4), `docker-runtime.md` (`DOCK-*`, v4).
|
|
39
|
+
Available rules: `naming-conv.md` (`NAME-*`, v4), `architecture.md` (`ARCH-*`, v4), `security.md` (`SEC-*`, v4), `performance.md` (`PERF-*`, v4), `error-handling.md` (`ERR-*`, v4), `testing.md` (`TEST-*`, v4), `git-workflow.md` (`GIT-*`, v4), `efficiency-vs-hype.md` (`DEP-*`, v4), `api-docs.md` (`API-*`, v4), `microservices.md` (`SVC-*`, v4), `event-driven.md` (`EVT-*`, v4), `database-design.md` (`DATA-*`, v4), `realtime.md` (`RT-*`, v4), `frontend-architecture.md` (`FE-*`, v4), `docker-runtime.md` (`DOCK-*`, v4), `observability.md` (`OBS-*`, v4), `resilience.md` (`RES-*`, v4), `migrations.md` (`MIG-*`, v4), `background-jobs.md` (`JOB-*`, v4), `config-and-flags.md` (`CFG-*`, v4), `api-versioning.md` (`VER-*`, v4).
|
|
40
40
|
|
|
41
|
-
For Docker or Compose work, load `docker-runtime.md` and verify the latest official Docker docs before authoring container assets. Also perform live web research for Docker and framework/package setup claims. For framework or package setup work, use the latest stable compatible dependency set and official setup flow unless a documented compatibility constraint blocks it
|
|
41
|
+
For Docker or Compose work, load `docker-runtime.md` and verify the latest official Docker docs before authoring container assets. Also perform live web research for Docker and framework/package setup claims. For framework or package setup work, use the latest stable compatible dependency set and official setup flow unless a documented compatibility constraint blocks it; prefer official framework scaffolders when they create the supported project shape. New dependencies are allowed when they improve efficiency, delivery time, correctness, accessibility, UX, or maintainability. Do not treat dependency avoidance or vague performance fear as a default reason to skip a modern maintained library.
|
|
42
42
|
|
|
43
43
|
Backend/API routing:
|
|
44
|
-
- Data/schema/persistence: `architecture.md`, `database-design.md`, `performance.md`, `testing.md`.
|
|
45
|
-
- Endpoint/API/error contracts: `architecture.md`, `api-docs.md`, `error-handling.md`, `security.md`, `testing.md`.
|
|
46
|
-
- Auth/secrets/uploads/permissions: `security.md`, `error-handling.md`, `testing.md`.
|
|
47
|
-
- Queue/worker/cron/events/retry: `event-driven.md`, `database-design.md`, `error-handling.md`, `performance.md`, `testing.md`.
|
|
48
|
-
- Multi-service/distributed boundaries: `microservices.md`, `event-driven.md`, `database-design.md`, `api-docs.md`, `architecture.md`.
|
|
44
|
+
- Data/schema/persistence: `architecture.md`, `database-design.md`, `migrations.md`, `performance.md`, `testing.md`.
|
|
45
|
+
- Endpoint/API/error contracts: `architecture.md`, `api-docs.md`, `api-versioning.md`, `error-handling.md`, `observability.md`, `security.md`, `testing.md`.
|
|
46
|
+
- Auth/secrets/uploads/permissions: `security.md`, `config-and-flags.md`, `error-handling.md`, `observability.md`, `testing.md`.
|
|
47
|
+
- Queue/worker/cron/events/retry: `event-driven.md`, `background-jobs.md`, `resilience.md`, `database-design.md`, `error-handling.md`, `observability.md`, `performance.md`, `testing.md`.
|
|
48
|
+
- Multi-service/distributed boundaries: `microservices.md`, `event-driven.md`, `database-design.md`, `api-docs.md`, `architecture.md`, `resilience.md`, `observability.md`, `performance.md`.
|
|
49
49
|
|
|
50
50
|
Use the union once when scopes overlap. Do not create framework-specific governance adapters.
|
|
51
51
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agentic-Senior-Core
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Change your AI Agent to code like a Staff Engineer, not a Junior.
|
|
6
6
|
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](CONTRIBUTING.md)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
**Production-grade Rules Engine (Governance Engine) for AI coding agents.**
|
|
11
11
|
Works with Cursor, Windsurf, GitHub Copilot, Claude Code, Gemini, and other LLM-powered IDE workflows.
|
|
12
12
|
|
|
13
|
-
Current package version: 4.
|
|
13
|
+
Current package version: 4.1.0. Last published version before this release: 4.0.3.
|
|
14
14
|
|
|
15
15
|
Highlights:
|
|
16
16
|
- Uses `AGENTS.md` as the canonical instruction entrypoint.
|
|
@@ -22,7 +22,37 @@ Highlights:
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Why this exists
|
|
26
|
+
|
|
27
|
+
A coding agent that has read every framework tutorial on the internet still ships junior-grade work because nothing in its training tells it which trade-off matters in your codebase. This pack is a small set of plain-language rules an agent loads only when the work scope calls for them: data, endpoints, observability, resilience, migrations, jobs, configuration, versioning, security, design, and a few more. The rules are written as invariants and as bad habits to reject, not as opinions about which framework is fashionable. An agent that reads them treats your repo with the discipline of a senior engineer the first time, instead of after three rounds of review. You install it with one command, you can revert it with a backup, and it does not depend on any particular IDE or LLM provider.
|
|
28
|
+
|
|
29
|
+
### Long-Term Stability
|
|
30
|
+
|
|
31
|
+
The rules in this pack are written as invariants, outcomes, and freshness criteria, not as named patterns, library prescriptions, or magic-number thresholds. A migration rule says "DDL expected to hold a lock longer than the service's acceptable request-latency threshold must use an online migration mechanism", not "use pgroll for tables larger than ten million rows". A resilience rule says "fail fast when a dependency is unhealthy and shed load before shared resources are exhausted", not "implement a circuit breaker using library X". The intent is that each rule continues to tell a future maintainer the right thing to do across at least three years of framework and tooling churn. Where a rule cites a specific tool name or numeric threshold, the citation block at the bottom of the rule carries a freshness anchor and (in the next release) a `last_validated` date so the next maintainer knows when the technology references were last cross-checked against current practice.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## What's New in v4.1
|
|
36
|
+
|
|
37
|
+
This release adds six backend rule files that bring the backend pack to parity with the existing frontend rule. They are technology-neutral by construction and follow the same v4 numbered-Markdown format as the prior fifteen rules.
|
|
38
|
+
|
|
39
|
+
- `observability.md` (`OBS-*`) — observability as structured per-request events; metrics, logs, and traces as derived views; SLO-backed alerting; cardinality, signal-substitution, and audit-stream rules.
|
|
40
|
+
- `resilience.md` (`RES-*`) — explicit timeouts and deadline propagation, idempotency-required retries, dependency isolation, fail-fast as outcome (not named pattern), explicit graceful degradation, observable backpressure.
|
|
41
|
+
- `migrations.md` (`MIG-*`) — expand-contract / parallel-change for live data, deploy-ordering invariant, lock-posture rule keyed to the service's own latency budget, idempotent resumable backfills, mandatory risk fields per migration ticket.
|
|
42
|
+
- `background-jobs.md` (`JOB-*`) — job-shape selection (scheduled vs queued vs stream vs one-shot), per-job ownership and runbook, job-level idempotency, lease/checkpoint/graceful-shutdown for long jobs, poison-message and dead-letter discipline, UTC schedules, jittered fan-out, explicit backpressure.
|
|
43
|
+
- `config-and-flags.md` (`CFG-*`) — configuration sources and startup validation, secret handling, four-way feature-flag taxonomy (release / kill switch / experiment / entitlement) with per-flag owner and expiry, safe defaults on flag-service outage, no-branch-on-environment rule.
|
|
44
|
+
- `api-versioning.md` (`VER-*`) — single versioning strategy per surface, breaking-vs-non-breaking definitions, deprecation discipline (in-band signal via RFC 9745 / RFC 8594 where adopted, plus migration guide and telemetry), explicit support windows, additive evolution as default, CI-blocking compatibility checks.
|
|
45
|
+
|
|
46
|
+
Plus targeted refinements to four existing rules:
|
|
47
|
+
|
|
48
|
+
- `frontend-architecture.md` — FE-012 Data state surface, FE-017 Interactivity priority, FE-018 Internationalization as layout, FE-019 Theme as context.
|
|
49
|
+
- `security.md` — SEC-003 authn vs authz, SEC-004 memory-hard credential storage, SEC-005 cryptographically verifiable service-to-service identity.
|
|
50
|
+
- `database-design.md` — DATA-003 money and time (no floating-point money, UTC for real-world moments), DATA-004 concurrency and write conflicts.
|
|
51
|
+
- `api-docs.md` — API-005 cross-reference to the new versioning rule, API-012 idempotency as a runtime invariant (not just a documentation field).
|
|
52
|
+
|
|
53
|
+
Plus repository hygiene: archive consolidation into `docs/archive/HISTORY.md`, removal of the v3-purge and migrate-rule-format tooling (now under `docs/archive/migrations/`), and inlining of the terminology mapping into this README.
|
|
54
|
+
|
|
55
|
+
## What's New in v4 (prior)
|
|
26
56
|
|
|
27
57
|
The internal `.agent-context/rules/` pack is now numbered Markdown with YAML frontmatter and stable section IDs (e.g. `FE-004`, `ARCH-009`, `API-006`). This is a breaking change for downstream consumers that parse rule headings; the migration guide lives in `CHANGELOG.md` under `4.0.0`. Repository-wide impact:
|
|
28
58
|
|
|
@@ -41,7 +71,7 @@ npx @ryuenn3123/agentic-senior-core init
|
|
|
41
71
|
|
|
42
72
|
One command to initialize `AGENTS.md`, native import bridges, checklists, policies, state files, and the lazy `.agent-context/` rule library for your project.
|
|
43
73
|
|
|
44
|
-
> **See [docs/doc-index.md](docs/doc-index.md), [docs/deep-dive.md](docs/deep-dive.md), and [docs/roadmap.md](docs/roadmap.md) for deeper CLI, architecture, integration, and roadmap context.**
|
|
74
|
+
> **See [docs/doc-index.md](docs/doc-index.md), [docs/deep-dive.md](docs/deep-dive.md), and [docs/deep-analysis-and-roadmap-backlog.md](docs/deep-analysis-and-roadmap-backlog.md) for deeper CLI, architecture, integration, and roadmap context.**
|
|
45
75
|
|
|
46
76
|
- Default init copies the compact instruction surface and writes onboarding, selected policy, token optimization, and memory continuity state.
|
|
47
77
|
- MCP workspace files are disabled by default. Add `--mcp-template` when you want starter IDE MCP configuration files.
|
|
@@ -92,7 +122,6 @@ If you see `Property $schema is not allowed`, keep `.vscode/mcp.json` without `$
|
|
|
92
122
|
| `agentic-senior-core init` | Initialize the compact project guidance pack and native agent entrypoints |
|
|
93
123
|
| `agentic-senior-core upgrade --dry-run` | Preview managed-surface upgrades |
|
|
94
124
|
| `agentic-senior-core optimize --show` | Show token optimization state |
|
|
95
|
-
| `npm run audit:v3-purge` | Run deep purge readiness audit (no deletion) |
|
|
96
125
|
| `npm run clean:local` | Remove ignored local reports, backups, benchmarks, and active-memory state |
|
|
97
126
|
| `agentic-senior-core mcp` | Start local MCP stdio runtime |
|
|
98
127
|
|
|
@@ -138,7 +167,12 @@ Deprecated legacy files such as `.instructions.md`, `.agent-instructions.md`, `.
|
|
|
138
167
|
|
|
139
168
|
Rule: on first mention in developer-facing docs, include canonical term in parentheses.
|
|
140
169
|
|
|
141
|
-
|
|
170
|
+
Examples:
|
|
171
|
+
- `Federated Rules Operations (Federated Governance)`
|
|
172
|
+
- `Rules Engine (Governance Engine)`
|
|
173
|
+
- `quality checks (guardrails)`
|
|
174
|
+
|
|
175
|
+
Compliance boundary: formal policy and audit artifacts must keep canonical terminology for operational traceability.
|
|
142
176
|
|
|
143
177
|
---
|
|
144
178
|
|
|
@@ -146,11 +180,10 @@ Full mapping reference: docs/terminology-mapping.md
|
|
|
146
180
|
|
|
147
181
|
- FAQ: docs/faq.md
|
|
148
182
|
- Deep dive internals: docs/deep-dive.md
|
|
149
|
-
-
|
|
183
|
+
- Project history (phase outcomes, archived playbooks, retired roadmap): docs/archive/HISTORY.md
|
|
150
184
|
- Integration playbook: docs/integration-playbook.md
|
|
151
185
|
- Benchmark and stack reference: docs/benchmark-reference.md
|
|
152
|
-
-
|
|
153
|
-
- Product roadmap: docs/roadmap.md
|
|
186
|
+
- Active roadmap and backlog: docs/deep-analysis-and-roadmap-backlog.md
|
|
154
187
|
|
|
155
188
|
---
|
|
156
189
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryuenn3123/agentic-senior-core",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Change your AI Agent to code like a Staff Engineer, not a Junior.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"agentic-senior-core": "bin/agentic-senior-core.js"
|
|
8
8
|
},
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"audit:release-bundle": "node ./scripts/audit-release-bundle.mjs",
|
|
64
64
|
"audit:file-size": "node ./scripts/audit-file-size.mjs",
|
|
65
65
|
"audit:rule-id-uniqueness": "node ./scripts/audit-rule-id-uniqueness.mjs",
|
|
66
|
-
"audit:v3-purge": "node ./scripts/v3-purge-audit.mjs",
|
|
67
66
|
"build:release-bundle": "node ./scripts/build-release-benchmark-bundle.mjs",
|
|
68
67
|
"sync:adapters": "node ./scripts/sync-thin-adapters.mjs",
|
|
69
68
|
"check:adapters": "node ./scripts/sync-thin-adapters.mjs --check",
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
"report:governance-weekly": "node ./scripts/governance-weekly-report.mjs",
|
|
85
84
|
"clean:local": "node ./scripts/clean-local-artifacts.mjs",
|
|
86
85
|
"validate": "node ./scripts/validate.mjs",
|
|
87
|
-
"test": "node --test ./tests/cli-smoke.test.mjs ./tests/mcp-server.test.mjs ./tests/llm-judge.test.mjs ./tests/ui-rubric-calibration.test.mjs ./tests/operations.test.mjs ./tests/knowledge-injection.test.mjs ./tests/
|
|
86
|
+
"test": "node --test ./tests/cli-smoke.test.mjs ./tests/mcp-server.test.mjs ./tests/llm-judge.test.mjs ./tests/ui-rubric-calibration.test.mjs ./tests/operations.test.mjs ./tests/knowledge-injection.test.mjs ./tests/audit-caching-scope-hygiene.test.mjs ./tests/research-dossier-migration.test.mjs ./tests/typography-palette-anti-repeat-audit.test.mjs ./tests/audit-design-anti-repeat-command.test.mjs ./benchmarks/token-usage/lib/token-counter.test.mjs ./benchmarks/token-usage/lib/provider-cache-matrix.test.mjs ./benchmarks/token-usage/lib/cache-layer-contract.test.mjs ./benchmarks/token-usage/lib/cache-economics.test.mjs"
|
|
88
87
|
},
|
|
89
88
|
"devDependencies": {
|
|
90
89
|
"@anthropic-ai/sdk": "^0.96.0",
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* Phase 2 cache-layer integrity gate. Validates provider cache metadata,
|
|
6
6
|
* fixture segmentation, and the emitted cache simulation JSON without calling
|
|
7
7
|
* provider APIs.
|
|
8
|
+
*
|
|
9
|
+
* Boundary: this audit covers the TECHNICAL contract (provider matrix,
|
|
10
|
+
* layer definitions, fixture segmentation, simulation result JSON shape).
|
|
11
|
+
* For public-prose hygiene around caching saving figures see
|
|
12
|
+
* audit-caching-scope-hygiene.mjs.
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
* that each claim is integration-scoped per `docs/architecture/decisions-foundation.md`
|
|
10
10
|
* D4 "Per-Tool Caching Scope Matrix".
|
|
11
11
|
*
|
|
12
|
+
* Boundary: this audit covers PUBLIC-PROSE hygiene only (preventing
|
|
13
|
+
* universal "X% caching saving" claims that mix integration modes). For the
|
|
14
|
+
* technical provider/fixture/result-JSON contract see
|
|
15
|
+
* audit-cache-layer-contract.mjs.
|
|
16
|
+
*
|
|
12
17
|
* The rule: never publish a single universal "X% caching saving" figure that
|
|
13
18
|
* mixes integration modes. Every numerical caching saving claim on a public
|
|
14
19
|
* surface must either:
|
|
@@ -15,7 +15,6 @@ const LOCAL_ARTIFACT_PATHS = [
|
|
|
15
15
|
'.zed',
|
|
16
16
|
'.agentic-backup',
|
|
17
17
|
'.agent-context/state/active-memory.json',
|
|
18
|
-
'.agent-context/state/v3-purge-audit.json',
|
|
19
18
|
'.agent-context/state/llm-judge-report.json',
|
|
20
19
|
'.agent-context/state/benchmark-analysis.json',
|
|
21
20
|
'.agent-context/state/benchmark-evidence-bundle.json',
|
|
@@ -17,9 +17,7 @@ const __dirname = dirname(__filename);
|
|
|
17
17
|
const REPOSITORY_ROOT = resolve(__dirname, '..');
|
|
18
18
|
|
|
19
19
|
const REQUIRED_FILES = [
|
|
20
|
-
'docs/
|
|
21
|
-
'docs/archive/v1.7-issue-breakdown.md',
|
|
22
|
-
'docs/archive/v1.7-execution-playbook.md',
|
|
20
|
+
'docs/archive/HISTORY.md',
|
|
23
21
|
'AGENTS.md',
|
|
24
22
|
'.agent-context/prompts/bootstrap-design.md',
|
|
25
23
|
'scripts/ui-design-judge.mjs',
|
|
@@ -32,11 +30,10 @@ const REQUIRED_FILES = [
|
|
|
32
30
|
'lib/cli/detector/design-evidence.mjs',
|
|
33
31
|
];
|
|
34
32
|
|
|
35
|
-
const
|
|
33
|
+
const REQUIRED_HISTORY_SNIPPETS = [
|
|
36
34
|
'V1.7',
|
|
37
35
|
'Frontend Product Experience',
|
|
38
|
-
'
|
|
39
|
-
'Delivered Scope',
|
|
36
|
+
'completed',
|
|
40
37
|
];
|
|
41
38
|
|
|
42
39
|
const REQUIRED_PR_CHECKLIST_SNIPPETS = [
|
|
@@ -174,7 +171,7 @@ function runAudit() {
|
|
|
174
171
|
assertFileExists(requiredFilePath, failures);
|
|
175
172
|
}
|
|
176
173
|
|
|
177
|
-
const roadmapPath = 'docs/
|
|
174
|
+
const roadmapPath = 'docs/archive/HISTORY.md';
|
|
178
175
|
const frontendRulePath = '.agent-context/rules/frontend-architecture.md';
|
|
179
176
|
const bootstrapDesignPromptPath = '.agent-context/prompts/bootstrap-design.md';
|
|
180
177
|
const instructionsPath = 'AGENTS.md';
|
|
@@ -185,7 +182,7 @@ function runAudit() {
|
|
|
185
182
|
|
|
186
183
|
if (existsSync(resolve(REPOSITORY_ROOT, roadmapPath))) {
|
|
187
184
|
const roadmapContent = readFileSync(resolve(REPOSITORY_ROOT, roadmapPath), 'utf8');
|
|
188
|
-
assertContains('
|
|
185
|
+
assertContains('Project history', roadmapPath, roadmapContent, REQUIRED_HISTORY_SNIPPETS, failures);
|
|
189
186
|
}
|
|
190
187
|
|
|
191
188
|
if (existsSync(resolve(REPOSITORY_ROOT, prChecklistPath))) {
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
export function runStaticReleaseChecks(results, diagnostics) {
|
|
24
24
|
const packageJsonPath = 'package.json';
|
|
25
25
|
const changelogPath = 'CHANGELOG.md';
|
|
26
|
-
const roadmapPath = 'docs/roadmap.md';
|
|
27
26
|
|
|
28
27
|
const packageJsonContent = readText(packageJsonPath);
|
|
29
28
|
if (!packageJsonContent) {
|
|
@@ -61,13 +60,14 @@ export function runStaticReleaseChecks(results, diagnostics) {
|
|
|
61
60
|
pushResult(results, true, 'changelog-version-entry', `Found release header for ${releaseVersion}`);
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const historyPath = 'docs/archive/HISTORY.md';
|
|
64
|
+
const historyContent = readText(historyPath);
|
|
65
|
+
if (!historyContent) {
|
|
66
|
+
pushResult(results, false, 'history-exists', `Missing ${historyPath}`);
|
|
67
|
+
} else if (!historyContent.includes('V1.8')) {
|
|
68
|
+
pushResult(results, false, 'history-v18', 'Project history does not mention V1.8 release track');
|
|
69
69
|
} else {
|
|
70
|
-
pushResult(results, true, '
|
|
70
|
+
pushResult(results, true, 'history-v18', 'Project history includes V1.8 release track');
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
try {
|
|
@@ -51,7 +51,6 @@ export const REQUIRED_HUMAN_WRITING_SNIPPETS = [
|
|
|
51
51
|
];
|
|
52
52
|
export const TERMINOLOGY_REFERENCE_PATHS = [
|
|
53
53
|
'README.md',
|
|
54
|
-
'docs/roadmap.md',
|
|
55
54
|
];
|
|
56
55
|
export const REQUIRED_TERMINOLOGY_ROW_PATTERNS = [
|
|
57
56
|
{
|
|
@@ -69,7 +68,6 @@ export const REQUIRED_TERMINOLOGY_ROW_PATTERNS = [
|
|
|
69
68
|
];
|
|
70
69
|
export const REQUIRED_TERMINOLOGY_RULE_SNIPPET =
|
|
71
70
|
'Rule: on first mention in developer-facing docs, include canonical term in parentheses.';
|
|
72
|
-
export const TERMINOLOGY_REFERENCE_DOCUMENT_PATH = 'docs/terminology-mapping.md';
|
|
73
71
|
export const REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS = [
|
|
74
72
|
{
|
|
75
73
|
path: 'README.md',
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
REQUIRED_UI_DESIGN_AUTOMATION_SNIPPETS,
|
|
20
20
|
REQUIRED_UNIVERSAL_SOP_SNIPPETS,
|
|
21
21
|
REQUIRED_UPGRADE_UI_CONTRACT_WARNING_SNIPPETS,
|
|
22
|
-
TERMINOLOGY_REFERENCE_DOCUMENT_PATH,
|
|
23
22
|
TERMINOLOGY_REFERENCE_PATHS,
|
|
24
23
|
THIN_ADAPTER_PATHS,
|
|
25
24
|
} from './config.mjs';
|
|
@@ -59,40 +58,6 @@ export async function validateTerminologyMapping(context) {
|
|
|
59
58
|
|
|
60
59
|
console.log('\nChecking terminology mapping consistency...');
|
|
61
60
|
|
|
62
|
-
const terminologyReferenceDocumentPath = join(ROOT_DIR, TERMINOLOGY_REFERENCE_DOCUMENT_PATH);
|
|
63
|
-
|
|
64
|
-
if (!(await fileExists(terminologyReferenceDocumentPath))) {
|
|
65
|
-
fail(`Missing terminology reference document: ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
|
|
66
|
-
} else {
|
|
67
|
-
const terminologyReferenceContent = await readTextFile(terminologyReferenceDocumentPath);
|
|
68
|
-
|
|
69
|
-
if (terminologyReferenceContent.includes('Dual-Term Mapping')) {
|
|
70
|
-
pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} includes Dual-Term Mapping section`);
|
|
71
|
-
} else {
|
|
72
|
-
fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must include Dual-Term Mapping section`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
for (const terminologyRowRule of REQUIRED_TERMINOLOGY_ROW_PATTERNS) {
|
|
76
|
-
if (terminologyRowRule.pattern.test(terminologyReferenceContent)) {
|
|
77
|
-
pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} includes mapping row: ${terminologyRowRule.label}`);
|
|
78
|
-
} else {
|
|
79
|
-
fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} is missing mapping row: ${terminologyRowRule.label}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (terminologyReferenceContent.includes('first mention must include canonical term in parentheses')) {
|
|
84
|
-
pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} defines first-mention canonical term rule`);
|
|
85
|
-
} else {
|
|
86
|
-
fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must define first-mention canonical term rule`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (terminologyReferenceContent.includes('Formal policy and audit artifacts must keep canonical terminology')) {
|
|
90
|
-
pass(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} defines compliance terminology boundary`);
|
|
91
|
-
} else {
|
|
92
|
-
fail(`${TERMINOLOGY_REFERENCE_DOCUMENT_PATH} must define compliance terminology boundary`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
61
|
for (const terminologyReferencePath of TERMINOLOGY_REFERENCE_PATHS) {
|
|
97
62
|
const absoluteReferencePath = join(ROOT_DIR, terminologyReferencePath);
|
|
98
63
|
|
|
@@ -122,12 +87,6 @@ export async function validateTerminologyMapping(context) {
|
|
|
122
87
|
} else {
|
|
123
88
|
fail(`${terminologyReferencePath} must include first-mention canonical term rule`);
|
|
124
89
|
}
|
|
125
|
-
|
|
126
|
-
if (referenceContent.includes(TERMINOLOGY_REFERENCE_DOCUMENT_PATH)) {
|
|
127
|
-
pass(`${terminologyReferencePath} links to ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
|
|
128
|
-
} else {
|
|
129
|
-
fail(`${terminologyReferencePath} must link to ${TERMINOLOGY_REFERENCE_DOCUMENT_PATH}`);
|
|
130
|
-
}
|
|
131
90
|
}
|
|
132
91
|
|
|
133
92
|
for (const firstMentionRule of REQUIRED_DEVELOPER_FIRST_MENTION_PATTERNS) {
|
|
@@ -397,7 +356,7 @@ export async function validateInstructionAdapters(context) {
|
|
|
397
356
|
const instructionFootprintLimits = [
|
|
398
357
|
{ path: 'AGENTS.md', maxLines: 180 },
|
|
399
358
|
{ path: '.agent-context/prompts/bootstrap-design.md', maxLines: 180 },
|
|
400
|
-
{ path: '.agent-context/rules/frontend-architecture.md', maxLines:
|
|
359
|
+
{ path: '.agent-context/rules/frontend-architecture.md', maxLines: 180 },
|
|
401
360
|
];
|
|
402
361
|
|
|
403
362
|
for (const requiredBootstrapReceiptSnippet of requiredBootstrapReceiptSnippets) {
|
package/scripts/validate.mjs
CHANGED
|
@@ -158,7 +158,6 @@ async function validateRequiredFiles() {
|
|
|
158
158
|
'lib/cli/audits/typography-palette-anti-repeat-audit.mjs',
|
|
159
159
|
'lib/cli/commands/audit-design-anti-repeat.mjs',
|
|
160
160
|
'scripts/sync-thin-adapters.mjs',
|
|
161
|
-
'scripts/v3-purge-audit.mjs',
|
|
162
161
|
'scripts/release-gate.mjs',
|
|
163
162
|
'scripts/generate-sbom.mjs',
|
|
164
163
|
'.agent-context/policies/llm-judge-threshold.json',
|
|
@@ -175,11 +174,8 @@ async function validateRequiredFiles() {
|
|
|
175
174
|
'docs/api-contract.md',
|
|
176
175
|
'docs/faq.md',
|
|
177
176
|
'docs/deep-dive.md',
|
|
178
|
-
'docs/
|
|
179
|
-
'docs/archive/
|
|
180
|
-
'docs/archive/v1.7-issue-breakdown.md',
|
|
181
|
-
'docs/archive/v1.8-operations-playbook.md',
|
|
182
|
-
'docs/archive/v2-upgrade-playbook.md',
|
|
177
|
+
'docs/archive/HISTORY.md',
|
|
178
|
+
'docs/archive/CHANGELOG-archive.md',
|
|
183
179
|
'.agent-context/state/benchmark-reproducibility.json',
|
|
184
180
|
'.agent-context/state/benchmark-writer-judge-config.json',
|
|
185
181
|
'.agent-context/state/memory-schema-v1.json',
|
|
@@ -247,6 +243,12 @@ async function validateRuleFiles() {
|
|
|
247
243
|
'rules/realtime.md',
|
|
248
244
|
'rules/frontend-architecture.md',
|
|
249
245
|
'rules/docker-runtime.md',
|
|
246
|
+
'rules/observability.md',
|
|
247
|
+
'rules/resilience.md',
|
|
248
|
+
'rules/migrations.md',
|
|
249
|
+
'rules/background-jobs.md',
|
|
250
|
+
'rules/config-and-flags.md',
|
|
251
|
+
'rules/api-versioning.md',
|
|
250
252
|
'review-checklists/pr-checklist.md',
|
|
251
253
|
'review-checklists/architecture-review.md',
|
|
252
254
|
'prompts/init-project.md',
|
|
@@ -496,7 +498,7 @@ async function validateDocumentationFlow() {
|
|
|
496
498
|
'npm run validate',
|
|
497
499
|
'docs/faq.md',
|
|
498
500
|
'docs/deep-dive.md',
|
|
499
|
-
'docs/archive/
|
|
501
|
+
'docs/archive/HISTORY.md',
|
|
500
502
|
];
|
|
501
503
|
|
|
502
504
|
for (const requiredReadmeSnippet of requiredReadmeSnippets) {
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Locked ID prefix table per `docs/architecture/format-spec.md` section 3.
|
|
5
|
-
* The migration helper reads this map to assign frontmatter and section IDs.
|
|
6
|
-
* Lock new entries here when adding a new rule file; never invent prefixes inline.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const ID_PREFIX_TABLE = Object.freeze({
|
|
10
|
-
'api-docs.md': { prefix: 'API', domain: 'api-docs', priority: 'high', scope: 'backend', appliesTo: ['backend', 'fullstack'] },
|
|
11
|
-
'architecture.md': { prefix: 'ARCH', domain: 'architecture', priority: 'critical', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
12
|
-
'database-design.md': { prefix: 'DATA', domain: 'database-design', priority: 'high', scope: 'data', appliesTo: ['backend', 'fullstack'] },
|
|
13
|
-
'docker-runtime.md': { prefix: 'DOCK', domain: 'docker-runtime', priority: 'high', scope: 'infra', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
14
|
-
'efficiency-vs-hype.md': { prefix: 'DEP', domain: 'efficiency-vs-hype', priority: 'medium', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
15
|
-
'error-handling.md': { prefix: 'ERR', domain: 'error-handling', priority: 'high', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
16
|
-
'event-driven.md': { prefix: 'EVT', domain: 'event-driven', priority: 'medium', scope: 'backend', appliesTo: ['backend', 'fullstack'] },
|
|
17
|
-
'frontend-architecture.md': { prefix: 'FE', domain: 'frontend-architecture', priority: 'high', scope: 'ui', appliesTo: ['frontend', 'fullstack'] },
|
|
18
|
-
'git-workflow.md': { prefix: 'GIT', domain: 'git-workflow', priority: 'medium', scope: 'governance', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
19
|
-
'microservices.md': { prefix: 'SVC', domain: 'microservices', priority: 'medium', scope: 'backend', appliesTo: ['backend', 'fullstack'] },
|
|
20
|
-
'naming-conv.md': { prefix: 'NAME', domain: 'naming-conv', priority: 'medium', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
21
|
-
'performance.md': { prefix: 'PERF', domain: 'performance', priority: 'medium', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
22
|
-
'realtime.md': { prefix: 'RT', domain: 'realtime', priority: 'medium', scope: 'backend', appliesTo: ['backend', 'fullstack'] },
|
|
23
|
-
'security.md': { prefix: 'SEC', domain: 'security', priority: 'critical', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
24
|
-
'testing.md': { prefix: 'TEST', domain: 'testing', priority: 'high', scope: 'all-tasks', appliesTo: ['backend', 'frontend', 'fullstack'] },
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @param {string} filename
|
|
29
|
-
* @returns {{ prefix: string, domain: string, priority: string, scope: string, appliesTo: string[] }}
|
|
30
|
-
*/
|
|
31
|
-
export function getPrefixEntry(filename) {
|
|
32
|
-
const entry = ID_PREFIX_TABLE[filename];
|
|
33
|
-
if (!entry) {
|
|
34
|
-
throw new Error(`Unknown rule file '${filename}'. Add it to ID_PREFIX_TABLE before migrating.`);
|
|
35
|
-
}
|
|
36
|
-
return entry;
|
|
37
|
-
}
|