Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import sitemap from '@astrojs/sitemap';
import starlightLlmsTxt from 'starlight-llms-txt';
import starlightLinksValidator from 'starlight-links-validator';
import starlightGitHubAlerts from 'starlight-github-alerts';
import starlightBlog from 'starlight-blog';
Expand Down Expand Up @@ -288,28 +287,6 @@ export default defineConfig({
starlightLinksValidator({
errorOnRelativeLinks: true,
errorOnLocalLinks: true,
}),
starlightLlmsTxt({
description: 'GitHub Agentic Workflows (gh-aw) is a Go-based GitHub CLI extension that enables writing agentic workflows in natural language using markdown files, and running them as GitHub Actions workflows.',
optionalLinks: [
{
label: 'GitHub Repository',
url: 'https://github.com/github/gh-aw',
description: 'Source code and development resources for gh-aw'
},
{
label: 'GitHub CLI Documentation',
url: 'https://cli.github.com/manual/',
description: 'Documentation for the GitHub CLI tool'
}
],
customSets: [
{
label: "agentic-workflows",
paths: ['blog/*meet-the-workflows*'],
description: "A comprehensive blog series documenting workflow patterns, best practices, and real-world examples of agentic workflows created at Peli's Agent Factory"
}
]
})
],
sidebar: [
Expand Down
177 changes: 0 additions & 177 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"starlight-blog": "^0.26.1",
"starlight-changelogs": "^0.5.0",
"starlight-links-validator": "^0.24.0",
"starlight-llms-txt": "^0.10.0",
"yaml": "^2.9.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion docs/public/.well-known/ai.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# GitHub Agentic Workflows - AI crawler permissions
Allow: /
Llms-txt: https://github.github.com/gh-aw/llms.txt
Llms-full-txt: https://github.github.com/gh-aw/llms-full.txt
Agents-txt: https://github.github.com/gh-aw/agents.txt
Summary: https://github.github.com/gh-aw/ai/summary.json
2 changes: 1 addition & 1 deletion docs/src/content/docs/agent-factory-status.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ These are experimental agentic workflows used by the GitHub Next team to learn,
| [Daily Agent of the Day Blog Writer](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-agent-of-the-day-blog-writer.md) | copilot | [![Daily Agent of the Day Blog Writer](https://github.com/github/gh-aw/actions/workflows/daily-agent-of-the-day-blog-writer.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-agent-of-the-day-blog-writer.lock.yml) | - | - |
| [Daily Agentic Workflow AIC Usage Audit](https://github.com/github/gh-aw/blob/main/.github/workflows/agentic-token-audit.md) | copilot | [![Daily Agentic Workflow AIC Usage Audit](https://github.com/github/gh-aw/actions/workflows/agentic-token-audit.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/agentic-token-audit.lock.yml) | `daily around 12:00 on weekdays` | - |
| [Daily AgentRx Trace Optimizer](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-agentrx-trace-optimizer.md) | claude | [![Daily AgentRx Trace Optimizer](https://github.com/github/gh-aw/actions/workflows/daily-agentrx-trace-optimizer.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-agentrx-trace-optimizer.lock.yml) | - | - |
| [Daily AIC Consumption Report (Sentry OTel)](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-token-consumption-report.md) | claude | [![Daily AIC Consumption Report (Sentry OTel)](https://github.com/github/gh-aw/actions/workflows/daily-token-consumption-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-token-consumption-report.lock.yml) | - | - |
| [Daily AIC Consumption Report (Sentry + Grafana OTel)](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-token-consumption-report.md) | claude | [![Daily AIC Consumption Report (Sentry + Grafana OTel)](https://github.com/github/gh-aw/actions/workflows/daily-token-consumption-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-token-consumption-report.lock.yml) | - | - |
| [Daily Ambient Context Optimizer](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-ambient-context-optimizer.md) | copilot | [![Daily Ambient Context Optimizer](https://github.com/github/gh-aw/actions/workflows/daily-ambient-context-optimizer.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-ambient-context-optimizer.lock.yml) | - | - |
| [Daily AstroStyleLite Markdown Spellcheck](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-astrostylelite-markdown-spellcheck.md) | claude | [![Daily AstroStyleLite Markdown Spellcheck](https://github.com/github/gh-aw/actions/workflows/daily-astrostylelite-markdown-spellcheck.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-astrostylelite-markdown-spellcheck.lock.yml) | - | - |
| [Daily AW Cross-Repo Compile Check](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-aw-cross-repo-compile-check.md) | claude | [![Daily AW Cross-Repo Compile Check](https://github.com/github/gh-aw/actions/workflows/daily-aw-cross-repo-compile-check.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-aw-cross-repo-compile-check.lock.yml) | - | - |
Expand Down
39 changes: 39 additions & 0 deletions docs/src/pages/_aw-prompts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Shared helper: reads all agent-optimised prompts from .github/aw/*.md and
* returns metadata needed to build llms.txt / agents.txt.
*/
import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';

export const RAW_BASE =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAW_BASE is hardcoded to the main branch: raw URLs will be stale/broken during branch builds and PR previews where new .github/aw/*.md files are added but not yet merged to main.

💡 Details

The constant https://raw.githubusercontent.com/github/gh-aw/main/.github/aw is baked in. A PR that adds a new prompt file will generate a llms.txt entry with a raw.githubusercontent.com/.../main/... URL that 404s until the PR merges. Any agent or tool consuming a preview deploy of the docs will follow a dead link.

Consider injecting the commit SHA at build time:

// Picks up GITHUB_SHA in CI, falls back to 'main' for local builds
const REF = process.env.GITHUB_SHA ?? 'main';
export const RAW_BASE =
    `https://raw.githubusercontent.com/github/gh-aw/${REF}/.github/aw`;

This ensures the generated index always points to the exact commit that was used to build it.

'https://raw.githubusercontent.com/github/gh-aw/main/.github/aw';

export interface AwPrompt {
file: string;
description: string;
rawUrl: string;
}

function parseFrontmatterDescription(content: string): string {
const match = content.match(/^---[\r\n]+([\s\S]*?)[\r\n]+---/);
if (!match) return '';
// Simple key extraction – avoids pulling in a YAML parser at this layer
const descMatch = match[1].match(/^description:\s*(.+)$/m);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAML-quoted description values will leak surrounding quotes into output: the regex captures the raw YAML value including any wrapping quote characters, so a description like description: "My prompt" renders as "My prompt" (with literal quotes) in the generated text files.

💡 Suggested fix

Strip wrapping single/double quotes after trimming:

const raw = descMatch[1].trim();
return raw.replace(/^(['"])(.*)\1$/, '$2');

All current .github/aw/*.md files use unquoted descriptions, so this is a latent defect. The first file that uses description: "My prompt" will silently publish the quotes verbatim in every AI crawler index.

return descMatch ? descMatch[1].trim() : '';
}

export function getAwPrompts(): AwPrompt[] {
// process.cwd() is the docs/ directory during `astro build`
const awDir = join(process.cwd(), '../.github/aw');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fragile CWD assumption: path resolution via process.cwd() will silently produce a wrong awDir (and crash the build) if astro build is ever invoked from a directory other than docs/.

💡 Suggested fix

Use import.meta.url to derive the path relative to the source file, which is immune to whatever the working directory happens to be:

import { fileURLToPath } from "node:url";
// ...
const awDir = fileURLToPath(new URL("../../../.github/aw", import.meta.url));

_aw-prompts.ts lives at docs/src/pages/, so three ../ steps land at the repo root and .github/aw is correct from there. This approach survives astro build being called from any working directory (e.g., repo root in a monorepo script or IDE task runner).

The comment documenting the assumption is a smell — if the code were robust, the comment would be unnecessary.

return readdirSync(awDir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readdirSync is shallow: existing .md files in subdirectories are silently omitted from the index: .github/aw/runbooks/ currently contains workflow-health.md (an actual operational guide), and .github/aw/imports/ may accumulate .md files over time. None of these will ever appear in llms.txt or agents.txt.

💡 Details

The intent seems to be indexing agent prompt files, and it is genuinely unclear whether runbooks/ and imports/ subdirectory content should be included. The problem is that the code has no explicit exclusion logic — it just accidentally excludes them because readdirSync is non-recursive and the .filter(f => f.endsWith('.md')) test only sees direct children.

Two options:

Option A – explicit shallow-only intention (add a comment):

// Intentionally shallow: only root-level prompt files, not subdirectories (runbooks/, imports/)
const awDir = ...;
return readdirSync(awDir)
    ...

Option B – recursive inclusion:

import { readdirSync, statSync, readFileSync } from 'node:fs';

function findMdFiles(dir: string): string[] {
    return readdirSync(dir).flatMap((f) => {
        const full = join(dir, f);
        return statSync(full).isDirectory()
            ? findMdFiles(full).map((sub) => join(f, sub))
            : f.endsWith('.md') ? [f] : [];
    });
}

The current code is a silent correctness hole: new files added to subdirectories will never appear in any published index without a code change.

.filter((f) => f.endsWith('.md'))
.sort()
.map((file) => {
const content = readFileSync(join(awDir, file), 'utf-8');
return {
file,
description: parseFrontmatterDescription(content),
rawUrl: `${RAW_BASE}/${file}`,
};
});
}
Comment on lines +25 to +39
26 changes: 26 additions & 0 deletions docs/src/pages/agents.txt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { APIRoute } from 'astro';
import { getAwPrompts } from './_aw-prompts.js';

export const GET: APIRoute = () => {
const prompts = getAwPrompts();

const lines = [
'# GitHub Agentic Workflows – Agent Prompts',
'',
'> Agent-optimised prompt files for GitHub Agentic Workflows (gh-aw).',
'> Use these files to ground AI agents working with gh-aw workflows.',
'',
'## Prompts',
'',
...prompts.map(({ file, description, rawUrl }) => {
const label = file.replace(/\.md$/, '');
return description
? `- [${label}](${rawUrl}): ${description}`
: `- [${label}](${rawUrl})`;
}),
];
Comment on lines +4 to +21
Comment on lines +7 to +21

return new Response(lines.join('\n'), {
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
});
};
Loading
Loading