@sweny-ai/core 0.1.77 → 0.1.78

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.
Files changed (119) hide show
  1. package/dist/browser.d.ts +11 -5
  2. package/dist/browser.js +11 -11
  3. package/dist/claude.d.ts +16 -0
  4. package/dist/claude.js +98 -9
  5. package/dist/cli/config.d.ts +22 -0
  6. package/dist/cli/config.js +56 -9
  7. package/dist/cli/main.d.ts +1 -1
  8. package/dist/cli/main.js +56 -57
  9. package/dist/cli/marketplace.js +35 -9
  10. package/dist/cli/publish.d.ts +10 -0
  11. package/dist/cli/publish.js +22 -14
  12. package/dist/loader.d.ts +40 -0
  13. package/dist/loader.js +73 -0
  14. package/dist/mcp-catalog.d.ts +47 -0
  15. package/dist/mcp-catalog.js +304 -0
  16. package/dist/mcp.d.ts +6 -9
  17. package/dist/mcp.js +24 -314
  18. package/dist/schema.d.ts +183 -151
  19. package/dist/schema.js +49 -7
  20. package/dist/skills/custom-loader.d.ts +40 -0
  21. package/dist/skills/custom-loader.js +107 -32
  22. package/dist/skills/index.d.ts +13 -1
  23. package/dist/skills/index.js +12 -3
  24. package/dist/studio.js +4 -1
  25. package/dist/templates.d.ts +29 -8
  26. package/dist/templates.js +30 -20
  27. package/dist/types.d.ts +12 -0
  28. package/dist/verify.js +42 -4
  29. package/package.json +8 -4
  30. package/dist/__tests__/cascade.test.d.ts +0 -11
  31. package/dist/__tests__/cascade.test.js +0 -452
  32. package/dist/__tests__/claude.test.d.ts +0 -1
  33. package/dist/__tests__/claude.test.js +0 -427
  34. package/dist/__tests__/custom-loader.test.d.ts +0 -1
  35. package/dist/__tests__/custom-loader.test.js +0 -116
  36. package/dist/__tests__/executor.test.d.ts +0 -1
  37. package/dist/__tests__/executor.test.js +0 -1635
  38. package/dist/__tests__/integration/datadog.integration.test.d.ts +0 -1
  39. package/dist/__tests__/integration/datadog.integration.test.js +0 -23
  40. package/dist/__tests__/integration/e2e-workflow.integration.test.d.ts +0 -1
  41. package/dist/__tests__/integration/e2e-workflow.integration.test.js +0 -75
  42. package/dist/__tests__/integration/github.integration.test.d.ts +0 -1
  43. package/dist/__tests__/integration/github.integration.test.js +0 -37
  44. package/dist/__tests__/integration/harness.d.ts +0 -24
  45. package/dist/__tests__/integration/harness.js +0 -34
  46. package/dist/__tests__/integration/linear.integration.test.d.ts +0 -1
  47. package/dist/__tests__/integration/linear.integration.test.js +0 -15
  48. package/dist/__tests__/integration/sentry.integration.test.d.ts +0 -1
  49. package/dist/__tests__/integration/sentry.integration.test.js +0 -20
  50. package/dist/__tests__/integration/slack.integration.test.d.ts +0 -1
  51. package/dist/__tests__/integration/slack.integration.test.js +0 -22
  52. package/dist/__tests__/integration/sources.integration.test.d.ts +0 -1
  53. package/dist/__tests__/integration/sources.integration.test.js +0 -123
  54. package/dist/__tests__/publish.test.d.ts +0 -1
  55. package/dist/__tests__/publish.test.js +0 -180
  56. package/dist/__tests__/requires.test.d.ts +0 -1
  57. package/dist/__tests__/requires.test.js +0 -82
  58. package/dist/__tests__/retry.test.d.ts +0 -1
  59. package/dist/__tests__/retry.test.js +0 -213
  60. package/dist/__tests__/schema.test.d.ts +0 -1
  61. package/dist/__tests__/schema.test.js +0 -600
  62. package/dist/__tests__/skill-config-integration.test.d.ts +0 -1
  63. package/dist/__tests__/skill-config-integration.test.js +0 -204
  64. package/dist/__tests__/skills-index.test.d.ts +0 -1
  65. package/dist/__tests__/skills-index.test.js +0 -119
  66. package/dist/__tests__/skills.test.d.ts +0 -1
  67. package/dist/__tests__/skills.test.js +0 -565
  68. package/dist/__tests__/spec-conformance.test.d.ts +0 -18
  69. package/dist/__tests__/spec-conformance.test.js +0 -1084
  70. package/dist/__tests__/studio.test.d.ts +0 -1
  71. package/dist/__tests__/studio.test.js +0 -403
  72. package/dist/__tests__/templates.test.d.ts +0 -1
  73. package/dist/__tests__/templates.test.js +0 -49
  74. package/dist/__tests__/testing.test.d.ts +0 -1
  75. package/dist/__tests__/testing.test.js +0 -242
  76. package/dist/__tests__/verify.test.d.ts +0 -1
  77. package/dist/__tests__/verify.test.js +0 -517
  78. package/dist/__tests__/version-consistency.test.d.ts +0 -1
  79. package/dist/__tests__/version-consistency.test.js +0 -312
  80. package/dist/__tests__/workflow-builder.test.d.ts +0 -1
  81. package/dist/__tests__/workflow-builder.test.js +0 -110
  82. package/dist/__tests__/workflow-yaml.test.d.ts +0 -1
  83. package/dist/__tests__/workflow-yaml.test.js +0 -201
  84. package/dist/cli/__tests__/diagram.test.d.ts +0 -1
  85. package/dist/cli/__tests__/diagram.test.js +0 -225
  86. package/dist/cli/__tests__/report-cloud.test.d.ts +0 -1
  87. package/dist/cli/__tests__/report-cloud.test.js +0 -165
  88. package/dist/cli/__tests__/upgrade.test.d.ts +0 -1
  89. package/dist/cli/__tests__/upgrade.test.js +0 -317
  90. package/dist/cli/__tests__/version-check.test.d.ts +0 -1
  91. package/dist/cli/__tests__/version-check.test.js +0 -209
  92. package/dist/cli/config.test.d.ts +0 -1
  93. package/dist/cli/config.test.js +0 -200
  94. package/dist/cli/credentials.test.d.ts +0 -1
  95. package/dist/cli/credentials.test.js +0 -172
  96. package/dist/cli/e2e.test.d.ts +0 -1
  97. package/dist/cli/e2e.test.js +0 -690
  98. package/dist/cli/marketplace.test.d.ts +0 -1
  99. package/dist/cli/marketplace.test.js +0 -355
  100. package/dist/cli/new.test.d.ts +0 -1
  101. package/dist/cli/new.test.js +0 -1043
  102. package/dist/cli/output.test.d.ts +0 -1
  103. package/dist/cli/output.test.js +0 -180
  104. package/dist/cli/publish.test.d.ts +0 -1
  105. package/dist/cli/publish.test.js +0 -610
  106. package/dist/cli/renderer.test.d.ts +0 -1
  107. package/dist/cli/renderer.test.js +0 -302
  108. package/dist/executor.test.d.ts +0 -1
  109. package/dist/executor.test.js +0 -618
  110. package/dist/mcp.test.d.ts +0 -1
  111. package/dist/mcp.test.js +0 -735
  112. package/dist/mermaid.test.d.ts +0 -1
  113. package/dist/mermaid.test.js +0 -256
  114. package/dist/sources.test.d.ts +0 -1
  115. package/dist/sources.test.js +0 -265
  116. package/dist/sources.validation.test.d.ts +0 -12
  117. package/dist/sources.validation.test.js +0 -380
  118. package/dist/workflow-builder.test.d.ts +0 -1
  119. package/dist/workflow-builder.test.js +0 -123
@@ -1,204 +0,0 @@
1
- /**
2
- * Integration tests validating the skill config system end-to-end:
3
- * - Every builtin skill has a non-empty config
4
- * - Config fields have correct structure (description, required, env)
5
- * - deriveWorkflowVariables produces correct output for real skills
6
- * - collectCredentialsForSkills works with real builtins
7
- * - Custom skill config merge works correctly
8
- * - publish validation catches real problems
9
- */
10
- import { describe, it, expect } from "vitest";
11
- import { builtinSkills } from "../skills/index.js";
12
- import { deriveWorkflowVariables } from "../workflow-builder.js";
13
- import { collectCredentialsForSkills } from "../cli/new.js";
14
- // ── Builtin skill config completeness ────────────────────────────────
15
- describe("builtin skill config completeness", () => {
16
- const SKILLS_WITH_CONFIG = [
17
- "github",
18
- "linear",
19
- "slack",
20
- "sentry",
21
- "datadog",
22
- "betterstack",
23
- "notification",
24
- "supabase",
25
- ];
26
- it("all expected skills exist in builtinSkills", () => {
27
- const ids = builtinSkills.map((s) => s.id);
28
- for (const expected of SKILLS_WITH_CONFIG) {
29
- expect(ids, `missing builtin skill: ${expected}`).toContain(expected);
30
- }
31
- });
32
- it("every builtin skill has at least one config field", () => {
33
- for (const skill of builtinSkills) {
34
- if (!SKILLS_WITH_CONFIG.includes(skill.id))
35
- continue;
36
- expect(Object.keys(skill.config).length, `${skill.id} should have config fields`).toBeGreaterThan(0);
37
- }
38
- });
39
- it("every config field has description, required boolean, and env string", () => {
40
- for (const skill of builtinSkills) {
41
- for (const [key, field] of Object.entries(skill.config)) {
42
- expect(typeof field.description, `${skill.id}.${key}.description`).toBe("string");
43
- expect(field.description.length, `${skill.id}.${key}.description is empty`).toBeGreaterThan(0);
44
- expect(typeof field.required, `${skill.id}.${key}.required`).toBe("boolean");
45
- expect(typeof field.env, `${skill.id}.${key}.env`).toBe("string");
46
- expect(field.env, `${skill.id}.${key}.env should match key`).toBe(key);
47
- }
48
- }
49
- });
50
- it("github has GITHUB_TOKEN as required", () => {
51
- const github = builtinSkills.find((s) => s.id === "github");
52
- expect(github.config.GITHUB_TOKEN).toBeDefined();
53
- expect(github.config.GITHUB_TOKEN.required).toBe(true);
54
- });
55
- it("sentry has SENTRY_AUTH_TOKEN, SENTRY_ORG (required) and SENTRY_BASE_URL (optional)", () => {
56
- const sentry = builtinSkills.find((s) => s.id === "sentry");
57
- expect(sentry.config.SENTRY_AUTH_TOKEN.required).toBe(true);
58
- expect(sentry.config.SENTRY_ORG.required).toBe(true);
59
- expect(sentry.config.SENTRY_BASE_URL.required).toBe(false);
60
- });
61
- it("datadog has DD_API_KEY, DD_APP_KEY (required) and DD_SITE (optional)", () => {
62
- const dd = builtinSkills.find((s) => s.id === "datadog");
63
- expect(dd.config.DD_API_KEY.required).toBe(true);
64
- expect(dd.config.DD_APP_KEY.required).toBe(true);
65
- expect(dd.config.DD_SITE.required).toBe(false);
66
- });
67
- it("betterstack has 4 required config fields", () => {
68
- const bs = builtinSkills.find((s) => s.id === "betterstack");
69
- expect(Object.keys(bs.config)).toHaveLength(4);
70
- expect(bs.config.BETTERSTACK_API_TOKEN.required).toBe(true);
71
- expect(bs.config.BETTERSTACK_QUERY_ENDPOINT.required).toBe(true);
72
- expect(bs.config.BETTERSTACK_QUERY_USERNAME.required).toBe(true);
73
- expect(bs.config.BETTERSTACK_QUERY_PASSWORD.required).toBe(true);
74
- });
75
- it("notification has all optional config fields", () => {
76
- const notif = builtinSkills.find((s) => s.id === "notification");
77
- for (const field of Object.values(notif.config)) {
78
- expect(field.required).toBe(false);
79
- }
80
- });
81
- });
82
- // ── deriveWorkflowVariables integration ──────────────────────────────
83
- describe("deriveWorkflowVariables with real builtins", () => {
84
- const makeWorkflow = (skills) => ({
85
- id: "test",
86
- name: "test",
87
- description: "test",
88
- entry: "step1",
89
- nodes: { step1: { name: "Step 1", instruction: "do it", skills } },
90
- edges: [],
91
- });
92
- it("produces ANTHROPIC_API_KEY + all github config fields", () => {
93
- const vars = deriveWorkflowVariables(makeWorkflow(["github"]), builtinSkills);
94
- const names = vars.map((v) => v.name);
95
- expect(names[0]).toBe("ANTHROPIC_API_KEY");
96
- expect(names).toContain("GITHUB_TOKEN");
97
- });
98
- it("handles multi-skill workflow correctly", () => {
99
- const vars = deriveWorkflowVariables(makeWorkflow(["github", "sentry", "slack"]), builtinSkills);
100
- const names = vars.map((v) => v.name);
101
- expect(names).toContain("GITHUB_TOKEN");
102
- expect(names).toContain("SENTRY_AUTH_TOKEN");
103
- expect(names).toContain("SENTRY_ORG");
104
- expect(names).toContain("SENTRY_BASE_URL");
105
- expect(names).toContain("SLACK_WEBHOOK_URL");
106
- expect(names).toContain("SLACK_BOT_TOKEN");
107
- });
108
- it("deduplicates when same skill appears in multiple nodes", () => {
109
- const workflow = {
110
- id: "test",
111
- name: "test",
112
- description: "test",
113
- entry: "a",
114
- nodes: {
115
- a: { name: "A", instruction: "a", skills: ["github"] },
116
- b: { name: "B", instruction: "b", skills: ["github"] },
117
- },
118
- edges: [{ from: "a", to: "b" }],
119
- };
120
- const vars = deriveWorkflowVariables(workflow, builtinSkills);
121
- const tokenVars = vars.filter((v) => v.name === "GITHUB_TOKEN");
122
- expect(tokenVars).toHaveLength(1);
123
- });
124
- it("tracks skill attribution correctly", () => {
125
- const vars = deriveWorkflowVariables(makeWorkflow(["github", "sentry"]), builtinSkills);
126
- expect(vars.find((v) => v.name === "GITHUB_TOKEN")?.skill).toBe("github");
127
- expect(vars.find((v) => v.name === "SENTRY_AUTH_TOKEN")?.skill).toBe("sentry");
128
- });
129
- it("marks required/optional correctly", () => {
130
- const vars = deriveWorkflowVariables(makeWorkflow(["sentry"]), builtinSkills);
131
- expect(vars.find((v) => v.name === "SENTRY_AUTH_TOKEN")?.required).toBe(true);
132
- expect(vars.find((v) => v.name === "SENTRY_BASE_URL")?.required).toBe(false);
133
- });
134
- });
135
- // ── collectCredentialsForSkills integration ──────────────────────────
136
- describe("collectCredentialsForSkills with real builtins", () => {
137
- it("always includes ANTHROPIC_API_KEY first", () => {
138
- const creds = collectCredentialsForSkills(["github"], builtinSkills);
139
- expect(creds[0].key).toBe("ANTHROPIC_API_KEY");
140
- });
141
- it("derives credentials from skill.config when availableSkills provided", () => {
142
- const creds = collectCredentialsForSkills(["github"], builtinSkills);
143
- expect(creds.some((c) => c.key === "GITHUB_TOKEN")).toBe(true);
144
- });
145
- it("includes all betterstack credentials", () => {
146
- const creds = collectCredentialsForSkills(["betterstack"], builtinSkills);
147
- const keys = creds.map((c) => c.key);
148
- expect(keys).toContain("BETTERSTACK_API_TOKEN");
149
- expect(keys).toContain("BETTERSTACK_QUERY_ENDPOINT");
150
- expect(keys).toContain("BETTERSTACK_QUERY_USERNAME");
151
- expect(keys).toContain("BETTERSTACK_QUERY_PASSWORD");
152
- });
153
- it("deduplicates across multiple skills", () => {
154
- const creds = collectCredentialsForSkills(["github", "github"], builtinSkills);
155
- const tokenCreds = creds.filter((c) => c.key === "GITHUB_TOKEN");
156
- expect(tokenCreds).toHaveLength(1);
157
- });
158
- it("falls back to SKILL_CREDENTIALS for unknown skills", () => {
159
- // "gitlab" isn't in builtinSkills but is in SKILL_CREDENTIALS
160
- const creds = collectCredentialsForSkills(["gitlab"], builtinSkills);
161
- expect(creds.some((c) => c.key === "GITLAB_TOKEN")).toBe(true);
162
- });
163
- });
164
- // ── Custom skill config merge ────────────────────────────────────────
165
- describe("custom skill config merge", () => {
166
- it("custom skill config fields are preserved in deriveWorkflowVariables", () => {
167
- const customSkill = {
168
- id: "my-tax-tool",
169
- name: "Tax Tool",
170
- description: "Tax processing",
171
- category: "general",
172
- config: {
173
- TAX_API_KEY: { description: "Tax service API key", required: true, env: "TAX_API_KEY" },
174
- },
175
- tools: [],
176
- };
177
- const workflow = {
178
- id: "test",
179
- name: "test",
180
- description: "test",
181
- entry: "start",
182
- nodes: { start: { name: "Start", instruction: "process", skills: ["my-tax-tool"] } },
183
- edges: [],
184
- };
185
- const vars = deriveWorkflowVariables(workflow, [customSkill]);
186
- expect(vars.find((v) => v.name === "TAX_API_KEY")).toBeDefined();
187
- expect(vars.find((v) => v.name === "TAX_API_KEY")?.skill).toBe("my-tax-tool");
188
- expect(vars.find((v) => v.name === "TAX_API_KEY")?.required).toBe(true);
189
- });
190
- it("collectCredentialsForSkills works with custom skills", () => {
191
- const customSkill = {
192
- id: "my-db",
193
- name: "DB",
194
- description: "Database",
195
- category: "general",
196
- config: {
197
- DB_URL: { description: "Database URL", required: true, env: "DB_URL" },
198
- },
199
- tools: [],
200
- };
201
- const creds = collectCredentialsForSkills(["my-db"], [customSkill]);
202
- expect(creds.some((c) => c.key === "DB_URL")).toBe(true);
203
- });
204
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,119 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { github, linear, slack, sentry, datadog, notification, builtinSkills, createSkillMap, allSkills, isSkillConfigured, validateWorkflowSkills, } from "../skills/index.js";
3
- describe("skills registry", () => {
4
- it("exports all builtin skills", () => {
5
- expect(builtinSkills.length).toBeGreaterThanOrEqual(6);
6
- const ids = builtinSkills.map((s) => s.id);
7
- expect(ids).toContain("github");
8
- expect(ids).toContain("linear");
9
- expect(ids).toContain("slack");
10
- expect(ids).toContain("sentry");
11
- expect(ids).toContain("datadog");
12
- expect(ids).toContain("notification");
13
- });
14
- it("individual skill exports match builtins", () => {
15
- expect(builtinSkills).toContain(github);
16
- expect(builtinSkills).toContain(linear);
17
- expect(builtinSkills).toContain(slack);
18
- expect(builtinSkills).toContain(sentry);
19
- expect(builtinSkills).toContain(datadog);
20
- expect(builtinSkills).toContain(notification);
21
- });
22
- it("createSkillMap builds a correct map", () => {
23
- const map = createSkillMap([github, slack]);
24
- expect(map.size).toBe(2);
25
- expect(map.get("github")).toBe(github);
26
- expect(map.get("slack")).toBe(slack);
27
- });
28
- it("createSkillMap throws on duplicate IDs", () => {
29
- expect(() => createSkillMap([github, github])).toThrow("Duplicate skill ID");
30
- });
31
- it("allSkills returns all builtin skills as a map", () => {
32
- const map = allSkills();
33
- expect(map.size).toBe(builtinSkills.length);
34
- for (const skill of builtinSkills) {
35
- expect(map.has(skill.id)).toBe(true);
36
- }
37
- });
38
- it("no tool name collisions across skills", () => {
39
- const seen = new Set();
40
- for (const skill of builtinSkills) {
41
- for (const tool of skill.tools) {
42
- expect(seen.has(tool.name)).toBe(false);
43
- seen.add(tool.name);
44
- }
45
- }
46
- });
47
- it("all tools have name, description, and input_schema", () => {
48
- for (const skill of builtinSkills) {
49
- for (const tool of skill.tools) {
50
- expect(tool.name).toBeTruthy();
51
- expect(tool.description).toBeTruthy();
52
- expect(tool.input_schema).toBeDefined();
53
- expect(typeof tool.handler).toBe("function");
54
- }
55
- }
56
- });
57
- it("all skills have valid metadata and category", () => {
58
- const validCategories = ["git", "observability", "tasks", "notification", "general"];
59
- for (const skill of builtinSkills) {
60
- expect(skill.id).toBeTruthy();
61
- expect(skill.name).toBeTruthy();
62
- expect(skill.description).toBeTruthy();
63
- expect(skill.config).toBeDefined();
64
- expect(Array.isArray(skill.tools)).toBe(true);
65
- expect(validCategories).toContain(skill.category);
66
- }
67
- });
68
- it("isSkillConfigured checks required env vars", () => {
69
- expect(isSkillConfigured(github, { GITHUB_TOKEN: "ghp_xxx" })).toBe(true);
70
- expect(isSkillConfigured(github, {})).toBe(false); // GITHUB_TOKEN is required
71
- // Slack has all-optional config — always configured, tools validate at call time
72
- expect(isSkillConfigured(slack, {})).toBe(true);
73
- expect(isSkillConfigured(slack, { SLACK_WEBHOOK_URL: "https://hooks.slack.com/..." })).toBe(true);
74
- expect(isSkillConfigured(slack, { SLACK_BOT_TOKEN: "xoxb-..." })).toBe(true);
75
- });
76
- it("validateWorkflowSkills detects missing providers", () => {
77
- const workflow = {
78
- nodes: {
79
- gather: { skills: ["github", "sentry"] },
80
- notify: { skills: ["slack"] },
81
- },
82
- };
83
- // Only github is available
84
- const available = createSkillMap([github]);
85
- const result = validateWorkflowSkills(workflow, available);
86
- expect(result.configured).toHaveLength(1);
87
- expect(result.configured[0].id).toBe("github");
88
- expect(result.missing.some((m) => m.id === "sentry")).toBe(true);
89
- // gather node has github (git) but no observability → error
90
- expect(result.errors.length).toBeGreaterThan(0);
91
- // notify node has no notification → warning (not error)
92
- expect(result.warnings.length).toBeGreaterThan(0);
93
- });
94
- it("validateWorkflowSkills passes when all categories covered", () => {
95
- const workflow = {
96
- nodes: {
97
- gather: { skills: ["github", "sentry"] },
98
- },
99
- };
100
- const available = createSkillMap([github, sentry]);
101
- const result = validateWorkflowSkills(workflow, available);
102
- expect(result.errors).toHaveLength(0);
103
- expect(result.warnings).toHaveLength(0);
104
- expect(result.configured).toHaveLength(2);
105
- });
106
- it("config fields have env vars matching canonical names", () => {
107
- // Datadog should use DD_* prefix
108
- for (const [key, field] of Object.entries(datadog.config)) {
109
- if (field.env) {
110
- expect(field.env).toMatch(/^DD_/);
111
- }
112
- }
113
- // Sentry base URL should be SENTRY_BASE_URL not SENTRY_URL
114
- const sentryConfig = Object.values(sentry.config).find((f) => f.env?.includes("SENTRY") && f.env?.includes("URL"));
115
- if (sentryConfig) {
116
- expect(sentryConfig.env).toBe("SENTRY_BASE_URL");
117
- }
118
- });
119
- });
@@ -1 +0,0 @@
1
- export {};