create-allyhub 0.2.0-next.2 → 0.2.0-next.4

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/dist/main.js CHANGED
@@ -1,22 +1,23 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{readFile as u}from"node:fs/promises";import{relative as h}from"node:path";import{parseArgs as m}from"node:util";import{startProject as g}from"@allyhub-next/scaffold";const s=`Usage: npm create allyhub [folder]
2
+ import{readFile as m}from"node:fs/promises";import{relative as g}from"node:path";import{parseArgs as w}from"node:util";import{REGISTRY as v,readWorkSkills as y,startProject as S}from"@allyhub-next/scaffold";const a=`Usage: npm create allyhub [folder]
3
3
 
4
4
  Makes <folder> (default: the current one) a Node project that uses AllyHub:
5
5
  a package.json, and a tsconfig.json, a .gitignore, an AGENTS.md and a
6
- CLAUDE.md where it has none.
6
+ CLAUDE.md where it has none. The AGENTS.md lists AllyHub's work skills
7
+ from its registry (ALLYHUB_REGISTRY names another, an address or a folder).
7
8
  A folder that has a package.json already is refused.
8
9
 
9
10
  Options:
10
11
  -h, --help Shows this help
11
12
  -v, --version Shows create-allyhub's version
12
- `;async function l(){return JSON.parse(await u(new URL("../package.json",import.meta.url),"utf8")).version}export async function main(a,n=r=>process.stdout.write(r),o=r=>process.stderr.write(r)){let r;try{r=m({args:[...a],allowPositionals:!0,options:{help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(e){return o(`${e instanceof Error?e.message:String(e)}
13
+ `;async function c(){return JSON.parse(await m(new URL("../package.json",import.meta.url),"utf8")).version}export async function main(i,t=r=>process.stdout.write(r),n=r=>process.stderr.write(r),d=process.env){let r;try{r=w({args:[...i],allowPositionals:!0,options:{help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}})}catch(e){return n(`${e instanceof Error?e.message:String(e)}
13
14
 
14
- ${s}`),2}const{values:i,positionals:c}=r;if(i.help===!0)return n(s),0;if(i.version===!0)return n(`${await l()}
15
- `),0;const[p=".",...d]=c;if(d.length>0)return o(s),2;try{const e=await g(p,{version:await l()}),t=h(process.cwd(),e.folder),f=t===""?"":` cd ${t.includes(" ")?JSON.stringify(t):t}
16
- `;return n(`Wrote ${e.files.join(", ")} in ${e.folder}.
15
+ ${a}`),2}const{values:l,positionals:p}=r;if(l.help===!0)return t(a),0;if(l.version===!0)return t(`${await c()}
16
+ `),0;const[f=".",...u]=p;if(u.length>0)return n(a),2;try{const e=await y(d.ALLYHUB_REGISTRY??v),o=await S(f,{version:await c(),...e===void 0?{}:{skills:e}}),s=g(process.cwd(),o.folder),h=s===""?"":` cd ${s.includes(" ")?JSON.stringify(s):s}
17
+ `;return t(`Wrote ${o.files.join(", ")} in ${o.folder}.
17
18
 
18
19
  Next:
19
- ${f} npm install
20
+ ${h} npm install
20
21
  npm run dev
21
- `),0}catch(e){return o(`${e instanceof Error?e.message:String(e)}
22
+ `),0}catch(e){return n(`${e instanceof Error?e.message:String(e)}
22
23
  `),1}}
@@ -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 l,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/
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/
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"]],AGENT_RULES_BEGIN="<!-- BEGIN:allyhub-agent-rules -->",AGENT_RULES_END="<!-- END:allyhub-agent-rules -->",AGENT_RULES=[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(([s,e])=>`- ${s}: ${e}`),"","`allyhub help` lists AllyHub's commands (`npx allyhub help` once the project has installed it); `allyhub help <command>` says what one does.","",AGENT_RULES_END].join(`
6
- `),PROJECT_AGENTS=`# AllyHub project
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(`
6
+ `)}export function projectAgents(e){return`# AllyHub project
7
7
 
8
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.
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
- ${AGENT_RULES}
13
- `,PROJECT_CLAUDE=`@AGENTS.md
12
+ ${agentRules(e)}
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(s){const e=s.toLowerCase().normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^\w.-]+/gu,"-").replace(/^[-._]+|[-._]+$/gu,"").slice(0,214);return e===""?"allyhub-project":e}const c=s=>y(s).then(()=>!0,()=>!1);export async function writeAgentFiles(s){const e=h(s);await l(e,{recursive:!0});const t=[];for(const[n,r]of[["AGENTS.md",PROJECT_AGENTS],["CLAUDE.md",PROJECT_CLAUDE]])await c(a(e,n))||(await d(a(e,n),r,{flag:"wx"}),t.push(n));return t}export async function startProject(s,e){const t=h(s);if(await c(a(t,"package.json")))throw new Error(`${t} already has a package.json: add AllyHub to it with npm install ${PROJECT_PACKAGES.cli} ${PROJECT_PACKAGES.sdk}.`);const n=packageName(f(t)),r=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]:r(PROJECT_PACKAGES.cli),[PROJECT_PACKAGES.sdk]:r(PROJECT_PACKAGES.sdk)},devDependencies:{typescript:PROJECT_TYPESCRIPT}},m=[["package.json",`${JSON.stringify(p,null,2)}
16
- `],["tsconfig.json",PROJECT_TSCONFIG],[".gitignore",PROJECT_GITIGNORE]];await l(t,{recursive:!0});const i=[];for(const[o,u]of m)await c(a(t,o))||(await d(a(t,o),u,{flag:"wx"}),i.push(o));return i.push(...await writeAgentFiles(t)),{folder:t,name:n,files:i}}
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}}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scaffold",
3
- "version": "0.2.0-next.2",
3
+ "version": "0.2.0-next.4",
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-next.2",
3
+ "version": "0.2.0-next.4",
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-next.2"
23
+ "@allyhub-next/scaffold": "0.2.0-next.4"
24
24
  },
25
25
  "bundleDependencies": [
26
26
  "@allyhub-next/scaffold"