Skip to content

Commit 6604d3a

Browse files
feat: add AGENTS.md files for various rules and guidelines; enhance search bar functionality for release notes (#339)
1 parent df9ec3b commit 6604d3a

File tree

7 files changed

+120
-0
lines changed

7 files changed

+120
-0
lines changed

.roo/rules-architect/AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
- Theme components swizzled from Docusaurus core; modifying requires understanding [src/theme/](src/theme/) override hierarchy.
6+
- Sitemap uses custom plugin ([docusaurus.config.ts](docusaurus.config.ts:94-107)) filtering "/page/" URLs; preset sitemap disabled. Don't re-enable preset.
7+
- Redirects required when moving docs ([docusaurus.config.ts](docusaurus.config.ts:109-271)); onBrokenLinks won't fail builds but creates poor UX.
8+
- Constants centralized in [src/constants.ts](src/constants.ts) for all external URLs. Never hardcode URLs in config or components.
9+
- PostHog analytics conditionally loaded based on env var ([docusaurus.config.ts](docusaurus.config.ts:84-93)); architectural decision for privacy/GDPR.
10+
- Search uses local plugin (@easyops-cn/docusaurus-search-local) with docsRouteBasePath "/" - maintain consistency.
11+
- No blog feature (disabled in preset); this is pure documentation site, not a content platform.

.roo/rules-ask/AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
- Docusaurus docs, not source code. This is documentation for the Roo Code VS Code extension at docs.roocode.com.
6+
- Legacy [Rakefile](Rakefile) is from old Jekyll site. Ignore it; current build uses Docusaurus/npm scripts.
7+
- Tutorial videos defined in [docs/tutorial-videos.json](docs/tutorial-videos.json), dynamically loaded in [sidebars.ts](sidebars.ts:37-42). Titles truncated to 40 chars.
8+
- Release notes have thanking exclusions: don't thank daniel-lxs, cte, hannesrudolph, jr, roomote, app/roomote, dleffel, mrubens per [.roorules](.roorules:14).
9+
- Many docs moved; check redirects in [docusaurus.config.ts](docusaurus.config.ts:109-271) when referencing old paths.
10+
- Context7 MCP configured in [.roo/mcp.json](.roo/mcp.json) with library ID "/facebook/docusaurus" for structural research.
11+
- Sidebar structure in [sidebars.ts](sidebars.ts) has nested categories; update-notes organized by major.minor versions.

.roo/rules-code/AGENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
- Linting targets only /src; docs are excluded. Use "npm run lint:unused" to enforce removal of unused imports. See [package.json](package.json).
6+
- Type checking uses tsc only (no emit); [tsconfig.json](tsconfig.json) is editor-focused. Run "npm run typecheck" locally; CI does not typecheck.
7+
- Use Docusaurus @site alias for cross-root imports from theme/MDX; example at [src/theme/MDXComponents.ts](src/theme/MDXComponents.ts:2).
8+
- Centralize external URLs in [src/constants.ts](src/constants.ts); consumed by [docusaurus.config.ts](docusaurus.config.ts:21) for navbar/footer.
9+
- When moving docs, add redirects in [docusaurus.config.ts](docusaurus.config.ts:109); onBrokenLinks is warn ([docusaurus.config.ts](docusaurus.config.ts:40)) so missing redirects won’t fail CI.
10+
- Internal doc links must be absolute and extensionless per [.roorules](.roorules) (e.g., /basic-usage/how-tools-work).
11+
- Images in docs must use HTML tags: <img src="/img/...png" alt="..." width="600" /> (Markdown image syntax is disallowed).
12+
- Builds preload dotenv; PostHog plugin loads only when POSTHOG_API_KEY is set. Use [.env.example](.env.example). See [docusaurus.config.ts](docusaurus.config.ts:83) and [package.json](package.json:7).
13+
- Use Node 20 locally to match CI ([.github/workflows/docusaurus-build.yml](.github/workflows/docusaurus-build.yml:23)); package engines allow >=18.
14+
- “Tutorial Videos” sidebar is driven by [docs/tutorial-videos.json](docs/tutorial-videos.json); titles truncated to 40 chars in [sidebars.ts](sidebars.ts:5).

.roo/rules-debug/AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
- CI only builds, doesn't lint/typecheck ([.github/workflows/docusaurus-build.yml](.github/workflows/docusaurus-build.yml:29)). Run "npm run lint" and "npm run typecheck" locally before pushing.
6+
- PostHog analytics silently skips if POSTHOG_API_KEY missing. Check [.env](.env) exists with key from [.env.example](.env.example).
7+
- No test framework configured. Scripts exist in package.json but no test files or jest/vitest config present.
8+
- Docusaurus dev server at localhost:3000. Hot reload may fail for theme swizzled components; restart if changes don't appear.
9+
- onBrokenLinks set to "warn" ([docusaurus.config.ts](docusaurus.config.ts:40)) - broken links won't fail build but check console warnings.
10+
- Node version mismatch (engines >=18, CI uses 20) can cause subtle differences. Use Node 20 locally.

AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to agents when working with code in this repository.
4+
5+
Non-obvious, project-specific rules:
6+
7+
- Start/build preload dotenv; analytics plugin is enabled only when POSTHOG_API_KEY is set. Use .env based on [.env.example](.env.example). CI injects it in [.github/workflows/docusaurus-build.yml](.github/workflows/docusaurus-build.yml). See [package.json](package.json) and [docusaurus.config.ts](docusaurus.config.ts).
8+
- Use Node 20 locally to match CI; engines allow >=18 but CI runs 20.
9+
- Linting targets only /src; docs content is not linted. Use "npm run lint:unused" to enforce unused import removal. Type checking uses "tsc" only (no emit); [tsconfig.json](tsconfig.json) is editor-focused.
10+
- When moving/renaming docs, you must add an explicit redirect in [docusaurus.config.ts](docusaurus.config.ts) under plugin-client-redirects. This is required by [.roorules](.roorules).
11+
- Internal doc links must be absolute and extensionless per [.roorules](.roorules) (example: /basic-usage/how-tools-work). Do not include ".md".
12+
- Images in docs must use HTML tags per [.roorules](.roorules): <img src="/img/...png" alt="..." width="600" />.
13+
- Sitemap: preset sitemap is disabled; a custom plugin is configured in [docusaurus.config.ts](docusaurus.config.ts) to filter URLs containing "/page/". Do not re-enable the preset sitemap.
14+
- Local search plugin is configured with docsRouteBasePath "/". Keep routeBasePath "/" consistent when adding content or links.
15+
- "Tutorial Videos" sidebar is generated from [docs/tutorial-videos.json](docs/tutorial-videos.json); titles are truncated to 40 chars in [sidebars.ts](sidebars.ts). Modify the JSON to add/remove videos.
16+
- Navigation/footer links are centralized in [src/constants.ts](src/constants.ts) and consumed by [docusaurus.config.ts](docusaurus.config.ts). Update constants rather than hardcoding URLs.
17+
- Legacy [Rakefile](Rakefile) is unrelated (Jekyll). Do not use it; all builds run through Docusaurus scripts.
18+
- For structural/formatting research, use Context7 MCP (ID "/facebook/docusaurus") via [.roo/mcp.json](.roo/mcp.json); see [.roorules](.roorules).
19+
- CI only builds (no lint/typecheck). Run lint and typecheck locally to catch issues CI won't.

docusaurus.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ const config: Config = {
7676
highlightSearchTermsOnTargetPage: true,
7777
explicitSearchResultPath: true,
7878
docsRouteBasePath: "/",
79+
searchContextByPaths: [
80+
{ label: "Getting Started", path: "getting-started" },
81+
{ label: "Basic Usage", path: "basic-usage" },
82+
{ label: "Features", path: "features" },
83+
{ label: "Advanced Usage", path: "advanced-usage" },
84+
{ label: "Providers", path: "providers" },
85+
{ label: "Roo Code Cloud", path: "roo-code-cloud" },
86+
{ label: "Release Notes", path: "update-notes" }
87+
],
88+
useAllContextsWithNoSearchContext: true,
7989
},
8090
],
8191
],

src/theme/SearchBar/index.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
import Link from '@docusaurus/Link';
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4+
import {useLocation} from '@docusaurus/router';
5+
import OriginalSearchBar from '@theme-original/SearchBar';
6+
7+
type Props = React.ComponentProps<typeof OriginalSearchBar>;
8+
9+
export default function SearchBarWrapper(props: Props) {
10+
const {
11+
siteConfig: {baseUrl},
12+
} = useDocusaurusContext();
13+
const location = useLocation();
14+
15+
// When on /update-notes/*, show a clear "scope indicator" and a shortcut to search the whole docs
16+
const inReleaseNotes =
17+
location.pathname === `${baseUrl}update-notes` ||
18+
location.pathname.startsWith(`${baseUrl}update-notes/`);
19+
20+
const searchEverywhereHref = `${baseUrl}search/`;
21+
22+
return (
23+
<div style={{display: 'flex', alignItems: 'center', gap: '0.5rem'}}>
24+
<OriginalSearchBar {...props} />
25+
{inReleaseNotes && (
26+
<span
27+
className="badge badge--secondary"
28+
title="Search currently scoped to Release Notes on this page"
29+
>
30+
Release Notes
31+
</span>
32+
)}
33+
{inReleaseNotes && (
34+
<Link
35+
className="button button--link"
36+
href={searchEverywhereHref}
37+
title="Open full-site search (all docs)"
38+
style={{marginLeft: '0.25rem'}}
39+
>
40+
Search everywhere
41+
</Link>
42+
)}
43+
</div>
44+
);
45+
}

0 commit comments

Comments
 (0)