Skip to content

Commit d1d7415

Browse files
MohabMohieclaude
andauthored
Retire Netlify: relocate shared AutoBot modules to shared/, delete netlify/ + netlify.toml (#864) (#878)
Option B (full retirement) per owner's issue decision. netlify/functions/ was not dead code: functions/api/gemini-proxy.js (the live Cloudflare AutoBot proxy) and the build-time index generators (scripts/build-autobot- index.mjs, scripts/build-llms-txt.mjs) both import from it. - Relocate the 5 live modules (autobot-core.mjs, github-context.mjs, docs-retrieval.mjs, docs-loader.mjs, constants.mjs) to a new top-level shared/ directory -- not functions/, which is a routing-sensitive path for this repo's Cloudflare Pages Functions convention. shared/ reflects that these modules serve both the worker runtime and build-time scripts, not just one. - Delete the dead netlify/functions/gemini-proxy.mjs handler (superseded by functions/api/gemini-proxy.js; nothing imported it). - Update every importer: functions/api/gemini-proxy.js, scripts/build- autobot-index.mjs, scripts/build-llms-txt.mjs, tests/docs-loader.test.js, tests/enhanced-instruction.test.js, demo-autobot-approach.mjs. - Fix shared/docs-loader.mjs's currentDir-relative paths to snippets.json and docs/ for the new (one level shallower) location. - Delete the now-empty netlify/ directory and netlify.toml (its redirects were already fully mirrored by docusaurus.config.js's plugin-client-redirects). - Sync docs/maintainers/site-operations.md and README.md to drop retired Netlify build/hosting references; update docusaurus.config.js's redirect comment to stop citing netlify.toml as authoritative. Verified: yarn build (regenerates static/autobot-index.json, 1,992,757 bytes), yarn test, yarn typecheck, yarn test:playwright (12/12), docs- quality.test.js, and check-doc-duplicates.mjs all green. Closes #864 Claude-Session: https://claude.ai/code/session_01V6zjrMRZpHqfeem4PkCkLn Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 3ac4191 commit d1d7415

16 files changed

Lines changed: 23 additions & 250 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ as the engine change and link the engine pull request.
4646

4747
GitHub Pages publishes the public guide at `https://shafthq.github.io/`.
4848
Cloudflare Workers hosts the AutoBot backend API and can serve the same static
49-
build as a mirror; Netlify can still host preview/static mirrors.
49+
build as a mirror.

demo-autobot-approach.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* 3. Key SHAFT topics are included in the context
88
*/
99

10-
import { loadDocumentation, getGitHubRepositoryContext } from './netlify/functions/docs-loader.mjs';
10+
import { loadDocumentation, getGitHubRepositoryContext } from './shared/docs-loader.mjs';
1111

1212
console.log('===========================================');
1313
console.log('AutoBot Documentation-Based Approach Demo');

docs/maintainers/site-operations.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Documentation site operations
44
description: Develop, validate, and deploy the canonical SHAFT documentation site.
55
slug: /maintainers/site-operations
66
sidebar_position: 2
7-
tags: [maintainers, docusaurus, cloudflare-workers, github-pages, netlify]
7+
tags: [maintainers, docusaurus, cloudflare-workers, github-pages]
88
---
99

1010
# Documentation site operations
@@ -33,10 +33,6 @@ uploads `build/` through `[assets]`, and routes `/api/gemini-proxy` through
3333
`worker/index.js`. Set `YARN_VERSION=1.22.22` and `GEMINI_API_KEY` in
3434
Cloudflare environment variables; do not commit secrets.
3535

36-
Netlify uses `yarn build`, publishes `build/`, and serves functions from
37-
`netlify/functions/`. `GEMINI_API_KEY` belongs in the Netlify environment; it
38-
must never be embedded in the browser bundle.
39-
4036
GitHub Pages uses `.github/workflows/deploy.yml` and publishes `build/` as the
4137
canonical public guide at `https://shafthq.github.io/`.
4238

@@ -87,8 +83,8 @@ AutoBot indexes Markdown and MDX by route and heading at startup, retrieves the
8783
eight best chunks for each question, and caps injected documentation context at
8884
80,000 characters. `yarn build` writes `static/autobot-index.json`; the
8985
Cloudflare function fetches that static index at runtime, so AutoBot does not
90-
depend on GitHub Pages server-side code or Netlify filesystem access.
91-
`EXCLUDED_DIRECTORIES` in `netlify/functions/docs-loader.mjs` excludes
86+
depend on GitHub Pages server-side code.
87+
`EXCLUDED_DIRECTORIES` in `shared/docs-loader.mjs` excludes
9288
`archive/` and `superpowers/` only -- `docs/maintainers/` is intentionally
9389
included per #795 ("make docs/maintainers/ fully public"), and
9490
`tests/docs-loader.test.js` asserts that inclusion; local search's
@@ -101,5 +97,6 @@ unchanged.
10197
- Reuse commands and dependency snippets from `src/components/DocSnippets`.
10298
- Put historical records under `docs/archive/`; archive routes are unlisted and
10399
emit `noindex`.
104-
- Add redirects in `netlify.toml` when replacing a public route.
100+
- Add redirects to the `plugin-client-redirects` config in
101+
`docusaurus.config.js` when replacing a public route.
105102
- Coordinate public behavior changes with a linked SHAFT_ENGINE pull request.

docusaurus.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,11 @@ const config = {
221221
require.resolve('@docusaurus/plugin-client-redirects'),
222222
/** @type {import('@docusaurus/plugin-client-redirects').Options} */
223223
({
224-
// GitHub Pages (the canonical host) can't serve netlify.toml's
225-
// server-side 301s, so this plugin emits static meta-refresh pages
226-
// for the same legacy URLs. Keep this list mirroring netlify.toml's
227-
// `[[redirects]]` entries — netlify.toml stays authoritative for the
228-
// secondary/fallback Netlify host.
224+
// GitHub Pages (the canonical, and since issue #864, only host)
225+
// can't serve server-side 301s, so this plugin emits static
226+
// meta-refresh pages for legacy URLs instead. This list is the
227+
// sole source of truth for redirects (netlify.toml, previously a
228+
// secondary/fallback host's redirect config, was retired in #864).
229229
createRedirects(existingPath) {
230230
const wildcardPrefixMap = {
231231
'/docs/reference/actions/': '/docs/Keywords/',

functions/api/gemini-proxy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createAutobotResponse } from '../../netlify/functions/autobot-core.mjs';
2-
import { getGitHubRepositoryContext } from '../../netlify/functions/github-context.mjs';
3-
import { loadDocumentationFromIndex } from '../../netlify/functions/docs-retrieval.mjs';
1+
import { createAutobotResponse } from '../../shared/autobot-core.mjs';
2+
import { getGitHubRepositoryContext } from '../../shared/github-context.mjs';
3+
import { loadDocumentationFromIndex } from '../../shared/docs-retrieval.mjs';
44

55
let cachedIndex = null;
66
let cachedGitHubContext = null;

netlify.toml

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

netlify/functions/gemini-proxy.mjs

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

scripts/build-autobot-index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {mkdir, writeFile} from 'node:fs/promises';
22
import path from 'node:path';
33
import {fileURLToPath} from 'node:url';
4-
import {buildDocumentationIndex} from '../netlify/functions/docs-loader.mjs';
4+
import {buildDocumentationIndex} from '../shared/docs-loader.mjs';
55

66
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
77
const outputPath = path.join(root, 'static', 'autobot-index.json');

scripts/build-llms-txt.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {mkdir, readFile, writeFile} from 'node:fs/promises';
22
import path from 'node:path';
33
import {fileURLToPath} from 'node:url';
4-
import {buildDocumentationIndex} from '../netlify/functions/docs-loader.mjs';
4+
import {buildDocumentationIndex} from '../shared/docs-loader.mjs';
55

66
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
77
const docsRoot = path.join(root, 'docs');

0 commit comments

Comments
 (0)