Repository navigation
fix(cli): default update policy to notify - #3
Dextheking1 wants to merge 1 commit into
Conversation
readPolicy fell back to auto when no config set a policy, so a fresh install silently installed new builds. Upstream defaulted to notify. An explicit policy in config is still respected.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideChanges the updater’s no-config fallback from automatic installation to notification, preventing fresh CLI installs from silently replacing the binary while leaving explicit update policies unchanged. Flow diagram for the updater default policyflowchart TD
A["Updater reads configured policy"] --> B{Policy configured?}
B -->|Yes| C["Use explicit policy"]
B -->|No| D["Fallback to notify"]
C --> E{Policy is notify?}
D --> E
E -->|Yes| F["Notify about update"]
E -->|No| G["Follow selected installation policy"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/cli/src/services/updater.ts" line_range="179" />
<code_context>
),
)
- return values.findLast((value) => value !== undefined) ?? "auto"
+ return values.findLast((value) => value !== undefined) ?? "notify"
})
</code_context>
<issue_to_address>
**Unset updates are not installed**
When no config file sets an update policy, `readPolicy` defaults to `notify`, so `run()` reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.
Restore `auto` as the unset-policy default so startup updates are installed as the guide promises.
</issue_to_address>Sourcery assessment
Approved.
| ), | ||
| ) | ||
| return values.findLast((value) => value !== undefined) ?? "auto" | ||
| return values.findLast((value) => value !== undefined) ?? "notify" |
There was a problem hiding this comment.
⚪ Low · Unset updates are not installed
When no config file sets an update policy, readPolicy defaults to notify, so run() reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.
Restore auto as the unset-policy default so startup updates are installed as the guide promises.
Prompt for AI agents
In `packages/cli/src/services/updater.ts` at line 179:
**Unset updates are not installed**
When no config file sets an update policy, `readPolicy` defaults to `notify`, so `run()` reports an available update without installing it, contradicting the guide’s promise that updates download automatically at startup.
Restore `auto` as the unset-policy default so startup updates are installed as the guide promises.
Issue for this PR
No linked issue.
Type of change
What does this PR do?
updater
readPolicyfalls back to"auto"when no config file sets a policy.run()treats anything except"notify"as install now, so a fresh install downloads and installs the newest@mars_ai/marscliin the background, no prompt.Upstream defaulted to
"notify"here. This restores that. An explicit policy in config is still respected, only the fallback changes.The CLI holds the user's API key. With the auto fallback, one bad publish replaces the binary on every default install before anyone sees it.
How did you verify your code works?
Verified: one word change.
"notify"is already a valid policy value in this file (decodePolicyaccepts it,run()handles it). Patched updater.ts transpiles clean withbun build.Screenshots / recordings
Not a UI change.
Checklist
Summary by Sourcery
Bug Fixes: