@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.
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/components/nuxt/site-source/app/composables/useWebPush.ts +4 -0
- package/dist/resources/components/nuxt/site-source/app/plugins/web-push.ts +52 -0
- package/dist/resources/components/nuxt/site-source/app/web-push/worker.ts +8 -0
- package/dist/resources/components/registry.json +11 -1
- package/dist/resources/registry.json +15 -3
- package/dist/resources/templates/base/{.claude → .codex}/docs/architecture-template.md +1 -1
- package/dist/resources/templates/base/{.claude → .codex}/docs/architecture.md +1 -1
- package/dist/resources/templates/base/{.claude → .codex}/docs/index.md +3 -3
- package/dist/resources/templates/base/{.claude → .codex}/docs/verification.md +1 -1
- package/dist/resources/templates/base/AGENTS.md +24 -24
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/api-design.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/architecture-template.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/check-list.md +3 -3
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/database.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/error-handling.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/index.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/logging.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/mediagen-provider-onboarding-sop.md +2 -2
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/mediagen-provider-quick-reference.md +1 -1
- package/dist/resources/templates/go-backend/{.claude → .codex}/docs/module-standards.md +1 -1
- package/dist/resources/templates/go-backend/.dockerignore +1 -2
- package/dist/resources/templates/go-backend/AGENTS.md +19 -19
- package/dist/resources/templates/go-backend/README.md +5 -1
- package/dist/resources/templates/go-backend/deployments/onex/product-onboarding.example.json +201 -0
- package/dist/resources/templates/go-backend/docs/onex-notifications.md +85 -0
- package/dist/resources/templates/go-backend/docs/openapi-provenance.json +1 -1
- package/dist/resources/templates/go-backend/docs/runtime-provenance.json +23 -2
- package/dist/resources/templates/go-backend/docs/source-provenance.json +124 -6
- package/dist/resources/templates/go-backend/docs/standards-provenance.json +30 -30
- package/dist/resources/templates/go-backend/internal/common/middleware/cors.go +1 -0
- package/dist/resources/templates/go-backend/internal/common/middleware/middleware_test.go +1 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/safe_post.go +28 -0
- package/dist/resources/templates/go-backend/internal/core/httpclient/safe_post_test.go +56 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/client.go +453 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/client_test.go +772 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/codec.go +33 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/error.go +146 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/error_notification_test.go +29 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/client.go +132 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/client_test.go +222 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/notification/contracts.go +219 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/resilience.go +23 -0
- package/dist/resources/templates/go-backend/internal/integrations/onex/v1/transport_policy.go +96 -0
- package/dist/resources/templates/go-backend/internal/products/README.md +1 -1
- package/dist/resources/templates/go-backend/internal/sharedevents/README.md +1 -1
- package/dist/resources/templates/go-backend/scripts/check-openapi-clean-deletion.sh +3 -3
- package/dist/resources/templates/mcp-server/.prettierignore +1 -0
- package/dist/resources/templates/nuxt/{.claude → .codex}/docs/stack.md +10 -0
- package/dist/resources/templates/nuxt/.dockerignore +1 -1
- package/dist/resources/templates/nuxt/.env.example +6 -0
- package/dist/resources/templates/nuxt/.prettierignore +2 -1
- package/dist/resources/templates/nuxt/DESIGN.md +1 -1
- package/dist/resources/templates/nuxt/README.md +8 -0
- package/dist/resources/templates/nuxt/nuxt.config.ts +13 -1
- package/dist/resources/templates/nuxt/package.json +4 -2
- package/package.json +1 -1
- package/dist/resources/templates/base/CLAUDE.md +0 -437
- package/dist/resources/templates/go-backend/CLAUDE.md +0 -1139
- /package/dist/resources/templates/base/{.claude → .codex}/docs/security-lifecycle.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/e2e-standards.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/event-runtime-boundary.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/identifier-contract.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/openapi-contract.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/payment-gateway-onboarding.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/platform-boundary.md +0 -0
- /package/dist/resources/templates/go-backend/{.claude → .codex}/docs/quality-gates.md +0 -0
- /package/dist/resources/templates/mcp-server/{.claude → .codex}/docs/stack.md +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { State } from "@stackonward/web-push";
|
|
2
|
+
import { createBrowser, initialState } from "@stackonward/web-push";
|
|
3
|
+
import { createWebPushController } from "@stackonward/composables";
|
|
4
|
+
import { createApi, createStorage, readConfig } from "@stackonward/onex-web-push";
|
|
5
|
+
|
|
6
|
+
export default defineNuxtPlugin({
|
|
7
|
+
name: "site:web-push",
|
|
8
|
+
setup(nuxtApp) {
|
|
9
|
+
const runtime = useRuntimeConfig();
|
|
10
|
+
const state = useState<State>("site:web-push", initialState);
|
|
11
|
+
const controller = createWebPushController(state, () => {
|
|
12
|
+
const config = readConfig(
|
|
13
|
+
runtime.public.webPush,
|
|
14
|
+
window.location.origin,
|
|
15
|
+
runtime.app.baseURL,
|
|
16
|
+
runtime.public.api.timeout,
|
|
17
|
+
);
|
|
18
|
+
return {
|
|
19
|
+
enabled: config.enabled,
|
|
20
|
+
api: createApi(config),
|
|
21
|
+
browser: createBrowser(
|
|
22
|
+
{
|
|
23
|
+
origin: config.origin,
|
|
24
|
+
workerUrl: new URL("push-sw.js", new URL(config.basePath, config.origin)).href,
|
|
25
|
+
scope: config.basePath,
|
|
26
|
+
timeout: config.timeout,
|
|
27
|
+
},
|
|
28
|
+
window,
|
|
29
|
+
navigator,
|
|
30
|
+
),
|
|
31
|
+
storage: createStorage(
|
|
32
|
+
{
|
|
33
|
+
databaseName: runtime.public.webPush.databaseName,
|
|
34
|
+
origin: config.origin,
|
|
35
|
+
productCode: config.productCode,
|
|
36
|
+
applicationCode: config.applicationCode,
|
|
37
|
+
},
|
|
38
|
+
window.indexedDB,
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
if (import.meta.client) {
|
|
43
|
+
onNuxtReady(() => {
|
|
44
|
+
void controller.initialize().catch(() => {
|
|
45
|
+
/* 初始化错误已进入状态;网站浏览不依赖推送服务可用。 */
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
nuxtApp.vueApp.onUnmount(() => controller.dispose());
|
|
49
|
+
}
|
|
50
|
+
return { provide: { webPush: controller } };
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorkerScope } from "@stackonward/web-push/worker";
|
|
2
|
+
import { installWorker } from "@stackonward/web-push/worker";
|
|
3
|
+
import { decodeMessage } from "@stackonward/onex-web-push";
|
|
4
|
+
|
|
5
|
+
declare const self: WorkerScope;
|
|
6
|
+
|
|
7
|
+
// 产品拥有品牌兜底文案;运行时实现通过公开包消费。
|
|
8
|
+
installWorker(self, { fallbackTitle: "Website notification", decode: decodeMessage });
|
|
@@ -147,6 +147,12 @@
|
|
|
147
147
|
"description": "Editable Nuxt product-site source: site shell, app shell, content shell, UI primitives, composables, plugins, theme tokens, and CSS.",
|
|
148
148
|
"installContext": "template",
|
|
149
149
|
"files": [
|
|
150
|
+
{ "path": "site-source/app/plugins/web-push.ts", "target": "app/plugins/web-push.ts" },
|
|
151
|
+
{
|
|
152
|
+
"path": "site-source/app/composables/useWebPush.ts",
|
|
153
|
+
"target": "app/composables/useWebPush.ts"
|
|
154
|
+
},
|
|
155
|
+
{ "path": "site-source/app/web-push/worker.ts", "target": "app/web-push/worker.ts" },
|
|
150
156
|
{
|
|
151
157
|
"path": "site-source/app/app.vue",
|
|
152
158
|
"target": "app/app.vue"
|
|
@@ -468,7 +474,11 @@
|
|
|
468
474
|
"target": "app/theme/tooltip.ts"
|
|
469
475
|
}
|
|
470
476
|
],
|
|
471
|
-
"dependencies": [
|
|
477
|
+
"dependencies": [
|
|
478
|
+
"@stackonward/composables",
|
|
479
|
+
"@stackonward/web-push",
|
|
480
|
+
"@stackonward/onex-web-push"
|
|
481
|
+
],
|
|
472
482
|
"devDependencies": [],
|
|
473
483
|
"registryDependencies": [],
|
|
474
484
|
"framework": "nuxt",
|
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
"type": "npm",
|
|
6
6
|
"version": "^0.0.3"
|
|
7
7
|
},
|
|
8
|
+
"@stackonward/web-push": {
|
|
9
|
+
"name": "@stackonward/web-push",
|
|
10
|
+
"description": "Provider-neutral browser Web Push and worker primitives",
|
|
11
|
+
"type": "npm",
|
|
12
|
+
"version": "^0.0.1"
|
|
13
|
+
},
|
|
14
|
+
"@stackonward/onex-web-push": {
|
|
15
|
+
"name": "@stackonward/onex-web-push",
|
|
16
|
+
"description": "OneX anonymous Web Push protocol and recovery storage adapters",
|
|
17
|
+
"type": "npm",
|
|
18
|
+
"version": "^0.0.1"
|
|
19
|
+
},
|
|
8
20
|
"@stackonward/analytics-core": {
|
|
9
21
|
"name": "@stackonward/analytics-core",
|
|
10
22
|
"description": "Provider-neutral analytics pipeline and browser autocapture",
|
|
@@ -21,7 +33,7 @@
|
|
|
21
33
|
"name": "@stackonward/cli",
|
|
22
34
|
"description": "StackOnward project and resource CLI",
|
|
23
35
|
"type": "npm",
|
|
24
|
-
"version": "^1.
|
|
36
|
+
"version": "^1.8.0"
|
|
25
37
|
},
|
|
26
38
|
"@stackonward/cms-client": {
|
|
27
39
|
"name": "@stackonward/cms-client",
|
|
@@ -45,7 +57,7 @@
|
|
|
45
57
|
"name": "@stackonward/composables",
|
|
46
58
|
"description": "Headless Vue composables",
|
|
47
59
|
"type": "npm",
|
|
48
|
-
"version": "^0.0
|
|
60
|
+
"version": "^0.1.0"
|
|
49
61
|
},
|
|
50
62
|
"@stackonward/device-fingerprint": {
|
|
51
63
|
"name": "@stackonward/device-fingerprint",
|
|
@@ -111,7 +123,7 @@
|
|
|
111
123
|
"name": "@stackonward/nuxt-site-shell",
|
|
112
124
|
"description": "Brand-free Nuxt product-site shell",
|
|
113
125
|
"type": "layer",
|
|
114
|
-
"version": "^0.
|
|
126
|
+
"version": "^0.4.0"
|
|
115
127
|
},
|
|
116
128
|
"@stackonward/onex-cms-client": {
|
|
117
129
|
"name": "@stackonward/onex-cms-client",
|
|
@@ -113,7 +113,7 @@ application already contains these modules.
|
|
|
113
113
|
|
|
114
114
|
### 4.2 Package Split Decision
|
|
115
115
|
|
|
116
|
-
{Answer the package split rules from
|
|
116
|
+
{Answer the package split rules from AGENTS.md: Which owner has two real consumers? Which types remain feature-private? Does a shared contract avoid framework or provider leakage?}
|
|
117
117
|
|
|
118
118
|
---
|
|
119
119
|
|
|
@@ -124,7 +124,7 @@ Brand tokens, logos, locale and navigation belong to application composition. Ge
|
|
|
124
124
|
|
|
125
125
|
Projects must run outside the source checkout. **FORBIDDEN**: developer absolute paths, dependency escapes, symlinks to external rules and commands requiring unshipped helpers.
|
|
126
126
|
|
|
127
|
-
Template changes affect new projects. Existing applications receive reviewed source changes; regeneration never overwrites business code or credentials.
|
|
127
|
+
Template changes affect new projects. Existing applications receive reviewed source changes; regeneration never overwrites business code or credentials. AGENTS remains the complete rule authority.
|
|
128
128
|
|
|
129
129
|
## 10. Architecture and Delivery
|
|
130
130
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Application Standards Index
|
|
2
2
|
|
|
3
|
-
Read [
|
|
3
|
+
Read [AGENTS.md](../../AGENTS.md) completely, then select the task boundary:
|
|
4
4
|
|
|
5
5
|
| Task | Standard |
|
|
6
6
|
| ---------------------------------- | ----------------------------------------------- |
|
|
@@ -15,7 +15,7 @@ This directory contains current engineering rules. Product designs and implement
|
|
|
15
15
|
|
|
16
16
|
## Required Reading Sequence
|
|
17
17
|
|
|
18
|
-
1. Read root `
|
|
18
|
+
1. Read root `AGENTS.md` for the five execution phases and shared forbidden patterns.
|
|
19
19
|
2. Read `stack.md` for the actual generated framework, environment consumers, commands and source owners.
|
|
20
20
|
3. Read `architecture.md` before changing ownership, public types, dependencies or shared abstractions.
|
|
21
21
|
4. Read `security-lifecycle.md` before changing external inputs, identity, credentials, requests, retries, cancellation or disposal.
|
|
@@ -39,4 +39,4 @@ Only the selected `stack.md` is installed. Base standards never overwrite it wit
|
|
|
39
39
|
|
|
40
40
|
**MUST** update the owning rule when a real contract changes; do not append a correction beside stale instructions. Keep useful examples, forbidden patterns and checklist coverage. Do not shorten a complete standard into an index-only entry.
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
<rule_authority>MUST keep one complete regular `AGENTS.md` per owner. NEVER maintain a second editable rule entrypoint for the same owner.</rule_authority> Relative links must resolve inside the generated project; external source-checkout paths and external symlinks are forbidden. Record source comparison and implementation evidence in ordinary project documentation, not these binding rules.
|
|
@@ -79,7 +79,7 @@ Tests of services with fake dependencies do not prove actual provider permission
|
|
|
79
79
|
|
|
80
80
|
## 8. Distribution and Generated Projects
|
|
81
81
|
|
|
82
|
-
For template changes, generate an application outside the source workspace using the packed CLI. Verify substituted variables, complete
|
|
82
|
+
For template changes, generate an application outside the source workspace using the packed CLI. Verify substituted variables, the complete AGENTS body, `.codex/docs`, relative links, package resolution and executable commands.
|
|
83
83
|
|
|
84
84
|
Do not rely on workspace symlinks to satisfy dependencies. Inspect packed files and the consumer artifact. The generated project must not reference developer absolute paths or template placeholders.
|
|
85
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Application Engineering Standard
|
|
2
2
|
|
|
3
|
-
> **Runtime**: Node.js ESM and TypeScript; complete installed stack in `.
|
|
3
|
+
> **Runtime**: Node.js ESM and TypeScript; complete installed stack in `.codex/docs/stack.md`.
|
|
4
4
|
> **Owner**: application business rules, routes, branding, configuration and release.
|
|
5
5
|
> **Dependencies**: versioned public package exports; generated source belongs to this application.
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ app/ and server/ # Nuxt presentation and server execution bound
|
|
|
13
13
|
src/ # MCP registrations, adapters and process startup
|
|
14
14
|
package.json # Installed dependencies and executable commands
|
|
15
15
|
.env.example # Configuration schema without credentials
|
|
16
|
-
.
|
|
16
|
+
.codex/docs/ # Complete engineering specifications
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
---
|
|
@@ -33,29 +33,29 @@ pnpm build
|
|
|
33
33
|
|
|
34
34
|
## Coding Rules
|
|
35
35
|
|
|
36
|
-
The selected stack has complete coding rules in `.
|
|
36
|
+
The selected stack has complete coding rules in `.codex/docs/stack.md`. Shared AI execution flow is defined in this file. <rule_authority>MUST keep one complete regular `AGENTS.md` per owner. NEVER maintain a second editable rule entrypoint for the same owner.</rule_authority> Nested rules add owner-specific constraints.
|
|
37
37
|
|
|
38
38
|
| File | Scope |
|
|
39
39
|
| --------------------------------------- | ------------------------------------------------------------- |
|
|
40
|
-
| `
|
|
41
|
-
| `.
|
|
42
|
-
| `.
|
|
43
|
-
| `.
|
|
44
|
-
| `.
|
|
45
|
-
| `.
|
|
46
|
-
| `.
|
|
40
|
+
| `AGENTS.md` | Shared execution flow and delivery discipline |
|
|
41
|
+
| `.codex/docs/index.md` | Reading order and module navigation |
|
|
42
|
+
| `.codex/docs/stack.md` | Framework rules, full command and environment tables |
|
|
43
|
+
| `.codex/docs/architecture.md` | Ownership, dependency direction, contracts and reuse |
|
|
44
|
+
| `.codex/docs/security-lifecycle.md` | Validation, secrets, authorization, cancellation and recovery |
|
|
45
|
+
| `.codex/docs/verification.md` | Verification and delivery requirements |
|
|
46
|
+
| `.codex/docs/architecture-template.md` | Complete design skeleton |
|
|
47
47
|
|
|
48
|
-
**Read the selected stack and applicable nested `
|
|
48
|
+
**Read the selected stack and applicable nested `AGENTS.md` before writing code.**
|
|
49
49
|
|
|
50
50
|
## Visual Design Standards (CRITICAL)
|
|
51
51
|
|
|
52
|
-
For a stack with a visual interface, **MUST** read the design standard identified by `.
|
|
52
|
+
For a stack with a visual interface, **MUST** read the design standard identified by `.codex/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
53
|
|
|
54
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
55
|
|
|
56
56
|
## Technology Stack and Environment
|
|
57
57
|
|
|
58
|
-
Read `package.json`, `.env.example`, configuration consumers and `.
|
|
58
|
+
Read `package.json`, `.env.example`, configuration consumers and `.codex/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
59
|
|
|
60
60
|
## Workflow Proportionality (CRITICAL)
|
|
61
61
|
|
|
@@ -93,7 +93,7 @@ Directories, modules and packages are namespaces. Child files and symbols **MUST
|
|
|
93
93
|
# AI Execution Standard
|
|
94
94
|
|
|
95
95
|
> Mandatory workflow for every task, regardless of language or subproject.
|
|
96
|
-
> Stack-specific rules are in `.
|
|
96
|
+
> Stack-specific rules are in `.codex/docs/stack.md` and applicable nested rules.
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
@@ -104,8 +104,8 @@ Before touching code, fully understand the task and its context.
|
|
|
104
104
|
### 1.1 Read Project Documentation
|
|
105
105
|
|
|
106
106
|
1. Read this file for shared execution rules.
|
|
107
|
-
2. Read the subproject `
|
|
108
|
-
3. Read subproject specs, and shared specs under `.
|
|
107
|
+
2. Read the subproject `AGENTS.md` for stack-specific rules, starting with `.codex/docs/stack.md`.
|
|
108
|
+
3. Read subproject specs, and shared specs under `.codex/docs/` that are relevant to the task.
|
|
109
109
|
4. Read existing architecture documents for affected modules.
|
|
110
110
|
|
|
111
111
|
**Read specs before designing. Do not rely on memory or assumptions about project conventions.**
|
|
@@ -365,7 +365,7 @@ Violation of any rule blocks commit. No exceptions.
|
|
|
365
365
|
| SH-E3 | Enforcement | Fix applied as patch/workaround without proper design | Make the fix architecturally sound |
|
|
366
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
367
|
|
|
368
|
-
Additional forbidden patterns are defined in each subproject's `
|
|
368
|
+
Additional forbidden patterns are defined in each subproject's `AGENTS.md`. Identifier/reference boundaries are in `.codex/docs/security-lifecycle.md`.
|
|
369
369
|
|
|
370
370
|
---
|
|
371
371
|
|
|
@@ -411,11 +411,11 @@ The principle: fail loudly, never silently skip. A production system that return
|
|
|
411
411
|
|
|
412
412
|
| Doc | Content |
|
|
413
413
|
| --------------------------------------- | --------------------------------------------------------- |
|
|
414
|
-
| `.
|
|
415
|
-
| `.
|
|
416
|
-
| `.
|
|
417
|
-
| `.
|
|
418
|
-
| `.
|
|
414
|
+
| `.codex/docs/stack.md` | Framework rules, real directories and executable commands |
|
|
415
|
+
| `.codex/docs/architecture.md` | Types, owner boundaries and dependency direction |
|
|
416
|
+
| `.codex/docs/security-lifecycle.md` | Trust, identity, secrets, async lifetime and recovery |
|
|
417
|
+
| `.codex/docs/verification.md` | Full verification and delivery requirements |
|
|
418
|
+
| `.codex/docs/architecture-template.md` | Complete Level A/B/C skeleton |
|
|
419
419
|
|
|
420
420
|
## Project Skill Routing
|
|
421
421
|
|
|
@@ -423,7 +423,7 @@ Use only skills available in the active environment. Read the selected entry and
|
|
|
423
423
|
|
|
424
424
|
## Artifact Hygiene (CRITICAL)
|
|
425
425
|
|
|
426
|
-
Durable standards belong in `.
|
|
426
|
+
Durable standards belong in `.codex/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
427
|
|
|
428
428
|
## Pre-commit Checklist
|
|
429
429
|
|
|
@@ -433,5 +433,5 @@ Durable standards belong in `.claude/docs/`; concrete designs and evidence belon
|
|
|
433
433
|
- [ ] Relevant success, validation, authorization and recovery behavior is verified.
|
|
434
434
|
- [ ] Declared stack checks pass; unavailable checks are reported accurately.
|
|
435
435
|
- [ ] No secrets, dead imports or deferred production code enter the diff.
|
|
436
|
-
- [ ]
|
|
436
|
+
- [ ] One complete AGENTS.md authority links the applicable .codex/docs standards.
|
|
437
437
|
- [ ] Normal commits preserve unrelated work and remote history.
|
package/dist/resources/templates/go-backend/{.claude → .codex}/docs/architecture-template.md
RENAMED
|
@@ -118,7 +118,7 @@ internal/platform/{module}/
|
|
|
118
118
|
|
|
119
119
|
### 4.2 Package Split Decision
|
|
120
120
|
|
|
121
|
-
{Answer the package split rules from
|
|
121
|
+
{Answer the package split rules from AGENTS.md: Does application/ need sub-domain splitting? Does domain/ need splitting by aggregate root?}
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Development Checklist
|
|
2
2
|
|
|
3
|
-
> Workflow and quality gates. Rules in `
|
|
3
|
+
> Workflow and quality gates. Rules in `AGENTS.md`.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
1. Design(架构评审)
|
|
10
10
|
2. Implementation
|
|
11
|
-
3. Self-review(对照
|
|
11
|
+
3. Self-review(对照 AGENTS.md FORBIDDEN 表)
|
|
12
12
|
4. Pre-commit validation
|
|
13
13
|
|
|
14
14
|
---
|
|
@@ -110,7 +110,7 @@ Pre-Commit Validation
|
|
|
110
110
|
=====================
|
|
111
111
|
Files changed: [list]
|
|
112
112
|
Specs checked:
|
|
113
|
-
-
|
|
113
|
+
- AGENTS.md FORBIDDEN table: PASS/FAIL (CRITICAL)
|
|
114
114
|
- api-design.md: PASS/FAIL
|
|
115
115
|
- module-standards.md: PASS/FAIL
|
|
116
116
|
- error-handling.md: PASS/FAIL
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Specification Index
|
|
2
2
|
|
|
3
|
-
Read `
|
|
3
|
+
Read `AGENTS.md` completely. Files below retain the full OneX specifications and examples. Binding event, E2E and OpenAPI contracts apply according to their declared owner. Platform paths, service names, governance commands and platform tables refer to upstream OneX; generated backend commands are defined by its own `Makefile`.
|
|
4
4
|
|
|
5
5
|
| File | Content | Priority |
|
|
6
6
|
|------|---------|----------|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> Scope: `internal/platform/mediagen/infrastructure/providers/*` + admin runtime configuration plane
|
|
6
6
|
> Audience: 任何需要新增 / 修改 / 排障 mediagen Provider Adapter 或在 admin 上线 Provider 的工程师
|
|
7
7
|
> 状态:admin-integrated 锁定版(基于提交 `f2338a6d` → `211ed024`)
|
|
8
|
-
> 设计权威:本文与
|
|
8
|
+
> 设计权威:本文与 `.codex/docs/identifier-contract.md`、`api-design.md`、`error-handling.md` 共同构成 mediagen 模块的技术契约。
|
|
9
9
|
|
|
10
10
|
本文档目的:让"接入新 Provider"从一个**模糊的探索性任务**收敛为**一组可逐步勾选的工程操作**。每一步都有具体的文件路径、迁移编号、admin UI 入口、复制模板、验收门槛。**严格按照本 SOP 落地的新 Provider,零返工**。
|
|
11
11
|
|
|
@@ -888,7 +888,7 @@ Service: 构造一个虚拟 SubmitRequest (sample input + draft revision snapsho
|
|
|
888
888
|
- `migrations/000473_add_generation_transport_retry_count.up.sql` —— transport_retry_count 列
|
|
889
889
|
- `migrations/000483_extend_p_mediagen_execution_logs_phase_lane.up.sql` —— execution_log phase + lane_code + 复合索引
|
|
890
890
|
- `migrations/000484_seed_ai_lane_dry_run_permission.up.sql` —— `ai_lane:rollback` + `ai_lane:dry_run` 权限种子
|
|
891
|
-
-
|
|
891
|
+
- 短表速查:`.codex/docs/mediagen-provider-quick-reference.md`
|
|
892
892
|
|
|
893
893
|
---
|
|
894
894
|
|
|
@@ -153,7 +153,7 @@ ANTHROPIC_API_KEY
|
|
|
153
153
|
|
|
154
154
|
## Code Rules Reference
|
|
155
155
|
|
|
156
|
-
规范模板在
|
|
156
|
+
规范模板在 `.codex/docs/` 目录中。
|
|
157
157
|
|
|
158
158
|
---
|
|
159
159
|
---
|
|
@@ -172,9 +172,9 @@ Before touching any code, fully understand the task and its context.
|
|
|
172
172
|
### 1.1 Read project documentation
|
|
173
173
|
|
|
174
174
|
1. Read this file (execution flow + coding rules)
|
|
175
|
-
2. Read
|
|
175
|
+
2. Read `.codex/docs/` specifications relevant to the task (api-design, module-standards, database, error-handling, etc.)
|
|
176
176
|
3. Read existing architecture docs in `docs/platform/` for affected modules
|
|
177
|
-
4. Read the
|
|
177
|
+
4. Read the AGENTS.md of each affected cmd/ app if applicable
|
|
178
178
|
|
|
179
179
|
**Read the specs BEFORE designing. Do not rely on memory or assumptions about project conventions.**
|
|
180
180
|
|
|
@@ -263,7 +263,7 @@ Verdict: PROCEED / REJECT / REVISE
|
|
|
263
263
|
|
|
264
264
|
### 2.4 Determine design document level
|
|
265
265
|
|
|
266
|
-
Classify the task and produce the corresponding design document. See `.
|
|
266
|
+
Classify the task and produce the corresponding design document. See `.codex/docs/architecture-template.md` for full skeleton.
|
|
267
267
|
|
|
268
268
|
```
|
|
269
269
|
New module or major architecture change?
|
|
@@ -278,7 +278,7 @@ Otherwise?
|
|
|
278
278
|
|
|
279
279
|
| Level | What to produce | Destination |
|
|
280
280
|
|-------|----------------|-------------|
|
|
281
|
-
| **A** | Complete architecture document following `.
|
|
281
|
+
| **A** | Complete architecture document following `.codex/docs/architecture-template.md` | Plan file → archive to `docs/platform/` |
|
|
282
282
|
| **B** | Impact scope, industry reference, schema/model/API changes, data flow, implementation waves | Plan file |
|
|
283
283
|
| **C** | Root cause analysis, fix design, affected files, verification plan | Plan file |
|
|
284
284
|
|
|
@@ -286,7 +286,7 @@ Otherwise?
|
|
|
286
286
|
|
|
287
287
|
### 2.5 Decision Autonomy
|
|
288
288
|
|
|
289
|
-
**Inherited from `
|
|
289
|
+
**Inherited from `AGENTS.md` Phase 2.2.** AI MUST make standard technical decisions autonomously when industry consensus exists. NEVER ask the user to choose between options that have a clear industry-standard answer.
|
|
290
290
|
|
|
291
291
|
Go-specific autonomous decisions (NEVER ask):
|
|
292
292
|
|
|
@@ -299,7 +299,7 @@ Go-specific autonomous decisions (NEVER ask):
|
|
|
299
299
|
|
|
300
300
|
### 2.6 Self-Review Gate (MANDATORY)
|
|
301
301
|
|
|
302
|
-
**Inherited from `
|
|
302
|
+
**Inherited from `AGENTS.md` Phase 2.6.** After completing ANY design or implementation, MUST self-review BEFORE presenting to user.
|
|
303
303
|
|
|
304
304
|
Go-specific self-review additions:
|
|
305
305
|
|
|
@@ -390,7 +390,7 @@ Re-validate against the FORBIDDEN Patterns table below with the actual implement
|
|
|
390
390
|
|
|
391
391
|
### 5.5 Automated review loop (Level A/B)
|
|
392
392
|
|
|
393
|
-
**Inherited from `
|
|
393
|
+
**Inherited from `AGENTS.md` Phase 5.5.** For Level A/B deliveries, dispatch review agents and iterate until zero findings BEFORE presenting to user.
|
|
394
394
|
|
|
395
395
|
Go-specific review dimensions:
|
|
396
396
|
|
|
@@ -551,14 +551,14 @@ Violation of ANY rule blocks commit. No exceptions.
|
|
|
551
551
|
| TX2 | Transaction | `middleware.WithTransaction` / `middleware.DBOrTx` | Use `database.TransactionManager.WithTransaction` — single mechanism |
|
|
552
552
|
| TX3 | Transaction | Multiple transaction context keys | Single `database.ctxTxKey{}` — one mechanism, one key |
|
|
553
553
|
| N1 | Enum | 管理端展示或选择使用的枚举值、标签、颜色在 registry 外重复维护 | 在 `internal/common/enums/register_xxx.go` 引用 owner 常量注册,并测试实际消费的值集合。私有实现类型和机器协议值不要求注册为管理端选项 |
|
|
554
|
-
| N2 | Reference | `ReferenceID` / `reference_id` 字段用 `fmt.Sprintf` / 字符串拼接 ad-hoc 构造 | 在 owner domain 的 `reference.go` 定义 helper `XxxReferenceID(xxxID int64) string`,调用方 MUST 通过 helper 生成。See
|
|
554
|
+
| N2 | Reference | `ReferenceID` / `reference_id` 字段用 `fmt.Sprintf` / 字符串拼接 ad-hoc 构造 | 在 owner domain 的 `reference.go` 定义 helper `XxxReferenceID(xxxID int64) string`,调用方 MUST 通过 helper 生成。See `.codex/docs/identifier-contract.md` §3.2 |
|
|
555
555
|
| N3 | Reference | `ReferenceType` 字段使用字符串字面量(e.g. `"order"` / `"subscription"`) | 在 domain 的 `reference.go` 定义 `ReferenceTypeXxx` 常量,所有写入路径 MUST 引用常量 |
|
|
556
556
|
| N4 | Validator | 写入 `p_credit_transactions` / `p_member_point_ledger` / `p_quota_transactions` 时绕过模块的 `ValidateTransactionFields` 直接调用 `db.Create` / `db.Save` | MUST 通过 repo 的 `Create` / `BatchCreate` 方法,repo 内部强制调用 `credit.ValidateTransactionFields`(或对应模块 validator)。禁止 Service/Handler 直接操作 `*gorm.DB` 写入凭证类表 |
|
|
557
557
|
| LC1 | Locale | Domain model, DTO write path, persisted JSON map, or admin API accepts/stores region locale tags such as `zh-CN` / `en-US` as business locale keys | Internal business locale values MUST use OneX short codes validated by `internal/common/locale.IsShortCode`. External headers/imports may call `NormalizeCode` only at boundary adapters before entering domain/service writes |
|
|
558
558
|
| LC2 | Locale | Duplicated supported-locale lists, locale enum metadata, or fallback locale arrays outside `internal/common/locale` / enum registry helpers | Use `commonlocale.SupportedCodes()`, `commonlocale.DefaultCode`, `commonlocale.AdminDefaultCode`, and shared enum helpers. Migrations may list historical external aliases only to repair old data |
|
|
559
559
|
| LC3 | Locale | Localized text/channel JSON validation implemented with ad-hoc key checks or `map[string]string` loops that do not call the common locale validator | Route all localized-map write validation through `commonlocale.IsShortCode` or a module helper that delegates to it. Invalid locale keys fail fast with validation errors |
|
|
560
560
|
|
|
561
|
-
`make lint-enums` / `backend/scripts/check-forbidden-patterns.sh` 运行管理端枚举合同测试及标识符、凭证写入静态检查。详细标识符契约见
|
|
561
|
+
`make lint-enums` / `backend/scripts/check-forbidden-patterns.sh` 运行管理端枚举合同测试及标识符、凭证写入静态检查。详细标识符契约见 `.codex/docs/identifier-contract.md`。
|
|
562
562
|
|
|
563
563
|
---
|
|
564
564
|
|
|
@@ -832,7 +832,7 @@ After write operation completes →
|
|
|
832
832
|
- 修改路由、请求、响应、认证或状态码时,同一变更内更新 owner path/component、Arazzo workflow 和生成制品。
|
|
833
833
|
- registry 中全部 HTTP 服务启动时必须通过 Gin route 与内嵌 internal bundle 的精确集合校验。
|
|
834
834
|
- partner/public 只能由 internal canonical source 投影生成,禁止直接编辑 `dist/`。
|
|
835
|
-
- 详细规则和模板见 `.
|
|
835
|
+
- 详细规则和模板见 `.codex/docs/openapi-contract.md`。
|
|
836
836
|
|
|
837
837
|
---
|
|
838
838
|
|
|
@@ -1064,9 +1064,9 @@ Modular Monolith 架构(Stripe/Shopify 标准)。统一平台 API 服务所
|
|
|
1064
1064
|
|
|
1065
1065
|
**Outbox Relay**:platform-api 运行统一 Relay,处理所有域的 outbox 事件。admin-api 不调用 `relay.Start()`,admin 写入的 outbox 记录由 platform-api 的 Relay 投递。
|
|
1066
1066
|
|
|
1067
|
-
**Event runtime boundary**:源聚合投影监听器必须留在拥有该状态机的运行时;`worker` 只消费 durable public events 做下游副作用。`user.deleted` 这类部分公开的事件族必须使用精确白名单,禁止 `user.*` 这类宽泛通配。See
|
|
1067
|
+
**Event runtime boundary**:源聚合投影监听器必须留在拥有该状态机的运行时;`worker` 只消费 durable public events 做下游副作用。`user.deleted` 这类部分公开的事件族必须使用精确白名单,禁止 `user.*` 这类宽泛通配。See `.codex/docs/event-runtime-boundary.md`.
|
|
1068
1068
|
|
|
1069
|
-
**E2E contract tests**:凡是跨运行时、依赖 relay/worker、会改变最终用户可见真相的工作流,必须同时具备一个全链路 E2E 和一个 `ProvideRelayConfig()` 白名单回归测试。See
|
|
1069
|
+
**E2E contract tests**:凡是跨运行时、依赖 relay/worker、会改变最终用户可见真相的工作流,必须同时具备一个全链路 E2E 和一个 `ProvideRelayConfig()` 白名单回归测试。See `.codex/docs/e2e-standards.md`.
|
|
1070
1070
|
|
|
1071
1071
|
**内部服务间调用**:`/internal/v1/` 路由组,通过 IAM 服务账号凭证认证、已认证主体校验、路由资源策略授权保护。
|
|
1072
1072
|
|
|
@@ -1109,7 +1109,7 @@ Product-specific tables are owned by external product repositories and must not
|
|
|
1109
1109
|
## Commit Discipline
|
|
1110
1110
|
|
|
1111
1111
|
- ONE module, ONE feature per commit
|
|
1112
|
-
- Pre-commit: validate against
|
|
1112
|
+
- Pre-commit: validate against `.codex/docs/` specs
|
|
1113
1113
|
- MUST NOT commit with any CRITICAL/MUST violation
|
|
1114
1114
|
|
|
1115
1115
|
---
|
|
@@ -1129,11 +1129,11 @@ Product-specific tables are owned by external product repositories and must not
|
|
|
1129
1129
|
|
|
1130
1130
|
| Doc | Content |
|
|
1131
1131
|
|-----|---------|
|
|
1132
|
-
| `.
|
|
1133
|
-
|
|
|
1134
|
-
|
|
|
1135
|
-
|
|
|
1136
|
-
|
|
|
1132
|
+
| `.codex/docs/architecture-template.md` | Plan mode mandatory skeleton (Level A/B/C) |
|
|
1133
|
+
| `.codex/docs/api-design.md` | Handler/Service/DTO/VO templates, pagination |
|
|
1134
|
+
| `.codex/docs/module-standards.md` | Tier decision, directory subdivision, VO naming |
|
|
1135
|
+
| `.codex/docs/error-handling.md` | Error types, codes, decision table |
|
|
1136
|
+
| `.codex/docs/database.md` | Model template, column types, migrations |
|
|
1137
1137
|
| Upstream OneX `.claude/docs/decisions.md` | Platform Architecture Decision Records; source revision in `docs/standards-provenance.json` |
|
|
1138
1138
|
| `internal/platform/trade/order/` | Reference: Full DDD module |
|
|
1139
1139
|
| `internal/platform/trade/module.go` | Reference: Module self-registration |
|
|
@@ -63,4 +63,8 @@ Outbox 保留 `schema_version` 不可变约束,产品生产者负责写入自
|
|
|
63
63
|
|
|
64
64
|
`/metrics` 用于内部采集,不应通过公网网关发布。当前入口只有基础健康与指标接口;产品登录、业务路由、OneX 服务身份和授权策略必须通过真实契约接入,健康检查成功不代表业务验收完成。
|
|
65
65
|
|
|
66
|
-
通用源码来源见 `docs/source-provenance.json`;入口、配置、部署和迁移的来源与调整见 `docs/runtime-provenance.json`。阅读 `
|
|
66
|
+
通用源码来源见 `docs/source-provenance.json`;入口、配置、部署和迁移的来源与调整见 `docs/runtime-provenance.json`。阅读 `AGENTS.md` 和 `.codex/docs/` 后开发,新增模块复用现有所有者和 ProviderSet。
|
|
67
|
+
|
|
68
|
+
## 可选 OneX 通知配置
|
|
69
|
+
|
|
70
|
+
需要接入 OneX 时,使用 [通知接入说明](docs/onex-notifications.md)和随模板分发的 [原生 profile 示例](deployments/onex/product-onboarding.example.json)。产品填写自身身份、品牌和公开配置,私有连接交给 OneX 现有执行器;示例默认不激活、不发布、不发送。模板已分发通用 `internal/integrations/onex/v1/notification` 协议客户端与测试,由产品显式装配;不会自动生成产品事件、通知 BFF 或客户端接收流程。
|