refactor: meta workflow targets ~/.upulse/engine/ instead of pulse repo
CI / test (push) Has been cancelled

- ENGINE_DIR = ~/.upulse/engine for meta coder/reviewer/tester/promoter
- REPO_DIR still used for coding workflow
- Tester accepts buildCmd/testCmd opts, no longer hardcoded to monorepo paths
- Init engine dir with package.json + tsconfig.json + git repo
This commit is contained in:
2026-04-17 14:12:47 +00:00
parent f88d325db8
commit ee1c0cc9c0
2 changed files with 17 additions and 10 deletions
+11 -7
View File
@@ -29,10 +29,13 @@ import { createWorkflowRule } from '../workflows/workflow-rule-adapter.js';
const REPO_DIR = join(import.meta.dir, '../../../..'); const REPO_DIR = join(import.meta.dir, '../../../..');
const DATA_DIR = join(homedir(), '.upulse/scopes'); const DATA_DIR = join(homedir(), '.upulse/scopes');
const ENGINE_DIR = join(homedir(), '.upulse/engine');
const TICK_INTERVAL_MS = 30_000; // 30 seconds const TICK_INTERVAL_MS = 30_000; // 30 seconds
// Ensure data dir // Ensure dirs
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR, { recursive: true }); for (const d of [DATA_DIR, ENGINE_DIR]) {
if (!existsSync(d)) mkdirSync(d, { recursive: true });
}
// ── LLM + Cursor ─────────────────────────────────────────────── // ── LLM + Cursor ───────────────────────────────────────────────
@@ -76,12 +79,12 @@ const codingRule = createWorkflowRule(codingWf, store, logStore, {
// 2. Meta workflow (real LLM + Cursor roles) // 2. Meta workflow (real LLM + Cursor roles)
const metaWf = createMetaWorkflow({ const metaWf = createMetaWorkflow({
architect: createMetaArchitectRole(llm), architect: createMetaArchitectRole(llm),
coder: createMetaCoderRole(cursorRunner, llm, REPO_DIR), coder: createMetaCoderRole(cursorRunner, llm, ENGINE_DIR),
reviewer: createMetaReviewerRole(cursorRunner, llm, REPO_DIR), reviewer: createMetaReviewerRole(cursorRunner, llm, ENGINE_DIR),
tester: createMetaTesterRole(llm, { repoDir: REPO_DIR }), tester: createMetaTesterRole(llm, { repoDir: ENGINE_DIR }),
promoter: createMetaPromoterRole({ promoter: createMetaPromoterRole({
repoDir: REPO_DIR, repoDir: ENGINE_DIR,
remote: 'gitflare', remote: 'origin',
branch: 'main', branch: 'main',
}), }),
}); });
@@ -93,6 +96,7 @@ const tick = createWorkflowTicker([codingRule, metaRule]);
console.log('🍊 Pulse Workflow Daemon started'); console.log('🍊 Pulse Workflow Daemon started');
console.log(` Repo: ${REPO_DIR}`); console.log(` Repo: ${REPO_DIR}`);
console.log(` Engine: ${ENGINE_DIR}`);
console.log(` Store: ${DATA_DIR}/workflows.db`); console.log(` Store: ${DATA_DIR}/workflows.db`);
console.log(` Tick interval: ${TICK_INTERVAL_MS / 1000}s`); console.log(` Tick interval: ${TICK_INTERVAL_MS / 1000}s`);
console.log(` Workflows: coding, meta`); console.log(` Workflows: coding, meta`);
@@ -39,8 +39,11 @@ const JUDGE_TOOL = {
export function createMetaTesterRole( export function createMetaTesterRole(
llm: LlmClient, llm: LlmClient,
opts: { repoDir: string }, opts: { repoDir: string; buildCmd?: string; testCmd?: string },
): Role<MetaTesterMeta> { ): Role<MetaTesterMeta> {
const buildCmd = opts.buildCmd ?? 'bun run build 2>&1';
const testCmd = opts.testCmd ?? 'bun test 2>&1';
return async ( return async (
_chain: WorkflowMessage[], _chain: WorkflowMessage[],
): Promise<RoleResult<MetaTesterMeta>> => { ): Promise<RoleResult<MetaTesterMeta>> => {
@@ -48,9 +51,9 @@ export function createMetaTesterRole(
let testOutput: string; let testOutput: string;
try { try {
testOutput = execSync( testOutput = execSync(
'bun run build 2>&1 && cd ../.. && bun test packages/pulse/src/workflows/ 2>&1', `${buildCmd} && ${testCmd}`,
{ {
cwd: join(opts.repoDir, 'packages/pulse'), cwd: opts.repoDir,
timeout: 60_000, timeout: 60_000,
encoding: 'utf-8', encoding: 'utf-8',
}, },