Files
cindy/scripts/check-pr-template-rules.mjs
Lizi bb3f71d084 chore: Cindy 首次开源提交 / initial open-source release
Cindy 是心动网络 (X.D. Network Inc.) 的跨端 AI Agent 客户端。
本次提交包含 Desktop(Electron)、Mobile(Expo)及全部共享 packages
的完整源码,以 Apache-2.0 协议开源。

This is the first public release of Cindy, X.D. Network's cross-platform
AI agent client: the Electron desktop app, the Expo mobile app, and all
shared workspace packages, licensed under Apache-2.0.

- 许可与合规:根 LICENSE(Apache-2.0)+ NOTICE;第三方组件归属声明与
  SPDX SBOM 收口在 docs/legal/notices/,由 pnpm licenses:generate 生成。
- 社区文件:README / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY / SUPPORT
  中英双语;issue / PR 模板与 CI workflow 在 .github/。
- 协议层以公开 submodule 引入:github.com/makecindy/cindy-protocol。
- 提交前已通过仓库门禁:全量 pnpm test:unit 与涉及 package 的 typecheck。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 08:30:44 +08:00

41 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
// 校验公开 PR 模板的顶层结构。内部 review-pr Skill 有自己的私有配置,
// 本脚本不读取维护者名单、通知设置或其他内部自动化数据。
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
const ROOT = join(SCRIPT_DIR, '..');
const read = (path) => readFileSync(path, 'utf8');
const template = read(join(ROOT, '.github', 'PULL_REQUEST_TEMPLATE.md'));
const requiredSections = ['这次改了什么', '怎么验证的', '风险'];
const errors = [];
/**
* 公开贡献契约固定为三个二级标题。内部 Skill 会按目标仓库模板和自己的配置做
* 更细的格式判定,但公开 CI 不依赖私有 Skill。
*/
const actualSections = [...template.matchAll(/^##\s+(.+)$/gm)].map((match) => match[1].trim());
for (const section of requiredSections) {
if (!actualSections.includes(section)) {
errors.push(`缺少二级标题「${section}」`);
}
}
for (const section of actualSections) {
if (!requiredSections.includes(section)) {
errors.push(`存在未声明的二级标题「${section}」`);
}
}
if (errors.length > 0) {
console.error('PR 模板结构不符合公开贡献契约:');
for (const error of errors) console.error(`- ${error}`);
process.exit(1);
}
console.log('PR 模板结构符合公开贡献契约');