Files
larksuite__cli/shortcuts/vc/skill_docs_test.go
zhaoleibd e525beb8d6 feat(skills): unify meeting related skills (#2387)
* feat(skills): unify meeting guidance

* fix(meeting): restore domain boundary guidance

* docs(meeting): remove agent rollout qualification guidance

* docs(meeting): front-load skill routing description

* docs(meeting): refine identity and command guidance

* docs(meeting): clarify identity and pagination guidance

* docs(meeting): fix minutes todo detail command

* fix(meeting): clarify artifact query routing

* fix(meeting): improve live meeting skill recall

* fix(qualitygate): generate valid minute token placeholders

* fix(meeting): address unified skill review findings

* docs(meeting): add minutes permission guidance

* docs(lark-meeting): 更新SKILL.md并新增会议问答引导脚本

1. 优化SKILL.md表格排版与快速行动章节内容,新增批量获取当日会议脚本的使用说明
2. 新增meeting_qa_bootstrap.py脚本,实现一站式采集当日进行中、已结束会议及未来日程,生成可直接执行的命令引导

* docs(calendar): clarify today's meeting lookup

* revert(meeting): remove meeting Q&A bootstrap guidance

* fix(skills): register lark-meeting suite keywords

---------

Co-authored-by: maozhixiang <maozhixiang@bytedance.com>
2026-08-21 10:49:46 +08:00

106 lines
3.8 KiB
Go

// Copyright (c) 2026 Lark Technologies Pte. Ltd.
// SPDX-License-Identifier: MIT
//
// Capability source test: pins the identity (user/bot) claims made in
// skills/lark-vc against the AuthTypes actually declared on the shortcuts.
// PR #2278's review found the docs had already drifted from the code once
// (SKILL.md claimed `+search` supported bot while vc_search.go stayed
// user-only) — this test fails loudly the next time that happens instead of
// relying on a human re-reading both sides on every AuthTypes change.
package vc
import (
"os"
"strings"
"testing"
)
func hasAuthType(authTypes []string, want string) bool {
for _, a := range authTypes {
if a == want {
return true
}
}
return false
}
func readSkillDoc(t *testing.T, relPath string) string {
t.Helper()
data, err := os.ReadFile("../../" + relPath)
if err != nil {
t.Fatalf("read %s: %v", relPath, err)
}
return string(data)
}
// TestVCSearchIdentityDocsMatchAuthTypes pins that `+search` stays user-only
// in both code and the reference owned by lark-meeting. If AuthTypes ever
// gains "bot", this test forces a deliberate documentation update instead of
// letting the docs silently fall out of sync.
func TestVCSearchIdentityDocsMatchAuthTypes(t *testing.T) {
skill := readSkillDoc(t, "skills/lark-meeting/SKILL.md")
reference := readSkillDoc(t, "skills/lark-meeting/references/lark-vc-search.md")
if hasAuthType(VCSearch.AuthTypes, "bot") {
t.Fatalf("VCSearch.AuthTypes = %v now includes bot; update skills/lark-meeting/references/lark-vc-search.md wording (and this test) to reflect the new support instead of leaving the user-only claim below", VCSearch.AuthTypes)
}
if !strings.Contains(skill, "references/lark-vc-search.md") {
t.Error("skills/lark-meeting/SKILL.md must link to the vc +search reference")
}
if !strings.Contains(reference, "仅支持 `user` 身份") && !strings.Contains(reference, "仅 `--as user`") {
t.Error("lark-vc-search.md must state that +search only supports user identity (matches VCSearch.AuthTypes)")
}
}
// TestVCBotShortcutsIdentityDocsMatchAuthTypes pins that the VC shortcuts this
// PR opened to bot (`+detail`, `+recording`) are both declared bot-capable in
// code and documented as such in their lark-meeting references.
func TestVCBotShortcutsIdentityDocsMatchAuthTypes(t *testing.T) {
skill := readSkillDoc(t, "skills/lark-meeting/SKILL.md")
for _, cmd := range []struct {
name string
authTypes []string
reference string
}{
{"+detail", VCDetail.AuthTypes, "lark-vc-detail.md"},
{"+recording", VCRecording.AuthTypes, "lark-vc-recording.md"},
} {
if !hasAuthType(cmd.authTypes, "bot") {
t.Errorf("%s AuthTypes = %v, want bot included (this PR's contract)", cmd.name, cmd.authTypes)
continue
}
if !strings.Contains(skill, "references/"+cmd.reference) {
t.Errorf("skills/lark-meeting/SKILL.md must link %s to %s", cmd.name, cmd.reference)
}
reference := readSkillDoc(t, "skills/lark-meeting/references/"+cmd.reference)
for _, identity := range []string{"--as user", "--as bot"} {
if !strings.Contains(reference, identity) {
t.Errorf("%s must document %s support for %s", cmd.reference, identity, cmd.name)
}
}
}
}
func TestMeetingArtifactSceneDelegatesToDomainOwners(t *testing.T) {
scene := readSkillDoc(t, "skills/lark-meeting/scenes/query-meeting-and-artifacts.md")
for _, target := range []string{
"query-note-and-artifacts.md",
"query-minutes-and-artifacts.md",
} {
if !strings.Contains(scene, target) {
t.Errorf("query-meeting-and-artifacts.md must delegate to %s", target)
}
}
for _, duplicatedCommand := range []string{
"lark-cli note +detail",
"lark-cli minutes +detail",
} {
if strings.Contains(scene, duplicatedCommand) {
t.Errorf("query-meeting-and-artifacts.md must not duplicate downstream command %q", duplicatedCommand)
}
}
}