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
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
validate:
name: Validate extension
runs-on: windows-latest
timeout-minutes: 15

steps:
- name: Check out source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5

- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Reject generated or private files
shell: pwsh
run: |
$tracked = @(git ls-files -- 'dist/**' 'data/**')
if ($tracked.Count -gt 0) {
$tracked | ForEach-Object { Write-Error "Generated or private path is tracked: $_" }
exit 1
}

- name: Verify release metadata
run: bun scripts/package-release.ts --verify-only

- name: Typecheck, test, and build
run: bun run check
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
name: Publish extension release
runs-on: windows-latest
timeout-minutes: 20

steps:
- name: Check out tagged source
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0

- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Verify tag and project versions
shell: pwsh
run: bun scripts/package-release.ts --verify-only --tag "$env:GITHUB_REF_NAME"

- name: Typecheck, test, and build
run: bun run check

- name: Package extension release
shell: pwsh
run: bun scripts/package-release.ts --tag "$env:GITHUB_REF_NAME"

- name: Publish immutable GitHub release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "$env:GITHUB_REF_NAME" --repo "$env:GITHUB_REPOSITORY" 2>$null
if ($LASTEXITCODE -eq 0) {
throw "Release $env:GITHUB_REF_NAME already exists; refusing to overwrite it."
}

$assets = @(Get-ChildItem "dist/release" -File)
if ($assets.Count -ne 3) {
throw "Expected ZIP, SHA-256, and extension-update.json assets; found $($assets.Count)."
}
foreach ($name in @("zcode-scheduler-$env:GITHUB_REF_NAME.zip", "zcode-scheduler-$env:GITHUB_REF_NAME.zip.sha256", "extension-update.json")) {
if (-not (Test-Path "dist/release/$name" -PathType Leaf)) { throw "Missing release asset: $name" }
}

$assetPaths = @($assets | ForEach-Object { $_.FullName })
gh release create "$env:GITHUB_REF_NAME" $assetPaths `
--repo "$env:GITHUB_REPOSITORY" `
--verify-tag `
--generate-notes `
--title "ZCode Scheduler $env:GITHUB_REF_NAME"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
coverage/
*.log
*.tsbuildinfo
4 changes: 2 additions & 2 deletions .zdp/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"apiVersion": 1,
"id": "scheduler",
"name": "Scheduler",
"version": "0.1.2",
"version": "0.1.3",
"description": "Create normal ZCode tasks from timezone-aware cron schedules while ZCode is open.",
"entrypoints": {
"main": "dist/main.cjs",
"renderer": "dist/renderer.js"
},
"engines": {
"host": ">=0.1.0 <1",
"host": ">=0.2.0 <1",
"zcode": ">=3.3.6"
},
"pages": [
Expand Down
4 changes: 4 additions & 0 deletions .zdp/update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schemaVersion": 1,
"manifestUrl": "https://github.com/notmike101/zcode-scheduler/releases/latest/download/extension-update.json"
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 notmike101

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ZCode Scheduler

Scheduler is an extension for [ZCode Desktop Extensions](https://github.com/notmike101/zcode-extensions). It creates timezone-aware recurring ZCode tasks while the desktop app is open.

Scheduled runs are ordinary persistent ZCode tasks. They appear immediately in the normal sidebar as `⏰ Job name`, can be opened while they run, remain available after completion, and archive like any other task.

## Requirements

- ZCode Desktop Extensions 0.2.0 or newer
- ZCode 3.3.6 or newer
- Windows

## Install

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**.

## Scheduling behavior

- Uses standard five-field cron expressions: minute, hour, day, month, weekday.
- Stores an IANA timezone with every job.
- Runs only while ZCode is open; missed runs are skipped.
- Supports skip, queue-one, and bounded parallel overlap policies.
- Keeps job definitions and run history in the extension's private data directory.
- Backfills retained pre-0.1.3 run sessions into the native task sidebar once when their workspace can be resolved.

## Development

```powershell
bun install
bun run check
bun run release:package -- --tag v0.1.3
```

The release command writes a ZIP, its SHA-256 checksum, and `extension-update.json` to `dist/release`.

## License

MIT
36 changes: 36 additions & 0 deletions bun.lock

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

31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "zcode-scheduler",
"version": "0.1.3",
"description": "Schedule normal, visible ZCode tasks with timezone-aware cron expressions.",
"private": true,
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/notmike101/zcode-scheduler.git"
},
"homepage": "https://github.com/notmike101/zcode-scheduler#readme",
"type": "module",
"packageManager": "bun@1.3.14",
"scripts": {
"build": "bun scripts/build.ts",
"typecheck": "tsc --noEmit",
"test": "bun test",
"check": "bun run typecheck && bun test && bun run build",
"release:package": "bun scripts/package-release.ts"
},
"dependencies": {
"croner": "^10.0.1",
"preact": "^10.27.2",
"zod": "^4.1.12"
},
"devDependencies": {
"@types/bun": "^1.3.4",
"@types/node": "^24.10.1",
"typescript": "^5.9.3"
}
}
36 changes: 36 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {mkdir, rm} from "node:fs/promises";
import path from "node:path";

const root = path.resolve(import.meta.dir, "..");
const dist = path.join(root, "dist");

await rm(dist, {recursive: true, force: true});
await mkdir(dist, {recursive: true});

await build({
entrypoints: [path.join(root, "src", "main.ts")],
outdir: dist,
target: "node",
format: "cjs",
naming: "[name].cjs",
});

await build({
entrypoints: [path.join(root, "src", "renderer.tsx")],
outdir: dist,
target: "browser",
format: "iife",
naming: "[name].js",
loader: {".css": "text"},
});

console.log(`Built Scheduler to ${dist}`);

async function build(options: Bun.BuildConfig): Promise<void> {
const result = await Bun.build({
sourcemap: "external",
minify: false,
...options,
});
if (!result.success) throw new AggregateError(result.logs, "Bun build failed");
}
Loading