Feature/notifier-update#13
Conversation
|
| Filename | Overview |
|---|---|
| README.md | Adds a new floci update section with correct usage examples; introduces a duplicate row in the commands table that should be removed. |
| src/main/java/io/floci/cli/FlociCli.java | Adds update-notification logic and fixes the routing guard — "update" is now included in isExplicitProduct so the product prefix is not prepended, and isUpdateCommand correctly suppresses the hint when the user is already running floci update. |
| src/main/java/io/floci/cli/commands/UpdateCommand.java | Three correctness fixes applied: semantic version comparison for unpinned updates, Version.isValid() guard on the fetched tag, and clearer error message distinguishing 200-with-empty-body from HTTP errors. |
| src/main/java/io/floci/cli/update/UpdateNotifier.java | New class implementing npm/gh-style update hints: cache-read for the notice, background virtual-thread refresh at most every 24h, CI/terminal detection, and captive-portal guard. Implementation is robust and fail-silent. |
| src/main/java/io/floci/cli/update/Version.java | New minimal semver helper: validates version shape, compares numeric cores, and correctly treats a stable release as newer than an equal-cored pre-release. |
| src/main/java/io/floci/cli/update/UpdateCache.java | Simple record holding the persisted cache shape; straightforward and correct. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant FlociCli
participant UpdateNotifier
participant CacheFile as ~/.floci/update-check.json
participant GitHub as GitHub API
User->>FlociCli: "floci <command>"
FlociCli->>FlociCli: interactiveRunEnabled()?
alt "interactive & not update command"
FlociCli->>UpdateNotifier: pendingNotice(currentVersion)
UpdateNotifier->>CacheFile: read latestVersion
CacheFile-->>UpdateNotifier: cached version (or empty)
UpdateNotifier->>UpdateNotifier: Version.isNewer(cached, current)?
UpdateNotifier-->>FlociCli: Optional[newer version]
FlociCli->>User: stderr hint (if newer found)
FlociCli->>UpdateNotifier: refreshInBackground()
UpdateNotifier->>CacheFile: "isStale? (>24h)"
alt cache stale or absent
UpdateNotifier->>GitHub: GET /releases/latest (virtual thread)
GitHub-->>UpdateNotifier: tag_name
UpdateNotifier->>UpdateNotifier: Version.isValid(tag)?
UpdateNotifier->>CacheFile: write UpdateCache(epoch, version)
end
end
FlociCli->>FlociCli: execute(effectiveArgs)
FlociCli->>UpdateNotifier: awaitRefresh(250ms)
FlociCli->>User: System.exit(exitCode)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant FlociCli
participant UpdateNotifier
participant CacheFile as ~/.floci/update-check.json
participant GitHub as GitHub API
User->>FlociCli: "floci <command>"
FlociCli->>FlociCli: interactiveRunEnabled()?
alt "interactive & not update command"
FlociCli->>UpdateNotifier: pendingNotice(currentVersion)
UpdateNotifier->>CacheFile: read latestVersion
CacheFile-->>UpdateNotifier: cached version (or empty)
UpdateNotifier->>UpdateNotifier: Version.isNewer(cached, current)?
UpdateNotifier-->>FlociCli: Optional[newer version]
FlociCli->>User: stderr hint (if newer found)
FlociCli->>UpdateNotifier: refreshInBackground()
UpdateNotifier->>CacheFile: "isStale? (>24h)"
alt cache stale or absent
UpdateNotifier->>GitHub: GET /releases/latest (virtual thread)
GitHub-->>UpdateNotifier: tag_name
UpdateNotifier->>UpdateNotifier: Version.isValid(tag)?
UpdateNotifier->>CacheFile: write UpdateCache(epoch, version)
end
end
FlociCli->>FlociCli: execute(effectiveArgs)
FlociCli->>UpdateNotifier: awaitRefresh(250ms)
FlociCli->>User: System.exit(exitCode)
Reviews (4): Last reviewed commit: "fix(cli): exempt update from default-pro..." | Re-trigger Greptile
…ify empty-body error
|
Hi @juandiii, Thank you for the PR. Please resolve conflicts when you have a chance. |
No description provided.