@orchestrator-claude/definitions 3.32.2 → 3.34.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/README.md +145 -0
- package/agents/adversarial-reviewer.md +2 -2
- package/agents/azure-devops-engineer.md +9 -1
- package/agents/cicd-platform-engineer.md +477 -0
- package/agents/debug-sidecar.md +6 -1
- package/agents/doc-sidecar.md +6 -1
- package/agents/frontend-engineer.md +173 -0
- package/agents/implementer.md +39 -23
- package/agents/methodology-researcher.md +2 -1
- package/agents/operational-artifact-builder.md +2 -1
- package/agents/orchestrator.md +47 -76
- package/agents/planner.md +2 -2
- package/agents/presentation-engineer.md +1 -1
- package/agents/python-data-engineer.md +214 -0
- package/agents/reviewer.md +16 -8
- package/agents/specifier.md +1 -1
- package/agents/task-generator.md +1 -1
- package/agents/test-sidecar.md +15 -4
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/DiffCommand.js +1 -1
- package/dist/commands/DiffCommand.js.map +1 -1
- package/dist/commands/InstallCommand.d.ts +41 -0
- package/dist/commands/InstallCommand.d.ts.map +1 -0
- package/dist/commands/InstallCommand.js +253 -0
- package/dist/commands/InstallCommand.js.map +1 -0
- package/dist/http/ApiClient.d.ts +5 -0
- package/dist/http/ApiClient.d.ts.map +1 -1
- package/dist/http/ApiClient.js.map +1 -1
- package/dist/install/DevCheckoutDetector.d.ts +66 -0
- package/dist/install/DevCheckoutDetector.d.ts.map +1 -0
- package/dist/install/DevCheckoutDetector.js +150 -0
- package/dist/install/DevCheckoutDetector.js.map +1 -0
- package/dist/install/HooksWirer.d.ts +29 -0
- package/dist/install/HooksWirer.d.ts.map +1 -0
- package/dist/install/HooksWirer.js +80 -0
- package/dist/install/HooksWirer.js.map +1 -0
- package/dist/install/LocalDiffReporter.d.ts +25 -0
- package/dist/install/LocalDiffReporter.d.ts.map +1 -0
- package/dist/install/LocalDiffReporter.js +50 -0
- package/dist/install/LocalDiffReporter.js.map +1 -0
- package/dist/install/Materializer.d.ts +67 -0
- package/dist/install/Materializer.d.ts.map +1 -0
- package/dist/install/Materializer.js +196 -0
- package/dist/install/Materializer.js.map +1 -0
- package/dist/install/McpRegistrar.d.ts +63 -0
- package/dist/install/McpRegistrar.d.ts.map +1 -0
- package/dist/install/McpRegistrar.js +114 -0
- package/dist/install/McpRegistrar.js.map +1 -0
- package/dist/install/ProcessRunner.d.ts +25 -0
- package/dist/install/ProcessRunner.d.ts.map +1 -0
- package/dist/install/ProcessRunner.js +41 -0
- package/dist/install/ProcessRunner.js.map +1 -0
- package/dist/install/ProjectSettingsNeutralizer.d.ts +39 -0
- package/dist/install/ProjectSettingsNeutralizer.d.ts.map +1 -0
- package/dist/install/ProjectSettingsNeutralizer.js +100 -0
- package/dist/install/ProjectSettingsNeutralizer.js.map +1 -0
- package/dist/install/types.d.ts +52 -0
- package/dist/install/types.d.ts.map +1 -0
- package/dist/install/types.js +8 -0
- package/dist/install/types.js.map +1 -0
- package/dist/manifest/ManifestLoader.d.ts.map +1 -1
- package/dist/manifest/ManifestLoader.js +3 -2
- package/dist/manifest/ManifestLoader.js.map +1 -1
- package/dist/manifest/types.d.ts +3 -0
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/scripts/bundle-hooks.d.ts +39 -0
- package/dist/scripts/bundle-hooks.d.ts.map +1 -0
- package/dist/scripts/bundle-hooks.js +165 -0
- package/dist/scripts/bundle-hooks.js.map +1 -0
- package/dist/scripts/generate-manifest.d.ts +22 -3
- package/dist/scripts/generate-manifest.d.ts.map +1 -1
- package/dist/scripts/generate-manifest.js +78 -35
- package/dist/scripts/generate-manifest.js.map +1 -1
- package/hooks/dangling-guard.mjs +7426 -0
- package/hooks/dangling-guard.ts +223 -6
- package/hooks/gate-guardian.mjs +463 -0
- package/hooks/hooks.json +63 -0
- package/hooks/lib/additional-directories-sync.ts +295 -0
- package/hooks/lib/api-client.ts +388 -7
- package/hooks/lib/session-selection.ts +81 -0
- package/hooks/mailbox-listener.mjs +259 -0
- package/hooks/post-compact.mjs +7931 -0
- package/hooks/post-implement.mjs +238 -0
- package/hooks/session-start.mjs +8234 -0
- package/hooks/session-start.ts +264 -23
- package/hooks/sprint-registry.mjs +59 -0
- package/hooks/subagent-start.mjs +289 -0
- package/hooks/subagent-stop.mjs +7793 -0
- package/hooks/subagent-stop.ts +4 -2
- package/hooks/user-prompt.mjs +329 -0
- package/hooks/workflow-guard.mjs +7805 -0
- package/hooks/workflow-guard.ts +360 -119
- package/hooks-settings-template.json +63 -0
- package/manifest.json +124 -90
- package/mcp-servers.json +48 -0
- package/package.json +10 -4
- package/personas/auditor-compliance.md +104 -0
- package/personas/cfo-conservador.md +88 -0
- package/personas/designer-perfeccionista.md +104 -0
- package/personas/diretor-cetico-fmcg.md +80 -0
- package/personas/engenheiro-cetico-construcao.md +107 -0
- package/skills/artifact-generator/SKILL.md +1 -1
- package/skills/artifact-production/SKILL.md +28 -0
- package/skills/backlog-synthesis/SKILL.md +8 -3
- package/skills/checkpoint-protocol/SKILL.md +7 -0
- package/skills/infographic-engine/SKILL.md +116 -0
- package/skills/orchestrator/SKILL.md +93 -7
- package/skills/persona-library/SKILL.md +1 -1
- package/skills/project-conventions/SKILL.md +53 -30
- package/skills/project-management-enterprise/SKILL.md +1 -1
- package/skills/python-data-engineering/SKILL.md +792 -0
- package/skills/release/SKILL.md +29 -18
- package/skills/release/release.sh +65 -4
- package/skills/storybook-validated-loop/SKILL.md +110 -0
- package/skills/tdd-discipline/SKILL.md +16 -0
- package/skills/workflow-coordination/SKILL.md +117 -16
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { createRequire as __createRequireShim } from 'node:module'; const require = __createRequireShim(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// hooks/lib/api-client.ts
|
|
4
|
+
import { readFileSync, writeFileSync, mkdirSync, statSync, unlinkSync, readdirSync } from "node:fs";
|
|
5
|
+
import { join as join2, dirname as dirname2 } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
// ../project-root-resolver/dist/index.js
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { dirname, join } from "node:path";
|
|
11
|
+
function resolveProjectRoot(cwd, sentinel = ".orchestrator") {
|
|
12
|
+
let currentDir = cwd;
|
|
13
|
+
for (; ; ) {
|
|
14
|
+
if (existsSync(join(currentDir, sentinel))) {
|
|
15
|
+
return currentDir;
|
|
16
|
+
}
|
|
17
|
+
const parentDir = dirname(currentDir);
|
|
18
|
+
if (parentDir === currentDir) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
currentDir = parentDir;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// hooks/lib/api-client.ts
|
|
26
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
27
|
+
var __dirname = dirname2(__filename);
|
|
28
|
+
var PROJECT_ROOT = join2(__dirname, "..", "..", "..");
|
|
29
|
+
var STATE_DIR = join2(PROJECT_ROOT, ".orchestrator", ".state");
|
|
30
|
+
var JWT_CACHE = join2(STATE_DIR, "jwt-token");
|
|
31
|
+
var DEBUG_LOG = join2(STATE_DIR, "hook-debug.log");
|
|
32
|
+
mkdirSync(STATE_DIR, { recursive: true });
|
|
33
|
+
var API_URL = process.env.ORCHESTRATOR_API_URL || "http://localhost:3001";
|
|
34
|
+
var AUTH_EMAIL = process.env.ORCHESTRATOR_ADMIN_EMAIL || process.env.ORCHESTRATOR_AUTH_EMAIL || "system@orchestrator.local";
|
|
35
|
+
var AUTH_PASSWORD = process.env.ORCHESTRATOR_ADMIN_PASSWORD || process.env.ORCHESTRATOR_AUTH_PASSWORD || "system123";
|
|
36
|
+
var PROJECT_ID = process.env.ORCHESTRATOR_PROJECT_ID || "";
|
|
37
|
+
function resolveHookProjectRoot(cwd) {
|
|
38
|
+
return resolveProjectRoot(cwd);
|
|
39
|
+
}
|
|
40
|
+
var projectIdResolutionAttempted = false;
|
|
41
|
+
async function ensureProjectIdResolved(token) {
|
|
42
|
+
if (PROJECT_ID || projectIdResolutionAttempted) return;
|
|
43
|
+
projectIdResolutionAttempted = true;
|
|
44
|
+
try {
|
|
45
|
+
const rootPath = resolveHookProjectRoot(process.cwd());
|
|
46
|
+
if (rootPath === null) {
|
|
47
|
+
log(
|
|
48
|
+
"API-CLIENT",
|
|
49
|
+
"ensureProjectIdResolved: cwd not registered (.orchestrator sentinel not found) \u2014 skipping"
|
|
50
|
+
);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const resolved = await resolveProjectIdByPath(rootPath, token);
|
|
54
|
+
if (resolved) {
|
|
55
|
+
PROJECT_ID = resolved;
|
|
56
|
+
log(
|
|
57
|
+
"API-CLIENT",
|
|
58
|
+
`ensureProjectIdResolved: resolved projectId=${resolved} rootPath=${rootPath}`
|
|
59
|
+
);
|
|
60
|
+
} else {
|
|
61
|
+
log(
|
|
62
|
+
"API-CLIENT",
|
|
63
|
+
`ensureProjectIdResolved: rootPath=${rootPath} not registered to any project \u2014 skipping`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
} catch (err) {
|
|
67
|
+
log(
|
|
68
|
+
"API-CLIENT",
|
|
69
|
+
`ensureProjectIdResolved: unexpected failure \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function log(prefix, msg) {
|
|
74
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z");
|
|
75
|
+
try {
|
|
76
|
+
const line = `[${ts}] ${prefix}: ${msg}
|
|
77
|
+
`;
|
|
78
|
+
writeFileSync(DEBUG_LOG, line, { flag: "a" });
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function getCachedToken() {
|
|
83
|
+
try {
|
|
84
|
+
const stat = statSync(JWT_CACHE);
|
|
85
|
+
const ageMs = Date.now() - stat.mtimeMs;
|
|
86
|
+
if (ageMs < 35e5) {
|
|
87
|
+
return readFileSync(JWT_CACHE, "utf-8").trim();
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
async function login() {
|
|
94
|
+
try {
|
|
95
|
+
const resp = await fetch(`${API_URL}/api/v1/auth/login`, {
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
"X-Project-ID": PROJECT_ID
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify({ email: AUTH_EMAIL, password: AUTH_PASSWORD }),
|
|
102
|
+
signal: AbortSignal.timeout(5e3)
|
|
103
|
+
});
|
|
104
|
+
if (!resp.ok) return null;
|
|
105
|
+
const data = await resp.json();
|
|
106
|
+
const token = data.accessToken || data.data?.accessToken || "";
|
|
107
|
+
if (token) {
|
|
108
|
+
writeFileSync(JWT_CACHE, token);
|
|
109
|
+
}
|
|
110
|
+
return token || null;
|
|
111
|
+
} catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function getToken() {
|
|
116
|
+
const token = getCachedToken() || await login();
|
|
117
|
+
if (token) {
|
|
118
|
+
await ensureProjectIdResolved(token);
|
|
119
|
+
}
|
|
120
|
+
return token;
|
|
121
|
+
}
|
|
122
|
+
async function apiGet(path, token, timeoutMs = 5e3) {
|
|
123
|
+
try {
|
|
124
|
+
const resp = await fetch(`${API_URL}${path}`, {
|
|
125
|
+
headers: {
|
|
126
|
+
Authorization: `Bearer ${token}`,
|
|
127
|
+
"X-Project-ID": PROJECT_ID
|
|
128
|
+
},
|
|
129
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
130
|
+
});
|
|
131
|
+
if (!resp.ok) return null;
|
|
132
|
+
return await resp.json();
|
|
133
|
+
} catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function resolveProjectIdByPath(rootPath, token) {
|
|
138
|
+
const resp = await apiGet(
|
|
139
|
+
`/api/v1/projects/resolve?rootPath=${encodeURIComponent(rootPath)}`,
|
|
140
|
+
token
|
|
141
|
+
);
|
|
142
|
+
return resp?.projectId ?? null;
|
|
143
|
+
}
|
|
144
|
+
async function getActiveWorkflow() {
|
|
145
|
+
const token = await getToken();
|
|
146
|
+
if (!token) return null;
|
|
147
|
+
for (const status of ["in_progress", "awaiting_agent", "awaiting_approval"]) {
|
|
148
|
+
const resp = await apiGet(
|
|
149
|
+
`/api/v1/workflows?status=${status}&limit=1`,
|
|
150
|
+
token,
|
|
151
|
+
3e3
|
|
152
|
+
);
|
|
153
|
+
const list = resp?.data || (Array.isArray(resp) ? resp : null);
|
|
154
|
+
const wf = list?.[0];
|
|
155
|
+
if (wf?.id) return wf;
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
async function getWorkflowStatus(workflowId) {
|
|
160
|
+
const token = await getToken();
|
|
161
|
+
if (!token) return null;
|
|
162
|
+
return apiGet(`/api/v1/workflows/${workflowId}/status`, token);
|
|
163
|
+
}
|
|
164
|
+
var LAST_COMPLETED_FILE = join2(STATE_DIR, "last-completed-workflow.json");
|
|
165
|
+
var LAST_COMPLETED_TTL_MS = 60 * 60 * 1e3;
|
|
166
|
+
var INVOCATIONS_DIR = join2(STATE_DIR, "invocations");
|
|
167
|
+
var INVOCATION_STATE_TTL_MS = 4 * 60 * 60 * 1e3;
|
|
168
|
+
var DISPATCH_INTENT_DIR = join2(STATE_DIR, "dispatch-intent");
|
|
169
|
+
async function readStdin() {
|
|
170
|
+
const chunks = [];
|
|
171
|
+
for await (const chunk of process.stdin) {
|
|
172
|
+
chunks.push(chunk);
|
|
173
|
+
}
|
|
174
|
+
const raw = Buffer.concat(chunks).toString("utf-8").trim();
|
|
175
|
+
if (!raw) return {};
|
|
176
|
+
try {
|
|
177
|
+
return JSON.parse(raw);
|
|
178
|
+
} catch {
|
|
179
|
+
return {};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function getField(obj, path) {
|
|
183
|
+
const parts = path.split(".");
|
|
184
|
+
let current = obj;
|
|
185
|
+
for (const part of parts) {
|
|
186
|
+
if (current == null || typeof current !== "object") return "";
|
|
187
|
+
current = current[part];
|
|
188
|
+
}
|
|
189
|
+
return current != null ? String(current) : "";
|
|
190
|
+
}
|
|
191
|
+
function outputContext(hookEvent, context) {
|
|
192
|
+
console.log(
|
|
193
|
+
JSON.stringify({
|
|
194
|
+
hookSpecificOutput: {
|
|
195
|
+
hookEventName: hookEvent,
|
|
196
|
+
additionalContext: context
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// hooks/post-implement.ts
|
|
203
|
+
var HOOK = "POST-IMPLEMENT";
|
|
204
|
+
var POST_IMPLEMENT_PHASE = "review";
|
|
205
|
+
function isImplementCompleted(currentPhase) {
|
|
206
|
+
return (currentPhase ?? "").toLowerCase() === POST_IMPLEMENT_PHASE;
|
|
207
|
+
}
|
|
208
|
+
function buildPostImplementSignal(workflowId) {
|
|
209
|
+
return [
|
|
210
|
+
`[ORCHESTRATOR] IMPLEMENT completed for ${workflowId} \u2014 dispatch the docs-guardian sub-agent before proceeding past the IMPLEMENT gate.`,
|
|
211
|
+
`(RFC-034 System-A post-implement signal: docs-guardian checks documentation compliance against the DOCS-CONSTITUTION after implementation.)`
|
|
212
|
+
].join("\n");
|
|
213
|
+
}
|
|
214
|
+
async function main() {
|
|
215
|
+
const stdin = await readStdin();
|
|
216
|
+
const toolName = getField(stdin, "tool_name") || getField(stdin, "tool");
|
|
217
|
+
if (toolName && !toolName.includes("advancePhase")) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const wfId = getField(stdin, "tool_input.workflowId") || (await getActiveWorkflow())?.id || "";
|
|
221
|
+
if (!wfId) {
|
|
222
|
+
log(HOOK, "no workflow id resolvable \u2014 skip (fail-open)");
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const status = await getWorkflowStatus(wfId);
|
|
226
|
+
if (!status) {
|
|
227
|
+
log(HOOK, `no status for workflow ${wfId} \u2014 skip (fail-open)`);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const phase = (status.currentPhase || "").toLowerCase();
|
|
231
|
+
log(HOOK, `workflow=${wfId} post-advance currentPhase=${phase}`);
|
|
232
|
+
if (!isImplementCompleted(phase)) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
log(HOOK, `IMPLEMENT completed for ${wfId} \u2014 emitting docs-guardian dispatch signal`);
|
|
236
|
+
outputContext("PostToolUse", buildPostImplementSignal(wfId));
|
|
237
|
+
}
|
|
238
|
+
main().catch(() => process.exit(0));
|