p-backlog 0.14.0 → 0.14.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/CHANGELOG.md +17 -0
- package/dist/cli.js +140 -40
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
Rewritten branches keep their candidates, removed lanes keep their costs, and CI no longer depends on Ubuntu mirrors.
|
|
6
|
+
|
|
7
|
+
- `backlog check`: a mark commit that was the tip of the current branch counts as the current line once that branch
|
|
8
|
+
was rewritten, whatever the rewrite did to its content: `pull --rebase` (including from a URL) or `rebase` with a
|
|
9
|
+
resolved conflict in any file, `commit --amend` followed by a rebase, `rebase --autosquash` and
|
|
10
|
+
`rebase --update-refs` for the branches of a stack. An edit to the task's lines is a candidate again instead of
|
|
11
|
+
silently disappearing. A rebased lane checked from `master` and a branch reset back past the mark still count as
|
|
12
|
+
another branch. A git failure while reading the branch's reflog leaves the task unchecked.
|
|
13
|
+
- Costs: runs and tokens of a git worktree that lived outside the repository directory stay with the repository's
|
|
14
|
+
project after `git worktree remove`. While such a worktree exists, the service remembers its root and main
|
|
15
|
+
repository from the working directories of transcripts and CLI runs; a live repository at the path still wins.
|
|
16
|
+
Worktrees removed before this version are not recovered.
|
|
17
|
+
- CI: the Linux end-to-end job no longer installs fonts through apt, so an outage of the Ubuntu mirrors no longer
|
|
18
|
+
fails CI and blocks a release.
|
|
19
|
+
|
|
3
20
|
## 0.14.0
|
|
4
21
|
|
|
5
22
|
Projects with several repositories, a single "state at the task's mark" for `backlog check`, and fixes from the full
|
package/dist/cli.js
CHANGED
|
@@ -4262,6 +4262,61 @@ function fileVersion({ mode = "", object = "", path = "" } = {}) {
|
|
|
4262
4262
|
return { path, version: `${mode} ${object}\0${path}` };
|
|
4263
4263
|
}
|
|
4264
4264
|
|
|
4265
|
+
// src/core/check/rewritten-branch.ts
|
|
4266
|
+
var DETACHED_HEAD_EXIT = 1;
|
|
4267
|
+
var NOT_AN_ANCESTOR_EXIT2 = 1;
|
|
4268
|
+
var REBASE_FINISHED = /^(?:rebase|pull)\b.*(?:\(finish\)|finished): refs\//;
|
|
4269
|
+
var AMEND = /^commit \(amend\):/;
|
|
4270
|
+
var REWRITTEN_BY_UPDATE_REFS = /^rewritten during rebase$/;
|
|
4271
|
+
function currentBranchRewroteTipOf(repo, git) {
|
|
4272
|
+
let history;
|
|
4273
|
+
const stepLines = /* @__PURE__ */ new Map();
|
|
4274
|
+
const stepLine = (step, index) => remembered(stepLines, index, () => lineOfStep(repo, step, git));
|
|
4275
|
+
return async (tip) => {
|
|
4276
|
+
const branch = await (history ??= currentBranchHistory(repo, git));
|
|
4277
|
+
if (branch.kind === "unreadable") return "unknown";
|
|
4278
|
+
if (branch.kind === "detached") return "not-rewritten";
|
|
4279
|
+
const tipIndex = branch.movesNewestFirst.findIndex(({ commit }) => commit === tip);
|
|
4280
|
+
if (tipIndex <= 0) return "not-rewritten";
|
|
4281
|
+
const stepsSinceTip = branch.stepsNewestFirst.slice(0, tipIndex);
|
|
4282
|
+
if (!stepsSinceTip.some(({ to }) => isRewrite(to))) return "not-rewritten";
|
|
4283
|
+
let rewrite = "rewritten";
|
|
4284
|
+
for (const [index, step] of stepsSinceTip.entries()) {
|
|
4285
|
+
const line = await stepLine(step, index);
|
|
4286
|
+
if (line === "leaves-line") return "not-rewritten";
|
|
4287
|
+
if (line === "unknown") rewrite = "unknown";
|
|
4288
|
+
}
|
|
4289
|
+
return rewrite;
|
|
4290
|
+
};
|
|
4291
|
+
}
|
|
4292
|
+
async function currentBranchHistory(repo, git) {
|
|
4293
|
+
const symbolicHead = await git(repo, ["symbolic-ref", "-q", "HEAD"]);
|
|
4294
|
+
if (symbolicHead.status === "exited" && symbolicHead.exitCode === DETACHED_HEAD_EXIT) return { kind: "detached" };
|
|
4295
|
+
const branch = outputLine(stdoutOf(symbolicHead));
|
|
4296
|
+
if (branch === null) return { kind: "unreadable" };
|
|
4297
|
+
const reflog = outputLines(stdoutOf(await git(repo, ["log", "--walk-reflogs", `--format=%H${FIELD}%P${FIELD}%gs`, branch, "--"])));
|
|
4298
|
+
if (reflog === null) return { kind: "unreadable" };
|
|
4299
|
+
const movesNewestFirst = reflog.map(branchMove);
|
|
4300
|
+
const stepsNewestFirst = movesNewestFirst.flatMap((to, index) => {
|
|
4301
|
+
const from = movesNewestFirst[index + 1];
|
|
4302
|
+
return from === void 0 ? [] : [{ from: from.commit, to }];
|
|
4303
|
+
});
|
|
4304
|
+
return { kind: "read", movesNewestFirst, stepsNewestFirst };
|
|
4305
|
+
}
|
|
4306
|
+
async function lineOfStep(repo, { from, to }, git) {
|
|
4307
|
+
if (isRewrite(to) || to.parents.includes(from)) return "keeps-line";
|
|
4308
|
+
const fromIsAncestor = await git(repo, ["merge-base", "--is-ancestor", from, to.commit]);
|
|
4309
|
+
if (fromIsAncestor.status === "ok") return "keeps-line";
|
|
4310
|
+
return fromIsAncestor.status === "exited" && fromIsAncestor.exitCode === NOT_AN_ANCESTOR_EXIT2 ? "leaves-line" : "unknown";
|
|
4311
|
+
}
|
|
4312
|
+
function isRewrite({ subject }) {
|
|
4313
|
+
return REBASE_FINISHED.test(subject) || AMEND.test(subject) || REWRITTEN_BY_UPDATE_REFS.test(subject);
|
|
4314
|
+
}
|
|
4315
|
+
function branchMove(line) {
|
|
4316
|
+
const [commit = "", parents = "", subject = ""] = line.split(FIELD);
|
|
4317
|
+
return { commit, parents: parents.split(" ").filter((parent) => parent !== ""), subject };
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4265
4320
|
// src/core/check/repo-facts.ts
|
|
4266
4321
|
var TRUST_COMMAND = /^git config .*safe\.directory/;
|
|
4267
4322
|
var DIFF_LINE_LIMIT = 80;
|
|
@@ -4361,30 +4416,34 @@ function headCommitsAt(repo, git) {
|
|
|
4361
4416
|
return (await moves).find((move) => move.at <= moment.getTime())?.commit ?? null;
|
|
4362
4417
|
};
|
|
4363
4418
|
}
|
|
4364
|
-
function headLineOf(repo,
|
|
4419
|
+
function headLineOf(repo, gitOutcome, ancestryOf) {
|
|
4420
|
+
const git = asGitRunner(gitOutcome);
|
|
4421
|
+
const rewroteTip = currentBranchRewroteTipOf(repo, gitOutcome);
|
|
4365
4422
|
const answers = /* @__PURE__ */ new Map();
|
|
4366
|
-
return (commit) => remembered(answers, commit, () => lineOfCommit(repo, commit, git,
|
|
4423
|
+
return (commit) => remembered(answers, commit, () => lineOfCommit(commit, ancestryOf, () => lineOfNonAncestor(repo, commit, git, rewroteTip)));
|
|
4367
4424
|
}
|
|
4368
|
-
async function lineOfCommit(
|
|
4425
|
+
async function lineOfCommit(commit, ancestryOf, lineOfNonAncestor2) {
|
|
4369
4426
|
const ancestry = await ancestryOf(commit);
|
|
4370
4427
|
switch (ancestry) {
|
|
4371
4428
|
case "ancestor":
|
|
4372
4429
|
return "this-line";
|
|
4373
4430
|
case "not-ancestor":
|
|
4374
|
-
return
|
|
4431
|
+
return lineOfNonAncestor2();
|
|
4375
4432
|
case "missing":
|
|
4376
4433
|
case "unknown":
|
|
4377
4434
|
return ancestry;
|
|
4378
4435
|
}
|
|
4379
4436
|
}
|
|
4380
|
-
async function lineOfNonAncestor(repo, commit, git) {
|
|
4437
|
+
async function lineOfNonAncestor(repo, commit, git, rewroteTip) {
|
|
4381
4438
|
const tip = (await resolveCommits(git, repo, [commit]))?.get(commit);
|
|
4382
4439
|
if (tip === void 0) return "unknown";
|
|
4440
|
+
const rewrite = await rewroteTip(tip);
|
|
4441
|
+
if (rewrite === "rewritten") return "this-line";
|
|
4383
4442
|
switch (await landingState(repo, tip, git)) {
|
|
4384
4443
|
case "landed":
|
|
4385
4444
|
return "this-line";
|
|
4386
4445
|
case "pending":
|
|
4387
|
-
return "other-branch";
|
|
4446
|
+
return rewrite === "unknown" ? "unknown" : "other-branch";
|
|
4388
4447
|
case "unknown":
|
|
4389
4448
|
return "unknown";
|
|
4390
4449
|
}
|
|
@@ -4967,14 +5026,29 @@ var strictly = (context) => ({ ...context, canonicalize: realpathOrNull });
|
|
|
4967
5026
|
function lookupProjectForDir(known, dir, dirRoots, context) {
|
|
4968
5027
|
return lookupProjectCanonicalizing(known, dir, dirRoots, strictly(context));
|
|
4969
5028
|
}
|
|
4970
|
-
async function lookupProjectForRecordedDir(known, dir, lookupRepoRoot, context) {
|
|
5029
|
+
async function lookupProjectForRecordedDir(known, dir, { lookupRepoRoot, worktreeRepos }, context) {
|
|
4971
5030
|
const dirRoots = await lookupRepoRoot(dir);
|
|
4972
|
-
const
|
|
5031
|
+
const leniently = { ...context, canonicalize: realpathThroughExistingAncestor };
|
|
5032
|
+
const byPath = lookupProjectCanonicalizing(known, dir, dirRoots, leniently);
|
|
4973
5033
|
if ("project" in byPath || byPath.broken.length > 0 || dirRoots !== "not-in-repo") return byPath;
|
|
5034
|
+
const byLiveAncestor = await lookupThroughLiveAncestor(known, dir, lookupRepoRoot, context);
|
|
5035
|
+
if (byLiveAncestor !== null) return byLiveAncestor;
|
|
5036
|
+
const recordedWorktree = recordedWorktreeOf(dir, worktreeRepos, context);
|
|
5037
|
+
return recordedWorktree === null ? byPath : lookupProjectCanonicalizing(known, dir, recordedWorktree, leniently);
|
|
5038
|
+
}
|
|
5039
|
+
async function lookupThroughLiveAncestor(known, dir, lookupRepoRoot, context) {
|
|
4974
5040
|
const ancestor = attemptReportingFailureSync(dir, nearestExistingAncestor, context.onUnreadable);
|
|
4975
|
-
if (ancestor === null || ancestor.missing.length === 0) return
|
|
4976
|
-
const
|
|
4977
|
-
return
|
|
5041
|
+
if (ancestor === null || ancestor.missing.length === 0) return null;
|
|
5042
|
+
const roots = repoRootsOf(await lookupRepoRoot(ancestor.real));
|
|
5043
|
+
return roots === null ? null : lookupProjectForDir(known, ancestor.real, roots, context);
|
|
5044
|
+
}
|
|
5045
|
+
function unreadableDirHasNoRepo() {
|
|
5046
|
+
}
|
|
5047
|
+
function recordedWorktreeOf(dir, worktreeRepos, { onUnreadable }) {
|
|
5048
|
+
const path = attemptReportingFailureSync(dir, realpathThroughExistingAncestor, onUnreadable);
|
|
5049
|
+
if (path === null) return null;
|
|
5050
|
+
const [deepest] = Object.entries(worktreeRepos).filter(([worktree]) => isSameOrInside(path, worktree)).sort(([a], [b]) => b.length - a.length);
|
|
5051
|
+
return deepest === void 0 ? null : { worktree: deepest[0], main: deepest[1] };
|
|
4978
5052
|
}
|
|
4979
5053
|
function lookupProjectCanonicalizing(known, dir, dirRoots, context) {
|
|
4980
5054
|
const roots = matchingRoots(dir, dirRoots, context);
|
|
@@ -7637,7 +7711,7 @@ async function runPrune(args, io) {
|
|
|
7637
7711
|
// src/server/start.ts
|
|
7638
7712
|
import { serve } from "@hono/node-server";
|
|
7639
7713
|
import { mkdir as mkdir6, rm as rm5, writeFile as writeFile2 } from "node:fs/promises";
|
|
7640
|
-
import { join as
|
|
7714
|
+
import { join as join35 } from "node:path";
|
|
7641
7715
|
|
|
7642
7716
|
// src/server/app.ts
|
|
7643
7717
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
@@ -9210,6 +9284,7 @@ var transcriptStateSchema = z17.object({
|
|
|
9210
9284
|
var USAGE_CACHE_FILE = ".usage-cache.json";
|
|
9211
9285
|
var USAGE_CACHE_VERSION = 6;
|
|
9212
9286
|
var bucketsSchema = z18.array(usageBucketSchema);
|
|
9287
|
+
var worktreeReposSchema = z18.record(z18.string(), z18.string());
|
|
9213
9288
|
var usageCacheEntrySchema = z18.object({
|
|
9214
9289
|
size: z18.number(),
|
|
9215
9290
|
mtimeMs: z18.number().optional(),
|
|
@@ -9221,19 +9296,21 @@ var usageCacheEntrySchema = z18.object({
|
|
|
9221
9296
|
var usageCacheSchema = z18.object({
|
|
9222
9297
|
version: z18.literal(USAGE_CACHE_VERSION),
|
|
9223
9298
|
files: z18.record(z18.string(), usageCacheEntrySchema),
|
|
9224
|
-
carried: z18.record(z18.string(), bucketsSchema).default({})
|
|
9299
|
+
carried: z18.record(z18.string(), bucketsSchema).default({}),
|
|
9300
|
+
worktreeRepos: worktreeReposSchema.default({})
|
|
9225
9301
|
});
|
|
9226
9302
|
var salvagedEntrySchema = z18.object({ buckets: bucketsSchema }).transform((entry) => entry.buckets);
|
|
9227
9303
|
var salvagedCacheSchema = z18.object({
|
|
9228
9304
|
files: z18.record(z18.string(), salvagedEntrySchema.nullable().catch(null)).catch({}),
|
|
9229
|
-
carried: z18.record(z18.string(), bucketsSchema.nullable().catch(null)).catch({})
|
|
9230
|
-
|
|
9305
|
+
carried: z18.record(z18.string(), bucketsSchema.nullable().catch(null)).catch({}),
|
|
9306
|
+
worktreeRepos: worktreeReposSchema.catch({})
|
|
9307
|
+
}).transform(({ files, carried, worktreeRepos }) => {
|
|
9231
9308
|
const salvaged = [...Object.entries(carried), ...Object.entries(files)].flatMap(([path, buckets]) => buckets === null ? [] : [[path, buckets]]);
|
|
9232
|
-
return { ...emptyUsageCache(), carried: Object.fromEntries(salvaged) };
|
|
9309
|
+
return { ...emptyUsageCache(), carried: Object.fromEntries(salvaged), worktreeRepos };
|
|
9233
9310
|
});
|
|
9234
9311
|
var storedCacheSchema = z18.union([usageCacheSchema, salvagedCacheSchema]);
|
|
9235
9312
|
function emptyUsageCache() {
|
|
9236
|
-
return { version: USAGE_CACHE_VERSION, files: {}, carried: {} };
|
|
9313
|
+
return { version: USAGE_CACHE_VERSION, files: {}, carried: {}, worktreeRepos: {} };
|
|
9237
9314
|
}
|
|
9238
9315
|
function usageBucketsOf(cache) {
|
|
9239
9316
|
return [...Object.values(cache.files).flatMap((entry) => entry.buckets), ...Object.values(cache.carried).flat()];
|
|
@@ -9249,8 +9326,8 @@ async function writeUsageCache(root, cache, onErrorAfterPublish) {
|
|
|
9249
9326
|
// src/server/cost-source.ts
|
|
9250
9327
|
function createCostSource(root, home2) {
|
|
9251
9328
|
const runsTail = createJsonlTail(join30(root, RUNS_FILE), cliRunSchema);
|
|
9252
|
-
const context = { home: home2, onUnreadable:
|
|
9253
|
-
const lookupRepoRoot = cachedRepoRoots({ onUnreadable:
|
|
9329
|
+
const context = { home: home2, onUnreadable: unreadableDirHasNoRepo };
|
|
9330
|
+
const lookupRepoRoot = cachedRepoRoots({ onUnreadable: unreadableDirHasNoRepo });
|
|
9254
9331
|
return {
|
|
9255
9332
|
stateKey: async (usage) => {
|
|
9256
9333
|
const { length, generation } = await runsTail.read();
|
|
@@ -9268,19 +9345,17 @@ async function computeCostReport({ usage: { cache, scan }, runs, known, projectI
|
|
|
9268
9345
|
[...buckets, ...runs].map((entry) => entry.cwd),
|
|
9269
9346
|
known,
|
|
9270
9347
|
context,
|
|
9271
|
-
lookupRepoRoot
|
|
9348
|
+
{ lookupRepoRoot, worktreeRepos: cache.worktreeRepos }
|
|
9272
9349
|
);
|
|
9273
9350
|
return costReport({ buckets, runs, projectOf: (cwd) => projectIds.get(cwd) ?? null, projectId, now, scan });
|
|
9274
9351
|
}
|
|
9275
|
-
async function projectIdsOfCwds(cwds, known, context,
|
|
9352
|
+
async function projectIdsOfCwds(cwds, known, context, recordedRepos) {
|
|
9276
9353
|
const projectIdOf = async (cwd) => {
|
|
9277
|
-
const lookup = await lookupProjectForRecordedDir(known, cwd,
|
|
9354
|
+
const lookup = await lookupProjectForRecordedDir(known, cwd, recordedRepos, context);
|
|
9278
9355
|
return [cwd, "project" in lookup ? lookup.project.id : null];
|
|
9279
9356
|
};
|
|
9280
9357
|
return new Map(await Promise.all([...new Set(cwds)].map(projectIdOf)));
|
|
9281
9358
|
}
|
|
9282
|
-
function unreadablePathHasNoProject() {
|
|
9283
|
-
}
|
|
9284
9359
|
|
|
9285
9360
|
// src/server/stats-api.ts
|
|
9286
9361
|
var REPORT_TTL_MS = 5 * MINUTE_MS;
|
|
@@ -9722,6 +9797,8 @@ function logReport({ closedEpics, reopenedEpics, blockingFiles, deleted, conflic
|
|
|
9722
9797
|
}
|
|
9723
9798
|
|
|
9724
9799
|
// src/server/usage-scanner.ts
|
|
9800
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
9801
|
+
import { isAbsolute as isAbsolute4, join as join34 } from "node:path";
|
|
9725
9802
|
import { isDeepStrictEqual } from "node:util";
|
|
9726
9803
|
|
|
9727
9804
|
// src/core/usage/transcripts.ts
|
|
@@ -10130,7 +10207,7 @@ async function scanTranscripts({ files, cache, byteBudget, now }) {
|
|
|
10130
10207
|
}
|
|
10131
10208
|
const stillReported = deletedStillReported(listedFiles, now);
|
|
10132
10209
|
const merged = {
|
|
10133
|
-
|
|
10210
|
+
...cache,
|
|
10134
10211
|
files: { ...entriesWhere(cache.files, (path, entry) => stillReported(path, entry.buckets)), ...listedFiles },
|
|
10135
10212
|
carried: entriesWhere(cache.carried, stillReported)
|
|
10136
10213
|
};
|
|
@@ -10237,6 +10314,8 @@ function createUsageScanner({ root, claudeProjectsDir: claudeProjectsDir2, byteB
|
|
|
10237
10314
|
let inFlight = null;
|
|
10238
10315
|
let schedule = STOPPED;
|
|
10239
10316
|
const onErrorAfterPublish = warnPathErrors((line) => void warn2(() => line));
|
|
10317
|
+
const runsTail = createJsonlTail(join34(root, RUNS_FILE), cliRunSchema);
|
|
10318
|
+
const newOutsideWorktrees = outsideWorktreeRecorder();
|
|
10240
10319
|
const setScan = (next) => {
|
|
10241
10320
|
if (!scanEquals(scan, next)) revision += 1;
|
|
10242
10321
|
scan = next;
|
|
@@ -10247,10 +10326,13 @@ function createUsageScanner({ root, claudeProjectsDir: claudeProjectsDir2, byteB
|
|
|
10247
10326
|
const files = await listTranscripts(claudeProjectsDir2);
|
|
10248
10327
|
setScan(progressBefore(files, current));
|
|
10249
10328
|
const result = await scanTranscripts({ files, cache: current, byteBudget, now: now() });
|
|
10250
|
-
|
|
10251
|
-
|
|
10329
|
+
const { values: runs } = await runsTail.read();
|
|
10330
|
+
const added = await newOutsideWorktrees(result.cache, runs);
|
|
10331
|
+
const next = added.length === 0 ? result.cache : { ...result.cache, worktreeRepos: { ...result.cache.worktreeRepos, ...Object.fromEntries(added) } };
|
|
10332
|
+
if (cacheChanged(published, next)) revision += 1;
|
|
10333
|
+
cache = next;
|
|
10252
10334
|
setScan({ listed: true, filesTotal: files.length, filesDone: result.filesDone, bytesLeft: result.bytesLeft });
|
|
10253
|
-
if (result.bytesRead > 0 || result.prunedBuckets > 0) await writeUsageCache(root,
|
|
10335
|
+
if (result.bytesRead > 0 || result.prunedBuckets > 0 || added.length > 0) await writeUsageCache(root, next, onErrorAfterPublish);
|
|
10254
10336
|
return result.bytesRead >= byteBudget ? "budget-spent" : "settled";
|
|
10255
10337
|
};
|
|
10256
10338
|
const scanOnce = () => {
|
|
@@ -10283,12 +10365,30 @@ function createUsageScanner({ root, claudeProjectsDir: claudeProjectsDir2, byteB
|
|
|
10283
10365
|
snapshot: () => ({ cache: cache ?? emptyUsageCache(), scan, revision })
|
|
10284
10366
|
};
|
|
10285
10367
|
}
|
|
10368
|
+
function outsideWorktreeRecorder() {
|
|
10369
|
+
const lookupRepoRoot = cachedRepoRoots({ onUnreadable: unreadableDirHasNoRepo });
|
|
10370
|
+
const settledCwds = /* @__PURE__ */ new Set();
|
|
10371
|
+
const settledRootsOf = async (cwd) => {
|
|
10372
|
+
const roots = existsSync2(cwd) ? await lookupRepoRoot(cwd) : "missing";
|
|
10373
|
+
if (roots !== "not-in-repo" && roots !== "unreadable") settledCwds.add(cwd);
|
|
10374
|
+
return roots;
|
|
10375
|
+
};
|
|
10376
|
+
return async (scanned, runs) => {
|
|
10377
|
+
const cwds = new Set([...usageBucketsOf(scanned), ...runs].map((entry) => entry.cwd));
|
|
10378
|
+
const unsettled = [...cwds].filter((cwd) => isAbsolute4(cwd) && !settledCwds.has(cwd));
|
|
10379
|
+
const found = (await Promise.all(unsettled.map(settledRootsOf))).filter((roots) => typeof roots !== "string");
|
|
10380
|
+
const outside = found.filter(({ worktree, main }) => relativeInside(main, worktree) === null && scanned.worktreeRepos[worktree] !== main);
|
|
10381
|
+
return [...new Map(outside.map(({ worktree, main }) => [worktree, main])).entries()];
|
|
10382
|
+
};
|
|
10383
|
+
}
|
|
10286
10384
|
function scanEquals(a, b) {
|
|
10287
10385
|
return a.listed === b.listed && a.filesTotal === b.filesTotal && a.filesDone === b.filesDone && a.bytesLeft === b.bytesLeft;
|
|
10288
10386
|
}
|
|
10289
10387
|
function cacheChanged(previous, next) {
|
|
10290
10388
|
const previousPaths = Object.keys(previous.files);
|
|
10291
|
-
|
|
10389
|
+
const sameFileSet = previousPaths.length === Object.keys(next.files).length;
|
|
10390
|
+
const sameKeptRecords = isDeepStrictEqual(previous.carried, next.carried) && isDeepStrictEqual(previous.worktreeRepos, next.worktreeRepos);
|
|
10391
|
+
if (!sameFileSet || !sameKeptRecords) return true;
|
|
10292
10392
|
return previousPaths.some((path) => entryChanged(previous.files[path], next.files[path]));
|
|
10293
10393
|
}
|
|
10294
10394
|
function entryChanged(previous, next) {
|
|
@@ -10311,7 +10411,7 @@ function progressBefore(files, cache) {
|
|
|
10311
10411
|
// src/server/start.ts
|
|
10312
10412
|
var SWEEP_INTERVAL_MS = HOUR_MS;
|
|
10313
10413
|
var STOP_SIGNALS = ["SIGTERM", "SIGINT", "SIGHUP"];
|
|
10314
|
-
var BUNDLED_WEB_DIR =
|
|
10414
|
+
var BUNDLED_WEB_DIR = join35(import.meta.dirname, "web");
|
|
10315
10415
|
async function startServer({ root, port, home: home2, env, platform, log, warn: warn2, pidFile, staticDir, settledLanguage, now = () => /* @__PURE__ */ new Date() }) {
|
|
10316
10416
|
await mkdir6(root, { recursive: true });
|
|
10317
10417
|
const startupMessages = serverMessages(settledLanguage);
|
|
@@ -10422,7 +10522,7 @@ function isFailure(outcome) {
|
|
|
10422
10522
|
|
|
10423
10523
|
// src/cli/service/launchd.ts
|
|
10424
10524
|
import { mkdir as mkdir7, rm as rm6, writeFile as writeFile3 } from "node:fs/promises";
|
|
10425
|
-
import { dirname as dirname9, join as
|
|
10525
|
+
import { dirname as dirname9, join as join36 } from "node:path";
|
|
10426
10526
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
10427
10527
|
|
|
10428
10528
|
// src/cli/service/service.ts
|
|
@@ -10486,7 +10586,7 @@ ${entries}
|
|
|
10486
10586
|
`;
|
|
10487
10587
|
}
|
|
10488
10588
|
function launchdManager(context, delay = sleep3) {
|
|
10489
|
-
const file =
|
|
10589
|
+
const file = join36(context.home, "Library/LaunchAgents", `${LABEL}.plist`);
|
|
10490
10590
|
const domain = `gui/${context.uid}`;
|
|
10491
10591
|
const bootout = () => context.exec("launchctl", ["bootout", `${domain}/${LABEL}`]);
|
|
10492
10592
|
const bootstrap = () => context.exec("launchctl", ["bootstrap", domain, file]);
|
|
@@ -10521,7 +10621,7 @@ function launchdManager(context, delay = sleep3) {
|
|
|
10521
10621
|
|
|
10522
10622
|
// src/cli/service/startup-folder.ts
|
|
10523
10623
|
import { mkdir as mkdir8, rm as rm7, writeFile as writeFile4 } from "node:fs/promises";
|
|
10524
|
-
import { dirname as dirname10, join as
|
|
10624
|
+
import { dirname as dirname10, join as join37, win32 } from "node:path";
|
|
10525
10625
|
var SCRIPT_NAME = "p-backlog.vbs";
|
|
10526
10626
|
var COMMAND_LINE_ARGUMENT = /"[^"]*"|\S+/g;
|
|
10527
10627
|
var PROCESS_QUERY_TIMEOUT_MS = 15e3;
|
|
@@ -10531,16 +10631,16 @@ function vbsString(value) {
|
|
|
10531
10631
|
return `"${value.replaceAll('"', '""')}"`;
|
|
10532
10632
|
}
|
|
10533
10633
|
function appDataDir(site) {
|
|
10534
|
-
return
|
|
10634
|
+
return join37(site.env.LOCALAPPDATA ?? join37(site.home, "AppData", "Local"), "p-backlog");
|
|
10535
10635
|
}
|
|
10536
10636
|
function startupFolder(site) {
|
|
10537
|
-
return
|
|
10637
|
+
return join37(site.env.APPDATA ?? join37(site.home, "AppData", "Roaming"), "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
|
|
10538
10638
|
}
|
|
10539
10639
|
function logPath(site) {
|
|
10540
|
-
return
|
|
10640
|
+
return join37(appDataDir(site), "p-backlog.log");
|
|
10541
10641
|
}
|
|
10542
10642
|
function pidFilePath(site) {
|
|
10543
|
-
return
|
|
10643
|
+
return join37(appDataDir(site), "server.pid");
|
|
10544
10644
|
}
|
|
10545
10645
|
var NODE_PATH_ENV = "P_BACKLOG_NODE";
|
|
10546
10646
|
var CLI_PATH_ENV = "P_BACKLOG_CLI";
|
|
@@ -10615,7 +10715,7 @@ function sameWindowsPath(left, right) {
|
|
|
10615
10715
|
return win32.normalize(left).toLowerCase() === win32.normalize(right).toLowerCase();
|
|
10616
10716
|
}
|
|
10617
10717
|
function startupFolderManager(context) {
|
|
10618
|
-
const file =
|
|
10718
|
+
const file = join37(startupFolder(context), SCRIPT_NAME);
|
|
10619
10719
|
return {
|
|
10620
10720
|
file,
|
|
10621
10721
|
logsHint: logPath(context),
|
|
@@ -10642,7 +10742,7 @@ function startupFolderManager(context) {
|
|
|
10642
10742
|
|
|
10643
10743
|
// src/cli/service/systemd.ts
|
|
10644
10744
|
import { mkdir as mkdir9, rm as rm8, writeFile as writeFile5 } from "node:fs/promises";
|
|
10645
|
-
import { dirname as dirname11, join as
|
|
10745
|
+
import { dirname as dirname11, join as join38 } from "node:path";
|
|
10646
10746
|
var SERVICE_NAME = "p-backlog";
|
|
10647
10747
|
var UNIT = `${SERVICE_NAME}.service`;
|
|
10648
10748
|
function quoted(value) {
|
|
@@ -10677,7 +10777,7 @@ async function systemctlSteps(exec, steps) {
|
|
|
10677
10777
|
return "done";
|
|
10678
10778
|
}
|
|
10679
10779
|
function systemdManager(context) {
|
|
10680
|
-
const file =
|
|
10780
|
+
const file = join38(context.home, ".config/systemd/user", UNIT);
|
|
10681
10781
|
return {
|
|
10682
10782
|
file,
|
|
10683
10783
|
logsHint: `journalctl --user -u ${SERVICE_NAME}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "p-backlog",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Keep pull requests clean and audit findings safe: a local, autonomous backlog for Claude Code. The agent files out-of-scope issues as Markdown tasks with context and re-checks them as code changes. Optional web UI with metrics.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|