@coze-arch/cli 0.0.19-beta.1 → 0.0.20

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 (32) hide show
  1. package/lib/__templates__/nuxt-vue/app/pages/index.vue +6 -0
  2. package/lib/__templates__/nuxt-vue/nuxt.config.ts +2 -2
  3. package/lib/__templates__/pi-agent/AGENTS.md +7 -2
  4. package/lib/__templates__/pi-agent/README.md +2 -0
  5. package/lib/__templates__/pi-agent/docs/project-overview.md +9 -15
  6. package/lib/__templates__/pi-agent/docs/user/getting-started.md +3 -4
  7. package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/SKILL.md +4 -10
  8. package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/SKILL.md +6 -18
  9. package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/SKILL.md +9 -37
  10. package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/SKILL.md +17 -30
  11. package/lib/__templates__/pi-agent/src/config.ts +60 -19
  12. package/lib/__templates__/pi-agent/src/core.ts +1 -0
  13. package/lib/__templates__/pi-agent/src/dashboard/index.ts +39 -4
  14. package/lib/__templates__/pi-agent/src/dashboard/server.ts +0 -12
  15. package/lib/__templates__/pi-agent/src/dashboard/web/src/components/app-layout.tsx +1 -15
  16. package/lib/__templates__/pi-agent/src/dashboard/web/src/main.tsx +0 -6
  17. package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/chat-page.tsx +0 -11
  18. package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/overview-page.tsx +268 -72
  19. package/lib/__templates__/pi-agent/src/dashboard/web/src/styles.css +0 -91
  20. package/lib/__templates__/pi-agent/tests/config.test.ts +63 -1
  21. package/lib/__templates__/templates.json +24 -24
  22. package/lib/cli.js +1 -1
  23. package/package.json +1 -1
  24. package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/scripts/asr.mjs +0 -9
  25. package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/scripts/gen.mjs +0 -9
  26. package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/scripts/tts.mjs +0 -9
  27. package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/scripts/gen.mjs +0 -9
  28. package/lib/__templates__/pi-agent/src/dashboard/api/docs.ts +0 -204
  29. package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/channels-page.tsx +0 -188
  30. package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/docs-page.tsx +0 -65
  31. package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/models-page.tsx +0 -122
  32. package/lib/__templates__/pi-agent/tests/dashboard-docs-api.test.ts +0 -125
@@ -1,125 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { dirname, join } from "node:path";
5
- import test from "node:test";
6
- import { readDocsResponse } from "../src/dashboard/api/docs.js";
7
-
8
- function writeDoc(rootDir: string, relativePath: string, content: string) {
9
- const filePath = join(rootDir, relativePath);
10
- mkdirSync(dirname(filePath), { recursive: true });
11
- writeFileSync(filePath, content, "utf-8");
12
- }
13
-
14
- test("readDocsResponse lists markdown docs by order and picks the first doc by default", () => {
15
- const docsDir = mkdtempSync(join(tmpdir(), "pi-bot-dashboard-docs-"));
16
-
17
- try {
18
- writeDoc(
19
- docsDir,
20
- "channels/feishu.md",
21
- `---
22
- title: 飞书接入
23
- summary: 飞书文档
24
- group: 渠道
25
- order: 30
26
- ---
27
- # 飞书接入
28
-
29
- 这里是飞书说明。
30
- `
31
- );
32
- writeDoc(
33
- docsDir,
34
- "getting-started.md",
35
- `---
36
- title: 快速开始
37
- summary: 启动项目
38
- group: 入门
39
- order: 10
40
- ---
41
- # 快速开始
42
-
43
- 先启动项目。
44
- `
45
- );
46
-
47
- const response = readDocsResponse({ docsDir });
48
-
49
- assert.deepEqual(
50
- response.docs.map((doc) => doc.slug),
51
- ["getting-started", "channels/feishu"]
52
- );
53
- assert.equal(response.selectedDoc?.slug, "getting-started");
54
- assert.equal(response.requestedSlugFound, true);
55
- } finally {
56
- rmSync(docsDir, { recursive: true, force: true });
57
- }
58
- });
59
-
60
- test("readDocsResponse returns the requested doc and strips frontmatter from content", () => {
61
- const docsDir = mkdtempSync(join(tmpdir(), "pi-bot-dashboard-docs-selected-"));
62
-
63
- try {
64
- writeDoc(
65
- docsDir,
66
- "getting-started.md",
67
- `---
68
- title: 快速开始
69
- summary: 启动项目
70
- group: 入门
71
- order: 10
72
- ---
73
- # 快速开始
74
-
75
- 先启动项目。
76
- `
77
- );
78
- writeDoc(
79
- docsDir,
80
- "channels/feishu.md",
81
- `---
82
- title: 飞书接入
83
- summary: 飞书文档
84
- group: 渠道
85
- order: 30
86
- ---
87
- # 飞书接入
88
-
89
- 这里是飞书说明。
90
- `
91
- );
92
-
93
- const response = readDocsResponse({ docsDir, slug: "channels/feishu" });
94
-
95
- assert.equal(response.selectedDoc?.slug, "channels/feishu");
96
- assert.match(response.selectedDoc?.content ?? "", /^# 飞书接入/m);
97
- assert.doesNotMatch(response.selectedDoc?.content ?? "", /^---$/m);
98
- assert.equal(response.requestedSlugFound, true);
99
- } finally {
100
- rmSync(docsDir, { recursive: true, force: true });
101
- }
102
- });
103
-
104
- test("readDocsResponse falls back to the default doc when the requested slug is missing", () => {
105
- const docsDir = mkdtempSync(join(tmpdir(), "pi-bot-dashboard-docs-fallback-"));
106
-
107
- try {
108
- writeDoc(
109
- docsDir,
110
- "getting-started.md",
111
- `# 快速开始
112
-
113
- 先启动项目。
114
- `
115
- );
116
-
117
- const response = readDocsResponse({ docsDir, slug: "does-not-exist" });
118
-
119
- assert.equal(response.selectedDoc?.slug, "getting-started");
120
- assert.equal(response.requestedSlug, "does-not-exist");
121
- assert.equal(response.requestedSlugFound, false);
122
- } finally {
123
- rmSync(docsDir, { recursive: true, force: true });
124
- }
125
- });