wao 0.38.0 → 0.39.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/cjs/cli.js +543 -46
- package/cjs/create.js +519 -30
- package/cjs/devs.js +4 -0
- package/cjs/hb.js +614 -232
- package/cjs/hyper-aos.js +1 -1
- package/cjs/hyperbeam.js +362 -85
- package/cjs/utils.js +4 -0
- package/cjs/workspace/.claude/agents/builder.md +66 -0
- package/cjs/workspace/.claude/agents/tester.md +48 -0
- package/cjs/workspace/.claude/rules/deploy.md +37 -0
- package/cjs/workspace/.claude/rules/lua.md +41 -0
- package/cjs/workspace/.claude/rules/testing.md +134 -0
- package/cjs/workspace/.claude/settings.json +31 -0
- package/cjs/workspace/.claude/skills/create-handler/SKILL.md +58 -0
- package/cjs/workspace/.claude/skills/deploy/SKILL.md +29 -0
- package/cjs/workspace/.claude/skills/test/SKILL.md +34 -0
- package/cjs/workspace/.claude/skills/test-hb/SKILL.md +46 -0
- package/cjs/workspace/CLAUDE.md +77 -0
- package/cjs/workspace/README.md +20 -0
- package/cjs/workspace/package.json +2 -2
- package/esm/cli.js +334 -7
- package/esm/create.js +329 -7
- package/esm/devs.js +1 -0
- package/esm/hb.js +275 -63
- package/esm/hyper-aos.js +1 -1
- package/esm/hyperbeam.js +289 -49
- package/esm/utils.js +2 -0
- package/esm/workspace/.claude/agents/builder.md +66 -0
- package/esm/workspace/.claude/agents/tester.md +48 -0
- package/esm/workspace/.claude/rules/deploy.md +37 -0
- package/esm/workspace/.claude/rules/lua.md +41 -0
- package/esm/workspace/.claude/rules/testing.md +134 -0
- package/esm/workspace/.claude/settings.json +31 -0
- package/esm/workspace/.claude/skills/create-handler/SKILL.md +58 -0
- package/esm/workspace/.claude/skills/deploy/SKILL.md +29 -0
- package/esm/workspace/.claude/skills/test/SKILL.md +34 -0
- package/esm/workspace/.claude/skills/test-hb/SKILL.md +46 -0
- package/esm/workspace/CLAUDE.md +77 -0
- package/esm/workspace/README.md +20 -0
- package/esm/workspace/package.json +2 -2
- package/package.json +2 -2
- package/cjs/weavedb.js +0 -519
- package/esm/weavedb.js +0 -393
package/cjs/cli.js
CHANGED
|
@@ -7,12 +7,17 @@ var _path = require("path");
|
|
|
7
7
|
var _nodeUtil = _interopRequireDefault(require("node:util"));
|
|
8
8
|
var _nodeChild_process = require("node:child_process");
|
|
9
9
|
var _fs = require("fs");
|
|
10
|
+
var _readline = require("readline");
|
|
11
|
+
var _arweave = _interopRequireDefault(require("arweave"));
|
|
10
12
|
var _cmds$args$;
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
14
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
13
15
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
14
16
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
15
17
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
18
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
21
|
var args = process.argv.slice(2);
|
|
17
22
|
var exec = _nodeUtil["default"].promisify(_nodeChild_process.exec);
|
|
18
23
|
var cmds = {
|
|
@@ -39,81 +44,573 @@ if (!cmd) {
|
|
|
39
44
|
console.log("The wrong command");
|
|
40
45
|
process.exit();
|
|
41
46
|
}
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
var dim = function dim(t) {
|
|
48
|
+
return "\x1B[2m".concat(t, "\x1B[22m");
|
|
49
|
+
};
|
|
50
|
+
var bold = function bold(t) {
|
|
51
|
+
return "\x1B[1m".concat(t, "\x1B[22m");
|
|
52
|
+
};
|
|
53
|
+
var cyan = function cyan(t) {
|
|
54
|
+
return "\x1B[36m".concat(t, "\x1B[39m");
|
|
55
|
+
};
|
|
56
|
+
var green = function green(t) {
|
|
57
|
+
return "\x1B[32m".concat(t, "\x1B[39m");
|
|
58
|
+
};
|
|
59
|
+
var red = function red(t) {
|
|
60
|
+
return "\x1B[31m".concat(t, "\x1B[39m");
|
|
61
|
+
};
|
|
62
|
+
var yellow = function yellow(t) {
|
|
63
|
+
return "\x1B[33m".concat(t, "\x1B[39m");
|
|
64
|
+
};
|
|
65
|
+
var magenta = function magenta(t) {
|
|
66
|
+
return "\x1B[35m".concat(t, "\x1B[39m");
|
|
67
|
+
};
|
|
68
|
+
var splash = function splash() {
|
|
69
|
+
var logo = ["██╗ ██╗ █████╗ ██████╗ ", "██║ ██║██╔══██╗██╔═══██╗", "██║ █╗ ██║███████║██║ ██║", "██║███╗██║██╔══██║██║ ██║", "╚███╔███╔╝██║ ██║╚██████╔╝", " ╚══╝╚══╝ ╚═╝ ╚═╝ ╚═════╝ "];
|
|
70
|
+
console.log();
|
|
71
|
+
for (var _i = 0, _logo = logo; _i < _logo.length; _i++) {
|
|
72
|
+
var line = _logo[_i];
|
|
73
|
+
console.log(" ".concat(cyan(line)));
|
|
74
|
+
}
|
|
75
|
+
console.log(" ".concat(dim("WizardAO SDK for Vibe Engineering")));
|
|
76
|
+
console.log();
|
|
77
|
+
};
|
|
78
|
+
var tree = function tree(title) {
|
|
79
|
+
var frames = ["◒", "◐", "◓", "◑"];
|
|
80
|
+
var steps = [];
|
|
81
|
+
var active = null;
|
|
82
|
+
var intervalId = null;
|
|
83
|
+
var startTime = Date.now();
|
|
84
|
+
var elapsed = function elapsed(from) {
|
|
85
|
+
var ms = Date.now() - from;
|
|
86
|
+
return ms < 1000 ? "".concat(ms, "ms") : "".concat((ms / 1000).toFixed(1), "s");
|
|
87
|
+
};
|
|
88
|
+
var render = function render() {
|
|
89
|
+
var lines = [];
|
|
90
|
+
lines.push("");
|
|
91
|
+
lines.push(" ".concat(bold(title)));
|
|
92
|
+
lines.push("");
|
|
93
|
+
for (var i = 0; i < steps.length; i++) {
|
|
94
|
+
var s = steps[i];
|
|
95
|
+
var isLast = i === steps.length - 1 && !active;
|
|
96
|
+
var branch = isLast ? " └" : " │";
|
|
97
|
+
if (s.status === "done") {
|
|
98
|
+
lines.push("".concat(branch, " ").concat(green("✔"), " ").concat(s.label));
|
|
99
|
+
} else if (s.status === "fail") {
|
|
100
|
+
lines.push("".concat(branch, " ").concat(red("✘"), " ").concat(red(s.label)));
|
|
101
|
+
}
|
|
102
|
+
if (s.children) {
|
|
103
|
+
var _iterator = _createForOfIteratorHelper(s.children),
|
|
104
|
+
_step;
|
|
105
|
+
try {
|
|
106
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
107
|
+
var c = _step.value;
|
|
108
|
+
var childBranch = isLast ? " " : " │";
|
|
109
|
+
lines.push("".concat(childBranch, " ").concat(dim(c)));
|
|
110
|
+
}
|
|
111
|
+
} catch (err) {
|
|
112
|
+
_iterator.e(err);
|
|
113
|
+
} finally {
|
|
114
|
+
_iterator.f();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (active) {
|
|
119
|
+
var frame = frames[active.tick++ % frames.length];
|
|
120
|
+
var _isLast = true;
|
|
121
|
+
lines.push(" \u2514 ".concat(cyan(frame), " ").concat(active.label).concat(dim("...")));
|
|
122
|
+
}
|
|
123
|
+
lines.push("");
|
|
124
|
+
return lines.join("\n");
|
|
125
|
+
};
|
|
126
|
+
var clear = function clear(lineCount) {
|
|
127
|
+
process.stdout.write("\x1B[".concat(lineCount, "A\x1B[0J"));
|
|
128
|
+
};
|
|
129
|
+
var lastLineCount = 0;
|
|
130
|
+
var paint = function paint() {
|
|
131
|
+
if (lastLineCount > 0) clear(lastLineCount);
|
|
132
|
+
var output = render();
|
|
133
|
+
process.stdout.write(output);
|
|
134
|
+
lastLineCount = output.split("\n").length - 1;
|
|
135
|
+
};
|
|
136
|
+
var startSpin = function startSpin() {
|
|
137
|
+
paint();
|
|
138
|
+
intervalId = setInterval(paint, 120);
|
|
139
|
+
};
|
|
140
|
+
var stopSpin = function stopSpin() {
|
|
141
|
+
if (intervalId) {
|
|
142
|
+
clearInterval(intervalId);
|
|
143
|
+
intervalId = null;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
step: function step(label) {
|
|
148
|
+
stopSpin();
|
|
149
|
+
if (active) {
|
|
150
|
+
active.status = "done";
|
|
151
|
+
steps.push(active);
|
|
152
|
+
}
|
|
153
|
+
active = {
|
|
154
|
+
label: label,
|
|
155
|
+
status: "active",
|
|
156
|
+
tick: 0,
|
|
157
|
+
start: Date.now(),
|
|
158
|
+
children: null
|
|
159
|
+
};
|
|
160
|
+
startSpin();
|
|
161
|
+
},
|
|
162
|
+
sub: function sub(text) {
|
|
163
|
+
if (active) {
|
|
164
|
+
active.children = active.children || [];
|
|
165
|
+
active.children.push(text);
|
|
166
|
+
}
|
|
167
|
+
paint();
|
|
168
|
+
},
|
|
169
|
+
done: function done() {
|
|
170
|
+
stopSpin();
|
|
171
|
+
if (active) {
|
|
172
|
+
active.status = "done";
|
|
173
|
+
steps.push(active);
|
|
174
|
+
active = null;
|
|
175
|
+
}
|
|
176
|
+
paint();
|
|
177
|
+
},
|
|
178
|
+
fail: function fail(label) {
|
|
179
|
+
stopSpin();
|
|
180
|
+
if (active) {
|
|
181
|
+
active.status = "fail";
|
|
182
|
+
if (label) active.label = label;
|
|
183
|
+
steps.push(active);
|
|
184
|
+
active = null;
|
|
185
|
+
}
|
|
186
|
+
paint();
|
|
187
|
+
},
|
|
188
|
+
summary: function summary(fn) {
|
|
189
|
+
stopSpin();
|
|
190
|
+
if (active) {
|
|
191
|
+
active.status = "done";
|
|
192
|
+
steps.push(active);
|
|
193
|
+
active = null;
|
|
194
|
+
}
|
|
195
|
+
paint();
|
|
196
|
+
var total = elapsed(startTime);
|
|
197
|
+
console.log(dim(" Completed in ".concat(total)));
|
|
198
|
+
console.log();
|
|
199
|
+
fn();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
var ask = function ask(question) {
|
|
204
|
+
return new Promise(function (res) {
|
|
205
|
+
var rl = (0, _readline.createInterface)({
|
|
206
|
+
input: process.stdin,
|
|
207
|
+
output: process.stdout
|
|
208
|
+
});
|
|
209
|
+
rl.question(question, function (answer) {
|
|
210
|
+
rl.close();
|
|
211
|
+
res(answer.trim().toLowerCase());
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
var HB_REPO = "https://github.com/permaweb/HyperBEAM.git";
|
|
216
|
+
var HB_TAG = "v0.9-milestone-3-beta-3";
|
|
217
|
+
var which = /*#__PURE__*/function () {
|
|
218
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(cmd) {
|
|
219
|
+
var _yield$exec, stdout, _t;
|
|
46
220
|
return _regenerator().w(function (_context) {
|
|
47
221
|
while (1) switch (_context.p = _context.n) {
|
|
222
|
+
case 0:
|
|
223
|
+
_context.p = 0;
|
|
224
|
+
_context.n = 1;
|
|
225
|
+
return exec("which ".concat(cmd, " 2>/dev/null"));
|
|
226
|
+
case 1:
|
|
227
|
+
_yield$exec = _context.v;
|
|
228
|
+
stdout = _yield$exec.stdout;
|
|
229
|
+
return _context.a(2, stdout.trim());
|
|
230
|
+
case 2:
|
|
231
|
+
_context.p = 2;
|
|
232
|
+
_t = _context.v;
|
|
233
|
+
return _context.a(2, null);
|
|
234
|
+
}
|
|
235
|
+
}, _callee, null, [[0, 2]]);
|
|
236
|
+
}));
|
|
237
|
+
return function which(_x) {
|
|
238
|
+
return _ref.apply(this, arguments);
|
|
239
|
+
};
|
|
240
|
+
}();
|
|
241
|
+
var getVersion = /*#__PURE__*/function () {
|
|
242
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(cmd) {
|
|
243
|
+
var flag,
|
|
244
|
+
_yield$exec2,
|
|
245
|
+
stdout,
|
|
246
|
+
_args2 = arguments,
|
|
247
|
+
_t2;
|
|
248
|
+
return _regenerator().w(function (_context2) {
|
|
249
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
250
|
+
case 0:
|
|
251
|
+
flag = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : "--version";
|
|
252
|
+
_context2.p = 1;
|
|
253
|
+
_context2.n = 2;
|
|
254
|
+
return exec("".concat(cmd, " ").concat(flag, " 2>&1"));
|
|
255
|
+
case 2:
|
|
256
|
+
_yield$exec2 = _context2.v;
|
|
257
|
+
stdout = _yield$exec2.stdout;
|
|
258
|
+
return _context2.a(2, stdout.trim().split("\n")[0]);
|
|
259
|
+
case 3:
|
|
260
|
+
_context2.p = 3;
|
|
261
|
+
_t2 = _context2.v;
|
|
262
|
+
return _context2.a(2, null);
|
|
263
|
+
}
|
|
264
|
+
}, _callee2, null, [[1, 3]]);
|
|
265
|
+
}));
|
|
266
|
+
return function getVersion(_x2) {
|
|
267
|
+
return _ref2.apply(this, arguments);
|
|
268
|
+
};
|
|
269
|
+
}();
|
|
270
|
+
var detectGCC = /*#__PURE__*/function () {
|
|
271
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
272
|
+
var _i2, _arr, v;
|
|
273
|
+
return _regenerator().w(function (_context3) {
|
|
274
|
+
while (1) switch (_context3.n) {
|
|
275
|
+
case 0:
|
|
276
|
+
_i2 = 0, _arr = [14, 13, 12, 11];
|
|
277
|
+
case 1:
|
|
278
|
+
if (!(_i2 < _arr.length)) {
|
|
279
|
+
_context3.n = 4;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
v = _arr[_i2];
|
|
283
|
+
_context3.n = 2;
|
|
284
|
+
return which("gcc-".concat(v));
|
|
285
|
+
case 2:
|
|
286
|
+
if (!_context3.v) {
|
|
287
|
+
_context3.n = 3;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
return _context3.a(2, v);
|
|
291
|
+
case 3:
|
|
292
|
+
_i2++;
|
|
293
|
+
_context3.n = 1;
|
|
294
|
+
break;
|
|
295
|
+
case 4:
|
|
296
|
+
_context3.n = 5;
|
|
297
|
+
return which("gcc");
|
|
298
|
+
case 5:
|
|
299
|
+
if (!_context3.v) {
|
|
300
|
+
_context3.n = 6;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
return _context3.a(2, null);
|
|
304
|
+
case 6:
|
|
305
|
+
return _context3.a(2, false);
|
|
306
|
+
}
|
|
307
|
+
}, _callee3);
|
|
308
|
+
}));
|
|
309
|
+
return function detectGCC() {
|
|
310
|
+
return _ref3.apply(this, arguments);
|
|
311
|
+
};
|
|
312
|
+
}();
|
|
313
|
+
var detectHBEnv = /*#__PURE__*/function () {
|
|
314
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
315
|
+
var deps, missing, erlPath, ver, rebar3Path, gccVersion, cmakePath;
|
|
316
|
+
return _regenerator().w(function (_context4) {
|
|
317
|
+
while (1) switch (_context4.n) {
|
|
318
|
+
case 0:
|
|
319
|
+
deps = {};
|
|
320
|
+
missing = []; // Erlang/OTP
|
|
321
|
+
_context4.n = 1;
|
|
322
|
+
return which("erl");
|
|
323
|
+
case 1:
|
|
324
|
+
erlPath = _context4.v;
|
|
325
|
+
if (!erlPath) {
|
|
326
|
+
_context4.n = 3;
|
|
327
|
+
break;
|
|
328
|
+
}
|
|
329
|
+
_context4.n = 2;
|
|
330
|
+
return getVersion("erl", "-eval '{ok, V} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), io:fwrite(V), halt().' -noshell");
|
|
331
|
+
case 2:
|
|
332
|
+
ver = _context4.v;
|
|
333
|
+
deps.erl = {
|
|
334
|
+
path: erlPath,
|
|
335
|
+
version: ver
|
|
336
|
+
};
|
|
337
|
+
_context4.n = 4;
|
|
338
|
+
break;
|
|
339
|
+
case 3:
|
|
340
|
+
missing.push("erlang (OTP 27+ required)");
|
|
341
|
+
case 4:
|
|
342
|
+
_context4.n = 5;
|
|
343
|
+
return which("rebar3");
|
|
344
|
+
case 5:
|
|
345
|
+
rebar3Path = _context4.v;
|
|
346
|
+
if (rebar3Path) {
|
|
347
|
+
deps.rebar3 = {
|
|
348
|
+
path: rebar3Path
|
|
349
|
+
};
|
|
350
|
+
} else {
|
|
351
|
+
missing.push("rebar3");
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// GCC
|
|
355
|
+
_context4.n = 6;
|
|
356
|
+
return detectGCC();
|
|
357
|
+
case 6:
|
|
358
|
+
gccVersion = _context4.v;
|
|
359
|
+
if (gccVersion === false) {
|
|
360
|
+
missing.push("gcc");
|
|
361
|
+
} else {
|
|
362
|
+
deps.gcc = gccVersion;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// CMake
|
|
366
|
+
_context4.n = 7;
|
|
367
|
+
return which("cmake");
|
|
368
|
+
case 7:
|
|
369
|
+
cmakePath = _context4.v;
|
|
370
|
+
if (cmakePath) {
|
|
371
|
+
deps.cmake = {
|
|
372
|
+
path: cmakePath
|
|
373
|
+
};
|
|
374
|
+
} else {
|
|
375
|
+
missing.push("cmake (>= 3.5)");
|
|
376
|
+
}
|
|
377
|
+
return _context4.a(2, {
|
|
378
|
+
deps: deps,
|
|
379
|
+
missing: missing
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}, _callee4);
|
|
383
|
+
}));
|
|
384
|
+
return function detectHBEnv() {
|
|
385
|
+
return _ref4.apply(this, arguments);
|
|
386
|
+
};
|
|
387
|
+
}();
|
|
388
|
+
var create = /*#__PURE__*/function () {
|
|
389
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
390
|
+
var _args$;
|
|
391
|
+
var appname, appdir, app, col, pad, pad2, hbChoice, hbMode, hbPath, absPath, t, arweave, jwk, addr, _yield$exec3, error, hbWarnings, _yield$detectHBEnv, deps, missing, hbCwd, envLines, _iterator2, _step2, m, _t3, _t4;
|
|
392
|
+
return _regenerator().w(function (_context5) {
|
|
393
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
48
394
|
case 0:
|
|
49
395
|
appname = (_args$ = args[0]) !== null && _args$ !== void 0 ? _args$ : "waoapp";
|
|
50
396
|
appdir = (0, _path.resolve)(process.cwd(), appname);
|
|
51
397
|
if (!(0, _fs.existsSync)(appdir)) {
|
|
52
|
-
|
|
398
|
+
_context5.n = 1;
|
|
53
399
|
break;
|
|
54
400
|
}
|
|
55
|
-
return
|
|
401
|
+
return _context5.a(2, console.error("\n ".concat(red("✘"), " Directory already exists: ").concat(bold(appdir), "\n")));
|
|
56
402
|
case 1:
|
|
57
|
-
|
|
58
|
-
|
|
403
|
+
_t3 = _path.resolve;
|
|
404
|
+
_context5.n = 2;
|
|
59
405
|
return (0, _utils.dirname)();
|
|
60
406
|
case 2:
|
|
61
|
-
app =
|
|
62
|
-
|
|
407
|
+
app = _t3(_context5.v, "workspace");
|
|
408
|
+
console.log();
|
|
409
|
+
console.log(" ".concat(bold("HyperBEAM setup:")));
|
|
410
|
+
col = 6 + HB_TAG.length;
|
|
411
|
+
pad = " ".repeat(col - "Link existing".length);
|
|
412
|
+
pad2 = " ".repeat(col - "Skip".length);
|
|
413
|
+
console.log(" ".concat(dim("1."), " Clone ").concat(cyan(HB_TAG), " ").concat(dim("(from GitHub)")));
|
|
414
|
+
console.log(" ".concat(dim("2."), " Link existing").concat(pad, " ").concat(dim("(symlink to local dir)")));
|
|
415
|
+
console.log(" ".concat(dim("3."), " Skip").concat(pad2, " ").concat(dim("(in-memory AOS only)")));
|
|
416
|
+
console.log();
|
|
417
|
+
_context5.n = 3;
|
|
418
|
+
return ask(" Choose ".concat(dim("(1/2/3)"), " [1]: "));
|
|
419
|
+
case 3:
|
|
420
|
+
hbChoice = _context5.v;
|
|
421
|
+
hbMode = hbChoice === "2" ? "link" : hbChoice === "3" ? "skip" : "clone";
|
|
422
|
+
hbPath = null;
|
|
423
|
+
if (!(hbMode === "link")) {
|
|
424
|
+
_context5.n = 5;
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
_context5.n = 4;
|
|
428
|
+
return ask(" Path to HyperBEAM directory: ");
|
|
429
|
+
case 4:
|
|
430
|
+
hbPath = _context5.v;
|
|
431
|
+
absPath = (0, _path.resolve)(process.cwd(), hbPath);
|
|
432
|
+
if (!(0, _fs.existsSync)(absPath)) {
|
|
433
|
+
console.error("\n ".concat(red("✘"), " Directory not found: ").concat(bold(absPath), "\n"));
|
|
434
|
+
process.exit(1);
|
|
435
|
+
}
|
|
436
|
+
hbPath = absPath;
|
|
437
|
+
case 5:
|
|
438
|
+
console.log();
|
|
439
|
+
t = tree("Creating ".concat(cyan(appname)));
|
|
440
|
+
_context5.p = 6;
|
|
441
|
+
t.step("Scaffolding project files");
|
|
63
442
|
(0, _fs.cpSync)(app, appdir, {
|
|
64
443
|
recursive: true
|
|
65
444
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
445
|
+
t.sub("src/counter.lua");
|
|
446
|
+
t.sub("test/ (3 test files)");
|
|
447
|
+
t.sub("scripts/deploy.js");
|
|
448
|
+
t.done();
|
|
449
|
+
t.step("Setting up Claude Code toolchain");
|
|
450
|
+
t.sub("CLAUDE.md");
|
|
451
|
+
t.sub(".claude/rules/ (lua, testing, deploy)");
|
|
452
|
+
t.sub(".claude/skills/ (test, deploy, create-handler)");
|
|
453
|
+
t.sub(".claude/agents/ (builder, tester)");
|
|
454
|
+
t.done();
|
|
455
|
+
t.step("Generating admin wallet");
|
|
456
|
+
arweave = _arweave["default"].init();
|
|
457
|
+
_context5.n = 7;
|
|
458
|
+
return arweave.wallets.generate();
|
|
459
|
+
case 7:
|
|
460
|
+
jwk = _context5.v;
|
|
461
|
+
_context5.n = 8;
|
|
462
|
+
return arweave.wallets.jwkToAddress(jwk);
|
|
463
|
+
case 8:
|
|
464
|
+
addr = _context5.v;
|
|
465
|
+
(0, _fs.writeFileSync)((0, _path.resolve)(appdir, ".wallet.json"), JSON.stringify(jwk));
|
|
466
|
+
t.sub("address: ".concat(addr));
|
|
467
|
+
t.done();
|
|
468
|
+
t.step("Installing dependencies");
|
|
469
|
+
_context5.n = 9;
|
|
470
|
+
return exec("cd ".concat(appdir, " && yarn --ignore-engines"));
|
|
471
|
+
case 9:
|
|
472
|
+
_yield$exec3 = _context5.v;
|
|
473
|
+
error = _yield$exec3.error;
|
|
474
|
+
if (!error) {
|
|
475
|
+
_context5.n = 10;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
t.fail("Failed to install dependencies");
|
|
479
|
+
return _context5.a(2);
|
|
480
|
+
case 10:
|
|
481
|
+
t.done();
|
|
482
|
+
hbWarnings = [];
|
|
483
|
+
if (!(hbMode !== "skip")) {
|
|
484
|
+
_context5.n = 14;
|
|
485
|
+
break;
|
|
77
486
|
}
|
|
78
|
-
|
|
487
|
+
t.step("Detecting HyperBEAM environment");
|
|
488
|
+
_context5.n = 11;
|
|
489
|
+
return detectHBEnv();
|
|
490
|
+
case 11:
|
|
491
|
+
_yield$detectHBEnv = _context5.v;
|
|
492
|
+
deps = _yield$detectHBEnv.deps;
|
|
493
|
+
missing = _yield$detectHBEnv.missing;
|
|
494
|
+
hbCwd = hbMode === "link" ? hbPath : "./HyperBEAM";
|
|
495
|
+
envLines = ["CWD=".concat(hbCwd)];
|
|
496
|
+
if (deps.erl) t.sub("".concat(green("✔"), " erlang ").concat(deps.erl.version || ""));
|
|
497
|
+
if (deps.rebar3) t.sub("".concat(green("✔"), " rebar3"));
|
|
498
|
+
if (deps.gcc) {
|
|
499
|
+
t.sub("".concat(green("✔"), " gcc-").concat(deps.gcc));
|
|
500
|
+
envLines.push("CC=gcc-".concat(deps.gcc));
|
|
501
|
+
envLines.push("CXX=g++-".concat(deps.gcc));
|
|
502
|
+
} else if (deps.gcc === null) {
|
|
503
|
+
t.sub("".concat(yellow("~"), " gcc found (no versioned binary, using default)"));
|
|
504
|
+
}
|
|
505
|
+
if (deps.cmake) {
|
|
506
|
+
t.sub("".concat(green("✔"), " cmake"));
|
|
507
|
+
envLines.push("CMAKE_POLICY_VERSION_MINIMUM=3.5");
|
|
508
|
+
}
|
|
509
|
+
_iterator2 = _createForOfIteratorHelper(missing);
|
|
510
|
+
try {
|
|
511
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
512
|
+
m = _step2.value;
|
|
513
|
+
t.sub("".concat(red("✘"), " ").concat(m, " \u2014 not found"));
|
|
514
|
+
hbWarnings.push(m);
|
|
515
|
+
}
|
|
516
|
+
} catch (err) {
|
|
517
|
+
_iterator2.e(err);
|
|
518
|
+
} finally {
|
|
519
|
+
_iterator2.f();
|
|
520
|
+
}
|
|
521
|
+
(0, _fs.writeFileSync)((0, _path.resolve)(appdir, ".env.hyperbeam"), envLines.join("\n") + "\n");
|
|
522
|
+
t.sub(".env.hyperbeam generated");
|
|
523
|
+
t.done();
|
|
524
|
+
if (!(hbMode === "link")) {
|
|
525
|
+
_context5.n = 12;
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
t.step("Linking HyperBEAM");
|
|
529
|
+
(0, _fs.symlinkSync)(hbPath, (0, _path.resolve)(appdir, "HyperBEAM"));
|
|
530
|
+
t.sub("".concat(hbPath, " \u2192 HyperBEAM/"));
|
|
531
|
+
t.done();
|
|
532
|
+
_context5.n = 14;
|
|
79
533
|
break;
|
|
80
|
-
case
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
534
|
+
case 12:
|
|
535
|
+
t.step("Cloning HyperBEAM");
|
|
536
|
+
t.sub("tag: ".concat(HB_TAG));
|
|
537
|
+
_context5.n = 13;
|
|
538
|
+
return exec("cd ".concat(appdir, " && git clone --depth 1 --branch ").concat(HB_TAG, " ").concat(HB_REPO, " HyperBEAM"), {
|
|
539
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
540
|
+
timeout: 600000
|
|
541
|
+
});
|
|
542
|
+
case 13:
|
|
543
|
+
t.done();
|
|
544
|
+
case 14:
|
|
545
|
+
t.summary(function () {
|
|
546
|
+
splash();
|
|
547
|
+
console.log(" ".concat(green("🎉"), " ").concat(bold(appname), " is ready!"));
|
|
548
|
+
if (hbWarnings.length > 0) {
|
|
549
|
+
console.log();
|
|
550
|
+
console.log(" ".concat(yellow("⚠"), " ").concat(bold("Missing HyperBEAM dependencies:")));
|
|
551
|
+
for (var _i3 = 0, _hbWarnings = hbWarnings; _i3 < _hbWarnings.length; _i3++) {
|
|
552
|
+
var w = _hbWarnings[_i3];
|
|
553
|
+
console.log(" ".concat(dim("•"), " ").concat(w));
|
|
554
|
+
}
|
|
555
|
+
console.log(" ".concat(dim("Install these before running HyperBEAM tests")));
|
|
556
|
+
}
|
|
557
|
+
console.log();
|
|
558
|
+
console.log(" ".concat(dim("$"), " ").concat(bold("cd ".concat(appname, " && claude"))));
|
|
559
|
+
console.log();
|
|
560
|
+
console.log(" ".concat(bold("Then:")));
|
|
561
|
+
console.log();
|
|
562
|
+
console.log(" ".concat(dim("1."), " ").concat(dim("plan your app or device")));
|
|
563
|
+
console.log(" ".concat(dim("2."), " ").concat(dim("build with /create-handler")));
|
|
564
|
+
console.log(" ".concat(dim("3."), " ").concat(dim("/test for in-memory AOS")));
|
|
565
|
+
console.log(" ".concat(dim("4."), " ").concat(dim("/test-hb for HyperBEAM integration")));
|
|
566
|
+
console.log(" ".concat(dim("5."), " ").concat(dim("/deploy to mainnet")));
|
|
567
|
+
console.log();
|
|
568
|
+
console.log(" ".concat(bold("Dev cycle:")));
|
|
569
|
+
console.log();
|
|
570
|
+
console.log(" ".concat(cyan("AOS"), " ").concat(dim("in-memory testing (fast)"), " yarn test test/legacynet.test.js"));
|
|
571
|
+
console.log(" ".concat(cyan("HyperBEAM"), " ").concat(dim("local node testing"), " yarn test test/hyperbeam.test.js"));
|
|
572
|
+
console.log(" ".concat(cyan("Mainnet"), " ").concat(dim("deploy when ready"), " yarn deploy src/counter.lua --wallet .wallet.json"));
|
|
573
|
+
console.log();
|
|
574
|
+
});
|
|
575
|
+
_context5.n = 16;
|
|
576
|
+
break;
|
|
577
|
+
case 15:
|
|
578
|
+
_context5.p = 15;
|
|
579
|
+
_t4 = _context5.v;
|
|
580
|
+
t.fail(_t4.message);
|
|
581
|
+
case 16:
|
|
582
|
+
return _context5.a(2);
|
|
86
583
|
}
|
|
87
|
-
},
|
|
584
|
+
}, _callee5, null, [[6, 15]]);
|
|
88
585
|
}));
|
|
89
586
|
return function create() {
|
|
90
|
-
return
|
|
587
|
+
return _ref5.apply(this, arguments);
|
|
91
588
|
};
|
|
92
589
|
}();
|
|
93
590
|
if (isCreate) create();else {
|
|
94
591
|
_pm["default"].connect(false, /*#__PURE__*/function () {
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
return _regenerator().w(function (
|
|
98
|
-
while (1) switch (
|
|
592
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(err) {
|
|
593
|
+
var _t5, _t6, _t7, _t8;
|
|
594
|
+
return _regenerator().w(function (_context6) {
|
|
595
|
+
while (1) switch (_context6.n) {
|
|
99
596
|
case 0:
|
|
100
597
|
if (err) {
|
|
101
598
|
console.error("Error connecting to PM2:", err);
|
|
102
599
|
process.exit(2);
|
|
103
600
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
601
|
+
_t5 = _pm["default"];
|
|
602
|
+
_t6 = _path.resolve;
|
|
603
|
+
_context6.n = 1;
|
|
107
604
|
return (0, _utils.dirname)();
|
|
108
605
|
case 1:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
script:
|
|
606
|
+
_t7 = _t6(_context6.v, cmd.script);
|
|
607
|
+
_t8 = args;
|
|
608
|
+
_t5.start.call(_t5, {
|
|
609
|
+
script: _t7,
|
|
113
610
|
nodeArgs: "--experimental-wasm-memory64",
|
|
114
611
|
instances: 1,
|
|
115
612
|
force: true,
|
|
116
|
-
args:
|
|
613
|
+
args: _t8,
|
|
117
614
|
daemon: false,
|
|
118
615
|
name: "wao"
|
|
119
616
|
}, function (err) {
|
|
@@ -125,12 +622,12 @@ if (isCreate) create();else {
|
|
|
125
622
|
});
|
|
126
623
|
_pm["default"].streamLogs("all", 0, false);
|
|
127
624
|
case 2:
|
|
128
|
-
return
|
|
625
|
+
return _context6.a(2);
|
|
129
626
|
}
|
|
130
|
-
},
|
|
627
|
+
}, _callee6);
|
|
131
628
|
}));
|
|
132
|
-
return function (
|
|
133
|
-
return
|
|
629
|
+
return function (_x3) {
|
|
630
|
+
return _ref6.apply(this, arguments);
|
|
134
631
|
};
|
|
135
632
|
}());
|
|
136
633
|
process.on("SIGINT", function () {
|