@andares/pi-toolkits 0.14.0 → 1.0.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/CHANGELOG.md +13 -0
- package/README.md +87 -21
- package/README.zh-CN.md +52 -17
- package/package.json +8 -2
- package/src/features/ask/index.test.ts +15 -0
- package/src/features/ask/index.ts +17 -0
- package/src/features/init/audit.test.ts +19 -2
- package/src/features/init/audit.ts +117 -15
- package/src/features/init/index.test.ts +123 -1
- package/src/features/init/index.ts +156 -46
- package/src/features/init/parity.test.ts +176 -0
- package/src/features/init/parity.ts +229 -0
- package/src/features/init/plan.ts +25 -3
- package/src/features/init/refresh.test.ts +88 -1
- package/src/features/init/refresh.ts +43 -64
- package/src/features/init/spec.ts +11 -0
- package/src/features/init/templates/memory-readme.md +9 -2
- package/src/features/init/test-helpers.ts +1 -0
- package/src/features/init/workflow.ts +159 -0
- package/src/features/plan/index.test.ts +51 -0
- package/src/features/plan/index.ts +24 -4
- package/src/features/quit-guard/constants.ts +18 -5
- package/src/features/quit-guard/index.ts +75 -29
- package/src/features/quit-guard/killer.test.ts +77 -0
- package/src/features/quit-guard/killer.ts +215 -0
- package/src/features/review/index.ts +14 -0
- package/src/features/review/review.test.ts +34 -2
- package/src/features/uat/index.test.ts +15 -0
- package/src/features/uat/index.ts +10 -7
- package/src/features/uat/record-tool.ts +3 -2
- package/src/features/uat/state.ts +13 -5
- package/src/lib/phases.ts +37 -0
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
* changed in between. The cache is the reason a UI refresh does not spawn git.
|
|
12
12
|
*/
|
|
13
13
|
import { execFileSync } from "node:child_process";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { STATE_FILE } from "../init/spec.js";
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
import { frameworkReadiness } from "../init/parity.js";
|
|
17
16
|
import { deriveState, ledgerPath, readEvents, type UatState } from "./ledger.js";
|
|
18
17
|
import { listRecords, type RecordEntry } from "./records.js";
|
|
19
18
|
|
|
@@ -47,9 +46,18 @@ export function resetProjectRootCache(): void {
|
|
|
47
46
|
rootCache.clear();
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The ask loop needs a usable framework, not byte-identical files: state,
|
|
51
|
+
* AGENTS.md, the memory contract and the evidence directory. Small edits to any
|
|
52
|
+
* of them are the operator's business and do not block acceptance.
|
|
53
|
+
*/
|
|
51
54
|
export function frameworkInstalled(root: string): boolean {
|
|
52
|
-
return
|
|
55
|
+
return frameworkReadiness(root).ready;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Missing pieces, for a refusal message that tells the operator what to fix. */
|
|
59
|
+
export function frameworkMissing(root: string): string[] {
|
|
60
|
+
return frameworkReadiness(root).missing;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
export interface UatSnapshot {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase helpers shared by the ask-family commands.
|
|
3
|
+
*
|
|
4
|
+
* `ask` is a mode; `ask-plan` and `ask-uat` are phases whose owning feature
|
|
5
|
+
* publishes a marker tool for the duration. The markers are deliberately the
|
|
6
|
+
* tool names the host already tracks (`plan_submit`, `uat_item`) so this helper
|
|
7
|
+
* does not need a second global control registry.
|
|
8
|
+
*/
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
import { getAskControl } from "./ask-control.js";
|
|
11
|
+
|
|
12
|
+
/** Tool the plan feature activates for the whole planning phase. */
|
|
13
|
+
export const PLAN_PHASE_TOOL = "plan_submit";
|
|
14
|
+
/** Tool the UAT feature activates while its page/phase is open. */
|
|
15
|
+
export const UAT_PHASE_TOOL = "uat_item";
|
|
16
|
+
|
|
17
|
+
export type Phase = "ask" | "plan" | "uat";
|
|
18
|
+
|
|
19
|
+
const PHASE_COMMAND: Record<Phase, string> = {
|
|
20
|
+
ask: "/ask",
|
|
21
|
+
plan: "/ask-plan",
|
|
22
|
+
uat: "/ask-uat",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function activePhases(pi: ExtensionAPI): Phase[] {
|
|
26
|
+
const tools = new Set(pi.getActiveTools());
|
|
27
|
+
const phases: Phase[] = [];
|
|
28
|
+
if (getAskControl()?.isActive()) phases.push("ask");
|
|
29
|
+
if (tools.has(PLAN_PHASE_TOOL)) phases.push("plan");
|
|
30
|
+
if (tools.has(UAT_PHASE_TOOL)) phases.push("uat");
|
|
31
|
+
return phases;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Human-readable command names for a refusal message. */
|
|
35
|
+
export function describePhases(phases: readonly Phase[]): string {
|
|
36
|
+
return phases.map((phase) => PHASE_COMMAND[phase]).join(" + ");
|
|
37
|
+
}
|