ambitgraph 0.9.8__tar.gz → 0.9.9__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.
- ambitgraph-0.9.9/ADDING-A-PACK.md +165 -0
- ambitgraph-0.9.9/DATA-FLOW.md +387 -0
- ambitgraph-0.9.9/MANIFEST.in +35 -0
- {ambitgraph-0.9.8/ambitgraph.egg-info → ambitgraph-0.9.9}/PKG-INFO +11 -6
- ambitgraph-0.9.9/QUICKSTART.md +391 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/README.md +9 -5
- ambitgraph-0.9.9/ambit_map/__init__.py +7 -0
- ambitgraph-0.9.9/ambit_map/ambit-map-enrich.md +57 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/ambit-mapllm-contract.md +28 -54
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/cli.py +12 -7
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/daemon.py +113 -58
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/contract.py +31 -34
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/express_pack.py +3 -4
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/flask_pack.py +1 -1
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/nextjs_pack.py +5 -6
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/langmirror.py +34 -41
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/load.py +4 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/mapllm.py +36 -12
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/model.py +17 -18
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/orchestrate.py +59 -48
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/registry.py +194 -227
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/serve.py +143 -116
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/WALKTHROUGH.md +62 -46
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/__init__.py +1 -1
- ambitgraph-0.9.8/ambitgraph/secretary.py → ambitgraph-0.9.9/ambitgraph/action_items.py +13 -12
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/cli.py +195 -370
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/cockpit.py +2 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/codelib.py +40 -45
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/config.py +27 -28
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/console.py +10 -17
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/demo.py +6 -6
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/design_tokens.py +2 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/doctor.py +13 -30
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/duplication.py +18 -18
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/edges.py +163 -175
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/emit.py +4 -4
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/estimate.py +10 -10
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/explain.py +14 -16
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/families.py +5 -6
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/gate.py +14 -14
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/harvest.py +2 -2
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/html_safe.py +45 -1
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/inventory.py +16 -21
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/jscalls.py +80 -85
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/langs.py +55 -70
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/merge.py +159 -149
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/objects.py +14 -14
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/__init__.py +18 -20
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/_init_js.py +11 -12
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/charts.js +13 -26
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/classdiagram.js +4 -6
- ambitgraph-0.9.9/ambitgraph/omniscient_next/escape.js +90 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/filterpanel.js +18 -24
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/graph.js +34 -27
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/insideview.js +2 -4
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/library.js +58 -64
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/next_embed.css +10 -14
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/objectcard.js +2 -4
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/paths.js +7 -9
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/search.js +4 -8
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/siderail.js +11 -17
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/standalone.py +28 -27
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/omniscient_next/wholemap.js +33 -37
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/parameterize.py +36 -37
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/pipeline.py +29 -20
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/portal.py +38 -324
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/prompts.py +3 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/pycalls.py +10 -15
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/pyshapes.py +13 -16
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/ratify.py +7 -7
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/report.py +334 -335
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/responsibility.py +3 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/shell.py +1268 -3840
- ambitgraph-0.9.9/ambitgraph/shell_word.py +50 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/symbols.py +325 -359
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/tables.py +3 -3
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/tasks.py +10 -9
- {ambitgraph-0.9.8 → ambitgraph-0.9.9/ambitgraph.egg-info}/PKG-INFO +11 -6
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph.egg-info/SOURCES.txt +5 -14
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph.egg-info/requires.txt +1 -0
- ambitgraph-0.9.9/ambitgraph.egg-info/top_level.txt +2 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/pyproject.toml +19 -21
- ambitgraph-0.9.8/MANIFEST.in +0 -25
- ambitgraph-0.9.8/ambit_contracts/__init__.py +0 -125
- ambitgraph-0.9.8/ambit_contracts/edge.py +0 -200
- ambitgraph-0.9.8/ambit_contracts/envelope.py +0 -237
- ambitgraph-0.9.8/ambit_contracts/fields.py +0 -211
- ambitgraph-0.9.8/ambit_contracts/grant.py +0 -258
- ambitgraph-0.9.8/ambit_contracts/household.py +0 -148
- ambitgraph-0.9.8/ambit_map/__init__.py +0 -7
- ambitgraph-0.9.8/ambit_map/ambit-map-enrich.md +0 -54
- ambitgraph-0.9.8/ambit_telegraph/__init__.py +0 -31
- ambitgraph-0.9.8/ambit_telegraph/cli.py +0 -537
- ambitgraph-0.9.8/ambit_telegraph/export.py +0 -393
- ambitgraph-0.9.8/ambit_telegraph/ledger.py +0 -911
- ambitgraph-0.9.8/ambit_telegraph/responsibility.py +0 -381
- ambitgraph-0.9.8/ambit_telegraph/store.py +0 -175
- ambitgraph-0.9.8/ambitgraph/omniscient_next/escape.js +0 -37
- ambitgraph-0.9.8/ambitgraph/reports.py +0 -109
- ambitgraph-0.9.8/ambitgraph.egg-info/top_level.txt +0 -4
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/LICENSE +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/__main__.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/assistant.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/__init__.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/fastapi_pack.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambit_map/dialects/supabase_pack.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/__main__.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/_delimited.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/architecture.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/docs_discovery.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/engine_identity.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/eval.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/explain_stage.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/feeds.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/gate_check.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/gate_server.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/jsobjects.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/jsonlines.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/mds.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/merge_jsp.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/sample.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/stages.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/text_capture.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph/urcode.py +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph.egg-info/dependency_links.txt +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/ambitgraph.egg-info/entry_points.txt +0 -0
- {ambitgraph-0.9.8 → ambitgraph-0.9.9}/setup.cfg +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Adding a pack
|
|
2
|
+
|
|
3
|
+
A *pack* is how the map learns to read one more framework in one more language. This page
|
|
4
|
+
is for anyone who wants to write one.
|
|
5
|
+
|
|
6
|
+
## What a pack is, and is not
|
|
7
|
+
|
|
8
|
+
The map already knows a fixed set of things it can say about your code — a route, a mount
|
|
9
|
+
between two routers, a reference to a table, and so on. A pack never adds to that set. It
|
|
10
|
+
teaches one of those *existing* kinds a new framework's syntax: the Flask pack and the
|
|
11
|
+
FastAPI pack both produce the same kind of route fact, from two completely different
|
|
12
|
+
decorator styles. Writing a pack for a stack the map does not yet read — Sinatra, say —
|
|
13
|
+
means finding Sinatra's own way of writing what the map already knows how to talk about,
|
|
14
|
+
never inventing a new thing for the map to say.
|
|
15
|
+
|
|
16
|
+
This is deliberate. The map's honesty rests on a small, closed vocabulary of claims, each
|
|
17
|
+
with its own tested rule for when it is allowed to speak. A pack that could mint a new kind
|
|
18
|
+
of claim would also have to invent a new rule for when that claim is true — and nothing
|
|
19
|
+
would have tested it. A pack stays inside the vocabulary that already exists.
|
|
20
|
+
|
|
21
|
+
## The detection contract
|
|
22
|
+
|
|
23
|
+
Before a pack reads a single line of source, it answers one question: does this repository
|
|
24
|
+
look like it uses the pack's framework at all?
|
|
25
|
+
|
|
26
|
+
That question is answered by `detect(probe)` — a single function, given a `Probe`: the
|
|
27
|
+
dependency manifests the scan found in the repository (`package.json`,
|
|
28
|
+
`requirements.txt`, `pyproject.toml`), walked to a bounded depth so a monorepo's
|
|
29
|
+
subpackages are seen without an unbounded filesystem crawl, plus `has_dirs` — the set of
|
|
30
|
+
directory names that same walk saw, for the one exception described below. The rule is
|
|
31
|
+
**dependency membership** — is the framework's package name declared in one of those
|
|
32
|
+
manifests? — never scanning source files, and never matching a config file that might not
|
|
33
|
+
mean what it looks like. Every shipped pack but one is exactly this (`contract` is
|
|
34
|
+
`ambit_map/dialects/contract.py`; every shipped pack is a module beside it, such as
|
|
35
|
+
`ambit_map/dialects/flask_pack.py`):
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
def detect(probe):
|
|
39
|
+
return "flask" in contract.probe_py_deps(probe)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The one exception, named honestly: the Supabase pack *also* detects a bare `supabase/`
|
|
43
|
+
directory — the migrations folder the Supabase CLI itself creates — because that directory
|
|
44
|
+
is unambiguous evidence of the framework even when the application code is written in a
|
|
45
|
+
language the map has no client-library manifest for at all (a Supabase-backed Go or Rust
|
|
46
|
+
service, say, with no `package.json` or `requirements.txt` to hold the dependency name).
|
|
47
|
+
`contract.probe_has_dir_named(probe, "supabase")` is that check, and it is the *only*
|
|
48
|
+
directory-name match any shipped pack makes. A directory name is weaker evidence than a
|
|
49
|
+
manifest entry — a folder can be named anything, for any reason — so this exception holds
|
|
50
|
+
for one pack and one directory, and is not offered as a general technique. A
|
|
51
|
+
pack proposing a second directory-name check should expect to justify it the same way: name
|
|
52
|
+
the directory, name why no manifest can see what it sees, and accept that "detects by
|
|
53
|
+
dependency membership" will no longer describe your pack alone — it will need this same
|
|
54
|
+
paragraph, honestly extended.
|
|
55
|
+
|
|
56
|
+
Detection is not a filter for convenience. It is the gate every later claim depends on.
|
|
57
|
+
The map records, for every pack it ships, whether that pack detected — true or false,
|
|
58
|
+
every scan, every pack. That single boolean is what makes "no framework this map
|
|
59
|
+
recognizes was found here" a sentence the map is entitled to say: it did check, and it can
|
|
60
|
+
name what it checked. A pack that never runs `extract()` because it did not detect
|
|
61
|
+
contributes nothing, and the page says nothing on its behalf. A pack that detects and then
|
|
62
|
+
finds nothing is a different, equally honest statement — "checked, found none" is not the
|
|
63
|
+
same claim as "never checked."
|
|
64
|
+
|
|
65
|
+
## extract(): the fact planes
|
|
66
|
+
|
|
67
|
+
A pack module ends with `PACK = contract.DialectPack(name=..., version=..., detect=detect,
|
|
68
|
+
extract=extract)`, and the map runs it only once that `PACK` is added to `all_packs()` in
|
|
69
|
+
`ambit_map/dialects/contract.py`.
|
|
70
|
+
|
|
71
|
+
Once a pack detects, the orchestrator hands `extract(files, model)` the scan's own unit
|
|
72
|
+
model and the text of the files inside the subtree that actually earned the detection —
|
|
73
|
+
not necessarily every file in the repo. When a repo-wide signal is what triggered
|
|
74
|
+
`detect()` (a root-level manifest, or the Supabase directory exception above), `files` is
|
|
75
|
+
the whole repo. But when it was one
|
|
76
|
+
subpackage's own manifest, alone, that satisfied `detect()` — the common monorepo shape —
|
|
77
|
+
`files` is narrowed to that subpackage's own directory, so a library repo's unrelated test
|
|
78
|
+
suite or a sibling service that never declared your framework's dependency is never handed
|
|
79
|
+
to your pack, even though the scan read it. The orchestrator does this by calling your
|
|
80
|
+
`detect()` again, once per manifest it found, each time against a `Probe` carrying only
|
|
81
|
+
that one manifest in isolation — so a pack author writes no extra scoping code; the same
|
|
82
|
+
`detect()` you already wrote decides both "does this repo qualify at all" and "which part
|
|
83
|
+
of it does". If a route you know exists in your fixture is missing from your pack's
|
|
84
|
+
output, check first whether its file lives outside the directory that declared your
|
|
85
|
+
dependency. The pack returns a `DialectFacts` — a small, fixed set of fact planes, each of
|
|
86
|
+
which feeds one of the map's existing kinds:
|
|
87
|
+
|
|
88
|
+
- **routes** — `Route(method, path, uid, line, via)`. One HTTP-visible entry point: a
|
|
89
|
+
decorator, a call, whatever your framework's own way of declaring "this function handles
|
|
90
|
+
this path" looks like.
|
|
91
|
+
- **mounts** — `Mount(prefix, router_name, uid, line, ...)`. One place a repo wires a
|
|
92
|
+
sub-router into the app, at a literal prefix or the application root. A mount is written
|
|
93
|
+
to the run's `product-dialect.json` with the pack's other facts, as the mounts of the
|
|
94
|
+
Flask and FastAPI packs are; the map page does not draw it.
|
|
95
|
+
- **table_refs** — `TableRef(table, op, uid, line, api)`. One place your framework's own
|
|
96
|
+
client API names a table by string — `supabase.from("orders").insert(...)`, not a raw
|
|
97
|
+
SQL scan. (The map already has a separate, language-blind reader for SQL text; a pack's
|
|
98
|
+
`table_refs` is for API-shaped access, where the table name is a plain argument to a
|
|
99
|
+
call.)
|
|
100
|
+
|
|
101
|
+
Every field on every one of these is read, never inferred. If a path is built by string
|
|
102
|
+
concatenation, if a methods list comes from a variable, if a mount's prefix is anything but
|
|
103
|
+
a literal string — the pack does not guess. It also does not simply drop the site. It
|
|
104
|
+
records an `UnknownSite(uid, line, why, path="")`: this line exists, here is what it looks
|
|
105
|
+
like, and here is why the pack could not read it as a fact. These records are kept in the
|
|
106
|
+
run's `product-dialect.json`, never dropped in silence.
|
|
107
|
+
|
|
108
|
+
Alongside routes and mounts, a pack carries its own short `blind` tuple — plain sentences
|
|
109
|
+
describing the specific things its own extraction does not attempt, even where the syntax
|
|
110
|
+
is well-formed. The Flask pack, for instance, says outright that it does not compose a
|
|
111
|
+
blueprint's prefix across nested mounts, and that routes registered through
|
|
112
|
+
`add_url_rule()` rather than the `@app.route` decorator are not read. Whenever the pack
|
|
113
|
+
detects, these sentences are written to the run's `product-dialect.json` beside its
|
|
114
|
+
`UnknownSite` records. The map page shows neither, so that file is where someone using the
|
|
115
|
+
framework in one of those ways finds why a route they know exists is missing.
|
|
116
|
+
|
|
117
|
+
Quarantine over guess, a disclosure sentence for every known gap, and a record of every
|
|
118
|
+
site a pack could see but could not read — that is the whole honesty contract a pack signs.
|
|
119
|
+
|
|
120
|
+
## The test every pack owes
|
|
121
|
+
|
|
122
|
+
Prove a pack with fixture source files, written in the framework's real syntax, and a test
|
|
123
|
+
that runs the pack through its real entry points, `detect()` and `extract()` — never a
|
|
124
|
+
hand-built fact object asserted against itself. A test that
|
|
125
|
+
constructs a `DialectFacts` by hand and then checks that the same object equals itself
|
|
126
|
+
proves nothing about whether the pack's regex, or its detection, actually works on real
|
|
127
|
+
source text.
|
|
128
|
+
|
|
129
|
+
Build that proof in four parts:
|
|
130
|
+
|
|
131
|
+
1. A small fixture file, written in the target framework's real syntax, covering the
|
|
132
|
+
ordinary case and at least one case your pack must refuse (an f-string path, a computed
|
|
133
|
+
prefix — whatever your own `UnknownSite` sites are).
|
|
134
|
+
2. A call through the pack's own `detect()` against a `Probe` built the same way the
|
|
135
|
+
orchestrator builds one, proving the framework is recognized from its manifest and
|
|
136
|
+
nothing else.
|
|
137
|
+
3. A call through `extract()` against the fixture text and a model that actually carries
|
|
138
|
+
the fixture's own unit ids — proving a fact only ever attaches to a uid the scan really
|
|
139
|
+
saw.
|
|
140
|
+
4. An assertion on the resulting facts *and* on the `unknown_sites` your refusal cases must
|
|
141
|
+
produce — a pack that never tests its own refusals has not tested its honesty.
|
|
142
|
+
|
|
143
|
+
## The bounded cost
|
|
144
|
+
|
|
145
|
+
Every pack shipped with this project so far follows the same shape: a `detect()` of a few
|
|
146
|
+
lines and an `extract()` built from the shared regex/text helpers in `contract.py` (balanced-
|
|
147
|
+
paren argument scanning, literal-string extraction, comment/string blanking — none of it
|
|
148
|
+
framework-specific, all of it reused). The smallest of
|
|
149
|
+
the five, at 165 lines including its own comments, covers a framework with no mount
|
|
150
|
+
concept at all; the largest, which also reads two fact planes none of the others need, is
|
|
151
|
+
437. A new pack for a stack of ordinary shape sits somewhere in that range — a few hundred
|
|
152
|
+
lines, not a few thousand — and no part of it touches the filesystem, a network socket, or
|
|
153
|
+
a language model.
|
|
154
|
+
|
|
155
|
+
## What a pack does not do
|
|
156
|
+
|
|
157
|
+
- **No network.** A pack is a pure function of the text it is handed. It never makes a
|
|
158
|
+
request.
|
|
159
|
+
- **No model.** Extraction is regex and balanced-text scanning over source the scan
|
|
160
|
+
already read — never an LLM call, never a probabilistic guess dressed as a fact.
|
|
161
|
+
- **No guessing.** Anything a pack cannot read as a literal is an `UnknownSite`, not an
|
|
162
|
+
invented value.
|
|
163
|
+
- **No new kinds.** A pack teaches an existing kind of claim — route, mount, table
|
|
164
|
+
reference — a new framework's syntax. It never adds a new kind of claim to the map's
|
|
165
|
+
vocabulary.
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
# DATA-FLOW.md — where your code and data go
|
|
2
|
+
|
|
3
|
+
This page says what AmbitGraph sends, runs and writes, and where each goes.
|
|
4
|
+
The first two sections answer the two short questions; the rest is detail.
|
|
5
|
+
|
|
6
|
+
## Can your code leave this machine, and when?
|
|
7
|
+
|
|
8
|
+
AmbitGraph holds no API key and never calls a model itself. Your code and
|
|
9
|
+
data reach a model only through an assistant you run yourself:
|
|
10
|
+
|
|
11
|
+
1. **You run a workflow script it wrote**, a `.workflow.js` file for your
|
|
12
|
+
own assistant session. `ambit scan` (unless `--deterministic`),
|
|
13
|
+
`ambit mapllm` and `ambit merge` at its step 0 write them, and
|
|
14
|
+
`ambit map` leaves one in each run folder. The scan's extract stage
|
|
15
|
+
tells your assistant to read every file the scan admitted, in full; the
|
|
16
|
+
merge's step 0 script carries the function being merged inside itself.
|
|
17
|
+
Your assistant sends what it reads to its model provider. Nothing is
|
|
18
|
+
sent unless you run a script, or hand your assistant the explain stage's
|
|
19
|
+
task files.
|
|
20
|
+
2. **An IDE assistant you registered asks the gate** (`ambit gate serve`)
|
|
21
|
+
and passes its answers, drawn from the map, to its own model provider.
|
|
22
|
+
3. **You paste what the Cockpit copies, or an assistant runs commands for
|
|
23
|
+
you.** The copy buttons only fill your clipboard. An assistant running
|
|
24
|
+
`ambit merge`, `ambit tasks` or `ambit mds apply` sees what they print,
|
|
25
|
+
and can add `--execute` to `ambit merge` itself, since the command
|
|
26
|
+
prints that flag as the next step.
|
|
27
|
+
|
|
28
|
+
Apart from that, AmbitGraph's own code connects only to its own server on
|
|
29
|
+
127.0.0.1. Other ways something can reach another machine while you use it:
|
|
30
|
+
|
|
31
|
+
- `ambit merge --execute` runs your repository's code, and pytest with your
|
|
32
|
+
`conftest.py` files and every installed pytest plugin; `--jsp-compile-gate`
|
|
33
|
+
runs the command you name without `--execute`, and it may be a script
|
|
34
|
+
from your repository. Any of these can connect anywhere you can.
|
|
35
|
+
- Git can run a program the repository's own git settings name, such as a
|
|
36
|
+
`core.fsmonitor` command, whenever AmbitGraph runs git (`ambit scan`,
|
|
37
|
+
`estimate`, `map`, `mapllm`, `demo`, `gate check`). `git clone` copies no
|
|
38
|
+
such setting, but a repository folder handed to you with its `.git`
|
|
39
|
+
folder keeps them: run
|
|
40
|
+
`git --no-pager -C <folder> config --list --show-scope --show-origin`
|
|
41
|
+
from outside it before a scan, and read the lines that start with `local`
|
|
42
|
+
or `worktree` (`--no-pager` keeps git from starting the pager that
|
|
43
|
+
folder's settings name).
|
|
44
|
+
- `python -m ambitgraph` or `python -c` started inside a folder, and any
|
|
45
|
+
command when `PYTHONPATH` holds a relative or empty entry, can run a file
|
|
46
|
+
there named like a module the tool imports ("What the tool runs").
|
|
47
|
+
- In a partial clone, `ambit gate check` can make git download missing
|
|
48
|
+
contents from your remote; a path on a network share is read and written
|
|
49
|
+
over the network.
|
|
50
|
+
|
|
51
|
+
## What does this tool run and write?
|
|
52
|
+
|
|
53
|
+
- **The scan itself runs none of your code** (git and Python can: first
|
|
54
|
+
section). It reads files as text and runs two local git commands.
|
|
55
|
+
- **Of AmbitGraph's commands, only `ambit merge` runs your repository's
|
|
56
|
+
code** (git and Python can too: first section): a Python merge only with
|
|
57
|
+
`--execute` (with `--parameterized`, before anyone has ratified the
|
|
58
|
+
proposal); a JSP merge runs the `--jsp-compile-gate` command you name,
|
|
59
|
+
with no `--execute` (last section).
|
|
60
|
+
- **Writes into a repository come from `ambit merge` and
|
|
61
|
+
`ambit mds apply`**, plus whatever pytest, your code and your compile
|
|
62
|
+
command write. Other commands write there only where you point them (an
|
|
63
|
+
`--out`, `ambit demo` or `ambit doctor` run inside it, a scan or runs
|
|
64
|
+
folder kept there); `ambit scan`, `ambit map` and `ambit mapllm` refuse
|
|
65
|
+
an output folder inside the folder they scan.
|
|
66
|
+
- **Everything else** goes to the scan's output folder, the map's folder,
|
|
67
|
+
the Cockpit page and a few small files ("Writes"); many hold text from
|
|
68
|
+
your code. `ambit scan` deletes results it rebuilds and explain task
|
|
69
|
+
files it replaces, the map its older `run-*` folders, and `ambit merge`
|
|
70
|
+
its earlier report, patch and `pending/` folder and, on a failed step,
|
|
71
|
+
the shared file it wrote.
|
|
72
|
+
|
|
73
|
+
## What each workflow script gives your assistant
|
|
74
|
+
|
|
75
|
+
Each stage of a scan that needs a model pauses (exit 3) and leaves its
|
|
76
|
+
script in the scan's `pending/` folder for you to run in your assistant
|
|
77
|
+
session. Every scan stage's script carries absolute paths on your machine,
|
|
78
|
+
which usually include your user name, and every stage runs before any human
|
|
79
|
+
ratification (your ruling on the draft map, recorded with `ambit ratify`).
|
|
80
|
+
|
|
81
|
+
- **extract** lists every file the scan admitted, or only the changed ones
|
|
82
|
+
on a `--baseline` re-scan that can reuse the baseline's answers, and
|
|
83
|
+
tells the assistant to read each one in full, with any `domain_notes`
|
|
84
|
+
from your config.
|
|
85
|
+
- **cluster, roles, vocab, ownership and suggest** hand over unit names (a
|
|
86
|
+
unit is a function, class or other definition the map names) with the
|
|
87
|
+
short hints and evidence lines the extract answers wrote, which can quote
|
|
88
|
+
your code; the vocabulary or areas you declared (in your config or with
|
|
89
|
+
`ambit scan --vocab`); and, for suggest, the file:line of every duplicate
|
|
90
|
+
copy. All but cluster also tell or let the assistant open your files.
|
|
91
|
+
- **explain**, when the config turns `explain_capture` on, points the
|
|
92
|
+
assistant at task files that quote your code (next section).
|
|
93
|
+
- **characterize**, `ambit merge`'s step 0, carries the function being
|
|
94
|
+
merged and the module-level values it reads (last section).
|
|
95
|
+
|
|
96
|
+
The prompts that send the assistant to your files tell it to stay under
|
|
97
|
+
the repository root, never to write, and to treat file text as evidence,
|
|
98
|
+
never as instructions; the explain prompts let it write
|
|
99
|
+
`results/explain.json`. Nothing in AmbitGraph can enforce what the
|
|
100
|
+
assistant actually opens or writes.
|
|
101
|
+
|
|
102
|
+
### The explain capture: source text the scan itself writes down
|
|
103
|
+
|
|
104
|
+
`explain_capture` is on in the config `ambit mapllm` generates and off in
|
|
105
|
+
the one `ambit map` generates and for `ambit scan` with no `--config`; a
|
|
106
|
+
config you pass decides for itself. When it is on, the scan keeps the start
|
|
107
|
+
of each admitted file's text, and of each `.md`, `.rst` and `.txt` file,
|
|
108
|
+
READMEs among them, that only `include_ext` keeps out, in
|
|
109
|
+
`results/text_capture.json`; in an `ambit mapllm` run most files are kept
|
|
110
|
+
whole. The explain stage writes task files into `pending/` that quote,
|
|
111
|
+
for each file without a cached answer, the start of its text, every
|
|
112
|
+
definition that has no doc comment, and the documents beside it or naming
|
|
113
|
+
it, so a file whose definitions all lack doc comments can reach the model
|
|
114
|
+
nearly whole. A re-scan with the capture turned off can leave what an
|
|
115
|
+
earlier capture wrote in place: delete `results/text_capture.json` and
|
|
116
|
+
those task files yourself, or scan into a new `--out`.
|
|
117
|
+
|
|
118
|
+
## What else reaches an assistant
|
|
119
|
+
|
|
120
|
+
- **The gate.** `ambit gate serve` (it needs the optional `mcp` package) is
|
|
121
|
+
a tool server an IDE assistant calls over standard input and output, not
|
|
122
|
+
a network port (QUICKSTART.md, section 6). Its answers carry what the map
|
|
123
|
+
holds about each unit and the map's recorded repository path; it never
|
|
124
|
+
reads source files.
|
|
125
|
+
- **The Cockpit's copy buttons** put text from the page on your clipboard:
|
|
126
|
+
"Ask your assistant" copies the screen's titles and figures with your
|
|
127
|
+
question; a Ratify card's Discuss button copies that unit's name, path,
|
|
128
|
+
hint, evidence and the location of every copy. Each prompt file you list
|
|
129
|
+
under `prompts` in `portal.json` is written into the page, ready to copy:
|
|
130
|
+
a `.md` file's first fenced code block, and any other file, wherever it
|
|
131
|
+
is, whole.
|
|
132
|
+
- **The task an accept-all pins.** The `tasks.json` an accept-all
|
|
133
|
+
`ambit ratify` writes asks your IDE assistant to run `ambit tasks` and
|
|
134
|
+
`ambit merge` for each accepted cluster; an assistant following it can
|
|
135
|
+
add `--execute` itself, so tell it whether it may.
|
|
136
|
+
- **What commands print.** An assistant running `ambit merge` or
|
|
137
|
+
`ambit mds apply` for you sees their output: paths, names, the end of a
|
|
138
|
+
JSP compile command's output and, in some merge refusals, module-level
|
|
139
|
+
values and what each copy returned or raised.
|
|
140
|
+
|
|
141
|
+
## What stays on this machine
|
|
142
|
+
|
|
143
|
+
- **Three commands open a web server, bound to 127.0.0.1 only**, the
|
|
144
|
+
loopback address no other machine can reach; a request naming another
|
|
145
|
+
host is refused. `ambit console serve` serves the Cockpit page and writes
|
|
146
|
+
nothing. `ambit map` and `ambit mapllm` serve the map page and its status
|
|
147
|
+
routes, and stop on a request carrying the random token in `serve.json`
|
|
148
|
+
in the map's folder; with `--once` they serve nothing.
|
|
149
|
+
- There is no password: any program or user on this machine can open these
|
|
150
|
+
pages, and the map's status routes, which name the repository's path. A
|
|
151
|
+
web page from another site, open in your browser, can send them requests
|
|
152
|
+
but not read the answers; such requests count as someone reading the
|
|
153
|
+
map, so they can keep it from stopping and make it rescan a changed
|
|
154
|
+
repository.
|
|
155
|
+
- **The pages load nothing from another address**: every script and style
|
|
156
|
+
is inline. A served map page pings its own server; if `portal.json` sets
|
|
157
|
+
`refresh_seconds`, the Cockpit page reloads itself from where it was
|
|
158
|
+
opened; the links your team lists in `portal.json` open when clicked.
|
|
159
|
+
- **Your browser.** `ambit map` and `ambit mapllm` open your default browser
|
|
160
|
+
at their 127.0.0.1 address unless you pass `--no-open` or set
|
|
161
|
+
`AMBIT_NO_BROWSER=1`.
|
|
162
|
+
|
|
163
|
+
## What the tool runs
|
|
164
|
+
|
|
165
|
+
The programs AmbitGraph starts itself (git, its own engine commands,
|
|
166
|
+
pytest, your JSP compile command) get a list of arguments, never a shell
|
|
167
|
+
command line. On Windows, `cmd.exe` runs a `.bat` or `.cmd` compile command
|
|
168
|
+
and reads the page names after it, so there a JSP merge with a compile
|
|
169
|
+
command refuses, before it changes a file, a page whose name holds a
|
|
170
|
+
character `cmd.exe` treats specially. The browser is opened through Python's
|
|
171
|
+
`webbrowser` module, which starts your system's opener (on macOS through
|
|
172
|
+
`/bin/sh`) or the command in `BROWSER`. No module calls `eval`; the only
|
|
173
|
+
`exec` calls are `ambit merge`'s; YAML is read with `yaml.safe_load`.
|
|
174
|
+
|
|
175
|
+
- **The scan** runs `git ls-files -z` in the scanned folder, which lists
|
|
176
|
+
the files git tracks (in a plain folder, those of the repository around
|
|
177
|
+
it); when git is missing, fails or lists no file, the scan walks the
|
|
178
|
+
folder and takes every file in it, untracked and ignored ones included,
|
|
179
|
+
and only "What is kept out" filters them. It also runs
|
|
180
|
+
`git rev-parse HEAD` in the nearest repository at or above the installed
|
|
181
|
+
engine, which is your own project when the engine sits in a virtual
|
|
182
|
+
environment inside it. Neither contacts a remote itself. `ambit estimate`
|
|
183
|
+
runs the same `git ls-files`, and so does `ambit demo`'s scan of its
|
|
184
|
+
bundled sample, so git applies the settings of any repository you start
|
|
185
|
+
the demo inside.
|
|
186
|
+
- **`ambit map` and `ambit mapllm`** run the engine's own commands as child
|
|
187
|
+
processes: the scan, in your repository; the page drawer, which may ask
|
|
188
|
+
git in the engine's folder for its commit; a check of which engine built
|
|
189
|
+
a map already running; and, by default, a background server that serves
|
|
190
|
+
until `--stop` or until nobody has looked at the map for 30 minutes
|
|
191
|
+
(`--idle-minutes`), rescanning whenever the repository changes.
|
|
192
|
+
`ambit mapllm` also runs the engine's `harvest` on each journal your
|
|
193
|
+
assistant drops in the run's `incoming/` folder.
|
|
194
|
+
- **`ambit gate check`** runs local git commands in the `--repo` you name,
|
|
195
|
+
on a private copy of the index in a temporary folder, with external diff
|
|
196
|
+
drivers and text conversion off; filters named in `.gitattributes` and a
|
|
197
|
+
`core.fsmonitor` command stay on and can write. The check itself writes
|
|
198
|
+
nothing in the repository; in a partial clone git may fetch missing
|
|
199
|
+
contents into its object folder.
|
|
200
|
+
- **`ambit doctor`** imports `pytest`, `mcp` and `yaml` to see whether they
|
|
201
|
+
are installed, and starts no program.
|
|
202
|
+
- **`python -m ambitgraph` (the README's form) and `python -c`** put the
|
|
203
|
+
folder you start them from ahead of Python's own library, so a file there
|
|
204
|
+
named like a module the tool imports (`json.py` or `yaml.py`, for
|
|
205
|
+
example), or an `ambitgraph` folder, runs in its place inside the tool's
|
|
206
|
+
process. Start from another folder and name the repository by its path,
|
|
207
|
+
or use the `ambit` command, which does not add the current folder; the
|
|
208
|
+
engine children the map and the demo start do not add theirs either. A
|
|
209
|
+
relative or empty entry in `PYTHONPATH` is read from the folder a command
|
|
210
|
+
starts in, `ambit` included: unset it or make it absolute.
|
|
211
|
+
|
|
212
|
+
## What is kept out
|
|
213
|
+
|
|
214
|
+
The extract stage lists only the files the scan admits, by the rules
|
|
215
|
+
below; the scan also copies the owner records of
|
|
216
|
+
`.ambit/responsibility.jsonl`, if the repository has one, whatever the
|
|
217
|
+
rules say. Kept out:
|
|
218
|
+
|
|
219
|
+
- **Secret-shaped files**, for example `.env`, `id_rsa`, `*.pem`, `*.key`,
|
|
220
|
+
credentials files and `.npmrc`, by name and whatever the extension, while
|
|
221
|
+
`redact_secret_files` is on, as it is by default: the scan neither lists
|
|
222
|
+
nor opens them. Two ways around it remain: a symbolic link under another
|
|
223
|
+
name is read as the file it points to (next item); and when a harvested
|
|
224
|
+
extract answer names a file inside the repository the scan did not
|
|
225
|
+
admit, the roles stage asks your assistant to read it. Their names are
|
|
226
|
+
kept in the scan's records, the `ambit codelib export` file and the
|
|
227
|
+
Cockpit.
|
|
228
|
+
- **Files outside the scanned repository**, except through a symbolic link:
|
|
229
|
+
a link inside the repository that points elsewhere is read as that file,
|
|
230
|
+
under the link's own name, listed for your assistant and, with the
|
|
231
|
+
explain capture on, kept and quoted. In a repository you did not write,
|
|
232
|
+
after the git config check of the first section, find its symbolic links
|
|
233
|
+
and remove or exclude them: `git -C <folder> ls-files -s` marks the ones
|
|
234
|
+
git tracks with mode `120000`, and when git does not list the files
|
|
235
|
+
(next item), untracked links are read too. `ambit harvest` rejects an
|
|
236
|
+
extract answer that reports a path outside the repository; a results
|
|
237
|
+
file your assistant writes straight into `results/` is not checked.
|
|
238
|
+
- **Untracked and ignored files**, when git lists the repository's files;
|
|
239
|
+
when it does not, only the other items here keep any file out.
|
|
240
|
+
- **Large, binary and minified files**, and **what you exclude** with
|
|
241
|
+
`exclude_dirs`, `exclude_globs`, `include_globs` and `include_ext`;
|
|
242
|
+
`include_ext` does not keep `.md`, `.rst` and `.txt` files out of the
|
|
243
|
+
explain capture. The config `ambit mapllm` generates also admits `.kt` and
|
|
244
|
+
`.kts` files, which `ambit scan` and `ambit map` leave out by default.
|
|
245
|
+
|
|
246
|
+
## Writes
|
|
247
|
+
|
|
248
|
+
**The scan's output folder** (`ambit scan --out`, by default `scans/latest`
|
|
249
|
+
under the folder you run it from) holds `scan.json` (the scanned folder's
|
|
250
|
+
path and the whole config, `domain_notes` included), `inventory.json` (the
|
|
251
|
+
admitted and skipped files), `results/` (the symbols with their signature
|
|
252
|
+
lines and doc comments, the connections, the duplicate clusters, the owner
|
|
253
|
+
records and your assistant's answers), `pending/` (the workflow scripts and
|
|
254
|
+
any explain task files; a scan does not empty it), `map/` (the draft and
|
|
255
|
+
ratified maps, the merge record and `disclosures.jsonl`, where the gate
|
|
256
|
+
appends a line for each new unit an assistant says it is writing),
|
|
257
|
+
`meter.json` and `ambit merge`'s artifact folders. Beside it,
|
|
258
|
+
`explain-cache.json` keeps the accepted explanations, and no command
|
|
259
|
+
deletes it. An accept-all `ambit ratify` writes `tasks.json` into the
|
|
260
|
+
parent of the `--scan` path as you typed it (with `--scan .`, the scan
|
|
261
|
+
folder itself), unless `--tasks` names another file.
|
|
262
|
+
|
|
263
|
+
**The runs folder** that `ambit cockpit --runs` names gets `cockpit.html`
|
|
264
|
+
(or `--out`), one self-contained page carrying what the runs and the files
|
|
265
|
+
beside them hold, the instruction and Markdown files its Library shows,
|
|
266
|
+
and what the files `portal.json` names hold. `ambit console serve` builds
|
|
267
|
+
the same page in memory and writes nothing. `ambit mds apply --runs` keeps
|
|
268
|
+
the old text and a diff of each file it rewrites under `mds-versions/`
|
|
269
|
+
there.
|
|
270
|
+
|
|
271
|
+
**The map's folder** (`ambit map`, `ambit mapllm`): by default one folder
|
|
272
|
+
per repository under `%LOCALAPPDATA%\AmbitGraph\` on Windows or
|
|
273
|
+
`~/.local/share/ambitgraph/` elsewhere, or `--out`. It holds the config it
|
|
274
|
+
generated; a run folder per scan, with everything a scan writes, the routes
|
|
275
|
+
and tables the framework packs found and the drawn page; `map.html`,
|
|
276
|
+
written by `--once`, a page you can keep or send; `serve.log`, a background
|
|
277
|
+
map's output, the paths an `ambit mapllm` stage hands your assistant
|
|
278
|
+
included, never rotated; and, while a map serves, `serve.json`, with the
|
|
279
|
+
repository's path and the stop token. After each scan the map keeps the
|
|
280
|
+
newest two `run-*` folders and deletes the rest; after two failed scans in
|
|
281
|
+
a row it keeps only the one it serves; a scan that runs out of time loses
|
|
282
|
+
its own run folder. These deletions reach every `run-*` folder there, so
|
|
283
|
+
give `--out` a folder used for nothing else.
|
|
284
|
+
|
|
285
|
+
**Elsewhere**:
|
|
286
|
+
|
|
287
|
+
- `ambit demo` writes the sample repository and its scan into
|
|
288
|
+
`./ambit-demo`, under the folder you run it from, or into `--out`.
|
|
289
|
+
- `ambit doctor` writes and deletes a probe file in the output folder (and
|
|
290
|
+
any empty folder it made for it); `ambit gate check` works on a copy of
|
|
291
|
+
the git index in a temporary folder, which it deletes when it ends.
|
|
292
|
+
- The Cockpit page writes no file itself. Its export buttons offer
|
|
293
|
+
downloads your browser saves: `rulings*.json`, and `mds-edits.json` with
|
|
294
|
+
the full new text of the documents you edited. It keeps its theme,
|
|
295
|
+
screen state, acknowledgements and the path and text of every Library
|
|
296
|
+
edit you have not reverted in your browser's storage for that page.
|
|
297
|
+
`ambit mds apply` with no bundle named reads the newest `mds-edits*.json`
|
|
298
|
+
in `~/Downloads`.
|
|
299
|
+
- `ambit cockpit --out`, `ambit codelib export --out`, `ambit merge --out`
|
|
300
|
+
and `ambit demo --out` write where they point, unchecked against your
|
|
301
|
+
repository; the installed package may get Python's bytecode caches.
|
|
302
|
+
|
|
303
|
+
**Into a repository**: `ambit merge --repo` (last section), and
|
|
304
|
+
`ambit mds apply`, which rewrites the Markdown instruction files the
|
|
305
|
+
Cockpit's Library lists as editable under `--repo-root` (by default the
|
|
306
|
+
folder that holds the installed `ambitgraph` package) from an edits bundle
|
|
307
|
+
you exported, with no `--execute`.
|
|
308
|
+
|
|
309
|
+
**Source text at rest.** Many of these files hold text from your code
|
|
310
|
+
(names, paths, signature lines, doc comments, the URLs and table names it
|
|
311
|
+
reads) and model-written fields that may quote it; among them
|
|
312
|
+
`results/symbols.json`, the pages (`cockpit.html`, `screen.html`,
|
|
313
|
+
`map.html`), the `ambit codelib export` file, an explain-capture run's
|
|
314
|
+
`results/text_capture.json` and task files, the merge's artifact folder
|
|
315
|
+
and test file, `mds-versions/`, a downloaded `mds-edits.json` and the
|
|
316
|
+
Cockpit's browser storage. Share them as you would the code.
|
|
317
|
+
|
|
318
|
+
## The one place the engine runs your code: `ambit merge`
|
|
319
|
+
|
|
320
|
+
`ambit merge --scan <dir> --cluster <id> --repo <working copy>`
|
|
321
|
+
consolidates one duplicate cluster in the working copy you name, after
|
|
322
|
+
refusing a member outside it and a map that no longer matches the files. A
|
|
323
|
+
cluster no human has ratified is refused unless you pass `--demo`, which
|
|
324
|
+
`--parameterized` never accepts.
|
|
325
|
+
|
|
326
|
+
**Python.** The artifact folder is `<scan>/merge-<id>/`, or `--out`. Step
|
|
327
|
+
0, for plain (not `async`) functions given neither `--inputs` nor
|
|
328
|
+
`--journal`, writes `pending/characterize.workflow.js` there and exits 3,
|
|
329
|
+
with no `--execute`; the script carries the whole function, its
|
|
330
|
+
decorators, and the import lines and module-level assignments it reads,
|
|
331
|
+
values included, for your assistant to propose sample inputs. With
|
|
332
|
+
`--execute` (refused without it) the merge runs each copy inside
|
|
333
|
+
AmbitGraph's own process, with Python's real builtins and imports: a plain
|
|
334
|
+
function on the sample inputs, an `async` function or a class with
|
|
335
|
+
stand-ins for its parameters and outside names. When copies disagree it
|
|
336
|
+
stops and prints what each returned or raised. Otherwise it writes
|
|
337
|
+
`tests_ambit/test_characterize_<id>.py`, which holds those results, and
|
|
338
|
+
runs pytest in the working copy before and after the change; pytest loads
|
|
339
|
+
your pytest configuration, `conftest.py` files and installed plugins and,
|
|
340
|
+
started as `python -m pytest` there, can import a module from the top of
|
|
341
|
+
the working copy in place of one it needs. Only on green does the merge
|
|
342
|
+
write `ambit_shared_<id>.py` beside the first copy, replacing any file of
|
|
343
|
+
that name, and rewrite every copy to import it.
|
|
344
|
+
|
|
345
|
+
On a red step every rewritten file is put back and the shared file is
|
|
346
|
+
deleted, even one that was there before; the test file stays, replacing an
|
|
347
|
+
earlier one of the same name, and so do pytest's cache files. Cluster ids
|
|
348
|
+
restart at `dup001` on a fresh scan, so check for an existing
|
|
349
|
+
`ambit_shared_<id>.py` first. On success the artifact folder keeps
|
|
350
|
+
`change.patch` and `merge-report.html`, which hold the moved code, and a
|
|
351
|
+
copy of the test, and `map/merged_map.json` records the merge. Each attempt
|
|
352
|
+
deletes an earlier report and patch there, and a success its `pending/`
|
|
353
|
+
folder; when the artifact folder is another one, each attempt also deletes
|
|
354
|
+
those two files from `<scan>/merge-<id>/`, and a success copies its own
|
|
355
|
+
into it.
|
|
356
|
+
|
|
357
|
+
**`--parameterized`**, for undecorated `async def` copies in one directory
|
|
358
|
+
that differ in a few of the names they read from outside. Its artifact
|
|
359
|
+
folder is `<scan>/parameterize-<id>/`, or `--out`. It writes its proposal,
|
|
360
|
+
with the full shared code, before any ratification check, even when it
|
|
361
|
+
then refuses, and never deletes it. With `--execute`, building the proposal
|
|
362
|
+
first runs each copy's own code in AmbitGraph's process, with stand-ins
|
|
363
|
+
for its parameters and the names it reads from its module, before anyone
|
|
364
|
+
has ratified anything. The change is made only once a human has ratified
|
|
365
|
+
that exact proposal by its content hash, every member unit is ratified,
|
|
366
|
+
and `--execute` is given; it then runs the copies again, writes
|
|
367
|
+
`tests_ambit/test_parameterized_<id>.py` and runs pytest as above, with the
|
|
368
|
+
same restore on red and the same test file left behind.
|
|
369
|
+
|
|
370
|
+
**JSP**, for a cluster of `.jsp` and `.jspf` pages, needs no `--execute`
|
|
371
|
+
and runs no copy itself. It writes the shared fragment
|
|
372
|
+
`<webroot>/WEB-INF/includes/ambit-shared-<id>.jspf`, rewrites each page to
|
|
373
|
+
include it and, when needed, edits `web.xml`. If splicing the fragment back
|
|
374
|
+
does not reproduce every page byte for byte, it puts every file back and
|
|
375
|
+
deletes the fragment, even one that was there before; folders it created
|
|
376
|
+
stay. `--jsp-compile-gate <command>` then runs your command over the
|
|
377
|
+
edited pages in the working copy (a script from the repository runs the
|
|
378
|
+
repository's own code); a non-zero exit, or a command that cannot start,
|
|
379
|
+
puts the files back the same way. A completed JSP merge keeps its patch and
|
|
380
|
+
report in its artifact folder.
|
|
381
|
+
|
|
382
|
+
**No sandbox wraps any of this**: no container, no network block, and no
|
|
383
|
+
time limit on the runs inside AmbitGraph's process or on pytest. The
|
|
384
|
+
protection is consent: the merge runs your code only with `--execute`,
|
|
385
|
+
whoever types it, an assistant included, and the compile command runs
|
|
386
|
+
because you name it. That code, and the command you name, can do whatever
|
|
387
|
+
your user account can.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# The source distribution (.tar.gz on PyPI) ships the packages, the README,
|
|
2
|
+
# the three user documents included below, pyproject and the LICENSE, plus
|
|
3
|
+
# the files the build itself adds (PKG-INFO, setup.cfg, the egg-info folder
|
|
4
|
+
# and this file). Everything pruned or excluded below stays out of it.
|
|
5
|
+
|
|
6
|
+
prune tests
|
|
7
|
+
prune tools
|
|
8
|
+
prune docs
|
|
9
|
+
prune build
|
|
10
|
+
prune dist
|
|
11
|
+
|
|
12
|
+
# Two more top-level packages are left out of the distribution.
|
|
13
|
+
prune ambit_telegraph
|
|
14
|
+
prune ambit_contracts
|
|
15
|
+
|
|
16
|
+
# Top-level folders named evidence, or starting evidence-, are left out.
|
|
17
|
+
prune evidence-*
|
|
18
|
+
prune evidence
|
|
19
|
+
|
|
20
|
+
# The .ambit folder (it holds responsibility.jsonl) is left out: it is not
|
|
21
|
+
# part of the installed package.
|
|
22
|
+
prune .ambit
|
|
23
|
+
|
|
24
|
+
# The user documents, read beside the README.
|
|
25
|
+
include QUICKSTART.md
|
|
26
|
+
include DATA-FLOW.md
|
|
27
|
+
include ADDING-A-PACK.md
|
|
28
|
+
|
|
29
|
+
# Two more root Markdown files and the root conftest.py are left out.
|
|
30
|
+
exclude AGENTS.md
|
|
31
|
+
exclude CHANGELOG.md
|
|
32
|
+
exclude conftest.py
|
|
33
|
+
|
|
34
|
+
global-exclude *.pyc
|
|
35
|
+
global-exclude __pycache__/*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ambitgraph
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.9
|
|
4
4
|
Summary: Read-only codebase scan: reusable units, families, roles, ownership candidates, duplication.
|
|
5
5
|
Author: AmbitGraph
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -22,6 +22,7 @@ Provides-Extra: dev
|
|
|
22
22
|
Requires-Dist: pytest>=7; extra == "dev"
|
|
23
23
|
Requires-Dist: mcp<2,>=1.2; extra == "dev"
|
|
24
24
|
Requires-Dist: jsonschema>=4; extra == "dev"
|
|
25
|
+
Requires-Dist: setuptools>=77; extra == "dev"
|
|
25
26
|
Provides-Extra: gate
|
|
26
27
|
Requires-Dist: mcp<2,>=1.2; extra == "gate"
|
|
27
28
|
Dynamic: license-file
|
|
@@ -34,7 +35,7 @@ Dynamic: license-file
|
|
|
34
35
|
|
|
35
36
|
One command, and you do. Deterministic. No tokens.
|
|
36
37
|
|
|
37
|
-
AmbitGraph draws your whole repo as a visual interactive map & library and gives them to you. It needs Python on your machine, never in your project. Free,
|
|
38
|
+
AmbitGraph draws your whole repo as a visual interactive map & library and gives them to you. It needs Python on your machine, never in your project. Free, no account, no API key, and it works with no network connection.
|
|
38
39
|
|
|
39
40
|
Python 3.11 or newer.
|
|
40
41
|
|
|
@@ -49,9 +50,11 @@ python -m ambitgraph map <folder>
|
|
|
49
50
|
|
|
50
51
|
The command gives your terminal back and the map keeps serving. Stop it with `python -m ambitgraph map <folder> --stop`.
|
|
51
52
|
|
|
53
|
+
Start `python -m ambitgraph` from outside the folder you map, for example from its parent. Started inside it, Python first looks there for the modules the tool imports, so a file named like one of them, `json.py` say, would run instead. `ambit map` does not add that folder itself.
|
|
54
|
+
|
|
52
55
|
Your codebase is displayed in your browser as local webpages.
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
AmbitGraph itself writes nothing into the folder you map. Git, which it asks for the file list, can still start a program your repository's own git settings name (DATA-FLOW.md, first section).
|
|
55
58
|
|
|
56
59
|
## Update
|
|
57
60
|
|
|
@@ -65,7 +68,9 @@ Updating the tool is not the same as refreshing a map: after your code changes,
|
|
|
65
68
|
|
|
66
69
|
## The cockpit
|
|
67
70
|
|
|
68
|
-
`ambit cockpit --runs <dir>` builds the
|
|
71
|
+
`ambit cockpit --runs <dir>` builds the Cockpit, a static dashboard page over a folder of scan runs. When a `portal.json` (in `<dir>`, or named with `--portal`) points its `urcode_root` at a map's output folder, the page also gains an UrCode tab: that map's Graph, Library and whole map on one dark screen.
|
|
72
|
+
|
|
73
|
+
The gate that IDE assistants query before they generate code (`ambit gate serve`) is set up in QUICKSTART.md, section 6.
|
|
69
74
|
|
|
70
75
|
## A GRAPH
|
|
71
76
|
|
|
@@ -79,13 +84,13 @@ Understand your own codebase in a way you never have. Simple, visual, and if you
|
|
|
79
84
|
|
|
80
85
|
## Your machine
|
|
81
86
|
|
|
82
|
-
The map is served
|
|
87
|
+
The map is served on your machine's loopback address, which only this machine can reach, though any user or program on it can open the map. AmbitGraph sends it nowhere itself. DATA-FLOW.md, first section, lists what can still reach another machine, among them a program your repository's git settings name. The map and your code belong to you.
|
|
83
88
|
|
|
84
89
|
## No AI
|
|
85
90
|
|
|
86
91
|
No AI is required. The map is plain reading of your code.
|
|
87
92
|
|
|
88
|
-
No model runs, no tokens burn, no key exists. If you want more than the map, your own assistant can work on top of it, on your own subscription, with whatever model you already pay for. Optional, always, and the map is finished without it.
|
|
93
|
+
No model runs, no tokens burn, no key exists. If you want more than the map, your own assistant can work on top of it, on your own subscription, with whatever model you already pay for. It then reads your files and sends them to that model's provider; DATA-FLOW.md says what each step gives it. Optional, always, and the map is finished without it.
|
|
89
94
|
|
|
90
95
|
## In this version
|
|
91
96
|
|