panopticon-cli 0.4.21 → 0.4.23

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 (43) hide show
  1. package/dist/{agents-2Q6TCHNN.js → agents-ND4NKCK2.js} +5 -5
  2. package/dist/{chunk-KQAEUOML.js → chunk-46DPNFMW.js} +2 -2
  3. package/dist/{chunk-26QM7CPN.js → chunk-6CIBLKFZ.js} +4 -3
  4. package/dist/{chunk-26QM7CPN.js.map → chunk-6CIBLKFZ.js.map} +1 -1
  5. package/dist/{chunk-KGPRXDMX.js → chunk-6HXKTOD7.js} +5 -1
  6. package/dist/chunk-6HXKTOD7.js.map +1 -0
  7. package/dist/{chunk-QB3W4NX6.js → chunk-G4H6KZDC.js} +29 -22
  8. package/dist/{chunk-QB3W4NX6.js.map → chunk-G4H6KZDC.js.map} +1 -1
  9. package/dist/{chunk-SOL4WQJD.js → chunk-JY7R7V4G.js} +2 -2
  10. package/dist/{chunk-65DGYSS4.js → chunk-ON5NIBGW.js} +2 -2
  11. package/dist/{chunk-YOQLBJ7B.js → chunk-SIAUVHVO.js} +3 -3
  12. package/dist/{chunk-ZAM2Q52Q.js → chunk-VTMXR7JF.js} +2 -2
  13. package/dist/{chunk-XTXWSLT3.js → chunk-ZLB6G4NW.js} +4 -4
  14. package/dist/cli/index.js +20 -20
  15. package/dist/{config-WCEPLNXI.js → config-QWTS63TU.js} +3 -3
  16. package/dist/dashboard/server.js +170 -44
  17. package/dist/index.d.ts +3 -1
  18. package/dist/index.js +6 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/{projects-AMR3XQM4.js → projects-VXRUCMLM.js} +3 -3
  21. package/dist/{remote-workspace-V57IZJRC.js → remote-workspace-FNXLMNBG.js} +4 -4
  22. package/dist/{specialist-context-2G6YOU3M.js → specialist-context-VWST6O2N.js} +13 -14
  23. package/dist/specialist-context-VWST6O2N.js.map +1 -0
  24. package/dist/{specialist-logs-5OTCVAVH.js → specialist-logs-OU3KESAI.js} +5 -5
  25. package/dist/{specialists-H5QEVLNN.js → specialists-QVAZGJPU.js} +5 -5
  26. package/dist/{traefik-DRNZMPGZ.js → traefik-7OLLXUD7.js} +4 -4
  27. package/package.json +1 -1
  28. package/skills/pan-oversee/SKILL.md +63 -11
  29. package/dist/chunk-KGPRXDMX.js.map +0 -1
  30. package/dist/specialist-context-2G6YOU3M.js.map +0 -1
  31. /package/dist/{agents-2Q6TCHNN.js.map → agents-ND4NKCK2.js.map} +0 -0
  32. /package/dist/{chunk-KQAEUOML.js.map → chunk-46DPNFMW.js.map} +0 -0
  33. /package/dist/{chunk-SOL4WQJD.js.map → chunk-JY7R7V4G.js.map} +0 -0
  34. /package/dist/{chunk-65DGYSS4.js.map → chunk-ON5NIBGW.js.map} +0 -0
  35. /package/dist/{chunk-YOQLBJ7B.js.map → chunk-SIAUVHVO.js.map} +0 -0
  36. /package/dist/{chunk-ZAM2Q52Q.js.map → chunk-VTMXR7JF.js.map} +0 -0
  37. /package/dist/{chunk-XTXWSLT3.js.map → chunk-ZLB6G4NW.js.map} +0 -0
  38. /package/dist/{config-WCEPLNXI.js.map → config-QWTS63TU.js.map} +0 -0
  39. /package/dist/{projects-AMR3XQM4.js.map → projects-VXRUCMLM.js.map} +0 -0
  40. /package/dist/{remote-workspace-V57IZJRC.js.map → remote-workspace-FNXLMNBG.js.map} +0 -0
  41. /package/dist/{specialist-logs-5OTCVAVH.js.map → specialist-logs-OU3KESAI.js.map} +0 -0
  42. /package/dist/{specialists-H5QEVLNN.js.map → specialists-QVAZGJPU.js.map} +0 -0
  43. /package/dist/{traefik-DRNZMPGZ.js.map → traefik-7OLLXUD7.js.map} +0 -0
@@ -51646,7 +51646,8 @@ var init_rally = __esm({
51646
51646
  return conditions.reduce((acc, cond) => acc ? `(${acc} AND ${cond})` : cond, "");
51647
51647
  }
51648
51648
  normalizeIssue(rallyArtifact) {
51649
- const stateValue = rallyArtifact.ScheduleState || rallyArtifact.State || "Defined";
51649
+ const rawStateValue = rallyArtifact.ScheduleState || rallyArtifact.State || "Defined";
51650
+ const stateValue = typeof rawStateValue === "object" && rawStateValue !== null ? rawStateValue.Name || rawStateValue._refObjectName || "Defined" : rawStateValue;
51650
51651
  const state = this.mapState(stateValue);
51651
51652
  const labels = [];
51652
51653
  if (rallyArtifact.Tags && rallyArtifact.Tags._tagsNameArray) {
@@ -59045,6 +59046,9 @@ import { homedir as homedir5 } from "os";
59045
59046
  import { join as join5 } from "path";
59046
59047
  import { fileURLToPath } from "url";
59047
59048
  import { dirname } from "path";
59049
+ function getPanopticonHome() {
59050
+ return process.env.PANOPTICON_HOME || join5(homedir5(), ".panopticon");
59051
+ }
59048
59052
  var PANOPTICON_HOME2, CONFIG_DIR, SKILLS_DIR, COMMANDS_DIR, AGENTS_DIR, BIN_DIR, BACKUPS_DIR, COSTS_DIR, HEARTBEATS_DIR, TRAEFIK_DIR, TRAEFIK_DYNAMIC_DIR, TRAEFIK_CERTS_DIR, CERTS_DIR, CONFIG_FILE, SETTINGS_FILE, CLAUDE_DIR, CODEX_DIR, CURSOR_DIR, GEMINI_DIR, OPENCODE_DIR, SYNC_TARGETS, TEMPLATES_DIR, CLAUDE_MD_TEMPLATES, currentFile, currentDir, packageRoot, SOURCE_TEMPLATES_DIR, SOURCE_TRAEFIK_TEMPLATES, SOURCE_SCRIPTS_DIR, SOURCE_SKILLS_DIR, SOURCE_DEV_SKILLS_DIR;
59049
59053
  var init_paths = __esm({
59050
59054
  "../../lib/paths.ts"() {
@@ -63537,8 +63541,11 @@ __export(specialist_logs_exports, {
63537
63541
  });
63538
63542
  import { existsSync as existsSync12, mkdirSync as mkdirSync9, writeFileSync as writeFileSync6, appendFileSync as appendFileSync3, readFileSync as readFileSync9, readdirSync as readdirSync4, statSync as statSync2, unlinkSync as unlinkSync3 } from "fs";
63539
63543
  import { join as join14, basename as basename2 } from "path";
63544
+ function getSpecialistsDir() {
63545
+ return join14(getPanopticonHome(), "specialists");
63546
+ }
63540
63547
  function getRunsDirectory(projectKey, specialistType) {
63541
- return join14(SPECIALISTS_DIR, projectKey, specialistType, "runs");
63548
+ return join14(getSpecialistsDir(), projectKey, specialistType, "runs");
63542
63549
  }
63543
63550
  function generateRunId(issueId) {
63544
63551
  const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").substring(0, 19);
@@ -63680,7 +63687,12 @@ function listRunLogs(projectKey, specialistType, options = {}) {
63680
63687
  createdAt: stats.birthtime
63681
63688
  };
63682
63689
  });
63683
- files.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
63690
+ files.sort((a, b) => {
63691
+ const timeDiff = b.createdAt.getTime() - a.createdAt.getTime();
63692
+ if (timeDiff !== 0)
63693
+ return timeDiff;
63694
+ return b.runId.localeCompare(a.runId);
63695
+ });
63684
63696
  const { limit, offset = 0 } = options;
63685
63697
  if (limit !== void 0) {
63686
63698
  return files.slice(offset, offset + limit);
@@ -63776,12 +63788,11 @@ function cleanupAllLogs() {
63776
63788
  console.log(`[specialist-logs] Cleanup complete: deleted ${results.totalDeleted} old logs`);
63777
63789
  return results;
63778
63790
  }
63779
- var SPECIALISTS_DIR, MAX_LOG_SIZE;
63791
+ var MAX_LOG_SIZE;
63780
63792
  var init_specialist_logs = __esm({
63781
63793
  "../../lib/cloister/specialist-logs.ts"() {
63782
63794
  "use strict";
63783
63795
  init_paths();
63784
- SPECIALISTS_DIR = join14(PANOPTICON_HOME2, "specialists");
63785
63796
  MAX_LOG_SIZE = 10 * 1024 * 1024;
63786
63797
  }
63787
63798
  });
@@ -63798,12 +63809,15 @@ __export(specialist_context_exports, {
63798
63809
  regenerateContextDigest: () => regenerateContextDigest,
63799
63810
  scheduleDigestGeneration: () => scheduleDigestGeneration
63800
63811
  });
63801
- import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "fs";
63812
+ import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync7, unlinkSync as unlinkSync4 } from "fs";
63802
63813
  import { join as join15 } from "path";
63803
63814
  import { exec } from "child_process";
63804
63815
  import { promisify } from "util";
63816
+ function getSpecialistsDir2() {
63817
+ return join15(getPanopticonHome(), "specialists");
63818
+ }
63805
63819
  function getContextDirectory(projectKey, specialistType) {
63806
- return join15(SPECIALISTS_DIR2, projectKey, specialistType, "context");
63820
+ return join15(getSpecialistsDir2(), projectKey, specialistType, "context");
63807
63821
  }
63808
63822
  function getContextDigestPath(projectKey, specialistType) {
63809
63823
  const contextDir = getContextDirectory(projectKey, specialistType);
@@ -63855,7 +63869,7 @@ async function generateContextDigest(projectKey, specialistType, options = {}) {
63855
63869
  const model = options.model ?? getDigestModel(projectKey, specialistType);
63856
63870
  try {
63857
63871
  console.log(`[specialist-context] Generating digest for ${projectKey}/${specialistType} using ${model}...`);
63858
- const tempDir = join15(PANOPTICON_HOME2, "tmp");
63872
+ const tempDir = join15(getPanopticonHome(), "tmp");
63859
63873
  if (!existsSync13(tempDir)) {
63860
63874
  mkdirSync10(tempDir, { recursive: true });
63861
63875
  }
@@ -63872,8 +63886,7 @@ async function generateContextDigest(projectKey, specialistType, options = {}) {
63872
63886
  }
63873
63887
  );
63874
63888
  try {
63875
- const { unlinkSync: unlinkSync11 } = await import("fs");
63876
- unlinkSync11(promptFile);
63889
+ unlinkSync4(promptFile);
63877
63890
  } catch {
63878
63891
  }
63879
63892
  if (stderr && !stderr.includes("warning")) {
@@ -63999,15 +64012,14 @@ function deleteContextDigest(projectKey, specialistType) {
63999
64012
  return false;
64000
64013
  }
64001
64014
  try {
64002
- const { unlinkSync: unlinkSync11 } = __require("fs");
64003
- unlinkSync11(digestPath);
64015
+ unlinkSync4(digestPath);
64004
64016
  return true;
64005
64017
  } catch (error) {
64006
64018
  console.error(`[specialist-context] Failed to delete digest:`, error);
64007
64019
  return false;
64008
64020
  }
64009
64021
  }
64010
- var execAsync, SPECIALISTS_DIR2;
64022
+ var execAsync;
64011
64023
  var init_specialist_context = __esm({
64012
64024
  "../../lib/cloister/specialist-context.ts"() {
64013
64025
  "use strict";
@@ -64016,7 +64028,6 @@ var init_specialist_context = __esm({
64016
64028
  init_projects();
64017
64029
  init_work_type_router();
64018
64030
  execAsync = promisify(exec);
64019
- SPECIALISTS_DIR2 = join15(PANOPTICON_HOME2, "specialists");
64020
64031
  }
64021
64032
  });
64022
64033
 
@@ -65094,7 +65105,7 @@ __export(agents_exports, {
65094
65105
  spawnAgent: () => spawnAgent,
65095
65106
  stopAgent: () => stopAgent
65096
65107
  });
65097
- import { existsSync as existsSync18, mkdirSync as mkdirSync13, writeFileSync as writeFileSync11, readFileSync as readFileSync15, readdirSync as readdirSync7, appendFileSync as appendFileSync4, unlinkSync as unlinkSync4 } from "fs";
65108
+ import { existsSync as existsSync18, mkdirSync as mkdirSync13, writeFileSync as writeFileSync11, readFileSync as readFileSync15, readdirSync as readdirSync7, appendFileSync as appendFileSync4, unlinkSync as unlinkSync5 } from "fs";
65098
65109
  import { join as join19 } from "path";
65099
65110
  import { homedir as homedir9 } from "os";
65100
65111
  import { exec as exec3 } from "child_process";
@@ -65118,7 +65129,7 @@ function clearReadySignal(agentId) {
65118
65129
  const readyPath = getReadySignalPath(agentId);
65119
65130
  if (existsSync18(readyPath)) {
65120
65131
  try {
65121
- unlinkSync4(readyPath);
65132
+ unlinkSync5(readyPath);
65122
65133
  } catch {
65123
65134
  }
65124
65135
  }
@@ -65704,14 +65715,14 @@ __export(specialists_exports, {
65704
65715
  wakeSpecialistOrQueue: () => wakeSpecialistOrQueue,
65705
65716
  wakeSpecialistWithTask: () => wakeSpecialistWithTask
65706
65717
  });
65707
- import { readFileSync as readFileSync16, writeFileSync as writeFileSync12, existsSync as existsSync19, mkdirSync as mkdirSync14, readdirSync as readdirSync8, unlinkSync as unlinkSync5, appendFileSync as appendFileSync5 } from "fs";
65718
+ import { readFileSync as readFileSync16, writeFileSync as writeFileSync12, existsSync as existsSync19, mkdirSync as mkdirSync14, readdirSync as readdirSync8, unlinkSync as unlinkSync6, appendFileSync as appendFileSync5 } from "fs";
65708
65719
  import { join as join20, basename as basename3 } from "path";
65709
65720
  import { homedir as homedir10 } from "os";
65710
65721
  import { exec as exec4 } from "child_process";
65711
65722
  import { promisify as promisify4 } from "util";
65712
65723
  function initSpecialistsDirectory() {
65713
- if (!existsSync19(SPECIALISTS_DIR3)) {
65714
- mkdirSync14(SPECIALISTS_DIR3, { recursive: true });
65724
+ if (!existsSync19(SPECIALISTS_DIR)) {
65725
+ mkdirSync14(SPECIALISTS_DIR, { recursive: true });
65715
65726
  }
65716
65727
  if (!existsSync19(REGISTRY_FILE)) {
65717
65728
  const registry = {
@@ -65785,8 +65796,8 @@ function loadRegistry() {
65785
65796
  }
65786
65797
  }
65787
65798
  function saveRegistry(registry) {
65788
- if (!existsSync19(SPECIALISTS_DIR3)) {
65789
- mkdirSync14(SPECIALISTS_DIR3, { recursive: true });
65799
+ if (!existsSync19(SPECIALISTS_DIR)) {
65800
+ mkdirSync14(SPECIALISTS_DIR, { recursive: true });
65790
65801
  }
65791
65802
  registry.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
65792
65803
  try {
@@ -65798,7 +65809,7 @@ function saveRegistry(registry) {
65798
65809
  }
65799
65810
  }
65800
65811
  function getSessionFilePath(name) {
65801
- return join20(SPECIALISTS_DIR3, `${name}.session`);
65812
+ return join20(SPECIALISTS_DIR, `${name}.session`);
65802
65813
  }
65803
65814
  function getSessionId2(name) {
65804
65815
  const sessionFile = getSessionFilePath(name);
@@ -65828,7 +65839,7 @@ function clearSessionId(name) {
65828
65839
  return false;
65829
65840
  }
65830
65841
  try {
65831
- unlinkSync5(sessionFile);
65842
+ unlinkSync6(sessionFile);
65832
65843
  return true;
65833
65844
  } catch (error) {
65834
65845
  console.error(`Failed to delete session file for ${name}:`, error);
@@ -66148,7 +66159,7 @@ function scheduleLogCleanup(projectKey, specialistType) {
66148
66159
  });
66149
66160
  }
66150
66161
  function getProjectSpecialistDir(projectKey, specialistType) {
66151
- return join20(SPECIALISTS_DIR3, projectKey, specialistType);
66162
+ return join20(SPECIALISTS_DIR, projectKey, specialistType);
66152
66163
  }
66153
66164
  function ensureProjectSpecialistDir(projectKey, specialistType) {
66154
66165
  const specialistDir = getProjectSpecialistDir(projectKey, specialistType);
@@ -66245,7 +66256,7 @@ function updateContextTokens(name, tokens) {
66245
66256
  function listSessionFiles() {
66246
66257
  initSpecialistsDirectory();
66247
66258
  try {
66248
- const files = readdirSync8(SPECIALISTS_DIR3);
66259
+ const files = readdirSync8(SPECIALISTS_DIR);
66249
66260
  const sessionFiles = files.filter((f) => f.endsWith(".session"));
66250
66261
  return sessionFiles.map((f) => f.replace(".session", ""));
66251
66262
  } catch (error) {
@@ -66923,7 +66934,7 @@ function getFeedbackStats() {
66923
66934
  }
66924
66935
  return stats;
66925
66936
  }
66926
- var execAsync4, SPECIALISTS_DIR3, REGISTRY_FILE, TASKS_DIR, DEFAULT_SPECIALISTS, gracePeriodStates, FEEDBACK_DIR, FEEDBACK_LOG;
66937
+ var execAsync4, SPECIALISTS_DIR, REGISTRY_FILE, TASKS_DIR, DEFAULT_SPECIALISTS, gracePeriodStates, FEEDBACK_DIR, FEEDBACK_LOG;
66927
66938
  var init_specialists = __esm({
66928
66939
  "../../lib/cloister/specialists.ts"() {
66929
66940
  "use strict";
@@ -66934,9 +66945,9 @@ var init_specialists = __esm({
66934
66945
  init_tmux();
66935
66946
  init_hooks();
66936
66947
  execAsync4 = promisify4(exec4);
66937
- SPECIALISTS_DIR3 = join20(PANOPTICON_HOME2, "specialists");
66938
- REGISTRY_FILE = join20(SPECIALISTS_DIR3, "registry.json");
66939
- TASKS_DIR = join20(SPECIALISTS_DIR3, "tasks");
66948
+ SPECIALISTS_DIR = join20(PANOPTICON_HOME2, "specialists");
66949
+ REGISTRY_FILE = join20(SPECIALISTS_DIR, "registry.json");
66950
+ TASKS_DIR = join20(SPECIALISTS_DIR, "tasks");
66940
66951
  DEFAULT_SPECIALISTS = [
66941
66952
  {
66942
66953
  name: "merge-agent",
@@ -67130,7 +67141,7 @@ var init_validation = __esm({
67130
67141
  });
67131
67142
 
67132
67143
  // ../../lib/git-utils.ts
67133
- import { existsSync as existsSync31, unlinkSync as unlinkSync9, readdirSync as readdirSync12 } from "fs";
67144
+ import { existsSync as existsSync31, unlinkSync as unlinkSync10, readdirSync as readdirSync12 } from "fs";
67134
67145
  import { join as join32 } from "path";
67135
67146
  import { exec as exec9 } from "child_process";
67136
67147
  import { promisify as promisify9 } from "util";
@@ -67204,7 +67215,7 @@ async function cleanupStaleLocks(repoPath) {
67204
67215
  }
67205
67216
  for (const lockFile of lockFiles) {
67206
67217
  try {
67207
- unlinkSync9(lockFile);
67218
+ unlinkSync10(lockFile);
67208
67219
  result.removed.push(lockFile);
67209
67220
  } catch (error) {
67210
67221
  const msg = error instanceof Error ? error.message : String(error);
@@ -67948,7 +67959,7 @@ Report any issues or conflicts you encountered.`;
67948
67959
  reason: "Timeout waiting for merge-agent specialist to complete merge (5 minutes)"
67949
67960
  };
67950
67961
  }
67951
- var execAsync10, __filename, __dirname2, SPECIALISTS_DIR4, MERGE_HISTORY_DIR, MERGE_HISTORY_FILE, MERGE_TIMEOUT_MS;
67962
+ var execAsync10, __filename, __dirname2, SPECIALISTS_DIR2, MERGE_HISTORY_DIR, MERGE_HISTORY_FILE, MERGE_TIMEOUT_MS;
67952
67963
  var init_merge_agent = __esm({
67953
67964
  "../../lib/cloister/merge-agent.ts"() {
67954
67965
  "use strict";
@@ -67960,8 +67971,8 @@ var init_merge_agent = __esm({
67960
67971
  execAsync10 = promisify10(exec10);
67961
67972
  __filename = fileURLToPath2(import.meta.url);
67962
67973
  __dirname2 = dirname4(__filename);
67963
- SPECIALISTS_DIR4 = join33(PANOPTICON_HOME2, "specialists");
67964
- MERGE_HISTORY_DIR = join33(SPECIALISTS_DIR4, "merge-agent");
67974
+ SPECIALISTS_DIR2 = join33(PANOPTICON_HOME2, "specialists");
67975
+ MERGE_HISTORY_DIR = join33(SPECIALISTS_DIR2, "merge-agent");
67965
67976
  MERGE_HISTORY_FILE = join33(MERGE_HISTORY_DIR, "history.jsonl");
67966
67977
  MERGE_TIMEOUT_MS = 15 * 60 * 1e3;
67967
67978
  }
@@ -68025,8 +68036,8 @@ function deleteWorkspaceMetadata(issueId) {
68025
68036
  return false;
68026
68037
  }
68027
68038
  try {
68028
- const { unlinkSync: unlinkSync11 } = __require("fs");
68029
- unlinkSync11(filename);
68039
+ const { unlinkSync: unlinkSync12 } = __require("fs");
68040
+ unlinkSync12(filename);
68030
68041
  return true;
68031
68042
  } catch {
68032
68043
  return false;
@@ -85379,6 +85390,17 @@ var IssueDataService = class {
85379
85390
  for (const tracker of ["github", "linear", "rally"]) {
85380
85391
  const cached = this.cache.getStale(tracker, "issues");
85381
85392
  if (cached?.data) {
85393
+ if (tracker === "rally") {
85394
+ cached.data = cached.data.map((issue) => {
85395
+ if (typeof issue.rawTrackerState === "object" && issue.rawTrackerState !== null) {
85396
+ return {
85397
+ ...issue,
85398
+ rawTrackerState: issue.rawTrackerState.Name || issue.rawTrackerState._refObjectName || "Defined"
85399
+ };
85400
+ }
85401
+ return issue;
85402
+ });
85403
+ }
85382
85404
  this.trackers[tracker].lastFetchedIssues = cached.data;
85383
85405
  this.trackers[tracker].lastFetchedAt = cached.lastFetchedAt;
85384
85406
  }
@@ -85734,7 +85756,7 @@ var IssueDataService = class {
85734
85756
  updatedAt: issue.updatedAt,
85735
85757
  parentRef: issue.parentRef,
85736
85758
  artifactType: issue.artifactType,
85737
- rawTrackerState: issue.rawState,
85759
+ rawTrackerState: typeof issue.rawState === "object" && issue.rawState !== null ? issue.rawState.Name || issue.rawState._refObjectName || "Defined" : issue.rawState,
85738
85760
  project: projectInfo,
85739
85761
  source: "rally"
85740
85762
  };
@@ -87022,7 +87044,7 @@ function getHandoffStats() {
87022
87044
 
87023
87045
  // ../../lib/cloister/fpp-violations.ts
87024
87046
  init_hooks();
87025
- import { readFileSync as readFileSync20, existsSync as existsSync25, writeFileSync as writeFileSync16, mkdirSync as mkdirSync18, unlinkSync as unlinkSync6 } from "fs";
87047
+ import { readFileSync as readFileSync20, existsSync as existsSync25, writeFileSync as writeFileSync16, mkdirSync as mkdirSync18, unlinkSync as unlinkSync7 } from "fs";
87026
87048
  import { join as join26, dirname as dirname2 } from "path";
87027
87049
  init_paths();
87028
87050
  var DEFAULT_FPP_CONFIG = {
@@ -87058,7 +87080,7 @@ function saveViolations(violations) {
87058
87080
  writeFileSync16(tempFile, JSON.stringify(persisted, null, 2));
87059
87081
  writeFileSync16(VIOLATIONS_DATA_FILE, readFileSync20(tempFile));
87060
87082
  try {
87061
- unlinkSync6(tempFile);
87083
+ unlinkSync7(tempFile);
87062
87084
  } catch (unlinkError) {
87063
87085
  console.debug("Failed to cleanup temp file:", unlinkError instanceof Error ? unlinkError.message : unlinkError);
87064
87086
  }
@@ -87149,7 +87171,7 @@ function clearOldViolations(hoursOld = 24) {
87149
87171
  // ../../lib/cloister/cost-monitor.ts
87150
87172
  init_paths();
87151
87173
  init_config();
87152
- import { readFileSync as readFileSync21, existsSync as existsSync26, writeFileSync as writeFileSync17, mkdirSync as mkdirSync19, unlinkSync as unlinkSync7 } from "fs";
87174
+ import { readFileSync as readFileSync21, existsSync as existsSync26, writeFileSync as writeFileSync17, mkdirSync as mkdirSync19, unlinkSync as unlinkSync8 } from "fs";
87153
87175
  import { join as join27, dirname as dirname3 } from "path";
87154
87176
  var COST_DATA_FILE = join27(PANOPTICON_HOME2, "cost-data.json");
87155
87177
  function loadCostData() {
@@ -87196,7 +87218,7 @@ function saveCostData(data) {
87196
87218
  writeFileSync17(tempFile, JSON.stringify(persisted, null, 2));
87197
87219
  writeFileSync17(COST_DATA_FILE, readFileSync21(tempFile));
87198
87220
  try {
87199
- unlinkSync7(tempFile);
87221
+ unlinkSync8(tempFile);
87200
87222
  } catch (unlinkError) {
87201
87223
  console.debug("Failed to cleanup temp file:", unlinkError instanceof Error ? unlinkError.message : unlinkError);
87202
87224
  }
@@ -88185,7 +88207,7 @@ function getDeaconStatus() {
88185
88207
  // ../../lib/cloister/service.ts
88186
88208
  init_paths();
88187
88209
  init_paths();
88188
- import { existsSync as existsSync29, writeFileSync as writeFileSync20, unlinkSync as unlinkSync8, readFileSync as readFileSync24, readdirSync as readdirSync11, renameSync } from "fs";
88210
+ import { existsSync as existsSync29, writeFileSync as writeFileSync20, unlinkSync as unlinkSync9, readFileSync as readFileSync24, readdirSync as readdirSync11, renameSync } from "fs";
88189
88211
  import { join as join30 } from "path";
88190
88212
  var CLOISTER_STATE_FILE = join30(PANOPTICON_HOME2, "cloister.state");
88191
88213
  function writeStateFile(running, pid) {
@@ -88198,7 +88220,7 @@ function writeStateFile(running, pid) {
88198
88220
  }));
88199
88221
  } else {
88200
88222
  if (existsSync29(CLOISTER_STATE_FILE)) {
88201
- unlinkSync8(CLOISTER_STATE_FILE);
88223
+ unlinkSync9(CLOISTER_STATE_FILE);
88202
88224
  }
88203
88225
  }
88204
88226
  } catch (error) {
@@ -88214,7 +88236,7 @@ function readStateFile() {
88214
88236
  process.kill(data.pid, 0);
88215
88237
  return data;
88216
88238
  } catch {
88217
- unlinkSync8(CLOISTER_STATE_FILE);
88239
+ unlinkSync9(CLOISTER_STATE_FILE);
88218
88240
  return { running: false };
88219
88241
  }
88220
88242
  }
@@ -95091,6 +95113,110 @@ app.post("/api/workspaces/:issueId/merge", async (req, res) => {
95091
95113
  completePendingOperation(issueId, "Workspace does not exist");
95092
95114
  return res.status(400).json({ error: "Workspace does not exist" });
95093
95115
  }
95116
+ const projectConfig = findProjectByTeam(issuePrefix);
95117
+ const isPolyrepo = projectConfig?.workspace?.type === "polyrepo";
95118
+ if (isPolyrepo && projectConfig?.workspace?.repos) {
95119
+ console.log(`[merge] Polyrepo detected for ${issueId}, merging repos individually...`);
95120
+ const repos = projectConfig.workspace.repos;
95121
+ const defaultBranch = projectConfig.workspace.default_branch || "main";
95122
+ const mergeResults = [];
95123
+ for (const repo of repos) {
95124
+ const repoMainPath = join43(projectPath, repo.path);
95125
+ const repoWorkspacePath = join43(workspacePath, repo.name);
95126
+ if (!existsSync44(repoWorkspacePath) || !existsSync44(join43(repoWorkspacePath, ".git"))) {
95127
+ console.log(`[merge] Skipping ${repo.name}: workspace repo not found`);
95128
+ continue;
95129
+ }
95130
+ try {
95131
+ const { stdout: diffStat } = await execAsync15(
95132
+ `git diff ${defaultBranch}..${branchName} --stat`,
95133
+ { cwd: repoMainPath, encoding: "utf-8" }
95134
+ );
95135
+ if (!diffStat.trim()) {
95136
+ console.log(`[merge] Skipping ${repo.name}: no changes on ${branchName}`);
95137
+ mergeResults.push({ repo: repo.name, success: true, message: "No changes, skipped" });
95138
+ continue;
95139
+ }
95140
+ console.log(`[merge] ${repo.name}: found changes on ${branchName}`);
95141
+ } catch {
95142
+ console.log(`[merge] Skipping ${repo.name}: branch ${branchName} not found`);
95143
+ mergeResults.push({ repo: repo.name, success: true, message: "Branch not found, skipped" });
95144
+ continue;
95145
+ }
95146
+ try {
95147
+ await execAsync15(`git push origin ${branchName}`, { cwd: repoWorkspacePath, encoding: "utf-8" });
95148
+ console.log(`[merge] Pushed ${branchName} from ${repo.name} workspace`);
95149
+ } catch (pushErr) {
95150
+ console.log(`[merge] Push note for ${repo.name}: ${pushErr.message}`);
95151
+ }
95152
+ try {
95153
+ await execAsync15("git fetch origin", { cwd: repoMainPath, encoding: "utf-8" });
95154
+ let stashed = false;
95155
+ try {
95156
+ const { stdout: statusOut } = await execAsync15("git status --porcelain", {
95157
+ cwd: repoMainPath,
95158
+ encoding: "utf-8"
95159
+ });
95160
+ if (statusOut.trim()) {
95161
+ await execAsync15(`git stash push -u -m "Pre-merge stash for ${issueId}"`, {
95162
+ cwd: repoMainPath,
95163
+ encoding: "utf-8"
95164
+ });
95165
+ stashed = true;
95166
+ console.log(`[merge] Stashed uncommitted changes in ${repo.name}`);
95167
+ }
95168
+ } catch (stashErr) {
95169
+ console.warn(`[merge] Stash note for ${repo.name}: ${stashErr.message}`);
95170
+ }
95171
+ await execAsync15(`git checkout ${defaultBranch}`, { cwd: repoMainPath, encoding: "utf-8" });
95172
+ await execAsync15(`git pull origin ${defaultBranch} --ff-only`, {
95173
+ cwd: repoMainPath,
95174
+ encoding: "utf-8"
95175
+ });
95176
+ await execAsync15(`git merge origin/${branchName} --no-edit`, {
95177
+ cwd: repoMainPath,
95178
+ encoding: "utf-8"
95179
+ });
95180
+ await execAsync15(`git push origin ${defaultBranch}`, {
95181
+ cwd: repoMainPath,
95182
+ encoding: "utf-8"
95183
+ });
95184
+ console.log(`[merge] Successfully merged ${branchName} into ${defaultBranch} for ${repo.name}`);
95185
+ mergeResults.push({ repo: repo.name, success: true, message: "Merged successfully" });
95186
+ if (stashed) {
95187
+ try {
95188
+ await execAsync15("git stash pop", { cwd: repoMainPath, encoding: "utf-8" });
95189
+ } catch {
95190
+ console.warn(`[merge] Could not pop stash in ${repo.name}, it remains stashed`);
95191
+ }
95192
+ }
95193
+ } catch (mergeErr) {
95194
+ console.error(`[merge] Merge failed for ${repo.name}:`, mergeErr.message);
95195
+ try {
95196
+ await execAsync15("git merge --abort", { cwd: repoMainPath, encoding: "utf-8" });
95197
+ } catch {
95198
+ }
95199
+ mergeResults.push({ repo: repo.name, success: false, message: mergeErr.message });
95200
+ }
95201
+ }
95202
+ const reposWithChanges = mergeResults.filter((r) => !r.message.includes("skipped"));
95203
+ const failedRepos = mergeResults.filter((r) => !r.success);
95204
+ if (failedRepos.length > 0) {
95205
+ const error = `Polyrepo merge failed for: ${failedRepos.map((r) => `${r.repo} (${r.message})`).join(", ")}`;
95206
+ setReviewStatus2(issueId, { mergeStatus: "failed" });
95207
+ completePendingOperation(issueId, error);
95208
+ return res.status(500).json({ error, repos: mergeResults });
95209
+ }
95210
+ console.log(`[merge] Polyrepo merge complete for ${issueId}: ${reposWithChanges.length} repo(s) merged`);
95211
+ setReviewStatus2(issueId, { mergeStatus: "merged", readyForMerge: false });
95212
+ completePendingOperation(issueId, null);
95213
+ await closeIssueAfterMerge(issueId);
95214
+ return res.json({
95215
+ success: true,
95216
+ message: `Polyrepo merge complete for ${issueId}`,
95217
+ repos: mergeResults
95218
+ });
95219
+ }
95094
95220
  try {
95095
95221
  await execAsync15(`git push origin ${branchName}`, { cwd: workspacePath, encoding: "utf-8" });
95096
95222
  console.log(`Pushed ${branchName} to remote`);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  declare const PANOPTICON_HOME: string;
2
+ /** Get PANOPTICON_HOME dynamically (reads env var on each call, useful for testing) */
3
+ declare function getPanopticonHome(): string;
2
4
  declare const CONFIG_DIR: string;
3
5
  declare const SKILLS_DIR: string;
4
6
  declare const COMMANDS_DIR: string;
@@ -714,4 +716,4 @@ declare function needsRouter(apiKeys: {
714
716
  */
715
717
  declare function getProviderEnv(provider: ProviderConfig, apiKey: string): Record<string, string>;
716
718
 
717
- export { AGENTS_DIR, type AnthropicModel, type ApiKeysConfig, BACKUPS_DIR, BIN_DIR, type BackupInfo, CERTS_DIR, CLAUDE_DIR, CLAUDE_MD_TEMPLATES, CODEX_DIR, COMMANDS_DIR, CONFIG_DIR, CONFIG_FILE, COSTS_DIR, CURSOR_DIR, type Comment, type ComplexityLevel, type ComplexityModels, GEMINI_DIR, type GitHubConfig, GitHubTracker, type GitLabConfig, GitLabTracker, type GoogleModel, HEARTBEATS_DIR, type HookItem, INIT_DIRS, type Issue, type IssueFilters, IssueNotFoundError, type IssueState, type IssueTracker, type IssueUpdate, type KimiModel, type LinearConfig, LinearTracker, type LinkDirection, LinkManager, type ModelId, type ModelsConfig, type NewIssue, NotImplementedError, OPENCODE_DIR, type OpenAIModel, PANOPTICON_HOME, PROVIDERS, type PanopticonConfig, type ProviderCompatibility, type ProviderConfig, type ProviderName, type RallyConfig, type RemoteConfig, type RemoteExeConfig, type Runtime, SETTINGS_FILE, SKILLS_DIR, SOURCE_DEV_SKILLS_DIR, SOURCE_SCRIPTS_DIR, SOURCE_SKILLS_DIR, SOURCE_TEMPLATES_DIR, SOURCE_TRAEFIK_TEMPLATES, SYNC_TARGETS, type SettingsConfig, type ShadowConfig, type Shell, type SpecialistModels, type SyncItem, type SyncOptions, type SyncPlan, type SyncResult, TEMPLATES_DIR, TRAEFIK_CERTS_DIR, TRAEFIK_DIR, TRAEFIK_DYNAMIC_DIR, TrackerAuthError, type TrackerConfig, type TrackerConfigItem, type TrackerLink, type TrackerType, type TrackersConfig, type ZAIModel, addAlias, cleanOldBackups, createBackup, createBackupTimestamp, createTracker, createTrackerFromConfig, detectShell, executeSync, formatIssueRef, getAgentCommand, getAliasInstructions, getAllTrackers, getAvailableModels, getClaudeModelFlag, getDashboardApiUrl, getDefaultConfig, getDefaultSettings, getDirectProviders, getLinkManager, getPrimaryTracker, getProviderEnv, getProviderForModel, getRouterProviders, getSecondaryTracker, getShellRcFile, hasAlias, isAnthropicModel, isDevMode, isPanopticonSymlink, listBackups, loadConfig, loadSettings, needsRouter, parseIssueRef, planHooksSync, planSync, requiresRouter, restoreBackup, saveConfig, saveSettings, syncHooks, validateSettings };
719
+ export { AGENTS_DIR, type AnthropicModel, type ApiKeysConfig, BACKUPS_DIR, BIN_DIR, type BackupInfo, CERTS_DIR, CLAUDE_DIR, CLAUDE_MD_TEMPLATES, CODEX_DIR, COMMANDS_DIR, CONFIG_DIR, CONFIG_FILE, COSTS_DIR, CURSOR_DIR, type Comment, type ComplexityLevel, type ComplexityModels, GEMINI_DIR, type GitHubConfig, GitHubTracker, type GitLabConfig, GitLabTracker, type GoogleModel, HEARTBEATS_DIR, type HookItem, INIT_DIRS, type Issue, type IssueFilters, IssueNotFoundError, type IssueState, type IssueTracker, type IssueUpdate, type KimiModel, type LinearConfig, LinearTracker, type LinkDirection, LinkManager, type ModelId, type ModelsConfig, type NewIssue, NotImplementedError, OPENCODE_DIR, type OpenAIModel, PANOPTICON_HOME, PROVIDERS, type PanopticonConfig, type ProviderCompatibility, type ProviderConfig, type ProviderName, type RallyConfig, type RemoteConfig, type RemoteExeConfig, type Runtime, SETTINGS_FILE, SKILLS_DIR, SOURCE_DEV_SKILLS_DIR, SOURCE_SCRIPTS_DIR, SOURCE_SKILLS_DIR, SOURCE_TEMPLATES_DIR, SOURCE_TRAEFIK_TEMPLATES, SYNC_TARGETS, type SettingsConfig, type ShadowConfig, type Shell, type SpecialistModels, type SyncItem, type SyncOptions, type SyncPlan, type SyncResult, TEMPLATES_DIR, TRAEFIK_CERTS_DIR, TRAEFIK_DIR, TRAEFIK_DYNAMIC_DIR, TrackerAuthError, type TrackerConfig, type TrackerConfigItem, type TrackerLink, type TrackerType, type TrackersConfig, type ZAIModel, addAlias, cleanOldBackups, createBackup, createBackupTimestamp, createTracker, createTrackerFromConfig, detectShell, executeSync, formatIssueRef, getAgentCommand, getAliasInstructions, getAllTrackers, getAvailableModels, getClaudeModelFlag, getDashboardApiUrl, getDefaultConfig, getDefaultSettings, getDirectProviders, getLinkManager, getPanopticonHome, getPrimaryTracker, getProviderEnv, getProviderForModel, getRouterProviders, getSecondaryTracker, getShellRcFile, hasAlias, isAnthropicModel, isDevMode, isPanopticonSymlink, listBackups, loadConfig, loadSettings, needsRouter, parseIssueRef, planHooksSync, planSync, requiresRouter, restoreBackup, saveConfig, saveSettings, syncHooks, validateSettings };
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  planSync,
30
30
  restoreBackup,
31
31
  syncHooks
32
- } from "./chunk-26QM7CPN.js";
32
+ } from "./chunk-6CIBLKFZ.js";
33
33
  import {
34
34
  PROVIDERS,
35
35
  getAgentCommand,
@@ -48,14 +48,14 @@ import {
48
48
  requiresRouter,
49
49
  saveSettings,
50
50
  validateSettings
51
- } from "./chunk-KQAEUOML.js";
51
+ } from "./chunk-46DPNFMW.js";
52
52
  import "./chunk-BBCUK6N2.js";
53
53
  import {
54
54
  getDashboardApiUrl,
55
55
  getDefaultConfig,
56
56
  loadConfig,
57
57
  saveConfig
58
- } from "./chunk-ZAM2Q52Q.js";
58
+ } from "./chunk-VTMXR7JF.js";
59
59
  import {
60
60
  AGENTS_DIR,
61
61
  BACKUPS_DIR,
@@ -86,9 +86,10 @@ import {
86
86
  TRAEFIK_CERTS_DIR,
87
87
  TRAEFIK_DIR,
88
88
  TRAEFIK_DYNAMIC_DIR,
89
+ getPanopticonHome,
89
90
  init_paths,
90
91
  isDevMode
91
- } from "./chunk-KGPRXDMX.js";
92
+ } from "./chunk-6HXKTOD7.js";
92
93
  import {
93
94
  init_esm_shims
94
95
  } from "./chunk-ZHC57RCV.js";
@@ -155,6 +156,7 @@ export {
155
156
  getDefaultSettings,
156
157
  getDirectProviders,
157
158
  getLinkManager,
159
+ getPanopticonHome,
158
160
  getPrimaryTracker,
159
161
  getProviderEnv,
160
162
  getProviderForModel,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Panopticon CLI - Main exports for library usage\nexport * from './lib/paths.js';\nexport * from './lib/config.js';\nexport * from './lib/shell.js';\nexport * from './lib/backup.js';\nexport * from './lib/sync.js';\nexport * from './lib/tracker/index.js';\nexport * from './lib/providers.js';\nexport * from './lib/settings.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Panopticon CLI - Main exports for library usage\nexport * from './lib/paths.js';\nexport * from './lib/config.js';\nexport * from './lib/shell.js';\nexport * from './lib/backup.js';\nexport * from './lib/sync.js';\nexport * from './lib/tracker/index.js';\nexport * from './lib/providers.js';\nexport * from './lib/settings.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA;AACA;","names":[]}
@@ -18,8 +18,8 @@ import {
18
18
  resolveProjectPath,
19
19
  saveProjectsConfig,
20
20
  unregisterProject
21
- } from "./chunk-SOL4WQJD.js";
22
- import "./chunk-KGPRXDMX.js";
21
+ } from "./chunk-JY7R7V4G.js";
22
+ import "./chunk-6HXKTOD7.js";
23
23
  import "./chunk-ZHC57RCV.js";
24
24
  init_projects();
25
25
  export {
@@ -42,4 +42,4 @@ export {
42
42
  saveProjectsConfig,
43
43
  unregisterProject
44
44
  };
45
- //# sourceMappingURL=projects-AMR3XQM4.js.map
45
+ //# sourceMappingURL=projects-VXRUCMLM.js.map
@@ -3,17 +3,17 @@ import {
3
3
  } from "./chunk-44EOY2ZL.js";
4
4
  import {
5
5
  loadConfig
6
- } from "./chunk-ZAM2Q52Q.js";
6
+ } from "./chunk-VTMXR7JF.js";
7
7
  import {
8
8
  extractTeamPrefix,
9
9
  findProjectByTeam,
10
10
  init_projects
11
- } from "./chunk-SOL4WQJD.js";
11
+ } from "./chunk-JY7R7V4G.js";
12
12
  import {
13
13
  createExeProvider,
14
14
  init_exe_provider
15
15
  } from "./chunk-JM6V62LT.js";
16
- import "./chunk-KGPRXDMX.js";
16
+ import "./chunk-6HXKTOD7.js";
17
17
  import {
18
18
  init_esm_shims
19
19
  } from "./chunk-ZHC57RCV.js";
@@ -176,4 +176,4 @@ EOF`);
176
176
  export {
177
177
  createRemoteWorkspace
178
178
  };
179
- //# sourceMappingURL=remote-workspace-V57IZJRC.js.map
179
+ //# sourceMappingURL=remote-workspace-FNXLMNBG.js.map