Open
Conversation
Add URL-based and GitHub release-based pack installation. Users can now install packs from HTTP URLs and GitHub repos (gh:owner/repo[@Version]) in addition to local files. Includes smart caching, version checking for updates, and multi-asset GitHub release support. New files: - resolve.go: source string parsing (local/HTTP/GitHub) - github.go: GitHub REST API client with token resolution - fetch.go: HTTP download with caching, size limits, atomic writes Changes: - install.go: InstallFromSource() wiring, Source field in InstallOptions - cmd_pack.go: install accepts any source, update gains --all and pack-id lookup with version checking - handlers.go: MCP handler accepts source field, path-validates only local sources - CLI_REFERENCE.md: updated docs for new source formats and flags Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryIntroduced remote pack installation capabilities for floop, enabling installs from HTTP URLs and GitHub releases using Major changes:
Code quality:
Confidence Score: 4/5
|
| Filename | Overview |
|---|---|
| internal/pack/resolve.go | Added source parsing logic for local paths, HTTP URLs, and GitHub shorthand (gh:owner/repo[@Version]) |
| internal/pack/github.go | GitHub REST API client with token resolution (GITHUB_TOKEN, gh auth token); potential timeout issue in token resolution |
| internal/pack/fetch.go | HTTP download with local caching, atomic writes, 50MB size limit, and proper cleanup of temp files |
| internal/pack/install.go | Added InstallFromSource function supporting local/HTTP/GitHub sources; properly records source in config |
| cmd/floop/cmd_pack.go | Updated install/update commands to support remote sources; added --all flag for batch updates and version checking |
| internal/mcp/handlers.go | Updated floop_pack_install to accept source field; path validation now conditional on local sources only |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User: floop pack install source] --> B{ResolveSource}
B -->|Local| C[Validate Path]
B -->|HTTP| D[HTTPCachePath]
B -->|GitHub| E[GitHubClient.ResolveRelease]
C --> F[Install from FilePath]
D --> G[Fetch URL]
G --> H{Cached?}
H -->|Yes| I[Return Cached]
H -->|No| J[HTTP Download]
J --> K[Atomic Write to Cache]
K --> F
I --> F
E --> L[FindPackAssets]
L --> M{Multi-asset?}
M -->|Yes + --all-assets| N[Download All .fpack]
M -->|Single| O[Download Asset]
M -->|Multi + no flag| P[Error: use --all-assets]
N --> Q[GitHubCachePath]
O --> Q
Q --> G
F --> R[Install Behaviors]
R --> S[Stamp Provenance]
S --> T[Record Source in Config]
T --> U[Sync Store]
U --> V{Update Command?}
V -->|Yes| W{Version Check}
W -->|Up-to-date| X[Skip Download]
W -->|Outdated| A
V -->|No| Y[Complete]
Last reviewed commit: 1c0eece
internal/pack/github.go
Outdated
Comment on lines
144
to
150
| cmd := exec.Command("gh", "auth", "token") | ||
| out, err := cmd.Output() | ||
| if err == nil { | ||
| token := strings.TrimSpace(string(out)) | ||
| if token != "" { | ||
| return token | ||
| } |
There was a problem hiding this comment.
Add timeout to gh auth token command. Without context/timeout, this could hang indefinitely if gh is unresponsive.
Suggested change
| cmd := exec.Command("gh", "auth", "token") | |
| out, err := cmd.Output() | |
| if err == nil { | |
| token := strings.TrimSpace(string(out)) | |
| if token != "" { | |
| return token | |
| } | |
| ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | |
| defer cancel() | |
| cmd := exec.CommandContext(ctx, "gh", "auth", "token") | |
| out, err := cmd.Output() |
- Fix gofmt field alignment in resolve_test.go - Add 5s context timeout to `gh auth token` exec.Command to prevent hangs if gh CLI is unresponsive Co-Authored-By: Claude Opus 4.6 <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
floop pack installnow accepts HTTP URLs (https://...) and GitHub shorthand (gh:owner/repo[@version]) in addition to local file pathsfloop pack update <pack-id>looks up the recorded source, checks the remote version against installed version, and skips download if already up-to-datefloop pack update --allupdates all installed packs that have remote sources--all-assetsflag installs all.fpackfiles from a GitHub release with multiple pack assetsfloop_pack_installtool now accepts asourcefield (backward-compatiblefile_pathdeprecated); path validation only applies to local sourcesNew files (6)
internal/pack/resolve.goSourceLocal,SourceHTTP,SourceGitHubinternal/pack/resolve_test.gointernal/pack/github.goGITHUB_TOKEN→gh auth token→ unauthenticated)internal/pack/github_test.gohttptestmock serverinternal/pack/fetch.gointernal/pack/fetch_test.goModified files (6)
internal/pack/install.goSourcefield onInstallOptions, fixedrecordInstallto populate source, addedInstallFromSource()cmd/floop/cmd_pack.goInstallFromSource, update reworked with pack-id lookup /--all/ version checkinternal/mcp/handlers.gosourcefield, conditional path validation, usesInstallFromSourcefor remoteinternal/mcp/schema.goSourcefield toFloopPackInstallInputcmd/floop/cmd_pack_test.godocs/CLI_REFERENCE.mdTest plan
go vet ./...passesgofmtcleango test ./internal/pack/...— all 33 tests pass (resolve, github, fetch, install)go test ./cmd/floop/...— all passgo build ./internal/mcp/...— compilesfloop pack install gh:nvandessel/floop(once release is published)floop pack update --all🤖 Generated with Claude Code