Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions config/project-registry-overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"_comment": "Operator-editable enrollment for the canonical project registry. 'overrides' pins hard normalization failures (drifted identifier -> canonical project_key). 'supplementary' enrolls real operator-OS projects the auditor does not track as git repos. 'memory_meta' maps ~/.claude memory note-slugs to their parent project (or '' for pure meta-notes). Consumed by src/project_registry.py; falls back to built-in defaults if this file is absent.",
"overrides": {
"jcc": "JobCommandCenter",
"jsm_export": "JSMTicketAnalyticsExport",
"bhv": "BrowserHistoryVisualizer",
"netmapper": "NetworkMapper",
"notion_os": "Notion",
"screenshotselect": "ScreenshottoDataSelect",
"interruptionresume": "Interruption Resume Studio"
},
"supplementary": [
{
"canonical_key": "supp:personal-ops",
"display_name": "personal-ops",
"repo_full_name": null,
"group_key": "operator_infra",
"lifecycle_state": "active",
"note": "Local operator control plane (127.0.0.1:46210). Most active project in bridge-db yet absent from auditor portfolio-truth."
},
{
"canonical_key": "supp:SecondBrain",
"display_name": "SecondBrain",
"repo_full_name": null,
"group_key": "operator_infra",
"lifecycle_state": "active",
"note": "4-layer knowledge vault at /Users/d/Documents/SecondBrain (engraph-indexed). Not a git repo; absent from auditor."
}
],
"memory_meta": {
"personal_ops_codebase": "supp:personal-ops",
"personal_ops_vision": "supp:personal-ops",
"github_repo_auditor_future_arcs": "GithubRepoAuditor",
"skill_library_port_2026-05": "",
"skill_eval_harness_2026-05": ""
}
}
49 changes: 49 additions & 0 deletions src/portfolio_truth_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
validate_registry_markdown,
validate_truth_snapshot,
)
from src.project_registry import build_project_registry, load_source_paths


@dataclass(frozen=True)
Expand All @@ -25,6 +26,47 @@ class PortfolioTruthPublishResult:
project_count: int
registry_changed: bool
report_changed: bool
project_registry_path: Path | None = None


_REPO_ROOT = Path(__file__).resolve().parents[1]
_CONFIG_DIR = _REPO_ROOT / "config"


def _build_project_registry_json(snapshot, *, include_notion: bool) -> str:
"""Render the canonical cross-store project registry from a snapshot.

External sources (bridge-db, Notion snapshot, memory) degrade gracefully
when absent, so this never fails the publish run.
"""
overrides_config_path = _CONFIG_DIR / "project-registry-overrides.json"
sources = load_source_paths(overrides_config_path)

scoring_pageids: dict[str, str] = {}
if include_notion and sources.get("scoring_data_source_id"):
try:
from src.notion_client import get_notion_token
from src.project_registry import fetch_scoring_pageids

token = get_notion_token()
if token:
scoring_pageids = fetch_scoring_pageids(
str(sources["scoring_data_source_id"]), token
)
except Exception:
scoring_pageids = {}

registry = build_project_registry(
snapshot.to_dict(),
bridge_db_path=sources["bridge_db"],
notion_snapshot_path=sources["notion_snapshot"],
notion_project_map_path=_CONFIG_DIR / "notion-project-map.json",
memory_dir=sources["memory_dir"],
scoring_pageids=scoring_pageids,
overrides_config_path=overrides_config_path,
generated_at=snapshot.generated_at,
)
return json.dumps(registry, indent=2) + "\n"


def publish_portfolio_truth(
Expand Down Expand Up @@ -60,6 +102,10 @@ def publish_portfolio_truth(
latest_path = truth_latest_path(output_dir)
latest_name = latest_path.name
snapshot_json = json.dumps(build_result.snapshot.to_dict(), indent=2) + "\n"
project_registry_path = output_dir / "project-registry.json"
project_registry_json = _build_project_registry_json(
build_result.snapshot, include_notion=include_notion
)
registry_markdown = render_registry_markdown(build_result.snapshot)
report_markdown = render_portfolio_report_markdown(build_result.snapshot, latest_name)

Expand All @@ -79,12 +125,14 @@ def publish_portfolio_truth(
latest_path: snapshot_json,
registry_output: registry_markdown,
portfolio_report_output: report_markdown,
project_registry_path: project_registry_json,
}
changed: dict[Path, bool] = {
registry_output: _content_changed(registry_output, registry_markdown),
portfolio_report_output: _content_changed(portfolio_report_output, report_markdown),
snapshot_path: True,
latest_path: True,
project_registry_path: True,
}
temp_files = {path: _stage_text(path, content) for path, content in targets.items()}
originals = {path: (path.read_text() if path.exists() else None) for path in targets}
Expand Down Expand Up @@ -119,6 +167,7 @@ def publish_portfolio_truth(
project_count=len(build_result.snapshot.projects),
registry_changed=changed[registry_output],
report_changed=changed[portfolio_report_output],
project_registry_path=project_registry_path,
)


Expand Down
Loading
Loading