openprototype 0.1.0 → 0.2.1
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/AGENTS.md +58 -0
- package/CONVENTIONS.md +54 -0
- package/LICENSE +21 -0
- package/README.md +234 -3
- package/bin/cli.js +297 -0
- package/lib/config.js +162 -0
- package/package.json +32 -10
- package/product/demo/pc/customer/customer_form.html +137 -0
- package/product/demo/pc/customer/customer_form.md +33 -0
- package/product/demo/pc/customer/customer_list.html +132 -0
- package/product/demo/pc/customer/customer_list.md +35 -0
- package/product/demo/pc/demo-data.js +23 -0
- package/product/demo/pc/index.html +1082 -0
- package/product/demo/pc/nav-tree.json +15 -0
- package/proto-kit.config.json +13 -0
- package/runtime/server.js +664 -0
- package/runtime/shared/ai-polish.js +159 -0
- package/runtime/shared/base-manager.js +168 -0
- package/runtime/shared/common/component-renderer.js +917 -0
- package/runtime/shared/common/copy-manager.js +134 -0
- package/runtime/shared/common/data-bridge.js +45 -0
- package/runtime/shared/common/form-renderer.js +211 -0
- package/runtime/shared/common/form.js +357 -0
- package/runtime/shared/common/formatter.js +78 -0
- package/runtime/shared/common/index.js +37 -0
- package/runtime/shared/common/line-chart.js +357 -0
- package/runtime/shared/common/modal-manager.js +82 -0
- package/runtime/shared/common/prd-panel.css +395 -0
- package/runtime/shared/common/prd-panel.js +1280 -0
- package/runtime/shared/common/prd-popup.js +168 -0
- package/runtime/shared/common/search-renderer.js +95 -0
- package/runtime/shared/common/table-renderer.js +177 -0
- package/runtime/shared/common/table.js +160 -0
- package/runtime/shared/common/toast.js +99 -0
- package/runtime/shared/common/ui-preference-manager.js +74 -0
- package/runtime/shared/common/view-mode.js +30 -0
- package/runtime/shared/common.js +43 -0
- package/runtime/shared/constants/icons.js +28 -0
- package/runtime/shared/constants/status.js +67 -0
- package/runtime/shared/libs/marked.min.js +69 -0
- package/runtime/shared/prd-content.js +9 -0
- package/runtime/shared/styles.css +7673 -0
- package/runtime/shared/utils.js +110 -0
- package/runtime/shared/view-controls.js +148 -0
- package/runtime/shell/agent-panel.css +429 -0
- package/runtime/shell/agent-panel.js +629 -0
- package/scripts/check/run-checks.js +58 -0
- package/scripts/check/smoke-test.js +244 -0
- package/scripts/check/static-check.js +248 -0
- package/scripts/check/sync-nav-tree.js +139 -0
- package/templates/AGENTS.md +58 -0
- package/templates/CONVENTIONS.md +54 -0
- package/templates/gitignore +12 -0
- package/templates/product-shell/index.html +1082 -0
- package/templates/skills/auto-test/SKILL.md +62 -0
- package/templates/skills/xiaojia/SKILL.md +299 -0
- package/cli.js +0 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# CONVENTIONS.md — 原型页面约定
|
|
2
|
+
|
|
3
|
+
> 这份文件说明 **`openprototype check` 静态检查器实际强制的红线**,以及配套的写法约定。
|
|
4
|
+
> 它和运行时(`scripts/check/` + `shared/` 引擎)耦合,改动检查器时同步改这里。
|
|
5
|
+
> 你团队自己的 PRD 模板、业务规范、术语,请另建 `rules/` 放,不必写进本文件。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 检查器强制项(违反 = `check` 报 ERROR)
|
|
10
|
+
|
|
11
|
+
1. **脚本加载顺序**
|
|
12
|
+
页面里出现的核心脚本必须按此相对先后:
|
|
13
|
+
`base-manager.js → constants.js → mock-data.js → data.js → common.js → menu.js → prd-content.js → 页面脚本`
|
|
14
|
+
|
|
15
|
+
2. **数据走 BaseDataManager**
|
|
16
|
+
页面级 JS / 内联脚本**禁止**直接 `localStorage.getItem/setItem/removeItem`。
|
|
17
|
+
所有读写通过继承 `BaseDataManager` 的 Manager(见 `shared/base-manager.js`)。
|
|
18
|
+
|
|
19
|
+
3. **状态值常量化**
|
|
20
|
+
`<option>` **禁止**硬编码状态文案(如「已审核」「待提交」)。状态下拉由 Renderer 从
|
|
21
|
+
`shared/constants/status.js` 的 `STATUS_LABELS` 生成。
|
|
22
|
+
|
|
23
|
+
4. **字体系统栈,禁止 Google Fonts**
|
|
24
|
+
不得引用 `fonts.googleapis.com` / `fonts.gstatic.com`。统一用:
|
|
25
|
+
`-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif`
|
|
26
|
+
|
|
27
|
+
## 冒烟测试项(`check` 的运行时部分,Playwright)
|
|
28
|
+
|
|
29
|
+
5. **`?mode=view` 物理隐藏**
|
|
30
|
+
URL 带 `?mode=view` 时,所有 input / textarea / 删除 / 编辑 / 提交按钮必须
|
|
31
|
+
`display:none`(**物理隐藏**),不是 `disabled`。
|
|
32
|
+
|
|
33
|
+
6. **无 console 报错**
|
|
34
|
+
每个页面打开时不得抛未捕获异常或 `console.error`。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 配套写法约定(不强制,但建议)
|
|
39
|
+
|
|
40
|
+
- **零内联**:HTML 只放容器(`#searchForm` / `#tableContainer` 等),按钮、下拉、操作列经
|
|
41
|
+
`shared/common.js` 的 Renderer 渲染,别写死在 HTML 里。
|
|
42
|
+
- **表单栅格**:上下布局,Label 在控件上方左对齐;普通项三栏,textarea 占满一行。
|
|
43
|
+
- **查询区按钮聚拢**:「查询 / 重置 / 新增」左对齐放在同一个 `.search-actions`。
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 怎么跑检查
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
openprototype check # 扫全部产品页面
|
|
51
|
+
openprototype check --changed # 只扫 git 改动的页面
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
生成或修改任何原型页面后立即跑一次,把 ERROR 全部修掉再交付(`auto-test` skill 会提醒 AI 这么做)。
|