speccore 8.3.295 → 8.3.297

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 (31) hide show
  1. package/dist/commands/init.d.ts.map +1 -1
  2. package/dist/commands/init.js +22 -1
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/commands/update-env-configs.d.ts.map +1 -1
  5. package/dist/commands/update-env-configs.js +6 -0
  6. package/dist/commands/update-env-configs.js.map +1 -1
  7. package/dist/core/deploy/engine.d.ts +11 -0
  8. package/dist/core/deploy/engine.d.ts.map +1 -1
  9. package/dist/core/deploy/engine.js +35 -7
  10. package/dist/core/deploy/engine.js.map +1 -1
  11. package/dist/core/unified-config.d.ts.map +1 -1
  12. package/dist/core/unified-config.js +31 -0
  13. package/dist/core/unified-config.js.map +1 -1
  14. package/package.json +1 -1
  15. package/templates/deploy-docker/README.md +12 -0
  16. package/templates/deploy-docker/backend-node.Dockerfile +52 -0
  17. package/templates/deploy-examples.yaml +80 -5
  18. package/templates/deploy-nginx/README.md +59 -0
  19. package/templates/deploy-nginx/nginx-site.conf +103 -0
  20. package/templates/deploy-scripts/README.md +61 -0
  21. package/templates/deploy-scripts/deploy-compose.sh +19 -0
  22. package/templates/deploy-scripts/deploy-ftp.sh +28 -0
  23. package/templates/deploy-scripts/deploy-password-ssh.sh +26 -0
  24. package/templates/deploy-scripts/deploy-python.sh +30 -0
  25. package/templates/deploy-scripts/trigger-jenkins.sh +30 -0
  26. package/templates/html/speccore-ask-guide.html +1 -1
  27. package/templates/html/speccore-ask-pipeline.html +1 -1
  28. package/templates/html/speccore-ask-result.html +1 -1
  29. package/templates/html/speccore-help.html +2 -2
  30. package/templates/speccore-yml-example.yml +222 -0
  31. package/templates/verify-spec-example.yaml +10 -6
@@ -0,0 +1,222 @@
1
+ # ═══════════════════════════════════════════════════════════
2
+ # SpecCore 主配置完整示例(.speccore.yml)
3
+ # ═══════════════════════════════════════════════════════════
4
+ # 位置:项目根 .speccore.yml(与 .speccore/PROJECT.yaml 分工:
5
+ # PROJECT.yaml 管「端/源码/Git/部署」,本文件管「行为/门禁/测试/AI」)
6
+ # 升级:speccore config --upgrade(不要手动编辑 schema_version)
7
+ # 参考:docs/config-reference.md(字段详解)
8
+ #
9
+ # 特性版本标记:
10
+ # v8.3.24+ arbitration 契约裁决 v8.3.94+ settings.vision
11
+ # v8.3.95+ quality_gates.verify_ui v8.3.193+ settings.ai provider 池
12
+ # v8.3.197+ quality_gates.block_level v8.3.215+ tests.auth 登录装配
13
+ # v8.3.217+ settings.smoke 三时机 v8.3.217+ stages / pipeline.test
14
+ # ═══════════════════════════════════════════════════════════
15
+
16
+ schema_version: 1
17
+
18
+ # ── 项目信息 ──
19
+ project:
20
+ name: my-project
21
+ description: 示例项目
22
+ version: 1.0.0
23
+
24
+ # ── 技术栈(供 AI 生成针对性内容)──
25
+ tech_stack:
26
+ backend: TypeScript / NestJS
27
+ frontend: Vue 3 / Element Plus
28
+ database: PostgreSQL
29
+ cache: Redis
30
+ mq: RabbitMQ
31
+
32
+ # ── 团队 ──
33
+ team:
34
+ members:
35
+ - name: alice
36
+ role: lead
37
+ assignee: true
38
+ - name: bob
39
+ role: developer
40
+ assignee: true
41
+
42
+ # ── 质量门禁 ──
43
+ quality_gates:
44
+ enforce_testing: true
45
+ enforce_review: true
46
+ require_pr: true
47
+ # 阻塞级别:standard(编译+单测+契约都阻断,默认)/ compile(仅编译阻断)
48
+ block_level: standard
49
+ # v8.3.95+: UI 验证默认行为(speccore verify --ui)
50
+ verify_ui:
51
+ enabled: true
52
+ smoke_test: true
53
+ visual_check: true
54
+ threshold: normal # strict / normal / loose
55
+ devices: [desktop, mobile]
56
+ browsers: [chromium]
57
+ timeout: 30000
58
+ headed: false
59
+ visual_model:
60
+ provider: qwen-vl
61
+ model: qwen-vl-max
62
+
63
+ # ── 契约裁决(v8.3.24+):full 全流程 / l1-only / report-only ──
64
+ arbitration:
65
+ enabled: true
66
+ mode: full
67
+
68
+ # ── 运行时行为 ──
69
+ settings:
70
+ # 指派策略:strict 阻断不一致 / loose 自动填+警告(推荐)/ off 关闭
71
+ assignee:
72
+ enabled: true
73
+ mode: loose
74
+ # 双向追溯 + @spec 注释
75
+ trace:
76
+ enabled: true
77
+ auto_annotate: true
78
+ # 归档时自动清理
79
+ archive:
80
+ auto_cleanup: false
81
+ # 并行执行建议
82
+ plan:
83
+ parallel_suggest: true
84
+ # 严格校验模式
85
+ validation:
86
+ strict_mode: false
87
+ # 自动检查规范库最新
88
+ sync:
89
+ auto_check: true
90
+ # 模式沉淀:off / smart(推荐)/ aggressive
91
+ patterns:
92
+ auto_save: smart
93
+ # 审查时检查执行人签名
94
+ review:
95
+ check_assignee: false
96
+ # v8.3.94+: 视觉模型(specs 文档图片理解,默认关闭)
97
+ vision:
98
+ enabled: false
99
+ provider: qwen-vl
100
+ model: qwen-vl-plus
101
+ apiKey: ${DASHSCOPE_API_KEY}
102
+ maxImagesPerPrompt: 10
103
+ imageMaxSizeKb: 2048
104
+ # 非必要流水线步骤三态开关:auto(智能,默认)/ on 强制 / off 跳过
105
+ optional_steps:
106
+ clarify: auto # 文档专业就跳过澄清
107
+ verify: auto
108
+ pipeline: auto
109
+ pr: off # 本地开发不自动提 PR
110
+ done: auto
111
+ spec2doc: off # 不需要导出文档
112
+ # 命名流水线(run --preset <name>)
113
+ pipelines:
114
+ default: develop # full/import/spec/analyze/develop/deliver/deploy/docs
115
+ custom:
116
+ my-flow: analyze,validate,taskify,plan,execute
117
+ hotfix: execute,verify,pipeline,pr
118
+ # v8.3.193+: 统一 LLM provider 池(host=宿主AI / llm=自配 / auto=宿主优先)
119
+ ai:
120
+ provider: auto
121
+ providers:
122
+ - name: local
123
+ type: ollama
124
+ endpoint: "http://localhost:11434"
125
+ model: qwen2.5:7b
126
+ priority: 1
127
+ - name: gpt4o
128
+ type: openai
129
+ model: gpt-4o
130
+ apiKey: "${OPENAI_API_KEY}"
131
+ priority: 2
132
+ defaults:
133
+ analyze: gpt4o
134
+ split: local
135
+ fallback: local
136
+ # v8.3.217+: 冒烟三时机开关 + 范围(run --smoke / --skip-smoke / --scope 单次覆盖)
137
+ smoke:
138
+ points:
139
+ local: auto # 开发完本地冒烟
140
+ pre-deploy: auto # 部署前门禁
141
+ post-deploy: auto # 部署后确认环境活着
142
+ scope: module # full 全量 / module 当前功能模块
143
+ scope_by_env:
144
+ dev: module
145
+ staging: module
146
+ production: full # 生产发布才全量
147
+
148
+ # ── Ask 引擎 ──
149
+ ask:
150
+ routing:
151
+ mode: hybrid # hybrid / cli-only / host-ai-only
152
+ high_threshold: 70
153
+ low_threshold: 45
154
+ auto_host_ai: true
155
+ cache_enabled: true
156
+ cache_min_hits: 3
157
+ rules:
158
+ force_host_ai: false
159
+ llm_providers:
160
+ - name: ollama-local
161
+ enabled: false
162
+ type: ollama
163
+ endpoint: http://localhost:11434
164
+ model: qwen2.5:7b
165
+ priority: 1
166
+ - name: openai-compatible
167
+ enabled: false
168
+ type: openai
169
+ endpoint: https://api.openai.com/v1/chat/completions
170
+ model: gpt-4o-mini
171
+ priority: 2
172
+
173
+ # ── 测试基础设施(与 verify / pipeline 联动)──
174
+ tests:
175
+ base_urls:
176
+ h5: https://staging.example.com/h5
177
+ admin: https://admin-staging.example.com
178
+ api: https://api-staging.example.com
179
+ local_urls:
180
+ h5: http://localhost:5173
181
+ # v8.3.215+: 测试登录(冒烟/视觉访问受保护页面前自动登录)
182
+ # data-testid 遵循 UI_SPEC 元素标识约定:{模块}-{页面}-{元素}
183
+ auth:
184
+ login_url: /login
185
+ username_selector: "[data-testid='login-username-input']"
186
+ password_selector: "[data-testid='login-password-input']"
187
+ submit_selector: "[data-testid='login-submit-btn']"
188
+ success_url_contains: /dashboard
189
+ credentials:
190
+ username: admin
191
+ password_env: SMOKE_PASSWORD # 密码从环境变量读取(推荐,不落库不进 git)
192
+ visual_model:
193
+ provider: qwen-vl
194
+ model: qwen-vl-max
195
+ timeout: 60000
196
+
197
+ # ── 分层测试阶段(verify --stage <stage> 联动)──
198
+ stages:
199
+ dev:
200
+ config: null # 使用内置代码质量验证
201
+ pr:
202
+ config: .speccore/tests/pr.yaml
203
+ deploy:
204
+ config: .speccore/tests/smoke.yaml
205
+ release:
206
+ config: .speccore/tests/release.yaml
207
+
208
+ # ── Pipeline 内置测试节点(build 后 deploy 前/后执行)──
209
+ pipeline:
210
+ test:
211
+ enabled: true
212
+ type: smoke # build-check / smoke / visual / api / all
213
+ stage: pre-deploy # pre-deploy / post-deploy / both
214
+ fail_on_error: true # 失败是否阻断部署(仅 critical)
215
+ auto_fix: true
216
+ max_retries: 3
217
+
218
+ # ── 配置变更历史(speccore config --upgrade 自动维护,勿手动编辑)──
219
+ config_history:
220
+ - date: 2026-09-01
221
+ change: 初始配置
222
+ changed_by: alice
@@ -13,32 +13,36 @@
13
13
  # 两种格式 speccore verify --config 均可自动识别。
14
14
  #
15
15
  # v8.3.95+ 支持: cookie / localStorage / script / scroll / upload / iframe / waitForRequest / waitForResponse
16
+ # v8.3.294+ 推荐: 选择器优先用 data-testid(UI_SPEC 元素标识约定 {模块}-{页面}-{元素}),
17
+ # 冒烟装配四阶段会自动从 UI_SPEC 提取元素清单生成场景,失败时输出自愈提示。
16
18
 
17
19
  name: 示例项目冒烟测试
18
20
  platform: h5-mobile
19
21
  url: /
20
22
 
21
23
  scenarios:
22
- # ── 场景1: 登录流程 ──
24
+ # ── 场景1: 登录流程(data-testid 选择器,推荐)──
25
+ # 登录态也可由 environments 配置的 tests.auth 自动装配(v8.3.215+),
26
+ # 本场景演示手工登录写法;受保护页面免登录可用 cookie/localStorage 注入(见场景2/3)。
23
27
  - name: 登录-账号密码登录
24
28
  description: 模块:auth 页面:/login
25
29
  actions:
26
30
  - type: navigate
27
31
  value: /login
28
32
  - type: fill
29
- selector: 'input[name="username"]'
33
+ selector: "[data-testid='login-username-input']"
30
34
  value: test_user
31
35
  - type: fill
32
- selector: 'input[name="password"]'
36
+ selector: "[data-testid='login-password-input']"
33
37
  value: test_password
34
38
  - type: click
35
- selector: 'button[type="submit"]'
36
- waitFor: '.dashboard-container'
39
+ selector: "[data-testid='login-submit-btn']"
40
+ waitFor: "[data-testid='dashboard-page']"
37
41
  assertions:
38
42
  - type: url
39
43
  contains: /dashboard
40
44
  - type: visible
41
- selector: '.dashboard-container'
45
+ selector: "[data-testid='dashboard-page']"
42
46
 
43
47
  # ── 场景2: Cookie 注入免登录 ──
44
48
  # 适用于: 已有登录态 Cookie,跳过登录页直接测试业务模块