@rotifer/playground 0.3.0-alpha.1 → 0.5.0-alpha.1
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/CHANGELOG.md +79 -0
- package/README.md +22 -8
- package/README.zh.md +8 -2
- package/dist/cloud/auth.d.ts +14 -0
- package/dist/cloud/auth.d.ts.map +1 -0
- package/dist/cloud/auth.js +129 -0
- package/dist/cloud/auth.js.map +1 -0
- package/dist/cloud/client.d.ts +57 -0
- package/dist/cloud/client.d.ts.map +1 -0
- package/dist/cloud/client.js +393 -0
- package/dist/cloud/client.js.map +1 -0
- package/dist/cloud/index.d.ts +4 -0
- package/dist/cloud/index.d.ts.map +1 -0
- package/dist/cloud/index.js +20 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/cloud/types.d.ts +75 -0
- package/dist/cloud/types.d.ts.map +1 -0
- package/dist/cloud/types.js +7 -0
- package/dist/cloud/types.js.map +1 -0
- package/dist/commands/arena-list.d.ts.map +1 -1
- package/dist/commands/arena-list.js +62 -1
- package/dist/commands/arena-list.js.map +1 -1
- package/dist/commands/arena-submit.d.ts.map +1 -1
- package/dist/commands/arena-submit.js +35 -1
- package/dist/commands/arena-submit.js.map +1 -1
- package/dist/commands/arena-watch.d.ts.map +1 -1
- package/dist/commands/arena-watch.js +96 -2
- package/dist/commands/arena-watch.js.map +1 -1
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +94 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +133 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +53 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/network.d.ts +3 -0
- package/dist/commands/network.d.ts.map +1 -0
- package/dist/commands/network.js +195 -0
- package/dist/commands/network.js.map +1 -0
- package/dist/commands/publish.d.ts +3 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +121 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/reputation.d.ts +3 -0
- package/dist/commands/reputation.d.ts.map +1 -0
- package/dist/commands/reputation.js +170 -0
- package/dist/commands/reputation.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +118 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/genes/genesis-web-search/.cloud-manifest.json +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.networkCommand = void 0;
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const display = __importStar(require("../utils/display.js"));
|
|
43
|
+
const node_fs_1 = require("node:fs");
|
|
44
|
+
const node_path_1 = require("node:path");
|
|
45
|
+
const node_crypto_1 = require("node:crypto");
|
|
46
|
+
const ROTIFER_HOME = (0, node_path_1.join)(process.env.HOME || process.env.USERPROFILE || "/tmp", ".rotifer");
|
|
47
|
+
const NETWORK_CONFIG = (0, node_path_1.join)(ROTIFER_HOME, "network.json");
|
|
48
|
+
function loadNetworkConfig() {
|
|
49
|
+
if ((0, node_fs_1.existsSync)(NETWORK_CONFIG)) {
|
|
50
|
+
try {
|
|
51
|
+
return JSON.parse((0, node_fs_1.readFileSync)(NETWORK_CONFIG, "utf-8"));
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// fall through
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
node_id: (0, node_crypto_1.randomUUID)(),
|
|
59
|
+
listen_port: 9878,
|
|
60
|
+
bootstrap_peers: [
|
|
61
|
+
"/dns4/bootstrap.rotifer.dev/tcp/9878",
|
|
62
|
+
],
|
|
63
|
+
enabled: false,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function saveNetworkConfig(config) {
|
|
67
|
+
if (!(0, node_fs_1.existsSync)(ROTIFER_HOME)) {
|
|
68
|
+
(0, node_fs_1.mkdirSync)(ROTIFER_HOME, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
(0, node_fs_1.writeFileSync)(NETWORK_CONFIG, JSON.stringify(config, null, 2) + "\n");
|
|
71
|
+
}
|
|
72
|
+
exports.networkCommand = new commander_1.Command("network")
|
|
73
|
+
.description("P2P gene network commands (v0.5 foundation)")
|
|
74
|
+
.addCommand(new commander_1.Command("status")
|
|
75
|
+
.description("Show network node status")
|
|
76
|
+
.action(async () => {
|
|
77
|
+
display.header("P2P Network Status");
|
|
78
|
+
const config = loadNetworkConfig();
|
|
79
|
+
saveNetworkConfig(config);
|
|
80
|
+
console.log();
|
|
81
|
+
display.keyValue("Node ID", config.node_id);
|
|
82
|
+
display.keyValue("Status", config.enabled
|
|
83
|
+
? chalk_1.default.green("● Active")
|
|
84
|
+
: chalk_1.default.dim("○ Inactive"));
|
|
85
|
+
display.keyValue("Listen Port", String(config.listen_port));
|
|
86
|
+
display.keyValue("Bootstrap Peers", String(config.bootstrap_peers.length));
|
|
87
|
+
console.log();
|
|
88
|
+
if (!config.enabled) {
|
|
89
|
+
display.info("Start the node: rotifer network start");
|
|
90
|
+
}
|
|
91
|
+
}))
|
|
92
|
+
.addCommand(new commander_1.Command("start")
|
|
93
|
+
.description("Start the P2P node")
|
|
94
|
+
.option("-p, --port <port>", "listen port", "9878")
|
|
95
|
+
.action(async (options) => {
|
|
96
|
+
display.header("Starting P2P Node");
|
|
97
|
+
const config = loadNetworkConfig();
|
|
98
|
+
config.listen_port = parseInt(options.port, 10);
|
|
99
|
+
config.enabled = true;
|
|
100
|
+
saveNetworkConfig(config);
|
|
101
|
+
console.log();
|
|
102
|
+
display.keyValue("Node ID", config.node_id);
|
|
103
|
+
display.keyValue("Listen", `/ip4/0.0.0.0/tcp/${config.listen_port}`);
|
|
104
|
+
display.keyValue("Protocol", "rotifer/gene-discovery/1.0.0");
|
|
105
|
+
console.log();
|
|
106
|
+
display.info("Connecting to bootstrap peers...");
|
|
107
|
+
for (const peer of config.bootstrap_peers) {
|
|
108
|
+
display.info(` → ${peer}`);
|
|
109
|
+
}
|
|
110
|
+
console.log();
|
|
111
|
+
display.warn("P2P networking is in foundation stage (v0.5). " +
|
|
112
|
+
"Gene metadata discovery is available; binary transfer uses Cloud CDN.");
|
|
113
|
+
console.log();
|
|
114
|
+
display.success("P2P node initialized");
|
|
115
|
+
display.info("In a future release, the node will run as a background daemon. " +
|
|
116
|
+
"For now, network config is saved to ~/.rotifer/network.json");
|
|
117
|
+
}))
|
|
118
|
+
.addCommand(new commander_1.Command("stop")
|
|
119
|
+
.description("Stop the P2P node")
|
|
120
|
+
.action(async () => {
|
|
121
|
+
const config = loadNetworkConfig();
|
|
122
|
+
config.enabled = false;
|
|
123
|
+
saveNetworkConfig(config);
|
|
124
|
+
display.success("P2P node stopped");
|
|
125
|
+
}))
|
|
126
|
+
.addCommand(new commander_1.Command("peers")
|
|
127
|
+
.description("List known peers")
|
|
128
|
+
.action(async () => {
|
|
129
|
+
display.header("Known Peers");
|
|
130
|
+
const config = loadNetworkConfig();
|
|
131
|
+
if (!config.enabled) {
|
|
132
|
+
display.warn("P2P node is not active. Run 'rotifer network start' first.");
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
console.log();
|
|
136
|
+
if (config.bootstrap_peers.length === 0) {
|
|
137
|
+
display.warn("No peers discovered");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const col = { id: 6, addr: 44, status: 10 };
|
|
141
|
+
console.log(" " +
|
|
142
|
+
padRight("#", col.id) +
|
|
143
|
+
padRight("Address", col.addr) +
|
|
144
|
+
"Status");
|
|
145
|
+
console.log(" " + "\u2500".repeat(60));
|
|
146
|
+
for (let i = 0; i < config.bootstrap_peers.length; i++) {
|
|
147
|
+
console.log(" " +
|
|
148
|
+
padRight(String(i + 1), col.id) +
|
|
149
|
+
padRight(config.bootstrap_peers[i], col.addr) +
|
|
150
|
+
chalk_1.default.dim("bootstrap"));
|
|
151
|
+
}
|
|
152
|
+
console.log();
|
|
153
|
+
display.info(`${config.bootstrap_peers.length} peer(s) known`);
|
|
154
|
+
}))
|
|
155
|
+
.addCommand(new commander_1.Command("search")
|
|
156
|
+
.description("Search genes via P2P network")
|
|
157
|
+
.argument("<query>", "search keywords")
|
|
158
|
+
.action(async (query) => {
|
|
159
|
+
display.header("P2P Gene Search");
|
|
160
|
+
const config = loadNetworkConfig();
|
|
161
|
+
if (!config.enabled) {
|
|
162
|
+
display.warn("P2P node is not active. Run 'rotifer network start' first.");
|
|
163
|
+
display.info("Falling back to Cloud search...");
|
|
164
|
+
console.log();
|
|
165
|
+
}
|
|
166
|
+
display.info(`Searching P2P network for: "${query}"`);
|
|
167
|
+
display.info("Querying DHT for gene metadata...");
|
|
168
|
+
console.log();
|
|
169
|
+
display.warn("P2P gene search is in foundation stage. " +
|
|
170
|
+
"Currently, all gene discovery goes through the Cloud Registry. " +
|
|
171
|
+
"P2P metadata propagation will be available in v0.6.");
|
|
172
|
+
console.log();
|
|
173
|
+
display.info("Use 'rotifer search' for Cloud-based gene discovery.");
|
|
174
|
+
}))
|
|
175
|
+
.addCommand(new commander_1.Command("announce")
|
|
176
|
+
.description("Announce a gene to the P2P network")
|
|
177
|
+
.argument("<name>", "gene name to announce")
|
|
178
|
+
.action(async (name) => {
|
|
179
|
+
display.header("Gene Announcement");
|
|
180
|
+
const config = loadNetworkConfig();
|
|
181
|
+
if (!config.enabled) {
|
|
182
|
+
display.warn("P2P node is not active. Run 'rotifer network start' first.");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
display.info(`Announcing gene '${name}' to P2P network...`);
|
|
186
|
+
display.info("Broadcasting gene metadata via GossipSub...");
|
|
187
|
+
console.log();
|
|
188
|
+
display.warn("P2P gene announcement is in foundation stage. " +
|
|
189
|
+
"Gene metadata will be propagated to connected peers in v0.6. " +
|
|
190
|
+
"For now, use 'rotifer publish' to share via Cloud Registry.");
|
|
191
|
+
}));
|
|
192
|
+
function padRight(str, len) {
|
|
193
|
+
return str.length >= len ? str : str + " ".repeat(len - str.length);
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/commands/network.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,6DAA+C;AAC/C,qCAA6E;AAC7E,yCAAiC;AACjC,6CAAyC;AAEzC,MAAM,YAAY,GAAG,IAAA,gBAAI,EACvB,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,MAAM,EACrD,UAAU,CACX,CAAC;AACF,MAAM,cAAc,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAS1D,SAAS,iBAAiB;IACxB,IAAI,IAAA,oBAAU,EAAC,cAAc,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,eAAe;QACjB,CAAC;IACH,CAAC;IACD,OAAO;QACL,OAAO,EAAE,IAAA,wBAAU,GAAE;QACrB,WAAW,EAAE,IAAI;QACjB,eAAe,EAAE;YACf,sCAAsC;SACvC;QACD,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAqB;IAC9C,IAAI,CAAC,IAAA,oBAAU,EAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,IAAA,mBAAS,EAAC,YAAY,EAAE,EAAE,SAAS,EAAE,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AO,CAAC,UAAU,CAAC;KACpB,WAAW,CAAC,oCAAoC,CAAC;KACjD,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;KAC3C,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;IAC7B,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IAEpC,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IAEnC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QAC3E,OAAO;IACT,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,qBAAqB,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,OAAO,CAAC,IAAI,CACV,gDAAgD;QAChD,+DAA+D;QAC/D,6DAA6D,CAC9D,CAAC;AACJ,CAAC,CAAC,CACL,CAAC;AAEJ,SAAS,QAAQ,CAAC,GAAW,EAAE,GAAW;IACxC,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,cAAc,SAgGvB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.publishCommand = void 0;
|
|
37
|
+
const commander_1 = require("commander");
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const node_path_1 = require("node:path");
|
|
40
|
+
const display = __importStar(require("../utils/display.js"));
|
|
41
|
+
const config_js_1 = require("../utils/config.js");
|
|
42
|
+
const auth_js_1 = require("../cloud/auth.js");
|
|
43
|
+
const client_js_1 = require("../cloud/client.js");
|
|
44
|
+
exports.publishCommand = new commander_1.Command("publish")
|
|
45
|
+
.description("Publish a gene to Rotifer Cloud")
|
|
46
|
+
.argument("<name>", "gene name to publish")
|
|
47
|
+
.option("--description <text>", "gene description")
|
|
48
|
+
.action(async (name, options) => {
|
|
49
|
+
display.header("Publish to Cloud");
|
|
50
|
+
let creds;
|
|
51
|
+
try {
|
|
52
|
+
creds = (0, auth_js_1.requireAuth)();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
display.error("Not logged in. Run 'rotifer login' first.");
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
display.info(`Publishing as ${creds.user.username}`);
|
|
59
|
+
const root = (0, config_js_1.getProjectRoot)();
|
|
60
|
+
const config = (0, config_js_1.loadConfig)(root);
|
|
61
|
+
const geneDir = (0, node_path_1.join)(root, config.genes_dir, name);
|
|
62
|
+
const phenotypePath = (0, node_path_1.join)(geneDir, "phenotype.json");
|
|
63
|
+
if (!(0, node_fs_1.existsSync)(phenotypePath)) {
|
|
64
|
+
display.rustStyleError({
|
|
65
|
+
code: "E0050",
|
|
66
|
+
message: `Gene '${name}' not found`,
|
|
67
|
+
file: phenotypePath,
|
|
68
|
+
suggestion: "Run 'rotifer wrap " + name + " --domain <domain>' first",
|
|
69
|
+
});
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
const phenotype = JSON.parse((0, node_fs_1.readFileSync)(phenotypePath, "utf-8"));
|
|
73
|
+
const irWasmPath = (0, node_path_1.join)(geneDir, "gene.ir.wasm");
|
|
74
|
+
const wasmBytes = (0, node_fs_1.existsSync)(irWasmPath)
|
|
75
|
+
? (0, node_fs_1.readFileSync)(irWasmPath)
|
|
76
|
+
: null;
|
|
77
|
+
if (!wasmBytes) {
|
|
78
|
+
display.warn("No compiled WASM found — publishing metadata only. Run 'rotifer compile " +
|
|
79
|
+
name +
|
|
80
|
+
"' first for full publishing.");
|
|
81
|
+
}
|
|
82
|
+
const description = options.description ||
|
|
83
|
+
phenotype.description ||
|
|
84
|
+
`${name} gene (${phenotype.domain})`;
|
|
85
|
+
try {
|
|
86
|
+
display.info("Uploading to cloud registry...");
|
|
87
|
+
const result = await (0, client_js_1.publishGene)({
|
|
88
|
+
name,
|
|
89
|
+
domain: phenotype.domain || "unknown",
|
|
90
|
+
version: phenotype.version || "0.1.0",
|
|
91
|
+
fidelity: phenotype.fidelity || "Wrapped",
|
|
92
|
+
description,
|
|
93
|
+
phenotype,
|
|
94
|
+
wasmBytes,
|
|
95
|
+
});
|
|
96
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(geneDir, ".cloud-manifest.json"), JSON.stringify({
|
|
97
|
+
cloud_id: result.id,
|
|
98
|
+
owner: result.owner,
|
|
99
|
+
version: result.version,
|
|
100
|
+
published_at: new Date().toISOString(),
|
|
101
|
+
}, null, 2) + "\n");
|
|
102
|
+
console.log();
|
|
103
|
+
display.success(`Gene '${name}' published to cloud!`);
|
|
104
|
+
display.keyValue("ID", result.id);
|
|
105
|
+
display.keyValue("Owner", result.owner);
|
|
106
|
+
display.keyValue("Domain", result.domain);
|
|
107
|
+
display.keyValue("Version", result.version);
|
|
108
|
+
display.keyValue("Fidelity", result.fidelity);
|
|
109
|
+
if (wasmBytes) {
|
|
110
|
+
display.keyValue("WASM Size", `${(wasmBytes.length / 1024).toFixed(1)}KB`);
|
|
111
|
+
}
|
|
112
|
+
console.log();
|
|
113
|
+
display.info("Others can install it: rotifer install " + result.id);
|
|
114
|
+
display.info("Submit to cloud Arena: rotifer arena submit --cloud " + name);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
display.error(err.message || "Publish failed");
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":";;;;;;;;;;;;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MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,iBAAiB,SAgC3B,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.reputationCommand = void 0;
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const display = __importStar(require("../utils/display.js"));
|
|
43
|
+
const client_js_1 = require("../cloud/client.js");
|
|
44
|
+
const auth_js_1 = require("../cloud/auth.js");
|
|
45
|
+
exports.reputationCommand = new commander_1.Command("reputation")
|
|
46
|
+
.description("View gene and developer reputation scores")
|
|
47
|
+
.argument("[gene-id]", "gene ID to view reputation for")
|
|
48
|
+
.option("--mine", "show your developer reputation", false)
|
|
49
|
+
.option("--leaderboard", "show developer leaderboard", false)
|
|
50
|
+
.option("--top <n>", "number of entries in leaderboard", "10")
|
|
51
|
+
.action(async (geneId, options) => {
|
|
52
|
+
if (options.leaderboard) {
|
|
53
|
+
await showLeaderboard(parseInt(options.top, 10));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (options.mine) {
|
|
57
|
+
await showMyReputation();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (geneId) {
|
|
61
|
+
await showGeneReputation(geneId);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
display.error("Specify a gene ID, --mine, or --leaderboard");
|
|
65
|
+
display.info("Usage: rotifer reputation <gene-id>");
|
|
66
|
+
display.info(" rotifer reputation --mine");
|
|
67
|
+
display.info(" rotifer reputation --leaderboard");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
70
|
+
async function showGeneReputation(geneId) {
|
|
71
|
+
display.header("Gene Reputation");
|
|
72
|
+
try {
|
|
73
|
+
const rep = await (0, client_js_1.getGeneReputation)(geneId);
|
|
74
|
+
console.log();
|
|
75
|
+
display.keyValue("Gene", rep.gene_name);
|
|
76
|
+
display.keyValue("Overall Score", formatScore(rep.score));
|
|
77
|
+
console.log();
|
|
78
|
+
const barWidth = 30;
|
|
79
|
+
console.log(" " + chalk_1.default.dim("Arena Score ") + renderBar(rep.arena_score, barWidth) + " " + rep.arena_score.toFixed(4));
|
|
80
|
+
console.log(" " + chalk_1.default.dim("Usage Score ") + renderBar(rep.usage_score, barWidth) + " " + rep.usage_score.toFixed(4));
|
|
81
|
+
console.log(" " + chalk_1.default.dim("Stability ") + renderBar(rep.stability_score, barWidth) + " " + rep.stability_score.toFixed(4));
|
|
82
|
+
console.log();
|
|
83
|
+
display.keyValue("Epoch", String(rep.epoch));
|
|
84
|
+
display.keyValue("Computed", rep.computed_at);
|
|
85
|
+
display.info("Weights: Arena(0.5) + Usage(0.3) + Stability(0.2)");
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
display.error(err.message || "Failed to fetch reputation");
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async function showMyReputation() {
|
|
93
|
+
display.header("My Developer Reputation");
|
|
94
|
+
const creds = (0, auth_js_1.loadCredentials)();
|
|
95
|
+
if (!creds) {
|
|
96
|
+
display.error("Not logged in. Run 'rotifer login' first.");
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const rep = await (0, client_js_1.getDeveloperReputation)(creds.user.id);
|
|
101
|
+
console.log();
|
|
102
|
+
display.keyValue("Developer", `@${creds.user.username}`);
|
|
103
|
+
display.keyValue("Overall Score", formatScore(rep.score));
|
|
104
|
+
console.log();
|
|
105
|
+
display.keyValue("Genes Published", String(rep.genes_published));
|
|
106
|
+
display.keyValue("Total Downloads", String(rep.total_downloads));
|
|
107
|
+
display.keyValue("Arena Wins", String(rep.arena_wins));
|
|
108
|
+
display.keyValue("Community Bonus", `+${rep.community_bonus.toFixed(3)}`);
|
|
109
|
+
console.log();
|
|
110
|
+
display.info("Score = avg(gene reputations) + community bonus");
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
display.error(err.message || "Failed to fetch reputation");
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function showLeaderboard(limit) {
|
|
118
|
+
display.header("Reputation Leaderboard");
|
|
119
|
+
try {
|
|
120
|
+
const entries = await (0, client_js_1.getReputationLeaderboard)(limit);
|
|
121
|
+
if (entries.length === 0) {
|
|
122
|
+
display.warn("No developers with reputation scores yet");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
console.log();
|
|
126
|
+
const col = { rank: 4, name: 20, score: 10, genes: 8, dl: 10, wins: 6 };
|
|
127
|
+
console.log(" " +
|
|
128
|
+
padRight("#", col.rank) +
|
|
129
|
+
padRight("Developer", col.name) +
|
|
130
|
+
padRight("Score", col.score) +
|
|
131
|
+
padRight("Genes", col.genes) +
|
|
132
|
+
padRight("Downloads", col.dl) +
|
|
133
|
+
"Wins");
|
|
134
|
+
console.log(" " + "\u2500".repeat(58));
|
|
135
|
+
for (let i = 0; i < entries.length; i++) {
|
|
136
|
+
const e = entries[i];
|
|
137
|
+
const rankStr = String(i + 1);
|
|
138
|
+
const scoreColor = e.score >= 0.7 ? chalk_1.default.green : e.score >= 0.3 ? chalk_1.default.yellow : chalk_1.default.dim;
|
|
139
|
+
console.log(" " +
|
|
140
|
+
padRight(rankStr, col.rank) +
|
|
141
|
+
padRight(`@${e.username}`, col.name) +
|
|
142
|
+
padRight(scoreColor(e.score.toFixed(4)), col.score + 10) +
|
|
143
|
+
padRight(String(e.genes_published), col.genes) +
|
|
144
|
+
padRight(String(e.total_downloads), col.dl) +
|
|
145
|
+
String(e.arena_wins));
|
|
146
|
+
}
|
|
147
|
+
console.log();
|
|
148
|
+
display.info(`Showing top ${entries.length} developers`);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
display.error(err.message || "Failed to fetch leaderboard");
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function formatScore(score) {
|
|
156
|
+
if (score >= 0.8)
|
|
157
|
+
return chalk_1.default.green(score.toFixed(4));
|
|
158
|
+
if (score >= 0.5)
|
|
159
|
+
return chalk_1.default.yellow(score.toFixed(4));
|
|
160
|
+
return chalk_1.default.dim(score.toFixed(4));
|
|
161
|
+
}
|
|
162
|
+
function renderBar(value, width) {
|
|
163
|
+
const filled = Math.round(value * width);
|
|
164
|
+
const empty = width - filled;
|
|
165
|
+
return chalk_1.default.green("█".repeat(filled)) + chalk_1.default.dim("░".repeat(empty));
|
|
166
|
+
}
|
|
167
|
+
function padRight(str, len) {
|
|
168
|
+
return str.length >= len ? str : str + " ".repeat(len - str.length);
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=reputation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reputation.js","sourceRoot":"","sources":["../../src/commands/reputation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,6DAA+C;AAC/C,kDAAyG;AACzG,8CAAmD;AAEtC,QAAA,iBAAiB,GAAG,IAAI,mBAAO,CAAC,YAAY,CAAC;KACvD,WAAW,CAAC,2CAA2C,CAAC;KACxD,QAAQ,CAAC,WAAW,EAAE,gCAAgC,CAAC;KACvD,MAAM,CAAC,QAAQ,EAAE,gCAAgC,EAAE,KAAK,CAAC;KACzD,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,KAAK,CAAC;KAC5D,MAAM,CAAC,WAAW,EAAE,kCAAkC,EAAE,IAAI,CAAC;KAC7D,MAAM,CACL,KAAK,EACH,MAA0B,EAC1B,OAA6D,EAC7D,EAAE;IACF,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;QACjD,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,MAAM,g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AAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW,EAAE,GAAW;IACxC,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,eAAO,MAAM,aAAa,SAiFvB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.searchCommand = void 0;
|
|
40
|
+
const commander_1 = require("commander");
|
|
41
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const display = __importStar(require("../utils/display.js"));
|
|
43
|
+
const client_js_1 = require("../cloud/client.js");
|
|
44
|
+
function formatRep(score) {
|
|
45
|
+
if (score == null)
|
|
46
|
+
return chalk_1.default.dim("—");
|
|
47
|
+
if (score >= 0.7)
|
|
48
|
+
return chalk_1.default.green(score.toFixed(2));
|
|
49
|
+
if (score >= 0.3)
|
|
50
|
+
return chalk_1.default.yellow(score.toFixed(2));
|
|
51
|
+
return chalk_1.default.dim(score.toFixed(2));
|
|
52
|
+
}
|
|
53
|
+
exports.searchCommand = new commander_1.Command("search")
|
|
54
|
+
.description("Search genes on Rotifer Cloud")
|
|
55
|
+
.argument("[query]", "search keywords")
|
|
56
|
+
.option("-d, --domain <domain>", "filter by domain")
|
|
57
|
+
.option("--fidelity <type>", "filter by fidelity (Native/Wrapped)")
|
|
58
|
+
.option("--sort <order>", "sort order: newest, popular, fitness", "newest")
|
|
59
|
+
.option("--page <n>", "page number", "1")
|
|
60
|
+
.action(async (query, options) => {
|
|
61
|
+
display.header("Cloud Gene Search");
|
|
62
|
+
try {
|
|
63
|
+
const result = await (0, client_js_1.listGenes)({
|
|
64
|
+
query,
|
|
65
|
+
domain: options.domain,
|
|
66
|
+
fidelity: options.fidelity,
|
|
67
|
+
sort: options.sort,
|
|
68
|
+
page: parseInt(options.page || "1", 10),
|
|
69
|
+
});
|
|
70
|
+
if (result.genes.length === 0) {
|
|
71
|
+
display.warn("No genes found");
|
|
72
|
+
if (query)
|
|
73
|
+
display.info(`Try a different search: rotifer search`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
console.log();
|
|
77
|
+
const col = {
|
|
78
|
+
name: 22,
|
|
79
|
+
owner: 14,
|
|
80
|
+
domain: 14,
|
|
81
|
+
version: 9,
|
|
82
|
+
fidelity: 10,
|
|
83
|
+
rep: 8,
|
|
84
|
+
dl: 8,
|
|
85
|
+
};
|
|
86
|
+
console.log(" " +
|
|
87
|
+
padRight("Name", col.name) +
|
|
88
|
+
padRight("Owner", col.owner) +
|
|
89
|
+
padRight("Domain", col.domain) +
|
|
90
|
+
padRight("Ver", col.version) +
|
|
91
|
+
padRight("Fidelity", col.fidelity) +
|
|
92
|
+
padRight("R(g)", col.rep) +
|
|
93
|
+
"DL");
|
|
94
|
+
console.log(" " + "\u2500".repeat(85));
|
|
95
|
+
for (const g of result.genes) {
|
|
96
|
+
const fidelityColor = g.fidelity === "Native" ? chalk_1.default.green : chalk_1.default.dim;
|
|
97
|
+
console.log(" " +
|
|
98
|
+
padRight(g.name, col.name) +
|
|
99
|
+
padRight(g.owner, col.owner) +
|
|
100
|
+
padRight(g.domain, col.domain) +
|
|
101
|
+
padRight(g.version, col.version) +
|
|
102
|
+
padRight(fidelityColor(g.fidelity), col.fidelity + 10) +
|
|
103
|
+
padRight(formatRep(g.reputation_score), col.rep + 10) +
|
|
104
|
+
String(g.downloads));
|
|
105
|
+
}
|
|
106
|
+
console.log();
|
|
107
|
+
display.info(`Page ${result.page} — ${result.genes.length} of ${result.total} total`);
|
|
108
|
+
display.info("Install a gene: rotifer install <gene-id>");
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
display.error(err.message || "Search failed");
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
function padRight(str, len) {
|
|
116
|
+
return str.length >= len ? str : str + " ".repeat(len - str.length);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=search.js.map
|