Skip to content
Closed
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
126 changes: 126 additions & 0 deletions .github/README_UPDATE_RULE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# README Update Rule

## ⚠️ MANDATORY: Update README with Every Commit

Every commit MUST update the `README.md` file under the **"Commits Categorized by Strategic Pillars"** section.

---

## How to Update

### 1. Determine Which Pillar Your Change Belongs To:

#### **Pillar 1: Idea Stack (Infrastructure & Architecture)**
- Architecture changes
- Infrastructure setup
- CI/CD configuration
- Provider systems
- Build tools
- Package management
- Git hooks

#### **Pillar 2: TUI Features (User Interface & Experience)**
- UI/UX improvements
- TUI components
- Dialogs and modals
- Keyboard shortcuts
- Visual feedback
- User interactions
- Metrics display in UI

#### **Pillar 3: SDK Level Features (Core Functionality & API)**
- Core functionality
- API changes
- Authentication systems
- Retry logic
- SDK implementations
- Request/response handling
- Error handling

#### **Pillar 4: Experiment and Reporting (Metrics & Analytics)**
- Metrics collection
- Logging systems
- Experimentation tracking
- Analytics
- Reporting tools
- Usage statistics

---

### 2. Add Your Commit to the README

**Location:** Near the top of `README.md`, under "Commits Categorized by Strategic Pillars"

**Format:**
```markdown
- **[commit-hash]** - [Brief description] ([key details])
```

**Example:**
```markdown
- **a1b2c3d4e** - Add cache display to sidebar (93% hit rate visualization)
```

---

### 3. Placement Rules

- Add **new commits at the TOP** of their pillar section (most recent first)
- Keep entries concise (one line)
- Include commit hash (first 9 characters)
- Mention key metrics if applicable (lines changed, files added, etc.)

---

## Example Workflow

```bash
# 1. Make your changes
git add .

# 2. Commit with descriptive message
git commit -m "add cache display to sidebar"

# 3. Get your commit hash
git log -1 --format=%h

# 4. Update README.md under appropriate pillar
# Add line: - **abc123def** - Add cache display to sidebar (shows 93% cache hit rate)

# 5. Amend your commit to include README update
git add README.md
git commit --amend --no-edit

# 6. Push
git push
```

---

## Why This Matters

1. **Transparency:** Everyone can see what's been done at a glance
2. **Organization:** Changes are categorized by strategic focus
3. **History:** Complete record of all improvements
4. **Planning:** Easy to see which pillars need attention

---

## Enforcement

This rule is enforced by:
- Git pre-push hooks (warning if README not updated)
- Code review process
- Team accountability

**If you forget:** The pre-push hook will remind you to update the README before pushing.

---

## Questions?

Ask any collaborator:
- Kevin
- Isaac
- Daniel
- Arihant
88 changes: 88 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: npm-publish
run-name: "npm publish ${{ inputs.bump }}"

on:
workflow_dispatch:
inputs:
bump:
description: "Bump major, minor, or patch"
required: true
type: choice
options:
- major
- minor
- patch
version:
description: "Override version (optional)"
required: false
type: string

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ./.github/actions/setup-bun

- name: Setup npm auth
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

- name: Publish packages
run: |
export OPENCODE_BUMP="${{ inputs.bump }}"
export OPENCODE_VERSION="${{ inputs.version }}"
export OPENCODE_CHANNEL="latest"

# Get version
cd packages/script
VERSION=$(bun run -e 'import { Script } from "./src/index.ts"; console.log(Script.version)')
cd ../..
echo "Publishing version: $VERSION"

# Update all package.json files
find . -name "package.json" -not -path "*/node_modules/*" -not -path "*/dist/*" | while read file; do
bun -e "const pkg = await Bun.file('$file').json(); pkg.version = '$VERSION'; await Bun.write('$file', JSON.stringify(pkg, null, 2) + '\n')"
echo "Updated: $file"
done

bun install

# Publish SDK
echo "=== Publishing cerebras-sdk ==="
cd packages/sdk/js
./script/publish.ts
cd ../../..

# Publish Plugin
echo "=== Publishing cerebras-plugin ==="
cd packages/plugin
./script/publish.ts
cd ../..

# Publish CLI
echo "=== Publishing cerebras-code ==="
cd packages/opencode
./script/publish.ts
cd ../..

# Commit and tag
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit -m "release: v$VERSION" || echo "No changes to commit"
git tag "v$VERSION"
git push origin HEAD --tags --no-verify

# Create GitHub Release
gh release create "v$VERSION" --title "v$VERSION" --notes "Release v$VERSION"
env:
GH_TOKEN: ${{ github.token }}
17 changes: 17 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,21 @@ if [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then
echo "Error: Bun version $CURRENT_VERSION does not match expected version $EXPECTED_VERSION from package.json"
exit 1
fi

# Check if README.md was updated in this push
if git diff --name-only origin/$(git branch --show-current)..HEAD | grep -q "README.md"; then
echo "✓ README.md updated - good job!"
else
echo ""
echo "⚠️ WARNING: README.md was not updated!"
echo "Please add your commit to the appropriate pillar section in README.md"
echo "See .github/README_UPDATE_RULE.md for guidelines"
echo ""
read -p "Continue anyway? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi

bun typecheck
Loading
Loading