Skip to content

Commit 4fe97bd

Browse files
ascorbicclaude
andauthored
docs: improve template setup instructions with automated secret configuration (#72)
* docs: improve template setup instructions with automated secret configuration - Add instructions for setting GitHub secrets using 1Password CLI - Document process for setting APP_ID and APP_PRIVATE_KEY from Mixiebot GitHub entry - Clarify that CLAUDE_CODE_OAUTH_TOKEN requires user to run /install-github-app command - Add detailed steps for npm Trusted Publishing OIDC setup - Improve formatting and clarity of setup checklist 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Update instructions --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c2a079c commit 4fe97bd

File tree

3 files changed

+90
-9
lines changed

3 files changed

+90
-9
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

CLAUDE.md

Lines changed: 89 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# CLAUDE.md
2-
3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
1+
This file provides guidance to agentic coding tools when working with code in this repository.
42

53
## ⚠️ Template Setup Required
64

7-
**This is currently a template repository.** If you see this message, you need to set up a new project by updating the following:
5+
**This is currently a template repository.** If you see this message, check if this is a new repo based on the template, by seeing if the git remote is ascorbic/library-template. If not, you need to set up a new project by updating the following:
86

97
1. **Package names**: Update `@ascorbic/example` in all `package.json` files to your new package name
108
2. **Repository URLs**: Update git repository URLs in `package.json` files. Check the current git remote for this.
@@ -15,11 +13,93 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1513
7. **Changeset configuration** in `.changeset/config.json`:
1614
- Update `repo` field from `ascorbic/library-template` to your actual repository (e.g., `yourname/yourrepo`)
1715
- Review the `ignore` array and remove/update package names as needed for your project
18-
8. **GitHub Secrets**: Set up required secrets in GitHub repository settings:
19-
- `APP_PRIVATE_KEY` - GitHub App private key for release workflow
20-
- `APP_ID` - GitHub App ID for release workflow
21-
- `CLAUDE_CODE_OAUTH_TOKEN` - Claude Code OAuth token for PR assistant
22-
9. **npm Trusted Publishing**: Configure trusted publishing on npmjs.com for your packages to enable OIDC authentication (no NPM_TOKEN needed)
16+
8. **Release workflow**: Activate the release workflow by renaming it:
17+
```bash
18+
mv .github/workflows/release.yml.template .github/workflows/release.yml
19+
```
20+
10. **GitHub Secrets**: Set up required secrets using 1Password CLI and GitHub CLI:
21+
22+
```bash
23+
# Authenticate to 1Password (use my.1password.com account)
24+
eval $(op signin --account my.1password.com)
25+
26+
# Set GitHub App secrets from "Mixiebot GitHub" entry
27+
op item get "Mixiebot GitHub" --account my.1password.com --fields "app id" | gh secret set APP_ID
28+
op item get "Mixiebot GitHub" --account my.1password.com --fields "private key" | gh secret set APP_PRIVATE_KEY
29+
```
30+
31+
For `CLAUDE_CODE_OAUTH_TOKEN`: Tell the user to open Claude Code and run the `/install-github-app` command, which will guide them through setting up the GitHub app and automatically add the secret to their repository. Note: The user must be a repository admin to install the GitHub app and add secrets.
32+
33+
11. **npm Trusted Publishing**: The user must manually configure trusted publishing on npmjs.com for their packages to enable OIDC authentication (no NPM_TOKEN needed). Tell them to:
34+
1. Publish a 0.0.0 version of the package locally (one-time setup)
35+
2. Navigate to the package page on npmjs.com
36+
3. Click on "Settings"
37+
4. Follow the GitHub authentication flow
38+
5. Enter the repository name and `release.yml` as the workflow name
39+
40+
12. **Repository Settings and Branch Protection**: Configure repository settings and branch protection rules using the GitHub CLI. Get the current repository name first:
41+
42+
```bash
43+
# Get repository name (format: owner/repo)
44+
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
45+
46+
# Configure repository settings
47+
gh api repos/$REPO --method PATCH \
48+
-f allow_squash_merge=true \
49+
-f allow_merge_commit=false \
50+
-f allow_rebase_merge=false \
51+
-f delete_branch_on_merge=true \
52+
-f allow_auto_merge=true \
53+
-f allow_update_branch=true \
54+
-f squash_merge_commit_message=COMMIT_MESSAGES \
55+
-f squash_merge_commit_title=COMMIT_OR_PR_TITLE \
56+
-f has_wiki=false
57+
58+
# Create branch protection ruleset for main branch
59+
gh api repos/$REPO/rulesets --method POST --input - <<'EOF'
60+
{
61+
"name": "main",
62+
"target": "branch",
63+
"enforcement": "active",
64+
"conditions": {
65+
"ref_name": {
66+
"include": ["~DEFAULT_BRANCH"],
67+
"exclude": []
68+
}
69+
},
70+
"rules": [
71+
{"type": "deletion"},
72+
{"type": "non_fast_forward"},
73+
{"type": "required_linear_history"},
74+
{
75+
"type": "pull_request",
76+
"parameters": {
77+
"required_approving_review_count": 0,
78+
"dismiss_stale_reviews_on_push": false,
79+
"require_code_owner_review": false,
80+
"require_last_push_approval": false,
81+
"required_review_thread_resolution": false,
82+
"allowed_merge_methods": ["merge", "squash", "rebase"]
83+
}
84+
},
85+
{
86+
"type": "required_status_checks",
87+
"parameters": {
88+
"strict_required_status_checks_policy": true,
89+
"do_not_enforce_on_create": true,
90+
"required_status_checks": [
91+
{"context": "test"},
92+
{"context": "Validate PR title"}
93+
]
94+
}
95+
}
96+
],
97+
"bypass_actors": [
98+
{"actor_type": "RepositoryRole", "actor_id": 5, "bypass_mode": "always"}
99+
]
100+
}
101+
EOF
102+
```
23103
24104
After setup, remove this section from CLAUDE.md.
25105

0 commit comments

Comments
 (0)