wokku-cli 0.5.1 → 0.5.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c8cac97273ed77799c94bfc6861b37480cc73ea3b0001b941867b6460dd5de7
4
- data.tar.gz: 3867324a0de011e3c98a4352f90b9a43046d03d381b048f6ca1fbf2d3a55eb68
3
+ metadata.gz: 1c7d8ff79cbc66dc2a088a04025b47c3c36ec6c0a954c68d02d42ee1dee34d46
4
+ data.tar.gz: 8dbc97b262bf992d0d1b63c4c7f6f876ce43866abcf258d203ad6df8b647b8da
5
5
  SHA512:
6
- metadata.gz: a1320f137cc4fc0a788f85d506a11ef7f74a3b4ad0eea18d11369ac3a2ee9a4e896ec1fd59a8208e2814fc9f7d0c9b090b2fff098c06e1e98cbd45d144dd3925
7
- data.tar.gz: 650d51fc2a0a3e32462f3f4771c2be3c62f17a603eac8acaf1a26f31f4db77e767b30aec9d2d1ea0c7388846205dfb8d74da77d7e376f05f72e3497dc843a53c
6
+ metadata.gz: eea912742f7b73ba8e908f4b85308e309882751f6899dfdb6e5161455091e9b18ca788534e91b01341594b0897f16d0046641ae9a4c2a5cd469cead422bc99b4
7
+ data.tar.gz: '019b37db8b1ccdb848f2b80a6da957490405bfd5c72680c4a067735068fb757c936ee7ecdef0affd3eef24d43ed371933bfdd65d3c24a9418c977fd009d4fdd2'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.3 — 2026-06-26
4
+
5
+ ### Fixed
6
+
7
+ - `databases:create` and `addons:shared:enable` no longer report success optimistically. The CLI used to print "Created"/"Enabled" on any 2xx — including a `202 Accepted` ("queued") — so a database or shared engine that was still provisioning, or that failed afterward, looked done. Both commands now poll until the resource is actually `running` (then "Created"/"ready"), `error` (a clear failure + nonzero exit), or a timeout ("still provisioning — check `wokku addons APP` / `databases:info`"). Poll cadence is tunable via `WOKKU_POLL_ATTEMPTS`/`WOKKU_POLL_INTERVAL`.
8
+
9
+ ## 0.5.2 — 2026-06-06
10
+
11
+ ### Changed
12
+
13
+ - API endpoint is now hard-locked to `https://wokku.cloud/api/v1`. Wokku is a managed-cloud product, so the endpoint is no longer configurable: removed the `WOKKU_API_URL` env override, the `auth:login --url` flag, and persisting `api_url` to `~/.wokku/config`. `mcp:install`/`mcp:switch` now pass only the token to the plugin (the MCP plugin's endpoint is fixed too, v1.2.0). Eliminates the class of bug where a stale/wrong API URL silently pointed the CLI at a dead host.
14
+
3
15
  ## 0.5.1 — 2026-06-04
4
16
 
5
17
  ### Fixed
data/README.md CHANGED
@@ -61,7 +61,7 @@ Set once and forget:
61
61
  export WOKKU_API_TOKEN=... # from wokku.cloud/dashboard/profile
62
62
  ```
63
63
 
64
- `WOKKU_API_URL` defaults to `https://wokku.cloud/api/v1` and shouldn't need to change.
64
+ The API endpoint is fixed to `https://wokku.cloud/api/v1` and is not configurable (Wokku is managed-cloud only).
65
65
 
66
66
  ## What's New in v0.2.0 (May 2026)
67
67
 
data/lib/wokku/auth.rb CHANGED
@@ -50,7 +50,7 @@ module Wokku
50
50
  when 200
51
51
  token = body.fetch("token")
52
52
  email = body.dig("user", "email")
53
- save_config({ "api_url" => url, "token" => token, "email" => email })
53
+ save_config({ "token" => token, "email" => email })
54
54
  puts
55
55
  Wokku::Output.status "Logged in as #{email}"
56
56
  Wokku::Output.status "Connected to: #{instance_label(url)}"
@@ -40,8 +40,26 @@ end
40
40
  register "addons:shared:enable", "Enable a shared engine on an app (usage: wokku addons:shared:enable APP ENGINE). ENGINE: postgres|redis|memcached|rabbitmq|meilisearch" do
41
41
  id = ARGV.shift || abort("Usage: wokku addons:shared:enable APP ENGINE")
42
42
  engine = ARGV.shift || abort("Missing engine")
43
- data = api(:post, "/apps/#{id}/addons/shared", { engine: engine })
44
- Wokku::Output.status(data["message"] || "Enabled shared #{engine} on #{id}")
43
+ api(:post, "/apps/#{id}/addons/shared", { engine: engine })
44
+
45
+ attempts = (ENV["WOKKU_POLL_ATTEMPTS"] || "30").to_i
46
+ interval = (ENV["WOKKU_POLL_INTERVAL"] || "2").to_f
47
+
48
+ Wokku::Output.status "Enabling shared #{engine} on #{id} — provisioning…" unless Wokku.quiet
49
+ final = poll_until("/apps/#{id}/addons", attempts: attempts, interval: interval) do |list|
50
+ row = Array(list).find { |a| a["service_type"] == engine && a["shared"] }
51
+ row && %w[running error].include?(row["status"])
52
+ end
53
+
54
+ row = Array(final).find { |a| a["service_type"] == engine && a["shared"] }
55
+ case row && row["status"]
56
+ when "running"
57
+ Wokku::Output.status "Shared #{engine} ready on #{id}."
58
+ when "error"
59
+ abort "Shared #{engine} failed to provision on #{id}. See the dashboard or re-run to retry."
60
+ else
61
+ Wokku::Output.status "Shared #{engine} still provisioning on #{id}. Check: wokku addons #{id}"
62
+ end
45
63
  end
46
64
 
47
65
  register "addons:shared:disable", "Disable a shared engine on an app (usage: wokku addons:shared:disable APP ENGINE)" do
@@ -1,18 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- DEFAULT_API_URL = "https://wokku.cloud/api/v1"
4
-
5
3
  # --- Auth ---
6
- register "auth:login", "Authenticate with Wokku via browser device flow. Flag: --url URL (for self-hosted)" do
7
- url = DEFAULT_API_URL
4
+ register "auth:login", "Authenticate with Wokku via browser device flow" do
8
5
  while (arg = ARGV.shift)
9
- case arg
10
- when "--url" then url = ARGV.shift or abort "--url requires a value"
11
- else abort "Unknown argument: #{arg}"
12
- end
6
+ abort "Unknown argument: #{arg}"
13
7
  end
14
8
 
15
- Wokku::Auth.login_with_device_flow!(url)
9
+ Wokku::Auth.login_with_device_flow!(Wokku::Config.api_url)
16
10
  end
17
11
 
18
12
  register "auth:logout", "Log out" do
@@ -32,7 +32,23 @@ register "databases:create", "Create a database (usage: wokku databases:create N
32
32
  abort "Missing --type (postgres, mysql, redis, mongo)" unless type
33
33
  server = resolve_server(explicit: server)
34
34
  data = api(:post, "/databases", { name: name, service_type: type, server_id: server })
35
- Wokku::Output.status "Created #{data['service_type']} database: #{data['name']}"
35
+
36
+ if data["status"] != "running"
37
+ attempts = (ENV["WOKKU_POLL_ATTEMPTS"] || "15").to_i
38
+ interval = (ENV["WOKKU_POLL_INTERVAL"] || "2").to_f
39
+ data = poll_until("/databases/#{data['name']}", attempts: attempts, interval: interval) do |d|
40
+ %w[running error].include?(d["status"])
41
+ end || { "name" => name, "service_type" => type, "status" => "creating" }
42
+ end
43
+
44
+ case data["status"]
45
+ when "running"
46
+ Wokku::Output.status "Created #{data['service_type']} database: #{data['name']}"
47
+ when "error"
48
+ abort "Database '#{data['name']}' failed to provision."
49
+ else
50
+ Wokku::Output.status "Database '#{data['name']}' is still provisioning. Check: wokku databases:info #{data['name']}"
51
+ end
36
52
  end
37
53
 
38
54
  register "databases:destroy", "Destroy a database (usage: wokku databases:destroy NAME)" do
@@ -27,15 +27,14 @@ def require_logged_in!
27
27
  end
28
28
 
29
29
  def install_mcp_entry!
30
- url = Wokku::Config.api_url
31
30
  token = Wokku::Config.api_token
32
31
 
33
32
  # Idempotent — silently no-ops if the entry doesn't exist yet.
34
33
  system("claude mcp remove #{Shellwords.escape(MCP_SERVER_NAME)} > /dev/null 2>&1")
35
34
 
35
+ # Only the token is passed — the plugin's endpoint is fixed to wokku.cloud.
36
36
  ok = system(
37
37
  "claude", "mcp", "add", MCP_SERVER_NAME,
38
- "--env", "WOKKU_API_URL=#{url}",
39
38
  "--env", "WOKKU_API_TOKEN=#{token}",
40
39
  "--", "npx", "-y", "@johannesdwicahyo/wokku-plugin"
41
40
  )
data/lib/wokku/config.rb CHANGED
@@ -30,8 +30,12 @@ module Wokku
30
30
  File.chmod(0600, file)
31
31
  end
32
32
 
33
+ # Wokku is managed-cloud only — the endpoint is fixed and intentionally
34
+ # NOT overridable (no config key, no env var). Mirrors the MCP plugin.
35
+ API_URL = "https://wokku.cloud/api/v1"
36
+
33
37
  def api_url
34
- load["api_url"] || ENV["WOKKU_API_URL"] || "https://wokku.cloud/api/v1"
38
+ API_URL
35
39
  end
36
40
 
37
41
  def api_token
data/lib/wokku/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Wokku
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.3"
4
4
  end
data/lib/wokku.rb CHANGED
@@ -80,6 +80,19 @@ rescue Wokku::ApiClient::NotAuthenticated, Wokku::ApiClient::Timeout,
80
80
  abort e.message
81
81
  end
82
82
 
83
+ # Poll GET <path> until the block returns truthy (returns that data) or the
84
+ # attempt budget is exhausted (returns nil). interval is injectable so specs
85
+ # can run with no real sleep.
86
+ def poll_until(path, attempts: 30, interval: 2)
87
+ attempts.times do |i|
88
+ data = api(:get, path)
89
+ return data if yield(data)
90
+
91
+ sleep(interval) if interval.positive? && i < attempts - 1
92
+ end
93
+ nil
94
+ end
95
+
83
96
  def load_config = Wokku::Config.load
84
97
  def save_config(data) = Wokku::Config.save(data)
85
98
  def api_url = Wokku::Config.api_url
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wokku-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Dwicahyo
@@ -24,7 +24,7 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0.7'
26
26
  description: Deploy and manage apps, databases, domains, and SSH keys on Wokku.cloud
27
- or self-hosted Wokku servers.
27
+ (managed cloud).
28
28
  email:
29
29
  - johannesdwicahyo@gmail.com
30
30
  executables: