@zixt/host 0.0.32 → 0.0.34
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 +41 -4
- 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.34",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -15899,6 +15899,10 @@ var TaskGitSummary = external_exports.object({
|
|
|
15899
15899
|
repositories: external_exports.array(
|
|
15900
15900
|
external_exports.object({
|
|
15901
15901
|
githubRepository: external_exports.string().regex(/^[A-Za-z0-9_.-]{1,100}\/[A-Za-z0-9_.-]{1,100}$/).optional(),
|
|
15902
|
+
/** True only when this repository was an isolated Git worktree. */
|
|
15903
|
+
isWorktree: external_exports.boolean().optional(),
|
|
15904
|
+
/** False means the Task used this repository, then removed its checkout after integration. */
|
|
15905
|
+
available: external_exports.boolean().optional(),
|
|
15902
15906
|
branch: taskGitSummaryLabel(512, "branch").nullable(),
|
|
15903
15907
|
ahead: external_exports.number().int().min(0),
|
|
15904
15908
|
behind: external_exports.number().int().min(0),
|
|
@@ -16134,6 +16138,8 @@ var TaskWorkingContextBase = external_exports.object({
|
|
|
16134
16138
|
root: SafeDisplayPath,
|
|
16135
16139
|
/** True when this checkout has a separate Git worktree directory. */
|
|
16136
16140
|
isWorktree: external_exports.boolean(),
|
|
16141
|
+
/** Absent is legacy-current; false preserves a cleaned-up Task repository as history. */
|
|
16142
|
+
available: external_exports.boolean().optional(),
|
|
16137
16143
|
/** Null is an observed detached HEAD, never an unknown branch. */
|
|
16138
16144
|
branch: safeWorkingContextLabel(512, "branch").nullable(),
|
|
16139
16145
|
headSha: external_exports.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/).nullable(),
|
|
@@ -32764,11 +32770,16 @@ function parsePullRequest(output, expectedBaseRepository, expectedHeadRepository
|
|
|
32764
32770
|
return void 0;
|
|
32765
32771
|
}
|
|
32766
32772
|
}
|
|
32767
|
-
async function pullRequest(command, gitCommand,
|
|
32773
|
+
async function pullRequest(command, gitCommand, repositoryCwd, commandCwd, repository, branch, signal) {
|
|
32768
32774
|
if (!command || !repository || !branch) return void 0;
|
|
32769
32775
|
const headOwner = repository.split("/")[0];
|
|
32770
32776
|
const selector = `${headOwner}:${branch}`;
|
|
32771
|
-
const baseRepositories = await pullRequestBaseRepositories(
|
|
32777
|
+
const baseRepositories = await pullRequestBaseRepositories(
|
|
32778
|
+
gitCommand,
|
|
32779
|
+
repositoryCwd,
|
|
32780
|
+
repository,
|
|
32781
|
+
signal
|
|
32782
|
+
);
|
|
32772
32783
|
for (const baseRepository of baseRepositories) {
|
|
32773
32784
|
const output = await run(
|
|
32774
32785
|
command.executablePath,
|
|
@@ -32782,7 +32793,7 @@ async function pullRequest(command, gitCommand, cwd, repository, branch, signal)
|
|
|
32782
32793
|
"--json",
|
|
32783
32794
|
"number,title,url,state,isDraft,baseRefName,headRefName,headRepository,headRepositoryOwner"
|
|
32784
32795
|
],
|
|
32785
|
-
|
|
32796
|
+
commandCwd,
|
|
32786
32797
|
command.env,
|
|
32787
32798
|
signal
|
|
32788
32799
|
);
|
|
@@ -32844,6 +32855,7 @@ async function repositoryState(directory, git, env, signal) {
|
|
|
32844
32855
|
return {
|
|
32845
32856
|
root,
|
|
32846
32857
|
isWorktree: gitDirectory !== commonDirectory,
|
|
32858
|
+
available: true,
|
|
32847
32859
|
branch,
|
|
32848
32860
|
headSha,
|
|
32849
32861
|
upstream,
|
|
@@ -32880,6 +32892,22 @@ async function collectWorkingContext(input) {
|
|
|
32880
32892
|
...uniqueRepositories.length > 0 ? { repositories: uniqueRepositories } : {}
|
|
32881
32893
|
});
|
|
32882
32894
|
}
|
|
32895
|
+
function preserveObservedRepositories(current, previous, fixedRepositoryRoots) {
|
|
32896
|
+
const fixed = new Set(fixedRepositoryRoots);
|
|
32897
|
+
const currentRepositories = current.repositories ?? [];
|
|
32898
|
+
const currentRoots = new Set(currentRepositories.map(({ root }) => root));
|
|
32899
|
+
const liveTaskRepositories = currentRepositories.filter(({ root }) => !fixed.has(root));
|
|
32900
|
+
const liveFixedRepositories = currentRepositories.filter(({ root }) => fixed.has(root));
|
|
32901
|
+
const retained = (previous?.repositories ?? []).filter(({ root }) => !fixed.has(root) && !currentRoots.has(root)).map((repository) => ({ ...repository, available: false }));
|
|
32902
|
+
const repositories = [...liveTaskRepositories, ...retained, ...liveFixedRepositories].slice(
|
|
32903
|
+
0,
|
|
32904
|
+
20
|
|
32905
|
+
);
|
|
32906
|
+
return TaskWorkingContextObservation.parse({
|
|
32907
|
+
...current,
|
|
32908
|
+
...repositories.length > 0 ? { repositories } : { repositories: void 0 }
|
|
32909
|
+
});
|
|
32910
|
+
}
|
|
32883
32911
|
var WorkingContextPullRequestCache = class {
|
|
32884
32912
|
constructor(ttlMs = PULL_REQUEST_CACHE_TTL_MS, now = Date.now, maxEntries = PULL_REQUEST_CACHE_MAX_ENTRIES) {
|
|
32885
32913
|
this.ttlMs = ttlMs;
|
|
@@ -32904,6 +32932,7 @@ var WorkingContextPullRequestCache = class {
|
|
|
32904
32932
|
command,
|
|
32905
32933
|
options.gitCommand,
|
|
32906
32934
|
repository.root,
|
|
32935
|
+
options.commandCwd ?? repository.root,
|
|
32907
32936
|
repository.githubRepository,
|
|
32908
32937
|
repository.branch,
|
|
32909
32938
|
options.signal
|
|
@@ -33917,6 +33946,7 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
33917
33946
|
${attachmentSection}` : prompt;
|
|
33918
33947
|
let activeWorkingContextReport = null;
|
|
33919
33948
|
let previousWorkingContext = "";
|
|
33949
|
+
let previousWorkingContextValue = null;
|
|
33920
33950
|
const observedWorkingDirectories = /* @__PURE__ */ new Set();
|
|
33921
33951
|
let observedPathRefreshPending = false;
|
|
33922
33952
|
const workingContextAbort = new AbortController();
|
|
@@ -33935,12 +33965,19 @@ ${attachmentSection}` : prompt;
|
|
|
33935
33965
|
env: workingContextEnvironments.git,
|
|
33936
33966
|
signal: workingContextAbort.signal
|
|
33937
33967
|
}).then(
|
|
33968
|
+
(context) => preserveObservedRepositories(context, previousWorkingContextValue, [
|
|
33969
|
+
cwd,
|
|
33970
|
+
...preparedWorkspace ? [preparedWorkspace.path] : []
|
|
33971
|
+
])
|
|
33972
|
+
).then(
|
|
33938
33973
|
(context) => pullRequests.enrich(context, ghContextCommand, {
|
|
33939
33974
|
...options.forcePullRequest ? { force: true } : {},
|
|
33940
33975
|
...gitContextCommand ? { gitCommand: gitContextCommand } : {},
|
|
33976
|
+
commandCwd: cwd,
|
|
33941
33977
|
signal: workingContextAbort.signal
|
|
33942
33978
|
})
|
|
33943
33979
|
).then((context) => {
|
|
33980
|
+
previousWorkingContextValue = context;
|
|
33944
33981
|
const serialized = JSON.stringify(context);
|
|
33945
33982
|
if (!options.forceReport && serialized === previousWorkingContext || task.cancelledNow() || workingContextAbort.signal.aborted) {
|
|
33946
33983
|
return;
|