pi-crew 0.1.46 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/agents/analyst.md +11 -11
- package/agents/critic.md +11 -11
- package/agents/executor.md +11 -11
- package/agents/explorer.md +11 -11
- package/agents/planner.md +11 -11
- package/agents/reviewer.md +11 -11
- package/agents/security-reviewer.md +11 -11
- package/agents/test-engineer.md +11 -11
- package/agents/verifier.md +11 -11
- package/agents/writer.md +11 -11
- package/docs/next-upgrade-roadmap.md +117 -42
- package/docs/refactor-tasks-phase3.md +394 -394
- package/docs/refactor-tasks-phase4.md +564 -564
- package/docs/refactor-tasks-phase5.md +402 -402
- package/docs/refactor-tasks-phase6.md +662 -662
- package/docs/research/AGENT-EXECUTION-ARCHITECTURE.md +261 -0
- package/docs/research/AGENT-LIFECYCLE-COMPARISON.md +111 -0
- package/docs/research/AUDIT_OH_MY_PI.md +261 -0
- package/docs/research/AUDIT_PI_CREW.md +457 -0
- package/docs/research/CAVEMAN-DEEP-RESEARCH.md +281 -0
- package/docs/research/COMPARISON_OH_MY_PI_VS_PI_CREW.md +264 -0
- package/docs/research/DEEP-RESEARCH-PI-POWERBAR.md +343 -0
- package/docs/research/DEEP_RESEARCH_SUBAGENT_ARCHITECTURE.md +480 -0
- package/docs/research/GAP_CLOSURE_IMPLEMENTATION_PLAN.md +354 -0
- package/docs/research/IMPLEMENTATION_PLAN.md +385 -0
- package/docs/research/LIVE-SESSION-PRODUCTION-READY-PLAN.md +502 -0
- package/docs/research/OH-MY-PI-DEEP-RESEARCH-v14.7.6.md +266 -0
- package/docs/research/REMAINING-GAPS-PLAN.md +363 -0
- package/docs/research/SESSION-SUMMARY-2026-05-08.md +146 -0
- package/docs/research/UI-RESPONSIVENESS-AUDIT.md +173 -0
- package/docs/research-awesome-agent-skills-distillation.md +100 -100
- package/docs/research-extension-examples.md +297 -297
- package/docs/research-extension-system.md +324 -324
- package/docs/research-oh-my-pi-distillation.md +56 -9
- package/docs/research-optimization-plan.md +548 -548
- package/docs/research-phase10-distillation.md +198 -198
- package/docs/research-phase11-distillation.md +201 -201
- package/docs/research-pi-coding-agent.md +357 -357
- package/docs/research-source-pi-crew-reference.md +174 -174
- package/docs/runtime-flow.md +148 -148
- package/docs/source-runtime-refactor-map.md +107 -107
- package/index.ts +6 -6
- package/package.json +99 -98
- package/schema.json +8 -0
- package/skills/async-worker-recovery/SKILL.md +42 -42
- package/skills/context-artifact-hygiene/SKILL.md +52 -52
- package/skills/delegation-patterns/SKILL.md +54 -54
- package/skills/mailbox-interactive/SKILL.md +40 -40
- package/skills/model-routing-context/SKILL.md +39 -39
- package/skills/multi-perspective-review/SKILL.md +58 -58
- package/skills/observability-reliability/SKILL.md +41 -41
- package/skills/orchestration/SKILL.md +157 -0
- package/skills/ownership-session-security/SKILL.md +41 -41
- package/skills/pi-extension-lifecycle/SKILL.md +39 -39
- package/skills/requirements-to-task-packet/SKILL.md +63 -63
- package/skills/resource-discovery-config/SKILL.md +41 -41
- package/skills/runtime-state-reader/SKILL.md +44 -44
- package/skills/secure-agent-orchestration-review/SKILL.md +45 -45
- package/skills/state-mutation-locking/SKILL.md +42 -42
- package/skills/systematic-debugging/SKILL.md +67 -67
- package/skills/ui-render-performance/SKILL.md +39 -39
- package/skills/verification-before-done/SKILL.md +57 -57
- package/skills/worktree-isolation/SKILL.md +39 -39
- package/src/agents/agent-config.ts +6 -0
- package/src/agents/agent-search.ts +98 -0
- package/src/agents/agent-serializer.ts +4 -0
- package/src/agents/discover-agents.ts +17 -4
- package/src/config/config.ts +24 -0
- package/src/config/defaults.ts +11 -0
- package/src/extension/autonomous-policy.ts +26 -33
- package/src/extension/cross-extension-rpc.ts +82 -82
- package/src/extension/help.ts +1 -0
- package/src/extension/management.ts +5 -0
- package/src/extension/register.ts +58 -13
- package/src/extension/registration/commands.ts +33 -1
- package/src/extension/registration/compaction-guard.ts +125 -125
- package/src/extension/registration/team-tool.ts +6 -4
- package/src/extension/run-bundle-schema.ts +89 -89
- package/src/extension/run-index.ts +24 -18
- package/src/extension/run-maintenance.ts +68 -62
- package/src/extension/team-tool/api.ts +23 -2
- package/src/extension/team-tool/cancel.ts +86 -11
- package/src/extension/team-tool/context.ts +3 -0
- package/src/extension/team-tool/handle-settings.ts +188 -188
- package/src/extension/team-tool/inspect.ts +41 -41
- package/src/extension/team-tool/intent-policy.ts +42 -0
- package/src/extension/team-tool/lifecycle-actions.ts +47 -18
- package/src/extension/team-tool/parallel-dispatch.ts +156 -0
- package/src/extension/team-tool/plan.ts +19 -19
- package/src/extension/team-tool/respond.ts +10 -2
- package/src/extension/team-tool/run.ts +3 -2
- package/src/extension/team-tool/status.ts +1 -1
- package/src/extension/team-tool-types.ts +1 -0
- package/src/extension/team-tool.ts +13 -3
- package/src/hooks/registry.ts +61 -0
- package/src/hooks/types.ts +41 -0
- package/src/i18n.ts +184 -184
- package/src/observability/exporters/otlp-exporter.ts +77 -77
- package/src/prompt/prompt-runtime.ts +72 -72
- package/src/runtime/agent-control.ts +108 -2
- package/src/runtime/agent-memory.ts +72 -72
- package/src/runtime/agent-observability.ts +114 -114
- package/src/runtime/async-marker.ts +26 -26
- package/src/runtime/async-runner.ts +3 -1
- package/src/runtime/attention-events.ts +28 -28
- package/src/runtime/background-runner.ts +19 -0
- package/src/runtime/cancellation-token.ts +89 -0
- package/src/runtime/cancellation.ts +61 -51
- package/src/runtime/capability-inventory.ts +116 -0
- package/src/runtime/child-pi.ts +2 -1
- package/src/runtime/code-summary.ts +247 -0
- package/src/runtime/completion-guard.ts +190 -190
- package/src/runtime/crash-recovery.ts +181 -0
- package/src/runtime/crew-agent-records.ts +35 -7
- package/src/runtime/crew-agent-runtime.ts +1 -0
- package/src/runtime/custom-tools/irc-tool.ts +201 -0
- package/src/runtime/custom-tools/submit-result-tool.ts +90 -0
- package/src/runtime/delivery-coordinator.ts +3 -1
- package/src/runtime/direct-run.ts +35 -35
- package/src/runtime/effectiveness.ts +81 -76
- package/src/runtime/event-stream-bridge.ts +90 -0
- package/src/runtime/foreground-control.ts +82 -82
- package/src/runtime/green-contract.ts +46 -46
- package/src/runtime/group-join.ts +106 -106
- package/src/runtime/heartbeat-gradient.ts +28 -28
- package/src/runtime/heartbeat-watcher.ts +124 -124
- package/src/runtime/live-agent-control.ts +88 -88
- package/src/runtime/live-agent-manager.ts +78 -2
- package/src/runtime/live-control-realtime.ts +36 -36
- package/src/runtime/live-extension-bridge.ts +150 -0
- package/src/runtime/live-irc.ts +92 -0
- package/src/runtime/live-session-health.ts +100 -0
- package/src/runtime/live-session-runtime.ts +297 -7
- package/src/runtime/mcp-proxy.ts +113 -0
- package/src/runtime/notebook-helpers.ts +90 -0
- package/src/runtime/orphan-sentinel.ts +7 -0
- package/src/runtime/output-validator.ts +187 -0
- package/src/runtime/parallel-research.ts +44 -44
- package/src/runtime/parallel-utils.ts +57 -0
- package/src/runtime/parent-guard.ts +80 -0
- package/src/runtime/pi-json-output.ts +111 -111
- package/src/runtime/policy-engine.ts +79 -79
- package/src/runtime/progress-event-coalescer.ts +43 -43
- package/src/runtime/prose-compressor.ts +164 -0
- package/src/runtime/recovery-recipes.ts +74 -74
- package/src/runtime/result-extractor.ts +121 -0
- package/src/runtime/role-permission.ts +39 -39
- package/src/runtime/runtime-resolver.ts +1 -4
- package/src/runtime/semaphore.ts +131 -0
- package/src/runtime/sensitive-paths.ts +92 -0
- package/src/runtime/session-resources.ts +25 -25
- package/src/runtime/session-snapshot.ts +59 -59
- package/src/runtime/session-usage.ts +79 -79
- package/src/runtime/sidechain-output.ts +29 -29
- package/src/runtime/stream-preview.ts +177 -0
- package/src/runtime/subagent-manager.ts +3 -2
- package/src/runtime/subprocess-tool-registry.ts +67 -0
- package/src/runtime/supervisor-contact.ts +59 -59
- package/src/runtime/task-display.ts +38 -38
- package/src/runtime/task-output-context.ts +59 -9
- package/src/runtime/task-runner/capabilities.ts +78 -78
- package/src/runtime/task-runner/live-executor.ts +2 -0
- package/src/runtime/task-runner/progress.ts +119 -119
- package/src/runtime/task-runner/prompt-builder.ts +70 -8
- package/src/runtime/task-runner/prompt-pipeline.ts +64 -64
- package/src/runtime/task-runner/result-utils.ts +14 -14
- package/src/runtime/task-runner/run-projection.ts +104 -0
- package/src/runtime/task-runner/state-helpers.ts +22 -22
- package/src/runtime/task-runner.ts +75 -4
- package/src/runtime/team-runner.ts +60 -8
- package/src/runtime/worker-heartbeat.ts +21 -21
- package/src/runtime/worker-startup.ts +57 -57
- package/src/runtime/workspace-tree.ts +298 -0
- package/src/runtime/yield-handler.ts +189 -0
- package/src/schema/config-schema.ts +6 -0
- package/src/schema/team-tool-schema.ts +11 -1
- package/src/skills/discover-skills.ts +67 -0
- package/src/state/active-run-registry.ts +4 -2
- package/src/state/artifact-store.ts +4 -1
- package/src/state/atomic-write.ts +50 -1
- package/src/state/blob-store.ts +117 -0
- package/src/state/contracts.ts +1 -0
- package/src/state/event-log-rotation.ts +158 -0
- package/src/state/event-log.ts +52 -2
- package/src/state/mailbox.ts +87 -7
- package/src/state/state-store.ts +24 -4
- package/src/state/task-claims.ts +44 -44
- package/src/state/types.ts +20 -0
- package/src/state/usage.ts +29 -29
- package/src/subagents/async-entry.ts +1 -1
- package/src/subagents/index.ts +3 -3
- package/src/subagents/live/control.ts +1 -1
- package/src/subagents/live/manager.ts +1 -1
- package/src/subagents/live/realtime.ts +1 -1
- package/src/subagents/live/session-runtime.ts +1 -1
- package/src/subagents/manager.ts +1 -1
- package/src/subagents/spawn.ts +1 -1
- package/src/teams/team-serializer.ts +38 -38
- package/src/types/diff.d.ts +18 -18
- package/src/ui/agent-management-overlay.ts +144 -0
- package/src/ui/crew-footer.ts +101 -101
- package/src/ui/crew-select-list.ts +111 -111
- package/src/ui/crew-widget.ts +11 -2
- package/src/ui/dashboard-panes/cancellation-pane.ts +43 -0
- package/src/ui/dashboard-panes/capability-pane.ts +60 -0
- package/src/ui/dashboard-panes/mailbox-pane.ts +35 -11
- package/src/ui/dashboard-panes/metrics-pane.ts +34 -34
- package/src/ui/dynamic-border.ts +25 -25
- package/src/ui/layout-primitives.ts +106 -106
- package/src/ui/live-run-sidebar.ts +4 -0
- package/src/ui/loaders.ts +158 -158
- package/src/ui/powerbar-publisher.ts +77 -15
- package/src/ui/render-coalescer.ts +51 -0
- package/src/ui/render-diff.ts +119 -119
- package/src/ui/render-scheduler.ts +143 -143
- package/src/ui/run-dashboard.ts +4 -0
- package/src/ui/run-event-bus.ts +209 -0
- package/src/ui/run-snapshot-cache.ts +68 -16
- package/src/ui/snapshot-types.ts +8 -0
- package/src/ui/spinner.ts +17 -17
- package/src/ui/status-colors.ts +58 -58
- package/src/ui/syntax-highlight.ts +116 -116
- package/src/ui/transcript-entries.ts +258 -0
- package/src/utils/atomic-write.ts +33 -33
- package/src/utils/completion-dedupe.ts +63 -63
- package/src/utils/frontmatter.ts +68 -68
- package/src/utils/git.ts +262 -262
- package/src/utils/ids.ts +17 -12
- package/src/utils/incremental-reader.ts +104 -0
- package/src/utils/names.ts +27 -27
- package/src/utils/redaction.ts +44 -44
- package/src/utils/safe-paths.ts +47 -47
- package/src/utils/scan-cache.ts +137 -0
- package/src/utils/sleep.ts +32 -32
- package/src/utils/sse-parser.ts +134 -0
- package/src/utils/task-name-generator.ts +337 -0
- package/src/utils/visual.ts +33 -2
- package/src/workflows/validate-workflow.ts +40 -40
- package/src/worktree/branch-freshness.ts +45 -45
- package/src/worktree/cleanup.ts +2 -1
- package/teams/default.team.md +12 -12
- package/teams/fast-fix.team.md +11 -11
- package/teams/implementation.team.md +18 -18
- package/teams/parallel-research.team.md +14 -14
- package/teams/research.team.md +11 -11
- package/teams/review.team.md +12 -12
- package/workflows/default.workflow.md +29 -29
- package/workflows/fast-fix.workflow.md +22 -22
- package/workflows/implementation.workflow.md +38 -38
- package/workflows/parallel-research.workflow.md +46 -46
- package/workflows/research.workflow.md +22 -22
- package/workflows/review.workflow.md +30 -30
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** A single Server-Sent Event */
|
|
2
|
+
export interface ServerSentEvent {
|
|
3
|
+
event: string | null;
|
|
4
|
+
data: string;
|
|
5
|
+
raw: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** L1: Maximum number of raw lines before discarding an oversized event. */
|
|
9
|
+
const MAX_EVENT_LINES = 1000;
|
|
10
|
+
|
|
11
|
+
/** Read newline-delimited lines from a text ReadableStream, buffering partial chunks. */
|
|
12
|
+
async function* readLines(
|
|
13
|
+
stream: ReadableStream<string>,
|
|
14
|
+
signal?: AbortSignal,
|
|
15
|
+
): AsyncGenerator<string> {
|
|
16
|
+
const reader = stream.getReader();
|
|
17
|
+
let buffer = "";
|
|
18
|
+
try {
|
|
19
|
+
while (true) {
|
|
20
|
+
if (signal?.aborted) return;
|
|
21
|
+
const { done, value } = await reader.read();
|
|
22
|
+
if (done) {
|
|
23
|
+
if (buffer.length > 0) yield buffer;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
buffer += value;
|
|
27
|
+
let idx: number;
|
|
28
|
+
while ((idx = buffer.indexOf("\n")) !== -1) {
|
|
29
|
+
const line = buffer.endsWith("\r\n", idx + 1)
|
|
30
|
+
? buffer.slice(0, idx - 1)
|
|
31
|
+
: buffer.slice(0, idx);
|
|
32
|
+
yield line;
|
|
33
|
+
buffer = buffer.slice(idx + 1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} finally {
|
|
37
|
+
reader.releaseLock();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Parse SSE events from a byte stream */
|
|
42
|
+
export async function* readSseEvents(
|
|
43
|
+
stream: ReadableStream<Uint8Array>,
|
|
44
|
+
signal?: AbortSignal,
|
|
45
|
+
): AsyncGenerator<ServerSentEvent> {
|
|
46
|
+
const textStream = stream.pipeThrough(new TextDecoderStream() as unknown as TransformStream<Uint8Array, string>);
|
|
47
|
+
let currentEvent: string | null = null;
|
|
48
|
+
let currentData: string[] = [];
|
|
49
|
+
let currentRaw: string[] = [];
|
|
50
|
+
|
|
51
|
+
function flush(): ServerSentEvent | null {
|
|
52
|
+
if (currentData.length === 0 && currentEvent === null) return null;
|
|
53
|
+
const evt: ServerSentEvent = {
|
|
54
|
+
event: currentEvent,
|
|
55
|
+
data: currentData.join("\n"),
|
|
56
|
+
raw: currentRaw,
|
|
57
|
+
};
|
|
58
|
+
currentEvent = null;
|
|
59
|
+
currentData = [];
|
|
60
|
+
currentRaw = [];
|
|
61
|
+
return evt;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for await (const line of readLines(textStream, signal)) {
|
|
65
|
+
if (signal?.aborted) return;
|
|
66
|
+
|
|
67
|
+
// Empty line → dispatch
|
|
68
|
+
if (line === "") {
|
|
69
|
+
const evt = flush();
|
|
70
|
+
if (evt) yield evt;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Comment
|
|
75
|
+
if (line.startsWith(":")) continue;
|
|
76
|
+
|
|
77
|
+
// [DONE] sentinel
|
|
78
|
+
if (line === "[DONE]") return;
|
|
79
|
+
|
|
80
|
+
const colonIdx = line.indexOf(":");
|
|
81
|
+
if (colonIdx === -1) {
|
|
82
|
+
// Field with no value
|
|
83
|
+
const field = line;
|
|
84
|
+
if (field === "event") {
|
|
85
|
+
currentEvent = "";
|
|
86
|
+
} else if (field === "data") {
|
|
87
|
+
currentData.push("");
|
|
88
|
+
}
|
|
89
|
+
currentRaw.push(line);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const field = line.slice(0, colonIdx);
|
|
94
|
+
let value = line.slice(colonIdx + 1);
|
|
95
|
+
// Remove leading space after colon per SSE spec
|
|
96
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
97
|
+
|
|
98
|
+
currentRaw.push(line);
|
|
99
|
+
|
|
100
|
+
// L1: Guard against unbounded memory growth
|
|
101
|
+
if (currentRaw.length > MAX_EVENT_LINES) {
|
|
102
|
+
const evt = flush();
|
|
103
|
+
if (evt) yield evt;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (field === "event") {
|
|
108
|
+
currentEvent = value;
|
|
109
|
+
} else if (field === "data") {
|
|
110
|
+
currentData.push(value);
|
|
111
|
+
}
|
|
112
|
+
// id / retry fields ignored
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Flush any remaining event at end of stream
|
|
116
|
+
const evt = flush();
|
|
117
|
+
if (evt) yield evt;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Parse SSE events and yield parsed JSON data objects */
|
|
121
|
+
export async function* readSseJson<T>(
|
|
122
|
+
stream: ReadableStream<Uint8Array>,
|
|
123
|
+
signal?: AbortSignal,
|
|
124
|
+
): AsyncGenerator<T> {
|
|
125
|
+
for await (const evt of readSseEvents(stream, signal)) {
|
|
126
|
+
try {
|
|
127
|
+
const parsed: T = JSON.parse(evt.data) as T;
|
|
128
|
+
yield parsed;
|
|
129
|
+
} catch {
|
|
130
|
+
// Skip non-JSON SSE data events (e.g., ping, error messages, sentinels)
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable task name generator.
|
|
3
|
+
* Format: AdjectiveNoun (e.g., "SwiftFalcon", "CalmPanda")
|
|
4
|
+
*
|
|
5
|
+
* Curated lists of ~120 adjectives and ~120 animals/nouns.
|
|
6
|
+
* 120 × 120 = 14,400 combinations.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const ADJECTIVES = [
|
|
10
|
+
"active",
|
|
11
|
+
"agile",
|
|
12
|
+
"alert",
|
|
13
|
+
"ancient",
|
|
14
|
+
"bold",
|
|
15
|
+
"brave",
|
|
16
|
+
"bright",
|
|
17
|
+
"brilliant",
|
|
18
|
+
"calm",
|
|
19
|
+
"capable",
|
|
20
|
+
"careful",
|
|
21
|
+
"charming",
|
|
22
|
+
"cheerful",
|
|
23
|
+
"clever",
|
|
24
|
+
"cloudy",
|
|
25
|
+
"cold",
|
|
26
|
+
"cool",
|
|
27
|
+
"curious",
|
|
28
|
+
"cute",
|
|
29
|
+
"daring",
|
|
30
|
+
"dark",
|
|
31
|
+
"deep",
|
|
32
|
+
"direct",
|
|
33
|
+
"eager",
|
|
34
|
+
"early",
|
|
35
|
+
"electric",
|
|
36
|
+
"elegant",
|
|
37
|
+
"energetic",
|
|
38
|
+
"enormous",
|
|
39
|
+
"epic",
|
|
40
|
+
"exact",
|
|
41
|
+
"exotic",
|
|
42
|
+
"fair",
|
|
43
|
+
"fancy",
|
|
44
|
+
"fast",
|
|
45
|
+
"fierce",
|
|
46
|
+
"firm",
|
|
47
|
+
"flat",
|
|
48
|
+
"flexible",
|
|
49
|
+
"fresh",
|
|
50
|
+
"friendly",
|
|
51
|
+
"full",
|
|
52
|
+
"fun",
|
|
53
|
+
"funny",
|
|
54
|
+
"gentle",
|
|
55
|
+
"global",
|
|
56
|
+
"golden",
|
|
57
|
+
"good",
|
|
58
|
+
"grand",
|
|
59
|
+
"grateful",
|
|
60
|
+
"great",
|
|
61
|
+
"green",
|
|
62
|
+
"happy",
|
|
63
|
+
"hard",
|
|
64
|
+
"heavy",
|
|
65
|
+
"hidden",
|
|
66
|
+
"honest",
|
|
67
|
+
"hot",
|
|
68
|
+
"huge",
|
|
69
|
+
"icy",
|
|
70
|
+
"ideal",
|
|
71
|
+
"keen",
|
|
72
|
+
"kind",
|
|
73
|
+
"large",
|
|
74
|
+
"lazy",
|
|
75
|
+
"light",
|
|
76
|
+
"lively",
|
|
77
|
+
"local",
|
|
78
|
+
"loud",
|
|
79
|
+
"lucky",
|
|
80
|
+
"magic",
|
|
81
|
+
"mighty",
|
|
82
|
+
"mild",
|
|
83
|
+
"modern",
|
|
84
|
+
"neat",
|
|
85
|
+
"new",
|
|
86
|
+
"nice",
|
|
87
|
+
"noble",
|
|
88
|
+
"odd",
|
|
89
|
+
"old",
|
|
90
|
+
"open",
|
|
91
|
+
"patient",
|
|
92
|
+
"perfect",
|
|
93
|
+
"plain",
|
|
94
|
+
"polite",
|
|
95
|
+
"popular",
|
|
96
|
+
"powerful",
|
|
97
|
+
"precise",
|
|
98
|
+
"pretty",
|
|
99
|
+
"proud",
|
|
100
|
+
"pure",
|
|
101
|
+
"quick",
|
|
102
|
+
"quiet",
|
|
103
|
+
"rapid",
|
|
104
|
+
"rare",
|
|
105
|
+
"real",
|
|
106
|
+
"rich",
|
|
107
|
+
"robust",
|
|
108
|
+
"round",
|
|
109
|
+
"royal",
|
|
110
|
+
"safe",
|
|
111
|
+
"sharp",
|
|
112
|
+
"short",
|
|
113
|
+
"shy",
|
|
114
|
+
"silent",
|
|
115
|
+
"simple",
|
|
116
|
+
"slim",
|
|
117
|
+
"smart",
|
|
118
|
+
"smooth",
|
|
119
|
+
"soft",
|
|
120
|
+
"solar",
|
|
121
|
+
"solid",
|
|
122
|
+
"steady",
|
|
123
|
+
"strange",
|
|
124
|
+
"strong",
|
|
125
|
+
"sunny",
|
|
126
|
+
"swift",
|
|
127
|
+
"tall",
|
|
128
|
+
"tame",
|
|
129
|
+
"tiny",
|
|
130
|
+
"tough",
|
|
131
|
+
"true",
|
|
132
|
+
"unique",
|
|
133
|
+
"vast",
|
|
134
|
+
"warm",
|
|
135
|
+
"wild",
|
|
136
|
+
"wise",
|
|
137
|
+
"zany",
|
|
138
|
+
"zen",
|
|
139
|
+
] as const;
|
|
140
|
+
|
|
141
|
+
const NOUNS = [
|
|
142
|
+
"albatross",
|
|
143
|
+
"ant",
|
|
144
|
+
"antelope",
|
|
145
|
+
"ape",
|
|
146
|
+
"archer",
|
|
147
|
+
"badger",
|
|
148
|
+
"bass",
|
|
149
|
+
"bat",
|
|
150
|
+
"bear",
|
|
151
|
+
"beaver",
|
|
152
|
+
"bee",
|
|
153
|
+
"beetle",
|
|
154
|
+
"bird",
|
|
155
|
+
"bison",
|
|
156
|
+
"boar",
|
|
157
|
+
"bobcat",
|
|
158
|
+
"bull",
|
|
159
|
+
"buzzard",
|
|
160
|
+
"camel",
|
|
161
|
+
"canary",
|
|
162
|
+
"carp",
|
|
163
|
+
"cat",
|
|
164
|
+
"cedar",
|
|
165
|
+
"cheetah",
|
|
166
|
+
"chicken",
|
|
167
|
+
"cobra",
|
|
168
|
+
"cod",
|
|
169
|
+
"condor",
|
|
170
|
+
"coral",
|
|
171
|
+
"cougar",
|
|
172
|
+
"crab",
|
|
173
|
+
"crane",
|
|
174
|
+
"cricket",
|
|
175
|
+
"crow",
|
|
176
|
+
"deer",
|
|
177
|
+
"dolphin",
|
|
178
|
+
"dove",
|
|
179
|
+
"dragon",
|
|
180
|
+
"duck",
|
|
181
|
+
"eagle",
|
|
182
|
+
"eel",
|
|
183
|
+
"elk",
|
|
184
|
+
"falcon",
|
|
185
|
+
"ferret",
|
|
186
|
+
"finch",
|
|
187
|
+
"flamingo",
|
|
188
|
+
"fox",
|
|
189
|
+
"frog",
|
|
190
|
+
"gazelle",
|
|
191
|
+
"gecko",
|
|
192
|
+
"ghost",
|
|
193
|
+
"gibbon",
|
|
194
|
+
"goat",
|
|
195
|
+
"goldfish",
|
|
196
|
+
"goose",
|
|
197
|
+
"gorilla",
|
|
198
|
+
"halibut",
|
|
199
|
+
"hamster",
|
|
200
|
+
"hare",
|
|
201
|
+
"hawk",
|
|
202
|
+
"heron",
|
|
203
|
+
"horse",
|
|
204
|
+
"hummingbird",
|
|
205
|
+
"hyena",
|
|
206
|
+
"ibis",
|
|
207
|
+
"iguana",
|
|
208
|
+
"impala",
|
|
209
|
+
"jackal",
|
|
210
|
+
"jaguar",
|
|
211
|
+
"jay",
|
|
212
|
+
"jellyfish",
|
|
213
|
+
"kangaroo",
|
|
214
|
+
"kite",
|
|
215
|
+
"kiwi",
|
|
216
|
+
"koala",
|
|
217
|
+
"krill",
|
|
218
|
+
"lark",
|
|
219
|
+
"lemur",
|
|
220
|
+
"leopard",
|
|
221
|
+
"lion",
|
|
222
|
+
"lizard",
|
|
223
|
+
"llama",
|
|
224
|
+
"lobster",
|
|
225
|
+
"lynx",
|
|
226
|
+
"macaw",
|
|
227
|
+
"magnet",
|
|
228
|
+
"mammoth",
|
|
229
|
+
"marmot",
|
|
230
|
+
"mink",
|
|
231
|
+
"mole",
|
|
232
|
+
"monkey",
|
|
233
|
+
"moose",
|
|
234
|
+
"moth",
|
|
235
|
+
"mouse",
|
|
236
|
+
"newt",
|
|
237
|
+
"ocelot",
|
|
238
|
+
"octopus",
|
|
239
|
+
"orca",
|
|
240
|
+
"ostrich",
|
|
241
|
+
"otter",
|
|
242
|
+
"owl",
|
|
243
|
+
"ox",
|
|
244
|
+
"panda",
|
|
245
|
+
"panther",
|
|
246
|
+
"parrot",
|
|
247
|
+
"peacock",
|
|
248
|
+
"pelican",
|
|
249
|
+
"penguin",
|
|
250
|
+
"pike",
|
|
251
|
+
"pony",
|
|
252
|
+
"python",
|
|
253
|
+
"quail",
|
|
254
|
+
"rabbit",
|
|
255
|
+
"raccoon",
|
|
256
|
+
"ram",
|
|
257
|
+
"raven",
|
|
258
|
+
"robin",
|
|
259
|
+
"rook",
|
|
260
|
+
"sable",
|
|
261
|
+
"salmon",
|
|
262
|
+
"scorpion",
|
|
263
|
+
"seal",
|
|
264
|
+
"shark",
|
|
265
|
+
"sheep",
|
|
266
|
+
"snail",
|
|
267
|
+
"sparrow",
|
|
268
|
+
"spider",
|
|
269
|
+
"squid",
|
|
270
|
+
"squirrel",
|
|
271
|
+
"stork",
|
|
272
|
+
"swan",
|
|
273
|
+
"tiger",
|
|
274
|
+
"toad",
|
|
275
|
+
"tortoise",
|
|
276
|
+
"toucan",
|
|
277
|
+
"trout",
|
|
278
|
+
"tuna",
|
|
279
|
+
"turkey",
|
|
280
|
+
"turtle",
|
|
281
|
+
"viper",
|
|
282
|
+
"vulture",
|
|
283
|
+
"walrus",
|
|
284
|
+
"wasp",
|
|
285
|
+
"whale",
|
|
286
|
+
"wolf",
|
|
287
|
+
"wombat",
|
|
288
|
+
"woodpecker",
|
|
289
|
+
"wren",
|
|
290
|
+
"yak",
|
|
291
|
+
"zebra",
|
|
292
|
+
] as const;
|
|
293
|
+
|
|
294
|
+
function capitalize(s: string): string {
|
|
295
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
let usedNames = new Set<string>();
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Generate a unique two-word identifier (e.g., "SwiftFalcon").
|
|
302
|
+
* Resets and starts over if all combinations exhausted.
|
|
303
|
+
*/
|
|
304
|
+
export function generateTaskName(): string {
|
|
305
|
+
// Try random combinations first (50 attempts)
|
|
306
|
+
for (let attempt = 0; attempt < 50; attempt++) {
|
|
307
|
+
const adj = ADJECTIVES[Math.floor(Math.random() * ADJECTIVES.length)]!;
|
|
308
|
+
const noun = NOUNS[Math.floor(Math.random() * NOUNS.length)]!;
|
|
309
|
+
const name = `${capitalize(adj)}${capitalize(noun)}`;
|
|
310
|
+
if (!usedNames.has(name)) {
|
|
311
|
+
usedNames.add(name);
|
|
312
|
+
return name;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Exhaustive search if random fails
|
|
317
|
+
for (const adj of ADJECTIVES) {
|
|
318
|
+
for (const noun of NOUNS) {
|
|
319
|
+
const name = `${capitalize(adj)}${capitalize(noun)}`;
|
|
320
|
+
if (!usedNames.has(name)) {
|
|
321
|
+
usedNames.add(name);
|
|
322
|
+
return name;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// All combinations exhausted — reset and start over
|
|
328
|
+
usedNames.clear();
|
|
329
|
+
return generateTaskName();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Reset name generator state (for testing).
|
|
334
|
+
*/
|
|
335
|
+
export function resetTaskNames(): void {
|
|
336
|
+
usedNames = new Set<string>();
|
|
337
|
+
}
|
package/src/utils/visual.ts
CHANGED
|
@@ -3,12 +3,43 @@ export const ANSI_PATTERN = /\u001b\[[0-?]*[ -/]*[@-~]/g;
|
|
|
3
3
|
const WIDTH_CACHE_LIMIT = 256;
|
|
4
4
|
const widthCache = new Map<string, number>();
|
|
5
5
|
|
|
6
|
+
/** Code-point ranges that render as width 2 in most terminals (CJK + emoji). */
|
|
7
|
+
const WIDE_RANGES: Array<[number, number]> = [
|
|
8
|
+
// CJK Unified Ideographs
|
|
9
|
+
[0x4E00, 0x9FFF],
|
|
10
|
+
// CJK Extension A
|
|
11
|
+
[0x3400, 0x4DBF],
|
|
12
|
+
// CJK Compatibility Ideographs
|
|
13
|
+
[0xF900, 0xFAFF],
|
|
14
|
+
// Hangul Syllables
|
|
15
|
+
[0xAC00, 0xD7AF],
|
|
16
|
+
// CJK Symbols and Punctuation, Hiragana, Katakana
|
|
17
|
+
[0x3000, 0x33FF],
|
|
18
|
+
// Fullwidth forms
|
|
19
|
+
[0xFF01, 0xFF60],
|
|
20
|
+
// Emoji blocks
|
|
21
|
+
[0x2600, 0x27BF], // Miscellaneous Symbols + Dingbats (includes ✅)
|
|
22
|
+
[0x1F300, 0x1F9FF], // Misc Symbols, Emoticons, Transport, Map, Supplement
|
|
23
|
+
[0x1FA00, 0x1FAFF], // Symbols Extended-A
|
|
24
|
+
[0x1F000, 0x1F02F], // Mahjong, Dominos
|
|
25
|
+
[0x2702, 0x27B0], // Dingbats
|
|
26
|
+
[0xFE00, 0xFE0F], // Variation Selectors (emoji presentation)
|
|
27
|
+
[0x200D, 0x200D], // Zero Width Joiner (creates compound emoji)
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
function isWideCodePoint(code: number): boolean {
|
|
31
|
+
for (const [lo, hi] of WIDE_RANGES) {
|
|
32
|
+
if (code >= lo && code <= hi) return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
6
37
|
export function visibleWidth(value: string): number {
|
|
7
38
|
// Skip caching for very long strings to avoid memory pressure.
|
|
8
39
|
if (value.length > 4096) {
|
|
9
40
|
let length = 0;
|
|
10
41
|
for (const char of value.replace(ANSI_PATTERN, "")) {
|
|
11
|
-
if (char !== "\n") length += 1;
|
|
42
|
+
if (char !== "\n") length += isWideCodePoint(char.codePointAt(0) ?? 0) ? 2 : 1;
|
|
12
43
|
}
|
|
13
44
|
return length;
|
|
14
45
|
}
|
|
@@ -16,7 +47,7 @@ export function visibleWidth(value: string): number {
|
|
|
16
47
|
if (cached !== undefined) return cached;
|
|
17
48
|
let length = 0;
|
|
18
49
|
for (const char of value.replace(ANSI_PATTERN, "")) {
|
|
19
|
-
if (char !== "\n") length += 1;
|
|
50
|
+
if (char !== "\n") length += isWideCodePoint(char.codePointAt(0) ?? 0) ? 2 : 1;
|
|
20
51
|
}
|
|
21
52
|
if (widthCache.size >= WIDTH_CACHE_LIMIT) {
|
|
22
53
|
const firstKey = widthCache.keys().next().value;
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import type { TeamConfig } from "../teams/team-config.ts";
|
|
2
|
-
import type { WorkflowConfig } from "./workflow-config.ts";
|
|
3
|
-
|
|
4
|
-
export function validateWorkflowForTeam(workflow: WorkflowConfig, team: TeamConfig): string[] {
|
|
5
|
-
const errors: string[] = [];
|
|
6
|
-
const roles = new Set(team.roles.map((role) => role.name));
|
|
7
|
-
const stepIds = new Set<string>();
|
|
8
|
-
|
|
9
|
-
for (const step of workflow.steps) {
|
|
10
|
-
if (stepIds.has(step.id)) errors.push(`Duplicate workflow step id '${step.id}'.`);
|
|
11
|
-
stepIds.add(step.id);
|
|
12
|
-
if (!roles.has(step.role)) errors.push(`Step '${step.id}' references unknown team role '${step.role}'.`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
for (const step of workflow.steps) {
|
|
16
|
-
for (const dep of step.dependsOn ?? []) {
|
|
17
|
-
if (!stepIds.has(dep)) errors.push(`Step '${step.id}' depends on unknown step '${dep}'.`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const visiting = new Set<string>();
|
|
22
|
-
const visited = new Set<string>();
|
|
23
|
-
const byId = new Map(workflow.steps.map((step) => [step.id, step]));
|
|
24
|
-
|
|
25
|
-
function visit(id: string, trail: string[]): void {
|
|
26
|
-
if (visited.has(id)) return;
|
|
27
|
-
if (visiting.has(id)) {
|
|
28
|
-
errors.push(`Workflow dependency cycle detected: ${[...trail, id].join(" -> ")}.`);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
visiting.add(id);
|
|
32
|
-
const step = byId.get(id);
|
|
33
|
-
for (const dep of step?.dependsOn ?? []) visit(dep, [...trail, id]);
|
|
34
|
-
visiting.delete(id);
|
|
35
|
-
visited.add(id);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
for (const step of workflow.steps) visit(step.id, []);
|
|
39
|
-
return [...new Set(errors)];
|
|
40
|
-
}
|
|
1
|
+
import type { TeamConfig } from "../teams/team-config.ts";
|
|
2
|
+
import type { WorkflowConfig } from "./workflow-config.ts";
|
|
3
|
+
|
|
4
|
+
export function validateWorkflowForTeam(workflow: WorkflowConfig, team: TeamConfig): string[] {
|
|
5
|
+
const errors: string[] = [];
|
|
6
|
+
const roles = new Set(team.roles.map((role) => role.name));
|
|
7
|
+
const stepIds = new Set<string>();
|
|
8
|
+
|
|
9
|
+
for (const step of workflow.steps) {
|
|
10
|
+
if (stepIds.has(step.id)) errors.push(`Duplicate workflow step id '${step.id}'.`);
|
|
11
|
+
stepIds.add(step.id);
|
|
12
|
+
if (!roles.has(step.role)) errors.push(`Step '${step.id}' references unknown team role '${step.role}'.`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const step of workflow.steps) {
|
|
16
|
+
for (const dep of step.dependsOn ?? []) {
|
|
17
|
+
if (!stepIds.has(dep)) errors.push(`Step '${step.id}' depends on unknown step '${dep}'.`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const visiting = new Set<string>();
|
|
22
|
+
const visited = new Set<string>();
|
|
23
|
+
const byId = new Map(workflow.steps.map((step) => [step.id, step]));
|
|
24
|
+
|
|
25
|
+
function visit(id: string, trail: string[]): void {
|
|
26
|
+
if (visited.has(id)) return;
|
|
27
|
+
if (visiting.has(id)) {
|
|
28
|
+
errors.push(`Workflow dependency cycle detected: ${[...trail, id].join(" -> ")}.`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
visiting.add(id);
|
|
32
|
+
const step = byId.get(id);
|
|
33
|
+
for (const dep of step?.dependsOn ?? []) visit(dep, [...trail, id]);
|
|
34
|
+
visiting.delete(id);
|
|
35
|
+
visited.add(id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const step of workflow.steps) visit(step.id, []);
|
|
39
|
+
return [...new Set(errors)];
|
|
40
|
+
}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
-
|
|
3
|
-
export type BranchFreshnessStatus = "fresh" | "stale" | "diverged" | "unknown";
|
|
4
|
-
export type StaleBranchPolicy = "warn" | "block" | "auto_rebase" | "auto_merge_forward";
|
|
5
|
-
|
|
6
|
-
export interface BranchFreshness {
|
|
7
|
-
status: BranchFreshnessStatus;
|
|
8
|
-
branch?: string;
|
|
9
|
-
mainRef: string;
|
|
10
|
-
ahead: number;
|
|
11
|
-
behind: number;
|
|
12
|
-
missingFixes: string[];
|
|
13
|
-
message: string;
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function git(cwd: string, args: string[]): string {
|
|
18
|
-
return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function count(cwd: string, range: string): number {
|
|
22
|
-
const raw = git(cwd, ["rev-list", "--count", range]);
|
|
23
|
-
const parsed = Number.parseInt(raw, 10);
|
|
24
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function checkBranchFreshness(cwd: string, mainRef = "main"): BranchFreshness {
|
|
28
|
-
try {
|
|
29
|
-
git(cwd, ["rev-parse", "--is-inside-work-tree"]);
|
|
30
|
-
const branch = git(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
31
|
-
const behind = count(cwd, `${branch}..${mainRef}`);
|
|
32
|
-
const ahead = count(cwd, `${mainRef}..${branch}`);
|
|
33
|
-
const missingFixes = behind > 0 ? git(cwd, ["log", "--format=%s", `${branch}..${mainRef}`]).split("\n").map((line) => line.trim()).filter(Boolean) : [];
|
|
34
|
-
if (behind === 0) return { status: "fresh", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' is fresh against ${mainRef}.` };
|
|
35
|
-
if (ahead > 0) return { status: "diverged", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' diverged from ${mainRef}: ahead=${ahead}, behind=${behind}.` };
|
|
36
|
-
return { status: "stale", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' is ${behind} commit(s) behind ${mainRef}.` };
|
|
37
|
-
} catch (error) {
|
|
38
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
39
|
-
return { status: "unknown", mainRef, ahead: 0, behind: 0, missingFixes: [], message: "Branch freshness could not be determined.", error: message };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function shouldBlockForBranchFreshness(freshness: BranchFreshness, policy: StaleBranchPolicy = "warn"): boolean {
|
|
44
|
-
return policy === "block" && (freshness.status === "stale" || freshness.status === "diverged");
|
|
45
|
-
}
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
export type BranchFreshnessStatus = "fresh" | "stale" | "diverged" | "unknown";
|
|
4
|
+
export type StaleBranchPolicy = "warn" | "block" | "auto_rebase" | "auto_merge_forward";
|
|
5
|
+
|
|
6
|
+
export interface BranchFreshness {
|
|
7
|
+
status: BranchFreshnessStatus;
|
|
8
|
+
branch?: string;
|
|
9
|
+
mainRef: string;
|
|
10
|
+
ahead: number;
|
|
11
|
+
behind: number;
|
|
12
|
+
missingFixes: string[];
|
|
13
|
+
message: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function git(cwd: string, args: string[]): string {
|
|
18
|
+
return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function count(cwd: string, range: string): number {
|
|
22
|
+
const raw = git(cwd, ["rev-list", "--count", range]);
|
|
23
|
+
const parsed = Number.parseInt(raw, 10);
|
|
24
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function checkBranchFreshness(cwd: string, mainRef = "main"): BranchFreshness {
|
|
28
|
+
try {
|
|
29
|
+
git(cwd, ["rev-parse", "--is-inside-work-tree"]);
|
|
30
|
+
const branch = git(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
31
|
+
const behind = count(cwd, `${branch}..${mainRef}`);
|
|
32
|
+
const ahead = count(cwd, `${mainRef}..${branch}`);
|
|
33
|
+
const missingFixes = behind > 0 ? git(cwd, ["log", "--format=%s", `${branch}..${mainRef}`]).split("\n").map((line) => line.trim()).filter(Boolean) : [];
|
|
34
|
+
if (behind === 0) return { status: "fresh", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' is fresh against ${mainRef}.` };
|
|
35
|
+
if (ahead > 0) return { status: "diverged", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' diverged from ${mainRef}: ahead=${ahead}, behind=${behind}.` };
|
|
36
|
+
return { status: "stale", branch, mainRef, ahead, behind, missingFixes, message: `Branch '${branch}' is ${behind} commit(s) behind ${mainRef}.` };
|
|
37
|
+
} catch (error) {
|
|
38
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
39
|
+
return { status: "unknown", mainRef, ahead: 0, behind: 0, missingFixes: [], message: "Branch freshness could not be determined.", error: message };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function shouldBlockForBranchFreshness(freshness: BranchFreshness, policy: StaleBranchPolicy = "warn"): boolean {
|
|
44
|
+
return policy === "block" && (freshness.status === "stale" || freshness.status === "diverged");
|
|
45
|
+
}
|