准备代码库对外开源发布
评估发布前置审批、历史与敏感信息清理、公开构建和仓库文件,形成分工明确的发布步骤。
完整提示词
<context>
Flipping a repository from private to public is permanent: forks and caches keep whatever was visible for even an hour. The expensive mistakes are secrets and customer data somewhere in the history, internal hostnames and staff names in comments and tests, vendored code whose licence does not allow redistribution, patents or contracts that restrict release, and a build that only works on the company network. Many organisations publish a fresh repository with squashed history because cleaning years of history is error-prone; others keep the history for its value and rewrite it with care. Approval matters too: in most employment and contract situations the employer, client or institution owns the code, so the people with authority must sign off before anything is published.
</context>
<task>
Prepare this code for public release.
<codebase>
{{codebase}}
</codebase>
{{#organisation}}
<organisation>
{{organisation}}
</organisation>
{{/organisation}}
1. Go or no-go questions: who owns the code and who must approve (legal, security, product, the team), whether any contract, grant, patent or partner agreement restricts release, whether it contains another party's confidential code, and whether the team will maintain it. Any "no" or "unknown" here stops the release until resolved.
2. Clearance checklist grouped by area: legal and ownership, licence choice and file headers, third-party code and dependency licences, export or regulatory concerns flagged for legal (not decided here), security review, brand and naming.
3. History decision: keep the full history after a scan and rewrite, or publish a fresh repository with a single initial commit. Recommend one for this codebase with reasons, and list what is lost either way.
4. Scrub list: secrets (scan the full history, and rotate anything found even after removal), credentials in CI config, customer or personal data in fixtures and tests, internal hostnames, IPs and URLs, staff names and emails in comments, issue tracker links, profanity or comments about customers, and large binaries.
5. Build and test in public: replace private registries, internal base images and internal APIs; make tests pass on a clean machine; set up public CI; confirm a newcomer can build from the README alone.
6. Repository files: LICENSE, README, CONTRIBUTING, CODE_OF_CONDUCT, SECURITY policy, issue templates, and a statement of maintenance level.
7. Order of work with owners, ending with a final review of the exact public tree by someone who did not do the cleaning, and a rehearsal by pushing to a private copy first.
</task>
<constraints>
- Do not decide legal ownership, export control or patent questions; list them for the organisation's legal owner.
- Never suggest deleting a secret from history as enough; it must be rotated.
- Do not invent the organisation's policies or approvers; use roles.
- If the user has not got authority to publish the code, say approval comes first and stop at the checklist.
</constraints>
<output_format>
## Go or no-go questions
Numbered questions with who answers each.
## Clearance checklist
Checklist grouped by area.
## History decision
Recommendation and trade-offs.
## Scrub list
Table: What | Where to look | How to fix.
## Build and test in public
Checklist.
## Repository files
Checklist.
## Order of work
Numbered steps with owner role.
</output_format>可替换内容
- {{codebase}}
- {{#organisation}}
- {{organisation}}
- {{/organisation}}
分类与标签
编程开发、开源发布、代码审查、仓库准备