fizzy-cli 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +24 -3
- data/lib/fizzy/cli/auth.rb +12 -7
- data/lib/fizzy/cli/base.rb +6 -1
- data/lib/fizzy/cli.rb +4 -3
- data/lib/fizzy/client.rb +9 -5
- data/lib/fizzy/project_config.rb +2 -0
- data/lib/fizzy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89a8e39c28c7a8d49b3af1f3b163c2a261bd858a2d4f4f86a593b69250d59959
|
|
4
|
+
data.tar.gz: dec53af4aa9bed136735432f17422fd62d50a4070639b6234757afde2e944a0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ecf54d250641fa05e79d9424158cd838c668b15dfd90a687501509ab6cba901bb813fb42d411b626a260a0e2d412a268315ebd4b0cd6febacc7d7a74f820779
|
|
7
|
+
data.tar.gz: edcdf11b52adf3968454aa0e8838e9ad6227510c49853ffb7ece7b53d01d11600bd1f1848c86b913f6e8349127fc625aa8ac5e90bc8ce5e9bf78554e606caf6f
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [0.6.1] - 2026-02-23
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Thor `ask()` returns nil in non-TTY environments (CI, piped input) causing NoMethodError on `init` command
|
|
12
|
+
- Init test uses basic line editor to avoid Readline bypassing `$stdin` in CI
|
|
13
|
+
|
|
14
|
+
## [0.6.0] - 2026-02-23
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- Custom URL support for self-hosted Fizzy instances
|
|
18
|
+
- `fizzy auth login --url URL` stores instance URL per-account in tokens.yml
|
|
19
|
+
- `url` key in `.fizzy.yml` for per-project instance URL
|
|
20
|
+
- `FIZZY_URL` environment variable for instance URL override
|
|
21
|
+
- URL resolution priority: `FIZZY_URL` env > `.fizzy.yml` > tokens.yml per-account > default
|
|
22
|
+
- URL validation in Client rejects non-http(s) URLs with clear error message
|
|
23
|
+
- `auth status` displays URL when using a non-default instance
|
|
24
|
+
- HTTP scheme detection for SSL (supports `http://` for local development)
|
|
25
|
+
|
|
8
26
|
## [0.5.0] - 2026-02-22
|
|
9
27
|
|
|
10
28
|
### Added
|
data/README.md
CHANGED
|
@@ -43,7 +43,13 @@ fizzy skill uninstall # Remove skill file
|
|
|
43
43
|
fizzy auth login --token YOUR_TOKEN
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
For self-hosted Fizzy instances, pass `--url`:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
fizzy auth login --token YOUR_TOKEN --url https://fizzy.mycompany.com
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The URL is stored per-account in `~/.config/fizzy-cli/tokens.yml`. You can also set `FIZZY_TOKEN` as an environment variable with `--account` to skip the file.
|
|
47
53
|
|
|
48
54
|
```sh
|
|
49
55
|
fizzy auth status # Show current auth
|
|
@@ -66,6 +72,14 @@ account: acme
|
|
|
66
72
|
board: b1
|
|
67
73
|
```
|
|
68
74
|
|
|
75
|
+
For self-hosted instances, add a `url` key:
|
|
76
|
+
|
|
77
|
+
```yaml
|
|
78
|
+
account: acme
|
|
79
|
+
board: b1
|
|
80
|
+
url: https://fizzy.mycompany.com
|
|
81
|
+
```
|
|
82
|
+
|
|
69
83
|
**Resolution priority** (highest wins):
|
|
70
84
|
1. CLI flag (`--account` / `--board`)
|
|
71
85
|
2. `.fizzy.yml` (nearest ancestor directory)
|
|
@@ -210,9 +224,16 @@ end
|
|
|
210
224
|
|
|
211
225
|
| Source | Purpose |
|
|
212
226
|
|--------|---------|
|
|
213
|
-
| `.fizzy.yml` | Per-project account and
|
|
214
|
-
| `~/.config/fizzy-cli/tokens.yml` | Stored auth tokens
|
|
227
|
+
| `.fizzy.yml` | Per-project account, board, and URL defaults |
|
|
228
|
+
| `~/.config/fizzy-cli/tokens.yml` | Stored auth tokens, default account, and per-account URL |
|
|
215
229
|
| `FIZZY_TOKEN` env var | Token override (requires `--account`) |
|
|
230
|
+
| `FIZZY_URL` env var | Instance URL override (default: `https://app.fizzy.do`) |
|
|
231
|
+
|
|
232
|
+
**URL resolution priority** (highest wins):
|
|
233
|
+
1. `FIZZY_URL` environment variable
|
|
234
|
+
2. `url` in `.fizzy.yml`
|
|
235
|
+
3. Per-account `url` from `tokens.yml` (set via `fizzy auth login --url`)
|
|
236
|
+
4. Default: `https://app.fizzy.do`
|
|
216
237
|
|
|
217
238
|
## Development
|
|
218
239
|
|
data/lib/fizzy/cli/auth.rb
CHANGED
|
@@ -24,11 +24,15 @@ module Fizzy
|
|
|
24
24
|
|
|
25
25
|
desc "login", "Authenticate with a Personal Access Token"
|
|
26
26
|
option :token, required: true, desc: "Personal Access Token"
|
|
27
|
+
option :url, type: :string, desc: "Custom Fizzy instance URL (default: #{Client::DEFAULT_BASE_URL})"
|
|
27
28
|
def login
|
|
28
29
|
token = options[:token]
|
|
30
|
+
custom_url = options[:url]
|
|
29
31
|
|
|
30
32
|
# Verify token by fetching identity
|
|
31
|
-
|
|
33
|
+
client_opts = { token: token, account_slug: "" }
|
|
34
|
+
client_opts[:base_url] = custom_url if custom_url
|
|
35
|
+
c = Client.new(**client_opts)
|
|
32
36
|
resp = c.get("/my/identity")
|
|
33
37
|
accounts = resp.body["accounts"]
|
|
34
38
|
|
|
@@ -36,7 +40,7 @@ module Fizzy
|
|
|
36
40
|
|
|
37
41
|
# Build tokens data
|
|
38
42
|
token_accounts = accounts.map do |a|
|
|
39
|
-
{
|
|
43
|
+
acct = {
|
|
40
44
|
"account_slug" => Auth.normalize_slug(a["slug"]),
|
|
41
45
|
"account_name" => a["name"],
|
|
42
46
|
"account_id" => a["id"],
|
|
@@ -49,6 +53,8 @@ module Fizzy
|
|
|
49
53
|
},
|
|
50
54
|
"created_at" => Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%3NZ")
|
|
51
55
|
}
|
|
56
|
+
acct["url"] = custom_url if custom_url
|
|
57
|
+
acct
|
|
52
58
|
end
|
|
53
59
|
|
|
54
60
|
data = {
|
|
@@ -69,13 +75,12 @@ module Fizzy
|
|
|
69
75
|
|
|
70
76
|
desc "status", "Show current auth status"
|
|
71
77
|
def status
|
|
72
|
-
|
|
73
|
-
c = Client.new(token: acct["access_token"], account_slug: acct["account_slug"])
|
|
74
|
-
resp = c.get("/my/identity")
|
|
78
|
+
resp = client.get("/my/identity")
|
|
75
79
|
|
|
80
|
+
puts "URL: #{client.base_url}" unless base_url == Client::DEFAULT_BASE_URL
|
|
76
81
|
puts "Token: #{Auth::TOKEN_FILE}"
|
|
77
|
-
puts "Account: #{
|
|
78
|
-
puts "User: #{
|
|
82
|
+
puts "Account: #{account["account_name"]} (#{account["account_slug"]})"
|
|
83
|
+
puts "User: #{account.dig("user", "name")} <#{account.dig("user", "email_address")}>"
|
|
79
84
|
|
|
80
85
|
accounts_count = resp.body["accounts"].size
|
|
81
86
|
puts "Accounts: #{accounts_count}" if accounts_count > 1
|
data/lib/fizzy/cli/base.rb
CHANGED
|
@@ -37,10 +37,15 @@ module Fizzy
|
|
|
37
37
|
"No value provided for option '--board'. Set via --board, .fizzy.yml, or: fizzy init")
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
def base_url
|
|
41
|
+
ENV["FIZZY_URL"] || project_config.url || account["url"] || Client::DEFAULT_BASE_URL
|
|
42
|
+
end
|
|
43
|
+
|
|
40
44
|
def client
|
|
41
45
|
@client ||= Client.new(
|
|
42
46
|
token: account["access_token"],
|
|
43
|
-
account_slug: account["account_slug"]
|
|
47
|
+
account_slug: account["account_slug"],
|
|
48
|
+
base_url: base_url
|
|
44
49
|
)
|
|
45
50
|
end
|
|
46
51
|
|
data/lib/fizzy/cli.rb
CHANGED
|
@@ -92,7 +92,7 @@ module Fizzy
|
|
|
92
92
|
say " #{i + 1}. #{a["account_name"]} (#{a["account_slug"]})#{marker}"
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
choice = ask("Select account number [1]:").strip
|
|
95
|
+
choice = ask("Select account number [1]:").to_s.strip
|
|
96
96
|
choice = "1" if choice.empty?
|
|
97
97
|
idx = choice.to_i - 1
|
|
98
98
|
raise Thor::Error, "Invalid selection" unless idx >= 0 && idx < accounts.size
|
|
@@ -101,7 +101,8 @@ module Fizzy
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def fetch_boards(account)
|
|
104
|
-
|
|
104
|
+
url = ENV["FIZZY_URL"] || account["url"] || Client::DEFAULT_BASE_URL
|
|
105
|
+
c = Client.new(token: account["access_token"], account_slug: account["account_slug"], base_url: url)
|
|
105
106
|
boards = c.get("boards").body
|
|
106
107
|
say "No boards found." if boards.empty?
|
|
107
108
|
boards
|
|
@@ -113,7 +114,7 @@ module Fizzy
|
|
|
113
114
|
say " #{i + 1}. #{b["name"]} (#{b["id"]})"
|
|
114
115
|
end
|
|
115
116
|
|
|
116
|
-
board_idx = ask("Select board number:").strip.to_i - 1
|
|
117
|
+
board_idx = ask("Select board number:").to_s.strip.to_i - 1
|
|
117
118
|
return boards[board_idx]["id"] if board_idx >= 0 && board_idx < boards.size
|
|
118
119
|
|
|
119
120
|
say "Invalid selection, skipping board."
|
data/lib/fizzy/client.rb
CHANGED
|
@@ -4,11 +4,15 @@ module Fizzy
|
|
|
4
4
|
Response = Data.define(:body, :headers, :status)
|
|
5
5
|
|
|
6
6
|
class Client
|
|
7
|
-
|
|
7
|
+
DEFAULT_BASE_URL = "https://app.fizzy.do"
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
attr_reader :base_url
|
|
10
|
+
|
|
11
|
+
def initialize(token:, account_slug:, base_url: DEFAULT_BASE_URL)
|
|
10
12
|
@token = token
|
|
11
13
|
@account_slug = account_slug
|
|
14
|
+
@base_url = base_url.chomp("/")
|
|
15
|
+
raise ArgumentError, "Invalid URL (must be http or https): #{@base_url}" unless @base_url.match?(%r{\Ahttps?://})
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
def get(path, params: {})
|
|
@@ -31,9 +35,9 @@ module Fizzy
|
|
|
31
35
|
|
|
32
36
|
def connection
|
|
33
37
|
@connection ||= begin
|
|
34
|
-
uri = URI(
|
|
38
|
+
uri = URI(@base_url)
|
|
35
39
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
36
|
-
http.use_ssl =
|
|
40
|
+
http.use_ssl = uri.scheme == "https"
|
|
37
41
|
http.open_timeout = 5
|
|
38
42
|
http.read_timeout = 30
|
|
39
43
|
http.start
|
|
@@ -48,7 +52,7 @@ module Fizzy
|
|
|
48
52
|
|
|
49
53
|
def request(method, path, body: nil, params: {})
|
|
50
54
|
full_path = path.start_with?("/") ? path : "/#{@account_slug}/#{path}"
|
|
51
|
-
uri = URI("#{
|
|
55
|
+
uri = URI("#{@base_url}#{full_path}")
|
|
52
56
|
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
53
57
|
|
|
54
58
|
req = build_request(method, uri)
|
data/lib/fizzy/project_config.rb
CHANGED
data/lib/fizzy/version.rb
CHANGED