|
24 | 24 | DoctorReport, |
25 | 25 | LocalToolchainReport, |
26 | 26 | ShellBridgeRecommendation, |
| 27 | + build_pipeline_skill_policy_context, |
27 | 28 | build_bash_login_shell_bridge_recommendation, |
28 | 29 | build_local_kimi_toolchain_report, |
29 | 30 | build_local_kimi_bootstrap_doctor_report, |
@@ -813,21 +814,29 @@ def _doctor_report_for_path(path: str | None = None) -> tuple[object, dict[str, |
813 | 814 | except typer.Exit: |
814 | 815 | return report, None, None |
815 | 816 | include_ok_local_checks = _include_ok_local_preflight_checks(selected_path, pipeline) |
| 817 | + pipeline_context = {"auto_preflight": _auto_smoke_preflight_metadata(selected_path, pipeline)} |
| 818 | + skill_policy_context = build_pipeline_skill_policy_context(pipeline) |
| 819 | + if skill_policy_context: |
| 820 | + pipeline_context.update(skill_policy_context) |
816 | 821 | return ( |
817 | 822 | _augment_preflight_report( |
818 | 823 | report, |
819 | 824 | pipeline, |
820 | 825 | include_ok_local_checks=include_ok_local_checks, |
821 | 826 | ), |
822 | | - {"auto_preflight": _auto_smoke_preflight_metadata(selected_path, pipeline)}, |
| 827 | + pipeline_context, |
823 | 828 | pipeline, |
824 | 829 | ) |
825 | 830 | pipeline = _load_pipeline(path) |
826 | 831 | report = _preflight_base_report(path, pipeline) |
827 | 832 | include_ok_local_checks = _include_ok_local_preflight_checks(path, pipeline) |
| 833 | + pipeline_context = {"auto_preflight": _auto_smoke_preflight_metadata(path, pipeline)} |
| 834 | + skill_policy_context = build_pipeline_skill_policy_context(pipeline) |
| 835 | + if skill_policy_context: |
| 836 | + pipeline_context.update(skill_policy_context) |
828 | 837 | return ( |
829 | 838 | _augment_preflight_report(report, pipeline, include_ok_local_checks=include_ok_local_checks), |
830 | | - {"auto_preflight": _auto_smoke_preflight_metadata(path, pipeline)}, |
| 839 | + pipeline_context, |
831 | 840 | pipeline, |
832 | 841 | ) |
833 | 842 |
|
@@ -1574,6 +1583,9 @@ def _load_pipeline_with_optional_smoke_preflight( |
1574 | 1583 | preflight_context = { |
1575 | 1584 | "auto_preflight": _auto_smoke_preflight_metadata(path or selected_path, preflight_pipeline) |
1576 | 1585 | } |
| 1586 | + skill_policy_context = build_pipeline_skill_policy_context(preflight_pipeline) |
| 1587 | + if skill_policy_context: |
| 1588 | + preflight_context.update(skill_policy_context) |
1577 | 1589 | if report.status == "failed": |
1578 | 1590 | _echo_doctor_report( |
1579 | 1591 | report, |
@@ -1623,6 +1635,38 @@ def _render_shell_bridge_summary(shell_bridge: object | None) -> str: |
1623 | 1635 | ) |
1624 | 1636 |
|
1625 | 1637 |
|
| 1638 | +def _render_skill_policy_summary_lines(pipeline: dict[str, object] | None) -> list[str]: |
| 1639 | + if not isinstance(pipeline, dict): |
| 1640 | + return [] |
| 1641 | + |
| 1642 | + skill_policy = pipeline.get("skill_policy") |
| 1643 | + if not isinstance(skill_policy, dict): |
| 1644 | + return [] |
| 1645 | + |
| 1646 | + lines: list[str] = [] |
| 1647 | + owned_roots = [str(root) for root in skill_policy.get("owned_roots", []) if isinstance(root, str) and root] |
| 1648 | + if owned_roots: |
| 1649 | + lines.append(f"Pipeline skill roots: AgentFlow-owned `.agents/skills/` -> {', '.join(owned_roots)}") |
| 1650 | + |
| 1651 | + target_roots = [str(root) for root in skill_policy.get("target_roots", []) if isinstance(root, str) and root] |
| 1652 | + target_suffix = f" -> {', '.join(target_roots)}" if target_roots else "" |
| 1653 | + if skill_policy.get("default_target_repo_skill_trust") is False: |
| 1654 | + lines.append(f"Pipeline target repo skills: ignored by default{target_suffix}") |
| 1655 | + |
| 1656 | + trusted_nodes = [str(node_id) for node_id in skill_policy.get("trusted_nodes", []) if isinstance(node_id, str) and node_id] |
| 1657 | + if trusted_nodes: |
| 1658 | + lines.append(f"Pipeline target repo skill trust: enabled for {', '.join(trusted_nodes)}") |
| 1659 | + |
| 1660 | + boundary = skill_policy.get("repo_instructions_boundary") |
| 1661 | + if isinstance(boundary, str) and boundary.strip(): |
| 1662 | + lines.append( |
| 1663 | + "Pipeline repo instructions: separate from skill trust; use `repo_instructions_mode` for `AGENTS.md`, " |
| 1664 | + "`CLAUDE.md`, and related instruction files." |
| 1665 | + ) |
| 1666 | + |
| 1667 | + return lines |
| 1668 | + |
| 1669 | + |
1626 | 1670 | def _doctor_check_summary_suffix(check: object) -> str: |
1627 | 1671 | if getattr(check, "name", None) != "bash_login_startup": |
1628 | 1672 | return "" |
@@ -1672,6 +1716,7 @@ def _render_doctor_summary( |
1672 | 1716 | rendered_matches = [match for match in matches if isinstance(match, str) and match] |
1673 | 1717 | if rendered_matches: |
1674 | 1718 | lines.append(f"{auto_preflight_label} matches: {', '.join(rendered_matches)}") |
| 1719 | + lines.extend(_render_skill_policy_summary_lines(pipeline)) |
1675 | 1720 | if include_shell_bridge: |
1676 | 1721 | lines.append(_render_shell_bridge_summary(shell_bridge)) |
1677 | 1722 | return "\n".join(lines) |
|
0 commit comments