Skip to content

Commit 46f75ee

Browse files
atokayevclaude
andauthored
[CLI] Surface Terms of Service link in login and version banner (#167)
* [CLI] Surface Terms of Service link in login and version banner Add the Terms of Service URL to the CLI so users can find the terms without acceptance being required: - New CENTML_TERMS_OF_SERVICE_URL setting (env-overridable), defaulting to https://app.centml.com/terms-of-service/ - login prints a "By continuing, you agree to the Terms of Service" notice before the browser prompt (only when a login is needed) - The --version banner shows a Terms of Service line No acceptance step is added; this is informational only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Add CODEOWNERS with Platform team as default owner Request the Platform team for review on every pull request. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Collapse CODEOWNERS whitespace to a single space Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7cfd52f commit 46f75ee

5 files changed

Lines changed: 42 additions & 1 deletion

File tree

‎.github/CODEOWNERS‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Code owners for this repository.
2+
# These owners are the default for everything in the repo and are
3+
# automatically requested for review on every pull request.
4+
# See https://docs.github.com/articles/about-code-owners
5+
6+
* @CentML/platform-team

‎centml/cli/login.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def login(token_file):
9696
click.echo("✅ Login successful")
9797
else:
9898
click.echo("Logging into CCluster...")
99+
click.echo(f"By continuing, you agree to the Terms of Service: {settings.CENTML_TERMS_OF_SERVICE_URL}\n")
99100

100101
choice = click.confirm("Do you want to log in with your browser now?", default=True)
101102
if choice:

‎centml/cli/main.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
delete_cluster,
1515
)
1616
from centml.cli.shell import shell, exec_cmd
17+
from centml.sdk.config import settings
1718

1819
# NVIDIA green (#76B900)
1920
_NVIDIA_GREEN = (118, 185, 0)
@@ -32,7 +33,7 @@
3233
✨ AI Deployment Made Simple ✨
3334
📚 Documentation: https://docs.nvidia.com/ccluster
3435
💬 Need help? Reach out on GitHub: https://github.com/NVIDIA/ccluster
35-
"""
36+
📄 Terms of Service: """ + settings.CENTML_TERMS_OF_SERVICE_URL + "\n"
3637

3738

3839
@click.group()

‎centml/sdk/config.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class Config(BaseSettings):
99
model_config = SettingsConfigDict(env_file=Path(".env"), extra="ignore")
1010

1111
CENTML_WEB_URL: str = os.getenv("CENTML_WEB_URL", default="https://app.centml.com/")
12+
CENTML_TERMS_OF_SERVICE_URL: str = os.getenv(
13+
"CENTML_TERMS_OF_SERVICE_URL", default="https://app.centml.com/terms-of-service/"
14+
)
1215
CENTML_CONFIG_PATH: str = os.getenv("CENTML_CONFIG_PATH", default=os.path.expanduser("~/.centml"))
1316
CENTML_CRED_FILE: str = os.getenv("CENTML_CRED_FILE", default="credentials.json")
1417
CENTML_CRED_FILE_PATH: str = os.path.join(CENTML_CONFIG_PATH, CENTML_CRED_FILE)

‎tests/test_cli_terms.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from unittest.mock import patch
2+
3+
from click.testing import CliRunner
4+
5+
from centml.cli.main import cli
6+
from centml.sdk.config import settings
7+
8+
TOS_URL = settings.CENTML_TERMS_OF_SERVICE_URL
9+
10+
11+
def test_version_shows_terms_url():
12+
result = CliRunner().invoke(cli, ["--version"])
13+
assert result.exit_code == 0
14+
assert TOS_URL in result.output
15+
16+
17+
def test_login_shows_terms_url_when_not_authenticated():
18+
with patch("centml.cli.login.auth.load_centml_cred", return_value=None):
19+
result = CliRunner().invoke(cli, ["login"], input="n\n")
20+
assert TOS_URL in result.output
21+
assert "Terms of Service" in result.output
22+
23+
24+
def test_login_with_stored_credentials_skips_terms_notice():
25+
with patch("centml.cli.login.auth.load_centml_cred", return_value={"refresh_token": "x"}), patch(
26+
"centml.cli.login.auth.refresh_centml_token", return_value=True
27+
):
28+
result = CliRunner().invoke(cli, ["login"])
29+
assert "Login successful" in result.output
30+
assert TOS_URL not in result.output

0 commit comments

Comments
 (0)