@singularity-layer/cli 0.2.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/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/auth.d.ts +111 -0
- package/dist/bundle.d.ts +42 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +1038 -0
- package/dist/format.d.ts +28 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +309 -0
- package/dist/processors.d.ts +10 -0
- package/dist/version.d.ts +11 -0
- package/package.json +78 -0
package/dist/format.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting and coercion. Small, pure, and separated because both are places where the obvious
|
|
3
|
+
* implementation is quietly wrong about money or types.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Integer micro-USDC -> a dollar string, WITHOUT ever touching a float.
|
|
7
|
+
*
|
|
8
|
+
* `micro / 1e6` is the obvious version and it is wrong for money. Every amount in this system is an
|
|
9
|
+
* integer count of micro-USDC, and the server's ledger is computed from those integers; dividing by
|
|
10
|
+
* 1e6 in IEEE-754 produces values that disagree with it in the last digits. A publisher reconciling
|
|
11
|
+
* a payout against a chain explorer then finds two numbers that should be identical and are not,
|
|
12
|
+
* with no way to tell which one is lying.
|
|
13
|
+
*
|
|
14
|
+
* Six decimal places always, because that is USDC's actual precision — trimming trailing zeros would
|
|
15
|
+
* make $0.010000 and $0.01 look like different levels of certainty about the same amount.
|
|
16
|
+
*/
|
|
17
|
+
export declare function usd(micro: number | string | bigint | null | undefined): string;
|
|
18
|
+
/** A timestamp a human reads, in UTC. Local time would make two people's logs disagree. */
|
|
19
|
+
export declare const when: (iso: string | null | undefined) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Turn typed terminal input into the type the schema declares.
|
|
22
|
+
*
|
|
23
|
+
* DRIVEN BY THE SCHEMA, NEVER GUESSED FROM THE TEXT. Guessing is the tempting version — "it looks
|
|
24
|
+
* like a number, make it a number" — and it silently corrupts the two cases that matter most: a
|
|
25
|
+
* numeric id or an account number becomes a float and loses precision, and a zip code like 02134
|
|
26
|
+
* loses its leading zero. The processor declared what it wants; this obeys that.
|
|
27
|
+
*/
|
|
28
|
+
export declare function coerce(raw: string, type: string | undefined): unknown;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The programmatic entry point: `import { ... } from '@singularity-layer/cli'`.
|
|
3
|
+
*
|
|
4
|
+
* WHY A LIBRARY SURFACE AT ALL. The CLI is a thin wrapper over signed HTTP, and the parts worth
|
|
5
|
+
* reusing are the parts that are easy to get subtly wrong: the signature scheme (a wrong byte gives
|
|
6
|
+
* an unexplained 401), the micro-USDC formatting (a float gives numbers that disagree with the
|
|
7
|
+
* ledger), and the bundler configuration (a wrong target gives a processor that fails at runtime
|
|
8
|
+
* inside a paid run). Anyone building a dashboard, a CI step, or an agent that deploys processors
|
|
9
|
+
* should not reimplement those.
|
|
10
|
+
*
|
|
11
|
+
* WHAT IS DELIBERATELY NOT EXPORTED: the subcommand implementations. They call process.exit and
|
|
12
|
+
* write to stderr, which is right for a terminal and wrong inside someone else's program. If a
|
|
13
|
+
* command's behaviour is worth having programmatically, it gets extracted properly rather than
|
|
14
|
+
* exposed as-is.
|
|
15
|
+
*/
|
|
16
|
+
export { api, loadKeypair, bs58, parseArgs, type Keypair, type Flags, type ApiOpts } from './auth.js';
|
|
17
|
+
export { bundleProcessor, MAX_BUNDLE_BYTES, type BundleResult } from './bundle.js';
|
|
18
|
+
export { usd, when, coerce } from './format.js';
|
|
19
|
+
export { VERSION } from './version.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
// src/auth.ts
|
|
2
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import nacl from "tweetnacl";
|
|
6
|
+
var die = (msg) => {
|
|
7
|
+
console.error(`error: ${msg}`);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
};
|
|
10
|
+
var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
11
|
+
function bs58(bytes) {
|
|
12
|
+
let zeros = 0;
|
|
13
|
+
while (zeros < bytes.length && bytes[zeros] === 0) zeros++;
|
|
14
|
+
const digits = [];
|
|
15
|
+
for (let k = zeros; k < bytes.length; k++) {
|
|
16
|
+
let carry = bytes[k];
|
|
17
|
+
for (let i = 0; i < digits.length; i++) {
|
|
18
|
+
carry += digits[i] << 8;
|
|
19
|
+
digits[i] = carry % 58;
|
|
20
|
+
carry = carry / 58 | 0;
|
|
21
|
+
}
|
|
22
|
+
while (carry > 0) {
|
|
23
|
+
digits.push(carry % 58);
|
|
24
|
+
carry = carry / 58 | 0;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let out = "1".repeat(zeros);
|
|
28
|
+
for (let i = digits.length - 1; i >= 0; i--) out += B58[digits[i]];
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
function loadKeypair(flags = {}) {
|
|
32
|
+
const path = String(
|
|
33
|
+
flags.keypair || process.env.SINGULARITY_KEYPAIR || process.env.SGLPROC_KEYPAIR || join(homedir(), ".config/solana/id.json")
|
|
34
|
+
);
|
|
35
|
+
if (!existsSync(path)) {
|
|
36
|
+
die(`no keypair at ${path}
|
|
37
|
+
pass --keypair <path>, set SINGULARITY_KEYPAIR, or create one:
|
|
38
|
+
solana-keygen new`);
|
|
39
|
+
}
|
|
40
|
+
let raw;
|
|
41
|
+
try {
|
|
42
|
+
raw = JSON.parse(readFileSync(path, "utf8"));
|
|
43
|
+
} catch {
|
|
44
|
+
die(`${path} is not a valid keypair file`);
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(raw) || raw.length !== 64 && raw.length !== 32) {
|
|
47
|
+
die(`${path} does not look like a Solana keypair (expected a 64-byte array)`);
|
|
48
|
+
}
|
|
49
|
+
const arr = raw;
|
|
50
|
+
const secret = arr.length === 64 ? Uint8Array.from(arr) : nacl.sign.keyPair.fromSeed(Uint8Array.from(arr)).secretKey;
|
|
51
|
+
const pair = nacl.sign.keyPair.fromSecretKey(secret);
|
|
52
|
+
return { secretKey: pair.secretKey, address: bs58(pair.publicKey) };
|
|
53
|
+
}
|
|
54
|
+
async function sha256Hex(input) {
|
|
55
|
+
const d = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(input));
|
|
56
|
+
return [...new Uint8Array(d)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
57
|
+
}
|
|
58
|
+
async function api(base, method, path, { body, kp, bearer, query, signQuery } = {}) {
|
|
59
|
+
let qs = "";
|
|
60
|
+
if (query) {
|
|
61
|
+
const params = new URLSearchParams();
|
|
62
|
+
for (const [k, v] of Object.entries(query)) {
|
|
63
|
+
if (Array.isArray(v)) for (const item of v) params.append(k, String(item));
|
|
64
|
+
else params.append(k, String(v));
|
|
65
|
+
}
|
|
66
|
+
const encoded = params.toString();
|
|
67
|
+
if (encoded) qs = "?" + encoded;
|
|
68
|
+
}
|
|
69
|
+
const signedRaw = method === "GET" ? signQuery ? qs : "" : body === void 0 ? "" : JSON.stringify(body);
|
|
70
|
+
const sentRaw = method === "GET" ? void 0 : body === void 0 ? void 0 : signedRaw;
|
|
71
|
+
const headers = {};
|
|
72
|
+
if (sentRaw) headers["content-type"] = "application/json";
|
|
73
|
+
if (bearer) headers.Authorization = `Bearer ${bearer}`;
|
|
74
|
+
if (kp) {
|
|
75
|
+
const timestamp = String(Math.floor(Date.now() / 1e3));
|
|
76
|
+
const nonce = [...nacl.randomBytes(12)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
77
|
+
const msg = `sgl-processor-auth:${method}:${path}:${await sha256Hex(signedRaw)}:${kp.address}:${timestamp}:${nonce}`;
|
|
78
|
+
const sig = nacl.sign.detached(new TextEncoder().encode(msg), kp.secretKey);
|
|
79
|
+
Object.assign(headers, {
|
|
80
|
+
"X-Auth-Address": kp.address,
|
|
81
|
+
"X-Auth-Chain": "solana",
|
|
82
|
+
"X-Auth-Signature": Buffer.from(sig).toString("base64"),
|
|
83
|
+
"X-Auth-Timestamp": timestamp,
|
|
84
|
+
"X-Auth-Nonce": nonce
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
let res;
|
|
88
|
+
try {
|
|
89
|
+
res = await fetch(`${base}${path}${qs}`, { method, headers, body: sentRaw });
|
|
90
|
+
} catch (e) {
|
|
91
|
+
return die(`could not reach ${base} \u2014 ${e instanceof Error ? e.message : String(e)}`);
|
|
92
|
+
}
|
|
93
|
+
const text = await res.text();
|
|
94
|
+
let parsed;
|
|
95
|
+
try {
|
|
96
|
+
parsed = text ? JSON.parse(text) : void 0;
|
|
97
|
+
} catch {
|
|
98
|
+
parsed = void 0;
|
|
99
|
+
}
|
|
100
|
+
if (!res.ok) {
|
|
101
|
+
const p = parsed ?? {};
|
|
102
|
+
return die(`${res.status} ${p.detail || p.error || text.slice(0, 300)}`);
|
|
103
|
+
}
|
|
104
|
+
return parsed;
|
|
105
|
+
}
|
|
106
|
+
var SHORT_FLAGS = {
|
|
107
|
+
i: "interactive",
|
|
108
|
+
f: "follow",
|
|
109
|
+
y: "yes",
|
|
110
|
+
j: "json"
|
|
111
|
+
};
|
|
112
|
+
function parseArgs(argv) {
|
|
113
|
+
const flags = {};
|
|
114
|
+
const words = [];
|
|
115
|
+
for (let i = 0; i < argv.length; i++) {
|
|
116
|
+
const tok = argv[i];
|
|
117
|
+
if (tok.startsWith("--")) {
|
|
118
|
+
const name = tok.slice(2);
|
|
119
|
+
const next = argv[i + 1];
|
|
120
|
+
if (next === void 0 || next.startsWith("-")) flags[name] = true;
|
|
121
|
+
else {
|
|
122
|
+
flags[name] = next;
|
|
123
|
+
i++;
|
|
124
|
+
}
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const short = /^-([a-zA-Z])$/.exec(tok);
|
|
128
|
+
if (short && SHORT_FLAGS[short[1]]) {
|
|
129
|
+
flags[SHORT_FLAGS[short[1]]] = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
words.push(tok);
|
|
133
|
+
}
|
|
134
|
+
return { words, flags };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/bundle.ts
|
|
138
|
+
import { build } from "esbuild";
|
|
139
|
+
import { readFileSync as readFileSync2, existsSync as existsSync2, lstatSync, realpathSync } from "node:fs";
|
|
140
|
+
import { join as join2, relative, isAbsolute, sep } from "node:path";
|
|
141
|
+
import { createHash } from "node:crypto";
|
|
142
|
+
var MAX_BUNDLE_BYTES = 1048576;
|
|
143
|
+
var UNAVAILABLE_BUILTINS = /* @__PURE__ */ new Set([
|
|
144
|
+
"fs",
|
|
145
|
+
"node:fs",
|
|
146
|
+
"fs/promises",
|
|
147
|
+
"node:fs/promises",
|
|
148
|
+
"child_process",
|
|
149
|
+
"node:child_process",
|
|
150
|
+
"worker_threads",
|
|
151
|
+
"node:worker_threads",
|
|
152
|
+
"net",
|
|
153
|
+
"node:net",
|
|
154
|
+
"tls",
|
|
155
|
+
"node:tls",
|
|
156
|
+
"dns",
|
|
157
|
+
"node:dns",
|
|
158
|
+
"cluster",
|
|
159
|
+
"node:cluster",
|
|
160
|
+
"os",
|
|
161
|
+
"node:os",
|
|
162
|
+
"v8",
|
|
163
|
+
"node:v8",
|
|
164
|
+
"repl",
|
|
165
|
+
"node:repl",
|
|
166
|
+
"vm",
|
|
167
|
+
"node:vm"
|
|
168
|
+
]);
|
|
169
|
+
function guardBuiltins() {
|
|
170
|
+
return {
|
|
171
|
+
name: "sgl-guard-builtins",
|
|
172
|
+
setup(b) {
|
|
173
|
+
b.onResolve({ filter: /.*/ }, (args) => {
|
|
174
|
+
if (!UNAVAILABLE_BUILTINS.has(args.path)) return null;
|
|
175
|
+
return {
|
|
176
|
+
errors: [{
|
|
177
|
+
text: `"${args.path}" is not available in a processor. Processors run in a Cloudflare isolate: there is no filesystem, no child processes and no raw sockets. Outbound HTTPS to hosts you declared in egress.allow is the way out. Imported by ` + (args.importer || "your entry file") + "."
|
|
178
|
+
}]
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function collectSources(dir, inputs) {
|
|
185
|
+
const out = {};
|
|
186
|
+
const root = realpathSync(dir);
|
|
187
|
+
for (const rel of inputs) {
|
|
188
|
+
if (rel.split("/").includes("node_modules")) continue;
|
|
189
|
+
const full = isAbsolute(rel) ? rel : join2(dir, rel);
|
|
190
|
+
let st;
|
|
191
|
+
try {
|
|
192
|
+
st = lstatSync(full);
|
|
193
|
+
} catch {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (!st.isFile()) continue;
|
|
197
|
+
const real = realpathSync(full);
|
|
198
|
+
if (real !== root && !real.startsWith(root + sep)) continue;
|
|
199
|
+
if (st.size > 256 * 1024) continue;
|
|
200
|
+
out[relative(root, real)] = readFileSync2(real, "utf8");
|
|
201
|
+
}
|
|
202
|
+
return out;
|
|
203
|
+
}
|
|
204
|
+
async function bundleProcessor(opts) {
|
|
205
|
+
const { entry, cwd } = opts;
|
|
206
|
+
if (!existsSync2(entry)) {
|
|
207
|
+
throw new Error(`no entry file at ${entry}`);
|
|
208
|
+
}
|
|
209
|
+
let result;
|
|
210
|
+
try {
|
|
211
|
+
result = await build({
|
|
212
|
+
entryPoints: [entry],
|
|
213
|
+
absWorkingDir: cwd,
|
|
214
|
+
bundle: true,
|
|
215
|
+
write: false,
|
|
216
|
+
// The list of files esbuild actually read. This IS the provenance set — see
|
|
217
|
+
// collectSources() for why a directory walk was a wallet-key exfiltration path.
|
|
218
|
+
metafile: true,
|
|
219
|
+
format: "esm",
|
|
220
|
+
// The isolate's own target. `browser` would pull in DOM shims that do not exist; `node`
|
|
221
|
+
// would resolve Node built-ins we cannot provide.
|
|
222
|
+
platform: "neutral",
|
|
223
|
+
target: "es2022",
|
|
224
|
+
mainFields: ["module", "main"],
|
|
225
|
+
conditions: ["worker", "browser", "import", "default"],
|
|
226
|
+
minify: opts.minify === true,
|
|
227
|
+
// Keeps the publisher's own function and variable names in run errors.
|
|
228
|
+
keepNames: true,
|
|
229
|
+
plugins: [guardBuiltins()],
|
|
230
|
+
logLevel: "silent"
|
|
231
|
+
});
|
|
232
|
+
} catch (e) {
|
|
233
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
234
|
+
throw new Error(`bundling failed:
|
|
235
|
+
${msg}`);
|
|
236
|
+
}
|
|
237
|
+
const output = result.outputFiles?.[0];
|
|
238
|
+
if (!output) throw new Error("bundling produced no output");
|
|
239
|
+
const bundle = new TextDecoder().decode(output.contents);
|
|
240
|
+
const bytes = new TextEncoder().encode(bundle).byteLength;
|
|
241
|
+
if (bytes > MAX_BUNDLE_BYTES) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`bundle is ${(bytes / 1024).toFixed(0)} KiB, over the ${MAX_BUNDLE_BYTES / 1024} KiB limit. Try --minify, or drop a heavy dependency.`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
const files = collectSources(cwd, Object.keys(result.metafile?.inputs ?? {}));
|
|
247
|
+
const sources = {};
|
|
248
|
+
for (const [path, src] of Object.entries(files)) {
|
|
249
|
+
sources[path] = createHash("sha256").update(src).digest("hex");
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
bundle,
|
|
253
|
+
files,
|
|
254
|
+
meta: {
|
|
255
|
+
bundler: `esbuild`,
|
|
256
|
+
entry: relative(cwd, entry),
|
|
257
|
+
bytes,
|
|
258
|
+
sources
|
|
259
|
+
},
|
|
260
|
+
warnings: (result.warnings ?? []).map((w) => w.text)
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// src/format.ts
|
|
265
|
+
function usd(micro) {
|
|
266
|
+
const n = BigInt(micro ?? 0);
|
|
267
|
+
const sign = n < 0n ? "-" : "";
|
|
268
|
+
const a = n < 0n ? -n : n;
|
|
269
|
+
return `${sign}${a / 1000000n}.${String(a % 1000000n).padStart(6, "0")}`;
|
|
270
|
+
}
|
|
271
|
+
var when = (iso) => iso ? new Date(iso).toISOString().replace("T", " ").slice(0, 19) : "";
|
|
272
|
+
function coerce(raw, type) {
|
|
273
|
+
switch (type) {
|
|
274
|
+
case "number":
|
|
275
|
+
case "integer": {
|
|
276
|
+
const n = Number(raw);
|
|
277
|
+
if (!Number.isFinite(n)) return die(`"${raw}" is not a number`);
|
|
278
|
+
return type === "integer" ? Math.trunc(n) : n;
|
|
279
|
+
}
|
|
280
|
+
case "boolean":
|
|
281
|
+
if (/^(true|yes|y|1)$/i.test(raw)) return true;
|
|
282
|
+
if (/^(false|no|n|0)$/i.test(raw)) return false;
|
|
283
|
+
return die(`"${raw}" is not true or false`);
|
|
284
|
+
case "array":
|
|
285
|
+
case "object":
|
|
286
|
+
try {
|
|
287
|
+
return JSON.parse(raw);
|
|
288
|
+
} catch {
|
|
289
|
+
return die(`"${raw}" is not valid JSON`);
|
|
290
|
+
}
|
|
291
|
+
default:
|
|
292
|
+
return raw;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/version.ts
|
|
297
|
+
var VERSION = "0.2.0";
|
|
298
|
+
export {
|
|
299
|
+
MAX_BUNDLE_BYTES,
|
|
300
|
+
VERSION,
|
|
301
|
+
api,
|
|
302
|
+
bs58,
|
|
303
|
+
bundleProcessor,
|
|
304
|
+
coerce,
|
|
305
|
+
loadKeypair,
|
|
306
|
+
parseArgs,
|
|
307
|
+
usd,
|
|
308
|
+
when
|
|
309
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `singularity processors` — deploy and manage Processors.
|
|
3
|
+
*
|
|
4
|
+
* A Processor is a loop you write; we host it and run it on demand, and buyers pay you directly per
|
|
5
|
+
* call. Everything the dashboard does is a wallet-signed HTTP call, so this is the same API, not a
|
|
6
|
+
* reduced one — and an agent can drive it identically.
|
|
7
|
+
*/
|
|
8
|
+
import { type Flags } from './auth.js';
|
|
9
|
+
export declare const HELP = "singularity processors \u2014 deploy loops we host and run\n\n init [slug] scaffold processor.json + processor.js here\n configure interactive setup: keypair, defaults\n deploy create it (prints the invoke token ONCE)\n update push new code or manifest\n run '{\"n\":10}' invoke and print the output\n run --get '{\"n\":10}' invoke over GET (for methods: [\"GET\"] processors)\n call -i invoke interactively, prompted per input field\n schema [slug] the input/output schema buyers and agents see\n list your processors\n search [query] the public catalogue\n logs [slug] recent runs and failure rate\n logs --follow stream new runs as they happen\n revenue sales and compute spend across everything you own\n earnings [slug] the same, for one processor\n env list | unset KEY which secrets are set; clear one\n secrets KEY=value ... set secret values (KEY= also clears)\n pause | resume stop or restart traffic, keeping the slug\n publish | unpublish list or unlist publicly (instant, no review)\n rotate new invoke token, the old one stops working\n delete --yes soft delete (the slug is never reusable)\n\n --keypair <path> defaults to ~/.config/solana/id.json\n --slug <slug> when not run from a processor directory\n --json machine-readable output, for scripts and agents\n --bundle bundle with esbuild: imports and npm packages\n --entry <file> bundle entry (default: the manifest's $code)";
|
|
10
|
+
export declare function run(words: string[], flags: Flags): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version, in its own module for one specific reason.
|
|
3
|
+
*
|
|
4
|
+
* cli.ts CALLS main() at import time — that is what makes it an executable. So anything that
|
|
5
|
+
* re-exports from cli.ts drags that side effect along with it: `import { VERSION } from
|
|
6
|
+
* '@singularity-layer/cli'` inside someone's dashboard would parse process.argv, print help, and
|
|
7
|
+
* exit their process. The bundler makes it worse, not better, by inlining the call into dist/index.js.
|
|
8
|
+
*
|
|
9
|
+
* Kept in sync with package.json by the release workflow, which is the only thing that bumps either.
|
|
10
|
+
*/
|
|
11
|
+
export declare const VERSION = "0.2.0";
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@singularity-layer/cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Singularity developer CLI \u2014 deploy paid endpoints (Processors) on the Singularity Cloud Network",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"singularity": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node build.mjs",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"esbuild": "^0.25.0",
|
|
33
|
+
"tweetnacl": "^1.0.3"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"typescript": "^5.6.0",
|
|
38
|
+
"vitest": "^2.1.9"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"singularity",
|
|
42
|
+
"processors",
|
|
43
|
+
"x402",
|
|
44
|
+
"serverless",
|
|
45
|
+
"agents",
|
|
46
|
+
"solana",
|
|
47
|
+
"mcp"
|
|
48
|
+
],
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/Singularity-Layer/singularity-cli.git"
|
|
53
|
+
},
|
|
54
|
+
"//": [
|
|
55
|
+
"PACKAGE NAME vs COMMAND NAME are deliberately different. The bare `singularity` name on npm",
|
|
56
|
+
"belongs to someone else, so the package is scoped \u2014 matching the rest of the family. The BIN",
|
|
57
|
+
"is still `singularity`, so users type what they expect.",
|
|
58
|
+
"",
|
|
59
|
+
"esbuild is a RUNTIME dependency, not a build-time one: the CLI bundles the publisher's processor",
|
|
60
|
+
"for them. That is what makes npm packages and multi-file TypeScript processors possible at all \u2014",
|
|
61
|
+
"bundling happens on the publisher's machine, because running `npm install` on our infrastructure",
|
|
62
|
+
"would mean executing arbitrary postinstall scripts on a box holding platform credentials.",
|
|
63
|
+
"",
|
|
64
|
+
"THIS REPO IS PUBLIC ON PURPOSE. People hand this CLI a Solana keypair, so the code that signs with",
|
|
65
|
+
"it should be readable, and npm provenance \u2014 which attests the tarball was built from a named commit",
|
|
66
|
+
"by the release workflow \u2014 is only available for public sources.",
|
|
67
|
+
"",
|
|
68
|
+
"This is the DEVELOPER CLI: one command, subcommands per product. It is deliberately NOT:",
|
|
69
|
+
" \u2022 `sgl` \u2014 the Rust node-operator daemon. Different audience and runtime, and its",
|
|
70
|
+
" releases are hash-allowlisted, so coupling would slow both.",
|
|
71
|
+
" \u2022 `sglcode` \u2014 the agentic coding CLI, a product in its own right.",
|
|
72
|
+
"The rule that stops sprawl: new capabilities become SUBCOMMANDS here, never new binaries."
|
|
73
|
+
],
|
|
74
|
+
"homepage": "https://github.com/Singularity-Layer/singularity-cli#readme",
|
|
75
|
+
"bugs": {
|
|
76
|
+
"url": "https://github.com/Singularity-Layer/singularity-cli/issues"
|
|
77
|
+
}
|
|
78
|
+
}
|