@vaporsoft/orc 0.1.0
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/LICENSE +6 -0
- package/README.md +178 -0
- package/dist/bin/orc.d.ts +3 -0
- package/dist/bin/orc.d.ts.map +1 -0
- package/dist/bin/orc.js +4 -0
- package/dist/bin/orc.js.map +1 -0
- package/dist/src/cli.d.ts +6 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +28 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/init.d.ts +6 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +58 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/start.d.ts +17 -0
- package/dist/src/commands/start.d.ts.map +1 -0
- package/dist/src/commands/start.js +146 -0
- package/dist/src/commands/start.js.map +1 -0
- package/dist/src/constants.d.ts +18 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +42 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/core/comment-categorizer.d.ts +20 -0
- package/dist/src/core/comment-categorizer.d.ts.map +1 -0
- package/dist/src/core/comment-categorizer.js +208 -0
- package/dist/src/core/comment-categorizer.js.map +1 -0
- package/dist/src/core/comment-fetcher.d.ts +37 -0
- package/dist/src/core/comment-fetcher.d.ts.map +1 -0
- package/dist/src/core/comment-fetcher.js +138 -0
- package/dist/src/core/comment-fetcher.js.map +1 -0
- package/dist/src/core/daemon.d.ts +92 -0
- package/dist/src/core/daemon.d.ts.map +1 -0
- package/dist/src/core/daemon.js +896 -0
- package/dist/src/core/daemon.js.map +1 -0
- package/dist/src/core/fix-executor.d.ts +50 -0
- package/dist/src/core/fix-executor.d.ts.map +1 -0
- package/dist/src/core/fix-executor.js +374 -0
- package/dist/src/core/fix-executor.js.map +1 -0
- package/dist/src/core/git-manager.d.ts +44 -0
- package/dist/src/core/git-manager.d.ts.map +1 -0
- package/dist/src/core/git-manager.js +230 -0
- package/dist/src/core/git-manager.js.map +1 -0
- package/dist/src/core/pilot-config.d.ts +18 -0
- package/dist/src/core/pilot-config.d.ts.map +1 -0
- package/dist/src/core/pilot-config.js +76 -0
- package/dist/src/core/pilot-config.js.map +1 -0
- package/dist/src/core/progress-store.d.ts +32 -0
- package/dist/src/core/progress-store.d.ts.map +1 -0
- package/dist/src/core/progress-store.js +106 -0
- package/dist/src/core/progress-store.js.map +1 -0
- package/dist/src/core/repo-config.d.ts +11 -0
- package/dist/src/core/repo-config.d.ts.map +1 -0
- package/dist/src/core/repo-config.js +168 -0
- package/dist/src/core/repo-config.js.map +1 -0
- package/dist/src/core/session-controller.d.ts +61 -0
- package/dist/src/core/session-controller.d.ts.map +1 -0
- package/dist/src/core/session-controller.js +926 -0
- package/dist/src/core/session-controller.js.map +1 -0
- package/dist/src/core/thread-responder.d.ts +28 -0
- package/dist/src/core/thread-responder.d.ts.map +1 -0
- package/dist/src/core/thread-responder.js +193 -0
- package/dist/src/core/thread-responder.js.map +1 -0
- package/dist/src/core/worktree-manager.d.ts +26 -0
- package/dist/src/core/worktree-manager.d.ts.map +1 -0
- package/dist/src/core/worktree-manager.js +189 -0
- package/dist/src/core/worktree-manager.js.map +1 -0
- package/dist/src/github/gh-client.d.ts +57 -0
- package/dist/src/github/gh-client.d.ts.map +1 -0
- package/dist/src/github/gh-client.js +236 -0
- package/dist/src/github/gh-client.js.map +1 -0
- package/dist/src/github/queries.d.ts +9 -0
- package/dist/src/github/queries.d.ts.map +1 -0
- package/dist/src/github/queries.js +152 -0
- package/dist/src/github/queries.js.map +1 -0
- package/dist/src/github/types.d.ts +114 -0
- package/dist/src/github/types.d.ts.map +1 -0
- package/dist/src/github/types.js +3 -0
- package/dist/src/github/types.js.map +1 -0
- package/dist/src/tui/App.d.ts +8 -0
- package/dist/src/tui/App.d.ts.map +1 -0
- package/dist/src/tui/App.js +407 -0
- package/dist/src/tui/App.js.map +1 -0
- package/dist/src/tui/components/ActivityPane.d.ts +7 -0
- package/dist/src/tui/components/ActivityPane.d.ts.map +1 -0
- package/dist/src/tui/components/ActivityPane.js +10 -0
- package/dist/src/tui/components/ActivityPane.js.map +1 -0
- package/dist/src/tui/components/DetailPanel.d.ts +15 -0
- package/dist/src/tui/components/DetailPanel.d.ts.map +1 -0
- package/dist/src/tui/components/DetailPanel.js +137 -0
- package/dist/src/tui/components/DetailPanel.js.map +1 -0
- package/dist/src/tui/components/DrillInOverlay.d.ts +13 -0
- package/dist/src/tui/components/DrillInOverlay.d.ts.map +1 -0
- package/dist/src/tui/components/DrillInOverlay.js +85 -0
- package/dist/src/tui/components/DrillInOverlay.js.map +1 -0
- package/dist/src/tui/components/ExpandedContent.d.ts +10 -0
- package/dist/src/tui/components/ExpandedContent.d.ts.map +1 -0
- package/dist/src/tui/components/ExpandedContent.js +99 -0
- package/dist/src/tui/components/ExpandedContent.js.map +1 -0
- package/dist/src/tui/components/Header.d.ts +12 -0
- package/dist/src/tui/components/Header.d.ts.map +1 -0
- package/dist/src/tui/components/Header.js +35 -0
- package/dist/src/tui/components/Header.js.map +1 -0
- package/dist/src/tui/components/HelpBar.d.ts +2 -0
- package/dist/src/tui/components/HelpBar.d.ts.map +1 -0
- package/dist/src/tui/components/HelpBar.js +11 -0
- package/dist/src/tui/components/HelpBar.js.map +1 -0
- package/dist/src/tui/components/KeybindLegend.d.ts +7 -0
- package/dist/src/tui/components/KeybindLegend.d.ts.map +1 -0
- package/dist/src/tui/components/KeybindLegend.js +53 -0
- package/dist/src/tui/components/KeybindLegend.js.map +1 -0
- package/dist/src/tui/components/LogPane.d.ts +11 -0
- package/dist/src/tui/components/LogPane.d.ts.map +1 -0
- package/dist/src/tui/components/LogPane.js +31 -0
- package/dist/src/tui/components/LogPane.js.map +1 -0
- package/dist/src/tui/components/SessionList.d.ts +14 -0
- package/dist/src/tui/components/SessionList.d.ts.map +1 -0
- package/dist/src/tui/components/SessionList.js +31 -0
- package/dist/src/tui/components/SessionList.js.map +1 -0
- package/dist/src/tui/components/SessionRow.d.ts +10 -0
- package/dist/src/tui/components/SessionRow.d.ts.map +1 -0
- package/dist/src/tui/components/SessionRow.js +52 -0
- package/dist/src/tui/components/SessionRow.js.map +1 -0
- package/dist/src/tui/components/SettingsPanel.d.ts +8 -0
- package/dist/src/tui/components/SettingsPanel.d.ts.map +1 -0
- package/dist/src/tui/components/SettingsPanel.js +191 -0
- package/dist/src/tui/components/SettingsPanel.js.map +1 -0
- package/dist/src/tui/components/StatusBadge.d.ts +9 -0
- package/dist/src/tui/components/StatusBadge.d.ts.map +1 -0
- package/dist/src/tui/components/StatusBadge.js +52 -0
- package/dist/src/tui/components/StatusBadge.js.map +1 -0
- package/dist/src/tui/components/Toolbar.d.ts +5 -0
- package/dist/src/tui/components/Toolbar.d.ts.map +1 -0
- package/dist/src/tui/components/Toolbar.js +2 -0
- package/dist/src/tui/components/Toolbar.js.map +1 -0
- package/dist/src/tui/components/comment-constants.d.ts +4 -0
- package/dist/src/tui/components/comment-constants.d.ts.map +1 -0
- package/dist/src/tui/components/comment-constants.js +15 -0
- package/dist/src/tui/components/comment-constants.js.map +1 -0
- package/dist/src/tui/hooks/logFlushUtils.d.ts +15 -0
- package/dist/src/tui/hooks/logFlushUtils.d.ts.map +1 -0
- package/dist/src/tui/hooks/logFlushUtils.js +33 -0
- package/dist/src/tui/hooks/logFlushUtils.js.map +1 -0
- package/dist/src/tui/hooks/useBranchLogs.d.ts +7 -0
- package/dist/src/tui/hooks/useBranchLogs.d.ts.map +1 -0
- package/dist/src/tui/hooks/useBranchLogs.js +58 -0
- package/dist/src/tui/hooks/useBranchLogs.js.map +1 -0
- package/dist/src/tui/hooks/useDaemonState.d.ts +19 -0
- package/dist/src/tui/hooks/useDaemonState.d.ts.map +1 -0
- package/dist/src/tui/hooks/useDaemonState.js +152 -0
- package/dist/src/tui/hooks/useDaemonState.js.map +1 -0
- package/dist/src/tui/hooks/useInitialDiscovery.d.ts +8 -0
- package/dist/src/tui/hooks/useInitialDiscovery.d.ts.map +1 -0
- package/dist/src/tui/hooks/useInitialDiscovery.js +31 -0
- package/dist/src/tui/hooks/useInitialDiscovery.js.map +1 -0
- package/dist/src/tui/hooks/useLogBuffer.d.ts +7 -0
- package/dist/src/tui/hooks/useLogBuffer.d.ts.map +1 -0
- package/dist/src/tui/hooks/useLogBuffer.js +52 -0
- package/dist/src/tui/hooks/useLogBuffer.js.map +1 -0
- package/dist/src/tui/hooks/useNextCheckCountdown.d.ts +7 -0
- package/dist/src/tui/hooks/useNextCheckCountdown.d.ts.map +1 -0
- package/dist/src/tui/hooks/useNextCheckCountdown.js +42 -0
- package/dist/src/tui/hooks/useNextCheckCountdown.js.map +1 -0
- package/dist/src/tui/hooks/useTerminalFocus.d.ts +9 -0
- package/dist/src/tui/hooks/useTerminalFocus.d.ts.map +1 -0
- package/dist/src/tui/hooks/useTerminalFocus.js +43 -0
- package/dist/src/tui/hooks/useTerminalFocus.js.map +1 -0
- package/dist/src/tui/theme.d.ts +32 -0
- package/dist/src/tui/theme.d.ts.map +1 -0
- package/dist/src/tui/theme.js +61 -0
- package/dist/src/tui/theme.js.map +1 -0
- package/dist/src/types/config.d.ts +35 -0
- package/dist/src/types/config.d.ts.map +1 -0
- package/dist/src/types/config.js +14 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/index.d.ts +107 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +3 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/concurrency.d.ts +7 -0
- package/dist/src/utils/concurrency.d.ts.map +1 -0
- package/dist/src/utils/concurrency.js +26 -0
- package/dist/src/utils/concurrency.js.map +1 -0
- package/dist/src/utils/format.d.ts +2 -0
- package/dist/src/utils/format.d.ts.map +1 -0
- package/dist/src/utils/format.js +8 -0
- package/dist/src/utils/format.js.map +1 -0
- package/dist/src/utils/logger.d.ts +39 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +120 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/notify.d.ts +6 -0
- package/dist/src/utils/notify.d.ts.map +1 -0
- package/dist/src/utils/notify.js +15 -0
- package/dist/src/utils/notify.js.map +1 -0
- package/dist/src/utils/open-terminal.d.ts +12 -0
- package/dist/src/utils/open-terminal.d.ts.map +1 -0
- package/dist/src/utils/open-terminal.js +93 -0
- package/dist/src/utils/open-terminal.js.map +1 -0
- package/dist/src/utils/process.d.ts +14 -0
- package/dist/src/utils/process.d.ts.map +1 -0
- package/dist/src/utils/process.js +36 -0
- package/dist/src/utils/process.js.map +1 -0
- package/dist/src/utils/project-detector.d.ts +12 -0
- package/dist/src/utils/project-detector.d.ts.map +1 -0
- package/dist/src/utils/project-detector.js +123 -0
- package/dist/src/utils/project-detector.js.map +1 -0
- package/dist/src/utils/quoting.d.ts +15 -0
- package/dist/src/utils/quoting.d.ts.map +1 -0
- package/dist/src/utils/quoting.js +39 -0
- package/dist/src/utils/quoting.js.map +1 -0
- package/dist/src/utils/retry.d.ts +14 -0
- package/dist/src/utils/retry.d.ts.map +1 -0
- package/dist/src/utils/retry.js +41 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/settings.d.ts +14 -0
- package/dist/src/utils/settings.d.ts.map +1 -0
- package/dist/src/utils/settings.js +21 -0
- package/dist/src/utils/settings.js.map +1 -0
- package/dist/src/utils/time.d.ts +2 -0
- package/dist/src/utils/time.d.ts.map +1 -0
- package/dist/src/utils/time.js +5 -0
- package/dist/src/utils/time.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads per-repo configuration from two sources:
|
|
3
|
+
*
|
|
4
|
+
* - `ORC.md` — freeform instructions/context passed to Claude Code
|
|
5
|
+
* - `orc.config.json` — structured config (setup, verify, permissions, auto-fix)
|
|
6
|
+
*
|
|
7
|
+
* This mirrors the Claude Code pattern: markdown for context, JSON for config.
|
|
8
|
+
*/
|
|
9
|
+
import { readFile } from "node:fs/promises";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { logger } from "../utils/logger.js";
|
|
13
|
+
const OrcConfigSchema = z.object({
|
|
14
|
+
setup: z.array(z.string()).default([]),
|
|
15
|
+
verify: z.array(z.string()).default([]),
|
|
16
|
+
allowedCommands: z.array(z.string()).default([]),
|
|
17
|
+
autoFix: z
|
|
18
|
+
.object({
|
|
19
|
+
must_fix: z.boolean().default(true),
|
|
20
|
+
should_fix: z.boolean().default(true),
|
|
21
|
+
nice_to_have: z.boolean().default(false),
|
|
22
|
+
verify_and_fix: z.boolean().default(true),
|
|
23
|
+
needs_clarification: z.boolean().default(true),
|
|
24
|
+
})
|
|
25
|
+
.default({}),
|
|
26
|
+
});
|
|
27
|
+
const DEFAULT_CONFIG = {
|
|
28
|
+
instructions: "",
|
|
29
|
+
setupCommands: [],
|
|
30
|
+
verifyCommands: [],
|
|
31
|
+
allowedCommands: [],
|
|
32
|
+
autoFix: {
|
|
33
|
+
must_fix: true,
|
|
34
|
+
should_fix: true,
|
|
35
|
+
nice_to_have: false,
|
|
36
|
+
verify_and_fix: true,
|
|
37
|
+
needs_clarification: true,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export async function loadRepoConfig(cwd) {
|
|
41
|
+
const { instructions, orcMdContent } = await loadInstructions(cwd);
|
|
42
|
+
const jsonResult = await loadJsonConfig(cwd);
|
|
43
|
+
// Only fall back to legacy ORC.md sections if orc.config.json doesn't exist at all.
|
|
44
|
+
// If orc.config.json exists but is invalid/malformed, use defaults (don't silently use legacy).
|
|
45
|
+
if (jsonResult.status === "not_found" && orcMdContent) {
|
|
46
|
+
const legacyConfig = parseLegacyOrcMdSections(orcMdContent);
|
|
47
|
+
if (legacyConfig) {
|
|
48
|
+
logger.info("Using legacy ORC.md sections (## Verify, ## Auto-fix, etc.) for config");
|
|
49
|
+
return {
|
|
50
|
+
instructions,
|
|
51
|
+
setupCommands: legacyConfig.setupCommands,
|
|
52
|
+
verifyCommands: legacyConfig.verifyCommands,
|
|
53
|
+
allowedCommands: legacyConfig.allowedCommands,
|
|
54
|
+
autoFix: legacyConfig.autoFix,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
instructions,
|
|
60
|
+
setupCommands: jsonResult.config.setup,
|
|
61
|
+
verifyCommands: jsonResult.config.verify,
|
|
62
|
+
allowedCommands: jsonResult.config.allowedCommands,
|
|
63
|
+
autoFix: jsonResult.config.autoFix,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Read freeform instructions from ORC.md. */
|
|
67
|
+
async function loadInstructions(cwd) {
|
|
68
|
+
const filePath = join(cwd, "ORC.md");
|
|
69
|
+
try {
|
|
70
|
+
const content = await readFile(filePath, "utf-8");
|
|
71
|
+
logger.info("Loaded ORC.md instructions");
|
|
72
|
+
return { instructions: content.trim(), orcMdContent: content };
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
logger.debug("No ORC.md found");
|
|
76
|
+
return { instructions: DEFAULT_CONFIG.instructions, orcMdContent: null };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Parse legacy ORC.md sections (## Verify, ## Auto-fix, etc.)
|
|
81
|
+
* for backwards compatibility with users who haven't migrated to orc.config.json.
|
|
82
|
+
*/
|
|
83
|
+
function parseLegacyOrcMdSections(content) {
|
|
84
|
+
const sections = new Map();
|
|
85
|
+
let currentHeading = "";
|
|
86
|
+
const lines = content.split("\n");
|
|
87
|
+
for (const line of lines) {
|
|
88
|
+
const h2Match = line.match(/^## (.+)/);
|
|
89
|
+
if (h2Match) {
|
|
90
|
+
currentHeading = h2Match[1].trim().toLowerCase();
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (line.match(/^# /))
|
|
94
|
+
continue;
|
|
95
|
+
if (currentHeading) {
|
|
96
|
+
const existing = sections.get(currentHeading) ?? "";
|
|
97
|
+
sections.set(currentHeading, existing + line + "\n");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// Check if any legacy sections exist
|
|
101
|
+
const hasLegacySections = sections.has("verify") || sections.has("auto-fix") || sections.has("setup") || sections.has("allowed commands");
|
|
102
|
+
if (!hasLegacySections) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const setupCommands = [];
|
|
106
|
+
const setupSection = sections.get("setup") ?? "";
|
|
107
|
+
for (const line of setupSection.split("\n")) {
|
|
108
|
+
const match = line.match(/^-\s*`(.+)`/);
|
|
109
|
+
if (match) {
|
|
110
|
+
setupCommands.push(match[1]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const verifyCommands = [];
|
|
114
|
+
const verifySection = sections.get("verify") ?? "";
|
|
115
|
+
for (const line of verifySection.split("\n")) {
|
|
116
|
+
const match = line.match(/^-\s*`(.+)`/);
|
|
117
|
+
if (match) {
|
|
118
|
+
verifyCommands.push(match[1]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const allowedCommands = [];
|
|
122
|
+
const allowedSection = sections.get("allowed commands") ?? "";
|
|
123
|
+
for (const line of allowedSection.split("\n")) {
|
|
124
|
+
const match = line.match(/^-\s*`(.+)`/);
|
|
125
|
+
if (match) {
|
|
126
|
+
allowedCommands.push(match[1]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const autoFix = { ...DEFAULT_CONFIG.autoFix };
|
|
130
|
+
const autoFixSection = sections.get("auto-fix") ?? "";
|
|
131
|
+
for (const line of autoFixSection.split("\n")) {
|
|
132
|
+
const match = line.match(/^-\s*(must_fix|should_fix|nice_to_have|verify_and_fix|needs_clarification)\s*:\s*(true|false)/);
|
|
133
|
+
if (match) {
|
|
134
|
+
autoFix[match[1]] = match[2] === "true";
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return { setupCommands, verifyCommands, allowedCommands, autoFix };
|
|
138
|
+
}
|
|
139
|
+
/** Read structured config from orc.config.json, validated with Zod. */
|
|
140
|
+
async function loadJsonConfig(cwd) {
|
|
141
|
+
const filePath = join(cwd, "orc.config.json");
|
|
142
|
+
try {
|
|
143
|
+
const raw = await readFile(filePath, "utf-8");
|
|
144
|
+
const parsed = JSON.parse(raw);
|
|
145
|
+
const config = OrcConfigSchema.parse(parsed);
|
|
146
|
+
logger.info("Loaded orc.config.json");
|
|
147
|
+
return { status: "loaded", config };
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
if (err instanceof z.ZodError) {
|
|
151
|
+
logger.warn(`Invalid orc.config.json: ${err.issues.map((i) => i.message).join(", ")}`);
|
|
152
|
+
return { status: "invalid", config: OrcConfigSchema.parse({}) };
|
|
153
|
+
}
|
|
154
|
+
else if (err instanceof SyntaxError) {
|
|
155
|
+
logger.warn(`Malformed JSON in orc.config.json: ${err.message}`);
|
|
156
|
+
return { status: "invalid", config: OrcConfigSchema.parse({}) };
|
|
157
|
+
}
|
|
158
|
+
else if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
159
|
+
logger.debug("No orc.config.json found, using defaults");
|
|
160
|
+
return { status: "not_found", config: OrcConfigSchema.parse({}) };
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
logger.warn(`Failed to load orc.config.json: ${err instanceof Error ? err.message : String(err)}`);
|
|
164
|
+
return { status: "invalid", config: OrcConfigSchema.parse({}) };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=repo-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-config.js","sourceRoot":"","sources":["../../../src/core/repo-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO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I,CAAC,sCAAsC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACjE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAClE,CAAC;aAAM,IAAI,GAAG,YAAY,KAAK,IAAI,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1E,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YACzD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QACpE,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,mCAAmC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAClE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main orchestration loop for a single branch.
|
|
3
|
+
*
|
|
4
|
+
* Pipeline: fetch → categorize → filter → fix → verify → push → reply → re-request review.
|
|
5
|
+
* Emits events for the UI/TUI layer to consume.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from "node:events";
|
|
8
|
+
import type { ProgressStore } from "./progress-store.js";
|
|
9
|
+
import type { BranchState, SessionMode } from "../types/index.js";
|
|
10
|
+
import type { Config } from "../types/config.js";
|
|
11
|
+
export declare class SessionController extends EventEmitter {
|
|
12
|
+
private config;
|
|
13
|
+
private branch;
|
|
14
|
+
private cwd;
|
|
15
|
+
private ghClient;
|
|
16
|
+
private fetcher;
|
|
17
|
+
private categorizer;
|
|
18
|
+
private executor;
|
|
19
|
+
private gitManager;
|
|
20
|
+
private responder;
|
|
21
|
+
private repoConfig;
|
|
22
|
+
private mode;
|
|
23
|
+
private state;
|
|
24
|
+
private progressStore;
|
|
25
|
+
private prAuthor;
|
|
26
|
+
private abortController;
|
|
27
|
+
private running;
|
|
28
|
+
private startedAt;
|
|
29
|
+
private conflictResolve;
|
|
30
|
+
private pendingBaseBranch;
|
|
31
|
+
constructor(branch: string, config: Config, cwd: string, mode: SessionMode | undefined, progressStore: ProgressStore);
|
|
32
|
+
updateConfig(config: Config): void;
|
|
33
|
+
getState(): BranchState;
|
|
34
|
+
/** Update the conflicted paths (used by daemon to propagate merge conflict status). */
|
|
35
|
+
setConflicted(paths: string[]): void;
|
|
36
|
+
start(): Promise<void>;
|
|
37
|
+
/** Rebase-only mode: rebase onto base, resolve conflicts if needed, push, then done. */
|
|
38
|
+
startRebase(): Promise<void>;
|
|
39
|
+
stop(): void;
|
|
40
|
+
/** Sleep that resolves immediately when the abort signal fires. */
|
|
41
|
+
private sleep;
|
|
42
|
+
private runCycle;
|
|
43
|
+
/** Called by the daemon when the TUI user presses R or A on a conflict prompt. */
|
|
44
|
+
acceptConflictResolution(always: boolean): void;
|
|
45
|
+
/** Called by the daemon when the TUI user presses Esc on a conflict prompt. */
|
|
46
|
+
dismissConflictResolution(): void;
|
|
47
|
+
/** Attempt to resolve conflicts by starting the rebase, letting Claude fix conflict markers, then continuing. */
|
|
48
|
+
private resolveConflicts;
|
|
49
|
+
/** Get list of files that would conflict in a merge with the base branch. */
|
|
50
|
+
private getConflictFiles;
|
|
51
|
+
/** Refresh in-memory lifetime stats from the persistent store. */
|
|
52
|
+
private syncLifetimeStats;
|
|
53
|
+
/** Poll CI status after push and automatically attempt to fix failures. */
|
|
54
|
+
private checkAndFixCI;
|
|
55
|
+
/** Wait for CI checks to complete, then return aggregated status. */
|
|
56
|
+
private pollCIStatus;
|
|
57
|
+
/** Build context string describing CI failures for the fix executor. */
|
|
58
|
+
private buildCIContext;
|
|
59
|
+
private setStatus;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=session-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-controller.d.ts","sourceRoot":"","sources":["../../../src/core/session-controller.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAS3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,WAAW,EAMX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAgBjD,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,eAAe,CAA0D;IACjF,OAAO,CAAC,iBAAiB,CAAuB;gBAEpC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,YAAS,EAAE,aAAa,EAAE,aAAa;IA8CjH,YAAY,CAAC,MAAM,EAAE,MAAM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