Skip to content

feat: bundle version-matched docs into app-tools and generate AGENTS.md in @modern-js/create#8774

Open
keepview wants to merge 2 commits into
mainfrom
feat/agent-knowledge-supply
Open

feat: bundle version-matched docs into app-tools and generate AGENTS.md in @modern-js/create#8774
keepview wants to merge 2 commits into
mainfrom
feat/agent-knowledge-supply

Conversation

@keepview

Copy link
Copy Markdown
Contributor

Summary

Implements the agent knowledge supply design (AI governance M1, items #1+#2, design doc) — the Next.js-style bundled-docs + AGENTS.md approach (their eval: 100% vs 79% for knowledge skills).

Part A: docs bundled into the app-tools tarball

  • prepublishOnly runs scripts/copy-main-doc.mjs: copies packages/document/docs/en into the package as main-doc/docs/en (356 files, ~0.79MB). Ships only in published tarballs — the directory is gitignored, no Nx graph edge, no pnpm transitive-dep path issue (docs live inside the package every project depends on directly).
  • .npmignore re-includes main-doc/** (generic src//output/ patterns were swallowing 39 doc files).
  • scripts/check-doc-bundle.mjs validates: tarball file count == source, every @site-docs-en/* alias import resolves inside the bundle (code fences stripped; csr-auth sandbox refs whitelisted), size < 3MB.

Part B: agent files in @modern-js/create

  • Template ships AGENTS.md (managed BEGIN/END:modernjs-agent-rules marker block: read bundled docs → llms.txt fallback → skills, plus 4 key facts) and CLAUDE.md (@AGENTS.md).
  • --no-agents-md opts out; both files skipped in --sub mode (agent files belong to the monorepo root).
  • Success hint printed only when files are actually generated.
  • Parsing refactor + bugfix: only --lang/-l consumes a value now; boolean flags no longer swallow the following positional (previously create --sub my-app ignored my-app).
  • New rstest infra with 6 integration tests (default/skip/order/sub/lang matrix).

Docs

  • ai-coding-agents guide (zh+en): new "Bundled docs & AGENTS.md" section.

Verification

  • node scripts/check-doc-bundle.mjs → 356 files, 0.79MB, all imports resolvable
  • pnpm test in packages/toolkit/create → 6/6 pass
  • Manual E2E: default / --no-agents-md (both orders) / --sub / --lang zh
  • tsc --noEmit clean, biome clean

Related

…md in create

Part of AI governance M1 (agent knowledge supply):

- app-tools: prepublishOnly copies packages/document/docs/en into the
  tarball as main-doc/docs/en (mirrors @modern-js/main-doc layout), so
  every project gets offline docs that exactly match the installed
  version; .npmignore re-includes the bundle; scripts/check-doc-bundle.mjs
  validates file count, alias-import resolvability and size
- create: template ships AGENTS.md (managed marker block pointing agents
  at the bundled docs, falling back to llms.txt and skills) and CLAUDE.md;
  --no-agents-md opts out; both files are skipped in --sub mode
- create: positional-argument parsing refactored — only --lang/-l consumes
  a value; fixes boolean flags swallowing the following argument
  (previously `create --sub my-app` ignored my-app)
- create: add rstest test infra with 6 integration tests
- docs: ai-coding-agents guide documents the bundled docs and AGENTS.md
@changeset-bot

changeset-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cfa5452

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 118 packages
Name Type
@modern-js/app-tools Minor
@modern-js/create Minor
@modern-js/adapter-rstest Minor
@modern-js/plugin-bff Minor
@modern-js/plugin-ssg Minor
@modern-js/plugin-styled-components Minor
@modern-js/plugin-i18n Minor
@modern-js/image Minor
@modern-js/runtime Minor
@modern-js/plugin-polyfill Minor
@integration-test/alias-set Patch
app-document Patch
async-entry-test Patch
tmp Patch
bff-api-app Patch
bff-client-app Patch
bff-indep-client-app Patch
bff-hono Patch
integration-clean-dist-path Patch
integration-compatibility Patch
integration-custom-dist-path Patch
custom-file-system-entry Patch
integration-custom-template Patch
deploy Patch
deploy-server Patch
dev-server Patch
integration-disable-html Patch
entries-app-builder Patch
app-custom-entries Patch
app-custom-routes-runtime Patch
app-custom Patch
app-entry Patch
app-route Patch
app-entry-server Patch
i18n-app-csr-html-lang Patch
i18n-app Patch
i18n-app-ssr-html-lang Patch
i18n-app-ssr Patch
i18n-custom-i18n-wrapper Patch
i18n-mf-app-provider Patch
i18n-mf-component-provider Patch
i18n-mf-consumer Patch
i18n-routes Patch
i18n-routes-ssr Patch
@integration-test/image-component Patch
main-entry-name Patch
nonce Patch
pure-esm-project Patch
react-compiler-test Patch
routes-match Patch
routes Patch
app-rsbuild-hooks Patch
rsc-csr-app Patch
rsc-csr-routes Patch
rsc-ssr-app Patch
rsc-ssr-routes Patch
basic-app-rstest-browser Patch
basic-app-rstest Patch
runtime-custom-plugin Patch
runtime-custom-config-plugin Patch
select-mul-entry-test Patch
select-one-entry-test Patch
server-config Patch
server-json-script Patch
server-monitors Patch
server-prod Patch
server-routes Patch
@source-code-build/app Patch
ssg-fixtures-mega-list-routes Patch
ssg-fixtures-nested-routes Patch
ssg-fixtures-simple Patch
ssg-fixtures-web-server Patch
ssr-base-async-entry-test Patch
ssr-base-async-pre-entry-test Patch
ssr-base-json-test Patch
ssr-base-test Patch
ssr-base-fallback-test Patch
init Patch
ssr-base-loadable Patch
ssr-partial-test Patch
rsc-closing-tags-test Patch
ssr-script-loading Patch
ssr-useid-test Patch
ssr-streaming-inline-test Patch
ssr-streaming-lazy-test Patch
ssr-streaming-test Patch
styled-components-stream Patch
styled-components-string Patch
integration-tailwindcss-v2 Patch
integration-tailwindcss-v3 Patch
integration-tailwindcss-v4-tools Patch
integration-tailwindcss-v4 Patch
tmp-dir Patch
write-to-dist Patch
@modern-js/bundle-diff-benchmark Minor
@modern-js/sandpack-react Minor
@modern-js/main-doc Minor
@modern-js/tsconfig Minor
@modern-js/builder Minor
@modern-js/plugin-data-loader Minor
@modern-js/render Minor
@modern-js/bff-core Minor
@modern-js/bff-runtime Minor
@modern-js/server-core Minor
@modern-js/create-request Minor
@modern-js/prod-server Minor
@modern-js/server-runtime Minor
@modern-js/server Minor
@modern-js/server-utils Minor
@modern-js/i18n-utils Minor
@modern-js/plugin Minor
@modern-js/runtime-utils Minor
@modern-js/types Minor
@modern-js/utils Minor
@modern-js/rslib Minor
@scripts/prebundle Patch
@scripts/rstest-config Patch
@scripts/release-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for modernjs-byted ready!

Name Link
🔨 Latest commit cfa5452
🔍 Latest deploy log https://app.netlify.com/projects/modernjs-byted/deploys/6a574be7a8787c00080d67f3
😎 Deploy Preview https://deploy-preview-8774--modernjs-byted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Exclude community/, tutorials/ and plugin/ from the bundled docs —
agents rarely need them while coding and llms.txt covers them online.
Bundle: 356 -> 323 files, 0.79MB -> 0.67MB unpacked (~205KB gzipped
transfer). Size limit tightened to 2MB.
@keepview

Copy link
Copy Markdown
Contributor Author

Trimmed the bundle per size review: excluded community/ (7.7%), plugin/ (7.2%) and tutorials/ (0.3%) — sections agents rarely need while coding, with llms.txt as the online fallback. 356 → 323 files, 0.79MB → 0.67MB unpacked, ~205KB gzipped transfer increment. All alias imports still resolve (check-doc-bundle green); size limit tightened to 2MB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant