fix(cli): Handle corrupt taskless.json manifest during init#15
Merged
thecodedrift merged 3 commits intomainfrom Apr 8, 2026
Merged
fix(cli): Handle corrupt taskless.json manifest during init#15thecodedrift merged 3 commits intomainfrom
thecodedrift merged 3 commits intomainfrom
Conversation
readManifest() only caught ENOENT errors, so a corrupt/unparseable taskless.json would crash init with a raw SyntaxError (e.g. "unexpected token *"). Now treats SyntaxError the same as a missing file — resets to version 0 so migrations re-run and rewrite the manifest. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves CLI init/migration resilience by treating a corrupt/unparseable .taskless/taskless.json manifest the same as a missing manifest, allowing migrations to re-run and regenerate a valid manifest instead of crashing.
Changes:
- Catch
SyntaxErrorwhile reading/parsing the manifest and default to{ version: 0 }. - Preserve existing behavior for
ENOENT(missing manifest) and rethrow all other errors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Covers the case where .taskless/taskless.json contains invalid JSON, verifying that ensureTasklessDirectory recovers gracefully. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The dist is a .js file relying on "type": "module" for ESM resolution. On older Node versions or when the package.json resolution chain is incomplete, Node falls back to CJS and chokes on `import *` syntax. Adding explicit "module" and "exports" fields improves ESM discovery. Co-Authored-By: Claude Opus 4.6 (1M context) <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
readManifest()inmigrate.tsonly caughtENOENTerrors when reading.taskless/taskless.json, so a corrupt or unparseable manifest would crashinitwith a rawSyntaxError(e.g. "unexpected token *")SyntaxErrorand treats it the same as a missing file — resets to version 0 so migrations re-run and rewrite the manifest correctlyTest plan
taskless initwith a valid.taskless/taskless.json— should work as beforetaskless initwith a corrupt.taskless/taskless.json(e.g.echo "***" > .taskless/taskless.json) — should recover gracefully instead of crashing🤖 Generated with Claude Code