@zixt/host 0.0.32 → 0.0.33

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -4
  2. 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.32",
34
+ version: "0.0.33",
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, cwd, repository, branch, signal) {
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(gitCommand, cwd, repository, signal);
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
- cwd,
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,19 @@ 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];
32903
+ return TaskWorkingContextObservation.parse({
32904
+ ...current,
32905
+ ...repositories.length > 0 ? { repositories } : { repositories: void 0 }
32906
+ });
32907
+ }
32883
32908
  var WorkingContextPullRequestCache = class {
32884
32909
  constructor(ttlMs = PULL_REQUEST_CACHE_TTL_MS, now = Date.now, maxEntries = PULL_REQUEST_CACHE_MAX_ENTRIES) {
32885
32910
  this.ttlMs = ttlMs;
@@ -32904,6 +32929,7 @@ var WorkingContextPullRequestCache = class {
32904
32929
  command,
32905
32930
  options.gitCommand,
32906
32931
  repository.root,
32932
+ options.commandCwd ?? repository.root,
32907
32933
  repository.githubRepository,
32908
32934
  repository.branch,
32909
32935
  options.signal
@@ -33917,6 +33943,7 @@ function createCliRunner(adapter, opts = {}) {
33917
33943
  ${attachmentSection}` : prompt;
33918
33944
  let activeWorkingContextReport = null;
33919
33945
  let previousWorkingContext = "";
33946
+ let previousWorkingContextValue = null;
33920
33947
  const observedWorkingDirectories = /* @__PURE__ */ new Set();
33921
33948
  let observedPathRefreshPending = false;
33922
33949
  const workingContextAbort = new AbortController();
@@ -33935,12 +33962,19 @@ ${attachmentSection}` : prompt;
33935
33962
  env: workingContextEnvironments.git,
33936
33963
  signal: workingContextAbort.signal
33937
33964
  }).then(
33965
+ (context) => preserveObservedRepositories(context, previousWorkingContextValue, [
33966
+ cwd,
33967
+ ...preparedWorkspace ? [preparedWorkspace.path] : []
33968
+ ])
33969
+ ).then(
33938
33970
  (context) => pullRequests.enrich(context, ghContextCommand, {
33939
33971
  ...options.forcePullRequest ? { force: true } : {},
33940
33972
  ...gitContextCommand ? { gitCommand: gitContextCommand } : {},
33973
+ commandCwd: cwd,
33941
33974
  signal: workingContextAbort.signal
33942
33975
  })
33943
33976
  ).then((context) => {
33977
+ previousWorkingContextValue = context;
33944
33978
  const serialized = JSON.stringify(context);
33945
33979
  if (!options.forceReport && serialized === previousWorkingContext || task.cancelledNow() || workingContextAbort.signal.aborted) {
33946
33980
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",