Skip to content
Merged
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
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches:
- main
- "autoloop/**"
pull_request:
branches:
- main

permissions:
contents: read

jobs:
test:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: bun install

- name: Type check
run: bun run typecheck

- name: Lint
run: bun run lint

- name: Test
run: bun test --coverage

build:
name: Build
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: bun install

- name: Build library
run: bun build ./src/index.ts --outdir ./dist --target browser --minify

- name: Upload dist artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
54 changes: 54 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy Playground to Pages

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
name: Build Playground
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: bun install

- name: Build library for browser
run: bun build ./src/index.ts --outdir ./playground/dist --target browser --minify

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: playground/

deploy:
name: Deploy to Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
*.tsbuildinfo
package-lock.json
*.tgz
7 changes: 2 additions & 5 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"servers": {
"github-agentic-workflows": {
"command": "gh",
"args": [
"aw",
"mcp-server"
]
"args": ["aw", "mcp-server"]
}
}
}
}
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"github.copilot.enable": {
"markdown": true
}
}
"github.copilot.enable": {
"markdown": true
}
}
65 changes: 65 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Agent Instructions (AGENTS.md)

This file provides project-specific conventions for AI coding agents working in this repository.

## Project Overview

**tsb** is a TypeScript port of [pandas](https://pandas.pydata.org/), built from first principles.
- Package name: `tsb` — all imports use `tsb`
- Runtime: Bun
- Language: TypeScript (strictest mode)

## Key Rules

1. **Never modify `README.md`** — it is read-only, the source of truth for project parameters.
2. **Never modify `.autoloop/programs/**`** or autoloop workflow files.
3. **Strict TypeScript only** — no `any`, no `as` casts, no `@ts-ignore`, no escape hatches.
4. **Zero core dependencies** — implement everything from scratch.
5. **100% test coverage** required — unit + property-based (fast-check) + fuzz where applicable.
6. **Every feature gets a playground page** in `playground/`.
7. **One feature per commit** — keep changes small and targeted.

## Project Structure

```
src/
index.ts — package entry point, re-exports all features
types.ts — shared type definitions
core/ — core data structures (Series, DataFrame, Index, Dtype)
io/ — I/O utilities (read_csv, read_json, etc.)
groupby/ — groupby and aggregation
reshape/ — pivot, melt, stack, unstack
merge/ — merge, join, concat
window/ — rolling, expanding, ewm
stats/ — statistical functions
tests/
setup.ts — global test setup (loaded via bunfig.toml)
*.test.ts — mirrors src/ structure
playground/
index.html — landing page
*.html — one page per feature
```

## Adding a New Feature

1. Create `src/{module}/{feature}.ts` with the implementation.
2. Export from `src/index.ts`.
3. Create `tests/{module}/{feature}.test.ts` with full coverage.
4. Create `playground/{feature}.html` with an interactive tutorial.
5. Update `playground/index.html` to mark the feature as complete.

## Running Locally

```bash
bun install # install devDependencies
bun test # run all tests
bun run lint # check linting
bun run typecheck # TypeScript strict check
```

## Autoloop Coordination

This project is built by [Autoloop](https://github.com/githubnext/autoloop), an iterative optimization agent.
- Long-running branch: `autoloop/build-tsb-pandas-typescript-migration`
- State file: `build-tsb-pandas-typescript-migration.md` on `memory/autoloop` branch
- Issue #1 is the program definition — do not modify it.
27 changes: 27 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
description: Coding preferences for Claude when working on tsb.
---

# Claude Code Configuration (CLAUDE.md)

## Behavior

- Always read `AGENTS.md` first for project conventions.
- Read `README.md` to understand the project requirements — treat it as read-only.
- Read the state file in `.autoloop/memory/` for current migration progress.

## Code Style

- TypeScript strict mode — no `any`, no `as`, no `@ts-ignore`
- Biome formatting (spaces, 100-col lines, double quotes, trailing commas)
- JSDoc for all exported symbols
- Unit tests with `bun:test` + property tests with `fast-check`

## Commands

```bash
bun install # install deps
bun test # run tests
bun run lint # Biome lint
bun run typecheck # tsc --noEmit
```
67 changes: 67 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": ["dist/**", "node_modules/**", "*.d.ts"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"all": true
},
"correctness": {
"all": true
},
"nursery": {
"all": true
},
"performance": {
"all": true,
"noBarrelFile": "off"
},
"security": {
"all": true
},
"style": {
"all": true,
"noDefaultExport": "off",
"useNamingConvention": "off"
},
"suspicious": {
"all": true
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "all",
"semicolons": "always"
}
},
"overrides": [
{
"include": ["**/*.ts", "**/*.tsx"],
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "all",
"semicolons": "always"
}
}
}
]
}
6 changes: 6 additions & 0 deletions bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[test]
preload = ["./tests/setup.ts"]
coverage = true

[install]
exact = true
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "tsb",
"version": "0.0.1",
"description": "A TypeScript port of pandas, built from first principles",
"type": "module",
"main": "./src/index.ts",
"module": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
".": {
"import": "./src/index.ts",
"types": "./src/index.ts"
}
},
"scripts": {
"test": "bun test",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"typecheck": "tsc --noEmit",
"build": "bun build ./src/index.ts --outdir ./dist --target browser",
"playground": "bun run playground/serve.ts"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"fast-check": "^3.22.0",
"@types/bun": "^1.1.14"
},
"peerDependencies": {
"typescript": "^5.7.0"
}
}
Loading
Loading