Skip to content

Commit b37269c

Browse files
authored
Add Cursor prompts to migrate a branch from Hugo to Mintlify (#1804)
## Description Add Cursor prompts to migrate a branch from Hugo to Mintlify - Locally, ports a branch with changes that were started before the Hugo migration to Mintlify. - Updates file locations, syntax, frontmatter, TOCs, links. - Validates Mintlify content using `mint dev` and `mint broken-links` - Recreates commits as a single squashed commit against current `origin/main` Afterward, the human user: - Closes the original PR. - Force-pushes the branch. - Creates a new PR against the branch. - Continues working or getting review in the new PR. Currently added to the `.ai/` directory. Migrating the existing prompts in that directory to Cursor format is WIP, and these will be in place to be picked up automatically in scope of that migration. ## Testing Successfully ported #1627 to #1802 Successfully ported #1563 to #1803
1 parent 2ad35fe commit b37269c

File tree

4 files changed

+476
-112
lines changed

4 files changed

+476
-112
lines changed

.ai/README.md

Lines changed: 49 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,67 @@
1-
# AI resources for wandb/docs
1+
# AI Assistant Resources
22

3-
This directory contains resources, prompts, and tools designed to help AI agents work effectively with the wandb/docs repository.
3+
This directory contains resources, prompts, and templates specifically designed for AI agents working with the W&B documentation repository.
44

5-
## Getting started
5+
## Directory Structure
66

7-
Start by reading the [system prompt](./system-prompt.md) to understand your role as a member of the W&B docs team.
8-
9-
## Directory structure
10-
11-
### `system-prompt.md`
12-
The foundational context for AI agents joining the W&B docs team. Defines your role, responsibilities, and key principles for creating documentation.
13-
14-
### `style-guide.md`
15-
Comprehensive style guide for W&B documentation. Covers formatting, punctuation, code examples, and W&B-specific conventions.
16-
17-
### `runbooks/`
18-
Standardized, task-specific instructions for AI agents performing complex operations in this repository. These runbooks ensure consistent, reliable execution of recurring tasks.
19-
20-
**Example tasks:**
21-
- Testing GitHub Actions changes
22-
- Performing large-scale refactoring
23-
- Managing release processes
24-
25-
See [runbooks/README.md](./runbooks/README.md) for detailed information.
26-
27-
### Future directories (planned)
28-
29-
#### `prompts/`
30-
System prompts and context for different types of AI interactions:
31-
- Documentation writing guidelines
32-
- Code review standards
33-
- Style and tone specifications
34-
35-
#### `tools/`
36-
Scripts and utilities that AI agents can use:
37-
- Validation scripts
38-
- Automation helpers
39-
- Analysis tools
40-
41-
#### `context/`
42-
Repository-specific context that helps AI agents understand:
43-
- Architecture decisions
44-
- Historical context
45-
- Domain-specific knowledge
46-
47-
## Usage guidelines
48-
49-
### For repository maintainers
50-
1. Keep runbooks up-to-date as processes change
51-
2. Test runbooks regularly with AI agents
52-
3. Document any repository-specific quirks or constraints
53-
4. Version control all AI resources alongside code
54-
55-
### For AI agent users
56-
1. Always check for relevant runbooks before starting complex tasks
57-
2. Provide runbooks as context to your AI agent
58-
3. Report issues or ambiguities in runbooks
59-
4. Contribute improvements based on your experience
60-
61-
## Collaboration guidelines
62-
63-
When working with human and AI teammates on documentation changes:
7+
```
8+
.ai/
9+
├── migrations/ # One-off migration tools and templates
10+
├── style-guide/ # Writing and code style guidance for AI agents
11+
└── runbooks/ # Step-by-step procedures for complex tasks
12+
```
6413

65-
### Before creating a PR
66-
- **Feature branches**: Push feature branches to collaborate with others before opening a PR.
67-
- **Branch naming**: Use descriptive names that indicate the purpose (for example, `fix/broken-links-automation-guide`).
14+
## For Human Contributors
6815

69-
### Creating pull requests
70-
1. **Start with draft PRs**: Create a draft pull request initially. This won't request reviews and can't be merged accidentally.
71-
2. **Wait for tests**: Ensure all PR tests pass before marking as ready for review.
72-
3. **Coordinate with humans**: The human coordinating the work should verify the changes meet requirements before marking the PR ready for review. A human should ultimately merge a PR, not an agent.
16+
These resources help AI assistants provide consistent, high-quality contributions to the docs. When working with an AI agent:
7317

74-
### PR titles and descriptions
75-
- **Be meaningful but concise**: Write clear titles that describe what changed.
76-
- **Link relevant context**: Include:
77-
- JIRA IDs (for example, `DOCS-1234`)
78-
- GitHub issue IDs (for example, `#456`)
79-
- Related PRs for additional context
80-
- **Add before/after comparison**: When applicable, include:
81-
- Links to the current live documentation
82-
- Links to the PR's HTML preview showing the changes
83-
- Brief description of what changed and why
18+
1. **For migrations**: Direct the agent to `.ai/migrations/` for specific migration templates
19+
2. **For style questions**: Reference `.ai/style-guide/` for consistency
20+
3. **For complex procedures**: Use `.ai/runbooks/` for detailed workflows
8421

85-
### Example PR description
86-
```
87-
## Description
22+
## For AI Agents
8823

89-
Updates AI agent style guide to improve accessibility and code quality.
24+
When assisting with documentation tasks:
9025

91-
The style guide now provides clearer guidance for AI agents creating documentation:
92-
- Added accessibility guidelines (no emojis)
93-
- Added code example best practices
94-
- Created runbook template
26+
1. **Check this directory first** for relevant templates and guidance
27+
2. **Follow style guides** in `.ai/style-guide/` to ensure consistency
28+
3. **Use migration templates** in `.ai/migrations/` for structural changes
29+
4. **Reference runbooks** in `.ai/runbooks/` for multi-step procedures
9530

96-
### Before/After
97-
- Live docs: https://docs.wandb.ai/guides/ai-resources
98-
- PR preview: https://preview-12345.pages.dev/guides/ai-resources
31+
## Current Resources
9932

100-
## Related issues
101-
102-
- Fixes DOCS-1234
103-
- Related to #456
104-
```
33+
### Migrations
34+
- **hugo-to-mintlify/**: Templates for migrating PRs from Hugo to Mintlify structure
35+
- `migration_prompt_template.md`: Step-by-step migration guide
36+
- `migration_user_prompt.md`: User-facing prompts for requesting migrations
10537

106-
## Best practices
38+
### Style Guide
39+
*(Coming soon)*
40+
- Writing style guidelines
41+
- Code formatting standards
42+
- Naming conventions
10743

108-
1. **Capture knowledge immediately**: After completing any complex task with an AI agent, ask them to draft a runbook while the details are fresh
109-
2. **Specificity**: Be explicit about every step, assumption, and requirement
110-
3. **Adaptability**: Include variations for common scenarios
111-
4. **Safety**: Always include cleanup steps and error handling
112-
5. **Testing**: Verify runbooks work with multiple AI providers
113-
6. **Maintenance**: Update runbooks when workflows or tools change
114-
7. **Iterative improvement**: Have agents review and improve existing runbooks based on their experience
44+
### Runbooks
45+
*(Coming soon)*
46+
- Release process
47+
- Documentation testing procedures
48+
- PR review checklist
11549

116-
## Contributing
50+
## Adding New Resources
11751

118-
When adding AI resources:
52+
When adding new AI resources:
53+
1. Place them in the appropriate subdirectory
54+
2. Update this README with a description
55+
3. Include clear instructions for both humans and AI agents
56+
4. Consider whether the resource is temporary (migration) or permanent (style guide)
11957

120-
1. Follow existing naming conventions and structure
121-
2. Include comprehensive documentation
122-
3. Test with at least one AI agent
123-
4. Update relevant README files
124-
5. Consider security implications of any shared context
58+
## Note on Tool Compatibility
12559

126-
## Security notes
60+
These resources are tool-agnostic and work with:
61+
- Cursor
62+
- GitHub Copilot
63+
- Claude (via API or web)
64+
- ChatGPT
65+
- Other AI coding assistants
12766

128-
- Never include sensitive information (API keys, passwords, etc.)
129-
- Be cautious about exposing internal URLs or infrastructure details
130-
- Review all contributions for potential security risks
67+
For tool-specific configurations (like `.cursorrules`), those remain in their respective directories.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Hugo to Mintlify Migration Guide
2+
3+
This directory contains templates and prompts for migrating documentation from Hugo to Mintlify structure.
4+
5+
## Quick Start for Humans
6+
7+
If you have a PR or branch that was created when the docs used Hugo, follow these steps:
8+
9+
### 1. Identify Your Situation
10+
11+
- **Have a PR number?** → Use Option 1 in `migration_user_prompt.md`
12+
- **Have a local branch?** → Use Option 2 in `migration_user_prompt.md`
13+
- **Have uncommitted changes?** → Use Option 3 in `migration_user_prompt.md`
14+
15+
### 2. Request the Migration
16+
17+
1. Open your AI assistant (Cursor, GitHub Copilot Chat, etc.)
18+
2. Copy the appropriate prompt from `migration_user_prompt.md`
19+
3. Fill in the placeholders (PR number, branch name, or file list)
20+
4. Paste to your AI assistant
21+
22+
### 3. What to Expect
23+
24+
The AI agent will:
25+
- Identify your Hugo changes
26+
- Find where files moved in Mintlify structure
27+
- Convert Hugo syntax to Mintlify components
28+
- Update navigation in `docs.json`
29+
- Create a clean commit with only Mintlify files
30+
31+
### 4. After Migration
32+
33+
- **If you had a PR**: Close the old PR and create a new one from the migrated branch
34+
- **If you had a branch**: Create a new PR directly
35+
- **Why?** PRs created during Hugo era don't get Mintlify preview deployments
36+
37+
## Files in This Directory
38+
39+
### `migration_prompt_template.md`
40+
Detailed step-by-step instructions for AI agents to perform the migration. This is the "how-to" guide the AI follows.
41+
42+
### `migration_user_prompt.md`
43+
Ready-to-use prompts for humans to copy/paste when requesting a migration. Pick the option that matches your situation.
44+
45+
## Common Issues and Solutions
46+
47+
### "Hugo template errors when running mint dev"
48+
The AI needs to do a hard reset and recreate the commit with only Mintlify files. Ask:
49+
```
50+
I'm getting Hugo template errors. Please hard reset to origin/main and recreate the commit with only Mintlify files.
51+
```
52+
53+
### "My new page doesn't appear in the navigation"
54+
The AI needs to update `docs.json`. Ask:
55+
```
56+
Please add my new page to the navigation in docs.json
57+
```
58+
59+
### "The PR preview isn't working"
60+
This is expected for PRs created during Hugo era. You must:
61+
1. Close the old PR (don't delete the branch)
62+
2. Create a new PR from the same branch
63+
3. The new PR will get Mintlify previews
64+
65+
## Prerequisites
66+
67+
Before starting a migration:
68+
1. Install Mintlify CLI: `npm i -g mintlify`
69+
2. Have your changes ready (in a PR, branch, or locally)
70+
3. Be in the docs repository
71+
72+
## Examples of Successful Migrations
73+
74+
- PR #1627 → PR #1802 (org_dashboard documentation)
75+
- PR #1563 (automation history documentation)
76+
77+
## Need Help?
78+
79+
If the migration fails or you encounter issues:
80+
1. Check that you're on the latest `main` branch
81+
2. Ensure no Hugo files are staged (only `models/`, `platform/`, etc.)
82+
3. Verify `mint dev` runs without errors
83+
4. Ask the AI to show you what files it's trying to commit
84+
85+
## Technical Notes
86+
87+
### File Structure Changes
88+
- **Hugo**: `content/en/guides/`**Mintlify**: Root-level directories
89+
- **Hugo**: `.md` files → **Mintlify**: `.mdx` files
90+
- **Hugo**: `content/en/guides/core/`**Mintlify**: `models/`
91+
- **Hugo**: `content/en/guides/hosting/`**Mintlify**: `platform/`
92+
93+
### Syntax Conversions
94+
- **Tabs**: `{{< tabpane >}}``<Tabs>`
95+
- **Links**: `{{< relref >}}` → Direct paths
96+
- **Comments**: `<!-- -->``{/* */}`
97+
- **Includes**: `{{< readfile >}}` → Import statements or inline content

0 commit comments

Comments
 (0)