@aipper/aiws 0.0.28 → 0.0.29

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.
@@ -1,10 +1,7 @@
1
- import path from "node:path";
2
-
3
1
  /**
4
2
  * @param {{
5
3
  * gitRoot: string,
6
4
  * branch: string,
7
- * changeWorktreeHint: string,
8
5
  * status: any
9
6
  * }} input
10
7
  * @param {{
@@ -14,21 +11,14 @@ import path from "node:path";
14
11
  * }} deps
15
12
  */
16
13
  export async function renderChangeStatusOutput(input, deps) {
17
- const { gitRoot, branch, changeWorktreeHint, status } = input;
14
+ const { gitRoot, branch, status } = input;
18
15
  /** @type {string[]} */
19
16
  const lines = [];
20
17
 
21
18
  lines.push(`✓ aiws change status: ${status.changeId}`);
22
19
  lines.push(`dir: ${status.dir}`);
23
20
  lines.push(`phase: ${status.phase}`);
24
- lines.push(`worktree: ${gitRoot}`);
25
21
  lines.push(`branch: ${branch || "(detached HEAD)"}`);
26
- if (changeWorktreeHint) lines.push(`note: change/<id> checked out in another worktree: ${changeWorktreeHint}`);
27
- if (status.context?.worktree && path.resolve(status.context.worktree) !== path.resolve(gitRoot)) {
28
- lines.push(`status_context: ${status.context.worktree}`);
29
- lines.push(`status_branch: ${status.context.branch || "(detached HEAD)"}`);
30
- }
31
- if (status.context?.warning) lines.push(`warning: ${status.context.warning}`);
32
22
  lines.push(`meta: ${status.metaState}`);
33
23
  if (status.reqId) lines.push(`Req_ID: ${status.reqId}`);
34
24
  if (status.probId) lines.push(`Problem_ID: ${status.probId}`);
@@ -41,7 +31,9 @@ export async function renderChangeStatusOutput(input, deps) {
41
31
  if (status.reviewGates?.summary) {
42
32
  const summary = status.reviewGates.summary;
43
33
  const missing = summary.finishGateMissingIds.length > 0 ? summary.finishGateMissingIds.join(", ") : "(none)";
44
- lines.push(`review_gates: dual_ready=${summary.dualReviewReady} finish_ready=${summary.finishGateReady} missing=${missing}`);
34
+ lines.push(
35
+ `review_gates: generic_only=${summary.genericReviewOnly} dual_pending=${summary.dualReviewPending} dual_ready=${summary.dualReviewReady} finish_ready=${summary.finishGateReady} missing=${missing}`,
36
+ );
45
37
  for (const gate of status.reviewGates.gates || []) {
46
38
  lines.push(`review_gate:${gate.id} ready=${gate.ready} status=${gate.status}${gate.foundPath ? ` path=${gate.foundPath}` : ""}`);
47
39
  }
@@ -100,7 +92,6 @@ export async function renderChangeStatusOutput(input, deps) {
100
92
  lines.push(`- ${deps.planVerifyHint(status.changeId)}`);
101
93
  if (status.blockersStrict.length > 0) {
102
94
  lines.push("- 先修复 Blockers (strict) 后复跑质量门,再进入编码:simple/local 单点修复优先 `$ws-dev-lite`;否则 `$ws-dev`");
103
- if (changeWorktreeHint) lines.push(`- 若需要写代码:先切到 change worktree 再改动:\`cd ${changeWorktreeHint}\``);
104
95
  return lines.join("\n") + "\n";
105
96
  }
106
97
 
@@ -5,51 +5,23 @@ import path from "node:path";
5
5
  * @param {string} changeId
6
6
  * @param {{
7
7
  * currentBranch: (gitRoot: string) => Promise<string>,
8
- * listGitWorktrees: (gitRoot: string) => Promise<Array<{ worktree: string, branch: string }>>,
9
- * pathExists: (path: string) => Promise<boolean>,
10
- * isGitRepository: (path: string) => Promise<boolean>,
11
8
  * inferChangeIdFromBranch: (branch: string) => string
12
9
  * }} deps
13
10
  */
14
11
  export async function resolveChangeStatusContext(gitRoot, changeId, deps) {
15
12
  const rootBranch = await deps.currentBranch(gitRoot);
16
- /** @type {Array<{ worktree: string, branch: string }>} */
17
- let worktrees = [];
18
- try {
19
- worktrees = await deps.listGitWorktrees(gitRoot);
20
- } catch {
21
- worktrees = [];
22
- }
23
-
24
- const changeRef = `refs/heads/change/${changeId}`;
25
- const changeWorktree = worktrees.find((worktree) => String(worktree.branch || "") === changeRef)?.worktree || "";
26
- const rootWorktree = path.resolve(gitRoot);
27
- let contextWorktree = rootWorktree;
28
- let source = "current_worktree";
29
- let warning = "";
30
- if (changeWorktree && path.resolve(changeWorktree) !== rootWorktree) {
31
- const candidate = path.resolve(changeWorktree);
32
- const candidateExists = await deps.pathExists(candidate);
33
- const candidateReady = candidateExists ? await deps.isGitRepository(candidate) : false;
34
- if (candidateReady) {
35
- contextWorktree = candidate;
36
- source = "change_worktree";
37
- } else {
38
- warning = `stale change worktree metadata: ${candidate} (run \`git worktree prune\`)`;
39
- }
40
- }
41
- const contextBranch = await deps.currentBranch(contextWorktree);
13
+ const contextBranch = rootBranch;
42
14
  const inferred = deps.inferChangeIdFromBranch(contextBranch);
43
15
 
44
16
  return {
45
- worktree: contextWorktree,
17
+ worktree: path.resolve(gitRoot),
46
18
  branch: contextBranch,
47
19
  branchMatchesChange: inferred === changeId,
48
- source,
49
- warning,
50
- currentWorktree: rootWorktree,
20
+ source: "current_worktree",
21
+ warning: "",
22
+ currentWorktree: path.resolve(gitRoot),
51
23
  currentBranch: rootBranch,
52
- changeWorktree: changeWorktree ? path.resolve(changeWorktree) : "",
24
+ changeWorktree: "",
53
25
  };
54
26
  }
55
27
 
@@ -72,7 +44,6 @@ export async function readChangeMetrics(changeDir, deps) {
72
44
  const FINISH_DONE_COMPLETED_CLEANUPS = new Set([
73
45
  "removed",
74
46
  "pruned-missing",
75
- "skipped:no_separate_change_worktree",
76
47
  "skipped:current_worktree",
77
48
  ]);
78
49