Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .zdp/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"apiVersion": 1,
"id": "scheduler",
"name": "Scheduler",
"version": "0.1.3",
"version": "0.1.4",
"description": "Create normal ZCode tasks from timezone-aware cron schedules while ZCode is open.",
"entrypoints": {
"main": "dist/main.cjs",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Scheduled runs are ordinary persistent ZCode tasks. They appear immediately in t

Open **Extensions → Available** in ZCode and install Scheduler. The host verifies the release archive checksum before staging it. New installs and updates take effect on the next ZCode launch.

Manual installation is also supported: download `zcode-scheduler-v0.1.3.zip` from the [latest release](https://github.com/notmike101/zcode-scheduler/releases/latest), extract the `scheduler` folder, and select it from **Extensions → Installed → Install folder**.
Manual installation is also supported: download `zcode-scheduler-v0.1.4.zip` from the [latest release](https://github.com/notmike101/zcode-scheduler/releases/latest), extract the `scheduler` folder, and select it from **Extensions → Installed → Install folder**.

## Scheduling behavior

Expand All @@ -30,7 +30,7 @@ Manual installation is also supported: download `zcode-scheduler-v0.1.3.zip` fro
```powershell
bun install
bun run check
bun run release:package -- --tag v0.1.3
bun run release:package -- --tag v0.1.4
```

The release command writes a ZIP, its SHA-256 checksum, and `extension-update.json` to `dist/release`.
Expand Down
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zcode-scheduler",
"version": "0.1.3",
"version": "0.1.4",
"description": "Schedule normal, visible ZCode tasks with timezone-aware cron expressions.",
"private": true,
"license": "MIT",
Expand All @@ -24,6 +24,7 @@
"zod": "^4.1.12"
},
"devDependencies": {
"@notmike101/zcode-extension-sdk": "0.3.0",
"@types/bun": "^1.3.4",
"@types/node": "^24.10.1",
"typescript": "^5.9.3"
Expand Down
78 changes: 0 additions & 78 deletions sdk/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {randomUUID} from "node:crypto";
import {appendFile, mkdir, readFile, readdir, rename, rm, stat, writeFile} from "node:fs/promises";
import path from "node:path";
import {writeJsonAtomic} from "./atomic.ts";
import type {ExtensionContext, ExtensionTaskRunHandle} from "../sdk/index.ts";
import type {ExtensionContext, ExtensionTaskRunHandle} from "@notmike101/zcode-extension-sdk/main";
import {editableJobSchema, jobSchema, runRecordSchema, type EditableJob, type RunRecord, type SchedulerJob} from "./schemas.ts";
import {nextRun, preview, systemTimezone, validateCron, validateTimezone} from "./cron.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {render} from "preact";
import {useEffect, useMemo, useState} from "preact/hooks";
import type {ExtensionBridge as ZdpBridge} from "../sdk/index.ts";
import type {ExtensionBridge as ZdpBridge} from "@notmike101/zcode-extension-sdk/renderer";
import type {RunRecord, SchedulerJob} from "./schemas.ts";
import styles from "./scheduler.css";

Expand Down
18 changes: 9 additions & 9 deletions tests/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import {assertReleaseVersion, releaseBaseName, resolveReleaseTag} from "../scrip

describe("release metadata", () => {
test("accepts a matching semantic version tag", () => {
expect(assertReleaseVersion("v0.1.3", "0.1.3", "0.1.3")).toBe("0.1.3");
expect(releaseBaseName("0.1.3")).toBe("zcode-scheduler-v0.1.3");
expect(assertReleaseVersion("v0.1.4", "0.1.4", "0.1.4")).toBe("0.1.4");
expect(releaseBaseName("0.1.4")).toBe("zcode-scheduler-v0.1.4");
});

test("ignores pull-request merge refs when inferring a release tag", () => {
expect(resolveReleaseTag(undefined, undefined, "1/merge", "0.1.3")).toBe("v0.1.3");
expect(resolveReleaseTag(undefined, "branch", "main", "0.1.3")).toBe("v0.1.3");
expect(resolveReleaseTag(undefined, "tag", "v0.1.3", "0.1.3")).toBe("v0.1.3");
expect(resolveReleaseTag("v0.1.4", "tag", "v0.1.3", "0.1.3")).toBe("v0.1.4");
expect(resolveReleaseTag(undefined, undefined, "1/merge", "0.1.4")).toBe("v0.1.4");
expect(resolveReleaseTag(undefined, "branch", "main", "0.1.4")).toBe("v0.1.4");
expect(resolveReleaseTag(undefined, "tag", "v0.1.4", "0.1.4")).toBe("v0.1.4");
expect(resolveReleaseTag("v0.1.5", "tag", "v0.1.4", "0.1.4")).toBe("v0.1.5");
});

test("rejects malformed or inconsistent versions", () => {
expect(() => assertReleaseVersion("release-0.1.3", "0.1.3", "0.1.3")).toThrow("strict vX.Y.Z");
expect(() => assertReleaseVersion("v0.1.4", "0.1.3", "0.1.3")).toThrow("package version");
expect(() => assertReleaseVersion("v0.1.3", "0.1.3", "0.1.2")).toThrow("manifest version");
expect(() => assertReleaseVersion("release-0.1.4", "0.1.4", "0.1.4")).toThrow("strict vX.Y.Z");
expect(() => assertReleaseVersion("v0.1.5", "0.1.4", "0.1.4")).toThrow("package version");
expect(() => assertReleaseVersion("v0.1.4", "0.1.4", "0.1.3")).toThrow("manifest version");
});
});
14 changes: 10 additions & 4 deletions tests/scheduler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import {afterEach, describe, expect, test} from "bun:test";
import {mkdir, mkdtemp, readFile, rm, writeFile} from "node:fs/promises";
import {tmpdir} from "node:os";
import path from "node:path";
import type {ExtensionContext, ExtensionTaskSpec} from "../sdk/index.ts";
import type {ExtensionContext, ExtensionTaskSpec} from "@notmike101/zcode-extension-sdk/main";
import {SchedulerPlugin} from "../src/main.ts";

type LegacySchedulerContext = Omit<ExtensionContext, "zcode"> & {
zcode: Pick<ExtensionContext["zcode"], "readWorkspaceState"> & {
tasks: Pick<ExtensionContext["zcode"]["tasks"], "run" | "ensureVisible">;
};
};

const roots: string[] = [];
const jobId = "6a1d0f7a-8eef-47aa-8638-3f2629ea1d5d";

Expand Down Expand Up @@ -118,12 +124,12 @@ function createContext(dataDir: string) {
warn: async () => undefined,
error: async () => undefined,
};
const context: ExtensionContext = {
const context: LegacySchedulerContext = {
manifest: {
apiVersion: 1,
id: "scheduler",
name: "Scheduler",
version: "0.1.3",
version: "0.1.4",
entrypoints: {},
engines: {host: ">=0.2.0 <1", zcode: ">=3.3.6"},
pages: [{id: "jobs", title: "Scheduler"}],
Expand All @@ -146,7 +152,7 @@ function createContext(dataDir: string) {
},
},
};
return {context, handlers, runs, visible, finish: resolveCompletion};
return {context: context as unknown as ExtensionContext, handlers, runs, visible, finish: resolveCompletion};
}

async function eventually(predicate: () => boolean | Promise<boolean>): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"jsxImportSource": "preact",
"types": ["bun", "node"]
},
"include": ["src/**/*.ts", "src/**/*.tsx", "sdk/**/*.ts", "scripts/**/*.ts", "tests/**/*.ts"]
"include": ["src/**/*.ts", "src/**/*.tsx", "scripts/**/*.ts", "tests/**/*.ts"]
}