refactor(skill): remove non-scenario skill commands, add navigation to user reference
Removed: cli, architecture, yaml, moderator, actor skill subcommands Kept: user, author, developer, adapter (scenario-based) Added: scenario navigation table to user-reference.ts
This commit is contained in:
@@ -6,27 +6,17 @@ import { describe, expect, test } from "vitest";
|
|||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
import {
|
import {
|
||||||
cmdSkillActor,
|
|
||||||
cmdSkillAdapter,
|
cmdSkillAdapter,
|
||||||
cmdSkillArchitecture,
|
|
||||||
cmdSkillAuthor,
|
cmdSkillAuthor,
|
||||||
cmdSkillCli,
|
|
||||||
cmdSkillDeveloper,
|
cmdSkillDeveloper,
|
||||||
cmdSkillList,
|
cmdSkillList,
|
||||||
cmdSkillModerator,
|
|
||||||
cmdSkillUser,
|
cmdSkillUser,
|
||||||
cmdSkillYaml,
|
|
||||||
} from "../commands/skill.js";
|
} from "../commands/skill.js";
|
||||||
|
|
||||||
describe("skill commands", () => {
|
describe("skill commands", () => {
|
||||||
test("skill list returns all skill names", () => {
|
test("skill list returns all skill names", () => {
|
||||||
const result = cmdSkillList();
|
const result = cmdSkillList();
|
||||||
expect(result).toBeInstanceOf(Array);
|
expect(result).toBeInstanceOf(Array);
|
||||||
expect(result).toContain("cli");
|
|
||||||
expect(result).toContain("architecture");
|
|
||||||
expect(result).toContain("yaml");
|
|
||||||
expect(result).toContain("moderator");
|
|
||||||
expect(result).toContain("actor");
|
|
||||||
expect(result).toContain("user");
|
expect(result).toContain("user");
|
||||||
expect(result).toContain("author");
|
expect(result).toContain("author");
|
||||||
expect(result).toContain("developer");
|
expect(result).toContain("developer");
|
||||||
@@ -36,50 +26,6 @@ describe("skill commands", () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test("skill architecture returns non-empty markdown string", () => {
|
|
||||||
const result = cmdSkillArchitecture();
|
|
||||||
expect(typeof result).toBe("string");
|
|
||||||
expect(result).toContain("CAS");
|
|
||||||
expect(result).toContain("Thread");
|
|
||||||
expect(result).toContain("Workflow");
|
|
||||||
expect(result).toContain("Step");
|
|
||||||
expect(result.length).toBeGreaterThan(200);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("skill yaml returns non-empty markdown string", () => {
|
|
||||||
const result = cmdSkillYaml();
|
|
||||||
expect(typeof result).toBe("string");
|
|
||||||
expect(result).toContain("roles");
|
|
||||||
expect(result).toContain("graph");
|
|
||||||
expect(result).toContain("frontmatter");
|
|
||||||
expect(result.length).toBeGreaterThan(200);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("skill moderator returns non-empty markdown string", () => {
|
|
||||||
const result = cmdSkillModerator();
|
|
||||||
expect(typeof result).toBe("string");
|
|
||||||
expect(result).toContain("routing");
|
|
||||||
expect(result).toContain("status");
|
|
||||||
expect(result.length).toBeGreaterThan(200);
|
|
||||||
// Check for edge or graph
|
|
||||||
expect(result).toMatch(/edge|graph/i);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("skill cli returns CLI reference markdown", () => {
|
|
||||||
const result = cmdSkillCli();
|
|
||||||
expect(typeof result).toBe("string");
|
|
||||||
expect(result).toContain("uwf");
|
|
||||||
});
|
|
||||||
|
|
||||||
test("skill actor returns non-empty markdown string", () => {
|
|
||||||
const result = cmdSkillActor();
|
|
||||||
expect(typeof result).toBe("string");
|
|
||||||
expect(result).toContain("frontmatter");
|
|
||||||
expect(result).toContain("CAS");
|
|
||||||
expect(result).toContain("status");
|
|
||||||
expect(result.length).toBeGreaterThan(200);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("skill user returns non-empty markdown string", () => {
|
test("skill user returns non-empty markdown string", () => {
|
||||||
const result = cmdSkillUser();
|
const result = cmdSkillUser();
|
||||||
expect(typeof result).toBe("string");
|
expect(typeof result).toBe("string");
|
||||||
@@ -126,11 +72,6 @@ describe("skill commands", () => {
|
|||||||
env: { ...process.env, PATH: `/opt/homebrew/bin:${process.env.PATH}` },
|
env: { ...process.env, PATH: `/opt/homebrew/bin:${process.env.PATH}` },
|
||||||
});
|
});
|
||||||
expect(output).not.toMatch(/help\s+\[command\]/i);
|
expect(output).not.toMatch(/help\s+\[command\]/i);
|
||||||
expect(output).toContain("cli");
|
|
||||||
expect(output).toContain("architecture");
|
|
||||||
expect(output).toContain("yaml");
|
|
||||||
expect(output).toContain("moderator");
|
|
||||||
expect(output).toContain("actor");
|
|
||||||
expect(output).toContain("user");
|
expect(output).toContain("user");
|
||||||
expect(output).toContain("author");
|
expect(output).toContain("author");
|
||||||
expect(output).toContain("developer");
|
expect(output).toContain("developer");
|
||||||
|
|||||||
@@ -17,16 +17,11 @@ import { cmdConfigGet, cmdConfigList, cmdConfigSet } from "./commands/config.js"
|
|||||||
import { cmdLogClean, cmdLogList, cmdLogShow } from "./commands/log.js";
|
import { cmdLogClean, cmdLogList, cmdLogShow } from "./commands/log.js";
|
||||||
import { cmdSetup, cmdSetupInteractive } from "./commands/setup.js";
|
import { cmdSetup, cmdSetupInteractive } from "./commands/setup.js";
|
||||||
import {
|
import {
|
||||||
cmdSkillActor,
|
|
||||||
cmdSkillAdapter,
|
cmdSkillAdapter,
|
||||||
cmdSkillArchitecture,
|
|
||||||
cmdSkillAuthor,
|
cmdSkillAuthor,
|
||||||
cmdSkillCli,
|
|
||||||
cmdSkillDeveloper,
|
cmdSkillDeveloper,
|
||||||
cmdSkillList,
|
cmdSkillList,
|
||||||
cmdSkillModerator,
|
|
||||||
cmdSkillUser,
|
cmdSkillUser,
|
||||||
cmdSkillYaml,
|
|
||||||
} from "./commands/skill.js";
|
} from "./commands/skill.js";
|
||||||
import { cmdStepFork, cmdStepList, cmdStepRead, cmdStepShow } from "./commands/step.js";
|
import { cmdStepFork, cmdStepList, cmdStepRead, cmdStepShow } from "./commands/step.js";
|
||||||
import {
|
import {
|
||||||
@@ -493,34 +488,6 @@ For more information, see: uwf help thread list
|
|||||||
const skill = program.command("skill").description("Built-in skill references for agents");
|
const skill = program.command("skill").description("Built-in skill references for agents");
|
||||||
skill.addHelpCommand(false);
|
skill.addHelpCommand(false);
|
||||||
|
|
||||||
skill
|
|
||||||
.command("cli")
|
|
||||||
.description("Print a markdown reference of all uwf commands")
|
|
||||||
.action(() => {
|
|
||||||
console.log(cmdSkillCli());
|
|
||||||
});
|
|
||||||
|
|
||||||
skill
|
|
||||||
.command("architecture")
|
|
||||||
.description("Print the architecture reference")
|
|
||||||
.action(() => {
|
|
||||||
console.log(cmdSkillArchitecture());
|
|
||||||
});
|
|
||||||
|
|
||||||
skill
|
|
||||||
.command("yaml")
|
|
||||||
.description("Print the workflow YAML schema reference")
|
|
||||||
.action(() => {
|
|
||||||
console.log(cmdSkillYaml());
|
|
||||||
});
|
|
||||||
|
|
||||||
skill
|
|
||||||
.command("actor")
|
|
||||||
.description("Print the actor reference (frontmatter protocol + CAS)")
|
|
||||||
.action(() => {
|
|
||||||
console.log(cmdSkillActor());
|
|
||||||
});
|
|
||||||
|
|
||||||
skill
|
skill
|
||||||
.command("adapter")
|
.command("adapter")
|
||||||
.description("Print the adapter reference (building agent adapters)")
|
.description("Print the adapter reference (building agent adapters)")
|
||||||
@@ -542,13 +509,6 @@ skill
|
|||||||
console.log(cmdSkillDeveloper());
|
console.log(cmdSkillDeveloper());
|
||||||
});
|
});
|
||||||
|
|
||||||
skill
|
|
||||||
.command("moderator")
|
|
||||||
.description("Print the moderator reference")
|
|
||||||
.action(() => {
|
|
||||||
console.log(cmdSkillModerator());
|
|
||||||
});
|
|
||||||
|
|
||||||
skill
|
skill
|
||||||
.command("user")
|
.command("user")
|
||||||
.description("Print the user reference (CLI guide + typical workflows)")
|
.description("Print the user reference (CLI guide + typical workflows)")
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
export {
|
export {
|
||||||
generateActorReference as cmdSkillActor,
|
|
||||||
generateAdapterReference as cmdSkillAdapter,
|
generateAdapterReference as cmdSkillAdapter,
|
||||||
generateArchitectureReference as cmdSkillArchitecture,
|
|
||||||
generateAuthorReference as cmdSkillAuthor,
|
generateAuthorReference as cmdSkillAuthor,
|
||||||
generateCliReference as cmdSkillCli,
|
|
||||||
generateDeveloperReference as cmdSkillDeveloper,
|
generateDeveloperReference as cmdSkillDeveloper,
|
||||||
generateModeratorReference as cmdSkillModerator,
|
|
||||||
generateUserReference as cmdSkillUser,
|
generateUserReference as cmdSkillUser,
|
||||||
generateYamlReference as cmdSkillYaml,
|
|
||||||
} from "@uncaged/workflow-util";
|
} from "@uncaged/workflow-util";
|
||||||
|
|
||||||
const SKILL_NAMES = [
|
const SKILL_NAMES = [
|
||||||
"cli",
|
|
||||||
"architecture",
|
|
||||||
"yaml",
|
|
||||||
"moderator",
|
|
||||||
"actor",
|
|
||||||
"user",
|
"user",
|
||||||
"author",
|
"author",
|
||||||
"developer",
|
"developer",
|
||||||
|
|||||||
@@ -121,5 +121,15 @@ uwf log clean --before <date> # delete old logs
|
|||||||
uwf --format <json|yaml> # output format (default: json)
|
uwf --format <json|yaml> # output format (default: json)
|
||||||
uwf -V, --version # print version
|
uwf -V, --version # print version
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
|
## Other Skill References
|
||||||
|
|
||||||
|
For specific scenarios, run the corresponding \`uwf skill\` command:
|
||||||
|
|
||||||
|
| Scenario | Command | When to use |
|
||||||
|
|----------|---------|-------------|
|
||||||
|
| Writing workflow YAML | \`uwf skill author\` | Designing roles, conditions, graphs, and edge prompts |
|
||||||
|
| Contributing to the engine | \`uwf skill developer\` | Modifying the workflow engine codebase itself |
|
||||||
|
| Building a new agent adapter | \`uwf skill adapter\` | Creating a new \`uwf-<name>\` CLI adapter |
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user