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
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
**/node_modules
**/.next
**/.open-next
**/.wrangler
**/.data
**/test-results
**/playwright-report
**/*.tsbuildinfo
**/* [0-9]*
.git
.env*
!.env.example
**/.dev.vars*
apps/mac
CLAUDE.local.md
.claude
.agents
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,15 @@ GITWORK_SCHEDULER=
# Free plan, which allows 50 subrequests per invocation.
RECONCILE_MAX_TARGETS=
RECONCILE_MAX_PAGES=

# ---- Docker and other self-hosted Node servers (docs/self-host/) ----------------------------
# The Docker image sets these three itself; set them only on a plain Node host.
# DATABASE_URL=file:/data/gitwork.sqlite
# GITWORK_MIGRATIONS_DIR=/app/migrations # apply pending migrations at start
# GITWORK_FAIL_ON_CONFIG_ERROR=1 # refuse to start on a configuration error
# docker-compose.yml: image tag, host port, and the domain for the optional Caddy profile.
GITWORK_TAG=latest
GITWORK_PORT=3000
GITWORK_DOMAIN=
# Tests only: write emails to a file instead of sending them (EMAIL_TRANSPORT=outbox).
EMAIL_OUTBOX_PATH=
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Bug
description: Something does not work as documented.
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened, and what did you expect?
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: "1. …\n2. …"
validations:
required: true
- type: input
id: version
attributes:
label: Version
description: From /setup/health, or the Docker tag.
validations:
required: true
- type: dropdown
id: host
attributes:
label: Host
options: [Docker, Cloudflare Workers, Other Node host, Local development]
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: Remove secrets, emails, and tokens first.
render: text
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security vulnerability
url: https://github.com/FlywheelStudio/gitwork/security/advisories/new
about: Report it privately, not as an issue.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Feature request
description: Suggest a change or a new feature.
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What problem does this solve?
validations:
required: true
- type: textarea
id: proposal
attributes:
label: What do you propose?
- type: textarea
id: github
attributes:
label: Where does the data live in GitHub?
description: GitHub is the source of truth. Name the GitHub field, label, or file, if you know it.
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## What and why

## How I tested it

## Checklist
- [ ] Every commit is signed off (`git commit -s`)
- [ ] `pnpm lint && pnpm typecheck && pnpm test` pass
- [ ] Tests cover the change (API routes: success, 401, 403, 400; DB code on both drivers)
- [ ] Docs updated (decision record if needed, `docs/INDEX.md`)
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@ jobs:
- run: pnpm test:e2e
# Builds and serves both runtimes; fails if libsql reaches the Worker bundle.
- run: pnpm smoke

# The Phase 7 exit check, minus GitHub: build the Docker image, start it on an empty volume, and
# sign in as the instance admin.
docker:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- run: docker build -t gitwork:ci .
- name: Start a fresh instance
run: |
mkdir -p /tmp/gw && chmod 777 /tmp/gw
docker run -d --name gw -p 3000:3000 -v /tmp/gw:/data \
-e BETTER_AUTH_SECRET="$(openssl rand -base64 32)" -e BETTER_AUTH_URL=http://localhost:3000 \
-e INSTANCE_ADMIN_EMAILS=admin@example.com -e EMAIL_TRANSPORT=outbox -e EMAIL_OUTBOX_PATH=/data/outbox.jsonl \
gitwork:ci
- run: ./scripts/selfhost-check.sh http://localhost:3000 /tmp/gw/outbox.jsonl admin@example.com
- name: Online backup
run: docker exec gw node backup.mjs /data/backup.sqlite && test -s /tmp/gw/backup.sqlite
- name: Refuses to start without configuration
run: |
if docker run --rm gitwork:ci; then echo "FAIL: started without configuration"; exit 1; fi
- if: always()
run: docker logs gw || true
13 changes: 13 additions & 0 deletions .github/workflows/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: DCO

# Contributions are accepted under the Developer Certificate of Origin (decision 024).
on: pull_request

jobs:
signoff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: ./scripts/check-dco.sh "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}"
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

# Push a tag like v0.1.0 to publish ghcr.io/flywheelstudio/gitwork:<version> and :latest
# (linux/amd64 and linux/arm64) and a GitHub Release with generated notes.
on:
push:
tags: ["v*.*.*"]

permissions:
contents: write
packages: write

jobs:
image:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: GITWORK_VERSION=${{ github.ref_name }}
- run: gh release create "$GITHUB_REF_NAME" --generate-notes --verify-tag
env:
GH_TOKEN: ${{ github.token }}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and versions follow [Semantic Versioning](https://semver.org/). Before 1.0.0, a minor version may
break things; the notes say how to upgrade.

## Unreleased

### Added
- Self-hosting: Docker image (`ghcr.io/flywheelstudio/gitwork`), `docker-compose.yml` with an
optional Caddy TLS profile, migrations on start, a configuration check that stops a bad deploy at
boot, an online backup script, and a self-host guide.
- `/setup/health` for instance admins: configuration, GitHub App, last webhook, last reconcile.
- `pnpm deploy:cf`: build, migrate D1, and deploy to Cloudflare Workers.
- Tasks on web: list, kanban, and timeline views of a GitHub Projects v2 board; task edits.
- Identity: email-code sign-in, accounts, workspaces, four roles, invites, GitHub account link.
- GitHub App: setup wizard, webhooks, cache, 15-minute reconcile.
10 changes: 10 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Code of conduct

Gitwork adopts the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).

In short: be respectful, assume good intent, and criticize ideas, not people. Harassment is not
tolerated in issues, pull requests, or any other project space.

Report a problem privately to the maintainers through GitHub's **Report content** feature or a
private security report (see SECURITY.md). Maintainers review every report and keep the reporter's
identity private.
50 changes: 50 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Contributing to Gitwork

Thank you for helping. This file covers how to set up, what a pull request needs, and the rules that
keep Gitwork safe.

## Set up

```bash
corepack enable
pnpm install
pnpm dev
```

`CLAUDE.md` lists every command and the codebase map. `docs/INDEX.md` lists every design decision.

## Sign off every commit (DCO)

Gitwork accepts contributions under the [Developer Certificate of Origin](https://developercertificate.org/)
(decision 024). Sign off each commit to certify that you wrote it or may submit it under the
project's license:

```bash
git commit -s -m "fix: …"
```

This adds `Signed-off-by: Your Name <you@example.com>`, matching the commit author. A CI check
fails a pull request with an unsigned commit. To fix one: `git rebase --signoff origin/main`, then
push.

## A pull request needs

- `pnpm lint && pnpm typecheck && pnpm test` passing. CI also runs `pnpm test:e2e`, `pnpm smoke`,
and a Docker self-host check.
- Tests for the change. API routes: success, 401, 403, 400. Database code runs on both drivers
(`describe.each(await allTestDrivers())`).
- Docs in the same pull request: a decision record in `docs/decisions/` for a decision of lasting
consequence, and `docs/INDEX.md` updated.
- Commit messages as `<type>: <what and why>` (feat, fix, docs, test, refactor, chore).

## Rules that must not break

- Every read and write goes through the permission and visibility checks in `packages/core`.
- Read Only users never receive a hidden item, by any path.
- Every write adds an `audit_log` row in the same batch.
- The markdown editors leave untouched lines byte-identical.
- Never call real GitHub from tests. Use `packages/server/test/fake-github.ts`.

## Licensing

By contributing, you license your work under [AGPL-3.0-only](LICENSE).
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# syntax=docker/dockerfile:1
# Gitwork on any Node host: Next.js standalone server + a SQLite file on the /data volume.
# Build: docker build -t gitwork .
# Run: docker compose up -d (see docker-compose.yml and docs/self-host/)

FROM node:22-slim AS build
WORKDIR /src
ENV NEXT_TELEMETRY_DISABLED=1 GITWORK_STANDALONE=1 COREPACK_ENABLE_DOWNLOAD_PROMPT=0
RUN corepack enable
COPY . .
RUN pnpm install --frozen-lockfile
RUN pnpm --filter @gitwork/web build

FROM node:22-slim
ARG GITWORK_VERSION=dev
LABEL org.opencontainers.image.source="https://github.com/FlywheelStudio/gitwork" \
org.opencontainers.image.licenses="AGPL-3.0-only" \
org.opencontainers.image.version="${GITWORK_VERSION}"
WORKDIR /app
ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0 \
GITWORK_VERSION=${GITWORK_VERSION} \
DATABASE_URL=file:/data/gitwork.sqlite \
GITWORK_MIGRATIONS_DIR=/app/migrations \
GITWORK_FAIL_ON_CONFIG_ERROR=1
COPY --from=build --chown=node:node /src/apps/web/.next/standalone ./
COPY --from=build --chown=node:node /src/apps/web/.next/static ./apps/web/.next/static
COPY --from=build --chown=node:node /src/apps/web/public ./apps/web/public
COPY --from=build --chown=node:node /src/packages/db/migrations ./migrations
COPY --from=build --chown=node:node /src/scripts/backup.mjs ./backup.mjs
RUN mkdir -p /data && chown node:node /data
USER node
VOLUME /data
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \
CMD node -e "fetch('http://127.0.0.1:3000/api/v1/health').then(r=>process.exit(r.ok?0:1),()=>process.exit(1))"
CMD ["node", "apps/web/server.js"]
51 changes: 35 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,61 @@
# Gitwork

Project management on top of GitHub. GitHub stays the source of truth for tasks and docs; Gitwork
gives your clients and stakeholders a fast, permissioned view of it — list, kanban, and timeline
views of a GitHub Projects v2 board, plus editable markdown from each repo's `docs/` folder.
Project management on top of GitHub. GitHub stays the source of truth for tasks and docs. Gitwork
gives your team, clients, and stakeholders a fast, permissioned view of it: list, kanban, and
timeline views of a GitHub Projects v2 board, with edits that go back to GitHub.

> **Status:** early development (Phase 0 of 7). Not usable yet. See [docs/STATE.md](docs/STATE.md).
People without a GitHub account can take part. Four roles (Owner, Admin, Member, Read Only) decide
what each person sees and changes. Read Only users never receive hidden items.

## Run it locally
> **Status: pre-release.** Tasks work end to end against a simulated GitHub. Docs editing, the
> activity inbox, and the Mac app are still in progress. See [docs/STATE.md](docs/STATE.md) and the
> [roadmap](docs/roadmap.md).

Requires Node 22+ and corepack (ships with Node 22–24).
## Self-host

Gitwork is open source under the [AGPL-3.0](LICENSE). Run it on any Docker host or on Cloudflare
Workers.

```bash
git clone https://github.com/FlywheelStudio/gitwork && cd gitwork
cp .env.example .env # fill in the URL, secret, admin email, and SMTP
docker compose up -d
```

The full guide, with Cloudflare, backups, and upgrades: [docs/self-host/](docs/self-host/README.md).

## Develop

Requires Node 22+ and corepack.

```bash
corepack enable # provides the pinned pnpm
corepack enable
pnpm install
pnpm dev # Node + SQLite file at apps/web/.data/ → http://localhost:3000
pnpm preview # Cloudflare Workers (workerd) + local D1 → http://localhost:8787
```

## Checks
Checks, as CI runs them:

```bash
pnpm lint && pnpm typecheck
pnpm test # unit tests; the DB suite runs on both libsql and D1
pnpm test # unit and integration; the DB suite runs on both libsql and D1
pnpm test:e2e # Playwright against the Node runtime
pnpm smoke # builds and serves both runtimes end to end
```

## Self-hosting

Gitwork runs on Cloudflare Workers (D1) or any Node host (SQLite file). Deploy guides arrive in
Phase 7. For Cloudflare today: `wrangler d1 create gitwork`, put the ID in
`apps/web/wrangler.jsonc`, then `wrangler d1 migrations apply DB --remote` and
`pnpm --filter @gitwork/web exec opennextjs-cloudflare deploy`.
Read [CONTRIBUTING.md](CONTRIBUTING.md) before a pull request. Every commit needs a DCO sign-off
(`git commit -s`).

## Docs

Start at [docs/INDEX.md](docs/INDEX.md). The product spec is [docs/spec.md](docs/spec.md).

## Security

Report vulnerabilities privately. See [SECURITY.md](SECURITY.md).

## License

[AGPL-3.0](LICENSE).
[AGPL-3.0-only](LICENSE). If you run a modified Gitwork for other people, you must offer them your
source code.
Loading
Loading