graphcoding 0.3.0__tar.gz → 0.4.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.
- {graphcoding-0.3.0/src/graphcoding.egg-info → graphcoding-0.4.0}/PKG-INFO +1 -1
- {graphcoding-0.3.0 → graphcoding-0.4.0}/pyproject.toml +1 -1
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/__init__.py +1 -1
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/cli.py +9 -6
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/store.py +6 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0/src/graphcoding.egg-info}/PKG-INFO +1 -1
- {graphcoding-0.3.0 → graphcoding-0.4.0}/tests/test_e2e.py +17 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/LICENSE +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/README.md +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/setup.cfg +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/drift.py +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/health.py +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/hooks.py +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/scan.py +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding/sync.py +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding.egg-info/SOURCES.txt +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding.egg-info/dependency_links.txt +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding.egg-info/entry_points.txt +0 -0
- {graphcoding-0.3.0 → graphcoding-0.4.0}/src/graphcoding.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphcoding
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Draw the graph of the system you want — then code until the repo matches. Future files and scheduled deletions are graph data; a drift gate blocks commits until code and declared design converge.
|
|
5
5
|
Author: Mosab Sayyed
|
|
6
6
|
License: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "graphcoding"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
description = "Draw the graph of the system you want — then code until the repo matches. Future files and scheduled deletions are graph data; a drift gate blocks commits until code and declared design converge."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -21,8 +21,9 @@ import sys
|
|
|
21
21
|
from . import __version__
|
|
22
22
|
from .drift import blocking_count, compute_drift, format_report
|
|
23
23
|
from .scan import scan_repo, trackable
|
|
24
|
-
from .store import (DEFAULT_CONFIG, EDGE_TYPES, GRAPH_DIR,
|
|
25
|
-
Node, config_path, find_root,
|
|
24
|
+
from .store import (DEFAULT_CONFIG, EDGE_TYPE_RE, EDGE_TYPES, GRAPH_DIR,
|
|
25
|
+
NODE_TYPES, Graph, Node, config_path, find_root,
|
|
26
|
+
load_config)
|
|
26
27
|
from .sync import sync as run_sync
|
|
27
28
|
from . import hooks as hooks_mod
|
|
28
29
|
|
|
@@ -109,8 +110,9 @@ def cmd_plan(args) -> None:
|
|
|
109
110
|
except ValueError:
|
|
110
111
|
sys.exit(f"bad --edge '{spec}' (want TYPE:target, e.g. IMPORTS:src/db.py)")
|
|
111
112
|
etype = etype.upper()
|
|
112
|
-
if
|
|
113
|
-
sys.exit(f"
|
|
113
|
+
if not EDGE_TYPE_RE.match(etype):
|
|
114
|
+
sys.exit(f"bad edge type {etype} (UPPER_SNAKE word; common: "
|
|
115
|
+
f"{', '.join(EDGE_TYPES)})")
|
|
114
116
|
node.add_edge(target, etype)
|
|
115
117
|
existing = g.nodes.get(args.name)
|
|
116
118
|
if existing and existing.status != "planned" and not args.force:
|
|
@@ -136,8 +138,9 @@ def cmd_link(args) -> None:
|
|
|
136
138
|
if not src:
|
|
137
139
|
sys.exit(f"unknown source node {args.source} (plan or scan it first)")
|
|
138
140
|
etype = args.type.upper()
|
|
139
|
-
if
|
|
140
|
-
sys.exit(f"
|
|
141
|
+
if not EDGE_TYPE_RE.match(etype):
|
|
142
|
+
sys.exit(f"bad edge type {etype} (UPPER_SNAKE word; common: "
|
|
143
|
+
f"{', '.join(EDGE_TYPES)})")
|
|
141
144
|
added = src.add_edge(args.target, etype)
|
|
142
145
|
g.save()
|
|
143
146
|
note = "" if args.target in g.nodes else " (target not in graph yet — planned work)"
|
|
@@ -29,11 +29,17 @@ NODE_TYPES = [
|
|
|
29
29
|
"Component", "Hook", "TypeDef", "ServiceDef", "ConfigFile", "Doc",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
|
+
# Common edge vocabulary — conventions, not a schema. Any UPPER_SNAKE word is
|
|
33
|
+
# a valid edge type (DEPLOYED_IN, PROMOTES_TO, MIRRORS, OWNS, ...). The
|
|
34
|
+
# scanner owns IMPORTS; everything else is human/agent vocabulary.
|
|
32
35
|
EDGE_TYPES = [
|
|
33
36
|
"IMPORTS", "CALLS", "CONTAINS", "INHERITS", "IMPLEMENTS",
|
|
34
37
|
"REFERENCES", "DEPENDS_ON", "RELATED_TO",
|
|
38
|
+
"DEPLOYED_IN", "PROMOTES_TO", "CONFIGURES",
|
|
35
39
|
]
|
|
36
40
|
|
|
41
|
+
EDGE_TYPE_RE = re.compile(r"^[A-Z][A-Z0-9_]*$")
|
|
42
|
+
|
|
37
43
|
STATUSES = ["ok", "planned", "needs-analysis", "to-be-deleted"]
|
|
38
44
|
|
|
39
45
|
GRAPH_DIR = ".graphcoding"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphcoding
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Draw the graph of the system you want — then code until the repo matches. Future files and scheduled deletions are graph data; a drift gate blocks commits until code and declared design converge.
|
|
5
5
|
Author: Mosab Sayyed
|
|
6
6
|
License: MIT
|
|
@@ -247,6 +247,23 @@ def test_external_nodes_db_mcp(repo, capsys):
|
|
|
247
247
|
assert g.nodes["erp:sap::orders"].type == "ErpObject"
|
|
248
248
|
|
|
249
249
|
|
|
250
|
+
def test_environments_and_open_edge_types(repo, capsys):
|
|
251
|
+
run(repo, "init")
|
|
252
|
+
run(repo, "plan", "env:prod", "--existing", "-t", "Environment",
|
|
253
|
+
"-s", "Production. READ-ONLY for agents; deploys via ops/deploy.sh")
|
|
254
|
+
run(repo, "plan", "env:staging", "--existing", "-t", "Environment",
|
|
255
|
+
"-s", "Staging; safe for experiments")
|
|
256
|
+
run(repo, "link", "env:staging", "PROMOTES_TO", "env:prod") # open edge type
|
|
257
|
+
run(repo, "plan", "svc:api", "--existing", "-t", "ServiceDef",
|
|
258
|
+
"-s", "API service", "-e", "DEPLOYED_IN:env:prod")
|
|
259
|
+
run(repo, "link", "src/app.py", "BAD!TYPE", "env:prod", expect_exit=1)
|
|
260
|
+
run(repo, "drift", expect_exit=0)
|
|
261
|
+
capsys.readouterr()
|
|
262
|
+
run(repo, "show", "env:prod")
|
|
263
|
+
out = capsys.readouterr().out
|
|
264
|
+
assert "READ-ONLY" in out and "PROMOTES_TO" in out and "DEPLOYED_IN" in out
|
|
265
|
+
|
|
266
|
+
|
|
250
267
|
def test_graph_file_is_sorted_and_stable(repo):
|
|
251
268
|
run(repo, "init")
|
|
252
269
|
p = os.path.join(repo, ".graphcoding", "graph.jsonl")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|