cfgit 0.4.2__tar.gz → 0.4.3__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.
- {cfgit-0.4.2 → cfgit-0.4.3}/PKG-INFO +1 -1
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/pyproject.toml +2 -2
- {cfgit-0.4.2 → cfgit-0.4.3}/pyproject.toml +1 -1
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/adapters/base.py +6 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/adapters/mongo.py +28 -2
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/adapters/postgres.py +44 -2
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/engine.py +14 -5
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/ui/server.py +32 -6
- {cfgit-0.4.2 → cfgit-0.4.3}/.github/workflows/ci.yml +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/.github/workflows/publish.yml +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/.gitignore +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/CONTRIBUTING.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/CREDITS.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/LICENSE +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/NOTICE +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/README.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/SECURITY.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/ADAPTERS.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/AGENTS.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/BRANCHING_PLAN.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/CONFIGURATION.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/IDENTITY_AND_ATTRIBUTION.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/PUBLISHING.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/README.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/SPEC.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/SPEC_CORE.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/USAGE.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/screenshots/01-diff.png +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/screenshots/02-impact.png +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/screenshots/03-scoped-impact.png +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/screenshots/04-branches.png +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/docs/screenshots/05-pull-request.png +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/examples/.cfg.toml +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/examples/cfgit-support-demo.toml +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/examples/seed_support_demo.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/README.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/overview.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/base.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/claude.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/factory.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/gemini.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/plugins/cfg_impact/cfg_impact/providers/openai_provider.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/skills/cfgit/SKILL.md +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/adapters/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/approval/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/approval/base.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/cli/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/cli/main.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/authz.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/config.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/diff.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/hashing.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/identity.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/core/remedy.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/interfaces/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/interfaces/actions.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/mcp/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/mcp/server.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/ui/__init__.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/src/cfg/update.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_adapter_contract_live.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_authz.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_awareness.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_commit_dry_run.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_config.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_config_discovery.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_console_script.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_core_purity.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_engine_safety.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_export_import.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_hashing.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_identity.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_impact_boundary.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_mcp_identity.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_mongo_history.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_output_mode.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_postgres_history.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_remedy.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_set_fields.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_ui_server.py +0 -0
- {cfgit-0.4.2 → cfgit-0.4.3}/tests/test_update_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cfgit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Git-style history, diff, drift detection, and rollback for live database records without migrating or owning your datastore
|
|
5
5
|
Project-URL: Homepage, https://github.com/AusafMo/cfgit
|
|
6
6
|
Project-URL: Repository, https://github.com/AusafMo/cfgit
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cfgit-impact"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.3"
|
|
4
4
|
description = "Optional cfgit plugin for deterministic system-impact summaries and opt-in LLM narration of database record diffs"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = "Apache-2.0"
|
|
8
8
|
authors = [{ name = "Mohammad Ausaf" }]
|
|
9
9
|
dependencies = [
|
|
10
|
-
"cfgit>=0.4.
|
|
10
|
+
"cfgit>=0.4.3,<0.5.0",
|
|
11
11
|
"httpx>=0.27",
|
|
12
12
|
]
|
|
13
13
|
|
|
@@ -108,6 +108,12 @@ class StorageAdapter(Protocol):
|
|
|
108
108
|
def get_records(self, collection: str, record_ids: list[str]) -> dict[str, dict]: ...
|
|
109
109
|
def get_heads(self, collection: str, record_ids: list[str]) -> dict[str, dict]: ...
|
|
110
110
|
|
|
111
|
+
# OPTIONAL cheap ref list for Engine._all_refs. Returns just the distinct
|
|
112
|
+
# (collection, record_id) pairs that have history — no doc, no per-row object
|
|
113
|
+
# materialization. Callers feature-detect and fall back to query_history when
|
|
114
|
+
# absent. On a remote store this is the difference between ~160ms and ~5s per load.
|
|
115
|
+
def list_history_refs(self) -> list[tuple[str, str]]: ...
|
|
116
|
+
|
|
111
117
|
# history reads
|
|
112
118
|
def get_head(self, collection: str, record_id: str) -> dict | None: ...
|
|
113
119
|
def query_history(self, *, collection: str | None = None, record_id: str | None = None,
|
|
@@ -31,6 +31,20 @@ except ModuleNotFoundError as exc: # pragma: no cover
|
|
|
31
31
|
raise ModuleNotFoundError("install cfgit[mongo] to use MongoAdapter") from exc
|
|
32
32
|
|
|
33
33
|
|
|
34
|
+
# MongoClient is thread-safe and connection-pooled by design, so one per URI can be shared
|
|
35
|
+
# across engines. A fresh client pays a full TLS+SRV handshake (~2s on Atlas); the UI builds
|
|
36
|
+
# an engine per request, so without this cache every /api/state re-handshakes. Keyed by URI.
|
|
37
|
+
_CLIENT_CACHE: dict[str, "MongoClient"] = {}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _client_for(uri: str) -> "MongoClient":
|
|
41
|
+
client = _CLIENT_CACHE.get(uri)
|
|
42
|
+
if client is None:
|
|
43
|
+
client = MongoClient(uri)
|
|
44
|
+
_CLIENT_CACHE[uri] = client
|
|
45
|
+
return client
|
|
46
|
+
|
|
47
|
+
|
|
34
48
|
class MongoAdapter:
|
|
35
49
|
def __init__(self, *, project: ProjectConfig, env_name: str):
|
|
36
50
|
env = project.envs[env_name]
|
|
@@ -42,9 +56,9 @@ class MongoAdapter:
|
|
|
42
56
|
self.history_uri = env.history_uri or env.uri
|
|
43
57
|
self.runtime_db_name = env.runtime_db or env.db
|
|
44
58
|
self.history_db_name = env.history_db or env.db
|
|
45
|
-
self.client =
|
|
59
|
+
self.client = _client_for(self.history_uri)
|
|
46
60
|
self.history_client = self.client
|
|
47
|
-
self.runtime_client = self.client if self.runtime_uri == self.history_uri else
|
|
61
|
+
self.runtime_client = self.client if self.runtime_uri == self.history_uri else _client_for(self.runtime_uri)
|
|
48
62
|
self.db = self.runtime_client[self.runtime_db_name]
|
|
49
63
|
self.history_db = self.history_client[self.history_db_name]
|
|
50
64
|
self.history = self.history_db[project.history.history_collection]
|
|
@@ -115,6 +129,18 @@ class MongoAdapter:
|
|
|
115
129
|
out[rid] = _history_row(row, with_doc=True)
|
|
116
130
|
return out
|
|
117
131
|
|
|
132
|
+
def list_history_refs(self) -> list[tuple[str, str]]:
|
|
133
|
+
"""Distinct (collection, record_id) pairs that have history, projected to just
|
|
134
|
+
those two fields — no doc, no per-row object churn. Feeds Engine._all_refs cheaply
|
|
135
|
+
(~160ms vs ~5s of pulling full rows on a remote store)."""
|
|
136
|
+
cursor = self.history.find(
|
|
137
|
+
{"env": self.env_name}, {"collection": 1, "record_id": 1, "_id": 0}
|
|
138
|
+
)
|
|
139
|
+
seen: set[tuple[str, str]] = set()
|
|
140
|
+
for row in cursor:
|
|
141
|
+
seen.add((str(row["collection"]), str(row["record_id"])))
|
|
142
|
+
return sorted(seen)
|
|
143
|
+
|
|
118
144
|
def get_head(self, collection: str, record_id: str) -> dict | None:
|
|
119
145
|
ptr = self.heads.find_one(self._head_query(collection, record_id))
|
|
120
146
|
if not ptr:
|
|
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
from copy import deepcopy
|
|
11
11
|
from datetime import datetime, timezone
|
|
12
12
|
import re
|
|
13
|
+
import threading
|
|
13
14
|
from typing import Any
|
|
14
15
|
|
|
15
16
|
from cfg.adapters.base import (
|
|
@@ -38,6 +39,25 @@ except ModuleNotFoundError as exc: # pragma: no cover
|
|
|
38
39
|
_IDENT_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*$")
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
# A psycopg connection is stateful and NOT safe to share across threads (unlike a
|
|
43
|
+
# thread-safe MongoClient). The UI builds an adapter per request on a threading server,
|
|
44
|
+
# so we cache one connection per (thread, URI): each thread reuses its own connection
|
|
45
|
+
# across requests — reclaiming the ~seconds-long TLS connect — without cross-thread sharing.
|
|
46
|
+
_CONN_CACHE = threading.local()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _conn_for(uri: str) -> "psycopg.Connection":
|
|
50
|
+
cache = getattr(_CONN_CACHE, "by_uri", None)
|
|
51
|
+
if cache is None:
|
|
52
|
+
cache = {}
|
|
53
|
+
_CONN_CACHE.by_uri = cache
|
|
54
|
+
conn = cache.get(uri)
|
|
55
|
+
if conn is None or conn.closed:
|
|
56
|
+
conn = psycopg.connect(uri, autocommit=True, row_factory=dict_row)
|
|
57
|
+
cache[uri] = conn
|
|
58
|
+
return conn
|
|
59
|
+
|
|
60
|
+
|
|
41
61
|
class PostgresAdapter:
|
|
42
62
|
def __init__(self, *, project: ProjectConfig, env_name: str):
|
|
43
63
|
env = project.envs[env_name]
|
|
@@ -45,7 +65,7 @@ class PostgresAdapter:
|
|
|
45
65
|
raise ValueError(f"missing Postgres URI for env {env_name}")
|
|
46
66
|
self.project = project
|
|
47
67
|
self.env_name = env_name
|
|
48
|
-
self.conn =
|
|
68
|
+
self.conn = _conn_for(env.uri)
|
|
49
69
|
self.history_table_name = project.history.history_collection
|
|
50
70
|
self.heads_table_name = project.history.heads_collection
|
|
51
71
|
self.refs_table_name = project.branches.refs_collection
|
|
@@ -147,6 +167,17 @@ class PostgresAdapter:
|
|
|
147
167
|
rows = cur.fetchall()
|
|
148
168
|
return {str(row["record_id"]): _history_row(row) for row in rows}
|
|
149
169
|
|
|
170
|
+
def list_history_refs(self) -> list[tuple[str, str]]:
|
|
171
|
+
"""Distinct (collection, record_id) pairs that have history — cheap two-column
|
|
172
|
+
scan for Engine._all_refs instead of materializing full rows via query_history."""
|
|
173
|
+
with self.conn.cursor() as cur:
|
|
174
|
+
cur.execute(
|
|
175
|
+
f"SELECT DISTINCT collection_name, record_id FROM {self.history_table} "
|
|
176
|
+
f"WHERE env = %s ORDER BY collection_name, record_id",
|
|
177
|
+
[self.env_name],
|
|
178
|
+
)
|
|
179
|
+
return [(str(row["collection_name"]), str(row["record_id"])) for row in cur.fetchall()]
|
|
180
|
+
|
|
150
181
|
def get_head(self, collection: str, record_id: str) -> dict | None:
|
|
151
182
|
with self.conn.cursor() as cur:
|
|
152
183
|
cur.execute(
|
|
@@ -211,8 +242,12 @@ class PostgresAdapter:
|
|
|
211
242
|
add_clause("oid LIKE %s", f"{oid}%")
|
|
212
243
|
|
|
213
244
|
direction = "DESC" if order == "desc" else "ASC"
|
|
245
|
+
# Select only the columns _history_row reads, and pull the large `doc` jsonb only
|
|
246
|
+
# when the caller asked for it — SELECT * shipped doc on every with_doc=False call
|
|
247
|
+
# (e.g. _all_refs, log listing), which is wasted transfer on a remote store.
|
|
248
|
+
cols = _HISTORY_COLUMNS + (", doc" if with_doc else "")
|
|
214
249
|
sql = (
|
|
215
|
-
f"SELECT
|
|
250
|
+
f"SELECT {cols} FROM {self.history_table} "
|
|
216
251
|
f"WHERE {' AND '.join(clauses)} "
|
|
217
252
|
f"ORDER BY collection_name ASC, record_id ASC, seq {direction}"
|
|
218
253
|
)
|
|
@@ -779,6 +814,13 @@ class PostgresAdapter:
|
|
|
779
814
|
)
|
|
780
815
|
|
|
781
816
|
|
|
817
|
+
# Columns _history_row reads (everything except the large `doc` jsonb, added on demand).
|
|
818
|
+
_HISTORY_COLUMNS = (
|
|
819
|
+
"env, collection_name, record_id, seq, oid, parent_oid, message, author, "
|
|
820
|
+
"recorded_at, valid_from, valid_to, valid_from_estimated, op, git_shas, tags, meta"
|
|
821
|
+
)
|
|
822
|
+
|
|
823
|
+
|
|
782
824
|
def _history_row(row: dict[str, Any], *, with_doc: bool = True) -> dict[str, Any]:
|
|
783
825
|
out = {
|
|
784
826
|
"env": row["env"],
|
|
@@ -552,12 +552,13 @@ class Engine:
|
|
|
552
552
|
untracked), so the snapshot records exactly which version it represents. Writes nothing.
|
|
553
553
|
"""
|
|
554
554
|
refs = [ref] if ref else self._all_refs(include_history=False)
|
|
555
|
+
live_by_ref, head_by_ref = self._batch_live_and_heads(refs)
|
|
555
556
|
items: list[dict[str, Any]] = []
|
|
556
557
|
for item in sorted(refs, key=lambda r: (r.collection, r.record_id)):
|
|
557
|
-
live =
|
|
558
|
+
live = live_by_ref.get((item.collection, item.record_id))
|
|
558
559
|
if live is None:
|
|
559
560
|
continue
|
|
560
|
-
head =
|
|
561
|
+
head = head_by_ref.get((item.collection, item.record_id))
|
|
561
562
|
items.append(
|
|
562
563
|
{
|
|
563
564
|
"record": f"{item.collection}:{item.record_id}",
|
|
@@ -583,9 +584,10 @@ class Engine:
|
|
|
583
584
|
secret_groups: dict[tuple[str, str, str], dict[str, Any]] = {}
|
|
584
585
|
large_groups: dict[tuple[str, str], dict[str, Any]] = {}
|
|
585
586
|
invariant_violations = self.adapter.check_runtime_invariant(ref.collection if ref else None)
|
|
587
|
+
live_by_ref, _ = self._batch_live_and_heads(refs)
|
|
586
588
|
scanned = 0
|
|
587
589
|
for item in refs:
|
|
588
|
-
live =
|
|
590
|
+
live = live_by_ref.get((item.collection, item.record_id))
|
|
589
591
|
if live is None:
|
|
590
592
|
continue
|
|
591
593
|
scanned += 1
|
|
@@ -1317,8 +1319,15 @@ class Engine:
|
|
|
1317
1319
|
for record_id in self.adapter.list_record_ids(coll.name):
|
|
1318
1320
|
refs.add((coll.name, record_id))
|
|
1319
1321
|
if include_history:
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
+
# Prefer the cheap two-field ref list; fall back to query_history for adapters
|
|
1323
|
+
# that don't implement it. query_history materializes every non-doc field of
|
|
1324
|
+
# every history row, which is a multi-second hotspot on a remote store.
|
|
1325
|
+
list_history_refs = getattr(self.adapter, "list_history_refs", None)
|
|
1326
|
+
if callable(list_history_refs):
|
|
1327
|
+
refs.update(list_history_refs())
|
|
1328
|
+
else:
|
|
1329
|
+
for row in self.adapter.query_history(limit=None, order="asc", with_doc=False):
|
|
1330
|
+
refs.add((row["collection"], row["record_id"]))
|
|
1322
1331
|
return [RecordRef(collection, record_id) for collection, record_id in refs]
|
|
1323
1332
|
|
|
1324
1333
|
def _main_doc(self, ref: RecordRef) -> dict[str, Any] | None:
|
|
@@ -266,6 +266,11 @@ UI_HTML = r"""<!doctype html>
|
|
|
266
266
|
--disp:"Space Grotesk",ui-sans-serif,system-ui,sans-serif;
|
|
267
267
|
--body:"Inter",ui-sans-serif,system-ui,-apple-system,sans-serif;
|
|
268
268
|
--mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
|
|
269
|
+
/* dashed drift ring, drawn as an SVG stroke so the dashes divide the circumference
|
|
270
|
+
evenly (a CSS dashed border bunches them to one side, and too many small dashes read
|
|
271
|
+
as a fuzzy dotted ring). Used as a mask; color comes from --amber. 5 clean dashes:
|
|
272
|
+
(4.0 dash + 2.28 gap) x5 ~= circumference 2*pi*5 = 31.4. */
|
|
273
|
+
--drift-ring:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13 13"><circle cx="6.5" cy="6.5" r="5" fill="none" stroke="black" stroke-width="1.8" stroke-dasharray="4.0 2.28" stroke-linecap="butt"/></svg>');
|
|
269
274
|
}
|
|
270
275
|
/* DARK: deep slate, never pure black; calm on the eyes.
|
|
271
276
|
Accent is monochrome (ink) + a single restrained GitHub green for primary actions. */
|
|
@@ -479,7 +484,8 @@ UI_HTML = r"""<!doctype html>
|
|
|
479
484
|
.node.sel{background:var(--panel2)}
|
|
480
485
|
.node.sel::before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--accent)}
|
|
481
486
|
/* graph rail: vertical line + node markers */
|
|
482
|
-
.
|
|
487
|
+
/* line center (20.5 + 2/2 = 21.5) is aligned to the marker center (15 + 13/2 = 21.5). */
|
|
488
|
+
.node .line{position:absolute;left:20.5px;top:0;bottom:0;width:2px;background:var(--edge2)}
|
|
483
489
|
.node:first-child .line{top:20px}
|
|
484
490
|
.node:last-child .line{bottom:calc(100% - 20px)}
|
|
485
491
|
.node .mk{position:absolute;left:15px;top:14px;width:13px;height:13px;border-radius:50%;
|
|
@@ -488,8 +494,16 @@ UI_HTML = r"""<!doctype html>
|
|
|
488
494
|
.node.restore .mk{border-color:var(--sky)}
|
|
489
495
|
.node.adopt .mk{border-color:var(--moss)}
|
|
490
496
|
.node.importt .mk{border-color:var(--faint)}
|
|
491
|
-
/* drift = open dashed ring in amber
|
|
492
|
-
|
|
497
|
+
/* drift = open dashed ring in amber. A CSS `border:dashed` renders its dashes from a
|
|
498
|
+
fixed origin, so they bunch to one side and the ring reads as off-center. Instead we
|
|
499
|
+
draw the ring as an SVG stroke whose dash pattern divides the circumference evenly
|
|
500
|
+
(perfectly symmetric), applied as a mask so it still respects the theme amber var.
|
|
501
|
+
An opaque base fill (pane bg + amber tint) keeps the timeline rail from showing through. */
|
|
502
|
+
.node.live .mk{border:0;z-index:2;background:linear-gradient(var(--amber-bg),var(--amber-bg)),var(--panel);
|
|
503
|
+
animation:pulse 2.4s ease-in-out infinite}
|
|
504
|
+
.node.live .mk::after{content:"";position:absolute;inset:0;background:var(--amber);
|
|
505
|
+
-webkit-mask:var(--drift-ring) center/contain no-repeat;mask:var(--drift-ring) center/contain no-repeat}
|
|
506
|
+
|
|
493
507
|
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 var(--amber-bg)}50%{box-shadow:0 0 0 5px transparent}}
|
|
494
508
|
.node .msg{font-size:13px;line-height:1.4;margin-bottom:4px}
|
|
495
509
|
.node.live .msg{color:var(--amber);font-weight:500}
|
|
@@ -968,7 +982,7 @@ document.addEventListener("click",e=>{if(!e.target.closest(".selectbox"))closeSe
|
|
|
968
982
|
document.addEventListener("keydown",e=>{if(e.key==="Escape")closeSelectMenus();});
|
|
969
983
|
syncSelectMenus();
|
|
970
984
|
|
|
971
|
-
async function loadState(){
|
|
985
|
+
async function loadState(isRefresh){
|
|
972
986
|
const st=await fetch("/api/state?"+qs()).then(r=>r.json()).catch(e=>({error:String(e)}));
|
|
973
987
|
if(st.data&&st.data.whoami){const w=st.data.whoami;S.who=w;const id=w.identity||{};
|
|
974
988
|
const disp=w.identity_display||w.author||"";
|
|
@@ -995,7 +1009,10 @@ async function loadState(){
|
|
|
995
1009
|
if(Object.keys(S.open).length===0){colls.forEach(c=>{S.open[c]=S.records.some(r=>r.collection===c&&isDrift(r.state));});
|
|
996
1010
|
if(!Object.values(S.open).some(Boolean)&&colls[0])S.open[colls[0]]=true;}
|
|
997
1011
|
renderFilters();renderTree();
|
|
998
|
-
|
|
1012
|
+
// Auto-default to the History/Activity view only on the FIRST load. On a refresh, softRefresh()
|
|
1013
|
+
// restores whatever tab you were on — so refreshing on Records (with nothing selected) must not
|
|
1014
|
+
// yank you to History.
|
|
1015
|
+
if(!isRefresh&&!S.sel&&!document.querySelector(".app")?.classList.contains("pr-mode")&&!document.querySelector(".app")?.classList.contains("branches-mode"))renderRecentHistory();
|
|
999
1016
|
}
|
|
1000
1017
|
|
|
1001
1018
|
function branchNames(){return [...new Set((S.branches.length?S.branches.map(b=>b.name):["main"]).filter(Boolean))];}
|
|
@@ -1771,7 +1788,16 @@ $("find").addEventListener("input",e=>{S.q=e.target.value;renderTree();});
|
|
|
1771
1788
|
// Reload state from the server but stay on the current tab/record — used by the Refresh
|
|
1772
1789
|
// button and by auto-refresh so new drift/branches/PRs (created in a terminal or another
|
|
1773
1790
|
// tab) show up without a manual reload.
|
|
1774
|
-
function
|
|
1791
|
+
function inActivityMode(){return $("navHistoryTab")?.classList.contains("on");}
|
|
1792
|
+
function softRefresh(){const keep=S.sel, prMode=inPrMode(), branchesMode=inBranchesMode(), activityMode=inActivityMode();
|
|
1793
|
+
return loadState(true).then(()=>{
|
|
1794
|
+
if(prMode){renderPrWorkspace();return;}
|
|
1795
|
+
if(branchesMode){renderBranchesWorkspace();return;}
|
|
1796
|
+
if(activityMode){renderRecentHistory();return;}
|
|
1797
|
+
if(keep){selectRecord(keep);return;}
|
|
1798
|
+
// Records tab with nothing selected: stay put (tree already re-rendered above).
|
|
1799
|
+
setNav("navRecordsTab");
|
|
1800
|
+
});}
|
|
1775
1801
|
$("refresh").onclick=()=>softRefresh();
|
|
1776
1802
|
// Auto-refresh: pick up out-of-band changes without a manual reload. We skip while a modal
|
|
1777
1803
|
// is open or a diff/impact panel is loading so we never yank the view out from under you.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|