@magnusekdahl/parallix 1.2.0 → 1.3.0

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 (127) hide show
  1. package/index.js +190 -185
  2. package/lib/agents/agents.js +737 -838
  3. package/lib/agents/agents.ts +930 -0
  4. package/lib/agents/claude-telemetry.js +149 -154
  5. package/lib/agents/claude-telemetry.ts +233 -0
  6. package/lib/agents/claude.js +121 -131
  7. package/lib/agents/claude.ts +156 -0
  8. package/lib/agents/codex-telemetry.js +176 -164
  9. package/lib/agents/codex-telemetry.ts +205 -0
  10. package/lib/agents/codex.js +168 -201
  11. package/lib/agents/codex.ts +236 -0
  12. package/lib/agents/limit-hit.js +216 -226
  13. package/lib/agents/limit-hit.ts +262 -0
  14. package/lib/agents/mistral-telemetry.js +7 -10
  15. package/lib/agents/mistral-telemetry.ts +44 -0
  16. package/lib/agents/mistral.js +40 -58
  17. package/lib/agents/mistral.ts +84 -0
  18. package/lib/agents/opencode-export.js +126 -127
  19. package/lib/agents/opencode-export.ts +160 -0
  20. package/lib/agents/opencode-telemetry.js +282 -261
  21. package/lib/agents/opencode-telemetry.ts +350 -0
  22. package/lib/agents/opencode.js +263 -305
  23. package/lib/agents/opencode.ts +370 -0
  24. package/lib/agents/stage-telemetry.js +23 -24
  25. package/lib/agents/stage-telemetry.ts +47 -0
  26. package/lib/commands/active.js +502 -579
  27. package/lib/commands/active.ts +665 -0
  28. package/lib/commands/checkpoint.js +98 -74
  29. package/lib/commands/checkpoint.ts +79 -0
  30. package/lib/commands/config.js +61 -31
  31. package/lib/commands/config.ts +47 -0
  32. package/lib/commands/coverage-gate.js +271 -246
  33. package/lib/commands/coverage-gate.ts +362 -0
  34. package/lib/commands/diff.js +140 -119
  35. package/lib/commands/diff.ts +125 -0
  36. package/lib/commands/draft.js +770 -923
  37. package/lib/commands/draft.ts +1021 -0
  38. package/lib/commands/handoff.js +588 -608
  39. package/lib/commands/handoff.ts +694 -0
  40. package/lib/commands/integrate.js +1332 -1463
  41. package/lib/commands/integrate.ts +1688 -0
  42. package/lib/commands/mission-start.js +279 -237
  43. package/lib/commands/mission-start.ts +263 -0
  44. package/lib/commands/rebase.js +606 -582
  45. package/lib/commands/rebase.ts +635 -0
  46. package/lib/commands/repair-handoff.js +181 -179
  47. package/lib/commands/repair-handoff.ts +228 -0
  48. package/lib/commands/resolve-conflict.js +121 -102
  49. package/lib/commands/resolve-conflict.ts +112 -0
  50. package/lib/commands/review.js +3 -4
  51. package/lib/commands/review.ts +14 -0
  52. package/lib/commands/setup-review.js +4 -5
  53. package/lib/commands/setup-review.ts +14 -0
  54. package/lib/commands/setup.js +3 -3
  55. package/lib/commands/setup.ts +2 -0
  56. package/lib/commands/stats-backfill.js +394 -359
  57. package/lib/commands/stats-backfill.ts +418 -0
  58. package/lib/commands/stats.js +1424 -1665
  59. package/lib/commands/stats.ts +2186 -0
  60. package/lib/commands/status.js +219 -200
  61. package/lib/commands/status.ts +219 -0
  62. package/lib/commands/verify.js +3 -1
  63. package/lib/commands/verify.ts +2 -0
  64. package/lib/core/fmt.js +140 -211
  65. package/lib/core/fmt.ts +189 -0
  66. package/lib/core/git.js +121 -102
  67. package/lib/core/git.ts +146 -0
  68. package/lib/core/gitignore.js +59 -106
  69. package/lib/core/gitignore.ts +103 -0
  70. package/lib/core/mission-utils.js +833 -875
  71. package/lib/core/mission-utils.ts +998 -0
  72. package/lib/core/nels.js +112 -127
  73. package/lib/core/nels.ts +189 -0
  74. package/lib/core/persistent-data-migration.js +247 -205
  75. package/lib/core/persistent-data-migration.ts +255 -0
  76. package/lib/core/product-config.js +400 -476
  77. package/lib/core/product-config.ts +518 -0
  78. package/lib/core/runtime-matrix.js +41 -87
  79. package/lib/core/runtime-matrix.ts +84 -0
  80. package/lib/core/spawn-tee.js +152 -192
  81. package/lib/core/spawn-tee.ts +202 -0
  82. package/lib/core/state-map.js +92 -92
  83. package/lib/core/state-map.ts +115 -0
  84. package/lib/core/storage.js +101 -129
  85. package/lib/core/storage.ts +182 -0
  86. package/lib/core/subagent-limit.js +15 -16
  87. package/lib/core/subagent-limit.ts +25 -0
  88. package/lib/core/verification.js +148 -138
  89. package/lib/core/verification.ts +200 -0
  90. package/lib/index.js +142 -59
  91. package/lib/index.ts +134 -0
  92. package/lib/review/rebase.js +142 -145
  93. package/lib/review/rebase.ts +188 -0
  94. package/lib/review/review-adapter.js +99 -87
  95. package/lib/review/review-adapter.ts +198 -0
  96. package/lib/review/review-artifacts.js +486 -629
  97. package/lib/review/review-artifacts.ts +622 -0
  98. package/lib/review/review-commands.js +1220 -1373
  99. package/lib/review/review-commands.ts +1579 -0
  100. package/lib/review/review-events.js +544 -886
  101. package/lib/review/review-events.ts +954 -0
  102. package/lib/review/review-loop.js +945 -1020
  103. package/lib/review/review-loop.ts +1174 -0
  104. package/lib/review/review-polling.js +86 -115
  105. package/lib/review/review-polling.ts +194 -0
  106. package/lib/review/review-prompts.js +154 -189
  107. package/lib/review/review-prompts.ts +182 -0
  108. package/lib/review/review-state.js +246 -225
  109. package/lib/review/review-state.ts +353 -0
  110. package/lib/review/review.js +63 -84
  111. package/lib/review/review.ts +138 -0
  112. package/lib/tools/backlog.js +694 -680
  113. package/lib/tools/backlog.ts +835 -0
  114. package/lib/tools/forgejo.js +1270 -1405
  115. package/lib/tools/forgejo.ts +1793 -0
  116. package/lib/tools/gatekeeper.js +106 -96
  117. package/lib/tools/gatekeeper.ts +124 -0
  118. package/lib/tools/redgreen.js +200 -181
  119. package/lib/tools/redgreen.ts +221 -0
  120. package/lib/tools/sessions.js +58 -52
  121. package/lib/tools/sessions.ts +81 -0
  122. package/lib/tools/setup-review.js +902 -975
  123. package/lib/tools/setup-review.ts +1152 -0
  124. package/package.json +7 -5
  125. package/prompts/draft.md +1 -0
  126. package/prompts/portfolio.md +1 -1
  127. package/px.js +226 -210
@@ -1,112 +1,65 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- /**
5
- * Workflow-generated paths that must be gitignored in enterprise repositories.
6
- * These are paths created by the px workflow toolkit that should never be
7
- * committed to version control.
8
- */
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const node_fs_1 = __importDefault(require("node:fs"));
6
+ const node_path_1 = __importDefault(require("node:path"));
9
7
  const WORKFLOW_ENTRIES = [
10
- '.workflow/',
11
- '.sessions/',
12
- '.forgejo-local/',
13
- 'workflow/.cache/',
14
- 'workflow/.sessions/',
15
- 'workflow/config/agents.local.json',
16
- 'agents.local.json',
8
+ '.workflow/',
9
+ '.sessions/',
10
+ '.forgejo-local/',
11
+ 'workflow/.cache/',
12
+ 'workflow/.sessions/',
13
+ 'workflow/config/agents.local.json',
14
+ 'agents.local.json',
17
15
  ];
18
-
19
- /**
20
- * Ensure that a repository's .gitignore contains all workflow-generated paths.
21
- *
22
- * Handles:
23
- * - Missing .gitignore: creates one with all 7 entries
24
- * - Existing .gitignore: appends only missing entries, skips duplicates
25
- * - Symlinked .gitignore: skips modification, logs warning
26
- * - Non-git directories: skips gracefully without crashing
27
- *
28
- * @param {string} rootDir - Path to the repository root
29
- * @param {object} options - Injected dependencies
30
- * @param {Function} [options.existsSyncFn] - fs.existsSync replacement
31
- * @param {Function} [options.lstatSyncFn] - fs.lstatSync replacement
32
- * @param {Function} [options.readFileSyncFn] - fs.readFileSync replacement
33
- * @param {Function} [options.writeFileSyncFn] - fs.writeFileSync replacement
34
- * @param {Function} [options.logFn] - Logger function
35
- * @returns {{ ok: boolean, created: boolean, appended: number, skipped: boolean, reason?: string }}
36
- */
37
16
  function ensureWorkflowGitignore(rootDir, options = {}) {
38
- const {
39
- existsSyncFn = fs.existsSync,
40
- lstatSyncFn = fs.lstatSync,
41
- readFileSyncFn = fs.readFileSync,
42
- writeFileSyncFn = fs.writeFileSync,
43
- logFn = () => {},
44
- } = options;
45
-
46
- const gitignorePath = path.join(rootDir, '.gitignore');
47
- const gitDirPath = path.join(rootDir, '.git');
48
-
49
- // Check if this is a git repository
50
- if (!existsSyncFn(gitDirPath)) {
51
- logFn(`[gitignore] Skipping ${rootDir}: not a git repository (no .git directory)`);
52
- return { ok: true, created: false, appended: 0, skipped: true, reason: 'not-a-git-repo' };
53
- }
54
-
55
- // Check if .gitignore exists
56
- if (!existsSyncFn(gitignorePath)) {
57
- // Create new .gitignore with all entries
58
- const content = WORKFLOW_ENTRIES.join('\n') + '\n';
59
- writeFileSyncFn(gitignorePath, content, 'utf8');
60
- logFn(`[gitignore] Created ${gitignorePath} with ${WORKFLOW_ENTRIES.length} entries`);
61
- return { ok: true, created: true, appended: WORKFLOW_ENTRIES.length, skipped: false };
62
- }
63
-
64
- // .gitignore exists - check for symlink
65
- try {
66
- const stat = lstatSyncFn(gitignorePath);
67
- if (stat.isSymbolicLink()) {
68
- logFn(`[gitignore] Skipping ${gitignorePath}: symbolic link, not modifying`);
69
- return { ok: true, created: false, appended: 0, skipped: true, reason: 'symlink' };
17
+ const { existsSyncFn = node_fs_1.default.existsSync, lstatSyncFn = node_fs_1.default.lstatSync, readFileSyncFn = node_fs_1.default.readFileSync, writeFileSyncFn = node_fs_1.default.writeFileSync, logFn = () => { }, } = options;
18
+ const gitignorePath = node_path_1.default.join(rootDir, '.gitignore');
19
+ const gitDirPath = node_path_1.default.join(rootDir, '.git');
20
+ if (!existsSyncFn(gitDirPath)) {
21
+ logFn(`[gitignore] Skipping ${rootDir}: not a git repository (no .git directory)`);
22
+ return { ok: true, created: false, appended: 0, skipped: true, reason: 'not-a-git-repo' };
70
23
  }
71
- } catch (_) {
72
- // If we can't stat, fall through to read - it might exist but be inaccessible
73
- }
74
-
75
- // Read existing .gitignore
76
- let existingContent;
77
- try {
78
- existingContent = readFileSyncFn(gitignorePath, 'utf8');
79
- } catch (err) {
80
- logFn(`[gitignore] Could not read ${gitignorePath}: ${/** @type{Error} */(err).message}`);
81
- return { ok: false, created: false, appended: 0, skipped: false, reason: `read-error: ${/** @type{Error} */(err).message}` };
82
- }
83
-
84
- // Parse existing entries
85
- const existingLines = existingContent.split(/\r?\n/);
86
- const existingEntries = new Set(
87
- existingLines
88
- /** @param {string} line */
89
- .map(/** @param {string} line */(line) => line.trim())
90
- /** @param {string} line */
91
- .filter(/** @param {string} line */(line) => line.length > 0 && !line.startsWith('#'))
92
- );
93
-
94
- // Find missing entries
95
- const missingEntries = WORKFLOW_ENTRIES.filter(entry => !existingEntries.has(entry));
96
-
97
- if (missingEntries.length === 0) {
98
- logFn(`[gitignore] ${gitignorePath} already contains all ${WORKFLOW_ENTRIES.length} workflow entries`);
99
- return { ok: true, created: false, appended: 0, skipped: false };
100
- }
101
-
102
- // Append missing entries
103
- const newContent = existingContent + '\n' + missingEntries.join('\n') + '\n';
104
- writeFileSyncFn(gitignorePath, newContent, 'utf8');
105
- logFn(`[gitignore] Appended ${missingEntries.length} missing entries to ${gitignorePath}`);
106
-
107
- return { ok: true, created: false, appended: missingEntries.length, skipped: false };
24
+ if (!existsSyncFn(gitignorePath)) {
25
+ const content = [...WORKFLOW_ENTRIES].join('\n') + '\n';
26
+ writeFileSyncFn(gitignorePath, content, 'utf8');
27
+ logFn(`[gitignore] Created ${gitignorePath} with ${WORKFLOW_ENTRIES.length} entries`);
28
+ return { ok: true, created: true, appended: WORKFLOW_ENTRIES.length, skipped: false };
29
+ }
30
+ try {
31
+ const stat = lstatSyncFn(gitignorePath);
32
+ if (stat.isSymbolicLink()) {
33
+ logFn(`[gitignore] Skipping ${gitignorePath}: symbolic link, not modifying`);
34
+ return { ok: true, created: false, appended: 0, skipped: true, reason: 'symlink' };
35
+ }
36
+ }
37
+ catch (_err) {
38
+ // If we can't stat, fall through to read
39
+ }
40
+ let existingContent;
41
+ try {
42
+ existingContent = readFileSyncFn(gitignorePath, 'utf8');
43
+ }
44
+ catch (err) {
45
+ const message = err instanceof Error ? err.message : String(err);
46
+ logFn(`[gitignore] Could not read ${gitignorePath}: ${message}`);
47
+ return { ok: false, created: false, appended: 0, skipped: false, reason: `read-error: ${message}` };
48
+ }
49
+ const existingLines = existingContent.split(/\r?\n/);
50
+ const existingEntries = new Set(existingLines
51
+ .map((line) => line.trim())
52
+ .filter((line) => line.length > 0 && !line.startsWith('#')));
53
+ const missingEntries = WORKFLOW_ENTRIES.filter(entry => !existingEntries.has(entry));
54
+ if (missingEntries.length === 0) {
55
+ logFn(`[gitignore] ${gitignorePath} already contains all ${WORKFLOW_ENTRIES.length} workflow entries`);
56
+ return { ok: true, created: false, appended: 0, skipped: false };
57
+ }
58
+ const newContent = existingContent + '\n' + [...missingEntries].join('\n') + '\n';
59
+ writeFileSyncFn(gitignorePath, newContent, 'utf8');
60
+ logFn(`[gitignore] Appended ${missingEntries.length} missing entries to ${gitignorePath}`);
61
+ return { ok: true, created: false, appended: missingEntries.length, skipped: false };
108
62
  }
109
-
63
+ ensureWorkflowGitignore.WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
64
+ ensureWorkflowGitignore.ensureWorkflowGitignore = ensureWorkflowGitignore;
110
65
  module.exports = ensureWorkflowGitignore;
111
- module.exports.ensureWorkflowGitignore = ensureWorkflowGitignore;
112
- module.exports.WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
@@ -0,0 +1,103 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ const WORKFLOW_ENTRIES = [
5
+ '.workflow/',
6
+ '.sessions/',
7
+ '.forgejo-local/',
8
+ 'workflow/.cache/',
9
+ 'workflow/.sessions/',
10
+ 'workflow/config/agents.local.json',
11
+ 'agents.local.json',
12
+ ] as const;
13
+
14
+ interface GitignoreResult {
15
+ ok: boolean;
16
+ created: boolean;
17
+ appended: number;
18
+ skipped: boolean;
19
+ reason?: string;
20
+ }
21
+
22
+ interface EnsureOptions {
23
+ existsSyncFn?: typeof fs.existsSync;
24
+ lstatSyncFn?: typeof fs.lstatSync;
25
+ readFileSyncFn?: typeof fs.readFileSync;
26
+ writeFileSyncFn?: typeof fs.writeFileSync;
27
+ logFn?: (msg: string) => void;
28
+ }
29
+
30
+ type EnsureWorkflowGitignoreFn = {
31
+ (rootDir: string, options?: EnsureOptions): GitignoreResult;
32
+ WORKFLOW_ENTRIES: typeof WORKFLOW_ENTRIES;
33
+ ensureWorkflowGitignore: EnsureWorkflowGitignoreFn;
34
+ };
35
+
36
+ function ensureWorkflowGitignore(rootDir: string, options: EnsureOptions = {}): GitignoreResult {
37
+ const {
38
+ existsSyncFn = fs.existsSync,
39
+ lstatSyncFn = fs.lstatSync,
40
+ readFileSyncFn = fs.readFileSync,
41
+ writeFileSyncFn = fs.writeFileSync,
42
+ logFn = () => {},
43
+ } = options;
44
+
45
+ const gitignorePath = path.join(rootDir, '.gitignore');
46
+ const gitDirPath = path.join(rootDir, '.git');
47
+
48
+ if (!existsSyncFn(gitDirPath)) {
49
+ logFn(`[gitignore] Skipping ${rootDir}: not a git repository (no .git directory)`);
50
+ return { ok: true, created: false, appended: 0, skipped: true, reason: 'not-a-git-repo' };
51
+ }
52
+
53
+ if (!existsSyncFn(gitignorePath)) {
54
+ const content = [...WORKFLOW_ENTRIES].join('\n') + '\n';
55
+ writeFileSyncFn(gitignorePath, content, 'utf8');
56
+ logFn(`[gitignore] Created ${gitignorePath} with ${WORKFLOW_ENTRIES.length} entries`);
57
+ return { ok: true, created: true, appended: WORKFLOW_ENTRIES.length, skipped: false };
58
+ }
59
+
60
+ try {
61
+ const stat = lstatSyncFn(gitignorePath);
62
+ if (stat.isSymbolicLink()) {
63
+ logFn(`[gitignore] Skipping ${gitignorePath}: symbolic link, not modifying`);
64
+ return { ok: true, created: false, appended: 0, skipped: true, reason: 'symlink' };
65
+ }
66
+ } catch (_err: unknown) {
67
+ // If we can't stat, fall through to read
68
+ }
69
+
70
+ let existingContent: string;
71
+ try {
72
+ existingContent = readFileSyncFn(gitignorePath, 'utf8');
73
+ } catch (err: unknown) {
74
+ const message = err instanceof Error ? err.message : String(err);
75
+ logFn(`[gitignore] Could not read ${gitignorePath}: ${message}`);
76
+ return { ok: false, created: false, appended: 0, skipped: false, reason: `read-error: ${message}` };
77
+ }
78
+
79
+ const existingLines = existingContent.split(/\r?\n/);
80
+ const existingEntries = new Set(
81
+ existingLines
82
+ .map((line: string) => line.trim())
83
+ .filter((line: string) => line.length > 0 && !line.startsWith('#'))
84
+ );
85
+
86
+ const missingEntries = WORKFLOW_ENTRIES.filter(entry => !existingEntries.has(entry));
87
+
88
+ if (missingEntries.length === 0) {
89
+ logFn(`[gitignore] ${gitignorePath} already contains all ${WORKFLOW_ENTRIES.length} workflow entries`);
90
+ return { ok: true, created: false, appended: 0, skipped: false };
91
+ }
92
+
93
+ const newContent = existingContent + '\n' + [...missingEntries].join('\n') + '\n';
94
+ writeFileSyncFn(gitignorePath, newContent, 'utf8');
95
+ logFn(`[gitignore] Appended ${missingEntries.length} missing entries to ${gitignorePath}`);
96
+
97
+ return { ok: true, created: false, appended: missingEntries.length, skipped: false };
98
+ }
99
+
100
+ (ensureWorkflowGitignore as EnsureWorkflowGitignoreFn).WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
101
+ (ensureWorkflowGitignore as EnsureWorkflowGitignoreFn).ensureWorkflowGitignore = ensureWorkflowGitignore as EnsureWorkflowGitignoreFn;
102
+
103
+ export = ensureWorkflowGitignore;