@harness-engineering/cli 1.9.0 → 1.10.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/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +7 -2
- package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +10 -1
- package/dist/agents/skills/claude-code/harness-execution/SKILL.md +2 -2
- package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +7 -2
- package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +10 -1
- package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +2 -2
- package/dist/agents-md-EMRFLNBC.js +8 -0
- package/dist/architecture-5JNN5L3M.js +13 -0
- package/dist/bin/harness-mcp.d.ts +1 -0
- package/dist/bin/harness-mcp.js +28 -0
- package/dist/bin/harness.js +42 -8
- package/dist/check-phase-gate-WOKIYGAM.js +12 -0
- package/dist/chunk-46YA6FI3.js +293 -0
- package/dist/chunk-4PFMY3H7.js +248 -0
- package/dist/{chunk-6JIT7CEM.js → chunk-72GHBOL2.js} +1 -1
- package/dist/chunk-7X7ZAYMY.js +373 -0
- package/dist/chunk-B7HFEHWP.js +35 -0
- package/dist/chunk-BM3PWGXQ.js +14 -0
- package/dist/chunk-C2ERUR3L.js +255 -0
- package/dist/chunk-CWZ4Y2PO.js +189 -0
- package/dist/{chunk-ULSRSP53.js → chunk-ECUJQS3B.js} +11 -112
- package/dist/chunk-EOLRW32Q.js +72 -0
- package/dist/chunk-F3YDAJFQ.js +125 -0
- package/dist/chunk-F4PTVZWA.js +116 -0
- package/dist/chunk-FPIPT36X.js +187 -0
- package/dist/chunk-FX7SQHGD.js +103 -0
- package/dist/chunk-HIOXKZYF.js +15 -0
- package/dist/chunk-IDZNPTYD.js +16 -0
- package/dist/chunk-JSTQ3AWB.js +31 -0
- package/dist/chunk-K6XAPGML.js +27 -0
- package/dist/chunk-KET4QQZB.js +8 -0
- package/dist/chunk-LXU5M77O.js +4028 -0
- package/dist/chunk-MDUK2J2O.js +67 -0
- package/dist/chunk-MHBMTPW7.js +29 -0
- package/dist/chunk-MO4YQOMB.js +85 -0
- package/dist/chunk-NKDM3FMH.js +52 -0
- package/dist/{chunk-CGSHUJES.js → chunk-NX6DSZSM.js} +7 -26
- package/dist/chunk-OPXH4CQN.js +62 -0
- package/dist/{chunk-RTPHUDZS.js → chunk-PAHHT2IK.js} +466 -2714
- package/dist/chunk-PMTFPOCT.js +122 -0
- package/dist/chunk-PSXF277V.js +89 -0
- package/dist/chunk-Q6AB7W5Z.js +135 -0
- package/dist/chunk-QPEH2QPG.js +347 -0
- package/dist/chunk-TEFCFC4H.js +15 -0
- package/dist/chunk-TRAPF4IX.js +185 -0
- package/dist/chunk-VUCPTQ6G.js +67 -0
- package/dist/chunk-W6Y7ZW3Y.js +13 -0
- package/dist/chunk-ZOAWBDWU.js +72 -0
- package/dist/ci-workflow-ZBBUNTHQ.js +8 -0
- package/dist/constants-5JGUXPEK.js +6 -0
- package/dist/create-skill-LUWO46WF.js +11 -0
- package/dist/dist-D4RYGUZE.js +14 -0
- package/dist/dist-L7LAAQAS.js +18 -0
- package/dist/{dist-C5PYIQPF.js → dist-PBTNVK6K.js} +8 -6
- package/dist/docs-PTJGD6XI.js +12 -0
- package/dist/engine-SCMZ3G3E.js +8 -0
- package/dist/entropy-YIUBGKY7.js +12 -0
- package/dist/feedback-WEVQSLAA.js +18 -0
- package/dist/generate-agent-definitions-BU5LOJTI.js +15 -0
- package/dist/glob-helper-5OHBUQAI.js +52 -0
- package/dist/graph-loader-RLO3KRIX.js +8 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +84 -33
- package/dist/loader-6S6PVGSF.js +10 -0
- package/dist/mcp-BNLBTCXZ.js +34 -0
- package/dist/performance-5TVW6SA6.js +24 -0
- package/dist/review-pipeline-4JTQAWKW.js +9 -0
- package/dist/runner-VMYLHWOC.js +6 -0
- package/dist/runtime-PXIM7UV6.js +9 -0
- package/dist/security-URYTKLGK.js +9 -0
- package/dist/skill-executor-KVS47DAU.js +8 -0
- package/dist/validate-KSDUUK2M.js +12 -0
- package/dist/validate-cross-check-WZAX357V.js +8 -0
- package/dist/version-KFFPOQAX.js +6 -0
- package/package.json +6 -4
- package/dist/create-skill-UZOHMXRU.js +0 -8
- package/dist/validate-cross-check-VG573VZO.js +0 -7
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// src/persona/trigger-detector.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
function detectTrigger(projectPath) {
|
|
5
|
+
const handoffPath = path.join(projectPath, ".harness", "handoff.json");
|
|
6
|
+
if (!fs.existsSync(handoffPath)) {
|
|
7
|
+
return { trigger: "manual" };
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const raw = fs.readFileSync(handoffPath, "utf-8");
|
|
11
|
+
const handoff = JSON.parse(raw);
|
|
12
|
+
if (handoff.fromSkill === "harness-planning" && Array.isArray(handoff.pending) && handoff.pending.length > 0) {
|
|
13
|
+
return {
|
|
14
|
+
trigger: "on_plan_approved",
|
|
15
|
+
handoff: {
|
|
16
|
+
fromSkill: handoff.fromSkill,
|
|
17
|
+
summary: handoff.summary ?? "",
|
|
18
|
+
pending: handoff.pending,
|
|
19
|
+
planPath: handoff.planPath
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return { trigger: "manual" };
|
|
24
|
+
} catch {
|
|
25
|
+
return { trigger: "manual" };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/persona/runner.ts
|
|
30
|
+
var TIMEOUT_ERROR_MESSAGE = "__PERSONA_RUNNER_TIMEOUT__";
|
|
31
|
+
function stepName(step) {
|
|
32
|
+
return "command" in step ? step.command : step.skill;
|
|
33
|
+
}
|
|
34
|
+
function stepType(step) {
|
|
35
|
+
return "command" in step ? "command" : "skill";
|
|
36
|
+
}
|
|
37
|
+
function matchesTrigger(step, trigger) {
|
|
38
|
+
const when = step.when ?? "always";
|
|
39
|
+
return when === "always" || when === trigger;
|
|
40
|
+
}
|
|
41
|
+
function skipRemaining(activeSteps, fromIndex, report) {
|
|
42
|
+
for (let j = fromIndex; j < activeSteps.length; j++) {
|
|
43
|
+
const remaining = activeSteps[j];
|
|
44
|
+
report.steps.push({
|
|
45
|
+
name: stepName(remaining),
|
|
46
|
+
type: stepType(remaining),
|
|
47
|
+
status: "skipped",
|
|
48
|
+
durationMs: 0
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function runPersona(persona, context) {
|
|
53
|
+
const startTime = Date.now();
|
|
54
|
+
const timeout = persona.config.timeout;
|
|
55
|
+
const report = {
|
|
56
|
+
persona: persona.name.toLowerCase().replace(/\s+/g, "-"),
|
|
57
|
+
status: "pass",
|
|
58
|
+
steps: [],
|
|
59
|
+
totalDurationMs: 0
|
|
60
|
+
};
|
|
61
|
+
let resolvedTrigger;
|
|
62
|
+
let handoff = context.handoff;
|
|
63
|
+
if (context.trigger === "auto") {
|
|
64
|
+
const detection = detectTrigger(context.projectPath);
|
|
65
|
+
resolvedTrigger = detection.trigger;
|
|
66
|
+
handoff = detection.handoff ?? handoff;
|
|
67
|
+
} else {
|
|
68
|
+
resolvedTrigger = context.trigger;
|
|
69
|
+
}
|
|
70
|
+
const activeSteps = persona.steps.filter((s) => matchesTrigger(s, resolvedTrigger));
|
|
71
|
+
for (let i = 0; i < activeSteps.length; i++) {
|
|
72
|
+
const step = activeSteps[i];
|
|
73
|
+
if (Date.now() - startTime >= timeout) {
|
|
74
|
+
skipRemaining(activeSteps, i, report);
|
|
75
|
+
report.status = "partial";
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
const stepStart = Date.now();
|
|
79
|
+
const remainingTime = timeout - (Date.now() - startTime);
|
|
80
|
+
if ("command" in step) {
|
|
81
|
+
const result = await Promise.race([
|
|
82
|
+
context.commandExecutor(step.command),
|
|
83
|
+
new Promise(
|
|
84
|
+
(resolve) => setTimeout(
|
|
85
|
+
() => resolve({
|
|
86
|
+
ok: false,
|
|
87
|
+
error: new Error(TIMEOUT_ERROR_MESSAGE)
|
|
88
|
+
}),
|
|
89
|
+
remainingTime
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
]);
|
|
93
|
+
const durationMs = Date.now() - stepStart;
|
|
94
|
+
if (result.ok) {
|
|
95
|
+
report.steps.push({
|
|
96
|
+
name: step.command,
|
|
97
|
+
type: "command",
|
|
98
|
+
status: "pass",
|
|
99
|
+
result: result.value,
|
|
100
|
+
durationMs
|
|
101
|
+
});
|
|
102
|
+
} else if (result.error.message === TIMEOUT_ERROR_MESSAGE) {
|
|
103
|
+
report.steps.push({
|
|
104
|
+
name: step.command,
|
|
105
|
+
type: "command",
|
|
106
|
+
status: "skipped",
|
|
107
|
+
error: "timed out",
|
|
108
|
+
durationMs
|
|
109
|
+
});
|
|
110
|
+
report.status = "partial";
|
|
111
|
+
skipRemaining(activeSteps, i + 1, report);
|
|
112
|
+
break;
|
|
113
|
+
} else {
|
|
114
|
+
report.steps.push({
|
|
115
|
+
name: step.command,
|
|
116
|
+
type: "command",
|
|
117
|
+
status: "fail",
|
|
118
|
+
error: result.error.message,
|
|
119
|
+
durationMs
|
|
120
|
+
});
|
|
121
|
+
report.status = "fail";
|
|
122
|
+
skipRemaining(activeSteps, i + 1, report);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
const skillContext = {
|
|
127
|
+
trigger: resolvedTrigger,
|
|
128
|
+
projectPath: context.projectPath,
|
|
129
|
+
outputMode: step.output ?? "auto",
|
|
130
|
+
...handoff ? { handoff } : {}
|
|
131
|
+
};
|
|
132
|
+
const SKILL_TIMEOUT_RESULT = {
|
|
133
|
+
status: "fail",
|
|
134
|
+
output: "timed out",
|
|
135
|
+
durationMs: 0
|
|
136
|
+
};
|
|
137
|
+
const result = await Promise.race([
|
|
138
|
+
context.skillExecutor(step.skill, skillContext),
|
|
139
|
+
new Promise(
|
|
140
|
+
(resolve) => setTimeout(() => resolve(SKILL_TIMEOUT_RESULT), remainingTime)
|
|
141
|
+
)
|
|
142
|
+
]);
|
|
143
|
+
const durationMs = Date.now() - stepStart;
|
|
144
|
+
if (result === SKILL_TIMEOUT_RESULT) {
|
|
145
|
+
report.steps.push({
|
|
146
|
+
name: step.skill,
|
|
147
|
+
type: "skill",
|
|
148
|
+
status: "skipped",
|
|
149
|
+
error: "timed out",
|
|
150
|
+
durationMs
|
|
151
|
+
});
|
|
152
|
+
report.status = "partial";
|
|
153
|
+
skipRemaining(activeSteps, i + 1, report);
|
|
154
|
+
break;
|
|
155
|
+
} else if (result.status === "pass") {
|
|
156
|
+
report.steps.push({
|
|
157
|
+
name: step.skill,
|
|
158
|
+
type: "skill",
|
|
159
|
+
status: "pass",
|
|
160
|
+
result: result.output,
|
|
161
|
+
...result.artifactPath ? { artifactPath: result.artifactPath } : {},
|
|
162
|
+
durationMs
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
report.steps.push({
|
|
166
|
+
name: step.skill,
|
|
167
|
+
type: "skill",
|
|
168
|
+
status: "fail",
|
|
169
|
+
error: result.output,
|
|
170
|
+
durationMs
|
|
171
|
+
});
|
|
172
|
+
report.status = "fail";
|
|
173
|
+
skipRemaining(activeSteps, i + 1, report);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
report.totalDurationMs = Date.now() - startTime;
|
|
179
|
+
return report;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export {
|
|
183
|
+
detectTrigger,
|
|
184
|
+
runPersona
|
|
185
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Err,
|
|
3
|
+
Ok
|
|
4
|
+
} from "./chunk-MHBMTPW7.js";
|
|
5
|
+
|
|
6
|
+
// src/persona/generators/ci-workflow.ts
|
|
7
|
+
import YAML from "yaml";
|
|
8
|
+
function buildGitHubTriggers(triggers) {
|
|
9
|
+
const on = {};
|
|
10
|
+
for (const trigger of triggers) {
|
|
11
|
+
switch (trigger.event) {
|
|
12
|
+
case "on_pr": {
|
|
13
|
+
const prConfig = {};
|
|
14
|
+
if (trigger.conditions?.paths) prConfig.paths = trigger.conditions.paths;
|
|
15
|
+
on.pull_request = prConfig;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case "on_commit": {
|
|
19
|
+
const pushConfig = {};
|
|
20
|
+
if (trigger.conditions?.branches) pushConfig.branches = trigger.conditions.branches;
|
|
21
|
+
on.push = pushConfig;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case "scheduled":
|
|
25
|
+
on.schedule = [{ cron: trigger.cron }];
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return on;
|
|
30
|
+
}
|
|
31
|
+
function generateCIWorkflow(persona, platform) {
|
|
32
|
+
try {
|
|
33
|
+
if (platform === "gitlab") return Err(new Error("GitLab CI generation is not yet supported"));
|
|
34
|
+
const severity = persona.config.severity;
|
|
35
|
+
const steps = [
|
|
36
|
+
{ uses: "actions/checkout@v4" },
|
|
37
|
+
{ uses: "actions/setup-node@v4", with: { "node-version": "20" } },
|
|
38
|
+
{ uses: "pnpm/action-setup@v4", with: { run_install: "frozen" } }
|
|
39
|
+
];
|
|
40
|
+
const commandSteps = persona.steps.filter((s) => "command" in s);
|
|
41
|
+
for (const step of commandSteps) {
|
|
42
|
+
const severityFlag = severity ? ` --severity ${severity}` : "";
|
|
43
|
+
steps.push({ run: `npx harness ${step.command}${severityFlag}` });
|
|
44
|
+
}
|
|
45
|
+
const workflow = {
|
|
46
|
+
name: persona.name,
|
|
47
|
+
on: buildGitHubTriggers(persona.triggers),
|
|
48
|
+
jobs: {
|
|
49
|
+
enforce: {
|
|
50
|
+
"runs-on": "ubuntu-latest",
|
|
51
|
+
steps
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return Ok(YAML.stringify(workflow, { lineWidth: 0 }));
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return Err(
|
|
58
|
+
new Error(
|
|
59
|
+
`Failed to generate CI workflow: ${error instanceof Error ? error.message : String(error)}`
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
generateCIWorkflow
|
|
67
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/mcp/utils/sanitize-path.ts
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
function sanitizePath(inputPath) {
|
|
4
|
+
const resolved = path.resolve(inputPath);
|
|
5
|
+
if (resolved === "/" || resolved === path.parse(resolved).root) {
|
|
6
|
+
throw new Error("Invalid project path: cannot use filesystem root");
|
|
7
|
+
}
|
|
8
|
+
return resolved;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
sanitizePath
|
|
13
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// src/slash-commands/types.ts
|
|
2
|
+
var VALID_PLATFORMS = ["claude-code", "gemini-cli"];
|
|
3
|
+
var GENERATED_HEADER_CLAUDE = "<!-- Generated by harness generate-slash-commands. Do not edit. -->";
|
|
4
|
+
var GENERATED_HEADER_GEMINI = "# Generated by harness generate-slash-commands. Do not edit.";
|
|
5
|
+
|
|
6
|
+
// src/slash-commands/sync.ts
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
10
|
+
// src/agent-definitions/constants.ts
|
|
11
|
+
var GENERATED_HEADER_AGENT = "<!-- Generated by harness generate-agent-definitions. Do not edit. -->";
|
|
12
|
+
|
|
13
|
+
// src/slash-commands/sync.ts
|
|
14
|
+
function computeSyncPlan(outputDir, rendered) {
|
|
15
|
+
const added = [];
|
|
16
|
+
const updated = [];
|
|
17
|
+
const removed = [];
|
|
18
|
+
const unchanged = [];
|
|
19
|
+
for (const [filename, content] of rendered) {
|
|
20
|
+
const filePath = path.join(outputDir, filename);
|
|
21
|
+
if (!fs.existsSync(filePath)) {
|
|
22
|
+
added.push(filename);
|
|
23
|
+
} else {
|
|
24
|
+
const existing = fs.readFileSync(filePath, "utf-8");
|
|
25
|
+
if (existing === content) {
|
|
26
|
+
unchanged.push(filename);
|
|
27
|
+
} else {
|
|
28
|
+
updated.push(filename);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (fs.existsSync(outputDir)) {
|
|
33
|
+
const existing = fs.readdirSync(outputDir).filter((f) => {
|
|
34
|
+
const stat = fs.statSync(path.join(outputDir, f));
|
|
35
|
+
return stat.isFile();
|
|
36
|
+
});
|
|
37
|
+
for (const filename of existing) {
|
|
38
|
+
if (rendered.has(filename)) continue;
|
|
39
|
+
const content = fs.readFileSync(path.join(outputDir, filename), "utf-8");
|
|
40
|
+
if (content.includes(GENERATED_HEADER_CLAUDE) || content.includes(GENERATED_HEADER_GEMINI) || content.includes(GENERATED_HEADER_AGENT)) {
|
|
41
|
+
removed.push(filename);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return { added, updated, removed, unchanged };
|
|
46
|
+
}
|
|
47
|
+
function applySyncPlan(outputDir, rendered, plan, deleteOrphans) {
|
|
48
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
49
|
+
for (const filename of [...plan.added, ...plan.updated]) {
|
|
50
|
+
const content = rendered.get(filename);
|
|
51
|
+
if (content !== void 0) {
|
|
52
|
+
fs.writeFileSync(path.join(outputDir, filename), content);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (deleteOrphans) {
|
|
56
|
+
for (const filename of plan.removed) {
|
|
57
|
+
const filePath = path.join(outputDir, filename);
|
|
58
|
+
if (fs.existsSync(filePath)) {
|
|
59
|
+
fs.unlinkSync(filePath);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
VALID_PLATFORMS,
|
|
67
|
+
GENERATED_HEADER_CLAUDE,
|
|
68
|
+
GENERATED_HEADER_GEMINI,
|
|
69
|
+
GENERATED_HEADER_AGENT,
|
|
70
|
+
computeSyncPlan,
|
|
71
|
+
applySyncPlan
|
|
72
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LinterConfigSchema,
|
|
3
|
+
ParseError,
|
|
4
|
+
RuleConfigSchema,
|
|
5
|
+
TemplateError,
|
|
6
|
+
TemplateLoadError,
|
|
7
|
+
generate,
|
|
8
|
+
validate
|
|
9
|
+
} from "./chunk-QPEH2QPG.js";
|
|
10
|
+
export {
|
|
11
|
+
LinterConfigSchema,
|
|
12
|
+
ParseError,
|
|
13
|
+
RuleConfigSchema,
|
|
14
|
+
TemplateError,
|
|
15
|
+
TemplateLoadError,
|
|
16
|
+
generate,
|
|
17
|
+
validate
|
|
18
|
+
};
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
EmitInteractionInputSchema,
|
|
18
18
|
EntropyAnalyzer,
|
|
19
19
|
EntropyConfigSchema,
|
|
20
|
-
Err,
|
|
21
20
|
ExclusionSet,
|
|
22
21
|
FailureEntrySchema,
|
|
23
22
|
FileSink,
|
|
@@ -29,14 +28,12 @@ import {
|
|
|
29
28
|
NoOpExecutor,
|
|
30
29
|
NoOpSink,
|
|
31
30
|
NoOpTelemetryAdapter,
|
|
32
|
-
Ok,
|
|
33
31
|
PatternConfigSchema,
|
|
34
32
|
QuestionSchema,
|
|
35
33
|
REQUIRED_SECTIONS,
|
|
36
34
|
RegressionDetector,
|
|
37
35
|
RuleRegistry,
|
|
38
36
|
SECURITY_DESCRIPTOR,
|
|
39
|
-
STANDARD_COGNITIVE_MODES,
|
|
40
37
|
SecurityConfigSchema,
|
|
41
38
|
SecurityScanner,
|
|
42
39
|
StreamIndexSchema,
|
|
@@ -104,8 +101,6 @@ import {
|
|
|
104
101
|
getUpdateNotification,
|
|
105
102
|
goRules,
|
|
106
103
|
injectionRules,
|
|
107
|
-
isErr,
|
|
108
|
-
isOk,
|
|
109
104
|
isSmallSuggestion,
|
|
110
105
|
isUpdateCheckEnabled,
|
|
111
106
|
listStreams,
|
|
@@ -165,7 +160,14 @@ import {
|
|
|
165
160
|
validateKnowledgeMap,
|
|
166
161
|
validatePatternConfig,
|
|
167
162
|
xssRules
|
|
168
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-NX6DSZSM.js";
|
|
164
|
+
import {
|
|
165
|
+
Err,
|
|
166
|
+
Ok,
|
|
167
|
+
STANDARD_COGNITIVE_MODES,
|
|
168
|
+
isErr,
|
|
169
|
+
isOk
|
|
170
|
+
} from "./chunk-MHBMTPW7.js";
|
|
169
171
|
export {
|
|
170
172
|
AGENT_DESCRIPTORS,
|
|
171
173
|
ARCHITECTURE_DESCRIPTOR,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkDocsDefinition,
|
|
3
|
+
handleCheckDocs
|
|
4
|
+
} from "./chunk-F4PTVZWA.js";
|
|
5
|
+
import "./chunk-IDZNPTYD.js";
|
|
6
|
+
import "./chunk-W6Y7ZW3Y.js";
|
|
7
|
+
import "./chunk-NX6DSZSM.js";
|
|
8
|
+
import "./chunk-MHBMTPW7.js";
|
|
9
|
+
export {
|
|
10
|
+
checkDocsDefinition,
|
|
11
|
+
handleCheckDocs
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectEntropyDefinition,
|
|
3
|
+
handleDetectEntropy
|
|
4
|
+
} from "./chunk-CWZ4Y2PO.js";
|
|
5
|
+
import "./chunk-IDZNPTYD.js";
|
|
6
|
+
import "./chunk-W6Y7ZW3Y.js";
|
|
7
|
+
import "./chunk-NX6DSZSM.js";
|
|
8
|
+
import "./chunk-MHBMTPW7.js";
|
|
9
|
+
export {
|
|
10
|
+
detectEntropyDefinition,
|
|
11
|
+
handleDetectEntropy
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
analyzeDiffDefinition,
|
|
3
|
+
createSelfReviewDefinition,
|
|
4
|
+
handleAnalyzeDiff,
|
|
5
|
+
handleCreateSelfReview,
|
|
6
|
+
handleRequestPeerReview,
|
|
7
|
+
requestPeerReviewDefinition
|
|
8
|
+
} from "./chunk-4PFMY3H7.js";
|
|
9
|
+
import "./chunk-IDZNPTYD.js";
|
|
10
|
+
import "./chunk-W6Y7ZW3Y.js";
|
|
11
|
+
export {
|
|
12
|
+
analyzeDiffDefinition,
|
|
13
|
+
createSelfReviewDefinition,
|
|
14
|
+
handleAnalyzeDiff,
|
|
15
|
+
handleCreateSelfReview,
|
|
16
|
+
handleRequestPeerReview,
|
|
17
|
+
requestPeerReviewDefinition
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createGenerateAgentDefinitionsCommand,
|
|
3
|
+
generateAgentDefinitions
|
|
4
|
+
} from "./chunk-46YA6FI3.js";
|
|
5
|
+
import "./chunk-Q6AB7W5Z.js";
|
|
6
|
+
import "./chunk-KET4QQZB.js";
|
|
7
|
+
import "./chunk-ZOAWBDWU.js";
|
|
8
|
+
import "./chunk-EOLRW32Q.js";
|
|
9
|
+
import "./chunk-B7HFEHWP.js";
|
|
10
|
+
import "./chunk-NX6DSZSM.js";
|
|
11
|
+
import "./chunk-MHBMTPW7.js";
|
|
12
|
+
export {
|
|
13
|
+
createGenerateAgentDefinitionsCommand,
|
|
14
|
+
generateAgentDefinitions
|
|
15
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/mcp/utils/glob-helper.ts
|
|
2
|
+
import * as fs from "fs/promises";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".go", ".py"]);
|
|
5
|
+
function globToRegex(pattern) {
|
|
6
|
+
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "\xA7\xA7").replace(/\*/g, "[^/]*").replace(/§§/g, ".*");
|
|
7
|
+
return new RegExp(escaped);
|
|
8
|
+
}
|
|
9
|
+
function isExcluded(relativePath, excludeRegexes) {
|
|
10
|
+
for (const regex of excludeRegexes) {
|
|
11
|
+
if (regex.test(relativePath)) return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", ".nuxt", "__pycache__"]);
|
|
16
|
+
async function globFiles(rootDir, exclude) {
|
|
17
|
+
const patterns = exclude ?? [
|
|
18
|
+
"**/node_modules/**",
|
|
19
|
+
"**/dist/**",
|
|
20
|
+
"**/*.test.ts",
|
|
21
|
+
"**/fixtures/**"
|
|
22
|
+
];
|
|
23
|
+
const excludeRegexes = patterns.map(globToRegex);
|
|
24
|
+
const files = [];
|
|
25
|
+
async function walk(dir) {
|
|
26
|
+
let entries;
|
|
27
|
+
try {
|
|
28
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
29
|
+
} catch {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
const fullPath = path.join(dir, entry.name);
|
|
34
|
+
const relativePath = path.relative(rootDir, fullPath);
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
if (SKIP_DIRS.has(entry.name)) continue;
|
|
37
|
+
if (isExcluded(relativePath + "/", excludeRegexes)) continue;
|
|
38
|
+
await walk(fullPath);
|
|
39
|
+
} else if (entry.isFile()) {
|
|
40
|
+
const ext = path.extname(entry.name);
|
|
41
|
+
if (!SOURCE_EXTENSIONS.has(ext)) continue;
|
|
42
|
+
if (isExcluded(relativePath, excludeRegexes)) continue;
|
|
43
|
+
files.push(fullPath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
await walk(rootDir);
|
|
48
|
+
return files;
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
globFiles
|
|
52
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Command } from 'commander';
|
|
|
2
2
|
import { ContextQLResult, IngestResult } from '@harness-engineering/graph';
|
|
3
3
|
import { Result } from '@harness-engineering/core';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
6
|
|
|
6
7
|
interface Phase {
|
|
7
8
|
name: string;
|
|
@@ -987,6 +988,15 @@ declare function renderClaudeCodeAgent(def: AgentDefinition): string;
|
|
|
987
988
|
|
|
988
989
|
declare function renderGeminiAgent(def: AgentDefinition): string;
|
|
989
990
|
|
|
991
|
+
type ToolDefinition = {
|
|
992
|
+
name: string;
|
|
993
|
+
description: string;
|
|
994
|
+
inputSchema: Record<string, unknown>;
|
|
995
|
+
};
|
|
996
|
+
declare function getToolDefinitions(): ToolDefinition[];
|
|
997
|
+
declare function createHarnessServer(projectRoot?: string): Server;
|
|
998
|
+
declare function startServer(): Promise<void>;
|
|
999
|
+
|
|
990
1000
|
declare function createProgram(): Command;
|
|
991
1001
|
|
|
992
|
-
export { AGENT_DESCRIPTIONS, ALLOWED_PERSONA_COMMANDS, type AgentDefinition, CLIError, type CommandExecutor, type CommandStep, type CreateSkillOptions, DEFAULT_TOOLS, ExitCode, GEMINI_TOOL_MAP, type GenerateAgentDefsOptions, type GenerateAgentDefsResult, type GenerateResult, type HandoffContext, type HarnessConfig, OutputFormatter, OutputMode, type Persona, type PersonaMetadata, type PersonaRunReport, type RenderedFiles, type SkillExecutionContext, type SkillExecutionResult, type SkillExecutor, type SkillSource, type SkillStep, type Step, type StepExecutionContext, type StepReport, type TemplateContext, TemplateEngine, type TriggerContext, type TriggerDetectionResult, buildPreamble, createProgram, detectTrigger, executeSkill, findConfigFile, generateAgentDefinition, generateAgentDefinitions, generateAgentsMd, generateCIWorkflow, generateRuntime, generateSkillFiles, generateSlashCommands, handleError, listPersonas, loadConfig, loadPersona, logger, renderClaudeCodeAgent, renderGeminiAgent, resolveConfig, runCheckPhaseGate, runCrossCheck, runGraphExport, runGraphStatus, runIngest, runPersona, runQuery, runScan };
|
|
1002
|
+
export { AGENT_DESCRIPTIONS, ALLOWED_PERSONA_COMMANDS, type AgentDefinition, CLIError, type CommandExecutor, type CommandStep, type CreateSkillOptions, DEFAULT_TOOLS, ExitCode, GEMINI_TOOL_MAP, type GenerateAgentDefsOptions, type GenerateAgentDefsResult, type GenerateResult, type HandoffContext, type HarnessConfig, OutputFormatter, OutputMode, type Persona, type PersonaMetadata, type PersonaRunReport, type RenderedFiles, type SkillExecutionContext, type SkillExecutionResult, type SkillExecutor, type SkillSource, type SkillStep, type Step, type StepExecutionContext, type StepReport, type TemplateContext, TemplateEngine, type TriggerContext, type TriggerDetectionResult, buildPreamble, createHarnessServer, createProgram, detectTrigger, executeSkill, findConfigFile, generateAgentDefinition, generateAgentDefinitions, generateAgentsMd, generateCIWorkflow, generateRuntime, generateSkillFiles, generateSlashCommands, getToolDefinitions, handleError, listPersonas, loadConfig, loadPersona, logger, renderClaudeCodeAgent, renderGeminiAgent, resolveConfig, runCheckPhaseGate, runCrossCheck, runGraphExport, runGraphStatus, runIngest, runPersona, runQuery, runScan, startServer };
|