@lark-apaas/coding-miaoda-sandbox-skills 0.1.0-dev.ec88bb5 → 0.1.0-dev.f3f0e48
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/miaoda/ai-data-processing/SKILL.md +4 -1
- package/miaoda/animation-skill/SKILL.md +348 -0
- package/miaoda/authz-cli/SKILL.md +1 -0
- package/miaoda/charts-skill/SKILL.md +264 -0
- package/miaoda/creative-to-fullstack/SKILL.md +64 -0
- package/miaoda/data-analysis/SKILL.md +151 -0
- package/miaoda/data-analysis/references/json-output-specification.md +277 -0
- package/miaoda/data-analysis/references/post-analysis-guide.md +77 -0
- package/miaoda/data-analysis/references/python-analysis-reference.md +272 -0
- package/miaoda/data-analysis/references/tmp-file-management-guide.md +100 -0
- package/miaoda/debug-investigation/SKILL.md +35 -23
- package/miaoda/extract-json-schema/SKILL.md +147 -0
- package/miaoda/feishu/SKILL.md +4 -4
- package/miaoda/forms-skill/SKILL.md +46 -4
- package/miaoda/lark-apps/SKILL.md +37 -0
- package/miaoda/lark-apps/references/openapi-key.md +80 -0
- package/miaoda/lark-apps-authz/SKILL.md +292 -0
- package/miaoda/lark-apps-authz/references/permission-points.md +39 -0
- package/miaoda/lark-apps-authz/references/role.md +122 -0
- package/miaoda/lark-apps-db/SKILL.md +227 -0
- package/miaoda/lark-apps-db/references/full-reference.md +424 -0
- package/miaoda/lark-apps-file/SKILL.md +216 -0
- package/miaoda/lark-apps-ops/SKILL.md +67 -0
- package/miaoda/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
- package/miaoda/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
- package/miaoda/lark-apps-ops/references/lark-apps-cache.md +62 -0
- package/miaoda/lark-apps-ops/references/lark-apps-env.md +46 -0
- package/miaoda/lark-apps-ops/references/lark-apps-export.md +46 -0
- package/miaoda/lark-apps-ops/references/lark-apps-local-dev.md +26 -0
- package/miaoda/lark-apps-ops/references/lark-apps-mcp.md +25 -0
- package/miaoda/lark-apps-ops/references/lark-apps-member.md +93 -0
- package/miaoda/lark-apps-ops/references/lark-apps-observability.md +46 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
- package/miaoda/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-create.md +37 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-get.md +59 -0
- package/miaoda/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda/lark-apps-ops/references/lark-apps-update.md +30 -0
- package/miaoda/lark-apps-ops/references/lark-apps-user-id-convert.md +63 -0
- package/miaoda/lark-apps-ops/references/openapi-key.md +80 -0
- package/miaoda/lark-design-prototype/DESIGN.md +603 -0
- package/miaoda/lark-design-prototype/SKILL.md +85 -0
- package/miaoda/lark-design-prototype/references/assets/card-illustration-library.md +113 -0
- package/miaoda/lark-design-prototype/references/case-matching.md +53 -0
- package/miaoda/lark-design-prototype/references/cases/conversational-ai-home.md +27 -0
- package/miaoda/lark-design-prototype/references/cases/data-table.md +30 -0
- package/miaoda/lark-design-prototype/references/cases/official-home.md +26 -0
- package/miaoda/lark-design-prototype/references/cases/workspace-home.md +34 -0
- package/miaoda/lark-design-prototype/references/color-roles.md +163 -0
- package/miaoda/lark-design-prototype/references/component-selection.md +134 -0
- package/miaoda/lark-design-prototype/references/design-quality-checklist.md +156 -0
- package/miaoda/lark-design-prototype/references/form-shell-patterns.md +77 -0
- package/miaoda/lark-design-prototype/references/icon-semantics.md +237 -0
- package/miaoda/lark-design-prototype/references/layout-interaction.md +164 -0
- package/miaoda/lark-design-prototype/references/page-contract.md +281 -0
- package/miaoda/lark-design-prototype/references/product-patterns.md +93 -0
- package/miaoda/lark-design-prototype/references/prompt-expansion.md +107 -0
- package/miaoda/lark-design-prototype/references/restoration-traps.md +113 -0
- package/miaoda/lark-design-prototype/references/token-semantics.md +112 -0
- package/miaoda/lark-design-prototype/references/visual-brief.md +125 -0
- package/miaoda/lark-design-prototype/references/visual-style-prompts.md +61 -0
- package/miaoda/lark-design-prototype/scripts/icon-query.mjs +272 -0
- package/miaoda/lark-design-prototype/scripts/token-query.mjs +76 -0
- package/miaoda/lark-design-prototype/scripts/verify-static-html.mjs +117 -0
- package/miaoda/miaoda-file/SKILL.md +1 -0
- package/miaoda/miaoda-sql/SKILL.md +21 -2
- package/miaoda/performance-review/SKILL.md +144 -0
- package/miaoda/performance-review/references/business-analyzer.md +139 -0
- package/miaoda/performance-review/references/examples.md +107 -0
- package/miaoda/semantic-search/SKILL.md +6 -4
- package/miaoda/table-skill/SKILL.md +2 -0
- package/{shared → miaoda}/testing-guide/SKILL.md +119 -13
- package/miaoda-design/lark-apps-comment/SKILL.md +119 -0
- package/miaoda-design/lark-apps-ops/SKILL.md +47 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-create.md +52 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-get.md +59 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda-design/lark-apps-ops/references/lark-apps-update.md +33 -0
- package/{shared → miaoda-modern}/charts-skill/SKILL.md +1 -1
- package/miaoda-modern/debug-investigation/SKILL.md +1 -1
- package/miaoda-modern/forms-skill/SKILL.md +70 -7
- package/{shared → miaoda-modern}/lark-apps/SKILL.md +5 -5
- package/miaoda-modern/lark-apps/references/openapi-key.md +80 -0
- package/miaoda-modern/lark-apps-ops/SKILL.md +67 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-get.md +30 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-access-scope-set.md +40 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-cache.md +62 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-env.md +46 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-export.md +46 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-local-dev.md +26 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-mcp.md +25 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-member.md +93 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-observability.md +46 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-install.md +36 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-list.md +23 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-plugin-uninstall.md +25 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-create.md +37 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-get.md +59 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-release-list.md +31 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-update.md +30 -0
- package/miaoda-modern/lark-apps-ops/references/lark-apps-user-id-convert.md +63 -0
- package/{shared/lark-apps → miaoda-modern/lark-apps-ops}/references/openapi-key.md +3 -3
- package/miaoda-modern/lark-design-prototype/DESIGN.md +603 -0
- package/miaoda-modern/lark-design-prototype/SKILL.md +85 -0
- package/miaoda-modern/lark-design-prototype/references/assets/card-illustration-library.md +113 -0
- package/miaoda-modern/lark-design-prototype/references/case-matching.md +53 -0
- package/miaoda-modern/lark-design-prototype/references/cases/conversational-ai-home.md +27 -0
- package/miaoda-modern/lark-design-prototype/references/cases/data-table.md +30 -0
- package/miaoda-modern/lark-design-prototype/references/cases/official-home.md +26 -0
- package/miaoda-modern/lark-design-prototype/references/cases/workspace-home.md +34 -0
- package/miaoda-modern/lark-design-prototype/references/color-roles.md +163 -0
- package/miaoda-modern/lark-design-prototype/references/component-selection.md +134 -0
- package/miaoda-modern/lark-design-prototype/references/design-quality-checklist.md +156 -0
- package/miaoda-modern/lark-design-prototype/references/form-shell-patterns.md +77 -0
- package/miaoda-modern/lark-design-prototype/references/icon-semantics.md +237 -0
- package/miaoda-modern/lark-design-prototype/references/layout-interaction.md +164 -0
- package/miaoda-modern/lark-design-prototype/references/page-contract.md +281 -0
- package/miaoda-modern/lark-design-prototype/references/product-patterns.md +93 -0
- package/miaoda-modern/lark-design-prototype/references/prompt-expansion.md +107 -0
- package/miaoda-modern/lark-design-prototype/references/restoration-traps.md +113 -0
- package/miaoda-modern/lark-design-prototype/references/token-semantics.md +112 -0
- package/miaoda-modern/lark-design-prototype/references/visual-brief.md +125 -0
- package/miaoda-modern/lark-design-prototype/references/visual-style-prompts.md +61 -0
- package/miaoda-modern/lark-design-prototype/scripts/icon-query.mjs +272 -0
- package/miaoda-modern/lark-design-prototype/scripts/token-query.mjs +76 -0
- package/miaoda-modern/lark-design-prototype/scripts/verify-static-html.mjs +117 -0
- package/miaoda-modern/memory/SKILL.md +86 -0
- package/{shared → miaoda-modern}/performance-review/SKILL.md +3 -3
- package/miaoda-modern/reviewer-usage/SKILL.md +113 -0
- package/package.json +1 -1
- package/shared/attachment/SKILL.md +5 -1
- package/shared/lark-cli/SKILL.md +221 -0
- package/shared/lark-cli/lark-base/README.md +61 -0
- package/shared/lark-cli/lark-base/references/lark-base-commands.md +123 -0
- package/shared/lark-cli/lark-calendar/README.md +158 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-meeting.md +30 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-room-find.md +108 -0
- package/shared/lark-cli/lark-calendar/references/lark-calendar-suggestion.md +120 -0
- package/shared/lark-cli/lark-contact/README.md +35 -0
- package/shared/lark-cli/lark-contact/references/lark-contact-get-user.md +13 -0
- package/shared/lark-cli/lark-contact/references/lark-contact-search-user.md +121 -0
- package/shared/lark-cli/lark-doc/README.md +68 -0
- package/shared/lark-cli/lark-doc/references/lark-doc-fetch.md +138 -0
- package/shared/lark-cli/lark-doc/references/lark-doc-history.md +61 -0
- package/shared/lark-cli/lark-drive/README.md +158 -0
- package/shared/lark-cli/lark-drive/references/lark-drive-batch-query-comments.md +44 -0
- package/shared/lark-cli/lark-drive/references/lark-drive-files-list.md +183 -0
- package/shared/lark-cli/lark-drive/references/lark-drive-list-replies.md +49 -0
- package/shared/lark-cli/lark-im/README.md +70 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-list.md +140 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-members-list.md +84 -0
- package/shared/lark-cli/lark-im/references/lark-im-chat-search.md +135 -0
- package/shared/lark-cli/lark-im/references/lark-im-reactions.md +232 -0
- package/shared/lark-cli/lark-minutes/README.md +51 -0
- package/shared/lark-cli/lark-minutes/references/lark-minutes-download.md +130 -0
- package/shared/lark-cli/lark-sheets/README.md +174 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-changeset.md +105 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-chart.md +46 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-conditional-format.md +42 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-filter-view.md +51 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-filter.md +42 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-float-image.md +43 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-formula-verify.md +64 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-history.md +70 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-pivot-table.md +44 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-read-data.md +287 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-search-replace.md +67 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-sheet-structure.md +52 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-sparkline.md +47 -0
- package/shared/lark-cli/lark-sheets/references/lark-sheets-workbook.md +69 -0
- package/shared/lark-cli/lark-sheets/scripts/lark_detect_subtables.py +596 -0
- package/shared/lark-cli/lark-sheets/scripts/lark_inspect_workbook.py +193 -0
- package/shared/lark-cli/lark-sheets/scripts/lark_profile_table.py +616 -0
- package/shared/lark-cli/lark-sheets/scripts/lark_sheet_range.py +176 -0
- package/shared/lark-cli/lark-sheets/scripts/lark_sheet_read_cli.py +221 -0
- package/shared/lark-cli/lark-sheets/scripts/sheets_df.py +50 -0
- package/shared/lark-cli/lark-slides/README.md +87 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-history.md +117 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentation-slide-get.md +108 -0
- package/shared/lark-cli/lark-slides/references/lark-slides-xml-presentations-get.md +77 -0
- package/shared/lark-cli/lark-task/README.md +93 -0
- package/shared/lark-cli/lark-task/references/lark-task-get-my-tasks.md +57 -0
- package/shared/lark-cli/lark-task/references/lark-task-get-related-tasks.md +49 -0
- package/shared/lark-cli/lark-task/references/lark-task-search.md +36 -0
- package/shared/lark-cli/lark-task/references/lark-task-tasklist-search.md +35 -0
- package/shared/lark-cli/lark-vc/README.md +40 -0
- package/shared/lark-cli/lark-vc/references/lark-vc-recording.md +31 -0
- package/shared/lark-cli/lark-whiteboard/README.md +34 -0
- package/shared/lark-cli/lark-whiteboard/references/lark-whiteboard-export.md +59 -0
- package/shared/lark-cli/lark-wiki/README.md +50 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-node-get.md +70 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-node-list.md +95 -0
- package/shared/lark-cli/lark-wiki/references/lark-wiki-space-list.md +68 -0
- package/miaoda-design/attachment/SKILL.md +0 -58
- package/shared/dev-channel-probe/SKILL.md +0 -40
- /package/{shared → miaoda}/memory/SKILL.md +0 -0
- /package/{shared → miaoda}/reviewer-usage/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/animation-skill/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/json-output-specification.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/post-analysis-guide.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/python-analysis-reference.md +0 -0
- /package/{shared → miaoda-modern}/data-analysis/references/tmp-file-management-guide.md +0 -0
- /package/{shared → miaoda-modern}/extract-json-schema/SKILL.md +0 -0
- /package/{shared → miaoda-modern}/performance-review/references/business-analyzer.md +0 -0
- /package/{shared → miaoda-modern}/performance-review/references/examples.md +0 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""Inspect a Lark spreadsheet and emit a compact workbook profile."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from lark_sheet_range import index_to_col
|
|
12
|
+
from lark_sheet_read_cli import (
|
|
13
|
+
LarkCliError,
|
|
14
|
+
add_spreadsheet_args,
|
|
15
|
+
emit_error,
|
|
16
|
+
emit_success,
|
|
17
|
+
envelope_data,
|
|
18
|
+
resolve_target_sheets,
|
|
19
|
+
run_sheets,
|
|
20
|
+
sheet_identifier,
|
|
21
|
+
sheet_locator,
|
|
22
|
+
sheet_title,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
ACTION = "inspect_workbook"
|
|
26
|
+
LAYOUT_INCLUDE = "merges,row_heights,col_widths,hidden_rows,hidden_cols,groups,frozen"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _sheet_summary(sheet: dict[str, Any]) -> dict[str, Any]:
|
|
30
|
+
return {
|
|
31
|
+
"sheet_id": sheet_identifier(sheet),
|
|
32
|
+
"title": sheet_title(sheet),
|
|
33
|
+
"index": sheet.get("index"),
|
|
34
|
+
"row_count": sheet.get("row_count"),
|
|
35
|
+
"column_count": sheet.get("column_count"),
|
|
36
|
+
"is_hidden": sheet.get("is_hidden"),
|
|
37
|
+
"merged_cells_count": sheet.get("merged_cells_count"),
|
|
38
|
+
"chart_count": sheet.get("chart_count"),
|
|
39
|
+
"pivot_table_count": sheet.get("pivot_table_count"),
|
|
40
|
+
"float_image_count": sheet.get("float_image_count"),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _list_count(value: Any) -> int:
|
|
45
|
+
return len(value) if isinstance(value, list) else 0
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _layout_summary(layout: dict[str, Any]) -> dict[str, Any]:
|
|
49
|
+
"""Retain layout signals without serializing unbounded per-cell metadata."""
|
|
50
|
+
merges = layout.get("merged_cells") or layout.get("merges") or []
|
|
51
|
+
groups = layout.get("groups") if isinstance(layout.get("groups"), dict) else {}
|
|
52
|
+
row_groups = layout.get("row_groups") or groups.get("rows", [])
|
|
53
|
+
col_groups = layout.get("column_groups") or groups.get("columns", [])
|
|
54
|
+
return {
|
|
55
|
+
"merge_count": _list_count(merges),
|
|
56
|
+
"row_heights_count": _list_count(layout.get("row_heights")),
|
|
57
|
+
"column_widths_count": _list_count(layout.get("col_widths")),
|
|
58
|
+
"hidden_rows_count": _list_count(layout.get("hidden_rows")),
|
|
59
|
+
"hidden_columns_count": _list_count(
|
|
60
|
+
layout.get("hidden_cols") or layout.get("hidden_columns")
|
|
61
|
+
),
|
|
62
|
+
"row_groups_count": _list_count(row_groups),
|
|
63
|
+
"column_groups_count": _list_count(col_groups),
|
|
64
|
+
"frozen": layout.get("frozen"),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def inspect_workbook(args) -> tuple[dict[str, Any], list[str]]:
|
|
69
|
+
warnings: list[str] = []
|
|
70
|
+
workbook = envelope_data(
|
|
71
|
+
run_sheets(
|
|
72
|
+
"+workbook-info",
|
|
73
|
+
url=args.url,
|
|
74
|
+
spreadsheet_token=args.spreadsheet_token,
|
|
75
|
+
timeout=args.timeout,
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
# An explicit selector must resolve: without require_one a typo'd
|
|
79
|
+
# --sheet-id/--sheet-name silently yields sheet_count 0, which reads as
|
|
80
|
+
# "empty workbook" instead of a locator error.
|
|
81
|
+
target_sheets = resolve_target_sheets(
|
|
82
|
+
workbook,
|
|
83
|
+
sheet_id=args.sheet_id,
|
|
84
|
+
sheet_name=args.sheet_name,
|
|
85
|
+
require_one=bool(args.sheet_id or args.sheet_name),
|
|
86
|
+
)
|
|
87
|
+
if args.max_sheets < 1:
|
|
88
|
+
raise LarkCliError("--max-sheets must be at least 1")
|
|
89
|
+
inspect_count = len(target_sheets)
|
|
90
|
+
if not args.sheet_id and not args.sheet_name:
|
|
91
|
+
inspect_count = min(len(target_sheets), args.max_sheets)
|
|
92
|
+
if inspect_count < len(target_sheets):
|
|
93
|
+
warnings.append(
|
|
94
|
+
f"layout and preview skipped for {len(target_sheets) - inspect_count} sheets; "
|
|
95
|
+
f"pass --sheet-id or --sheet-name to inspect one"
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
profiles = []
|
|
99
|
+
for position, sheet in enumerate(target_sheets):
|
|
100
|
+
sid = sheet_identifier(sheet)
|
|
101
|
+
title = sheet_title(sheet)
|
|
102
|
+
profile = _sheet_summary(sheet)
|
|
103
|
+
if position >= inspect_count:
|
|
104
|
+
profiles.append(profile)
|
|
105
|
+
continue
|
|
106
|
+
locator = sheet_locator(sheet)
|
|
107
|
+
col_count = int(sheet.get("column_count") or args.max_preview_cols)
|
|
108
|
+
preview_cols = min(col_count, args.max_preview_cols)
|
|
109
|
+
if col_count > args.max_preview_cols:
|
|
110
|
+
warnings.append(
|
|
111
|
+
f"{title or sid}: preview clipped to first {args.max_preview_cols} columns"
|
|
112
|
+
)
|
|
113
|
+
end_col = index_to_col(max(1, preview_cols))
|
|
114
|
+
preview_range = f"A1:{end_col}{args.preview_rows}"
|
|
115
|
+
|
|
116
|
+
# Per-sheet, not fail-the-run: this is the first-step pre-flight, and
|
|
117
|
+
# one unreadable sheet (odd type, transient error, a locator that does
|
|
118
|
+
# not resolve) must not throw away the summaries already collected for
|
|
119
|
+
# every other sheet. The basic summary comes from +workbook-info and is
|
|
120
|
+
# already in hand, so a failure here degrades detail, not correctness —
|
|
121
|
+
# same call the sibling profile_table downgrades to a warning.
|
|
122
|
+
try:
|
|
123
|
+
layout = envelope_data(
|
|
124
|
+
run_sheets(
|
|
125
|
+
"+sheet-info",
|
|
126
|
+
url=args.url,
|
|
127
|
+
spreadsheet_token=args.spreadsheet_token,
|
|
128
|
+
**locator,
|
|
129
|
+
flags={"include": LAYOUT_INCLUDE},
|
|
130
|
+
timeout=args.timeout,
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
preview = envelope_data(
|
|
134
|
+
run_sheets(
|
|
135
|
+
"+csv-get",
|
|
136
|
+
url=args.url,
|
|
137
|
+
spreadsheet_token=args.spreadsheet_token,
|
|
138
|
+
**locator,
|
|
139
|
+
flags={
|
|
140
|
+
"range": preview_range,
|
|
141
|
+
"max_chars": args.max_chars,
|
|
142
|
+
# 预览按字面行号呈现,显式要回 annotated_csv
|
|
143
|
+
"include_row_prefix": True,
|
|
144
|
+
},
|
|
145
|
+
timeout=args.timeout,
|
|
146
|
+
)
|
|
147
|
+
)
|
|
148
|
+
except LarkCliError as exc:
|
|
149
|
+
warnings.append(
|
|
150
|
+
f"{title or sid}: layout/preview unavailable ({exc}); "
|
|
151
|
+
"re-read this sheet on its own with --sheet-name, or use +sheet-info / +csv-get directly"
|
|
152
|
+
)
|
|
153
|
+
profiles.append(profile)
|
|
154
|
+
continue
|
|
155
|
+
if preview.get("has_more"):
|
|
156
|
+
warnings.append(f"{title or sid}: preview range {preview_range} was truncated")
|
|
157
|
+
|
|
158
|
+
profiles.append(
|
|
159
|
+
{
|
|
160
|
+
**profile,
|
|
161
|
+
"layout": _layout_summary(layout),
|
|
162
|
+
"preview": {
|
|
163
|
+
"range": preview_range,
|
|
164
|
+
"current_region": preview.get("current_region"),
|
|
165
|
+
"row_indices": preview.get("row_indices"),
|
|
166
|
+
"col_indices": preview.get("col_indices"),
|
|
167
|
+
"annotated_csv": preview.get("annotated_csv"),
|
|
168
|
+
"has_more": preview.get("has_more"),
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
return {"sheet_count": len(target_sheets), "sheets": profiles}, warnings
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def main() -> None:
|
|
177
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
178
|
+
add_spreadsheet_args(parser, require_sheet=False, allow_sheet=True)
|
|
179
|
+
parser.add_argument("--preview-rows", type=int, default=15)
|
|
180
|
+
parser.add_argument("--max-preview-cols", type=int, default=100)
|
|
181
|
+
parser.add_argument("--max-chars", type=int, default=8000)
|
|
182
|
+
parser.add_argument("--max-sheets", type=int, default=3)
|
|
183
|
+
parser.add_argument("--timeout", type=int, default=60)
|
|
184
|
+
args = parser.parse_args()
|
|
185
|
+
try:
|
|
186
|
+
data, warnings = inspect_workbook(args)
|
|
187
|
+
except (LarkCliError, ValueError, TypeError) as exc:
|
|
188
|
+
emit_error(ACTION, str(exc))
|
|
189
|
+
emit_success(ACTION, data, warnings)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
if __name__ == "__main__":
|
|
193
|
+
main()
|