@zero2webmaster/starter-kit 0.1.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.
- package/LICENSE +38 -0
- package/README.md +89 -0
- package/dist/brand.d.ts +72 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +198 -0
- package/dist/brand.js.map +1 -0
- package/dist/brief.d.ts +14 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +47 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +82 -0
- package/dist/cli.js.map +1 -0
- package/dist/confirm.d.ts +45 -0
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +382 -0
- package/dist/confirm.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/parse-brief.d.ts +32 -0
- package/dist/parse-brief.d.ts.map +1 -0
- package/dist/parse-brief.js +298 -0
- package/dist/parse-brief.js.map +1 -0
- package/dist/scaffolders/cf-pages.d.ts +9 -0
- package/dist/scaffolders/cf-pages.d.ts.map +1 -0
- package/dist/scaffolders/cf-pages.js +259 -0
- package/dist/scaffolders/cf-pages.js.map +1 -0
- package/dist/scaffolders/cf-worker.d.ts +4 -0
- package/dist/scaffolders/cf-worker.d.ts.map +1 -0
- package/dist/scaffolders/cf-worker.js +112 -0
- package/dist/scaffolders/cf-worker.js.map +1 -0
- package/dist/scaffolders/common.d.ts +39 -0
- package/dist/scaffolders/common.d.ts.map +1 -0
- package/dist/scaffolders/common.js +441 -0
- package/dist/scaffolders/common.js.map +1 -0
- package/dist/scaffolders/index.d.ts +18 -0
- package/dist/scaffolders/index.d.ts.map +1 -0
- package/dist/scaffolders/index.js +40 -0
- package/dist/scaffolders/index.js.map +1 -0
- package/dist/scaffolders/library.d.ts +4 -0
- package/dist/scaffolders/library.d.ts.map +1 -0
- package/dist/scaffolders/library.js +122 -0
- package/dist/scaffolders/library.js.map +1 -0
- package/dist/scaffolders/nextjs.d.ts +10 -0
- package/dist/scaffolders/nextjs.d.ts.map +1 -0
- package/dist/scaffolders/nextjs.js +395 -0
- package/dist/scaffolders/nextjs.js.map +1 -0
- package/dist/scaffolders/protocol-repo.d.ts +4 -0
- package/dist/scaffolders/protocol-repo.d.ts.map +1 -0
- package/dist/scaffolders/protocol-repo.js +162 -0
- package/dist/scaffolders/protocol-repo.js.map +1 -0
- package/dist/scaffolders/python-service.d.ts +4 -0
- package/dist/scaffolders/python-service.d.ts.map +1 -0
- package/dist/scaffolders/python-service.js +144 -0
- package/dist/scaffolders/python-service.js.map +1 -0
- package/dist/scaffolders/wp-plugin.d.ts +4 -0
- package/dist/scaffolders/wp-plugin.d.ts.map +1 -0
- package/dist/scaffolders/wp-plugin.js +268 -0
- package/dist/scaffolders/wp-plugin.js.map +1 -0
- package/dist/standards.d.ts +65 -0
- package/dist/standards.d.ts.map +1 -0
- package/dist/standards.js +335 -0
- package/dist/standards.js.map +1 -0
- package/dist/substitute.d.ts +37 -0
- package/dist/substitute.d.ts.map +1 -0
- package/dist/substitute.js +98 -0
- package/dist/substitute.js.map +1 -0
- package/dist/summary.d.ts +20 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +191 -0
- package/dist/summary.js.map +1 -0
- package/dist/templates.d.ts +30 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +123 -0
- package/dist/templates.js.map +1 -0
- package/dist/wizard.d.ts +12 -0
- package/dist/wizard.d.ts.map +1 -0
- package/dist/wizard.js +158 -0
- package/dist/wizard.js.map +1 -0
- package/dist/writer.d.ts +62 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +367 -0
- package/dist/writer.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Scaffolder: `protocol-repo` — markdown-only coordination/spec repo.
|
|
2
|
+
//
|
|
3
|
+
// A protocol-repo's content IS the deliverable — SOPs, shared specs,
|
|
4
|
+
// agent-coordination bulletins, internal protocols. No deploy target, no web
|
|
5
|
+
// surface, no analytics, no monitoring. Strictly private GitHub repo + .md.
|
|
6
|
+
//
|
|
7
|
+
// Per SKILL.md "protocol-repo" type characteristics:
|
|
8
|
+
// - `has_web_ui` is forced no.
|
|
9
|
+
// - Skip Fathom (no web surface), Uptime Kuma (no /health), portable-stack
|
|
10
|
+
// web-runtime advice (N/A).
|
|
11
|
+
// - KEEP: readability rule, "no secrets, ever" hard rule.
|
|
12
|
+
//
|
|
13
|
+
// The repo MUST be created with `gh repo create ... --visibility private`
|
|
14
|
+
// (instructed in the final summary).
|
|
15
|
+
//
|
|
16
|
+
// Overrides `commonBaseFiles` for README (the README IS the authoritative
|
|
17
|
+
// design doc, not a marketing summary) and CHANGELOG (markdown-only repos
|
|
18
|
+
// version less formally — but still get one for parity).
|
|
19
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
20
|
+
const NARRATIVE = `## What this is
|
|
21
|
+
|
|
22
|
+
\`{{slug}}\` is a Z2W **protocol-repo** — a coordination / specification repo whose content IS the deliverable. Markdown-only. No deploy. No analytics. No monitoring. No web surface.
|
|
23
|
+
|
|
24
|
+
**Hard rules:**
|
|
25
|
+
|
|
26
|
+
- **Private repo only.** Run \`gh repo create {{github_org}}/{{slug}} --visibility private\` after the first commit; do NOT make it public.
|
|
27
|
+
- **No secrets, ever.** Operational metadata only. Detect-and-redact on \`sk_*\`, \`pk_*\`, \`rk_*\`, \`whsec_*\`, \`xoxb-*\`, \`tbl[A-Za-z0-9]{14}\`, \`pat_*\`, etc.
|
|
28
|
+
- **Never edit another project's file directly.** Cross-project signaling goes via \`[→ {their-project}]\` prefixes in the target's "Open questions" section.
|
|
29
|
+
- **Append-only within sections.** Trimming expired entries is a separate operation flagged in the commit message.
|
|
30
|
+
|
|
31
|
+
**Quick start for contributors:**
|
|
32
|
+
|
|
33
|
+
\`\`\`bash
|
|
34
|
+
# Pull latest before editing:
|
|
35
|
+
git pull --ff-only
|
|
36
|
+
|
|
37
|
+
# Edit your project's file in projects/<your-slug>.md
|
|
38
|
+
# Commit with: {your-slug}: <summary>
|
|
39
|
+
git push
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
If a viewing mirror is genuinely needed in the future, it belongs as a SEPARATE follow-on \`cf-pages\` project (gated by CF Access). NOT in this repo.
|
|
43
|
+
`;
|
|
44
|
+
const PROTOCOL_README_TEMPLATE = `# {{slug}}
|
|
45
|
+
|
|
46
|
+
> {{description}}
|
|
47
|
+
|
|
48
|
+
**Type:** protocol-repo (markdown-only; no deploy)
|
|
49
|
+
**Repo:** \`{{github_org}}/{{slug}}\` (private)
|
|
50
|
+
**Author:** {{author}}
|
|
51
|
+
**Created:** {{date}}
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## What this repo is
|
|
56
|
+
|
|
57
|
+
[TODO — fill in the authoritative design / spec for this protocol-repo. This README is the design document, not a marketing summary. If a prior design directive exists in another project's \`directives/\`, copy it here verbatim.]
|
|
58
|
+
|
|
59
|
+
## How consumers use it
|
|
60
|
+
|
|
61
|
+
Each consumer agent in the Z2W ecosystem reads this repo via \`gh api repos/{{github_org}}/{{slug}}/contents/<file>.md\` or \`git clone\`. Auth = each consumer's existing \`gh\` CLI auth — zero new credentials.
|
|
62
|
+
|
|
63
|
+
## File layout
|
|
64
|
+
|
|
65
|
+
- \`README.md\` (this file) — authoritative spec
|
|
66
|
+
- \`AGENT_PROTOCOL.md\` — live protocol document consumers follow
|
|
67
|
+
- \`projects/\` — per-consumer data files (one .md per participating project)
|
|
68
|
+
- \`global.md\` — cross-cutting content
|
|
69
|
+
|
|
70
|
+
## Conventions
|
|
71
|
+
|
|
72
|
+
- Append-only within sections; trimming is a separate, flagged commit.
|
|
73
|
+
- Cross-project signals: \`[→ {their-project}]\` prefix in the target's "Open questions" section.
|
|
74
|
+
- Commit format: \`{{slug}}: {summary}\` (or the participating project's slug if the commit is project-scoped).
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
*Scaffolded {{date}} via \`@zero2webmaster/starter-kit\`.*
|
|
79
|
+
`;
|
|
80
|
+
const PROTOCOL_DOC_TEMPLATE = `# {{slug}} — Protocol
|
|
81
|
+
|
|
82
|
+
**Version:** {{version}}
|
|
83
|
+
**Last updated:** {{date}}
|
|
84
|
+
|
|
85
|
+
This document defines the live protocol consumers of \`{{slug}}\` follow. The README.md captures the design rationale; this file captures the rules.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## §1 — Purpose
|
|
90
|
+
|
|
91
|
+
[TODO — describe what problem this protocol solves.]
|
|
92
|
+
|
|
93
|
+
## §2 — Participating projects
|
|
94
|
+
|
|
95
|
+
[TODO — list which Z2W projects are participants in this protocol, and how they're identified.]
|
|
96
|
+
|
|
97
|
+
## §3 — File format
|
|
98
|
+
|
|
99
|
+
[TODO — describe the per-project file schema.]
|
|
100
|
+
|
|
101
|
+
## §4 — Mechanics
|
|
102
|
+
|
|
103
|
+
[TODO — describe session-start / during-session / session-end mechanics.]
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
*This is a living protocol document. Bump the version when the schema or mechanics change.*
|
|
108
|
+
`;
|
|
109
|
+
const GLOBAL_MD_TEMPLATE = `# {{slug}} — Global
|
|
110
|
+
|
|
111
|
+
**Last updated:** {{date}}
|
|
112
|
+
|
|
113
|
+
This file holds cross-project signals that affect 2+ participating projects, or any policy change. Single-project signals belong in \`projects/<slug>.md\`, not here.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Active sessions (last 48h)
|
|
118
|
+
|
|
119
|
+
*(none)*
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Open questions (awaiting response)
|
|
124
|
+
|
|
125
|
+
*(none)*
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Heads-ups for other agents
|
|
130
|
+
|
|
131
|
+
*(none)*
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Cross-project decisions
|
|
136
|
+
|
|
137
|
+
*(none yet)*
|
|
138
|
+
`;
|
|
139
|
+
const PROJECTS_KEEP_TEMPLATE = `# Per-project files
|
|
140
|
+
|
|
141
|
+
This directory holds one markdown file per participating Z2W project. Each consumer agent maintains its own file (\`projects/<their-slug>.md\`) and reads other projects' files for cross-project signals.
|
|
142
|
+
|
|
143
|
+
Bootstrap a new project file by copying the schema from any existing one, or from the AGENT_PROTOCOL.md mini-template if one is defined.
|
|
144
|
+
`;
|
|
145
|
+
export function scaffoldProtocolRepo(inputs, opts) {
|
|
146
|
+
const spec = resolveBrandSpec(inputs);
|
|
147
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
148
|
+
// Override the generic README with the protocol-repo authoritative-design README.
|
|
149
|
+
const baseOverridden = base.map((file) => file.path === "README.md"
|
|
150
|
+
? { path: "README.md", content: sub(PROTOCOL_README_TEMPLATE, inputs, opts, spec) }
|
|
151
|
+
: file);
|
|
152
|
+
const typeSpecific = [
|
|
153
|
+
{
|
|
154
|
+
path: "AGENT_PROTOCOL.md",
|
|
155
|
+
content: sub(PROTOCOL_DOC_TEMPLATE, inputs, opts, spec),
|
|
156
|
+
},
|
|
157
|
+
{ path: "global.md", content: sub(GLOBAL_MD_TEMPLATE, inputs, opts, spec) },
|
|
158
|
+
{ path: "projects/README.md", content: PROJECTS_KEEP_TEMPLATE },
|
|
159
|
+
];
|
|
160
|
+
return [...baseOverridden, ...typeSpecific];
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=protocol-repo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-repo.js","sourceRoot":"","sources":["../../src/scaffolders/protocol-repo.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,qEAAqE;AACrE,6EAA6E;AAC7E,4EAA4E;AAC5E,EAAE;AACF,qDAAqD;AACrD,iCAAiC;AACjC,6EAA6E;AAC7E,gCAAgC;AAChC,4DAA4D;AAC5D,EAAE;AACF,0EAA0E;AAC1E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,yDAAyD;AAIzD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,GAAG,GAGJ,MAAM,aAAa,CAAC;AAErB,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBjB,CAAC;AAEF,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChC,CAAC;AAEF,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B7B,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6B1B,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;CAK9B,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAClC,MAAsB,EACtB,IAAwB;IAExB,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACtD,kFAAkF;IAClF,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACvC,IAAI,CAAC,IAAI,KAAK,WAAW;QACvB,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,wBAAwB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QACnF,CAAC,CAAC,IAAI,CACT,CAAC;IACF,MAAM,YAAY,GAAmB;QACnC;YACE,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,GAAG,CAAC,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACxD;QACD,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC3E,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,sBAAsB,EAAE;KAChE,CAAC;IACF,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,YAAY,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldPythonService(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
//# sourceMappingURL=python-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-service.d.ts","sourceRoot":"","sources":["../../src/scaffolders/python-service.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAmHrB,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CA4BhB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Scaffolder: `python-service` — FastAPI service with DB-free `/health`.
|
|
2
|
+
//
|
|
3
|
+
// Per [[neon-postgres]], the `/health` endpoint MUST NOT touch the database
|
|
4
|
+
// even when `db_strategy=neon-postgres`. This scaffolder ships a `/health`
|
|
5
|
+
// that returns `{"status": "ok"}` unconditionally; if a deeper readiness
|
|
6
|
+
// check is needed, add a `/health/deep` per the neon-careful pattern.
|
|
7
|
+
//
|
|
8
|
+
// NOT subject to SEO baseline (API-only service, no public HTML surface).
|
|
9
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
10
|
+
const NARRATIVE = `## What this is
|
|
11
|
+
|
|
12
|
+
\`{{slug}}\` is a Python FastAPI service scaffolded under the {{brand_name}} brand. API-only — no public HTML surface, no SEO baseline.
|
|
13
|
+
|
|
14
|
+
**Quick start for contributors:**
|
|
15
|
+
|
|
16
|
+
\`\`\`bash
|
|
17
|
+
python3 -m venv .venv
|
|
18
|
+
source .venv/bin/activate
|
|
19
|
+
pip install -e .[dev] # or: pip install -r requirements.txt
|
|
20
|
+
uvicorn {{slug_under}}.main:app --reload
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
**Health endpoint:** \`GET /health\` returns \`{"status": "ok"}\`. **Do NOT** make this endpoint touch the database — per [[neon-postgres]], routine probes burn through Neon Free's CU-hour quota.
|
|
24
|
+
|
|
25
|
+
**Deployment:** any Python WSGI/ASGI host (Cloud Run, Fly.io, Render, Railway). Per [[portable-stack]], avoid host-branded SDKs.
|
|
26
|
+
`;
|
|
27
|
+
const PYPROJECT_TEMPLATE = `[project]
|
|
28
|
+
name = "{{slug}}"
|
|
29
|
+
version = "{{version}}"
|
|
30
|
+
description = "{{description}}"
|
|
31
|
+
authors = [
|
|
32
|
+
{ name = "{{author}}", url = "{{author_url}}" },
|
|
33
|
+
]
|
|
34
|
+
readme = "README.md"
|
|
35
|
+
requires-python = ">=3.11"
|
|
36
|
+
dependencies = [
|
|
37
|
+
"fastapi>=0.115",
|
|
38
|
+
"uvicorn[standard]>=0.30",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8",
|
|
44
|
+
"httpx>=0.27",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[build-system]
|
|
48
|
+
requires = ["setuptools>=68", "wheel"]
|
|
49
|
+
build-backend = "setuptools.build_meta"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.packages.find]
|
|
52
|
+
where = ["src"]
|
|
53
|
+
`;
|
|
54
|
+
const REQUIREMENTS_TEMPLATE = `# Pinned runtime dependencies for {{slug}}.
|
|
55
|
+
# Prefer \`pyproject.toml\` for new code; this file exists for hosts that
|
|
56
|
+
# only consume \`requirements.txt\`.
|
|
57
|
+
|
|
58
|
+
fastapi>=0.115
|
|
59
|
+
uvicorn[standard]>=0.30
|
|
60
|
+
`;
|
|
61
|
+
const MAIN_PY_TEMPLATE = `"""{{slug}} — FastAPI entry point.
|
|
62
|
+
|
|
63
|
+
{{description}}
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
from fastapi import FastAPI
|
|
67
|
+
|
|
68
|
+
app = FastAPI(title="{{slug}}", version="{{version}}")
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@app.get("/health")
|
|
72
|
+
def health() -> dict[str, str]:
|
|
73
|
+
"""DB-free health endpoint.
|
|
74
|
+
|
|
75
|
+
Per [[neon-postgres]], do NOT add a database roundtrip here. Routine
|
|
76
|
+
probes from uptime monitors (per [[uptime-kuma-monitor]]) burn through
|
|
77
|
+
Neon Free's 100 CU-hour monthly quota. If a deeper readiness check is
|
|
78
|
+
needed, add a separate \`/health/deep\` endpoint with explicit budget.
|
|
79
|
+
"""
|
|
80
|
+
return {"status": "ok"}
|
|
81
|
+
`;
|
|
82
|
+
const INIT_PY_TEMPLATE = `"""{{slug}} — top-level package."""
|
|
83
|
+
|
|
84
|
+
__version__ = "{{version}}"
|
|
85
|
+
`;
|
|
86
|
+
const CONFTEST_TEMPLATE = `"""Test fixtures for {{slug}}."""
|
|
87
|
+
|
|
88
|
+
import pytest
|
|
89
|
+
from fastapi.testclient import TestClient
|
|
90
|
+
|
|
91
|
+
from {{slug_under}}.main import app
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@pytest.fixture
|
|
95
|
+
def client() -> TestClient:
|
|
96
|
+
return TestClient(app)
|
|
97
|
+
`;
|
|
98
|
+
const TEST_HEALTH_TEMPLATE = `"""Smoke test for the DB-free /health endpoint."""
|
|
99
|
+
|
|
100
|
+
from fastapi.testclient import TestClient
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_health_returns_ok(client: TestClient) -> None:
|
|
104
|
+
response = client.get("/health")
|
|
105
|
+
assert response.status_code == 200
|
|
106
|
+
assert response.json() == {"status": "ok"}
|
|
107
|
+
`;
|
|
108
|
+
const ENV_EXAMPLE_TEMPLATE = `# {{slug}} — example environment variables.
|
|
109
|
+
# Copy to \`.env\` and fill in real values. Do NOT commit \`.env\`.
|
|
110
|
+
|
|
111
|
+
# Database URL (only if db_strategy is non-none). For Neon Postgres, use the
|
|
112
|
+
# pooled connection string per [[neon-postgres]].
|
|
113
|
+
# DATABASE_URL=postgresql://user:pass@host/db
|
|
114
|
+
`;
|
|
115
|
+
export function scaffoldPythonService(inputs, opts) {
|
|
116
|
+
const spec = resolveBrandSpec(inputs);
|
|
117
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
118
|
+
const typeSpecific = [
|
|
119
|
+
{ path: "pyproject.toml", content: sub(PYPROJECT_TEMPLATE, inputs, opts, spec) },
|
|
120
|
+
{
|
|
121
|
+
path: "requirements.txt",
|
|
122
|
+
content: sub(REQUIREMENTS_TEMPLATE, inputs, opts, spec),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
path: `src/${inputs.slug.replace(/-/g, "_")}/main.py`,
|
|
126
|
+
content: sub(MAIN_PY_TEMPLATE, inputs, opts, spec),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
path: `src/${inputs.slug.replace(/-/g, "_")}/__init__.py`,
|
|
130
|
+
content: sub(INIT_PY_TEMPLATE, inputs, opts, spec),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
path: "tests/conftest.py",
|
|
134
|
+
content: sub(CONFTEST_TEMPLATE, inputs, opts, spec),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
path: "tests/test_health.py",
|
|
138
|
+
content: sub(TEST_HEALTH_TEMPLATE, inputs, opts, spec),
|
|
139
|
+
},
|
|
140
|
+
{ path: ".env.example", content: sub(ENV_EXAMPLE_TEMPLATE, inputs, opts, spec) },
|
|
141
|
+
];
|
|
142
|
+
return [...base, ...typeSpecific];
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=python-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-service.js","sourceRoot":"","sources":["../../src/scaffolders/python-service.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,yEAAyE;AACzE,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAI1E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,GAAG,GAGJ,MAAM,aAAa,CAAC;AAErB,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0B1B,CAAC;AAEF,MAAM,qBAAqB,GAAG;;;;;;CAM7B,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;CAGxB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;CAWzB,CAAC;AAEF,MAAM,oBAAoB,GAAG;;;;;;;;;CAS5B,CAAC;AAEF,MAAM,oBAAoB,GAAG;;;;;;CAM5B,CAAC;AAEF,MAAM,UAAU,qBAAqB,CACnC,MAAsB,EACtB,IAAwB;IAExB,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACtD,MAAM,YAAY,GAAmB;QACnC,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAChF;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,GAAG,CAAC,qBAAqB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACxD;QACD;YACE,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU;YACrD,OAAO,EAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACnD;QACD;YACE,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc;YACzD,OAAO,EAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACnD;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,GAAG,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACpD;QACD;YACE,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACvD;QACD,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,oBAAoB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;KACjF,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ScaffoldInputs } from "../index.js";
|
|
2
|
+
import { type ScaffoldFile, type ScaffolderOptions } from "./common.js";
|
|
3
|
+
export declare function scaffoldWpPlugin(inputs: ScaffoldInputs, opts?: ScaffolderOptions): ScaffoldFile[];
|
|
4
|
+
//# sourceMappingURL=wp-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-plugin.d.ts","sourceRoot":"","sources":["../../src/scaffolders/wp-plugin.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAsOrB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,iBAAiB,GACvB,YAAY,EAAE,CA0BhB"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// Scaffolder: `wp-plugin` — WordPress plugin (mirrors the
|
|
2
|
+
// [[wordpress-plugins-skill]] conventions).
|
|
3
|
+
//
|
|
4
|
+
// NOT subject to the SEO baseline standing requirement — WP sites get SEO
|
|
5
|
+
// from RankMath.
|
|
6
|
+
//
|
|
7
|
+
// Critical conventions enforced by this scaffolder:
|
|
8
|
+
// - Plugin folder name MUST equal the plugin slug (no version suffix),
|
|
9
|
+
// enforced by the host environment but reflected here in the plugin
|
|
10
|
+
// header `Plugin Name` matching the slug.
|
|
11
|
+
// - Activator + Module Loader follow the singleton pattern.
|
|
12
|
+
// - HPOS compatibility declared on `before_woocommerce_init`.
|
|
13
|
+
// - `WP_UNINSTALL_PLUGIN` guard on `uninstall.php`.
|
|
14
|
+
// - `dbDelta` stub is commented out unless `db_strategy === 'mysql-wp'`.
|
|
15
|
+
//
|
|
16
|
+
// The Local symlink is NOT created by this scaffolder — instructed in the
|
|
17
|
+
// final summary per [[symlink-safety]].
|
|
18
|
+
import { commonBaseFiles, resolveBrandSpec, sub, } from "./common.js";
|
|
19
|
+
const NARRATIVE = `## What this is
|
|
20
|
+
|
|
21
|
+
\`{{slug}}\` is a WordPress plugin scaffolded under the {{brand_name}} brand. Follows the canonical Z2W WordPress plugin pattern (see [[wordpress-plugins-skill]]).
|
|
22
|
+
|
|
23
|
+
**Quick start for contributors:**
|
|
24
|
+
|
|
25
|
+
1. Drop the plugin folder into a Local by Flywheel site's \`wp-content/plugins/\` (or symlink — see [[symlink-safety]] for the catastrophic-blast-radius rule).
|
|
26
|
+
2. Activate via WP Admin → Plugins.
|
|
27
|
+
3. Build the module registry by adding entries to \`includes/class-{{slug}}-module-loader.php\`.
|
|
28
|
+
|
|
29
|
+
**SEO:** WordPress sites get SEO from RankMath; no SEO baseline scaffolding here.
|
|
30
|
+
|
|
31
|
+
**HPOS:** WooCommerce HPOS compatibility is declared in the main plugin file.
|
|
32
|
+
|
|
33
|
+
**Update package convention (CRITICAL):** the update ZIP folder name MUST equal the plugin slug (\`{{slug}}\`) — no version suffix. The \`upgrader_source_selection\` defensive filter in the plugin file enforces this on activation.
|
|
34
|
+
`;
|
|
35
|
+
const PLUGIN_HEADER_TEMPLATE = `<?php
|
|
36
|
+
/**
|
|
37
|
+
* Plugin Name: {{slug}}
|
|
38
|
+
* Plugin URI: https://github.com/{{github_org}}/{{slug}}
|
|
39
|
+
* Description: {{description}}
|
|
40
|
+
* Version: {{version}}
|
|
41
|
+
* Requires at least: 6.4
|
|
42
|
+
* Requires PHP: 8.1
|
|
43
|
+
* Author: {{author}}
|
|
44
|
+
* Author URI: {{author_url}}
|
|
45
|
+
* License: Proprietary
|
|
46
|
+
* Text Domain: {{slug}}
|
|
47
|
+
* Domain Path: /languages
|
|
48
|
+
* WC requires at least: 8.0
|
|
49
|
+
* WC tested up to: 9.5
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
if (!defined('ABSPATH')) {
|
|
53
|
+
exit;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
define('{{slug_camel}}_VERSION', '{{version}}');
|
|
57
|
+
define('{{slug_camel}}_FILE', __FILE__);
|
|
58
|
+
define('{{slug_camel}}_PATH', plugin_dir_path(__FILE__));
|
|
59
|
+
define('{{slug_camel}}_URL', plugin_dir_url(__FILE__));
|
|
60
|
+
define('{{slug_camel}}_SLUG', '{{slug}}');
|
|
61
|
+
|
|
62
|
+
require_once {{slug_camel}}_PATH . 'includes/class-{{slug}}-activator.php';
|
|
63
|
+
require_once {{slug_camel}}_PATH . 'includes/class-{{slug}}-module-loader.php';
|
|
64
|
+
|
|
65
|
+
register_activation_hook(__FILE__, ['{{slug_camel}}_Activator', 'activate']);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Declare HPOS compatibility for WooCommerce (per [[wordpress-plugins-skill]]).
|
|
69
|
+
*/
|
|
70
|
+
add_action('before_woocommerce_init', function () {
|
|
71
|
+
if (class_exists(\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil::class)) {
|
|
72
|
+
\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil::declare_compatibility(
|
|
73
|
+
'custom_order_tables',
|
|
74
|
+
__FILE__,
|
|
75
|
+
true
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Defensive update-folder filter (per [[wordpress-plugins-skill]] CRITICAL
|
|
82
|
+
* rule). Ensures the update ZIP folder name is normalized to '{{slug}}' on
|
|
83
|
+
* upgrade so the plugin folder name stays stable across versions.
|
|
84
|
+
*/
|
|
85
|
+
add_filter('upgrader_source_selection', function ($source, $remote_source, $upgrader, $hook_extra) {
|
|
86
|
+
if (empty($hook_extra['plugin'])) {
|
|
87
|
+
return $source;
|
|
88
|
+
}
|
|
89
|
+
if (strpos($hook_extra['plugin'], '{{slug}}/') !== 0) {
|
|
90
|
+
return $source;
|
|
91
|
+
}
|
|
92
|
+
$expected = trailingslashit(dirname($source)) . '{{slug}}';
|
|
93
|
+
if ($source === $expected || ! is_dir($source)) {
|
|
94
|
+
return $source;
|
|
95
|
+
}
|
|
96
|
+
if (file_exists($expected)) {
|
|
97
|
+
global $wp_filesystem;
|
|
98
|
+
if ($wp_filesystem) {
|
|
99
|
+
$wp_filesystem->delete($expected, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (@rename($source, $expected)) {
|
|
103
|
+
return trailingslashit($expected);
|
|
104
|
+
}
|
|
105
|
+
return $source;
|
|
106
|
+
}, 10, 4);
|
|
107
|
+
|
|
108
|
+
add_action('plugins_loaded', function () {
|
|
109
|
+
{{slug_camel}}_Module_Loader::instance();
|
|
110
|
+
});
|
|
111
|
+
`;
|
|
112
|
+
const UNINSTALL_TEMPLATE = `<?php
|
|
113
|
+
/**
|
|
114
|
+
* Uninstall handler for {{slug}}.
|
|
115
|
+
* Fires when an admin clicks "Delete" on the Plugins screen.
|
|
116
|
+
*
|
|
117
|
+
* SAFETY: per [[symlink-safety]], WordPress's Delete action follows
|
|
118
|
+
* symlinks and recursively deletes the target. Symlinked development
|
|
119
|
+
* plugins should NEVER be deleted via WP Admin.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
if (!defined('WP_UNINSTALL_PLUGIN')) {
|
|
123
|
+
exit;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Clean removal stub. Add settings/option cleanup here as the plugin grows.
|
|
127
|
+
// Example:
|
|
128
|
+
// delete_option('{{slug_under}}_settings');
|
|
129
|
+
`;
|
|
130
|
+
const README_TXT_TEMPLATE = `=== {{slug}} ===
|
|
131
|
+
Contributors: kerrykriger
|
|
132
|
+
Tags: {{slug}}
|
|
133
|
+
Requires at least: 6.4
|
|
134
|
+
Tested up to: 6.6
|
|
135
|
+
Requires PHP: 8.1
|
|
136
|
+
Stable tag: {{version}}
|
|
137
|
+
License: Proprietary
|
|
138
|
+
License URI: {{author_url}}
|
|
139
|
+
WC requires at least: 8.0
|
|
140
|
+
WC tested up to: 9.5
|
|
141
|
+
|
|
142
|
+
{{description}}
|
|
143
|
+
|
|
144
|
+
== Description ==
|
|
145
|
+
|
|
146
|
+
{{description}}
|
|
147
|
+
|
|
148
|
+
== Installation ==
|
|
149
|
+
|
|
150
|
+
1. Upload the \`{{slug}}\` folder to \`/wp-content/plugins/\`.
|
|
151
|
+
2. Activate via the Plugins screen.
|
|
152
|
+
|
|
153
|
+
== Changelog ==
|
|
154
|
+
|
|
155
|
+
= {{version}} ({{date}}) =
|
|
156
|
+
* Initial scaffold via \`@zero2webmaster/starter-kit\`.
|
|
157
|
+
`;
|
|
158
|
+
const ACTIVATOR_TEMPLATE = `<?php
|
|
159
|
+
/**
|
|
160
|
+
* Activator for {{slug}}.
|
|
161
|
+
*
|
|
162
|
+
* Singleton; runs custom-table dbDelta calls on activation if the plugin
|
|
163
|
+
* carries any. {{slug}} currently has no custom tables — the dbDelta block
|
|
164
|
+
* is left as a commented stub for future extension.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
if (!defined('ABSPATH')) {
|
|
168
|
+
exit;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
class {{slug_camel}}_Activator {
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Fires from the register_activation_hook in the main plugin file.
|
|
175
|
+
*/
|
|
176
|
+
public static function activate(): void {
|
|
177
|
+
// global $wpdb;
|
|
178
|
+
// require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
|
179
|
+
// $charset_collate = $wpdb->get_charset_collate();
|
|
180
|
+
// $sql = "CREATE TABLE {\$wpdb->prefix}{{slug_under}}_examples (
|
|
181
|
+
// id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
182
|
+
// created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
183
|
+
// PRIMARY KEY (id)
|
|
184
|
+
// ) {\$charset_collate};";
|
|
185
|
+
// dbDelta($sql);
|
|
186
|
+
|
|
187
|
+
// Bump a version option so future activations can run migrations.
|
|
188
|
+
update_option('{{slug_under}}_version', {{slug_camel}}_VERSION);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
const MODULE_LOADER_TEMPLATE = `<?php
|
|
193
|
+
/**
|
|
194
|
+
* Module loader for {{slug}}.
|
|
195
|
+
*
|
|
196
|
+
* Singleton; instantiates registered modules in a fixed order. Mirrors the
|
|
197
|
+
* canonical Z2W WordPress module-loader pattern (see [[wordpress-plugins-skill]]).
|
|
198
|
+
*
|
|
199
|
+
* To add a module:
|
|
200
|
+
* 1. Drop the class file in includes/modules/
|
|
201
|
+
* 2. Add the class to the \`\$modules\` registry below
|
|
202
|
+
* 3. Add a corresponding test in tests/ModuleLoaderTest
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
if (!defined('ABSPATH')) {
|
|
206
|
+
exit;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
class {{slug_camel}}_Module_Loader {
|
|
210
|
+
|
|
211
|
+
private static ?self \$instance = null;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Module registry. Keys are stable module IDs; values are class names.
|
|
215
|
+
*/
|
|
216
|
+
private array \$modules = [
|
|
217
|
+
// 'settings' => '{{slug_camel}}_Settings',
|
|
218
|
+
];
|
|
219
|
+
|
|
220
|
+
public static function instance(): self {
|
|
221
|
+
if (self::\$instance === null) {
|
|
222
|
+
self::\$instance = new self();
|
|
223
|
+
self::\$instance->boot();
|
|
224
|
+
}
|
|
225
|
+
return self::\$instance;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private function boot(): void {
|
|
229
|
+
foreach (\$this->modules as \$id => \$class) {
|
|
230
|
+
if (class_exists(\$class)) {
|
|
231
|
+
\$class::instance();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
public function registered_modules(): array {
|
|
237
|
+
return \$this->modules;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
`;
|
|
241
|
+
export function scaffoldWpPlugin(inputs, opts) {
|
|
242
|
+
const spec = resolveBrandSpec(inputs);
|
|
243
|
+
const base = commonBaseFiles(inputs, opts, NARRATIVE);
|
|
244
|
+
const typeSpecific = [
|
|
245
|
+
{ path: `${inputs.slug}.php`, content: sub(PLUGIN_HEADER_TEMPLATE, inputs, opts, spec) },
|
|
246
|
+
{ path: "uninstall.php", content: sub(UNINSTALL_TEMPLATE, inputs, opts, spec) },
|
|
247
|
+
{ path: "readme.txt", content: sub(README_TXT_TEMPLATE, inputs, opts, spec) },
|
|
248
|
+
{
|
|
249
|
+
path: `includes/class-${inputs.slug}-activator.php`,
|
|
250
|
+
content: sub(ACTIVATOR_TEMPLATE, inputs, opts, spec),
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
path: `includes/class-${inputs.slug}-module-loader.php`,
|
|
254
|
+
content: sub(MODULE_LOADER_TEMPLATE, inputs, opts, spec),
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
path: "admin/.gitkeep",
|
|
258
|
+
content: "# Admin-side assets (css, js, views) live here.\n",
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
path: "public/.gitkeep",
|
|
262
|
+
content: "# Public-side assets (css, js) live here.\n",
|
|
263
|
+
},
|
|
264
|
+
{ path: "languages/.gitkeep", content: "# Translation files live here.\n" },
|
|
265
|
+
];
|
|
266
|
+
return [...base, ...typeSpecific];
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=wp-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wp-plugin.js","sourceRoot":"","sources":["../../src/scaffolders/wp-plugin.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,4CAA4C;AAC5C,EAAE;AACF,0EAA0E;AAC1E,iBAAiB;AACjB,EAAE;AACF,oDAAoD;AACpD,yEAAyE;AACzE,wEAAwE;AACxE,8CAA8C;AAC9C,8DAA8D;AAC9D,gEAAgE;AAChE,sDAAsD;AACtD,2EAA2E;AAC3E,EAAE;AACF,0EAA0E;AAC1E,wCAAwC;AAIxC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,GAAG,GAGJ,MAAM,aAAa,CAAC;AAErB,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;CAejB,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4E9B,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B3B,CAAC;AAEF,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiC1B,CAAC;AAEF,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD9B,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAC9B,MAAsB,EACtB,IAAwB;IAExB,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACtD,MAAM,YAAY,GAAmB;QACnC,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QACxF,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC/E,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;QAC7E;YACE,IAAI,EAAE,kBAAkB,MAAM,CAAC,IAAI,gBAAgB;YACnD,OAAO,EAAE,GAAG,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACrD;QACD;YACE,IAAI,EAAE,kBAAkB,MAAM,CAAC,IAAI,oBAAoB;YACvD,OAAO,EAAE,GAAG,CAAC,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;SACzD;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,mDAAmD;SAC7D;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,6CAA6C;SACvD;QACD,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,kCAAkC,EAAE;KAC5E,CAAC;IACF,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ProjectType, ScaffoldInputs } from "./index.js";
|
|
2
|
+
import { type SubstitutionOptions } from "./substitute.js";
|
|
3
|
+
export type StandardKey = "portable-stack" | "fathom" | "uptime-kuma" | "neon-careful" | "agent-coordination" | "seo-baseline" | "email-service" | "text-size";
|
|
4
|
+
export type StandardDecisionState = "inserted-inline" | "skipped-not-applicable";
|
|
5
|
+
export interface StandardDecision {
|
|
6
|
+
key: StandardKey;
|
|
7
|
+
title: string;
|
|
8
|
+
state: StandardDecisionState;
|
|
9
|
+
/** Why the conditional matched (or didn't). */
|
|
10
|
+
reason: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolveStandardsOptions extends SubstitutionOptions {
|
|
13
|
+
/**
|
|
14
|
+
* When true, signals the writer (ROADMAP Step 6) to run an interactive
|
|
15
|
+
* (a) inline / (b) promote-into-Templates dialog per applicable standard
|
|
16
|
+
* before the final write. The resolver itself remains pure-functional:
|
|
17
|
+
* it produces the default-(a) inline body and surfaces
|
|
18
|
+
* {@link StandardsResolution.promotePending} so the writer knows to
|
|
19
|
+
* defer for the dialog. Default false — paid subscribers shouldn't be
|
|
20
|
+
* forced through four dialogs per scaffold.
|
|
21
|
+
*/
|
|
22
|
+
promoteStandards?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface StandardsResolution {
|
|
25
|
+
/**
|
|
26
|
+
* Markdown body suitable for `.replace()`-ing into the
|
|
27
|
+
* `<!-- STANDARDS_BLOCK -->` marker that the Step 4 scaffolders emit
|
|
28
|
+
* inside CLAUDE.md. Already includes substitutions; ready to write.
|
|
29
|
+
*/
|
|
30
|
+
body: string;
|
|
31
|
+
/** One entry per standard the resolver considered (applicable or not). */
|
|
32
|
+
decisions: StandardDecision[];
|
|
33
|
+
/**
|
|
34
|
+
* True iff `opts.promoteStandards` was set. Forwarded to the writer so the
|
|
35
|
+
* interactive a/b dialog runs at the writer phase, not here.
|
|
36
|
+
*/
|
|
37
|
+
promotePending: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fathom env var name per framework. Mirrors skill v1.1.0's Step 6 conditional
|
|
41
|
+
* wording: `NEXT_PUBLIC_FATHOM_SITE_ID` for Next.js, hard-coded inline for
|
|
42
|
+
* cf-pages static HTML, `PUBLIC_FATHOM_SITE_ID` for the Vite/SvelteKit/Astro
|
|
43
|
+
* family — the safe default for anything else with `has_web_ui=true`.
|
|
44
|
+
*/
|
|
45
|
+
export declare function fathomEnvVarFor(projectType: ProjectType): string;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve which standards apply to `inputs` and render the standards markdown
|
|
48
|
+
* body suitable for `.replace()`-ing into the `<!-- STANDARDS_BLOCK -->`
|
|
49
|
+
* marker that the Step 4 scaffolders emit inside CLAUDE.md.
|
|
50
|
+
*
|
|
51
|
+
* Pure function: no filesystem reads, no time-of-day dependencies (date can
|
|
52
|
+
* be pinned via {@link ResolveStandardsOptions.date} for snapshot tests).
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveStandards(inputs: ScaffoldInputs, opts?: ResolveStandardsOptions): StandardsResolution;
|
|
55
|
+
/**
|
|
56
|
+
* Convenience: take the CLAUDE.md content emitted by a Step 4 scaffolder and
|
|
57
|
+
* replace the `<!-- STANDARDS_BLOCK -->` marker with the resolver's body.
|
|
58
|
+
* Callers that compose the standards body with the rest of the writer pipeline
|
|
59
|
+
* can use this directly; tests use it to verify the full integration end-to-end.
|
|
60
|
+
*
|
|
61
|
+
* Returns the input verbatim if the marker isn't present (so this is safe to
|
|
62
|
+
* call on any file).
|
|
63
|
+
*/
|
|
64
|
+
export declare function applyStandardsBlock(claudeMd: string, resolution: StandardsResolution): string;
|
|
65
|
+
//# sourceMappingURL=standards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standards.d.ts","sourceRoot":"","sources":["../src/standards.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,MAAM,WAAW,GACnB,gBAAgB,GAChB,QAAQ,GACR,aAAa,GACb,cAAc,GACd,oBAAoB,GACpB,cAAc,GACd,eAAe,GACf,WAAW,CAAC;AAEhB,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,wBAAwB,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,WAAW,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,qBAAqB,CAAC;IAC7B,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;CACzB;AAgJD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAMhE;AAmJD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE,uBAA4B,GACjC,mBAAmB,CAiCrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,mBAAmB,GAC9B,MAAM,CAER"}
|