@zero2webmaster/starter-kit 0.4.0 → 0.5.1
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.
- package/README.md +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/scaffolders/cf-worker.js +56 -1
- package/dist/scaffolders/common.js +1 -0
- package/dist/standards.d.ts +1 -1
- package/dist/standards.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.5.1 | **Framework:** 2.13.0
|
|
4
4
|
|
|
5
5
|
> Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
|
|
6
6
|
|
|
@@ -99,4 +99,4 @@ For licensing inquiries: kerry@zero2webmaster.com.
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
101
|
*Scaffolded 2026-05-28 via the [[instantiate-z2w-project]] Claude Code skill v1; reconciled against the consolidated skill v1.1.0 (brief-first + Agent Coordination block) on 2026-05-29.*
|
|
102
|
-
*Version: 0.
|
|
102
|
+
*Version: 0.5.1 | Last Updated: 2026-07-22*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeScaffold } from "./writer.js";
|
|
2
2
|
import type { ScaffoldFile } from "./scaffolders/common.js";
|
|
3
3
|
import type { StandardDecision } from "./standards.js";
|
|
4
|
-
export declare const version = "0.
|
|
4
|
+
export declare const version = "0.5.1";
|
|
5
5
|
export type ProjectType = "wp-plugin" | "cf-worker" | "cf-pages" | "nextjs" | "python-service" | "node-service" | "library" | "protocol-repo";
|
|
6
6
|
export type BrandPreset = "save-the-frogs" | "bansuri-bliss" | "zero2webmaster" | "custom";
|
|
7
7
|
export type DbStrategy = "none" | "neon-postgres" | "supabase" | "sqlite" | "mysql-wp" | "other";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import * as path from "node:path";
|
|
|
21
21
|
import { Writable } from "node:stream";
|
|
22
22
|
import { isValidSlug } from "./parse-brief.js";
|
|
23
23
|
import { writeScaffold } from "./writer.js";
|
|
24
|
-
export const version = "0.
|
|
24
|
+
export const version = "0.5.1";
|
|
25
25
|
// Canonical enum value-arrays. These live here, next to the type unions they
|
|
26
26
|
// enumerate, so both the CLI's confirm/wizard flows (which re-export them) and
|
|
27
27
|
// the programmatic `validateScaffoldInputs` share one source of truth. Keep
|
|
@@ -22,6 +22,8 @@ npx wrangler deploy # deploy to Cloudflare
|
|
|
22
22
|
**Secrets:** local secrets live in \`.dev.vars\` (gitignored). Production secrets via \`wrangler secret put\`.
|
|
23
23
|
|
|
24
24
|
**Observability:** enabled in \`wrangler.jsonc\`.
|
|
25
|
+
|
|
26
|
+
**Tests:** \`npm test\` runs vitest against the Worker's fetch handler (a sample test in \`src/index.test.ts\` asserts the DB-free \`/health\` contract + a 404 fallback). These are **plain vitest** unit tests over the handler — they run on Node's global \`Request\`/\`Response\`, no \`workerd\` runtime needed. Once the Worker binds KV / Durable Objects / D1 / R2 that must be exercised in the real runtime, graduate to \`@cloudflare/vitest-pool-workers\`.
|
|
25
27
|
`;
|
|
26
28
|
const WRANGLER_TEMPLATE = `{
|
|
27
29
|
"$schema": "node_modules/wrangler/config-schema.json",
|
|
@@ -64,15 +66,66 @@ const PACKAGE_JSON_TEMPLATE = `{
|
|
|
64
66
|
"scripts": {
|
|
65
67
|
"dev": "wrangler dev",
|
|
66
68
|
"deploy": "wrangler deploy",
|
|
67
|
-
"typecheck": "tsc --noEmit"
|
|
69
|
+
"typecheck": "tsc --noEmit",
|
|
70
|
+
"test": "vitest run",
|
|
71
|
+
"test:watch": "vitest"
|
|
68
72
|
},
|
|
69
73
|
"devDependencies": {
|
|
70
74
|
"@cloudflare/workers-types": "^5.20260714.1",
|
|
71
75
|
"typescript": "^5.4.0",
|
|
76
|
+
"vitest": "^4.1.0",
|
|
72
77
|
"wrangler": "^4.112.0"
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
`;
|
|
81
|
+
// Plain vitest over the fetch handler (NOT @cloudflare/vitest-pool-workers).
|
|
82
|
+
// The Worker's routing + DB-free /health logic is pure Request→Response and runs
|
|
83
|
+
// on Node 20+'s global Request/Response/URL, so it needs no workerd runtime — the
|
|
84
|
+
// lightest thing that lets a fresh scaffold pass `npm test` out of the box,
|
|
85
|
+
// matching the node-service / library pattern. Include only src test files; the
|
|
86
|
+
// deployed bundle (main = src/index.ts) never imports them, so they're excluded
|
|
87
|
+
// from `wrangler deploy` automatically.
|
|
88
|
+
const VITEST_CONFIG_TEMPLATE = `import { defineConfig } from "vitest/config";
|
|
89
|
+
|
|
90
|
+
export default defineConfig({
|
|
91
|
+
test: {
|
|
92
|
+
include: ["src/**/*.test.ts"],
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
`;
|
|
96
|
+
// Sample test proving a brand-new cf-worker scaffold is green on first `npm test`.
|
|
97
|
+
// tsconfig already sets skipLibCheck, so vitest's own types resolve without
|
|
98
|
+
// pulling in @types/node (which would collide with @cloudflare/workers-types on
|
|
99
|
+
// the global Request/Response). The handler is imported and driven directly.
|
|
100
|
+
const SRC_INDEX_TEST_TEMPLATE = `// Smoke test for the {{slug}} Worker fetch handler.
|
|
101
|
+
//
|
|
102
|
+
// Plain vitest (Node), not @cloudflare/vitest-pool-workers: the /health and 404
|
|
103
|
+
// paths are pure Request→Response and read neither bindings nor the execution
|
|
104
|
+
// context, so Node's global Request/Response is enough. If this Worker later
|
|
105
|
+
// binds KV / Durable Objects / D1 / R2 (or reads \`cf\` request properties) that
|
|
106
|
+
// must run in the real runtime, graduate to @cloudflare/vitest-pool-workers.
|
|
107
|
+
|
|
108
|
+
import { describe, expect, it } from "vitest";
|
|
109
|
+
|
|
110
|
+
import worker, { type Env } from "./index";
|
|
111
|
+
|
|
112
|
+
// Minimal stand-ins — the routes under test touch neither.
|
|
113
|
+
const env = {} as Env;
|
|
114
|
+
const ctx = {} as ExecutionContext;
|
|
115
|
+
|
|
116
|
+
describe("{{slug}} Worker fetch handler", () => {
|
|
117
|
+
it("GET /health returns 200 {status: ok} without touching the database", async () => {
|
|
118
|
+
const res = await worker.fetch(new Request("https://example.com/health"), env, ctx);
|
|
119
|
+
expect(res.status).toBe(200);
|
|
120
|
+
expect(await res.json()).toEqual({ status: "ok" });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("unknown routes return 404", async () => {
|
|
124
|
+
const res = await worker.fetch(new Request("https://example.com/nope"), env, ctx);
|
|
125
|
+
expect(res.status).toBe(404);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
`;
|
|
76
129
|
const TSCONFIG_TEMPLATE = `{
|
|
77
130
|
"compilerOptions": {
|
|
78
131
|
"target": "ES2022",
|
|
@@ -103,8 +156,10 @@ export function scaffoldCfWorker(inputs, opts) {
|
|
|
103
156
|
const typeSpecific = [
|
|
104
157
|
{ path: "wrangler.jsonc", content: sub(WRANGLER_TEMPLATE, inputs, opts, spec) },
|
|
105
158
|
{ path: "src/index.ts", content: sub(SRC_INDEX_TEMPLATE, inputs, opts, spec) },
|
|
159
|
+
{ path: "src/index.test.ts", content: sub(SRC_INDEX_TEST_TEMPLATE, inputs, opts, spec) },
|
|
106
160
|
{ path: "package.json", content: sub(PACKAGE_JSON_TEMPLATE, inputs, opts, spec) },
|
|
107
161
|
{ path: "tsconfig.json", content: sub(TSCONFIG_TEMPLATE, inputs, opts, spec) },
|
|
162
|
+
{ path: "vitest.config.ts", content: sub(VITEST_CONFIG_TEMPLATE, inputs, opts, spec) },
|
|
108
163
|
{ path: ".dev.vars", content: sub(DEV_VARS_TEMPLATE, inputs, opts, spec) },
|
|
109
164
|
];
|
|
110
165
|
return [...base, ...typeSpecific];
|
package/dist/standards.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface StandardsResolution {
|
|
|
51
51
|
* family — the safe default for anything else with `has_web_ui=true`.
|
|
52
52
|
*/
|
|
53
53
|
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
54
|
-
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
54
|
+
export declare const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.14";
|
|
55
55
|
/**
|
|
56
56
|
* Resolve which standards apply to `inputs` and render the standards markdown
|
|
57
57
|
* body suitable for `.replace()`-ing into the `<!-- STANDARDS_BLOCK -->`
|
package/dist/standards.js
CHANGED
|
@@ -311,7 +311,7 @@ const NEON_CAREFUL_BODY = `### Neon-careful (Neon Postgres)
|
|
|
311
311
|
// `zero2webmaster/z2w-agent-coordination`'s AGENT_PROTOCOL.md when the embedded
|
|
312
312
|
// block's mechanics change (drift-detection Signal A greps for this exact token).
|
|
313
313
|
// When you sync a newer canonical block below, bump this to match its comment.
|
|
314
|
-
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.
|
|
314
|
+
export const CANONICAL_COORDINATION_BLOCK_VERSION = "v0.1.14";
|
|
315
315
|
/**
|
|
316
316
|
* The Agent Coordination section, emitted as its own TOP-LEVEL `## Agent
|
|
317
317
|
* Coordination` section (NOT a `###` standards subsection). The bulk is the
|
|
@@ -359,6 +359,7 @@ This project participates in the Z2W cross-project coordination bulletin.
|
|
|
359
359
|
- **Updating the bulletin at session end is a MANDATORY standing wrap step — never a question you put to Kerry (v0.1.11).** It ranks with committing your code, not with optional extras. Do NOT end a session by asking *"want me to update the bulletin too?"* or *"that wasn't in your wrap list — say the word"* — decide with the two tiers below and just do it. The one and only time you skip is a purely read-only / conversational session that changed no files and no project state — and even then you **skip silently, you do not ask**. (Kerry, 2026-07-05: *"they should know to either do it or not do it"* — this rule is that decision, made once, so no agent defers it back to him.)
|
|
360
360
|
- **Tier 1 — ALWAYS (any session that did real work on this project):** rewrite \`## Current focus\` in place — one short paragraph (or 1–3 bullets) of what this project is working on right now, stamped with the current date + session id — and add/close your \`## Active sessions\` entry. It is the field the \`agents.z2w.us\` dashboard reads: a stale timestamp signals "agent ran but said nothing."
|
|
361
361
|
- **Tier 2 — ADDITIONALLY, only if the session shipped code or changed project state:** add a \`## Recent commits\` entry and append any new heads-ups / \`[→ {project}]\` / \`[→ Kerry]\` items.
|
|
362
|
+
- **Keep \`## Integrations\` + your Live status current — a never-ask standing step, exactly like \`## Current focus\` (v0.1.14).** If this session changed how this project relates to another Z2W app — it started consuming an engine/service, stopped using one, or became a provider another app now depends on — update your file's \`## Integrations\` edges. If the project's lifecycle changed — scaffolded → live in prod, went dormant, retired — update the **Live status** line and its date. This is the capture mechanism behind the ecosystem dependency map + live-status badges on \`agents.z2w.us\`; a stale edge or status silently misleads every other agent (real 2026-07-20 miss: an audit called a LIVE engine "unbuilt" because no single place recorded its status). Decide and do it — do not ask. Absent section = nothing to report yet; create it lazily the first time you have an edge or a status to record. Schema + conventions in §8.10.
|
|
362
363
|
- **Size discipline (v0.1.11):** before appending, if \`projects/{this-project}.md\` is approaching ~200 KB, trim FIRST — archive old \`## Active sessions\` and \`## Recent commits\` entries and resolved \`## Open questions\` threads into \`projects/{this-project}-archive.md\` (a separate, commit-flagged operation). \`## Current focus\` is rewritten in place (never appended).
|
|
363
364
|
- \`git commit -m "{this-project}: {summary}"\` (see §8.2 for agent-identifier format) and \`git push\`.
|
|
364
365
|
- If push fails due to concurrent write from another session: \`git pull --rebase\`, resolve any conflicts, retry push.
|