create-allyhub 0.5.0 → 0.7.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.
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import{mkdir as c,readFile as y,writeFile as d}from"node:fs/promises";import{basename as f,join as a,resolve as h}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(), layouts, slides.yaml's pages and what is placed on them, steps, 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.yaml and CSV): Excel's model as text, the openpyxl API, formulas, tables, names, checks, sheet.ts, scenarios, calc, trace, 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(t){return t.filter(e=>e.type==="allyhub:skill"&&e.name!==MASTER_SKILL).map(e=>({name:e.name,description:e.description.replaceAll(/\s+/gu," ").trim()}))}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";export function agentRules(){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,e])=>`- ${t}: ${e}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","","`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.","",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(), layouts, slides.yaml's pages and what is placed on them, steps, 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.yaml and CSV): Excel's model as text, the openpyxl API, formulas, tables, names, checks, sheet.ts, scenarios, calc, trace, render"],["websites.md","a website, any web project with website.json: how Studio serves it ($PORT, $HOST, the preview hosts), videos in its pages, its build"],["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(t){return t.filter(e=>e.type==="allyhub:skill"&&e.name!==MASTER_SKILL).map(e=>({name:e.name,description:e.description.replaceAll(/\s+/gu," ").trim()}))}export const AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->";export function agentRules(){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,e])=>`- ${t}: ${e}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","","`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.","",AGENT_RULES_END].join(`
|
|
6
6
|
`)}export function projectAgents(){return`# AllyHub project
|
|
7
7
|
|
|
8
|
-
This folder is an AllyHub project. Videos, 3D sceneries and 3D models are TypeScript, docs MDX, sheets YAML and CSV: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`model.ts\`, \`doc.mdx\`, \`sheet.yaml\`), wherever it suits the project; a model is made once and put in any scenery that imports it.
|
|
8
|
+
This folder is an AllyHub project. Videos, 3D sceneries and 3D models are TypeScript, docs MDX, sheets YAML and CSV, and a website any web project: each is a folder with its entry file (\`video.ts\`, \`scenery.ts\`, \`model.ts\`, \`doc.mdx\`, \`sheet.yaml\`, a website's \`website.json\`), 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()}
|
|
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(t){const e=t.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return e===""?"allyhub-project":e}const l=t=>y(t).then(()=>!0,()=>!1);export async function writeAgentFiles(t){const e=h(t);await c(e,{recursive:!0});const s=[];for(const[n,
|
|
16
|
-
`],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await c(s,{recursive:!0});const
|
|
15
|
+
`;export function packageName(t){const e=t.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return e===""?"allyhub-project":e}const l=t=>y(t).then(()=>!0,()=>!1);export async function writeAgentFiles(t){const e=h(t);await c(e,{recursive:!0});const s=[];for(const[n,i]of[["AGENTS.md",projectAgents()],["CLAUDE.md",PROJECT_CLAUDE]])await l(a(e,n))||(await d(a(e,n),i,{flag:"wx"}),s.push(n));return s}export async function startProject(t,e){const s=h(t);if(await l(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)),i=o=>e.packages?.[o]??e.version,p={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]:i(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:i(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},m=[["package.json",`${JSON.stringify(p,null,2)}
|
|
16
|
+
`],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await c(s,{recursive:!0});const r=[];for(const[o,u]of m)await l(a(s,o))||(await d(a(s,o),u,{flag:"wx"}),r.push(o));return r.push(...await writeAgentFiles(s)),{folder:s,name:n,files:r}}
|