@p4pilot/core 0.1.0 → 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/dist/browser.cjs +44 -5
- package/dist/browser.js +2 -2
- package/dist/{chunk-QIZ2GXWH.js → chunk-WVX5D7PO.js} +42 -5
- package/dist/{chunk-HLG24B6W.js → chunk-YXI7CC7G.js} +2 -0
- package/dist/index.cjs +42 -5
- package/dist/index.js +1 -1
- package/dist/p4-client.d.ts.map +1 -0
- package/dist/p4-client.js +263 -0
- package/dist/p4-client.js.map +1 -0
- package/dist/testing/mock-runner.cjs +2 -0
- package/dist/testing/mock-runner.js +1 -1
- package/package.json +67 -67
package/dist/browser.cjs
CHANGED
|
@@ -109,6 +109,32 @@ function asArray(value) {
|
|
|
109
109
|
if (value === void 0) return [];
|
|
110
110
|
return Array.isArray(value) ? value : [value];
|
|
111
111
|
}
|
|
112
|
+
function mergeRecords(records) {
|
|
113
|
+
const merged = /* @__PURE__ */ new Map();
|
|
114
|
+
for (const record of records) {
|
|
115
|
+
for (const [key, value] of record) merged.set(key, value);
|
|
116
|
+
}
|
|
117
|
+
return merged;
|
|
118
|
+
}
|
|
119
|
+
function extractUnifiedDiff(stdout) {
|
|
120
|
+
const lines = [];
|
|
121
|
+
let depotFile;
|
|
122
|
+
let inHunk = false;
|
|
123
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
124
|
+
if (line.startsWith("... depotFile ")) {
|
|
125
|
+
depotFile = line.slice("... depotFile ".length);
|
|
126
|
+
inHunk = false;
|
|
127
|
+
} else if (line.startsWith("@@")) {
|
|
128
|
+
if (depotFile !== void 0) lines.push(`--- ${depotFile}`);
|
|
129
|
+
lines.push(line);
|
|
130
|
+
inHunk = true;
|
|
131
|
+
} else if (inHunk && !line.startsWith("... ")) {
|
|
132
|
+
lines.push(line);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const diff = lines.join("\n").trimEnd();
|
|
136
|
+
return diff.length === 0 ? void 0 : diff;
|
|
137
|
+
}
|
|
112
138
|
function toOpenedFile(record) {
|
|
113
139
|
return {
|
|
114
140
|
depotFile: record.get("depotFile") ?? "",
|
|
@@ -196,7 +222,9 @@ var P4Client = class {
|
|
|
196
222
|
if (opts?.changelist) args.push("-c", opts.changelist);
|
|
197
223
|
args.push(...files);
|
|
198
224
|
const { stdout } = await this.#run(args);
|
|
199
|
-
|
|
225
|
+
const opened = parseZtag(stdout).map(toOpenedFile);
|
|
226
|
+
if (opts?.changelist === void 0) return opened;
|
|
227
|
+
return opened.map((file) => ({ ...file, change: opts.changelist }));
|
|
200
228
|
}
|
|
201
229
|
async revert(files) {
|
|
202
230
|
if (files.length === 0) return [];
|
|
@@ -238,13 +266,14 @@ var P4Client = class {
|
|
|
238
266
|
if (opts?.diff) args.push("-du");
|
|
239
267
|
args.push(change);
|
|
240
268
|
const { stdout } = await this.#run(args);
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
269
|
+
const records = parseZtag(stdout);
|
|
270
|
+
if (records.length === 0) {
|
|
243
271
|
throw new P4PilotError(
|
|
244
272
|
`p4 describe returned nothing for ${change}`,
|
|
245
273
|
"P4_COMMAND_FAILED"
|
|
246
274
|
);
|
|
247
275
|
}
|
|
276
|
+
const record = mergeRecords(records);
|
|
248
277
|
const grouped = groupIndexed(record);
|
|
249
278
|
const depotFiles = asArray(grouped.depotFile);
|
|
250
279
|
const actions = asArray(grouped.action);
|
|
@@ -254,12 +283,17 @@ var P4Client = class {
|
|
|
254
283
|
action: actions[index] ?? "edit",
|
|
255
284
|
rev: revs[index] === void 0 ? void 0 : Number(revs[index])
|
|
256
285
|
}));
|
|
286
|
+
let diff = str(grouped.diff) ?? extractUnifiedDiff(stdout);
|
|
287
|
+
if (opts?.diff && grouped.status === "pending" && depotFiles.length > 0) {
|
|
288
|
+
const result = await this.#run(["diff", "-du", ...depotFiles]);
|
|
289
|
+
diff = extractUnifiedDiff(result.stdout);
|
|
290
|
+
}
|
|
257
291
|
return {
|
|
258
292
|
change: str(grouped.change) ?? change,
|
|
259
293
|
description: str(grouped.desc) ?? "",
|
|
260
294
|
user: str(grouped.user),
|
|
261
295
|
files,
|
|
262
|
-
diff
|
|
296
|
+
diff
|
|
263
297
|
};
|
|
264
298
|
}
|
|
265
299
|
async filelog(file, opts) {
|
|
@@ -304,7 +338,10 @@ Description:
|
|
|
304
338
|
async reopen(files, changelist) {
|
|
305
339
|
if (files.length === 0) return [];
|
|
306
340
|
const { stdout } = await this.#run(["reopen", "-c", changelist, ...files]);
|
|
307
|
-
return parseZtag(stdout).map(
|
|
341
|
+
return parseZtag(stdout).map((record) => ({
|
|
342
|
+
...toOpenedFile(record),
|
|
343
|
+
change: changelist
|
|
344
|
+
}));
|
|
308
345
|
}
|
|
309
346
|
};
|
|
310
347
|
|
|
@@ -560,6 +597,8 @@ var MockP4Runner = class {
|
|
|
560
597
|
return this.runChanges(commandArgs);
|
|
561
598
|
case "describe":
|
|
562
599
|
return this.runDescribe(commandArgs);
|
|
600
|
+
case "diff":
|
|
601
|
+
return success();
|
|
563
602
|
case "change":
|
|
564
603
|
return this.runChange(commandArgs, opts);
|
|
565
604
|
case "sync":
|
package/dist/browser.js
CHANGED
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
ensureOpenForEditMany,
|
|
9
9
|
groupIndexed,
|
|
10
10
|
parseZtag
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WVX5D7PO.js";
|
|
12
12
|
import {
|
|
13
13
|
MockP4Runner
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YXI7CC7G.js";
|
|
15
15
|
export {
|
|
16
16
|
DEFAULT_ASSET_GUARD_CONFIG,
|
|
17
17
|
MockP4Runner,
|
|
@@ -74,6 +74,32 @@ function asArray(value) {
|
|
|
74
74
|
if (value === void 0) return [];
|
|
75
75
|
return Array.isArray(value) ? value : [value];
|
|
76
76
|
}
|
|
77
|
+
function mergeRecords(records) {
|
|
78
|
+
const merged = /* @__PURE__ */ new Map();
|
|
79
|
+
for (const record of records) {
|
|
80
|
+
for (const [key, value] of record) merged.set(key, value);
|
|
81
|
+
}
|
|
82
|
+
return merged;
|
|
83
|
+
}
|
|
84
|
+
function extractUnifiedDiff(stdout) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
let depotFile;
|
|
87
|
+
let inHunk = false;
|
|
88
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
89
|
+
if (line.startsWith("... depotFile ")) {
|
|
90
|
+
depotFile = line.slice("... depotFile ".length);
|
|
91
|
+
inHunk = false;
|
|
92
|
+
} else if (line.startsWith("@@")) {
|
|
93
|
+
if (depotFile !== void 0) lines.push(`--- ${depotFile}`);
|
|
94
|
+
lines.push(line);
|
|
95
|
+
inHunk = true;
|
|
96
|
+
} else if (inHunk && !line.startsWith("... ")) {
|
|
97
|
+
lines.push(line);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const diff = lines.join("\n").trimEnd();
|
|
101
|
+
return diff.length === 0 ? void 0 : diff;
|
|
102
|
+
}
|
|
77
103
|
function toOpenedFile(record) {
|
|
78
104
|
return {
|
|
79
105
|
depotFile: record.get("depotFile") ?? "",
|
|
@@ -161,7 +187,9 @@ var P4Client = class {
|
|
|
161
187
|
if (opts?.changelist) args.push("-c", opts.changelist);
|
|
162
188
|
args.push(...files);
|
|
163
189
|
const { stdout } = await this.#run(args);
|
|
164
|
-
|
|
190
|
+
const opened = parseZtag(stdout).map(toOpenedFile);
|
|
191
|
+
if (opts?.changelist === void 0) return opened;
|
|
192
|
+
return opened.map((file) => ({ ...file, change: opts.changelist }));
|
|
165
193
|
}
|
|
166
194
|
async revert(files) {
|
|
167
195
|
if (files.length === 0) return [];
|
|
@@ -203,13 +231,14 @@ var P4Client = class {
|
|
|
203
231
|
if (opts?.diff) args.push("-du");
|
|
204
232
|
args.push(change);
|
|
205
233
|
const { stdout } = await this.#run(args);
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
234
|
+
const records = parseZtag(stdout);
|
|
235
|
+
if (records.length === 0) {
|
|
208
236
|
throw new P4PilotError(
|
|
209
237
|
`p4 describe returned nothing for ${change}`,
|
|
210
238
|
"P4_COMMAND_FAILED"
|
|
211
239
|
);
|
|
212
240
|
}
|
|
241
|
+
const record = mergeRecords(records);
|
|
213
242
|
const grouped = groupIndexed(record);
|
|
214
243
|
const depotFiles = asArray(grouped.depotFile);
|
|
215
244
|
const actions = asArray(grouped.action);
|
|
@@ -219,12 +248,17 @@ var P4Client = class {
|
|
|
219
248
|
action: actions[index] ?? "edit",
|
|
220
249
|
rev: revs[index] === void 0 ? void 0 : Number(revs[index])
|
|
221
250
|
}));
|
|
251
|
+
let diff = str(grouped.diff) ?? extractUnifiedDiff(stdout);
|
|
252
|
+
if (opts?.diff && grouped.status === "pending" && depotFiles.length > 0) {
|
|
253
|
+
const result = await this.#run(["diff", "-du", ...depotFiles]);
|
|
254
|
+
diff = extractUnifiedDiff(result.stdout);
|
|
255
|
+
}
|
|
222
256
|
return {
|
|
223
257
|
change: str(grouped.change) ?? change,
|
|
224
258
|
description: str(grouped.desc) ?? "",
|
|
225
259
|
user: str(grouped.user),
|
|
226
260
|
files,
|
|
227
|
-
diff
|
|
261
|
+
diff
|
|
228
262
|
};
|
|
229
263
|
}
|
|
230
264
|
async filelog(file, opts) {
|
|
@@ -269,7 +303,10 @@ Description:
|
|
|
269
303
|
async reopen(files, changelist) {
|
|
270
304
|
if (files.length === 0) return [];
|
|
271
305
|
const { stdout } = await this.#run(["reopen", "-c", changelist, ...files]);
|
|
272
|
-
return parseZtag(stdout).map(
|
|
306
|
+
return parseZtag(stdout).map((record) => ({
|
|
307
|
+
...toOpenedFile(record),
|
|
308
|
+
change: changelist
|
|
309
|
+
}));
|
|
273
310
|
}
|
|
274
311
|
};
|
|
275
312
|
|
package/dist/index.cjs
CHANGED
|
@@ -145,6 +145,32 @@ function asArray(value) {
|
|
|
145
145
|
if (value === void 0) return [];
|
|
146
146
|
return Array.isArray(value) ? value : [value];
|
|
147
147
|
}
|
|
148
|
+
function mergeRecords(records) {
|
|
149
|
+
const merged = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const record of records) {
|
|
151
|
+
for (const [key, value] of record) merged.set(key, value);
|
|
152
|
+
}
|
|
153
|
+
return merged;
|
|
154
|
+
}
|
|
155
|
+
function extractUnifiedDiff(stdout) {
|
|
156
|
+
const lines = [];
|
|
157
|
+
let depotFile;
|
|
158
|
+
let inHunk = false;
|
|
159
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
160
|
+
if (line.startsWith("... depotFile ")) {
|
|
161
|
+
depotFile = line.slice("... depotFile ".length);
|
|
162
|
+
inHunk = false;
|
|
163
|
+
} else if (line.startsWith("@@")) {
|
|
164
|
+
if (depotFile !== void 0) lines.push(`--- ${depotFile}`);
|
|
165
|
+
lines.push(line);
|
|
166
|
+
inHunk = true;
|
|
167
|
+
} else if (inHunk && !line.startsWith("... ")) {
|
|
168
|
+
lines.push(line);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const diff = lines.join("\n").trimEnd();
|
|
172
|
+
return diff.length === 0 ? void 0 : diff;
|
|
173
|
+
}
|
|
148
174
|
function toOpenedFile(record) {
|
|
149
175
|
return {
|
|
150
176
|
depotFile: record.get("depotFile") ?? "",
|
|
@@ -232,7 +258,9 @@ var P4Client = class {
|
|
|
232
258
|
if (opts?.changelist) args.push("-c", opts.changelist);
|
|
233
259
|
args.push(...files);
|
|
234
260
|
const { stdout } = await this.#run(args);
|
|
235
|
-
|
|
261
|
+
const opened = parseZtag(stdout).map(toOpenedFile);
|
|
262
|
+
if (opts?.changelist === void 0) return opened;
|
|
263
|
+
return opened.map((file) => ({ ...file, change: opts.changelist }));
|
|
236
264
|
}
|
|
237
265
|
async revert(files) {
|
|
238
266
|
if (files.length === 0) return [];
|
|
@@ -274,13 +302,14 @@ var P4Client = class {
|
|
|
274
302
|
if (opts?.diff) args.push("-du");
|
|
275
303
|
args.push(change);
|
|
276
304
|
const { stdout } = await this.#run(args);
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
305
|
+
const records = parseZtag(stdout);
|
|
306
|
+
if (records.length === 0) {
|
|
279
307
|
throw new P4PilotError(
|
|
280
308
|
`p4 describe returned nothing for ${change}`,
|
|
281
309
|
"P4_COMMAND_FAILED"
|
|
282
310
|
);
|
|
283
311
|
}
|
|
312
|
+
const record = mergeRecords(records);
|
|
284
313
|
const grouped = groupIndexed(record);
|
|
285
314
|
const depotFiles = asArray(grouped.depotFile);
|
|
286
315
|
const actions = asArray(grouped.action);
|
|
@@ -290,12 +319,17 @@ var P4Client = class {
|
|
|
290
319
|
action: actions[index] ?? "edit",
|
|
291
320
|
rev: revs[index] === void 0 ? void 0 : Number(revs[index])
|
|
292
321
|
}));
|
|
322
|
+
let diff = str(grouped.diff) ?? extractUnifiedDiff(stdout);
|
|
323
|
+
if (opts?.diff && grouped.status === "pending" && depotFiles.length > 0) {
|
|
324
|
+
const result = await this.#run(["diff", "-du", ...depotFiles]);
|
|
325
|
+
diff = extractUnifiedDiff(result.stdout);
|
|
326
|
+
}
|
|
293
327
|
return {
|
|
294
328
|
change: str(grouped.change) ?? change,
|
|
295
329
|
description: str(grouped.desc) ?? "",
|
|
296
330
|
user: str(grouped.user),
|
|
297
331
|
files,
|
|
298
|
-
diff
|
|
332
|
+
diff
|
|
299
333
|
};
|
|
300
334
|
}
|
|
301
335
|
async filelog(file, opts) {
|
|
@@ -340,7 +374,10 @@ Description:
|
|
|
340
374
|
async reopen(files, changelist) {
|
|
341
375
|
if (files.length === 0) return [];
|
|
342
376
|
const { stdout } = await this.#run(["reopen", "-c", changelist, ...files]);
|
|
343
|
-
return parseZtag(stdout).map(
|
|
377
|
+
return parseZtag(stdout).map((record) => ({
|
|
378
|
+
...toOpenedFile(record),
|
|
379
|
+
change: changelist
|
|
380
|
+
}));
|
|
344
381
|
}
|
|
345
382
|
};
|
|
346
383
|
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
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AAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ1C,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAOnD,KAAK,CACT,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAiB7D,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;QACjC,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAS1B,QAAQ,CACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GACxB,OAAO,CAAC,cAAc,CAAC;IAoCpB,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GACtB,OAAO,CAAC,YAAY,EAAE,CAAC;IAsBpB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAenD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAQzE"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { P4PilotError } from "./types.js";
|
|
2
|
+
import { groupIndexed, parseZtag } from "./ztag.js";
|
|
3
|
+
const CHANGE_CREATED = /Change (\d+) created/;
|
|
4
|
+
function num(value) {
|
|
5
|
+
return value === undefined ? undefined : Number(value);
|
|
6
|
+
}
|
|
7
|
+
function str(value) {
|
|
8
|
+
return typeof value === "string" ? value : undefined;
|
|
9
|
+
}
|
|
10
|
+
function asArray(value) {
|
|
11
|
+
if (value === undefined)
|
|
12
|
+
return [];
|
|
13
|
+
return Array.isArray(value) ? value : [value];
|
|
14
|
+
}
|
|
15
|
+
function mergeRecords(records) {
|
|
16
|
+
const merged = new Map();
|
|
17
|
+
for (const record of records) {
|
|
18
|
+
for (const [key, value] of record)
|
|
19
|
+
merged.set(key, value);
|
|
20
|
+
}
|
|
21
|
+
return merged;
|
|
22
|
+
}
|
|
23
|
+
function extractUnifiedDiff(stdout) {
|
|
24
|
+
const lines = [];
|
|
25
|
+
let depotFile;
|
|
26
|
+
let inHunk = false;
|
|
27
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
28
|
+
if (line.startsWith("... depotFile ")) {
|
|
29
|
+
depotFile = line.slice("... depotFile ".length);
|
|
30
|
+
inHunk = false;
|
|
31
|
+
}
|
|
32
|
+
else if (line.startsWith("@@")) {
|
|
33
|
+
if (depotFile !== undefined)
|
|
34
|
+
lines.push(`--- ${depotFile}`);
|
|
35
|
+
lines.push(line);
|
|
36
|
+
inHunk = true;
|
|
37
|
+
}
|
|
38
|
+
else if (inHunk && !line.startsWith("... ")) {
|
|
39
|
+
lines.push(line);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const diff = lines.join("\n").trimEnd();
|
|
43
|
+
return diff.length === 0 ? undefined : diff;
|
|
44
|
+
}
|
|
45
|
+
function toOpenedFile(record) {
|
|
46
|
+
return {
|
|
47
|
+
depotFile: record.get("depotFile") ?? "",
|
|
48
|
+
clientFile: record.get("clientFile"),
|
|
49
|
+
rev: num(record.get("rev")),
|
|
50
|
+
action: (record.get("action") ?? "edit"),
|
|
51
|
+
change: record.get("change") ?? "default",
|
|
52
|
+
type: record.get("type") ?? "text",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function toFileStat(record) {
|
|
56
|
+
const headRev = num(record.get("headRev"));
|
|
57
|
+
const action = record.get("action");
|
|
58
|
+
return {
|
|
59
|
+
depotFile: record.get("depotFile") ?? "",
|
|
60
|
+
clientFile: record.get("clientFile"),
|
|
61
|
+
headType: record.get("headType"),
|
|
62
|
+
headRev,
|
|
63
|
+
haveRev: num(record.get("haveRev")),
|
|
64
|
+
action,
|
|
65
|
+
isOpened: action !== undefined,
|
|
66
|
+
isTracked: headRev !== undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function toChangelistSummary(record) {
|
|
70
|
+
const status = record.get("status");
|
|
71
|
+
return {
|
|
72
|
+
change: record.get("change") ?? "",
|
|
73
|
+
description: record.get("desc") ?? "",
|
|
74
|
+
status: status === "submitted" || status === "shelved" ? status : "pending",
|
|
75
|
+
user: record.get("user"),
|
|
76
|
+
client: record.get("client"),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Typed wrapper over a {@link P4Runner}. Each method builds `p4` args, runs them,
|
|
81
|
+
* parses the `-ztag` output, and maps it to a domain type. Non-zero exits raise
|
|
82
|
+
* a {@link P4PilotError} with code `P4_COMMAND_FAILED`.
|
|
83
|
+
*/
|
|
84
|
+
export class P4Client {
|
|
85
|
+
#runner;
|
|
86
|
+
constructor(runner) {
|
|
87
|
+
this.#runner = runner;
|
|
88
|
+
}
|
|
89
|
+
async #run(args, opts) {
|
|
90
|
+
const result = await this.#runner.run(args, opts);
|
|
91
|
+
if (result.exitCode !== 0) {
|
|
92
|
+
throw new P4PilotError(`p4 ${args.join(" ")} failed`, "P4_COMMAND_FAILED", result.stderr.trim() || result.stdout.trim());
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
async info() {
|
|
97
|
+
const { stdout } = await this.#run(["info"]);
|
|
98
|
+
const record = parseZtag(stdout)[0];
|
|
99
|
+
const info = {};
|
|
100
|
+
if (record) {
|
|
101
|
+
for (const [key, value] of record) {
|
|
102
|
+
info[key] = value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return info;
|
|
106
|
+
}
|
|
107
|
+
async opened(opts) {
|
|
108
|
+
const args = ["opened"];
|
|
109
|
+
if (opts?.changelist)
|
|
110
|
+
args.push("-c", opts.changelist);
|
|
111
|
+
const { stdout } = await this.#run(args);
|
|
112
|
+
return parseZtag(stdout).map(toOpenedFile);
|
|
113
|
+
}
|
|
114
|
+
async fstat(files) {
|
|
115
|
+
if (files.length === 0)
|
|
116
|
+
return [];
|
|
117
|
+
const { stdout } = await this.#run(["fstat", ...files]);
|
|
118
|
+
return parseZtag(stdout).map(toFileStat);
|
|
119
|
+
}
|
|
120
|
+
async edit(files, opts) {
|
|
121
|
+
return this.#openOp("edit", files, opts);
|
|
122
|
+
}
|
|
123
|
+
async add(files, opts) {
|
|
124
|
+
return this.#openOp("add", files, opts);
|
|
125
|
+
}
|
|
126
|
+
async deleteFiles(files, opts) {
|
|
127
|
+
return this.#openOp("delete", files, opts);
|
|
128
|
+
}
|
|
129
|
+
async #openOp(command, files, opts) {
|
|
130
|
+
if (files.length === 0)
|
|
131
|
+
return [];
|
|
132
|
+
const args = [command];
|
|
133
|
+
if (opts?.changelist)
|
|
134
|
+
args.push("-c", opts.changelist);
|
|
135
|
+
args.push(...files);
|
|
136
|
+
const { stdout } = await this.#run(args);
|
|
137
|
+
const opened = parseZtag(stdout).map(toOpenedFile);
|
|
138
|
+
const requestedChangelist = opts?.changelist;
|
|
139
|
+
if (requestedChangelist === undefined)
|
|
140
|
+
return opened;
|
|
141
|
+
return opened.map((file) => ({
|
|
142
|
+
...file,
|
|
143
|
+
change: requestedChangelist,
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
async revert(files) {
|
|
147
|
+
if (files.length === 0)
|
|
148
|
+
return [];
|
|
149
|
+
const { stdout } = await this.#run(["revert", ...files]);
|
|
150
|
+
return parseZtag(stdout)
|
|
151
|
+
.map((record) => record.get("depotFile") ?? "")
|
|
152
|
+
.filter((depotFile) => depotFile.length > 0);
|
|
153
|
+
}
|
|
154
|
+
async sync(paths) {
|
|
155
|
+
const args = ["sync"];
|
|
156
|
+
if (paths && paths.length > 0)
|
|
157
|
+
args.push(...paths);
|
|
158
|
+
const { stdout } = await this.#run(args);
|
|
159
|
+
return { synced: parseZtag(stdout).length };
|
|
160
|
+
}
|
|
161
|
+
async where(file) {
|
|
162
|
+
const { stdout } = await this.#run(["where", file]);
|
|
163
|
+
const record = parseZtag(stdout)[0];
|
|
164
|
+
if (!record) {
|
|
165
|
+
throw new P4PilotError(`p4 where returned no mapping for ${file}`, "FILE_NOT_IN_CLIENT");
|
|
166
|
+
}
|
|
167
|
+
const clientFile = record.get("clientFile") ?? "";
|
|
168
|
+
return {
|
|
169
|
+
depotFile: record.get("depotFile") ?? "",
|
|
170
|
+
clientFile,
|
|
171
|
+
path: record.get("path") ?? clientFile,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
async changes(opts) {
|
|
175
|
+
const args = ["changes"];
|
|
176
|
+
if (opts?.status)
|
|
177
|
+
args.push("-s", opts.status);
|
|
178
|
+
if (opts?.max !== undefined)
|
|
179
|
+
args.push("-m", String(opts.max));
|
|
180
|
+
if (opts?.user)
|
|
181
|
+
args.push("-u", opts.user);
|
|
182
|
+
const { stdout } = await this.#run(args);
|
|
183
|
+
return parseZtag(stdout).map(toChangelistSummary);
|
|
184
|
+
}
|
|
185
|
+
async describe(change, opts) {
|
|
186
|
+
const args = ["describe"];
|
|
187
|
+
if (opts?.diff)
|
|
188
|
+
args.push("-du");
|
|
189
|
+
args.push(change);
|
|
190
|
+
const { stdout } = await this.#run(args);
|
|
191
|
+
const records = parseZtag(stdout);
|
|
192
|
+
if (records.length === 0) {
|
|
193
|
+
throw new P4PilotError(`p4 describe returned nothing for ${change}`, "P4_COMMAND_FAILED");
|
|
194
|
+
}
|
|
195
|
+
const record = mergeRecords(records);
|
|
196
|
+
const grouped = groupIndexed(record);
|
|
197
|
+
const depotFiles = asArray(grouped.depotFile);
|
|
198
|
+
const actions = asArray(grouped.action);
|
|
199
|
+
const revs = asArray(grouped.rev);
|
|
200
|
+
const files = depotFiles.map((depotFile, index) => ({
|
|
201
|
+
depotFile,
|
|
202
|
+
action: (actions[index] ?? "edit"),
|
|
203
|
+
rev: revs[index] === undefined ? undefined : Number(revs[index]),
|
|
204
|
+
}));
|
|
205
|
+
let diff = str(grouped.diff) ?? extractUnifiedDiff(stdout);
|
|
206
|
+
if (opts?.diff && grouped.status === "pending" && depotFiles.length > 0) {
|
|
207
|
+
const result = await this.#run(["diff", "-du", ...depotFiles]);
|
|
208
|
+
diff = extractUnifiedDiff(result.stdout);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
change: str(grouped.change) ?? change,
|
|
212
|
+
description: str(grouped.desc) ?? "",
|
|
213
|
+
user: str(grouped.user),
|
|
214
|
+
files,
|
|
215
|
+
diff,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
async filelog(file, opts) {
|
|
219
|
+
const args = ["filelog"];
|
|
220
|
+
if (opts?.max !== undefined)
|
|
221
|
+
args.push("-m", String(opts.max));
|
|
222
|
+
args.push(file);
|
|
223
|
+
const { stdout } = await this.#run(args);
|
|
224
|
+
const record = parseZtag(stdout)[0];
|
|
225
|
+
if (!record)
|
|
226
|
+
return [];
|
|
227
|
+
const grouped = groupIndexed(record);
|
|
228
|
+
const revs = asArray(grouped.rev);
|
|
229
|
+
const changes = asArray(grouped.change);
|
|
230
|
+
const actions = asArray(grouped.action);
|
|
231
|
+
const users = asArray(grouped.user);
|
|
232
|
+
const descriptions = asArray(grouped.desc);
|
|
233
|
+
return revs.map((rev, index) => ({
|
|
234
|
+
rev: Number(rev),
|
|
235
|
+
change: changes[index] ?? "",
|
|
236
|
+
action: (actions[index] ?? "edit"),
|
|
237
|
+
user: users[index] ?? "",
|
|
238
|
+
description: descriptions[index] ?? "",
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
async newChangelist(description) {
|
|
242
|
+
const indented = description.replace(/\n/g, "\n\t");
|
|
243
|
+
const spec = `Change:\tnew\n\nDescription:\n\t${indented}\n`;
|
|
244
|
+
const { stdout } = await this.#run(["change", "-i"], { input: spec });
|
|
245
|
+
const matched = CHANGE_CREATED.exec(stdout);
|
|
246
|
+
if (matched?.[1])
|
|
247
|
+
return matched[1];
|
|
248
|
+
const change = parseZtag(stdout)[0]?.get("change");
|
|
249
|
+
if (change)
|
|
250
|
+
return change;
|
|
251
|
+
throw new P4PilotError("could not parse created changelist number", "P4_COMMAND_FAILED", stdout.trim());
|
|
252
|
+
}
|
|
253
|
+
async reopen(files, changelist) {
|
|
254
|
+
if (files.length === 0)
|
|
255
|
+
return [];
|
|
256
|
+
const { stdout } = await this.#run(["reopen", "-c", changelist, ...files]);
|
|
257
|
+
return parseZtag(stdout).map((record) => ({
|
|
258
|
+
...toOpenedFile(record),
|
|
259
|
+
change: changelist,
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=p4-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p4-client.js","sourceRoot":"","sources":["../src/p4-client.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAWpD,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAE9C,SAAS,GAAG,CAAC,KAAyB;IACpC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,GAAG,CAAC,KAAoC;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,SAAS,OAAO,CAAC,KAAoC;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,KAAK,CAAC,OAAO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AAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC;YAAE,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAC1B,MAAM,IAAI,YAAY,CACpB,2CAA2C,EAC3C,mBAAmB,EACnB,MAAM,CAAC,IAAI,EAAE,CACd,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAe,EAAE,UAAkB;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QAClC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;QAC3E,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACxC,GAAG,YAAY,CAAC,MAAM,CAAC;YACvB,MAAM,EAAE,UAAU;SACnB,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@p4pilot/core",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Perforce-native core library for AI coding agents.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"perforce",
|
|
7
|
-
"p4",
|
|
8
|
-
"ai-agent",
|
|
9
|
-
"mcp",
|
|
10
|
-
"game-development"
|
|
11
|
-
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/sdvgdfvds/p4pilot.git",
|
|
15
|
-
"directory": "packages/core"
|
|
16
|
-
},
|
|
17
|
-
"homepage": "https://github.com/sdvgdfvds/p4pilot#readme",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/sdvgdfvds/p4pilot/issues"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"author": "p4pilot contributors",
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=20"
|
|
25
|
-
},
|
|
26
|
-
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
},
|
|
29
|
-
"type": "module",
|
|
30
|
-
"main": "./dist/index.cjs",
|
|
31
|
-
"module": "./dist/index.js",
|
|
32
|
-
"types": "./dist/index.d.ts",
|
|
33
|
-
"exports": {
|
|
34
|
-
".": {
|
|
35
|
-
"types": "./dist/index.d.ts",
|
|
36
|
-
"import": "./dist/index.js",
|
|
37
|
-
"require": "./dist/index.cjs"
|
|
38
|
-
},
|
|
39
|
-
"./testing": {
|
|
40
|
-
"types": "./dist/testing/mock-runner.d.ts",
|
|
41
|
-
"import": "./dist/testing/mock-runner.js",
|
|
42
|
-
"require": "./dist/testing/mock-runner.cjs"
|
|
43
|
-
},
|
|
44
|
-
"./browser": {
|
|
45
|
-
"types": "./dist/browser.d.ts",
|
|
46
|
-
"import": "./dist/browser.js",
|
|
47
|
-
"require": "./dist/browser.cjs"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"files": [
|
|
51
|
-
"dist"
|
|
52
|
-
],
|
|
53
|
-
"scripts": {
|
|
54
|
-
"build": "tsup",
|
|
55
|
-
"test": "vitest run",
|
|
56
|
-
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\""
|
|
57
|
-
},
|
|
58
|
-
"dependencies": {
|
|
59
|
-
"execa": "^9.6.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@types/node": "^24.0.0",
|
|
63
|
-
"tsup": "^8.5.0",
|
|
64
|
-
"typescript": "^5.6.0",
|
|
65
|
-
"vitest": "^4.1.0"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@p4pilot/core",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Perforce-native core library for AI coding agents.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"perforce",
|
|
7
|
+
"p4",
|
|
8
|
+
"ai-agent",
|
|
9
|
+
"mcp",
|
|
10
|
+
"game-development"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/sdvgdfvds/p4pilot.git",
|
|
15
|
+
"directory": "packages/core"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/sdvgdfvds/p4pilot#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/sdvgdfvds/p4pilot/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "p4pilot contributors",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.cjs",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"require": "./dist/index.cjs"
|
|
38
|
+
},
|
|
39
|
+
"./testing": {
|
|
40
|
+
"types": "./dist/testing/mock-runner.d.ts",
|
|
41
|
+
"import": "./dist/testing/mock-runner.js",
|
|
42
|
+
"require": "./dist/testing/mock-runner.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./browser": {
|
|
45
|
+
"types": "./dist/browser.d.ts",
|
|
46
|
+
"import": "./dist/browser.js",
|
|
47
|
+
"require": "./dist/browser.cjs"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsup",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\""
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"execa": "^9.6.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^24.0.0",
|
|
63
|
+
"tsup": "^8.5.0",
|
|
64
|
+
"typescript": "^5.6.0",
|
|
65
|
+
"vitest": "^4.1.0"
|
|
66
|
+
}
|
|
67
|
+
}
|