graphcoding 0.2.0__tar.gz → 0.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphcoding
3
- Version: 0.2.0
3
+ Version: 0.3.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.2.0"
7
+ version = "0.3.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"
@@ -3,4 +3,4 @@
3
3
  Query before you touch code. Design in the graph. Sync as you go.
4
4
  Drift is caught by tooling, not memory.
5
5
  """
6
- __version__ = "0.2.0"
6
+ __version__ = "0.3.0"
@@ -326,7 +326,8 @@ def build_parser() -> argparse.ArgumentParser:
326
326
  s.add_argument("name", help="repo-relative path, path::Symbol, or an external "
327
327
  "name like db:orders / api:stripe (see external_prefixes)")
328
328
  s.add_argument("--summary", "-s", help="one line: what it will do")
329
- s.add_argument("--type", "-t", default="CodeFile", choices=NODE_TYPES)
329
+ s.add_argument("--type", "-t", default="CodeFile",
330
+ help=f"free-form; common: {', '.join(NODE_TYPES)}")
330
331
  s.add_argument("--edge", "-e", action="append",
331
332
  help="TYPE:target (repeatable), e.g. -e IMPORTS:src/db.py")
332
333
  s.add_argument("--existing", action="store_true",
@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
 
22
22
  import json
23
23
  import os
24
+ import re
24
25
  from dataclasses import dataclass, field
25
26
 
26
27
  NODE_TYPES = [
@@ -52,20 +53,20 @@ DEFAULT_CONFIG = {
52
53
  ],
53
54
  "ignore_tests": True,
54
55
  "scan_symbols": False,
55
- # nodes whose names start with these prefixes describe architecture that
56
- # is not a repo file — drift never expects one on disk:
57
- # db: database objects (db:orders, db:settings::llm_provider)
58
- # mcp: MCP servers and their tools (mcp:router::get_blast_radius)
59
- # svc: deployed services / processes (svc:api-gateway)
60
- # queue: queues / topics (queue:invoice-events)
61
- # api: third-party APIs (api:stripe::charges)
62
- # ext: anything else outside the repo
63
- "external_prefixes": ["db:", "mcp:", "svc:", "queue:", "api:", "ext:"],
64
56
  }
65
57
 
58
+ # The classification is OPEN and binary: a node is either CODE (a repo-relative
59
+ # file path — scanned, drift-gated) or ANOTHER SYSTEM (any "scheme:" name —
60
+ # declared, never expected on disk). Invent whatever schemes fit your world:
61
+ # db:orders, mcp:router::search, svc:gateway, erp:sap::orders, team:payments,
62
+ # sensor:plant-7. The scheme is yours; the lifecycle and edges are the same.
63
+ _SCHEME = re.compile(r"^[A-Za-z][A-Za-z0-9_.+-]*:(?!//)")
66
64
 
67
- def is_external(name: str, cfg: dict) -> bool:
68
- return any(name.startswith(p) for p in cfg.get("external_prefixes", []))
65
+
66
+ def is_external(name: str, cfg: dict | None = None) -> bool:
67
+ """True for 'scheme:...' names (non-file architecture). File paths never
68
+ carry a scheme; URLs (scheme://) are also treated as external."""
69
+ return bool(_SCHEME.match(name)) or "://" in name
69
70
 
70
71
 
71
72
  @dataclass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphcoding
3
- Version: 0.2.0
3
+ Version: 0.3.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
@@ -238,6 +238,13 @@ def test_external_nodes_db_mcp(repo, capsys):
238
238
  g = Graph.load(repo)
239
239
  assert "mcp:router::search" not in g.nodes # externals retire immediately
240
240
  run(repo, "drift", expect_exit=0)
241
+ # the classification is OPEN — any invented scheme and type work
242
+ run(repo, "plan", "erp:sap::orders", "--existing", "-t", "ErpObject",
243
+ "-s", "SAP order master; synced nightly")
244
+ run(repo, "link", "src/app.py", "REFERENCES", "erp:sap::orders")
245
+ run(repo, "drift", expect_exit=0)
246
+ g = Graph.load(repo)
247
+ assert g.nodes["erp:sap::orders"].type == "ErpObject"
241
248
 
242
249
 
243
250
  def test_graph_file_is_sorted_and_stable(repo):
File without changes
File without changes
File without changes