colab-new
v0.0.10
Published
Starts a co:lab project from a template: clones it, adds .llm-rules, swaps the placeholders for the project's name, installs the lint hook and prints the hosting steps left to do.
Downloads
1,336
Readme
colab-new
Starts a co:lab project from one of the templates in one command, so "the client said yes" to "there's a
staging URL" has no hand-copying in it — and no # app-name-api README or "One-line description of the app"
meta description leaking into a real project.
MANDATORY SETUP
- Run
git clone https://codeberg.org/colab47/llm-instructions.git .llm-rulesFIRST. - Please ensure your LLM is truly using/following the rules.
- Whenever you need the latest rules, run
updateRules(see the llm-instructions README).
Usage
colab-new website luna-black --domain=lunablack.co.za --description="Tattoo studio in Johannesburg."
colab-new website apple-glass --production=netlify --staging=vercel
colab-new api hyde-park-agent
colab-new --helpRun it in the folder the project should be created in. The name is kebab-case; every other spelling the
template needs (Luna Black, lunaBlack, lunablack for Java packages, luna_black for Flutter) is derived
from it.
| Kind | Template |
|-----------|---------------------------------------------------------------------------|
| website | website-template |
| web-app | web-app-template |
| webgl | webgl-template |
| cli | cli-template |
| api | spring-boot-template |
| flutter | flutter-template |
How it works
One run, for colab-new website luna-black:
- Clones the template from Codeberg (
--depth 1), drops its.git, runsgit initonluna-black/so there is a repo for the pre-commit hook, and setsorigintohttps://codeberg.org/colab47/luna-black.git— so a push from any tool goes to the colab47 organisation, never to whatever account that tool defaults to. Refuses if the folder already exists. - Clones
.llm-rulesfrom llm-instructions — from~/.cache/llm-ruleswhenupdate-llm-rules.shhas left one there, otherwise from Codeberg. - Replaces the template's placeholders in every text file (binary files are left alone):
app-name,App Name,appName, pluscli-namefor a CLI,appnamefor an API (the Java package folder is renamed too) andapp_name/AppNamefor Flutter. With--domain=and--description=,example.comand the "One-line description …" meta descriptions go too. - Runs
npm installwhere there is apackage.json, which runsc3b-lint --initfrom the template'spostinstalland installs the pre-commit hook. - Appends a "Placeholders" section to
TODO.mdlisting whatever is still the template's — the domain or description if not given, the GoatCounter site, the favicon and OG image — so nothing ships silently. - Creates the Netlify sites, when production or staging is on Netlify:
<name>(<name>-staging), or<name>-colab47when that name is taken — Netlify site names are global, not per team. They're made here, before the first commit, so the deploy scripts carry the project ID of the site Netlify actually made. - When production or staging isn't where the template deploys it (Heroku and Vercel), rewrites
deployanddeploy:staginginpackage.jsonfor the hosts chosen: Vercel's is the template'svercel --prod, Netlify'snetlify deploy --prod --site <the site's project ID>(its name, when the site couldn't be made here and is left for you to create), and no staging drops the staging scripts. Staging's builds withD8E_STAGING=1wherever it is (--build-envon Vercel), so d8e drops the GoatCounter tag there and nowhere else. - Commits and pushes to the colab47 organisation the way your own
git pushwould — over SSH or HTTPS, whatever git has for Codeberg. If Codeberg lets that push create the repo, that is the whole step. If the push is refused because the repo does not exist yet, the repo is created through Codeberg's API with git's HTTPS credential (the keychain on a Mac) and pushed again. With neither — SSH only and no push-to-create — the one command left,git push -u origin mainafter creating the repo, is printed. - Production (Heroku unless
--production=): creates the Heroku app — with the nginx and Node buildpacks for a site, with a Postgres add-on for an API — or the<name>Vercel project, linked; a Netlify site is made at 6. Going live stays a deliberategit push heroku mainornpm run deploy. - Staging (Vercel unless
--staging=): creates<name>-stagingon Vercel (linked), and deploys it or the Netlify site made at 6, so there is a staging URL to send. A web app's Netlify staging waits forAPI_URLon the site first. Vercel projects land in whichever Vercel scope is current (vercel switch), Netlify sites in the colab47 team. Each step runs when its CLI is installed and logged in. - Prints what is left: any of 6 and 8–10 that could not run here, as the exact command; Bunny; the API's config
vars;
API_URLfor a web app — each pointing at the section of the project's own README that explains it.
The hosting steps live in hosting.js, beside the bin.
A hosting step that fails (a Heroku name already taken, say) stops the run with the tool's own message, but the folder stays: everything before it is done, and the step can be rerun by hand from the printed command.
Flags
--domain=example.co.za— the real domain, in place ofexample.com.--description="…"— the meta description, in place of the template's placeholder sentence.--production=heroku|vercel|netlify— where a site goes live (defaultheroku).--staging=vercel|netlify|none— where a site's staging goes (defaultvercel). Vercel can't take both, since a folder links to one Vercel project; Netlify can, each deploy naming its site. Both flags are forwebsite,web-appandwebgl: an API goes to Heroku.--from=<folder>— copy a local folder instead of cloning from Codeberg (offline, or trying a template change before it is pushed)..git,node_modulesand build output are not copied.--no-install— skipnpm install.--local— scaffold only: no Codeberg repo, Heroku app, Vercel project or Netlify site, each printed as a command.--dry-run— report what would be created and write nothing.--help— print the usage, kinds and flags. An unknown flag or kind prints the same and exits 1.
Setup
npm install -g colab-newNeeds git set up to push to colab47 on Codeberg, as for any other repo. For the hosting steps: the Heroku CLI,
the Vercel CLI and the Netlify CLI
(npm install -g netlify-cli), whichever the chosen hosts need, each logged in. Any of them missing just turns that step into a
printed command.
Tests and publishing
See TECH.md. npm run deploy runs the tests and publishes to npm.
