Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Implementation Plan for Non-Polluting Init

The goal is to ensure that running objectdocs init in any GitHub project does not pollute the project root directory. All documentation-related files should be contained within the content/ folder.

Changes Made:

  • ✅ Analyzed current init command behavior
  • ✅ Modified init command to create/update content/package.json with npm scripts
  • ✅ Fixed init command to properly await npm install completion
  • ✅ Verified dev, build, and start commands work with the new structure (no changes needed)
  • ✅ Updated test scripts to validate new behavior and detect monorepo correctly
  • ✅ Updated README.md with new usage instructions for both existing projects and new standalone projects
  • ✅ Updated examples/starter documentation to reflect new structure
  • ✅ Restored original ObjectDocs project documentation (this repo's own docs)
  • ✅ Tested and validated complete workflow

Implementation Details:

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

  • Creates content/package.json with scripts that reference .objectdocs subdirectory
  • Added proper async/await to ensure npm install completes before returning
  • Adds both content/.objectdocs and content/node_modules to .gitignore

Test Script (test-quick.sh):

  • Fixed monorepo detection to run before changing directories
  • Now properly uses local CLI version during tests

Documentation:

  • README.md updated with two usage patterns (existing projects vs new standalone)
  • examples/starter updated with new structure and convenience scripts

Important Note:

  • The /content directory in the ObjectDocs repository itself contains the project's own documentation and was accidentally modified during initial testing
  • These files have been restored to their original state

Expected Outcome:

After running objectdocs init:

  • content/package.json exists with proper scripts (dev, build, start)
  • content/.objectdocs/ contains the Next.js site engine
  • content/.objectdocs and content/node_modules are gitignored
  • Root directory remains clean (only original project files)
  • All build outputs go to appropriate locations within content/

Testing:

  • ✅ All tests pass (quick build test validates complete flow)
  • ✅ Code review completed with no issues
  • ✅ No security vulnerabilities detected
  • ✅ Manual verification confirms proper isolation of documentation files
  • ✅ Original ObjectDocs project documentation restored
Original prompt

我应该在任何GitHub项目执行init命令,package.json应该初始化在 content 文件夹下, fumadocs nextjs 项目 site 复制到 content/.objectdocs ,整个文档开发过程不要污染项目根目录。


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@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 10:35am

Request Review

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

@copilot 继续

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot 继续

Completed! The implementation is now fully working:

objectdocs init creates content/package.json with proper scripts
✅ All files are isolated in the content/ directory
✅ Root directory remains clean
✅ Test suite passes successfully

You can now use objectdocs init in any GitHub project without polluting the root directory. All documentation-related files will be contained in the content/ folder.

Commit: 2be2a4e

Copilot AI changed the title [WIP] Initialize package.json in content folder Initialize package.json in content folder Jan 22, 2026
Copilot AI requested a review from xuyushun441-sys January 22, 2026 09:11
@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 #32

@github-actions github-actions bot added documentation Improvements or additions to documentation dependencies labels Jan 22, 2026
@hotlong
Copy link
Contributor

hotlong commented Jan 22, 2026

@copilot 注意,当前项目的 /content 目录不是给模版项目用的,是为了写当前项目的文档。

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

Copilot AI commented Jan 22, 2026

@copilot 注意,当前项目的 /content 目录不是给模版项目用的,是为了写当前项目的文档。

已修复!之前的测试不小心修改了 ObjectDocs 项目自己的文档内容(content/docs/ 目录)。现在已经恢复到原始状态。

(Fixed! The previous testing accidentally modified ObjectDocs project's own documentation content in content/docs/. It has now been restored to the original state.)

Commit: 2219503

@hotlong hotlong marked this pull request as ready for review January 22, 2026 11:31
Copilot AI review requested due to automatic review settings January 22, 2026 11:31
@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 #32

@hotlong hotlong merged commit a92030d into main Jan 22, 2026
12 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the ObjectDocs init flow so that running objectdocs init in any GitHub project keeps the project root clean by installing the documentation engine and scripts entirely under content/.

Changes:

  • Updated the CLI init command to scaffold content/.objectdocs, create or update content/package.json with dev/build/start scripts, and add appropriate entries to .gitignore, while properly awaiting npm install.
  • Adjusted the quick test script and starter example to build and run the site from content/, aligning tests and docs with the new non-polluting structure.
  • Refreshed the main README and starter README to describe the new usage patterns for existing projects and standalone docs projects.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test-quick.sh Fixes monorepo root detection and updates the quick build test to initialize ObjectDocs, then build from content/ and assert output in content/.objectdocs/.next, validating the new layout.
pnpm-lock.yaml Enables autoInstallPeers in pnpm settings, affecting dependency resolution across the monorepo.
packages/cli/src/commands/init.mjs Changes the init command to work under content/ (creating content if needed), copy the site into content/.objectdocs, manage content/package.json scripts, update .gitignore, and await npm install completion.
examples/starter/package.json Updates example scripts so dev, build, and start run via cd content && npm run ..., delegating to the new content/package.json-managed scripts.
examples/starter/README.md Documents the new starter structure (including content/package.json) and updates getting-started, build, and run instructions to match the content-based workflow.
README.md Rewrites the Quick Start to emphasize initializing in any existing project without polluting the root, explains content/package.json and .objectdocs, and adds a standalone-project flow with updated scripts and project structure.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +125 to 131
Initialize ObjectDocs:

```bash
pnpm dev
npm run init
# or
npx objectdocs init
```
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The instructions here recommend running npm run init, but the earlier scripts snippet for a new standalone project only defines dev, build, and start scripts and does not include an init script. Either the scripts example should add an init script, or this command should be updated to use the CLI directly (for example via npx @objectdocs/cli init), otherwise npm run init will fail for users following these steps.

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +9
"dev": "cd content && npm run dev",
"build": "cd content && npm run build",
"start": "cd content && npm run start"
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

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

The build script here has been changed to "build": "cd content && npm run build", but the starter README still references "build": "objectdocs build" and mentions Vercel using pnpm build (via objectdocs build) with .next at the project root. Please update the README (including the troubleshooting and Vercel deployment sections) so the documented scripts and expected output directory match this new script-based flow.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants