@neta-art/neta-search-cli 0.2.58 → 0.2.64

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.
Files changed (2) hide show
  1. package/neta-search.mjs +28 -6
  2. package/package.json +1 -1
package/neta-search.mjs CHANGED
@@ -28113,16 +28113,35 @@ function cliVersion() {
28113
28113
  }
28114
28114
 
28115
28115
  // cli/src/env.ts
28116
+ var PROD_SERVICE = "http://neta-search-api.recsys.svc.cluster.local";
28117
+ var DEV_SERVICE = "http://neta-search-api-dev.recsys.svc.cluster.local";
28118
+ var PROD_PUBLIC = "https://search.neta.art";
28119
+ var DEV_PUBLIC = "https://dev-search.neta.art";
28120
+ function isDevEnv(env) {
28121
+ return (env ?? "").trim() === "dev";
28122
+ }
28116
28123
  function detectEnv() {
28117
28124
  const actorId = process.env["COHUB_USER_UUID"] ?? "";
28118
28125
  const spaceId = process.env["COHUB_SPACE_ID"] ?? "";
28119
- const apiBase = process.env["NETASEARCH_API"] ?? // sandbox 内(平台注入 COHUB_*):默认 prod Service——真实用户的事件该写
28120
- // prod 账本;否则 prod sandbox 的事件会全部写进 dev 账本(review #76 抓过的
28121
- // 隐患)。sandbox 外:默认 prod 公网地址(2026-10-09 起;此前是 dev,公网 npm 版发布前改),
28122
- // 本地验收用 NETASEARCH_API 指 dev。
28123
- // 不依赖平台注入 NETASEARCH_API——COHUB_SPACE_ID 就是平台已给的信号。
28124
- (spaceId !== "" ? "http://neta-search-api.recsys.svc.cluster.local" : "https://search.neta.art");
28126
+ const explicit = process.env["NETASEARCH_API"];
28127
+ const inSandbox = spaceId !== "";
28128
+ let apiBase;
28129
+ let source;
28130
+ if (explicit !== void 0) {
28131
+ apiBase = explicit;
28132
+ source = "NETASEARCH_API";
28133
+ } else if (isDevEnv(process.env["ENV"])) {
28134
+ apiBase = inSandbox ? DEV_SERVICE : DEV_PUBLIC;
28135
+ source = "env:dev";
28136
+ } else if (inSandbox) {
28137
+ apiBase = PROD_SERVICE;
28138
+ source = "default:prod";
28139
+ } else {
28140
+ apiBase = PROD_PUBLIC;
28141
+ source = "public";
28142
+ }
28125
28143
  return {
28144
+ source,
28126
28145
  apiBase,
28127
28146
  actorId,
28128
28147
  spaceId,
@@ -31111,6 +31130,7 @@ async function cmdRemove(names, opts) {
31111
31130
  const env = detectEnv();
31112
31131
  const local = scanLocal(opts.dir);
31113
31132
  const results = [];
31133
+ const reports = [];
31114
31134
  for (const n of names) {
31115
31135
  const found = (await findLocal(env, local, n)).filter((s) => existsSync7(s.path));
31116
31136
  if (found.length === 0) results.push({ name: n, result: "not_found" });
@@ -31122,9 +31142,11 @@ async function cmdRemove(names, opts) {
31122
31142
  } else {
31123
31143
  rmSync2(s.path, { recursive: true, force: true });
31124
31144
  results.push({ name: s.name, result: "removed" });
31145
+ if (s.kind === "installed" && s.id) reports.push(reportSkillEvent(env, "uninstall", s.id, s.digest ?? "", s.name));
31125
31146
  }
31126
31147
  }
31127
31148
  }
31149
+ await Promise.allSettled(reports);
31128
31150
  const failed = results.filter((r) => r.result !== "removed").length;
31129
31151
  if (opts.json) console.log(JSON.stringify({ results }));
31130
31152
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/neta-search-cli",
3
- "version": "0.2.58",
3
+ "version": "0.2.64",
4
4
  "description": "neta-search CLI — find, try and install skills from the Cohub / Neta skill registry",
5
5
  "type": "module",
6
6
  "bin": {