graphite-code 1.9.3__py3-none-any.whl → 1.9.4__py3-none-any.whl

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.
graphite/__init__.py CHANGED
@@ -38,4 +38,4 @@ __all__ = ["__version__"]
38
38
  #: Coarse and hand-maintained by construction. It is a release label, not
39
39
  #: evidence that a given fix is present -- to answer that, survey for the marker
40
40
  #: the fix introduced, or compare `graphite --version` fingerprints.
41
- __version__ = "1.9.3"
41
+ __version__ = "1.9.4"
graphite/agent_hooks.py CHANGED
@@ -23,7 +23,7 @@ from .graph import edge_relations
23
23
  from .graph_io import load_validated_graph_bundle
24
24
  from .health import _edge_language, is_placeholder, persisted_resolution
25
25
  from .incident_ledger import record_incident, repo_ledger_dir
26
- from .ingest import enclosing_git_root, repository_root
26
+ from .ingest import activation_root, repository_root
27
27
  from .query import _CALL_RELATIONS
28
28
 
29
29
  SESSION_CONTRACT = (
@@ -77,18 +77,25 @@ def _activate(root: Path) -> None:
77
77
  """Register this repo as open, so the daemon supervises it and leaves the
78
78
  rest of the machine alone.
79
79
 
80
- A directory below a checkout's root is never registered. No build can run
81
- there (`ingest` refuses it), so the daemon would fail on it at every
82
- discovery cycle for as long as the marker lived.
80
+ What is registered is `ingest.activation_root`'s answer, the rule the
81
+ CLI's backstop uses too. A directory below a checkout's root is never
82
+ registered: no build can run there, so the daemon would fail on it at
83
+ every discovery cycle for as long as the marker lived. A folder in no
84
+ repository is registered only where graphite is set up there, and a drive
85
+ or filesystem root never is, not even one holding `.git`. The payload's
86
+ `cwd` follows a `cd` in the shell and `Stop` renews the marker every turn,
87
+ so a session that wandered to a drive root would otherwise keep the whole
88
+ drive under supervision.
83
89
 
84
90
  Guarded separately from the caller's own try/except: activation is
85
91
  bookkeeping, and this module is fail-open by contract -- a broken registry
86
92
  must never cost the agent its session context or its graph-first reminder.
87
93
  """
88
94
  try:
89
- if enclosing_git_root(root) not in (None, root):
95
+ opened = activation_root(root)
96
+ if opened is None:
90
97
  return
91
- mark_active(root, "claude")
98
+ mark_active(opened, "claude")
92
99
  except Exception:
93
100
  return
94
101
 
graphite/cli.py CHANGED
@@ -53,7 +53,7 @@ from .graph_io import MAX_GRAPH_BYTES, GraphReadError, load_validated_graph_bund
53
53
  from .health import persisted_resolution, ratio_percent, resolution_health
54
54
  from . import hookinstall
55
55
  from .incident_ledger import record_incident, repo_ledger_dir
56
- from .ingest import collect_files, enclosing_git_root, repository_root, trusted_root
56
+ from .ingest import activation_root, collect_files, enclosing_git_root, repository_root, trusted_root
57
57
  from .init import init_project, platform_choices, resolve_platform_selection
58
58
  from .io import atomic_write_json
59
59
  from .listing import listing_lines
@@ -3704,14 +3704,16 @@ def main(argv: list[str] | None = None) -> int:
3704
3704
  # GRAPHITE_DAEMON_CHILD, without which activation would never expire.
3705
3705
  #
3706
3706
  # What is registered is the REPOSITORY the command is typed in, not the
3707
- # directory (#81): its root where graphite is set up there, and nothing at
3708
- # all for a folder below some other checkout's root. No build can run
3709
- # below a root, so the daemon would fail on such a marker at every
3710
- # discovery cycle for as long as it lived. `agent_hooks._activate` has
3711
- # made the same two choices since #80.
3707
+ # directory (#81), and `ingest.activation_root` decides it for this path
3708
+ # and for `agent_hooks._activate` alike: never a drive or filesystem root,
3709
+ # not even one holding `.git`; otherwise a checkout's root; nothing for a
3710
+ # folder below a root, where no build can run; and a folder in no
3711
+ # repository only where graphite is set up there. Registering any folder
3712
+ # a command ran in put a whole drive under supervision when a command was
3713
+ # typed at its root.
3712
3714
  if args.command not in _ACTIVATION_EXEMPT_COMMANDS and not _is_scratch_workspace(Path.cwd()):
3713
- opened = repository_root(Path.cwd())
3714
- if _root_above(opened) is None:
3715
+ opened = activation_root(Path.cwd())
3716
+ if opened is not None:
3715
3717
  activation.mark_active(opened, "cli")
3716
3718
 
3717
3719
  try:
graphite/ingest.py CHANGED
@@ -248,6 +248,9 @@ def repository_root(directory: Path) -> Path:
248
248
  is asked last: the hooks ask for the root at every tool call.
249
249
 
250
250
  Never raises: a directory that cannot be read stands for itself.
251
+
252
+ This answers where a session or command READS. What it may REGISTER with
253
+ the daemon is narrower, and `activation_root` decides that.
251
254
  """
252
255
  try:
253
256
  top = enclosing_git_root(directory)
@@ -260,6 +263,44 @@ def repository_root(directory: Path) -> Path:
260
263
  return directory
261
264
 
262
265
 
266
+ def activation_root(directory: Path) -> Path | None:
267
+ """The directory a session or command in `directory` registers as open, or
268
+ None for nothing.
269
+
270
+ Asked by the two paths that INFER activation from where they run: the
271
+ CLI's backstop and the agent hooks. `graphite activate` names its path and
272
+ is believed as given, so it does not ask.
273
+
274
+ - A drive or filesystem root never registers, not even one holding
275
+ `.git`. Registering whatever folder a command ran in handed the daemon
276
+ that folder to build: a command typed in a drive root put the whole
277
+ drive under supervision, and every build of it timed out until the
278
+ marker expired an hour later. A stray `.git` at a drive root is the
279
+ same drive, so it is asked about first -- the stance `trusted_root`
280
+ already takes. A repository whose root really is a drive root is
281
+ registered with `graphite activate`, which names its path.
282
+ - A checkout's root registers itself, set up or not. That is how a fresh
283
+ clone gets its first graph.
284
+ - A folder below a checkout's root registers nothing. No build can run
285
+ there (#80, #81), so the daemon would fail on the marker at every cycle.
286
+ - A folder in no repository registers itself only where graphite is set
287
+ up there (a graph, or `GRAPHITE.md`). A home directory, which often
288
+ holds a stray package manifest, is otherwise the drive-root case again.
289
+
290
+ Never raises: a directory that cannot be read registers nothing.
291
+ """
292
+ try:
293
+ root = repository_root(directory)
294
+ if root.parent == root or _resolved(root).parent == _resolved(root):
295
+ return None
296
+ top = enclosing_git_root(root)
297
+ if top is not None:
298
+ return root if top == root else None
299
+ return root if _is_set_up(root) else None
300
+ except OSError:
301
+ return None
302
+
303
+
263
304
  def _git_ls_files(
264
305
  root: Path,
265
306
  *,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.9.3
3
+ Version: 1.9.4
4
4
  Summary: Local-first, zero-LLM knowledge graph extraction for codebases.
5
5
  Project-URL: Homepage, https://github.com/jared0565/graphite
6
6
  Project-URL: Repository, https://github.com/jared0565/graphite
@@ -49,7 +49,7 @@ Description-Content-Type: text/markdown
49
49
 
50
50
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
51
51
 
52
- **Status: 1.9.3, production/stable.** Published on PyPI as
52
+ **Status: 1.9.4, production/stable.** Published on PyPI as
53
53
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
54
54
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
55
55
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -1,9 +1,9 @@
1
- graphite/__init__.py,sha256=qcb1ma4NarbXArhUCm7BqXsuZWvIH4aTT2WmiKvxaoM,2181
1
+ graphite/__init__.py,sha256=VWekp1kuBVFH3NsU4V7DG--BW0Io_xYYw2oK-aOf2dQ,2181
2
2
  graphite/__main__.py,sha256=Bp5bcXE6M0AnuNW1LjOXOEvGG5r0fXZoeRb_k5Yxphs,149
3
3
  graphite/_cleanup_worker.py,sha256=oIXOPa1jHVP8ePRSwn27nZEHOAc4DSBrjeH2Ds9wuq8,19619
4
4
  graphite/_win32_ctypes.py,sha256=YLH4kpKjL7zUUOs9E8C-Kjdy45PJBd6eRUeKwiKdSV4,1476
5
5
  graphite/activation.py,sha256=Jcgk8AFvqbMNQiPAa2MTzSO0BAYRC5FX6MsZUjbDe1I,5249
6
- graphite/agent_hooks.py,sha256=m8L2hEWdqZxLiEXpIatY-TxEtiHI6WF3F0fUszNlo54,77565
6
+ graphite/agent_hooks.py,sha256=7fpwi7PTxggbIFK805e1F2jLK0u0hg9G4xzvsbpvs9o,78005
7
7
  graphite/agent_settings.py,sha256=Ec95ilPhkPOM3vW67pdsjYivnCyc5uCqWfCBu-DLI3A,11085
8
8
  graphite/analyze.py,sha256=BwiZ4lkQ8Oo8WvnIGLI03YSNUpynYvV46tVbzHH5iWQ,9304
9
9
  graphite/answer_contract.py,sha256=KTnGmtT6gvi28-PhLZp9vaj7FDvGrqLW_BvhAa-VPR4,31237
@@ -11,7 +11,7 @@ graphite/bootstrap.py,sha256=OPDzN9jSr8IE1N7xOnVKk3FgO2UqBTOUNcNV-pZAsus,8448
11
11
  graphite/buildlock.py,sha256=QXo4cnGGCmhxuuYdy6f5OHF82Yg6zHUMxLVdxwG49ic,5393
12
12
  graphite/cache.py,sha256=Mh28dYg9irXBvH-oa8jpFSM-ehXcs5FuNVHVzF_WRA8,9143
13
13
  graphite/channel.py,sha256=UNFAGuws6XFbkBu0fnVLepBDxT1BWAJlW33IPVlDi9M,72908
14
- graphite/cli.py,sha256=kjTdUwP2t0OxLLxJkQb9K7azu89is9U-x4f_ulczd7I,166397
14
+ graphite/cli.py,sha256=KSE6UHWh6Xi8Yc0W6GJd5gicMOk82k3LSWn98gb47zc,166547
15
15
  graphite/cluster.py,sha256=j5dFT40DD7scD4h8d7XJoAGQIcJKpsKsrFceiJkOuzw,4066
16
16
  graphite/config.py,sha256=ZWhWOWYEyKGoHCp6vWI4M4NQM57ohf5BaX0Ty8HfWYM,9267
17
17
  graphite/context.py,sha256=vWMuFxqDGby-9Gs_t9XNJzKR-nZqwMdbU2y6N_GypWU,13215
@@ -33,7 +33,7 @@ graphite/hook_entry.py,sha256=0lfCZB9-B_9QBKagLhV_VIMVFcrOeAwpLcFXUjhMMpg,2655
33
33
  graphite/hookinstall.py,sha256=7qfboCBjP7DAeugbXXjZDDg-0aP7GJc_WhqxgJsOlV4,10215
34
34
  graphite/hookshim.py,sha256=4to9xkNOWPjbk1Es97KTTknjJM9gdHkbEDjCQq8ntec,3771
35
35
  graphite/incident_ledger.py,sha256=fXL3seCIcBPexXlFhds9FeX_3svwo8qHfvca2NQFRiE,9748
36
- graphite/ingest.py,sha256=FG4YNRTds7GFypV8HgT_DOlTzw4zoVw2aaKwGPrSxX0,13892
36
+ graphite/ingest.py,sha256=ODpSYJ0wGtDpVlJ-gLiGU6AsofJTZmiaIjtRsZQj9R4,15899
37
37
  graphite/init.py,sha256=yoCyQ83UJ7Nb_suq_HUAVOwPhHbqpWfKtfD4P3n_LPE,41322
38
38
  graphite/io.py,sha256=YBXfMcPsv1Lzun8ByW4BQlfgMm54akckLFrUhwWtleI,2996
39
39
  graphite/launchd_agent.py,sha256=rmKhhCbB-9FDU_3A1b2OlZxKpxZqdgtYnLbzkFMs_rI,4529
@@ -113,8 +113,8 @@ graphite/routing/zai_edit.py,sha256=Kra2tI9GkntQAhV1vNHlFlp4sY-ksq2-bY4N9fEfLEc,
113
113
  graphite/routing/zai_executor.py,sha256=cHUl7DbWRUhYg9Lwm3OiP6H3dI70y_b8iAWCyfgOPi0,6636
114
114
  graphite/routing/zai_probe.py,sha256=HL2vM8s2J4-n8Bp3l7QLpWLEk-PhZrt_rLc2cY65hvU,4771
115
115
  graphite/ts_resolver.mjs,sha256=wiKDWkJIC9__3wL49ty4W8hRc5biisNNtFhH1aFA47A,10822
116
- graphite_code-1.9.3.dist-info/METADATA,sha256=we0nvE9z4vzjdoSRDVv9IXdpLeD254ewKx4WyOjkzMQ,48525
117
- graphite_code-1.9.3.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
118
- graphite_code-1.9.3.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
- graphite_code-1.9.3.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
- graphite_code-1.9.3.dist-info/RECORD,,
116
+ graphite_code-1.9.4.dist-info/METADATA,sha256=obB3iKnIjKUbdyUly9oVR7FkOs8Qhvl2e8l7tp_Hm_M,48525
117
+ graphite_code-1.9.4.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
118
+ graphite_code-1.9.4.dist-info/entry_points.txt,sha256=-BpYAYFyn58DYi-hrFW9hMz6mTwNsYI44s9gaef4MiM,87
119
+ graphite_code-1.9.4.dist-info/licenses/LICENSE,sha256=mfotJ1Lk0VVUgoEPOIR7-x5cvYiz2UkuVH7e3fhoDiY,1066
120
+ graphite_code-1.9.4.dist-info/RECORD,,