pi-cicd 0.1.1

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/src/types.ts ADDED
@@ -0,0 +1,149 @@
1
+ /**
2
+ * pi-ci — Shared types for headless CI mode.
3
+ *
4
+ * Exit code contract and CI event types per SPEC.md §2.1 and §5.
5
+ */
6
+
7
+ // ---------------------------------------------------------------------------
8
+ // Exit codes
9
+ // ---------------------------------------------------------------------------
10
+
11
+ export const EXIT_CODES = {
12
+ SUCCESS: 0,
13
+ ERROR: 1,
14
+ TIMEOUT: 1,
15
+ BLOCKED: 10,
16
+ CANCELLED: 11,
17
+ NEEDS_INPUT: 12,
18
+ } as const;
19
+
20
+ export type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // CI events (JSONL stream)
24
+ // ---------------------------------------------------------------------------
25
+
26
+ export type CIEventType =
27
+ | "ci_start"
28
+ | "ci_progress"
29
+ | "ci_edit"
30
+ | "ci_test"
31
+ | "ci_cost"
32
+ | "ci_end";
33
+
34
+ export interface CIEventBase {
35
+ type: CIEventType;
36
+ timestamp: string; // ISO 8601
37
+ }
38
+
39
+ export interface CIStartEvent extends CIEventBase {
40
+ type: "ci_start";
41
+ task: string;
42
+ mode: "single" | "plan";
43
+ }
44
+
45
+ export type CIRunPhase =
46
+ | "exploring"
47
+ | "planning"
48
+ | "implementing"
49
+ | "verifying"
50
+ | "reviewing";
51
+
52
+ export interface CIProgressEvent extends CIEventBase {
53
+ type: "ci_progress";
54
+ phase: CIRunPhase;
55
+ files?: string[];
56
+ }
57
+
58
+ export interface CIEditEvent extends CIEventBase {
59
+ type: "ci_edit";
60
+ file: string;
61
+ lines_added: number;
62
+ lines_removed: number;
63
+ }
64
+
65
+ export interface CITestEvent extends CIEventBase {
66
+ type: "ci_test";
67
+ command: string;
68
+ passed: number;
69
+ failed: number;
70
+ }
71
+
72
+ export interface CICostEvent extends CIEventBase {
73
+ type: "ci_cost";
74
+ tokens: { input: number; output: number };
75
+ cost_usd: number;
76
+ }
77
+
78
+ export interface CIEndEvent extends CIEventBase {
79
+ type: "ci_end";
80
+ exit_code: ExitCode;
81
+ duration_ms: number;
82
+ }
83
+
84
+ export type CIEvent =
85
+ | CIStartEvent
86
+ | CIProgressEvent
87
+ | CIEditEvent
88
+ | CITestEvent
89
+ | CICostEvent
90
+ | CIEndEvent;
91
+
92
+ // ---------------------------------------------------------------------------
93
+ // Answer injection
94
+ // ---------------------------------------------------------------------------
95
+
96
+ export interface AnswerEntry {
97
+ match: string;
98
+ answer: string;
99
+ }
100
+
101
+ export interface AnswerFile {
102
+ answers: AnswerEntry[];
103
+ }
104
+
105
+ // ---------------------------------------------------------------------------
106
+ // Test results
107
+ // ---------------------------------------------------------------------------
108
+
109
+ export interface TestSummary {
110
+ passed: number;
111
+ failed: number;
112
+ total: number;
113
+ duration_ms: number;
114
+ }
115
+
116
+ // ---------------------------------------------------------------------------
117
+ // PR creation
118
+ // ---------------------------------------------------------------------------
119
+
120
+ export interface PROptions {
121
+ title: string;
122
+ body?: string;
123
+ base?: string;
124
+ head?: string;
125
+ draft?: boolean;
126
+ labels?: string[];
127
+ }
128
+
129
+ export interface PRResult {
130
+ url: string;
131
+ number: number;
132
+ }
133
+
134
+ // ---------------------------------------------------------------------------
135
+ // Pipeline
136
+ // ---------------------------------------------------------------------------
137
+
138
+ export type CIPipelineMode = "single" | "plan" | "review" | "supervised";
139
+
140
+ export interface CIOptions {
141
+ prompt: string;
142
+ mode: CIPipelineMode;
143
+ answersFile?: string;
144
+ planFile?: string;
145
+ prNumber?: number;
146
+ resume?: string;
147
+ idleTimeoutMs?: number;
148
+ maxRetries?: number;
149
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "strict": true,
7
+ "noImplicitAny": true,
8
+ "exactOptionalPropertyTypes": false,
9
+ "skipLibCheck": true,
10
+ "allowImportingTsExtensions": true,
11
+ "noEmit": true,
12
+ "types": ["node"]
13
+ },
14
+ "include": [
15
+ "*.ts",
16
+ "src/**/*.ts",
17
+ "test/**/*.ts"
18
+ ]
19
+ }