mirror of
https://github.com/larksuite/cli.git
synced 2026-07-08 18:13:01 +08:00
Replace the embedded bootstrap manifest with a typed OAPI call to GET /open-apis/security_plugin/v1/sec_cli/manifest, resolving the download URL per-platform/per-arch against the live release set. TAT auth flows through the existing credential chain; an x-tt-env header is injected when LARKSUITE_CLI_X_TT_ENV is set, for BOE routing. Drop the standalone `sec install` verb — `sec run --auto-install` (default on) makes it redundant. Add a persistent --verbose / -v flag on the sec parent, inherited by every subcommand, that emits step-by-step trace output on stderr. bootstrap.json and bootstrap.go remain in-tree as dead code; they will be removed in a follow-up cleanup.
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package sec
|
|
|
|
import (
|
|
"sort"
|
|
"testing"
|
|
|
|
"github.com/larksuite/cli/internal/cmdutil"
|
|
"github.com/larksuite/cli/internal/core"
|
|
)
|
|
|
|
// TestNewCmdSec_HasAllSubcommands locks in the public command surface so a
|
|
// future refactor doesn't silently drop run/status/etc. The `update` verb
|
|
// was intentionally removed when lark-sec-cli took over its own upgrade
|
|
// lifecycle; if it ever needs to come back, add it here too. `install` was
|
|
// removed because `sec run --auto-install` (default on) makes a standalone
|
|
// install verb redundant.
|
|
func TestNewCmdSec_HasAllSubcommands(t *testing.T) {
|
|
f, _, _, _ := cmdutil.TestFactory(t, &core.CliConfig{AppID: "a", AppSecret: "s"})
|
|
cmd := NewCmdSec(f)
|
|
|
|
var got []string
|
|
for _, c := range cmd.Commands() {
|
|
got = append(got, c.Name())
|
|
}
|
|
sort.Strings(got)
|
|
want := []string{"config", "run", "status", "stop"}
|
|
if len(got) != len(want) {
|
|
t.Fatalf("subcommands = %v, want %v", got, want)
|
|
}
|
|
for i, name := range want {
|
|
if got[i] != name {
|
|
t.Errorf("subcommands[%d] = %q, want %q", i, got[i], name)
|
|
}
|
|
}
|
|
}
|