Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ See [Tuning your reviews](https://gittensory.aethereal.dev/docs/tuning) for the
| Website | [gittensory.aethereal.dev](https://gittensory.aethereal.dev/) |
| Docs | [gittensory.aethereal.dev/docs](https://gittensory.aethereal.dev/docs) |
| MCP package | [@jsonbored/gittensory-mcp](https://www.npmjs.com/package/@jsonbored/gittensory-mcp) |
| Engine package | [`@jsonbored/gittensory-engine`](packages/gittensory-engine/README.md) — shared deterministic logic for the review stack and miner |
| Miner package | [`@jsonbored/gittensory-miner`](packages/gittensory-miner/README.md) — local foundation CLI for the autonomous miner runtime |
| API | [API browser](https://gittensory.aethereal.dev/api) and [OpenAPI JSON](https://gittensory-api.aethereal.dev/openapi.json) |
| GitHub App | [Install](https://github.com/apps/gittensory/installations/new) and [setup docs](https://gittensory.aethereal.dev/docs/github-app) |
| Browser extension | [Extension page](https://gittensory.aethereal.dev/extension) |
Expand Down
1 change: 1 addition & 0 deletions packages/gittensory-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ dashboard progress summaries:
- `hasPlanPendingSteps(plan)` — any step is `pending`
- `hasPlanRunningSteps(plan)` — any step is `running`
- `hasPlanSkippedSteps(plan)` — any step is `skipped`
- `hasPlanCompletedSteps(plan)` — any step is `completed`

## Opportunity competition

Expand Down
1 change: 1 addition & 0 deletions packages/gittensory-engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export { hasPlanFailedSteps } from "./plan-failure.js";
export { hasPlanPendingSteps } from "./plan-pending.js";
export { hasPlanRunningSteps } from "./plan-running.js";
export { hasPlanSkippedSteps } from "./plan-skipped.js";
export { hasPlanCompletedSteps } from "./plan-completed.js";
export * from "./plan-templates.js";
export * from "./portfolio/queue.js";
export {
Expand Down
8 changes: 8 additions & 0 deletions packages/gittensory-engine/src/plan-completed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { PlanDag } from "./plan-export.js";

/**
* Return whether any step in the plan is completed. Pure — reads the plan DAG only.
*/
export function hasPlanCompletedSteps(plan: PlanDag): boolean {
return plan.steps.some((step) => step.status === "completed");
}
54 changes: 54 additions & 0 deletions test/unit/plan-completed.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { describe, expect, it } from "vitest";

import { hasPlanCompletedSteps } from "../../packages/gittensory-engine/src/plan-completed";
import type { PlanStep } from "../../packages/gittensory-engine/src/plan-export";

function step(over: Partial<PlanStep> & { id: string; title: string }): PlanStep {
return {
actionClass: undefined,
dependsOn: [],
status: "pending",
attempts: 0,
maxAttempts: 3,
lastError: null,
...over,
};
}

describe("hasPlanCompletedSteps", () => {
it("returns false for an empty plan", () => {
expect(hasPlanCompletedSteps({ steps: [] })).toBe(false);
});

it("returns false when no step is completed", () => {
expect(
hasPlanCompletedSteps({
steps: [
step({ id: "a", title: "Build", status: "pending" }),
step({ id: "b", title: "Test", status: "running" }),
],
}),
).toBe(false);
});

it("returns true when at least one step is completed", () => {
expect(
hasPlanCompletedSteps({
steps: [
step({ id: "a", title: "Build", status: "completed" }),
step({ id: "b", title: "Test", status: "pending" }),
],
}),
).toBe(true);
});

it("is exported from the package barrel", async () => {
const barrel = await import("../../packages/gittensory-engine/src/index");
expect(typeof barrel.hasPlanCompletedSteps).toBe("function");
expect(
barrel.hasPlanCompletedSteps({
steps: [step({ id: "a", title: "A", status: "completed" })],
}),
).toBe(true);
});
});
Loading