Skip to content

Commit c4fa882

Browse files
committed
Docs(feat[astro]): Scaffold Astro docs monorepo
why: Establish the Astro-based docs pipeline and site structure alongside the existing Sphinx docs. what: - Add pnpm workspace with Biome/TS configs and AGENTS guidance - Introduce core API scan/model/intersphinx packages with tests - Add Astro autodoc/intersphinx packages and a starter docs site
1 parent 2b4f16b commit c4fa882

63 files changed

Lines changed: 8962 additions & 0 deletions

Some content is hidden

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

astro/AGENTS.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# AGENTS.md
2+
3+
## Project Context
4+
5+
Astro-based documentation monorepo for libtmux. It replaces the existing Sphinx site with a static-first Astro site that renders API docs by scanning Python source with a TypeScript toolchain and a small Python AST helper.
6+
7+
## Tech Stack
8+
9+
- **Framework**: Astro v5 (islands) + optional React for hydration
10+
- **Styling**: Tailwind CSS v4
11+
- **Language**: TypeScript (strict)
12+
- **Testing**: Vitest
13+
- **Quality**: Biome (lint/format)
14+
- **Package Manager**: pnpm 10.x workspaces
15+
- **Python tooling**: uv/uvx + Python AST for API scanning
16+
17+
## Architecture Map
18+
19+
```
20+
packages/
21+
├── core/
22+
│ ├── py-ast/ # Python AST scanner + Zod schemas
23+
│ ├── api-model/ # High-level API model + snapshots
24+
│ └── intersphinx/ # Intersphinx inventory parser
25+
├── astro/
26+
│ ├── autodoc/ # Astro components + helpers for API rendering
27+
│ └── intersphinx/ # Astro helpers for intersphinx resolution
28+
└── site/
29+
└── docs/ # Astro docs site for libtmux
30+
```
31+
32+
## Workflow Commands
33+
34+
```bash
35+
pnpm install
36+
```
37+
38+
```bash
39+
pnpm start
40+
```
41+
42+
```bash
43+
pnpm type-check
44+
```
45+
46+
```bash
47+
pnpm biome-all
48+
```
49+
50+
```bash
51+
pnpm test
52+
```
53+
54+
```bash
55+
pnpm update:all
56+
```
57+
58+
```bash
59+
pnpm ncu
60+
```
61+
62+
## Hard Constraints
63+
64+
1. **Monorepo layering**: core packages must not depend on astro packages.
65+
2. **Autodoc data**: use Zod schemas for validated data flow between packages.
66+
3. **Python scanning**: default to uvx when available; allow an override for local Python executables.
67+
4. **Astro hydration**: any React components must include an explicit client directive.

astro/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# libtmux docs (Astro)
2+
3+
Astro-based documentation monorepo for libtmux. It replaces the Sphinx site with a static-first site and a TypeScript-driven API doc pipeline that scans Python source via uv/uvx.
4+
5+
## Packages
6+
7+
- `packages/core/py-ast`: Python AST scanner with Zod schemas
8+
- `packages/core/api-model`: High-level API model built from scan results
9+
- `packages/core/intersphinx`: Sphinx intersphinx inventory parser
10+
- `packages/astro/autodoc`: Astro components for API docs
11+
- `packages/astro/intersphinx`: Astro helpers for intersphinx links
12+
- `packages/site/docs`: The docs website
13+
14+
## Setup
15+
16+
Install dependencies:
17+
18+
```bash
19+
pnpm install
20+
```
21+
22+
## Development
23+
24+
Start the docs site:
25+
26+
```bash
27+
pnpm start
28+
```
29+
30+
## Quality checks
31+
32+
Run the type checker:
33+
34+
```bash
35+
pnpm type-check
36+
```
37+
38+
Run the linter:
39+
40+
```bash
41+
pnpm biome-all
42+
```
43+
44+
Run tests:
45+
46+
```bash
47+
pnpm test
48+
```
49+
50+
## Updating dependencies
51+
52+
Update all dependencies with npm-check-updates:
53+
54+
```bash
55+
pnpm update:all
56+
```
57+
58+
## Python scanning
59+
60+
The AST scanner defaults to `uvx python` and can be overridden with `LIBTMUX_PYTHON_COMMAND`.

astro/biome.jsonc

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
3+
"css": {
4+
"parser": {
5+
"tailwindDirectives": true
6+
}
7+
},
8+
"files": {
9+
"includes": [
10+
"**",
11+
"!**/.venv",
12+
"!**/.astro",
13+
"!**/node_modules",
14+
"!**/dist",
15+
"!**/coverage",
16+
"!**/.vitest",
17+
"!**/notes",
18+
"!**/playwright-report",
19+
"!**/pnpm-lock.yaml",
20+
"!**/.pnpm-store",
21+
"!**/build-analytics.json",
22+
"!**/CHANGELOG.md"
23+
]
24+
},
25+
"formatter": {
26+
"enabled": true,
27+
"indentStyle": "space",
28+
"indentWidth": 2,
29+
"lineWidth": 120
30+
},
31+
"linter": {
32+
"enabled": true,
33+
"rules": {
34+
"recommended": true,
35+
"complexity": {
36+
"noExcessiveCognitiveComplexity": "off"
37+
},
38+
"suspicious": {
39+
"noExplicitAny": "off",
40+
"noArrayIndexKey": "off"
41+
},
42+
"style": {
43+
"noNonNullAssertion": "off",
44+
"noParameterAssign": "error",
45+
"useAsConstAssertion": "error",
46+
"useDefaultParameterLast": "error",
47+
"useEnumInitializers": "error",
48+
"useSelfClosingElements": "error",
49+
"useSingleVarDeclarator": "error",
50+
"noUnusedTemplateLiteral": "error",
51+
"useNumberNamespace": "error",
52+
"noInferrableTypes": "error",
53+
"noUselessElse": "error"
54+
}
55+
}
56+
},
57+
"javascript": {
58+
"formatter": {
59+
"quoteStyle": "single",
60+
"trailingCommas": "all",
61+
"semicolons": "asNeeded"
62+
}
63+
},
64+
"overrides": [
65+
{
66+
"includes": ["**/*.astro"],
67+
"linter": {
68+
"rules": {
69+
"correctness": {
70+
"noUnusedImports": "off",
71+
"noUnusedVariables": "off"
72+
}
73+
}
74+
}
75+
},
76+
{
77+
"includes": ["**/*.css"],
78+
"linter": {
79+
"rules": {
80+
"suspicious": {
81+
"noUnknownAtRules": "off"
82+
}
83+
}
84+
}
85+
}
86+
]
87+
}

astro/package.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@libtmux/docs-monorepo",
3+
"version": "0.0.1",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"start": "pnpm --filter @libtmux/docs-site start",
8+
"build": "pnpm --filter @libtmux/docs-site build",
9+
"preview": "pnpm --filter @libtmux/docs-site preview",
10+
"clean": "pnpm run --recursive clean",
11+
"distclean": "pnpm run --recursive distclean",
12+
"format": "pnpm run --recursive format",
13+
"format:check": "biome format .",
14+
"lint": "biome lint .",
15+
"ncu": "pnpm run --recursive ncu",
16+
"ncu-local": "ncu",
17+
"biome-all": "pnpm run --recursive biome",
18+
"biome-full": "biome lint . --apply --max-diagnostics=100 && biome check . --apply && biome format . --write",
19+
"test": "pnpm run --recursive test",
20+
"update": "pnpm run --recursive update",
21+
"update:all": "ncu -u; pnpm --recursive run 'ncu' -u",
22+
"deduplicate": "pnpm dedupe",
23+
"type-check": "pnpm run --recursive type-check",
24+
"type-check:watch": "pnpm run --recursive type-check:watch"
25+
},
26+
"engines": {
27+
"node": ">=24"
28+
},
29+
"packageManager": "pnpm@10.27.0",
30+
"devDependencies": {
31+
"@biomejs/biome": "2.3.11",
32+
"npm-check-updates": "^19.2.1",
33+
"typescript": "^5.9.3"
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@libtmux/astro-autodoc",
3+
"version": "0.0.1",
4+
"type": "module",
5+
"description": "Astro components for libtmux API docs",
6+
"main": "src/index.ts",
7+
"types": "src/index.ts",
8+
"files": ["src"],
9+
"scripts": {
10+
"test": "vitest run",
11+
"test:watch": "vitest",
12+
"lint": "biome lint .",
13+
"format": "pnpm biome check . --write; biome format . --write",
14+
"type-check": "tsc --noEmit",
15+
"type-check:watch": "tsc --noEmit --watch",
16+
"update": "pnpm update",
17+
"ncu": "ncu",
18+
"clean": "rm -rf dist/ node_modules/.cache/",
19+
"biome": "biome check . --apply && biome format . --write"
20+
},
21+
"dependencies": {
22+
"@libtmux/api-model": "workspace:*",
23+
"@libtmux/py-ast": "workspace:*"
24+
},
25+
"peerDependencies": {
26+
"astro": "^5.0.0"
27+
},
28+
"devDependencies": {
29+
"@biomejs/biome": "2.3.11",
30+
"@types/node": "^25.0.3",
31+
"typescript": "^5.9.3",
32+
"vitest": "^4.0.16"
33+
}
34+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
import '../styles.css'
3+
import AutodocFunction from './AutodocFunction.astro'
4+
import AutodocVariable from './AutodocVariable.astro'
5+
import Docstring from './Docstring.astro'
6+
import { slugify } from '../utils'
7+
8+
const { klass } = Astro.props
9+
const anchor = slugify(klass.qualname)
10+
const bases = klass.bases.length > 0 ? `(${klass.bases.join(', ')})` : ''
11+
---
12+
13+
<section id={anchor} class="autodoc-card autodoc">
14+
<header>
15+
<div class="autodoc-title">class {klass.name}{bases}</div>
16+
{klass.decorators.length > 0 ? (
17+
<div>
18+
{klass.decorators.map((decorator) => (
19+
<span class="autodoc-pill">@{decorator}</span>
20+
))}
21+
</div>
22+
) : null}
23+
</header>
24+
25+
<Docstring value={klass.docstring} />
26+
27+
{klass.attributes.length > 0 ? (
28+
<div class="autodoc-divider">
29+
<h4>Attributes</h4>
30+
<div class="autodoc-grid">
31+
{klass.attributes.map((attribute) => (
32+
<AutodocVariable variable={attribute} />
33+
))}
34+
</div>
35+
</div>
36+
) : null}
37+
38+
{klass.methods.length > 0 ? (
39+
<div class="autodoc-divider">
40+
<h4>Methods</h4>
41+
<div class="autodoc-grid">
42+
{klass.methods.map((method) => (
43+
<AutodocFunction fn={method} label={`${klass.name}.${method.name}`} />
44+
))}
45+
</div>
46+
</div>
47+
) : null}
48+
</section>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
import '../styles.css'
3+
import Docstring from './Docstring.astro'
4+
import { formatSignature, slugify } from '../utils'
5+
6+
const { fn, label } = Astro.props
7+
const anchor = slugify(fn.qualname)
8+
const title = label ?? fn.name
9+
const signature = formatSignature(fn.signature, fn.returns)
10+
---
11+
12+
<section id={anchor} class="autodoc-card autodoc">
13+
<div class="autodoc-title">{title}</div>
14+
<div class="autodoc-signature">{signature}</div>
15+
<Docstring value={fn.docstring} />
16+
</section>

0 commit comments

Comments
 (0)