@agi-ventures-canada/hackathon-cli 0.1.2 → 0.1.4

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 (65) hide show
  1. package/dist/_chunks/assign.mjs +1 -1
  2. package/dist/_chunks/assign.mjs.map +1 -1
  3. package/dist/_chunks/assignments-create.mjs +2 -2
  4. package/dist/_chunks/assignments-create.mjs.map +1 -1
  5. package/dist/_chunks/assignments-list.mjs +6 -6
  6. package/dist/_chunks/assignments-list.mjs.map +1 -1
  7. package/dist/_chunks/constants.mjs +1 -1
  8. package/dist/_chunks/constants.mjs.map +1 -1
  9. package/dist/_chunks/create.mjs +16 -0
  10. package/dist/_chunks/create.mjs.map +1 -1
  11. package/dist/_chunks/create5.mjs +1 -1
  12. package/dist/_chunks/create5.mjs.map +1 -1
  13. package/dist/_chunks/create6.mjs +9 -3
  14. package/dist/_chunks/create6.mjs.map +1 -1
  15. package/dist/_chunks/criteria-create.mjs +1 -1
  16. package/dist/_chunks/criteria-create.mjs.map +1 -1
  17. package/dist/_chunks/criteria-list.mjs +1 -1
  18. package/dist/_chunks/criteria-list.mjs.map +1 -1
  19. package/dist/_chunks/criteria-update.mjs +1 -1
  20. package/dist/_chunks/criteria-update.mjs.map +1 -1
  21. package/dist/_chunks/get.mjs +5 -5
  22. package/dist/_chunks/get.mjs.map +1 -1
  23. package/dist/_chunks/get2.mjs +2 -2
  24. package/dist/_chunks/get2.mjs.map +1 -1
  25. package/dist/_chunks/get3.mjs +5 -5
  26. package/dist/_chunks/get3.mjs.map +1 -1
  27. package/dist/_chunks/get4.mjs +5 -5
  28. package/dist/_chunks/get4.mjs.map +1 -1
  29. package/dist/_chunks/hackathons.mjs +2 -2
  30. package/dist/_chunks/hackathons.mjs.map +1 -1
  31. package/dist/_chunks/invitations-list.mjs +1 -1
  32. package/dist/_chunks/invitations-list.mjs.map +1 -1
  33. package/dist/_chunks/judges-add.mjs +1 -1
  34. package/dist/_chunks/judges-add.mjs.map +1 -1
  35. package/dist/_chunks/judges-list.mjs +1 -1
  36. package/dist/_chunks/judges-list.mjs.map +1 -1
  37. package/dist/_chunks/list.mjs +2 -2
  38. package/dist/_chunks/list.mjs.map +1 -1
  39. package/dist/_chunks/list2.mjs +1 -1
  40. package/dist/_chunks/list2.mjs.map +1 -1
  41. package/dist/_chunks/list4.mjs +1 -1
  42. package/dist/_chunks/list4.mjs.map +1 -1
  43. package/dist/_chunks/list5.mjs +4 -4
  44. package/dist/_chunks/list5.mjs.map +1 -1
  45. package/dist/_chunks/login.mjs +5 -1
  46. package/dist/_chunks/login.mjs.map +1 -1
  47. package/dist/_chunks/org.mjs +1 -1
  48. package/dist/_chunks/org.mjs.map +1 -1
  49. package/dist/_chunks/pick-results.mjs +23 -19
  50. package/dist/_chunks/pick-results.mjs.map +1 -1
  51. package/dist/_chunks/reorder.mjs +1 -1
  52. package/dist/_chunks/reorder.mjs.map +1 -1
  53. package/dist/_chunks/reorder2.mjs +1 -1
  54. package/dist/_chunks/reorder2.mjs.map +1 -1
  55. package/dist/_chunks/results.mjs +6 -6
  56. package/dist/_chunks/results.mjs.map +1 -1
  57. package/dist/_chunks/submissions.mjs +3 -3
  58. package/dist/_chunks/submissions.mjs.map +1 -1
  59. package/dist/_chunks/update-check.mjs +24 -2
  60. package/dist/_chunks/update-check.mjs.map +1 -1
  61. package/dist/_chunks/update4.mjs +2 -2
  62. package/dist/_chunks/update4.mjs.map +1 -1
  63. package/dist/_chunks/update5.mjs +8 -1
  64. package/dist/_chunks/update5.mjs.map +1 -1
  65. package/package.json +1 -1
@@ -22,7 +22,7 @@ async function runPrizesAssign(client, hackathonId, prizeId, args) {
22
22
  console.error("Error: --submission is required");
23
23
  process.exit(1);
24
24
  }
25
- const result = await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/${prizeId}/assign`, { submission_id: options.submission });
25
+ const result = await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/${prizeId}/assign`, { submissionId: options.submission });
26
26
  if (options.json) {
27
27
  console.log(formatJson(result));
28
28
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"assign.mjs","names":[],"sources":["../../src/commands/prizes/assign.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\n\ninterface AssignOptions {\n submission?: string\n json?: boolean\n}\n\nexport function parseAssignOptions(args: string[]): AssignOptions {\n const options: AssignOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--submission\":\n options.submission = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runPrizesAssign(\n client: OatmealClient,\n hackathonId: string,\n prizeId: string,\n args: string[]\n): Promise<void> {\n if (!prizeId) {\n console.error(\"Usage: hackathon prizes assign <hackathon-id> <prize-id> --submission <id>\")\n process.exit(1)\n }\n\n const options = parseAssignOptions(args)\n\n if (!options.submission) {\n console.error(\"Error: --submission is required\")\n process.exit(1)\n }\n\n const result = await client.post(\n `/api/dashboard/hackathons/${hackathonId}/prizes/${prizeId}/assign`,\n { submission_id: options.submission }\n )\n\n if (options.json) {\n console.log(formatJson(result))\n return\n }\n\n console.log(formatSuccess(`Assigned prize ${prizeId} to submission ${options.submission}`))\n}\n"],"mappings":";;AAQA,SAAgB,mBAAmB,MAA+B;CAChE,MAAM,UAAyB,EAAE;AACjC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,aAAa,KAAK,EAAE;AAC5B;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,gBACpB,QACA,aACA,SACA,MACe;AACf,KAAI,CAAC,SAAS;AACZ,UAAQ,MAAM,6EAA6E;AAC3F,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,mBAAmB,KAAK;AAExC,KAAI,CAAC,QAAQ,YAAY;AACvB,UAAQ,MAAM,kCAAkC;AAChD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,SAAS,MAAM,OAAO,KAC1B,6BAA6B,YAAY,UAAU,QAAQ,UAC3D,EAAE,eAAe,QAAQ,YAAY,CACtC;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,OAAO,CAAC;AAC/B;;AAGF,SAAQ,IAAI,cAAc,kBAAkB,QAAQ,iBAAiB,QAAQ,aAAa,CAAC"}
1
+ {"version":3,"file":"assign.mjs","names":[],"sources":["../../src/commands/prizes/assign.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\n\ninterface AssignOptions {\n submission?: string\n json?: boolean\n}\n\nexport function parseAssignOptions(args: string[]): AssignOptions {\n const options: AssignOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--submission\":\n options.submission = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runPrizesAssign(\n client: OatmealClient,\n hackathonId: string,\n prizeId: string,\n args: string[]\n): Promise<void> {\n if (!prizeId) {\n console.error(\"Usage: hackathon prizes assign <hackathon-id> <prize-id> --submission <id>\")\n process.exit(1)\n }\n\n const options = parseAssignOptions(args)\n\n if (!options.submission) {\n console.error(\"Error: --submission is required\")\n process.exit(1)\n }\n\n const result = await client.post(\n `/api/dashboard/hackathons/${hackathonId}/prizes/${prizeId}/assign`,\n { submissionId: options.submission }\n )\n\n if (options.json) {\n console.log(formatJson(result))\n return\n }\n\n console.log(formatSuccess(`Assigned prize ${prizeId} to submission ${options.submission}`))\n}\n"],"mappings":";;AAQA,SAAgB,mBAAmB,MAA+B;CAChE,MAAM,UAAyB,EAAE;AACjC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,aAAa,KAAK,EAAE;AAC5B;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,gBACpB,QACA,aACA,SACA,MACe;AACf,KAAI,CAAC,SAAS;AACZ,UAAQ,MAAM,6EAA6E;AAC3F,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,mBAAmB,KAAK;AAExC,KAAI,CAAC,QAAQ,YAAY;AACvB,UAAQ,MAAM,kCAAkC;AAChD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,SAAS,MAAM,OAAO,KAC1B,6BAA6B,YAAY,UAAU,QAAQ,UAC3D,EAAE,cAAc,QAAQ,YAAY,CACrC;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,OAAO,CAAC;AAC/B;;AAGF,SAAQ,IAAI,cAAc,kBAAkB,QAAQ,iBAAiB,QAAQ,aAAa,CAAC"}
@@ -22,8 +22,8 @@ async function runAssignmentsCreate(client, hackathonId, args) {
22
22
  process.exit(1);
23
23
  }
24
24
  const assignment = await client.post(`/api/dashboard/hackathons/${hackathonId}/judging/assignments`, {
25
- judge_id: options.judge,
26
- submission_id: options.submission
25
+ judgeParticipantId: options.judge,
26
+ submissionId: options.submission
27
27
  });
28
28
  if (options.json) {
29
29
  console.log(formatJson(assignment));
@@ -1 +1 @@
1
- {"version":3,"file":"assignments-create.mjs","names":[],"sources":["../../src/commands/judging/assignments-create.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgeAssignment } from \"../../types.js\"\n\ninterface AssignmentCreateOptions {\n judge?: string\n submission?: string\n json?: boolean\n}\n\nexport function parseAssignmentCreateOptions(args: string[]): AssignmentCreateOptions {\n const options: AssignmentCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--judge\":\n options.judge = args[++i]\n break\n case \"--submission\":\n options.submission = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runAssignmentsCreate(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseAssignmentCreateOptions(args)\n\n if (!options.judge || !options.submission) {\n console.error(\"Error: --judge and --submission are required\")\n process.exit(1)\n }\n\n const assignment = await client.post<JudgeAssignment>(\n `/api/dashboard/hackathons/${hackathonId}/judging/assignments`,\n { judge_id: options.judge, submission_id: options.submission }\n )\n\n if (options.json) {\n console.log(formatJson(assignment))\n return\n }\n\n console.log(formatSuccess(`Created assignment ${assignment.id}`))\n}\n"],"mappings":";;AAUA,SAAgB,6BAA6B,MAAyC;CACpF,MAAM,UAAmC,EAAE;AAC3C,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,QAAQ,KAAK,EAAE;AACvB;EACF,KAAK;AACH,WAAQ,aAAa,KAAK,EAAE;AAC5B;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,qBACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,6BAA6B,KAAK;AAElD,KAAI,CAAC,QAAQ,SAAS,CAAC,QAAQ,YAAY;AACzC,UAAQ,MAAM,+CAA+C;AAC7D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,aAAa,MAAM,OAAO,KAC9B,6BAA6B,YAAY,uBACzC;EAAE,UAAU,QAAQ;EAAO,eAAe,QAAQ;EAAY,CAC/D;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,WAAW,CAAC;AACnC;;AAGF,SAAQ,IAAI,cAAc,sBAAsB,WAAW,KAAK,CAAC"}
1
+ {"version":3,"file":"assignments-create.mjs","names":[],"sources":["../../src/commands/judging/assignments-create.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgeAssignment } from \"../../types.js\"\n\ninterface AssignmentCreateOptions {\n judge?: string\n submission?: string\n json?: boolean\n}\n\nexport function parseAssignmentCreateOptions(args: string[]): AssignmentCreateOptions {\n const options: AssignmentCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--judge\":\n options.judge = args[++i]\n break\n case \"--submission\":\n options.submission = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runAssignmentsCreate(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseAssignmentCreateOptions(args)\n\n if (!options.judge || !options.submission) {\n console.error(\"Error: --judge and --submission are required\")\n process.exit(1)\n }\n\n const assignment = await client.post<JudgeAssignment>(\n `/api/dashboard/hackathons/${hackathonId}/judging/assignments`,\n { judgeParticipantId: options.judge, submissionId: options.submission }\n )\n\n if (options.json) {\n console.log(formatJson(assignment))\n return\n }\n\n console.log(formatSuccess(`Created assignment ${assignment.id}`))\n}\n"],"mappings":";;AAUA,SAAgB,6BAA6B,MAAyC;CACpF,MAAM,UAAmC,EAAE;AAC3C,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,QAAQ,KAAK,EAAE;AACvB;EACF,KAAK;AACH,WAAQ,aAAa,KAAK,EAAE;AAC5B;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,qBACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,6BAA6B,KAAK;AAElD,KAAI,CAAC,QAAQ,SAAS,CAAC,QAAQ,YAAY;AACzC,UAAQ,MAAM,+CAA+C;AAC7D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,aAAa,MAAM,OAAO,KAC9B,6BAA6B,YAAY,uBACzC;EAAE,oBAAoB,QAAQ;EAAO,cAAc,QAAQ;EAAY,CACxE;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,WAAW,CAAC;AACnC;;AAGF,SAAQ,IAAI,cAAc,sBAAsB,WAAW,KAAK,CAAC"}
@@ -12,20 +12,20 @@ async function runAssignmentsList(client, hackathonId, options) {
12
12
  }
13
13
  console.log(formatTable(data.assignments, [
14
14
  {
15
- key: "judge_name",
15
+ key: "judgeName",
16
16
  label: "Judge"
17
17
  },
18
18
  {
19
- key: "submission_name",
19
+ key: "submissionTitle",
20
20
  label: "Submission"
21
21
  },
22
22
  {
23
- key: "status",
24
- label: "Status"
23
+ key: "isComplete",
24
+ label: "Complete"
25
25
  },
26
26
  {
27
- key: "scored_at",
28
- label: "Scored At"
27
+ key: "assignedAt",
28
+ label: "Assigned At"
29
29
  }
30
30
  ]));
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"assignments-list.mjs","names":[],"sources":["../../src/commands/judging/assignments-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgeAssignment } from \"../../types.js\"\n\nexport async function runAssignmentsList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ assignments: JudgeAssignment[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/assignments`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.assignments?.length) {\n console.log(\"No assignments found.\")\n return\n }\n\n console.log(\n formatTable(data.assignments, [\n { key: \"judge_name\", label: \"Judge\" },\n { key: \"submission_name\", label: \"Submission\" },\n { key: \"status\", label: \"Status\" },\n { key: \"scored_at\", label: \"Scored At\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,mBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,sBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,wBAAwB;AACpC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAc,OAAO;GAAS;EACrC;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAa,OAAO;;EAC5B,CAAC,CACH"}
1
+ {"version":3,"file":"assignments-list.mjs","names":[],"sources":["../../src/commands/judging/assignments-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgeAssignment } from \"../../types.js\"\n\nexport async function runAssignmentsList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ assignments: JudgeAssignment[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/assignments`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.assignments?.length) {\n console.log(\"No assignments found.\")\n return\n }\n\n console.log(\n formatTable(data.assignments, [\n { key: \"judgeName\", label: \"Judge\" },\n { key: \"submissionTitle\", label: \"Submission\" },\n { key: \"isComplete\", label: \"Complete\" },\n { key: \"assignedAt\", label: \"Assigned At\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,mBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,sBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,wBAAwB;AACpC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAa,OAAO;GAAS;EACpC;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAc,OAAO;GAAY;EACxC;GAAE,KAAK;GAAc,OAAO;;EAC7B,CAAC,CACH"}
@@ -7,7 +7,7 @@ const CONFIG_DIR = join(homedir(), ".hackathon");
7
7
  const CONFIG_FILE = join(CONFIG_DIR, "config.json");
8
8
  const REQUEST_TIMEOUT_MS = 3e4;
9
9
  const POLL_INTERVAL_MS = 2e3;
10
- const AUTH_TIMEOUT_MS = 3e5;
10
+ const AUTH_TIMEOUT_MS = 6e5;
11
11
  //#endregion
12
12
  export { POLL_INTERVAL_MS as a, DEFAULT_BASE_URL as i, CONFIG_DIR as n, REQUEST_TIMEOUT_MS as o, CONFIG_FILE as r, VERSION as s, AUTH_TIMEOUT_MS as t };
13
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/constants.ts"],"sourcesContent":["import { homedir } from \"node:os\"\nimport { join } from \"node:path\"\n\nexport const VERSION = \"0.1.0\"\nexport const DEFAULT_BASE_URL = \"https://getoatmeal.com\"\nexport const CONFIG_DIR = join(homedir(), \".hackathon\")\nexport const CONFIG_FILE = join(CONFIG_DIR, \"config.json\")\nexport const REQUEST_TIMEOUT_MS = 30_000\nexport const POLL_INTERVAL_MS = 2_000\nexport const AUTH_TIMEOUT_MS = 300_000\n"],"mappings":";;;AAGA,MAAa,UAAU;AACvB,MAAa,mBAAmB;AAChC,MAAa,aAAa,KAAK,SAAS,EAAE,aAAa;AACvD,MAAa,cAAc,KAAK,YAAY,cAAc;AAC1D,MAAa,qBAAqB;AAClC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/constants.ts"],"sourcesContent":["import { homedir } from \"node:os\"\nimport { join } from \"node:path\"\n\nexport const VERSION = \"0.1.0\"\nexport const DEFAULT_BASE_URL = \"https://getoatmeal.com\"\nexport const CONFIG_DIR = join(homedir(), \".hackathon\")\nexport const CONFIG_FILE = join(CONFIG_DIR, \"config.json\")\nexport const REQUEST_TIMEOUT_MS = 30_000\nexport const POLL_INTERVAL_MS = 2_000\nexport const AUTH_TIMEOUT_MS = 600_000\n"],"mappings":";;;AAGA,MAAa,UAAU;AACvB,MAAa,mBAAmB;AAChC,MAAa,aAAa,KAAK,SAAS,EAAE,aAAa;AACvD,MAAa,cAAc,KAAK,YAAY,cAAc;AAC1D,MAAa,qBAAqB;AAClC,MAAa,mBAAmB;AAChC,MAAa,kBAAkB"}
@@ -13,6 +13,9 @@ function parseCreateOptions(args) {
13
13
  case "--description":
14
14
  options.description = args[++i];
15
15
  break;
16
+ case "--from-url":
17
+ options.fromUrl = args[++i];
18
+ break;
16
19
  case "--json":
17
20
  options.json = true;
18
21
  break;
@@ -24,6 +27,19 @@ async function runHackathonsCreate(client, args) {
24
27
  let name = options.name;
25
28
  let slug = options.slug;
26
29
  let description = options.description;
30
+ if (options.fromUrl) {
31
+ const hackathon = await client.post("/api/dashboard/import/luma-url", {
32
+ url: options.fromUrl,
33
+ name,
34
+ description
35
+ });
36
+ if (options.json) {
37
+ console.log(formatJson(hackathon));
38
+ return;
39
+ }
40
+ console.log(formatSuccess(`Imported hackathon "${hackathon.name}" (${hackathon.id})`));
41
+ return;
42
+ }
27
43
  if (!name && process.stdout.isTTY) {
28
44
  const result = await p.text({
29
45
  message: "Hackathon name:",
@@ -1 +1 @@
1
- {"version":3,"file":"create.mjs","names":[],"sources":["../../src/commands/hackathons/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\ninterface CreateOptions {\n name?: string\n slug?: string\n description?: string\n json?: boolean\n}\n\nexport function parseCreateOptions(args: string[]): CreateOptions {\n const options: CreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--slug\":\n options.slug = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runHackathonsCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseCreateOptions(args)\n\n let name = options.name\n let slug = options.slug\n let description = options.description\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Hackathon name:\", validate: (v: string) => (v ? undefined : \"Name is required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (!slug && process.stdout.isTTY) {\n const suggested = name.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-|-$/g, \"\")\n const result = await p.text({ message: \"Slug:\", initialValue: suggested })\n if (p.isCancel(result)) return\n slug = result\n }\n\n if (!description && process.stdout.isTTY) {\n const result = await p.text({ message: \"Description (optional):\" })\n if (!p.isCancel(result)) description = result || undefined\n }\n\n const hackathon = await client.post<Hackathon>(\"/api/dashboard/hackathons\", {\n name,\n slug,\n description,\n })\n\n if (options.json) {\n console.log(formatJson(hackathon))\n return\n }\n\n console.log(formatSuccess(`Created hackathon \"${hackathon.name}\" (${hackathon.id})`))\n}\n"],"mappings":";;;AAYA,SAAgB,mBAAmB,MAA+B;CAChE,MAAM,UAAyB,EAAE;AACjC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,oBACpB,QACA,MACe;CACf,MAAM,UAAU,mBAAmB,KAAK;CAExC,IAAI,OAAO,QAAQ;CACnB,IAAI,OAAO,QAAQ;CACnB,IAAI,cAAc,QAAQ;AAE1B,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAmB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAqB,CAAC;AAC1H,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,YAAY,KAAK,aAAa,CAAC,QAAQ,eAAe,IAAI,CAAC,QAAQ,UAAU,GAAG;EACtF,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAS,cAAc;GAAW,CAAC;AAC1E,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,eAAe,QAAQ,OAAO,OAAO;EACxC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,SAAS,2BAA2B,CAAC;AACnE,MAAI,CAAC,EAAE,SAAS,OAAO,CAAE,eAAc,UAAU,KAAA;;CAGnD,MAAM,YAAY,MAAM,OAAO,KAAgB,6BAA6B;EAC1E;EACA;EACA;EACD,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,UAAU,CAAC;AAClC;;AAGF,SAAQ,IAAI,cAAc,sBAAsB,UAAU,KAAK,KAAK,UAAU,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"create.mjs","names":[],"sources":["../../src/commands/hackathons/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\ninterface CreateOptions {\n name?: string\n slug?: string\n description?: string\n fromUrl?: string\n json?: boolean\n}\n\ninterface ImportedHackathonResponse {\n id: string\n name: string\n slug: string\n}\n\nexport function parseCreateOptions(args: string[]): CreateOptions {\n const options: CreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--slug\":\n options.slug = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--from-url\":\n options.fromUrl = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runHackathonsCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseCreateOptions(args)\n\n let name = options.name\n let slug = options.slug\n let description = options.description\n\n if (options.fromUrl) {\n const hackathon = await client.post<ImportedHackathonResponse>(\"/api/dashboard/import/luma-url\", {\n url: options.fromUrl,\n name,\n description,\n })\n\n if (options.json) {\n console.log(formatJson(hackathon))\n return\n }\n\n console.log(formatSuccess(`Imported hackathon \"${hackathon.name}\" (${hackathon.id})`))\n return\n }\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Hackathon name:\", validate: (v: string) => (v ? undefined : \"Name is required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (!slug && process.stdout.isTTY) {\n const suggested = name.toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-|-$/g, \"\")\n const result = await p.text({ message: \"Slug:\", initialValue: suggested })\n if (p.isCancel(result)) return\n slug = result\n }\n\n if (!description && process.stdout.isTTY) {\n const result = await p.text({ message: \"Description (optional):\" })\n if (!p.isCancel(result)) description = result || undefined\n }\n\n const hackathon = await client.post<Hackathon>(\"/api/dashboard/hackathons\", {\n name,\n slug,\n description,\n })\n\n if (options.json) {\n console.log(formatJson(hackathon))\n return\n }\n\n console.log(formatSuccess(`Created hackathon \"${hackathon.name}\" (${hackathon.id})`))\n}\n"],"mappings":";;;AAmBA,SAAgB,mBAAmB,MAA+B;CAChE,MAAM,UAAyB,EAAE;AACjC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,UAAU,KAAK,EAAE;AACzB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,oBACpB,QACA,MACe;CACf,MAAM,UAAU,mBAAmB,KAAK;CAExC,IAAI,OAAO,QAAQ;CACnB,IAAI,OAAO,QAAQ;CACnB,IAAI,cAAc,QAAQ;AAE1B,KAAI,QAAQ,SAAS;EACnB,MAAM,YAAY,MAAM,OAAO,KAAgC,kCAAkC;GAC/F,KAAK,QAAQ;GACb;GACA;GACD,CAAC;AAEF,MAAI,QAAQ,MAAM;AAChB,WAAQ,IAAI,WAAW,UAAU,CAAC;AAClC;;AAGF,UAAQ,IAAI,cAAc,uBAAuB,UAAU,KAAK,KAAK,UAAU,GAAG,GAAG,CAAC;AACtF;;AAGF,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAmB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAqB,CAAC;AAC1H,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,YAAY,KAAK,aAAa,CAAC,QAAQ,eAAe,IAAI,CAAC,QAAQ,UAAU,GAAG;EACtF,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAS,cAAc;GAAW,CAAC;AAC1E,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,eAAe,QAAQ,OAAO,OAAO;EACxC,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,SAAS,2BAA2B,CAAC;AACnE,MAAI,CAAC,EAAE,SAAS,OAAO,CAAE,eAAc,UAAU,KAAA;;CAGnD,MAAM,YAAY,MAAM,OAAO,KAAgB,6BAA6B;EAC1E;EACA;EACA;EACD,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,UAAU,CAAC;AAClC;;AAGF,SAAQ,IAAI,cAAc,sBAAsB,UAAU,KAAK,KAAK,UAAU,GAAG,GAAG,CAAC"}
@@ -46,7 +46,7 @@ async function runSchedulesCreate(client, args) {
46
46
  }
47
47
  const schedule = await client.post("/api/dashboard/schedules", {
48
48
  name,
49
- cron_expression: cron
49
+ cronExpression: cron
50
50
  });
51
51
  if (options.json) {
52
52
  console.log(formatJson(schedule));
@@ -1 +1 @@
1
- {"version":3,"file":"create5.mjs","names":[],"sources":["../../src/commands/schedules/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\ninterface ScheduleCreateOptions {\n name?: string\n cron?: string\n json?: boolean\n}\n\nexport function parseScheduleCreateOptions(args: string[]): ScheduleCreateOptions {\n const options: ScheduleCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--cron\":\n options.cron = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runSchedulesCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseScheduleCreateOptions(args)\n\n let name = options.name\n let cron = options.cron\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Schedule name:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (!cron && process.stdout.isTTY) {\n const result = await p.text({ message: \"Cron expression:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n cron = result\n }\n\n if (!cron) {\n console.error(\"Error: --cron is required\")\n process.exit(1)\n }\n\n const schedule = await client.post<Schedule>(\"/api/dashboard/schedules\", {\n name,\n cron_expression: cron,\n })\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(formatSuccess(`Created schedule \"${schedule.name}\" (${schedule.id})`))\n}\n"],"mappings":";;;AAWA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,mBACpB,QACA,MACe;CACf,MAAM,UAAU,2BAA2B,KAAK;CAEhD,IAAI,OAAO,QAAQ;CACnB,IAAI,OAAO,QAAQ;AAEnB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAkB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACjH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAoB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACnH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,KAAe,4BAA4B;EACvE;EACA,iBAAiB;EAClB,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,KAAK,SAAS,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"create5.mjs","names":[],"sources":["../../src/commands/schedules/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\ninterface ScheduleCreateOptions {\n name?: string\n cron?: string\n json?: boolean\n}\n\nexport function parseScheduleCreateOptions(args: string[]): ScheduleCreateOptions {\n const options: ScheduleCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--cron\":\n options.cron = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runSchedulesCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseScheduleCreateOptions(args)\n\n let name = options.name\n let cron = options.cron\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Schedule name:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (!cron && process.stdout.isTTY) {\n const result = await p.text({ message: \"Cron expression:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n cron = result\n }\n\n if (!cron) {\n console.error(\"Error: --cron is required\")\n process.exit(1)\n }\n\n const schedule = await client.post<Schedule>(\"/api/dashboard/schedules\", {\n name,\n cronExpression: cron,\n })\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(formatSuccess(`Created schedule \"${schedule.name}\" (${schedule.id})`))\n}\n"],"mappings":";;;AAWA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,mBACpB,QACA,MACe;CACf,MAAM,UAAU,2BAA2B,KAAK;CAEhD,IAAI,OAAO,QAAQ;CACnB,IAAI,OAAO,QAAQ;AAEnB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAkB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACjH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAoB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACnH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,KAAe,4BAA4B;EACvE;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,KAAK,SAAS,GAAG,GAAG,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import { a as formatWarning, n as formatJson, r as formatSuccess } from "../cli.mjs";
2
2
  import * as p from "@clack/prompts";
3
3
  //#region src/commands/webhooks/create.ts
4
+ function normalizeUrl(input) {
5
+ const trimmed = input.trim();
6
+ if (!trimmed) return trimmed;
7
+ if (/^https?:\/\//i.test(trimmed)) return trimmed;
8
+ return `https://${trimmed}`;
9
+ }
4
10
  function parseWebhookCreateOptions(args) {
5
11
  const options = {};
6
12
  for (let i = 0; i < args.length; i++) switch (args[i]) {
@@ -38,7 +44,7 @@ async function runWebhooksCreate(client, args) {
38
44
  events = result.split(",").map((s) => s.trim());
39
45
  }
40
46
  const webhook = await client.post("/api/v1/webhooks", {
41
- url,
47
+ url: normalizeUrl(url),
42
48
  events
43
49
  });
44
50
  if (options.json) {
@@ -46,9 +52,9 @@ async function runWebhooksCreate(client, args) {
46
52
  return;
47
53
  }
48
54
  console.log(formatSuccess(`Created webhook ${webhook.id}`));
49
- if (webhook.signing_secret) {
55
+ if (webhook.signingSecret) {
50
56
  console.log(formatWarning("Save this signing secret — it won't be shown again:"));
51
- console.log(webhook.signing_secret);
57
+ console.log(webhook.signingSecret);
52
58
  }
53
59
  }
54
60
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"create6.mjs","names":[],"sources":["../../src/commands/webhooks/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess, formatWarning } from \"../../output.js\"\nimport type { Webhook } from \"../../types.js\"\n\ninterface WebhookCreateOptions {\n url?: string\n events?: string[]\n json?: boolean\n}\n\nexport function parseWebhookCreateOptions(args: string[]): WebhookCreateOptions {\n const options: WebhookCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--url\":\n options.url = args[++i]\n break\n case \"--events\":\n options.events = args[++i]?.split(\",\").map((s) => s.trim())\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runWebhooksCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseWebhookCreateOptions(args)\n\n let url = options.url\n let events = options.events\n\n if (!url && process.stdout.isTTY) {\n const result = await p.text({ message: \"Webhook URL:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n url = result\n }\n\n if (!url) {\n console.error(\"Error: --url is required\")\n process.exit(1)\n }\n\n if (!events?.length && process.stdout.isTTY) {\n const result = await p.text({ message: \"Events (comma-separated):\" })\n if (p.isCancel(result)) return\n events = result.split(\",\").map((s: string) => s.trim())\n }\n\n const webhook = await client.post<Webhook>(\"/api/v1/webhooks\", { url, events })\n\n if (options.json) {\n console.log(formatJson(webhook))\n return\n }\n\n console.log(formatSuccess(`Created webhook ${webhook.id}`))\n if (webhook.signing_secret) {\n console.log(formatWarning(\"Save this signing secret — it won't be shown again:\"))\n console.log(webhook.signing_secret)\n }\n}\n"],"mappings":";;;AAWA,SAAgB,0BAA0B,MAAsC;CAC9E,MAAM,UAAgC,EAAE;AACxC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,MAAM,KAAK,EAAE;AACrB;EACF,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;AAC3D;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,MACe;CACf,MAAM,UAAU,0BAA0B,KAAK;CAE/C,IAAI,MAAM,QAAQ;CAClB,IAAI,SAAS,QAAQ;AAErB,KAAI,CAAC,OAAO,QAAQ,OAAO,OAAO;EAChC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAgB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AAC/G,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,QAAM;;AAGR,KAAI,CAAC,KAAK;AACR,UAAQ,MAAM,2BAA2B;AACzC,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,UAAU,QAAQ,OAAO,OAAO;EAC3C,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,SAAS,6BAA6B,CAAC;AACrE,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,WAAS,OAAO,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC;;CAGzD,MAAM,UAAU,MAAM,OAAO,KAAc,oBAAoB;EAAE;EAAK;EAAQ,CAAC;AAE/E,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,QAAQ,CAAC;AAChC;;AAGF,SAAQ,IAAI,cAAc,mBAAmB,QAAQ,KAAK,CAAC;AAC3D,KAAI,QAAQ,gBAAgB;AAC1B,UAAQ,IAAI,cAAc,sDAAsD,CAAC;AACjF,UAAQ,IAAI,QAAQ,eAAe"}
1
+ {"version":3,"file":"create6.mjs","names":[],"sources":["../../src/commands/webhooks/create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess, formatWarning } from \"../../output.js\"\nimport type { Webhook } from \"../../types.js\"\n\ninterface WebhookCreateOptions {\n url?: string\n events?: string[]\n json?: boolean\n}\n\nfunction normalizeUrl(input: string): string {\n const trimmed = input.trim()\n if (!trimmed) return trimmed\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed\n return `https://${trimmed}`\n}\n\nexport function parseWebhookCreateOptions(args: string[]): WebhookCreateOptions {\n const options: WebhookCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--url\":\n options.url = args[++i]\n break\n case \"--events\":\n options.events = args[++i]?.split(\",\").map((s) => s.trim())\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runWebhooksCreate(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseWebhookCreateOptions(args)\n\n let url = options.url\n let events = options.events\n\n if (!url && process.stdout.isTTY) {\n const result = await p.text({ message: \"Webhook URL:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n url = result\n }\n\n if (!url) {\n console.error(\"Error: --url is required\")\n process.exit(1)\n }\n\n if (!events?.length && process.stdout.isTTY) {\n const result = await p.text({ message: \"Events (comma-separated):\" })\n if (p.isCancel(result)) return\n events = result.split(\",\").map((s: string) => s.trim())\n }\n\n const webhook = await client.post<Webhook>(\"/api/v1/webhooks\", {\n url: normalizeUrl(url),\n events,\n })\n\n if (options.json) {\n console.log(formatJson(webhook))\n return\n }\n\n console.log(formatSuccess(`Created webhook ${webhook.id}`))\n if (webhook.signingSecret) {\n console.log(formatWarning(\"Save this signing secret — it won't be shown again:\"))\n console.log(webhook.signingSecret)\n }\n}\n"],"mappings":";;;AAWA,SAAS,aAAa,OAAuB;CAC3C,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,CAAC,QAAS,QAAO;AACrB,KAAI,gBAAgB,KAAK,QAAQ,CAAE,QAAO;AAC1C,QAAO,WAAW;;AAGpB,SAAgB,0BAA0B,MAAsC;CAC9E,MAAM,UAAgC,EAAE;AACxC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,MAAM,KAAK,EAAE;AACrB;EACF,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;AAC3D;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,MACe;CACf,MAAM,UAAU,0BAA0B,KAAK;CAE/C,IAAI,MAAM,QAAQ;CAClB,IAAI,SAAS,QAAQ;AAErB,KAAI,CAAC,OAAO,QAAQ,OAAO,OAAO;EAChC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAgB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AAC/G,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,QAAM;;AAGR,KAAI,CAAC,KAAK;AACR,UAAQ,MAAM,2BAA2B;AACzC,UAAQ,KAAK,EAAE;;AAGjB,KAAI,CAAC,QAAQ,UAAU,QAAQ,OAAO,OAAO;EAC3C,MAAM,SAAS,MAAM,EAAE,KAAK,EAAE,SAAS,6BAA6B,CAAC;AACrE,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,WAAS,OAAO,MAAM,IAAI,CAAC,KAAK,MAAc,EAAE,MAAM,CAAC;;CAGzD,MAAM,UAAU,MAAM,OAAO,KAAc,oBAAoB;EAC7D,KAAK,aAAa,IAAI;EACtB;EACD,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,QAAQ,CAAC;AAChC;;AAGF,SAAQ,IAAI,cAAc,mBAAmB,QAAQ,KAAK,CAAC;AAC3D,KAAI,QAAQ,eAAe;AACzB,UAAQ,IAAI,cAAc,sDAAsD,CAAC;AACjF,UAAQ,IAAI,QAAQ,cAAc"}
@@ -62,7 +62,7 @@ async function runCriteriaCreate(client, hackathonId, args) {
62
62
  const criteria = await client.post(`/api/dashboard/hackathons/${hackathonId}/judging/criteria`, {
63
63
  name,
64
64
  description: options.description,
65
- max_score: maxScore ?? 10,
65
+ maxScore: maxScore ?? 10,
66
66
  weight: weight ?? 1
67
67
  });
68
68
  if (options.json) {
@@ -1 +1 @@
1
- {"version":3,"file":"criteria-create.mjs","names":[],"sources":["../../src/commands/judging/criteria-create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\ninterface CriteriaCreateOptions {\n name?: string\n description?: string\n maxScore?: number\n weight?: number\n json?: boolean\n}\n\nexport function parseCriteriaCreateOptions(args: string[]): CriteriaCreateOptions {\n const options: CriteriaCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--max-score\":\n options.maxScore = parseInt(args[++i], 10)\n break\n case \"--weight\":\n options.weight = parseFloat(args[++i])\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runCriteriaCreate(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseCriteriaCreateOptions(args)\n\n let name = options.name\n let maxScore = options.maxScore\n let weight = options.weight\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Criteria name:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (maxScore === undefined && process.stdout.isTTY) {\n const result = await p.text({ message: \"Max score:\", initialValue: \"10\" })\n if (p.isCancel(result)) return\n maxScore = parseInt(result, 10)\n }\n\n if (maxScore !== undefined && (isNaN(maxScore) || maxScore <= 0)) {\n console.error(\"Error: --max-score must be a positive integer\")\n process.exit(1)\n }\n\n if (weight === undefined && process.stdout.isTTY) {\n const result = await p.text({ message: \"Weight:\", initialValue: \"1\" })\n if (p.isCancel(result)) return\n weight = parseFloat(result)\n }\n\n const criteria = await client.post<JudgingCriteria>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria`,\n {\n name,\n description: options.description,\n max_score: maxScore ?? 10,\n weight: weight ?? 1,\n }\n )\n\n if (options.json) {\n console.log(formatJson(criteria))\n return\n }\n\n console.log(formatSuccess(`Created criteria \"${criteria.name}\" (${criteria.id})`))\n}\n"],"mappings":";;;AAaA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,WAAW,SAAS,KAAK,EAAE,IAAI,GAAG;AAC1C;EACF,KAAK;AACH,WAAQ,SAAS,WAAW,KAAK,EAAE,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,2BAA2B,KAAK;CAEhD,IAAI,OAAO,QAAQ;CACnB,IAAI,WAAW,QAAQ;CACvB,IAAI,SAAS,QAAQ;AAErB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAkB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACjH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,aAAa,KAAA,KAAa,QAAQ,OAAO,OAAO;EAClD,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAc,cAAc;GAAM,CAAC;AAC1E,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,aAAW,SAAS,QAAQ,GAAG;;AAGjC,KAAI,aAAa,KAAA,MAAc,MAAM,SAAS,IAAI,YAAY,IAAI;AAChE,UAAQ,MAAM,gDAAgD;AAC9D,UAAQ,KAAK,EAAE;;AAGjB,KAAI,WAAW,KAAA,KAAa,QAAQ,OAAO,OAAO;EAChD,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAW,cAAc;GAAK,CAAC;AACtE,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,WAAS,WAAW,OAAO;;CAG7B,MAAM,WAAW,MAAM,OAAO,KAC5B,6BAA6B,YAAY,oBACzC;EACE;EACA,aAAa,QAAQ;EACrB,WAAW,YAAY;EACvB,QAAQ,UAAU;EACnB,CACF;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,KAAK,SAAS,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"criteria-create.mjs","names":[],"sources":["../../src/commands/judging/criteria-create.ts"],"sourcesContent":["import * as p from \"@clack/prompts\"\nimport type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\ninterface CriteriaCreateOptions {\n name?: string\n description?: string\n maxScore?: number\n weight?: number\n json?: boolean\n}\n\nexport function parseCriteriaCreateOptions(args: string[]): CriteriaCreateOptions {\n const options: CriteriaCreateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--max-score\":\n options.maxScore = parseInt(args[++i], 10)\n break\n case \"--weight\":\n options.weight = parseFloat(args[++i])\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runCriteriaCreate(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseCriteriaCreateOptions(args)\n\n let name = options.name\n let maxScore = options.maxScore\n let weight = options.weight\n\n if (!name && process.stdout.isTTY) {\n const result = await p.text({ message: \"Criteria name:\", validate: (v: string) => (v ? undefined : \"Required\") })\n if (p.isCancel(result)) return\n name = result\n }\n\n if (!name) {\n console.error(\"Error: --name is required\")\n process.exit(1)\n }\n\n if (maxScore === undefined && process.stdout.isTTY) {\n const result = await p.text({ message: \"Max score:\", initialValue: \"10\" })\n if (p.isCancel(result)) return\n maxScore = parseInt(result, 10)\n }\n\n if (maxScore !== undefined && (isNaN(maxScore) || maxScore <= 0)) {\n console.error(\"Error: --max-score must be a positive integer\")\n process.exit(1)\n }\n\n if (weight === undefined && process.stdout.isTTY) {\n const result = await p.text({ message: \"Weight:\", initialValue: \"1\" })\n if (p.isCancel(result)) return\n weight = parseFloat(result)\n }\n\n const criteria = await client.post<JudgingCriteria>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria`,\n {\n name,\n description: options.description,\n maxScore: maxScore ?? 10,\n weight: weight ?? 1,\n }\n )\n\n if (options.json) {\n console.log(formatJson(criteria))\n return\n }\n\n console.log(formatSuccess(`Created criteria \"${criteria.name}\" (${criteria.id})`))\n}\n"],"mappings":";;;AAaA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,WAAW,SAAS,KAAK,EAAE,IAAI,GAAG;AAC1C;EACF,KAAK;AACH,WAAQ,SAAS,WAAW,KAAK,EAAE,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,2BAA2B,KAAK;CAEhD,IAAI,OAAO,QAAQ;CACnB,IAAI,WAAW,QAAQ;CACvB,IAAI,SAAS,QAAQ;AAErB,KAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;EACjC,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAkB,WAAW,MAAe,IAAI,KAAA,IAAY;GAAa,CAAC;AACjH,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,SAAO;;AAGT,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,4BAA4B;AAC1C,UAAQ,KAAK,EAAE;;AAGjB,KAAI,aAAa,KAAA,KAAa,QAAQ,OAAO,OAAO;EAClD,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAc,cAAc;GAAM,CAAC;AAC1E,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,aAAW,SAAS,QAAQ,GAAG;;AAGjC,KAAI,aAAa,KAAA,MAAc,MAAM,SAAS,IAAI,YAAY,IAAI;AAChE,UAAQ,MAAM,gDAAgD;AAC9D,UAAQ,KAAK,EAAE;;AAGjB,KAAI,WAAW,KAAA,KAAa,QAAQ,OAAO,OAAO;EAChD,MAAM,SAAS,MAAM,EAAE,KAAK;GAAE,SAAS;GAAW,cAAc;GAAK,CAAC;AACtE,MAAI,EAAE,SAAS,OAAO,CAAE;AACxB,WAAS,WAAW,OAAO;;CAG7B,MAAM,WAAW,MAAM,OAAO,KAC5B,6BAA6B,YAAY,oBACzC;EACE;EACA,aAAa,QAAQ;EACrB,UAAU,YAAY;EACtB,QAAQ,UAAU;EACnB,CACF;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,KAAK,SAAS,GAAG,GAAG,CAAC"}
@@ -16,7 +16,7 @@ async function runCriteriaList(client, hackathonId, options) {
16
16
  label: "Name"
17
17
  },
18
18
  {
19
- key: "max_score",
19
+ key: "maxScore",
20
20
  label: "Max Score"
21
21
  },
22
22
  {
@@ -1 +1 @@
1
- {"version":3,"file":"criteria-list.mjs","names":[],"sources":["../../src/commands/judging/criteria-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\nexport async function runCriteriaList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ criteria: JudgingCriteria[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.criteria?.length) {\n console.log(\"No judging criteria found.\")\n return\n }\n\n console.log(\n formatTable(data.criteria, [\n { key: \"name\", label: \"Name\" },\n { key: \"max_score\", label: \"Max Score\" },\n { key: \"weight\", label: \"Weight\" },\n { key: \"description\", label: \"Description\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,gBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,mBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,UAAU,QAAQ;AAC1B,UAAQ,IAAI,6BAA6B;AACzC;;AAGF,SAAQ,IACN,YAAY,KAAK,UAAU;EACzB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAa,OAAO;GAAa;EACxC;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"criteria-list.mjs","names":[],"sources":["../../src/commands/judging/criteria-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\nexport async function runCriteriaList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ criteria: JudgingCriteria[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.criteria?.length) {\n console.log(\"No judging criteria found.\")\n return\n }\n\n console.log(\n formatTable(data.criteria, [\n { key: \"name\", label: \"Name\" },\n { key: \"maxScore\", label: \"Max Score\" },\n { key: \"weight\", label: \"Weight\" },\n { key: \"description\", label: \"Description\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,gBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,mBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,UAAU,QAAQ;AAC1B,UAAQ,IAAI,6BAA6B;AACzC;;AAGF,SAAQ,IACN,YAAY,KAAK,UAAU;EACzB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAY,OAAO;GAAa;EACvC;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
@@ -30,7 +30,7 @@ async function runCriteriaUpdate(client, hackathonId, criteriaId, args) {
30
30
  const body = {};
31
31
  if (options.name) body.name = options.name;
32
32
  if (options.description) body.description = options.description;
33
- if (options.maxScore !== void 0) body.max_score = options.maxScore;
33
+ if (options.maxScore !== void 0) body.maxScore = options.maxScore;
34
34
  if (options.weight !== void 0) body.weight = options.weight;
35
35
  if (Object.keys(body).length === 0) {
36
36
  console.error("Error: provide at least one field to update");
@@ -1 +1 @@
1
- {"version":3,"file":"criteria-update.mjs","names":[],"sources":["../../src/commands/judging/criteria-update.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\ninterface CriteriaUpdateOptions {\n name?: string\n description?: string\n maxScore?: number\n weight?: number\n json?: boolean\n}\n\nexport function parseCriteriaUpdateOptions(args: string[]): CriteriaUpdateOptions {\n const options: CriteriaUpdateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--max-score\":\n options.maxScore = parseInt(args[++i], 10)\n break\n case \"--weight\":\n options.weight = parseFloat(args[++i])\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runCriteriaUpdate(\n client: OatmealClient,\n hackathonId: string,\n criteriaId: string,\n args: string[]\n): Promise<void> {\n if (!criteriaId) {\n console.error(\"Usage: hackathon judging criteria update <hackathon-id> <criteria-id> [--name ...] [--max-score ...]\")\n process.exit(1)\n }\n\n const options = parseCriteriaUpdateOptions(args)\n const body: Record<string, unknown> = {}\n if (options.name) body.name = options.name\n if (options.description) body.description = options.description\n if (options.maxScore !== undefined) body.max_score = options.maxScore\n if (options.weight !== undefined) body.weight = options.weight\n\n if (Object.keys(body).length === 0) {\n console.error(\"Error: provide at least one field to update\")\n process.exit(1)\n }\n\n const criteria = await client.patch<JudgingCriteria>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria/${criteriaId}`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(criteria))\n return\n }\n\n console.log(formatSuccess(`Updated criteria \"${criteria.name}\"`))\n}\n"],"mappings":";;AAYA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,WAAW,SAAS,KAAK,EAAE,IAAI,GAAG;AAC1C;EACF,KAAK;AACH,WAAQ,SAAS,WAAW,KAAK,EAAE,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,aACA,YACA,MACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,uGAAuG;AACrH,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,2BAA2B,KAAK;CAChD,MAAM,OAAgC,EAAE;AACxC,KAAI,QAAQ,KAAM,MAAK,OAAO,QAAQ;AACtC,KAAI,QAAQ,YAAa,MAAK,cAAc,QAAQ;AACpD,KAAI,QAAQ,aAAa,KAAA,EAAW,MAAK,YAAY,QAAQ;AAC7D,KAAI,QAAQ,WAAW,KAAA,EAAW,MAAK,SAAS,QAAQ;AAExD,KAAI,OAAO,KAAK,KAAK,CAAC,WAAW,GAAG;AAClC,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,MAC5B,6BAA6B,YAAY,oBAAoB,cAC7D,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"criteria-update.mjs","names":[],"sources":["../../src/commands/judging/criteria-update.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { JudgingCriteria } from \"../../types.js\"\n\ninterface CriteriaUpdateOptions {\n name?: string\n description?: string\n maxScore?: number\n weight?: number\n json?: boolean\n}\n\nexport function parseCriteriaUpdateOptions(args: string[]): CriteriaUpdateOptions {\n const options: CriteriaUpdateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--description\":\n options.description = args[++i]\n break\n case \"--max-score\":\n options.maxScore = parseInt(args[++i], 10)\n break\n case \"--weight\":\n options.weight = parseFloat(args[++i])\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runCriteriaUpdate(\n client: OatmealClient,\n hackathonId: string,\n criteriaId: string,\n args: string[]\n): Promise<void> {\n if (!criteriaId) {\n console.error(\"Usage: hackathon judging criteria update <hackathon-id> <criteria-id> [--name ...] [--max-score ...]\")\n process.exit(1)\n }\n\n const options = parseCriteriaUpdateOptions(args)\n const body: Record<string, unknown> = {}\n if (options.name) body.name = options.name\n if (options.description) body.description = options.description\n if (options.maxScore !== undefined) body.maxScore = options.maxScore\n if (options.weight !== undefined) body.weight = options.weight\n\n if (Object.keys(body).length === 0) {\n console.error(\"Error: provide at least one field to update\")\n process.exit(1)\n }\n\n const criteria = await client.patch<JudgingCriteria>(\n `/api/dashboard/hackathons/${hackathonId}/judging/criteria/${criteriaId}`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(criteria))\n return\n }\n\n console.log(formatSuccess(`Updated criteria \"${criteria.name}\"`))\n}\n"],"mappings":";;AAYA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,cAAc,KAAK,EAAE;AAC7B;EACF,KAAK;AACH,WAAQ,WAAW,SAAS,KAAK,EAAE,IAAI,GAAG;AAC1C;EACF,KAAK;AACH,WAAQ,SAAS,WAAW,KAAK,EAAE,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,kBACpB,QACA,aACA,YACA,MACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,uGAAuG;AACrH,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,2BAA2B,KAAK;CAChD,MAAM,OAAgC,EAAE;AACxC,KAAI,QAAQ,KAAM,MAAK,OAAO,QAAQ;AACtC,KAAI,QAAQ,YAAa,MAAK,cAAc,QAAQ;AACpD,KAAI,QAAQ,aAAa,KAAA,EAAW,MAAK,WAAW,QAAQ;AAC5D,KAAI,QAAQ,WAAW,KAAA,EAAW,MAAK,SAAS,QAAQ;AAExD,KAAI,OAAO,KAAK,KAAK,CAAC,WAAW,GAAG;AAClC,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,MAC5B,6BAA6B,YAAY,oBAAoB,cAC7D,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,GAAG,CAAC"}
@@ -35,23 +35,23 @@ async function runHackathonsGet(client, idOrSlug, options) {
35
35
  },
36
36
  {
37
37
  label: "Starts",
38
- value: hackathon.starts_at
38
+ value: hackathon.startsAt
39
39
  },
40
40
  {
41
41
  label: "Ends",
42
- value: hackathon.ends_at
42
+ value: hackathon.endsAt
43
43
  },
44
44
  {
45
45
  label: "Registration Opens",
46
- value: hackathon.registration_opens_at
46
+ value: hackathon.registrationOpensAt
47
47
  },
48
48
  {
49
49
  label: "Registration Closes",
50
- value: hackathon.registration_closes_at
50
+ value: hackathon.registrationClosesAt
51
51
  },
52
52
  {
53
53
  label: "Created",
54
- value: hackathon.created_at
54
+ value: hackathon.createdAt
55
55
  }
56
56
  ]));
57
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get.mjs","names":[],"sources":["../../src/commands/hackathons/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\nimport { resolveHackathonId } from \"./resolve.js\"\n\nexport async function runHackathonsGet(\n client: OatmealClient,\n idOrSlug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!idOrSlug) {\n console.error(\"Usage: hackathon events get <id-or-slug>\")\n process.exit(1)\n }\n\n const id = await resolveHackathonId(client, idOrSlug)\n const hackathon = await client.get<Hackathon>(`/api/dashboard/hackathons/${id}`)\n\n if (options.json) {\n console.log(formatJson(hackathon))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: hackathon.id },\n { label: \"Name\", value: hackathon.name },\n { label: \"Slug\", value: hackathon.slug },\n { label: \"Status\", value: hackathon.status },\n { label: \"Description\", value: hackathon.description },\n { label: \"Starts\", value: hackathon.starts_at },\n { label: \"Ends\", value: hackathon.ends_at },\n { label: \"Registration Opens\", value: hackathon.registration_opens_at },\n { label: \"Registration Closes\", value: hackathon.registration_closes_at },\n { label: \"Created\", value: hackathon.created_at },\n ])\n )\n}\n"],"mappings":";;;AAKA,eAAsB,iBACpB,QACA,UACA,SACe;AACf,KAAI,CAAC,UAAU;AACb,UAAQ,MAAM,2CAA2C;AACzD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,KAAK,MAAM,mBAAmB,QAAQ,SAAS;CACrD,MAAM,YAAY,MAAM,OAAO,IAAe,6BAA6B,KAAK;AAEhF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,UAAU,CAAC;AAClC;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,UAAU;GAAI;EACpC;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAM;EACxC;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAM;EACxC;GAAE,OAAO;GAAU,OAAO,UAAU;GAAQ;EAC5C;GAAE,OAAO;GAAe,OAAO,UAAU;GAAa;EACtD;GAAE,OAAO;GAAU,OAAO,UAAU;GAAW;EAC/C;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAS;EAC3C;GAAE,OAAO;GAAsB,OAAO,UAAU;GAAuB;EACvE;GAAE,OAAO;GAAuB,OAAO,UAAU;GAAwB;EACzE;GAAE,OAAO;GAAW,OAAO,UAAU;;EACtC,CAAC,CACH"}
1
+ {"version":3,"file":"get.mjs","names":[],"sources":["../../src/commands/hackathons/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\nimport { resolveHackathonId } from \"./resolve.js\"\n\nexport async function runHackathonsGet(\n client: OatmealClient,\n idOrSlug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!idOrSlug) {\n console.error(\"Usage: hackathon events get <id-or-slug>\")\n process.exit(1)\n }\n\n const id = await resolveHackathonId(client, idOrSlug)\n const hackathon = await client.get<Hackathon>(`/api/dashboard/hackathons/${id}`)\n\n if (options.json) {\n console.log(formatJson(hackathon))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: hackathon.id },\n { label: \"Name\", value: hackathon.name },\n { label: \"Slug\", value: hackathon.slug },\n { label: \"Status\", value: hackathon.status },\n { label: \"Description\", value: hackathon.description },\n { label: \"Starts\", value: hackathon.startsAt },\n { label: \"Ends\", value: hackathon.endsAt },\n { label: \"Registration Opens\", value: hackathon.registrationOpensAt },\n { label: \"Registration Closes\", value: hackathon.registrationClosesAt },\n { label: \"Created\", value: hackathon.createdAt },\n ])\n )\n}\n"],"mappings":";;;AAKA,eAAsB,iBACpB,QACA,UACA,SACe;AACf,KAAI,CAAC,UAAU;AACb,UAAQ,MAAM,2CAA2C;AACzD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,KAAK,MAAM,mBAAmB,QAAQ,SAAS;CACrD,MAAM,YAAY,MAAM,OAAO,IAAe,6BAA6B,KAAK;AAEhF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,UAAU,CAAC;AAClC;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,UAAU;GAAI;EACpC;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAM;EACxC;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAM;EACxC;GAAE,OAAO;GAAU,OAAO,UAAU;GAAQ;EAC5C;GAAE,OAAO;GAAe,OAAO,UAAU;GAAa;EACtD;GAAE,OAAO;GAAU,OAAO,UAAU;GAAU;EAC9C;GAAE,OAAO;GAAQ,OAAO,UAAU;GAAQ;EAC1C;GAAE,OAAO;GAAsB,OAAO,UAAU;GAAqB;EACrE;GAAE,OAAO;GAAuB,OAAO,UAAU;GAAsB;EACvE;GAAE,OAAO;GAAW,OAAO,UAAU;;EACtC,CAAC,CACH"}
@@ -25,11 +25,11 @@ async function runJobsGet(client, jobId, options) {
25
25
  },
26
26
  {
27
27
  label: "Created",
28
- value: job.created_at
28
+ value: job.createdAt
29
29
  },
30
30
  {
31
31
  label: "Completed",
32
- value: job.completed_at
32
+ value: job.completedAt
33
33
  },
34
34
  {
35
35
  label: "Error",
@@ -1 +1 @@
1
- {"version":3,"file":"get2.mjs","names":[],"sources":["../../src/commands/jobs/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Job } from \"../../types.js\"\n\nexport async function runJobsGet(\n client: OatmealClient,\n jobId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!jobId) {\n console.error(\"Usage: hackathon jobs get <job-id>\")\n process.exit(1)\n }\n\n const job = await client.get<Job>(`/api/dashboard/jobs/${jobId}`)\n\n if (options.json) {\n console.log(formatJson(job))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: job.id },\n { label: \"Type\", value: job.type },\n { label: \"Status\", value: job.status },\n { label: \"Created\", value: job.created_at },\n { label: \"Completed\", value: job.completed_at },\n { label: \"Error\", value: job.error },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,WACpB,QACA,OACA,SACe;AACf,KAAI,CAAC,OAAO;AACV,UAAQ,MAAM,qCAAqC;AACnD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,MAAM,MAAM,OAAO,IAAS,uBAAuB,QAAQ;AAEjE,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,IAAI,CAAC;AAC5B;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,IAAI;GAAI;EAC9B;GAAE,OAAO;GAAQ,OAAO,IAAI;GAAM;EAClC;GAAE,OAAO;GAAU,OAAO,IAAI;GAAQ;EACtC;GAAE,OAAO;GAAW,OAAO,IAAI;GAAY;EAC3C;GAAE,OAAO;GAAa,OAAO,IAAI;GAAc;EAC/C;GAAE,OAAO;GAAS,OAAO,IAAI;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"get2.mjs","names":[],"sources":["../../src/commands/jobs/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Job } from \"../../types.js\"\n\nexport async function runJobsGet(\n client: OatmealClient,\n jobId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!jobId) {\n console.error(\"Usage: hackathon jobs get <job-id>\")\n process.exit(1)\n }\n\n const job = await client.get<Job>(`/api/dashboard/jobs/${jobId}`)\n\n if (options.json) {\n console.log(formatJson(job))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: job.id },\n { label: \"Type\", value: job.type },\n { label: \"Status\", value: job.status },\n { label: \"Created\", value: job.createdAt },\n { label: \"Completed\", value: job.completedAt },\n { label: \"Error\", value: job.error },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,WACpB,QACA,OACA,SACe;AACf,KAAI,CAAC,OAAO;AACV,UAAQ,MAAM,qCAAqC;AACnD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,MAAM,MAAM,OAAO,IAAS,uBAAuB,QAAQ;AAEjE,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,IAAI,CAAC;AAC5B;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,IAAI;GAAI;EAC9B;GAAE,OAAO;GAAQ,OAAO,IAAI;GAAM;EAClC;GAAE,OAAO;GAAU,OAAO,IAAI;GAAQ;EACtC;GAAE,OAAO;GAAW,OAAO,IAAI;GAAW;EAC1C;GAAE,OAAO;GAAa,OAAO,IAAI;GAAa;EAC9C;GAAE,OAAO;GAAS,OAAO,IAAI;;EAC9B,CAAC,CACH"}
@@ -10,25 +10,25 @@ async function runResultsGet(client, hackathonId, options) {
10
10
  console.log(formatJson(data));
11
11
  return;
12
12
  }
13
- if (!data.rankings?.length) {
13
+ if (!data.results?.length) {
14
14
  console.log("No results available. Run 'hackathon results calculate <id>' first.");
15
15
  return;
16
16
  }
17
- console.log(formatTable(data.rankings, [
17
+ console.log(formatTable(data.results, [
18
18
  {
19
19
  key: "rank",
20
20
  label: "#"
21
21
  },
22
22
  {
23
- key: "submission_name",
23
+ key: "submissionTitle",
24
24
  label: "Submission"
25
25
  },
26
26
  {
27
- key: "team_name",
27
+ key: "teamName",
28
28
  label: "Team"
29
29
  },
30
30
  {
31
- key: "total_score",
31
+ key: "totalScore",
32
32
  label: "Score"
33
33
  }
34
34
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"get3.mjs","names":[],"sources":["../../src/commands/results/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { ResultsData } from \"../../types.js\"\n\nexport async function runResultsGet(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!hackathonId) {\n console.error(\"Usage: hackathon results get <hackathon-id>\")\n process.exit(1)\n }\n\n const data = await client.get<ResultsData>(\n `/api/dashboard/hackathons/${hackathonId}/results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.rankings?.length) {\n console.log(\"No results available. Run 'hackathon results calculate <id>' first.\")\n return\n }\n\n console.log(\n formatTable(data.rankings, [\n { key: \"rank\", label: \"#\" },\n { key: \"submission_name\", label: \"Submission\" },\n { key: \"team_name\", label: \"Team\" },\n { key: \"total_score\", label: \"Score\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;AACf,KAAI,CAAC,aAAa;AAChB,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,UAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,UAAU,QAAQ;AAC1B,UAAQ,IAAI,sEAAsE;AAClF;;AAGF,SAAQ,IACN,YAAY,KAAK,UAAU;EACzB;GAAE,KAAK;GAAQ,OAAO;GAAK;EAC3B;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAa,OAAO;GAAQ;EACnC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"get3.mjs","names":[],"sources":["../../src/commands/results/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { ResultsData } from \"../../types.js\"\n\nexport async function runResultsGet(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!hackathonId) {\n console.error(\"Usage: hackathon results get <hackathon-id>\")\n process.exit(1)\n }\n\n const data = await client.get<ResultsData>(\n `/api/dashboard/hackathons/${hackathonId}/results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.results?.length) {\n console.log(\"No results available. Run 'hackathon results calculate <id>' first.\")\n return\n }\n\n console.log(\n formatTable(data.results, [\n { key: \"rank\", label: \"#\" },\n { key: \"submissionTitle\", label: \"Submission\" },\n { key: \"teamName\", label: \"Team\" },\n { key: \"totalScore\", label: \"Score\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;AACf,KAAI,CAAC,aAAa;AAChB,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,UAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,SAAS,QAAQ;AACzB,UAAQ,IAAI,sEAAsE;AAClF;;AAGF,SAAQ,IACN,YAAY,KAAK,SAAS;EACxB;GAAE,KAAK;GAAQ,OAAO;GAAK;EAC3B;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAY,OAAO;GAAQ;EAClC;GAAE,KAAK;GAAc,OAAO;;EAC7B,CAAC,CACH"}
@@ -21,23 +21,23 @@ async function runSchedulesGet(client, scheduleId, options) {
21
21
  },
22
22
  {
23
23
  label: "Cron",
24
- value: schedule.cron_expression
24
+ value: schedule.cronExpression
25
25
  },
26
26
  {
27
27
  label: "Enabled",
28
- value: String(schedule.enabled)
28
+ value: String(schedule.isActive)
29
29
  },
30
30
  {
31
31
  label: "Last Run",
32
- value: schedule.last_run_at
32
+ value: schedule.lastRunAt
33
33
  },
34
34
  {
35
35
  label: "Next Run",
36
- value: schedule.next_run_at
36
+ value: schedule.nextRunAt
37
37
  },
38
38
  {
39
39
  label: "Created",
40
- value: schedule.created_at
40
+ value: schedule.createdAt
41
41
  }
42
42
  ]));
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get4.mjs","names":[],"sources":["../../src/commands/schedules/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\nexport async function runSchedulesGet(\n client: OatmealClient,\n scheduleId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!scheduleId) {\n console.error(\"Usage: hackathon schedules get <schedule-id>\")\n process.exit(1)\n }\n\n const schedule = await client.get<Schedule>(`/api/dashboard/schedules/${scheduleId}`)\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: schedule.id },\n { label: \"Name\", value: schedule.name },\n { label: \"Cron\", value: schedule.cron_expression },\n { label: \"Enabled\", value: String(schedule.enabled) },\n { label: \"Last Run\", value: schedule.last_run_at },\n { label: \"Next Run\", value: schedule.next_run_at },\n { label: \"Created\", value: schedule.created_at },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,gBACpB,QACA,YACA,SACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,+CAA+C;AAC7D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,IAAc,4BAA4B,aAAa;AAErF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,SAAS;GAAI;EACnC;GAAE,OAAO;GAAQ,OAAO,SAAS;GAAM;EACvC;GAAE,OAAO;GAAQ,OAAO,SAAS;GAAiB;EAClD;GAAE,OAAO;GAAW,OAAO,OAAO,SAAS,QAAA;GAAU;EACrD;GAAE,OAAO;GAAY,OAAO,SAAS;GAAa;EAClD;GAAE,OAAO;GAAY,OAAO,SAAS;GAAa;EAClD;GAAE,OAAO;GAAW,OAAO,SAAS;;EACrC,CAAC,CACH"}
1
+ {"version":3,"file":"get4.mjs","names":[],"sources":["../../src/commands/schedules/get.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\nexport async function runSchedulesGet(\n client: OatmealClient,\n scheduleId: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!scheduleId) {\n console.error(\"Usage: hackathon schedules get <schedule-id>\")\n process.exit(1)\n }\n\n const schedule = await client.get<Schedule>(`/api/dashboard/schedules/${scheduleId}`)\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"ID\", value: schedule.id },\n { label: \"Name\", value: schedule.name },\n { label: \"Cron\", value: schedule.cronExpression },\n { label: \"Enabled\", value: String(schedule.isActive) },\n { label: \"Last Run\", value: schedule.lastRunAt },\n { label: \"Next Run\", value: schedule.nextRunAt },\n { label: \"Created\", value: schedule.createdAt },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,gBACpB,QACA,YACA,SACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,+CAA+C;AAC7D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,IAAc,4BAA4B,aAAa;AAErF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAM,OAAO,SAAS;GAAI;EACnC;GAAE,OAAO;GAAQ,OAAO,SAAS;GAAM;EACvC;GAAE,OAAO;GAAQ,OAAO,SAAS;GAAgB;EACjD;GAAE,OAAO;GAAW,OAAO,OAAO,SAAS,SAAA;GAAW;EACtD;GAAE,OAAO;GAAY,OAAO,SAAS;GAAW;EAChD;GAAE,OAAO;GAAY,OAAO,SAAS;GAAW;EAChD;GAAE,OAAO;GAAW,OAAO,SAAS;;EACrC,CAAC,CACH"}
@@ -49,11 +49,11 @@ async function runBrowseHackathons(client, args) {
49
49
  label: "Status"
50
50
  },
51
51
  {
52
- key: "starts_at",
52
+ key: "startsAt",
53
53
  label: "Starts"
54
54
  },
55
55
  {
56
- key: "ends_at",
56
+ key: "endsAt",
57
57
  label: "Ends"
58
58
  }
59
59
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"hackathons.mjs","names":[],"sources":["../../src/commands/browse/hackathons.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\ninterface BrowseHackathonsOptions {\n search?: string\n page?: number\n limit?: number\n json?: boolean\n}\n\nexport function parseBrowseHackathonsOptions(args: string[]): BrowseHackathonsOptions {\n const options: BrowseHackathonsOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--search\":\n case \"-s\":\n options.search = args[++i]\n break\n case \"--page\":\n options.page = parseInt(args[++i], 10)\n break\n case \"--limit\":\n options.limit = parseInt(args[++i], 10)\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runBrowseHackathons(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseBrowseHackathonsOptions(args)\n\n const params: Record<string, string | number | undefined> = {\n q: options.search,\n page: options.page,\n limit: options.limit,\n }\n\n const data = await client.get<{ hackathons: Hackathon[] }>(\"/api/public/hackathons\", {\n params,\n })\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.hackathons?.length) {\n console.log(\"No hackathons found.\")\n return\n }\n\n console.log(\n formatTable(data.hackathons, [\n { key: \"name\", label: \"Name\" },\n { key: \"slug\", label: \"Slug\" },\n { key: \"status\", label: \"Status\" },\n { key: \"starts_at\", label: \"Starts\" },\n { key: \"ends_at\", label: \"Ends\" },\n ])\n )\n}\n"],"mappings":";;AAWA,SAAgB,6BAA6B,MAAyC;CACpF,MAAM,UAAmC,EAAE;AAC3C,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;EACL,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,OAAO,SAAS,KAAK,EAAE,IAAI,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,QAAQ,SAAS,KAAK,EAAE,IAAI,GAAG;AACvC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,oBACpB,QACA,MACe;CACf,MAAM,UAAU,6BAA6B,KAAK;CAElD,MAAM,SAAsD;EAC1D,GAAG,QAAQ;EACX,MAAM,QAAQ;EACd,OAAO,QAAQ;EAChB;CAED,MAAM,OAAO,MAAM,OAAO,IAAiC,0BAA0B,EACnF,QACD,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,UAAQ,IAAI,uBAAuB;AACnC;;AAGF,SAAQ,IACN,YAAY,KAAK,YAAY;EAC3B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAa,OAAO;GAAU;EACrC;GAAE,KAAK;GAAW,OAAO;;EAC1B,CAAC,CACH"}
1
+ {"version":3,"file":"hackathons.mjs","names":[],"sources":["../../src/commands/browse/hackathons.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\ninterface BrowseHackathonsOptions {\n search?: string\n page?: number\n limit?: number\n json?: boolean\n}\n\nexport function parseBrowseHackathonsOptions(args: string[]): BrowseHackathonsOptions {\n const options: BrowseHackathonsOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--search\":\n case \"-s\":\n options.search = args[++i]\n break\n case \"--page\":\n options.page = parseInt(args[++i], 10)\n break\n case \"--limit\":\n options.limit = parseInt(args[++i], 10)\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runBrowseHackathons(\n client: OatmealClient,\n args: string[]\n): Promise<void> {\n const options = parseBrowseHackathonsOptions(args)\n\n const params: Record<string, string | number | undefined> = {\n q: options.search,\n page: options.page,\n limit: options.limit,\n }\n\n const data = await client.get<{ hackathons: Hackathon[] }>(\"/api/public/hackathons\", {\n params,\n })\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.hackathons?.length) {\n console.log(\"No hackathons found.\")\n return\n }\n\n console.log(\n formatTable(data.hackathons, [\n { key: \"name\", label: \"Name\" },\n { key: \"slug\", label: \"Slug\" },\n { key: \"status\", label: \"Status\" },\n { key: \"startsAt\", label: \"Starts\" },\n { key: \"endsAt\", label: \"Ends\" },\n ])\n )\n}\n"],"mappings":";;AAWA,SAAgB,6BAA6B,MAAyC;CACpF,MAAM,UAAmC,EAAE;AAC3C,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;EACL,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,OAAO,SAAS,KAAK,EAAE,IAAI,GAAG;AACtC;EACF,KAAK;AACH,WAAQ,QAAQ,SAAS,KAAK,EAAE,IAAI,GAAG;AACvC;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,oBACpB,QACA,MACe;CACf,MAAM,UAAU,6BAA6B,KAAK;CAElD,MAAM,SAAsD;EAC1D,GAAG,QAAQ;EACX,MAAM,QAAQ;EACd,OAAO,QAAQ;EAChB;CAED,MAAM,OAAO,MAAM,OAAO,IAAiC,0BAA0B,EACnF,QACD,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,UAAQ,IAAI,uBAAuB;AACnC;;AAGF,SAAQ,IACN,YAAY,KAAK,YAAY;EAC3B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAY,OAAO;GAAU;EACpC;GAAE,KAAK;GAAU,OAAO;;EACzB,CAAC,CACH"}
@@ -20,7 +20,7 @@ async function runInvitationsList(client, hackathonId, options) {
20
20
  label: "Status"
21
21
  },
22
22
  {
23
- key: "created_at",
23
+ key: "createdAt",
24
24
  label: "Sent"
25
25
  }
26
26
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"invitations-list.mjs","names":[],"sources":["../../src/commands/judging/invitations-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgeInvitation } from \"../../types.js\"\n\nexport async function runInvitationsList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ invitations: JudgeInvitation[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/invitations`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.invitations?.length) {\n console.log(\"No pending invitations.\")\n return\n }\n\n console.log(\n formatTable(data.invitations, [\n { key: \"email\", label: \"Email\" },\n { key: \"status\", label: \"Status\" },\n { key: \"created_at\", label: \"Sent\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,mBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,sBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,0BAA0B;AACtC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAc,OAAO;;EAC7B,CAAC,CACH"}
1
+ {"version":3,"file":"invitations-list.mjs","names":[],"sources":["../../src/commands/judging/invitations-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { JudgeInvitation } from \"../../types.js\"\n\nexport async function runInvitationsList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ invitations: JudgeInvitation[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/invitations`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.invitations?.length) {\n console.log(\"No pending invitations.\")\n return\n }\n\n console.log(\n formatTable(data.invitations, [\n { key: \"email\", label: \"Email\" },\n { key: \"status\", label: \"Status\" },\n { key: \"createdAt\", label: \"Sent\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,mBACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,sBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,0BAA0B;AACtC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAa,OAAO;;EAC5B,CAAC,CACH"}
@@ -23,7 +23,7 @@ async function runJudgesAdd(client, hackathonId, args) {
23
23
  }
24
24
  const body = {};
25
25
  if (options.email) body.email = options.email;
26
- if (options.userId) body.user_id = options.userId;
26
+ if (options.userId) body.clerkUserId = options.userId;
27
27
  const judge = await client.post(`/api/dashboard/hackathons/${hackathonId}/judging/judges`, body);
28
28
  if (options.json) {
29
29
  console.log(formatJson(judge));
@@ -1 +1 @@
1
- {"version":3,"file":"judges-add.mjs","names":[],"sources":["../../src/commands/judging/judges-add.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Judge } from \"../../types.js\"\n\ninterface JudgesAddOptions {\n email?: string\n userId?: string\n json?: boolean\n}\n\nexport function parseJudgesAddOptions(args: string[]): JudgesAddOptions {\n const options: JudgesAddOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--email\":\n options.email = args[++i]\n break\n case \"--user-id\":\n options.userId = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runJudgesAdd(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseJudgesAddOptions(args)\n\n if (!options.email && !options.userId) {\n console.error(\"Error: provide --email or --user-id\")\n process.exit(1)\n }\n\n const body: Record<string, string> = {}\n if (options.email) body.email = options.email\n if (options.userId) body.user_id = options.userId\n\n const judge = await client.post<Judge>(\n `/api/dashboard/hackathons/${hackathonId}/judging/judges`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(judge))\n return\n }\n\n console.log(formatSuccess(`Added judge ${judge.name ?? judge.email ?? judge.id}`))\n}\n"],"mappings":";;AAUA,SAAgB,sBAAsB,MAAkC;CACtE,MAAM,UAA4B,EAAE;AACpC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,QAAQ,KAAK,EAAE;AACvB;EACF,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,aACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,sBAAsB,KAAK;AAE3C,KAAI,CAAC,QAAQ,SAAS,CAAC,QAAQ,QAAQ;AACrC,UAAQ,MAAM,sCAAsC;AACpD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAA+B,EAAE;AACvC,KAAI,QAAQ,MAAO,MAAK,QAAQ,QAAQ;AACxC,KAAI,QAAQ,OAAQ,MAAK,UAAU,QAAQ;CAE3C,MAAM,QAAQ,MAAM,OAAO,KACzB,6BAA6B,YAAY,kBACzC,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,MAAM,CAAC;AAC9B;;AAGF,SAAQ,IAAI,cAAc,eAAe,MAAM,QAAQ,MAAM,SAAS,MAAM,KAAK,CAAC"}
1
+ {"version":3,"file":"judges-add.mjs","names":[],"sources":["../../src/commands/judging/judges-add.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Judge } from \"../../types.js\"\n\ninterface JudgesAddOptions {\n email?: string\n userId?: string\n json?: boolean\n}\n\nexport function parseJudgesAddOptions(args: string[]): JudgesAddOptions {\n const options: JudgesAddOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--email\":\n options.email = args[++i]\n break\n case \"--user-id\":\n options.userId = args[++i]\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runJudgesAdd(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n const options = parseJudgesAddOptions(args)\n\n if (!options.email && !options.userId) {\n console.error(\"Error: provide --email or --user-id\")\n process.exit(1)\n }\n\n const body: Record<string, string> = {}\n if (options.email) body.email = options.email\n if (options.userId) body.clerkUserId = options.userId\n\n const judge = await client.post<Judge>(\n `/api/dashboard/hackathons/${hackathonId}/judging/judges`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(judge))\n return\n }\n\n console.log(formatSuccess(`Added judge ${judge.name ?? judge.email ?? judge.id}`))\n}\n"],"mappings":";;AAUA,SAAgB,sBAAsB,MAAkC;CACtE,MAAM,UAA4B,EAAE;AACpC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,QAAQ,KAAK,EAAE;AACvB;EACF,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,aACpB,QACA,aACA,MACe;CACf,MAAM,UAAU,sBAAsB,KAAK;AAE3C,KAAI,CAAC,QAAQ,SAAS,CAAC,QAAQ,QAAQ;AACrC,UAAQ,MAAM,sCAAsC;AACpD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAA+B,EAAE;AACvC,KAAI,QAAQ,MAAO,MAAK,QAAQ,QAAQ;AACxC,KAAI,QAAQ,OAAQ,MAAK,cAAc,QAAQ;CAE/C,MAAM,QAAQ,MAAM,OAAO,KACzB,6BAA6B,YAAY,kBACzC,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,MAAM,CAAC;AAC9B;;AAGF,SAAQ,IAAI,cAAc,eAAe,MAAM,QAAQ,MAAM,SAAS,MAAM,KAAK,CAAC"}
@@ -12,7 +12,7 @@ async function runJudgesList(client, hackathonId, options) {
12
12
  }
13
13
  const rows = data.judges.map((j) => ({
14
14
  ...j,
15
- progress: `${j.completed_count ?? 0}/${j.total_count ?? 0}`
15
+ progress: `${j.completedCount ?? 0}/${j.totalCount ?? 0}`
16
16
  }));
17
17
  console.log(formatTable(rows, [
18
18
  {
@@ -1 +1 @@
1
- {"version":3,"file":"judges-list.mjs","names":[],"sources":["../../src/commands/judging/judges-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Judge } from \"../../types.js\"\n\nexport async function runJudgesList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ judges: Judge[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/judges`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.judges?.length) {\n console.log(\"No judges found.\")\n return\n }\n\n const rows = data.judges.map((j) => ({\n ...j,\n progress: `${j.completed_count ?? 0}/${j.total_count ?? 0}`,\n }))\n\n console.log(\n formatTable(rows, [\n { key: \"name\", label: \"Name\" },\n { key: \"email\", label: \"Email\" },\n { key: \"progress\", label: \"Progress\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,iBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,QAAQ,QAAQ;AACxB,UAAQ,IAAI,mBAAmB;AAC/B;;CAGF,MAAM,OAAO,KAAK,OAAO,KAAK,OAAO;EACnC,GAAG;EACH,UAAU,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,eAAe;EACzD,EAAE;AAEH,SAAQ,IACN,YAAY,MAAM;EAChB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAAY,OAAO;;EAC3B,CAAC,CACH"}
1
+ {"version":3,"file":"judges-list.mjs","names":[],"sources":["../../src/commands/judging/judges-list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Judge } from \"../../types.js\"\n\nexport async function runJudgesList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ judges: Judge[] }>(\n `/api/dashboard/hackathons/${hackathonId}/judging/judges`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.judges?.length) {\n console.log(\"No judges found.\")\n return\n }\n\n const rows = data.judges.map((j) => ({\n ...j,\n progress: `${j.completedCount ?? 0}/${j.totalCount ?? 0}`,\n }))\n\n console.log(\n formatTable(rows, [\n { key: \"name\", label: \"Name\" },\n { key: \"email\", label: \"Email\" },\n { key: \"progress\", label: \"Progress\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,iBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,QAAQ,QAAQ;AACxB,UAAQ,IAAI,mBAAmB;AAC/B;;CAGF,MAAM,OAAO,KAAK,OAAO,KAAK,OAAO;EACnC,GAAG;EACH,UAAU,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,cAAc;EACvD,EAAE;AAEH,SAAQ,IACN,YAAY,MAAM;EAChB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAAY,OAAO;;EAC3B,CAAC,CACH"}
@@ -24,11 +24,11 @@ async function runHackathonsList(client, options) {
24
24
  label: "Status"
25
25
  },
26
26
  {
27
- key: "starts_at",
27
+ key: "startsAt",
28
28
  label: "Starts"
29
29
  },
30
30
  {
31
- key: "ends_at",
31
+ key: "endsAt",
32
32
  label: "Ends"
33
33
  }
34
34
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"list.mjs","names":[],"sources":["../../src/commands/hackathons/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\nexport async function runHackathonsList(\n client: OatmealClient,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ hackathons: Hackathon[] }>(\"/api/dashboard/hackathons\")\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.hackathons?.length) {\n console.log(\"No hackathons found.\")\n return\n }\n\n console.log(\n formatTable(data.hackathons, [\n { key: \"name\", label: \"Name\" },\n { key: \"slug\", label: \"Slug\" },\n { key: \"status\", label: \"Status\" },\n { key: \"starts_at\", label: \"Starts\" },\n { key: \"ends_at\", label: \"Ends\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,kBACpB,QACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IAAiC,4BAA4B;AAEvF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,UAAQ,IAAI,uBAAuB;AACnC;;AAGF,SAAQ,IACN,YAAY,KAAK,YAAY;EAC3B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAa,OAAO;GAAU;EACrC;GAAE,KAAK;GAAW,OAAO;;EAC1B,CAAC,CACH"}
1
+ {"version":3,"file":"list.mjs","names":[],"sources":["../../src/commands/hackathons/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Hackathon } from \"../../types.js\"\n\nexport async function runHackathonsList(\n client: OatmealClient,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ hackathons: Hackathon[] }>(\"/api/dashboard/hackathons\")\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.hackathons?.length) {\n console.log(\"No hackathons found.\")\n return\n }\n\n console.log(\n formatTable(data.hackathons, [\n { key: \"name\", label: \"Name\" },\n { key: \"slug\", label: \"Slug\" },\n { key: \"status\", label: \"Status\" },\n { key: \"startsAt\", label: \"Starts\" },\n { key: \"endsAt\", label: \"Ends\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,kBACpB,QACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IAAiC,4BAA4B;AAEvF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,UAAQ,IAAI,uBAAuB;AACnC;;AAGF,SAAQ,IACN,YAAY,KAAK,YAAY;EAC3B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAY,OAAO;GAAU;EACpC;GAAE,KAAK;GAAU,OAAO;;EACzB,CAAC,CACH"}
@@ -26,7 +26,7 @@ async function runJobsList(client, args, options) {
26
26
  label: "Status"
27
27
  },
28
28
  {
29
- key: "created_at",
29
+ key: "createdAt",
30
30
  label: "Created"
31
31
  }
32
32
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"list2.mjs","names":[],"sources":["../../src/commands/jobs/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Job } from \"../../types.js\"\n\nexport async function runJobsList(\n client: OatmealClient,\n args: string[],\n options: { json?: boolean }\n): Promise<void> {\n let limit: number | undefined\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--limit\") limit = parseInt(args[++i], 10)\n }\n\n const data = await client.get<{ jobs: Job[] }>(\"/api/dashboard/jobs\", {\n params: { limit },\n })\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.jobs?.length) {\n console.log(\"No jobs found.\")\n return\n }\n\n console.log(\n formatTable(data.jobs, [\n { key: \"id\", label: \"ID\" },\n { key: \"type\", label: \"Type\" },\n { key: \"status\", label: \"Status\" },\n { key: \"created_at\", label: \"Created\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,YACpB,QACA,MACA,SACe;CACf,IAAI;AACJ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,UAAW,SAAQ,SAAS,KAAK,EAAE,IAAI,GAAG;CAG5D,MAAM,OAAO,MAAM,OAAO,IAAqB,uBAAuB,EACpE,QAAQ,EAAE,OAAO,EAClB,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,MAAM,QAAQ;AACtB,UAAQ,IAAI,iBAAiB;AAC7B;;AAGF,SAAQ,IACN,YAAY,KAAK,MAAM;EACrB;GAAE,KAAK;GAAM,OAAO;GAAM;EAC1B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAc,OAAO;;EAC7B,CAAC,CACH"}
1
+ {"version":3,"file":"list2.mjs","names":[],"sources":["../../src/commands/jobs/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Job } from \"../../types.js\"\n\nexport async function runJobsList(\n client: OatmealClient,\n args: string[],\n options: { json?: boolean }\n): Promise<void> {\n let limit: number | undefined\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--limit\") limit = parseInt(args[++i], 10)\n }\n\n const data = await client.get<{ jobs: Job[] }>(\"/api/dashboard/jobs\", {\n params: { limit },\n })\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.jobs?.length) {\n console.log(\"No jobs found.\")\n return\n }\n\n console.log(\n formatTable(data.jobs, [\n { key: \"id\", label: \"ID\" },\n { key: \"type\", label: \"Type\" },\n { key: \"status\", label: \"Status\" },\n { key: \"createdAt\", label: \"Created\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,YACpB,QACA,MACA,SACe;CACf,IAAI;AACJ,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,UAAW,SAAQ,SAAS,KAAK,EAAE,IAAI,GAAG;CAG5D,MAAM,OAAO,MAAM,OAAO,IAAqB,uBAAuB,EACpE,QAAQ,EAAE,OAAO,EAClB,CAAC;AAEF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,MAAM,QAAQ;AACtB,UAAQ,IAAI,iBAAiB;AAC7B;;AAGF,SAAQ,IACN,YAAY,KAAK,MAAM;EACrB;GAAE,KAAK;GAAM,OAAO;GAAM;EAC1B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAU,OAAO;GAAU;EAClC;GAAE,KAAK;GAAa,OAAO;;EAC5B,CAAC,CACH"}
@@ -24,7 +24,7 @@ async function runPrizesList(client, hackathonId, options) {
24
24
  label: "Value"
25
25
  },
26
26
  {
27
- key: "assigned_submission_name",
27
+ key: "assignedSubmissionName",
28
28
  label: "Assigned To"
29
29
  }
30
30
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"list4.mjs","names":[],"sources":["../../src/commands/prizes/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Prize } from \"../../types.js\"\n\nexport async function runPrizesList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ prizes: Prize[] }>(\n `/api/dashboard/hackathons/${hackathonId}/prizes`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.prizes?.length) {\n console.log(\"No prizes found.\")\n return\n }\n\n console.log(\n formatTable(data.prizes, [\n { key: \"name\", label: \"Name\" },\n { key: \"type\", label: \"Type\" },\n { key: \"value\", label: \"Value\" },\n { key: \"assigned_submission_name\", label: \"Assigned To\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,SAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,QAAQ,QAAQ;AACxB,UAAQ,IAAI,mBAAmB;AAC/B;;AAGF,SAAQ,IACN,YAAY,KAAK,QAAQ;EACvB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAA4B,OAAO;;EAC3C,CAAC,CACH"}
1
+ {"version":3,"file":"list4.mjs","names":[],"sources":["../../src/commands/prizes/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Prize } from \"../../types.js\"\n\nexport async function runPrizesList(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ prizes: Prize[] }>(\n `/api/dashboard/hackathons/${hackathonId}/prizes`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.prizes?.length) {\n console.log(\"No prizes found.\")\n return\n }\n\n console.log(\n formatTable(data.prizes, [\n { key: \"name\", label: \"Name\" },\n { key: \"type\", label: \"Type\" },\n { key: \"value\", label: \"Value\" },\n { key: \"assignedSubmissionName\", label: \"Assigned To\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,cACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,SAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,QAAQ,QAAQ;AACxB,UAAQ,IAAI,mBAAmB;AAC/B;;AAGF,SAAQ,IACN,YAAY,KAAK,QAAQ;EACvB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAS,OAAO;GAAS;EAChC;GAAE,KAAK;GAA0B,OAAO;;EACzC,CAAC,CACH"}
@@ -12,7 +12,7 @@ async function runSchedulesList(client, options) {
12
12
  }
13
13
  const rows = data.schedules.map((s) => ({
14
14
  ...s,
15
- enabled_str: s.enabled ? "Enabled" : "Disabled"
15
+ activeStr: s.isActive ? "Enabled" : "Disabled"
16
16
  }));
17
17
  console.log(formatTable(rows, [
18
18
  {
@@ -20,15 +20,15 @@ async function runSchedulesList(client, options) {
20
20
  label: "Name"
21
21
  },
22
22
  {
23
- key: "cron_expression",
23
+ key: "cronExpression",
24
24
  label: "Cron"
25
25
  },
26
26
  {
27
- key: "enabled_str",
27
+ key: "activeStr",
28
28
  label: "Status"
29
29
  },
30
30
  {
31
- key: "next_run_at",
31
+ key: "nextRunAt",
32
32
  label: "Next Run"
33
33
  }
34
34
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"list5.mjs","names":[],"sources":["../../src/commands/schedules/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\nexport async function runSchedulesList(\n client: OatmealClient,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ schedules: Schedule[] }>(\"/api/dashboard/schedules\")\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.schedules?.length) {\n console.log(\"No schedules found.\")\n return\n }\n\n const rows = data.schedules.map((s) => ({\n ...s,\n enabled_str: s.enabled ? \"Enabled\" : \"Disabled\",\n }))\n\n console.log(\n formatTable(rows, [\n { key: \"name\", label: \"Name\" },\n { key: \"cron_expression\", label: \"Cron\" },\n { key: \"enabled_str\", label: \"Status\" },\n { key: \"next_run_at\", label: \"Next Run\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,iBACpB,QACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IAA+B,2BAA2B;AAEpF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,WAAW,QAAQ;AAC3B,UAAQ,IAAI,sBAAsB;AAClC;;CAGF,MAAM,OAAO,KAAK,UAAU,KAAK,OAAO;EACtC,GAAG;EACH,aAAa,EAAE,UAAU,YAAY;EACtC,EAAE;AAEH,SAAQ,IACN,YAAY,MAAM;EAChB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAmB,OAAO;GAAQ;EACzC;GAAE,KAAK;GAAe,OAAO;GAAU;EACvC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"list5.mjs","names":[],"sources":["../../src/commands/schedules/list.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\nexport async function runSchedulesList(\n client: OatmealClient,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<{ schedules: Schedule[] }>(\"/api/dashboard/schedules\")\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.schedules?.length) {\n console.log(\"No schedules found.\")\n return\n }\n\n const rows = data.schedules.map((s) => ({\n ...s,\n activeStr: s.isActive ? \"Enabled\" : \"Disabled\",\n }))\n\n console.log(\n formatTable(rows, [\n { key: \"name\", label: \"Name\" },\n { key: \"cronExpression\", label: \"Cron\" },\n { key: \"activeStr\", label: \"Status\" },\n { key: \"nextRunAt\", label: \"Next Run\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,iBACpB,QACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IAA+B,2BAA2B;AAEpF,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,WAAW,QAAQ;AAC3B,UAAQ,IAAI,sBAAsB;AAClC;;CAGF,MAAM,OAAO,KAAK,UAAU,KAAK,OAAO;EACtC,GAAG;EACH,WAAW,EAAE,WAAW,YAAY;EACrC,EAAE;AAEH,SAAQ,IACN,YAAY,MAAM;EAChB;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAkB,OAAO;GAAQ;EACxC;GAAE,KAAK;GAAa,OAAO;GAAU;EACrC;GAAE,KAAK;GAAa,OAAO;;EAC5B,CAAC,CACH"}
@@ -50,6 +50,10 @@ async function runLogin(args) {
50
50
  }
51
51
  const deviceToken = randomBytes(32).toString("hex");
52
52
  const authUrl = `${baseUrl}/cli-auth?token=${deviceToken}`;
53
+ const initClient = new OatmealClient({ baseUrl });
54
+ try {
55
+ await initClient.get("/api/public/cli-auth/poll", { params: { token: deviceToken } });
56
+ } catch {}
53
57
  p.log.info(`Opening browser to sign in...`);
54
58
  p.log.info(authUrl);
55
59
  try {
@@ -81,7 +85,7 @@ async function pollForKey(baseUrl, deviceToken) {
81
85
  if (result.status === "expired") throw new Error("Authentication session expired. Please try again.");
82
86
  await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
83
87
  }
84
- throw new Error("Authentication timed out after 5 minutes. Please try again.");
88
+ throw new Error("Authentication timed out after 10 minutes. Please try again.");
85
89
  }
86
90
  async function validateAndSaveKey(apiKey, baseUrl) {
87
91
  const client = new OatmealClient({
@@ -1 +1 @@
1
- {"version":3,"file":"login.mjs","names":[],"sources":["../../src/commands/login.ts"],"sourcesContent":["import { randomBytes } from \"node:crypto\"\nimport { execSync } from \"node:child_process\"\nimport * as p from \"@clack/prompts\"\nimport { OatmealClient } from \"../client.js\"\nimport { loadConfig, saveConfig } from \"../config.js\"\nimport { AUTH_TIMEOUT_MS, DEFAULT_BASE_URL, POLL_INTERVAL_MS } from \"../constants.js\"\nimport type { CliConfig, WhoAmIResponse } from \"../types.js\"\n\ninterface LoginOptions {\n apiKey?: string\n noBrowser?: boolean\n baseUrl?: string\n yes?: boolean\n}\n\nexport function parseLoginOptions(args: string[]): LoginOptions {\n const options: LoginOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--api-key\":\n options.apiKey = args[++i]\n break\n case \"--no-browser\":\n options.noBrowser = true\n break\n case \"--base-url\":\n options.baseUrl = args[++i]\n break\n case \"--yes\":\n case \"-y\":\n options.yes = true\n break\n }\n }\n return options\n}\n\nexport async function runLogin(args: string[]): Promise<void> {\n const options = parseLoginOptions(args)\n const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL\n\n const existingConfig = loadConfig()\n if (existingConfig && !options.yes && !options.apiKey && !process.env.HACKATHON_API_KEY) {\n const overwrite = await p.confirm({\n message: \"You are already logged in. Overwrite existing config?\",\n })\n if (p.isCancel(overwrite) || !overwrite) {\n p.log.info(\"Login cancelled.\")\n return\n }\n }\n\n const key = options.apiKey ?? process.env.HACKATHON_API_KEY\n if (key) {\n await validateAndSaveKey(key, baseUrl)\n return\n }\n\n if (options.noBrowser || !process.stdout.isTTY) {\n const pastedKey = await p.password({ message: \"Paste your API key:\" })\n if (p.isCancel(pastedKey)) {\n p.log.info(\"Login cancelled.\")\n return\n }\n await validateAndSaveKey(pastedKey, baseUrl)\n return\n }\n\n const deviceToken = randomBytes(32).toString(\"hex\")\n const authUrl = `${baseUrl}/cli-auth?token=${deviceToken}`\n\n p.log.info(`Opening browser to sign in...`)\n p.log.info(authUrl)\n\n try {\n openBrowser(authUrl)\n } catch {\n p.log.warn(\"Could not open browser. Visit the URL above manually.\")\n }\n\n const spinner = p.spinner()\n spinner.start(\"Waiting for authentication...\")\n\n try {\n const apiKey = await pollForKey(baseUrl, deviceToken)\n spinner.stop(\"Authenticated!\")\n await validateAndSaveKey(apiKey, baseUrl)\n } catch (error) {\n spinner.stop(\"Authentication failed.\")\n throw error\n }\n}\n\nfunction openBrowser(url: string): void {\n const platform = process.platform\n const cmd =\n platform === \"darwin\"\n ? \"open\"\n : platform === \"win32\"\n ? \"start\"\n : \"xdg-open\"\n execSync(`${cmd} \"${url}\"`, { stdio: \"ignore\" })\n}\n\nasync function pollForKey(baseUrl: string, deviceToken: string): Promise<string> {\n const client = new OatmealClient({ baseUrl })\n const start = Date.now()\n\n while (Date.now() - start < AUTH_TIMEOUT_MS) {\n const result = await client.get<{ status: string; apiKey?: string }>(\n \"/api/public/cli-auth/poll\",\n { params: { token: deviceToken } }\n )\n\n if (result.status === \"complete\" && result.apiKey) {\n return result.apiKey\n }\n\n if (result.status === \"expired\") {\n throw new Error(\"Authentication session expired. Please try again.\")\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS))\n }\n\n throw new Error(\"Authentication timed out after 5 minutes. Please try again.\")\n}\n\nasync function validateAndSaveKey(apiKey: string, baseUrl: string): Promise<void> {\n const client = new OatmealClient({ baseUrl, apiKey })\n\n const spinner = p.spinner()\n spinner.start(\"Validating API key...\")\n\n try {\n const whoami = await client.get<WhoAmIResponse>(\"/api/v1/whoami\")\n spinner.stop(\"Key validated!\")\n\n const config: CliConfig = {\n apiKey,\n baseUrl,\n tenantId: whoami.tenantId,\n keyId: whoami.keyId,\n scopes: whoami.scopes,\n }\n\n saveConfig(config)\n\n p.log.success(`Logged in! Key saved to ~/.hackathon/config.json`)\n p.log.info(`Tenant: ${whoami.tenantId}`)\n p.log.info(`Scopes: ${whoami.scopes.join(\", \")}`)\n } catch (error) {\n spinner.stop(\"Validation failed.\")\n throw error\n }\n}\n"],"mappings":";;;;;;;AAeA,SAAgB,kBAAkB,MAA8B;CAC9D,MAAM,UAAwB,EAAE;AAChC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,YAAY;AACpB;EACF,KAAK;AACH,WAAQ,UAAU,KAAK,EAAE;AACzB;EACF,KAAK;EACL,KAAK;AACH,WAAQ,MAAM;AACd;;AAGN,QAAO;;AAGT,eAAsB,SAAS,MAA+B;CAC5D,MAAM,UAAU,kBAAkB,KAAK;CACvC,MAAM,UAAU,QAAQ,WAAA;AAGxB,KADuB,YAAY,IACb,CAAC,QAAQ,OAAO,CAAC,QAAQ,UAAU,CAAC,QAAQ,IAAI,mBAAmB;EACvF,MAAM,YAAY,MAAM,EAAE,QAAQ,EAChC,SAAS,yDACV,CAAC;AACF,MAAI,EAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,KAAE,IAAI,KAAK,mBAAmB;AAC9B;;;CAIJ,MAAM,MAAM,QAAQ,UAAU,QAAQ,IAAI;AAC1C,KAAI,KAAK;AACP,QAAM,mBAAmB,KAAK,QAAQ;AACtC;;AAGF,KAAI,QAAQ,aAAa,CAAC,QAAQ,OAAO,OAAO;EAC9C,MAAM,YAAY,MAAM,EAAE,SAAS,EAAE,SAAS,uBAAuB,CAAC;AACtE,MAAI,EAAE,SAAS,UAAU,EAAE;AACzB,KAAE,IAAI,KAAK,mBAAmB;AAC9B;;AAEF,QAAM,mBAAmB,WAAW,QAAQ;AAC5C;;CAGF,MAAM,cAAc,YAAY,GAAG,CAAC,SAAS,MAAM;CACnD,MAAM,UAAU,GAAG,QAAQ,kBAAkB;AAE7C,GAAE,IAAI,KAAK,gCAAgC;AAC3C,GAAE,IAAI,KAAK,QAAQ;AAEnB,KAAI;AACF,cAAY,QAAQ;SACd;AACN,IAAE,IAAI,KAAK,wDAAwD;;CAGrE,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,gCAAgC;AAE9C,KAAI;EACF,MAAM,SAAS,MAAM,WAAW,SAAS,YAAY;AACrD,UAAQ,KAAK,iBAAiB;AAC9B,QAAM,mBAAmB,QAAQ,QAAQ;UAClC,OAAO;AACd,UAAQ,KAAK,yBAAyB;AACtC,QAAM;;;AAIV,SAAS,YAAY,KAAmB;CACtC,MAAM,WAAW,QAAQ;AAOzB,UAAS,GALP,aAAa,WACT,SACA,aAAa,UACX,UACA,WACQ,IAAI,IAAI,IAAI,EAAE,OAAO,UAAU,CAAC;;AAGlD,eAAe,WAAW,SAAiB,aAAsC;CAC/E,MAAM,SAAS,IAAI,cAAc,EAAE,SAAS,CAAC;CAC7C,MAAM,QAAQ,KAAK,KAAK;AAExB,QAAO,KAAK,KAAK,GAAG,QAAQ,iBAAiB;EAC3C,MAAM,SAAS,MAAM,OAAO,IAC1B,6BACA,EAAE,QAAQ,EAAE,OAAO,aAAa,EAAE,CACnC;AAED,MAAI,OAAO,WAAW,cAAc,OAAO,OACzC,QAAO,OAAO;AAGhB,MAAI,OAAO,WAAW,UACpB,OAAM,IAAI,MAAM,oDAAoD;AAGtE,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,iBAAiB,CAAC;;AAGvE,OAAM,IAAI,MAAM,8DAA8D;;AAGhF,eAAe,mBAAmB,QAAgB,SAAgC;CAChF,MAAM,SAAS,IAAI,cAAc;EAAE;EAAS;EAAQ,CAAC;CAErD,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,wBAAwB;AAEtC,KAAI;EACF,MAAM,SAAS,MAAM,OAAO,IAAoB,iBAAiB;AACjE,UAAQ,KAAK,iBAAiB;AAU9B,aAR0B;GACxB;GACA;GACA,UAAU,OAAO;GACjB,OAAO,OAAO;GACd,QAAQ,OAAO;GAChB,CAEiB;AAElB,IAAE,IAAI,QAAQ,mDAAmD;AACjE,IAAE,IAAI,KAAK,WAAW,OAAO,WAAW;AACxC,IAAE,IAAI,KAAK,WAAW,OAAO,OAAO,KAAK,KAAK,GAAG;UAC1C,OAAO;AACd,UAAQ,KAAK,qBAAqB;AAClC,QAAM"}
1
+ {"version":3,"file":"login.mjs","names":[],"sources":["../../src/commands/login.ts"],"sourcesContent":["import { randomBytes } from \"node:crypto\"\nimport { execSync } from \"node:child_process\"\nimport * as p from \"@clack/prompts\"\nimport { OatmealClient } from \"../client.js\"\nimport { loadConfig, saveConfig } from \"../config.js\"\nimport { AUTH_TIMEOUT_MS, DEFAULT_BASE_URL, POLL_INTERVAL_MS } from \"../constants.js\"\nimport type { CliConfig, WhoAmIResponse } from \"../types.js\"\n\ninterface LoginOptions {\n apiKey?: string\n noBrowser?: boolean\n baseUrl?: string\n yes?: boolean\n}\n\nexport function parseLoginOptions(args: string[]): LoginOptions {\n const options: LoginOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--api-key\":\n options.apiKey = args[++i]\n break\n case \"--no-browser\":\n options.noBrowser = true\n break\n case \"--base-url\":\n options.baseUrl = args[++i]\n break\n case \"--yes\":\n case \"-y\":\n options.yes = true\n break\n }\n }\n return options\n}\n\nexport async function runLogin(args: string[]): Promise<void> {\n const options = parseLoginOptions(args)\n const baseUrl = options.baseUrl ?? DEFAULT_BASE_URL\n\n const existingConfig = loadConfig()\n if (existingConfig && !options.yes && !options.apiKey && !process.env.HACKATHON_API_KEY) {\n const overwrite = await p.confirm({\n message: \"You are already logged in. Overwrite existing config?\",\n })\n if (p.isCancel(overwrite) || !overwrite) {\n p.log.info(\"Login cancelled.\")\n return\n }\n }\n\n const key = options.apiKey ?? process.env.HACKATHON_API_KEY\n if (key) {\n await validateAndSaveKey(key, baseUrl)\n return\n }\n\n if (options.noBrowser || !process.stdout.isTTY) {\n const pastedKey = await p.password({ message: \"Paste your API key:\" })\n if (p.isCancel(pastedKey)) {\n p.log.info(\"Login cancelled.\")\n return\n }\n await validateAndSaveKey(pastedKey, baseUrl)\n return\n }\n\n const deviceToken = randomBytes(32).toString(\"hex\")\n const authUrl = `${baseUrl}/cli-auth?token=${deviceToken}`\n\n const initClient = new OatmealClient({ baseUrl })\n try {\n await initClient.get(\"/api/public/cli-auth/poll\", { params: { token: deviceToken } })\n } catch {\n // Session creation failed — continue anyway, poll loop will retry\n }\n\n p.log.info(`Opening browser to sign in...`)\n p.log.info(authUrl)\n\n try {\n openBrowser(authUrl)\n } catch {\n p.log.warn(\"Could not open browser. Visit the URL above manually.\")\n }\n\n const spinner = p.spinner()\n spinner.start(\"Waiting for authentication...\")\n\n try {\n const apiKey = await pollForKey(baseUrl, deviceToken)\n spinner.stop(\"Authenticated!\")\n await validateAndSaveKey(apiKey, baseUrl)\n } catch (error) {\n spinner.stop(\"Authentication failed.\")\n throw error\n }\n}\n\nfunction openBrowser(url: string): void {\n const platform = process.platform\n const cmd =\n platform === \"darwin\"\n ? \"open\"\n : platform === \"win32\"\n ? \"start\"\n : \"xdg-open\"\n execSync(`${cmd} \"${url}\"`, { stdio: \"ignore\" })\n}\n\nasync function pollForKey(baseUrl: string, deviceToken: string): Promise<string> {\n const client = new OatmealClient({ baseUrl })\n const start = Date.now()\n\n while (Date.now() - start < AUTH_TIMEOUT_MS) {\n const result = await client.get<{ status: string; apiKey?: string }>(\n \"/api/public/cli-auth/poll\",\n { params: { token: deviceToken } }\n )\n\n if (result.status === \"complete\" && result.apiKey) {\n return result.apiKey\n }\n\n if (result.status === \"expired\") {\n throw new Error(\"Authentication session expired. Please try again.\")\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS))\n }\n\n throw new Error(\"Authentication timed out after 10 minutes. Please try again.\")\n}\n\nasync function validateAndSaveKey(apiKey: string, baseUrl: string): Promise<void> {\n const client = new OatmealClient({ baseUrl, apiKey })\n\n const spinner = p.spinner()\n spinner.start(\"Validating API key...\")\n\n try {\n const whoami = await client.get<WhoAmIResponse>(\"/api/v1/whoami\")\n spinner.stop(\"Key validated!\")\n\n const config: CliConfig = {\n apiKey,\n baseUrl,\n tenantId: whoami.tenantId,\n keyId: whoami.keyId,\n scopes: whoami.scopes,\n }\n\n saveConfig(config)\n\n p.log.success(`Logged in! Key saved to ~/.hackathon/config.json`)\n p.log.info(`Tenant: ${whoami.tenantId}`)\n p.log.info(`Scopes: ${whoami.scopes.join(\", \")}`)\n } catch (error) {\n spinner.stop(\"Validation failed.\")\n throw error\n }\n}\n"],"mappings":";;;;;;;AAeA,SAAgB,kBAAkB,MAA8B;CAC9D,MAAM,UAAwB,EAAE;AAChC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,SAAS,KAAK,EAAE;AACxB;EACF,KAAK;AACH,WAAQ,YAAY;AACpB;EACF,KAAK;AACH,WAAQ,UAAU,KAAK,EAAE;AACzB;EACF,KAAK;EACL,KAAK;AACH,WAAQ,MAAM;AACd;;AAGN,QAAO;;AAGT,eAAsB,SAAS,MAA+B;CAC5D,MAAM,UAAU,kBAAkB,KAAK;CACvC,MAAM,UAAU,QAAQ,WAAA;AAGxB,KADuB,YAAY,IACb,CAAC,QAAQ,OAAO,CAAC,QAAQ,UAAU,CAAC,QAAQ,IAAI,mBAAmB;EACvF,MAAM,YAAY,MAAM,EAAE,QAAQ,EAChC,SAAS,yDACV,CAAC;AACF,MAAI,EAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,KAAE,IAAI,KAAK,mBAAmB;AAC9B;;;CAIJ,MAAM,MAAM,QAAQ,UAAU,QAAQ,IAAI;AAC1C,KAAI,KAAK;AACP,QAAM,mBAAmB,KAAK,QAAQ;AACtC;;AAGF,KAAI,QAAQ,aAAa,CAAC,QAAQ,OAAO,OAAO;EAC9C,MAAM,YAAY,MAAM,EAAE,SAAS,EAAE,SAAS,uBAAuB,CAAC;AACtE,MAAI,EAAE,SAAS,UAAU,EAAE;AACzB,KAAE,IAAI,KAAK,mBAAmB;AAC9B;;AAEF,QAAM,mBAAmB,WAAW,QAAQ;AAC5C;;CAGF,MAAM,cAAc,YAAY,GAAG,CAAC,SAAS,MAAM;CACnD,MAAM,UAAU,GAAG,QAAQ,kBAAkB;CAE7C,MAAM,aAAa,IAAI,cAAc,EAAE,SAAS,CAAC;AACjD,KAAI;AACF,QAAM,WAAW,IAAI,6BAA6B,EAAE,QAAQ,EAAE,OAAO,aAAa,EAAE,CAAC;SAC/E;AAIR,GAAE,IAAI,KAAK,gCAAgC;AAC3C,GAAE,IAAI,KAAK,QAAQ;AAEnB,KAAI;AACF,cAAY,QAAQ;SACd;AACN,IAAE,IAAI,KAAK,wDAAwD;;CAGrE,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,gCAAgC;AAE9C,KAAI;EACF,MAAM,SAAS,MAAM,WAAW,SAAS,YAAY;AACrD,UAAQ,KAAK,iBAAiB;AAC9B,QAAM,mBAAmB,QAAQ,QAAQ;UAClC,OAAO;AACd,UAAQ,KAAK,yBAAyB;AACtC,QAAM;;;AAIV,SAAS,YAAY,KAAmB;CACtC,MAAM,WAAW,QAAQ;AAOzB,UAAS,GALP,aAAa,WACT,SACA,aAAa,UACX,UACA,WACQ,IAAI,IAAI,IAAI,EAAE,OAAO,UAAU,CAAC;;AAGlD,eAAe,WAAW,SAAiB,aAAsC;CAC/E,MAAM,SAAS,IAAI,cAAc,EAAE,SAAS,CAAC;CAC7C,MAAM,QAAQ,KAAK,KAAK;AAExB,QAAO,KAAK,KAAK,GAAG,QAAQ,iBAAiB;EAC3C,MAAM,SAAS,MAAM,OAAO,IAC1B,6BACA,EAAE,QAAQ,EAAE,OAAO,aAAa,EAAE,CACnC;AAED,MAAI,OAAO,WAAW,cAAc,OAAO,OACzC,QAAO,OAAO;AAGhB,MAAI,OAAO,WAAW,UACpB,OAAM,IAAI,MAAM,oDAAoD;AAGtE,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,iBAAiB,CAAC;;AAGvE,OAAM,IAAI,MAAM,+DAA+D;;AAGjF,eAAe,mBAAmB,QAAgB,SAAgC;CAChF,MAAM,SAAS,IAAI,cAAc;EAAE;EAAS;EAAQ,CAAC;CAErD,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,wBAAwB;AAEtC,KAAI;EACF,MAAM,SAAS,MAAM,OAAO,IAAoB,iBAAiB;AACjE,UAAQ,KAAK,iBAAiB;AAU9B,aAR0B;GACxB;GACA;GACA,UAAU,OAAO;GACjB,OAAO,OAAO;GACd,QAAQ,OAAO;GAChB,CAEiB;AAElB,IAAE,IAAI,QAAQ,mDAAmD;AACjE,IAAE,IAAI,KAAK,WAAW,OAAO,WAAW;AACxC,IAAE,IAAI,KAAK,WAAW,OAAO,OAAO,KAAK,KAAK,GAAG;UAC1C,OAAO;AACd,UAAQ,KAAK,qBAAqB;AAClC,QAAM"}
@@ -25,7 +25,7 @@ async function runBrowseOrg(client, slug, options) {
25
25
  },
26
26
  {
27
27
  label: "Hackathons",
28
- value: String(data.hackathon_count ?? 0)
28
+ value: String(data.organizedHackathons?.length ?? 0)
29
29
  }
30
30
  ]));
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"org.mjs","names":[],"sources":["../../src/commands/browse/org.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { OrgProfile } from \"../../types.js\"\n\nexport async function runBrowseOrg(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse org <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<OrgProfile>(\n `/api/public/orgs/${encodeURIComponent(slug)}`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"Name\", value: data.name },\n { label: \"Slug\", value: data.slug },\n { label: \"Description\", value: data.description },\n { label: \"Hackathons\", value: String(data.hackathon_count ?? 0) },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,aACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,qCAAqC;AACnD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,oBAAoB,mBAAmB,KAAK,GAC7C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAQ,OAAO,KAAK;GAAM;EACnC;GAAE,OAAO;GAAQ,OAAO,KAAK;GAAM;EACnC;GAAE,OAAO;GAAe,OAAO,KAAK;GAAa;EACjD;GAAE,OAAO;GAAc,OAAO,OAAO,KAAK,mBAAmB,EAAA;;EAC9D,CAAC,CACH"}
1
+ {"version":3,"file":"org.mjs","names":[],"sources":["../../src/commands/browse/org.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatDetail, formatJson } from \"../../output.js\"\nimport type { OrgProfile } from \"../../types.js\"\n\nexport async function runBrowseOrg(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse org <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<OrgProfile>(\n `/api/public/orgs/${encodeURIComponent(slug)}`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n console.log(\n formatDetail([\n { label: \"Name\", value: data.name },\n { label: \"Slug\", value: data.slug },\n { label: \"Description\", value: data.description },\n { label: \"Hackathons\", value: String(data.organizedHackathons?.length ?? 0) },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,aACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,qCAAqC;AACnD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,oBAAoB,mBAAmB,KAAK,GAC7C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,SAAQ,IACN,aAAa;EACX;GAAE,OAAO;GAAQ,OAAO,KAAK;GAAM;EACnC;GAAE,OAAO;GAAQ,OAAO,KAAK;GAAM;EACnC;GAAE,OAAO;GAAe,OAAO,KAAK;GAAa;EACjD;GAAE,OAAO;GAAc,OAAO,OAAO,KAAK,qBAAqB,UAAU,EAAA;;EAC1E,CAAC,CACH"}
@@ -6,28 +6,32 @@ async function runPickResults(client, hackathonId, options) {
6
6
  console.log(formatJson(data));
7
7
  return;
8
8
  }
9
- if (!data.picks?.length) {
9
+ const entries = Object.entries(data.results);
10
+ if (!entries.length) {
10
11
  console.log("No pick results available.");
11
12
  return;
12
13
  }
13
- const rows = data.picks.map((pick) => ({
14
- ...pick,
15
- judges_list: pick.judges.join(", ")
16
- }));
17
- console.log(formatTable(rows, [
18
- {
19
- key: "submission_name",
20
- label: "Submission"
21
- },
22
- {
23
- key: "pick_count",
24
- label: "Picks"
25
- },
26
- {
27
- key: "judges_list",
28
- label: "Judges"
29
- }
30
- ]));
14
+ for (const [prizeId, picks] of entries) {
15
+ console.log(`\nPrize: ${prizeId}`);
16
+ console.log(formatTable(picks, [
17
+ {
18
+ key: "submissionId",
19
+ label: "Submission"
20
+ },
21
+ {
22
+ key: "firstPicks",
23
+ label: "1st Picks"
24
+ },
25
+ {
26
+ key: "averageRank",
27
+ label: "Avg Rank"
28
+ },
29
+ {
30
+ key: "totalPicks",
31
+ label: "Total Picks"
32
+ }
33
+ ]));
34
+ }
31
35
  }
32
36
  //#endregion
33
37
  export { runPickResults };
@@ -1 +1 @@
1
- {"version":3,"file":"pick-results.mjs","names":[],"sources":["../../src/commands/judging/pick-results.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { PickResults } from \"../../types.js\"\n\nexport async function runPickResults(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<PickResults>(\n `/api/dashboard/hackathons/${hackathonId}/judging/pick-results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.picks?.length) {\n console.log(\"No pick results available.\")\n return\n }\n\n const rows = data.picks.map((pick) => ({\n ...pick,\n judges_list: pick.judges.join(\", \"),\n }))\n\n console.log(\n formatTable(rows, [\n { key: \"submission_name\", label: \"Submission\" },\n { key: \"pick_count\", label: \"Picks\" },\n { key: \"judges_list\", label: \"Judges\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,eACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,uBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,OAAO,QAAQ;AACvB,UAAQ,IAAI,6BAA6B;AACzC;;CAGF,MAAM,OAAO,KAAK,MAAM,KAAK,UAAU;EACrC,GAAG;EACH,aAAa,KAAK,OAAO,KAAK,KAAA;EAC/B,EAAE;AAEH,SAAQ,IACN,YAAY,MAAM;EAChB;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAc,OAAO;GAAS;EACrC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"pick-results.mjs","names":[],"sources":["../../src/commands/judging/pick-results.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\n\ninterface PickResultEntry {\n submissionId: string\n firstPicks: number\n averageRank: number\n totalPicks: number\n}\n\ntype PickResultsResponse = {\n results: Record<string, PickResultEntry[]>\n}\n\nexport async function runPickResults(\n client: OatmealClient,\n hackathonId: string,\n options: { json?: boolean }\n): Promise<void> {\n const data = await client.get<PickResultsResponse>(\n `/api/dashboard/hackathons/${hackathonId}/judging/pick-results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n const entries = Object.entries(data.results)\n if (!entries.length) {\n console.log(\"No pick results available.\")\n return\n }\n\n for (const [prizeId, picks] of entries) {\n console.log(`\\nPrize: ${prizeId}`)\n console.log(\n formatTable(picks, [\n { key: \"submissionId\", label: \"Submission\" },\n { key: \"firstPicks\", label: \"1st Picks\" },\n { key: \"averageRank\", label: \"Avg Rank\" },\n { key: \"totalPicks\", label: \"Total Picks\" },\n ])\n )\n }\n}\n"],"mappings":";;AAcA,eAAsB,eACpB,QACA,aACA,SACe;CACf,MAAM,OAAO,MAAM,OAAO,IACxB,6BAA6B,YAAY,uBAC1C;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;CAGF,MAAM,UAAU,OAAO,QAAQ,KAAK,QAAQ;AAC5C,KAAI,CAAC,QAAQ,QAAQ;AACnB,UAAQ,IAAI,6BAA6B;AACzC;;AAGF,MAAK,MAAM,CAAC,SAAS,UAAU,SAAS;AACtC,UAAQ,IAAI,YAAY,UAAU;AAClC,UAAQ,IACN,YAAY,OAAO;GACjB;IAAE,KAAK;IAAgB,OAAO;IAAc;GAC5C;IAAE,KAAK;IAAc,OAAO;IAAa;GACzC;IAAE,KAAK;IAAe,OAAO;IAAY;GACzC;IAAE,KAAK;IAAc,OAAO;;GAC7B,CAAC,CACH"}
@@ -7,7 +7,7 @@ async function runJudgeDisplayReorder(client, hackathonId, args) {
7
7
  console.error("Error: --ids is required (comma-separated profile IDs in desired order)");
8
8
  process.exit(1);
9
9
  }
10
- await client.post(`/api/dashboard/hackathons/${hackathonId}/judges/display/reorder`, { profile_ids: ids });
10
+ await client.post(`/api/dashboard/hackathons/${hackathonId}/judges/display/reorder`, { orderedIds: ids });
11
11
  console.log(formatSuccess(`Reordered ${ids.length} judge display profiles`));
12
12
  }
13
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"reorder.mjs","names":[],"sources":["../../src/commands/judge-display/reorder.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatSuccess } from \"../../output.js\"\n\nexport async function runJudgeDisplayReorder(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n let ids: string[] = []\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--ids\") {\n ids = args[++i]?.split(\",\").map((s) => s.trim()) ?? []\n }\n }\n\n if (!ids.length) {\n console.error(\"Error: --ids is required (comma-separated profile IDs in desired order)\")\n process.exit(1)\n }\n\n await client.post(\n `/api/dashboard/hackathons/${hackathonId}/judges/display/reorder`,\n { profile_ids: ids }\n )\n console.log(formatSuccess(`Reordered ${ids.length} judge display profiles`))\n}\n"],"mappings":";;AAGA,eAAsB,uBACpB,QACA,aACA,MACe;CACf,IAAI,MAAgB,EAAE;AACtB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,QACd,OAAM,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;AAI1D,KAAI,CAAC,IAAI,QAAQ;AACf,UAAQ,MAAM,0EAA0E;AACxF,UAAQ,KAAK,EAAE;;AAGjB,OAAM,OAAO,KACX,6BAA6B,YAAY,0BACzC,EAAE,aAAa,KAAK,CACrB;AACD,SAAQ,IAAI,cAAc,aAAa,IAAI,OAAO,yBAAyB,CAAC"}
1
+ {"version":3,"file":"reorder.mjs","names":[],"sources":["../../src/commands/judge-display/reorder.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatSuccess } from \"../../output.js\"\n\nexport async function runJudgeDisplayReorder(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n let ids: string[] = []\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--ids\") {\n ids = args[++i]?.split(\",\").map((s) => s.trim()) ?? []\n }\n }\n\n if (!ids.length) {\n console.error(\"Error: --ids is required (comma-separated profile IDs in desired order)\")\n process.exit(1)\n }\n\n await client.post(\n `/api/dashboard/hackathons/${hackathonId}/judges/display/reorder`,\n { orderedIds: ids }\n )\n console.log(formatSuccess(`Reordered ${ids.length} judge display profiles`))\n}\n"],"mappings":";;AAGA,eAAsB,uBACpB,QACA,aACA,MACe;CACf,IAAI,MAAgB,EAAE;AACtB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,QACd,OAAM,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;AAI1D,KAAI,CAAC,IAAI,QAAQ;AACf,UAAQ,MAAM,0EAA0E;AACxF,UAAQ,KAAK,EAAE;;AAGjB,OAAM,OAAO,KACX,6BAA6B,YAAY,0BACzC,EAAE,YAAY,KAAK,CACpB;AACD,SAAQ,IAAI,cAAc,aAAa,IAAI,OAAO,yBAAyB,CAAC"}
@@ -7,7 +7,7 @@ async function runPrizesReorder(client, hackathonId, args) {
7
7
  console.error("Error: --ids is required (comma-separated prize IDs in desired order)");
8
8
  process.exit(1);
9
9
  }
10
- await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/reorder`, { prize_ids: ids });
10
+ await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/reorder`, { orderedIds: ids });
11
11
  console.log(formatSuccess(`Reordered ${ids.length} prizes`));
12
12
  }
13
13
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"reorder2.mjs","names":[],"sources":["../../src/commands/prizes/reorder.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatSuccess } from \"../../output.js\"\n\nexport async function runPrizesReorder(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n let ids: string[] = []\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--ids\") {\n ids = args[++i]?.split(\",\").map((s) => s.trim()) ?? []\n }\n }\n\n if (!ids.length) {\n console.error(\"Error: --ids is required (comma-separated prize IDs in desired order)\")\n process.exit(1)\n }\n\n await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/reorder`, {\n prize_ids: ids,\n })\n console.log(formatSuccess(`Reordered ${ids.length} prizes`))\n}\n"],"mappings":";;AAGA,eAAsB,iBACpB,QACA,aACA,MACe;CACf,IAAI,MAAgB,EAAE;AACtB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,QACd,OAAM,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;AAI1D,KAAI,CAAC,IAAI,QAAQ;AACf,UAAQ,MAAM,wEAAwE;AACtF,UAAQ,KAAK,EAAE;;AAGjB,OAAM,OAAO,KAAK,6BAA6B,YAAY,kBAAkB,EAC3E,WAAW,KACZ,CAAC;AACF,SAAQ,IAAI,cAAc,aAAa,IAAI,OAAO,SAAS,CAAC"}
1
+ {"version":3,"file":"reorder2.mjs","names":[],"sources":["../../src/commands/prizes/reorder.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatSuccess } from \"../../output.js\"\n\nexport async function runPrizesReorder(\n client: OatmealClient,\n hackathonId: string,\n args: string[]\n): Promise<void> {\n let ids: string[] = []\n for (let i = 0; i < args.length; i++) {\n if (args[i] === \"--ids\") {\n ids = args[++i]?.split(\",\").map((s) => s.trim()) ?? []\n }\n }\n\n if (!ids.length) {\n console.error(\"Error: --ids is required (comma-separated prize IDs in desired order)\")\n process.exit(1)\n }\n\n await client.post(`/api/dashboard/hackathons/${hackathonId}/prizes/reorder`, {\n orderedIds: ids,\n })\n console.log(formatSuccess(`Reordered ${ids.length} prizes`))\n}\n"],"mappings":";;AAGA,eAAsB,iBACpB,QACA,aACA,MACe;CACf,IAAI,MAAgB,EAAE;AACtB,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,KAAI,KAAK,OAAO,QACd,OAAM,KAAK,EAAE,IAAI,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;AAI1D,KAAI,CAAC,IAAI,QAAQ;AACf,UAAQ,MAAM,wEAAwE;AACtF,UAAQ,KAAK,EAAE;;AAGjB,OAAM,OAAO,KAAK,6BAA6B,YAAY,kBAAkB,EAC3E,YAAY,KACb,CAAC;AACF,SAAQ,IAAI,cAAc,aAAa,IAAI,OAAO,SAAS,CAAC"}
@@ -10,29 +10,29 @@ async function runBrowseResults(client, slug, options) {
10
10
  console.log(formatJson(data));
11
11
  return;
12
12
  }
13
- if (!data.published) {
13
+ if (!data.isPublished) {
14
14
  console.log("Results have not been published yet.");
15
15
  return;
16
16
  }
17
- if (!data.rankings?.length) {
17
+ if (!data.results?.length) {
18
18
  console.log("No rankings available.");
19
19
  return;
20
20
  }
21
- console.log(formatTable(data.rankings, [
21
+ console.log(formatTable(data.results, [
22
22
  {
23
23
  key: "rank",
24
24
  label: "#"
25
25
  },
26
26
  {
27
- key: "submission_name",
27
+ key: "submissionTitle",
28
28
  label: "Submission"
29
29
  },
30
30
  {
31
- key: "team_name",
31
+ key: "teamName",
32
32
  label: "Team"
33
33
  },
34
34
  {
35
- key: "total_score",
35
+ key: "totalScore",
36
36
  label: "Score"
37
37
  }
38
38
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"results.mjs","names":[],"sources":["../../src/commands/browse/results.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { ResultsData } from \"../../types.js\"\n\nexport async function runBrowseResults(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse results <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<ResultsData>(\n `/api/public/hackathons/${encodeURIComponent(slug)}/results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.published) {\n console.log(\"Results have not been published yet.\")\n return\n }\n\n if (!data.rankings?.length) {\n console.log(\"No rankings available.\")\n return\n }\n\n console.log(\n formatTable(data.rankings, [\n { key: \"rank\", label: \"#\" },\n { key: \"submission_name\", label: \"Submission\" },\n { key: \"team_name\", label: \"Team\" },\n { key: \"total_score\", label: \"Score\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,iBACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,yCAAyC;AACvD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,0BAA0B,mBAAmB,KAAK,CAAC,UACpD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,WAAW;AACnB,UAAQ,IAAI,uCAAuC;AACnD;;AAGF,KAAI,CAAC,KAAK,UAAU,QAAQ;AAC1B,UAAQ,IAAI,yBAAyB;AACrC;;AAGF,SAAQ,IACN,YAAY,KAAK,UAAU;EACzB;GAAE,KAAK;GAAQ,OAAO;GAAK;EAC3B;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAa,OAAO;GAAQ;EACnC;GAAE,KAAK;GAAe,OAAO;;EAC9B,CAAC,CACH"}
1
+ {"version":3,"file":"results.mjs","names":[],"sources":["../../src/commands/browse/results.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { ResultsData } from \"../../types.js\"\n\nexport async function runBrowseResults(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse results <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<ResultsData>(\n `/api/public/hackathons/${encodeURIComponent(slug)}/results`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.isPublished) {\n console.log(\"Results have not been published yet.\")\n return\n }\n\n if (!data.results?.length) {\n console.log(\"No rankings available.\")\n return\n }\n\n console.log(\n formatTable(data.results, [\n { key: \"rank\", label: \"#\" },\n { key: \"submissionTitle\", label: \"Submission\" },\n { key: \"teamName\", label: \"Team\" },\n { key: \"totalScore\", label: \"Score\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,iBACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,yCAAyC;AACvD,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,0BAA0B,mBAAmB,KAAK,CAAC,UACpD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa;AACrB,UAAQ,IAAI,uCAAuC;AACnD;;AAGF,KAAI,CAAC,KAAK,SAAS,QAAQ;AACzB,UAAQ,IAAI,yBAAyB;AACrC;;AAGF,SAAQ,IACN,YAAY,KAAK,SAAS;EACxB;GAAE,KAAK;GAAQ,OAAO;GAAK;EAC3B;GAAE,KAAK;GAAmB,OAAO;GAAc;EAC/C;GAAE,KAAK;GAAY,OAAO;GAAQ;EAClC;GAAE,KAAK;GAAc,OAAO;;EAC7B,CAAC,CACH"}
@@ -16,15 +16,15 @@ async function runBrowseSubmissions(client, slug, options) {
16
16
  }
17
17
  console.log(formatTable(data.submissions, [
18
18
  {
19
- key: "name",
19
+ key: "title",
20
20
  label: "Name"
21
21
  },
22
22
  {
23
- key: "team_name",
23
+ key: "submitter",
24
24
  label: "Team"
25
25
  },
26
26
  {
27
- key: "submitted_at",
27
+ key: "createdAt",
28
28
  label: "Submitted"
29
29
  }
30
30
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"submissions.mjs","names":[],"sources":["../../src/commands/browse/submissions.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Submission } from \"../../types.js\"\n\nexport async function runBrowseSubmissions(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse submissions <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<{ submissions: Submission[] }>(\n `/api/public/hackathons/${encodeURIComponent(slug)}/submissions`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.submissions?.length) {\n console.log(\"No submissions found.\")\n return\n }\n\n console.log(\n formatTable(data.submissions, [\n { key: \"name\", label: \"Name\" },\n { key: \"team_name\", label: \"Team\" },\n { key: \"submitted_at\", label: \"Submitted\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,qBACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,6CAA6C;AAC3D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,0BAA0B,mBAAmB,KAAK,CAAC,cACpD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,wBAAwB;AACpC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAQ,OAAO;GAAQ;EAC9B;GAAE,KAAK;GAAa,OAAO;GAAQ;EACnC;GAAE,KAAK;GAAgB,OAAO;;EAC/B,CAAC,CACH"}
1
+ {"version":3,"file":"submissions.mjs","names":[],"sources":["../../src/commands/browse/submissions.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatTable } from \"../../output.js\"\nimport type { Submission } from \"../../types.js\"\n\nexport async function runBrowseSubmissions(\n client: OatmealClient,\n slug: string,\n options: { json?: boolean }\n): Promise<void> {\n if (!slug) {\n console.error(\"Usage: hackathon browse submissions <slug>\")\n process.exit(1)\n }\n\n const data = await client.get<{ submissions: Submission[] }>(\n `/api/public/hackathons/${encodeURIComponent(slug)}/submissions`\n )\n\n if (options.json) {\n console.log(formatJson(data))\n return\n }\n\n if (!data.submissions?.length) {\n console.log(\"No submissions found.\")\n return\n }\n\n console.log(\n formatTable(data.submissions, [\n { key: \"title\", label: \"Name\" },\n { key: \"submitter\", label: \"Team\" },\n { key: \"createdAt\", label: \"Submitted\" },\n ])\n )\n}\n"],"mappings":";;AAIA,eAAsB,qBACpB,QACA,MACA,SACe;AACf,KAAI,CAAC,MAAM;AACT,UAAQ,MAAM,6CAA6C;AAC3D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,OAAO,MAAM,OAAO,IACxB,0BAA0B,mBAAmB,KAAK,CAAC,cACpD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,KAAK,CAAC;AAC7B;;AAGF,KAAI,CAAC,KAAK,aAAa,QAAQ;AAC7B,UAAQ,IAAI,wBAAwB;AACpC;;AAGF,SAAQ,IACN,YAAY,KAAK,aAAa;EAC5B;GAAE,KAAK;GAAS,OAAO;GAAQ;EAC/B;GAAE,KAAK;GAAa,OAAO;GAAQ;EACnC;GAAE,KAAK;GAAa,OAAO;;EAC5B,CAAC,CACH"}
@@ -1,6 +1,28 @@
1
1
  import { n as CONFIG_DIR, s as VERSION } from "./constants.mjs";
2
2
  import { join } from "node:path";
3
3
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
+ //#region src/invocation.ts
5
+ const PACKAGE_NAME$1 = "@agi-ventures-canada/hackathon-cli";
6
+ function detectInvocationMode() {
7
+ const npmCommand = process.env.npm_command ?? "";
8
+ const execPath = process.env.npm_execpath ?? "";
9
+ const lifecycleEvent = process.env.npm_lifecycle_event ?? "";
10
+ const launcher = process.env._ ?? "";
11
+ const argv1 = process.argv[1] ?? "";
12
+ if (npmCommand === "run-script" && /bun/.test(execPath) || /packages\/cli\/src\/cli\.ts$/.test(argv1) || /packages\/cli\/dist\/cli\.mjs$/.test(argv1)) return "local-bun-script";
13
+ if (lifecycleEvent === "bunx" || npmCommand === "bunx" || /bunx/.test(launcher)) return "bunx";
14
+ if (npmCommand === "exec" || /npm/.test(execPath)) return "npx";
15
+ return "global";
16
+ }
17
+ function formatUpdateHint() {
18
+ switch (detectInvocationMode()) {
19
+ case "local-bun-script": return `Update this repo to get the new CLI version, or install the published CLI with \`bun install -g ${PACKAGE_NAME$1}@latest\`.`;
20
+ case "bunx": return `Run \`bunx ${PACKAGE_NAME$1} update\` to update.`;
21
+ case "npx": return `Run \`npx ${PACKAGE_NAME$1} update\` to update.`;
22
+ default: return "Run `hackathon update` to update.";
23
+ }
24
+ }
25
+ //#endregion
4
26
  //#region src/update-check.ts
5
27
  const PACKAGE_NAME = "@agi-ventures-canada/hackathon-cli";
6
28
  const CHECK_FILE = join(CONFIG_DIR, "update-check.json");
@@ -62,9 +84,9 @@ async function checkForUpdate() {
62
84
  return null;
63
85
  }
64
86
  function formatUpdateNotice(info) {
65
- return `\nUpdate available: ${info.current} → ${info.latest}\nRun \`hackathon update\` to update`;
87
+ return `\nUpdate available: ${info.current} → ${info.latest}\n${formatUpdateHint()}`;
66
88
  }
67
89
  //#endregion
68
- export { checkForUpdate, formatUpdateNotice };
90
+ export { checkForUpdate, formatUpdateNotice, detectInvocationMode as t };
69
91
 
70
92
  //# sourceMappingURL=update-check.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-check.mjs","names":[],"sources":["../../src/update-check.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport { CONFIG_DIR, VERSION } from \"./constants.js\"\n\nconst PACKAGE_NAME = \"@agi-ventures-canada/hackathon-cli\"\nconst CHECK_FILE = join(CONFIG_DIR, \"update-check.json\")\nconst CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000 // 4 hours\n\ninterface UpdateCheckCache {\n lastChecked: number\n latestVersion: string\n}\n\nfunction readCache(): UpdateCheckCache | null {\n if (!existsSync(CHECK_FILE)) return null\n try {\n return JSON.parse(readFileSync(CHECK_FILE, \"utf-8\")) as UpdateCheckCache\n } catch {\n return null\n }\n}\n\nfunction writeCache(data: UpdateCheckCache): void {\n try {\n writeFileSync(CHECK_FILE, JSON.stringify(data) + \"\\n\", { mode: 0o600 })\n } catch {\n // Silently ignore write failures\n }\n}\n\nasync function fetchLatestVersion(): Promise<string | null> {\n try {\n const controller = new AbortController()\n const timeout = setTimeout(() => controller.abort(), 3000)\n const res = await fetch(\n `https://registry.npmjs.org/${PACKAGE_NAME}/latest`,\n { signal: controller.signal }\n )\n clearTimeout(timeout)\n if (!res.ok) return null\n const data = (await res.json()) as { version?: string }\n return data.version ?? null\n } catch {\n return null\n }\n}\n\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split(\".\").map(Number)\n const pb = b.split(\".\").map(Number)\n for (let i = 0; i < 3; i++) {\n if ((pa[i] ?? 0) < (pb[i] ?? 0)) return -1\n if ((pa[i] ?? 0) > (pb[i] ?? 0)) return 1\n }\n return 0\n}\n\nexport interface UpdateInfo {\n current: string\n latest: string\n}\n\nexport async function checkForUpdate(): Promise<UpdateInfo | null> {\n const cache = readCache()\n const now = Date.now()\n\n if (cache && now - cache.lastChecked < CHECK_INTERVAL_MS) {\n if (compareVersions(VERSION, cache.latestVersion) < 0) {\n return { current: VERSION, latest: cache.latestVersion }\n }\n return null\n }\n\n const latest = await fetchLatestVersion()\n if (!latest) return null\n\n writeCache({ lastChecked: now, latestVersion: latest })\n\n if (compareVersions(VERSION, latest) < 0) {\n return { current: VERSION, latest }\n }\n return null\n}\n\nexport function formatUpdateNotice(info: UpdateInfo): string {\n return `\\nUpdate available: ${info.current} → ${info.latest}\\nRun \\`hackathon update\\` to update`\n}\n"],"mappings":";;;;AAIA,MAAM,eAAe;AACrB,MAAM,aAAa,KAAK,YAAY,oBAAoB;AACxD,MAAM,oBAAoB,QAAc;AAOxC,SAAS,YAAqC;AAC5C,KAAI,CAAC,WAAW,WAAW,CAAE,QAAO;AACpC,KAAI;AACF,SAAO,KAAK,MAAM,aAAa,YAAY,QAAQ,CAAC;SAC9C;AACN,SAAO;;;AAIX,SAAS,WAAW,MAA8B;AAChD,KAAI;AACF,gBAAc,YAAY,KAAK,UAAU,KAAK,GAAG,MAAM,EAAE,MAAM,KAAO,CAAC;SACjE;;AAKV,eAAe,qBAA6C;AAC1D,KAAI;EACF,MAAM,aAAa,IAAI,iBAAiB;EACxC,MAAM,UAAU,iBAAiB,WAAW,OAAO,EAAE,IAAK;EAC1D,MAAM,MAAM,MAAM,MAChB,8BAA8B,aAAa,UAC3C,EAAE,QAAQ,WAAW,QAAQ,CAC9B;AACD,eAAa,QAAQ;AACrB,MAAI,CAAC,IAAI,GAAI,QAAO;AAEpB,UADc,MAAM,IAAI,MAAM,EAClB,WAAW;SACjB;AACN,SAAO;;;AAIX,SAAS,gBAAgB,GAAW,GAAmB;CACrD,MAAM,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,OAAO;CACnC,MAAM,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,OAAO;AACnC,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,OAAK,GAAG,MAAM,MAAM,GAAG,MAAM,GAAI,QAAO;AACxC,OAAK,GAAG,MAAM,MAAM,GAAG,MAAM,GAAI,QAAO;;AAE1C,QAAO;;AAQT,eAAsB,iBAA6C;CACjE,MAAM,QAAQ,WAAW;CACzB,MAAM,MAAM,KAAK,KAAK;AAEtB,KAAI,SAAS,MAAM,MAAM,cAAc,mBAAmB;AACxD,MAAI,gBAAA,SAAyB,MAAM,cAAc,GAAG,EAClD,QAAO;GAAE,SAAS;GAAS,QAAQ,MAAM;GAAe;AAE1D,SAAO;;CAGT,MAAM,SAAS,MAAM,oBAAoB;AACzC,KAAI,CAAC,OAAQ,QAAO;AAEpB,YAAW;EAAE,aAAa;EAAK,eAAe;EAAQ,CAAC;AAEvD,KAAI,gBAAA,SAAyB,OAAO,GAAG,EACrC,QAAO;EAAE,SAAS;EAAS;EAAQ;AAErC,QAAO;;AAGT,SAAgB,mBAAmB,MAA0B;AAC3D,QAAO,uBAAuB,KAAK,QAAQ,KAAK,KAAK,OAAO"}
1
+ {"version":3,"file":"update-check.mjs","names":["PACKAGE_NAME"],"sources":["../../src/invocation.ts","../../src/update-check.ts"],"sourcesContent":["const PACKAGE_NAME = \"@agi-ventures-canada/hackathon-cli\"\n\nexport type InvocationMode = \"global\" | \"local-bun-script\" | \"bunx\" | \"npx\"\n\nexport function detectInvocationMode(): InvocationMode {\n const npmCommand = process.env.npm_command ?? \"\"\n const execPath = process.env.npm_execpath ?? \"\"\n const lifecycleEvent = process.env.npm_lifecycle_event ?? \"\"\n const launcher = process.env._ ?? \"\"\n const argv1 = process.argv[1] ?? \"\"\n\n if (\n (npmCommand === \"run-script\" && /bun/.test(execPath)) ||\n /packages\\/cli\\/src\\/cli\\.ts$/.test(argv1) ||\n /packages\\/cli\\/dist\\/cli\\.mjs$/.test(argv1)\n ) {\n return \"local-bun-script\"\n }\n\n if (\n lifecycleEvent === \"bunx\" ||\n npmCommand === \"bunx\" ||\n /bunx/.test(launcher)\n ) {\n return \"bunx\"\n }\n\n if (npmCommand === \"exec\" || /npm/.test(execPath)) {\n return \"npx\"\n }\n\n return \"global\"\n}\n\nexport function formatUpdateHint(): string {\n switch (detectInvocationMode()) {\n case \"local-bun-script\":\n return `Update this repo to get the new CLI version, or install the published CLI with \\`bun install -g ${PACKAGE_NAME}@latest\\`.`\n case \"bunx\":\n return `Run \\`bunx ${PACKAGE_NAME} update\\` to update.`\n case \"npx\":\n return `Run \\`npx ${PACKAGE_NAME} update\\` to update.`\n default:\n return \"Run `hackathon update` to update.\"\n }\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\"\nimport { join } from \"node:path\"\nimport { CONFIG_DIR, VERSION } from \"./constants.js\"\nimport { formatUpdateHint } from \"./invocation.js\"\n\nconst PACKAGE_NAME = \"@agi-ventures-canada/hackathon-cli\"\nconst CHECK_FILE = join(CONFIG_DIR, \"update-check.json\")\nconst CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000 // 4 hours\n\ninterface UpdateCheckCache {\n lastChecked: number\n latestVersion: string\n}\n\nfunction readCache(): UpdateCheckCache | null {\n if (!existsSync(CHECK_FILE)) return null\n try {\n return JSON.parse(readFileSync(CHECK_FILE, \"utf-8\")) as UpdateCheckCache\n } catch {\n return null\n }\n}\n\nfunction writeCache(data: UpdateCheckCache): void {\n try {\n writeFileSync(CHECK_FILE, JSON.stringify(data) + \"\\n\", { mode: 0o600 })\n } catch {\n // Silently ignore write failures\n }\n}\n\nasync function fetchLatestVersion(): Promise<string | null> {\n try {\n const controller = new AbortController()\n const timeout = setTimeout(() => controller.abort(), 3000)\n const res = await fetch(\n `https://registry.npmjs.org/${PACKAGE_NAME}/latest`,\n { signal: controller.signal }\n )\n clearTimeout(timeout)\n if (!res.ok) return null\n const data = (await res.json()) as { version?: string }\n return data.version ?? null\n } catch {\n return null\n }\n}\n\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split(\".\").map(Number)\n const pb = b.split(\".\").map(Number)\n for (let i = 0; i < 3; i++) {\n if ((pa[i] ?? 0) < (pb[i] ?? 0)) return -1\n if ((pa[i] ?? 0) > (pb[i] ?? 0)) return 1\n }\n return 0\n}\n\nexport interface UpdateInfo {\n current: string\n latest: string\n}\n\nexport async function checkForUpdate(): Promise<UpdateInfo | null> {\n const cache = readCache()\n const now = Date.now()\n\n if (cache && now - cache.lastChecked < CHECK_INTERVAL_MS) {\n if (compareVersions(VERSION, cache.latestVersion) < 0) {\n return { current: VERSION, latest: cache.latestVersion }\n }\n return null\n }\n\n const latest = await fetchLatestVersion()\n if (!latest) return null\n\n writeCache({ lastChecked: now, latestVersion: latest })\n\n if (compareVersions(VERSION, latest) < 0) {\n return { current: VERSION, latest }\n }\n return null\n}\n\nexport function formatUpdateNotice(info: UpdateInfo): string {\n return `\\nUpdate available: ${info.current} → ${info.latest}\\n${formatUpdateHint()}`\n}\n"],"mappings":";;;;AAAA,MAAMA,iBAAe;AAIrB,SAAgB,uBAAuC;CACrD,MAAM,aAAa,QAAQ,IAAI,eAAe;CAC9C,MAAM,WAAW,QAAQ,IAAI,gBAAgB;CAC7C,MAAM,iBAAiB,QAAQ,IAAI,uBAAuB;CAC1D,MAAM,WAAW,QAAQ,IAAI,KAAK;CAClC,MAAM,QAAQ,QAAQ,KAAK,MAAM;AAEjC,KACG,eAAe,gBAAgB,MAAM,KAAK,SAAS,IACpD,+BAA+B,KAAK,MAAM,IAC1C,iCAAiC,KAAK,MAAM,CAE5C,QAAO;AAGT,KACE,mBAAmB,UACnB,eAAe,UACf,OAAO,KAAK,SAAS,CAErB,QAAO;AAGT,KAAI,eAAe,UAAU,MAAM,KAAK,SAAS,CAC/C,QAAO;AAGT,QAAO;;AAGT,SAAgB,mBAA2B;AACzC,SAAQ,sBAAsB,EAA9B;EACE,KAAK,mBACH,QAAO,mGAAmGA,eAAa;EACzH,KAAK,OACH,QAAO,cAAcA,eAAa;EACpC,KAAK,MACH,QAAO,aAAaA,eAAa;EACnC,QACE,QAAO;;;;;ACtCb,MAAM,eAAe;AACrB,MAAM,aAAa,KAAK,YAAY,oBAAoB;AACxD,MAAM,oBAAoB,QAAc;AAOxC,SAAS,YAAqC;AAC5C,KAAI,CAAC,WAAW,WAAW,CAAE,QAAO;AACpC,KAAI;AACF,SAAO,KAAK,MAAM,aAAa,YAAY,QAAQ,CAAC;SAC9C;AACN,SAAO;;;AAIX,SAAS,WAAW,MAA8B;AAChD,KAAI;AACF,gBAAc,YAAY,KAAK,UAAU,KAAK,GAAG,MAAM,EAAE,MAAM,KAAO,CAAC;SACjE;;AAKV,eAAe,qBAA6C;AAC1D,KAAI;EACF,MAAM,aAAa,IAAI,iBAAiB;EACxC,MAAM,UAAU,iBAAiB,WAAW,OAAO,EAAE,IAAK;EAC1D,MAAM,MAAM,MAAM,MAChB,8BAA8B,aAAa,UAC3C,EAAE,QAAQ,WAAW,QAAQ,CAC9B;AACD,eAAa,QAAQ;AACrB,MAAI,CAAC,IAAI,GAAI,QAAO;AAEpB,UADc,MAAM,IAAI,MAAM,EAClB,WAAW;SACjB;AACN,SAAO;;;AAIX,SAAS,gBAAgB,GAAW,GAAmB;CACrD,MAAM,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,OAAO;CACnC,MAAM,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,OAAO;AACnC,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,OAAK,GAAG,MAAM,MAAM,GAAG,MAAM,GAAI,QAAO;AACxC,OAAK,GAAG,MAAM,MAAM,GAAG,MAAM,GAAI,QAAO;;AAE1C,QAAO;;AAQT,eAAsB,iBAA6C;CACjE,MAAM,QAAQ,WAAW;CACzB,MAAM,MAAM,KAAK,KAAK;AAEtB,KAAI,SAAS,MAAM,MAAM,cAAc,mBAAmB;AACxD,MAAI,gBAAA,SAAyB,MAAM,cAAc,GAAG,EAClD,QAAO;GAAE,SAAS;GAAS,QAAQ,MAAM;GAAe;AAE1D,SAAO;;CAGT,MAAM,SAAS,MAAM,oBAAoB;AACzC,KAAI,CAAC,OAAQ,QAAO;AAEpB,YAAW;EAAE,aAAa;EAAK,eAAe;EAAQ,CAAC;AAEvD,KAAI,gBAAA,SAAyB,OAAO,GAAG,EACrC,QAAO;EAAE,SAAS;EAAS;EAAQ;AAErC,QAAO;;AAGT,SAAgB,mBAAmB,MAA0B;AAC3D,QAAO,uBAAuB,KAAK,QAAQ,KAAK,KAAK,OAAO,IAAI,kBAAkB"}
@@ -29,8 +29,8 @@ async function runSchedulesUpdate(client, scheduleId, args) {
29
29
  const options = parseScheduleUpdateOptions(args);
30
30
  const body = {};
31
31
  if (options.name) body.name = options.name;
32
- if (options.cron) body.cron_expression = options.cron;
33
- if (options.enabled !== void 0) body.enabled = options.enabled;
32
+ if (options.cron) body.cronExpression = options.cron;
33
+ if (options.enabled !== void 0) body.isActive = options.enabled;
34
34
  if (Object.keys(body).length === 0) {
35
35
  console.error("Error: provide at least one field to update");
36
36
  process.exit(1);
@@ -1 +1 @@
1
- {"version":3,"file":"update4.mjs","names":[],"sources":["../../src/commands/schedules/update.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\ninterface ScheduleUpdateOptions {\n name?: string\n cron?: string\n enabled?: boolean\n json?: boolean\n}\n\nexport function parseScheduleUpdateOptions(args: string[]): ScheduleUpdateOptions {\n const options: ScheduleUpdateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--cron\":\n options.cron = args[++i]\n break\n case \"--enable\":\n options.enabled = true\n break\n case \"--disable\":\n options.enabled = false\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runSchedulesUpdate(\n client: OatmealClient,\n scheduleId: string,\n args: string[]\n): Promise<void> {\n if (!scheduleId) {\n console.error(\"Usage: hackathon schedules update <schedule-id> [--name ...] [--cron ...]\")\n process.exit(1)\n }\n\n const options = parseScheduleUpdateOptions(args)\n const body: Record<string, unknown> = {}\n if (options.name) body.name = options.name\n if (options.cron) body.cron_expression = options.cron\n if (options.enabled !== undefined) body.enabled = options.enabled\n\n if (Object.keys(body).length === 0) {\n console.error(\"Error: provide at least one field to update\")\n process.exit(1)\n }\n\n const schedule = await client.patch<Schedule>(\n `/api/dashboard/schedules/${scheduleId}`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(formatSuccess(`Updated schedule \"${schedule.name}\"`))\n}\n"],"mappings":";;AAWA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,UAAU;AAClB;EACF,KAAK;AACH,WAAQ,UAAU;AAClB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,mBACpB,QACA,YACA,MACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,4EAA4E;AAC1F,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,2BAA2B,KAAK;CAChD,MAAM,OAAgC,EAAE;AACxC,KAAI,QAAQ,KAAM,MAAK,OAAO,QAAQ;AACtC,KAAI,QAAQ,KAAM,MAAK,kBAAkB,QAAQ;AACjD,KAAI,QAAQ,YAAY,KAAA,EAAW,MAAK,UAAU,QAAQ;AAE1D,KAAI,OAAO,KAAK,KAAK,CAAC,WAAW,GAAG;AAClC,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,MAC5B,4BAA4B,cAC5B,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,GAAG,CAAC"}
1
+ {"version":3,"file":"update4.mjs","names":[],"sources":["../../src/commands/schedules/update.ts"],"sourcesContent":["import type { OatmealClient } from \"../../client.js\"\nimport { formatJson, formatSuccess } from \"../../output.js\"\nimport type { Schedule } from \"../../types.js\"\n\ninterface ScheduleUpdateOptions {\n name?: string\n cron?: string\n enabled?: boolean\n json?: boolean\n}\n\nexport function parseScheduleUpdateOptions(args: string[]): ScheduleUpdateOptions {\n const options: ScheduleUpdateOptions = {}\n for (let i = 0; i < args.length; i++) {\n switch (args[i]) {\n case \"--name\":\n options.name = args[++i]\n break\n case \"--cron\":\n options.cron = args[++i]\n break\n case \"--enable\":\n options.enabled = true\n break\n case \"--disable\":\n options.enabled = false\n break\n case \"--json\":\n options.json = true\n break\n }\n }\n return options\n}\n\nexport async function runSchedulesUpdate(\n client: OatmealClient,\n scheduleId: string,\n args: string[]\n): Promise<void> {\n if (!scheduleId) {\n console.error(\"Usage: hackathon schedules update <schedule-id> [--name ...] [--cron ...]\")\n process.exit(1)\n }\n\n const options = parseScheduleUpdateOptions(args)\n const body: Record<string, unknown> = {}\n if (options.name) body.name = options.name\n if (options.cron) body.cronExpression = options.cron\n if (options.enabled !== undefined) body.isActive = options.enabled\n\n if (Object.keys(body).length === 0) {\n console.error(\"Error: provide at least one field to update\")\n process.exit(1)\n }\n\n const schedule = await client.patch<Schedule>(\n `/api/dashboard/schedules/${scheduleId}`,\n body\n )\n\n if (options.json) {\n console.log(formatJson(schedule))\n return\n }\n\n console.log(formatSuccess(`Updated schedule \"${schedule.name}\"`))\n}\n"],"mappings":";;AAWA,SAAgB,2BAA2B,MAAuC;CAChF,MAAM,UAAiC,EAAE;AACzC,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,IAC/B,SAAQ,KAAK,IAAb;EACE,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,OAAO,KAAK,EAAE;AACtB;EACF,KAAK;AACH,WAAQ,UAAU;AAClB;EACF,KAAK;AACH,WAAQ,UAAU;AAClB;EACF,KAAK;AACH,WAAQ,OAAO;AACf;;AAGN,QAAO;;AAGT,eAAsB,mBACpB,QACA,YACA,MACe;AACf,KAAI,CAAC,YAAY;AACf,UAAQ,MAAM,4EAA4E;AAC1F,UAAQ,KAAK,EAAE;;CAGjB,MAAM,UAAU,2BAA2B,KAAK;CAChD,MAAM,OAAgC,EAAE;AACxC,KAAI,QAAQ,KAAM,MAAK,OAAO,QAAQ;AACtC,KAAI,QAAQ,KAAM,MAAK,iBAAiB,QAAQ;AAChD,KAAI,QAAQ,YAAY,KAAA,EAAW,MAAK,WAAW,QAAQ;AAE3D,KAAI,OAAO,KAAK,KAAK,CAAC,WAAW,GAAG;AAClC,UAAQ,MAAM,8CAA8C;AAC5D,UAAQ,KAAK,EAAE;;CAGjB,MAAM,WAAW,MAAM,OAAO,MAC5B,4BAA4B,cAC5B,KACD;AAED,KAAI,QAAQ,MAAM;AAChB,UAAQ,IAAI,WAAW,SAAS,CAAC;AACjC;;AAGF,SAAQ,IAAI,cAAc,qBAAqB,SAAS,KAAK,GAAG,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { s as VERSION } from "./constants.mjs";
2
- import { checkForUpdate } from "./update-check.mjs";
2
+ import { checkForUpdate, t as detectInvocationMode } from "./update-check.mjs";
3
3
  import pc from "picocolors";
4
4
  import { execSync } from "node:child_process";
5
5
  //#region src/commands/update.ts
@@ -32,7 +32,14 @@ async function runUpdate() {
32
32
  return;
33
33
  }
34
34
  const pm = detectPackageManager();
35
+ const invocationMode = detectInvocationMode();
35
36
  console.log(`New version available: ${update.latest}`);
37
+ if (invocationMode === "local-bun-script") {
38
+ console.log(pc.yellow("You are running the repo-local CLI via `bun cli`."));
39
+ console.log("Update this repository to use the newer CLI source, or install the published package globally:");
40
+ console.log(` ${pm.install}`);
41
+ return;
42
+ }
36
43
  console.log(`Updating via ${pm.cmd}...`);
37
44
  try {
38
45
  execSync(pm.install, { stdio: "inherit" });
@@ -1 +1 @@
1
- {"version":3,"file":"update5.mjs","names":[],"sources":["../../src/commands/update.ts"],"sourcesContent":["import { execSync } from \"node:child_process\"\nimport pc from \"picocolors\"\nimport { VERSION } from \"../constants.js\"\nimport { checkForUpdate } from \"../update-check.js\"\n\nconst PKG = \"@agi-ventures-canada/hackathon-cli\"\n\nfunction detectPackageManager(): { cmd: string; install: string } {\n const execPath = process.env.npm_execpath ?? process.env._ ?? \"\"\n if (/bun/.test(execPath)) return { cmd: \"bun\", install: `bun install -g ${PKG}@latest` }\n if (/pnpm/.test(execPath)) return { cmd: \"pnpm\", install: `pnpm add -g ${PKG}@latest` }\n if (/yarn/.test(execPath)) return { cmd: \"yarn\", install: `yarn global add ${PKG}@latest` }\n return { cmd: \"npm\", install: `npm install -g ${PKG}@latest` }\n}\n\nexport async function runUpdate(): Promise<void> {\n console.log(`Current version: ${VERSION}`)\n console.log(\"Checking for updates...\")\n\n const update = await checkForUpdate()\n if (!update) {\n console.log(pc.green(\"Already up to date.\"))\n return\n }\n\n const pm = detectPackageManager()\n console.log(`New version available: ${update.latest}`)\n console.log(`Updating via ${pm.cmd}...`)\n\n try {\n execSync(pm.install, { stdio: \"inherit\" })\n console.log(pc.green(`\\nUpdated to ${update.latest}`))\n } catch {\n console.error(pc.red(\"Update failed. Try manually:\"))\n console.error(` ${pm.install}`)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;AAKA,MAAM,MAAM;AAEZ,SAAS,uBAAyD;CAChE,MAAM,WAAW,QAAQ,IAAI,gBAAgB,QAAQ,IAAI,KAAK;AAC9D,KAAI,MAAM,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAO,SAAS,kBAAkB,IAAI;EAAU;AACxF,KAAI,OAAO,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAQ,SAAS,eAAe,IAAI;EAAU;AACvF,KAAI,OAAO,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAQ,SAAS,mBAAmB,IAAI;EAAU;AAC3F,QAAO;EAAE,KAAK;EAAO,SAAS,kBAAkB,IAAI;EAAU;;AAGhE,eAAsB,YAA2B;AAC/C,SAAQ,IAAI,oBAAoB,UAAU;AAC1C,SAAQ,IAAI,0BAA0B;CAEtC,MAAM,SAAS,MAAM,gBAAgB;AACrC,KAAI,CAAC,QAAQ;AACX,UAAQ,IAAI,GAAG,MAAM,sBAAsB,CAAC;AAC5C;;CAGF,MAAM,KAAK,sBAAsB;AACjC,SAAQ,IAAI,0BAA0B,OAAO,SAAS;AACtD,SAAQ,IAAI,gBAAgB,GAAG,IAAI,KAAK;AAExC,KAAI;AACF,WAAS,GAAG,SAAS,EAAE,OAAO,WAAW,CAAC;AAC1C,UAAQ,IAAI,GAAG,MAAM,gBAAgB,OAAO,SAAS,CAAC;SAChD;AACN,UAAQ,MAAM,GAAG,IAAI,+BAA+B,CAAC;AACrD,UAAQ,MAAM,KAAK,GAAG,UAAU;AAChC,UAAQ,KAAK,EAAE"}
1
+ {"version":3,"file":"update5.mjs","names":[],"sources":["../../src/commands/update.ts"],"sourcesContent":["import { execSync } from \"node:child_process\"\nimport pc from \"picocolors\"\nimport { VERSION } from \"../constants.js\"\nimport { detectInvocationMode } from \"../invocation.js\"\nimport { checkForUpdate } from \"../update-check.js\"\n\nconst PKG = \"@agi-ventures-canada/hackathon-cli\"\n\nfunction detectPackageManager(): { cmd: string; install: string } {\n const execPath = process.env.npm_execpath ?? process.env._ ?? \"\"\n if (/bun/.test(execPath)) return { cmd: \"bun\", install: `bun install -g ${PKG}@latest` }\n if (/pnpm/.test(execPath)) return { cmd: \"pnpm\", install: `pnpm add -g ${PKG}@latest` }\n if (/yarn/.test(execPath)) return { cmd: \"yarn\", install: `yarn global add ${PKG}@latest` }\n return { cmd: \"npm\", install: `npm install -g ${PKG}@latest` }\n}\n\nexport async function runUpdate(): Promise<void> {\n console.log(`Current version: ${VERSION}`)\n console.log(\"Checking for updates...\")\n\n const update = await checkForUpdate()\n if (!update) {\n console.log(pc.green(\"Already up to date.\"))\n return\n }\n\n const pm = detectPackageManager()\n const invocationMode = detectInvocationMode()\n console.log(`New version available: ${update.latest}`)\n\n if (invocationMode === \"local-bun-script\") {\n console.log(pc.yellow(\"You are running the repo-local CLI via `bun cli`.\"))\n console.log(\"Update this repository to use the newer CLI source, or install the published package globally:\")\n console.log(` ${pm.install}`)\n return\n }\n\n console.log(`Updating via ${pm.cmd}...`)\n\n try {\n execSync(pm.install, { stdio: \"inherit\" })\n console.log(pc.green(`\\nUpdated to ${update.latest}`))\n } catch {\n console.error(pc.red(\"Update failed. Try manually:\"))\n console.error(` ${pm.install}`)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;AAMA,MAAM,MAAM;AAEZ,SAAS,uBAAyD;CAChE,MAAM,WAAW,QAAQ,IAAI,gBAAgB,QAAQ,IAAI,KAAK;AAC9D,KAAI,MAAM,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAO,SAAS,kBAAkB,IAAI;EAAU;AACxF,KAAI,OAAO,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAQ,SAAS,eAAe,IAAI;EAAU;AACvF,KAAI,OAAO,KAAK,SAAS,CAAE,QAAO;EAAE,KAAK;EAAQ,SAAS,mBAAmB,IAAI;EAAU;AAC3F,QAAO;EAAE,KAAK;EAAO,SAAS,kBAAkB,IAAI;EAAU;;AAGhE,eAAsB,YAA2B;AAC/C,SAAQ,IAAI,oBAAoB,UAAU;AAC1C,SAAQ,IAAI,0BAA0B;CAEtC,MAAM,SAAS,MAAM,gBAAgB;AACrC,KAAI,CAAC,QAAQ;AACX,UAAQ,IAAI,GAAG,MAAM,sBAAsB,CAAC;AAC5C;;CAGF,MAAM,KAAK,sBAAsB;CACjC,MAAM,iBAAiB,sBAAsB;AAC7C,SAAQ,IAAI,0BAA0B,OAAO,SAAS;AAEtD,KAAI,mBAAmB,oBAAoB;AACzC,UAAQ,IAAI,GAAG,OAAO,oDAAoD,CAAC;AAC3E,UAAQ,IAAI,iGAAiG;AAC7G,UAAQ,IAAI,KAAK,GAAG,UAAU;AAC9B;;AAGF,SAAQ,IAAI,gBAAgB,GAAG,IAAI,KAAK;AAExC,KAAI;AACF,WAAS,GAAG,SAAS,EAAE,OAAO,WAAW,CAAC;AAC1C,UAAQ,IAAI,GAAG,MAAM,gBAAgB,OAAO,SAAS,CAAC;SAChD;AACN,UAAQ,MAAM,GAAG,IAAI,+BAA+B,CAAC;AACrD,UAAQ,MAAM,KAAK,GAAG,UAAU;AAChC,UAAQ,KAAK,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-ventures-canada/hackathon-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "CLI for the Oatmeal hackathon platform",
5
5
  "type": "module",
6
6
  "bin": {