@witty-ai/skill-insight 0.5.0-beta → 0.6.0-beta

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 (223) hide show
  1. package/.env.example +5 -0
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/app-path-routes-manifest.json +4 -0
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +3 -3
  6. package/.next/standalone/.next/routes-manifest.json +24 -0
  7. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  8. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  15. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  22. package/.next/standalone/.next/server/app/api/config/route.js +3 -3
  23. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/data/route.js +3 -3
  25. package/.next/standalone/.next/server/app/api/data/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/otel/v1/logs/route.js +3 -3
  27. package/.next/standalone/.next/server/app/api/otel/v1/logs/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/otel/v1/traces/route.js +1 -1
  29. package/.next/standalone/.next/server/app/api/otel/v1/traces/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/proxy/[taskId]/end/route.js +4 -4
  31. package/.next/standalone/.next/server/app/api/proxy/[taskId]/end/route.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/api/rejudge/route.js +3 -3
  33. package/.next/standalone/.next/server/app/api/rejudge/route.js.nft.json +1 -1
  34. package/.next/standalone/.next/server/app/api/session/route.js +1 -1
  35. package/.next/standalone/.next/server/app/api/session/route.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route/app-paths-manifest.json +3 -0
  37. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route/build-manifest.json +11 -0
  38. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route/server-reference-manifest.json +4 -0
  39. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route.js +6 -0
  40. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route.js.map +5 -0
  41. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route.js.nft.json +1 -0
  42. package/.next/standalone/.next/server/app/api/setup/opencode-commands/si-optimizer/route_client-reference-manifest.js +2 -0
  43. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route/app-paths-manifest.json +3 -0
  44. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route/build-manifest.json +11 -0
  45. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route/server-reference-manifest.json +4 -0
  46. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route.js +6 -0
  47. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route.js.map +5 -0
  48. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route.js.nft.json +1 -0
  49. package/.next/standalone/.next/server/app/api/setup/opencode-tui/route_client-reference-manifest.js +2 -0
  50. package/.next/standalone/.next/server/app/api/skills/[id]/versions/[version]/download/route.js.nft.json +1 -1
  51. package/.next/standalone/.next/server/app/api/skills/[id]/versions/[version]/route.js +3 -2
  52. package/.next/standalone/.next/server/app/api/skills/[id]/versions/[version]/route.js.nft.json +1 -1
  53. package/.next/standalone/.next/server/app/api/skills/automation/import/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/api/skills/logs/route.js +2 -2
  55. package/.next/standalone/.next/server/app/api/skills/logs/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/api/skills/route.js +3 -2
  57. package/.next/standalone/.next/server/app/api/skills/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route/app-paths-manifest.json +3 -0
  59. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route/build-manifest.json +11 -0
  60. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route/server-reference-manifest.json +4 -0
  61. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route.js +8 -0
  62. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route.js.map +5 -0
  63. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route.js.nft.json +1 -0
  64. package/.next/standalone/.next/server/app/api/skills/sync-enterprise/route_client-reference-manifest.js +2 -0
  65. package/.next/standalone/.next/server/app/api/task-stats/route/app-paths-manifest.json +3 -0
  66. package/.next/standalone/.next/server/app/api/task-stats/route/build-manifest.json +11 -0
  67. package/.next/standalone/.next/server/app/api/task-stats/route/server-reference-manifest.json +4 -0
  68. package/.next/standalone/.next/server/app/api/task-stats/route.js +11 -0
  69. package/.next/standalone/.next/server/app/api/task-stats/route.js.map +5 -0
  70. package/.next/standalone/.next/server/app/api/task-stats/route.js.nft.json +1 -0
  71. package/.next/standalone/.next/server/app/api/task-stats/route_client-reference-manifest.js +2 -0
  72. package/.next/standalone/.next/server/app/api/upload/route.js +1 -1
  73. package/.next/standalone/.next/server/app/api/upload/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/details/page/react-loadable-manifest.json +2 -2
  75. package/.next/standalone/.next/server/app/details/page_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/details.html +1 -1
  77. package/.next/standalone/.next/server/app/details.rsc +2 -2
  78. package/.next/standalone/.next/server/app/details.segments/_full.segment.rsc +2 -2
  79. package/.next/standalone/.next/server/app/details.segments/_head.segment.rsc +1 -1
  80. package/.next/standalone/.next/server/app/details.segments/_index.segment.rsc +1 -1
  81. package/.next/standalone/.next/server/app/details.segments/_tree.segment.rsc +1 -1
  82. package/.next/standalone/.next/server/app/details.segments/details/__PAGE__.segment.rsc +2 -2
  83. package/.next/standalone/.next/server/app/details.segments/details.segment.rsc +1 -1
  84. package/.next/standalone/.next/server/app/index.html +1 -1
  85. package/.next/standalone/.next/server/app/index.rsc +2 -2
  86. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  87. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  88. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  89. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  90. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  91. package/.next/standalone/.next/server/app/login.html +1 -1
  92. package/.next/standalone/.next/server/app/login.rsc +1 -1
  93. package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +1 -1
  94. package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
  95. package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +1 -1
  96. package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  97. package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  98. package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
  99. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/skills.html +1 -1
  101. package/.next/standalone/.next/server/app/skills.rsc +1 -1
  102. package/.next/standalone/.next/server/app/skills.segments/_full.segment.rsc +1 -1
  103. package/.next/standalone/.next/server/app/skills.segments/_head.segment.rsc +1 -1
  104. package/.next/standalone/.next/server/app/skills.segments/_index.segment.rsc +1 -1
  105. package/.next/standalone/.next/server/app/skills.segments/_tree.segment.rsc +1 -1
  106. package/.next/standalone/.next/server/app/skills.segments/skills/__PAGE__.segment.rsc +1 -1
  107. package/.next/standalone/.next/server/app/skills.segments/skills.segment.rsc +1 -1
  108. package/.next/standalone/.next/server/app-paths-manifest.json +4 -0
  109. package/.next/standalone/.next/server/chunks/[root-of-the-server]__15dbd1f2._.js +3 -0
  110. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ce5e3b8._.js +1 -1
  111. package/.next/standalone/.next/server/chunks/[root-of-the-server]__53775b48._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6923eecf._.js +1 -1
  113. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6d8053e2._.js +1 -1
  114. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8402dfd1._.js +3 -0
  115. package/.next/standalone/.next/server/chunks/[root-of-the-server]__863cf6de._.js +1 -1
  116. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89404730._.js +3 -0
  117. package/.next/standalone/.next/server/chunks/[root-of-the-server]__aa5c8858._.js +2 -2
  118. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c20da96a._.js +3 -0
  119. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ddf63a21._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f9e66e02._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/_3e8b4d8c._.js +1 -1
  122. package/.next/standalone/.next/server/chunks/_41a98bd8._.js +1 -1
  123. package/.next/standalone/.next/server/chunks/_4c806e26._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/_cd3d20ca._.js +1 -1
  125. package/.next/standalone/.next/server/chunks/_ddffef3e._.js +1 -1
  126. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_setup_opencode-tui_route_actions_fc8ae29f.js +3 -0
  127. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_skills_sync-enterprise_route_actions_0ca45899.js +3 -0
  128. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_task-stats_route_actions_983505cd.js +3 -0
  129. package/.next/standalone/.next/server/chunks/ce889_server_app_api_setup_opencode-commands_si-optimizer_route_actions_fcde30ef.js +3 -0
  130. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_c33286ed.js +47 -4
  131. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_f42faeee.js +1 -1
  132. package/.next/standalone/.next/server/chunks/src_98433cb8._.js +175 -0
  133. package/.next/standalone/.next/server/chunks/src_lib_12408140._.js +1 -1
  134. package/.next/standalone/.next/server/chunks/ssr/_c8c8c083._.js +2 -2
  135. package/.next/standalone/.next/server/chunks/ssr/_fd46f439._.js +2 -1
  136. package/.next/standalone/.next/server/chunks/ssr/node_modules_dagre-d3-es_src_dagre_index_3582f3d0.js +1 -1
  137. package/.next/standalone/.next/server/chunks/ssr/node_modules_lodash-es_a1341fea._.js +1 -1
  138. package/.next/standalone/.next/server/chunks/ssr/node_modules_lodash-es_e1de6ed8._.js +1 -1
  139. package/.next/standalone/.next/server/pages/404.html +1 -1
  140. package/.next/standalone/.next/server/pages/500.html +2 -2
  141. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  143. package/.next/standalone/.next/static/chunks/{01eddf501c574a44.js → 4ee8dc41c9f15b7b.js} +1 -1
  144. package/.next/standalone/.next/static/chunks/{737b8cff3c6a4e30.js → 9445b2873a413c58.js} +1 -1
  145. package/.next/standalone/.next/static/chunks/94dfb15df65ef720.js +2 -0
  146. package/.next/standalone/.next/static/chunks/9d1c5c3494fa53de.js +109 -0
  147. package/.next/standalone/.next/static/chunks/{e09d9ee16fe90255.js → cd0fde15dc0dfcca.js} +1 -1
  148. package/.next/standalone/.next/static/chunks/{ff6357067630b168.js → e13d208072a48316.js} +1 -1
  149. package/.next/standalone/node_modules/.prisma/client/edge.js +6 -3
  150. package/.next/standalone/node_modules/.prisma/client/index-browser.js +3 -0
  151. package/.next/standalone/node_modules/.prisma/client/index.js +6 -3
  152. package/.next/standalone/node_modules/.prisma/client/package.json +1 -1
  153. package/.next/standalone/node_modules/.prisma/client/schema.prisma +12 -9
  154. package/.next/standalone/node_modules/.prisma/client/wasm.js +3 -0
  155. package/.next/standalone/node_modules/adm-zip/util/constants.js +142 -0
  156. package/.next/standalone/node_modules/adm-zip/util/decoder.js +5 -0
  157. package/.next/standalone/node_modules/adm-zip/util/errors.js +63 -0
  158. package/.next/standalone/node_modules/adm-zip/util/fattr.js +76 -0
  159. package/.next/standalone/node_modules/adm-zip/util/index.js +5 -0
  160. package/.next/standalone/node_modules/adm-zip/util/utils.js +339 -0
  161. package/.next/standalone/package.json +6 -2
  162. package/.next/standalone/prisma/schema.prisma +3 -0
  163. package/.next/standalone/scripts/opencode_plugin.ts +23 -5
  164. package/.next/standalone/scripts/opencode_tui_plugin.tsx +308 -0
  165. package/.next/standalone/scripts/si-optimizer.md +5 -0
  166. package/.next/static/chunks/{01eddf501c574a44.js → 4ee8dc41c9f15b7b.js} +1 -1
  167. package/.next/static/chunks/{737b8cff3c6a4e30.js → 9445b2873a413c58.js} +1 -1
  168. package/.next/static/chunks/94dfb15df65ef720.js +2 -0
  169. package/.next/static/chunks/9d1c5c3494fa53de.js +109 -0
  170. package/.next/static/chunks/{e09d9ee16fe90255.js → cd0fde15dc0dfcca.js} +1 -1
  171. package/.next/static/chunks/{ff6357067630b168.js → e13d208072a48316.js} +1 -1
  172. package/package.json +6 -2
  173. package/prisma/schema.prisma +3 -0
  174. package/scripts/activate_telemetry.sh +44 -1
  175. package/scripts/opencode_plugin.ts +23 -5
  176. package/scripts/opencode_tui_plugin.tsx +308 -0
  177. package/scripts/si-optimizer.md +5 -0
  178. package/scripts/utils.js +0 -1
  179. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e2f0baee._.js +0 -3
  180. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fc05579d._.js +0 -3
  181. package/.next/standalone/.next/server/chunks/src_497d2ad2._.js +0 -175
  182. package/.next/standalone/.next/static/chunks/4071dbec4cf7e72e.js +0 -109
  183. package/.next/standalone/.next/static/chunks/a87b5e84254095a5.js +0 -1
  184. package/.next/standalone/LICENSE +0 -21
  185. package/.next/standalone/bin/cli.js +0 -106
  186. package/.next/standalone/custom-models.example.json +0 -21
  187. package/.next/standalone/eslint.config.mjs +0 -18
  188. package/.next/standalone/features/feature-skill-used-jump-link/design/2026-03-18-skill-used-jump-link-design.md +0 -126
  189. package/.next/standalone/features/feature-skill-used-jump-link/feature.json +0 -32
  190. package/.next/standalone/features/feature-skill-used-jump-link/issue.md +0 -32
  191. package/.next/standalone/features/feature-skill-used-jump-link/plans/2026-03-18-skill-used-jump-link.md +0 -528
  192. package/.next/standalone/next.config.ts +0 -41
  193. package/.next/standalone/scripts/activate_telemetry.sh +0 -159
  194. package/.next/standalone/scripts/create_migration_package.sh +0 -124
  195. package/.next/standalone/scripts/fix_models.js +0 -66
  196. package/.next/standalone/scripts/init_opengauss.py +0 -284
  197. package/.next/standalone/scripts/install.js +0 -273
  198. package/.next/standalone/scripts/logs.js +0 -38
  199. package/.next/standalone/scripts/otel_data/logs.jsonl +0 -12
  200. package/.next/standalone/scripts/otel_data/metrics.jsonl +0 -21
  201. package/.next/standalone/scripts/otel_data/raw_requests.jsonl +0 -8
  202. package/.next/standalone/scripts/otel_data/raw_requests.jsonl.bak +0 -6
  203. package/.next/standalone/scripts/otel_receiver.py +0 -580
  204. package/.next/standalone/scripts/postinstall.js +0 -192
  205. package/.next/standalone/scripts/publish-npm.js +0 -401
  206. package/.next/standalone/scripts/restart.js +0 -26
  207. package/.next/standalone/scripts/restart.sh +0 -138
  208. package/.next/standalone/scripts/restart_dev.sh +0 -132
  209. package/.next/standalone/scripts/start.js +0 -291
  210. package/.next/standalone/scripts/status.js +0 -41
  211. package/.next/standalone/scripts/stop.js +0 -90
  212. package/.next/standalone/scripts/sync_skills.js +0 -216
  213. package/.next/standalone/scripts/utils.js +0 -235
  214. package/.next/standalone/tests/setup_skill_optimizer.sh +0 -118
  215. package/.next/standalone/tsconfig.json +0 -34
  216. package/.next/static/chunks/4071dbec4cf7e72e.js +0 -109
  217. package/.next/static/chunks/a87b5e84254095a5.js +0 -1
  218. /package/.next/standalone/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_buildManifest.js +0 -0
  219. /package/.next/standalone/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_clientMiddlewareManifest.json +0 -0
  220. /package/.next/standalone/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_ssgManifest.js +0 -0
  221. /package/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_buildManifest.js +0 -0
  222. /package/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_clientMiddlewareManifest.json +0 -0
  223. /package/.next/static/{H581Rok68JtPV4bAVVH3l → 0uvhCJooDO_gMNlKOaHwB}/_ssgManifest.js +0 -0
@@ -1,192 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { execSync } = require('child_process')
4
- const fs = require('fs')
5
- const path = require('path')
6
-
7
- const {
8
- ensureEnvFile,
9
- ensureDataDirectory,
10
- runCommand,
11
- getDataRoot,
12
- migrateDataIfNeeded
13
- } = require('./utils.js')
14
-
15
- const PACKAGE_ROOT = path.resolve(__dirname, '..')
16
-
17
- console.log('=== Skill-Insight Post-Install Initialization ===\n')
18
-
19
- try {
20
- migrateDataIfNeeded()
21
- console.log()
22
-
23
- ensureEnvFile()
24
- console.log()
25
-
26
- ensureDataDirectory()
27
- console.log()
28
-
29
- const dataRoot = getDataRoot()
30
- const dbPath = path.join(dataRoot, 'data', 'witty_insight.db')
31
- const dbUrl = `file:${dbPath}`
32
- process.env.DATABASE_URL = dbUrl
33
-
34
- console.log('Syncing database schema...')
35
- execSync('npx prisma db push', {
36
- stdio: 'inherit',
37
- cwd: PACKAGE_ROOT,
38
- env: { ...process.env, DATABASE_URL: dbUrl }
39
- })
40
- console.log('✓ Database schema synced')
41
- console.log()
42
-
43
- console.log('Generating Prisma client...')
44
- execSync('npx prisma generate', {
45
- stdio: 'inherit',
46
- cwd: PACKAGE_ROOT,
47
- env: { ...process.env, DATABASE_URL: dbUrl }
48
- })
49
- console.log('✓ Prisma client generated')
50
- console.log()
51
-
52
- const standaloneDir = path.join(PACKAGE_ROOT, '.next', 'standalone')
53
- if (fs.existsSync(standaloneDir)) {
54
- console.log('Setting up standalone environment...')
55
-
56
- const staticDir = path.join(PACKAGE_ROOT, '.next', 'static')
57
- const standaloneStaticDir = path.join(standaloneDir, '.next', 'static')
58
-
59
- if (fs.existsSync(staticDir) && !fs.existsSync(standaloneStaticDir)) {
60
- fs.mkdirSync(path.dirname(standaloneStaticDir), { recursive: true })
61
- fs.cpSync(staticDir, standaloneStaticDir, { recursive: true })
62
- console.log('✓ Static files copied to standalone')
63
- }
64
-
65
- const publicDir = path.join(PACKAGE_ROOT, 'public')
66
- const standalonePublicDir = path.join(standaloneDir, 'public')
67
-
68
- if (fs.existsSync(publicDir) && !fs.existsSync(standalonePublicDir)) {
69
- fs.cpSync(publicDir, standalonePublicDir, { recursive: true })
70
- console.log('✓ Public files copied to standalone')
71
- }
72
-
73
- const prismaClientDir = path.join(PACKAGE_ROOT, 'node_modules', '.prisma', 'client')
74
- const standaloneNodeModules = path.join(standaloneDir, 'node_modules')
75
- const standalonePrismaDir = path.join(standaloneNodeModules, '.prisma')
76
- const standaloneClientDir = path.join(standalonePrismaDir, 'client')
77
-
78
- if (fs.existsSync(prismaClientDir)) {
79
- fs.mkdirSync(standalonePrismaDir, { recursive: true })
80
-
81
- if (fs.existsSync(standaloneClientDir)) {
82
- fs.rmSync(standaloneClientDir, { recursive: true, force: true })
83
- }
84
-
85
- fs.cpSync(prismaClientDir, standaloneClientDir, { recursive: true })
86
- console.log('✓ Prisma client copied to standalone')
87
- }
88
-
89
- const pgDir = path.join(PACKAGE_ROOT, 'node_modules', 'pg')
90
- if (fs.existsSync(pgDir)) {
91
- if (!fs.existsSync(standaloneNodeModules)) {
92
- fs.mkdirSync(standaloneNodeModules, { recursive: true })
93
- }
94
- const standalonePgDir = path.join(standaloneNodeModules, 'pg')
95
- if (!fs.existsSync(standalonePgDir)) {
96
- fs.cpSync(pgDir, standalonePgDir, { recursive: true })
97
- console.log('✓ pg module copied to standalone')
98
- }
99
- }
100
-
101
- const chunksDir = path.join(standaloneDir, '.next', 'server', 'chunks')
102
- if (fs.existsSync(chunksDir)) {
103
- const chunkFiles = fs.readdirSync(chunksDir).filter(f => f.endsWith('.js'))
104
- let foundPrismaHash = null
105
- let foundPgHash = null
106
-
107
- for (const file of chunkFiles) {
108
- const filePath = path.join(chunksDir, file)
109
- const content = fs.readFileSync(filePath, 'utf8')
110
-
111
- if (!foundPrismaHash) {
112
- const prismaHashMatch = content.match(/@prisma\/client-([a-f0-9]+)/)
113
- if (prismaHashMatch) {
114
- foundPrismaHash = prismaHashMatch[1]
115
- }
116
- }
117
-
118
- if (!foundPgHash) {
119
- const pgHashMatch = content.match(/["']pg-([a-f0-9]+)["']/)
120
- if (pgHashMatch) {
121
- foundPgHash = pgHashMatch[1]
122
- }
123
- }
124
-
125
- if (foundPrismaHash && foundPgHash) {
126
- break
127
- }
128
- }
129
-
130
- if (foundPrismaHash) {
131
- const hashName = `@prisma/client-${foundPrismaHash}`
132
- const hashDir = path.join(standaloneNodeModules, hashName)
133
-
134
- if (!fs.existsSync(hashDir)) {
135
- fs.mkdirSync(path.dirname(hashDir), { recursive: true })
136
- if (process.platform === 'win32') {
137
- try {
138
- fs.symlinkSync(standaloneClientDir, hashDir, 'junction')
139
- console.log(`✓ Created junction: ${hashName} -> .prisma/client`)
140
- } catch (err) {
141
- console.log(`⚠️ Could not create junction on Windows: ${err.message}`)
142
- console.log(` Falling back to copying directory...`)
143
- fs.cpSync(standaloneClientDir, hashDir, { recursive: true })
144
- console.log(`✓ Copied directory: ${hashName}`)
145
- }
146
- } else {
147
- fs.symlinkSync(standaloneClientDir, hashDir, 'dir')
148
- console.log(`✓ Created symlink: ${hashName} -> .prisma/client`)
149
- }
150
- }
151
- } else {
152
- console.log('⚠️ Could not find Prisma hash in build output')
153
- }
154
-
155
- if (foundPgHash) {
156
- const pgHashName = `pg-${foundPgHash}`
157
- const pgHashDir = path.join(standaloneNodeModules, pgHashName)
158
- const pgTargetDir = path.join(standaloneNodeModules, 'pg')
159
-
160
- if (!fs.existsSync(pgHashDir) && fs.existsSync(pgTargetDir)) {
161
- if (process.platform === 'win32') {
162
- try {
163
- fs.symlinkSync(pgTargetDir, pgHashDir, 'junction')
164
- console.log(`✓ Created junction: ${pgHashName} -> pg`)
165
- } catch (err) {
166
- console.log(`⚠️ Could not create junction on Windows: ${err.message}`)
167
- console.log(` Falling back to copying directory...`)
168
- fs.cpSync(pgTargetDir, pgHashDir, { recursive: true })
169
- console.log(`✓ Copied directory: ${pgHashName}`)
170
- }
171
- } else {
172
- fs.symlinkSync(pgTargetDir, pgHashDir, 'dir')
173
- console.log(`✓ Created symlink: ${pgHashName} -> pg`)
174
- }
175
- }
176
- } else {
177
- console.log('⚠️ Could not find pg hash in build output')
178
- }
179
- }
180
- console.log()
181
- }
182
-
183
- console.log('=== Initialization Complete ===')
184
- console.log('\nStart the service with:')
185
- console.log(' npx @witty-ai/skill-insight start')
186
- console.log('\nOr specify a custom port:')
187
- console.log(' npx @witty-ai/skill-insight start --port 3001')
188
- console.log('\nAccess the dashboard at: http://localhost:3000')
189
- } catch (error) {
190
- console.error('\n❌ Initialization failed:', error.message)
191
- process.exit(1)
192
- }
@@ -1,401 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { execSync } = require('child_process')
4
- const fs = require('fs')
5
- const path = require('path')
6
-
7
- function runCommand(command, description, ignoreFailure = false) {
8
- console.log(`\n${description}...`)
9
- console.log(`$ ${command}`)
10
- try {
11
- execSync(command, { stdio: 'inherit' })
12
- console.log('✓ Success')
13
- return true
14
- } catch (error) {
15
- if (ignoreFailure) {
16
- console.log('⚠️ Warning: Command failed, but continuing...')
17
- return false
18
- }
19
- console.error('✗ Failed')
20
- process.exit(1)
21
- }
22
- }
23
-
24
- function isValidVersion(version) {
25
- const semverRegex = /^(\d+)\.(\d+)\.(\d+)(-([a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*))?(\+([a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*))?$/
26
- return semverRegex.test(version)
27
- }
28
-
29
- function parseVersion(version) {
30
- const match = version.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?(?:\+(.+))?$/)
31
- if (!match) return null
32
-
33
- return {
34
- major: parseInt(match[1], 10),
35
- minor: parseInt(match[2], 10),
36
- patch: parseInt(match[3], 10),
37
- prerelease: match[4] || null,
38
- build: match[5] || null
39
- }
40
- }
41
-
42
- function incrementVersion(version, type = 'patch') {
43
- const parsed = parseVersion(version)
44
- if (!parsed) {
45
- throw new Error(`Invalid version: ${version}`)
46
- }
47
-
48
- let { major, minor, patch, prerelease, build } = parsed
49
-
50
- if (type === 'major') {
51
- major++
52
- minor = 0
53
- patch = 0
54
- prerelease = null
55
- } else if (type === 'minor') {
56
- minor++
57
- patch = 0
58
- prerelease = null
59
- } else {
60
- patch++
61
- prerelease = null
62
- }
63
-
64
- let newVersion = `${major}.${minor}.${patch}`
65
- if (prerelease) newVersion += `-${prerelease}`
66
- if (build) newVersion += `+${build}`
67
-
68
- return newVersion
69
- }
70
-
71
- function addPrerelease(version, prereleaseType) {
72
- const parsed = parseVersion(version)
73
- if (!parsed) {
74
- throw new Error(`Invalid version: ${version}`)
75
- }
76
-
77
- let { major, minor, patch, prerelease } = parsed
78
-
79
- if (prerelease && prerelease.startsWith(prereleaseType)) {
80
- const match = prerelease.match(new RegExp(`^${prereleaseType}\\.(\\d+)$`))
81
- if (match) {
82
- const num = parseInt(match[1], 10) + 1
83
- prerelease = `${prereleaseType}.${num}`
84
- } else {
85
- prerelease = `${prereleaseType}.1`
86
- }
87
- } else {
88
- prerelease = `${prereleaseType}.1`
89
- }
90
-
91
- return `${major}.${minor}.${patch}-${prerelease}`
92
- }
93
-
94
- function setupStandalone() {
95
- console.log('\nSetting up standalone environment...')
96
-
97
- const packageRoot = process.cwd()
98
- const standaloneDir = path.join(packageRoot, '.next', 'standalone')
99
-
100
- if (!fs.existsSync(standaloneDir)) {
101
- console.log('⚠️ Standalone directory not found, skipping setup')
102
- return
103
- }
104
-
105
- const staticDir = path.join(packageRoot, '.next', 'static')
106
- const standaloneStaticDir = path.join(standaloneDir, '.next', 'static')
107
-
108
- if (fs.existsSync(staticDir) && !fs.existsSync(standaloneStaticDir)) {
109
- fs.mkdirSync(path.dirname(standaloneStaticDir), { recursive: true })
110
- execSync(`cp -r "${staticDir}" "${path.dirname(standaloneStaticDir)}/"`, { stdio: 'inherit' })
111
- console.log('✓ Static files copied to standalone')
112
- }
113
-
114
- const publicDir = path.join(packageRoot, 'public')
115
- const standalonePublicDir = path.join(standaloneDir, 'public')
116
-
117
- if (fs.existsSync(publicDir) && !fs.existsSync(standalonePublicDir)) {
118
- execSync(`cp -r "${publicDir}" "${standaloneDir}/"`, { stdio: 'inherit' })
119
- console.log('✓ Public files copied to standalone')
120
- }
121
-
122
- const scriptsDir = path.join(packageRoot, 'scripts')
123
- const standaloneScriptsDir = path.join(standaloneDir, 'scripts')
124
-
125
- if (fs.existsSync(scriptsDir) && !fs.existsSync(standaloneScriptsDir)) {
126
- execSync(`cp -r "${scriptsDir}" "${standaloneDir}/"`, { stdio: 'inherit' })
127
- console.log('✓ Scripts files copied to standalone')
128
- }
129
-
130
- const prismaDir = path.join(packageRoot, 'prisma')
131
- const standalonePrismaDir = path.join(standaloneDir, 'prisma')
132
-
133
- if (fs.existsSync(prismaDir) && !fs.existsSync(standalonePrismaDir)) {
134
- execSync(`cp -r "${prismaDir}" "${standaloneDir}/"`, { stdio: 'inherit' })
135
- console.log('✓ Prisma files copied to standalone')
136
- }
137
-
138
- const dirsToRemove = ['docs', 'data', 'src', 'skills']
139
- const filesToRemove = ['README.md', '.env', 'server.log', 'tsconfig.tsbuildinfo', 'package-lock.json']
140
-
141
- const prismaDbFile = path.join(standaloneDir, 'prisma', 'dev.db')
142
- if (fs.existsSync(prismaDbFile)) {
143
- fs.unlinkSync(prismaDbFile)
144
- console.log('✓ Removed prisma/dev.db from standalone')
145
- }
146
-
147
- const tgzFiles = fs.readdirSync(standaloneDir).filter(f => f.endsWith('.tgz'))
148
- for (const tgz of tgzFiles) {
149
- fs.unlinkSync(path.join(standaloneDir, tgz))
150
- console.log(`✓ Removed ${tgz} from standalone`)
151
- }
152
-
153
- for (const dir of dirsToRemove) {
154
- const dirPath = path.join(standaloneDir, dir)
155
- if (fs.existsSync(dirPath)) {
156
- fs.rmSync(dirPath, { recursive: true, force: true })
157
- console.log(`✓ Removed ${dir}/ from standalone`)
158
- }
159
- }
160
-
161
- for (const file of filesToRemove) {
162
- const filePath = path.join(standaloneDir, file)
163
- if (fs.existsSync(filePath)) {
164
- fs.unlinkSync(filePath)
165
- console.log(`✓ Removed ${file} from standalone`)
166
- }
167
- }
168
-
169
- const nodeModulesDir = path.join(standaloneDir, 'node_modules')
170
- if (fs.existsSync(nodeModulesDir)) {
171
- const devDepsToRemove = ['typescript', '@typescript-eslint', 'eslint', 'prettier']
172
- for (const dep of devDepsToRemove) {
173
- const depPath = path.join(nodeModulesDir, dep)
174
- if (fs.existsSync(depPath)) {
175
- fs.rmSync(depPath, { recursive: true, force: true })
176
- console.log(`✓ Removed ${dep} from standalone node_modules`)
177
- }
178
- }
179
-
180
- const imgDir = path.join(nodeModulesDir, '@img')
181
- if (fs.existsSync(imgDir)) {
182
- const platform = process.platform
183
- const arch = process.arch
184
- const keepPattern = `${platform}-${arch}`
185
-
186
- const imgSubDirs = fs.readdirSync(imgDir, { withFileTypes: true })
187
- .filter(dirent => dirent.isDirectory())
188
- .map(dirent => dirent.name)
189
-
190
- for (const subDir of imgSubDirs) {
191
- if (!subDir.includes(keepPattern) && !subDir.includes('colour')) {
192
- const subDirPath = path.join(imgDir, subDir)
193
- fs.rmSync(subDirPath, { recursive: true, force: true })
194
- console.log(`✓ Removed @img/${subDir} from standalone (platform-specific)`)
195
- }
196
- }
197
- }
198
- }
199
-
200
- console.log('✓ Standalone setup complete')
201
- }
202
-
203
- function showHelp() {
204
- console.log(`
205
- Usage: node scripts/publish-npm.js [options]
206
-
207
- Options:
208
- --version <version> Specify exact version (e.g., 0.1.0-beta, 1.0.0)
209
- --type <type> Increment version type: patch, minor, major
210
- --prerelease <type> Add prerelease suffix: alpha, beta, rc
211
- --tag <tag> npm dist-tag (default: latest)
212
- --dry-run Test without publishing
213
- --help Show this help
214
-
215
- Examples:
216
- # Specify exact version
217
- node scripts/publish-npm.js --version 0.1.0-beta
218
-
219
- # Auto increment patch version
220
- node scripts/publish-npm.js --type patch
221
-
222
- # Add prerelease suffix
223
- node scripts/publish-npm.js --type minor --prerelease beta
224
- # 1.0.0 -> 1.1.0-beta.1
225
-
226
- # Publish beta version with tag
227
- node scripts/publish-npm.js --version 1.0.0-beta.1 --tag beta
228
-
229
- # Dry run
230
- node scripts/publish-npm.js --version 1.0.0 --dry-run
231
- `)
232
- }
233
-
234
- function main() {
235
- console.log('=== NPM Package Publishing Script ===\n')
236
-
237
- const args = process.argv.slice(2)
238
-
239
- if (args.includes('--help') || args.includes('-h')) {
240
- showHelp()
241
- process.exit(0)
242
- }
243
-
244
- const versionIndex = args.indexOf('--version')
245
- const typeIndex = args.indexOf('--type')
246
- const prereleaseIndex = args.indexOf('--prerelease')
247
- const tagIndex = args.indexOf('--tag')
248
- const dryRun = args.includes('--dry-run')
249
-
250
- const specifiedVersion = versionIndex !== -1 ? args[versionIndex + 1] : null
251
- const type = typeIndex !== -1 ? args[typeIndex + 1] : null
252
- const prereleaseType = prereleaseIndex !== -1 ? args[prereleaseIndex + 1] : null
253
- const npmTag = tagIndex !== -1 ? args[tagIndex + 1] : 'latest'
254
-
255
- if (specifiedVersion && type) {
256
- console.error('❌ Error: Cannot use both --version and --type together')
257
- process.exit(1)
258
- }
259
-
260
- if (!specifiedVersion && !type) {
261
- console.error('❌ Error: Must specify either --version or --type')
262
- showHelp()
263
- process.exit(1)
264
- }
265
-
266
- if (type && !['patch', 'minor', 'major'].includes(type)) {
267
- console.error('❌ Error: Invalid version type. Use: patch, minor, or major')
268
- process.exit(1)
269
- }
270
-
271
- if (specifiedVersion && !isValidVersion(specifiedVersion)) {
272
- console.error(`❌ Error: Invalid version format: ${specifiedVersion}`)
273
- console.error(' Expected format: X.Y.Z or X.Y.Z-prerelease (e.g., 1.0.0, 0.1.0-beta)')
274
- process.exit(1)
275
- }
276
-
277
- console.log('Configuration:')
278
- if (specifiedVersion) {
279
- console.log(` Version: ${specifiedVersion}`)
280
- } else {
281
- console.log(` Type: ${type}`)
282
- if (prereleaseType) {
283
- console.log(` Prerelease: ${prereleaseType}`)
284
- }
285
- }
286
- console.log(` npm tag: ${npmTag}`)
287
- console.log(` Dry run: ${dryRun ? 'Yes' : 'No'}`)
288
-
289
- try {
290
- const packageJsonPath = path.join(process.cwd(), 'package.json')
291
-
292
- if (!fs.existsSync(packageJsonPath)) {
293
- console.error('❌ Error: package.json not found')
294
- process.exit(1)
295
- }
296
-
297
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
298
-
299
- if (!packageJson.version) {
300
- console.error('❌ Error: package.json missing version field')
301
- process.exit(1)
302
- }
303
-
304
- const currentVersion = packageJson.version
305
- let newVersion
306
-
307
- if (specifiedVersion) {
308
- newVersion = specifiedVersion
309
- } else if (prereleaseType) {
310
- newVersion = addPrerelease(currentVersion, prereleaseType)
311
- } else {
312
- newVersion = incrementVersion(currentVersion, type)
313
- }
314
-
315
- console.log(`\nVersion: ${currentVersion} → ${newVersion}`)
316
-
317
- packageJson.version = newVersion
318
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n')
319
-
320
- console.log(`✓ Updated package.json`)
321
-
322
- runCommand('npm ci', 'Installing dependencies')
323
-
324
- if (fs.existsSync('eslint.config.mjs')) {
325
- runCommand('npm run lint', 'Running linter', true)
326
- }
327
-
328
- runCommand('npm run build', 'Building project')
329
-
330
- setupStandalone()
331
-
332
- const prismaDbInSource = path.join(process.cwd(), 'prisma', 'dev.db')
333
- if (fs.existsSync(prismaDbInSource)) {
334
- const stats = fs.statSync(prismaDbInSource)
335
- if (stats.size === 0) {
336
- fs.unlinkSync(prismaDbInSource)
337
- console.log('✓ Removed empty prisma/dev.db')
338
- }
339
- }
340
-
341
- const tgzName = `${packageJson.name}-${newVersion}.tgz`
342
- const existingTgz = path.join(process.cwd(), tgzName)
343
- if (fs.existsSync(existingTgz)) {
344
- fs.unlinkSync(existingTgz)
345
- }
346
-
347
- runCommand('npm pack', 'Creating npm package')
348
-
349
- const tgzPath = path.join(process.cwd(), tgzName)
350
- if (fs.existsSync(tgzPath)) {
351
- const stats = fs.statSync(tgzPath)
352
- const sizeMB = (stats.size / (1024 * 1024)).toFixed(2)
353
- console.log(`\n📦 Package created: ${tgzName} (${sizeMB} MB)`)
354
- }
355
-
356
- if (dryRun) {
357
- console.log('\n=== Dry Run Complete ===')
358
- console.log(`Version: ${newVersion}`)
359
- console.log(`npm tag: ${npmTag}`)
360
- console.log(`Package: ${tgzName}`)
361
- console.log('\nTo publish, run without --dry-run flag')
362
- } else {
363
- try {
364
- execSync('npm whoami', { stdio: 'ignore' })
365
- } catch (error) {
366
- console.error('\n❌ Error: Not logged in to npm')
367
- console.error('Please run: npm login')
368
- process.exit(1)
369
- }
370
-
371
- const isScopedPackage = packageJson.name.startsWith('@')
372
- let publishCmd
373
- if (isScopedPackage) {
374
- publishCmd = npmTag === 'latest'
375
- ? 'npm publish --access public'
376
- : `npm publish --access public --tag ${npmTag}`
377
- } else {
378
- publishCmd = npmTag === 'latest'
379
- ? 'npm publish'
380
- : `npm publish --tag ${npmTag}`
381
- }
382
-
383
- runCommand(publishCmd, `Publishing to npm (${npmTag} tag)`)
384
-
385
- console.log('\n=== Publishing Complete ===')
386
- console.log(`\nPackage: ${packageJson.name}@${newVersion}`)
387
- console.log(`Tag: ${npmTag}`)
388
- console.log('\nInstall with:')
389
- if (npmTag === 'latest') {
390
- console.log(` npm install ${packageJson.name}`)
391
- } else {
392
- console.log(` npm install ${packageJson.name}@${npmTag}`)
393
- }
394
- }
395
- } catch (error) {
396
- console.error('\n❌ Error:', error.message)
397
- process.exit(1)
398
- }
399
- }
400
-
401
- main()
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { sleep } = require('./utils.js')
4
-
5
- async function run(options) {
6
- console.log('=== Restarting Skill-Insight Service ===\n')
7
-
8
- try {
9
- const stop = require('./stop.js')
10
- const start = require('./start.js')
11
-
12
- await stop.run(options)
13
- console.log()
14
-
15
- console.log('Waiting for port to release...')
16
- await sleep(2000)
17
- console.log()
18
-
19
- await start.run(options)
20
- } catch (error) {
21
- console.error('❌ Restart failed:', error.message)
22
- process.exit(1)
23
- }
24
- }
25
-
26
- module.exports = { run }