plugin-meta-worker.ts 715 B

1234567891011121314151617181920212223242526
  1. type Msg = {
  2. file: string
  3. spec: string
  4. target: string
  5. id: string
  6. }
  7. const raw = process.argv[2]
  8. if (!raw) throw new Error("Missing worker payload")
  9. const value = JSON.parse(raw)
  10. if (!value || typeof value !== "object") {
  11. throw new Error("Invalid worker payload")
  12. }
  13. const msg = Object.fromEntries(Object.entries(value))
  14. if (typeof msg.file !== "string" || typeof msg.spec !== "string" || typeof msg.target !== "string") {
  15. throw new Error("Invalid worker payload")
  16. }
  17. if (typeof msg.id !== "string") throw new Error("Invalid worker payload")
  18. process.env.KILO_PLUGIN_META_FILE = msg.file
  19. const { PluginMeta } = await import("../../src/plugin/meta")
  20. await PluginMeta.touch(msg.spec, msg.target, msg.id)