mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
be2a96f490
Aggregate the sheets work from feat/lark-sheets-develop: - Improve validation errors with schema hints, aggregated issues, enum guidance, and prescriptive flag/style-field messages. - Harden +batch-update input contracts, key normalization, style vocabulary handling, and resource-budget checks. - Add read offload and truncation handling for cells, csv, and table-get, with typed output-path errors and safer jq/output-path semantics. - Correct freeze semantics by emitting full-state freeze/unfreeze operations and adding --rows/--cols for +dim-freeze. - Improve +styles-put and shared --styles parsing for styles, merges, row/column sizing, freeze, and sheet-prefixed range validation. - Fix dim-insert inherit-style mapping, table-get date/time handling, table-put style anchors, and CSV path-shaped input guards. - Update lark-sheets skill docs, scripts, tests, and generated flag data. Tested with: - go test ./shortcuts/common ./shortcuts/sheets/... - go test ./shortcuts/... ./internal/... - python3 -m py_compile skills/lark-sheets/scripts/*.py
30 lines
1.3 KiB
Go
30 lines
1.3 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmdutil
|
|
|
|
import (
|
|
"github.com/larksuite/cli/errs"
|
|
)
|
|
|
|
// RequireConfirmation constructs a typed *errs.ConfirmationRequiredError
|
|
// (exit code ExitConfirmationRequired) carrying the risk level and action as
|
|
// typed extension fields. Used by both shortcut and service command execution
|
|
// paths when a statically high-risk-write operation has not been confirmed
|
|
// with --yes.
|
|
//
|
|
// action identifies the operation for the agent (e.g. "mail +send",
|
|
// "drive.files.delete"). The hint is deliberately NOT a pre-built retry
|
|
// command: argv cannot faithfully reproduce the original invocation (pipeline
|
|
// producers, stdin bytes, redirections, inline env and the executable's real
|
|
// path are all gone), POSIX quoting does not survive PowerShell/cmd.exe, and
|
|
// echoing argv values can copy credentials or free-form payloads (--sql,
|
|
// --json) into the error envelope and every log that captures it. Per the
|
|
// lark-shared approval protocol, the caller that obtained the user's consent
|
|
// appends --yes to its own saved argv array and re-executes.
|
|
func RequireConfirmation(action string) error {
|
|
err := errs.NewConfirmationRequiredError(errs.RiskHighRiskWrite, action,
|
|
"%s requires confirmation", action)
|
|
return err.WithHint("add --yes to confirm")
|
|
}
|