chipgraph 0.1.0__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.
- chipgraph/__init__.py +7 -0
- chipgraph/adapters/__init__.py +1 -0
- chipgraph/adapters/format/__init__.py +6 -0
- chipgraph/adapters/format/__main__.py +16 -0
- chipgraph/adapters/format/_yaml_lines.py +54 -0
- chipgraph/adapters/format/chip_yaml.py +323 -0
- chipgraph/adapters/format/qsoc_contract.py +246 -0
- chipgraph/adapters/llm/__init__.py +58 -0
- chipgraph/adapters/llm/_budget.py +173 -0
- chipgraph/adapters/llm/_errors.py +50 -0
- chipgraph/adapters/llm/_nda.py +30 -0
- chipgraph/adapters/llm/_retry.py +85 -0
- chipgraph/adapters/llm/anthropic.py +247 -0
- chipgraph/adapters/llm/decide_backend.py +179 -0
- chipgraph/adapters/llm/fake.py +87 -0
- chipgraph/adapters/llm/guard.py +68 -0
- chipgraph/adapters/parser/__init__.py +22 -0
- chipgraph/adapters/parser/cocotb.py +304 -0
- chipgraph/adapters/parser/generic_regex.py +75 -0
- chipgraph/adapters/parser/verible.py +55 -0
- chipgraph/adapters/parser/verilator.py +46 -0
- chipgraph/adapters/review/__init__.py +7 -0
- chipgraph/adapters/review/file.py +123 -0
- chipgraph/adapters/review/github.py +886 -0
- chipgraph/adapters/runner/__init__.py +7 -0
- chipgraph/adapters/runner/local.py +122 -0
- chipgraph/adapters/runtime/__init__.py +5 -0
- chipgraph/adapters/runtime/claude_code/__init__.py +24 -0
- chipgraph/adapters/runtime/claude_code/agents.py +158 -0
- chipgraph/adapters/runtime/claude_code/decisions.py +280 -0
- chipgraph/adapters/runtime/claude_code/guarded.py +310 -0
- chipgraph/adapters/runtime/claude_code/isolation.py +482 -0
- chipgraph/adapters/runtime/claude_code/loop.py +342 -0
- chipgraph/adapters/runtime/claude_code/previous.py +419 -0
- chipgraph/adapters/runtime/claude_code/review.py +492 -0
- chipgraph/adapters/runtime/claude_code/runtime.py +192 -0
- chipgraph/adapters/runtime/claude_code/service.py +2285 -0
- chipgraph/adapters/tool/__init__.py +7 -0
- chipgraph/adapters/tool/cmd.py +229 -0
- chipgraph/adapters/tool/edalize.py +773 -0
- chipgraph/adapters/tool/filelist.py +259 -0
- chipgraph/adapters/tool/pyslang.py +485 -0
- chipgraph/adapters/vcs/__init__.py +1 -0
- chipgraph/adapters/vcs/git.py +521 -0
- chipgraph/app/__init__.py +10 -0
- chipgraph/app/baseline.py +339 -0
- chipgraph/app/build.py +332 -0
- chipgraph/app/checks.py +202 -0
- chipgraph/app/context.py +191 -0
- chipgraph/app/errors.py +11 -0
- chipgraph/app/executors.py +79 -0
- chipgraph/app/findings.py +203 -0
- chipgraph/app/ingest.py +523 -0
- chipgraph/checks/__init__.py +52 -0
- chipgraph/checks/_cdc_analyze.py +272 -0
- chipgraph/checks/_cdc_elaborate.py +455 -0
- chipgraph/checks/_common.py +268 -0
- chipgraph/checks/_cross.py +96 -0
- chipgraph/checks/_model.py +64 -0
- chipgraph/checks/_naming_pyslang.py +235 -0
- chipgraph/checks/_naming_rules.py +127 -0
- chipgraph/checks/_xref_syntax.py +260 -0
- chipgraph/checks/cdc_struct.py +235 -0
- chipgraph/checks/connect.py +353 -0
- chipgraph/checks/cross_chip.py +454 -0
- chipgraph/checks/duplicate.py +153 -0
- chipgraph/checks/filelist.py +323 -0
- chipgraph/checks/format.py +268 -0
- chipgraph/checks/generated.py +151 -0
- chipgraph/checks/hardcode.py +233 -0
- chipgraph/checks/layout.py +155 -0
- chipgraph/checks/naming.py +311 -0
- chipgraph/checks/plan_check.py +901 -0
- chipgraph/checks/ports_diff.py +203 -0
- chipgraph/checks/spec_schema.py +277 -0
- chipgraph/checks/style.py +910 -0
- chipgraph/checks/tb_static.py +599 -0
- chipgraph/checks/trace.py +224 -0
- chipgraph/checks/vendor_guard.py +369 -0
- chipgraph/checks/wrap_check.py +486 -0
- chipgraph/cli/__init__.py +1688 -0
- chipgraph/cli/next_steps.py +137 -0
- chipgraph/core/__init__.py +1 -0
- chipgraph/core/config/__init__.py +93 -0
- chipgraph/core/config/defaults.py +14 -0
- chipgraph/core/config/errors.py +32 -0
- chipgraph/core/config/loader.py +766 -0
- chipgraph/core/config/models.py +845 -0
- chipgraph/core/config/templates.py +340 -0
- chipgraph/core/contracts/__init__.py +75 -0
- chipgraph/core/contracts/_paths.py +26 -0
- chipgraph/core/contracts/agent.py +49 -0
- chipgraph/core/contracts/artifact.py +68 -0
- chipgraph/core/contracts/check.py +76 -0
- chipgraph/core/contracts/event.py +70 -0
- chipgraph/core/contracts/export.py +128 -0
- chipgraph/core/contracts/finding.py +171 -0
- chipgraph/core/contracts/gate.py +50 -0
- chipgraph/core/contracts/rule.py +177 -0
- chipgraph/core/contracts/types.py +45 -0
- chipgraph/core/engine/__init__.py +70 -0
- chipgraph/core/engine/agent_rule.py +1362 -0
- chipgraph/core/engine/baseline.py +283 -0
- chipgraph/core/engine/decide.py +462 -0
- chipgraph/core/engine/fanout.py +1358 -0
- chipgraph/core/engine/gate.py +170 -0
- chipgraph/core/engine/graph.py +647 -0
- chipgraph/core/engine/records.py +60 -0
- chipgraph/core/engine/rules.py +92 -0
- chipgraph/core/engine/scheduler.py +637 -0
- chipgraph/core/engine/select.py +1239 -0
- chipgraph/core/engine/targets.py +342 -0
- chipgraph/core/model/__init__.py +98 -0
- chipgraph/core/model/entities.py +244 -0
- chipgraph/core/model/export.py +16 -0
- chipgraph/core/model/ingest.py +693 -0
- chipgraph/core/model/json_value.py +4 -0
- chipgraph/core/model/keys.py +95 -0
- chipgraph/core/model/model.py +153 -0
- chipgraph/core/model/provenance.py +27 -0
- chipgraph/core/model/query.py +583 -0
- chipgraph/core/model/registry.py +80 -0
- chipgraph/core/model/relations.py +61 -0
- chipgraph/core/model/store.py +279 -0
- chipgraph/core/plugin_api/__init__.py +81 -0
- chipgraph/core/plugin_api/local.py +167 -0
- chipgraph/core/plugin_api/pack.py +159 -0
- chipgraph/core/plugin_api/protocols.py +177 -0
- chipgraph/core/plugin_api/registry.py +111 -0
- chipgraph/core/plugin_api/types.py +94 -0
- chipgraph/core/runtime/__init__.py +41 -0
- chipgraph/core/runtime/executor.py +79 -0
- chipgraph/core/runtime/queue.py +565 -0
- chipgraph/core/runtime/roles/__init__.py +91 -0
- chipgraph/core/runtime/roles/data/author.md +41 -0
- chipgraph/core/runtime/roles/data/critic.md +56 -0
- chipgraph/core/runtime/roles/data/planner.md +38 -0
- chipgraph/core/runtime/roles/data/researcher.md +37 -0
- chipgraph/core/runtime/roles/data/rtl-author.md +64 -0
- chipgraph/core/runtime/roles/data/tb-author.md +48 -0
- chipgraph/core/runtime/roles/data/triage.md +34 -0
- chipgraph/core/runtime/roles/policy.py +299 -0
- chipgraph/core/runtime/roles/registry.py +52 -0
- chipgraph/core/runtime/roles/review.py +275 -0
- chipgraph/core/runtime/roles/schema.py +82 -0
- chipgraph/core/runtime/roles/skills.py +134 -0
- chipgraph/core/runtime/roles/spec.py +232 -0
- chipgraph/core/state/__init__.py +1 -0
- chipgraph/core/state/artifacts.py +156 -0
- chipgraph/core/state/backend.py +117 -0
- chipgraph/core/state/findings.py +151 -0
- chipgraph/core/state/handoff.py +411 -0
- chipgraph/core/state/idempotency.py +59 -0
- chipgraph/core/state/journal.py +238 -0
- chipgraph/core/state/layout.py +82 -0
- chipgraph/core/state/lock.py +195 -0
- chipgraph/core/state/trace.py +225 -0
- chipgraph/learn/__init__.py +96 -0
- chipgraph/learn/draft.py +187 -0
- chipgraph/learn/infer.py +580 -0
- chipgraph/learn/models.py +145 -0
- chipgraph/learn/try_run.py +228 -0
- chipgraph/mcp/__init__.py +12 -0
- chipgraph/mcp/model_tools.py +167 -0
- chipgraph/mcp/server.py +787 -0
- chipgraph/orgs/qnsc/naming-v1.yml +113 -0
- chipgraph/orgs/qnsc/profile.yml +5 -0
- chipgraph/packs/__init__.py +8 -0
- chipgraph/packs/assist/__init__.py +16 -0
- chipgraph/packs/assist/ask/__init__.py +58 -0
- chipgraph/packs/assist/ask/_db.py +57 -0
- chipgraph/packs/assist/ask/_project.py +230 -0
- chipgraph/packs/assist/ask/answer.py +266 -0
- chipgraph/packs/assist/ask/check.py +182 -0
- chipgraph/packs/assist/ask/contract.py +115 -0
- chipgraph/packs/assist/ask/documents.py +157 -0
- chipgraph/packs/assist/ask/fts.py +80 -0
- chipgraph/packs/assist/ask/retrieve.py +331 -0
- chipgraph/packs/assist/audit/__init__.py +383 -0
- chipgraph/packs/assist/pack.yml +13 -0
- chipgraph/packs/assist/triage/__init__.py +64 -0
- chipgraph/packs/assist/triage/contract.py +94 -0
- chipgraph/packs/assist/triage/parse.py +371 -0
- chipgraph/packs/assist/triage/question.py +384 -0
- chipgraph/packs/assist/triage/report.py +160 -0
- chipgraph/packs/assist/triage/rules.py +447 -0
- chipgraph/packs/assist/triage/run.py +224 -0
- chipgraph/packs/digital_rtl/__init__.py +19 -0
- chipgraph/packs/digital_rtl/layout.py +144 -0
- chipgraph/packs/digital_rtl/pack.yml +25 -0
- chipgraph/packs/digital_rtl/plan/__init__.py +34 -0
- chipgraph/packs/digital_rtl/plan/__main__.py +16 -0
- chipgraph/packs/digital_rtl/plan/context.py +82 -0
- chipgraph/packs/digital_rtl/plan/expand.py +94 -0
- chipgraph/packs/digital_rtl/plan/model.py +150 -0
- chipgraph/packs/digital_rtl/plan/resolver.py +400 -0
- chipgraph/packs/digital_rtl/plan/show.py +176 -0
- chipgraph/packs/digital_rtl/pr/__init__.py +11 -0
- chipgraph/packs/digital_rtl/pr/body.py +165 -0
- chipgraph/packs/digital_rtl/pr/gate.py +110 -0
- chipgraph/packs/digital_rtl/pr/open.py +397 -0
- chipgraph/packs/digital_rtl/rtl/__init__.py +9 -0
- chipgraph/packs/digital_rtl/rtl/context.py +272 -0
- chipgraph/packs/digital_rtl/rules/open_pr.yml +30 -0
- chipgraph/packs/digital_rtl/rules/plan.yml +28 -0
- chipgraph/packs/digital_rtl/rules/plan_expand.yml +29 -0
- chipgraph/packs/digital_rtl/rules/pr_gate.yml +27 -0
- chipgraph/packs/digital_rtl/rules/review.yml +31 -0
- chipgraph/packs/digital_rtl/rules/rtl_module.yml +53 -0
- chipgraph/packs/digital_rtl/skills/lang-sv-rtl.md +58 -0
- chipgraph/packs/digital_rtl/skills/org-naming.md +29 -0
- chipgraph/packs/digital_rtl/skills/plan-modules.md +63 -0
- chipgraph/packs/digital_rtl/skills/review-diff.md +41 -0
- chipgraph/packs/digital_rtl/targets/plan.yml +11 -0
- chipgraph/packs/digital_rtl/targets/rtl.yml +20 -0
- chipgraph/packs/digital_rtl/wrapper/__init__.py +24 -0
- chipgraph/packs/digital_rtl/wrapper/common.py +171 -0
- chipgraph/packs/digital_rtl/wrapper/context.py +222 -0
- chipgraph/packs/digital_rtl/wrapper/emacs.py +626 -0
- chipgraph/packs/digital_rtl/wrapper/expansion.py +304 -0
- chipgraph/packs/digital_rtl/wrapper/lisp.py +504 -0
- chipgraph/packs/digital_rtl/wrapper/resolver.py +60 -0
- chipgraph/packs/digital_rtl/wrapper/rules/wrapper.yml +41 -0
- chipgraph/packs/digital_rtl/wrapper/rules/wrapper_gen.yml +35 -0
- chipgraph/packs/digital_rtl/wrapper/skills/wrapper-auto.md +120 -0
- chipgraph/packs/dv/__init__.py +15 -0
- chipgraph/packs/dv/declaration.py +392 -0
- chipgraph/packs/dv/interface.py +596 -0
- chipgraph/packs/dv/pack.yml +14 -0
- chipgraph/packs/dv/rules/tb_module.yml +42 -0
- chipgraph/packs/dv/skills/dv/cocotb.md +72 -0
- chipgraph/packs/spec_core/__init__.py +9 -0
- chipgraph/packs/spec_core/extract/__init__.py +12 -0
- chipgraph/packs/spec_core/extract/_markdown.py +371 -0
- chipgraph/packs/spec_core/extract/_text.py +116 -0
- chipgraph/packs/spec_core/extract/mas.py +975 -0
- chipgraph/packs/spec_core/gen/__init__.py +11 -0
- chipgraph/packs/spec_core/gen/agents_md/__init__.py +148 -0
- chipgraph/packs/spec_core/gen/agents_md/_context.py +239 -0
- chipgraph/packs/spec_core/gen/agents_md/_markers.py +131 -0
- chipgraph/packs/spec_core/gen/agents_md/agents_md.md.j2 +178 -0
- chipgraph/packs/spec_core/gen/diagram/__init__.py +110 -0
- chipgraph/packs/spec_core/gen/diagram/__main__.py +44 -0
- chipgraph/packs/spec_core/gen/diagram/_diagrams.py +403 -0
- chipgraph/packs/spec_core/gen/diagram/_scene.py +163 -0
- chipgraph/packs/spec_core/pack.yml +6 -0
- chipgraph/py.typed +0 -0
- chipgraph-0.1.0.dist-info/METADATA +53 -0
- chipgraph-0.1.0.dist-info/RECORD +252 -0
- chipgraph-0.1.0.dist-info/WHEEL +4 -0
- chipgraph-0.1.0.dist-info/entry_points.txt +61 -0
- chipgraph-0.1.0.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""What is next after a build of a named target (`chipgraph plan`, `chipgraph rtl`).
|
|
2
|
+
|
|
3
|
+
From the run summary and the graph: each gate the run waits on, with how to approve it
|
|
4
|
+
(and, for a pull request gate, the PR's URL from `pr/<block>.json`); the agent tasks
|
|
5
|
+
queued for the Claude Code session (`/chipgraph:run`); what failed; and, when nothing
|
|
6
|
+
waits, the pull request of the block if there is one.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from chipgraph.app.context import AppContext
|
|
16
|
+
from chipgraph.core.engine import gate as gate_mod
|
|
17
|
+
from chipgraph.core.engine.graph import BuildGraph
|
|
18
|
+
from chipgraph.core.engine.scheduler import RunSummary
|
|
19
|
+
from chipgraph.core.runtime import ACTIVE_STATUSES, OPEN_STATUSES, TaskQueue
|
|
20
|
+
|
|
21
|
+
RUN_COMMAND = "/chipgraph:run"
|
|
22
|
+
PR_RECORD = "pr/{block}.json"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _pr(app_ctx: AppContext, block: str | None) -> dict[str, Any] | None:
|
|
26
|
+
if block is None:
|
|
27
|
+
return None
|
|
28
|
+
path = app_ctx.root / PR_RECORD.format(block=block)
|
|
29
|
+
try:
|
|
30
|
+
data = json.loads(path.read_text(encoding="utf-8"))
|
|
31
|
+
except (OSError, ValueError):
|
|
32
|
+
return None
|
|
33
|
+
return data if isinstance(data, dict) else None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def next_steps(app_ctx: AppContext, graph: BuildGraph, summary: RunSummary) -> dict[str, Any]:
|
|
37
|
+
"""The next steps after `summary`: `lines` for a person, and the same as data."""
|
|
38
|
+
lines: list[str] = []
|
|
39
|
+
gates: list[dict[str, Any]] = []
|
|
40
|
+
for iid in summary.waiting_gate:
|
|
41
|
+
instance = graph.instances[iid]
|
|
42
|
+
rule = graph.rules[instance.rule_id]
|
|
43
|
+
gate_id = gate_mod.gate_id_for(rule.gate or "", instance.params)
|
|
44
|
+
block = instance.params.get("block")
|
|
45
|
+
item: dict[str, Any] = {"gate": gate_id, "instance": iid}
|
|
46
|
+
pr = _pr(app_ctx, block) if gate_id.startswith("pr:") else None
|
|
47
|
+
if pr is not None and pr.get("url"):
|
|
48
|
+
item["url"] = pr["url"]
|
|
49
|
+
lines.append(
|
|
50
|
+
f"gate {gate_id}: review and approve the pull request {pr['url']} "
|
|
51
|
+
f"(head {str(pr.get('head_sha', ''))[:12]}); then run this again"
|
|
52
|
+
)
|
|
53
|
+
else:
|
|
54
|
+
if gate_id.startswith("plan:") and block is not None:
|
|
55
|
+
lines.append(f"read the plan: chipgraph plan show {block}")
|
|
56
|
+
lines.append(f"gate {gate_id}: chipgraph approve {gate_id} --instance '{iid}'")
|
|
57
|
+
gates.append(item)
|
|
58
|
+
|
|
59
|
+
queue = TaskQueue(app_ctx.layout)
|
|
60
|
+
tasks: list[str] = []
|
|
61
|
+
failed: list[str] = []
|
|
62
|
+
for iid in summary.failed:
|
|
63
|
+
record = queue.get(iid)
|
|
64
|
+
if record is not None and (
|
|
65
|
+
record.status in OPEN_STATUSES or record.status in ACTIVE_STATUSES
|
|
66
|
+
):
|
|
67
|
+
tasks.append(iid)
|
|
68
|
+
else:
|
|
69
|
+
failed.append(iid)
|
|
70
|
+
if tasks:
|
|
71
|
+
lines.append(f"agent tasks waiting for {RUN_COMMAND} in Claude Code: {', '.join(tasks)}")
|
|
72
|
+
for iid in failed:
|
|
73
|
+
lines.append(f"failed: {iid} (see HANDOFF.md)")
|
|
74
|
+
if summary.blocked and not lines:
|
|
75
|
+
lines.append(f"blocked: {', '.join(summary.blocked)}")
|
|
76
|
+
|
|
77
|
+
pr_done: dict[str, Any] | None = None
|
|
78
|
+
if summary.ok:
|
|
79
|
+
blocks = {
|
|
80
|
+
graph.instances[i].params.get("block") for i in (*summary.done, *summary.skipped_fresh)
|
|
81
|
+
}
|
|
82
|
+
for block in sorted(b for b in blocks if b is not None):
|
|
83
|
+
pr_done = _pr(app_ctx, block) or pr_done
|
|
84
|
+
if pr_done is not None and pr_done.get("url"):
|
|
85
|
+
lines.append(f"done: the pull request {pr_done['url']} is approved; merging is yours")
|
|
86
|
+
elif pr_done is not None:
|
|
87
|
+
lines.append(
|
|
88
|
+
f"done: branch {pr_done.get('branch')} is approved ({pr_done.get('gate')}); "
|
|
89
|
+
"merging is yours"
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
lines.append("done: nothing waits")
|
|
93
|
+
return {"lines": lines, "gates": gates, "tasks": tasks, "failed": failed, "pr": pr_done}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def chain_rows(graph: BuildGraph, target: str, summary: RunSummary) -> list[tuple[str, str]]:
|
|
97
|
+
"""The instances of `target` in build order with where each stands after `summary`.
|
|
98
|
+
|
|
99
|
+
`done`, `fresh` (already up to date), `failed`, `waiting <gate>` or `blocked`; an
|
|
100
|
+
instance this run did not reach is `not run`.
|
|
101
|
+
"""
|
|
102
|
+
states: dict[str, str] = {}
|
|
103
|
+
for iid in summary.done:
|
|
104
|
+
states[iid] = "done"
|
|
105
|
+
for iid in summary.skipped_fresh:
|
|
106
|
+
states[iid] = "fresh"
|
|
107
|
+
for iid in summary.failed:
|
|
108
|
+
states[iid] = "failed"
|
|
109
|
+
for iid in summary.blocked:
|
|
110
|
+
states[iid] = "blocked"
|
|
111
|
+
for iid in summary.waiting_gate:
|
|
112
|
+
instance = graph.instances[iid]
|
|
113
|
+
gate = gate_mod.gate_id_for(graph.rules[instance.rule_id].gate or "", instance.params)
|
|
114
|
+
states[iid] = f"waiting {gate}"
|
|
115
|
+
selected = graph.select(target)
|
|
116
|
+
return [(iid, states.get(iid, "not run")) for iid in graph.topo_order() if iid in selected]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def write_chain(
|
|
120
|
+
handoff: Path, graph: BuildGraph, target: str, summary: RunSummary
|
|
121
|
+
) -> list[tuple[str, str]]:
|
|
122
|
+
"""Append the target's chain to a run's `HANDOFF.md` (when the file is there).
|
|
123
|
+
|
|
124
|
+
A failure to write it never fails the build. Returns the rows.
|
|
125
|
+
"""
|
|
126
|
+
rows = chain_rows(graph, target, summary)
|
|
127
|
+
lines = [f"## Chain of {target}", ""]
|
|
128
|
+
lines += [f"{i + 1}. `{iid}`: {state}" for i, (iid, state) in enumerate(rows)]
|
|
129
|
+
try:
|
|
130
|
+
text = handoff.read_text(encoding="utf-8")
|
|
131
|
+
handoff.write_text(text.rstrip("\n") + "\n\n" + "\n".join(lines) + "\n", encoding="utf-8")
|
|
132
|
+
except OSError:
|
|
133
|
+
pass
|
|
134
|
+
return rows
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
__all__ = ["RUN_COMMAND", "chain_rows", "next_steps", "write_chain"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Core: knows nothing about chips or tools."""
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Layered configuration: the project `Profile`, personal `UserConfig`, and their loader.
|
|
2
|
+
|
|
3
|
+
`chipgraph.core.config` knows nothing about chips or tools: no project, bus, PDK or tool
|
|
4
|
+
names appear here. See DESIGN.md 8.3, 8.4, 8.6 and 12.6.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from chipgraph.core.config.defaults import DEFAULT_PROFILE
|
|
8
|
+
from chipgraph.core.config.errors import ConfigError
|
|
9
|
+
from chipgraph.core.config.loader import (
|
|
10
|
+
ConfigIssue,
|
|
11
|
+
ResolvedProfile,
|
|
12
|
+
SourceFetcher,
|
|
13
|
+
SourceRef,
|
|
14
|
+
builtin_data_dir,
|
|
15
|
+
find_profile,
|
|
16
|
+
load,
|
|
17
|
+
resolve_data_ref,
|
|
18
|
+
)
|
|
19
|
+
from chipgraph.core.config.models import (
|
|
20
|
+
STYLE_KEYS,
|
|
21
|
+
AdapterCfg,
|
|
22
|
+
BlockOverride,
|
|
23
|
+
BlockSpecOverride,
|
|
24
|
+
DataCfg,
|
|
25
|
+
DecideCfg,
|
|
26
|
+
DecideOverride,
|
|
27
|
+
DecideSettings,
|
|
28
|
+
DecideTier,
|
|
29
|
+
DecisionsCfg,
|
|
30
|
+
EnvCfg,
|
|
31
|
+
FanoutCfg,
|
|
32
|
+
Level,
|
|
33
|
+
ModelsCfg,
|
|
34
|
+
NamingCfg,
|
|
35
|
+
PathRule,
|
|
36
|
+
PlanCfg,
|
|
37
|
+
PolicyCfg,
|
|
38
|
+
Profile,
|
|
39
|
+
RequirementsCfg,
|
|
40
|
+
SelectCfg,
|
|
41
|
+
SourceCfg,
|
|
42
|
+
SpecCfg,
|
|
43
|
+
StateCfg,
|
|
44
|
+
StyleCfg,
|
|
45
|
+
StyleKey,
|
|
46
|
+
TargetCfg,
|
|
47
|
+
TemplatesCfg,
|
|
48
|
+
UserConfig,
|
|
49
|
+
WrapperCfg,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
"DEFAULT_PROFILE",
|
|
54
|
+
"STYLE_KEYS",
|
|
55
|
+
"AdapterCfg",
|
|
56
|
+
"BlockOverride",
|
|
57
|
+
"BlockSpecOverride",
|
|
58
|
+
"ConfigError",
|
|
59
|
+
"ConfigIssue",
|
|
60
|
+
"DataCfg",
|
|
61
|
+
"DecideCfg",
|
|
62
|
+
"DecideOverride",
|
|
63
|
+
"DecideSettings",
|
|
64
|
+
"DecideTier",
|
|
65
|
+
"DecisionsCfg",
|
|
66
|
+
"EnvCfg",
|
|
67
|
+
"FanoutCfg",
|
|
68
|
+
"Level",
|
|
69
|
+
"ModelsCfg",
|
|
70
|
+
"NamingCfg",
|
|
71
|
+
"PathRule",
|
|
72
|
+
"PlanCfg",
|
|
73
|
+
"PolicyCfg",
|
|
74
|
+
"Profile",
|
|
75
|
+
"RequirementsCfg",
|
|
76
|
+
"ResolvedProfile",
|
|
77
|
+
"SelectCfg",
|
|
78
|
+
"SourceCfg",
|
|
79
|
+
"SourceFetcher",
|
|
80
|
+
"SourceRef",
|
|
81
|
+
"SpecCfg",
|
|
82
|
+
"StateCfg",
|
|
83
|
+
"StyleCfg",
|
|
84
|
+
"StyleKey",
|
|
85
|
+
"TargetCfg",
|
|
86
|
+
"TemplatesCfg",
|
|
87
|
+
"UserConfig",
|
|
88
|
+
"WrapperCfg",
|
|
89
|
+
"builtin_data_dir",
|
|
90
|
+
"find_profile",
|
|
91
|
+
"load",
|
|
92
|
+
"resolve_data_ref",
|
|
93
|
+
]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Tool defaults: the first configuration layer, before org, preset, project or path layers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
DEFAULT_PROFILE: dict[str, Any] = {
|
|
8
|
+
"runtime": "claude-code",
|
|
9
|
+
"data": {"default": "internal"},
|
|
10
|
+
"state": {"backend": "local"},
|
|
11
|
+
"decisions": {"store": "repo"},
|
|
12
|
+
"autonomy": {"spec": "L2", "rtl": "L3", "verify": "L3"},
|
|
13
|
+
}
|
|
14
|
+
"""Raw (pre-validation) defaults merged under every other layer. See DESIGN 8.3."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""`ConfigError`: raised for unreadable or invalid configuration, naming file/key/line."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ConfigError(Exception):
|
|
9
|
+
"""An error loading or validating configuration.
|
|
10
|
+
|
|
11
|
+
Always names the offending file; names the dotted key and, when known from a YAML
|
|
12
|
+
node mark, the line, so a person can find and fix the problem without guessing.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
message: str,
|
|
18
|
+
*,
|
|
19
|
+
file: str | Path | None = None,
|
|
20
|
+
key: str | None = None,
|
|
21
|
+
line: int | None = None,
|
|
22
|
+
) -> None:
|
|
23
|
+
self.file = str(file) if file is not None else None
|
|
24
|
+
self.key = key
|
|
25
|
+
self.line = line
|
|
26
|
+
parts: list[str] = []
|
|
27
|
+
if self.file is not None:
|
|
28
|
+
parts.append(f"{self.file}:{line}" if line is not None else self.file)
|
|
29
|
+
if key is not None:
|
|
30
|
+
parts.append(f"key '{key}'")
|
|
31
|
+
parts.append(message)
|
|
32
|
+
super().__init__(": ".join(parts))
|