jishushell 0.4.24 → 0.5.15

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 (281) hide show
  1. package/INSTALL-NOTICE +11 -0
  2. package/apps/anythingllm-container.yaml +287 -0
  3. package/apps/browserless-chromium-container.yaml +90 -0
  4. package/apps/filebrowser-container.yaml +163 -0
  5. package/apps/hermes-container.yaml +36 -2
  6. package/apps/ollama-binary.yaml +91 -90
  7. package/apps/ollama-cpu-container.yaml +8 -1
  8. package/apps/ollama-with-hollama-binary.yaml +91 -90
  9. package/apps/openclaw-binary.yaml +38 -1
  10. package/apps/openclaw-container.yaml +45 -2
  11. package/apps/openclaw-with-ollama-container.yaml +11 -2
  12. package/apps/openclaw-with-searxng-container.yaml +26 -2
  13. package/apps/openwebui-container.yaml +45 -1
  14. package/apps/playwright-container.yaml +7 -1
  15. package/apps/searxng-container.yaml +58 -7
  16. package/apps/weknora-container.yaml +471 -0
  17. package/dist/cli/app.js +79 -9
  18. package/dist/cli/app.js.map +1 -1
  19. package/dist/cli/doctor.d.ts +12 -12
  20. package/dist/cli/doctor.js +242 -55
  21. package/dist/cli/doctor.js.map +1 -1
  22. package/dist/cli/llm.d.ts +4 -3
  23. package/dist/cli/llm.js +4 -3
  24. package/dist/cli/llm.js.map +1 -1
  25. package/dist/cli/panel.d.ts +6 -5
  26. package/dist/cli/panel.js +10 -9
  27. package/dist/cli/panel.js.map +1 -1
  28. package/dist/config.d.ts +19 -0
  29. package/dist/config.js +99 -1
  30. package/dist/config.js.map +1 -1
  31. package/dist/control.d.ts +7 -6
  32. package/dist/control.js +7 -6
  33. package/dist/control.js.map +1 -1
  34. package/dist/install.js +3 -3
  35. package/dist/install.js.map +1 -1
  36. package/dist/routes/agent-apps.d.ts +1 -1
  37. package/dist/routes/agent-apps.js +1 -1
  38. package/dist/routes/apps.js +44 -11
  39. package/dist/routes/apps.js.map +1 -1
  40. package/dist/routes/auth.js +5 -2
  41. package/dist/routes/auth.js.map +1 -1
  42. package/dist/routes/backup.js +64 -11
  43. package/dist/routes/backup.js.map +1 -1
  44. package/dist/routes/external-mounts.d.ts +17 -0
  45. package/dist/routes/external-mounts.js +73 -0
  46. package/dist/routes/external-mounts.js.map +1 -0
  47. package/dist/routes/file-mounts.d.ts +13 -0
  48. package/dist/routes/file-mounts.js +90 -0
  49. package/dist/routes/file-mounts.js.map +1 -0
  50. package/dist/routes/files-organize.d.ts +28 -0
  51. package/dist/routes/files-organize.js +167 -0
  52. package/dist/routes/files-organize.js.map +1 -0
  53. package/dist/routes/files.d.ts +31 -0
  54. package/dist/routes/files.js +321 -0
  55. package/dist/routes/files.js.map +1 -0
  56. package/dist/routes/instances.js +826 -17
  57. package/dist/routes/instances.js.map +1 -1
  58. package/dist/routes/internal.d.ts +2 -0
  59. package/dist/routes/internal.js +59 -0
  60. package/dist/routes/internal.js.map +1 -0
  61. package/dist/routes/llm.js +24 -35
  62. package/dist/routes/llm.js.map +1 -1
  63. package/dist/routes/setup.js +10 -10
  64. package/dist/routes/setup.js.map +1 -1
  65. package/dist/routes/system.js +1 -1
  66. package/dist/routes/system.js.map +1 -1
  67. package/dist/routes/webdav.d.ts +17 -0
  68. package/dist/routes/webdav.js +114 -0
  69. package/dist/routes/webdav.js.map +1 -0
  70. package/dist/server.d.ts +9 -0
  71. package/dist/server.js +751 -20
  72. package/dist/server.js.map +1 -1
  73. package/dist/services/agent-apps/catalog.js +4 -3
  74. package/dist/services/agent-apps/catalog.js.map +1 -1
  75. package/dist/services/agent-apps/index.d.ts +1 -1
  76. package/dist/services/agent-apps/index.js +1 -1
  77. package/dist/services/agent-apps/installers/adapter.d.ts +1 -1
  78. package/dist/services/agent-apps/installers/adapter.js +1 -1
  79. package/dist/services/agent-apps/installers/shell-script.d.ts +1 -1
  80. package/dist/services/agent-apps/installers/shell-script.js +3 -3
  81. package/dist/services/agent-apps/installers/shell-script.js.map +1 -1
  82. package/dist/services/agent-apps/types.d.ts +2 -2
  83. package/dist/services/agent-apps/types.js +1 -1
  84. package/dist/services/app/app-compiler.d.ts +1 -1
  85. package/dist/services/app/app-compiler.js +5 -5
  86. package/dist/services/app/app-compiler.js.map +1 -1
  87. package/dist/services/app/app-manager.d.ts +25 -1
  88. package/dist/services/app/app-manager.js +829 -150
  89. package/dist/services/app/app-manager.js.map +1 -1
  90. package/dist/services/app/custom-manager.js.map +1 -1
  91. package/dist/services/app/hermes-agent-manager.js +7 -4
  92. package/dist/services/app/hermes-agent-manager.js.map +1 -1
  93. package/dist/services/app/ollama-manager.js +1 -1
  94. package/dist/services/app/ollama-manager.js.map +1 -1
  95. package/dist/services/app/openclaw-manager.js +20 -3
  96. package/dist/services/app/openclaw-manager.js.map +1 -1
  97. package/dist/services/app/platform-transform.d.ts +32 -0
  98. package/dist/services/app/platform-transform.js +65 -0
  99. package/dist/services/app/platform-transform.js.map +1 -0
  100. package/dist/services/app/provide-resolver.d.ts +29 -0
  101. package/dist/services/app/provide-resolver.js +112 -0
  102. package/dist/services/app/provide-resolver.js.map +1 -0
  103. package/dist/services/app-passwords.d.ts +61 -0
  104. package/dist/services/app-passwords.js +173 -0
  105. package/dist/services/app-passwords.js.map +1 -0
  106. package/dist/services/backup-manager.d.ts +11 -0
  107. package/dist/services/backup-manager.js +177 -4
  108. package/dist/services/backup-manager.js.map +1 -1
  109. package/dist/services/capability-endpoint-validator.d.ts +41 -0
  110. package/dist/services/capability-endpoint-validator.js +104 -0
  111. package/dist/services/capability-endpoint-validator.js.map +1 -0
  112. package/dist/services/capability-health.d.ts +16 -0
  113. package/dist/services/capability-health.js +121 -0
  114. package/dist/services/capability-health.js.map +1 -0
  115. package/dist/services/capability-registry.d.ts +106 -0
  116. package/dist/services/capability-registry.js +313 -0
  117. package/dist/services/capability-registry.js.map +1 -0
  118. package/dist/services/connection-apply.d.ts +91 -0
  119. package/dist/services/connection-apply.js +475 -0
  120. package/dist/services/connection-apply.js.map +1 -0
  121. package/dist/services/connection-resolver.d.ts +65 -0
  122. package/dist/services/connection-resolver.js +281 -0
  123. package/dist/services/connection-resolver.js.map +1 -0
  124. package/dist/services/connection-transactor.d.ts +39 -0
  125. package/dist/services/connection-transactor.js +351 -0
  126. package/dist/services/connection-transactor.js.map +1 -0
  127. package/dist/services/external-mounts.d.ts +40 -0
  128. package/dist/services/external-mounts.js +187 -0
  129. package/dist/services/external-mounts.js.map +1 -0
  130. package/dist/services/files-manager.d.ts +252 -0
  131. package/dist/services/files-manager.js +1075 -0
  132. package/dist/services/files-manager.js.map +1 -0
  133. package/dist/services/files-mounts.d.ts +42 -0
  134. package/dist/services/files-mounts.js +207 -0
  135. package/dist/services/files-mounts.js.map +1 -0
  136. package/dist/services/instance-manager.d.ts +13 -0
  137. package/dist/services/instance-manager.js +138 -46
  138. package/dist/services/instance-manager.js.map +1 -1
  139. package/dist/services/llm-proxy/index.d.ts +16 -2
  140. package/dist/services/llm-proxy/index.js +48 -44
  141. package/dist/services/llm-proxy/index.js.map +1 -1
  142. package/dist/services/llm-proxy/probe.d.ts +6 -0
  143. package/dist/services/llm-proxy/probe.js +85 -0
  144. package/dist/services/llm-proxy/probe.js.map +1 -0
  145. package/dist/services/llm-proxy/ssrf.d.ts +1 -0
  146. package/dist/services/llm-proxy/ssrf.js +24 -9
  147. package/dist/services/llm-proxy/ssrf.js.map +1 -1
  148. package/dist/services/nomad-manager.d.ts +4 -0
  149. package/dist/services/nomad-manager.js +428 -35
  150. package/dist/services/nomad-manager.js.map +1 -1
  151. package/dist/services/organize/applier.d.ts +46 -0
  152. package/dist/services/organize/applier.js +218 -0
  153. package/dist/services/organize/applier.js.map +1 -0
  154. package/dist/services/organize/rules.d.ts +57 -0
  155. package/dist/services/organize/rules.js +286 -0
  156. package/dist/services/organize/rules.js.map +1 -0
  157. package/dist/services/organize/scanner.d.ts +50 -0
  158. package/dist/services/organize/scanner.js +366 -0
  159. package/dist/services/organize/scanner.js.map +1 -0
  160. package/dist/services/organize/store.d.ts +14 -0
  161. package/dist/services/organize/store.js +82 -0
  162. package/dist/services/organize/store.js.map +1 -0
  163. package/dist/services/panel-manager.js +20 -1
  164. package/dist/services/panel-manager.js.map +1 -1
  165. package/dist/services/process-manager.js +4 -3
  166. package/dist/services/process-manager.js.map +1 -1
  167. package/dist/services/runtime/adapters/hermes.d.ts +30 -1
  168. package/dist/services/runtime/adapters/hermes.js +219 -6
  169. package/dist/services/runtime/adapters/hermes.js.map +1 -1
  170. package/dist/services/runtime/adapters/openclaw-mcporter.d.ts +45 -0
  171. package/dist/services/runtime/adapters/openclaw-mcporter.js +108 -0
  172. package/dist/services/runtime/adapters/openclaw-mcporter.js.map +1 -0
  173. package/dist/services/runtime/adapters/openclaw-routes.d.ts +8 -2
  174. package/dist/services/runtime/adapters/openclaw-routes.js +68 -0
  175. package/dist/services/runtime/adapters/openclaw-routes.js.map +1 -1
  176. package/dist/services/runtime/adapters/openclaw.d.ts +177 -0
  177. package/dist/services/runtime/adapters/openclaw.js +1171 -11
  178. package/dist/services/runtime/adapters/openclaw.js.map +1 -1
  179. package/dist/services/runtime/instance.d.ts +1 -1
  180. package/dist/services/runtime/instance.js +1 -1
  181. package/dist/services/runtime/instance.js.map +1 -1
  182. package/dist/services/runtime/mcp-shims/anythingllm-shim.d.ts +46 -0
  183. package/dist/services/runtime/mcp-shims/anythingllm-shim.js +281 -0
  184. package/dist/services/runtime/mcp-shims/anythingllm-shim.js.map +1 -0
  185. package/dist/services/runtime/mcp-shims/drive-shim.d.ts +54 -0
  186. package/dist/services/runtime/mcp-shims/drive-shim.js +489 -0
  187. package/dist/services/runtime/mcp-shims/drive-shim.js.map +1 -0
  188. package/dist/services/runtime/mcp-shims/firewall.d.ts +26 -0
  189. package/dist/services/runtime/mcp-shims/firewall.js +129 -0
  190. package/dist/services/runtime/mcp-shims/firewall.js.map +1 -0
  191. package/dist/services/runtime/mcp-shims/searxng-shim.d.ts +27 -0
  192. package/dist/services/runtime/mcp-shims/searxng-shim.js +125 -0
  193. package/dist/services/runtime/mcp-shims/searxng-shim.js.map +1 -0
  194. package/dist/services/runtime/mcp-shims/write-mcp-entry.d.ts +83 -0
  195. package/dist/services/runtime/mcp-shims/write-mcp-entry.js +127 -0
  196. package/dist/services/runtime/mcp-shims/write-mcp-entry.js.map +1 -0
  197. package/dist/services/runtime/migrations.d.ts +8 -0
  198. package/dist/services/runtime/migrations.js +100 -0
  199. package/dist/services/runtime/migrations.js.map +1 -1
  200. package/dist/services/runtime/types.d.ts +46 -0
  201. package/dist/services/setup-manager.js +99 -24
  202. package/dist/services/setup-manager.js.map +1 -1
  203. package/dist/services/suggestions.d.ts +27 -0
  204. package/dist/services/suggestions.js +133 -0
  205. package/dist/services/suggestions.js.map +1 -0
  206. package/dist/services/task-registry.js +4 -2
  207. package/dist/services/task-registry.js.map +1 -1
  208. package/dist/services/telemetry/device-fingerprint.d.ts +1 -1
  209. package/dist/services/telemetry/device-fingerprint.js +1 -1
  210. package/dist/services/types-shim.d.ts +16 -0
  211. package/dist/services/types-shim.js +2 -0
  212. package/dist/services/types-shim.js.map +1 -0
  213. package/dist/services/webdav/server.d.ts +24 -0
  214. package/dist/services/webdav/server.js +420 -0
  215. package/dist/services/webdav/server.js.map +1 -0
  216. package/dist/services/webdav/xml-builder.d.ts +73 -0
  217. package/dist/services/webdav/xml-builder.js +156 -0
  218. package/dist/services/webdav/xml-builder.js.map +1 -0
  219. package/dist/services/workspace-builder.d.ts +29 -0
  220. package/dist/services/workspace-builder.js +188 -0
  221. package/dist/services/workspace-builder.js.map +1 -0
  222. package/dist/types.d.ts +231 -1
  223. package/dist/utils/instance-lock.d.ts +22 -0
  224. package/dist/utils/instance-lock.js +48 -0
  225. package/dist/utils/instance-lock.js.map +1 -0
  226. package/dist/utils/path-locks.d.ts +30 -0
  227. package/dist/utils/path-locks.js +63 -0
  228. package/dist/utils/path-locks.js.map +1 -0
  229. package/dist/utils/path-safety.d.ts +41 -0
  230. package/dist/utils/path-safety.js +119 -0
  231. package/dist/utils/path-safety.js.map +1 -0
  232. package/dist/utils/safe-json.js +55 -22
  233. package/dist/utils/safe-json.js.map +1 -1
  234. package/dist/utils/safe-write.d.ts +24 -0
  235. package/dist/utils/safe-write.js +82 -0
  236. package/dist/utils/safe-write.js.map +1 -0
  237. package/install/jishu-install.sh +323 -27
  238. package/install/jishu-uninstall.sh +353 -20
  239. package/package.json +18 -1
  240. package/public/assets/Dashboard-BdWPtroF.js +1 -0
  241. package/public/assets/{HermesChatPanel-mFSureyc.js → HermesChatPanel-B_2HlVBQ.js} +1 -1
  242. package/public/assets/HermesConfigForm-DVlhg3WV.js +4 -0
  243. package/public/assets/{InitPassword-CVA8wQA6.js → InitPassword-D7glTExX.js} +1 -1
  244. package/public/assets/InstanceDetail-CxSy2cpe.js +92 -0
  245. package/public/assets/{Login-BWsZH2mu.js → Login-Cfr5c2sv.js} +1 -1
  246. package/public/assets/NewInstance-BIYDmJis.js +1 -0
  247. package/public/assets/ProviderRecommendations-BuRnvRcI.js +1 -0
  248. package/public/assets/Settings-Cc-tYBil.js +1 -0
  249. package/public/assets/Setup-lGZEk5jq.js +1 -0
  250. package/public/assets/{WeixinLoginPanel-CnjR8xMu.js → WeixinLoginPanel-CoGqzxeV.js} +2 -2
  251. package/public/assets/index-87IJXG-w.css +1 -0
  252. package/public/assets/index-BZc5zH7u.js +19 -0
  253. package/public/assets/providers-DtNXh9JD.js +1 -0
  254. package/public/assets/registry-BWnkJgZ1.js +2 -0
  255. package/public/assets/{usePolling-Do5Erqm_.js → usePolling-CwwT9KrC.js} +1 -1
  256. package/public/assets/{vendor-i18n-ucpM0OR0.js → vendor-i18n-y9V7Sfuu.js} +1 -1
  257. package/public/assets/{vendor-react-Bk1hRGiY.js → vendor-react-BWrEVJVb.js} +6 -6
  258. package/public/index.html +4 -4
  259. package/scripts/check-app-spec.mjs +457 -0
  260. package/scripts/check-i18n.mjs +154 -0
  261. package/scripts/check-new-file-tests.mjs +230 -0
  262. package/scripts/check-quarantine-expiry.mjs +105 -0
  263. package/scripts/perf/README.md +49 -0
  264. package/scripts/perf/auth.js +99 -0
  265. package/scripts/perf/config.js +63 -0
  266. package/scripts/perf/instances.js +143 -0
  267. package/scripts/perf/proxy.js +96 -0
  268. package/scripts/run.sh +4 -4
  269. package/scripts/smoke/files-w1.sh +142 -0
  270. package/scripts/smoke-backend.mjs +122 -0
  271. package/scripts/smoke-post-publish.mjs +346 -0
  272. package/public/assets/Dashboard-B-JoOjBQ.js +0 -1
  273. package/public/assets/HermesConfigForm-DvR05LK1.js +0 -4
  274. package/public/assets/InstanceDetail-DcZW2QGO.js +0 -91
  275. package/public/assets/NewInstance-BCIrAd86.js +0 -1
  276. package/public/assets/Settings-xkDcduFz.js +0 -1
  277. package/public/assets/Setup-Cfuwj4gV.js +0 -1
  278. package/public/assets/index-CPhVFEsx.css +0 -1
  279. package/public/assets/index-DQsM6Joa.js +0 -19
  280. package/public/assets/providers-V-vwrExZ.js +0 -1
  281. package/public/assets/registry-B4UFJdpA.js +0 -2
@@ -0,0 +1,230 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CI check: warn when newly added source files have no corresponding test.
4
+ *
5
+ * Usage:
6
+ * node scripts/check-new-file-tests.mjs [--base <ref>]
7
+ *
8
+ * Defaults:
9
+ * --base: CI_MERGE_REQUEST_TARGET_BRANCH_NAME (MR) or origin/main (fallback)
10
+ *
11
+ * Exit codes:
12
+ * 0 — all new files have tests (or no new files)
13
+ * 1 — some new files are missing tests (warning)
14
+ */
15
+
16
+ import { execSync } from "node:child_process";
17
+ import { existsSync } from "node:fs";
18
+ import { basename, dirname, join } from "node:path";
19
+
20
+ // ── Configuration ──────────────────────────────────────────────────────
21
+
22
+ /** File basenames exempt from the test requirement. */
23
+ const EXEMPT_BASENAMES = new Set([
24
+ "index.ts",
25
+ "index.tsx",
26
+ "types.ts",
27
+ "types.tsx",
28
+ "constants.ts",
29
+ "constants.tsx",
30
+ "main.tsx",
31
+ "App.tsx",
32
+ "vite-env.d.ts",
33
+ ]);
34
+
35
+ /** Glob-style suffix patterns to exempt. */
36
+ const EXEMPT_SUFFIXES = [
37
+ ".d.ts",
38
+ ".test.ts",
39
+ ".test.tsx",
40
+ ".spec.ts",
41
+ ".spec.tsx",
42
+ ".visual.spec.ts",
43
+ ".browser.test.ts",
44
+ ".browser.test.tsx",
45
+ ];
46
+
47
+ /** Path prefixes to exempt entirely. */
48
+ const EXEMPT_PATH_PREFIXES = [
49
+ "src/test-setup",
50
+ "frontend/src/test-setup",
51
+ "frontend/src/visual-tests/",
52
+ ];
53
+
54
+ /** Directories where backend tests live (searched for basename match). */
55
+ const BACKEND_TEST_DIRS = ["tests/unit", "tests/integration"];
56
+
57
+ // ── Helpers ────────────────────────────────────────────────────────────
58
+
59
+ function git(cmd) {
60
+ return execSync(`git ${cmd}`, { encoding: "utf-8" }).trim();
61
+ }
62
+
63
+ function resolveBase() {
64
+ // CLI --base override
65
+ const baseIdx = process.argv.indexOf("--base");
66
+ if (baseIdx !== -1 && process.argv[baseIdx + 1]) {
67
+ return process.argv[baseIdx + 1];
68
+ }
69
+
70
+ // GitLab MR pipeline
71
+ const mrTarget = process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;
72
+ if (mrTarget) {
73
+ try {
74
+ git(`fetch origin ${mrTarget} --depth=1 2>/dev/null`);
75
+ } catch {
76
+ // already fetched or shallow — proceed
77
+ }
78
+ return `origin/${mrTarget}`;
79
+ }
80
+
81
+ // GitLab push pipeline
82
+ const beforeSha = process.env.CI_COMMIT_BEFORE_SHA;
83
+ if (beforeSha && beforeSha !== "0000000000000000000000000000000000000000") {
84
+ return beforeSha;
85
+ }
86
+
87
+ // Local fallback
88
+ return "origin/main";
89
+ }
90
+
91
+ function isExempt(filePath) {
92
+ const base = basename(filePath);
93
+
94
+ if (EXEMPT_BASENAMES.has(base)) return true;
95
+ if (EXEMPT_SUFFIXES.some((s) => filePath.endsWith(s))) return true;
96
+ if (EXEMPT_PATH_PREFIXES.some((p) => filePath.startsWith(p))) return true;
97
+
98
+ return false;
99
+ }
100
+
101
+ /**
102
+ * Search for a test file matching the given source file basename.
103
+ * Accepts exact basename match or partial token match
104
+ * (e.g., `app.ts` matches `app-cli.test.ts`).
105
+ */
106
+ function findBackendTest(sourceFile) {
107
+ const base = basename(sourceFile, ".ts");
108
+
109
+ for (const dir of BACKEND_TEST_DIRS) {
110
+ try {
111
+ const files = execSync(
112
+ `find ${dir} -name "*.test.ts" -type f 2>/dev/null`,
113
+ { encoding: "utf-8" },
114
+ ).trim();
115
+
116
+ if (!files) continue;
117
+
118
+ for (const testFile of files.split("\n")) {
119
+ const testBase = basename(testFile, ".test.ts");
120
+ // Exact match or token-contains match
121
+ if (testBase === base || testBase.includes(base) || base.includes(testBase)) {
122
+ return testFile;
123
+ }
124
+ }
125
+ } catch {
126
+ continue;
127
+ }
128
+ }
129
+
130
+ return null;
131
+ }
132
+
133
+ /**
134
+ * Check if a co-located frontend test file exists.
135
+ */
136
+ function findFrontendTest(sourceFile) {
137
+ const dir = dirname(sourceFile);
138
+ const base = basename(sourceFile).replace(/\.(tsx?)$/, "");
139
+
140
+ const candidates = [
141
+ join(dir, `${base}.test.ts`),
142
+ join(dir, `${base}.test.tsx`),
143
+ ];
144
+
145
+ for (const candidate of candidates) {
146
+ if (existsSync(candidate)) return candidate;
147
+ }
148
+
149
+ return null;
150
+ }
151
+
152
+ // ── Main ───────────────────────────────────────────────────────────────
153
+
154
+ const base = resolveBase();
155
+ let mergeBase;
156
+ try {
157
+ mergeBase = git(`merge-base HEAD ${base}`);
158
+ } catch {
159
+ // merge-base may fail on shallow clones — fall back to direct base
160
+ mergeBase = base;
161
+ }
162
+
163
+ let newFiles;
164
+ try {
165
+ const output = git(`diff --name-only --diff-filter=A ${mergeBase}...HEAD`);
166
+ newFiles = output ? output.split("\n") : [];
167
+ } catch {
168
+ console.log("⚠ Could not compute diff — skipping new-file test check.");
169
+ process.exit(0);
170
+ }
171
+
172
+ // Filter to source files only
173
+ const backendSources = newFiles.filter(
174
+ (f) => f.startsWith("src/") && f.endsWith(".ts") && !isExempt(f),
175
+ );
176
+ const frontendSources = newFiles.filter(
177
+ (f) =>
178
+ f.startsWith("frontend/src/") &&
179
+ (f.endsWith(".ts") || f.endsWith(".tsx")) &&
180
+ !isExempt(f),
181
+ );
182
+
183
+ const uncovered = [];
184
+
185
+ for (const file of backendSources) {
186
+ const testFile = findBackendTest(file);
187
+ if (!testFile) {
188
+ uncovered.push({ source: file, kind: "backend" });
189
+ }
190
+ }
191
+
192
+ for (const file of frontendSources) {
193
+ const testFile = findFrontendTest(file);
194
+ if (!testFile) {
195
+ uncovered.push({ source: file, kind: "frontend" });
196
+ }
197
+ }
198
+
199
+ // ── Report ─────────────────────────────────────────────────────────────
200
+
201
+ const totalChecked = backendSources.length + frontendSources.length;
202
+
203
+ if (totalChecked === 0) {
204
+ console.log("✔ No new source files to check.");
205
+ process.exit(0);
206
+ }
207
+
208
+ console.log(`Checked ${totalChecked} new source file(s) against ${mergeBase.slice(0, 8)}...\n`);
209
+
210
+ if (uncovered.length === 0) {
211
+ console.log("✔ All new source files have matching test files.");
212
+ process.exit(0);
213
+ }
214
+
215
+ console.log("⚠ The following new source files have no obvious matching test:\n");
216
+ for (const { source, kind } of uncovered) {
217
+ const hint =
218
+ kind === "backend"
219
+ ? "→ Expected: tests/unit/**/<name>.test.ts or tests/integration/**/<name>.test.ts"
220
+ : "→ Expected: co-located <name>.test.{ts,tsx}";
221
+ console.log(` ${source}`);
222
+ console.log(` ${hint}\n`);
223
+ }
224
+ console.log(
225
+ "If these files are covered by existing integration/e2e tests, " +
226
+ "note the covering test in the MR description.\n" +
227
+ "See docs/testing.md for testing conventions.\n",
228
+ );
229
+
230
+ process.exit(1);
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Check quarantine expiry — fails CI if any quarantined test has expired.
4
+ *
5
+ * Usage: node scripts/check-quarantine-expiry.mjs
6
+ * Exit codes:
7
+ * 0 — all quarantined tests are within their expiry window (or none exist)
8
+ * 1 — one or more quarantined tests have expired
9
+ */
10
+
11
+ import { readFileSync } from "fs";
12
+ import { resolve, dirname } from "path";
13
+ import { fileURLToPath } from "url";
14
+
15
+ const __dirname = dirname(fileURLToPath(import.meta.url));
16
+ const quarantinePath = resolve(__dirname, "../tests/quarantine.json");
17
+
18
+ const MAX_QUARANTINE_DAYS = 14;
19
+
20
+ try {
21
+ const raw = readFileSync(quarantinePath, "utf-8");
22
+ const data = JSON.parse(raw);
23
+ const tests = data.tests || [];
24
+
25
+ if (tests.length === 0) {
26
+ console.log("✅ No quarantined tests.");
27
+ process.exit(0);
28
+ }
29
+
30
+ const today = new Date();
31
+ today.setHours(0, 0, 0, 0);
32
+
33
+ const expired = [];
34
+ const active = [];
35
+ const tooLong = [];
36
+
37
+ for (const entry of tests) {
38
+ const expiryDate = new Date(entry.expiry);
39
+ expiryDate.setHours(0, 0, 0, 0);
40
+ const createdDate = new Date(entry.created);
41
+ createdDate.setHours(0, 0, 0, 0);
42
+
43
+ const durationDays = Math.ceil(
44
+ (expiryDate.getTime() - createdDate.getTime()) / (1000 * 60 * 60 * 24),
45
+ );
46
+
47
+ if (durationDays > MAX_QUARANTINE_DAYS) {
48
+ tooLong.push({
49
+ ...entry,
50
+ durationDays,
51
+ });
52
+ }
53
+
54
+ if (expiryDate < today) {
55
+ expired.push(entry);
56
+ } else {
57
+ active.push(entry);
58
+ }
59
+ }
60
+
61
+ if (active.length > 0) {
62
+ console.log(`⏳ ${active.length} quarantined test(s) (active):`);
63
+ for (const t of active) {
64
+ console.log(` - ${t.file} > "${t.testName}" (expires: ${t.expiry}, owner: ${t.owner})`);
65
+ }
66
+ }
67
+
68
+ if (tooLong.length > 0) {
69
+ console.error(`\n❌ ${tooLong.length} quarantine(s) exceed ${MAX_QUARANTINE_DAYS}-day limit:`);
70
+ for (const t of tooLong) {
71
+ console.error(
72
+ ` - ${t.file} > "${t.testName}" (${t.durationDays} days, max ${MAX_QUARANTINE_DAYS})`,
73
+ );
74
+ }
75
+ console.error("\nShorten expiry to at most 14 days from creation date.");
76
+ }
77
+
78
+ if (expired.length > 0) {
79
+ console.error(`\n❌ ${expired.length} quarantined test(s) have EXPIRED:`);
80
+ for (const t of expired) {
81
+ console.error(
82
+ ` - ${t.file} > "${t.testName}" (expired: ${t.expiry}, owner: ${t.owner})`,
83
+ );
84
+ console.error(` Reason: ${t.reason}`);
85
+ if (t.issueLink) {
86
+ console.error(` Issue: ${t.issueLink}`);
87
+ }
88
+ }
89
+ console.error("\nFix or remove expired quarantine entries before merging.");
90
+ }
91
+
92
+ if (tooLong.length > 0 || expired.length > 0) {
93
+ process.exit(1);
94
+ }
95
+
96
+ console.log("\n✅ All quarantine entries are within their expiry window.");
97
+ process.exit(0);
98
+ } catch (err) {
99
+ if (err.code === "ENOENT") {
100
+ console.log("✅ No quarantine file found (tests/quarantine.json).");
101
+ process.exit(0);
102
+ }
103
+ console.error("Failed to check quarantine:", err.message);
104
+ process.exit(1);
105
+ }
@@ -0,0 +1,49 @@
1
+ # Performance Baseline Tests (k6)
2
+
3
+ Latency baseline scripts for core API endpoints. Run nightly in CI to detect
4
+ performance regressions.
5
+
6
+ ## Prerequisites
7
+
8
+ - [k6](https://grafana.com/docs/k6/latest/set-up/install-k6/) installed on the runner
9
+ - JishuShell server running (the CI job starts one automatically)
10
+
11
+ ## Scripts
12
+
13
+ | Script | Endpoints covered |
14
+ |--------|-------------------|
15
+ | `auth.js` | `/api/auth/status`, `/api/auth/login`, `/api/auth/logout` |
16
+ | `proxy.js` | `/proxy/v1/models`, `/api/llm/providers` |
17
+ | `instances.js` | `/api/instances` CRUD lifecycle |
18
+
19
+ ## Environment Variables
20
+
21
+ | Variable | Default | Description |
22
+ |----------|---------|-------------|
23
+ | `BASE_URL` | `http://127.0.0.1:8090` | Server base URL |
24
+ | `PASSWORD` | `perf-test-password-2026` | Admin password |
25
+ | `SMOKE` | `false` | Set to `true` for quick 10s validation |
26
+
27
+ ## Usage
28
+
29
+ ```bash
30
+ # Smoke test (quick validation)
31
+ k6 run -e SMOKE=true scripts/perf/auth.js
32
+
33
+ # Full baseline run
34
+ k6 run scripts/perf/auth.js
35
+
36
+ # All scripts with custom base URL
37
+ for script in scripts/perf/auth.js scripts/perf/proxy.js scripts/perf/instances.js; do
38
+ k6 run -e BASE_URL=http://localhost:9090 "$script"
39
+ done
40
+ ```
41
+
42
+ ## Thresholds
43
+
44
+ Default thresholds (see `config.js`):
45
+ - **p(95) < 500ms** for general endpoints
46
+ - **p(99) < 1000ms** tail latency
47
+ - **Error rate < 1%**
48
+
49
+ Per-endpoint overrides are defined in each script's `options.thresholds`.
@@ -0,0 +1,99 @@
1
+ import http from "k6/http";
2
+ import { check, group, sleep } from "k6";
3
+ import {
4
+ BASE_URL,
5
+ PASSWORD,
6
+ DEFAULT_THRESHOLDS,
7
+ DEFAULT_STAGES,
8
+ SMOKE_STAGES,
9
+ authHeaders,
10
+ } from "./config.js";
11
+
12
+ const isSmoke = __ENV.SMOKE === "true";
13
+
14
+ export const options = {
15
+ stages: isSmoke ? SMOKE_STAGES : DEFAULT_STAGES,
16
+ thresholds: {
17
+ ...DEFAULT_THRESHOLDS,
18
+ "http_req_duration{name:login}": ["p(95)<300"],
19
+ "http_req_duration{name:auth_status}": ["p(95)<100"],
20
+ },
21
+ tags: { suite: "auth" },
22
+ };
23
+
24
+ /**
25
+ * Setup: initialize password and obtain a baseline token.
26
+ * Runs once before VUs start.
27
+ */
28
+ export function setup() {
29
+ // Check if already initialized
30
+ const statusRes = http.get(`${BASE_URL}/api/auth/status`);
31
+ const initialized = statusRes.json("initialized");
32
+
33
+ let token;
34
+ if (!initialized) {
35
+ const initRes = http.post(
36
+ `${BASE_URL}/api/auth/init`,
37
+ JSON.stringify({ password: PASSWORD }),
38
+ { headers: { "Content-Type": "application/json" } },
39
+ );
40
+ check(initRes, { "init 200": (r) => r.status === 200 });
41
+ token = initRes.json("token");
42
+ } else {
43
+ const loginRes = http.post(
44
+ `${BASE_URL}/api/auth/login`,
45
+ JSON.stringify({ password: PASSWORD }),
46
+ { headers: { "Content-Type": "application/json" } },
47
+ );
48
+ check(loginRes, { "login 200": (r) => r.status === 200 });
49
+ token = loginRes.json("token");
50
+ }
51
+
52
+ if (!token) {
53
+ throw new Error("Failed to obtain auth token during setup");
54
+ }
55
+ return { token };
56
+ }
57
+
58
+ export default function (data) {
59
+ group("auth-status", () => {
60
+ const res = http.get(`${BASE_URL}/api/auth/status`, {
61
+ tags: { name: "auth_status" },
62
+ });
63
+ check(res, {
64
+ "status 200": (r) => r.status === 200,
65
+ "has initialized field": (r) => r.json("initialized") !== undefined,
66
+ });
67
+ });
68
+
69
+ sleep(0.5);
70
+
71
+ group("login", () => {
72
+ const res = http.post(
73
+ `${BASE_URL}/api/auth/login`,
74
+ JSON.stringify({ password: PASSWORD }),
75
+ {
76
+ headers: { "Content-Type": "application/json" },
77
+ tags: { name: "login" },
78
+ },
79
+ );
80
+ check(res, {
81
+ "login 200": (r) => r.status === 200,
82
+ "returns token": (r) => r.json("token") !== undefined,
83
+ });
84
+ });
85
+
86
+ sleep(0.5);
87
+
88
+ group("logout", () => {
89
+ const res = http.post(`${BASE_URL}/api/auth/logout`, null, {
90
+ headers: authHeaders(data.token),
91
+ tags: { name: "logout" },
92
+ });
93
+ check(res, {
94
+ "logout 200": (r) => r.status === 200,
95
+ });
96
+ });
97
+
98
+ sleep(1);
99
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared configuration and helpers for k6 performance tests.
3
+ *
4
+ * Environment variables:
5
+ * BASE_URL — server base URL (default: http://127.0.0.1:8090)
6
+ * PASSWORD — admin password for auth (default: perf-test-password-2026)
7
+ */
8
+
9
+ export const BASE_URL = __ENV.BASE_URL || "http://127.0.0.1:8090";
10
+ export const PASSWORD = __ENV.PASSWORD || "perf-test-password-2026";
11
+
12
+ /**
13
+ * Standard k6 thresholds for API endpoints.
14
+ * - p(95) < 500ms: acceptable for most CRUD ops
15
+ * - p(99) < 1000ms: tail latency budget
16
+ * - error rate < 1%
17
+ */
18
+ export const DEFAULT_THRESHOLDS = {
19
+ http_req_duration: ["p(95)<500", "p(99)<1000"],
20
+ http_req_failed: ["rate<0.01"],
21
+ };
22
+
23
+ /**
24
+ * Standard load profile for baseline tests.
25
+ * Ramp up to 10 VUs over 30s, hold for 2m, ramp down.
26
+ */
27
+ export const DEFAULT_STAGES = [
28
+ { duration: "30s", target: 10 },
29
+ { duration: "2m", target: 10 },
30
+ { duration: "10s", target: 0 },
31
+ ];
32
+
33
+ /**
34
+ * Smoke profile for quick validation (CI gate).
35
+ * 1 VU for 10s — just verify the script works.
36
+ */
37
+ export const SMOKE_STAGES = [
38
+ { duration: "10s", target: 1 },
39
+ ];
40
+
41
+ /**
42
+ * Build standard headers with auth cookie.
43
+ * @param {string} token - JWT token from login/init
44
+ * @returns {object} headers object for k6 http calls
45
+ */
46
+ export function authHeaders(token) {
47
+ return {
48
+ "Content-Type": "application/json",
49
+ Cookie: `jishushell_session=${token}`,
50
+ };
51
+ }
52
+
53
+ /**
54
+ * Build standard headers with Bearer token (for proxy routes).
55
+ * @param {string} token - JWT token
56
+ * @returns {object} headers object for k6 http calls
57
+ */
58
+ export function bearerHeaders(token) {
59
+ return {
60
+ "Content-Type": "application/json",
61
+ Authorization: `Bearer ${token}`,
62
+ };
63
+ }
@@ -0,0 +1,143 @@
1
+ import http from "k6/http";
2
+ import { check, group, sleep } from "k6";
3
+ import {
4
+ BASE_URL,
5
+ PASSWORD,
6
+ DEFAULT_THRESHOLDS,
7
+ DEFAULT_STAGES,
8
+ SMOKE_STAGES,
9
+ authHeaders,
10
+ } from "./config.js";
11
+
12
+ const isSmoke = __ENV.SMOKE === "true";
13
+
14
+ export const options = {
15
+ stages: isSmoke ? SMOKE_STAGES : DEFAULT_STAGES,
16
+ thresholds: {
17
+ ...DEFAULT_THRESHOLDS,
18
+ "http_req_duration{name:list_instances}": ["p(95)<300"],
19
+ "http_req_duration{name:create_instance}": ["p(95)<1000"],
20
+ "http_req_duration{name:get_instance}": ["p(95)<300"],
21
+ "http_req_duration{name:delete_instance}": ["p(95)<1000"],
22
+ },
23
+ tags: { suite: "instances" },
24
+ };
25
+
26
+ /**
27
+ * Setup: obtain auth token.
28
+ */
29
+ export function setup() {
30
+ const statusRes = http.get(`${BASE_URL}/api/auth/status`);
31
+ const initialized = statusRes.json("initialized");
32
+
33
+ let token;
34
+ if (!initialized) {
35
+ const initRes = http.post(
36
+ `${BASE_URL}/api/auth/init`,
37
+ JSON.stringify({ password: PASSWORD }),
38
+ { headers: { "Content-Type": "application/json" } },
39
+ );
40
+ token = initRes.json("token");
41
+ } else {
42
+ const loginRes = http.post(
43
+ `${BASE_URL}/api/auth/login`,
44
+ JSON.stringify({ password: PASSWORD }),
45
+ { headers: { "Content-Type": "application/json" } },
46
+ );
47
+ token = loginRes.json("token");
48
+ }
49
+
50
+ if (!token) {
51
+ throw new Error("Failed to obtain auth token during setup");
52
+ }
53
+ return { token };
54
+ }
55
+
56
+ export default function (data) {
57
+ const headers = authHeaders(data.token);
58
+ const instanceId = `perf-${__VU}-${__ITER}`;
59
+
60
+ group("list-instances", () => {
61
+ const res = http.get(`${BASE_URL}/api/instances`, {
62
+ headers,
63
+ tags: { name: "list_instances" },
64
+ });
65
+ check(res, {
66
+ "list 200": (r) => r.status === 200,
67
+ "returns array": (r) => {
68
+ try {
69
+ return Array.isArray(r.json());
70
+ } catch {
71
+ return false;
72
+ }
73
+ },
74
+ });
75
+ });
76
+
77
+ sleep(0.3);
78
+
79
+ group("create-instance", () => {
80
+ const payload = JSON.stringify({
81
+ id: instanceId,
82
+ name: `Perf Test ${instanceId}`,
83
+ description: "Created by k6 performance test",
84
+ agentType: "openclaw",
85
+ });
86
+ const res = http.post(`${BASE_URL}/api/instances`, payload, {
87
+ headers,
88
+ tags: { name: "create_instance" },
89
+ });
90
+ check(res, {
91
+ "create 200/201": (r) => r.status === 200 || r.status === 201,
92
+ });
93
+ });
94
+
95
+ sleep(0.3);
96
+
97
+ group("get-instance", () => {
98
+ const res = http.get(`${BASE_URL}/api/instances/${instanceId}`, {
99
+ headers,
100
+ tags: { name: "get_instance" },
101
+ });
102
+ check(res, {
103
+ "get 200": (r) => r.status === 200,
104
+ "has id": (r) => {
105
+ try {
106
+ return r.json("id") === instanceId;
107
+ } catch {
108
+ return false;
109
+ }
110
+ },
111
+ });
112
+ });
113
+
114
+ sleep(0.3);
115
+
116
+ group("update-instance", () => {
117
+ const payload = JSON.stringify({
118
+ name: `Updated ${instanceId}`,
119
+ description: "Updated by k6 performance test",
120
+ });
121
+ const res = http.put(`${BASE_URL}/api/instances/${instanceId}`, payload, {
122
+ headers,
123
+ tags: { name: "update_instance" },
124
+ });
125
+ check(res, {
126
+ "update 200": (r) => r.status === 200,
127
+ });
128
+ });
129
+
130
+ sleep(0.3);
131
+
132
+ group("delete-instance", () => {
133
+ const res = http.del(`${BASE_URL}/api/instances/${instanceId}`, null, {
134
+ headers,
135
+ tags: { name: "delete_instance" },
136
+ });
137
+ check(res, {
138
+ "delete 200": (r) => r.status === 200,
139
+ });
140
+ });
141
+
142
+ sleep(1);
143
+ }