feihong-code 8.0.2 → 8.3.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.
@@ -13,4 +13,4 @@ updates:
13
13
  schedule:
14
14
  interval: "weekly"
15
15
  labels:
16
- - "github-actions"
16
+ - "dependencies"
@@ -1,193 +1,193 @@
1
- # 飞虹 Code CI
2
- # 晋江市飞虹智科技企业管理有限公司 · 飞扬企源研发中心 · 负责人:吴赐虹
3
- #
4
- # 全流程离线:不使用任何 API key / Secrets,PR 来自 fork 也能安全跑完。
5
- name: CI
6
-
7
- on:
8
- push:
9
- branches: [master, main]
10
- pull_request:
11
- workflow_dispatch:
12
-
13
- env:
14
- FH_OFFLINE: 'true'
15
- FH_PROVIDERS: '[]'
16
-
17
- jobs:
18
- # ---------- 1. 构建与离线闭环冒烟(多 Node 版本矩阵) ----------
19
- build:
20
- name: 构建 · Node ${{ matrix.node }}
21
- runs-on: ubuntu-latest
22
- strategy:
23
- fail-fast: false
24
- matrix:
25
- node: [22]
26
- steps:
27
- - uses: actions/checkout@v4
28
- - uses: actions/setup-node@v4
29
- with:
30
- node-version: ${{ matrix.node }}
31
- # Node 18 上 electron 41 的 postinstall 因 @electron/get 转 ESM 而 require() 失败;
32
- # 构建/测试不需要 electron 二进制,故 Node 18 跳过安装脚本(CLI 为纯 TS 编译)。
33
- - run: npm install ${{ matrix.node == 18 && '--ignore-scripts' || '' }}
34
- - name: 版本号一致性(package.json 为单一权威源)
35
- run: npm run check:version
36
- - name: 类型检查
37
- run: npm run typecheck
38
- - name: 编译
39
- run: npm run build
40
- - name: 跨端一致性冒烟(桌面/移动/扩展)
41
- run: npm run check:cross -- --runtime
42
- # Node 18 跳过运行时 CLI 步骤:CLI 启动时即加载 playwright-core(硬要求 Node>=20),
43
- # 故 Node 18 仅验证构建/类型检查/跨端契约(见 check:cross 的 F12 守卫),不实际运行 CLI。
44
- - name: CLI 可用性
45
- if: ${{ matrix.node != 18 }}
46
- run: node dist/cli/index.js --version
47
- - name: 离线端到端闭环
48
- if: ${{ matrix.node != 18 }}
49
- run: node dist/cli/index.js "离线冒烟:创建一个说明文件"
50
- - name: 只读技能
51
- if: ${{ matrix.node != 18 }}
52
- run: |
53
- node dist/cli/index.js /plan "实现登录并且添加支付"
54
- node dist/cli/index.js /grill src
55
-
56
- # ---------- 2. M4 企业能力(权限 / 审计 / 多租户 / 配额) ----------
57
- enterprise:
58
- name: 企业能力冒烟 (M4)
59
- runs-on: ubuntu-latest
60
- steps:
61
- - uses: actions/checkout@v4
62
- - uses: actions/setup-node@v4
63
- with:
64
- node-version: 22
65
- - run: npm install
66
- - run: npm run build
67
- - name: M4 断言套件(RBAC / 审计链 / 多租户 / 配额)
68
- run: node scripts/verify-m4.mjs
69
- - name: CLI 企业命令冒烟
70
- env:
71
- FH_HOME: ${{ runner.temp }}/fhhome
72
- FH_TENANT: ci-tenant
73
- FH_USER: ci-bot
74
- FH_ROLE: developer
75
- run: |
76
- node dist/cli/index.js whoami
77
- node dist/cli/index.js policy
78
- node dist/cli/index.js "CI 离线任务"
79
- node dist/cli/index.js audit --limit 10
80
- node dist/cli/index.js audit verify
81
- node dist/cli/index.js tenants
82
- - name: 租户隔离断言(beta 不得看到 ci-tenant 的会话)
83
- env:
84
- FH_HOME: ${{ runner.temp }}/fhhome
85
- FH_TENANT: beta-tenant
86
- FH_ROLE: viewer
87
- run: |
88
- out=$(node dist/cli/index.js sessions)
89
- echo "$out"
90
- if echo "$out" | grep -q "CI 离线任务"; then
91
- echo "::error::租户隔离失效:beta-tenant 读到了 ci-tenant 的会话"
92
- exit 1
93
- fi
94
-
95
- # ---------- 3. 供应链与密钥安全 ----------
96
- security:
97
- name: 发布包安全检查
98
- runs-on: ubuntu-latest
99
- steps:
100
- - uses: actions/checkout@v4
101
- - uses: actions/setup-node@v4
102
- with:
103
- node-version: 22
104
- - run: npm install
105
- - run: npm run build
106
- - name: 发布包不得包含密钥或源码
107
- run: |
108
- npm pack --dry-run 2>&1 | tee pack.txt
109
- for bad in "\\.env([ /]|$)" "src/" ".workbuddy" "policy.json" "id_rsa"; do
110
- if grep -qE "$bad" pack.txt; then
111
- echo "::error::发布包中检出敏感条目: $bad"
112
- exit 1
113
- fi
114
- done
115
- echo "发布包白名单校验通过"
116
- - name: 仓库内不得提交明文密钥
117
- run: |
118
- if git grep -nIE "sk-[A-Za-z0-9_-]{16,}" -- . ':!*.md' ':!scripts/verify-m4.mjs' ':!tests/unit/redact.test.ts' ':!scripts/data/voltagent_skills.json'; then
119
- echo "::error::检出疑似明文 API Key"
120
- exit 1
121
- fi
122
- - name: 合规宣称扫描(对外材料不得宣称已获第三方认证)
123
- run: npm run check:compliance
124
- echo "密钥扫描通过"
125
- - run: npm audit --omit=dev --audit-level=high
126
- continue-on-error: true
127
-
128
- # ---------- 3b. 供应链安全:依赖漏洞 + SBOM(P0-2) ----------
129
- supplychain:
130
- name: 供应链安全 · 依赖扫描 + SBOM
131
- runs-on: ubuntu-latest
132
- steps:
133
- - uses: actions/checkout@v4
134
- - uses: actions/setup-node@v4
135
- with:
136
- node-version: 22
137
- - run: npm install
138
- # 1) npm audit:生产依赖 high 及以上漏洞视为失败(供应链准入证据)
139
- - name: npm audit(生产依赖 high+)
140
- run: npm audit --omit=dev --audit-level=high
141
- # 2) osv-scanner:OSV 数据库全量扫描 lockfile
142
- - name: osv-scanner(OSV 全量漏洞库)
143
- uses: google/osv-scanner/actions/scanner@v2
144
- with:
145
- scan-args: |-
146
- --format=sarif
147
- --output=osv-scanner.sarif
148
- .
149
- - name: 上传 osv-scanner 结果
150
- uses: actions/upload-artifact@v7
151
- with:
152
- name: osv-scanner.sarif
153
- path: osv-scanner.sarif
154
- # 3) SBOM 生成(CycloneDX,随版本发布的供应链物料清单)
155
- - name: 生成 SBOM(CycloneDX)
156
- run: |
157
- npx --yes @cyclonedx/cyclonedx-npm --output-file sbom.cdx.json --omit dev
158
- echo "SBOM 已生成"
159
- - name: 上传 SBOM
160
- uses: actions/upload-artifact@v7
161
- with:
162
- name: sbom.cdx.json
163
- path: sbom.cdx.json
164
- - name: SBOM 冒烟(非空 + 合法 JSON)
165
- run: |
166
- node -e "const s=require('./sbom.cdx.json'); if(!s.components||s.components.length===0){process.exit(1)} console.log('SBOM 组件数:', s.components.length)"
167
-
168
- # ---------- 4. 容器镜像构建校验(稳定部署) ----------
169
- docker:
170
- name: Docker 镜像构建校验
171
- runs-on: ubuntu-latest
172
- steps:
173
- - uses: actions/checkout@v4
174
- - name: 构建镜像(不推送)
175
- run: docker build -t feihong-code:ci .
176
- - name: 冒烟:容器内企业命令可用
177
- run: |
178
- docker run --rm \
179
- -e FH_ENTERPRISE=true -e FH_TENANT=ci -e FH_USER=ci -e FH_ROLE=developer \
180
- feihong-code:ci whoami
181
- - name: 冒烟:Web 控制台可启动
182
- run: |
183
- docker run --rm -d --name fhcode-smoke -p 8099:8080 \
184
- -e FH_ENTERPRISE=true -e FH_WEB_TOKEN=ci-token -e FH_WEB_PORT=8080 \
185
- feihong-code:ci serve --port 8080
186
- sleep 3
187
- code=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ci-token" http://localhost:8099/api/health)
188
- docker rm -f fhcode-smoke
189
- if [ "$code" != "200" ]; then
190
- echo "::error::Web 控制台健康检查失败,HTTP=$code"
191
- exit 1
192
- fi
193
- echo "Web 控制台健康检查通过 (HTTP 200)"
1
+ # 飞虹 Code CI
2
+ # 晋江市飞虹智科技企业管理有限公司 · 飞扬企源研发中心 · 负责人:吴赐虹
3
+ #
4
+ # 全流程离线:不使用任何 API key / Secrets,PR 来自 fork 也能安全跑完。
5
+ name: CI
6
+
7
+ on:
8
+ push:
9
+ branches: [master, main]
10
+ pull_request:
11
+ workflow_dispatch:
12
+
13
+ env:
14
+ FH_OFFLINE: 'true'
15
+ FH_PROVIDERS: '[]'
16
+
17
+ jobs:
18
+ # ---------- 1. 构建与离线闭环冒烟(多 Node 版本矩阵) ----------
19
+ build:
20
+ name: 构建 · Node ${{ matrix.node }}
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ node: [22]
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: actions/setup-node@v4
29
+ with:
30
+ node-version: ${{ matrix.node }}
31
+ # Node 18 上 electron 41 的 postinstall 因 @electron/get 转 ESM 而 require() 失败;
32
+ # 构建/测试不需要 electron 二进制,故 Node 18 跳过安装脚本(CLI 为纯 TS 编译)。
33
+ - run: npm install ${{ matrix.node == 18 && '--ignore-scripts' || '' }}
34
+ - name: 版本号一致性(package.json 为单一权威源)
35
+ run: npm run check:version
36
+ - name: 类型检查
37
+ run: npm run typecheck
38
+ - name: 编译
39
+ run: npm run build
40
+ - name: 跨端一致性冒烟(桌面/移动/扩展)
41
+ run: npm run check:cross -- --runtime
42
+ # Node 18 跳过运行时 CLI 步骤:CLI 启动时即加载 playwright-core(硬要求 Node>=20),
43
+ # 故 Node 18 仅验证构建/类型检查/跨端契约(见 check:cross 的 F12 守卫),不实际运行 CLI。
44
+ - name: CLI 可用性
45
+ if: ${{ matrix.node != 18 }}
46
+ run: node dist/cli/index.js --version
47
+ - name: 离线端到端闭环
48
+ if: ${{ matrix.node != 18 }}
49
+ run: node dist/cli/index.js "离线冒烟:创建一个说明文件"
50
+ - name: 只读技能
51
+ if: ${{ matrix.node != 18 }}
52
+ run: |
53
+ node dist/cli/index.js /plan "实现登录并且添加支付"
54
+ node dist/cli/index.js /grill src
55
+
56
+ # ---------- 2. M4 企业能力(权限 / 审计 / 多租户 / 配额) ----------
57
+ enterprise:
58
+ name: 企业能力冒烟 (M4)
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+ - uses: actions/setup-node@v4
63
+ with:
64
+ node-version: 22
65
+ - run: npm install
66
+ - run: npm run build
67
+ - name: M4 断言套件(RBAC / 审计链 / 多租户 / 配额)
68
+ run: node scripts/verify-m4.mjs
69
+ - name: CLI 企业命令冒烟
70
+ env:
71
+ FH_HOME: ${{ runner.temp }}/fhhome
72
+ FH_TENANT: ci-tenant
73
+ FH_USER: ci-bot
74
+ FH_ROLE: developer
75
+ run: |
76
+ node dist/cli/index.js whoami
77
+ node dist/cli/index.js policy
78
+ node dist/cli/index.js "CI 离线任务"
79
+ node dist/cli/index.js audit --limit 10
80
+ node dist/cli/index.js audit verify
81
+ node dist/cli/index.js tenants
82
+ - name: 租户隔离断言(beta 不得看到 ci-tenant 的会话)
83
+ env:
84
+ FH_HOME: ${{ runner.temp }}/fhhome
85
+ FH_TENANT: beta-tenant
86
+ FH_ROLE: viewer
87
+ run: |
88
+ out=$(node dist/cli/index.js sessions)
89
+ echo "$out"
90
+ if echo "$out" | grep -q "CI 离线任务"; then
91
+ echo "::error::租户隔离失效:beta-tenant 读到了 ci-tenant 的会话"
92
+ exit 1
93
+ fi
94
+
95
+ # ---------- 3. 供应链与密钥安全 ----------
96
+ security:
97
+ name: 发布包安全检查
98
+ runs-on: ubuntu-latest
99
+ steps:
100
+ - uses: actions/checkout@v4
101
+ - uses: actions/setup-node@v4
102
+ with:
103
+ node-version: 22
104
+ - run: npm install
105
+ - run: npm run build
106
+ - name: 发布包不得包含密钥或源码
107
+ run: |
108
+ npm pack --dry-run 2>&1 | tee pack.txt
109
+ for bad in "\\.env([ /]|$)" "src/" ".workbuddy" "policy.json" "id_rsa"; do
110
+ if grep -qE "$bad" pack.txt; then
111
+ echo "::error::发布包中检出敏感条目: $bad"
112
+ exit 1
113
+ fi
114
+ done
115
+ echo "发布包白名单校验通过"
116
+ - name: 仓库内不得提交明文密钥
117
+ run: |
118
+ if git grep -nIE "sk-[A-Za-z0-9_-]{16,}" -- . ':!*.md' ':!scripts/verify-m4.mjs' ':!tests/unit/redact.test.ts' ':!scripts/data/voltagent_skills.json'; then
119
+ echo "::error::检出疑似明文 API Key"
120
+ exit 1
121
+ fi
122
+ - name: 合规宣称扫描(对外材料不得宣称已获第三方认证)
123
+ run: npm run check:compliance
124
+ echo "密钥扫描通过"
125
+ - run: npm audit --omit=dev --audit-level=high
126
+ continue-on-error: true
127
+
128
+ # ---------- 3b. 供应链安全:依赖漏洞 + SBOM(P0-2) ----------
129
+ supplychain:
130
+ name: 供应链安全 · 依赖扫描 + SBOM
131
+ runs-on: ubuntu-latest
132
+ steps:
133
+ - uses: actions/checkout@v4
134
+ - uses: actions/setup-node@v4
135
+ with:
136
+ node-version: 22
137
+ - run: npm install
138
+ # 1) npm audit:生产依赖 high 及以上漏洞视为失败(供应链准入证据)
139
+ - name: npm audit(生产依赖 high+)
140
+ run: npm audit --omit=dev --audit-level=high
141
+ # 2) osv-scanner:OSV 数据库全量扫描 lockfile
142
+ - name: osv-scanner(OSV 全量漏洞库)
143
+ uses: google/osv-scanner/actions/scanner@v2
144
+ with:
145
+ scan-args: |-
146
+ --format=sarif
147
+ --output=osv-scanner.sarif
148
+ .
149
+ - name: 上传 osv-scanner 结果
150
+ uses: actions/upload-artifact@v7
151
+ with:
152
+ name: osv-scanner.sarif
153
+ path: osv-scanner.sarif
154
+ # 3) SBOM 生成(CycloneDX,随版本发布的供应链物料清单)
155
+ - name: 生成 SBOM(CycloneDX)
156
+ run: |
157
+ npx --yes @cyclonedx/cyclonedx-npm --output-file sbom.cdx.json --omit dev
158
+ echo "SBOM 已生成"
159
+ - name: 上传 SBOM
160
+ uses: actions/upload-artifact@v7
161
+ with:
162
+ name: sbom.cdx.json
163
+ path: sbom.cdx.json
164
+ - name: SBOM 冒烟(非空 + 合法 JSON)
165
+ run: |
166
+ node -e "const s=require('./sbom.cdx.json'); if(!s.components||s.components.length===0){process.exit(1)} console.log('SBOM 组件数:', s.components.length)"
167
+
168
+ # ---------- 4. 容器镜像构建校验(稳定部署) ----------
169
+ docker:
170
+ name: Docker 镜像构建校验
171
+ runs-on: ubuntu-latest
172
+ steps:
173
+ - uses: actions/checkout@v4
174
+ - name: 构建镜像(不推送)
175
+ run: docker build -t feihong-code:ci .
176
+ - name: 冒烟:容器内企业命令可用
177
+ run: |
178
+ docker run --rm \
179
+ -e FH_ENTERPRISE=true -e FH_TENANT=ci -e FH_USER=ci -e FH_ROLE=developer \
180
+ feihong-code:ci whoami
181
+ - name: 冒烟:Web 控制台可启动
182
+ run: |
183
+ docker run --rm -d --name fhcode-smoke -p 8099:8080 \
184
+ -e FH_ENTERPRISE=true -e FH_WEB_TOKEN=ci-token -e FH_WEB_PORT=8080 \
185
+ feihong-code:ci serve --port 8080
186
+ sleep 3
187
+ code=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: Bearer ci-token" http://localhost:8099/api/health)
188
+ docker rm -f fhcode-smoke
189
+ if [ "$code" != "200" ]; then
190
+ echo "::error::Web 控制台健康检查失败,HTTP=$code"
191
+ exit 1
192
+ fi
193
+ echo "Web 控制台健康检查通过 (HTTP 200)"