tooig 0.1.3__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.
tooig-0.1.3/.gitignore ADDED
@@ -0,0 +1,224 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .test-tmp/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Node.js dependencies and debug output
56
+ node_modules/
57
+ npm-debug.log*
58
+ pnpm-debug.log*
59
+
60
+ # Translations
61
+ *.mo
62
+ *.pot
63
+
64
+ # Django stuff:
65
+ *.log
66
+ local_settings.py
67
+ db.sqlite3
68
+ db.sqlite3-journal
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ .pybuilder/
82
+ target/
83
+
84
+ # Jupyter Notebook
85
+ .ipynb_checkpoints
86
+
87
+ # IPython
88
+ profile_default/
89
+ ipython_config.py
90
+
91
+ # pyenv
92
+ # For a library or package, you might want to ignore these files since the code is
93
+ # intended to run in multiple environments; otherwise, check them in:
94
+ # .python-version
95
+
96
+ # pipenv
97
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
99
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
100
+ # install all needed dependencies.
101
+ # Pipfile.lock
102
+
103
+ # UV
104
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # uv.lock
108
+
109
+ # poetry
110
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
111
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
112
+ # commonly ignored for libraries.
113
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
114
+ # poetry.lock
115
+ # poetry.toml
116
+
117
+ # pdm
118
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
119
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
120
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
121
+ # pdm.lock
122
+ # pdm.toml
123
+ .pdm-python
124
+ .pdm-build/
125
+
126
+ # pixi
127
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
128
+ # pixi.lock
129
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
130
+ # in the .venv directory. It is recommended not to include this directory in version control.
131
+ .pixi
132
+
133
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
134
+ __pypackages__/
135
+
136
+ # Celery stuff
137
+ celerybeat-schedule
138
+ celerybeat.pid
139
+
140
+ # Redis
141
+ *.rdb
142
+ *.aof
143
+ *.pid
144
+
145
+ # RabbitMQ
146
+ mnesia/
147
+ rabbitmq/
148
+ rabbitmq-data/
149
+
150
+ # ActiveMQ
151
+ activemq-data/
152
+
153
+ # SageMath parsed files
154
+ *.sage.py
155
+
156
+ # Environments
157
+ .env
158
+ .envrc
159
+ .venv
160
+ env/
161
+ venv/
162
+ ENV/
163
+ env.bak/
164
+ venv.bak/
165
+
166
+ # Spyder project settings
167
+ .spyderproject
168
+ .spyproject
169
+
170
+ # Rope project settings
171
+ .ropeproject
172
+
173
+ # mkdocs documentation
174
+ /site
175
+
176
+ # mypy
177
+ .mypy_cache/
178
+ .dmypy.json
179
+ dmypy.json
180
+
181
+ # Pyre type checker
182
+ .pyre/
183
+
184
+ # pytype static type analyzer
185
+ .pytype/
186
+
187
+ # Cython debug symbols
188
+ cython_debug/
189
+
190
+ # PyCharm
191
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
192
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
193
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
194
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
195
+ # .idea/
196
+
197
+ # Abstra
198
+ # Abstra is an AI-powered process automation framework.
199
+ # Ignore directories containing user credentials, local state, and settings.
200
+ # Learn more at https://abstra.io/docs
201
+ .abstra/
202
+
203
+ # Visual Studio Code
204
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
205
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
206
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
207
+ # you could uncomment the following to ignore the entire vscode folder
208
+ # .vscode/
209
+ # Temporary file for partial code execution
210
+ tempCodeRunnerFile.py
211
+
212
+ # Ruff stuff:
213
+ .ruff_cache/
214
+
215
+ # PyPI configuration file
216
+ .pypirc
217
+
218
+ # Marimo
219
+ marimo/_static/
220
+ marimo/_lsp/
221
+ __marimo__/
222
+
223
+ # Streamlit
224
+ .streamlit/secrets.toml
tooig-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,282 @@
1
+ Metadata-Version: 2.4
2
+ Name: tooig
3
+ Version: 0.1.3
4
+ Summary: Interactive framework for tooig developer program
5
+ Project-URL: Documentation, https://developer.tooig.com/get_started
6
+ Project-URL: Issues, https://github.com/tooig/developer/issues
7
+ Project-URL: Repository, https://github.com/tooig/developer
8
+ Author-email: "Tooig, Inc" <tooighq@gmail.com>
9
+ License: MIT
10
+ Keywords: cli,developer,nineth,tooig
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: httpx<1,>=0.27
18
+ Requires-Dist: platformdirs<5,>=4.2
19
+ Requires-Dist: questionary<3,>=2.1
20
+ Requires-Dist: rich<15,>=13.9
21
+ Requires-Dist: typer<1,>=0.15
22
+ Description-Content-Type: text/markdown
23
+
24
+ # tooig CLI
25
+
26
+ `tooig` is the secure setup CLI for Tooig developers. It is published with the same name and version to PyPI and npm. Both distributions implement the same authentication, build authorization, credential-storage, and SDK-installation flow.
27
+
28
+ ## Table of contents
29
+
30
+ 1. [Requirements](#requirements)
31
+ 2. [Installation](#installation)
32
+ 3. [Developer setup walkthrough](#developer-setup-walkthrough)
33
+ 4. [Authentication](#authentication)
34
+ 5. [Build authorization](#build-authorization)
35
+ 6. [Framework installation](#framework-installation)
36
+ 7. [Credential storage](#credential-storage)
37
+ 8. [Configuration](#configuration)
38
+ 9. [Service contract](#service-contract)
39
+ 10. [Security model](#security-model)
40
+ 11. [Troubleshooting](#troubleshooting)
41
+ 12. [Release process](#release-process)
42
+
43
+ ## Requirements
44
+
45
+ Use either of these runtimes:
46
+
47
+ - Python 3.10 or newer and `pip`.
48
+ - Node.js 20 or newer and npm or pnpm.
49
+
50
+ The selected framework must exist in the same package registry as the installed CLI. The Python CLI installs from PyPI; the Node.js CLI installs from npm.
51
+
52
+ ## Installation
53
+
54
+ ### Python and pip
55
+
56
+ ```console
57
+ python -m pip install --upgrade tooig
58
+ tooig developer
59
+ ```
60
+
61
+ ### npm
62
+
63
+ Install globally:
64
+
65
+ ```console
66
+ npm install --global tooig
67
+ tooig developer
68
+ ```
69
+
70
+ Or run without a permanent global installation:
71
+
72
+ ```console
73
+ npx tooig developer
74
+ ```
75
+
76
+ ### pnpm
77
+
78
+ ```console
79
+ pnpm add --global tooig
80
+ tooig developer
81
+ ```
82
+
83
+ Or:
84
+
85
+ ```console
86
+ pnpm dlx tooig developer
87
+ ```
88
+
89
+ `npx install --g tooig` is not a valid npm installation command. Use `npm install --global tooig` or `npx tooig developer` instead.
90
+
91
+ ## Developer setup walkthrough
92
+
93
+ Run:
94
+
95
+ ```console
96
+ tooig developer
97
+ ```
98
+
99
+ The CLI performs these steps:
100
+
101
+ 1. Prompts for the name portion of the developer email. Enter `ada` for `ada@developer.tooig.com`.
102
+ 2. Offers **Sign in** and **Create developer account**.
103
+ 3. Reads the password without echoing characters to the terminal.
104
+ 4. Authenticates with the Tooig API.
105
+ 5. Offers browser authorization or an existing API key.
106
+ 6. Validates and stores the resulting API key.
107
+ 7. Offers `nineth` and `bridge (nineth-bridge)`.
108
+ 8. Installs the selected SDK using the CLI's package ecosystem.
109
+ 9. Prints the getting-started URL: <https://developer.tooig.com/get_started>.
110
+
111
+ Use `--no-open` on remote machines to print the browser authorization URL without launching a browser:
112
+
113
+ ```console
114
+ tooig developer --no-open
115
+ ```
116
+
117
+ ## Authentication
118
+
119
+ The prompt accepts only the local portion of a Tooig developer address:
120
+
121
+ ```text
122
+ email: [name]@developer.tooig.com
123
+ ```
124
+
125
+ The suffix is fixed by the CLI. Local parts are normalized to lowercase and may contain letters, numbers, dots, underscores, and hyphens.
126
+
127
+ For a new account, select **Create developer account** and use a password of at least 12 characters. The CLI submits the signup and then authenticates. If the account policy requires email verification, verify the address and run `tooig developer` again.
128
+
129
+ Passwords and short-lived login tokens are held in memory only. They are never written to the credential file or displayed in progress/error output.
130
+
131
+ ## Build authorization
132
+
133
+ ### Secure browser link
134
+
135
+ The CLI asks the Tooig API to create a signed, short-lived authorization request. The service returns the link; the CLI does not generate or sign authorization links locally.
136
+
137
+ ```text
138
+ https://developer.tooig.com/{server-generated-id}
139
+ ```
140
+
141
+ The link is opened in the default browser unless `--no-open` is set. The CLI polls the service until the request is approved, denied, cancelled, or expired. On approval, the service returns the build API key.
142
+
143
+ The CLI rejects an authorization URL that changes the configured API host or downgrades HTTPS. Localhost development may use HTTP.
144
+
145
+ ### Existing API key
146
+
147
+ Select **Use an existing API key**. Input is hidden. Before storing the key, the CLI validates it against the authenticated session endpoint. Invalid or truncated keys are not saved.
148
+
149
+ ## Framework installation
150
+
151
+ The framework choices and commands are:
152
+
153
+ | CLI distribution | Selection | Command |
154
+ | --- | --- | --- |
155
+ | PyPI | `nineth` | `python -m pip install --upgrade nineth` |
156
+ | PyPI | `bridge` | `python -m pip install --upgrade nineth-bridge` |
157
+ | npm | `nineth` | `npm install nineth` |
158
+ | npm | `bridge` | `npm install nineth-bridge` |
159
+ | pnpm | `nineth` | `pnpm add nineth` |
160
+ | pnpm | `bridge` | `pnpm add nineth-bridge` |
161
+
162
+ The Node.js CLI detects pnpm through `npm_config_user_agent`; all other npm/npx invocations use npm. Installer commands use argument arrays and never interpolate user input into a shell command.
163
+
164
+ ## Credential storage
165
+
166
+ Python and Node.js use the same versioned JSON format so either CLI can reuse the authorization:
167
+
168
+ | Platform | Default location |
169
+ | --- | --- |
170
+ | Windows | `%APPDATA%\\tooig\\credentials.json` |
171
+ | macOS | `~/Library/Application Support/tooig/credentials.json` |
172
+ | Linux | `${XDG_CONFIG_HOME:-~/.config}/tooig/credentials.json` |
173
+
174
+ The file contains the developer email, API base URL, and API key. It never contains the password or login token.
175
+
176
+ Writes use a temporary file followed by an atomic rename. On POSIX systems the directory is mode `0700` and the file is mode `0600`. Both clients refuse to read or replace a symlinked credential file. Do not commit this file or copy it into a project directory.
177
+
178
+ ## Configuration
179
+
180
+ The production API is used by default:
181
+
182
+ ```text
183
+ https://developer.tooig.com/api
184
+ ```
185
+
186
+ Override it for development with `TOOIG_API_URL` or `--api-url`:
187
+
188
+ ```console
189
+ tooig developer --api-url http://localhost:8000/api
190
+ ```
191
+
192
+ Non-local API URLs must use HTTPS and cannot contain embedded usernames or passwords.
193
+
194
+ ## Service contract
195
+
196
+ The CLI expects these server endpoints relative to the API base URL:
197
+
198
+ | Method | Endpoint | Purpose |
199
+ | --- | --- | --- |
200
+ | `POST` | `/auth/signup` | Create a developer account. |
201
+ | `POST` | `/auth/login` | Return a short-lived `access_token`. |
202
+ | `GET` | `/auth/session` | Validate an existing bearer API key. |
203
+ | `POST` | `/developer/authorizations` | Create a signed browser authorization request. |
204
+ | `GET` | `/developer/authorizations/{id}` | Poll `pending`, `approved`, `denied`, `cancelled`, or `expired`. |
205
+
206
+ The authorization creation response is:
207
+
208
+ ```json
209
+ {
210
+ "id": "server-generated-id",
211
+ "authorization_url": "https://developer.tooig.com/server-generated-id",
212
+ "interval": 2,
213
+ "expires_in": 300
214
+ }
215
+ ```
216
+
217
+ An approved poll response is:
218
+
219
+ ```json
220
+ {
221
+ "status": "approved",
222
+ "api_key": "server-issued-secret"
223
+ }
224
+ ```
225
+
226
+ The repository currently supplies `/auth/signup`, `/auth/login`, and `/auth/session`. Browser authorization requires the `/developer/authorizations` service to be deployed before that option can complete. Existing API-key authorization is usable against the current API.
227
+
228
+ ## Security model
229
+
230
+ - HTTPS is mandatory except for loopback development.
231
+ - Password and API-key prompts do not echo input.
232
+ - The server signs and issues authorization requests and keys.
233
+ - Authorization URLs are origin-checked before opening.
234
+ - Login tokens are not persisted.
235
+ - Existing keys are validated before persistence.
236
+ - Secrets are not passed as command-line arguments to package managers.
237
+ - Network failures are converted to bounded errors without response dumps.
238
+ - Framework names are selected from a fixed allowlist.
239
+ - Credential writes are atomic and symlink-resistant.
240
+
241
+ Local credential-file protection is not a substitute for full-disk encryption or a locked operating-system account. Rotate the API key immediately if the workstation or file is compromised.
242
+
243
+ ## Troubleshooting
244
+
245
+ ### Account creation succeeds but login fails
246
+
247
+ The account may require email verification. Complete verification and rerun `tooig developer` using **Sign in**.
248
+
249
+ ### Browser authorization is unavailable
250
+
251
+ Use **Use an existing API key** until the browser-authorization service is deployed. For remote or headless environments, use `--no-open` and open the printed link on another trusted device.
252
+
253
+ ### Package installation fails
254
+
255
+ Check registry access and install the selected package directly using the command in [Framework installation](#framework-installation). The authorization remains stored, so rerunning setup does not expose the password or key.
256
+
257
+ ### PowerShell blocks `npm.ps1`
258
+
259
+ Use `npm.cmd` in a restricted PowerShell session or adjust the local execution policy according to your organization's policy. The published `tooig` executable itself does not require shell interpolation.
260
+
261
+ ## Release process
262
+
263
+ Repository versioning is controlled by the first recognized dispatch token in a commit message:
264
+
265
+ | Dispatch | Version bump | Repository | PyPI/npm `tooig` |
266
+ | --- | --- | --- | --- |
267
+ | `build:` | Major | Bump and GitHub release | No publish |
268
+ | `feat:` | Minor | Bump and GitHub release | No publish |
269
+ | `chore:` | Patch | Bump and GitHub release | No publish |
270
+ | `build[tooig]:` | Major | Bump and GitHub release | Bump, build, validate, publish, release |
271
+ | `feat[tooig]:` | Minor | Bump and GitHub release | Bump, build, validate, publish, release |
272
+ | `chore[tooig]:` | Patch | Bump and GitHub release | Bump, build, validate, publish, release |
273
+
274
+ The PyPI and npm versions must match before a scoped release. The script updates both manifests and the npm lockfile together. Repository tags use `vX.Y.Z`; package tags use `tooig-vX.Y.Z`.
275
+
276
+ GitHub Actions requires:
277
+
278
+ - An npm automation token in the `NPM_TOKEN` repository secret.
279
+ - PyPI Trusted Publishing configured for this repository and workflow.
280
+ - `contents: write` and `id-token: write`, already declared by the workflow.
281
+
282
+ The repository release reads `.github/release_notes/repository.md`. The package release reads `.github/release_notes/tooig.md`.
@@ -0,0 +1,9 @@
1
+ # tooig
2
+
3
+ Secure interactive setup for Tooig developers.
4
+
5
+ ```console
6
+ npx tooig developer
7
+ ```
8
+
9
+ Full documentation: <https://developer.tooig.com/get_started>
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { run } from '../src/cli.js';
4
+
5
+ await run(process.argv);