@stackonward/cli 1.7.0 → 1.8.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 (69) hide show
  1. package/dist/index.js +8 -8
  2. package/dist/index.js.map +1 -1
  3. package/dist/resources/components/nuxt/site-source/app/composables/useWebPush.ts +4 -0
  4. package/dist/resources/components/nuxt/site-source/app/plugins/web-push.ts +52 -0
  5. package/dist/resources/components/nuxt/site-source/app/web-push/worker.ts +8 -0
  6. package/dist/resources/components/registry.json +11 -1
  7. package/dist/resources/registry.json +15 -3
  8. package/dist/resources/templates/base/{.claude → .codex}/docs/architecture-template.md +1 -1
  9. package/dist/resources/templates/base/{.claude → .codex}/docs/architecture.md +1 -1
  10. package/dist/resources/templates/base/{.claude → .codex}/docs/index.md +3 -3
  11. package/dist/resources/templates/base/{.claude → .codex}/docs/verification.md +1 -1
  12. package/dist/resources/templates/base/AGENTS.md +24 -24
  13. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/api-design.md +1 -1
  14. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/architecture-template.md +1 -1
  15. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/check-list.md +3 -3
  16. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/database.md +1 -1
  17. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/error-handling.md +1 -1
  18. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/index.md +1 -1
  19. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/logging.md +1 -1
  20. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/mediagen-provider-onboarding-sop.md +2 -2
  21. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/mediagen-provider-quick-reference.md +1 -1
  22. package/dist/resources/templates/go-backend/{.claude → .codex}/docs/module-standards.md +1 -1
  23. package/dist/resources/templates/go-backend/.dockerignore +1 -2
  24. package/dist/resources/templates/go-backend/AGENTS.md +19 -19
  25. package/dist/resources/templates/go-backend/README.md +5 -1
  26. package/dist/resources/templates/go-backend/deployments/onex/product-onboarding.example.json +201 -0
  27. package/dist/resources/templates/go-backend/docs/onex-notifications.md +85 -0
  28. package/dist/resources/templates/go-backend/docs/openapi-provenance.json +1 -1
  29. package/dist/resources/templates/go-backend/docs/runtime-provenance.json +23 -2
  30. package/dist/resources/templates/go-backend/docs/source-provenance.json +124 -6
  31. package/dist/resources/templates/go-backend/docs/standards-provenance.json +30 -30
  32. package/dist/resources/templates/go-backend/internal/common/middleware/cors.go +1 -0
  33. package/dist/resources/templates/go-backend/internal/common/middleware/middleware_test.go +1 -0
  34. package/dist/resources/templates/go-backend/internal/core/httpclient/safe_post.go +28 -0
  35. package/dist/resources/templates/go-backend/internal/core/httpclient/safe_post_test.go +56 -0
  36. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/client.go +453 -0
  37. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/client_test.go +772 -0
  38. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/codec.go +33 -0
  39. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/error.go +146 -0
  40. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/error_notification_test.go +29 -0
  41. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/client.go +132 -0
  42. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/client_test.go +222 -0
  43. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/contracts.go +219 -0
  44. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/resilience.go +23 -0
  45. package/dist/resources/templates/go-backend/internal/integrations/onex/v1/transport_policy.go +96 -0
  46. package/dist/resources/templates/go-backend/internal/products/README.md +1 -1
  47. package/dist/resources/templates/go-backend/internal/sharedevents/README.md +1 -1
  48. package/dist/resources/templates/go-backend/scripts/check-openapi-clean-deletion.sh +3 -3
  49. package/dist/resources/templates/mcp-server/.prettierignore +1 -0
  50. package/dist/resources/templates/nuxt/{.claude → .codex}/docs/stack.md +10 -0
  51. package/dist/resources/templates/nuxt/.dockerignore +1 -1
  52. package/dist/resources/templates/nuxt/.env.example +6 -0
  53. package/dist/resources/templates/nuxt/.prettierignore +2 -1
  54. package/dist/resources/templates/nuxt/DESIGN.md +1 -1
  55. package/dist/resources/templates/nuxt/README.md +8 -0
  56. package/dist/resources/templates/nuxt/nuxt.config.ts +13 -1
  57. package/dist/resources/templates/nuxt/package.json +4 -2
  58. package/package.json +1 -1
  59. package/dist/resources/templates/base/CLAUDE.md +0 -437
  60. package/dist/resources/templates/go-backend/CLAUDE.md +0 -1139
  61. /package/dist/resources/templates/base/{.claude → .codex}/docs/security-lifecycle.md +0 -0
  62. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/e2e-standards.md +0 -0
  63. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/event-runtime-boundary.md +0 -0
  64. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/identifier-contract.md +0 -0
  65. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/openapi-contract.md +0 -0
  66. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/payment-gateway-onboarding.md +0 -0
  67. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/platform-boundary.md +0 -0
  68. /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/quality-gates.md +0 -0
  69. /package/dist/resources/templates/mcp-server/{.claude → .codex}/docs/stack.md +0 -0
@@ -1,437 +0,0 @@
1
- # Application Engineering Standard
2
-
3
- > **Runtime**: Node.js ESM and TypeScript; complete installed stack in `.claude/docs/stack.md`.
4
- > **Owner**: application business rules, routes, branding, configuration and release.
5
- > **Dependencies**: versioned public package exports; generated source belongs to this application.
6
-
7
- ---
8
-
9
- ## Project Structure
10
-
11
- ```text
12
- app/ and server/ # Nuxt presentation and server execution boundaries
13
- src/ # MCP registrations, adapters and process startup
14
- package.json # Installed dependencies and executable commands
15
- .env.example # Configuration schema without credentials
16
- .claude/docs/ # Complete engineering specifications
17
- ```
18
-
19
- ---
20
-
21
- ## Quick Start
22
-
23
- ```bash
24
- pnpm install
25
- pnpm format:check
26
- pnpm lint
27
- pnpm typecheck
28
- pnpm test
29
- pnpm build
30
- ```
31
-
32
- ---
33
-
34
- ## Coding Rules
35
-
36
- The selected stack has complete coding rules in `.claude/docs/stack.md`. Shared AI execution flow is defined in this file. `AGENTS.md` contains the same complete body. Nested rules add owner-specific constraints.
37
-
38
- | File | Scope |
39
- | --------------------------------------- | ------------------------------------------------------------- |
40
- | `CLAUDE.md` | Shared execution flow and delivery discipline |
41
- | `.claude/docs/index.md` | Reading order and module navigation |
42
- | `.claude/docs/stack.md` | Framework rules, full command and environment tables |
43
- | `.claude/docs/architecture.md` | Ownership, dependency direction, contracts and reuse |
44
- | `.claude/docs/security-lifecycle.md` | Validation, secrets, authorization, cancellation and recovery |
45
- | `.claude/docs/verification.md` | Verification and delivery requirements |
46
- | `.claude/docs/architecture-template.md` | Complete design skeleton |
47
-
48
- **Read the selected stack and applicable nested `CLAUDE.md` before writing code.**
49
-
50
- ## Visual Design Standards (CRITICAL)
51
-
52
- For a stack with a visual interface, **MUST** read the design standard identified by `.claude/docs/stack.md` before choosing icons, colors, sizing or component overrides. Use that stack's installed component system, token owner and asset conventions. Icon artwork, accessible labels and interactive target size are separate responsibilities; local size changes must use the existing component contract.
53
-
54
- **FORBIDDEN**: inventing a second icon library or theme implementation for an existing capability. Non-visual stacks do not acquire UI dependencies or a required design document from this rule.
55
-
56
- ## Technology Stack and Environment
57
-
58
- Read `package.json`, `.env.example`, configuration consumers and `.claude/docs/stack.md` before changing dependencies or environment variables. A sample variable does not prove that runtime code reads it. Nuxt uses `pnpm dev` / `pnpm preview`; MCP uses `pnpm start:stdio` after build. Never put private credentials in Nuxt public configuration or MCP tool output.
59
-
60
- ## Workflow Proportionality (CRITICAL)
61
-
62
- | Level | Proven boundary | Required workflow |
63
- | ------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
64
- | LOCAL | One owner, no public-contract, security or lifecycle change | Read owner and direct consumers; correct the cause and run targeted verification |
65
- | FOCUSED | One existing contract or high-risk behavior | Focused design and producer-consumer verification |
66
- | ARCHITECTURAL | New shared abstraction or cross-module architecture | Complete applicable design, primary-source research and relevant review |
67
-
68
- Semantic impact selects depth before file count or document size. Local corrections do not require architecture research. Findings expand scope only when they caused the request, were introduced by the change or block verification.
69
-
70
- ## Pre-implementation Declarations (CRITICAL)
71
-
72
- For non-trivial additions, declare `PLACEMENT/NAMING` (owner, name, kind, responsibility, searched reuse and business nouns), `PATTERN / WHY / SCOPE`, `EXISTING / APPROACH / SCOPE` and `RULES / REUSE / LAYER` before editing.
73
-
74
- External calls, user-selectable alternatives, variable business policy, replaceable technology, standard extension points and multi-tenant behavior require `EXTENSIBILITY-INTENT`: signal, current and expected implementations, confidence, pattern, interface/configuration first, and exact files a second adapter would change. Otherwise state `NO-ABSTRACTION-JUSTIFICATION` and its refactor trigger.
75
-
76
- ## Owner-Scoped Naming (CRITICAL)
77
-
78
- Directories, modules and packages are namespaces. Child files and symbols **MUST** keep only the minimum responsibility-bearing name and **MUST NOT** repeat the owner or replace one redundant caller prefix with another (`MarketingHeader` -> `PublicHeader` remains forbidden).
79
-
80
- - Inside an explicit owner, use short names such as `Header`, `Config`, `Status`, `Menu`, `EventInput` or `items`; across owners, add only the shortest required qualifier, such as `SiteHeader`, `LocaleMenu`, `GTMOptions` or `GA4Event`.
81
- - Names describe responsibility, never the first caller, page, brand, task or conversation. Pure transforms use business-free names; business and protocol nouns remain only when they enforce that contract.
82
- - Directories, packages and ordinary TypeScript modules use kebab-case; Vue composables use `useX.ts`; Vue component files and types use PascalCase; variables and functions use camelCase; only true fixed invariants use UPPER_SNAKE_CASE. Framework route and endpoint files follow framework syntax.
83
- - External or business-owned identifiers such as `purchase`, `login` and `gateway_*` are semantic contracts, not code-name redundancy, and remain unchanged.
84
- - Vague standalone or catch-all names such as `helper`, `utils`, `common` and `manager` are forbidden; choose a precise owner and responsibility. `temp`, `new` and `final` naming residue is forbidden. Search owners, siblings and usages before naming or renaming; update all references and delete superseded names together.
85
- - Nuxt component directories remain namespaces: preserve default path-aware auto-naming and never set global `pathPrefix: false`. Local explicit imports may use the short name; cross-owner and global auto-imports use the path qualifier.
86
-
87
- ✅ `analytics/events.ts::EventInput`, `components/site/Header.vue` -> `SiteHeader`, `useTracking`, `GTMOptions`, `GA4Event`
88
-
89
- ❌ `types/marketing-analytics.ts`, `MarketingHeader`, `PublicHeader`, `GoogleTagManagerOptions`
90
-
91
- ---
92
-
93
- # AI Execution Standard
94
-
95
- > Mandatory workflow for every task, regardless of language or subproject.
96
- > Stack-specific rules are in `.claude/docs/stack.md` and applicable nested rules.
97
-
98
- ---
99
-
100
- ## Phase 1: Understand
101
-
102
- Before touching code, fully understand the task and its context.
103
-
104
- ### 1.1 Read Project Documentation
105
-
106
- 1. Read this file for shared execution rules.
107
- 2. Read the subproject `CLAUDE.md` for stack-specific rules, starting with `.claude/docs/stack.md`.
108
- 3. Read subproject specs, and shared specs under `.claude/docs/` that are relevant to the task.
109
- 4. Read existing architecture documents for affected modules.
110
-
111
- **Read specs before designing. Do not rely on memory or assumptions about project conventions.**
112
-
113
- ### 1.2 Scope the Impact
114
-
115
- For each task, answer:
116
-
117
- - Which modules are affected?
118
- - Which files need modification?
119
- - Does data cross a module boundary?
120
- - Does this affect build or generation steps, such as Nuxt preparation, TypeScript checking or compiled MCP entrypoints?
121
-
122
- ### 1.3 Read All Affected Source Files
123
-
124
- Read every file that will be modified. Understand:
125
-
126
- - Current function signatures and parameter types.
127
- - Current data structures and behavior.
128
- - Current data flow from input to output.
129
- - Existing patterns and conventions in the file.
130
-
131
- **Do not modify any file you have not read in the current session. Do not assume code shape from memory.**
132
-
133
- ---
134
-
135
- ## Phase 2: Design
136
-
137
- Design the solution before writing code. This is the most important phase.
138
-
139
- ### 2.1 Research Industry Standards (MANDATORY)
140
-
141
- Before proposing any design, research industry best practices first. This is not optional.
142
-
143
- For every design decision, answer: "How does an industry leader solve this exact problem?"
144
-
145
- Required research sources by domain:
146
-
147
- | Domain | Must reference |
148
- | ------------------ | --------------------------------------------------------- |
149
- | API design | Stripe API, GitHub API, Slack API |
150
- | Domain modeling | Stripe, Shopify, AWS service models |
151
- | Event architecture | AWS EventBridge, Stripe Events, CloudEvents spec |
152
- | Auth / Identity | Auth0, AWS Cognito, Keycloak |
153
- | Audit / Logging | AWS CloudTrail, Google Cloud Audit Logs, GitHub Audit Log |
154
- | Database schema | PostgreSQL official docs and relevant mature OSS projects |
155
- | State machines | Stripe payment lifecycle, AWS Step Functions |
156
-
157
- Research output must appear as a concrete table in the design document:
158
-
159
- ```markdown
160
- | Decision Point | Industry Pattern | Used By | Our Choice | Rationale |
161
- | -------------- | -------------------- | --------------- | ---------- | --------------------------------------------- |
162
- | Event delivery | Transactional Outbox | Stripe, Shopify | Outbox | Guarantees at-least-once delivery without 2PC |
163
- ```
164
-
165
- Missing this table means the design is incomplete and implementation is forbidden.
166
-
167
- Refactoring rule: do not propose removing, replacing, or rewriting existing architecture until you have analyzed what the current design was trying to achieve and how industry leaders solve the same problem.
168
-
169
- ### 2.2 Decision Autonomy (CRITICAL)
170
-
171
- AI must make standard technical decisions autonomously. Never ask the user to choose when an industry-standard answer exists.
172
-
173
- | Level | Condition | Action |
174
- | -------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
175
- | **Autonomous** | Industry consensus exists; two or more major platforms use the same pattern | Decide and implement. State the decision and cite the standard. Do not ask |
176
- | **Recommend** | Two or three viable options exist with clear trade-offs, and one is likely better | State the recommendation with reasoning. Implement the recommended option unless the user objects |
177
- | **Escalate** | Genuine trade-off with no clear winner, business/product decision, or irreversible architecture choice | Present options with concrete trade-off analysis and wait for user input |
178
-
179
- Examples of autonomous decisions:
180
-
181
- - Outbox vs dual-write -> Outbox.
182
- - Soft delete vs hard delete -> Soft delete with `deleted_at`.
183
- - Event naming convention -> `{resource}.{action}` in past tense.
184
- - Pagination style -> Cursor-based for large datasets, offset for admin screens.
185
- - Password hashing algorithm -> bcrypt or argon2.
186
- - API error format -> RFC 9457-style semantics in the agreed HTTP `{ error: {...} }` envelope.
187
- - Idempotency mechanism -> Idempotency key header following the Stripe pattern.
188
-
189
- Examples of escalation decisions:
190
-
191
- - Which payment provider to integrate.
192
- - Whether to split a monolith into microservices.
193
- - Pricing model or billing structure.
194
- - Which third-party SaaS to adopt when vendor lock-in is material.
195
-
196
- The user is a developer, not an architect. If the correct technical decision is clear, make it.
197
-
198
- ### 2.3 Define the Target State
199
-
200
- For each touched area, define the exact desired end state. The design must include concrete code architecture, not just a list of edits.
201
-
202
- Be concrete. "Add a status field" is insufficient. Specify exact types, constraints, behavior, and ownership.
203
-
204
- Design code architecture in the plan, not while editing files.
205
-
206
- ### 2.4 Validate the Design
207
-
208
- Patch-vs-design check: before proposing a fix, ask whether the change is being made in the one place that owns the responsibility. If it is a workaround, find the owning location first.
209
-
210
- Check every design decision against the subproject's forbidden-pattern table. If any check fails, revise the design before implementation.
211
-
212
- ### 2.5 Determine Design Document Level
213
-
214
- ```text
215
- New module or major architecture change?
216
- -> Level A: full architecture document
217
-
218
- Change an existing public contract or security/lifecycle boundary?
219
- -> Level B: focused design document
220
-
221
- Otherwise?
222
- -> Level C: fix design
223
- ```
224
-
225
- | Level | Required output |
226
- | ----- | ------------------------------------------------------------------------------------------- |
227
- | **A** | Complete architecture document with all mandatory sections |
228
- | **B** | Impact scope, industry reference, schema/model/API changes, data flow, implementation waves |
229
- | **C** | Root cause analysis, fix design, affected files, verification plan |
230
-
231
- ### 2.6 Self-Review Gate (MANDATORY)
232
-
233
- After completing any design or implementation, self-review before presenting work to the user.
234
-
235
- Self-review checklist:
236
-
237
- 1. **Industry alignment**: For each design decision, is this what Stripe, AWS, or GitHub would do? If not, why is the deviation justified?
238
- 2. **Pattern correctness**: Is the named pattern, such as Outbox, CQRS, or Repository, used correctly, or did the implementation invent a hybrid that violates the guarantee?
239
- 3. **Scope creep**: Did the change add anything not requested? Did it miss anything requested?
240
- 4. **Forbidden-pattern scan**: Grep every changed file against the forbidden-pattern tables. Zero tolerance.
241
- 5. **Data-flow completeness**: For every new field, trace Source -> DTO -> Service -> Repository -> Entity -> VO -> Response.
242
- 6. **Error-path coverage**: For every new code path, identify what happens on failure. It must not be silently swallowed.
243
-
244
- If any check fails, fix it before presenting. Do not present work with known issues.
245
-
246
- For Level A/B designs, use independent review only for relevant risks that deterministic checks cannot close. Select zero to three dimensions and at most two review-fix rounds unless new in-scope blocking evidence appears.
247
-
248
- ### 2.7 Present Design for Approval
249
-
250
- Approval gate applies only to Level A designs.
251
-
252
- | Level | Approval behavior |
253
- | ----- | -------------------------------------------------------------------------------------------------------------------------------- |
254
- | **A** | Present a concrete design; obtain approval for unapproved irreversible or business choices. Existing authorization remains valid |
255
- | **B** | Present design summary, then proceed to implementation. User can interrupt if needed |
256
- | **C** | Implement directly and mention the fix rationale in the delivery message |
257
-
258
- ---
259
-
260
- ## Phase 3: Plan
261
-
262
- After design passes self-review, and after user approval for Level A, create the implementation plan.
263
-
264
- ### 3.1 List All File Modifications
265
-
266
- For each file, state the exact path, function or section to change, and intended change.
267
-
268
- ### 3.2 Map Dependencies
269
-
270
- Determine which changes depend on others. A change depends on another if it imports, references, or extends something defined by the other.
271
-
272
- ### 3.3 Group Into Dependency Waves
273
-
274
- Group changes so each wave depends only on previous waves. Independent changes within one wave may be implemented in parallel.
275
-
276
- ---
277
-
278
- ## Phase 4: Implement
279
-
280
- ### 4.1 Execute Wave by Wave
281
-
282
- For each wave:
283
-
284
- 1. Implement all changes in the wave.
285
- 2. Verify type consistency with previous waves.
286
- 3. Proceed to the next wave only when the current wave is clean.
287
-
288
- ### 4.2 Read Before Write
289
-
290
- Before modifying each file:
291
-
292
- 1. Read its current content.
293
- 2. Confirm the change is compatible with the actual file.
294
- 3. Then apply the modification.
295
-
296
- ### 4.3 Follow Existing Patterns
297
-
298
- When adding code to an existing file, match:
299
-
300
- - Naming conventions already used in that file.
301
- - Code style and formatting patterns.
302
- - Comment language and level of detail.
303
- - Import organization.
304
-
305
- ---
306
-
307
- ## Phase 5: Verify
308
-
309
- ### 5.1 Build
310
-
311
- Run the subproject's build and type-check commands. All must pass.
312
-
313
- ### 5.2 Design Conformance Check
314
-
315
- After build passes, verify the implementation matches the approved design. Every design item must be implemented. No silent omissions.
316
-
317
- ### 5.3 Quantitative Verification
318
-
319
- Grep for expected outcomes with concrete numbers. "It compiles" is necessary but not sufficient. Count the things that should exist.
320
-
321
- ### 5.4 Rule Conformance Check
322
-
323
- Re-validate actual implemented code against subproject forbidden-pattern tables. If any rule is violated, fix it before marking complete.
324
-
325
- ### 5.5 Automated Review Loop for Level A/B
326
-
327
- For Level A and Level B deliveries:
328
-
329
- 1. Select relevant architecture, rule or integration review dimensions that deterministic checks cannot close.
330
- 2. Collect findings.
331
- 3. Fix every finding.
332
- 4. Re-run review.
333
- 5. Complete at most two review-fix rounds unless new in-scope blocking evidence appears. Unresolved blocking findings prohibit completion.
334
- 6. Only then present the final result.
335
-
336
- The user should receive a clean, reviewed deliverable, not a draft that depends on the user catching quality issues.
337
-
338
- ---
339
-
340
- # Shared Rules
341
-
342
- Rules in this section apply to all subprojects regardless of language or framework.
343
-
344
- ---
345
-
346
- ## Forbidden Patterns — Shared (CRITICAL)
347
-
348
- Violation of any rule blocks commit. No exceptions.
349
-
350
- | ID | Category | Pattern | Fix |
351
- | ----- | ------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
352
- | SH-S1 | Security | Hardcoded secrets in source | Move to config/env |
353
- | SH-S3 | Security | Sensitive data in logs | Log IDs only; never log passwords, tokens, or PII |
354
- | SH-H2 | Hygiene | Commented-out code | Delete it; git has history |
355
- | SH-H5 | Hygiene | Unused or speculative code | Delete it; write only what is needed now |
356
- | SH-I1 | Identifier | Mixing public business numbers, business reference keys, idempotency keys, and third-party IDs in one field or naming scheme | Split identifier classes, use owner helpers, and put each semantic in the correct field |
357
- | SH-I2 | Identifier | Runtime exact-match deduplication on a reference or idempotency field without a matching DB unique constraint | Add a unique constraint on the exact lookup scope, or widen runtime lookup to the full owner scope |
358
- | SH-D1 | Deferred | `// TODO:` / `// 待后续` / `// 暂跳过` in committed code | Implement completely or return an explicit error |
359
- | SH-D2 | Deferred | Fallback branch for backward compatibility | Keep a single code path. Migrate data when format changes |
360
- | SH-D5 | Deferred | Silent skip of an unsupported feature | Return a typed error for unsupported operations |
361
- | SH-D7 | Deferred | `placeholder` / `stub` / `dummy` / `mock` in non-test code | Allow only in test files. Production code must be complete |
362
- | SH-M1 | Migration | Marking a migration complete from fresh empty-DB verification while imported databases still violate the current contract | Audit existing imported data and ship a repair or clean re-import path before calling the migration complete |
363
- | SH-E1 | Enforcement | Discovered violation deferred to "next time" | Fix it now. Rules have zero exceptions |
364
- | SH-E2 | Enforcement | Code delivered with known violations | Fix all violations before delivery |
365
- | SH-E3 | Enforcement | Fix applied as patch/workaround without proper design | Make the fix architecturally sound |
366
- | SH-E6 | Enum Registry | Cross-language enum metadata duplication, such as backend labels/colors/options plus frontend `constants/*.ts` copies | The owning backend contract is the single source of truth for business enum metadata. Consume its declared API/generated types; pure UI variants stay local. Do not assume a platform enum endpoint exists |
367
-
368
- Additional forbidden patterns are defined in each subproject's `CLAUDE.md`. Identifier/reference boundaries are in `.claude/docs/security-lifecycle.md`.
369
-
370
- ---
371
-
372
- ## Delivery Discipline (CRITICAL)
373
-
374
- Every delivery must achieve zero violations against this spec.
375
-
376
- | Principle | Detail |
377
- | ---------------------------------- | --------------------------------------------------- |
378
- | **Fix on discovery** | Found a violation -> fix it now |
379
- | **No exemptions** | No pattern is too simple to follow the rules |
380
- | **Design first** | Every fix must be designed properly, not patched |
381
- | **No later** | "Handle later" means handle now |
382
- | **Delivery means zero violations** | Delivery with known violations is a failed delivery |
383
-
384
- ---
385
-
386
- ## Git History Safety (CRITICAL)
387
-
388
- - Read package.json and hook configuration. Run the installed setup command when present; never claim an absent hook script ran.
389
- - `git commit --amend`, branch history rewrites, rebase-based repair, and force push are forbidden. Use new normal commits only.
390
- - Push rejection must be resolved by fetch, inspect, merge, and new commit. Do not bypass installed hooks or claim an uninstalled gate enforces these rules.
391
-
392
- ---
393
-
394
- ## Deferred Code Policy (CRITICAL)
395
-
396
- Every committed line must be production-ready. There are zero exceptions.
397
-
398
- The principle: fail loudly, never silently skip. A production system that returns an error is safer than one that silently does nothing.
399
-
400
- ---
401
-
402
- ## Comments
403
-
404
- - Code comments: Chinese ONLY.
405
- - Style: explain why, not what. Skip self-explanatory code.
406
- - Never include ticket numbers or commented-out code.
407
-
408
- ---
409
-
410
- ## Reference
411
-
412
- | Doc | Content |
413
- | --------------------------------------- | --------------------------------------------------------- |
414
- | `.claude/docs/stack.md` | Framework rules, real directories and executable commands |
415
- | `.claude/docs/architecture.md` | Types, owner boundaries and dependency direction |
416
- | `.claude/docs/security-lifecycle.md` | Trust, identity, secrets, async lifetime and recovery |
417
- | `.claude/docs/verification.md` | Full verification and delivery requirements |
418
- | `.claude/docs/architecture-template.md` | Complete Level A/B/C skeleton |
419
-
420
- ## Project Skill Routing
421
-
422
- Use only skills available in the active environment. Read the selected entry and all applicable references before following its workflow. Explicit user scope takes precedence over generic length limits or unrelated release gates. This source template does not install platform-specific skills, admin scanners or backend executables.
423
-
424
- ## Artifact Hygiene (CRITICAL)
425
-
426
- Durable standards belong in `.claude/docs/`; concrete designs and evidence belong in ordinary `docs/designs/`. Binding rules describe implemented structures and stable constraints. FORBIDDEN: conversation transcripts, repair narration, future-state assertions, dead links and invented commands.
427
-
428
- ## Pre-commit Checklist
429
-
430
- - [ ] Read changed owners, nested rules, dependencies and direct consumers.
431
- - [ ] Contracts, enum authority, configuration and lifecycle are consistent.
432
- - [ ] Visual changes follow the installed stack design standard, token/component owner and accessibility contract.
433
- - [ ] Relevant success, validation, authorization and recovery behavior is verified.
434
- - [ ] Declared stack checks pass; unavailable checks are reported accurately.
435
- - [ ] No secrets, dead imports or deferred production code enter the diff.
436
- - [ ] CLAUDE.md and AGENTS.md contain the same complete standards body.
437
- - [ ] Normal commits preserve unrelated work and remote history.