mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +00:00
feat(cursor): multitask slash, autoReview mode, native worktree/add-dir (#1014)
* feat(cursor): multitask slash, autoReview mode, native worktree/add-dir Close the highest-value Cursor Agent gaps for remote HAPI: expand ACP-safe slash pass-through (/multitask, worktree, add-dir, …), add autoReview permission mode (--auto-review spawn + mid-session slash), and route Cursor New Session worktrees through agent --worktree instead of HAPI sibling trees. Fixes #1013 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): accept --mode autoReview for hapi cursor Align --mode parsing with CURSOR_PERMISSION_MODES so documented `hapi cursor --mode autoReview` enables Smart Auto instead of silently falling back to default. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+27
-13
@@ -336,20 +336,27 @@ export async function startRunner(options: { workspaceRoots?: string[] } = {}):
|
||||
}
|
||||
|
||||
if (sessionType === 'worktree') {
|
||||
const worktreeResult = await createWorktree({
|
||||
basePath: directory,
|
||||
nameHint: worktreeName
|
||||
});
|
||||
if (!worktreeResult.ok) {
|
||||
logger.debug(`[RUNNER RUN] Worktree creation failed: ${worktreeResult.error}`);
|
||||
return {
|
||||
type: 'error',
|
||||
errorMessage: worktreeResult.error
|
||||
};
|
||||
// Cursor Agent has native `--worktree` under ~/.cursor/worktrees/. Prefer that
|
||||
// over HAPI's sibling-directory worktree so Cursor sandbox/skills see the same layout.
|
||||
if (agent === 'cursor') {
|
||||
spawnDirectory = directory;
|
||||
logger.debug(`[RUNNER RUN] Cursor-native worktree requested (nameHint=${worktreeName ?? '(auto)'})`);
|
||||
} else {
|
||||
const worktreeResult = await createWorktree({
|
||||
basePath: directory,
|
||||
nameHint: worktreeName
|
||||
});
|
||||
if (!worktreeResult.ok) {
|
||||
logger.debug(`[RUNNER RUN] Worktree creation failed: ${worktreeResult.error}`);
|
||||
return {
|
||||
type: 'error',
|
||||
errorMessage: worktreeResult.error
|
||||
};
|
||||
}
|
||||
worktreeInfo = worktreeResult.info;
|
||||
spawnDirectory = worktreeInfo.worktreePath;
|
||||
logger.debug(`[RUNNER RUN] Created worktree ${worktreeInfo.worktreePath} (branch ${worktreeInfo.branch})`);
|
||||
}
|
||||
worktreeInfo = worktreeResult.info;
|
||||
spawnDirectory = worktreeInfo.worktreePath;
|
||||
logger.debug(`[RUNNER RUN] Created worktree ${worktreeInfo.worktreePath} (branch ${worktreeInfo.branch})`);
|
||||
}
|
||||
|
||||
const cleanupWorktree = async () => {
|
||||
@@ -1125,5 +1132,12 @@ export function buildCliArgs(
|
||||
args.push('--yolo');
|
||||
}
|
||||
}
|
||||
if (agent === 'cursor' && options.sessionType === 'worktree') {
|
||||
args.push('--cursor-worktree');
|
||||
const name = options.worktreeName?.trim();
|
||||
if (name) {
|
||||
args.push(name);
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user