Skip to content

Commit c21e174

Browse files
more stuff
1 parent 3320ffc commit c21e174

26 files changed

Lines changed: 1295 additions & 1536 deletions

.ai-workspace/README.md

Lines changed: 36 additions & 228 deletions
Original file line numberDiff line numberDiff line change
@@ -1,189 +1,61 @@
11
# AI Workspace Infrastructure
22

3-
This directory contains the infrastructure for the AI Workspace Template, including configuration management, scripts, and templates.
3+
This directory contains the infrastructure for the AI Workspace Template.
4+
5+
**Full documentation:** [Configuration Reference](https://michaelyochpaz.github.io/ai-workspace-template/configuration/)
46

57
## Directory Structure
68

79
```
810
.ai-workspace/
9-
├── lib/
10-
│ ├── __init__.py
11-
│ └── config.py # Pydantic configuration models
12-
├── scripts/
13-
│ ├── align-workspace.py # Pre-commit: aligns workspace with config
14-
│ ├── session-sync.py # Session start: syncs submodules
15-
│ ├── transpile-skills.py
16-
│ ├── transpile-commands.py
17-
│ └── mktmpdir.py
18-
├── templates/
19-
│ ├── AGENTS.md.j2 # Jinja2 template for generating AGENTS.md
20-
│ ├── skills-readme.md # Template for skills/README.md
21-
│ ├── commands-readme.md # Template for commands/README.md
22-
│ └── agent-docs-readme.md # Template for agent-docs/README.md
23-
├── zensical.toml # Zensical documentation site config
24-
├── schema.json # Auto-generated JSON schema for config
25-
└── README.md # This file
11+
├── docs/ # Documentation source (Zensical site)
12+
├── lib/ # Python library (config models)
13+
├── scripts/ # Automation scripts
14+
├── templates/ # Jinja2 templates
15+
├── schema.json # JSON schema for ai-workspace.toml
16+
└── zensical.toml # Documentation site config
2617
```
2718

28-
## AGENTS.md Generation
29-
30-
`AGENTS.md` is **auto-generated** from the Jinja2 template at `.ai-workspace/templates/AGENTS.md.j2`. Do not edit it directly.
31-
32-
### How It Works
19+
## Key Scripts
3320

34-
1. The `align-workspace.py` script runs on every pre-commit
35-
2. It gathers data from:
36-
- `ai-workspace.toml` (feature flags)
37-
- `agent-docs/*/metadata.yaml` (documentation listings)
38-
- `skills/` and `commands/` directories (item counts)
39-
- `AGENTS.project.md` (project-specific content)
40-
3. It renders the template and writes `AGENTS.md`
21+
| Script | Purpose |
22+
|--------|---------|
23+
| `align-workspace.py` | Pre-commit: regenerates AGENTS.md, manages feature dirs |
24+
| `session-sync.py` | Session start: syncs submodules, discovers tools |
25+
| `transpile-skills.py` | Validates and distributes skills |
26+
| `transpile-commands.py` | Validates and distributes commands |
27+
| `mktmpdir.py` | Creates unique task directories under `.tmp/` |
4128

42-
### Project-Specific Instructions
29+
## AGENTS.md Generation
4330

44-
Add project-specific instructions in `AGENTS.project.md` at the repository root. This content is merged into the generated `AGENTS.md`.
31+
`AGENTS.md` is auto-generated from `templates/AGENTS.md.j2`. Don't edit directly.
4532

46-
**Initial state:** The file ships with `<placeholder>` tags. Remove these tags when adding your content:
33+
- **Workspace instructions:** Edit `templates/AGENTS.md.j2`
34+
- **Project-specific instructions:** Edit `AGENTS.project.md` at repo root
4735

48-
```markdown
49-
<placeholder>
50-
Add project-specific instructions here...
51-
</placeholder>
36+
Regenerate manually:
37+
```bash
38+
uv run .ai-workspace/scripts/align-workspace.py
5239
```
5340

54-
**Detection logic:**
55-
- If file is missing → project section omitted
56-
- If file contains `<placeholder>` → project section omitted
57-
- If file has content (no `<placeholder>`) → content included in AGENTS.md
58-
59-
### Conditional Sections
60-
61-
The template conditionally includes sections based on configuration and content:
62-
63-
| Section | Included When |
64-
|---------|---------------|
65-
| Agent Docs | `features.agent_docs = true` |
66-
| Commands | `features.commands = true` AND commands exist |
67-
| Skills | `features.skills = true` AND skills exist |
68-
| Project Content | `AGENTS.project.md` has content (no `<placeholder>`) |
69-
7041
## Configuration
7142

72-
The workspace is configured via `ai-workspace.toml` at the repository root.
73-
74-
### Schema
75-
76-
The `schema.json` file provides JSON Schema for editor autocomplete. It's auto-generated from the Pydantic models in `lib/config.py`.
77-
78-
### Configuration Reference
79-
80-
#### `[workspace]`
81-
82-
| Key | Type | Default | Description |
83-
|-----|------|---------|-------------|
84-
| `name` | string | `"AI Workspace"` | Workspace display name |
43+
The workspace is configured via `ai-workspace.toml` at the repository root. Key sections:
8544

86-
#### `[sync]`
45+
| Section | Purpose |
46+
|---------|---------|
47+
| `[workspace]` | General settings (name) |
48+
| `[repositories]` | Repository status and sync settings |
49+
| `[hooks.session_start]` | Session start script config |
50+
| `[features]` | Enable/disable skills, commands, agent-docs |
51+
| `[tools]` | Tool discovery settings |
52+
| `[distribution]` | Where to distribute skills/commands |
8753

88-
| Key | Type | Default | Description |
89-
|-----|------|---------|-------------|
90-
| `skip_on_uncommitted_changes` | bool | `true` | Skip submodules with uncommitted changes (`false` = fail) |
91-
| `default_branch` | string | `"main"` | Fallback branch if not specified in .gitmodules |
92-
| `template_upstream_url` | string | (template URL) | URL for template update notifications. Set empty to disable. |
93-
| `template_upstream_git_remote` | string | `"template-upstream"` | Git remote name for the template upstream |
94-
95-
#### `[hooks.session_start]`
96-
97-
| Key | Type | Default | Description |
98-
|-----|------|---------|-------------|
99-
| `script` | string | (required) | Path to the script to run at session start |
100-
| `timeout` | int | `120` | Timeout in seconds |
101-
102-
#### `[features]`
103-
104-
| Key | Type | Default | Description |
105-
|-----|------|---------|-------------|
106-
| `skills` | bool | `true` | Enable skills system |
107-
| `commands` | bool | `true` | Enable commands system |
108-
| `agent_docs` | bool | `true` | Enable agent-docs system |
109-
110-
**Warning:** Disabling a feature removes its directory if empty. If the directory has user content, pre-commit will fail with instructions to manually remove the content.
111-
112-
#### `[distribution]`
113-
114-
| Key | Type | Default | Description |
115-
|-----|------|---------|-------------|
116-
| `skills_paths` | list[str] | `[".opencode/skill"]` | Target directories for skills symlinks |
117-
| `commands_paths` | list[str] | (IDE dirs) | Target directories for commands |
118-
119-
**Note:** `.cursor/*` paths automatically use `strip_frontmatter` method; all others use symlinks.
120-
121-
### Example Configuration
122-
123-
```toml
124-
[workspace]
125-
name = "AI Workspace"
126-
127-
[sync]
128-
skip_on_uncommitted_changes = true
129-
default_branch = "main"
130-
template_upstream_url = "https://github.com/MichaelYochpaz/ai-workspace-template.git"
131-
template_upstream_git_remote = "template-upstream"
132-
133-
[hooks.session_start]
134-
script = ".ai-workspace/scripts/session-sync.py"
135-
timeout = 120
136-
137-
[features]
138-
skills = true
139-
commands = true
140-
agent_docs = true
141-
142-
[distribution]
143-
skills_paths = [".opencode/skill"]
144-
commands_paths = [
145-
".roo/commands",
146-
".claude/commands",
147-
".cursor/commands",
148-
".opencode/command",
149-
]
150-
```
54+
See [Configuration](https://michaelyochpaz.github.io/ai-workspace-template/configuration/) for the full reference.
15155

152-
## Scripts
56+
## Documentation Site
15357

154-
### align-workspace.py
155-
156-
Runs via pre-commit. Ensures workspace state matches `ai-workspace.toml`:
157-
158-
- Manages feature directories (creates/removes based on config)
159-
- Generates `AGENTS.md` from Jinja2 template
160-
- Generates `.claude/settings.json` with SessionStart hooks
161-
- Ensures `.opencode/plugins/` directory exists for OpenCode plugin
162-
- Updates `schema.json` from Pydantic models
163-
- Runs feature-specific validators (skills, commands)
164-
165-
### session-sync.py
166-
167-
Runs at AI tool session start. Syncs submodules to their configured branches:
168-
169-
- Reads branch configuration from `.gitmodules`
170-
- Skips submodules with uncommitted changes (configurable)
171-
- Checks for template updates and displays notification
172-
- Non-blocking: network failures don't prevent session start
173-
174-
### transpile-skills.py / transpile-commands.py
175-
176-
Validate and distribute skills/commands to IDE-specific directories. See `skills/README.md` and `commands/README.md` for details.
177-
178-
### mktmpdir.py
179-
180-
Creates unique task directories under `.tmp/` for organizing temporary files.
181-
182-
## Tool Configurations
183-
184-
### Documentation Site
185-
186-
The documentation site is built with [Zensical](https://zensical.org/) and configured via `zensical.toml` in this directory. Build and preview commands:
58+
Built with [Zensical](https://zensical.org/). Config in `zensical.toml`.
18759

18860
```bash
18961
# Preview locally
@@ -192,67 +64,3 @@ zensical serve --config-file .ai-workspace/zensical.toml
19264
# Build static site
19365
zensical build --config-file .ai-workspace/zensical.toml
19466
```
195-
196-
### Claude Code
197-
198-
The align-workspace script generates `.claude/settings.json` with a SessionStart hook:
199-
200-
```json
201-
{
202-
"hooks": {
203-
"SessionStart": [
204-
{
205-
"matcher": "startup|resume",
206-
"hooks": [
207-
{
208-
"type": "command",
209-
"command": "uv run \"$CLAUDE_PROJECT_DIR/.ai-workspace/scripts/session-sync.py\"",
210-
"timeout": 120,
211-
"statusMessage": "Syncing submodules..."
212-
}
213-
]
214-
}
215-
]
216-
}
217-
}
218-
```
219-
220-
### OpenCode
221-
222-
The `.opencode/plugins/session-sync.ts` plugin reads configuration from `ai-workspace.toml` at runtime:
223-
224-
- Listens for `session.created` events
225-
- Reads `hooks.session_start.script` from `ai-workspace.toml`
226-
- Executes the configured script via `uv run`
227-
- Injects results into the system prompt via `experimental.chat.system.transform` hook
228-
229-
## Extending
230-
231-
### Adding a New Hook Type
232-
233-
1. Add the hook config to `lib/config.py` (HooksConfig class)
234-
2. Update `align-workspace.py` to generate tool-specific configurations
235-
3. Regenerate schema: `uv run .ai-workspace/scripts/align-workspace.py`
236-
237-
### Adding a New IDE/Tool
238-
239-
1. Update `transpile-skills.py` and/or `transpile-commands.py` with new IDE config
240-
2. Add hook generation to `align-workspace.py` if the tool supports session hooks
241-
3. Update `[distribution]` defaults in `lib/config.py`
242-
243-
### Modifying AGENTS.md Structure
244-
245-
Edit the Jinja2 template at `.ai-workspace/templates/AGENTS.md.j2`. The template receives:
246-
247-
```python
248-
{
249-
"features": {
250-
"agent_docs": {"enabled": bool, "docs": [AgentDoc, ...]},
251-
"skills": {"enabled": bool, "count": int},
252-
"commands": {"enabled": bool, "count": int},
253-
},
254-
"project_content": str | None,
255-
}
256-
```
257-
258-
Run `uv run .ai-workspace/scripts/align-workspace.py` to regenerate AGENTS.md after template changes.

.ai-workspace/docs/ci-recommendations.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)