@dev.sail.money/sailor 1.3.0-226 → 1.3.0-228
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/AGENTS.md +1 -1
- package/README.md +59 -498
- package/package.json +1 -5
- package/packages/cli/dist/index.cjs +53 -22
- package/packages/sdk/dist/fees.d.ts +2 -1
- package/packages/sdk/dist/fees.d.ts.map +1 -1
- package/packages/sdk/dist/fees.js +2 -1
- package/packages/sdk/dist/fees.js.map +1 -1
- package/packages/sdk/dist/intelligence.d.ts +1 -1
- package/packages/sdk/dist/intelligence.js +1 -1
- package/packages/sdk/package.json +2 -2
- package/templates/default/.agents/skills/sail-mandates/references/examples-index.md +3 -3
- package/templates/default/.agents/skills/sail-template-swap/SKILL.md +2 -2
- package/templates/default/.agents/skills/sail-template-swap-no-oracle/SKILL.md +2 -2
- package/templates/default/.agents/skills/sail-templates/SKILL.md +2 -2
- package/templates/default/docs/PERMISSION_MODEL.md +2 -2
- package/{examples → templates/default/examples}/custom-mandate/.sail/contracts/interfaces/IPermission.sol +4 -0
- package/{examples → templates/default/examples}/custom-mandate/README.md +4 -1
- package/{examples → templates/default/examples}/permissions/interfaces/IBatchPermission.sol +2 -0
- package/{examples → templates/default/examples}/permissions/interfaces/IPermission.sol +4 -0
- package/templates/default/test/BoundedCallPermission.t.sol +2 -1
- package/docs/PERMISSION_MODEL.md +0 -93
- package/examples/README.md +0 -24
- package/examples/lifi-permissions/LifiBoundedApprovePermissionCloneable.sol +0 -84
- package/examples/lifi-permissions/LifiDiamondSwapPermissionCloneable.sol +0 -97
- package/examples/lifi-permissions/README.md +0 -53
- package/scripts/check-docs.mjs +0 -309
- package/scripts/check-init.mjs +0 -123
- package/scripts/check-update.mjs +0 -177
- package/scripts/clean.mjs +0 -17
- /package/{examples → templates/default/examples}/custom-mandate/foundry.toml +0 -0
- /package/{examples → templates/default/examples}/custom-mandate/mandates/BoundedCallPermission.sol +0 -0
- /package/{examples → templates/default/examples}/custom-mandate/mandates/README.md +0 -0
- /package/{examples → templates/default/examples}/custom-mandate/mandates/SailCalldata.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedApproveAndCallBatch.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedBorrow_AaveV3_Arbitrum.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedLimitless_Base.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedPerp_GMXv2_Arbitrum.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedStake_Venice_Base.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedSupply_AaveV3_Arbitrum.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedSwapNative_UniswapV3_Base.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedSwap_UniswapV3_Base.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedSwap_UniswapV4_Unichain.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedTransfer_ERC20_Ethereum.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/BoundedVault_ERC4626_Base.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/README.md +0 -0
- /package/{examples → templates/default/examples}/permissions/SailCalldata.sol +0 -0
- /package/{examples → templates/default/examples}/permissions/foundry.toml +0 -0
package/scripts/check-update.mjs
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* `sailor update` smoke tests.
|
|
4
|
-
*
|
|
5
|
-
* PASS 1 — standard update:
|
|
6
|
-
* Deletes a template-owned file and a user skill, runs `sailor update`,
|
|
7
|
-
* asserts the template file is restored and the user skill is untouched.
|
|
8
|
-
*
|
|
9
|
-
* PASS 2 — seeds missing user-space files:
|
|
10
|
-
* Deletes a user-space file (package.json) and dir (src/), runs update,
|
|
11
|
-
* asserts they are re-added. Asserts AGENTS.md / CLAUDE.md / Dockerfile
|
|
12
|
-
* are NOT overwritten when they already exist.
|
|
13
|
-
*
|
|
14
|
-
* PASS 3 — stale path pruning:
|
|
15
|
-
* Manually creates .agents/skills/sail-ci/ (orphan from old template version),
|
|
16
|
-
* runs update, asserts it is deleted and sail-automation is present.
|
|
17
|
-
*
|
|
18
|
-
* PASS 4 — init-on-existing errors:
|
|
19
|
-
* Runs `sailor init` inside the already-initialized project;
|
|
20
|
-
* asserts it exits non-zero with an "already initialized" message.
|
|
21
|
-
*
|
|
22
|
-
* Run: node scripts/check-update.mjs (CI builds the CLI first)
|
|
23
|
-
* Exit: 0 = all passes OK, 1 = failure (prints what went wrong).
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import { execFileSync } from "node:child_process";
|
|
27
|
-
import fs from "node:fs";
|
|
28
|
-
import os from "node:os";
|
|
29
|
-
import path from "node:path";
|
|
30
|
-
import { fileURLToPath } from "node:url";
|
|
31
|
-
|
|
32
|
-
const ROOT = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
33
|
-
const BUNDLE = path.join(ROOT, "packages/cli/dist/index.cjs");
|
|
34
|
-
const PROJECT = "smoke-update";
|
|
35
|
-
|
|
36
|
-
function fail(msg) {
|
|
37
|
-
console.error(`✗ update smoke test FAILED: ${msg}`);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!fs.existsSync(BUNDLE)) {
|
|
42
|
-
fail(`CLI bundle not found at ${BUNDLE}.\n Build it first: pnpm --filter sailor build`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), "sailor-update-smoke-"));
|
|
46
|
-
const dest = path.join(tmpRoot, PROJECT);
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
// Bootstrap: fresh init so we have a valid project to update.
|
|
50
|
-
try {
|
|
51
|
-
execFileSync(process.execPath, [BUNDLE, "init", PROJECT], {
|
|
52
|
-
cwd: tmpRoot,
|
|
53
|
-
encoding: "utf-8",
|
|
54
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
55
|
-
});
|
|
56
|
-
} catch (err) {
|
|
57
|
-
const out = `${err.stdout ?? ""}${err.stderr ?? ""}`.trim();
|
|
58
|
-
fail(`bootstrap \`sailor init ${PROJECT}\` exited non-zero.\n ${out || err.message}`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// ── PASS 1 — standard update ───────────────────────────────────────────────
|
|
62
|
-
// Delete a template-owned file and add a user skill that must survive update.
|
|
63
|
-
const templateOwned = path.join(dest, ".agents/skills/sail-automation/SKILL.md");
|
|
64
|
-
const cursorRules = path.join(dest, ".cursor/rules");
|
|
65
|
-
const userSkill = path.join(dest, ".agents/skills/my-custom-skill/SKILL.md");
|
|
66
|
-
|
|
67
|
-
fs.rmSync(templateOwned);
|
|
68
|
-
fs.rmSync(cursorRules);
|
|
69
|
-
fs.mkdirSync(path.dirname(userSkill), { recursive: true });
|
|
70
|
-
fs.writeFileSync(userSkill, "# custom skill\n", "utf-8");
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
execFileSync(process.execPath, [BUNDLE, "update"], {
|
|
74
|
-
cwd: dest,
|
|
75
|
-
encoding: "utf-8",
|
|
76
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
77
|
-
});
|
|
78
|
-
} catch (err) {
|
|
79
|
-
const out = `${err.stdout ?? ""}${err.stderr ?? ""}`.trim();
|
|
80
|
-
fail(`Pass 1: \`sailor update\` exited non-zero.\n ${out || err.message}`);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (!fs.existsSync(templateOwned))
|
|
84
|
-
fail(`Pass 1: update did not restore "${path.relative(dest, templateOwned)}"`);
|
|
85
|
-
if (!fs.existsSync(cursorRules))
|
|
86
|
-
fail(`Pass 1: update did not restore "${path.relative(dest, cursorRules)}"`);
|
|
87
|
-
if (!fs.existsSync(userSkill))
|
|
88
|
-
fail(`Pass 1: update removed user file "${path.relative(dest, userSkill)}" — must be preserved`);
|
|
89
|
-
|
|
90
|
-
console.log("✓ Pass 1 passed — template files restored, user skill preserved");
|
|
91
|
-
|
|
92
|
-
// ── PASS 2 — seeds missing user-space files ───────────────────────────────
|
|
93
|
-
const agentsMd = path.join(dest, "AGENTS.md");
|
|
94
|
-
const claudeMd = path.join(dest, "CLAUDE.md");
|
|
95
|
-
const dockerfile = path.join(dest, "Dockerfile");
|
|
96
|
-
const packageJson = path.join(dest, "package.json");
|
|
97
|
-
const srcDir = path.join(dest, "src");
|
|
98
|
-
|
|
99
|
-
// Record AGENTS.md content before update — it must not change.
|
|
100
|
-
const agentsContentBefore = fs.readFileSync(agentsMd, "utf-8");
|
|
101
|
-
|
|
102
|
-
fs.rmSync(packageJson);
|
|
103
|
-
fs.rmSync(srcDir, { recursive: true });
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
execFileSync(process.execPath, [BUNDLE, "update"], {
|
|
107
|
-
cwd: dest,
|
|
108
|
-
encoding: "utf-8",
|
|
109
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
110
|
-
});
|
|
111
|
-
} catch (err) {
|
|
112
|
-
const out = `${err.stdout ?? ""}${err.stderr ?? ""}`.trim();
|
|
113
|
-
fail(`Pass 2: \`sailor update\` exited non-zero.\n ${out || err.message}`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (!fs.existsSync(packageJson))
|
|
117
|
-
fail(`Pass 2: update did not re-add missing "package.json"`);
|
|
118
|
-
if (!fs.existsSync(srcDir))
|
|
119
|
-
fail(`Pass 2: update did not re-add missing "src/" directory`);
|
|
120
|
-
|
|
121
|
-
// AGENTS.md, CLAUDE.md, Dockerfile must not be overwritten.
|
|
122
|
-
const agentsContentAfter = fs.readFileSync(agentsMd, "utf-8");
|
|
123
|
-
if (agentsContentAfter !== agentsContentBefore)
|
|
124
|
-
fail(`Pass 2: update overwrote "AGENTS.md" — user-space files must never be overwritten`);
|
|
125
|
-
if (!fs.existsSync(claudeMd))
|
|
126
|
-
fail(`Pass 2: "CLAUDE.md" is missing after update`);
|
|
127
|
-
if (!fs.existsSync(dockerfile))
|
|
128
|
-
fail(`Pass 2: "Dockerfile" is missing after update`);
|
|
129
|
-
|
|
130
|
-
console.log("✓ Pass 2 passed — missing user-space files seeded, existing ones untouched");
|
|
131
|
-
|
|
132
|
-
// ── PASS 3 — stale path pruning ───────────────────────────────────────────
|
|
133
|
-
const staleSkill = path.join(dest, ".agents/skills/sail-ci/SKILL.md");
|
|
134
|
-
fs.mkdirSync(path.dirname(staleSkill), { recursive: true });
|
|
135
|
-
fs.writeFileSync(staleSkill, "# old sail-ci skill\n", "utf-8");
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
execFileSync(process.execPath, [BUNDLE, "update"], {
|
|
139
|
-
cwd: dest,
|
|
140
|
-
encoding: "utf-8",
|
|
141
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
142
|
-
});
|
|
143
|
-
} catch (err) {
|
|
144
|
-
const out = `${err.stdout ?? ""}${err.stderr ?? ""}`.trim();
|
|
145
|
-
fail(`Pass 3: \`sailor update\` exited non-zero.\n ${out || err.message}`);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (fs.existsSync(path.join(dest, ".agents/skills/sail-ci")))
|
|
149
|
-
fail(`Pass 3: stale ".agents/skills/sail-ci" was not removed`);
|
|
150
|
-
if (!fs.existsSync(path.join(dest, ".agents/skills/sail-automation/SKILL.md")))
|
|
151
|
-
fail(`Pass 3: ".agents/skills/sail-automation/SKILL.md" missing after update`);
|
|
152
|
-
|
|
153
|
-
console.log("✓ Pass 3 passed — stale sail-ci skill pruned, sail-automation present");
|
|
154
|
-
|
|
155
|
-
// ── PASS 4 — init-on-existing errors ──────────────────────────────────────
|
|
156
|
-
let initRejected = false;
|
|
157
|
-
let initOutput = "";
|
|
158
|
-
try {
|
|
159
|
-
initOutput = execFileSync(process.execPath, [BUNDLE, "init"], {
|
|
160
|
-
cwd: dest,
|
|
161
|
-
encoding: "utf-8",
|
|
162
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
163
|
-
});
|
|
164
|
-
} catch (err) {
|
|
165
|
-
initRejected = true;
|
|
166
|
-
initOutput = `${err.stdout ?? ""}${err.stderr ?? ""}`.trim();
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (!initRejected)
|
|
170
|
-
fail(`Pass 4: \`sailor init\` on existing project did not exit non-zero — should refuse`);
|
|
171
|
-
if (!/already initialized/i.test(initOutput))
|
|
172
|
-
fail(`Pass 4: error message did not mention "already initialized".\n output: ${initOutput}`);
|
|
173
|
-
|
|
174
|
-
console.log("✓ Pass 4 passed — init on existing project correctly refused");
|
|
175
|
-
} finally {
|
|
176
|
-
fs.rmSync(tmpRoot, { recursive: true, force: true });
|
|
177
|
-
}
|
package/scripts/clean.mjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { rmSync } from "node:fs";
|
|
2
|
-
|
|
3
|
-
const targets = [
|
|
4
|
-
"node_modules",
|
|
5
|
-
"packages/sdk/node_modules",
|
|
6
|
-
"packages/sdk/dist",
|
|
7
|
-
"packages/sdk/tsconfig.tsbuildinfo",
|
|
8
|
-
"packages/cli/node_modules",
|
|
9
|
-
"packages/cli/dist",
|
|
10
|
-
"packages/ui/node_modules",
|
|
11
|
-
"packages/ui/dist",
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
for (const p of targets) {
|
|
15
|
-
rmSync(p, { recursive: true, force: true });
|
|
16
|
-
console.log(` removed ${p}`);
|
|
17
|
-
}
|
|
File without changes
|
/package/{examples → templates/default/examples}/custom-mandate/mandates/BoundedCallPermission.sol
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{examples → templates/default/examples}/permissions/BoundedBorrow_AaveV3_Arbitrum.sol
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{examples → templates/default/examples}/permissions/BoundedSupply_AaveV3_Arbitrum.sol
RENAMED
|
File without changes
|
/package/{examples → templates/default/examples}/permissions/BoundedSwapNative_UniswapV3_Base.sol
RENAMED
|
File without changes
|
|
File without changes
|
/package/{examples → templates/default/examples}/permissions/BoundedSwap_UniswapV4_Unichain.sol
RENAMED
|
File without changes
|
/package/{examples → templates/default/examples}/permissions/BoundedTransfer_ERC20_Ethereum.sol
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|