cartograph-cli 0.1.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.
- cartograph_cli-0.1.0/.github/workflows/publish.yml +30 -0
- cartograph_cli-0.1.0/.github/workflows/test.yml +27 -0
- cartograph_cli-0.1.0/.gitignore +56 -0
- cartograph_cli-0.1.0/CLAUDE.md +77 -0
- cartograph_cli-0.1.0/CONTRIBUTING.md +63 -0
- cartograph_cli-0.1.0/LICENSE +21 -0
- cartograph_cli-0.1.0/PKG-INFO +125 -0
- cartograph_cli-0.1.0/README.md +114 -0
- cartograph_cli-0.1.0/cartograph/__init__.py +11 -0
- cartograph_cli-0.1.0/cartograph/__main__.py +5 -0
- cartograph_cli-0.1.0/cartograph/auth.py +196 -0
- cartograph_cli-0.1.0/cartograph/checkin.py +521 -0
- cartograph_cli-0.1.0/cartograph/cli.py +1359 -0
- cartograph_cli-0.1.0/cartograph/cloud.py +385 -0
- cartograph_cli-0.1.0/cartograph/dashboard.py +474 -0
- cartograph_cli-0.1.0/cartograph/dashboard_ui.py +1666 -0
- cartograph_cli-0.1.0/cartograph/engine.py +544 -0
- cartograph_cli-0.1.0/cartograph/inspector.py +125 -0
- cartograph_cli-0.1.0/cartograph/installer.py +210 -0
- cartograph_cli-0.1.0/cartograph/languages/__init__.py +2 -0
- cartograph_cli-0.1.0/cartograph/languages/base.py +168 -0
- cartograph_cli-0.1.0/cartograph/languages/javascript.py +248 -0
- cartograph_cli-0.1.0/cartograph/languages/nim.py +282 -0
- cartograph_cli-0.1.0/cartograph/languages/python.py +142 -0
- cartograph_cli-0.1.0/cartograph/languages/registry.py +41 -0
- cartograph_cli-0.1.0/cartograph/library_config.json +24 -0
- cartograph_cli-0.1.0/cartograph/scaffolding/__init__.py +119 -0
- cartograph_cli-0.1.0/cartograph/scaffolding/templates.py +186 -0
- cartograph_cli-0.1.0/cartograph/search/__init__.py +31 -0
- cartograph_cli-0.1.0/cartograph/search/base.py +20 -0
- cartograph_cli-0.1.0/cartograph/search/bm25.py +94 -0
- cartograph_cli-0.1.0/cartograph/search/filters.py +85 -0
- cartograph_cli-0.1.0/cartograph/search/hybrid.py +95 -0
- cartograph_cli-0.1.0/cartograph/search/ngram.py +83 -0
- cartograph_cli-0.1.0/cartograph/search/synonyms.json +48 -0
- cartograph_cli-0.1.0/cartograph/trust.py +54 -0
- cartograph_cli-0.1.0/cartograph/validation_stamp.py +115 -0
- cartograph_cli-0.1.0/cartograph/validator.py +265 -0
- cartograph_cli-0.1.0/logo/logo-cartograph-black.svg +7 -0
- cartograph_cli-0.1.0/logo/logo-cartograph-white.svg +7 -0
- cartograph_cli-0.1.0/logo/logo-cartograph.svg +15 -0
- cartograph_cli-0.1.0/pyproject.toml +25 -0
- cartograph_cli-0.1.0/pytest.ini +5 -0
- cartograph_cli-0.1.0/tests/__init__.py +0 -0
- cartograph_cli-0.1.0/tests/conftest.py +273 -0
- cartograph_cli-0.1.0/tests/test_checkin.py +213 -0
- cartograph_cli-0.1.0/tests/test_create.py +82 -0
- cartograph_cli-0.1.0/tests/test_inspect.py +95 -0
- cartograph_cli-0.1.0/tests/test_install.py +72 -0
- cartograph_cli-0.1.0/tests/test_language_engines.py +86 -0
- cartograph_cli-0.1.0/tests/test_loading.py +37 -0
- cartograph_cli-0.1.0/tests/test_search.py +82 -0
- cartograph_cli-0.1.0/tests/test_validate.py +60 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Build and publish
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
environment: pypi
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install hatch
|
|
24
|
+
run: pip install hatch
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: hatch build
|
|
28
|
+
|
|
29
|
+
- name: Publish
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: pip install -e . && pip install pytest pytest-cov
|
|
25
|
+
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: pytest --tb=short -q
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.Python
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
*.egg
|
|
12
|
+
|
|
13
|
+
# Virtual environments
|
|
14
|
+
.venv/
|
|
15
|
+
venv/
|
|
16
|
+
env/
|
|
17
|
+
|
|
18
|
+
# Logs and temp output
|
|
19
|
+
*.log
|
|
20
|
+
*.jsonl
|
|
21
|
+
*.txt
|
|
22
|
+
|
|
23
|
+
# Test artifacts
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
|
|
27
|
+
# Widgets installed into this repo for local testing - not part of the package.
|
|
28
|
+
# The cartograph/ dir doubles as the Python package and the default install target
|
|
29
|
+
# when running from source. Real subpackages are re-included below.
|
|
30
|
+
cartograph/*/
|
|
31
|
+
!cartograph/languages/
|
|
32
|
+
!cartograph/scaffolding/
|
|
33
|
+
!cartograph/search/
|
|
34
|
+
|
|
35
|
+
# Widget_Library - local dev library, seeded on first run, not committed
|
|
36
|
+
Widget_Library/
|
|
37
|
+
|
|
38
|
+
# Failed / temp
|
|
39
|
+
failed_widgets/
|
|
40
|
+
checkouts/
|
|
41
|
+
|
|
42
|
+
# Secrets
|
|
43
|
+
.env
|
|
44
|
+
.env.*
|
|
45
|
+
|
|
46
|
+
# Hidden app dirs
|
|
47
|
+
.agent/
|
|
48
|
+
.cartograph/
|
|
49
|
+
.cartographer/
|
|
50
|
+
.claude/
|
|
51
|
+
|
|
52
|
+
# IDE
|
|
53
|
+
.idea/
|
|
54
|
+
.vscode/
|
|
55
|
+
*.swp
|
|
56
|
+
*.swo
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
|
|
2
|
+
## Cartograph
|
|
3
|
+
|
|
4
|
+
Cartograph is a widget library manager. Widgets are reusable, self-contained
|
|
5
|
+
code modules with tests, examples, and metadata. When installed into a project
|
|
6
|
+
they live under `cartograph/<widget_id>/`.
|
|
7
|
+
|
|
8
|
+
Before writing reusable, self-contained logic, search the library first.
|
|
9
|
+
|
|
10
|
+
### Widget structure
|
|
11
|
+
```
|
|
12
|
+
cartograph/<widget_id>/
|
|
13
|
+
widget.json metadata, version, dependencies
|
|
14
|
+
src/ source code
|
|
15
|
+
tests/ test files (80%+ coverage required)
|
|
16
|
+
examples/ example_usage.* (must run), usage_hint.* (optional)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
widget_id format: `<domain>-<name>-<language>` e.g. `backend-retry-backoff-python`
|
|
20
|
+
|
|
21
|
+
Do not edit installed widget files directly - local edits are overwritten on
|
|
22
|
+
update. Wrap or extend in your own code instead.
|
|
23
|
+
|
|
24
|
+
### Commands
|
|
25
|
+
`<arg>` = required `[arg]` = optional defaults shown where relevant
|
|
26
|
+
|
|
27
|
+
**Find and use widgets**
|
|
28
|
+
|
|
29
|
+
cartograph search <query>
|
|
30
|
+
[--domain backend|data|ml|security|infra|frontend|universal]
|
|
31
|
+
[--language python|javascript|nim]
|
|
32
|
+
|
|
33
|
+
cartograph inspect <widget_id>
|
|
34
|
+
[--source] include source files
|
|
35
|
+
[--reviews] include review comments
|
|
36
|
+
[--all-versions] list full version history
|
|
37
|
+
[--version X] inspect a specific version
|
|
38
|
+
|
|
39
|
+
cartograph install <widget_id> [--target .] [--version X]
|
|
40
|
+
cartograph uninstall <widget_id> [--target .]
|
|
41
|
+
cartograph upgrade <widget_id> [--target .] [--version X]
|
|
42
|
+
cartograph status [widget_id] [--target .]
|
|
43
|
+
cartograph rate <widget_id> <score 1-5> [--comment "..."] [--target .]
|
|
44
|
+
|
|
45
|
+
**Create and publish widgets**
|
|
46
|
+
|
|
47
|
+
cartograph create <widget_id>
|
|
48
|
+
--language python|javascript|nim REQUIRED
|
|
49
|
+
--domain backend|data|ml|security|infra|frontend|universal REQUIRED
|
|
50
|
+
[--name "Display Name"] [--target .]
|
|
51
|
+
|
|
52
|
+
cartograph validate [path] [--lib] path defaults to .
|
|
53
|
+
cartograph checkin [path] path defaults to .
|
|
54
|
+
--reason "what changed and why" REQUIRED
|
|
55
|
+
[--bump patch|minor|major] defaults to minor
|
|
56
|
+
[--publish] also publish to cloud
|
|
57
|
+
|
|
58
|
+
cartograph rollback <widget_id> [--version X] [--reason "..."]
|
|
59
|
+
cartograph delete <widget_id> [--confirm]
|
|
60
|
+
|
|
61
|
+
**Cloud registry**
|
|
62
|
+
|
|
63
|
+
cartograph cloud publish [widget_id] [path]
|
|
64
|
+
[--lib] publish from library by ID
|
|
65
|
+
[--visibility public|private] defaults to public
|
|
66
|
+
cartograph cloud unpublish <widget_id> [--confirm]
|
|
67
|
+
cartograph cloud sync reconcile local with cloud
|
|
68
|
+
cartograph cloud rate <widget_id> <score 1-5> [--comment "..."]
|
|
69
|
+
|
|
70
|
+
**Library and account**
|
|
71
|
+
|
|
72
|
+
cartograph stats
|
|
73
|
+
cartograph doctor
|
|
74
|
+
cartograph login [--token X]
|
|
75
|
+
cartograph logout
|
|
76
|
+
cartograph whoami
|
|
77
|
+
cartograph dashboard
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Note from the Author - Ben Teigland
|
|
2
|
+
|
|
3
|
+
I am very excited to have you along for this ride! This project was born out of personal frustrations with code quality and portability of AI written code. By trade I am not a CS person, which might be reflected in opinionated decisions made about validation engines. I am trained in Electrical Engineering so a systems focus with simple first is my intention. I will be using AI to review submitted PRs, as admittedly I do not know programming well enough for manual review. However, I will not rely on a single pass. This whole project is based on scrutinizing what the AI lets through, and I intend to do that for reviews.
|
|
4
|
+
|
|
5
|
+
With that said, I do encourage you to use AI to build our engine. People who understand the philosophy of this tool are highest valued, if you can write the code yourself then that's an added bonus! You will not be rejected if Claude or some other chatbot is a co-author. However, if you submit a large PR it is more likely to be rejected. A large PR with 90% correct code but 10% causing issues will be rejected. You are better submitting it as chunks so get that 90% in.
|
|
6
|
+
|
|
7
|
+
Thank you for you interest in supporting this project!
|
|
8
|
+
|
|
9
|
+
--- Ben Teigland
|
|
10
|
+
|
|
11
|
+
# Contributing to Cartograph
|
|
12
|
+
|
|
13
|
+
The following guide covers the basic mechanics.
|
|
14
|
+
|
|
15
|
+
## Getting started
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git clone https://github.com/benteigland11/Cartograph.git
|
|
19
|
+
cd cartograph
|
|
20
|
+
pip install -e .
|
|
21
|
+
pytest
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Run `cartograph doctor` to verify all language engine dependencies are installed if you intend to work with them.
|
|
25
|
+
|
|
26
|
+
## What to work on
|
|
27
|
+
|
|
28
|
+
- Check open issues for bugs and feature requests
|
|
29
|
+
- New language engines (see `cartograph/languages/` for the pattern) - Please note this will be heavily reviewed. Each langauge took a few days of trial and error with AI coding to start. Validation is the service.
|
|
30
|
+
- Search improvements (`cartograph/search/`)
|
|
31
|
+
|
|
32
|
+
## Writing code
|
|
33
|
+
|
|
34
|
+
- Run `pytest` before submitting. Tests live in `tests/`.
|
|
35
|
+
- No extra dependencies unless absolutely necessary. The core uses only `platformdirs` and `rank-bm25` plus any language files.
|
|
36
|
+
- Keep cloud logic in `cloud.py`. Keep auth logic in `auth.py`. The CLI is in `cli.py`.
|
|
37
|
+
- If you add a new command, update the setup command to reflect the new command reference.
|
|
38
|
+
|
|
39
|
+
## Adding a language
|
|
40
|
+
|
|
41
|
+
Supporting a language means owning its full validation pipeline, not just generating files. See `cartograph/languages/base.py` for the interface and `cartograph/languages/python.py` for a complete implementation.
|
|
42
|
+
|
|
43
|
+
A language engine must:
|
|
44
|
+
- Run tests and report pass/fail
|
|
45
|
+
- Measure code coverage (if applicable. General rule, if it is possible to measure it should be measured and sit at 80%)
|
|
46
|
+
- Execute example files (if applicable. Many languages, like js, won't have executable example files, but if it can be ran it should be)
|
|
47
|
+
- Clean up after itself. No temp files!
|
|
48
|
+
|
|
49
|
+
If a language engine gets picked up in this repo it will be pushed up to the cloud registry quickly.
|
|
50
|
+
|
|
51
|
+
## Pull requests
|
|
52
|
+
|
|
53
|
+
- Keep PRs focused. One feature or fix per PR. Adding support for a new language counts as a single feature if fully put together. We will not accept half written language engines.
|
|
54
|
+
- Include a clear description of what changed and why.
|
|
55
|
+
- If you're adding a new command, include `--help` output in the PR description.
|
|
56
|
+
|
|
57
|
+
## Cloud registry
|
|
58
|
+
|
|
59
|
+
The default registry is hosted at the URL configured in `cartograph/auth.py`. You can point to your own registry by setting `CARTOGRAPH_REGISTRY_URL`. The registry API is documented by the endpoints in `cartograph/cloud.py`. We recommend using the default cloud registry to create a network effect and use a custom one for enterprise systems.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Cartograph Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cartograph-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Widget library manager for AI agents — CLI
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: platformdirs>=4.0.0
|
|
9
|
+
Requires-Dist: rank-bm25>=0.2.2
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# Cartograph
|
|
13
|
+
|
|
14
|
+
A shared widget library for AI agents. Search, install, create, validate, and check in reusable code across projects.
|
|
15
|
+
|
|
16
|
+
## Why Cartograph
|
|
17
|
+
|
|
18
|
+
AI agents write a lot of code, but it disappears. Each new project starts from scratch, and agents can't naturally reuse logic across codebases without somewhere to put it.
|
|
19
|
+
|
|
20
|
+
Cartograph came out of a personal frustration. Features that took 10 to 20 hours to polish with AI coding tools would need to be rebuilt almost from scratch when the next project needed them and most of the hardened logic would be gone. Then I built a basic engine, and those same features could be dropped into a new project in minutes.
|
|
21
|
+
|
|
22
|
+
Those same widgets have now been reused across many projects and have settled into a quiet loop of continuous improvement. Each time a new edge case surfaces, the fix goes back into the library, and every project that installs it going forward starts with that bug already squashed.
|
|
23
|
+
|
|
24
|
+
## Philosophy
|
|
25
|
+
|
|
26
|
+
Something that might take getting used to is this CLI tool is made with agents in mind first. This means things like few interactive CLI commands.
|
|
27
|
+
|
|
28
|
+
We only ship what we can validate. Every widget that enters the library has passed a full pipeline: structure checks, manifest validation, coverage enforcement, contamination scanning, example execution, and versioning. If the pipeline can't run it, it doesn't go in.
|
|
29
|
+
|
|
30
|
+
Supporting a language means owning its full validation pipeline, not just generating files. We'll add languages as those pipelines are ready, not before.
|
|
31
|
+
|
|
32
|
+
Cloud version gets trickier. We ship this engine with the ability to self sign, and you can design the cloud service to accept a self signed or do its own validation. Default is not done in the cloud because that is an expensive operation.
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install cartograph-cli
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then generate instructions for your AI agent:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cartograph setup --agent claude --write
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
We built in the ability to separate out by agentic service in case some need different guidance.
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
cartograph search <query>
|
|
52
|
+
[--domain backend|data|ml|security|infra|frontend|universal]
|
|
53
|
+
[--language python|javascript|nim]
|
|
54
|
+
|
|
55
|
+
cartograph inspect <widget_id>
|
|
56
|
+
[--source] include source files
|
|
57
|
+
[--reviews] include review comments
|
|
58
|
+
[--all-versions] list full version history
|
|
59
|
+
[--version X] inspect a specific historical version
|
|
60
|
+
|
|
61
|
+
cartograph install <widget_id> [--target .] [--version X]
|
|
62
|
+
cartograph uninstall <widget_id> [--target .]
|
|
63
|
+
cartograph upgrade <widget_id> [--target .] [--version X]
|
|
64
|
+
cartograph status [widget_id] [--target .] omit widget_id to scan all installed
|
|
65
|
+
cartograph delete <widget_id> [--confirm] dry-run without --confirm
|
|
66
|
+
cartograph rollback <widget_id> [--version X] [--reason "..."]
|
|
67
|
+
|
|
68
|
+
cartograph create <widget_id>
|
|
69
|
+
--language python|javascript|nim REQUIRED
|
|
70
|
+
--domain backend|data|ml|security|infra|frontend|universal REQUIRED
|
|
71
|
+
|
|
72
|
+
cartograph validate [path] [--lib]
|
|
73
|
+
cartograph checkin [path]
|
|
74
|
+
--reason "what changed and why" REQUIRED
|
|
75
|
+
[--bump patch|minor|major]
|
|
76
|
+
[--publish] also publish to cloud
|
|
77
|
+
|
|
78
|
+
cartograph rate <widget_id> <score 1-5> [--comment "..."]
|
|
79
|
+
cartograph setup [--agent claude|codex|gemini|antigravity|cursor]
|
|
80
|
+
[--write]
|
|
81
|
+
cartograph stats
|
|
82
|
+
cartograph doctor
|
|
83
|
+
cartograph dashboard
|
|
84
|
+
|
|
85
|
+
cartograph login [--token TOKEN]
|
|
86
|
+
cartograph logout
|
|
87
|
+
cartograph whoami
|
|
88
|
+
cartograph cloud publish [widget_id] [path] [--visibility public|private]
|
|
89
|
+
cartograph cloud unpublish <widget_id> [--confirm]
|
|
90
|
+
cartograph cloud sync
|
|
91
|
+
cartograph cloud rate <widget_id> <score 1-5> [--comment "..."]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install -e .
|
|
98
|
+
pytest
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The widget library lives in your platform's user data directory. To override the location, set `WIDGET_LIBRARY_PATH`. When running from source, a `Widget_Library/` directory alongside this repo takes precedence so local edits work without configuration.
|
|
102
|
+
|
|
103
|
+
Run `cartograph doctor` to check that all language engine dependencies (pytest, coverage, node, npx, vitest) are installed correctly.
|
|
104
|
+
|
|
105
|
+
## Status
|
|
106
|
+
|
|
107
|
+
- Python: fully supported (create, validate, test, checkin)
|
|
108
|
+
- JavaScript: fully supported (React components, plain JS, vitest)
|
|
109
|
+
- Nim: fully supported (testament)
|
|
110
|
+
- Search: hybrid BM25 + n-gram (local and cloud)
|
|
111
|
+
- Dashboard: `cartograph dashboard` opens a local web UI for browsing and managing widgets
|
|
112
|
+
|
|
113
|
+
## Cloud registry
|
|
114
|
+
|
|
115
|
+
The default registry is hosted by the Cartograph project. To point at your own registry instance, set `CARTOGRAPH_REGISTRY_URL`:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
export CARTOGRAPH_REGISTRY_URL=https://your-registry.example.com
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Authenticate with `cartograph login`, which opens a browser-based OAuth flow. Once authenticated, you can publish widgets. You can still install cloud widgets when not logged in. We encourage you to use the default cloud registry to build up a network effect. Switching the Registry URL would be good use cases for enterprise systems that want this as an internal tool.
|
|
122
|
+
|
|
123
|
+
## Roadmap
|
|
124
|
+
|
|
125
|
+
- Continued support for more languages.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Cartograph
|
|
2
|
+
|
|
3
|
+
A shared widget library for AI agents. Search, install, create, validate, and check in reusable code across projects.
|
|
4
|
+
|
|
5
|
+
## Why Cartograph
|
|
6
|
+
|
|
7
|
+
AI agents write a lot of code, but it disappears. Each new project starts from scratch, and agents can't naturally reuse logic across codebases without somewhere to put it.
|
|
8
|
+
|
|
9
|
+
Cartograph came out of a personal frustration. Features that took 10 to 20 hours to polish with AI coding tools would need to be rebuilt almost from scratch when the next project needed them and most of the hardened logic would be gone. Then I built a basic engine, and those same features could be dropped into a new project in minutes.
|
|
10
|
+
|
|
11
|
+
Those same widgets have now been reused across many projects and have settled into a quiet loop of continuous improvement. Each time a new edge case surfaces, the fix goes back into the library, and every project that installs it going forward starts with that bug already squashed.
|
|
12
|
+
|
|
13
|
+
## Philosophy
|
|
14
|
+
|
|
15
|
+
Something that might take getting used to is this CLI tool is made with agents in mind first. This means things like few interactive CLI commands.
|
|
16
|
+
|
|
17
|
+
We only ship what we can validate. Every widget that enters the library has passed a full pipeline: structure checks, manifest validation, coverage enforcement, contamination scanning, example execution, and versioning. If the pipeline can't run it, it doesn't go in.
|
|
18
|
+
|
|
19
|
+
Supporting a language means owning its full validation pipeline, not just generating files. We'll add languages as those pipelines are ready, not before.
|
|
20
|
+
|
|
21
|
+
Cloud version gets trickier. We ship this engine with the ability to self sign, and you can design the cloud service to accept a self signed or do its own validation. Default is not done in the cloud because that is an expensive operation.
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install cartograph-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then generate instructions for your AI agent:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cartograph setup --agent claude --write
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
We built in the ability to separate out by agentic service in case some need different guidance.
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
cartograph search <query>
|
|
41
|
+
[--domain backend|data|ml|security|infra|frontend|universal]
|
|
42
|
+
[--language python|javascript|nim]
|
|
43
|
+
|
|
44
|
+
cartograph inspect <widget_id>
|
|
45
|
+
[--source] include source files
|
|
46
|
+
[--reviews] include review comments
|
|
47
|
+
[--all-versions] list full version history
|
|
48
|
+
[--version X] inspect a specific historical version
|
|
49
|
+
|
|
50
|
+
cartograph install <widget_id> [--target .] [--version X]
|
|
51
|
+
cartograph uninstall <widget_id> [--target .]
|
|
52
|
+
cartograph upgrade <widget_id> [--target .] [--version X]
|
|
53
|
+
cartograph status [widget_id] [--target .] omit widget_id to scan all installed
|
|
54
|
+
cartograph delete <widget_id> [--confirm] dry-run without --confirm
|
|
55
|
+
cartograph rollback <widget_id> [--version X] [--reason "..."]
|
|
56
|
+
|
|
57
|
+
cartograph create <widget_id>
|
|
58
|
+
--language python|javascript|nim REQUIRED
|
|
59
|
+
--domain backend|data|ml|security|infra|frontend|universal REQUIRED
|
|
60
|
+
|
|
61
|
+
cartograph validate [path] [--lib]
|
|
62
|
+
cartograph checkin [path]
|
|
63
|
+
--reason "what changed and why" REQUIRED
|
|
64
|
+
[--bump patch|minor|major]
|
|
65
|
+
[--publish] also publish to cloud
|
|
66
|
+
|
|
67
|
+
cartograph rate <widget_id> <score 1-5> [--comment "..."]
|
|
68
|
+
cartograph setup [--agent claude|codex|gemini|antigravity|cursor]
|
|
69
|
+
[--write]
|
|
70
|
+
cartograph stats
|
|
71
|
+
cartograph doctor
|
|
72
|
+
cartograph dashboard
|
|
73
|
+
|
|
74
|
+
cartograph login [--token TOKEN]
|
|
75
|
+
cartograph logout
|
|
76
|
+
cartograph whoami
|
|
77
|
+
cartograph cloud publish [widget_id] [path] [--visibility public|private]
|
|
78
|
+
cartograph cloud unpublish <widget_id> [--confirm]
|
|
79
|
+
cartograph cloud sync
|
|
80
|
+
cartograph cloud rate <widget_id> <score 1-5> [--comment "..."]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install -e .
|
|
87
|
+
pytest
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The widget library lives in your platform's user data directory. To override the location, set `WIDGET_LIBRARY_PATH`. When running from source, a `Widget_Library/` directory alongside this repo takes precedence so local edits work without configuration.
|
|
91
|
+
|
|
92
|
+
Run `cartograph doctor` to check that all language engine dependencies (pytest, coverage, node, npx, vitest) are installed correctly.
|
|
93
|
+
|
|
94
|
+
## Status
|
|
95
|
+
|
|
96
|
+
- Python: fully supported (create, validate, test, checkin)
|
|
97
|
+
- JavaScript: fully supported (React components, plain JS, vitest)
|
|
98
|
+
- Nim: fully supported (testament)
|
|
99
|
+
- Search: hybrid BM25 + n-gram (local and cloud)
|
|
100
|
+
- Dashboard: `cartograph dashboard` opens a local web UI for browsing and managing widgets
|
|
101
|
+
|
|
102
|
+
## Cloud registry
|
|
103
|
+
|
|
104
|
+
The default registry is hosted by the Cartograph project. To point at your own registry instance, set `CARTOGRAPH_REGISTRY_URL`:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
export CARTOGRAPH_REGISTRY_URL=https://your-registry.example.com
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Authenticate with `cartograph login`, which opens a browser-based OAuth flow. Once authenticated, you can publish widgets. You can still install cloud widgets when not logged in. We encourage you to use the default cloud registry to build up a network effect. Switching the Registry URL would be good use cases for enterprise systems that want this as an internal tool.
|
|
111
|
+
|
|
112
|
+
## Roadmap
|
|
113
|
+
|
|
114
|
+
- Continued support for more languages.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Cartograph - widget library manager for AI agents."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version as _pkg_version
|
|
4
|
+
|
|
5
|
+
from .engine import Cartograph, LIBRARY_PATH
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
__version__ = _pkg_version("cartograph-cli")
|
|
9
|
+
except Exception:
|
|
10
|
+
__version__ = "0.0.0"
|
|
11
|
+
__all__ = ["Cartograph", "LIBRARY_PATH", "__version__"]
|