+ )
+}
+
export function RepositoryHooksSection({
repo,
yamlHooks,
@@ -101,7 +134,7 @@ export function RepositoryHooksSection({
{yamlState === 'loaded'
? 'Hook commands are defined in the repo and shared with everyone who uses it.'
: yamlState === 'invalid'
- ? 'The file exists, but Orca could not read valid setup or archive commands from it yet.'
+ ? 'The core configuration file exists in the repo root, but Orca could not parse the supported hook definitions yet.'
: 'Add an `orca.yaml` file to enable setup or archive hooks for this repo. Example template:'}
@@ -118,35 +151,50 @@ export function RepositoryHooksSection({
) : yamlState === 'invalid' ? (
-
- Fix the file format in `orca.yaml` to restore shared hook behavior.
-
- ) : (
-
-
- Example `orca.yaml` template
-
-
-
-
+
+
+
+
+
+
+
+
+ `orca.yaml` could not be parsed
+
+
+ {/* Why: once a repo has an `orca.yaml`, the failure mode is usually bad shape
+ rather than a missing concept. Showing a repair-oriented explanation and
+ template here lets maintainers fix the committed file without needing the doc. */}
+ The file is present, but Orca could not find valid `setup` or `archive` hook
+ definitions in the expected format.
+
+
+
+
+
+ Recommended fixes
+
+
+ {PARSE_ERROR_FIXES.map((fix, index) => (
+
+
+ {index + 1}
+
+ {fix}
+
+ ))}
+
+
-
- {EXAMPLE_TEMPLATE}
-
+
+
+ ) : (
+
)}
@@ -238,6 +286,12 @@ export function RepositoryHooksSection({
)
}
+const PARSE_ERROR_FIXES = [
+ 'Check the indentation under `scripts:`. Hook keys should use two spaces, and command lines should use four.',
+ 'Define only the supported hook keys: `setup` and `archive`.',
+ 'Compare your file against the working template below and copy that shape if needed.'
+]
+
function renderYamlScriptPreview(yamlHooks: OrcaHooks | null): string {
return `scripts:${
yamlHooks?.scripts.setup
diff --git a/src/renderer/src/components/sidebar/AddWorktreeDialog.tsx b/src/renderer/src/components/sidebar/AddWorktreeDialog.tsx
index 62910cb533c..65d1d0a0663 100644
--- a/src/renderer/src/components/sidebar/AddWorktreeDialog.tsx
+++ b/src/renderer/src/components/sidebar/AddWorktreeDialog.tsx
@@ -154,7 +154,11 @@ const AddWorktreeDialog = React.memo(function AddWorktreeDialog() {
repoId,
name.trim(),
undefined,
- setupConfig ? ((resolvedSetupDecision ?? 'inherit') as SetupDecision) : 'inherit'
+ // Why: the renderer-side hook lookup only exists to preview setup and collect an `ask`
+ // choice before create. The main process is still the source of truth for whether a repo
+ // has setup and whether it should launch. Always pass the resolved decision through so a
+ // stale or failed preview lookup cannot silently suppress setup for a newly created worktree.
+ (resolvedSetupDecision ?? 'inherit') as SetupDecision
)
const wt = result.worktree
// Meta update is best-effort — the worktree already exists, so don't