Metadata-Version: 2.4
Name: geotech-cli
Version: 0.2.0rc1
Summary: Contributor CLI for Stratum Commons executable notebooks and tool walkthroughs.
Project-URL: Homepage, https://stratumcommons.org
Project-URL: Documentation, https://stratumcommons.org/docs/python/geotech-cli
Project-URL: Repository, https://github.com/stratum-commons-stack/stratum_commons
Project-URL: Issues, https://github.com/stratum-commons-stack/stratum_commons/issues
Project-URL: Changelog, https://github.com/stratum-commons-stack/stratum_commons/blob/main/packages/geotech-cli/CHANGELOG.md
Author: Stratum Commons contributors
License-Expression: MIT
License-File: LICENSE
Keywords: engineering,geotechnical,notebook,pyodide,stratum-commons
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.13
Requires-Dist: httpx>=0.28.1
Requires-Dist: keyring>=25.6.0
Requires-Dist: pydantic>=2.11.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: typer>=0.16.0
Description-Content-Type: text/markdown

# geotech-cli

`geotech-cli` is the contributor-facing scaffold for Stratum Commons executable notebooks and tool walkthroughs.

This in-repo scaffold currently supports a narrow Phase 2 contract:

- parse and validate the published YAML front-matter schema
- run a local Python `run(runtime_inputs)` function after the front-matter block
- persist a recorded output bundle under `.geotech/output/`
- submit the bundle to `POST /api/cli/submit` using a bearer token or browser-session-equivalent API token

## Source file contract

The CLI expects a source file that starts with a fenced YAML block and then defines Python source code.

```python
---
schema: 1
standard_id: geo.spt.n60_correction
version: 1.0.0
runtime:
  target: browser
  pyodide: "0.29.4"
inputs:
  - id: raw_blow_count
    label: Raw blow count
    quantity_kind: blow_count
    unit: blows/0.3m
outputs:
  - id: n60
    label: Corrected N60
    kind: scalar
    quantity_kind: blow_count
    unit: blows/0.3m
licence:
  code: MIT
audience: practitioner
domain_tags:
  - foundations
known_limitations:
  - Demonstration scaffold only.
required_packages:
  - numpy
lockfile: uv.lock
---

DEFAULT_INPUTS = {
    "raw_blow_count": 18,
}

def run(runtime_inputs):
    return {
        "summary": "Executed local scaffold.",
        "scalarOutputs": [
            {"id": "n60", "label": "Corrected N60", "value": runtime_inputs["raw_blow_count"], "unit": "blows/0.3m"},
        ],
    }
```

`DEFAULT_INPUTS` is optional. The CLI merges repeated `--input key=value` arguments over those defaults.

## Commands

```bash
geotech validate notebook.py
geotech run notebook.py --input raw_blow_count=18
geotech submit notebook.py --title "SPT demo" --summary "Demo executable post"
geotech checklist notebook.py
geotech auth save-token stc_pat_...
```

## Notes

- `validate` checks `uv.lock`, the manifest schema, runtime hints, optional `marimo check`, and the canonical `/standards/<id>/v/<version>` route when online.
- `run` executes the local `run(runtime_inputs)` function and writes `.geotech/output/<stem>.run.json`.
- `submit` synthesizes a minimal publishable markdown body around the validated front-matter and uploads the recorded output bundle to the current platform route.
- `checklist` currently prints a declaration shell from the manifest metadata; the full standards-bound assumption sync remains a later slice.