mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
a6f3e635d4
* feat(docs): add local authoring and resource workflows Add docs +script workflows for isolated draft initialization and tolerant XML/Markdown profiling. Support local and remote document resources across create and update flows with safe, bounded-concurrency uploads, binding verification, and cleanup. Synchronize shared credential-source selection during concurrent uploads, refresh lark-doc guidance, and expand unit, dry-run, and live E2E coverage. * docs(lark-doc): clarify genre reference paths * fix(docs): address PR validation feedback * docs(lark-doc): clarify remote image handling * feat: streamline docs draft workflow * fix(docs): clarify script input and resource cleanup * fix(docs): align script dry-run test with auth flow * fix(docs): authenticate local script e2e test * fix(docs): refine script diagnostics and image preflight * fix(docs): align draft workspace cleanup with VFS * fix(docs): route workspace cleanup through FileIO * docs(lark-doc): simplify profile check guidance
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package doc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/larksuite/cli/shortcuts/common"
|
|
)
|
|
|
|
// v1UpdateFlags returns hidden parse-only compatibility flags for old v1 commands.
|
|
func v1UpdateFlags() []common.Flag {
|
|
return docsLegacyFlagDefinitions(docsUpdateLegacyFlags())
|
|
}
|
|
|
|
var docsUpdateLocalResourceScopes = []string{
|
|
"docs:document.media:upload",
|
|
}
|
|
|
|
var docsUpdateWikiLocalResourceScopes = []string{
|
|
"docs:document.media:upload",
|
|
"wiki:node:retrieve",
|
|
}
|
|
|
|
func docsUpdateLocalResourceScopesFor(ref documentRef) []string {
|
|
if ref.Kind == "wiki" {
|
|
return docsUpdateWikiLocalResourceScopes
|
|
}
|
|
return docsUpdateLocalResourceScopes
|
|
}
|
|
|
|
var DocsUpdate = common.Shortcut{
|
|
Service: "docs",
|
|
Command: "+update",
|
|
Description: "Update a Lark document",
|
|
Risk: "write",
|
|
Scopes: []string{"docx:document:write_only", "docx:document:readonly"},
|
|
ConditionalScopes: docsUpdateWikiLocalResourceScopes,
|
|
AuthTypes: []string{"user", "bot"},
|
|
Flags: concatFlags(
|
|
[]common.Flag{
|
|
docsAPIVersionCompatFlag(),
|
|
{Name: "doc", Desc: "document URL or token", Required: true},
|
|
},
|
|
v2UpdateFlags(),
|
|
v1UpdateFlags(),
|
|
),
|
|
Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
|
return validateUpdateV2(ctx, runtime)
|
|
},
|
|
DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI {
|
|
return dryRunUpdateV2(ctx, runtime)
|
|
},
|
|
Execute: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
|
return executeUpdateV2(ctx, runtime)
|
|
},
|
|
}
|