fix(project): refuse to re-init a project that lost its config.yaml - #260
Merged
Merged
Conversation
Every project-mode command auto-initializes when .skillshare/config.yaml is missing. That is right for a repository with no project directory at all, and for the shared skills repo produced by 'init -p --config local', which gitignores config.yaml so each developer regenerates their own. It was wrong for the case in between. A .skillshare/ that already held skills or agents, whose config.yaml was simply gone, was re-initialized into an empty config. Every configured target was dropped, the target symlinks were left behind pointing at a project the config no longer described, and the command exited 0. Nothing said anything had happened. Add ensureProjectConfig, which replaces the open-coded auto-init at every project command entry point. It initializes as before when there is no project directory, and when config.yaml is gitignored, so both intentional cases keep working untouched. When the directory holds skills or agents and its config is neither present nor gitignored, it now returns an error pointing at version control or an explicit 'skillshare init -p' instead of writing over the project. The gitignore check is treated as inconclusive on error, so a repository that cannot be inspected is guarded rather than overwritten.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
7 tasks
runkids
self-requested a review
August 6, 2026 02:49
runkids
approved these changes
Aug 7, 2026
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.
Type
proposals/only — see CONTRIBUTING.md)Linked Issue
Split out of #258 at your request — this is the missing-config guard on its own, with none of the visible-directory changes. #258 will be rebased on top of this so the feature can be reviewed separately.
Problem
Every project-mode command auto-initializes when
.skillshare/config.yamlis missing. That is right for a repository with no project directory at all, and for the shared skills repo produced byinit -p --config local, which gitignoresconfig.yamlso each developer regenerates their own.It was wrong for the case in between. A
.skillshare/that already held skills or agents, whoseconfig.yamlwas simply gone, was re-initialized into an empty config: every configured target dropped, target symlinks left behind pointing at a project the config no longer described, exit code 0, nothing reported.Approach
A new
ensureProjectConfighelper incmd/skillshare/mode.goreplaces the open-codedif !projectConfigExists { performProjectInit }pattern at every project entry point (17 call sites across 13 files — the same sites #258 touched, minus everything visible-directory related).It initializes exactly as before when there is no project directory, and when
config.yamlis covered by.skillshare/.gitignore— so both intentional auto-init cases are unchanged. When the directory holds skills or agents and its config is neither present nor gitignored, it returns an error pointing at version control or an explicitskillshare init -pinstead of writing over the project.Two deliberate details:
skills/oragents/do not count as content, so an effectively-empty directory still repairs silently.Test coverage
cmd/skillshare/require_project_config_test.gocovers the guard in all four states — initialized project, no project directory (still bootstraps), gitignored-config shared repo (still repairs, content untouched), and a content-bearing project without a config (errors, writes nothing) — plus agents-only content, an empty project directory, and a command-level regression test thatstatus -prefuses rather than overwriting.gofmt,go vet ./...andgo build ./...are clean.go test ./...shows no failures beyond the two that already fail on unmodifiedmainin my environment (TestCommitSourceFiles_CommitFailureIsReturnedandTestGitRootMismatch, both host-git-config dependent — same two noted in #258).Checklist