@sweny-ai/core 0.1.53 → 0.1.54
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/cli/main.js +2 -20
- package/dist/cli/new.d.ts +0 -5
- package/dist/cli/new.js +0 -5
- package/dist/cli/new.test.js +1 -9
- package/dist/cli/publish.js +23 -12
- package/package.json +1 -5
package/dist/cli/main.js
CHANGED
|
@@ -23,7 +23,7 @@ import * as readline from "node:readline";
|
|
|
23
23
|
import { loadDotenv, loadConfigFile } from "./config-file.js";
|
|
24
24
|
import { buildCredentialMap } from "./credentials.js";
|
|
25
25
|
import { runNew } from "./new.js";
|
|
26
|
-
import {
|
|
26
|
+
import { runE2eRun } from "./e2e.js";
|
|
27
27
|
import { registerTriageCommand, registerImplementCommand, parseCliInputs, validateInputs, validateWarnings, } from "./config.js";
|
|
28
28
|
import { c, formatBanner, getStepDetails, formatStepLine, formatDagResultHuman, formatDagResultMarkdown, formatResultJson, formatValidationErrors, formatCrashError, formatCheckResults, } from "./output.js";
|
|
29
29
|
import { checkProviderConnectivity } from "./check.js";
|
|
@@ -64,23 +64,8 @@ program
|
|
|
64
64
|
.action(async () => {
|
|
65
65
|
await runNew();
|
|
66
66
|
});
|
|
67
|
-
// ── sweny init (deprecated alias) ─────────────────────────────────────
|
|
68
|
-
program
|
|
69
|
-
.command("init", { hidden: true })
|
|
70
|
-
.description("[DEPRECATED] Use `sweny new` instead")
|
|
71
|
-
.action(async () => {
|
|
72
|
-
console.warn("\x1B[33m ⚠ `sweny init` is deprecated and will be removed in v6. Use `sweny new` instead.\x1B[0m\n");
|
|
73
|
-
await runNew();
|
|
74
|
-
});
|
|
75
67
|
// ── sweny e2e ────────────────────────────────────────────────────────
|
|
76
68
|
const e2eCmd = program.command("e2e").description("End-to-end browser testing");
|
|
77
|
-
e2eCmd
|
|
78
|
-
.command("init")
|
|
79
|
-
.description("[DEPRECATED] Use `sweny new` and pick 'End-to-end browser testing'")
|
|
80
|
-
.action(async () => {
|
|
81
|
-
console.warn("\x1B[33m ⚠ `sweny e2e init` is deprecated and will be removed in v6. Use `sweny new` and pick 'End-to-end browser testing'.\x1B[0m\n");
|
|
82
|
-
await runE2eInit();
|
|
83
|
-
});
|
|
84
69
|
e2eCmd
|
|
85
70
|
.command("run [file]")
|
|
86
71
|
.description("Run e2e workflow files from .sweny/e2e/")
|
|
@@ -819,12 +804,9 @@ workflowCmd
|
|
|
819
804
|
.action(workflowExportAction);
|
|
820
805
|
workflowCmd
|
|
821
806
|
.command("create <description>")
|
|
822
|
-
.description("
|
|
807
|
+
.description("Generate a new workflow from a natural language description")
|
|
823
808
|
.option("--json", "Output workflow JSON to stdout (no interactive prompt)")
|
|
824
809
|
.action(async (description, options) => {
|
|
825
|
-
if (!options.json) {
|
|
826
|
-
console.warn("\x1B[33m ⚠ `sweny workflow create` is deprecated and will be removed in v6. Use `sweny new` and pick 'Describe your own'.\x1B[0m\n");
|
|
827
|
-
}
|
|
828
810
|
const skills = configuredSkills();
|
|
829
811
|
const claude = new ClaudeClient({
|
|
830
812
|
maxTurns: 3,
|
package/dist/cli/new.d.ts
CHANGED
|
@@ -94,8 +94,3 @@ export declare function buildActionWorkflow(credentials: Credential[], cronExpre
|
|
|
94
94
|
* Safe to re-run in an existing project to add additional workflows.
|
|
95
95
|
*/
|
|
96
96
|
export declare function runNew(): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Use `runNew` instead. Kept as a named re-export so external
|
|
99
|
-
* callers (e.g. create-sweny, plugin skills) don't break during the migration.
|
|
100
|
-
*/
|
|
101
|
-
export declare const runInit: typeof runNew;
|
package/dist/cli/new.js
CHANGED
|
@@ -578,11 +578,6 @@ export async function runNew() {
|
|
|
578
578
|
p.note(steps.join("\n"), "Next steps");
|
|
579
579
|
p.outro(hasExistingConfig ? "Workflow added!" : "You're all set!");
|
|
580
580
|
}
|
|
581
|
-
/**
|
|
582
|
-
* @deprecated Use `runNew` instead. Kept as a named re-export so external
|
|
583
|
-
* callers (e.g. create-sweny, plugin skills) don't break during the migration.
|
|
584
|
-
*/
|
|
585
|
-
export const runInit = runNew;
|
|
586
581
|
// ── Custom workflow branch ────────────────────────────────────────────
|
|
587
582
|
/**
|
|
588
583
|
* Prompt the user for a description, generate a workflow via the LLM,
|
package/dist/cli/new.test.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import * as os from "node:os";
|
|
5
5
|
import { parse as parseYaml } from "yaml";
|
|
6
|
-
import { collectCredentials, collectCredentialsForSkills, extractSkillsFromYaml, detectGitRemote, buildSwenyYml, buildEnvTemplate, buildActionWorkflow,
|
|
6
|
+
import { collectCredentials, collectCredentialsForSkills, extractSkillsFromYaml, detectGitRemote, buildSwenyYml, buildEnvTemplate, buildActionWorkflow, PROVIDER_CREDENTIALS, SKILL_CREDENTIALS, } from "./new.js";
|
|
7
7
|
// ── detectGitRemote ────────────────────────────────────────────────────
|
|
8
8
|
describe("detectGitRemote", () => {
|
|
9
9
|
const tmpDirs = [];
|
|
@@ -763,14 +763,6 @@ describe("extractSkillsFromYaml — block-style arrays", () => {
|
|
|
763
763
|
expect(extractSkillsFromYaml(yaml)).toEqual([]);
|
|
764
764
|
});
|
|
765
765
|
});
|
|
766
|
-
// ── Deprecated alias: runInit === runNew ──────────────────────────────
|
|
767
|
-
describe("runInit deprecation alias", () => {
|
|
768
|
-
it("re-exports runNew as runInit (identity pin)", () => {
|
|
769
|
-
// Callers using `import { runInit } from "@sweny-ai/core/new"` must
|
|
770
|
-
// continue to hit the same function during the deprecation window.
|
|
771
|
-
expect(runInit).toBe(runNew);
|
|
772
|
-
});
|
|
773
|
-
});
|
|
774
766
|
describe("SKILL_CREDENTIALS", () => {
|
|
775
767
|
it("has entries for all built-in skills", () => {
|
|
776
768
|
const expected = [
|
package/dist/cli/publish.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import * as fs from "node:fs";
|
|
10
10
|
import * as path from "node:path";
|
|
11
|
-
import {
|
|
11
|
+
import { execFileSync } from "node:child_process";
|
|
12
12
|
import * as p from "@clack/prompts";
|
|
13
13
|
import chalk from "chalk";
|
|
14
14
|
import { parse as parseYaml } from "yaml";
|
|
@@ -108,7 +108,7 @@ export function validateSkillDir(dirPath) {
|
|
|
108
108
|
// ── GitHub PR helpers ──────────────────────────────────────────────────
|
|
109
109
|
function ghAvailable() {
|
|
110
110
|
try {
|
|
111
|
-
|
|
111
|
+
execFileSync("gh", ["--version"], { stdio: "pipe" });
|
|
112
112
|
return true;
|
|
113
113
|
}
|
|
114
114
|
catch {
|
|
@@ -117,7 +117,7 @@ function ghAvailable() {
|
|
|
117
117
|
}
|
|
118
118
|
function ghAuthenticated() {
|
|
119
119
|
try {
|
|
120
|
-
|
|
120
|
+
execFileSync("gh", ["auth", "status"], { stdio: "pipe" });
|
|
121
121
|
return true;
|
|
122
122
|
}
|
|
123
123
|
catch {
|
|
@@ -287,21 +287,21 @@ async function openGitHubPR(type, id, sourcePath, meta) {
|
|
|
287
287
|
s.start("Forking marketplace repository...");
|
|
288
288
|
try {
|
|
289
289
|
// Fork the marketplace repo (idempotent — if already forked, just continues)
|
|
290
|
-
|
|
290
|
+
execFileSync("gh", ["repo", "fork", "swenyai/marketplace", "--clone=false"], { stdio: "pipe" });
|
|
291
291
|
// Get the fork name
|
|
292
|
-
const forkInfo =
|
|
292
|
+
const forkInfo = execFileSync("gh", ["api", "user"], { stdio: "pipe", encoding: "utf-8" });
|
|
293
293
|
const username = JSON.parse(forkInfo).login;
|
|
294
294
|
const forkRepo = `${username}/marketplace`;
|
|
295
295
|
s.message("Creating branch...");
|
|
296
296
|
const branchName = `publish/${type}/${id}`;
|
|
297
297
|
// Clone to temp, create branch, add file, push, create PR
|
|
298
298
|
const tmpDir = fs.mkdtempSync(path.join(process.env.TMPDIR ?? "/tmp", "sweny-publish-"));
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
execFileSync("gh", ["repo", "clone", forkRepo, tmpDir, "--", "--depth", "1"], { stdio: "pipe" });
|
|
300
|
+
execFileSync("git", ["-C", tmpDir, "checkout", "-b", branchName], { stdio: "pipe" });
|
|
301
301
|
if (type === "workflow") {
|
|
302
302
|
const dest = path.join(tmpDir, "workflows", "community", `${id}.yml`);
|
|
303
303
|
fs.copyFileSync(sourcePath, dest);
|
|
304
|
-
|
|
304
|
+
execFileSync("git", ["-C", tmpDir, "add", `workflows/community/${id}.yml`], { stdio: "pipe" });
|
|
305
305
|
}
|
|
306
306
|
else {
|
|
307
307
|
const destDir = path.join(tmpDir, "skills", "community", id);
|
|
@@ -311,17 +311,28 @@ async function openGitHubPR(type, id, sourcePath, meta) {
|
|
|
311
311
|
for (const file of files) {
|
|
312
312
|
fs.copyFileSync(path.join(sourcePath, file), path.join(destDir, file));
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
execFileSync("git", ["-C", tmpDir, "add", `skills/community/${id}`], { stdio: "pipe" });
|
|
315
315
|
}
|
|
316
316
|
s.message("Pushing...");
|
|
317
317
|
const commitMsg = type === "workflow" ? `feat: add ${id} workflow` : `feat: add ${id} skill`;
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
execFileSync("git", ["-C", tmpDir, "commit", "-m", commitMsg], { stdio: "pipe" });
|
|
319
|
+
execFileSync("git", ["-C", tmpDir, "push", "origin", branchName], { stdio: "pipe" });
|
|
320
320
|
s.message("Creating pull request...");
|
|
321
321
|
const prBody = type === "workflow"
|
|
322
322
|
? `## New Workflow: ${id}\n\n**Author:** ${meta.author}\n**Category:** ${meta.category}\n**Tags:** ${meta.tags?.join(", ")}\n\nSubmitted via \`sweny publish\`.`
|
|
323
323
|
: `## New Skill: ${id}\n\nSubmitted via \`sweny publish\`.`;
|
|
324
|
-
const prResult =
|
|
324
|
+
const prResult = execFileSync("gh", [
|
|
325
|
+
"pr",
|
|
326
|
+
"create",
|
|
327
|
+
"--repo",
|
|
328
|
+
"swenyai/marketplace",
|
|
329
|
+
"--head",
|
|
330
|
+
`${username}:${branchName}`,
|
|
331
|
+
"--title",
|
|
332
|
+
`feat: add ${type} ${id}`,
|
|
333
|
+
"--body",
|
|
334
|
+
prBody,
|
|
335
|
+
], { stdio: "pipe", encoding: "utf-8" });
|
|
325
336
|
const prUrl = prResult.trim();
|
|
326
337
|
// Cleanup temp dir
|
|
327
338
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sweny-ai/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sweny": "./dist/cli/main.js"
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"./workflows": "./dist/workflows/index.js",
|
|
16
16
|
"./testing": "./dist/testing.js",
|
|
17
17
|
"./schema": "./dist/schema.js",
|
|
18
|
-
"./init": "./dist/cli/new.js",
|
|
19
18
|
"./new": "./dist/cli/new.js"
|
|
20
19
|
},
|
|
21
20
|
"typesVersions": {
|
|
@@ -38,9 +37,6 @@
|
|
|
38
37
|
"schema": [
|
|
39
38
|
"dist/schema.d.ts"
|
|
40
39
|
],
|
|
41
|
-
"init": [
|
|
42
|
-
"dist/cli/new.d.ts"
|
|
43
|
-
],
|
|
44
40
|
"new": [
|
|
45
41
|
"dist/cli/new.d.ts"
|
|
46
42
|
]
|