apizit-cli 0.2.0b4__tar.gz → 0.4.0b1__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 (28) hide show
  1. apizit_cli-0.4.0b1/PKG-INFO +59 -0
  2. apizit_cli-0.4.0b1/README.md +42 -0
  3. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/pyproject.toml +34 -35
  4. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/__init__.py +3 -3
  5. apizit_cli-0.4.0b1/src/apizit_cli/account.py +107 -0
  6. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/commands.py +380 -337
  7. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/context.py +234 -154
  8. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/main.py +191 -172
  9. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/operations.py +885 -745
  10. apizit_cli-0.4.0b1/src/apizit_cli/presentation.py +602 -0
  11. apizit_cli-0.4.0b1/src/apizit_cli/selection.py +60 -0
  12. apizit_cli-0.4.0b1/src/apizit_cli.egg-info/PKG-INFO +59 -0
  13. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/SOURCES.txt +3 -0
  14. apizit_cli-0.2.0b4/PKG-INFO +0 -54
  15. apizit_cli-0.2.0b4/README.md +0 -36
  16. apizit_cli-0.2.0b4/src/apizit_cli.egg-info/PKG-INFO +0 -54
  17. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/setup.cfg +0 -0
  18. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/authentication.py +0 -0
  19. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/configuration.py +0 -0
  20. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/credential_store.py +0 -0
  21. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/domains.py +0 -0
  22. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/errors.py +0 -0
  23. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/http.py +0 -0
  24. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli/sources.py +0 -0
  25. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/dependency_links.txt +0 -0
  26. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/entry_points.txt +0 -0
  27. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/requires.txt +0 -0
  28. {apizit_cli-0.2.0b4 → apizit_cli-0.4.0b1}/src/apizit_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: apizit-cli
3
+ Version: 0.4.0b1
4
+ Summary: Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI.
5
+ Author: APIZIT
6
+ Classifier: Environment :: Console
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: requests<3,>=2.32.0
13
+ Requires-Dist: pydantic<3,>=2.12.5
14
+ Requires-Dist: pyyaml<7,>=6.0.3
15
+ Requires-Dist: keyring<26,>=25.7
16
+ Requires-Dist: pathspec<2,>=1
17
+
18
+ # APIZIT CLI
19
+
20
+ Check a project, launch its analyzed source and get its live API URL from your terminal.
21
+ Managed adapters cover Flask, FastAPI, Django, Express, NestJS and Spring Boot;
22
+ APIZIT Linking provides declarative Python routes. Scan to confirm compatibility.
23
+
24
+ Python 3.12 or later is required. This guide covers prerelease 0.4.0b1.
25
+ Install that exact version with pip (or py -m pip on Windows):
26
+
27
+ ```sh
28
+ python -m pip install apizit-cli==0.4.0b1
29
+ apizit login
30
+ apizit account setup
31
+ apizit workspace use
32
+ apizit scan .
33
+ apizit deploy --from-scan latest
34
+ apizit api show
35
+ ```
36
+
37
+ Use `python -m pip install --upgrade apizit-cli==0.4.0b1` to update.
38
+ `pipx install apizit-cli==0.4.0b1` is an isolated alternative. An unversioned install
39
+ can select an older stable release. No AWS account, Docker or backend checkout is needed.
40
+ Account setup asks for your public username and explicit choices after reviewing required documents.
41
+
42
+ The default view summarizes outcomes. `--verbose` adds technical details; `--json` preserves
43
+ the complete versioned result and takes priority. Existing IDs and CI scripts remain supported.
44
+ Names and slugs resolve accessible resources only; ambiguous names need IDs.
45
+ `apizit api use "weather-api"` links an existing API without replacing another binding.
46
+
47
+ Interactive operations save non-secret references in `.apizit/operations.json`, scoped by folder,
48
+ endpoint and workspace. `latest` resumes the recorded operation. `deploy --from-scan latest`
49
+ reuses the exact scanned snapshot, excluding later edits. `deploy .` uploads current bytes.
50
+ The short commands above assume the same project folder. Copy the complete `Next:`
51
+ command after scanning an absolute path; its `--project-dir`, endpoint and workspace
52
+ keep the scan context when you execute it from another directory.
53
+
54
+ APIZIT remains prelaunch. The default endpoint is `https://api.apizit.com/v1` (protected main domain).
55
+ For TEST, pass `--endpoint https://api-test.apizit.com/v1` or set `APIZIT_API_URL` on every command.
56
+ Sessions stay separate by endpoint. Configuration keeps its strict version 2 schema.
57
+
58
+ Run `apizit --help` or `apizit docs`. CI and AI agents use `--json --non-interactive` with
59
+ explicit IDs, stable idempotency keys and an expiring token. Store secrets in the workspace vault.
@@ -0,0 +1,42 @@
1
+ # APIZIT CLI
2
+
3
+ Check a project, launch its analyzed source and get its live API URL from your terminal.
4
+ Managed adapters cover Flask, FastAPI, Django, Express, NestJS and Spring Boot;
5
+ APIZIT Linking provides declarative Python routes. Scan to confirm compatibility.
6
+
7
+ Python 3.12 or later is required. This guide covers prerelease 0.4.0b1.
8
+ Install that exact version with pip (or py -m pip on Windows):
9
+
10
+ ```sh
11
+ python -m pip install apizit-cli==0.4.0b1
12
+ apizit login
13
+ apizit account setup
14
+ apizit workspace use
15
+ apizit scan .
16
+ apizit deploy --from-scan latest
17
+ apizit api show
18
+ ```
19
+
20
+ Use `python -m pip install --upgrade apizit-cli==0.4.0b1` to update.
21
+ `pipx install apizit-cli==0.4.0b1` is an isolated alternative. An unversioned install
22
+ can select an older stable release. No AWS account, Docker or backend checkout is needed.
23
+ Account setup asks for your public username and explicit choices after reviewing required documents.
24
+
25
+ The default view summarizes outcomes. `--verbose` adds technical details; `--json` preserves
26
+ the complete versioned result and takes priority. Existing IDs and CI scripts remain supported.
27
+ Names and slugs resolve accessible resources only; ambiguous names need IDs.
28
+ `apizit api use "weather-api"` links an existing API without replacing another binding.
29
+
30
+ Interactive operations save non-secret references in `.apizit/operations.json`, scoped by folder,
31
+ endpoint and workspace. `latest` resumes the recorded operation. `deploy --from-scan latest`
32
+ reuses the exact scanned snapshot, excluding later edits. `deploy .` uploads current bytes.
33
+ The short commands above assume the same project folder. Copy the complete `Next:`
34
+ command after scanning an absolute path; its `--project-dir`, endpoint and workspace
35
+ keep the scan context when you execute it from another directory.
36
+
37
+ APIZIT remains prelaunch. The default endpoint is `https://api.apizit.com/v1` (protected main domain).
38
+ For TEST, pass `--endpoint https://api-test.apizit.com/v1` or set `APIZIT_API_URL` on every command.
39
+ Sessions stay separate by endpoint. Configuration keeps its strict version 2 schema.
40
+
41
+ Run `apizit --help` or `apizit docs`. CI and AI agents use `--json --non-interactive` with
42
+ explicit IDs, stable idempotency keys and an expiring token. Store secrets in the workspace vault.
@@ -1,35 +1,34 @@
1
- [build-system]
2
- requires = ["setuptools>=77"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "apizit-cli"
7
- version = "0.2.0b4"
8
- description = "Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI."
9
- readme = "README.md"
10
- requires-python = ">=3.12"
11
- authors = [{name = "APIZIT"}]
12
- classifiers = [
13
- "Development Status :: 4 - Beta",
14
- "Environment :: Console",
15
- "Operating System :: OS Independent",
16
- "Programming Language :: Python :: 3",
17
- "Programming Language :: Python :: 3.12",
18
- ]
19
- dependencies = [
20
- "requests>=2.32.0,<3",
21
- "pydantic>=2.12.5,<3",
22
- "pyyaml>=6.0.3,<7",
23
- "keyring>=25.7,<26",
24
- "pathspec>=1,<2",
25
- ]
26
-
27
- [project.scripts]
28
- apizit = "apizit_cli.main:main"
29
-
30
- [tool.setuptools.packages.find]
31
- where = ["src"]
32
- include = ["apizit_cli*"]
33
-
34
- [tool.setuptools.package-data]
35
- apizit_cli = ["data/*.json", "data/*.md", "data/*.yaml"]
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "apizit-cli"
7
+ version = "0.4.0b1"
8
+ description = "Launch supported Python, JavaScript, TypeScript or Java APIs from your terminal or CI."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ authors = [{name = "APIZIT"}]
12
+ classifiers = [
13
+ "Environment :: Console",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.12",
17
+ ]
18
+ dependencies = [
19
+ "requests>=2.32.0,<3",
20
+ "pydantic>=2.12.5,<3",
21
+ "pyyaml>=6.0.3,<7",
22
+ "keyring>=25.7,<26",
23
+ "pathspec>=1,<2",
24
+ ]
25
+
26
+ [project.scripts]
27
+ apizit = "apizit_cli.main:main"
28
+
29
+ [tool.setuptools.packages.find]
30
+ where = ["src"]
31
+ include = ["apizit_cli*"]
32
+
33
+ [tool.setuptools.package-data]
34
+ apizit_cli = ["data/*.json", "data/*.md", "data/*.yaml"]
@@ -1,3 +1,3 @@
1
- """The APIZIT HTTP client. Importing this package never initializes a session."""
2
-
3
- __version__ = "0.2.0b4"
1
+ """The APIZIT HTTP client. Importing this package never initializes a session."""
2
+
3
+ __version__ = "0.4.0b1"
@@ -0,0 +1,107 @@
1
+ """Account setup through the existing server-owned profile and acceptance contracts."""
2
+
3
+ import re
4
+ import sys
5
+
6
+ from apizit_cli.errors import CliError, EXIT_USAGE
7
+ from apizit_cli.presentation import safe_text
8
+
9
+
10
+ def account_command(runner):
11
+ profile = runner.get("/account/profile", workspace=False)
12
+ if runner.args.command_path == "account show":
13
+ return profile
14
+ username = runner.args.username or profile.get("username")
15
+ if not username:
16
+ if runner.non_interactive:
17
+ raise CliError(
18
+ "Provide a public username: apizit account setup <username>.",
19
+ code="USERNAME_REQUIRED",
20
+ exit_code=EXIT_USAGE,
21
+ )
22
+ print("Public username: ", end="", file=sys.stderr, flush=True)
23
+ username = sys.stdin.readline().strip()
24
+ # Format, uniqueness and rename rules belong to the server, never to a second CLI model.
25
+ if profile.get("legal_acceptance_current") is True:
26
+ if username == profile.get("username"):
27
+ return {"profile": profile, "already_complete": True}
28
+ updated = runner.client.request(
29
+ "PUT",
30
+ "/account/profile",
31
+ workspace=False,
32
+ body={
33
+ "username": username,
34
+ "company_name": profile.get("company_name"),
35
+ "profession": profile.get("profession"),
36
+ },
37
+ )
38
+ return {"profile": updated}
39
+
40
+ requirements = profile.get("legal_requirements") or runner.get(
41
+ "/account/legal-requirements", workspace=False, authenticated=False
42
+ )
43
+ documents = requirements.get("documents")
44
+ if (
45
+ not isinstance(documents, list)
46
+ or not documents
47
+ or any(
48
+ not isinstance(doc, dict)
49
+ or not re.fullmatch(r"[a-z][a-z0-9_]{0,63}", str(doc.get("document_id", "")))
50
+ or not re.fullmatch(r"[a-zA-Z0-9.-]{1,64}", str(doc.get("version", "")))
51
+ or doc.get("choice") not in {"agreement", "acknowledgement"}
52
+ or not isinstance(doc.get("url"), str)
53
+ or not doc["url"].startswith("https://")
54
+ for doc in documents
55
+ )
56
+ ):
57
+ raise CliError(
58
+ "APIZIT returned invalid account document requirements.", code="INVALID_RESPONSE"
59
+ )
60
+ expected = {f"{doc['document_id']}={doc['version']}" for doc in documents}
61
+ selected = runner.args.accept_document or []
62
+ if selected and (set(selected) != expected or len(selected) != len(expected)):
63
+ raise CliError(
64
+ "Document choices do not match the current versions. Review account show before retrying.",
65
+ code="LEGAL_DOCUMENT_VERSION_CHANGED",
66
+ exit_code=EXIT_USAGE,
67
+ )
68
+ if not selected:
69
+ if runner.non_interactive:
70
+ raise CliError(
71
+ "Review the current documents with apizit account show. Then repeat account setup "
72
+ "with --accept-document DOCUMENT_ID=VERSION for each explicit choice.",
73
+ code="LEGAL_ACCEPTANCE_REQUIRED",
74
+ exit_code=EXIT_USAGE,
75
+ details={"required_documents": documents},
76
+ )
77
+ for doc in documents:
78
+ verb = "agree to" if doc["choice"] == "agreement" else "acknowledge"
79
+ print(
80
+ f"{safe_text(doc.get('title') or doc['document_id'])} "
81
+ f"(version {safe_text(doc['version'])}): {safe_text(doc['url'])}",
82
+ file=sys.stderr,
83
+ )
84
+ print(
85
+ f'After reviewing this document, type "yes" to {verb} it: ',
86
+ end="",
87
+ file=sys.stderr,
88
+ flush=True,
89
+ )
90
+ if sys.stdin.readline().strip() != "yes":
91
+ raise CliError(
92
+ "Account setup was not submitted. No document choice was saved.",
93
+ code="CONFIRMATION_DECLINED",
94
+ exit_code=EXIT_USAGE,
95
+ )
96
+ return runner.client.request(
97
+ "POST",
98
+ "/account/onboarding",
99
+ workspace=False,
100
+ body={
101
+ "username": username,
102
+ "legal_acceptances": [
103
+ {"document_id": doc["document_id"], "version": doc["version"], "accepted": True}
104
+ for doc in documents
105
+ ],
106
+ },
107
+ )