Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Adjust example running architecture - CLI copies site to content/.objectdocs

This PR restructures the ObjectDocs architecture to use a local copy of the site engine, providing better isolation and version control.

Changes Made

  1. New init Command (packages/cli/src/commands/init.mjs):

    • Copies @objectdocs/site package to content/.objectdocs
    • Installs dependencies with --legacy-peer-deps flag
    • Automatically adds content/.objectdocs to .gitignore (creates file if needed, prevents duplicates)
    • Uses line-by-line checking to prevent false positives in duplicate detection
    • Provides user feedback during initialization
  2. Updated CLI Commands:

    • dev.mjs: Uses content/.objectdocs as the Next.js app directory
    • build.mjs: Uses content/.objectdocs as the Next.js app directory
    • start.mjs: Uses content/.objectdocs as the Next.js app directory
    • All commands validate .objectdocs exists and provide helpful error messages
  3. Documentation Updates:

    • Main README.md: Added init step to Quick Start guide, notes automatic .gitignore update
    • packages/cli/README.md: Documented the new init command with .gitignore feature
    • examples/starter/README.md: Updated installation and testing instructions
    • All READMEs show updated project structure with .objectdocs directory
  4. Updated .gitignore Files:

    • Root .gitignore: Excludes content/.objectdocs
    • examples/starter/.gitignore: Excludes content/.objectdocs
    • Init command automatically manages user's .gitignore
  5. CI/CD Fixes:

    • Updated CI workflow to use build:site for monorepo builds
    • This allows CI to build the site package directly without requiring init

New Workflow

Users now follow this workflow:

  1. Create project and install @objectdocs/cli
  2. Run pnpm objectdocs init to initialize the site engine locally
    • The command automatically adds content/.objectdocs to .gitignore
  3. Use pnpm dev, pnpm build, pnpm start as usual

Monorepo Development

For monorepo development and CI:

  • Use pnpm run build:site to build the site package directly
  • This bypasses the need for init in the monorepo context

Testing

  • ✅ Init command successfully copies site and installs dependencies
  • ✅ Init command automatically adds entry to .gitignore
  • ✅ Init command handles existing .gitignore files correctly
  • ✅ Init command creates .gitignore if it doesn't exist
  • ✅ Init command prevents duplicate entries (line-by-line checking)
  • ✅ Init command correctly distinguishes entry in comments vs. actual entry
  • ✅ Dev server starts correctly using local .objectdocs
  • ✅ Build completes successfully using local .objectdocs
  • ✅ CI build works with build:site command
  • ✅ Tested in both monorepo root and examples/starter directories
  • ✅ Code review passed with no issues
  • ✅ No security vulnerabilities detected
Original prompt

调整example 运行架构,cli 初始化把site复制到content/.objectdocs ,然后重新调整所有的dev build命令


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel
Copy link

vercel bot commented Jan 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
objectdocs-site Ready Ready Preview, Comment Jan 22, 2026 4:28am

Request Review

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
@hotlong
Copy link
Contributor

hotlong commented Jan 22, 2026

@copilot 继续

@hotlong
Copy link
Contributor

hotlong commented Jan 22, 2026

@copilot 注意添加 gitignore,包括在init命令中

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot 继续

已完成!实现已完成并测试通过。

The architecture adjustment is now complete (commit 82f6f70). The new workflow:

  1. Run pnpm objectdocs init to copy the site engine to content/.objectdocs
  2. Use pnpm dev, pnpm build, pnpm start as before

All commands now use the local .objectdocs directory, and documentation has been updated.

Copilot AI changed the title [WIP] Adjust example runtime architecture and CLI initialization Adjust example runtime architecture and CLI initialization Jan 22, 2026
Copilot AI requested a review from hotlong January 22, 2026 03:48
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot 注意添加 gitignore,包括在init命令中

已添加!The init command now automatically adds content/.objectdocs to .gitignore (commit aff642c).

功能:

  • 自动检测并更新 .gitignore 文件
  • 如果文件不存在会自动创建
  • 防止重复添加条目
  • 添加时会显示确认消息

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title Adjust example runtime architecture and CLI initialization Adjust example runtime architecture and CLI initialization with automatic .gitignore management Jan 22, 2026
@github-actions
Copy link

🚀 Preview Deployment

This pull request will be automatically deployed to Vercel.

Preview Links

  • 📝 Documentation: Will be available once Vercel deployment completes
  • 🌍 Languages: English (/en/docs) and Chinese (/cn/docs)

Build Status

Check the CI workflow for build status and any errors.


Automated preview information for PR #29

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 22, 2026
@huangyiirene
Copy link
Contributor

@copilot fix build

Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot fix build

Fixed! The CI build now uses build:site command (commit 3ad7452).

The issue was that the new architecture requires objectdocs init to be run before building, but in the monorepo/CI context, we should build the site package directly using pnpm run build:site instead.

@github-actions
Copy link

🚀 Preview Deployment

This pull request will be automatically deployed to Vercel.

Preview Links

  • 📝 Documentation: Will be available once Vercel deployment completes
  • 🌍 Languages: English (/en/docs) and Chinese (/cn/docs)

Build Status

Check the CI workflow for build status and any errors.


Automated preview information for PR #29

@huangyiirene huangyiirene marked this pull request as ready for review January 22, 2026 04:38
@huangyiirene huangyiirene merged commit fd10c85 into main Jan 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants