create-allyhub 0.2.0 → 0.3.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.
@@ -1,16 +1,16 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{mkdir as d,readFile as h,writeFile as p}from"node:fs/promises";import{basename as f,join as a,resolve as u}from"node:path";export const PROJECT_PACKAGES={cli:"allyhub",sdk:"@allyhub/sdk"},PROJECT_TYPESCRIPT="~5.9.3",PROJECT_GITIGNORE=`node_modules/
2
+ import{mkdir as d,readFile as h,writeFile as p}from"node:fs/promises";import{basename as f,join as a,resolve as m}from"node:path";export const PROJECT_PACKAGES={cli:"allyhub",sdk:"@allyhub/sdk"},PROJECT_TYPESCRIPT="~5.9.3",PROJECT_GITIGNORE=`node_modules/
3
3
  .allyhub/
4
4
  .playwright-cli/
5
- `,SDK_DOCS=[["project.md","folders, items and entry files, imports, scripts and shared text, allyhub.config.ts, fonts"],["contract.md","a frame drawn from its time alone, drawn offline, problems and their rules"],["video.md","video(), formats, part(), layers and stacking, transitions, the look, capture, post"],["layers.md","defineComponent(), custom(), the layer's ctx, DOM, animation, path, noise and input helpers, starter components"],["speech.md","take(), say(), word references, anchors, shown and said, captions, edits files"],["sound.md","music, sound effects, the mix, the master, mic"],["footage.md","footage(): placing, cropping, reframing, faces and mattes, a video item inside another"],["slides.md","slides(), pages, speaker notes"],["batches.md","the matrix: dimensions, slots, pools, rules, combos"],["scenery.md","3D sceneries: defineScenery(), cameras and moves, the scenery() layer, screens"],["modeling.md","props modelled in code with @allyhub-next/model"],["docs.md","a doc (doc.mdx): its title, the Markdown and tags it reads, pictures and links, comments"],["sheets.md","a sheet (sheet.csv, sheet.yaml): column types and formats, comments, check, import, render"],["defaults.md","every default of the piece API and the option that changes it"]],REGISTRY="https://allyhub.com/r",MASTER_SKILL="allyhub";export function workSkills(e){return e.filter(t=>t.type==="allyhub:skill"&&t.name!==MASTER_SKILL).map(t=>({name:t.name,description:t.description.replaceAll(/\s+/gu," ").trim()}))}export const REGISTRY_WAIT_MS=5e3;const g=e=>{const t=e?.items;return Array.isArray(t)&&t.every(s=>{const n=s;return typeof n?.name=="string"&&typeof n.type=="string"&&typeof n.description=="string"})};export async function readWorkSkills(e=REGISTRY,t=REGISTRY_WAIT_MS){try{const s=/^https?:\/\//u.test(e)?await fetch(new URL("registry.json",e.endsWith("/")?e:`${e}/`),{signal:AbortSignal.timeout(t)}).then(n=>n.ok?n.json():void 0):JSON.parse(await h(a(e,"registry.json"),"utf8"));return g(s)?workSkills(s.items):void 0}catch{return}}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";function k(e){return e===void 0||e.length===0?["`allyhub skills` lists AllyHub's work skills, each how to make one kind of work; `allyhub skills show <name>` prints one, `allyhub add <name>` adds it to this project."]:["AllyHub's work skills, each how to make one kind of work, as the registry had them when this project was made (`allyhub skills` lists them now, `allyhub skills show <name>` prints one):","",...e.map(t=>`- \`${t.name}\` (\`allyhub add ${t.name}\`): ${t.description}`)]}export function agentRules(e){return[AGENT_RULES_BEGIN,"",`Before writing or changing a video, a deck, a doc, a sheet or a 3D scenery, read the files it needs in the SDK's docs, for the version this project builds with: \`node_modules/${PROJECT_PACKAGES.sdk}/docs/\` once the project has installed it; without it, \`allyhub help\` says where they are (the SDK the CLI lends). The API has changed from what you may know; the docs and the SDK's types are right.`,"",...SDK_DOCS.map(([t,s])=>`- ${t}: ${s}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","",...k(e),"",AGENT_RULES_END].join(`
5
+ `,SDK_DOCS=[["project.md","folders, items and entry files, imports, scripts and shared text, allyhub.config.ts, fonts"],["contract.md","a frame drawn from its time alone, drawn offline, problems and their rules"],["video.md","video(), formats, part(), layers and stacking, transitions, the look, capture, post"],["layers.md","defineComponent(), custom(), the layer's ctx, DOM, animation, path, noise and input helpers, starter components"],["speech.md","take(), say(), word references, anchors, shown and said, captions, edits files"],["sound.md","music, sound effects, the mix, the master, mic"],["footage.md","footage(): placing, cropping, reframing, faces and mattes, a video item inside another"],["slides.md","slides(), pages, speaker notes"],["batches.md","the matrix: dimensions, slots, pools, rules, combos"],["scenery.md","3D sceneries: defineScenery(), cameras and moves, the scenery() layer, screens"],["modeling.md","props modelled in code with @allyhub-next/model"],["docs.md","a doc (doc.mdx): its title, the Markdown and tags it reads, pictures and links, comments"],["sheets.md","a sheet (sheet.csv, sheet.yaml): column types and formats, comments, check, import, render"],["defaults.md","every default of the piece API and the option that changes it"]],REGISTRY="https://allyhub.com/r",MASTER_SKILL="allyhub";export function workSkills(e){return e.filter(t=>t.type==="allyhub:skill"&&t.name!==MASTER_SKILL).map(t=>({name:t.name,description:t.description.replaceAll(/\s+/gu," ").trim()}))}export const REGISTRY_WAIT_MS=5e3;const g=e=>{const t=e?.items;return Array.isArray(t)&&t.every(s=>{const n=s;return typeof n?.name=="string"&&typeof n.type=="string"&&typeof n.description=="string"})};export async function readWorkSkills(e=REGISTRY,t=REGISTRY_WAIT_MS){try{const s=/^https?:\/\//u.test(e)?await fetch(new URL("registry.json",e.endsWith("/")?e:`${e}/`),{signal:AbortSignal.timeout(t)}).then(n=>n.ok?n.json():void 0):JSON.parse(await h(a(e,"registry.json"),"utf8"));return g(s)?workSkills(s.items):void 0}catch{return}}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";function k(e){return e===void 0||e.length===0?["`allyhub skills` lists AllyHub's work skills, each how to make one kind of work; `allyhub skills show <name>` prints one, `allyhub add skill/<name>` adds it to this project."]:["AllyHub's work skills, each how to make one kind of work, as the registry had them when this project was made (`allyhub skills` lists them now, `allyhub skills show <name>` prints one):","",...e.map(t=>`- \`${t.name}\` (\`allyhub add skill/${t.name}\`): ${t.description}`)]}export function agentRules(e){return[AGENT_RULES_BEGIN,"",`Before writing or changing a video, a deck, a doc, a sheet, a 3D scenery or a 3D model, read the files it needs in the SDK's docs, for the version this project builds with: \`node_modules/${PROJECT_PACKAGES.sdk}/docs/\` once the project has installed it; without it, \`allyhub help\` says where they are (the SDK the CLI lends). The API has changed from what you may know; the docs and the SDK's types are right.`,"",...SDK_DOCS.map(([t,s])=>`- ${t}: ${s}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","",...k(e),"",AGENT_RULES_END].join(`
6
6
  `)}export function projectAgents(e){return`# AllyHub project
7
7
 
8
- This folder is an AllyHub project. Videos and 3D sceneries are TypeScript, docs MDX, sheets CSV: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`doc.mdx\`, \`sheet.csv\`), wherever it suits the project.
8
+ This folder is an AllyHub project. Videos, 3D sceneries and 3D models are TypeScript, docs MDX, sheets CSV: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`model.ts\`, \`doc.mdx\`, \`sheet.csv\`), wherever it suits the project; a model is made once and put in any scenery that imports it.
9
9
 
10
10
  - A video or a scenery is code: where the project has no package.json yet, \`npm create allyhub@latest .\` then \`npm install\`.
11
11
 
12
12
  ${agentRules(e)}
13
13
  `}export const PROJECT_CLAUDE=`@AGENTS.md
14
14
  `,PROJECT_TSCONFIG=`${JSON.stringify({compilerOptions:{target:"ES2022",module:"ESNext",moduleResolution:"Bundler",lib:["ES2022","DOM","DOM.Iterable"],types:[`${PROJECT_PACKAGES.sdk}/client`,`${PROJECT_PACKAGES.cli}/client`],strict:!0,noEmit:!0,skipLibCheck:!0,verbatimModuleSyntax:!0,allowImportingTsExtensions:!0},include:["**/*.ts",".allyhub/cache/types"],exclude:["node_modules"]},null,2)}
15
- `;export function packageName(e){const t=e.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return t===""?"allyhub-project":t}const c=e=>h(e).then(()=>!0,()=>!1);export async function writeAgentFiles(e,t){const s=u(e);await d(s,{recursive:!0});const n=[];for(const[o,i]of[["AGENTS.md",projectAgents(t)],["CLAUDE.md",PROJECT_CLAUDE]])await c(a(s,o))||(await p(a(s,o),i,{flag:"wx"}),n.push(o));return n}export async function startProject(e,t){const s=u(e);if(await c(a(s,"package.json")))throw new Error(`${s} already has a package.json: add AllyHub to it with npm install ${PROJECT_PACKAGES.cli} ${PROJECT_PACKAGES.sdk}.`);const n=packageName(f(s)),o=r=>t.packages?.[r]??t.version,i={name:n,version:"0.0.0",private:!0,type:"module",scripts:{dev:"allyhub dev",check:"allyhub check",render:"allyhub render",typecheck:"tsc --noEmit"},dependencies:{[PROJECT_PACKAGES.cli]:o(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:o(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},m=[["package.json",`${JSON.stringify(i,null,2)}
16
- `],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await d(s,{recursive:!0});const l=[];for(const[r,y]of m)await c(a(s,r))||(await p(a(s,r),y,{flag:"wx"}),l.push(r));return l.push(...await writeAgentFiles(s,t.skills)),{folder:s,name:n,files:l}}
15
+ `;export function packageName(e){const t=e.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return t===""?"allyhub-project":t}const c=e=>h(e).then(()=>!0,()=>!1);export async function writeAgentFiles(e,t){const s=m(e);await d(s,{recursive:!0});const n=[];for(const[o,i]of[["AGENTS.md",projectAgents(t)],["CLAUDE.md",PROJECT_CLAUDE]])await c(a(s,o))||(await p(a(s,o),i,{flag:"wx"}),n.push(o));return n}export async function startProject(e,t){const s=m(e);if(await c(a(s,"package.json")))throw new Error(`${s} already has a package.json: add AllyHub to it with npm install ${PROJECT_PACKAGES.cli} ${PROJECT_PACKAGES.sdk}.`);const n=packageName(f(s)),o=r=>t.packages?.[r]??t.version,i={name:n,version:"0.0.0",private:!0,type:"module",scripts:{dev:"allyhub dev",check:"allyhub check",render:"allyhub render",typecheck:"tsc --noEmit"},dependencies:{[PROJECT_PACKAGES.cli]:o(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:o(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},u=[["package.json",`${JSON.stringify(i,null,2)}
16
+ `],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await d(s,{recursive:!0});const l=[];for(const[r,y]of u)await c(a(s,r))||(await p(a(s,r),y,{flag:"wx"}),l.push(r));return l.push(...await writeAgentFiles(s,t.skills)),{folder:s,name:n,files:l}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scaffold",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-allyhub",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Starts an AllyHub project: npm create allyhub <folder>.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://allyhub.com",
@@ -20,7 +20,7 @@
20
20
  "node": ">=22.19"
21
21
  },
22
22
  "dependencies": {
23
- "@allyhub-next/scaffold": "0.2.0"
23
+ "@allyhub-next/scaffold": "0.3.0"
24
24
  },
25
25
  "bundleDependencies": [
26
26
  "@allyhub-next/scaffold"