fix(workspace): preserve existing CLAUDE.md and AGENTS.md on init#63
Merged
fix(workspace): preserve existing CLAUDE.md and AGENTS.md on init#63
Conversation
When running `workspace init`, skip copying agent files from the template source if they already exist in the target directory. Existing files still receive WORKSPACE-RULES injection (append) without losing user content. Closes #62 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Deploying allagents with
|
| Latest commit: |
d0bc1c0
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6b7f3f76.allagents.pages.dev |
| Branch Preview URL: | https://fix-62-preserve-agent-files.allagents.pages.dev |
Tests asserting "non-workspace dir" behavior were inheriting the test runner's cwd which may contain .allagents/workspace.yaml, causing the "No plugins configured" path to be skipped. Set cwd to the temp directory so tests are isolated from the project's own workspace config. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…NTS.md Runs the built CLI binary with `workspace init --from` against a directory that already has CLAUDE.md/AGENTS.md and asserts the original content is preserved while WORKSPACE-RULES are appended. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The unit test in workspace-init-preserve.test.ts already calls initWorkspace() directly and covers the same code path without requiring a pre-built binary. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
These tests spawned `node dist/index.js` and required a build step before running. They were also brittle (cwd leaked project state into "non-workspace" assertions). Remove them; the enriched-help and metadata tests in tests/unit/ and tests/e2e/cli-enriched-help.test.ts cover the same logic by importing source directly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace removed e2e binary-spawning tests with unit tests that import source directly: - agent-help: flag extraction, command metadata completeness, options/positionals - json-output: flag extraction and position flexibility The --help output tests are not replaced since they tested cmd-ts framework behavior, not our code. cli-enriched-help.test.ts already covers our metadata structure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
workspace initno longer overwrites existing CLAUDE.md or AGENTS.md files when copying from a template source (local or GitHub)Closes #62
Test plan
--from--from🤖 Generated with Claude Code