@tbox.cn/app-cli 0.5.1 → 0.7.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/chunk-CT3VBMI6.js +17 -0
- package/dist/chunk-JZBQYBEL.js +2 -0
- package/dist/{contracts-resolver-ABE4US6D.js → contracts-resolver-W3DLYTZF.js} +1 -1
- package/dist/declared-7FO4GAX5.js +2 -0
- package/dist/index.js +72 -70
- package/package.json +4 -3
- package/scaffold/module-repo/LICENSE +21 -0
- package/scaffold/module-repo/README.md +27 -0
- package/scaffold/module-repo/package.json +54 -0
- package/scaffold/module-repo/src/client/index.ts +15 -0
- package/scaffold/module-repo/src/index.ts +6 -0
- package/scaffold/module-repo/src/server/index.ts +23 -0
- package/scaffold/module-repo/tbox.module.json +26 -0
- package/scaffold/module-repo/tests/smoke.test.ts +16 -0
- package/scaffold/module-repo/tsconfig.json +8 -0
- package/scaffold/provider-app/package.json +26 -0
- package/scaffold/provider-app/src/server/index.ts +16 -0
- package/scaffold/provider-app/tbox.module.json +29 -0
- package/scaffold/provider-app/tsconfig.json +7 -0
- package/scaffold/provider-repo/LICENSE +21 -0
- package/scaffold/provider-repo/README.md +26 -0
- package/scaffold/provider-repo/package.json +37 -0
- package/scaffold/provider-repo/schemas/README.md +6 -0
- package/scaffold/provider-repo/src/server/index.ts +16 -0
- package/scaffold/provider-repo/tbox.module.json +29 -0
- package/scaffold/provider-repo/tests/smoke.test.ts +9 -0
- package/scaffold/provider-repo/tsconfig.json +7 -0
- package/scaffold/provider-repo/tsup.config.ts +17 -0
- package/scaffold/theme/LICENSE +21 -0
- package/scaffold/theme/README.md +21 -0
- package/scaffold/theme/assets/README.md +18 -0
- package/scaffold/theme/assets.css +25 -0
- package/scaffold/theme/brand.js +8 -0
- package/scaffold/theme/domains.css +4 -0
- package/scaffold/theme/index.css +24 -0
- package/scaffold/theme/motion.css +4 -0
- package/scaffold/theme/overrides.css +4 -0
- package/scaffold/theme/package.json +24 -0
- package/scaffold/theme/tokens.css +5 -0
- package/starter/agent-mall.md +7 -3
- package/starter/agent.md +10 -7
- package/starter/h5.md +42 -0
- package/dist/chunk-D4Z67K2V.js +0 -2
- package/dist/chunk-IA5ZAM5W.js +0 -16
- package/dist/declared-TVLLELHR.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "tbox-app CLI:create / module add|remove|list|sync|diff|doctor|update|publish / start|stop|eval 智能体评测(纯函数核心 + commander 薄壳)。",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"starter",
|
|
18
|
+
"scaffold",
|
|
18
19
|
"README.md",
|
|
19
20
|
"LICENSE"
|
|
20
21
|
],
|
|
@@ -27,14 +28,14 @@
|
|
|
27
28
|
"yaml": "2.9.0",
|
|
28
29
|
"typescript": "5.9.3",
|
|
29
30
|
"zod": "3.25.76",
|
|
30
|
-
"@tbox.cn/app-toolkit": "0.
|
|
31
|
+
"@tbox.cn/app-toolkit": "0.5.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/diff": "7.0.2",
|
|
34
35
|
"@types/node": "24.13.3",
|
|
35
36
|
"tsup": "8.5.1",
|
|
36
37
|
"vitest": "4.1.10",
|
|
37
|
-
"@tbox.cn/app-contracts": "0.
|
|
38
|
+
"@tbox.cn/app-contracts": "0.12.0"
|
|
38
39
|
},
|
|
39
40
|
"license": "MIT",
|
|
40
41
|
"publishConfig": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tbox.cn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# __PKG__
|
|
2
|
+
|
|
3
|
+
__ID__ 业务模块(tbox 组件化应用 · codegen 源形态,`tbox-app new module` 生成)。
|
|
4
|
+
|
|
5
|
+
## 形态铁律(摘要)
|
|
6
|
+
|
|
7
|
+
- 单包双端、逐行同构:`src/server/index.ts` 与 `src/client/index.ts` 描述对象对称;`satisfies` 声明(禁类型标注)
|
|
8
|
+
- `cards` map 的 key = meta.cardType;`exports` 恒指 `src/`
|
|
9
|
+
- import 边界:只 import contracts/sdk 公开入口;全禁直接 import `@tbox-dev-js/sdk`;`client/**` 引同包 `server/**` 类型必须 `import type`
|
|
10
|
+
- `register` 只注册不解析;跨模块交互一律经 ctx(Port + 事件总线)
|
|
11
|
+
|
|
12
|
+
完整铁律与 doctor 26 条规则见 `docs/reference/modules.md`。
|
|
13
|
+
|
|
14
|
+
## 开发循环
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pnpm install # workspace 成员(modules/* 已在根 workspace glob 内)
|
|
18
|
+
pnpm --filter __PKG__ typecheck && pnpm --filter __PKG__ test
|
|
19
|
+
tbox-app module doctor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 交付清单(新增能力后)
|
|
23
|
+
|
|
24
|
+
- `tbox.module.json` contributes 与实现同步(tools/cards/handlers 声明面)
|
|
25
|
+
- 服务槽需求写 `contributes.services`(demand 侧);供给写 `providers.slots`(仅 provider 包)
|
|
26
|
+
- skills 文件化:`skills/<name>/SKILL.md`(loadModuleSkills 声明式通道)
|
|
27
|
+
- 发布:`tbox-app module publish __ID__`(需人工确认;SOP 见 docs/cookbook/release.md)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PKG__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "__ID__ 业务模块(codegen 源):双端单包、逐行同构——server/client 描述对象对称自注册。",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"import": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"./server": {
|
|
12
|
+
"types": "./src/server/index.ts",
|
|
13
|
+
"import": "./src/server/index.ts"
|
|
14
|
+
},
|
|
15
|
+
"./client": {
|
|
16
|
+
"types": "./src/client/index.ts",
|
|
17
|
+
"import": "./src/client/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"prepack": "pnpm build"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@tbox.cn/app-contracts": "catalog:",
|
|
29
|
+
"@tbox.cn/app-sdk-client": "catalog:",
|
|
30
|
+
"@tbox.cn/app-sdk-server": "catalog:"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"zod": "catalog:",
|
|
34
|
+
"react": "catalog:",
|
|
35
|
+
"react-dom": "catalog:"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "catalog:",
|
|
39
|
+
"@types/react": "catalog:",
|
|
40
|
+
"typescript": "catalog:",
|
|
41
|
+
"vitest": "catalog:",
|
|
42
|
+
"zod": "catalog:",
|
|
43
|
+
"tsup": "catalog:",
|
|
44
|
+
"happy-dom": "catalog:"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"src",
|
|
49
|
+
"skills",
|
|
50
|
+
"tbox.module.json",
|
|
51
|
+
"README.md",
|
|
52
|
+
"LICENSE"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClientContext, ClientModule } from '@tbox.cn/app-sdk-client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* __ID__ 客户端注册入口(与 src/server/index.ts 逐行同构)。
|
|
5
|
+
* cards map 的 key 约定 = cardType;无卡片模块写空 map。
|
|
6
|
+
* 客户端职责 = 卡片渲染/槽组件/内联过滤——不新增卡型也需 clientModule 入口(装配判定 = 入口存在性)。
|
|
7
|
+
*/
|
|
8
|
+
const cards = {} as const;
|
|
9
|
+
|
|
10
|
+
export const clientModule = {
|
|
11
|
+
cards,
|
|
12
|
+
register(_ctx: ClientContext): void {
|
|
13
|
+
// _ctx.cards.registerMap(cards);
|
|
14
|
+
},
|
|
15
|
+
} satisfies ClientModule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ServerContext, ServerModule } from '@tbox.cn/app-sdk-server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* __ID__ 服务端注册入口。
|
|
5
|
+
* 铁律:register 只注册不解析(resolveService 仅 handle/事件回调内);服务实例模块顶层单例;
|
|
6
|
+
* 跨模块交互一律经 ctx(禁 import SDK 全局单例状态);cards map 的 key 约定 = meta.cardType。
|
|
7
|
+
* 声明式字段(skills/preTools)经装配端 registerAll 自动注册——见 docs/reference/modules.md。
|
|
8
|
+
*/
|
|
9
|
+
const cards = {} as const;
|
|
10
|
+
|
|
11
|
+
export const serverModule = {
|
|
12
|
+
declaration: {
|
|
13
|
+
moduleId: '__ID__',
|
|
14
|
+
},
|
|
15
|
+
cards,
|
|
16
|
+
register(_ctx: ServerContext): void {
|
|
17
|
+
// _ctx.tools.register(...);
|
|
18
|
+
// _ctx.cards.registerMap(cards);
|
|
19
|
+
// _ctx.handlers.register({ id: '...', handle: async () => ({ cards: [], text: '' }) });
|
|
20
|
+
// _ctx.services.register('xxx', xxxService);
|
|
21
|
+
// _ctx.routes.register(...);
|
|
22
|
+
},
|
|
23
|
+
} satisfies ServerModule;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "__ID__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"kind": "business",
|
|
6
|
+
"risk": {
|
|
7
|
+
"level": "low",
|
|
8
|
+
"writeBoundary": "source"
|
|
9
|
+
},
|
|
10
|
+
"distribution": {
|
|
11
|
+
"defaultMode": "codegen"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"modules": []
|
|
15
|
+
},
|
|
16
|
+
"env": [],
|
|
17
|
+
"declare": {
|
|
18
|
+
"handlers": [],
|
|
19
|
+
"tools": [],
|
|
20
|
+
"cards": [],
|
|
21
|
+
"routes": [],
|
|
22
|
+
"pages": [],
|
|
23
|
+
"tabs": [],
|
|
24
|
+
"resources": []
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { serverModule } from '../src/server/index';
|
|
3
|
+
import { clientModule } from '../src/client/index';
|
|
4
|
+
|
|
5
|
+
describe('__ID__ 模块形态(铁律冒烟)', () => {
|
|
6
|
+
it('双端描述对象在场且自洽(satisfies ServerModule/ClientModule 编译期锁)', () => {
|
|
7
|
+
expect(serverModule).toBeTruthy();
|
|
8
|
+
expect(clientModule).toBeTruthy();
|
|
9
|
+
expect(serverModule.cards).toEqual({});
|
|
10
|
+
expect(clientModule.cards).toEqual({});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('cards key 约定 = meta.cardType(无卡片空 map;新增卡后 key 必须等于 meta.cardType)', () => {
|
|
14
|
+
expect(Object.keys(serverModule.cards)).toHaveLength(0);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PKG__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "__ID__ Provider 包(应用内 local 形态):服务槽供给声明 + register 实现,经 tbox-app provider bind 绑定消费。",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./server": {
|
|
8
|
+
"types": "./src/server/index.ts",
|
|
9
|
+
"import": "./src/server/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"test": "vitest run"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@tbox.cn/app-contracts": "catalog:",
|
|
19
|
+
"@tbox.cn/app-sdk-server": "catalog:"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "catalog:",
|
|
23
|
+
"typescript": "catalog:",
|
|
24
|
+
"vitest": "catalog:"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ServerContext, ServerModule } from '@tbox.cn/app-sdk-server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* __ID__ Provider 注册入口(server-only——供给声明在 tbox.module.json contributes.providers.slots,
|
|
5
|
+
* 实现在此经 ctx.services 注册;消费方经 Port 接口 + ctx.services.resolve 消费)。
|
|
6
|
+
* 槽位示例(tbox.module.json 默认含一条占位槽,按需改写):
|
|
7
|
+
* { "service": "<domain>.<slot>", "credentialType": "-", "local": true,
|
|
8
|
+
* "provider": "__ID__", "implementation": "__ID__-<slot>@1", "configSchema": "schemas/<slot>.config.json" }
|
|
9
|
+
* 绑定:tbox-app provider bind <service> __ID__ [implementation](写 config/integrations.json)。
|
|
10
|
+
* 结构样例与厂商中立纪律:modules/provider-mock(极简)/ modules/provider-mocktest(configSchema 样例)+ docs/reference/providers.md。
|
|
11
|
+
*/
|
|
12
|
+
export const serverModule = {
|
|
13
|
+
register(_ctx: ServerContext): void {
|
|
14
|
+
// _ctx.services.register('<slot>', impl); // 实现按需落 src/server/<slot>.ts
|
|
15
|
+
},
|
|
16
|
+
} satisfies ServerModule;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "__ID__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"kind": "business",
|
|
6
|
+
"risk": {
|
|
7
|
+
"level": "low",
|
|
8
|
+
"writeBoundary": "source"
|
|
9
|
+
},
|
|
10
|
+
"distribution": {
|
|
11
|
+
"defaultMode": "local"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"modules": []
|
|
15
|
+
},
|
|
16
|
+
"env": [],
|
|
17
|
+
"declare": {
|
|
18
|
+
"handlers": [],
|
|
19
|
+
"tools": [],
|
|
20
|
+
"cards": [],
|
|
21
|
+
"routes": [],
|
|
22
|
+
"pages": [],
|
|
23
|
+
"tabs": [],
|
|
24
|
+
"providers": {
|
|
25
|
+
"slots": []
|
|
26
|
+
},
|
|
27
|
+
"consumes": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tbox.cn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# __ID__ Provider 包
|
|
2
|
+
|
|
3
|
+
__ID__ 服务槽供给包(tbox 组件化应用 · 公开发布形态,`tbox-app new provider` 生成)。
|
|
4
|
+
|
|
5
|
+
## 职责边界
|
|
6
|
+
|
|
7
|
+
- 供给声明 = `tbox.module.json` 的 `contributes.providers.slots`(service/credentialType/implementation/configSchema)
|
|
8
|
+
- 实现 = `src/server/`(经 ctx.services 注册;消费方走 Port 接口 + ctx.services.resolve)
|
|
9
|
+
- 绑定 = `tbox-app provider bind <service> __ID__ [implementation]`(写应用 config/integrations.json)
|
|
10
|
+
- **厂商中立纪律**:本包受 vendor-neutrality 门禁扫描(公开 publishable 时)——不得内嵌厂商字样/真实标识/深链
|
|
11
|
+
|
|
12
|
+
结构样例与多 Provider 架构见 `docs/reference/providers.md`;凭证红线见 `docs/cookbook/real-env-and-secrets.md`(包内一律 credentialRef 或占位,禁任何密钥凭据)。
|
|
13
|
+
|
|
14
|
+
## 开发循环
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pnpm install
|
|
18
|
+
pnpm --filter __PKG__ typecheck && pnpm --filter __PKG__ test
|
|
19
|
+
pnpm --filter __PKG__ build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 交付清单
|
|
23
|
+
|
|
24
|
+
- `schemas/<slot>.config.json`:per-slot config schema(provider use/configure 面)
|
|
25
|
+
- `tbox.module.json` slots 与 src 实现同步;credentialType 与 `config/credentials/` 工件对齐
|
|
26
|
+
- 发布登记:`scripts/release.mjs FAMILY_PACKAGES` 加行(kind: 'module';私有厂商集成 publishable: false)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PKG__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "__ID__ Provider 包(公开发布形态):服务槽供给声明 + register 实现,经 tbox-app provider bind 绑定消费。",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./server": {
|
|
8
|
+
"types": "./src/server/index.ts",
|
|
9
|
+
"import": "./src/server/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"prepack": "pnpm build"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@tbox.cn/app-contracts": "catalog:",
|
|
21
|
+
"@tbox.cn/app-sdk-server": "catalog:"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "catalog:",
|
|
25
|
+
"typescript": "catalog:",
|
|
26
|
+
"vitest": "catalog:",
|
|
27
|
+
"tsup": "catalog:"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"src",
|
|
32
|
+
"schemas",
|
|
33
|
+
"tbox.module.json",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# schemas/ — per-slot config schema
|
|
2
|
+
|
|
3
|
+
槽位 config schema(JSON Schema draft-07 形态;`tbox.module.json` slots[].configSchema 指向)。
|
|
4
|
+
文件名约定 = `<slot>.config.json`(slot = 域后段,如 `parking.config.json` 供 `parking.*` 域共享)。
|
|
5
|
+
|
|
6
|
+
参照:`modules/provider-mocktest/schemas/*.config.json`(五域共享形态——2026-09-20 拆分迁入)。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ServerContext, ServerModule } from '@tbox.cn/app-sdk-server';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* __ID__ Provider 注册入口(server-only——供给声明在 tbox.module.json contributes.providers.slots,
|
|
5
|
+
* 实现在此经 ctx.services 注册;消费方经 Port 接口 + ctx.services.resolve 消费)。
|
|
6
|
+
* 槽位示例(tbox.module.json 默认含一条占位槽,按需改写):
|
|
7
|
+
* { "service": "<domain>.<slot>", "credentialType": "-", "local": true,
|
|
8
|
+
* "provider": "__ID__", "implementation": "__ID__-<slot>@1", "configSchema": "schemas/<slot>.config.json" }
|
|
9
|
+
* 绑定:tbox-app provider bind <service> __ID__ [implementation](写 config/integrations.json)。
|
|
10
|
+
* 结构样例与厂商中立纪律:modules/provider-mock(极简)/ modules/provider-mocktest(configSchema 样例)+ docs/reference/providers.md。
|
|
11
|
+
*/
|
|
12
|
+
export const serverModule = {
|
|
13
|
+
register(_ctx: ServerContext): void {
|
|
14
|
+
// _ctx.services.register('<slot>', impl); // 实现按需落 src/server/<slot>.ts
|
|
15
|
+
},
|
|
16
|
+
} satisfies ServerModule;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"id": "__ID__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"kind": "business",
|
|
6
|
+
"risk": {
|
|
7
|
+
"level": "low",
|
|
8
|
+
"writeBoundary": "source"
|
|
9
|
+
},
|
|
10
|
+
"distribution": {
|
|
11
|
+
"defaultMode": "codegen"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"modules": []
|
|
15
|
+
},
|
|
16
|
+
"env": [],
|
|
17
|
+
"declare": {
|
|
18
|
+
"handlers": [],
|
|
19
|
+
"tools": [],
|
|
20
|
+
"cards": [],
|
|
21
|
+
"routes": [],
|
|
22
|
+
"pages": [],
|
|
23
|
+
"tabs": [],
|
|
24
|
+
"providers": {
|
|
25
|
+
"slots": []
|
|
26
|
+
},
|
|
27
|
+
"consumes": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { serverModule } from '../src/server/index';
|
|
3
|
+
|
|
4
|
+
describe('__ID__ provider 形态冒烟', () => {
|
|
5
|
+
it('serverModule 在场(供给实现经 ctx.services 注册——register 空实现为合法骨架)', () => {
|
|
6
|
+
expect(serverModule).toBeTruthy();
|
|
7
|
+
expect(typeof serverModule.register).toBe('function');
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: {
|
|
5
|
+
index: 'src/server/index.ts',
|
|
6
|
+
},
|
|
7
|
+
format: ['esm'],
|
|
8
|
+
target: 'node20',
|
|
9
|
+
platform: 'node',
|
|
10
|
+
outDir: 'dist',
|
|
11
|
+
clean: true,
|
|
12
|
+
sourcemap: false,
|
|
13
|
+
// dts worker 以命令行式传参会撞 TS5074(incremental 需单文件 emit 或 tsBuildInfoFile);
|
|
14
|
+
// 声明产物一次性构建无需增量——仅 dts 关闭,typecheck 的增量缓存不受影响。
|
|
15
|
+
dts: { compilerOptions: { incremental: false } },
|
|
16
|
+
external: ['@tbox.cn/app-sdk-server', '@tbox.cn/app-contracts'],
|
|
17
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tbox.cn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# __PKG__
|
|
2
|
+
|
|
3
|
+
__ID__ 主题包(品牌资产包,`tbox-app new theme` 生成):五段 CSS 覆写 + brand.js 品牌副作用 + 素材九语义位。
|
|
4
|
+
|
|
5
|
+
## 接线(换主题 = 替换语义)
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
tbox-app theme use <id> --source <本包目录> # registry 源缺省;私有主题必须 --source
|
|
9
|
+
tbox-app theme list # ● 接线生效 / ○ 已安装未接线
|
|
10
|
+
tbox-app dev --theme <id> # 开发期临时换主题(文件零改动)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
接线三行(main.tsx 自由区,theme use 自动维护):index.css import + brand.js import + `applyTheme('<id>')`。
|
|
14
|
+
|
|
15
|
+
## 结构契约
|
|
16
|
+
|
|
17
|
+
- 五段 CSS(doctor ㉕ theme-package-structure 校验):tokens/motion/overrides/domains/assets——覆写变量 ⊆ kit 主题契约封闭清单
|
|
18
|
+
- 素材唯一归宿:`assets/` 九语义位 + `assets.css` 覆写(模块侧只消费 `var(…, 兜底)`)
|
|
19
|
+
- 发布形态:公开主题过 vendor-neutrality 门禁;私有主题在 `scripts/release.mjs FAMILY_PACKAGES` 标 `publishable: false`(theme-wanda 先例)
|
|
20
|
+
|
|
21
|
+
视觉体系与域色矩阵见 `docs/reference/templates.md`;换肤面(四级级联与三条变量链)同页。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# assets/ — 九语义位素材
|
|
2
|
+
|
|
3
|
+
IP 素材唯一归宿(模块兜底 = 中立渐变;模块侧禁元素级 `--tbox-asset-*` 声明)。
|
|
4
|
+
|
|
5
|
+
| 语义位 | 文件名约定 |
|
|
6
|
+
|---|---|
|
|
7
|
+
| home-poster-stage | `__ID__-home-poster-stage.jpg` |
|
|
8
|
+
| home-poster-compact | `__ID__-home-poster-compact.jpg` |
|
|
9
|
+
| bumpin-bg | `__ID__-bumpin-bg.jpg` |
|
|
10
|
+
| member-login-hero | `__ID__-member-login-hero.jpg` |
|
|
11
|
+
| member-mascot | `__ID__-member-mascot.jpg` |
|
|
12
|
+
| parking-hero | `__ID__-parking-hero.jpg` |
|
|
13
|
+
| promotion-activity-header | `__ID__-promotion-activity-header.jpg` |
|
|
14
|
+
| promotion-coupon-header | `__ID__-promotion-coupon-header.jpg` |
|
|
15
|
+
| sg-header | `__ID__-sg-header.jpg` |
|
|
16
|
+
|
|
17
|
+
素材落位后在 `assets.css` 的 `html[data-theme='<id>']` 主题段内以 `--tbox-asset-<位>: url('./assets/<文件>');`
|
|
18
|
+
覆写(变量名清单见 assets.css 头注;⊆ kit 主题契约封闭清单;禁裸 :root——doctor ㉕ 锚检查)。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* __ID__ 素材变量覆写——九语义位占位骨架。
|
|
3
|
+
*
|
|
4
|
+
* IP 素材唯一归宿 = 主题包(模块兜底 = 中立渐变;模块侧禁元素级 --tbox-asset-* 声明——
|
|
5
|
+
* 声明截断 html[data-theme] 覆写继承,guard-asset-cascade 拦截;素材变量链 = var(…, 兜底) 消费形态)。
|
|
6
|
+
*
|
|
7
|
+
* 九语义位(素材文件放 assets/,变量指文件相对路径;覆写须挂 html[data-theme='__ID__'] 主题段,
|
|
8
|
+
* 禁裸 :root——doctor ㉕ 锚检查):
|
|
9
|
+
* --tbox-asset-home-poster-stage 家页主视觉(舞台态)
|
|
10
|
+
* --tbox-asset-home-poster-compact 家页主视觉(紧凑态)
|
|
11
|
+
* --tbox-asset-bumpin-bg 碰一下入口背景
|
|
12
|
+
* --tbox-asset-member-login-hero 会员登录主视觉
|
|
13
|
+
* --tbox-asset-member-mascot 会员吉祥物
|
|
14
|
+
* --tbox-asset-parking-hero 停车主视觉
|
|
15
|
+
* --tbox-asset-promotion-activity-header 活动头图
|
|
16
|
+
* --tbox-asset-promotion-coupon-header 券头图
|
|
17
|
+
* --tbox-asset-sg-header 导购头图
|
|
18
|
+
*
|
|
19
|
+
* 启用示例(素材落 assets/ 后,加入下方主题段):
|
|
20
|
+
* --tbox-asset-home-poster-stage: url('./assets/__ID__-home-poster-stage.jpg');
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/* 空块 = kit 默认素材(中立渐变兜底);素材启用后在本段内覆写九语义位 */
|
|
24
|
+
html[data-theme='__ID__'] {
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* __ID__ 品牌副作用入口(v1 仅标题——复杂化前须先补 AST 纯度校验,
|
|
3
|
+
* 质量门边界见 .agents/notes/implemented/feature/2026-09-17-theme-brand-assets.md)。
|
|
4
|
+
*
|
|
5
|
+
* 接线(生成应用侧三行之二):import '__PKG__/brand.js';
|
|
6
|
+
* 质量门 = doctor ㉖ 对称检查(exports 含 ./brand.js 而入口未 import → 已安装未接线告警)。
|
|
7
|
+
*/
|
|
8
|
+
document.title = '__ID__';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* __PKG__ 主题包入口——品牌资产包,零 npm 依赖。
|
|
3
|
+
*
|
|
4
|
+
* 接线(生成应用侧三行,main.tsx 自由区):
|
|
5
|
+
* import '__PKG__/index.css';
|
|
6
|
+
* import '__PKG__/brand.js';
|
|
7
|
+
* import { applyTheme } from '@app/agent-ui-kit/theme';
|
|
8
|
+
* applyTheme('__ID__');
|
|
9
|
+
* (接线管理:tbox-app theme use <id> --source <本包目录>;tbox-app theme list 查看状态)
|
|
10
|
+
*
|
|
11
|
+
* 五段结构(主题契约,doctor theme-package-structure 校验):
|
|
12
|
+
* tokens 品牌彩部覆写(primary/accent 族)
|
|
13
|
+
* motion 动效节奏覆写
|
|
14
|
+
* overrides 壳类 .tbox-* 覆写
|
|
15
|
+
* domains 域色通道覆写(--tbox-domain-*)
|
|
16
|
+
* assets 素材变量覆写(--tbox-asset-* 九语义位——IP 素材唯一归宿)
|
|
17
|
+
*
|
|
18
|
+
* 覆写变量必须 ⊆ kit 主题契约封闭清单(@app/agent-ui-kit/theme/contract)。
|
|
19
|
+
*/
|
|
20
|
+
@import './tokens.css';
|
|
21
|
+
@import './motion.css';
|
|
22
|
+
@import './overrides.css';
|
|
23
|
+
@import './domains.css';
|
|
24
|
+
@import './assets.css';
|