@difflab/pi 0.3.0 → 0.4.0-rc.202609231122.7b4400b

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.
Files changed (103) hide show
  1. package/README.md +22 -2
  2. package/agents/diffpi-orchestrator.md +12 -1
  3. package/agents/diffpi-planner.md +30 -0
  4. package/agents/diffpi-reviewer.md +4 -3
  5. package/agents/diffpi-worker.md +9 -1
  6. package/dist/assets.d.ts +1 -0
  7. package/dist/assets.d.ts.map +1 -1
  8. package/dist/cli/plan.d.ts +16 -0
  9. package/dist/cli/plan.d.ts.map +1 -0
  10. package/dist/cli.d.ts +4 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cli.js +7994 -0
  13. package/dist/commands/index.d.ts +1 -0
  14. package/dist/commands/index.d.ts.map +1 -1
  15. package/dist/commands/plan.d.ts +4 -0
  16. package/dist/commands/plan.d.ts.map +1 -0
  17. package/dist/commands/review.d.ts.map +1 -1
  18. package/dist/commands.d.ts +22 -0
  19. package/dist/commands.d.ts.map +1 -0
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/environment.d.ts +3 -1
  22. package/dist/environment.d.ts.map +1 -1
  23. package/dist/extensions/fsx.d.ts +8 -0
  24. package/dist/extensions/fsx.d.ts.map +1 -0
  25. package/dist/extensions/index.js +13520 -2438
  26. package/dist/extensions/processx.d.ts +2 -0
  27. package/dist/extensions/processx.d.ts.map +1 -1
  28. package/dist/extensions/subagentx.d.ts +31 -0
  29. package/dist/extensions/subagentx.d.ts.map +1 -0
  30. package/dist/extensions/tuicrx.d.ts +7 -0
  31. package/dist/extensions/tuicrx.d.ts.map +1 -1
  32. package/dist/extensions/zedx.d.ts +2 -0
  33. package/dist/extensions/zedx.d.ts.map +1 -1
  34. package/dist/extensions/zodx.d.ts +8 -0
  35. package/dist/extensions/zodx.d.ts.map +1 -0
  36. package/dist/gates.d.ts +0 -1
  37. package/dist/gates.d.ts.map +1 -1
  38. package/dist/index.d.ts +9 -4
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +6037 -315
  41. package/dist/log.d.ts +15 -0
  42. package/dist/log.d.ts.map +1 -0
  43. package/dist/plan/index.d.ts +4 -0
  44. package/dist/plan/index.d.ts.map +1 -0
  45. package/dist/plan/markdown.d.ts +6 -0
  46. package/dist/plan/markdown.d.ts.map +1 -0
  47. package/dist/plan/operations.d.ts +43 -0
  48. package/dist/plan/operations.d.ts.map +1 -0
  49. package/dist/plan/reviews.d.ts +28 -0
  50. package/dist/plan/reviews.d.ts.map +1 -0
  51. package/dist/plan/store.d.ts +37 -0
  52. package/dist/plan/store.d.ts.map +1 -0
  53. package/dist/plan/types.d.ts +127 -0
  54. package/dist/plan/types.d.ts.map +1 -0
  55. package/dist/review/github-review-backend.d.ts.map +1 -1
  56. package/dist/review/gitlab-review-backend.d.ts.map +1 -1
  57. package/dist/review/index.d.ts +2 -2
  58. package/dist/review/index.d.ts.map +1 -1
  59. package/dist/review/review-markdown.d.ts.map +1 -1
  60. package/dist/review/review-state.d.ts +1 -0
  61. package/dist/review/review-state.d.ts.map +1 -1
  62. package/dist/review/types.d.ts +12 -1
  63. package/dist/review/types.d.ts.map +1 -1
  64. package/dist/setup.d.ts.map +1 -1
  65. package/dist/store.d.ts +2 -0
  66. package/dist/store.d.ts.map +1 -1
  67. package/dist/tools/ci.d.ts +6 -0
  68. package/dist/tools/ci.d.ts.map +1 -0
  69. package/dist/tools/index.d.ts +4 -1
  70. package/dist/tools/index.d.ts.map +1 -1
  71. package/dist/tools/index.js +7808 -814
  72. package/dist/tools/log.d.ts +3 -0
  73. package/dist/tools/log.d.ts.map +1 -0
  74. package/dist/tools/modes.d.ts.map +1 -1
  75. package/dist/tools/plan-schema.d.ts +211 -0
  76. package/dist/tools/plan-schema.d.ts.map +1 -0
  77. package/dist/tools/plan.d.ts +6 -0
  78. package/dist/tools/plan.d.ts.map +1 -0
  79. package/dist/tools/review.d.ts +27 -0
  80. package/dist/tools/review.d.ts.map +1 -1
  81. package/dist/vcs/github.d.ts.map +1 -1
  82. package/dist/vcs/gitlab.d.ts.map +1 -1
  83. package/dist/vcs/types.d.ts +10 -1
  84. package/dist/vcs/types.d.ts.map +1 -1
  85. package/dist/workflow.d.ts +33 -0
  86. package/dist/workflow.d.ts.map +1 -0
  87. package/package.json +11 -2
  88. package/skills/plan/SKILL.md +23 -0
  89. package/skills/review/SKILL.md +1 -1
  90. package/skills/review/references/review-standards.md +23 -0
  91. package/skills/review/references/workflows/address.md +3 -3
  92. package/skills/review/references/workflows/complete.md +1 -1
  93. package/skills/review/references/workflows/merge.md +1 -1
  94. package/skills/review/references/workflows/publish.md +4 -4
  95. package/templates/plan/PLAN.md +40 -0
  96. package/templates/plan/implementation.md +24 -0
  97. package/workflows/plan/annotate.md +13 -0
  98. package/workflows/plan/finalize.md +15 -0
  99. package/workflows/plan/go.md +20 -0
  100. package/workflows/plan/help.md +20 -0
  101. package/workflows/plan/init.md +13 -0
  102. package/workflows/plan/new.md +20 -0
  103. package/workflows/plan/update.md +18 -0
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
+ export declare const diffpiLogTool: ToolDefinition;
3
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/tools/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAoBlF,eAAO,MAAM,aAAa,EAAE,cA0B1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../src/tools/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAElF,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB5D,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,CAiErF"}
1
+ {"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../src/tools/modes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGlF,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,UAAU,CAAC;AAiB5D,wBAAgB,eAAe,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,cAAc,EAAE,CAiErF"}
@@ -0,0 +1,211 @@
1
+ import { z } from 'zod';
2
+ declare const planTaskDraftSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ title: z.ZodString;
5
+ steps: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ fileScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
9
+ }, z.core.$strict>;
10
+ declare const planPhaseDraftSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ title: z.ZodString;
13
+ objective: z.ZodString;
14
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
+ tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ title: z.ZodString;
18
+ steps: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
20
+ fileScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
22
+ }, z.core.$strict>>>;
23
+ }, z.core.$strict>;
24
+ export declare const planContextParametersSchema: z.ZodObject<{
25
+ cwd: z.ZodOptional<z.ZodString>;
26
+ plan: z.ZodOptional<z.ZodString>;
27
+ branch: z.ZodOptional<z.ZodString>;
28
+ statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
29
+ draft: "draft";
30
+ ready: "ready";
31
+ in_progress: "in_progress";
32
+ blocked: "blocked";
33
+ completed: "completed";
34
+ }>>>;
35
+ }, z.core.$strict>;
36
+ export declare const planInitParametersSchema: z.ZodObject<{
37
+ cwd: z.ZodOptional<z.ZodString>;
38
+ shortSlug: z.ZodString;
39
+ branch: z.ZodOptional<z.ZodString>;
40
+ title: z.ZodOptional<z.ZodString>;
41
+ intent: z.ZodOptional<z.ZodString>;
42
+ issueId: z.ZodOptional<z.ZodString>;
43
+ issueUrl: z.ZodOptional<z.ZodString>;
44
+ open: z.ZodOptional<z.ZodBoolean>;
45
+ }, z.core.$strict>;
46
+ export declare const planUpdateOverviewParametersSchema: z.ZodObject<{
47
+ cwd: z.ZodOptional<z.ZodString>;
48
+ plan: z.ZodString;
49
+ expectedPlanRevision: z.ZodNumber;
50
+ intent: z.ZodOptional<z.ZodString>;
51
+ requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ design: z.ZodOptional<z.ZodObject<{
53
+ bigIdeas: z.ZodString;
54
+ keyApiUpdates: z.ZodString;
55
+ consequences: z.ZodString;
56
+ }, z.core.$strict>>;
57
+ references: z.ZodOptional<z.ZodArray<z.ZodObject<{
58
+ id: z.ZodString;
59
+ value: z.ZodString;
60
+ }, z.core.$strict>>>;
61
+ }, z.core.$strict>;
62
+ export declare const planAddPhaseParametersSchema: z.ZodObject<{
63
+ cwd: z.ZodOptional<z.ZodString>;
64
+ plan: z.ZodString;
65
+ expectedPlanRevision: z.ZodNumber;
66
+ afterPhaseId: z.ZodOptional<z.ZodString>;
67
+ phase: z.ZodObject<{
68
+ id: z.ZodString;
69
+ title: z.ZodString;
70
+ objective: z.ZodString;
71
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
73
+ id: z.ZodString;
74
+ title: z.ZodString;
75
+ steps: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
+ fileScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
+ acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
+ }, z.core.$strict>>>;
80
+ }, z.core.$strict>;
81
+ }, z.core.$strict>;
82
+ export declare const planRemovePhaseParametersSchema: z.ZodObject<{
83
+ cwd: z.ZodOptional<z.ZodString>;
84
+ plan: z.ZodString;
85
+ expectedPlanRevision: z.ZodNumber;
86
+ phaseId: z.ZodString;
87
+ reason: z.ZodString;
88
+ }, z.core.$strict>;
89
+ export declare const planUpdatePhaseParametersSchema: z.ZodObject<{
90
+ cwd: z.ZodOptional<z.ZodString>;
91
+ plan: z.ZodString;
92
+ expectedPlanRevision: z.ZodNumber;
93
+ phaseId: z.ZodString;
94
+ patch: z.ZodObject<{
95
+ title: z.ZodOptional<z.ZodString>;
96
+ objective: z.ZodOptional<z.ZodString>;
97
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
99
+ id: z.ZodString;
100
+ title: z.ZodString;
101
+ steps: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
103
+ fileScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
+ acceptanceCriteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
105
+ }, z.core.$strict>>>;
106
+ }, z.core.$strict>;
107
+ }, z.core.$strict>;
108
+ export declare const planValidateParametersSchema: z.ZodObject<{
109
+ cwd: z.ZodOptional<z.ZodString>;
110
+ plan: z.ZodString;
111
+ strict: z.ZodOptional<z.ZodBoolean>;
112
+ }, z.core.$strict>;
113
+ export declare const planLogProgressParametersSchema: z.ZodObject<{
114
+ cwd: z.ZodOptional<z.ZodString>;
115
+ plan: z.ZodString;
116
+ actor: z.ZodString;
117
+ message: z.ZodString;
118
+ executionId: z.ZodOptional<z.ZodString>;
119
+ phaseId: z.ZodOptional<z.ZodString>;
120
+ taskId: z.ZodOptional<z.ZodString>;
121
+ evidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
+ }, z.core.$strict>;
124
+ export declare const planRunGatesParametersSchema: z.ZodObject<{
125
+ cwd: z.ZodOptional<z.ZodString>;
126
+ plan: z.ZodString;
127
+ phaseId: z.ZodString;
128
+ expectedPhaseRevision: z.ZodNumber;
129
+ executionId: z.ZodString;
130
+ actor: z.ZodString;
131
+ }, z.core.$strict>;
132
+ export declare const planRecordCiParametersSchema: z.ZodObject<{
133
+ cwd: z.ZodOptional<z.ZodString>;
134
+ plan: z.ZodString;
135
+ phaseId: z.ZodString;
136
+ sha: z.ZodString;
137
+ executionId: z.ZodString;
138
+ actor: z.ZodString;
139
+ status: z.ZodEnum<{
140
+ skipped: "skipped";
141
+ passed: "passed";
142
+ failed: "failed";
143
+ }>;
144
+ detail: z.ZodString;
145
+ retryReason: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>;
147
+ export declare const planLookupParametersSchema: z.ZodObject<{
148
+ cwd: z.ZodOptional<z.ZodString>;
149
+ plan: z.ZodOptional<z.ZodString>;
150
+ }, z.core.$strict>;
151
+ export declare const planStartExecutionParametersSchema: z.ZodObject<{
152
+ cwd: z.ZodOptional<z.ZodString>;
153
+ plan: z.ZodString;
154
+ commitMode: z.ZodEnum<{
155
+ push: "push";
156
+ "no-commit": "no-commit";
157
+ commit: "commit";
158
+ }>;
159
+ actor: z.ZodString;
160
+ }, z.core.$strict>;
161
+ export declare const planUpdateStatusParametersSchema: z.ZodObject<{
162
+ cwd: z.ZodOptional<z.ZodString>;
163
+ plan: z.ZodString;
164
+ target: z.ZodObject<{
165
+ type: z.ZodEnum<{
166
+ phase: "phase";
167
+ task: "task";
168
+ plan: "plan";
169
+ }>;
170
+ id: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strict>;
172
+ expectedStatus: z.ZodEnum<{
173
+ draft: "draft";
174
+ ready: "ready";
175
+ in_progress: "in_progress";
176
+ blocked: "blocked";
177
+ completed: "completed";
178
+ pending: "pending";
179
+ skipped: "skipped";
180
+ }>;
181
+ status: z.ZodEnum<{
182
+ draft: "draft";
183
+ ready: "ready";
184
+ in_progress: "in_progress";
185
+ blocked: "blocked";
186
+ completed: "completed";
187
+ pending: "pending";
188
+ skipped: "skipped";
189
+ }>;
190
+ actor: z.ZodString;
191
+ message: z.ZodString;
192
+ executionId: z.ZodOptional<z.ZodString>;
193
+ evidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
194
+ blockedReason: z.ZodOptional<z.ZodString>;
195
+ attempts: z.ZodOptional<z.ZodArray<z.ZodString>>;
196
+ needsUserDecision: z.ZodOptional<z.ZodBoolean>;
197
+ commit: z.ZodOptional<z.ZodObject<{
198
+ sha: z.ZodString;
199
+ subject: z.ZodString;
200
+ completedAt: z.ZodString;
201
+ pushedAt: z.ZodOptional<z.ZodString>;
202
+ ci: z.ZodOptional<z.ZodObject<{
203
+ status: z.ZodLiteral<"pending">;
204
+ startedAt: z.ZodString;
205
+ }, z.core.$strict>>;
206
+ }, z.core.$strict>>;
207
+ }, z.core.$strict>;
208
+ export type PlanTaskDraft = z.infer<typeof planTaskDraftSchema>;
209
+ export type PlanPhaseDraft = z.infer<typeof planPhaseDraftSchema>;
210
+ export {};
211
+ //# sourceMappingURL=plan-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-schema.d.ts","sourceRoot":"","sources":["../../src/tools/plan-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,QAAA,MAAM,mBAAmB;;;;;;;kBASd,CAAC;AAEZ,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;kBAQf,CAAC;AAYZ,eAAO,MAAM,2BAA2B;;;;;;;;;;;kBAO7B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;kBAW1B,CAAC;AAEZ,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;kBAa3C,CAAC;AAEL,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;kBAQ9B,CAAC;AAEZ,eAAO,MAAM,+BAA+B;;;;;;kBAQjC,CAAC;AAEZ,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;kBAejC,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;kBAE9B,CAAC;AAEZ,eAAO,MAAM,+BAA+B;;;;;;;;;;kBAYjC,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;;;;kBAS9B,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;kBAY9B,CAAC;AAEZ,eAAO,MAAM,0BAA0B;;;kBAAkE,CAAC;AAE1G,eAAO,MAAM,kCAAkC;;;;;;;;;kBAOpC,CAAC;AAEZ,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA+BlC,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ExtensionAPI, ToolDefinition } from '@earendil-works/pi-coding-agent';
2
+ import type { ModeController } from '../modes';
3
+ import { type PlanStore } from '../plan/store';
4
+ export type PlanToolRuntime = Pick<ExtensionAPI, 'events' | 'sendUserMessage'> & Partial<Pick<ExtensionAPI, 'sendMessage'>>;
5
+ export declare function createPlanTools(_pi: PlanToolRuntime, _modes: ModeController, store?: PlanStore): readonly ToolDefinition[];
6
+ //# sourceMappingURL=plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/tools/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAQpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM/C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAmBhE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,GAAG,iBAAiB,CAAC,GAC5E,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;AAE7C,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,cAAc,EACtB,KAAK,GAAE,SAA6B,GACnC,SAAS,cAAc,EAAE,CA6W3B"}
@@ -1,6 +1,33 @@
1
1
  import { type ToolDefinition } from '@earendil-works/pi-coding-agent';
2
2
  import { type ReviewComment, type ReviewThreadRecord } from '../review';
3
3
  export declare function hasReviewDraft(comments: readonly ReviewComment[], body: string): boolean;
4
+ export declare function partitionReviewComments(comments: readonly ReviewComment[], knownFingerprints: ReadonlySet<string>, model: string): {
5
+ checkpointed: {
6
+ source: ReviewComment;
7
+ published: {
8
+ body: string;
9
+ file: string;
10
+ line?: number;
11
+ side?: import("..").ReviewSide;
12
+ author?: string;
13
+ sourceCommentId?: string;
14
+ };
15
+ fingerprint: string;
16
+ }[];
17
+ candidates: {
18
+ source: ReviewComment;
19
+ published: {
20
+ body: string;
21
+ file: string;
22
+ line?: number;
23
+ side?: import("..").ReviewSide;
24
+ author?: string;
25
+ sourceCommentId?: string;
26
+ };
27
+ fingerprint: string;
28
+ }[];
29
+ };
30
+ export declare function resolveReviewThread(comment: ReviewComment, threads: readonly ReviewThreadRecord[]): ReviewThreadRecord | undefined;
4
31
  export declare function workingTreeDiff(cwd: string): Promise<string>;
5
32
  export declare function createReviewTools(): readonly ToolDefinition[];
6
33
  export declare function syncLocalThreadArtifact(path: string, title: string, sessionSlug: string, threads: readonly ReviewThreadRecord[]): Promise<ReviewThreadRecord[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/tools/review.ts"],"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AAID,wBAAgB,iBAAiB,IAAI,SAAS,cAAc,EAAE,CAyc7D;AAID,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,SAAS,kBAAkB,EAAE,GACrC,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwB/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/vcs/github.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAYjD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAuGzD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CA6B1D"}
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/vcs/github.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAYjD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CA2IzD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CA4B1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../src/vcs/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAajD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAgFzD"}
1
+ {"version":3,"file":"gitlab.d.ts","sourceRoot":"","sources":["../../src/vcs/gitlab.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAajD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CA4GzD"}
@@ -8,6 +8,11 @@ export interface PrRef {
8
8
  headRef: string;
9
9
  headSha?: string;
10
10
  }
11
+ export type HostedCiStatus = 'passed' | 'failed' | 'pending' | 'skipped';
12
+ export interface HostedCiResult {
13
+ status: HostedCiStatus;
14
+ detail: string;
15
+ }
11
16
  export interface OpenPrOptions {
12
17
  title: string;
13
18
  body: string;
@@ -22,7 +27,11 @@ export interface VcsBackend {
22
27
  viewPr(idOrBranch: string): Promise<PrRef | undefined>;
23
28
  defaultBranch(): Promise<string>;
24
29
  prDiff(id: number): Promise<string>;
25
- prChecks(id: number): Promise<string>;
30
+ prChecks(id: number): Promise<HostedCiResult>;
31
+ watchCommitCi(sha: string, options: {
32
+ intervalSeconds: number;
33
+ signal?: AbortSignal;
34
+ }): Promise<HostedCiResult>;
26
35
  markReady(id: number): Promise<void>;
27
36
  closePr(id: number, comment?: string): Promise<void>;
28
37
  mergePr(id: number, subject: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vcs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,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EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrD;AAED,yEAAyE;AACzE,MAAM,MAAM,KAAK,GAAG,UAAU,CAAC"}
@@ -0,0 +1,33 @@
1
+ export type PlanWorkflowName = 'init' | 'new' | 'update' | 'annotate' | 'finalize' | 'go' | 'help';
2
+ export type PlanWorkflowArguments = {
3
+ init: {
4
+ plan: string;
5
+ branch?: string;
6
+ };
7
+ new: {
8
+ plan: string;
9
+ branch?: string;
10
+ background: boolean;
11
+ prompt?: string;
12
+ };
13
+ update: {
14
+ plan?: string;
15
+ branch?: string;
16
+ background: boolean;
17
+ instructions?: string;
18
+ };
19
+ annotate: {
20
+ plan?: string;
21
+ };
22
+ finalize: {
23
+ plan?: string;
24
+ };
25
+ go: {
26
+ plan: string;
27
+ commitMode: 'no-commit' | 'commit' | 'push';
28
+ background: boolean;
29
+ };
30
+ help: Record<string, never>;
31
+ };
32
+ export declare function loadPlanWorkflow<Name extends PlanWorkflowName>(name: Name, args: PlanWorkflowArguments[Name]): Promise<string>;
33
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC;AAEnG,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7E,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvF,QAAQ,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,QAAQ,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IACvF,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC7B,CAAC;AAIF,wBAAsB,gBAAgB,CAAC,IAAI,SAAS,gBAAgB,EAClE,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,qBAAqB,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,MAAM,CAAC,CAMjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difflab/pi",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-rc.202609231122.7b4400b",
4
4
  "description": "Tools and skills for the pi coding agent",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,9 @@
17
17
  "type": "module",
18
18
  "main": "./dist/index.js",
19
19
  "types": "./dist/index.d.ts",
20
+ "bin": {
21
+ "diffpi": "./dist/cli.js"
22
+ },
20
23
  "exports": {
21
24
  ".": {
22
25
  "types": "./dist/index.d.ts",
@@ -31,7 +34,8 @@
31
34
  "agents/",
32
35
  "dist/",
33
36
  "skills/",
34
- "templates/"
37
+ "templates/",
38
+ "workflows/"
35
39
  ],
36
40
  "pi": {
37
41
  "extensions": [
@@ -54,7 +58,12 @@
54
58
  },
55
59
  "dependencies": {
56
60
  "@juicesharp/rpiv-ask-user-question": "^2.10.1",
61
+ "cmd-ts": "^0.15.0",
62
+ "commander": "^14.0.0",
63
+ "mdast-builder": "1.1.1",
57
64
  "pi-mcp-adapter": "^2.33.0",
65
+ "remark-stringify": "11.0.0",
66
+ "unified": "11.0.5",
58
67
  "zod": "^4.6.5"
59
68
  },
60
69
  "devDependencies": {
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: plan
3
+ description: Route natural-language planning requests to Diffpi's /plan commands. Use when a user wants to create, revise, annotate, finalize, or execute a durable plan, or asks which /plan command to run.
4
+ allowed-tools: ask_user_question
5
+ ---
6
+
7
+ # Plan Command Guide
8
+
9
+ Use `/plan` commands as the execution boundary. Do not reproduce their workflows, call `plan_*` tools directly, or edit managed plan files.
10
+
11
+ ## Natural-language routing
12
+
13
+ Map the user's intent to one command:
14
+
15
+ - Create an empty plan shell: `/plan init <short-slug> [--branch <name>]`
16
+ - Research and author a complete plan: `/plan new <short-slug> [--branch <name>] [--bg] [prompt...]`
17
+ - Revise a plan from chat instructions or its current plan review: `/plan update [short-slug] [--branch <name>] [--bg] [instructions...]`
18
+ - Review a plan in tuicr and save the result: `/plan annotate [short-slug]`
19
+ - Validate and mark a plan ready: `/plan finalize [short-slug]`
20
+ - Execute a plan: `/plan go <short-slug> [--mode <no-commit|commit|push>] [--bg]`
21
+ - Show command help: `/plan help`
22
+
23
+ Infer the command, slug, branch, and free-text arguments from recent conversation when they are clear. If a required value cannot be inferred, use `ask_user_question`; do not ask in plain chat. Then give the user one exact, copyable `/plan` command. Explain defaults only when relevant: `go` uses `--mode no-commit` when `--mode` is omitted.
@@ -12,6 +12,6 @@ Parse the first non-flag argument as VERB and preserve remaining flags. Normaliz
12
12
 
13
13
  Read and follow `references/workflows/{VERB}.md`. Call `review_context` first in every workflow. Use `ask_user_question` for choices that cannot be derived from the request. Never ask those questions as plain chat text.
14
14
 
15
- For inline execution, `/review auto` and `/review address` activate the reviewer profile on Sol; lifecycle verbs activate the orchestrator profile on Luna. The reviewer coordinates `address`, classifies every thread, and delegates bounded implementation to lightweight worker agents. With `--bg`, the command leaves the current chat mode unchanged and launches a tracked background orchestrator, which routes `auto` and `address` through the reviewer.
15
+ For inline execution, `/review auto` and `/review address` activate the reviewer profile on Sol; lifecycle verbs activate the orchestrator profile on Luna. The reviewer coordinates `address`, classifies every thread, and delegates bounded implementation to lightweight worker agents. With `--bg`, the command leaves the current chat mode unchanged and launches one named background orchestrator through the pi-subagents cross-extension RPC. Do not add an extra model turn or use recursive Pi or `/bg --agent` for this dispatch. For further delegation, use `Agent`, `get_subagent_result`, and `steer_subagent`; use `SubagentWorkflow` for deterministic multi-stage orchestration. Reserve pi-background-tasks for ordinary long-running shell commands, tests, builds, and servers.
16
16
 
17
17
  Workflow index: `auto` generates findings and leaves remote comments pending; `new` creates a local review or remote draft PR/MR; `edit` opens an existing local or remote review for the user; `address` fixes local or remote comments, commits remote fixes through `/git`, and records or posts replies; `publish` promotes pending review work; `complete` approves, rejects, abandons, or archives a review without merging; `merge` is the separate GitHub-only merge action; `help` prints the reference.
@@ -0,0 +1,23 @@
1
+ # Review standards
2
+
3
+ Use these rules for review and address workflows.
4
+
5
+ ## Intent
6
+
7
+ Check that the change serves the stated PR intent. Treat a missing required behavior as blocking.
8
+
9
+ ## Correctness
10
+
11
+ Trace the main path and important failure paths. Check validation, persistence, retries, permissions, and user-visible errors.
12
+
13
+ ## Scope
14
+
15
+ Reject unrelated churn, duplicate abstractions, speculative follow-ups, and generated code that does not reduce complexity. If a requested change is relevant, apply it in the current workflow. Defer only when the user explicitly defers it or a required decision is blocked.
16
+
17
+ ## Design
18
+
19
+ Prefer existing package APIs and small public surfaces. Add a dependency when it is a maintained fit for the problem. Do not recreate a general-purpose parser, scheduler, or subagent system without checking installed packages first.
20
+
21
+ ## Responses
22
+
23
+ Respond to every addressed thread. State what changed and include verification evidence. Keep every thread open for the user to resolve. Address workflows must never resolve or delete threads.
@@ -4,8 +4,8 @@
4
4
  2. Run this workflow as the reviewer coordinator. Call `review_context` with the target and backend selection.
5
5
  3. Call `review_comments`. With `--local`, it synchronizes every comment in the selected tuicr session to `.diffpi/review/<session-slug>.md`. Existing replies and statuses remain; source comments removed by the user become resolved ledger entries.
6
6
  4. Classify every thread, group justified code changes into bounded non-overlapping tasks, and delegate those tasks to lightweight worker agents. Keep questions, outcome decisions, integration, and response text in the reviewer coordinator. With `--local`, workers modify the current working tree without committing. Without `--local`, apply a fix only when the comment requests a change.
7
- 5. Respond to every thread with its outcome. Answer questions and leave them open. For substantive requests, state what changed and whether it is resolved, but leave the thread open for reviewer confirmation. For a trivial request, reply `Resolved`; remote threads may close, while the user must delete the local tuicr source comment before the next sync marks it resolved.
7
+ 5. Respond to every thread with its outcome. Answer questions and leave them open. For substantive requests, state what changed and whether it is resolved, but leave every thread open for the user to resolve. Do not resolve remote threads or delete local source comments in this workflow, including for trivial requests.
8
8
  6. When a remote address flow changes code, invoke the upstream `/git commit --no-push` workflow after checks pass and before drafting responses. Use `--atomic` when the fixes form separate logical commits.
9
- 7. Call `review_respond` for each thread. With `--local`, every response is posted to tuicr and recorded in the session ledger. Without `--local`, replies post to the forge immediately.
9
+ 7. Call `review_respond` for each thread with `resolve: false`. With `--local`, every response is posted to tuicr and recorded in the session ledger. Without `--local`, replies post to the forge immediately. The user owns thread resolution.
10
10
  8. With `--local`, call `review_launch_ui` with `local: true` after replies are recorded so the user can inspect the working-tree review in tuicr.
11
- 9. Report fixed, committed, answered, addressed, resolved, and unresolved counts. Do not publish, complete, or merge in this workflow.
11
+ 9. Report fixed, committed, answered, addressed, unresolved, and skipped counts. Resolved must always be zero in this workflow. Do not publish, complete, or merge.
@@ -1,6 +1,6 @@
1
1
  # complete
2
2
 
3
- 1. Parse an optional PR/MR id or URL, `--local`, and exactly one remote action: `--approve`, `--reject`, or `--abandon`. `close` is an alias for this workflow.
3
+ 1. Parse an optional PR/MR id or URL, `--local`, and exactly one remote action: `--approve`, `--reject`, or `--abandon`. `close` is an alias for this workflow. If the action is omitted, ask the user with `header: "Action"`; all question headers must be 16 characters or fewer.
4
4
  2. Call `review_context` with the same target and backend selection.
5
5
  3. With `--local`, call `review_complete` with `local: true`. It archives the reply overlay to `.diffpi/reviews/<session-slug>.md`, then deletes the exact persisted tuicr session. This is destructive and prevents its comments from appearing in future tuicr sessions.
6
6
  4. Without `--local`, map `--approve`, `--reject`, or `--abandon` to the `review_complete` action `approve`, `reject`, or `abandon`. The tool applies the remote lifecycle action but does not merge.
@@ -1,6 +1,6 @@
1
1
  # merge
2
2
 
3
- 1. Call `review_context` and confirm the PR/MR is approved and ready.
3
+ 1. Call `review_context` and confirm the GitHub PR is open, non-draft, clean, and its checks are settled. Do not require an approval from the current user; authors cannot approve their own PRs. GitHub branch protection remains authoritative.
4
4
  2. If a conventional squash subject is required and the subject is unclear, use `ask_user_question`.
5
5
  3. Call `review_merge` with the chosen subject.
6
6
  4. Report the merge result.
@@ -1,8 +1,8 @@
1
1
  # publish
2
2
 
3
3
  1. Parse an optional PR/MR id or URL, `--local`, and one status: `--comment`, `--approve`, `--request-changes`, or `--close`. The default is comment.
4
- 2. Call `review_context` with the target and backend selection.
5
- 3. For `--local`, call `review_publish` with `local: true`. The tool reads the exact tuicr session, promotes its unpublished line comments to a pending forge review, follows the stored local overlay path, posts unpublished replies to their remote threads, and then publishes the selected status. Question replies remain open. The tool does not post an overall review comment.
6
- 4. For a remote review, call `review_publish` without `local`. The existing pending forge comments already contain provenance, so the tool only publishes them with the selected status and no overall comment.
4
+ 2. Call `review_context` with the target and `local: true` so the exact tuicr PR session can be inspected. If that session exists and has drafts, publish through the local promotion path even when the user omitted `--local`. Use `local: false` only when no matching tuicr session exists or when the target has forge-native pending review work.
5
+ 3. The local promotion path reads the exact tuicr session. A local line comment on the same file and line as an existing remote thread is treated as a response, not a new comment. A leading `[REOPEN]`, `[RESOLVE]`, or `[DELETE]` changes the thread state; the marker is removed from the response body. `[DELETE]` deletes the matched remote thread when the forge supports it. Other unpublished line comments become new review comments. The tool follows the stored local overlay path, posts unpublished replies to their remote threads, and then publishes the selected status. Question replies remain open. The tool does not post an overall review comment.
6
+ 4. For a forge-native review without a matching tuicr session, call `review_publish` without `local`. Existing pending forge comments already contain provenance, so the tool only publishes them with the selected status and no overall comment.
7
7
  5. Comment, approve, and request-changes mark a draft PR/MR ready before publication. Close publishes pending work as comment status and then closes the PR/MR. GitLab rejects request-changes because it has no equivalent review state.
8
- 6. Report promoted comment and reply counts, the public status, and the final PR/MR state. Publishing never merges.
8
+ 6. Report promoted comment and reply counts, the public status, and the final PR/MR state. Publishing never merges. If a response cannot be matched by file and line, report it as a new comment rather than silently attaching it to the wrong thread.
@@ -0,0 +1,40 @@
1
+ <!-- diffpi-plan: {"schemaVersion":1,"id":"{{id}}","revision":0,"branch":"{{branch}}","status":"draft","createdAt":"{{created_at}}","updatedAt":"{{updated_at}}"} -->
2
+
3
+ # {{title}}
4
+
5
+ - **Plan ID:** {{id}}
6
+ - **Branch:** {{branch}}
7
+ - **Issue:** {{issue_id}}
8
+ - **Issue URL:** {{issue_url}}
9
+ - **Status:** draft
10
+ - **Revision:** 0
11
+
12
+ ## Intent
13
+
14
+ {{intent}}
15
+
16
+ ## Requirements
17
+
18
+ <!-- Add requirements. -->
19
+
20
+ ## Design
21
+
22
+ ### Big Ideas
23
+
24
+ <!-- Describe the main approach. -->
25
+
26
+ ### Key API Addition/Updates
27
+
28
+ <!-- Describe public API changes. -->
29
+
30
+ ### Consequences
31
+
32
+ <!-- Describe trade-offs and limitations. -->
33
+
34
+ ## Implementation
35
+
36
+ <!-- Add phases with plan_add_phase. -->
37
+
38
+ ## References
39
+
40
+ <!-- Add references. -->
@@ -0,0 +1,24 @@
1
+ # Phase {{phase_id}}: {{phase_title}}
2
+
3
+ ## Summary
4
+
5
+ <!-- State the change delivered by this phase in one short paragraph or up to three bullets. -->
6
+
7
+ ## Scope
8
+
9
+ **Objective:** {{phase_objective}}
10
+
11
+ **Tasks:**
12
+ {{phase_tasks}}
13
+
14
+ ## Files Changed
15
+
16
+ <!-- Show the directory tree. Annotate files added, removed, and updated. -->
17
+
18
+ ## API Changes
19
+
20
+ <!-- Document each public app, library, module, class, or function. Include behavior, data contracts, and imperative or declarative APIs. -->
21
+
22
+ ## Implementation Constraints
23
+
24
+ <!-- State required libraries, algorithms, patterns, restrictions, and important implementation details. -->
@@ -0,0 +1,13 @@
1
+ # annotate
2
+
3
+ ## Arguments
4
+
5
+ - **Invocation:** `/plan annotate [short-slug]`
6
+ - `[short-slug]` (optional): Plan to annotate. Omit it only when context resolves exactly one plan.
7
+
8
+ ## Instructions
9
+
10
+ 1. Call `plan_context` and infer planId from the provided short slug/conversation context. Fall back to looking at available active plan candidates, and ask user which to annotate listing available options.
11
+ 2. Call `plan_annotate`; it uses `tuicr --file .diffpi/plan/{planId}`, never `-p` or `--path`.
12
+ 3. Report the selected plan, launch result, and copyable fallback command. Closing tuicr saves one immutable plan review for the current plan revision.
13
+ 4. Tell the user to run `/plan update <plan-id>` after closing tuicr.
@@ -0,0 +1,15 @@
1
+ # finalize
2
+
3
+ ## Arguments
4
+
5
+ - **Invocation:** `/plan finalize [short-slug]`
6
+ - `[short-slug]` (optional): Plan to validate and mark ready. Omit it only when context resolves exactly one plan.
7
+
8
+ ## Instructions
9
+
10
+ 1. Call `plan_context` and use the current persisted plan, including changes authored through chat.
11
+ 2. Call `plan_review` once. If a review exists for the current plan revision, apply its feedback using the update workflow's mutation rules. If no review exists, continue directly.
12
+ 3. Call `plan_validate` with `strict: true`. Address validation issues and stop on unresolved errors or Design above 800 words.
13
+ 4. Mark the draft ready with `plan_update_status`.
14
+ 5. Use one `ask_user_question` call to choose the next action. Choices are foreground execution, background execution, execute later, or continue planning. When execution is selected, also ask for `no-commit`, `commit`, or `push` mode.
15
+ 6. Call `diffpi_modes_unset` before returning so finalization exits to the default inline mode. For execution, return the exact `/plan go <short-slug> --mode <mode>` command, adding `--bg` for background execution. Do not call `plan_start_execution`; `/plan go` routes execution to Orchestrator.
@@ -0,0 +1,20 @@
1
+ # go
2
+
3
+ ## Arguments
4
+
5
+ - **Invocation:** `/plan go <short-slug> [--mode <no-commit|commit|push>] [--bg]`
6
+ - `<short-slug>` (required): Plan to execute.
7
+ - `--mode no-commit` (optional, default): Execute without creating commits.
8
+ - `--mode commit` (optional): Create one local commit after each completed phase. Do not push or monitor remote CI.
9
+ - `--mode push` (optional): Create and push one commit after each completed phase, then monitor remote CI before completion.
10
+ - `--bg` (optional): Launch the execution Orchestrator in the background and preserve the current foreground mode.
11
+
12
+ ## Instructions
13
+
14
+ 1. Call `plan_context` with the supplied slug.
15
+ 2. Read the requested commit mode from `--mode`. Use `no-commit` when the flag is omitted. Do not ask the user to select a commit mode.
16
+ 3. Reject values other than `no-commit`, `commit`, or `push`. The command parser normally performs this validation before invoking the workflow.
17
+ 4. The command has already selected the foreground Orchestrator or launched the background Orchestrator. Continue as the current Orchestrator and launch implementation Workers as needed.
18
+ 5. Call `plan_start_execution` with the selected commit mode. This tool initializes durable execution state and returns the execution packet. It does not select a mode, send another turn, or launch an agent.
19
+ 6. In `no-commit` mode, do not create or push commits. In `commit` mode, create one local commit after each phase passes its gates, but do not push or monitor remote CI. In `push` mode, commit and push each phase, record pending CI, and launch a bounded background Worker to call `watch_ci` for the exact commit and then `plan_record_ci` for the phase while the next phase executes. Collect that monitor before the next push and collect all monitors before completion; failed or timed-out CI blocks execution.
20
+ 7. For foreground execution, call `diffpi_modes_unset` after the plan is completed. Background execution must not change the foreground mode. Report the execution ID and selected commit mode.