agentic-workflow-manager 5.0.1 → 5.0.2
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.
|
@@ -129,18 +129,24 @@ function computeCodexHookStatus(agent) {
|
|
|
129
129
|
const settingsEntry = checkCodexSettingsEntry(config.settingsPath, config.scriptsDir, config.matcher, config.eventName);
|
|
130
130
|
const allOk = sessionStartScript.ok && settingsEntry.ok;
|
|
131
131
|
const settingsOnlyMissing = !settingsEntry.ok && sessionStartScript.ok;
|
|
132
|
-
let overall;
|
|
133
|
-
if (allOk)
|
|
134
|
-
overall = 'HEALTHY';
|
|
135
|
-
else if (settingsOnlyMissing)
|
|
136
|
-
overall = 'NOT_INSTALLED';
|
|
137
|
-
else
|
|
138
|
-
overall = 'DEGRADED';
|
|
139
132
|
// Trust only makes sense once the AWM entry is actually present in
|
|
140
133
|
// hooks.json — otherwise there's nothing installed to trust.
|
|
141
134
|
const trust = settingsEntry.ok
|
|
142
135
|
? computeCodexTrust(sessionStartScript, scriptPath, heartbeatPath)
|
|
143
136
|
: undefined;
|
|
137
|
+
// `overall` IGNORABA `trust` por completo, asi que `awm hooks status` imprimia
|
|
138
|
+
// `Status: HEALTHY` dos lineas debajo de `Trust: … pending-trust`. Una corrida real
|
|
139
|
+
// del playbook leyo esa salida y concluyo que el hook andaba. `doctor --json` decia
|
|
140
|
+
// la verdad; la vista humana, no — y es la que mira una persona. Ver D-010.
|
|
141
|
+
let overall;
|
|
142
|
+
if (!allOk)
|
|
143
|
+
overall = settingsOnlyMissing ? 'NOT_INSTALLED' : 'DEGRADED';
|
|
144
|
+
else if (trust === 'stale')
|
|
145
|
+
overall = 'DEGRADED';
|
|
146
|
+
else if (trust === 'pending-trust')
|
|
147
|
+
overall = 'PENDING_TRUST';
|
|
148
|
+
else
|
|
149
|
+
overall = 'HEALTHY';
|
|
144
150
|
return {
|
|
145
151
|
overall,
|
|
146
152
|
trust,
|
|
@@ -13,6 +13,16 @@ const status_1 = require("./status");
|
|
|
13
13
|
const providers_1 = require("../../providers");
|
|
14
14
|
const registries_1 = require("../../core/registries");
|
|
15
15
|
const HOOK_TARGETS = providers_1.AGENT_TARGETS.filter((a) => (0, providers_1.getHookConfig)(a));
|
|
16
|
+
/**
|
|
17
|
+
* `hooks` nacio con `-t, --target` y el resto del CLI (`add`, `remove`, `sync`,
|
|
18
|
+
* `update`, `doctor`) usa `-a, --agent`. La asimetria se cobro una corrida real del
|
|
19
|
+
* playbook: `awm hooks status --agent codex` fallaba con `unknown option`. Se acepta
|
|
20
|
+
* `--agent` como alias en vez de renombrar, para no romper a quien ya scriptea
|
|
21
|
+
* `--target`. Ver D-010.
|
|
22
|
+
*/
|
|
23
|
+
function resolveHookTarget(options) {
|
|
24
|
+
return (options.agent ?? options.target ?? 'claude-code');
|
|
25
|
+
}
|
|
16
26
|
function targetOptionDescription() {
|
|
17
27
|
return `Target harness (${HOOK_TARGETS.join('|')})`;
|
|
18
28
|
}
|
|
@@ -21,9 +31,10 @@ function registerHooksCommand(program) {
|
|
|
21
31
|
hooks.command('install')
|
|
22
32
|
.description('Install the AWM bootstrap hook into the target harness')
|
|
23
33
|
.option('-t, --target <target>', targetOptionDescription(), 'claude-code')
|
|
34
|
+
.option('-a, --agent <agent>', 'Alias de --target, por simetria con el resto del CLI')
|
|
24
35
|
.option('-y, --yes', 'Skip interactive confirmations', false)
|
|
25
36
|
.action(async (options) => {
|
|
26
|
-
const agent = (options
|
|
37
|
+
const agent = resolveHookTarget(options);
|
|
27
38
|
const prefs = (0, config_1.getPreferences)();
|
|
28
39
|
const hooksRoot = (0, registries_1.capabilityRoot)('hooks');
|
|
29
40
|
if (!hooksRoot) {
|
|
@@ -69,9 +80,10 @@ function registerHooksCommand(program) {
|
|
|
69
80
|
hooks.command('uninstall')
|
|
70
81
|
.description('Remove the AWM bootstrap hook')
|
|
71
82
|
.option('-t, --target <target>', targetOptionDescription(), 'claude-code')
|
|
83
|
+
.option('-a, --agent <agent>', 'Alias de --target, por simetria con el resto del CLI')
|
|
72
84
|
.option('-y, --yes', 'Skip interactive confirmations', false)
|
|
73
85
|
.action(async (options) => {
|
|
74
|
-
const agent = (options
|
|
86
|
+
const agent = resolveHookTarget(options);
|
|
75
87
|
if (!options.yes && process.stdin.isTTY) {
|
|
76
88
|
const ok = await (0, prompts_1.confirm)({ message: 'Remove AWM bootstrap hook from settings.json?' });
|
|
77
89
|
if ((0, prompts_1.isCancel)(ok) || ok !== true) {
|
|
@@ -98,8 +110,9 @@ function registerHooksCommand(program) {
|
|
|
98
110
|
hooks.command('status')
|
|
99
111
|
.description('Check the bootstrap hook installation status')
|
|
100
112
|
.option('-t, --target <target>', targetOptionDescription(), 'claude-code')
|
|
113
|
+
.option('-a, --agent <agent>', 'Alias de --target, por simetria con el resto del CLI')
|
|
101
114
|
.action((options) => {
|
|
102
|
-
const agent = (options
|
|
115
|
+
const agent = resolveHookTarget(options);
|
|
103
116
|
try {
|
|
104
117
|
const result = (0, status_1.computeHookStatus)(agent);
|
|
105
118
|
const symbol = (ok) => ok ? picocolors_1.default.green('✓') : picocolors_1.default.red('✗');
|
|
@@ -118,10 +131,17 @@ function registerHooksCommand(program) {
|
|
|
118
131
|
}
|
|
119
132
|
console.log('');
|
|
120
133
|
const overall = result.overall === 'HEALTHY' ? picocolors_1.default.green(result.overall) :
|
|
121
|
-
result.overall === 'NOT_INSTALLED'
|
|
122
|
-
picocolors_1.default.
|
|
134
|
+
result.overall === 'NOT_INSTALLED' || result.overall === 'PENDING_TRUST'
|
|
135
|
+
? picocolors_1.default.yellow(result.overall)
|
|
136
|
+
: picocolors_1.default.red(result.overall);
|
|
123
137
|
console.log(` Status: ${overall}`);
|
|
124
|
-
if (result.overall
|
|
138
|
+
if (result.overall === 'PENDING_TRUST') {
|
|
139
|
+
console.log(picocolors_1.default.dim(' El hook esta instalado y bien formado, pero nunca se lo vio correr.'));
|
|
140
|
+
console.log(picocolors_1.default.dim(' Abri una sesion del agente; si sigue igual, no se esta disparando.'));
|
|
141
|
+
}
|
|
142
|
+
// PENDING_TRUST no sale 1: no hay nada roto que arreglar, y salir 1 en
|
|
143
|
+
// toda instalacion recien hecha convertiria el comando en ruido.
|
|
144
|
+
if (result.overall !== 'HEALTHY' && result.overall !== 'PENDING_TRUST') {
|
|
125
145
|
process.exit(1);
|
|
126
146
|
}
|
|
127
147
|
}
|
|
@@ -167,6 +167,27 @@ describe('installHook / computeHookStatus / uninstallHook — Codex adapter', ()
|
|
|
167
167
|
const { computeHookStatus } = require('../../../src/commands/hooks/status');
|
|
168
168
|
expect(computeHookStatus('codex').trust).toBe(expected); // verifies R18
|
|
169
169
|
});
|
|
170
|
+
// `overall` NUNCA se assertaba — solo `.trust` — y por eso el bug vivio: se calculaba
|
|
171
|
+
// ignorando trust por completo, asi que `awm hooks status` imprimia `Status: HEALTHY`
|
|
172
|
+
// dos lineas debajo de `Trust: … pending-trust`. Una corrida real del playbook leyo esa
|
|
173
|
+
// salida y concluyo que el hook andaba. Ver D-010.
|
|
174
|
+
it.each([
|
|
175
|
+
[false, 'PENDING_TRUST'],
|
|
176
|
+
[true, 'HEALTHY'],
|
|
177
|
+
])('overall refleja el trust, no solo la presencia de archivos (heartbeat=%s)', (heartbeat, expected) => {
|
|
178
|
+
installCodexFixture({ heartbeat: heartbeat });
|
|
179
|
+
const { computeHookStatus } = require('../../../src/commands/hooks/status');
|
|
180
|
+
expect(computeHookStatus('codex').overall).toBe(expected);
|
|
181
|
+
});
|
|
182
|
+
it('un heartbeat obsoleto degrada: el script cambio desde la ultima corrida confirmada', () => {
|
|
183
|
+
installCodexFixture({ heartbeat: true });
|
|
184
|
+
fs_1.default.writeFileSync(path_1.default.join(codexScriptsDir, 'session-start'), '#!/usr/bin/env bash\necho "changed"', { mode: 0o755 });
|
|
185
|
+
const { computeHookStatus } = require('../../../src/commands/hooks/status');
|
|
186
|
+
const status = computeHookStatus('codex');
|
|
187
|
+
expect(status.trust).toBe('stale');
|
|
188
|
+
// Esto era `HEALTHY`: la rotura mas clara de las tres, reportada en verde.
|
|
189
|
+
expect(status.overall).toBe('DEGRADED');
|
|
190
|
+
});
|
|
170
191
|
it('reports stale trust when the heartbeat hash no longer matches the installed script', () => {
|
|
171
192
|
installCodexFixture({ heartbeat: true });
|
|
172
193
|
fs_1.default.writeFileSync(path_1.default.join(codexScriptsDir, 'session-start'), '#!/usr/bin/env bash\necho "changed"', { mode: 0o755 });
|