@sweny-ai/core 0.1.77 → 0.1.79
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/browser.d.ts +11 -5
- package/dist/browser.js +11 -11
- package/dist/claude.d.ts +16 -0
- package/dist/claude.js +98 -9
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/config.js +56 -9
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +56 -57
- package/dist/cli/marketplace.js +35 -9
- package/dist/cli/publish.d.ts +10 -0
- package/dist/cli/publish.js +22 -14
- package/dist/loader.d.ts +40 -0
- package/dist/loader.js +73 -0
- package/dist/mcp-catalog.d.ts +47 -0
- package/dist/mcp-catalog.js +304 -0
- package/dist/mcp.d.ts +6 -9
- package/dist/mcp.js +24 -314
- package/dist/schema.d.ts +183 -151
- package/dist/schema.js +49 -7
- package/dist/skills/custom-loader.d.ts +40 -0
- package/dist/skills/custom-loader.js +107 -32
- package/dist/skills/index.d.ts +13 -1
- package/dist/skills/index.js +12 -3
- package/dist/studio.js +4 -1
- package/dist/templates.d.ts +29 -8
- package/dist/templates.js +30 -20
- package/dist/types.d.ts +12 -0
- package/dist/verify.js +96 -7
- package/package.json +8 -4
- package/dist/__tests__/cascade.test.d.ts +0 -11
- package/dist/__tests__/cascade.test.js +0 -452
- package/dist/__tests__/claude.test.d.ts +0 -1
- package/dist/__tests__/claude.test.js +0 -427
- package/dist/__tests__/custom-loader.test.d.ts +0 -1
- package/dist/__tests__/custom-loader.test.js +0 -116
- package/dist/__tests__/executor.test.d.ts +0 -1
- package/dist/__tests__/executor.test.js +0 -1635
- package/dist/__tests__/integration/datadog.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/datadog.integration.test.js +0 -23
- package/dist/__tests__/integration/e2e-workflow.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/e2e-workflow.integration.test.js +0 -75
- package/dist/__tests__/integration/github.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/github.integration.test.js +0 -37
- package/dist/__tests__/integration/harness.d.ts +0 -24
- package/dist/__tests__/integration/harness.js +0 -34
- package/dist/__tests__/integration/linear.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/linear.integration.test.js +0 -15
- package/dist/__tests__/integration/sentry.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/sentry.integration.test.js +0 -20
- package/dist/__tests__/integration/slack.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/slack.integration.test.js +0 -22
- package/dist/__tests__/integration/sources.integration.test.d.ts +0 -1
- package/dist/__tests__/integration/sources.integration.test.js +0 -123
- package/dist/__tests__/publish.test.d.ts +0 -1
- package/dist/__tests__/publish.test.js +0 -180
- package/dist/__tests__/requires.test.d.ts +0 -1
- package/dist/__tests__/requires.test.js +0 -82
- package/dist/__tests__/retry.test.d.ts +0 -1
- package/dist/__tests__/retry.test.js +0 -213
- package/dist/__tests__/schema.test.d.ts +0 -1
- package/dist/__tests__/schema.test.js +0 -600
- package/dist/__tests__/skill-config-integration.test.d.ts +0 -1
- package/dist/__tests__/skill-config-integration.test.js +0 -204
- package/dist/__tests__/skills-index.test.d.ts +0 -1
- package/dist/__tests__/skills-index.test.js +0 -119
- package/dist/__tests__/skills.test.d.ts +0 -1
- package/dist/__tests__/skills.test.js +0 -565
- package/dist/__tests__/spec-conformance.test.d.ts +0 -18
- package/dist/__tests__/spec-conformance.test.js +0 -1084
- package/dist/__tests__/studio.test.d.ts +0 -1
- package/dist/__tests__/studio.test.js +0 -403
- package/dist/__tests__/templates.test.d.ts +0 -1
- package/dist/__tests__/templates.test.js +0 -49
- package/dist/__tests__/testing.test.d.ts +0 -1
- package/dist/__tests__/testing.test.js +0 -242
- package/dist/__tests__/verify.test.d.ts +0 -1
- package/dist/__tests__/verify.test.js +0 -517
- package/dist/__tests__/version-consistency.test.d.ts +0 -1
- package/dist/__tests__/version-consistency.test.js +0 -312
- package/dist/__tests__/workflow-builder.test.d.ts +0 -1
- package/dist/__tests__/workflow-builder.test.js +0 -110
- package/dist/__tests__/workflow-yaml.test.d.ts +0 -1
- package/dist/__tests__/workflow-yaml.test.js +0 -201
- package/dist/cli/__tests__/diagram.test.d.ts +0 -1
- package/dist/cli/__tests__/diagram.test.js +0 -225
- package/dist/cli/__tests__/report-cloud.test.d.ts +0 -1
- package/dist/cli/__tests__/report-cloud.test.js +0 -165
- package/dist/cli/__tests__/upgrade.test.d.ts +0 -1
- package/dist/cli/__tests__/upgrade.test.js +0 -317
- package/dist/cli/__tests__/version-check.test.d.ts +0 -1
- package/dist/cli/__tests__/version-check.test.js +0 -209
- package/dist/cli/config.test.d.ts +0 -1
- package/dist/cli/config.test.js +0 -200
- package/dist/cli/credentials.test.d.ts +0 -1
- package/dist/cli/credentials.test.js +0 -172
- package/dist/cli/e2e.test.d.ts +0 -1
- package/dist/cli/e2e.test.js +0 -690
- package/dist/cli/marketplace.test.d.ts +0 -1
- package/dist/cli/marketplace.test.js +0 -355
- package/dist/cli/new.test.d.ts +0 -1
- package/dist/cli/new.test.js +0 -1043
- package/dist/cli/output.test.d.ts +0 -1
- package/dist/cli/output.test.js +0 -180
- package/dist/cli/publish.test.d.ts +0 -1
- package/dist/cli/publish.test.js +0 -610
- package/dist/cli/renderer.test.d.ts +0 -1
- package/dist/cli/renderer.test.js +0 -302
- package/dist/executor.test.d.ts +0 -1
- package/dist/executor.test.js +0 -618
- package/dist/mcp.test.d.ts +0 -1
- package/dist/mcp.test.js +0 -735
- package/dist/mermaid.test.d.ts +0 -1
- package/dist/mermaid.test.js +0 -256
- package/dist/sources.test.d.ts +0 -1
- package/dist/sources.test.js +0 -265
- package/dist/sources.validation.test.d.ts +0 -12
- package/dist/sources.validation.test.js +0 -380
- package/dist/workflow-builder.test.d.ts +0 -1
- package/dist/workflow-builder.test.js +0 -123
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli/output.test.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { formatDagResultMarkdown } from "./output.js";
|
|
3
|
-
import { triageWorkflow } from "../workflows/index.js";
|
|
4
|
-
function success(data = {}) {
|
|
5
|
-
return { status: "success", data, toolCalls: [] };
|
|
6
|
-
}
|
|
7
|
-
function failed(data = {}) {
|
|
8
|
-
return { status: "failed", data, toolCalls: [] };
|
|
9
|
-
}
|
|
10
|
-
function minimalConfig(overrides = {}) {
|
|
11
|
-
return {
|
|
12
|
-
timeRange: "6h",
|
|
13
|
-
serviceFilter: "permit-service",
|
|
14
|
-
repository: "acme/app",
|
|
15
|
-
observabilityProviders: ["betterstack"],
|
|
16
|
-
issueTrackerProvider: "linear",
|
|
17
|
-
dryRun: false,
|
|
18
|
-
...overrides,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/** Build a minimal fake workflow for tests that don't need the full triage graph. */
|
|
22
|
-
function fakeWorkflow() {
|
|
23
|
-
return {
|
|
24
|
-
id: "test",
|
|
25
|
-
name: "Test Workflow",
|
|
26
|
-
description: "Minimal fixture for output.test.ts — not a real DAG.",
|
|
27
|
-
entry: "investigate",
|
|
28
|
-
nodes: {
|
|
29
|
-
investigate: { name: "Investigate", instruction: "noop", skills: [] },
|
|
30
|
-
create_issue: { name: "Create Issue", instruction: "noop", skills: [] },
|
|
31
|
-
create_pr: { name: "Open PR", instruction: "noop", skills: [] },
|
|
32
|
-
},
|
|
33
|
-
edges: [
|
|
34
|
-
{ from: "investigate", to: "create_issue" },
|
|
35
|
-
{ from: "create_issue", to: "create_pr" },
|
|
36
|
-
],
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function fakeTrace(steps) {
|
|
40
|
-
return {
|
|
41
|
-
steps: steps.map((s) => ({
|
|
42
|
-
node: s.node,
|
|
43
|
-
status: "success",
|
|
44
|
-
iteration: s.iteration ?? 1,
|
|
45
|
-
})),
|
|
46
|
-
edges: [],
|
|
47
|
-
sources: {},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
describe("formatDagResultMarkdown", () => {
|
|
51
|
-
it("renders a success header with issue + PR when both exist", () => {
|
|
52
|
-
const results = new Map([
|
|
53
|
-
[
|
|
54
|
-
"investigate",
|
|
55
|
-
success({ novel_count: 1, highest_severity: "high", findings: [{ severity: "high", title: "500 on /parse" }] }),
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
"create_issue",
|
|
59
|
-
success({
|
|
60
|
-
issueIdentifier: "OFF-1234",
|
|
61
|
-
issueTitle: "Parse failure",
|
|
62
|
-
issueUrl: "https://linear.app/acme/issue/OFF-1234",
|
|
63
|
-
}),
|
|
64
|
-
],
|
|
65
|
-
["create_pr", success({ prNumber: 42, prUrl: "https://github.com/acme/app/pull/42" })],
|
|
66
|
-
]);
|
|
67
|
-
const md = formatDagResultMarkdown(results, 15_000, minimalConfig());
|
|
68
|
-
expect(md).toContain("## ✅ SWEny Triage — PR opened");
|
|
69
|
-
expect(md).toContain("| Duration | 15s |");
|
|
70
|
-
expect(md).toContain("| Service filter | `permit-service` |");
|
|
71
|
-
expect(md).toContain("| Highest severity | high |");
|
|
72
|
-
expect(md).toContain("OFF-1234");
|
|
73
|
-
expect(md).toContain("https://linear.app/acme/issue/OFF-1234");
|
|
74
|
-
expect(md).toContain("#42");
|
|
75
|
-
expect(md).toContain("https://github.com/acme/app/pull/42");
|
|
76
|
-
expect(md).toContain("**Issue created:**");
|
|
77
|
-
expect(md).toContain("**PR opened:**");
|
|
78
|
-
});
|
|
79
|
-
it("renders an issue-only result when no PR was opened", () => {
|
|
80
|
-
const results = new Map([
|
|
81
|
-
["investigate", success({ novel_count: 1, highest_severity: "medium" })],
|
|
82
|
-
[
|
|
83
|
-
"create_issue",
|
|
84
|
-
success({ issueIdentifier: "OFF-5", issueTitle: "Investigate warning", issueUrl: "https://linear.app/x/5" }),
|
|
85
|
-
],
|
|
86
|
-
]);
|
|
87
|
-
const md = formatDagResultMarkdown(results, 5_000, minimalConfig());
|
|
88
|
-
expect(md).toContain("## ✅ SWEny Triage — Issue created");
|
|
89
|
-
expect(md).toContain("OFF-5");
|
|
90
|
-
expect(md).not.toContain("**PR opened:**");
|
|
91
|
-
});
|
|
92
|
-
it("renders a clean no-incident result when novel_count is 0", () => {
|
|
93
|
-
const results = new Map([["investigate", success({ novel_count: 0 })]]);
|
|
94
|
-
const md = formatDagResultMarkdown(results, 3_000, minimalConfig());
|
|
95
|
-
expect(md).toContain("## ✅ SWEny Triage — No new incidents");
|
|
96
|
-
expect(md).toContain("| Novel findings | 0 |");
|
|
97
|
-
});
|
|
98
|
-
it("renders a findings table in dry-run mode", () => {
|
|
99
|
-
const results = new Map([
|
|
100
|
-
[
|
|
101
|
-
"investigate",
|
|
102
|
-
success({
|
|
103
|
-
novel_count: 2,
|
|
104
|
-
highest_severity: "high",
|
|
105
|
-
findings: [
|
|
106
|
-
{ severity: "high", title: "OOM in worker", is_duplicate: false, fix_complexity: "medium" },
|
|
107
|
-
{ severity: "low", title: "Stale metric", is_duplicate: true, duplicate_of: "OFF-99" },
|
|
108
|
-
],
|
|
109
|
-
}),
|
|
110
|
-
],
|
|
111
|
-
]);
|
|
112
|
-
const md = formatDagResultMarkdown(results, 9_000, minimalConfig({ dryRun: true }));
|
|
113
|
-
expect(md).toContain("## 🔍 SWEny Triage — Dry run complete");
|
|
114
|
-
expect(md).toContain("| # | Severity | Title | Complexity | Status |");
|
|
115
|
-
expect(md).toContain("| 1 | high | OOM in worker | medium | novel |");
|
|
116
|
-
expect(md).toContain("| 2 | low | Stale metric | — | dup of OFF-99 |");
|
|
117
|
-
expect(md).toContain("_Dry run mode — no side effects were taken._");
|
|
118
|
-
expect(md).toContain("| Mode | dry run |");
|
|
119
|
-
});
|
|
120
|
-
it("renders a failure summary when a node failed", () => {
|
|
121
|
-
const results = new Map([
|
|
122
|
-
["gather", success()],
|
|
123
|
-
["investigate", failed({ error: "Rate limited by Anthropic API" })],
|
|
124
|
-
]);
|
|
125
|
-
const md = formatDagResultMarkdown(results, 2_000, minimalConfig());
|
|
126
|
-
expect(md).toContain("## ❌ SWEny Triage Failed");
|
|
127
|
-
expect(md).toContain("**Failed at:** `investigate`");
|
|
128
|
-
expect(md).toContain("Rate limited by Anthropic API");
|
|
129
|
-
});
|
|
130
|
-
it("escapes pipe characters in finding titles so the table stays valid", () => {
|
|
131
|
-
const results = new Map([
|
|
132
|
-
[
|
|
133
|
-
"investigate",
|
|
134
|
-
success({
|
|
135
|
-
novel_count: 1,
|
|
136
|
-
findings: [{ severity: "high", title: "broken | pipe | title" }],
|
|
137
|
-
}),
|
|
138
|
-
],
|
|
139
|
-
]);
|
|
140
|
-
const md = formatDagResultMarkdown(results, 1_000, minimalConfig({ dryRun: true }));
|
|
141
|
-
expect(md).toContain("broken \\| pipe \\| title");
|
|
142
|
-
});
|
|
143
|
-
it("embeds a mermaid workflow diagram when workflow is supplied", () => {
|
|
144
|
-
const results = new Map([
|
|
145
|
-
["investigate", success({ novel_count: 0 })],
|
|
146
|
-
["create_issue", success({ issueIdentifier: "OFF-7", issueUrl: "https://linear.app/x/7" })],
|
|
147
|
-
]);
|
|
148
|
-
const workflow = fakeWorkflow();
|
|
149
|
-
const md = formatDagResultMarkdown(results, 4_000, minimalConfig(), { workflow });
|
|
150
|
-
expect(md).toContain("```mermaid");
|
|
151
|
-
expect(md).toContain("graph TB");
|
|
152
|
-
expect(md).toContain("title: Test Workflow");
|
|
153
|
-
// Status classes should be applied for nodes that ran successfully
|
|
154
|
-
expect(md).toContain("class investigate,create_issue success");
|
|
155
|
-
});
|
|
156
|
-
it("renders the workflow path and iteration counts from the execution trace", () => {
|
|
157
|
-
const results = new Map([
|
|
158
|
-
["investigate", success({ novel_count: 1 })],
|
|
159
|
-
["create_issue", success({ issueIdentifier: "OFF-8" })],
|
|
160
|
-
]);
|
|
161
|
-
const workflow = fakeWorkflow();
|
|
162
|
-
const trace = fakeTrace([
|
|
163
|
-
{ node: "investigate" },
|
|
164
|
-
{ node: "create_issue" },
|
|
165
|
-
{ node: "create_issue", iteration: 2 },
|
|
166
|
-
]);
|
|
167
|
-
const md = formatDagResultMarkdown(results, 8_000, minimalConfig(), { workflow, trace });
|
|
168
|
-
expect(md).toContain("**Workflow path:** `investigate` → `create_issue` → `create_issue ×2`");
|
|
169
|
-
});
|
|
170
|
-
it("accepts the real triageWorkflow without throwing", () => {
|
|
171
|
-
// Regression guard: the real workflow must serialise cleanly through toMermaidBlock
|
|
172
|
-
// so we do not ship a broken diagram to every downstream consumer.
|
|
173
|
-
const results = new Map([["investigate", success({ novel_count: 0 })]]);
|
|
174
|
-
const md = formatDagResultMarkdown(results, 1_000, minimalConfig(), {
|
|
175
|
-
workflow: triageWorkflow,
|
|
176
|
-
});
|
|
177
|
-
expect(md).toContain("```mermaid");
|
|
178
|
-
expect(md).toContain(`title: ${triageWorkflow.name}`);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|