Skip to content

Commit 3cb56e4

Browse files
authored
Fix Glossary Maintainer workflow: Move documentation skill to .github folder and add compiler validation (#14637)
1 parent 2d48adb commit 3cb56e4

7 files changed

Lines changed: 284 additions & 8 deletions

File tree

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
---
2+
name: documentation
3+
description: Documentation Brief description for SEO and navigation
4+
---
5+
6+
### Documentation
7+
8+
The documentation for this project is available in the `docs/` directory. It uses GitHub-flavored markdown with Astro Starlight for rendering and follows the Diátaxis framework for systematic documentation.
9+
10+
## Diátaxis Framework
11+
12+
Documentation must be organized into four distinct types, each serving a specific purpose:
13+
14+
### 1. Tutorials (Learning-Oriented)
15+
**Purpose**: Guide beginners through achieving a specific outcome to build confidence.
16+
17+
- Start with what the user will build or achieve
18+
- Provide a clear, step-by-step path from start to finish
19+
- Include concrete examples and working code
20+
- Assume minimal prior knowledge
21+
- Focus on the happy path (avoid edge cases and alternatives)
22+
- End with a working result the user can see and use
23+
- Use imperative mood: "Create a file", "Run the command"
24+
25+
**Avoid**: Explaining concepts in depth, multiple options, troubleshooting
26+
27+
### 2. How-to Guides (Goal-Oriented)
28+
**Purpose**: Show how to solve a specific real-world problem or accomplish a particular task.
29+
30+
- Title format: "How to [accomplish specific goal]"
31+
- Assume the user knows the basics
32+
- Focus on practical steps to solve one problem
33+
- Include necessary context but stay focused
34+
- Show multiple approaches only when genuinely useful
35+
- End when the goal is achieved
36+
- Use imperative mood: "Configure the setting", "Add the following"
37+
38+
**Avoid**: Teaching fundamentals, explaining every detail, being exhaustive
39+
40+
### 3. Reference (Information-Oriented)
41+
**Purpose**: Provide accurate, complete technical descriptions of the system.
42+
43+
- Organized by structure (CLI commands, configuration options, API endpoints)
44+
- Comprehensive and authoritative
45+
- Consistent format across all entries
46+
- Technical accuracy is paramount
47+
- Include all parameters, options, and return values
48+
- Use descriptive mood: "The command accepts", "Returns a string"
49+
- Minimal narrative or explanation
50+
51+
**Avoid**: Instructions, tutorials, opinions on usage
52+
53+
### 4. Explanation (Understanding-Oriented)
54+
**Purpose**: Clarify and illuminate topics to deepen understanding.
55+
56+
- Discuss why things are the way they are
57+
- Explain design decisions and tradeoffs
58+
- Provide context and background
59+
- Connect concepts to help form mental models
60+
- Discuss alternatives and their implications
61+
- Use indicative mood: "This approach provides", "The engine uses"
62+
63+
**Avoid**: Step-by-step instructions, exhaustive reference material
64+
65+
## General Style Guidelines
66+
67+
- **Tone**: Neutral, technical, not promotional
68+
- **Voice**: Avoid "we", "our", "us" (use "the tool", "this command")
69+
- **Headings**: Use markdown heading syntax, not bold text as headings
70+
- **Lists**: Avoid long bullet point lists; prefer prose with structure
71+
- **Code samples**: Minimal and focused; exclude optional fields unless relevant
72+
- **Language tag**: Use `aw` for agentic workflow snippets with YAML frontmatter
73+
74+
**Example workflow code block**:
75+
```aw wrap
76+
on: push
77+
# Your workflow steps here
78+
```
79+
80+
## GitHub-Flavored Markdown Syntax
81+
82+
Documentation files use GitHub-flavored markdown with Astro Starlight for rendering. Key syntax elements:
83+
84+
### Frontmatter
85+
Every documentation page must have frontmatter:
86+
```markdown
87+
title: Page Title
88+
description: Brief description for SEO and navigation
89+
```
90+
91+
### GitHub Alerts
92+
Use GitHub's alert syntax for notes, tips, warnings, and cautions:
93+
```markdown
94+
> [!NOTE]
95+
> Important information the reader should notice.
96+
97+
> [!TIP]
98+
> Helpful advice for the reader.
99+
100+
> [!WARNING]
101+
> Warning about potential issues or pitfalls.
102+
103+
> [!CAUTION]
104+
> Critical warning about dangerous operations.
105+
106+
> [!IMPORTANT]
107+
> Key information users need to know.
108+
```
109+
110+
### Code Blocks
111+
- Use syntax highlighting with language tags
112+
- Add `title` attribute for file names: ` ```yaml title=".github/workflows/example.yml" `
113+
- Use `aw` language for agentic workflow files with YAML frontmatter
114+
- Add `wrap` for line wrapping: ` ```aw wrap `
115+
116+
### Links
117+
- Internal links: Use relative paths between documentation pages
118+
- External links: Open in new tab automatically
119+
- Link text: Use descriptive text, avoid "click here"
120+
121+
### Tabs
122+
Use tabs for showing alternatives (e.g., different languages, platforms):
123+
```markdown
124+
import { Tabs, TabItem } from '@astrojs/starlight/components';
125+
126+
<Tabs>
127+
<TabItem label="npm">
128+
```bash
129+
npm install package
130+
```
131+
</TabItem>
132+
<TabItem label="yarn">
133+
```bash
134+
yarn add package
135+
```
136+
</TabItem>
137+
</Tabs>
138+
```
139+
140+
### Cards
141+
Use cards for navigation or highlighting multiple options:
142+
```markdown
143+
import { Card, CardGrid } from '@astrojs/starlight/components';
144+
145+
<CardGrid>
146+
<Card title="Getting Started" icon="rocket">
147+
Quick introduction to the basics.
148+
</Card>
149+
<Card title="Advanced Usage" icon="setting">
150+
Deep dive into advanced features.
151+
</Card>
152+
</CardGrid>
153+
```
154+
155+
**Remember**: Keep components minimal. Prefer standard markdown when possible.
156+
157+
## Content to Avoid
158+
159+
- "Key Features" sections
160+
- Marketing language or selling points
161+
- Excessive bullet points (prefer structured prose)
162+
- Overly verbose examples with all optional parameters
163+
- Mixing documentation types (e.g., tutorials that become reference)
164+
165+
## Avoiding Documentation Bloat
166+
167+
Documentation bloat reduces clarity and makes content harder to navigate. Common types of bloat include:
168+
169+
### Types of Documentation Bloat
170+
171+
1. **Duplicate content**: Same information repeated in different sections
172+
2. **Excessive bullet points**: Long lists that could be condensed into prose or tables
173+
3. **Redundant examples**: Multiple examples showing the same concept
174+
4. **Verbose descriptions**: Overly wordy explanations that could be more concise
175+
5. **Repetitive structure**: The same "What it does" / "Why it's valuable" pattern overused
176+
177+
### Writing Concise Documentation
178+
179+
When editing documentation, focus on:
180+
181+
**Consolidate bullet points**:
182+
- Convert long bullet lists into concise prose or tables
183+
- Remove redundant points that say the same thing differently
184+
185+
**Eliminate duplicates**:
186+
- Remove repeated information
187+
- Consolidate similar sections
188+
189+
**Condense verbose text**:
190+
- Make descriptions more direct and concise
191+
- Remove filler words and phrases
192+
- Keep technical accuracy while reducing word count
193+
194+
**Standardize structure**:
195+
- Reduce repetitive "What it does" / "Why it's valuable" patterns
196+
- Use varied, natural language
197+
198+
**Simplify code samples**:
199+
- Remove unnecessary complexity from code examples
200+
- Focus on demonstrating the core concept clearly
201+
- Eliminate boilerplate or setup code unless essential for understanding
202+
- Keep examples minimal yet complete
203+
- Use realistic but simple scenarios
204+
205+
### Example: Before and After
206+
207+
**Before (Bloated)**:
208+
```markdown
209+
### Tool Name
210+
Description of the tool.
211+
212+
- **What it does**: This tool does X, Y, and Z
213+
- **Why it's valuable**: It's valuable because A, B, and C
214+
- **How to use**: You use it by doing steps 1, 2, 3, 4, 5
215+
- **When to use**: Use it when you need X
216+
- **Benefits**: Gets you benefit A, benefit B, benefit C
217+
- **Learn more**: [Link](url)
218+
```
219+
220+
**After (Concise)**:
221+
```markdown
222+
### Tool Name
223+
Description of the tool that does X, Y, and Z to achieve A, B, and C.
224+
225+
Use it when you need X by following steps 1-5. [Learn more](url)
226+
```
227+
228+
### Documentation Quality Guidelines
229+
230+
1. **Preserve meaning**: Never lose important information
231+
2. **Be surgical**: Make precise edits, don't rewrite everything
232+
3. **Maintain tone**: Keep the neutral, technical tone
233+
4. **Test locally**: Verify links and formatting are still correct
234+
235+
## Structure by File Type
236+
237+
- **Getting Started**: Tutorial format
238+
- **How-to Guides**: Goal-oriented, one task per guide
239+
- **CLI Reference**: Reference format, complete command documentation
240+
- **Concepts**: Explanation format, building understanding
241+
- **API Reference**: Reference format, complete API documentation

.github/workflows/glossary-maintainer.lock.yml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/glossary-maintainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ network:
2424

2525
imports:
2626
- shared/mood.md
27-
- ../../skills/documentation/SKILL.md
27+
- ../skills/documentation/SKILL.md
2828
- ../agents/technical-doc-writer.agent.md
2929

3030
safe-outputs:

.github/workflows/technical-doc-writer.lock.yml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/technical-doc-writer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ network:
2525

2626
imports:
2727
- shared/mood.md
28-
- ../../skills/documentation/SKILL.md
28+
- ../skills/documentation/SKILL.md
2929
- ../agents/technical-doc-writer.agent.md
3030

3131
safe-outputs:

pkg/parser/remote_fetch.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,31 @@ func ResolveIncludePath(filePath, baseDir string, cache *ImportCache) (string, e
117117
remoteLog.Printf("Using local file resolution for: %s", filePath)
118118
// Regular path, resolve relative to base directory
119119
fullPath := filepath.Join(baseDir, filePath)
120+
121+
// Security check: ensure the resolved path is within the .github folder
122+
// baseDir should be .github or a subdirectory within it
123+
githubFolder := baseDir
124+
// Find the .github folder by traversing up from baseDir
125+
for !strings.HasSuffix(githubFolder, ".github") && githubFolder != "." && githubFolder != "/" {
126+
githubFolder = filepath.Dir(githubFolder)
127+
if githubFolder == "." || githubFolder == "/" {
128+
// If we can't find .github folder, use baseDir
129+
githubFolder = baseDir
130+
break
131+
}
132+
}
133+
134+
// Normalize paths for comparison
135+
normalizedGithubFolder := filepath.Clean(githubFolder)
136+
normalizedFullPath := filepath.Clean(fullPath)
137+
138+
// Check if fullPath is within githubFolder
139+
relativePath, err := filepath.Rel(normalizedGithubFolder, normalizedFullPath)
140+
if err != nil || relativePath == ".." || strings.HasPrefix(relativePath, ".."+string(filepath.Separator)) || filepath.IsAbs(relativePath) {
141+
remoteLog.Printf("Security: Path escapes .github folder: %s (resolves to: %s)", filePath, relativePath)
142+
return "", fmt.Errorf("Security: Path %s must be within .github folder (resolves to: %s)", filePath, relativePath)
143+
}
144+
120145
if _, err := os.Stat(fullPath); os.IsNotExist(err) {
121146
remoteLog.Printf("Local file not found: %s", fullPath)
122147
// Return a simple error that will be wrapped with source location by the caller

pkg/workflow/expression_validation.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,16 @@ func validateRuntimeImportFiles(markdownContent string, workspaceDir string) err
412412
githubFolder := filepath.Join(workspaceDir, ".github")
413413
absolutePath := filepath.Join(githubFolder, normalizedPath)
414414

415+
// Security check: ensure the resolved path is within the .github folder
416+
// Use filepath.Rel to check if the path escapes the .github folder
417+
normalizedGithubFolder := filepath.Clean(githubFolder)
418+
normalizedAbsolutePath := filepath.Clean(absolutePath)
419+
relativePath, err := filepath.Rel(normalizedGithubFolder, normalizedAbsolutePath)
420+
if err != nil || relativePath == ".." || strings.HasPrefix(relativePath, ".."+string(filepath.Separator)) || filepath.IsAbs(relativePath) {
421+
validationErrors = append(validationErrors, fmt.Sprintf("%s: Security: Path must be within .github folder (resolves to: %s)", filePath, relativePath))
422+
continue
423+
}
424+
415425
// Check if file exists
416426
if _, err := os.Stat(absolutePath); os.IsNotExist(err) {
417427
// Skip validation for optional imports ({{#runtime-import? ...}})

0 commit comments

Comments
 (0)