dknowc-dsh 1.0.3 → 1.1.0
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.
- package/README.md +9 -4
- package/package.json +2 -2
- package/skills/dknowc-official-doc-writer/SKILL.md +17 -8
- package/skills/dknowc-official-doc-writer/reference/sample_search_result.md +48 -0
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +75 -0
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +72 -8
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +1 -1
- package/skills/dknowc-ppt-assistant/README.md +54 -0
- package/skills/dknowc-ppt-assistant/SKILL.md +151 -0
- package/skills/dknowc-ppt-assistant/THIRD_PARTY_NOTICES.md +36 -0
- package/skills/dknowc-ppt-assistant/official-docs/output/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/official-docs/search-results/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/projects/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/references/content-pack.md +55 -0
- package/skills/dknowc-ppt-assistant/references/material_usage.md +51 -0
- package/skills/dknowc-ppt-assistant/references/sample_effect.html +89 -0
- package/skills/dknowc-ppt-assistant/references/sample_search_result.md +48 -0
- package/skills/dknowc-ppt-assistant/references/search_intro.md +79 -0
- package/skills/dknowc-ppt-assistant/references/style-presets.md +126 -0
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +81 -0
- package/skills/dknowc-ppt-assistant/references/upstream-docs/svg-pipeline.md +842 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/01_cover.svg +28 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/02_quote.svg +38 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/03_origin.svg +96 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/README.md +15 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/design_spec.md +408 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/spec_lock.md +78 -0
- package/skills/dknowc-ppt-assistant/scripts/adapt_mcp_result.py +279 -0
- package/skills/dknowc-ppt-assistant/scripts/check_release.py +106 -0
- package/skills/dknowc-ppt-assistant/scripts/compact_svg_coordinates.py +345 -0
- package/skills/dknowc-ppt-assistant/scripts/config.py +707 -0
- package/skills/dknowc-ppt-assistant/scripts/console_encoding.py +33 -0
- package/skills/dknowc-ppt-assistant/scripts/error_helper.py +434 -0
- package/skills/dknowc-ppt-assistant/scripts/finalize_svg.py +507 -0
- package/skills/dknowc-ppt-assistant/scripts/hyperlink_contract.py +399 -0
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +182 -0
- package/skills/dknowc-ppt-assistant/scripts/language_tags.py +283 -0
- package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +158 -0
- package/skills/dknowc-ppt-assistant/scripts/native_payloads.py +655 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_animation_presets.json +3440 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_animations.py +3965 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_effects.py +143 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_opc_validation.py +346 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/__init__.py +130 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-APACHE-2.0.txt +202 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-OPEN-XML-SDK-MIT.txt +23 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/NOTICE.md +54 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeDefinitions.xml +19898 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeSemantics.json +1217 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/shape_type_values.txt +187 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/errors.py +39 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/formula.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/loader.py +364 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/models.py +201 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/registry.py +270 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantic_hash.py +456 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantics.py +543 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/xml_safety.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/__init__.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/animation_import.py +287 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chart_to_svg.py +2377 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chartex_to_svg.py +422 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/color_resolver.py +894 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/converter.py +1143 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/custgeom_to_svg.py +165 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/effect_to_svg.py +410 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/emu_units.py +258 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/fill_to_svg.py +816 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/formula_import.py +611 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/hyperlinks.py +93 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/import_diagnostics.py +37 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ln_to_svg.py +362 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/normalized_chart_svg.py +1217 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ooxml_loader.py +506 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/pic_to_svg.py +653 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_authoring.py +894 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_registry_to_svg.py +216 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_svg_markup.py +198 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/prstgeom_to_svg.py +162 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/shape_walker.py +556 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/slide_to_svg.py +2002 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/tbl_to_svg.py +1841 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/transition_import.py +201 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/txbody_to_svg.py +1433 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_transitions.py +3153 -0
- package/skills/dknowc-ppt-assistant/scripts/preset_shape_svg.py +450 -0
- package/skills/dknowc-ppt-assistant/scripts/project_utils.py +645 -0
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +183 -0
- package/skills/dknowc-ppt-assistant/scripts/register_template.py +1327 -0
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +1048 -0
- package/skills/dknowc-ppt-assistant/scripts/resource_paths.py +282 -0
- package/skills/dknowc-ppt-assistant/scripts/shape_boolean_svg.py +189 -0
- package/skills/dknowc-ppt-assistant/scripts/slide_roster.py +44 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/__init__.py +12 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/align_embed_images.py +672 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/crop_images.py +370 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_icons.py +564 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_images.py +288 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/fix_image_aspect.py +389 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/flatten_tspan.py +948 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/svg_rect_to_path.py +346 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/__init__.py +15 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/checker.py +7791 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/cli.py +193 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/svg_contracts.py +1121 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/xml_support.py +35 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality_checker.py +59 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/__init__.py +37 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/animation_config.py +1622 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/canvas_contract.py +226 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/__init__.py +1 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/context.py +291 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/converter.py +1980 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/elements.py +5272 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/hyperlinks.py +162 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/paths.py +847 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/styles.py +752 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/text_properties.py +796 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_colors.py +283 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_fonts.py +330 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/utils.py +3555 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/geometry_properties.py +140 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/__init__.py +356 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_data.py +1449 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_style.py +886 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_xml.py +1495 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chartex.py +272 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/fallback_hash.py +161 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula.py +243 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_ast.py +592 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_compiler.py +96 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_omml.py +1049 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_parser.py +2181 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_profile.py +739 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_run_properties.py +234 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/inline_formula.py +311 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_attributes.py +182 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_common.py +806 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_status.py +190 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/table.py +1113 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/workbook.py +216 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/__init__.py +1 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/builder.py +6273 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/cli.py +2059 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/dimensions.py +189 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/discovery.py +120 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/media.py +160 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/narration.py +696 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/notes.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/slide_xml.py +138 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_structure.py +3457 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_validation.py +1536 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/semantic_markers.py +240 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/shape_boolean.py +1355 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/text_outline.py +1121 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/tspan_flattener.py +64 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/use_expander.py +577 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/update_spec.py +404 -0
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +142 -0
- package/skills/dknowc-ppt-assistant/workflows/routing.md +38 -0
- package/skills/dknowc-trusted-consulting/SKILL.md +21 -5
- package/skills/dknowc-trusted-consulting/reference/consult_intro.md +79 -0
- package/skills/dknowc-trusted-consulting/reference/sample_consult_answer.md +31 -0
- package/skills/dknowc-trusted-consulting/reference/sample_trace_report.html +76 -0
- package/skills/dknowc-trusted-consulting/scripts/register_key.mjs +1 -0
- package/skills/dknowc-trusted-search/SKILL.md +30 -2
- package/skills/dknowc-trusted-search/reference/sample_search_result.md +33 -0
- package/skills/dknowc-trusted-search/reference/sample_trace_report.html +450 -0
- package/skills/dknowc-trusted-search/reference/search_intro.md +79 -0
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +1 -0
- package/src/index.js +7 -2
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
PPT Master - Hyperlink Contract
|
|
4
|
+
|
|
5
|
+
Parse and validate the shared SVG hyperlink surface used by quality checks,
|
|
6
|
+
SVG-to-PPTX export, and PPTX-to-SVG round-trip conversion.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
from hyperlink_contract import parse_hyperlink_target
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
parse_hyperlink_target("https://example.com")
|
|
13
|
+
parse_hyperlink_target("#slide-3", slide_count=8)
|
|
14
|
+
|
|
15
|
+
Dependencies:
|
|
16
|
+
None (standard library only).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import re
|
|
22
|
+
from dataclasses import dataclass
|
|
23
|
+
from xml.etree import ElementTree as ET
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
SVG_NS = "http://www.w3.org/2000/svg"
|
|
27
|
+
XLINK_NS = "http://www.w3.org/1999/xlink"
|
|
28
|
+
HYPERLINK_REL_TYPE = (
|
|
29
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"
|
|
30
|
+
"hyperlink"
|
|
31
|
+
)
|
|
32
|
+
SLIDE_REL_TYPE = (
|
|
33
|
+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
|
|
34
|
+
)
|
|
35
|
+
SLIDE_JUMP_ACTION = "ppaction://hlinksldjump"
|
|
36
|
+
SHAPE_HYPERLINK_ATTR = "data-pptx-shape-hyperlink"
|
|
37
|
+
|
|
38
|
+
_SLIDE_TARGET_RE = re.compile(r"#slide-([1-9][0-9]*)")
|
|
39
|
+
_URI_SCHEME_RE = re.compile(r"([A-Za-z][A-Za-z0-9+.-]*):")
|
|
40
|
+
_FORBIDDEN_EXTERNAL_SCHEMES = frozenset({
|
|
41
|
+
"data",
|
|
42
|
+
"file",
|
|
43
|
+
"javascript",
|
|
44
|
+
"vbscript",
|
|
45
|
+
})
|
|
46
|
+
_NON_OUTPUT_ANCESTORS = frozenset({
|
|
47
|
+
"defs",
|
|
48
|
+
"desc",
|
|
49
|
+
"metadata",
|
|
50
|
+
"style",
|
|
51
|
+
"symbol",
|
|
52
|
+
"title",
|
|
53
|
+
})
|
|
54
|
+
_INLINE_CONTAINER_TAGS = frozenset({"text", "tspan"})
|
|
55
|
+
_INLINE_CONTENT_TAGS = frozenset({"tspan"})
|
|
56
|
+
_UNSUPPORTED_LINK_BEHAVIOR_ATTRIBUTES = frozenset({
|
|
57
|
+
"download",
|
|
58
|
+
"hreflang",
|
|
59
|
+
"ping",
|
|
60
|
+
"referrerpolicy",
|
|
61
|
+
"rel",
|
|
62
|
+
"target",
|
|
63
|
+
"type",
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class HyperlinkContractError(ValueError):
|
|
68
|
+
"""Raised when one hyperlink cannot be represented faithfully in PPTX."""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(frozen=True)
|
|
72
|
+
class HyperlinkTarget:
|
|
73
|
+
"""One normalized hyperlink destination."""
|
|
74
|
+
|
|
75
|
+
raw: str
|
|
76
|
+
kind: str
|
|
77
|
+
slide_number: int | None = None
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _local_name(elem: ET.Element) -> str:
|
|
81
|
+
if not isinstance(elem.tag, str):
|
|
82
|
+
return str(elem.tag)
|
|
83
|
+
return elem.tag.rsplit("}", 1)[-1]
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def parse_hyperlink_target(
|
|
87
|
+
raw: str,
|
|
88
|
+
*,
|
|
89
|
+
slide_count: int | None = None,
|
|
90
|
+
) -> HyperlinkTarget:
|
|
91
|
+
"""Parse one canonical SVG hyperlink target.
|
|
92
|
+
|
|
93
|
+
Same-deck jumps use ``#slide-N``. External destinations must be absolute
|
|
94
|
+
URIs with an explicit scheme. Local files, script/data URLs, relative
|
|
95
|
+
paths, arbitrary SVG fragments, whitespace, and control characters fail
|
|
96
|
+
closed instead of being silently dropped during export.
|
|
97
|
+
"""
|
|
98
|
+
if not isinstance(raw, str):
|
|
99
|
+
raise HyperlinkContractError("hyperlink target must be a string")
|
|
100
|
+
if not raw:
|
|
101
|
+
raise HyperlinkContractError("hyperlink target must not be empty")
|
|
102
|
+
if raw != raw.strip():
|
|
103
|
+
raise HyperlinkContractError(
|
|
104
|
+
"hyperlink target must not contain leading or trailing whitespace"
|
|
105
|
+
)
|
|
106
|
+
if any(ord(char) < 0x21 or ord(char) == 0x7F for char in raw):
|
|
107
|
+
raise HyperlinkContractError(
|
|
108
|
+
"hyperlink target must not contain whitespace or control characters; "
|
|
109
|
+
"percent-encode URI spaces"
|
|
110
|
+
)
|
|
111
|
+
if "\\" in raw:
|
|
112
|
+
raise HyperlinkContractError(
|
|
113
|
+
"hyperlink target must use URI syntax, not a filesystem path"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
slide_match = _SLIDE_TARGET_RE.fullmatch(raw)
|
|
117
|
+
if slide_match is not None:
|
|
118
|
+
slide_number = int(slide_match.group(1))
|
|
119
|
+
if slide_count is not None and slide_number > slide_count:
|
|
120
|
+
raise HyperlinkContractError(
|
|
121
|
+
f"slide jump {raw!r} exceeds the {slide_count}-slide deck"
|
|
122
|
+
)
|
|
123
|
+
return HyperlinkTarget(
|
|
124
|
+
raw=f"#slide-{slide_number}",
|
|
125
|
+
kind="slide",
|
|
126
|
+
slide_number=slide_number,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
if raw.startswith("#"):
|
|
130
|
+
raise HyperlinkContractError(
|
|
131
|
+
"same-deck hyperlinks must use the exact #slide-N form"
|
|
132
|
+
)
|
|
133
|
+
scheme_match = _URI_SCHEME_RE.match(raw)
|
|
134
|
+
if scheme_match is None:
|
|
135
|
+
raise HyperlinkContractError(
|
|
136
|
+
"external hyperlinks must be absolute URIs with an explicit scheme"
|
|
137
|
+
)
|
|
138
|
+
scheme = scheme_match.group(1).lower()
|
|
139
|
+
if scheme in _FORBIDDEN_EXTERNAL_SCHEMES:
|
|
140
|
+
raise HyperlinkContractError(
|
|
141
|
+
f"external hyperlink scheme {scheme!r} is not allowed"
|
|
142
|
+
)
|
|
143
|
+
return HyperlinkTarget(raw=raw, kind="external")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def svg_hyperlink_href(elem: ET.Element) -> str:
|
|
147
|
+
"""Return the sole href value from one SVG ``<a>`` element."""
|
|
148
|
+
if _local_name(elem) != "a" or elem.tag != f"{{{SVG_NS}}}a":
|
|
149
|
+
raise HyperlinkContractError("hyperlink carrier must be an SVG <a>")
|
|
150
|
+
href = elem.get("href")
|
|
151
|
+
xlink_href = elem.get(f"{{{XLINK_NS}}}href")
|
|
152
|
+
if href is not None and xlink_href is not None:
|
|
153
|
+
raise HyperlinkContractError(
|
|
154
|
+
"SVG <a> must not declare both href and xlink:href"
|
|
155
|
+
)
|
|
156
|
+
value = href if href is not None else xlink_href
|
|
157
|
+
if value is None:
|
|
158
|
+
raise HyperlinkContractError("SVG <a> must declare href")
|
|
159
|
+
return value
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def project_hyperlink_errors(
|
|
163
|
+
root: ET.Element,
|
|
164
|
+
*,
|
|
165
|
+
slide_count: int | None = None,
|
|
166
|
+
) -> list[str]:
|
|
167
|
+
"""Return fail-closed diagnostics for every SVG hyperlink carrier."""
|
|
168
|
+
errors: list[str] = []
|
|
169
|
+
parent_by_id = {
|
|
170
|
+
id(child): parent
|
|
171
|
+
for parent in root.iter()
|
|
172
|
+
for child in list(parent)
|
|
173
|
+
}
|
|
174
|
+
anchors = [
|
|
175
|
+
elem for elem in root.iter()
|
|
176
|
+
if _local_name(elem) == "a"
|
|
177
|
+
]
|
|
178
|
+
for index, anchor in enumerate(anchors, 1):
|
|
179
|
+
label = anchor.get("id") or f"anchor {index}"
|
|
180
|
+
if anchor.tag != f"{{{SVG_NS}}}a":
|
|
181
|
+
errors.append(f"{label}: hyperlink carrier must be an SVG <a>")
|
|
182
|
+
continue
|
|
183
|
+
try:
|
|
184
|
+
href = svg_hyperlink_href(anchor)
|
|
185
|
+
parse_hyperlink_target(href, slide_count=slide_count)
|
|
186
|
+
except HyperlinkContractError as exc:
|
|
187
|
+
errors.append(f"{label}: {exc}")
|
|
188
|
+
|
|
189
|
+
unsupported_attrs = sorted(
|
|
190
|
+
name
|
|
191
|
+
for name in anchor.attrib
|
|
192
|
+
if name.rsplit("}", 1)[-1].lower()
|
|
193
|
+
in _UNSUPPORTED_LINK_BEHAVIOR_ATTRIBUTES
|
|
194
|
+
)
|
|
195
|
+
if unsupported_attrs:
|
|
196
|
+
errors.append(
|
|
197
|
+
f"{label}: unsupported link behavior attribute(s): "
|
|
198
|
+
+ ", ".join(unsupported_attrs)
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
ancestors: list[ET.Element] = []
|
|
202
|
+
current = parent_by_id.get(id(anchor))
|
|
203
|
+
while current is not None:
|
|
204
|
+
ancestors.append(current)
|
|
205
|
+
current = parent_by_id.get(id(current))
|
|
206
|
+
ancestor_tags = [_local_name(elem) for elem in ancestors]
|
|
207
|
+
if "a" in ancestor_tags:
|
|
208
|
+
errors.append(f"{label}: nested SVG <a> elements are not supported")
|
|
209
|
+
hidden_ancestor = next(
|
|
210
|
+
(tag for tag in ancestor_tags if tag in _NON_OUTPUT_ANCESTORS),
|
|
211
|
+
None,
|
|
212
|
+
)
|
|
213
|
+
if hidden_ancestor is not None:
|
|
214
|
+
errors.append(
|
|
215
|
+
f"{label}: hyperlink cannot appear inside non-output "
|
|
216
|
+
f"<{hidden_ancestor}> content"
|
|
217
|
+
)
|
|
218
|
+
replacement_ancestor = next(
|
|
219
|
+
(
|
|
220
|
+
elem
|
|
221
|
+
for elem in ancestors
|
|
222
|
+
if elem.get("data-pptx-replace-with") is not None
|
|
223
|
+
or elem.get("data-pptx-part") == "geometry-detail"
|
|
224
|
+
),
|
|
225
|
+
None,
|
|
226
|
+
)
|
|
227
|
+
if replacement_ancestor is not None:
|
|
228
|
+
errors.append(
|
|
229
|
+
f"{label}: hyperlink cannot appear inside content replaced "
|
|
230
|
+
"or skipped during native export"
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
inline = any(tag in _INLINE_CONTAINER_TAGS for tag in ancestor_tags)
|
|
234
|
+
children = [
|
|
235
|
+
child for child in list(anchor)
|
|
236
|
+
if _local_name(child) not in _NON_OUTPUT_ANCESTORS
|
|
237
|
+
]
|
|
238
|
+
if inline:
|
|
239
|
+
if any(_local_name(child) not in _INLINE_CONTENT_TAGS for child in children):
|
|
240
|
+
errors.append(
|
|
241
|
+
f"{label}: inline hyperlink content may contain only <tspan>"
|
|
242
|
+
)
|
|
243
|
+
positioned = [
|
|
244
|
+
elem
|
|
245
|
+
for elem in anchor.iter()
|
|
246
|
+
if any(elem.get(name) is not None for name in ("x", "y", "dx", "dy"))
|
|
247
|
+
]
|
|
248
|
+
if positioned:
|
|
249
|
+
errors.append(
|
|
250
|
+
f"{label}: inline hyperlink cannot own x/y/dx/dy; "
|
|
251
|
+
"put line positioning on an enclosing <tspan>"
|
|
252
|
+
)
|
|
253
|
+
direct_parent = parent_by_id.get(id(anchor))
|
|
254
|
+
if (
|
|
255
|
+
direct_parent is not None
|
|
256
|
+
and _local_name(direct_parent) == "text"
|
|
257
|
+
and (
|
|
258
|
+
direct_parent.get("data-paragraph-line-height") is not None
|
|
259
|
+
or any(
|
|
260
|
+
_local_name(sibling) == "tspan"
|
|
261
|
+
and any(
|
|
262
|
+
sibling.get(name) is not None
|
|
263
|
+
for name in ("x", "y", "dx", "dy")
|
|
264
|
+
)
|
|
265
|
+
for sibling in list(direct_parent)
|
|
266
|
+
)
|
|
267
|
+
)
|
|
268
|
+
):
|
|
269
|
+
errors.append(
|
|
270
|
+
f"{label}: multi-line hyperlinks must be nested inside "
|
|
271
|
+
"the owning line <tspan>"
|
|
272
|
+
)
|
|
273
|
+
visible_text = "".join(anchor.itertext())
|
|
274
|
+
if not visible_text.strip():
|
|
275
|
+
errors.append(f"{label}: inline hyperlink must contain visible text")
|
|
276
|
+
else:
|
|
277
|
+
if anchor.text and anchor.text.strip():
|
|
278
|
+
errors.append(
|
|
279
|
+
f"{label}: shape hyperlink cannot contain direct text; "
|
|
280
|
+
"wrap text in <text>"
|
|
281
|
+
)
|
|
282
|
+
visible_children = [
|
|
283
|
+
child for child in children
|
|
284
|
+
if child.get("data-pptx-part") != "geometry-detail"
|
|
285
|
+
]
|
|
286
|
+
if not visible_children:
|
|
287
|
+
errors.append(
|
|
288
|
+
f"{label}: shape hyperlink must wrap at least one visual element"
|
|
289
|
+
)
|
|
290
|
+
if any(_local_name(child) == "tspan" for child in children):
|
|
291
|
+
errors.append(
|
|
292
|
+
f"{label}: shape hyperlink cannot contain a bare <tspan>; "
|
|
293
|
+
"wrap inline runs in <text>"
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
for index, carrier in enumerate(
|
|
297
|
+
(
|
|
298
|
+
elem
|
|
299
|
+
for elem in root.iter()
|
|
300
|
+
if elem.get(SHAPE_HYPERLINK_ATTR) is not None
|
|
301
|
+
),
|
|
302
|
+
1,
|
|
303
|
+
):
|
|
304
|
+
label = carrier.get("id") or f"shape hyperlink transport {index}"
|
|
305
|
+
raw_target = carrier.get(SHAPE_HYPERLINK_ATTR) or ""
|
|
306
|
+
try:
|
|
307
|
+
parse_hyperlink_target(raw_target, slide_count=slide_count)
|
|
308
|
+
except HyperlinkContractError as exc:
|
|
309
|
+
errors.append(f"{label}: {exc}")
|
|
310
|
+
if _local_name(carrier) != "g":
|
|
311
|
+
errors.append(
|
|
312
|
+
f"{label}: {SHAPE_HYPERLINK_ATTR} is allowed only on <g>"
|
|
313
|
+
)
|
|
314
|
+
ancestors: list[ET.Element] = []
|
|
315
|
+
current = parent_by_id.get(id(carrier))
|
|
316
|
+
while current is not None:
|
|
317
|
+
ancestors.append(current)
|
|
318
|
+
current = parent_by_id.get(id(current))
|
|
319
|
+
if any(_local_name(elem) == "a" for elem in ancestors):
|
|
320
|
+
errors.append(
|
|
321
|
+
f"{label}: {SHAPE_HYPERLINK_ATTR} cannot be nested in <a>"
|
|
322
|
+
)
|
|
323
|
+
inline_anchors = [
|
|
324
|
+
elem
|
|
325
|
+
for elem in carrier.iter(f"{{{SVG_NS}}}a")
|
|
326
|
+
if any(
|
|
327
|
+
_local_name(ancestor) in _INLINE_CONTAINER_TAGS
|
|
328
|
+
for ancestor in _ancestors_of(elem, parent_by_id)
|
|
329
|
+
)
|
|
330
|
+
]
|
|
331
|
+
if not inline_anchors:
|
|
332
|
+
errors.append(
|
|
333
|
+
f"{label}: {SHAPE_HYPERLINK_ATTR} is reserved for PPTX "
|
|
334
|
+
"round-trip groups that also contain inline hyperlinks"
|
|
335
|
+
)
|
|
336
|
+
return errors
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def _ancestors_of(
|
|
340
|
+
elem: ET.Element,
|
|
341
|
+
parent_by_id: dict[int, ET.Element],
|
|
342
|
+
) -> list[ET.Element]:
|
|
343
|
+
"""Return ancestors from nearest parent to the SVG root."""
|
|
344
|
+
ancestors: list[ET.Element] = []
|
|
345
|
+
current = parent_by_id.get(id(elem))
|
|
346
|
+
while current is not None:
|
|
347
|
+
ancestors.append(current)
|
|
348
|
+
current = parent_by_id.get(id(current))
|
|
349
|
+
return ancestors
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def trigger_shape_hyperlink_errors(
|
|
353
|
+
root: ET.Element,
|
|
354
|
+
trigger_group_ids: set[str] | frozenset[str],
|
|
355
|
+
) -> list[str]:
|
|
356
|
+
"""Reject navigation links on click-trigger animation groups."""
|
|
357
|
+
if not trigger_group_ids:
|
|
358
|
+
return []
|
|
359
|
+
parent_by_id = {
|
|
360
|
+
id(child): parent
|
|
361
|
+
for parent in root.iter()
|
|
362
|
+
for child in list(parent)
|
|
363
|
+
}
|
|
364
|
+
errors: list[str] = []
|
|
365
|
+
for elem in root.iter():
|
|
366
|
+
group_id = elem.get("id")
|
|
367
|
+
if _local_name(elem) != "g" or group_id not in trigger_group_ids:
|
|
368
|
+
continue
|
|
369
|
+
has_link = elem.get(SHAPE_HYPERLINK_ATTR) is not None or any(
|
|
370
|
+
_local_name(descendant) == "a"
|
|
371
|
+
or descendant.get(SHAPE_HYPERLINK_ATTR) is not None
|
|
372
|
+
for descendant in elem.iter()
|
|
373
|
+
)
|
|
374
|
+
if not has_link:
|
|
375
|
+
has_link = any(
|
|
376
|
+
_local_name(ancestor) == "a"
|
|
377
|
+
or ancestor.get(SHAPE_HYPERLINK_ATTR) is not None
|
|
378
|
+
for ancestor in _ancestors_of(elem, parent_by_id)
|
|
379
|
+
)
|
|
380
|
+
if has_link:
|
|
381
|
+
errors.append(
|
|
382
|
+
f"animation trigger group {group_id!r} cannot also carry a "
|
|
383
|
+
"hyperlink; use an ordinary animation or a separate trigger"
|
|
384
|
+
)
|
|
385
|
+
return errors
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
__all__ = [
|
|
389
|
+
"HYPERLINK_REL_TYPE",
|
|
390
|
+
"HyperlinkContractError",
|
|
391
|
+
"HyperlinkTarget",
|
|
392
|
+
"SHAPE_HYPERLINK_ATTR",
|
|
393
|
+
"SLIDE_JUMP_ACTION",
|
|
394
|
+
"SLIDE_REL_TYPE",
|
|
395
|
+
"parse_hyperlink_target",
|
|
396
|
+
"project_hyperlink_errors",
|
|
397
|
+
"svg_hyperlink_href",
|
|
398
|
+
"trigger_shape_hyperlink_errors",
|
|
399
|
+
]
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""深知可信PPT初始化与环境检查。
|
|
3
|
+
|
|
4
|
+
Public 版统一只从环境变量 DKNOWC_API_KEY 读取 API Key。
|
|
5
|
+
|
|
6
|
+
职责划分:
|
|
7
|
+
- 本脚本只报告环境状态,不自行决定是否阻断任务。
|
|
8
|
+
- `ready` 只表示基础运行环境(python3、requests)就绪。
|
|
9
|
+
- `search_ready` 表示可调用深知可信检索(API Key 已配置且 requests 可用)。
|
|
10
|
+
- `pptx_ready` 表示可直接执行 SVG→PPTX 编译导出(python-pptx + XlsxWriter 可用)。
|
|
11
|
+
依赖缺失时可用 `uv run --with python-pptx --with XlsxWriter python3 ...` 隔离提供,
|
|
12
|
+
此时素材检索与 SVG 创作不受影响。
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import argparse
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import platform
|
|
19
|
+
import shutil
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
SKILL_ROOT = Path(__file__).resolve().parent.parent
|
|
25
|
+
API_KEY_ENV = "DKNOWC_API_KEY"
|
|
26
|
+
ENV_STATE_PATH = SKILL_ROOT / "config" / "environment_state.json"
|
|
27
|
+
|
|
28
|
+
PLACEHOLDER_KEYS = {
|
|
29
|
+
"",
|
|
30
|
+
"your_api_key_here",
|
|
31
|
+
"你的深知可信搜索 API Key",
|
|
32
|
+
"你的深知搜索 API Key",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _module_available(module_name):
|
|
37
|
+
try:
|
|
38
|
+
__import__(module_name)
|
|
39
|
+
return True
|
|
40
|
+
except ImportError:
|
|
41
|
+
return False
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _looks_like_key(value: str) -> bool:
|
|
45
|
+
value = (value or "").strip()
|
|
46
|
+
return value not in PLACEHOLDER_KEYS
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _in_dsh() -> bool:
|
|
50
|
+
"""dsh 环境标志:dsh 的 bash 工具会注入 DSH_SHELL=1。
|
|
51
|
+
|
|
52
|
+
dsh 场景下,脚本子进程无法隐式继承 DKNOWC_API_KEY(dsh 安全机制会清理
|
|
53
|
+
名字含 KEY 的环境变量),但 dsh 插件会通过 shell-env 显式通道把该 Key
|
|
54
|
+
注入为 DSH_DKNOWC_API_KEY。检索子能力走 MCP 转接,无 Key 时仅暂停
|
|
55
|
+
检索,不阻断纯生成任务。
|
|
56
|
+
"""
|
|
57
|
+
return os.environ.get("DSH_SHELL") == "1"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def check_api_key_config():
|
|
61
|
+
if _in_dsh():
|
|
62
|
+
api_key = os.environ.get("DSH_DKNOWC_API_KEY", "").strip()
|
|
63
|
+
if _looks_like_key(api_key):
|
|
64
|
+
return {
|
|
65
|
+
"api_key_configured": True,
|
|
66
|
+
"api_key_env": API_KEY_ENV,
|
|
67
|
+
"api_key_source": "environment",
|
|
68
|
+
"api_key_hint": None,
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
"api_key_configured": False,
|
|
72
|
+
"api_key_env": API_KEY_ENV,
|
|
73
|
+
"api_key_source": None,
|
|
74
|
+
"api_key_hint": f"未检测到可用的 {API_KEY_ENV}(dsh 主进程环境变量未配置或为空)。仅检索任务受影响,不涉及检索的生成任务可继续。",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
api_key = os.environ.get(API_KEY_ENV, "").strip()
|
|
78
|
+
if _looks_like_key(api_key):
|
|
79
|
+
return {
|
|
80
|
+
"api_key_configured": True,
|
|
81
|
+
"api_key_env": API_KEY_ENV,
|
|
82
|
+
"api_key_source": "environment",
|
|
83
|
+
"api_key_hint": None,
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
"api_key_configured": False,
|
|
87
|
+
"api_key_env": API_KEY_ENV,
|
|
88
|
+
"api_key_source": None,
|
|
89
|
+
"api_key_hint": f"本 Skill 的素材检索需要通过环境变量 {API_KEY_ENV} 连接深知可信智能服务。当前未检测到可用 Key,请先注册或登录深知可信智能 MaaS 账号获取 API Key,再注入该环境变量。",
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def load_environment_state():
|
|
94
|
+
if not ENV_STATE_PATH.exists():
|
|
95
|
+
return {}
|
|
96
|
+
try:
|
|
97
|
+
with ENV_STATE_PATH.open("r", encoding="utf-8") as state_file:
|
|
98
|
+
state = json.load(state_file)
|
|
99
|
+
return state if isinstance(state, dict) else {}
|
|
100
|
+
except (OSError, json.JSONDecodeError):
|
|
101
|
+
return {}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def save_environment_state(state):
|
|
105
|
+
ENV_STATE_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
106
|
+
with ENV_STATE_PATH.open("w", encoding="utf-8") as state_file:
|
|
107
|
+
json.dump(state, state_file, ensure_ascii=False, indent=2)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def check_environment():
|
|
111
|
+
state = load_environment_state()
|
|
112
|
+
python3_available = shutil.which("python3") is not None
|
|
113
|
+
requests_available = _module_available("requests")
|
|
114
|
+
python_pptx_available = _module_available("pptx")
|
|
115
|
+
xlsxwriter_available = _module_available("XlsxWriter")
|
|
116
|
+
config_status = check_api_key_config()
|
|
117
|
+
|
|
118
|
+
blocking_issues = []
|
|
119
|
+
if not python3_available:
|
|
120
|
+
blocking_issues.append("python3_missing")
|
|
121
|
+
if not requests_available:
|
|
122
|
+
blocking_issues.append("requests_missing")
|
|
123
|
+
|
|
124
|
+
pptx_blocking_issues = []
|
|
125
|
+
if not python_pptx_available:
|
|
126
|
+
pptx_blocking_issues.append("python_pptx_missing")
|
|
127
|
+
if not xlsxwriter_available:
|
|
128
|
+
pptx_blocking_issues.append("xlsxwriter_missing")
|
|
129
|
+
|
|
130
|
+
search_blocking_issues = []
|
|
131
|
+
if not config_status["api_key_configured"]:
|
|
132
|
+
search_blocking_issues.append("api_key_missing")
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
"python": platform.python_version(),
|
|
136
|
+
"python3_available": python3_available,
|
|
137
|
+
"requests": requests_available,
|
|
138
|
+
"python_pptx": python_pptx_available,
|
|
139
|
+
"xlsxwriter": xlsxwriter_available,
|
|
140
|
+
"api_key_configured": config_status["api_key_configured"],
|
|
141
|
+
"api_key_env": API_KEY_ENV,
|
|
142
|
+
"api_key_source": config_status["api_key_source"],
|
|
143
|
+
"api_key_hint": config_status["api_key_hint"],
|
|
144
|
+
"search_ready": config_status["api_key_configured"] and requests_available,
|
|
145
|
+
"search_blocking_issues": search_blocking_issues,
|
|
146
|
+
# PPT 编译依赖缺失不阻断其他环节:可用 uv run --with 隔离提供。
|
|
147
|
+
"pptx_ready": python3_available and python_pptx_available and xlsxwriter_available,
|
|
148
|
+
"pptx_blocking_issues": pptx_blocking_issues,
|
|
149
|
+
"pptx_hint": (
|
|
150
|
+
"SVG 编译导出可用 `uv run --with python-pptx --with XlsxWriter python3 ...` 隔离提供依赖;"
|
|
151
|
+
if pptx_blocking_issues else None
|
|
152
|
+
),
|
|
153
|
+
"blocking_issues": blocking_issues,
|
|
154
|
+
"ready": not blocking_issues,
|
|
155
|
+
"maas_platform_url": "https://platform.dknowc.cn/",
|
|
156
|
+
"environment_state": {
|
|
157
|
+
"dependency_install_declined": bool(state.get("dependency_install_declined")),
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def main():
|
|
163
|
+
parser = argparse.ArgumentParser(description="深知可信PPT初始化与环境检查")
|
|
164
|
+
parser.add_argument("--decline-dependency-install", action="store_true", help="记录用户已拒绝依赖安装提示,后续不再反复询问")
|
|
165
|
+
parser.add_argument("--reset-environment-prompts", action="store_true", help="清除依赖安装提示的拒绝记录")
|
|
166
|
+
args = parser.parse_args()
|
|
167
|
+
|
|
168
|
+
state = load_environment_state()
|
|
169
|
+
if args.reset_environment_prompts:
|
|
170
|
+
state.pop("dependency_install_declined", None)
|
|
171
|
+
if args.decline_dependency_install:
|
|
172
|
+
state["dependency_install_declined"] = True
|
|
173
|
+
if args.reset_environment_prompts or args.decline_dependency_install:
|
|
174
|
+
save_environment_state(state)
|
|
175
|
+
|
|
176
|
+
result = check_environment()
|
|
177
|
+
result["environment_state_path"] = "config/environment_state.json"
|
|
178
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
main()
|