@ravshansbox/pi-next-issue 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-next-issue",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Pi extension that works through GitHub issues in the background",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/git.ts CHANGED
@@ -81,8 +81,8 @@ export async function push(cwd: string, remote: string, branch: string): Promise
81
81
  await must('git', ['push', '-u', remote, `HEAD:refs/heads/${branch}`], { cwd });
82
82
  }
83
83
 
84
- export async function discard(cwd: string): Promise<void> {
85
- await must('git', ['reset', '--hard', '@{upstream}'], { cwd });
84
+ export async function discard(cwd: string, remote: string, branch: string): Promise<void> {
85
+ await must('git', ['reset', '--hard', `${remote}/${branch}`], { cwd });
86
86
  await must('git', ['clean', '-fd'], { cwd });
87
87
  }
88
88
 
package/src/ports.ts CHANGED
@@ -17,7 +17,7 @@ export async function createPorts(root: string, config: Config): Promise<Ports>
17
17
  worktree: (issue, branch) => git.worktree(root, config.remote, base, issue, branch),
18
18
  commit: (cwd, message) => git.commit(cwd, message),
19
19
  push: (cwd, branch) => git.push(cwd, config.remote, branch),
20
- discard: (cwd) => git.discard(cwd),
20
+ discard: (cwd, branch) => git.discard(cwd, config.remote, branch),
21
21
  diff: (cwd) => git.diff(cwd, config.remote, base),
22
22
  openPr: (branch, title, body) => github.openPr(repo, branch, base, title, body),
23
23
  checks: async (pr, cwd, signal) =>
package/src/runner.ts CHANGED
@@ -46,7 +46,7 @@ export type Ports = {
46
46
  worktree(issue: number, branch: string): Promise<string>;
47
47
  commit(cwd: string, message: string): Promise<boolean>;
48
48
  push(cwd: string, branch: string): Promise<void>;
49
- discard(cwd: string): Promise<void>;
49
+ discard(cwd: string, branch: string): Promise<void>;
50
50
  diff(cwd: string): Promise<string>;
51
51
  openPr(branch: string, title: string, body: string): Promise<number>;
52
52
  checks(pr: number, cwd: string, signal: AbortSignal): Promise<ChecksResult>;
@@ -294,7 +294,7 @@ export class Runner {
294
294
  cwd,
295
295
  reviewPrompt(issue, comments, diff, state.earlier),
296
296
  );
297
- await ports.discard(cwd);
297
+ await ports.discard(cwd, state.branch);
298
298
  if (verdict === undefined) {
299
299
  return needsHuman('the reviewer gave no verdict');
300
300
  }