refactor: align package folder names with npm package names
CI / check (pull_request) Failing after 8m30s
CI / check (pull_request) Failing after 8m30s
Rename packages/ subdirectories to match their @united-workforce/* scope: cli-workflow → cli workflow-agent-builtin → agent-builtin workflow-agent-claude-code → agent-claude-code workflow-agent-hermes → agent-hermes workflow-dashboard → dashboard workflow-protocol → protocol workflow-util-agent → util-agent workflow-util → util Updated all tsconfig references, scripts, and active docs. Historical docs (docs/plans/, docs/superpowers/) left as-is. Closes #21
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import {
|
||||
createThreadIndexEntry,
|
||||
markThreadSuspended,
|
||||
normalizeThreadIndexEntry,
|
||||
parseThreadsIndex,
|
||||
serializeThreadIndexEntry,
|
||||
serializeThreadsIndex,
|
||||
updateThreadHead,
|
||||
} from "../thread-index.js";
|
||||
|
||||
describe("thread-index", () => {
|
||||
test("parse legacy string head hash", () => {
|
||||
const entry = normalizeThreadIndexEntry("0123456789ABC");
|
||||
expect(entry).toEqual({
|
||||
head: "0123456789ABC",
|
||||
suspendedRole: null,
|
||||
suspendMessage: null,
|
||||
});
|
||||
});
|
||||
|
||||
test("parse suspended object entry", () => {
|
||||
const entry = normalizeThreadIndexEntry({
|
||||
head: "0123456789ABC",
|
||||
suspendedRole: "worker",
|
||||
suspendMessage: "Please clarify: Which API?",
|
||||
});
|
||||
expect(entry).toEqual({
|
||||
head: "0123456789ABC",
|
||||
suspendedRole: "worker",
|
||||
suspendMessage: "Please clarify: Which API?",
|
||||
});
|
||||
});
|
||||
|
||||
test("serialize non-suspended entry as compact string", () => {
|
||||
const entry = createThreadIndexEntry("0123456789ABC");
|
||||
expect(serializeThreadIndexEntry(entry)).toBe("0123456789ABC");
|
||||
});
|
||||
|
||||
test("serialize suspended entry as object", () => {
|
||||
const entry = markThreadSuspended(
|
||||
createThreadIndexEntry("0123456789ABC"),
|
||||
"worker",
|
||||
"Please clarify: Which API?",
|
||||
);
|
||||
expect(serializeThreadIndexEntry(entry)).toEqual({
|
||||
head: "0123456789ABC",
|
||||
suspendedRole: "worker",
|
||||
suspendMessage: "Please clarify: Which API?",
|
||||
});
|
||||
});
|
||||
|
||||
test("updateThreadHead clears suspend metadata", () => {
|
||||
const suspended = markThreadSuspended(
|
||||
createThreadIndexEntry("OLDHEAD0123456"),
|
||||
"worker",
|
||||
"Waiting",
|
||||
);
|
||||
const resumed = updateThreadHead(suspended, "NEWHEAD01234567");
|
||||
expect(resumed).toEqual({
|
||||
head: "NEWHEAD01234567",
|
||||
suspendedRole: null,
|
||||
suspendMessage: null,
|
||||
});
|
||||
});
|
||||
|
||||
test("parseThreadsIndex round-trip", () => {
|
||||
const raw = {
|
||||
"01THREAD0000000000000001": "HEAD00000000001",
|
||||
"01THREAD0000000000000002": {
|
||||
head: "HEAD00000000002",
|
||||
suspendedRole: "reviewer",
|
||||
suspendMessage: "Need input",
|
||||
},
|
||||
};
|
||||
const parsed = parseThreadsIndex(raw);
|
||||
expect(serializeThreadsIndex(parsed)).toEqual(raw);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import type { StartNodePayload, StepRecord, Target } from "../types.js";
|
||||
|
||||
describe("Protocol types for thread/edge location", () => {
|
||||
describe("StartNodePayload", () => {
|
||||
test("has required cwd field", () => {
|
||||
const payload: StartNodePayload = {
|
||||
workflow: "0123456789ABC",
|
||||
prompt: "Test prompt",
|
||||
cwd: "/home/user/project",
|
||||
};
|
||||
|
||||
expect(payload.cwd).toBe("/home/user/project");
|
||||
expect(typeof payload.cwd).toBe("string");
|
||||
});
|
||||
});
|
||||
|
||||
describe("StepRecord", () => {
|
||||
test("has required cwd field", () => {
|
||||
const record: StepRecord = {
|
||||
role: "planner",
|
||||
output: "0123456789ABC",
|
||||
detail: "DEF0123456789",
|
||||
agent: "uwf-hermes",
|
||||
edgePrompt: "Plan the implementation",
|
||||
startedAtMs: Date.now(),
|
||||
completedAtMs: Date.now() + 1000,
|
||||
assembledPrompt: null,
|
||||
cwd: "/home/user/project",
|
||||
};
|
||||
|
||||
expect(record.cwd).toBe("/home/user/project");
|
||||
expect(typeof record.cwd).toBe("string");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Target", () => {
|
||||
test("has location field that accepts string", () => {
|
||||
const target: Target = {
|
||||
role: "coder",
|
||||
prompt: "Implement the code",
|
||||
location: "/custom/path",
|
||||
};
|
||||
|
||||
expect(target.location).toBe("/custom/path");
|
||||
expect(typeof target.location).toBe("string");
|
||||
});
|
||||
|
||||
test("has location field that accepts null", () => {
|
||||
const target: Target = {
|
||||
role: "coder",
|
||||
prompt: "Implement the code",
|
||||
location: null,
|
||||
};
|
||||
|
||||
expect(target.location).toBe(null);
|
||||
});
|
||||
|
||||
test("location supports mustache template syntax", () => {
|
||||
const target: Target = {
|
||||
role: "coder",
|
||||
prompt: "Implement the code",
|
||||
location: "{{{repoPath}}}",
|
||||
};
|
||||
|
||||
expect(target.location).toBe("{{{repoPath}}}");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user