Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "flow2spec-workspace",
"private": true,
"version": "3.3.1",
"version": "3.4.0",
"description": "Flow2Spec workspace for the Core library and CLI packages",
"workspaces": [
"packages/core",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@double-coding/flow2spec",
"version": "3.3.1",
"version": "3.4.0",
"description": "在业务仓库初始化文档驱动、可写回知识库的 AI 协作骨架",
"homepage": "https://github.com/double-coding-lab/Flow2Spec#readme",
"repository": {
Expand All @@ -20,7 +20,7 @@
"README.md"
],
"dependencies": {
"@double-coding/flow2spec-core": "3.3.1"
"@double-coding/flow2spec-core": "3.4.0"
},
"publishConfig": {
"access": "public",
Expand Down
22 changes: 22 additions & 0 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,25 @@
Flow2Spec 的程序化核心能力包,供 CLI 和原生开发工具插件共同使用。

普通用户通常不需要单独安装此包;安装 `@double-coding/flow2spec` 或 Flow2Spec 原生插件时会自动带上对应版本的 Core。

## 原生插件 API

```js
const { createFlow2Spec } = require("@double-coding/flow2spec-core");

const flow2spec = createFlow2Spec({ cwd: process.cwd() });
const skills = flow2spec.resources.skillCatalog({ host: "dsh", locale: "zh-CN" });
const entry = flow2spec.resources.unifiedEntry({
host: "dsh",
locale: "zh-CN",
projectConfig: flow2spec.config.load(),
});
const update = await flow2spec.update.check();
```

- `resources.skillCatalog()` 返回带正文和关联规则资源的结构化 Skill 清单。Core 根据宿主适配规则与 Skill 路径,插件不需要重写其他客户端目录。
- `resources.unifiedEntry()` 返回宿主适配后的统一入口,可附带当前项目配置摘要。
- `update.check()` 复用 `.Knowledge/update-check.json` 的每日缓存与版本比较语义;网络不可用时返回 `unavailable`,不会阻断宿主。
- `capabilities.json` 的 `protocolVersion` 用于插件启动时执行能力兼容校验。

包通过 `index.d.ts` 导出完整公共契约类型。普通 CLI 用户继续使用 `npx @double-coding/flow2spec init`,无需直接调用这些 API。
7 changes: 5 additions & 2 deletions packages/core/capabilities.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schema": "flow2spec.capabilities.v1",
"protocolVersion": 1,
"protocolVersion": 2,
"package": "@double-coding/flow2spec-core",
"capabilities": [
{ "id": "project.init", "api": "project.init", "since": "3.3.0" },
Expand All @@ -22,6 +22,9 @@
{ "id": "resources.capabilities", "api": "resources.capabilities", "since": "3.3.0" },
{ "id": "resources.skills", "api": "resources.listSkills", "since": "3.3.0" },
{ "id": "resources.rules", "api": "resources.listRules", "since": "3.3.0" },
{ "id": "resources.read", "api": "resources.read", "since": "3.3.0" }
{ "id": "resources.read", "api": "resources.read", "since": "3.3.0" },
{ "id": "resources.skill-catalog", "api": "resources.skillCatalog", "since": "3.4.0" },
{ "id": "resources.unified-entry", "api": "resources.unifiedEntry", "since": "3.4.0" },
{ "id": "update.check", "api": "update.check", "since": "3.4.0" }
]
}
Loading
Loading