@drewpayment/mink 0.9.0 → 0.10.0

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 (48) hide show
  1. package/dashboard/out/404.html +1 -1
  2. package/dashboard/out/action-log.html +1 -1
  3. package/dashboard/out/action-log.txt +1 -1
  4. package/dashboard/out/activity.html +1 -1
  5. package/dashboard/out/activity.txt +1 -1
  6. package/dashboard/out/bugs.html +1 -1
  7. package/dashboard/out/bugs.txt +1 -1
  8. package/dashboard/out/capture.html +1 -1
  9. package/dashboard/out/capture.txt +1 -1
  10. package/dashboard/out/config.html +1 -1
  11. package/dashboard/out/config.txt +1 -1
  12. package/dashboard/out/daemon.html +1 -1
  13. package/dashboard/out/daemon.txt +1 -1
  14. package/dashboard/out/design.html +1 -1
  15. package/dashboard/out/design.txt +1 -1
  16. package/dashboard/out/discord.html +1 -1
  17. package/dashboard/out/discord.txt +1 -1
  18. package/dashboard/out/file-index.html +1 -1
  19. package/dashboard/out/file-index.txt +1 -1
  20. package/dashboard/out/index.html +1 -1
  21. package/dashboard/out/index.txt +1 -1
  22. package/dashboard/out/insights.html +1 -1
  23. package/dashboard/out/insights.txt +1 -1
  24. package/dashboard/out/learning.html +1 -1
  25. package/dashboard/out/learning.txt +1 -1
  26. package/dashboard/out/overview.html +1 -1
  27. package/dashboard/out/overview.txt +1 -1
  28. package/dashboard/out/scheduler.html +1 -1
  29. package/dashboard/out/scheduler.txt +1 -1
  30. package/dashboard/out/sync.html +1 -1
  31. package/dashboard/out/sync.txt +1 -1
  32. package/dashboard/out/tokens.html +1 -1
  33. package/dashboard/out/tokens.txt +1 -1
  34. package/dashboard/out/waste.html +1 -1
  35. package/dashboard/out/waste.txt +1 -1
  36. package/dashboard/out/wiki.html +1 -1
  37. package/dashboard/out/wiki.txt +1 -1
  38. package/dist/cli.js +906 -443
  39. package/package.json +1 -1
  40. package/src/cli.ts +8 -1
  41. package/src/commands/init.ts +21 -21
  42. package/src/commands/update.ts +4 -9
  43. package/src/commands/upgrade.ts +128 -0
  44. package/src/core/self-update.ts +363 -0
  45. package/src/core/task-registry.ts +52 -2
  46. package/src/types/config.ts +24 -0
  47. /package/dashboard/out/_next/static/{FLxzihv7lbkF71kIxdNQT → frTrvF6NV-Xl2bLk21NkY}/_buildManifest.js +0 -0
  48. /package/dashboard/out/_next/static/{FLxzihv7lbkF71kIxdNQT → frTrvF6NV-Xl2bLk21NkY}/_ssgManifest.js +0 -0
@@ -1,4 +1,6 @@
1
1
  import type { TaskDefinition } from "../types/scheduler";
2
+ import { resolveConfigValue } from "./global-config";
3
+ import { parseCronExpression } from "./cron-parser";
2
4
 
3
5
  // ── Built-in Task Definitions ───────────────────────────────────────────────
4
6
 
@@ -53,16 +55,43 @@ const BUILT_IN_TASKS: TaskDefinition[] = [
53
55
  retryPolicy: { maxAttempts: 3, baseDelayMs: 60_000 },
54
56
  timeoutMs: 300_000,
55
57
  },
58
+ {
59
+ id: "cli-self-update",
60
+ name: "CLI Self-Update",
61
+ description: "Check npm for a newer mink release and install it (gated by cli.auto-update)",
62
+ schedule: "0 4 * * *",
63
+ actionType: "function",
64
+ enabled: true,
65
+ retryPolicy: { maxAttempts: 3, baseDelayMs: 60_000 },
66
+ timeoutMs: 10 * 60_000,
67
+ },
56
68
  ];
57
69
 
58
70
  // ── Public API ──────────────────────────────────────────────────────────────
59
71
 
72
+ function resolveTaskSchedule(taskId: string, defaultSchedule: string): string {
73
+ if (taskId !== "cli-self-update") return defaultSchedule;
74
+ try {
75
+ const value = resolveConfigValue("cli.auto-update-schedule").value;
76
+ parseCronExpression(value);
77
+ return value;
78
+ } catch {
79
+ return defaultSchedule;
80
+ }
81
+ }
82
+
83
+ function applyDynamicOverrides(task: TaskDefinition): TaskDefinition {
84
+ if (task.id !== "cli-self-update") return task;
85
+ return { ...task, schedule: resolveTaskSchedule(task.id, task.schedule) };
86
+ }
87
+
60
88
  export function getBuiltInTasks(): TaskDefinition[] {
61
- return BUILT_IN_TASKS;
89
+ return BUILT_IN_TASKS.map(applyDynamicOverrides);
62
90
  }
63
91
 
64
92
  export function getTaskById(id: string): TaskDefinition | undefined {
65
- return BUILT_IN_TASKS.find((t) => t.id === id);
93
+ const task = BUILT_IN_TASKS.find((t) => t.id === id);
94
+ return task ? applyDynamicOverrides(task) : undefined;
66
95
  }
67
96
 
68
97
  // ── AI CLI Execution ────────────────────────────────────────────────────────
@@ -196,6 +225,27 @@ export async function executeTask(
196
225
  break;
197
226
  }
198
227
 
228
+ case "cli-self-update": {
229
+ const { runSelfUpgrade } = await import("./self-update");
230
+ const result = await runSelfUpgrade({
231
+ source: "scheduler",
232
+ interactive: false,
233
+ });
234
+ // Surface non-success results so the scheduler retry/dead-letter logic
235
+ // can react. "skipped" and "up-to-date" are normal outcomes.
236
+ if (result.status === "error") {
237
+ const err = new Error(result.reason);
238
+ if (!result.transient) {
239
+ // Non-transient errors (e.g. no package manager) shouldn't keep retrying;
240
+ // tag the message so the dead-letter logs reflect the cause.
241
+ err.message = `[non-transient] ${err.message}`;
242
+ }
243
+ throw err;
244
+ }
245
+ console.log(`[mink] cli-self-update: ${result.status}`);
246
+ break;
247
+ }
248
+
199
249
  default:
200
250
  throw new Error(`No executor defined for task: ${taskId}`);
201
251
  }
@@ -14,6 +14,9 @@ export interface GlobalConfig {
14
14
  "channel.discord.allowlist"?: string;
15
15
  "channel.default-platform"?: string;
16
16
  "channel.skip-permissions"?: string;
17
+ "cli.auto-update"?: string;
18
+ "cli.auto-update-schedule"?: string;
19
+ "cli.auto-update-package-manager"?: string;
17
20
  }
18
21
 
19
22
  export type ConfigKey = keyof GlobalConfig & string;
@@ -146,6 +149,27 @@ export const CONFIG_KEYS: ConfigKeyMeta[] = [
146
149
  description: "Pass --dangerously-skip-permissions so the channel can run without terminal prompts",
147
150
  scope: "shared",
148
151
  },
152
+ {
153
+ key: "cli.auto-update",
154
+ default: "false",
155
+ envVar: "MINK_CLI_AUTO_UPDATE",
156
+ description: "Auto-upgrade the mink CLI on schedule via the background scheduler",
157
+ scope: "shared",
158
+ },
159
+ {
160
+ key: "cli.auto-update-schedule",
161
+ default: "0 4 * * *",
162
+ envVar: "MINK_CLI_AUTO_UPDATE_SCHEDULE",
163
+ description: "Cron expression governing the cli-self-update scheduled task",
164
+ scope: "shared",
165
+ },
166
+ {
167
+ key: "cli.auto-update-package-manager",
168
+ default: "auto",
169
+ envVar: "MINK_CLI_AUTO_UPDATE_PACKAGE_MANAGER",
170
+ description: "Force a package manager (auto|npm|bun) for self-upgrade installs",
171
+ scope: "local",
172
+ },
149
173
  ];
150
174
 
151
175
  const VALID_KEYS = new Set<string>(CONFIG_KEYS.map((k) => k.key));