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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ packages/player/LICENSE
packages/normalize/LICENSE
packages/verify/LICENSE
packages/author/LICENSE
# The h5p-author skill's text, which the author's `prepack` copies beside its type files (#178).
packages/author/SKILL.md
packages/author/references/authoring.md
packages/cmi5/LICENSE
packages/embed/LICENSE

Expand Down
8 changes: 7 additions & 1 deletion design/author.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,13 @@ to 3,000. Nineteen things the code does not say by itself:
`skills/h5p-author/references/types/*.md` into the package, `references/types/<Type>.md`, each
an export, for the page to hand over with a source's problems. They stay the skill's, at the
repository's root where `npx skills add` looks, written by `sync:skill` as before; the copy is
not in git, and `build.test.ts` holds it to the skill's files, file for file.
not in git, and `build.test.ts` holds it to the skill's files, file for file. Since #178 the
skill's text travels with them, `SKILL.md` and `references/authoring.md`, each an export too:
the Claude app, given a link to the skill on GitHub, answered that GitHub's rate limit kept it
out, since GitHub limits anonymous requests per address and a chat app's are shared. The
organisation's site serves the skill from the release its build page pins, and the skill gives
a chat the site's address for a type's file, not raw.githubusercontent.com's. Installing the
skill stays the way: nothing is fetched while the chat works.

The same test on the 23 other content types the skill lists says how far each thing reaches:
two runs each, 46 first replies, each built package checked against what its task asked for.
Expand Down
7 changes: 4 additions & 3 deletions design/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ packages/author/ @missing-elements/h5p-author — a playable .h5p of an
scripts/ sync-skill.mjs writes the skill's type files' generated sections from the
pack (`pnpm --filter @missing-elements/h5p-author sync:skill`);
check-pack-published.mjs, the publish guard for the pinned pack and player,
and the normalizer's `./crc32`; copy-type-files.mjs, `prepack`'s copy of
the skill's type files into `references/types/`, which the package
carries and git does not (#172)
and the normalizer's `./crc32`; copy-skill.mjs, `prepack`'s copy of
the skill's text and type files, `SKILL.md`, `references/authoring.md`
and `references/types/`, which the package carries and git does not
(#172, #178)
tests/ node tests: the generator, text and translations, layouts and schema, the
loader, builds with media from disk and a local server, the command, the
quiz format, the check of saved content, the demo's packages among it, and
Expand Down
5 changes: 4 additions & 1 deletion packages/author/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ An unknown name lists the pack's content types.
The package carries those type files too, as the release has them:
`@missing-elements/h5p-author/references/types/H5P.TrueFalse.md` is the type's notes, an example and
these fields. A page that builds for a chat with no skill beside it hands them over with a source's
problems, as the [build page](https://missing-elements.github.io/h5p/build/) does.
problems, as the [build page](https://missing-elements.github.io/h5p/build/) does. The skill's text
travels with them, `@missing-elements/h5p-author/SKILL.md` and its brief,
`references/authoring.md`, for a site to serve to a chat given a link to the skill: GitHub limits
the requests of an address many users share, as a chat app's is.

## A content type's bundle

Expand Down
7 changes: 5 additions & 2 deletions packages/author/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@
"default": "./lib/browser.mjs"
},
"./references/types/*.md": "./references/types/*.md",
"./references/authoring.md": "./references/authoring.md",
"./SKILL.md": "./SKILL.md",
"./package.json": "./package.json"
},
"files": [
"bin",
"lib",
"references",
"types"
"types",
"SKILL.md"
],
"keywords": [
"h5p",
Expand All @@ -56,7 +59,7 @@
"test:unit": "pnpm --filter @missing-elements/h5p-offline-player build:plan && vitest run --project node",
"typecheck": "pnpm types && tsc -p tsconfig.json",
"sync:skill": "pnpm --filter @missing-elements/h5p-offline-player build:plan && node scripts/sync-skill.mjs",
"prepack": "node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\" && node scripts/copy-type-files.mjs && pnpm types",
"prepack": "node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\" && node scripts/copy-skill.mjs && pnpm types",
"prepublishOnly": "node -e \"if (!/^pnpm\\//.test(process.env.npm_config_user_agent || '')) { console.error('Publish with pnpm publish: npm would ship the workspace: dependency ranges as they are, and the package would not install.'); process.exit(1) }\" && node scripts/check-pack-published.mjs && pnpm typecheck && pnpm test",
"types": "pnpm --filter @missing-elements/h5p-offline-player exec tsc -b && node -e \"require('node:fs').rmSync('types', { recursive: true, force: true })\" && tsc -p tsconfig.types.json"
},
Expand Down
22 changes: 22 additions & 0 deletions packages/author/scripts/copy-skill.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// The h5p-author skill's text, copied into the package as `prepack` runs: `SKILL.md`, its brief,
// `references/authoring.md`, and its type files, each content type's notes, an example and its
// fields, as the release has them. A page that builds, with no skill beside it, hands the type
// files to a chat whose source had problems (#172), and serves the skill to a chat given a link to
// it rather than GitHub's, which limits the requests of addresses many users share (#178). They are
// the skill's, at the repository's root, where `npx skills add` looks; the copy is not in git.
import { cp, mkdir, readdir, rm } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'

const skill = new URL('../../../skills/h5p-author/', import.meta.url)
const from = fileURLToPath(new URL('references/types/', skill))
const to = fileURLToPath(new URL('../references/types/', import.meta.url))

await rm(fileURLToPath(new URL('../references/', import.meta.url)), { recursive: true, force: true })
await rm(fileURLToPath(new URL('../SKILL.md', import.meta.url)), { force: true })
await mkdir(to, { recursive: true })
const files = (await readdir(from)).filter((name) => name.endsWith('.md'))
if (!files.length) throw new Error(`No type files in ${from}`)
for (const name of files) await cp(`${from}${name}`, `${to}${name}`)
await cp(fileURLToPath(new URL('references/authoring.md', skill)), fileURLToPath(new URL('../references/authoring.md', import.meta.url)))
await cp(fileURLToPath(new URL('SKILL.md', skill)), fileURLToPath(new URL('../SKILL.md', import.meta.url)))
console.log(`Copied SKILL.md, references/authoring.md and ${files.length} type files to references/types/`)
16 changes: 0 additions & 16 deletions packages/author/scripts/copy-type-files.mjs

This file was deleted.

25 changes: 16 additions & 9 deletions packages/author/tests/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,20 +784,27 @@ describe('the build', () => {
})

describe('the package', () => {
it('carries the skill\'s type files, copied as it is packed, for a page to hand to a chat (#172)', async () => {
const skill = resolve(import.meta.dirname, '../../../skills/h5p-author/references/types')
it('carries the skill\'s text and type files, copied as it is packed, for a page to hand to a chat (#172, #178)', async () => {
const skill = resolve(import.meta.dirname, '../../../skills/h5p-author')
const copied = resolve(import.meta.dirname, '../references/types')
const { stdout } = await exec(process.execPath, [resolve(import.meta.dirname, '../scripts/copy-type-files.mjs')])
const names = (await readdir(skill)).filter(name => name.endsWith('.md')).sort()
const { stdout } = await exec(process.execPath, [resolve(import.meta.dirname, '../scripts/copy-skill.mjs')])
const names = (await readdir(join(skill, 'references/types'))).filter(name => name.endsWith('.md')).sort()
expect(names).toContain('H5P.InteractiveBook.md')
expect(stdout).toContain(`Copied ${names.length} type files`)
expect(stdout).toContain(`Copied SKILL.md, references/authoring.md and ${names.length} type files`)
expect((await readdir(copied)).sort()).toEqual(names)
for (const name of names) expect(await readFile(join(copied, name), 'utf8'), name).toBe(await readFile(join(skill, name), 'utf8'))
for (const name of names) expect(await readFile(join(copied, name), 'utf8'), name).toBe(await readFile(join(skill, 'references/types', name), 'utf8'))
// The skill's text beside them, as it is, for a site to serve to a chat given a link.
for (const name of ['SKILL.md', 'references/authoring.md']) {
expect(await readFile(resolve(import.meta.dirname, '..', name), 'utf8'), name).toBe(await readFile(join(skill, name), 'utf8'))
}
// Packed and found: in `files`, copied by `prepack`, and each one an export of its own.
const manifest = JSON.parse(await readFile(resolve(import.meta.dirname, '../package.json'), 'utf8'))
expect(manifest.files).toContain('references')
expect(manifest.scripts.prepack).toContain('node scripts/copy-type-files.mjs')
expect(createRequire(import.meta.url).resolve('@missing-elements/h5p-author/references/types/H5P.InteractiveBook.md')).toBe(join(copied, 'H5P.InteractiveBook.md'))
expect(manifest.files).toEqual(expect.arrayContaining(['references', 'SKILL.md']))
expect(manifest.scripts.prepack).toContain('node scripts/copy-skill.mjs')
const require = createRequire(import.meta.url)
expect(require.resolve('@missing-elements/h5p-author/references/types/H5P.InteractiveBook.md')).toBe(join(copied, 'H5P.InteractiveBook.md'))
expect(require.resolve('@missing-elements/h5p-author/SKILL.md')).toBe(resolve(import.meta.dirname, '../SKILL.md'))
expect(require.resolve('@missing-elements/h5p-author/references/authoring.md')).toBe(resolve(import.meta.dirname, '../references/authoring.md'))
})
})

Expand Down
2 changes: 1 addition & 1 deletion skills/h5p-author/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ the same package.
Read the type's file, `references/types/<Type>.md`: notes, an example, its fields. Parts other
content holds have files too: H5P.AdvancedText, H5P.Image, H5P.Video, H5P.Text. With this text
alone and no file beside it, open the file at
`https://raw.githubusercontent.com/missing-elements/h5p-offline-player/main/skills/h5p-author/references/types/<Type>.md`;
`https://missing-elements.github.io/h5p/build/types/<Type>.md`;

@cubic-dev-ai cubic-dev-ai Bot Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This fallback URL is added before the separate site change that serves /build/types/<Type>.md is deployed, so users of the released skill can hit a missing page. Deploy the file-serving route before publishing this skill, or keep the fallback on the existing source until that route is live.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At skills/h5p-author/SKILL.md, line 63:

<comment>This fallback URL is added before the separate site change that serves `/build/types/<Type>.md` is deployed, so users of the released skill can hit a missing page. Deploy the file-serving route before publishing this skill, or keep the fallback on the existing source until that route is live.</comment>

<file context>
@@ -60,7 +60,7 @@ the same package.
 content holds have files too: H5P.AdvancedText, H5P.Image, H5P.Video, H5P.Text. With this text
 alone and no file beside it, open the file at
-`https://raw.githubusercontent.com/missing-elements/h5p-offline-player/main/skills/h5p-author/references/types/<Type>.md`;
+`https://missing-elements.github.io/h5p/build/types/<Type>.md`;
 where nothing opens, write the source from what you know of the type: the build says, for each
 place that is wrong, what to write there.
</file context>
Fix with cubic

where nothing opens, write the source from what you know of the type: the build says, for each
place that is wrong, what to write there.

Expand Down
Loading