clawnify 0.11.8 → 0.12.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 +5 -0
- package/dist/{chunk-U75BCDGF.js → chunk-TR3GJVCX.js} +2 -2
- package/dist/{cli-YFMKUMSP.js → cli-UFC2VLJT.js} +178 -12
- package/dist/cli-UFC2VLJT.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{mcp-UOJTU5X2.js → mcp-FQ7VFFFF.js} +2 -2
- package/package.json +1 -1
- package/dist/cli-YFMKUMSP.js.map +0 -1
- /package/dist/{chunk-U75BCDGF.js.map → chunk-TR3GJVCX.js.map} +0 -0
- /package/dist/{mcp-UOJTU5X2.js.map → mcp-FQ7VFFFF.js.map} +0 -0
package/README.md
CHANGED
|
@@ -100,6 +100,11 @@ clawnify open <slug> # Open app in browser
|
|
|
100
100
|
clawnify logs <app-id> # View build logs
|
|
101
101
|
clawnify rm <app-id> # Delete an app
|
|
102
102
|
clawnify whoami # Show current user
|
|
103
|
+
clawnify flows list # List ClawFlow drafts + latest published version
|
|
104
|
+
clawnify flows read <name> # Print a flow's current draft definition
|
|
105
|
+
clawnify flows create <name> --file flow.json # Create a draft (validated on-box)
|
|
106
|
+
clawnify flows edit <name> # Edit the draft in $EDITOR (or --file)
|
|
107
|
+
clawnify flows publish <name> # Publish the draft as the next numbered version
|
|
103
108
|
clawnify ai-files install # Install rules + skills + MCP into your agent(s)
|
|
104
109
|
clawnify ai-files uninstall # Remove them
|
|
105
110
|
```
|
|
@@ -593,7 +593,7 @@ async function pollUntilReady(resourceId, options = {}) {
|
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
// src/version.ts
|
|
596
|
-
var VERSION = "0.
|
|
596
|
+
var VERSION = "0.12.0";
|
|
597
597
|
|
|
598
598
|
export {
|
|
599
599
|
OAUTH_CLIENT_ID,
|
|
@@ -617,4 +617,4 @@ export {
|
|
|
617
617
|
pollUntilReady,
|
|
618
618
|
VERSION
|
|
619
619
|
};
|
|
620
|
-
//# sourceMappingURL=chunk-
|
|
620
|
+
//# sourceMappingURL=chunk-TR3GJVCX.js.map
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
resolveOrgContext,
|
|
21
21
|
saveAuth,
|
|
22
22
|
saveProject
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-TR3GJVCX.js";
|
|
24
24
|
|
|
25
25
|
// src/cli.ts
|
|
26
26
|
import { Command } from "commander";
|
|
@@ -1242,7 +1242,7 @@ async function envUnsetCommand(key) {
|
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
1244
|
// src/commands/api.ts
|
|
1245
|
-
async function apiCommand(
|
|
1245
|
+
async function apiCommand(path10, opts) {
|
|
1246
1246
|
const method = (opts.method || (opts.data !== void 0 ? "POST" : "GET")).toUpperCase();
|
|
1247
1247
|
let body;
|
|
1248
1248
|
if (opts.data !== void 0) {
|
|
@@ -1253,7 +1253,7 @@ async function apiCommand(path9, opts) {
|
|
|
1253
1253
|
process.exit(1);
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
|
-
const p =
|
|
1256
|
+
const p = path10.startsWith("/") ? path10 : `/${path10}`;
|
|
1257
1257
|
const res = await api.call(method, p, { body, orgId: opts.org });
|
|
1258
1258
|
const text = await res.text();
|
|
1259
1259
|
let out = text;
|
|
@@ -1376,9 +1376,9 @@ var DETECTORS = [
|
|
|
1376
1376
|
{ agent: "aider", markers: ["CONVENTIONS.md", ".aider.conf.yml"], target: "CONVENTIONS.md" }
|
|
1377
1377
|
];
|
|
1378
1378
|
function exists(cwd, name) {
|
|
1379
|
-
const
|
|
1379
|
+
const path10 = join(cwd, name);
|
|
1380
1380
|
try {
|
|
1381
|
-
statSync(
|
|
1381
|
+
statSync(path10);
|
|
1382
1382
|
return true;
|
|
1383
1383
|
} catch {
|
|
1384
1384
|
return false;
|
|
@@ -1402,7 +1402,7 @@ function agentByName(name) {
|
|
|
1402
1402
|
var ALL_AGENTS = DETECTORS.map((d) => d.agent);
|
|
1403
1403
|
|
|
1404
1404
|
// src/lib/skills/content.gen.ts
|
|
1405
|
-
var CLI_VERSION = "0.
|
|
1405
|
+
var CLI_VERSION = "0.12.0";
|
|
1406
1406
|
var BUNDLED_SKILLS = [
|
|
1407
1407
|
{
|
|
1408
1408
|
name: "build-a-clawnify-app",
|
|
@@ -1437,10 +1437,10 @@ var VERSION_HEADER_RE = /<!--\s*clawnify-skill:\s*([\w-]+)\s+v([\d.]+)\s*-->/;
|
|
|
1437
1437
|
function versionHeader(name) {
|
|
1438
1438
|
return `<!-- clawnify-skill: ${name} v${CLI_VERSION} -->`;
|
|
1439
1439
|
}
|
|
1440
|
-
function readExistingVersion(
|
|
1441
|
-
if (!existsSync2(
|
|
1440
|
+
function readExistingVersion(path10) {
|
|
1441
|
+
if (!existsSync2(path10)) return null;
|
|
1442
1442
|
try {
|
|
1443
|
-
const head = readFileSync(
|
|
1443
|
+
const head = readFileSync(path10, "utf8").slice(0, 500);
|
|
1444
1444
|
const match = head.match(VERSION_HEADER_RE);
|
|
1445
1445
|
return match ? match[2] : null;
|
|
1446
1446
|
} catch {
|
|
@@ -3535,8 +3535,8 @@ async function docsCommand(slug, options) {
|
|
|
3535
3535
|
process.exit(1);
|
|
3536
3536
|
}
|
|
3537
3537
|
const caller = options.caller ?? "external";
|
|
3538
|
-
const
|
|
3539
|
-
const res = await fetch(DOCS_URL +
|
|
3538
|
+
const path10 = slug ? `/docs/${auth.org_id}/${slug}.md?caller=${caller}` : `/docs/${auth.org_id}/index.md`;
|
|
3539
|
+
const res = await fetch(DOCS_URL + path10, {
|
|
3540
3540
|
headers: {
|
|
3541
3541
|
authorization: "Bearer " + token
|
|
3542
3542
|
}
|
|
@@ -3727,6 +3727,166 @@ Valid: ${ALL_AGENTS.join(", ")}`
|
|
|
3727
3727
|
return detectAgents(process.cwd());
|
|
3728
3728
|
}
|
|
3729
3729
|
|
|
3730
|
+
// src/commands/flows.ts
|
|
3731
|
+
import { spawnSync } from "child_process";
|
|
3732
|
+
import fs8 from "fs";
|
|
3733
|
+
import os from "os";
|
|
3734
|
+
import path9 from "path";
|
|
3735
|
+
function flowFileName(name) {
|
|
3736
|
+
return name.endsWith(".json") ? name : `${name}.json`;
|
|
3737
|
+
}
|
|
3738
|
+
function parseFlowFile(file) {
|
|
3739
|
+
const abs = path9.resolve(file);
|
|
3740
|
+
let raw;
|
|
3741
|
+
try {
|
|
3742
|
+
raw = fs8.readFileSync(abs, "utf8");
|
|
3743
|
+
} catch {
|
|
3744
|
+
console.error(`Cannot read ${abs}.`);
|
|
3745
|
+
process.exit(1);
|
|
3746
|
+
}
|
|
3747
|
+
try {
|
|
3748
|
+
const parsed = JSON.parse(raw);
|
|
3749
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error();
|
|
3750
|
+
return parsed;
|
|
3751
|
+
} catch {
|
|
3752
|
+
console.error(`${abs} is not a valid flow definition (expected a JSON object).`);
|
|
3753
|
+
process.exit(1);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
function failValidation(payload, note) {
|
|
3757
|
+
console.error(payload.error ?? "Flow validation failed:");
|
|
3758
|
+
for (const e of payload.errors ?? []) {
|
|
3759
|
+
const where = [e.node && `node "${e.node}"`, e.field].filter(Boolean).join(", ");
|
|
3760
|
+
console.error(` - ${where ? `${where}: ` : ""}${e.message}`);
|
|
3761
|
+
}
|
|
3762
|
+
if (note) console.error(note);
|
|
3763
|
+
process.exit(1);
|
|
3764
|
+
}
|
|
3765
|
+
async function draftExists(serverId, name) {
|
|
3766
|
+
const res = await api.get(`/servers/${serverId}/flows?name=${encodeURIComponent(flowFileName(name))}`);
|
|
3767
|
+
return res.ok;
|
|
3768
|
+
}
|
|
3769
|
+
async function saveDraft(serverId, name, flow, validationNote) {
|
|
3770
|
+
const res = await api.post(`/servers/${serverId}/flows`, { name, flow });
|
|
3771
|
+
const payload = await res.json().catch(() => ({}));
|
|
3772
|
+
if (res.status === 422 && payload.errors) failValidation(payload, validationNote);
|
|
3773
|
+
if (!res.ok) {
|
|
3774
|
+
console.error(`Failed to save draft (${res.status})${payload.error ? `: ${payload.error}` : ""}.`);
|
|
3775
|
+
process.exit(1);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
async function flowsListCommand(opts) {
|
|
3779
|
+
const serverId = await resolveServerId(opts.server);
|
|
3780
|
+
const res = await api.get(`/servers/${serverId}/flows`);
|
|
3781
|
+
if (!res.ok) {
|
|
3782
|
+
console.error(`Failed to list flows (${res.status}).`);
|
|
3783
|
+
process.exit(1);
|
|
3784
|
+
}
|
|
3785
|
+
const { flows } = await res.json();
|
|
3786
|
+
if (opts.json) {
|
|
3787
|
+
console.log(JSON.stringify(flows, null, 2));
|
|
3788
|
+
return;
|
|
3789
|
+
}
|
|
3790
|
+
if (!flows || flows.length === 0) {
|
|
3791
|
+
console.log("No flows on this server. Create one with: clawnify flows create <name> --file flow.json");
|
|
3792
|
+
return;
|
|
3793
|
+
}
|
|
3794
|
+
const nameW = Math.max(4, ...flows.map((f) => f.flow.length));
|
|
3795
|
+
console.log(`${"Name".padEnd(nameW)} ${"Nodes".padEnd(5)} ${"Published".padEnd(9)} Updated`);
|
|
3796
|
+
console.log(`${"\u2500".repeat(nameW)} ${"\u2500".repeat(5)} ${"\u2500".repeat(9)} ${"\u2500".repeat(10)}`);
|
|
3797
|
+
for (const f of flows) {
|
|
3798
|
+
const published = f.published != null ? `v${f.published}` : "\u2014";
|
|
3799
|
+
const updated = (f.updated_at ?? "").slice(0, 16).replace("T", " ");
|
|
3800
|
+
console.log(`${f.flow.padEnd(nameW)} ${String(f.nodes?.length ?? 0).padEnd(5)} ${published.padEnd(9)} ${updated}`);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
async function flowsReadCommand(name, opts) {
|
|
3804
|
+
const serverId = await resolveServerId(opts.server);
|
|
3805
|
+
const res = await api.get(`/servers/${serverId}/flows?name=${encodeURIComponent(flowFileName(name))}`);
|
|
3806
|
+
if (!res.ok) {
|
|
3807
|
+
if (res.status === 404) console.error(`No draft flow named "${name}" on this server.`);
|
|
3808
|
+
else console.error(`Failed to read flow (${res.status}).`);
|
|
3809
|
+
process.exit(1);
|
|
3810
|
+
}
|
|
3811
|
+
const { flow } = await res.json();
|
|
3812
|
+
console.log(JSON.stringify(flow, null, 2));
|
|
3813
|
+
}
|
|
3814
|
+
async function flowsCreateCommand(name, opts) {
|
|
3815
|
+
if (!opts.file) {
|
|
3816
|
+
console.error(`Provide the flow definition: clawnify flows create ${name} --file flow.json`);
|
|
3817
|
+
process.exit(1);
|
|
3818
|
+
}
|
|
3819
|
+
const serverId = await resolveServerId(opts.server);
|
|
3820
|
+
const flow = parseFlowFile(opts.file);
|
|
3821
|
+
if (await draftExists(serverId, name)) {
|
|
3822
|
+
console.error(`A draft named "${name}" already exists. Update it with: clawnify flows edit ${name} --file ${opts.file}`);
|
|
3823
|
+
process.exit(1);
|
|
3824
|
+
}
|
|
3825
|
+
await saveDraft(serverId, name, flow);
|
|
3826
|
+
const nodes = Array.isArray(flow.nodes) ? flow.nodes.length : 0;
|
|
3827
|
+
console.log(`Created draft flow "${name}" (${nodes} node${nodes === 1 ? "" : "s"}). Not live yet \u2014 publish with: clawnify flows publish ${name}`);
|
|
3828
|
+
}
|
|
3829
|
+
async function flowsEditCommand(name, opts) {
|
|
3830
|
+
const serverId = await resolveServerId(opts.server);
|
|
3831
|
+
if (!await draftExists(serverId, name)) {
|
|
3832
|
+
console.error(`No draft flow named "${name}" on this server. Create it with: clawnify flows create ${name} --file flow.json`);
|
|
3833
|
+
process.exit(1);
|
|
3834
|
+
}
|
|
3835
|
+
let flow;
|
|
3836
|
+
let tmpDir = null;
|
|
3837
|
+
let tmpFile = null;
|
|
3838
|
+
if (opts.file) {
|
|
3839
|
+
flow = parseFlowFile(opts.file);
|
|
3840
|
+
} else {
|
|
3841
|
+
const res = await api.get(`/servers/${serverId}/flows?name=${encodeURIComponent(flowFileName(name))}`);
|
|
3842
|
+
const { flow: current } = await res.json();
|
|
3843
|
+
tmpDir = fs8.mkdtempSync(path9.join(os.tmpdir(), "clawnify-flow-"));
|
|
3844
|
+
tmpFile = path9.join(tmpDir, flowFileName(name));
|
|
3845
|
+
fs8.writeFileSync(tmpFile, JSON.stringify(current, null, 2) + "\n");
|
|
3846
|
+
const editor = process.env.VISUAL || process.env.EDITOR || "vi";
|
|
3847
|
+
const result = spawnSync(`${editor} "${tmpFile}"`, { shell: true, stdio: "inherit" });
|
|
3848
|
+
if (result.status !== 0) {
|
|
3849
|
+
console.error(`Editor exited without saving \u2014 draft unchanged (kept at ${tmpFile}).`);
|
|
3850
|
+
process.exit(1);
|
|
3851
|
+
}
|
|
3852
|
+
const edited = fs8.readFileSync(tmpFile, "utf8");
|
|
3853
|
+
if (edited === JSON.stringify(current, null, 2) + "\n") {
|
|
3854
|
+
fs8.rmSync(tmpDir, { recursive: true, force: true });
|
|
3855
|
+
console.log("No changes.");
|
|
3856
|
+
return;
|
|
3857
|
+
}
|
|
3858
|
+
try {
|
|
3859
|
+
flow = JSON.parse(edited);
|
|
3860
|
+
} catch {
|
|
3861
|
+
console.error(`Edited file is not valid JSON \u2014 draft unchanged (kept at ${tmpFile}; re-save with: clawnify flows edit ${name} --file "${tmpFile}")`);
|
|
3862
|
+
process.exit(1);
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
await saveDraft(
|
|
3866
|
+
serverId,
|
|
3867
|
+
name,
|
|
3868
|
+
flow,
|
|
3869
|
+
tmpFile ? `Draft unchanged \u2014 your edits are kept at ${tmpFile}; fix and re-save with: clawnify flows edit ${name} --file "${tmpFile}"` : void 0
|
|
3870
|
+
);
|
|
3871
|
+
if (tmpDir) fs8.rmSync(tmpDir, { recursive: true, force: true });
|
|
3872
|
+
console.log(`Saved draft "${name}". Live runs still use the last published version \u2014 publish with: clawnify flows publish ${name}`);
|
|
3873
|
+
}
|
|
3874
|
+
async function flowsPublishCommand(name, opts) {
|
|
3875
|
+
const serverId = await resolveServerId(opts.server);
|
|
3876
|
+
const res = await api.post(`/servers/${serverId}/flows/publish`, { name });
|
|
3877
|
+
const payload = await res.json().catch(() => ({}));
|
|
3878
|
+
if (res.status === 404) {
|
|
3879
|
+
console.error(`No draft flow named "${name}" on this server \u2014 nothing to publish.`);
|
|
3880
|
+
process.exit(1);
|
|
3881
|
+
}
|
|
3882
|
+
if (res.status === 422 && payload.errors) failValidation(payload);
|
|
3883
|
+
if (!res.ok) {
|
|
3884
|
+
console.error(`Failed to publish (${res.status})${payload.error ? `: ${payload.error}` : ""}.`);
|
|
3885
|
+
process.exit(1);
|
|
3886
|
+
}
|
|
3887
|
+
console.log(`Published "${name}" as v${payload.version}. flow_run and webhook triggers now use v${payload.version}.`);
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3730
3890
|
// src/cli.ts
|
|
3731
3891
|
async function runCli() {
|
|
3732
3892
|
const program = new Command();
|
|
@@ -3764,6 +3924,12 @@ async function runCli() {
|
|
|
3764
3924
|
agents.command("skills [agent]").description("Show an agent's effective skill inventory (what it can actually run, not just its workspace)").option("--server <id>", "Target server (default: the org's server)").action(agentsSkillsCommand);
|
|
3765
3925
|
agents.command("grant-skill <skill>").description("Grant an existing (main-authored) skill to one agent (--to) or every agent (--all)").option("--server <id>", "Target server (default: the org's server)").option("--to <agent>", "Grant to one specialist agent").option("--all", "Grant to every agent (shared managed root; includes future agents)").action(agentsGrantSkillCommand);
|
|
3766
3926
|
agents.command("create <slug>").description("Create a new specialist agent (RESTARTS the gateway \u2014 needs --yes)").option("--server <id>", "Target server (default: the org's server)").option("--name <name>", "Display name (default: the slug)").option("--description <role>", "The agent's role/specialization (seeded into its AGENTS.md)").option("--yes", "Confirm \u2014 proceed with the gateway restart").action(agentsCreateCommand);
|
|
3927
|
+
const flows = program.command("flows").description("Manage ClawFlows: create/edit drafts, publish versions");
|
|
3928
|
+
flows.command("list", { isDefault: true }).description("List flow drafts and their latest published version").option("--server <id>", "Target server (default: the org's server)").option("--json", "Print the raw JSON payload").action(flowsListCommand);
|
|
3929
|
+
flows.command("read <name>").description("Print a flow's current draft definition").option("--server <id>", "Target server (default: the org's server)").action(flowsReadCommand);
|
|
3930
|
+
flows.command("create <name>").description("Create a flow draft from a local JSON definition").option("--file <path>", "Flow definition JSON (required)").option("--server <id>", "Target server (default: the org's server)").action(flowsCreateCommand);
|
|
3931
|
+
flows.command("edit <name>").description("Replace a flow draft \u2014 from --file, or interactively via $EDITOR").option("--file <path>", "Flow definition JSON (default: open the current draft in $EDITOR)").option("--server <id>", "Target server (default: the org's server)").action(flowsEditCommand);
|
|
3932
|
+
flows.command("publish <name>").description("Validate the draft and publish it as the next numbered version").option("--server <id>", "Target server (default: the org's server)").action(flowsPublishCommand);
|
|
3767
3933
|
const env = program.command("env").description("Org custom environment variables (read via `connections list`)");
|
|
3768
3934
|
env.command("set <key> <value>").description("Set an org-wide custom env var (NON-SECRET config; restarts the gateway to apply)").action(envSetCommand);
|
|
3769
3935
|
env.command("unset <key>").description("Remove an org-wide custom env var (restarts the gateway to apply)").action(envUnsetCommand);
|
|
@@ -3797,4 +3963,4 @@ async function runCli() {
|
|
|
3797
3963
|
export {
|
|
3798
3964
|
runCli
|
|
3799
3965
|
};
|
|
3800
|
-
//# sourceMappingURL=cli-
|
|
3966
|
+
//# sourceMappingURL=cli-UFC2VLJT.js.map
|