-
Notifications
You must be signed in to change notification settings - Fork 0
fix(init): stop installing docs that describe a deleted layout #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| "@taskless/cli": patch | ||
| --- | ||
|
|
||
| The installed `.taskless/README.md` and Taskless skill no longer describe a | ||
| layout two migrations old. | ||
|
|
||
| Both named `rule-tests/`, a directory `0005` deletes, and the README described | ||
| rules as living under `sg/rules/` and `vale/rules/` rather than the current | ||
| `rules/<engine>/<id>/`. The skill line is the one that mattered most: it is a | ||
| trigger description, so it taught an agent to look in a directory the migration | ||
| had removed. | ||
|
|
||
| `0001` writes the README on every run and says it "overwrites stale content | ||
| from older versions", which is true and not sufficient. Migrations only run | ||
| above the recorded version, so a project already at 5 never ran `0001` again | ||
| and kept its stale copy permanently. Migration `0006` rewrites it, so an | ||
| existing project gets a correct description rather than only new installs. | ||
|
|
||
| The README's layout section is now derived from the rule layout table instead | ||
| of described beside it, so the words cannot disagree with the directories they | ||
| describe. `LATEST_SCHEMA_VERSION` is exported for the same reason: tests | ||
| hardcoded the current version in ten places, and the version matrix listed | ||
| prior versions literally, so each new migration silently stopped covering the | ||
| version it had just made prior. |
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
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
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
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
38 changes: 38 additions & 0 deletions
38
packages/cli/src/filesystem/migrations/0006-refresh-readme.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { join } from "node:path"; | ||
| import { writeFile } from "node:fs/promises"; | ||
|
|
||
| import { pinnedSpecifier } from "../../util/package-manager"; | ||
| import { buildReadmeContent } from "./0001-init"; | ||
| import type { Migration } from "../types"; | ||
|
|
||
| /** | ||
| * Rewrite `.taskless/README.md`, because the copy on disk describes a tree that | ||
| * two migrations ago stopped existing. | ||
| * | ||
| * `0001` writes this file and says it "overwrites stale content from older | ||
| * versions", which is true and not sufficient: `runMigrations` only runs | ||
| * migrations ABOVE the recorded version, so a project already at 5 never runs | ||
| * `0001` again. Its README is frozen at whatever the CLI wrote when it last | ||
| * migrated, and for every project that reached 5 that text describes | ||
| * `sg/rules/` and `sg/rule-tests/` — a layout `0004` and `0005` dismantled, and | ||
| * a `rule-tests/` directory `0005` deletes outright. | ||
| * | ||
| * So the fix has to be a migration of its own. Correcting `0001`'s template | ||
| * reaches new installs and projects still catching up; nothing but a version | ||
| * bump reaches a project that is already current, which is most of them. | ||
| * | ||
| * A schema version spent on documentation is worth stating plainly rather than | ||
| * apologising for. The file is generated, not authored — `0001` overwrites it | ||
| * unconditionally and the header says "managed by Taskless" — so no user | ||
| * content is at risk, and the alternative is a wrong description of the | ||
| * project's own directory that never self-corrects. | ||
| */ | ||
| const migration: Migration = async (directory) => { | ||
|
thecodedrift marked this conversation as resolved.
|
||
| await writeFile( | ||
| join(directory, "README.md"), | ||
| buildReadmeContent(pinnedSpecifier()), | ||
| "utf8" | ||
| ); | ||
| }; | ||
|
|
||
| export default migration; | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.