sweatstack-cli 0.12.0__tar.gz → 0.13.0__tar.gz

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.
Files changed (64) hide show
  1. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/CHANGELOG.md +23 -0
  2. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/DEVELOPMENT.md +8 -6
  3. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/PKG-INFO +38 -9
  4. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/README.md +37 -8
  5. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/pyproject.toml +1 -1
  6. sweatstack_cli-0.13.0/src/sweatstack_cli/__init__.py +10 -0
  7. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/commands/app.py +19 -12
  8. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/commands/page.py +3 -11
  9. sweatstack_cli-0.13.0/src/sweatstack_cli/go_live.py +45 -0
  10. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/test_app.py +39 -4
  11. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/test_page_deploy.py +58 -0
  12. sweatstack_cli-0.13.0/tests/test_version.py +17 -0
  13. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/uv.lock +1 -1
  14. sweatstack_cli-0.12.0/src/sweatstack_cli/__init__.py +0 -3
  15. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/settings.local.json +0 -0
  16. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/SKILL.md +0 -0
  17. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/api.md +0 -0
  18. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/auth.md +0 -0
  19. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/cli.md +0 -0
  20. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/pyscript.md +0 -0
  21. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.claude/skills/sweatstack/webapp.md +0 -0
  22. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.gitignore +0 -0
  23. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/.python-version +0 -0
  24. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/CREATE_PRIVATE_APP.md +0 -0
  25. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/Makefile +0 -0
  26. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/PLAN.md +0 -0
  27. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/plans/001-page-init-command.md +0 -0
  28. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/api/__init__.py +0 -0
  29. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/api/client.py +0 -0
  30. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/auth/__init__.py +0 -0
  31. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/auth/callback_server.py +0 -0
  32. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/auth/jwt.py +0 -0
  33. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/auth/pkce.py +0 -0
  34. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/auth/tokens.py +0 -0
  35. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/commands/__init__.py +0 -0
  36. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/commands/auth.py +0 -0
  37. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/config.py +0 -0
  38. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/console.py +0 -0
  39. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/exceptions.py +0 -0
  40. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/main.py +0 -0
  41. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/project.py +0 -0
  42. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/py.typed +0 -0
  43. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/services/__init__.py +0 -0
  44. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/services/applications.py +0 -0
  45. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/templates/page/index.html +0 -0
  46. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/src/sweatstack_cli/version_check.py +0 -0
  47. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/sweatstack.toml +0 -0
  48. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/__init__.py +0 -0
  49. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/conftest.py +0 -0
  50. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_api/__init__.py +0 -0
  51. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_api/test_client.py +0 -0
  52. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_auth/__init__.py +0 -0
  53. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_auth/test_callback_server.py +0 -0
  54. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_auth/test_jwt.py +0 -0
  55. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_auth/test_pkce.py +0 -0
  56. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_auth/test_tokens.py +0 -0
  57. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/__init__.py +0 -0
  58. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/test_auth.py +0 -0
  59. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/test_cli.py +0 -0
  60. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_commands/test_page_init.py +0 -0
  61. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_project.py +0 -0
  62. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_services/__init__.py +0 -0
  63. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_services/test_applications.py +0 -0
  64. {sweatstack_cli-0.12.0 → sweatstack_cli-0.13.0}/tests/test_version_check.py +0 -0
@@ -4,6 +4,29 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.13.0] - 2026-10-15
8
+
9
+ ### Changed
10
+
11
+ - `page deploy` prints what the app still needs before anyone else can connect,
12
+ as the server reports it (`go_live_missing`), and links to the app's Consent
13
+ screen, where it goes live. It used to print a bare `/publish` link, which only
14
+ ever said the app was private.
15
+ - `app create` points to the app's overview as the next step and lists what is
16
+ missing before anyone else can connect.
17
+
18
+ ## [0.12.1] - 2026-10-13
19
+
20
+ ### Fixed
21
+
22
+ - 0.12.0 reported itself as 0.11.0: in `--version`, in `status` (which then
23
+ always offered an "update" to 0.12.0) and in the `User-Agent` header. The
24
+ version is now read from the installed package, so `pyproject.toml` is the
25
+ only place to bump it.
26
+ - `app create` checks for an existing `sweatstack.toml` before creating the
27
+ application, not after. Non-interactively, or when declining to overwrite, it
28
+ used to create the app and then stop, leaving an application nothing pointed to.
29
+
7
30
  ## [0.12.0] - 2026-10-13
8
31
 
9
32
  ### Fixed
@@ -25,7 +25,7 @@ pytest
25
25
 
26
26
  ```
27
27
  src/sweatstack_cli/
28
- ├── __init__.py # Package version
28
+ ├── __init__.py # Package version (read from metadata)
29
29
  ├── main.py # CLI entry point (Typer app)
30
30
  ├── config.py # Environment-based configuration
31
31
  ├── console.py # Rich console singleton
@@ -338,11 +338,13 @@ def my_command():
338
338
 
339
339
  ## Release Process
340
340
 
341
- 1. Update version in `src/sweatstack_cli/__init__.py`
342
- 2. Update `pyproject.toml` version if needed
343
- 3. Run full test suite: `pytest`
344
- 4. Build: `uv build` or `python -m build`
345
- 5. Publish: `twine upload dist/*`
341
+ 1. Bump `version` in `pyproject.toml`, then run `uv lock` to update `uv.lock`.
342
+ This is the only place the version lives: `__version__` reads it from the
343
+ installed package.
344
+ 2. Rename `## [Unreleased]` in `CHANGELOG.md` to `## [X.Y.Z] - YYYY-MM-DD`.
345
+ 3. Run all checks: `make check`
346
+ 4. Commit as `Release X.Y.Z`
347
+ 5. Build and publish: `make publish`
346
348
 
347
349
  ## Debugging
348
350
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sweatstack-cli
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: Command-line interface for SweatStack — the sports data platform for developers
5
5
  Project-URL: Homepage, https://sweatstack.no
6
6
  Project-URL: Documentation, https://docs.sweatstack.no
@@ -67,8 +67,11 @@ uv tool install --reinstall sweatstack-cli
67
67
  # Authenticate with SweatStack
68
68
  sweatstack login
69
69
 
70
- # Create an app and deploy
71
- sweatstack app create "My App" --page my-page --env
70
+ # Create an app with a page, and scaffold public/index.html
71
+ sweatstack page init "My App"
72
+
73
+ # Preview locally, then publish to https://my-app.pages.sweatstack.dev
74
+ sweatstack page serve
72
75
  sweatstack page deploy
73
76
  ```
74
77
 
@@ -110,7 +113,7 @@ sweatstack page deploy
110
113
 
111
114
  ### Project Configuration
112
115
 
113
- Both `app create` and `app link` generate a `sweatstack.toml` in the current directory. Other commands read defaults from this file.
116
+ `app create`, `app link` and `page init` generate a `sweatstack.toml` in the current directory. Other commands read defaults from this file.
114
117
 
115
118
  ```toml
116
119
  [app]
@@ -122,9 +125,33 @@ slug = "my-page"
122
125
  directory = "dist"
123
126
  ```
124
127
 
125
- ### Page Deployment
128
+ ### Pages
129
+
130
+ Static sites hosted at `https://<slug>.pages.sweatstack.dev`. Each application has at most one page.
131
+
132
+ | Command | Description |
133
+ |---------|-------------|
134
+ | `sweatstack page init [NAME]` | Create an app and its page, and scaffold `public/index.html` |
135
+ | `sweatstack page serve` | Preview the site locally |
136
+ | `sweatstack page deploy [SLUG]` | Publish the site, creating the page if needed |
137
+
138
+ #### `page init`
139
+
140
+ Creates a private application and its page, records both in `sweatstack.toml`, and writes a starter app to `public/index.html` that signs in with SweatStack and plots your latest activity. The slug is derived from the name. With an app already linked in `sweatstack.toml`, it reuses that app instead of creating one.
126
141
 
127
- Deploy static sites to SweatStack Pages.
142
+ | Option | Description |
143
+ |--------|-------------|
144
+ | `--slug TEXT` | Page slug (default: derived from the name) |
145
+ | `--dir PATH` | Directory to scaffold (default: `public`) |
146
+ | `--title TEXT` | Title shown on the page (default: the name) |
147
+ | `--client-id TEXT` | Reuse an existing application |
148
+ | `--force, -f` | Overwrite an existing `index.html` |
149
+
150
+ #### `page serve`
151
+
152
+ Serves the `[page] directory` from `sweatstack.toml` on the first free port from 8000. Extra arguments are passed to `python -m http.server`. Apps created by the CLI accept sign-in redirects to localhost on any port.
153
+
154
+ #### `page deploy`
128
155
 
129
156
  ```bash
130
157
  # Deploy using sweatstack.toml defaults (recommended)
@@ -134,9 +161,11 @@ sweatstack page deploy
134
161
  sweatstack page deploy my-page --dir ./dist
135
162
  ```
136
163
 
137
- If the page doesn't exist yet, `deploy` creates it. With an app linked in
138
- `sweatstack.toml`, it creates that app's page. Without one, it asks to create a
139
- new app with the page (and fails instead when not run interactively, e.g. in CI).
164
+ Every deploy replaces all files on the page. If the page doesn't exist yet, `deploy` creates it. With an app linked in `sweatstack.toml`, it creates that app's page. Without one, it asks to create a new app with the page, and fails instead when not run interactively (e.g. in CI).
165
+
166
+ New apps are private: only you can sign in. After deploying, `deploy` prints a link to make the app public.
167
+
168
+ **Limits:** 10 MB per file; 100 MB and about 1,000 files per deploy.
140
169
 
141
170
  ## License
142
171
 
@@ -37,8 +37,11 @@ uv tool install --reinstall sweatstack-cli
37
37
  # Authenticate with SweatStack
38
38
  sweatstack login
39
39
 
40
- # Create an app and deploy
41
- sweatstack app create "My App" --page my-page --env
40
+ # Create an app with a page, and scaffold public/index.html
41
+ sweatstack page init "My App"
42
+
43
+ # Preview locally, then publish to https://my-app.pages.sweatstack.dev
44
+ sweatstack page serve
42
45
  sweatstack page deploy
43
46
  ```
44
47
 
@@ -80,7 +83,7 @@ sweatstack page deploy
80
83
 
81
84
  ### Project Configuration
82
85
 
83
- Both `app create` and `app link` generate a `sweatstack.toml` in the current directory. Other commands read defaults from this file.
86
+ `app create`, `app link` and `page init` generate a `sweatstack.toml` in the current directory. Other commands read defaults from this file.
84
87
 
85
88
  ```toml
86
89
  [app]
@@ -92,9 +95,33 @@ slug = "my-page"
92
95
  directory = "dist"
93
96
  ```
94
97
 
95
- ### Page Deployment
98
+ ### Pages
99
+
100
+ Static sites hosted at `https://<slug>.pages.sweatstack.dev`. Each application has at most one page.
101
+
102
+ | Command | Description |
103
+ |---------|-------------|
104
+ | `sweatstack page init [NAME]` | Create an app and its page, and scaffold `public/index.html` |
105
+ | `sweatstack page serve` | Preview the site locally |
106
+ | `sweatstack page deploy [SLUG]` | Publish the site, creating the page if needed |
107
+
108
+ #### `page init`
109
+
110
+ Creates a private application and its page, records both in `sweatstack.toml`, and writes a starter app to `public/index.html` that signs in with SweatStack and plots your latest activity. The slug is derived from the name. With an app already linked in `sweatstack.toml`, it reuses that app instead of creating one.
96
111
 
97
- Deploy static sites to SweatStack Pages.
112
+ | Option | Description |
113
+ |--------|-------------|
114
+ | `--slug TEXT` | Page slug (default: derived from the name) |
115
+ | `--dir PATH` | Directory to scaffold (default: `public`) |
116
+ | `--title TEXT` | Title shown on the page (default: the name) |
117
+ | `--client-id TEXT` | Reuse an existing application |
118
+ | `--force, -f` | Overwrite an existing `index.html` |
119
+
120
+ #### `page serve`
121
+
122
+ Serves the `[page] directory` from `sweatstack.toml` on the first free port from 8000. Extra arguments are passed to `python -m http.server`. Apps created by the CLI accept sign-in redirects to localhost on any port.
123
+
124
+ #### `page deploy`
98
125
 
99
126
  ```bash
100
127
  # Deploy using sweatstack.toml defaults (recommended)
@@ -104,9 +131,11 @@ sweatstack page deploy
104
131
  sweatstack page deploy my-page --dir ./dist
105
132
  ```
106
133
 
107
- If the page doesn't exist yet, `deploy` creates it. With an app linked in
108
- `sweatstack.toml`, it creates that app's page. Without one, it asks to create a
109
- new app with the page (and fails instead when not run interactively, e.g. in CI).
134
+ Every deploy replaces all files on the page. If the page doesn't exist yet, `deploy` creates it. With an app linked in `sweatstack.toml`, it creates that app's page. Without one, it asks to create a new app with the page, and fails instead when not run interactively (e.g. in CI).
135
+
136
+ New apps are private: only you can sign in. After deploying, `deploy` prints a link to make the app public.
137
+
138
+ **Limits:** 10 MB per file; 100 MB and about 1,000 files per deploy.
110
139
 
111
140
  ## License
112
141
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sweatstack-cli"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  description = "Command-line interface for SweatStack — the sports data platform for developers"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Aart Goossens", email = "aart@sweatstack.no" }]
@@ -0,0 +1,10 @@
1
+ """SweatStack CLI — Command-line interface for the SweatStack platform."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ # Single source of truth: the version in pyproject.toml, read from the installed
6
+ # package's metadata. A hardcoded copy here drifted once (0.12.0 shipped as 0.11.0).
7
+ try:
8
+ __version__ = version("sweatstack-cli")
9
+ except PackageNotFoundError: # Imported from a source tree that isn't installed.
10
+ __version__ = "unknown"
@@ -12,6 +12,7 @@ import typer
12
12
  from sweatstack_cli.api import APIClient
13
13
  from sweatstack_cli.console import console, stderr_console
14
14
  from sweatstack_cli.exceptions import APIError, AuthenticationError
15
+ from sweatstack_cli.go_live import app_url, print_go_live
15
16
  from sweatstack_cli.project import CONFIG_FILENAME, write_config
16
17
  from sweatstack_cli.services.applications import create_application
17
18
 
@@ -74,6 +75,18 @@ def create(
74
75
  raise typer.Exit(1)
75
76
  name = typer.prompt("App name")
76
77
 
78
+ # Protect an existing sweatstack.toml before creating anything, so declining
79
+ # (or a non-interactive refusal) never leaves an orphaned application behind.
80
+ if Path(CONFIG_FILENAME).exists():
81
+ if not interactive:
82
+ console.print(
83
+ f"[red]Error:[/red] {CONFIG_FILENAME} already exists. "
84
+ "Remove it first or run interactively."
85
+ )
86
+ raise typer.Exit(1)
87
+ console.print(f"[yellow]Warning:[/yellow] {CONFIG_FILENAME} already exists.")
88
+ typer.confirm("Overwrite?", abort=True)
89
+
77
90
  # Prompt for optional fields in interactive mode
78
91
  if interactive:
79
92
  if description is None:
@@ -110,18 +123,7 @@ def create(
110
123
  if env_path:
111
124
  _write_env_file(env_path, result)
112
125
 
113
- # Write sweatstack.toml (protect existing file)
114
- config_path = Path(CONFIG_FILENAME)
115
- if config_path.exists():
116
- if not interactive:
117
- console.print(
118
- f"[red]Error:[/red] {CONFIG_FILENAME} already exists. "
119
- "Remove it first or run interactively."
120
- )
121
- raise typer.Exit(1)
122
- console.print(f"[yellow]Warning:[/yellow] {CONFIG_FILENAME} already exists.")
123
- typer.confirm("Overwrite?", abort=True)
124
-
126
+ # Write sweatstack.toml (checked for overwrite before the app was created)
125
127
  # Default the deploy directory to public/ so the project is deploy-ready and
126
128
  # consistent with `page init` / `page serve` / `page deploy`.
127
129
  config_path = write_config(
@@ -197,6 +199,11 @@ def _print_app_created(result: dict[str, str], env_path: Path | None, config_pat
197
199
  console.print()
198
200
  console.print("[yellow]Save the secret now — it won't be shown again.[/yellow]")
199
201
 
202
+ console.print()
203
+ console.print("Next: authorize with your own account. The app's overview walks you through it:")
204
+ console.print(f" {app_url(result['id'])}")
205
+ print_go_live(result)
206
+
200
207
 
201
208
  @app.command()
202
209
  def link(
@@ -16,9 +16,9 @@ import typer
16
16
  from rich.progress import Progress, SpinnerColumn, TextColumn
17
17
 
18
18
  from sweatstack_cli.api import APIClient
19
- from sweatstack_cli.config import get_settings
20
19
  from sweatstack_cli.console import console
21
20
  from sweatstack_cli.exceptions import APIError, AuthenticationError
21
+ from sweatstack_cli.go_live import print_go_live
22
22
  from sweatstack_cli.project import CONFIG_FILENAME, ProjectConfig, update_config, write_config
23
23
  from sweatstack_cli.services.applications import (
24
24
  APPLICATION_HAS_PAGE_CODE,
@@ -196,16 +196,8 @@ def deploy(
196
196
  console.print(f" Files: {file_count}")
197
197
  console.print(f" URL: {result.get('url', 'N/A')}")
198
198
 
199
- # Nudge to publish if app is private
200
- application = result.get("application", {})
201
- if application.get("is_private"):
202
- app_id = application.get("id")
203
- if app_id:
204
- base_url = get_settings().api_url
205
- console.print()
206
- console.print("Your app is private. Ready to go public?")
207
- publish_url = f"{base_url}/applications/{app_id}/publish"
208
- console.print(f" {publish_url}")
199
+ # What the app still needs before anyone else can connect, as the server reports it.
200
+ print_go_live(result.get("application") or {}, on_pages=True)
209
201
 
210
202
 
211
203
  def _upload(
@@ -0,0 +1,45 @@
1
+ """What an app still needs before anyone else can connect, as the CLI prints it.
2
+
3
+ The server decides: `go_live_missing` on the application in an API response is the same
4
+ checklist the web app's pages show (SweatStack plan 080). The CLI only prints it and links to
5
+ the page where each item is filled in, so a terminal, an agent and the browser agree.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Any
11
+
12
+ from sweatstack_cli.config import get_settings
13
+ from sweatstack_cli.console import console
14
+
15
+
16
+ def app_url(application_id: str, tab: str = "") -> str:
17
+ """The application's page in the web app, or one of its tabs."""
18
+ return f"{get_settings().api_url}/applications/{application_id}{tab}"
19
+
20
+
21
+ def print_go_live(application: dict[str, Any], *, on_pages: bool = False) -> None:
22
+ """Print what stands between `application` and anyone else connecting, or nothing when the
23
+ app is ready. A server older than the checklist sends only `is_private`; then the CLI says
24
+ that much and links to the same page."""
25
+ application_id = application.get("id")
26
+ if not application_id:
27
+ return
28
+ missing = [item["label"] for item in application.get("go_live_missing") or []]
29
+ private = bool(application.get("is_private"))
30
+ if not missing and not private:
31
+ return
32
+
33
+ console.print()
34
+ if private:
35
+ console.print("Your app is private: only you can connect.")
36
+ else:
37
+ console.print("Your app is public, but anyone else is turned away until you add:")
38
+ if missing:
39
+ if private:
40
+ console.print("Before anyone else can, add:")
41
+ for label in missing:
42
+ console.print(f" - {label}")
43
+ if private and on_pages:
44
+ console.print("Runs entirely in the browser? The Pages fast track fills in most of it.")
45
+ console.print(f" {app_url(application_id, '/consent')}")
@@ -44,6 +44,23 @@ class TestAppCreate:
44
44
  json={"name": "Test App"},
45
45
  )
46
46
 
47
+ def test_create_points_to_the_next_step(self, mock_api: MagicMock, tmp_path: Path) -> None:
48
+ """The app's overview walks the developer from here (SweatStack plan 080)."""
49
+ mock_api.post.return_value = {
50
+ "name": "Test App",
51
+ "id": "abc123",
52
+ "is_private": True,
53
+ "go_live_missing": [{"field": "description", "label": "description"}],
54
+ }
55
+
56
+ with runner.isolated_filesystem(temp_dir=tmp_path):
57
+ result = runner.invoke(app, ["app", "create", "Test App"])
58
+
59
+ assert result.exit_code == 0, result.output
60
+ assert "Next: authorize with your own account" in result.stdout
61
+ assert "/applications/abc123\n" in result.stdout
62
+ assert " - description" in result.stdout
63
+
47
64
  def test_create_with_page(self, mock_api: MagicMock, tmp_path: Path) -> None:
48
65
  """Should create an app with page association."""
49
66
  mock_api.post.return_value = {
@@ -189,9 +206,12 @@ class TestAppCreate:
189
206
  assert result.exit_code == 1
190
207
  assert "mutually exclusive" in result.stdout
191
208
 
192
- def test_create_not_authenticated(self) -> None:
209
+ def test_create_not_authenticated(self, tmp_path: Path) -> None:
193
210
  """Should error when not authenticated."""
194
- with patch("sweatstack_cli.commands.app.APIClient") as mock_client:
211
+ with (
212
+ patch("sweatstack_cli.commands.app.APIClient") as mock_client,
213
+ runner.isolated_filesystem(temp_dir=tmp_path),
214
+ ):
195
215
  mock_client.side_effect = AuthenticationError("Not authenticated")
196
216
 
197
217
  result = runner.invoke(app, ["app", "create", "Test App"])
@@ -200,15 +220,30 @@ class TestAppCreate:
200
220
  assert "Not authenticated" in result.stdout
201
221
  assert "sweatstack login" in result.stdout
202
222
 
203
- def test_create_api_error(self, mock_api: MagicMock) -> None:
223
+ def test_create_api_error(self, mock_api: MagicMock, tmp_path: Path) -> None:
204
224
  """Should handle API errors."""
205
225
  mock_api.post.side_effect = APIError("App name already exists")
206
226
 
207
- result = runner.invoke(app, ["app", "create", "Test App"])
227
+ with runner.isolated_filesystem(temp_dir=tmp_path):
228
+ result = runner.invoke(app, ["app", "create", "Test App"])
208
229
 
209
230
  assert result.exit_code == 3
210
231
  assert "App name already exists" in result.stdout
211
232
 
233
+ def test_create_existing_config_creates_nothing(
234
+ self, mock_api: MagicMock, tmp_path: Path
235
+ ) -> None:
236
+ """Should refuse before creating the app, never leaving an orphan behind."""
237
+ with runner.isolated_filesystem(temp_dir=tmp_path):
238
+ Path("sweatstack.toml").write_text('[app]\nclient_id = "existing"\n')
239
+
240
+ result = runner.invoke(app, ["app", "create", "Test App"])
241
+
242
+ assert result.exit_code == 1
243
+ assert "already exists" in result.stdout
244
+ mock_api.post.assert_not_called()
245
+ assert Path("sweatstack.toml").read_text() == '[app]\nclient_id = "existing"\n'
246
+
212
247
  def test_create_env_with_secret_no_warning_without_env(
213
248
  self, mock_api: MagicMock, tmp_path: Path
214
249
  ) -> None:
@@ -153,3 +153,61 @@ class TestDeployCreatesAppWhenUnlinked:
153
153
  assert result.exit_code == 1
154
154
  mock_api.post.assert_not_called()
155
155
  assert not Path("sweatstack.toml").exists()
156
+
157
+
158
+ class TestDeployPrintsWhatIsMissing:
159
+ """After a deploy the CLI prints the server's go-live checklist (SweatStack plan 080)."""
160
+
161
+ def _deploy(self, mock_api: MagicMock, application: dict) -> str:
162
+ mock_api.put.return_value = {**DEPLOYED, "application": application}
163
+ result = runner.invoke(app, ["page", "deploy", "my-page", "--dir", "public"])
164
+ assert result.exit_code == 0, result.output
165
+ return result.output
166
+
167
+ def test_a_private_app_lists_the_fields_and_the_consent_screen(
168
+ self, mock_api: MagicMock, site: Path
169
+ ) -> None:
170
+ output = self._deploy(
171
+ mock_api,
172
+ {
173
+ "id": "app_123",
174
+ "name": "My App",
175
+ "is_private": True,
176
+ "go_live_missing": [
177
+ {"field": "description", "label": "description"},
178
+ {"field": "purpose.activities", "label": "purpose for Activities"},
179
+ ],
180
+ },
181
+ )
182
+ assert "Your app is private" in output
183
+ assert " - description\n - purpose for Activities" in output
184
+ assert "Pages fast track" in output
185
+ assert "/applications/app_123/consent" in output
186
+ assert "/publish" not in output
187
+
188
+ def test_a_public_app_missing_a_purpose_says_who_is_turned_away(
189
+ self, mock_api: MagicMock, site: Path
190
+ ) -> None:
191
+ output = self._deploy(
192
+ mock_api,
193
+ {
194
+ "id": "app_123",
195
+ "name": "My App",
196
+ "is_private": False,
197
+ "go_live_missing": [{"field": "purpose.wellness", "label": "purpose for Wellness"}],
198
+ },
199
+ )
200
+ assert "turned away until you add" in output and "purpose for Wellness" in output
201
+
202
+ def test_a_ready_app_prints_nothing_extra(self, mock_api: MagicMock, site: Path) -> None:
203
+ output = self._deploy(
204
+ mock_api,
205
+ {"id": "app_123", "name": "My App", "is_private": False, "go_live_missing": []},
206
+ )
207
+ assert "/consent" not in output
208
+
209
+ def test_an_older_server_without_the_checklist_still_links(
210
+ self, mock_api: MagicMock, site: Path
211
+ ) -> None:
212
+ output = self._deploy(mock_api, {"id": "app_123", "name": "My App", "is_private": True})
213
+ assert "Your app is private" in output and "/applications/app_123/consent" in output
@@ -0,0 +1,17 @@
1
+ """The reported version is the one in pyproject.toml."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import tomllib
6
+ from pathlib import Path
7
+
8
+ from sweatstack_cli import __version__
9
+
10
+ PYPROJECT = Path(__file__).parent.parent / "pyproject.toml"
11
+
12
+
13
+ def test_version_matches_pyproject() -> None:
14
+ with PYPROJECT.open("rb") as f:
15
+ expected = tomllib.load(f)["project"]["version"]
16
+
17
+ assert __version__ == expected
@@ -463,7 +463,7 @@ wheels = [
463
463
 
464
464
  [[package]]
465
465
  name = "sweatstack-cli"
466
- version = "0.12.0"
466
+ version = "0.12.1"
467
467
  source = { editable = "." }
468
468
  dependencies = [
469
469
  { name = "httpx" },
@@ -1,3 +0,0 @@
1
- """SweatStack CLI — Command-line interface for the SweatStack platform."""
2
-
3
- __version__ = "0.11.0"
File without changes