Skip to content
Open
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
25 changes: 1 addition & 24 deletions .codependencerc
Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
{
"codependencies": [
"@changesets/cli",
"@commitlint/cli",
"@commitlint/config-lerna-scopes",
"@commitlint/prompt",
"@types/node",
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"@vitest/coverage-c8",
"c8",
"changesets",
"codependence",
"commitizen",
"conventional-changelog-cli",
"cross-env",
"eslint",
"eslint-config-prettier",
"husky",
"lint-staged",
"path-exists-cli",
"prettier",
"rimraf",
"tslib",
"tsutils",
"turbo",
"typescript",
"vitest"
"typescript"
]
}
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Anthropic API Key for generating weekly challenges
# Get your key from: https://console.anthropic.com/
ANTHROPIC_API_KEY=your_api_key_here

# Turbo Remote Caching (optional, speeds up CI/CD)
# Get your token from: https://vercel.com/account/tokens
TURBO_TOKEN=your_turbo_token_here
TURBO_TEAM=your_team_slug_here

GITHUB_TOKEN=
PR_CREATE_TOKEN=
119 changes: 119 additions & 0 deletions .github/workflows/biweekly-challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Biweekly Data Structure Challenge

on:
schedule:
# Every other Monday at 9:00 AM UTC (1:00 AM PST) - runs on the 1st and 15th day of month
- cron: '0 9 1,15 * *'
workflow_dispatch: # Allow manual trigger

jobs:
generate-challenge:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Generate new data structure challenge
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: bun run scripts/generateNewDataStructure.ts

- name: Get challenge info
id: challenge-info
run: |
# Get the newest challenge detail file
CHALLENGE_FILE=$(ls -t challenge-*.json | head -1)

# Extract info from the challenge file
NAME=$(jq -r '.name' $CHALLENGE_FILE)
TITLE=$(jq -r '.title' $CHALLENGE_FILE)
DIFFICULTY=$(jq -r '.difficulty' $CHALLENGE_FILE)

echo "name=$NAME" >> $GITHUB_OUTPUT
echo "title=$TITLE" >> $GITHUB_OUTPUT
echo "difficulty=$DIFFICULTY" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
feat(${{ steps.challenge-info.outputs.name }}): add ${{ steps.challenge-info.outputs.title }} challenge

- Difficulty: ${{ steps.challenge-info.outputs.difficulty }}
- Challenge details provided
- Ready for implementation

Generated with Claude AI
branch: challenge/${{ steps.challenge-info.outputs.name }}
delete-branch: true
title: "Biweekly Challenge: ${{ steps.challenge-info.outputs.title }}"
body: |
## New Biweekly Data Structure Challenge

**Data Structure:** ${{ steps.challenge-info.outputs.title }}
**Difficulty:** ${{ steps.challenge-info.outputs.difficulty }}
**Challenge Details:** `challenge-${{ steps.challenge-info.outputs.name }}.json`

### What's Included

- Challenge specification with operations and complexity analysis
- TypeScript interface and factory function templates
- Hints and use cases
- Added to challenges.json tracker

### Getting Started

```bash
# 1. Create the package and demo app
bun run create ${{ steps.challenge-info.outputs.name }}

# 2. Review the challenge details
cat challenge-${{ steps.challenge-info.outputs.name }}.json

# 3. Implement the data structure
cd packages/${{ steps.challenge-info.outputs.name }}
# Edit src/index.ts with the implementation

# 4. Create the visualization
cd ../../apps/${{ steps.challenge-info.outputs.name }}-demo
bun run dev
# Edit src/main.ts to visualize the data structure

# 5. Run tests
cd ../..
bun test
```

### Implementation Checklist

- [ ] Create package with `bun run create ${{ steps.challenge-info.outputs.name }}`
- [ ] Implement data structure in `packages/${{ steps.challenge-info.outputs.name }}/src/index.ts`
- [ ] Write tests in `packages/${{ steps.challenge-info.outputs.name }}/tests/`
- [ ] Create interactive demo in `apps/${{ steps.challenge-info.outputs.name }}-demo/`
- [ ] Add visualization with Tailwind CSS
- [ ] All tests passing
- [ ] Update challenges.json `completed: true`
- [ ] Ready for code review

---

*This challenge was generated by Claude AI using the biweekly automation.*

Have fun building!
labels: |
data-structure
biweekly-challenge
auto-generated
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,16 @@ coverage

**/dist/*
.turbo
.vscode

# Generated challenge detail files (committed in PRs)
challenge-*.json

# Python
__pycache__/
*.py[cod]
*$py.class
.pytest_cache/
.venv/
venv/
*.egg-info/
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/post-merge

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

73 changes: 73 additions & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
[tools]
bun = "1.3.1"
python = "3.14"
go = "1.25"

[settings]
legacy_version_file = true

[tasks.install]
description = "Install all dependencies"
run = [
"bun install",
"pip install pytest"
]

[tasks.test]
description = "Run all tests with Turbo caching"
run = "turbo run test"

[tasks."test:ts"]
description = "Run TypeScript tests"
run = "turbo run test:ts"

[tasks."test:go"]
description = "Run Go tests"
run = "turbo run test:go"

[tasks."test:python"]
description = "Run Python tests"
run = "turbo run test:python"

[tasks.format]
description = "Format code with Prettier"
run = "bun run format"

[tasks.clean]
description = "Remove build artifacts and caches"
run = [
"rm -rf structures/*/dist",
"rm -rf structures/*/.turbo",
"rm -rf .turbo",
"find structures -name '__pycache__' -exec rm -rf {} +",
"find structures -name '.pytest_cache' -exec rm -rf {} +"
]

[tasks.setup]
description = "First-time project setup"
run = [
"bun install",
"pip install pytest",
"./scripts/setup-hooks.sh"
]

[tasks.check]
description = "Verify all tools and dependencies are working"
run = [
"bun --version",
"go version",
"python --version",
"pytest --version",
"turbo --version"
]

[tasks."generate-challenge"]
description = "Generate a new data structure challenge"
run = "bun run generate-challenge"

[tasks."update-readme"]
description = "Update README with implementation status"
run = "bun run scripts/updateReadme.ts"

[env]
_.python.venv = { path = ".venv", create = true }
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

42 changes: 42 additions & 0 deletions apps/stack-demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Stack Data Structure Demo</title>
</head>
<body class="bg-slate-900 text-slate-100 min-h-screen p-8">
<div class="max-w-4xl mx-auto">
<header class="text-center mb-8">
<h1 class="text-6xl font-bold mb-2 bg-gradient-to-r from-indigo-500 to-cyan-500 bg-clip-text text-transparent">
Stack
</h1>
<p class="text-slate-400 text-lg">Last In, First Out (LIFO)</p>
</header>

<div class="bg-slate-800 p-6 rounded-xl mb-8">
<div id="controls" class="flex gap-4 flex-wrap"></div>
</div>

<div class="bg-slate-800 px-6 py-4 rounded-xl mb-8 flex justify-center gap-8">
<div class="flex gap-2 items-center">
<span class="text-slate-400 font-medium">Length:</span>
<span id="lengthDisplay" class="text-2xl font-bold text-cyan-400">0</span>
</div>
</div>

<div class="bg-slate-800 p-8 rounded-xl mb-8 min-h-[300px]">
<div id="stackContainer" class="flex flex-col gap-2 items-center">
<div class="text-slate-400 italic py-12 text-center">Stack is empty</div>
</div>
</div>

<div class="bg-slate-800 p-6 rounded-xl">
<h3 class="mb-4 text-slate-400 text-sm uppercase tracking-wider">Operations Log</h3>
<div id="logContainer" class="max-h-[200px] overflow-y-auto"></div>
</div>
</div>

<script type="module" src="/src/main.ts"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions apps/stack-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@datastructures/stack-demo",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tsc": "tsc --noEmit"
},
"dependencies": {
"@datastructures/stack": "workspace:*",
"@datastructures/components": "workspace:*"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.17",
"typescript": "^5.7.2",
"vite": "^6.0.5"
}
}
6 changes: 6 additions & 0 deletions apps/stack-demo/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Loading