@magnusekdahl/parallix 1.0.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.
- package/CHANGELOG.md +140 -0
- package/LICENSE +661 -0
- package/README.md +196 -0
- package/config/agents.json +25 -0
- package/config/agents.local.json.template +8 -0
- package/config/state-map.json +4 -0
- package/config/state-map.json.template +31 -0
- package/config/workflow.config.schema.json +98 -0
- package/data/.gitkeep +0 -0
- package/docs/adr/0031-ai-agent-instruction-boundary-and-command-floor.md +114 -0
- package/docs/adr/0032-mission-refinement-state-and-usage-budget-signals.md +135 -0
- package/docs/adr/0034-module-and-skill-invocation-model.md +202 -0
- package/docs/adr/0036-mission-sizing-and-dependency-wave-heuristics.md +79 -0
- package/docs/adr/0037-ai-workflow-coordination-architecture.md +162 -0
- package/docs/adr/0041-integration-pipeline-gates.md +165 -0
- package/docs/adr/0042-workflow-cli-color-rendering-approach.md +106 -0
- package/docs/adr/0043-git-target-resolution-strategy.md +185 -0
- package/docs/adr/0044-workflow-distribution-model.md +277 -0
- package/docs/adr/0045-parallax-branch-model.md +182 -0
- package/docs/adr/0046-npm-publish-process-and-security.md +138 -0
- package/docs/adr/index.md +20 -0
- package/docs/agents.md +212 -0
- package/docs/authority-reference.md +298 -0
- package/docs/forgejo-setup.md +31 -0
- package/docs/migration/extraction.md +61 -0
- package/docs/migration/task-classification.md +36 -0
- package/docs/operator-setup.md +76 -0
- package/docs/readme-rewrite-benchmark.md +188 -0
- package/docs/use-cases.md +105 -0
- package/examples/README.md +62 -0
- package/examples/run-enterprise-tarball-workflow-smoke.sh +257 -0
- package/examples/run-verify-env-smoke.sh +40 -0
- package/index.js +250 -0
- package/lib/README.md +13 -0
- package/lib/agents/agents.js +867 -0
- package/lib/agents/claude-telemetry.js +233 -0
- package/lib/agents/claude.js +139 -0
- package/lib/agents/codex-telemetry.js +202 -0
- package/lib/agents/codex.js +219 -0
- package/lib/agents/limit-hit.js +252 -0
- package/lib/agents/mistral-telemetry.js +44 -0
- package/lib/agents/mistral.js +68 -0
- package/lib/agents/opencode-export.js +110 -0
- package/lib/agents/opencode-telemetry.js +356 -0
- package/lib/agents/opencode.js +218 -0
- package/lib/agents/stage-telemetry.js +37 -0
- package/lib/commands/active.js +625 -0
- package/lib/commands/checkpoint.js +76 -0
- package/lib/commands/config.js +39 -0
- package/lib/commands/coverage-gate.js +358 -0
- package/lib/commands/diff.js +119 -0
- package/lib/commands/draft.js +854 -0
- package/lib/commands/handoff.js +501 -0
- package/lib/commands/integrate.js +1528 -0
- package/lib/commands/mission-start.js +246 -0
- package/lib/commands/rebase.js +597 -0
- package/lib/commands/repair-handoff.js +227 -0
- package/lib/commands/resolve-conflict.js +109 -0
- package/lib/commands/review.js +13 -0
- package/lib/commands/setup-review.js +13 -0
- package/lib/commands/setup.js +3 -0
- package/lib/commands/stats-backfill.js +395 -0
- package/lib/commands/stats.js +1601 -0
- package/lib/commands/status.js +183 -0
- package/lib/commands/verify.js +1 -0
- package/lib/core/fmt.js +202 -0
- package/lib/core/git.js +73 -0
- package/lib/core/gitignore.js +110 -0
- package/lib/core/mission-utils.js +1017 -0
- package/lib/core/persistent-data-migration.js +201 -0
- package/lib/core/product-config.js +508 -0
- package/lib/core/runtime-matrix.js +82 -0
- package/lib/core/spawn-tee.js +173 -0
- package/lib/core/state-map.js +89 -0
- package/lib/core/storage.js +165 -0
- package/lib/core/verification.js +149 -0
- package/lib/index.js +77 -0
- package/lib/review/rebase.js +163 -0
- package/lib/review/review-adapter.js +135 -0
- package/lib/review/review-artifacts.js +619 -0
- package/lib/review/review-commands.js +1375 -0
- package/lib/review/review-events.js +1007 -0
- package/lib/review/review-loop.js +1004 -0
- package/lib/review/review-polling.js +141 -0
- package/lib/review/review-prompts.js +212 -0
- package/lib/review/review-state.js +280 -0
- package/lib/review/review.js +96 -0
- package/lib/tools/backlog.js +680 -0
- package/lib/tools/forgejo.js +1585 -0
- package/lib/tools/gatekeeper.js +106 -0
- package/lib/tools/sessions.js +74 -0
- package/lib/tools/setup-review.js +1053 -0
- package/package.json +56 -0
- package/prompts/act-on-review-verbose.md +20 -0
- package/prompts/act-on-review.md +22 -0
- package/prompts/draft.md +20 -0
- package/prompts/execute.md +24 -0
- package/prompts/portfolio.md +30 -0
- package/prompts/review-verbose.md +20 -0
- package/prompts/review.md +17 -0
- package/px.js +236 -0
- package/templates/AGENTS-snippet.md +14 -0
- package/templates/AGENTS.md.template +34 -0
- package/templates/CLAUDE.md.template +27 -0
- package/templates/CODEX.md.template +38 -0
- package/templates/MISTRAL.md.template +24 -0
- package/templates/claude-commands/act-on-review.md +3 -0
- package/templates/claude-commands/area-review.md +3 -0
- package/templates/claude-commands/draft.md +6 -0
- package/templates/claude-commands/execute.md +6 -0
- package/templates/claude-commands/integrate.md +4 -0
- package/templates/claude-commands/portfolio.md +5 -0
- package/templates/claude-commands/review.md +4 -0
- package/templates/codex/config.toml +6 -0
- package/templates/mission-scaffold.md +39 -0
- package/templates/vibe/skills/act-on-review/SKILL.md +16 -0
- package/templates/vibe/skills/area-review/SKILL.md +16 -0
- package/templates/vibe/skills/draft/SKILL.md +16 -0
- package/templates/vibe/skills/execute/SKILL.md +16 -0
- package/templates/vibe/skills/integrate/SKILL.md +16 -0
- package/templates/vibe/skills/portfolio/SKILL.md +21 -0
- package/templates/vibe/skills/review/SKILL.md +16 -0
- package/tools/setup-forgejo-docker.sh +84 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fmt = require('../core/fmt');
|
|
4
|
+
|
|
5
|
+
const { findMissionDir, findCheckpoints, missionDirForSlug, missionBranchName } = require('../core/mission-utils');
|
|
6
|
+
const { resolveTaskFile } = require('./backlog');
|
|
7
|
+
const { readToken, postReview } = require('./forgejo');
|
|
8
|
+
|
|
9
|
+
const DEFAULT_GATEKEEPER_USER = 'forgejo-gatekeeper';
|
|
10
|
+
|
|
11
|
+
// Pre-review pushback bot. Runs after performHandoff has created/updated the
|
|
12
|
+
// PR and before the human/agent reviewer engages, so missing mandatory
|
|
13
|
+
// artifacts surface as a request-changes review instead of consuming a
|
|
14
|
+
// reviewer cycle. Returns { ok, missing, skipped, posted } so callers can
|
|
15
|
+
// surface a clear log line without needing to re-derive state.
|
|
16
|
+
|
|
17
|
+
function checkMandatoryFiles(slug, options = {}) {
|
|
18
|
+
const {
|
|
19
|
+
rootDir = process.cwd(),
|
|
20
|
+
findMissionDirFn = findMissionDir,
|
|
21
|
+
findCheckpointsFn = findCheckpoints,
|
|
22
|
+
resolveTaskFileFn = resolveTaskFile
|
|
23
|
+
} = options;
|
|
24
|
+
|
|
25
|
+
const missing = [];
|
|
26
|
+
const expectedMissionDir = missionDirForSlug(rootDir, slug);
|
|
27
|
+
const expectedMissionRel = path.relative(rootDir, expectedMissionDir).split(path.sep).join('/');
|
|
28
|
+
|
|
29
|
+
const missionDir = findMissionDirFn(slug, rootDir);
|
|
30
|
+
const missionPath = missionDir ? path.join(missionDir, 'MISSION.md') : null;
|
|
31
|
+
if (!missionPath || !fs.existsSync(missionPath)) {
|
|
32
|
+
missing.push(`${expectedMissionRel}/MISSION.md`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (missionDir) {
|
|
36
|
+
const checkpoints = findCheckpointsFn(missionDir);
|
|
37
|
+
if (!checkpoints || checkpoints.length === 0) {
|
|
38
|
+
missing.push(`${expectedMissionRel}/CP-*.md (at least one checkpoint document)`);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
missing.push(`${expectedMissionRel}/CP-*.md (at least one checkpoint document)`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const taskResolution = resolveTaskFileFn(slug, rootDir);
|
|
45
|
+
if (!taskResolution || !taskResolution.ok) {
|
|
46
|
+
missing.push('backlog/tasks/' + slug + ' - *.md');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return { ok: missing.length === 0, missing };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function buildPushbackBody(slug, missing) {
|
|
53
|
+
const bullets = missing.map(item => `- ${item}`).join('\n');
|
|
54
|
+
return [
|
|
55
|
+
`**Pre-review gatekeeper: missing mandatory artifacts for \`${slug}\`.**`,
|
|
56
|
+
'',
|
|
57
|
+
'The following files are required before a reviewer engages but were not found on this branch:',
|
|
58
|
+
'',
|
|
59
|
+
bullets,
|
|
60
|
+
'',
|
|
61
|
+
'Push the missing artifacts and re-request review. This comment is automated; once the artifacts are present the gatekeeper will not block again.'
|
|
62
|
+
].join('\n');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function runGatekeeper(slug, options = {}) {
|
|
66
|
+
const {
|
|
67
|
+
rootDir = process.cwd(),
|
|
68
|
+
user = process.env.FORGEJO_GATEKEEPER_USER || DEFAULT_GATEKEEPER_USER,
|
|
69
|
+
log = fmt.log.plain,
|
|
70
|
+
readTokenFn = readToken,
|
|
71
|
+
postReviewFn = postReview,
|
|
72
|
+
checkFn = checkMandatoryFiles
|
|
73
|
+
} = options;
|
|
74
|
+
const branch = options.branch || missionBranchName(slug, rootDir);
|
|
75
|
+
|
|
76
|
+
const check = checkFn(slug, { rootDir });
|
|
77
|
+
if (check.ok) {
|
|
78
|
+
log(fmt.status('INFO', `Gatekeeper: all mandatory artifacts present for ${fmt.slug(slug)}.`));
|
|
79
|
+
return { ok: true, missing: [], skipped: false, posted: false };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const token = readTokenFn(user);
|
|
83
|
+
if (!token) {
|
|
84
|
+
log(fmt.status('WARN', `Gatekeeper: no Forgejo token for "${fmt.agent(user)}"; skipping pushback for ${fmt.slug(slug)}. Missing: ${check.missing.join(', ')}.`));
|
|
85
|
+
return { ok: false, missing: check.missing, skipped: true, posted: false };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const body = buildPushbackBody(slug, check.missing);
|
|
89
|
+
log(fmt.status('INFO', `Gatekeeper: posting request-changes pushback on ${fmt.branch(branch)} as ${fmt.agent(user)}. Missing: ${check.missing.join(', ')}.`));
|
|
90
|
+
const result = postReviewFn(branch, token, 'request-changes', body);
|
|
91
|
+
|
|
92
|
+
if (!result || !result.ok) {
|
|
93
|
+
const detail = result && result.error ? result.error : 'unknown postReview failure';
|
|
94
|
+
log(fmt.status('WARN', `Gatekeeper: pushback post failed for ${fmt.slug(slug)}: ${detail}.`));
|
|
95
|
+
return { ok: false, missing: check.missing, skipped: false, posted: false };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return { ok: false, missing: check.missing, skipped: false, posted: true };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = {
|
|
102
|
+
DEFAULT_GATEKEEPER_USER,
|
|
103
|
+
checkMandatoryFiles,
|
|
104
|
+
buildPushbackBody,
|
|
105
|
+
runGatekeeper
|
|
106
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// Per-worktree session markers used by startAgent to decide whether to launch
|
|
5
|
+
// an agent fresh or with its family-specific resume flag. Stored under
|
|
6
|
+
// .workflow/sessions/ which is already gitignored, so markers live with the
|
|
7
|
+
// mission worktree and survive harness restarts but never travel through git.
|
|
8
|
+
|
|
9
|
+
function sessionsDir(worktree) {
|
|
10
|
+
return path.join(worktree, '.workflow', 'sessions');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function sessionFile(worktree, slug, role) {
|
|
14
|
+
return path.join(sessionsDir(worktree), `${slug}-${role}.json`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function readSession(worktree, slug, role) {
|
|
18
|
+
if (!worktree || !slug || !role) return null;
|
|
19
|
+
const file = sessionFile(worktree, slug, role);
|
|
20
|
+
if (!fs.existsSync(file)) return null;
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
23
|
+
if (parsed && typeof parsed.agent === 'string') return parsed;
|
|
24
|
+
return null;
|
|
25
|
+
} catch (_) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function writeSession(worktree, slug, role, payload) {
|
|
31
|
+
if (!worktree || !slug || !role || !payload || typeof payload.agent !== 'string') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
fs.mkdirSync(sessionsDir(worktree), { recursive: true });
|
|
35
|
+
const body = {
|
|
36
|
+
agent: payload.agent,
|
|
37
|
+
lastLaunched: payload.lastLaunched || new Date().toISOString(),
|
|
38
|
+
sessionId: payload.sessionId || null
|
|
39
|
+
};
|
|
40
|
+
fs.writeFileSync(sessionFile(worktree, slug, role), JSON.stringify(body, null, 2) + '\n', 'utf8');
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Resume only when the previous launch in this (slug, role) used the same
|
|
45
|
+
// agent family. A fallback to a different family invalidates the marker —
|
|
46
|
+
// the new family has no prior session to continue.
|
|
47
|
+
function shouldResume(worktree, slug, role, agent) {
|
|
48
|
+
const prev = readSession(worktree, slug, role);
|
|
49
|
+
return Boolean(prev && prev.agent === agent);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Return the session ID from the marker, if one was persisted.
|
|
53
|
+
function getSessionId(worktree, slug, role) {
|
|
54
|
+
const prev = readSession(worktree, slug, role);
|
|
55
|
+
return prev && prev.sessionId ? prev.sessionId : null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function clearSession(worktree, slug, role) {
|
|
59
|
+
if (!worktree || !slug || !role) return false;
|
|
60
|
+
const file = sessionFile(worktree, slug, role);
|
|
61
|
+
if (!fs.existsSync(file)) return false;
|
|
62
|
+
fs.unlinkSync(file);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
sessionsDir,
|
|
68
|
+
sessionFile,
|
|
69
|
+
readSession,
|
|
70
|
+
writeSession,
|
|
71
|
+
shouldResume,
|
|
72
|
+
getSessionId,
|
|
73
|
+
clearSession
|
|
74
|
+
};
|