@zixt/host 0.0.39 → 0.0.40
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/index.js +48 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@zixt/host",
|
|
34
|
-
version: "0.0.
|
|
34
|
+
version: "0.0.40",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -15907,6 +15907,8 @@ var TaskGitSummary = external_exports.object({
|
|
|
15907
15907
|
isWorktree: external_exports.boolean().optional(),
|
|
15908
15908
|
/** False means the Task used this repository, then removed its checkout after integration. */
|
|
15909
15909
|
available: external_exports.boolean().optional(),
|
|
15910
|
+
/** False preserves the Task branch after a shared checkout switches back. */
|
|
15911
|
+
checkedOut: external_exports.boolean().optional(),
|
|
15910
15912
|
branch: taskGitSummaryLabel(512, "branch").nullable(),
|
|
15911
15913
|
ahead: external_exports.number().int().min(0),
|
|
15912
15914
|
behind: external_exports.number().int().min(0),
|
|
@@ -16147,6 +16149,8 @@ var TaskWorkingContextBase = external_exports.object({
|
|
|
16147
16149
|
isWorktree: external_exports.boolean(),
|
|
16148
16150
|
/** Absent is legacy-current; false preserves a cleaned-up Task repository as history. */
|
|
16149
16151
|
available: external_exports.boolean().optional(),
|
|
16152
|
+
/** Absent is legacy-current; false means this retained branch is no longer checked out. */
|
|
16153
|
+
checkedOut: external_exports.boolean().optional(),
|
|
16150
16154
|
/** Null is an observed detached HEAD, never an unknown branch. */
|
|
16151
16155
|
branch: safeWorkingContextLabel(512, "branch").nullable(),
|
|
16152
16156
|
headSha: external_exports.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/).nullable(),
|
|
@@ -33069,6 +33073,7 @@ async function repositoryState(directory, git, env, signal) {
|
|
|
33069
33073
|
root,
|
|
33070
33074
|
isWorktree: gitDirectory !== commonDirectory,
|
|
33071
33075
|
available: true,
|
|
33076
|
+
checkedOut: true,
|
|
33072
33077
|
branch,
|
|
33073
33078
|
headSha,
|
|
33074
33079
|
upstream,
|
|
@@ -33105,13 +33110,42 @@ async function collectWorkingContext(input) {
|
|
|
33105
33110
|
...uniqueRepositories.length > 0 ? { repositories: uniqueRepositories } : {}
|
|
33106
33111
|
});
|
|
33107
33112
|
}
|
|
33108
|
-
function preserveObservedRepositories(current, previous, fixedRepositoryRoots) {
|
|
33113
|
+
function preserveObservedRepositories(current, previous, fixedRepositoryRoots, initial = null) {
|
|
33109
33114
|
const fixed = new Set(fixedRepositoryRoots);
|
|
33110
33115
|
const currentRepositories = current.repositories ?? [];
|
|
33111
33116
|
const currentRoots = new Set(currentRepositories.map(({ root }) => root));
|
|
33112
|
-
const
|
|
33113
|
-
|
|
33114
|
-
|
|
33117
|
+
const previousByRoot = new Map(
|
|
33118
|
+
(previous?.repositories ?? []).map((repository) => [repository.root, repository])
|
|
33119
|
+
);
|
|
33120
|
+
const initialByRoot = new Map(
|
|
33121
|
+
(initial?.repositories ?? []).map((repository) => [repository.root, repository])
|
|
33122
|
+
);
|
|
33123
|
+
const sameRef = (left, right) => left.branch === right.branch && (left.branch !== null || left.headSha === right.headSha);
|
|
33124
|
+
const liveRepositories = currentRepositories.map((repository) => {
|
|
33125
|
+
if (!fixed.has(repository.root)) return repository;
|
|
33126
|
+
const previousRepository = previousByRoot.get(repository.root);
|
|
33127
|
+
const initialRepository = initialByRoot.get(repository.root);
|
|
33128
|
+
if (!previousRepository || !initialRepository || !sameRef(repository, initialRepository)) {
|
|
33129
|
+
return repository;
|
|
33130
|
+
}
|
|
33131
|
+
if (previousRepository.checkedOut !== false && sameRef(previousRepository, initialRepository)) {
|
|
33132
|
+
return repository;
|
|
33133
|
+
}
|
|
33134
|
+
return {
|
|
33135
|
+
...previousRepository,
|
|
33136
|
+
root: repository.root,
|
|
33137
|
+
isWorktree: repository.isWorktree,
|
|
33138
|
+
available: true,
|
|
33139
|
+
checkedOut: false
|
|
33140
|
+
};
|
|
33141
|
+
});
|
|
33142
|
+
const liveTaskRepositories = liveRepositories.filter(({ root }) => !fixed.has(root));
|
|
33143
|
+
const liveFixedRepositories = liveRepositories.filter(({ root }) => fixed.has(root));
|
|
33144
|
+
const retained = (previous?.repositories ?? []).filter(({ root }) => !fixed.has(root) && !currentRoots.has(root)).map((repository) => ({
|
|
33145
|
+
...repository,
|
|
33146
|
+
available: false,
|
|
33147
|
+
checkedOut: false
|
|
33148
|
+
}));
|
|
33115
33149
|
const repositories = [...liveTaskRepositories, ...retained, ...liveFixedRepositories].slice(
|
|
33116
33150
|
0,
|
|
33117
33151
|
20
|
|
@@ -34171,6 +34205,7 @@ ${attachmentSection}` : prompt;
|
|
|
34171
34205
|
let activeWorkingContextReport = null;
|
|
34172
34206
|
let previousWorkingContext = "";
|
|
34173
34207
|
let previousWorkingContextValue = null;
|
|
34208
|
+
let initialWorkingContextValue = null;
|
|
34174
34209
|
const observedWorkingDirectories = /* @__PURE__ */ new Set();
|
|
34175
34210
|
let observedPathRefreshPending = false;
|
|
34176
34211
|
const workingContextAbort = new AbortController();
|
|
@@ -34188,12 +34223,15 @@ ${attachmentSection}` : prompt;
|
|
|
34188
34223
|
git,
|
|
34189
34224
|
env: workingContextEnvironments.git,
|
|
34190
34225
|
signal: workingContextAbort.signal
|
|
34226
|
+
}).then((context) => {
|
|
34227
|
+
initialWorkingContextValue ??= context;
|
|
34228
|
+
return preserveObservedRepositories(
|
|
34229
|
+
context,
|
|
34230
|
+
previousWorkingContextValue,
|
|
34231
|
+
[cwd, ...preparedWorkspace ? [preparedWorkspace.path] : []],
|
|
34232
|
+
initialWorkingContextValue
|
|
34233
|
+
);
|
|
34191
34234
|
}).then(
|
|
34192
|
-
(context) => preserveObservedRepositories(context, previousWorkingContextValue, [
|
|
34193
|
-
cwd,
|
|
34194
|
-
...preparedWorkspace ? [preparedWorkspace.path] : []
|
|
34195
|
-
])
|
|
34196
|
-
).then(
|
|
34197
34235
|
(context) => pullRequests.enrich(context, ghContextCommand, {
|
|
34198
34236
|
...options.forcePullRequest ? { force: true } : {},
|
|
34199
34237
|
...gitContextCommand ? { gitCommand: gitContextCommand } : {},
|