editlet 0.0.0-stage → 0.1.0-alpha.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 +21 -0
- package/README.md +113 -2
- package/dist/admin/config.d.ts +22 -0
- package/dist/admin/config.js +75 -0
- package/dist/admin/dist/assets/RichEditor-BlaCRrEX.css +1 -0
- package/dist/admin/dist/assets/RichEditor-IZKdt6MK.js +42 -0
- package/dist/admin/dist/assets/blank-line-CbGzlqBI.js +1 -0
- package/dist/admin/dist/assets/channel-CljeMIwA.js +1 -0
- package/dist/admin/dist/assets/db-CCMyPgQa.js +1 -0
- package/dist/admin/dist/assets/index-CWoJh4H8.js +257 -0
- package/dist/admin/dist/assets/index-DkRMnD_M.css +1 -0
- package/dist/admin/dist/assets/mdast-util-from-markdown-C79q1_d8.js +3 -0
- package/dist/admin/dist/assets/mdast-util-gfm-cM-_xFJE.js +19 -0
- package/dist/admin/dist/assets/micromark-extension-gfm-Wz6-oszS.js +1 -0
- package/dist/admin/dist/assets/micromark-util-classify-character-BgXaGAja.js +1 -0
- package/dist/admin/dist/assets/micromark-util-html-tag-name-B61T18yC.js +1 -0
- package/dist/admin/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/admin/dist/index.html +16 -0
- package/dist/admin/dist/preview.js +1 -0
- package/dist/admin/dist/window.js +1 -0
- package/dist/astro/content.d.ts +21 -0
- package/dist/astro/content.js +235 -0
- package/dist/astro/devServer.js +89 -0
- package/dist/astro/index.d.ts +15 -0
- package/dist/astro/index.js +98 -0
- package/dist/astro/nodeBridge.js +36 -0
- package/dist/astro/shared.js +10 -0
- package/dist/astro/stub/index.html +71 -0
- package/dist/auth/client.d.ts +24 -0
- package/dist/auth/client.js +120 -0
- package/dist/auth/handler.d.ts +16 -0
- package/dist/auth/handler.js +281 -0
- package/dist/auth/protocol.d.ts +25 -0
- package/dist/auth/protocol.js +3 -0
- package/dist/core/assets.d.ts +73 -0
- package/dist/core/assets.js +405 -0
- package/dist/core/devApi.d.ts +28 -0
- package/dist/core/devApi.js +3 -0
- package/dist/core/entryFile.d.ts +13 -0
- package/dist/core/entryFile.js +81 -0
- package/dist/core/fields.js +147 -0
- package/dist/core/generate.d.ts +3 -0
- package/dist/core/generate.js +70 -0
- package/dist/core/gitStyle.d.ts +92 -0
- package/dist/core/gitStyle.js +206 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +16 -0
- package/dist/core/issues.d.ts +10 -0
- package/dist/core/issues.js +10 -0
- package/dist/core/paths.d.ts +31 -0
- package/dist/core/paths.js +114 -0
- package/dist/core/project.js +56 -0
- package/dist/core/references.d.ts +68 -0
- package/dist/core/references.js +103 -0
- package/dist/core/rename.d.ts +60 -0
- package/dist/core/rename.js +133 -0
- package/dist/core/schema.d.ts +117 -0
- package/dist/core/schema.js +299 -0
- package/dist/core/sha.d.ts +2 -0
- package/dist/core/sha.js +13 -0
- package/dist/core/source.d.ts +48 -0
- package/dist/core/source.js +57 -0
- package/dist/core/validate.d.ts +22 -0
- package/dist/core/validate.js +148 -0
- package/dist/core/walk.d.ts +23 -0
- package/dist/core/walk.js +94 -0
- package/dist/core/writes.d.ts +37 -0
- package/dist/core/writes.js +166 -0
- package/dist/github/base64.js +16 -0
- package/dist/github/cache.d.ts +34 -0
- package/dist/github/cache.js +126 -0
- package/dist/github/client.d.ts +38 -0
- package/dist/github/client.js +228 -0
- package/dist/github/codeowners.d.ts +23 -0
- package/dist/github/codeowners.js +96 -0
- package/dist/github/commitReader.d.ts +25 -0
- package/dist/github/commitReader.js +38 -0
- package/dist/github/deploy.d.ts +15 -0
- package/dist/github/deploy.js +33 -0
- package/dist/github/index.d.ts +9 -0
- package/dist/github/index.js +8 -0
- package/dist/github/repo.d.ts +95 -0
- package/dist/github/repo.js +375 -0
- package/dist/github/source.d.ts +115 -0
- package/dist/github/source.js +558 -0
- package/dist/loader/index.d.ts +27 -0
- package/dist/loader/index.js +151 -0
- package/dist/loader/protocol.d.ts +95 -0
- package/dist/loader/protocol.js +120 -0
- package/dist/loader/window/geometry.js +9 -0
- package/dist/next/EditletLoader.d.ts +5 -0
- package/dist/next/EditletLoader.js +33 -0
- package/dist/next/assetUrl.d.ts +9 -0
- package/dist/next/assetUrl.js +13 -0
- package/dist/next/buildGuard.js +26 -0
- package/dist/next/config.d.ts +18 -0
- package/dist/next/config.js +255 -0
- package/dist/next/devServer.js +70 -0
- package/dist/next/editletField.d.ts +7 -0
- package/dist/next/editletField.js +7 -0
- package/dist/next/index.d.ts +8 -0
- package/dist/next/index.js +6 -0
- package/dist/next/preview.d.ts +18 -0
- package/dist/next/preview.js +100 -0
- package/dist/next/previewCookie.d.ts +5 -0
- package/dist/next/previewCookie.js +72 -0
- package/dist/next/previewEnv.js +25 -0
- package/dist/next/previewRef.d.ts +8 -0
- package/dist/next/previewRef.js +17 -0
- package/dist/next/publicDir.js +65 -0
- package/dist/next/reader.d.ts +49 -0
- package/dist/next/reader.js +161 -0
- package/dist/next/stub/index.html +56 -0
- package/dist/node/devHandler.d.ts +6 -0
- package/dist/node/devHandler.js +430 -0
- package/dist/node/fs.js +37 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +3 -0
- package/dist/node/project.d.ts +12 -0
- package/dist/node/project.js +43 -0
- package/package.json +187 -4
- package/skills/README.md +84 -0
- package/skills/editlet/SKILL.md +119 -0
- package/skills/editlet/references/content-format.md +191 -0
- package/skills/editlet/references/preview.md +75 -0
- package/skills/editlet/references/publishing.md +137 -0
- package/skills/editlet/references/schema-changes.md +127 -0
- package/skills/editlet/scripts/guard.mjs +1061 -0
- package/skills/editlet/scripts/link.mjs +193 -0
- package/skills/editlet/scripts/refs.mjs +1480 -0
- package/skills/editlet/scripts/schema.mjs +1340 -0
- package/skills/editlet/scripts/style.mjs +657 -0
- package/skills/editlet/scripts/types.mjs +525 -0
- package/skills/editlet/scripts/validate.mjs +724 -0
- package/skills/editlet-migrate/SKILL.md +92 -0
- package/skills/editlet-migrate/references/mapping.md +73 -0
- package/skills/editlet-migrate/references/sources.md +70 -0
- package/skills/editlet-setup/SKILL.md +108 -0
- package/skills/editlet-setup/references/astro.md +83 -0
- package/skills/editlet-setup/references/doctor.md +89 -0
- package/skills/editlet-setup/references/next.md +140 -0
- package/skills/editlet-setup/references/preview.md +54 -0
- package/skills/editlet-setup/references/production.md +153 -0
- package/skills/editlet-setup/references/roles.md +238 -0
- package/skills/editlet-setup/references/skills.md +99 -0
- package/skills/editlet-setup/scripts/doctor.mjs +1378 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# The skills, the guard hook, upgrades
|
|
2
|
+
|
|
3
|
+
Read this to link or check the skills, to explain the guard hook, in a monorepo, for an upgrade, or when a script is
|
|
4
|
+
missing.
|
|
5
|
+
|
|
6
|
+
## Link the skills
|
|
7
|
+
|
|
8
|
+
The skills ship inside the npm package, in `node_modules/editlet/skills/<name>`. Link them so they always match the
|
|
9
|
+
installed version:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
node node_modules/editlet/skills/editlet/scripts/link.mjs --hooks
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
It creates relative symlinks for every skill of the package and adds the guard hook:
|
|
16
|
+
|
|
17
|
+
| Path | For |
|
|
18
|
+
|---|---|
|
|
19
|
+
| `.claude/skills/<name>` → `../../node_modules/editlet/skills/<name>` (`editlet`, `editlet-migrate`, `editlet-setup`) | Claude Code |
|
|
20
|
+
| `.agents/skills/<name>` → the same | Other agents that read `.agents/skills` (Codex and others) |
|
|
21
|
+
| `.claude/settings.json` → a `PreToolUse` hook on `Bash` running `editlet/scripts/guard.mjs` | The git/gh safety net |
|
|
22
|
+
|
|
23
|
+
A link that points at a skill the installed version no longer has is reported as `stale link` and removed.
|
|
24
|
+
|
|
25
|
+
Run it again at any time; it is idempotent. `--check` only reports and exits 1 when something is missing, points elsewhere (`wrong link`), or, with `--hooks`, when the guard is missing or cannot load. A real
|
|
26
|
+
directory (a copy) at a link path is left alone and reported. Without `--hooks`, no settings are written.
|
|
27
|
+
|
|
28
|
+
By hand, from the project root:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
mkdir -p .claude/skills .agents/skills
|
|
32
|
+
for s in editlet editlet-setup editlet-migrate; do
|
|
33
|
+
ln -s ../../node_modules/editlet/skills/$s .claude/skills/$s
|
|
34
|
+
ln -s ../../node_modules/editlet/skills/$s .agents/skills/$s
|
|
35
|
+
done
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Commit the links if the team wants them for everyone. They are small and point into `node_modules`.
|
|
39
|
+
|
|
40
|
+
**Monorepo:** run `link.mjs` in the folder where Claude Code starts (usually the repo root), because the hook command
|
|
41
|
+
uses `$CLAUDE_PROJECT_DIR`. Run the content scripts with the app folder as root:
|
|
42
|
+
`node .claude/skills/editlet/scripts/validate.mjs apps/web` or `schema.mjs … --root apps/web`. The guard then
|
|
43
|
+
protects only `main` and `master` (a custom `git.baseBranch` is not known) and skips the commit check, because it
|
|
44
|
+
cannot find `cms/schema.json`, unless Claude Code starts in the app folder.
|
|
45
|
+
|
|
46
|
+
## The guard hook
|
|
47
|
+
|
|
48
|
+
`scripts/guard.mjs` runs before every Bash command Claude Code executes. It:
|
|
49
|
+
|
|
50
|
+
| Command | Decision |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `git push` to the base branch, `main` or `master` (also `HEAD:main`, a bare `git push` on that branch, `--mirror`, `--all`, deleting it) | deny |
|
|
53
|
+
| `git commit` while files under `contentDir` or the schema changed and `validate` fails | deny, with the issues |
|
|
54
|
+
| `gh pr merge … --admin`; `gh api` writes to `…/protection` | deny |
|
|
55
|
+
| any other `gh pr merge` | ask (the human confirms in a permission prompt) |
|
|
56
|
+
| anything else | no opinion (normal permissions apply) |
|
|
57
|
+
|
|
58
|
+
It is a safety net, not a sandbox. Commands hidden in scripts, `bash -c "…"` strings or aliases can get past it, and
|
|
59
|
+
it judges `git` by the session's folder (`cd sub && git push` or `git -C other commit` are not followed). If the guard
|
|
60
|
+
fails while running, it denies the command. The hook protects only when `guard.mjs` and its dependencies load. A missing bundle, or a missing `yaml` / `zod`
|
|
61
|
+
(a fresh clone before `npm install`, or the source repo before `build.ts`), makes Node exit 1, which Claude Code treats
|
|
62
|
+
as a non-blocking error: the command then runs unguarded. `link.mjs --check --hooks` reports `guard missing` or
|
|
63
|
+
`guard broken` (exit 1); without `--check` it prints a `warning:` line. The real wall is branch protection on GitHub: require a PR for the base branch.
|
|
64
|
+
|
|
65
|
+
The entry it adds to `.claude/settings.json`:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"hooks": {
|
|
70
|
+
"PreToolUse": [
|
|
71
|
+
{
|
|
72
|
+
"matcher": "Bash",
|
|
73
|
+
"hooks": [{ "type": "command", "command": "node \"$CLAUDE_PROJECT_DIR\"/.claude/skills/editlet/scripts/guard.mjs" }]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Optional extra permission rules for the same settings file: `"permissions": { "ask": ["Bash(gh pr merge:*)"] }`.
|
|
81
|
+
|
|
82
|
+
## Upgrade
|
|
83
|
+
|
|
84
|
+
1. `npm install editlet@alpha` (while Editlet is in alpha, `latest` stays on the first published version), with the
|
|
85
|
+
project's package manager.
|
|
86
|
+
2. `node node_modules/editlet/skills/editlet/scripts/link.mjs --hooks`: the links follow the new version on their own;
|
|
87
|
+
this adds links for new skills and removes stale ones.
|
|
88
|
+
3. `node .claude/skills/editlet/scripts/validate.mjs`: does the new version read the content differently?
|
|
89
|
+
4. The project's build. Read the package's release notes for breaking changes before you fix anything.
|
|
90
|
+
|
|
91
|
+
## A script is missing
|
|
92
|
+
|
|
93
|
+
The `.mjs` scripts are built when the package is packed. In the Editlet source repo itself, build them first:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
node packages/editlet/skills/editlet/scripts/build.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Never run the `.ts` sources from `node_modules` with `node`. Node does not strip types inside `node_modules`.
|