@imdeadpool/guardex 7.0.39 → 7.0.43
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/README.md +85 -16
- package/package.json +2 -1
- package/skills/gitguardex/SKILL.md +13 -0
- package/skills/guardex-merge-skills-to-dev/SKILL.md +59 -0
- package/src/agents/cleanup-sessions.js +126 -0
- package/src/agents/detect.js +160 -0
- package/src/agents/finish.js +172 -0
- package/src/agents/inspect.js +189 -0
- package/src/agents/launch.js +240 -0
- package/src/agents/registry.js +133 -0
- package/src/agents/selection-panel.js +571 -0
- package/src/agents/sessions.js +151 -0
- package/src/agents/start.js +591 -0
- package/src/agents/status.js +143 -0
- package/src/agents/terminal.js +152 -0
- package/src/budget/index.js +343 -0
- package/src/ci-init/index.js +265 -0
- package/src/cli/args.js +305 -1
- package/src/cli/main.js +262 -132
- package/src/cockpit/action-runner.js +3 -0
- package/src/cockpit/actions.js +80 -0
- package/src/cockpit/control.js +1121 -0
- package/src/cockpit/index.js +426 -0
- package/src/cockpit/keybindings.js +224 -0
- package/src/cockpit/kitty-layout.js +549 -0
- package/src/cockpit/kitty-tree.js +144 -0
- package/src/cockpit/layout.js +224 -0
- package/src/cockpit/logs-reader.js +182 -0
- package/src/cockpit/menu.js +204 -0
- package/src/cockpit/pane-actions.js +597 -0
- package/src/cockpit/pane-menu.js +387 -0
- package/src/cockpit/projects-finder.js +178 -0
- package/src/cockpit/render.js +215 -0
- package/src/cockpit/settings-render.js +128 -0
- package/src/cockpit/settings.js +124 -0
- package/src/cockpit/shortcuts.js +24 -0
- package/src/cockpit/sidebar.js +311 -0
- package/src/cockpit/state.js +72 -0
- package/src/cockpit/theme.js +128 -0
- package/src/cockpit/welcome.js +266 -0
- package/src/context.js +78 -35
- package/src/doctor/index.js +4 -3
- package/src/finish/index.js +39 -2
- package/src/git/index.js +65 -0
- package/src/kitty/command.js +101 -0
- package/src/kitty/runtime.js +250 -0
- package/src/output/index.js +1 -1
- package/src/pr-review.js +241 -0
- package/src/scaffold/index.js +19 -0
- package/src/submodule/index.js +288 -0
- package/src/terminal/index.js +120 -0
- package/src/terminal/kitty.js +622 -0
- package/src/terminal/tmux.js +126 -0
- package/src/tmux/command.js +27 -0
- package/src/tmux/session.js +89 -0
- package/templates/AGENTS.multiagent-safety.md +421 -37
- package/templates/codex/skills/gitguardex/SKILL.md +2 -0
- package/templates/githooks/pre-commit +22 -1
- package/templates/github/workflows/README.md +87 -0
- package/templates/github/workflows/ci-full.yml +55 -0
- package/templates/github/workflows/ci.yml +56 -0
- package/templates/github/workflows/cr.yml +20 -1
- package/templates/scripts/agent-branch-finish.sh +545 -27
- package/templates/scripts/agent-branch-start.sh +193 -21
- package/templates/scripts/agent-preflight.sh +89 -0
- package/templates/scripts/agent-worktree-prune.sh +96 -5
- package/templates/scripts/codex-agent.sh +41 -6
- package/templates/scripts/openspec/init-plan-workspace.sh +43 -0
- package/templates/scripts/review-bot-watch.sh +31 -2
- package/templates/scripts/agent-session-state.js +0 -171
- package/templates/scripts/install-vscode-active-agents-extension.js +0 -135
- package/templates/vscode/guardex-active-agents/README.md +0 -34
- package/templates/vscode/guardex-active-agents/extension.js +0 -3782
- package/templates/vscode/guardex-active-agents/fileicons/gitguardex-fileicons.json +0 -54
- package/templates/vscode/guardex-active-agents/fileicons/icons/agent.svg +0 -5
- package/templates/vscode/guardex-active-agents/fileicons/icons/branch.svg +0 -7
- package/templates/vscode/guardex-active-agents/fileicons/icons/config.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/hook.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/openspec.svg +0 -5
- package/templates/vscode/guardex-active-agents/fileicons/icons/plan.svg +0 -4
- package/templates/vscode/guardex-active-agents/fileicons/icons/spec.svg +0 -5
- package/templates/vscode/guardex-active-agents/icon.png +0 -0
- package/templates/vscode/guardex-active-agents/media/active-agents-hivemind.svg +0 -14
- package/templates/vscode/guardex-active-agents/package.json +0 -169
- package/templates/vscode/guardex-active-agents/session-schema.js +0 -1348
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const crypto = require('node:crypto');
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
|
|
5
|
+
const SESSION_FIELDS = [
|
|
6
|
+
'id',
|
|
7
|
+
'task',
|
|
8
|
+
'agent',
|
|
9
|
+
'branch',
|
|
10
|
+
'worktreePath',
|
|
11
|
+
'base',
|
|
12
|
+
'status',
|
|
13
|
+
'activity',
|
|
14
|
+
'claims',
|
|
15
|
+
'metadata',
|
|
16
|
+
'launchCommand',
|
|
17
|
+
'tmux',
|
|
18
|
+
'pr',
|
|
19
|
+
'finishEvidence',
|
|
20
|
+
'claimFailure',
|
|
21
|
+
'createdAt',
|
|
22
|
+
'updatedAt',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function sessionsDir(repoRoot) {
|
|
26
|
+
return path.join(repoRoot, '.guardex', 'agents', 'sessions');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function assertSessionId(sessionId) {
|
|
30
|
+
if (typeof sessionId !== 'string' || sessionId.trim() === '') {
|
|
31
|
+
throw new Error('Agent session id must be a non-empty string.');
|
|
32
|
+
}
|
|
33
|
+
if (sessionId.includes('/') || sessionId.includes('\\') || sessionId === '.' || sessionId === '..') {
|
|
34
|
+
throw new Error(`Invalid agent session id: ${sessionId}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function sessionFilePath(repoRoot, sessionId) {
|
|
39
|
+
assertSessionId(sessionId);
|
|
40
|
+
return path.join(sessionsDir(repoRoot), `${sessionId}.json`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function pickSessionFields(record) {
|
|
44
|
+
const session = {};
|
|
45
|
+
for (const field of SESSION_FIELDS) {
|
|
46
|
+
session[field] = record[field] ?? null;
|
|
47
|
+
}
|
|
48
|
+
return session;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function normalizeSessionPayload(payload, now) {
|
|
52
|
+
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
53
|
+
throw new Error('Agent session payload must be an object.');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const id = payload.id == null ? crypto.randomUUID() : payload.id;
|
|
57
|
+
assertSessionId(id);
|
|
58
|
+
|
|
59
|
+
return pickSessionFields({
|
|
60
|
+
...payload,
|
|
61
|
+
id,
|
|
62
|
+
status: payload.status || 'active',
|
|
63
|
+
createdAt: payload.createdAt || now,
|
|
64
|
+
updatedAt: now,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function writeJsonAtomic(filePath, value) {
|
|
69
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
70
|
+
const tempPath = path.join(
|
|
71
|
+
path.dirname(filePath),
|
|
72
|
+
`.${path.basename(filePath)}.${process.pid}.${Date.now()}.tmp`,
|
|
73
|
+
);
|
|
74
|
+
const body = `${JSON.stringify(value, null, 2)}\n`;
|
|
75
|
+
fs.writeFileSync(tempPath, body, { encoding: 'utf8', mode: 0o600 });
|
|
76
|
+
fs.renameSync(tempPath, filePath);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function readJsonFile(filePath) {
|
|
80
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function createAgentSession(repoRoot, payload) {
|
|
84
|
+
const now = new Date().toISOString();
|
|
85
|
+
const session = normalizeSessionPayload(payload, now);
|
|
86
|
+
writeJsonAtomic(sessionFilePath(repoRoot, session.id), session);
|
|
87
|
+
return session;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function readAgentSession(repoRoot, sessionId) {
|
|
91
|
+
const filePath = sessionFilePath(repoRoot, sessionId);
|
|
92
|
+
if (!fs.existsSync(filePath)) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return pickSessionFields(readJsonFile(filePath));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function updateAgentSession(repoRoot, sessionId, patch) {
|
|
99
|
+
if (!patch || typeof patch !== 'object' || Array.isArray(patch)) {
|
|
100
|
+
throw new Error('Agent session patch must be an object.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const existing = readAgentSession(repoRoot, sessionId);
|
|
104
|
+
if (!existing) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const now = new Date().toISOString();
|
|
109
|
+
const session = pickSessionFields({
|
|
110
|
+
...existing,
|
|
111
|
+
...patch,
|
|
112
|
+
id: existing.id,
|
|
113
|
+
createdAt: existing.createdAt,
|
|
114
|
+
updatedAt: now,
|
|
115
|
+
});
|
|
116
|
+
writeJsonAtomic(sessionFilePath(repoRoot, sessionId), session);
|
|
117
|
+
return session;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function listAgentSessions(repoRoot) {
|
|
121
|
+
const dir = sessionsDir(repoRoot);
|
|
122
|
+
if (!fs.existsSync(dir)) {
|
|
123
|
+
return [];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return fs
|
|
127
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
128
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith('.json'))
|
|
129
|
+
.map((entry) => readAgentSession(repoRoot, entry.name.slice(0, -'.json'.length)))
|
|
130
|
+
.filter(Boolean)
|
|
131
|
+
.sort((left, right) => left.id.localeCompare(right.id));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function removeAgentSession(repoRoot, sessionId) {
|
|
135
|
+
const filePath = sessionFilePath(repoRoot, sessionId);
|
|
136
|
+
if (!fs.existsSync(filePath)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
fs.unlinkSync(filePath);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = {
|
|
144
|
+
sessionFilePath,
|
|
145
|
+
sessionsDir,
|
|
146
|
+
createAgentSession,
|
|
147
|
+
readAgentSession,
|
|
148
|
+
updateAgentSession,
|
|
149
|
+
listAgentSessions,
|
|
150
|
+
removeAgentSession,
|
|
151
|
+
};
|