Skip to content

Commit dfed76f

Browse files
authored
Merge pull request #2 from flyingrobots/git-stunts
Git Stunts Prep
2 parents eeddded + 9b192c0 commit dfed76f

669 files changed

Lines changed: 9325 additions & 254277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.git
3+
test-repo
4+
playwright-report
5+
test-results

.github/workflows/ci.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,39 @@ on:
77
branches: [ main ]
88

99
jobs:
10+
dependency-guard:
11+
name: Dependency Guard + Clean Install
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: '22'
19+
cache: 'npm'
20+
21+
- name: Verify Dependency Integrity (Pre-Install)
22+
run: npm run check:deps
23+
24+
- name: Clean Install
25+
run: npm ci
26+
27+
- name: Verify Dependency Integrity (Post-Install)
28+
run: npm run check:deps
29+
30+
- name: Configure Git User
31+
run: |
32+
git config --global user.email "ci@git-cms.local"
33+
git config --global user.name "CI Bot"
34+
git config --global init.defaultBranch main
35+
36+
- name: Run Local Integration Tests
37+
run: npm run test:local
38+
1039
unit-test:
1140
name: Unit Tests (Docker)
1241
runs-on: ubuntu-latest
42+
needs: dependency-guard
1343
steps:
1444
- uses: actions/checkout@v4
1545

@@ -19,14 +49,15 @@ jobs:
1949
e2e-test:
2050
name: E2E Tests (Playwright)
2151
runs-on: ubuntu-latest
52+
needs: dependency-guard
2253
container:
2354
image: mcr.microsoft.com/playwright:v1.57.0-jammy
2455
steps:
2556
- uses: actions/checkout@v4
2657

2758
- uses: actions/setup-node@v4
2859
with:
29-
node-version: '20'
60+
node-version: '22'
3061
cache: 'npm'
3162

3263
# Git is required in the container to perform plumbing operations during E2E tests
@@ -50,4 +81,4 @@ jobs:
5081
with:
5182
name: playwright-report
5283
path: playwright-report/
53-
retention-days: 30
84+
retention-days: 30

.github/workflows/test-setup.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test Setup Script
2+
3+
on:
4+
push:
5+
branches: [main, git-stunts]
6+
paths:
7+
- 'scripts/setup.sh'
8+
- 'test/setup.bats'
9+
- 'test/run-setup-tests.sh'
10+
- 'test/Dockerfile.bats'
11+
pull_request:
12+
paths:
13+
- 'scripts/setup.sh'
14+
- 'test/setup.bats'
15+
- 'test/run-setup-tests.sh'
16+
- 'test/Dockerfile.bats'
17+
18+
jobs:
19+
test-setup-script:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Run BATS tests
27+
run: npm run test:setup
28+
29+
- name: Upload test results
30+
if: always()
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: bats-test-results
34+
path: test-results/

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,20 @@ playwright-report/
66
cms-chunks-*/
77
cms-upload-*/
88
git-cms-test-*/
9+
.obsidian/
10+
11+
# LaTeX artifacts
12+
docs/adr-tex-2/*.aux
13+
docs/adr-tex-2/*.log
14+
docs/adr-tex-2/*.out
15+
docs/adr-tex-2/*.toc
16+
docs/adr-tex-2/*.synctex.gz
17+
docs/adr-tex-2/*.fls
18+
docs/adr-tex-2/*.fdb_latexmk
19+
docs/adr-tex-2/*.bbl
20+
docs/adr-tex-2/*.blg
21+
docs/adr-tex-2/*.idx
22+
docs/adr-tex-2/*.ind
23+
docs/adr-tex-2/*.ilg
24+
docs/adr-tex-2/*.lof
25+
docs/adr-tex-2/*.lot

Dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# syntax=docker/dockerfile:1
22

33
# Base stage
4-
FROM node:20-slim AS base
4+
FROM node:22-slim AS base
55
ENV NODE_ENV=production
6-
# Install Git (Required for git-cms)
7-
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6+
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
87
WORKDIR /app
98

109
# Deps stage
1110
FROM base AS deps
11+
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ && rm -rf /var/lib/apt/lists/*
1212
COPY package.json package-lock.json* ./
1313
RUN npm ci --include=dev
1414

@@ -17,19 +17,17 @@ FROM base AS dev
1717
ENV NODE_ENV=development
1818
COPY --from=deps /app/node_modules ./node_modules
1919
COPY . .
20-
# Configure Git for Dev
21-
RUN git config --global user.email "dev@git-cms.local"
22-
RUN git config --global user.name "Git CMS Dev"
23-
RUN git config --global init.defaultBranch main
20+
RUN git config --global user.email "dev@git-cms.local" \
21+
&& git config --global user.name "Git CMS Dev" \
22+
&& git config --global init.defaultBranch main
2423
CMD ["npm", "run", "serve"]
2524

2625
# Test stage
2726
FROM base AS test
2827
ENV NODE_ENV=test
2928
COPY --from=deps /app/node_modules ./node_modules
3029
COPY . .
31-
# Configure Git for Test
32-
RUN git config --global user.email "bot@git-cms.local"
33-
RUN git config --global user.name "Git CMS Bot"
34-
RUN git config --global init.defaultBranch main
30+
RUN git config --global user.email "bot@git-cms.local" \
31+
&& git config --global user.name "Git CMS Bot" \
32+
&& git config --global init.defaultBranch main
3533
CMD ["npm", "run", "test:local"]

GETTING_STARTED.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Getting Started with Git CMS
2+
3+
This quick guide is the lightweight entry point. For the full Docker-focused walkthrough in the docs folder, see [`docs/GETTING_STARTED.md`](docs/GETTING_STARTED.md).
4+
5+
---
6+
7+
## Prerequisites
8+
9+
- Git
10+
- Node.js 22+
11+
- Docker Desktop (recommended for safe testing)
12+
13+
---
14+
15+
## Installation
16+
17+
### Option A: Local CLI Install
18+
19+
```bash
20+
git clone https://github.com/flyingrobots/git-cms.git
21+
cd git-cms
22+
npm install
23+
npm link
24+
```
25+
26+
### Option B: Docker (Recommended)
27+
28+
```bash
29+
git clone https://github.com/flyingrobots/git-cms.git
30+
cd git-cms
31+
npm run setup
32+
npm run dev
33+
```
34+
35+
Open the UI at [http://localhost:4638/](http://localhost:4638/).
36+
37+
---
38+
39+
## First Article
40+
41+
1. Click `+ New Article`.
42+
2. Set a slug like `my-first-post`.
43+
3. Add title + body content.
44+
4. Click `Save Draft`.
45+
5. Click `Publish` when ready.
46+
47+
---
48+
49+
## CLI Basics
50+
51+
```bash
52+
# Draft reads content from stdin
53+
echo "# Hello" | git cms draft hello-world "Hello World"
54+
55+
# List drafts
56+
git cms list
57+
58+
# Publish
59+
git cms publish hello-world
60+
61+
# Show article
62+
git cms show hello-world
63+
```
64+
65+
---
66+
67+
## Safety Notes
68+
69+
- Prefer Docker workflows while learning.
70+
- Use a dedicated test repository for local CLI experimentation.
71+
- Avoid running low-level Git plumbing in repositories you care about.
72+
73+
See [`TESTING_GUIDE.md`](TESTING_GUIDE.md) for safety and cleanup procedures.

0 commit comments

Comments
 (0)