ai-projects 1.5.0 → 1.5.1
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/index.js +32 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {z as z$1}from'zod';import {parser}from'zod-opts';import Je from'dotenv';import Be from'fs';import F from'path';import {fileURLToPath}from'url';import {spawn,exec}from'child_process';import K from'fs/promises';import y from'lodash';import W from'moment';import {inspect}from'util';import Pt from'yaml';var He=Object.defineProperty;var f=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ke=(t,e)=>{for(var o in e)He(t,o,{get:e[o],enumerable:true});};var b,B=f(()=>{b={name:"ai-projects",version:"1.5.
|
|
2
|
+
import {z as z$1}from'zod';import {parser}from'zod-opts';import Je from'dotenv';import Be from'fs';import F from'path';import {fileURLToPath}from'url';import {spawn,exec}from'child_process';import K from'fs/promises';import y from'lodash';import W from'moment';import {inspect}from'util';import Pt from'yaml';var He=Object.defineProperty;var f=(t,e)=>()=>(t&&(e=t(t=0)),e);var Ke=(t,e)=>{for(var o in e)He(t,o,{get:e[o],enumerable:true});};var b,B=f(()=>{b={name:"ai-projects",version:"1.5.1",type:"module",description:"Useful CLI for AI agents to create and manage projects, tasks, skills and agents",main:"dist/index.js",types:"dist/index.d.ts",bin:{aip:"dist/index.js"},files:["dist/**/*","README.md","LICENSE"],scripts:{build:"npm run build:map && npm run build:code","build:map":"tsx bin/map-commands.ts","build:code":"tsup --no-dts","build:all":"npm run build:map && tsup","build:check":"tsc --noEmit","build:watch":"npm run build:code -- --watch","build:clean":"rimraf dist/*","build:incr":"tsup --no-dts",start:"dist/index.js",dev:'npm run build:watch -- --onSuccess "dist/index.js"',cli:"npm run build && npm start --",ts:"tsx",vitest:"VITE_CJS_IGNORE_WARNING=true vitest",test:"npm run test:types && npm run test:unit","test:unit":"npm run vitest -- run","test:types:test":"tsc -p tsconfig.test.json --incremental --tsBuildInfoFile dist/test.tsbuildinfo","test:types:bin":"tsc -p bin/tsconfig.json --incremental --tsBuildInfoFile dist/bin.tsbuildinfo","test:types":"npm run test:types:test && npm run test:types:bin","test:full":"npm run lint:full && npm run test",eslint:"eslint --cache",lint:"npm run eslint -- '{src,bin}/**/*.ts'","lint:fix":"npm run lint -- --fix","lint:full":"npm run build:incr && npm run test:types:bin && npm run lint:fix","lint:full:silent":"npm run -s lint:full && echo LINT OK",map:"npm run build:map",link:"npm link",unlink:"npm unlink",prepare:'[ "$CI" != "true" ] && [ -d node_modules/husky ] && husky || true',prepack:"npm run test:full && npm run build:all","publish:dry":"npm pack --dry-run","version:patch":"npm version patch","version:minor":"npm version minor","version:major":"npm version major","agent:stop":"npm run -s lint:full:silent"},keywords:["ai","aip","project","task","kanban","cli","agent","automation"],author:"Ariel Flesler <aflesler@gmail.com>",license:"MIT",repository:{type:"git",url:"git+https://github.com/flesler/ai-projects.git"},homepage:"https://github.com/flesler/ai-projects#readme",bugs:{url:"https://github.com/flesler/ai-projects/issues"},engines:{node:">=20.0.0"},dependencies:{dotenv:"^17.3.1",lodash:"^4.17.21",moment:"^2.30.1",tslib:"^2.8.1",yaml:"^2.8.0",zod:"^3.25.76","zod-opts":"^1.0.0"},devDependencies:{"@eslint/js":"^10.0.1","@stylistic/eslint-plugin":"^5.7.0","@types/dotenv":"^8.2.3","@types/eslint":"^9.6.1","@types/lodash":"^4.17.23","@types/moment":"^2.13.0","@types/node":"^25.0.9","@types/source-map-support":"^0.5.10","@typescript-eslint/eslint-plugin":"^8.53.0","@typescript-eslint/parser":"^8.53.0",eslint:"^10.0.3","eslint-plugin-import-x":"^4.16.2","eslint-plugin-unused-imports":"^4.4.1","fast-glob":"^3.3.3",husky:"^9.1.7",rimraf:"^6.0.1","source-map-support":"^0.5.21",tsup:"^8.5.1",tsx:"^4.20.3","types-package-json":"^2.0.39",typescript:"^5.8.3",vitest:"^4.0.17"}};});function p(t){let{description:e,options:o=z$1.object({}),args:r,handler:s}=t,i=o.shape,a={};for(let[m,d]of Object.entries(i))a[m]={type:d};let l=parser().options(a);if(r){let m=r.shape,d=Object.entries(m).map(([k,P])=>({name:k,type:P}));d.length>0&&(l=l.args(d));}return e&&(l=l.description(e)),{description:e,options:o,args:r,parser:l,handler:s,cli:m=>s(l.parse(m))}}var g=f(()=>{});var c,$=f(()=>{c={dirs:{PROJECTS:"projects",SKILLS:"skills",AGENTS:"agents",TASKS:"tasks",INPUTS:"inputs",OUTPUTS:"outputs",HOOKS:"hooks",SCRIPTS:"scripts"},files:{MAIN:"main.md",STATUS:"status.tsv",LOG:"audit.log",SKILL:"SKILL.md"},hookTypes:["pre-create","post-create","pre-complete","post-complete","pre-start","post-start","pre-update","post-update"],languages:["ts","js","sh","py"],targets:["project","task"]};});var Ve,bt,N,Ze,E,H=f(()=>{$();Ve=()=>{let t=fileURLToPath(import.meta.url),e=F.dirname(t),o=10;for(let r=0;r<o;r++)try{if(Be.existsSync(F.join(e,"package.json")))return e;let s=F.dirname(e);if(s===e)break;e=s;}catch{break}return process.cwd()},bt=Ve(),N=process.env.AIP_HOME;N||(Je.config({path:F.join(bt,".env"),quiet:true}),N=process.env.AIP_HOME);if(!N){N=process.cwd();let t=N.split(F.sep);for(let e of [c.dirs.PROJECTS,c.dirs.SKILLS,c.dirs.AGENTS]){let o=t.indexOf(e);if(o!==-1){N=t.slice(0,o).join(F.sep);break}}}Ze={ROOT:bt,AIP_HOME:N},E=Ze;});var j,n,T=f(()=>{H();j={REPO:fileURLToPath(import.meta.url.replace(/\/(dist|src)\/.*/,"/")),join:(...t)=>F.join(...t),onRepo:(...t)=>j.join(j.REPO,...t),joinHome:(...t)=>j.join(E.AIP_HOME,...t),async ensureDir(t){await K.mkdir(t,{recursive:true});},async write(t,e){await j.ensureDir(F.dirname(t)),await K.writeFile(t,e,"utf8");},async append(t,e){await j.ensureDir(F.dirname(t)),await K.appendFile(t,e,"utf8");},async read(t){return K.readFile(t,"utf8")},async readRepo(...t){return j.read(j.onRepo(...t))},async readMany(...t){return (await Promise.all(t.map(async o=>{if(await j.fileExists(o)){let r=await j.read(o);return `# ${o}
|
|
3
3
|
|
|
4
|
-
${r}`}return ""}))).filter(Boolean)},async logFiles(...t){let e=await
|
|
4
|
+
${r}`}return ""}))).filter(Boolean)},async logFiles(...t){let e=await j.readMany(...t);console.log(e.join(`
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
`));},dumpCommandMapLines(t,e){let o=e?y.pick(t,e):t,r=[];for(let[s,i]of
|
|
8
|
+
`));},dumpCommandMapLines(t,e){let o=e?y.pick(t,e):t,r=[];for(let[s,i]of j.entriesOf(o))r.push(`${s} {${Object.keys(i).join("|")}}`);return r},async fileExists(t){try{return await K.access(t),!0}catch{return false}},async listDir(t){try{return await K.readdir(t)}catch{return []}},spawn:spawn,cd(t){process.chdir(t);},async exec(t,e){return new Promise(o=>{exec(t,{encoding:"utf8",...e},(r,s,i)=>{let a=r?.code;o({stdout:s??"",stderr:i??"",code:r?typeof a=="number"?a:1:0});});})},noop:()=>{},omitByDeep:(t,e)=>y.isArray(t)?t.map(o=>j.omitByDeep(o,e)):y.isPlainObject(t)?y.mapValues(y.omitBy(t,e),o=>j.omitByDeep(o,e)):t,omitNilsDeep:t=>j.omitByDeep(t,y.isNil),omitUndefinedsDeep:t=>j.omitByDeep(t,y.isUndefined),cloneDeep:t=>y.cloneDeep(t),int:t=>Number.parseInt(t,10),keysOf:t=>Object.keys(t),entriesOf:t=>Object.entries(t),isKeyOf:(t,e)=>!y.isNil(t)&&t in e,typeOf:t=>typeof t,never:{},undef:t=>t??void 0,toNull:t=>t??null,same:t=>t,notNil:t=>{if(y.isNil(t))throw new Error(`Received unexpected ${t} value`);return t},randomInt:(t,e)=>Math.floor(Math.random()*(e-t+1))+t,promise:()=>{let t,e=new Promise((o,r)=>{t={resolve:o,reject:r};});return y.extend(e,t)},isPromise:t=>y.isObject(t)&&"catch"in t,delay:t=>{let e=y.isObject(t)?j.toMS(t):t;return new Promise(o=>setTimeout(o,e))},promiseMap:(t,e)=>Promise.all(t.map(e)),promiseEach:(t,e)=>Promise.all(t.map(e)).then(()=>{}),memoize:t=>y.memoize(t,j.memoizeKey),toMS:t=>W.duration(t).asMilliseconds(),toSecs:t=>W.duration(t).asSeconds(),inspect:(t,e)=>inspect(t,{colors:false,showHidden:false,depth:null,compact:true,breakLength:1/0,...e}),stringify(t,e,o){let r=new WeakSet;return JSON.stringify(t,(s,i)=>{if(y.isObject(i)){if(r.has(i))return "[Circular]";r.add(i);}return y.isFunction(e)?e(s,i):i},o)},dump:t=>j.oneLine(j.stringify(t)),compactWhitespace:t=>t.replace(/\\n/g,`
|
|
9
9
|
`).replace(/\r/g,"").replace(/[ \t]*\n[ \t]*/g,`
|
|
10
10
|
`).replace(/\n{3,}/g,`
|
|
11
11
|
|
|
12
|
-
`).replace(/ {2,}/g," ").trim(),oneLine:t=>t.replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/ +/g," ").trim(),fuzzySearch:(t,e)=>y.includes(y.toLower(t||""),y.toLower(e||"")),elapsed:(t,e=Date.now())=>W.duration(W(e).diff(t||0)),iso:t=>W.utc(t).toISOString(),isoDate:t=>
|
|
12
|
+
`).replace(/ {2,}/g," ").trim(),oneLine:t=>t.replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/ +/g," ").trim(),fuzzySearch:(t,e)=>y.includes(y.toLower(t||""),y.toLower(e||"")),elapsed:(t,e=Date.now())=>W.duration(W(e).diff(t||0)),iso:t=>W.utc(t).toISOString(),isoDate:t=>j.iso(t).slice(0,10),memoizeKey:(...t)=>t.join(""),exit:(t=0)=>{process.exit(t);},set:(t,e,o)=>(t[e]=o,t),run:async t=>{try{await t(),process.exit(0);}catch(e){console.error(e),process.exit(1);}},isMain:()=>{let t=process.argv[1]||"";return t.includes("/index.")||t.endsWith("/bin/aip")},errorMessage:t=>t instanceof Error?t.message:String(t),slugify:t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")},n=j;});var xt,V,ut,Z,$t=f(()=>{T();xt=t=>{let e=t.trim();if(!e.startsWith("---"))return null;let o=e.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);return o?{frontmatter:Pt.parse(o[1]),content:o[2].trim()}:null},V=async(t,e,o="")=>{let s=`---
|
|
13
13
|
${Pt.stringify(e).trim()}
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -200,26 +200,26 @@ DEBUG=1 aip task update --status done
|
|
|
200
200
|
---
|
|
201
201
|
|
|
202
202
|
*Hooks automate workflow enforcement. Pre-hooks guard quality, post-hooks handle cleanup.*
|
|
203
|
-
`,Gt=p({description:"Hook types, env vars, and patterns",options:z$1.object({}),handler:async()=>{console.log(ao);}});});var
|
|
203
|
+
`,Gt=p({description:"Hook types, env vars, and patterns",options:z$1.object({}),handler:async()=>{console.log(ao);}});});var A,po,Jt,Bt=f(()=>{B();g();A=Object.keys(b.bin)[0],po=`# Quick Start
|
|
204
204
|
|
|
205
205
|
## New Task/Project
|
|
206
206
|
|
|
207
207
|
\`\`\`bash
|
|
208
208
|
# 1. Create project (if needed)
|
|
209
|
-
${
|
|
209
|
+
${A} project create "my-project" --description "What I'm building"
|
|
210
210
|
|
|
211
211
|
# 2. Create task
|
|
212
|
-
${
|
|
212
|
+
${A} task create my-project "first-task" --description "Start here"
|
|
213
213
|
|
|
214
214
|
# 3. Navigate to task
|
|
215
|
-
cd $(${
|
|
215
|
+
cd $(${A} task path first-task)
|
|
216
216
|
|
|
217
217
|
# 4. Start working (implicit from PWD)
|
|
218
|
-
${
|
|
218
|
+
${A} task start
|
|
219
219
|
# \u2192 sets status to in-progress, reads all context to stdout
|
|
220
220
|
|
|
221
221
|
# 5. Work session
|
|
222
|
-
# Log progress: ${
|
|
222
|
+
# Log progress: ${A} log append "API integration complete"
|
|
223
223
|
# Save: outputs/ to deliver, inputs/ for data
|
|
224
224
|
\`\`\`
|
|
225
225
|
|
|
@@ -227,27 +227,27 @@ ${O} task start
|
|
|
227
227
|
|
|
228
228
|
\`\`\`bash
|
|
229
229
|
# Find your tasks (searches all projects)
|
|
230
|
-
${
|
|
230
|
+
${A} task list
|
|
231
231
|
|
|
232
232
|
# Navigate to task
|
|
233
|
-
cd $(${
|
|
233
|
+
cd $(${A} task path task-slug)
|
|
234
234
|
|
|
235
235
|
# All commands work implicitly from PWD:
|
|
236
|
-
${
|
|
236
|
+
${A} task start # Start working (sets status to in-progress, reads all context to stdout)
|
|
237
237
|
\`\`\`
|
|
238
238
|
|
|
239
239
|
## Completing
|
|
240
240
|
|
|
241
241
|
\`\`\`bash
|
|
242
242
|
# Mark done (implicit from PWD)
|
|
243
|
-
${
|
|
244
|
-
${
|
|
243
|
+
${A} task update --status done
|
|
244
|
+
${A} log append "if you want to log something extra"
|
|
245
245
|
\`\`\`
|
|
246
246
|
|
|
247
247
|
## Check current task
|
|
248
248
|
|
|
249
249
|
\`\`\`bash
|
|
250
|
-
${
|
|
250
|
+
${A} task current
|
|
251
251
|
\`\`\`
|
|
252
252
|
|
|
253
253
|
**Note:** All task commands accept an optional task slug, but use PWD if not provided. Navigate with \`cd\` first for smoother workflow.
|
|
@@ -265,7 +265,11 @@ $AIP_HOME/projects/slug/
|
|
|
265
265
|
|
|
266
266
|
**Status format:** TSV with columns: date, time, entityType, slug, action, text
|
|
267
267
|
**Example:** \`2026-03-30<TAB>14:30:00<TAB>task<TAB>api-integration<TAB>log<TAB>API integration complete\`
|
|
268
|
-
|
|
268
|
+
|
|
269
|
+
## Commands
|
|
270
|
+
|
|
271
|
+
Run \`${A} help usage\` for all commands.
|
|
272
|
+
`,Jt=p({description:"Quick start guide for new users",options:z$1.object({}),handler:async()=>{console.log(po);}});});var lo,mo,uo,fo,go,ko,ho,Vt,Zt,G,ht,qt,Yt=f(()=>{B();$();g();x();lo=Object.values(M).join("|"),{PROJECTS:mo,TASKS:uo,HOOKS:fo,INPUTS:go,OUTPUTS:ko,SCRIPTS:ho}=c.dirs,{MAIN:Vt,STATUS:Zt}=c.files,G=Object.keys(b.bin)[0],ht=`# AIP - Project Management Skill
|
|
269
273
|
|
|
270
274
|
Automated project and task creation with proper structure, front-matter, and file organization.
|
|
271
275
|
|
|
@@ -289,7 +293,7 @@ $AIP_HOME/${mo}/{project-slug}/
|
|
|
289
293
|
\u251C\u2500\u2500 ${fo}/ # pre|post-{create,start,update,complete}.*
|
|
290
294
|
\u251C\u2500\u2500 ${ko}/ # Deliverables
|
|
291
295
|
\u251C\u2500\u2500 ${go}/ # External data
|
|
292
|
-
\u251C\u2500\u2500 ${
|
|
296
|
+
\u251C\u2500\u2500 ${ho}/ # Automation
|
|
293
297
|
\u2514\u2500\u2500 ${uo}/
|
|
294
298
|
\u2514\u2500\u2500 {task-slug}/
|
|
295
299
|
\u251C\u2500\u2500 ${Vt} # Task definition
|
|
@@ -322,10 +326,10 @@ When working on a task:
|
|
|
322
326
|
3. Work and save outputs to \`outputs/\`
|
|
323
327
|
4. Log progress: \`${G} log append "message"\`
|
|
324
328
|
5. On completion: set status=\`done\`, log summary
|
|
325
|
-
`,qt=p({description:"Project management skill for creating and managing projects/tasks",options:z$1.object({mode:z$1.enum(["md","claude","hermes"]).default("md").describe("Output format: md (no header), claude (name+description), hermes (full frontmatter)")}),handler:async t=>{let e=Object.keys(b.bin)[0];if(t.mode==="md"){console.log(
|
|
329
|
+
`,qt=p({description:"Project management skill for creating and managing projects/tasks",options:z$1.object({mode:z$1.enum(["md","claude","hermes"]).default("md").describe("Output format: md (no header), claude (name+description), hermes (full frontmatter)")}),handler:async t=>{let e=Object.keys(b.bin)[0];if(t.mode==="md"){console.log(ht);return}if(t.mode==="claude"){console.log(`---
|
|
326
330
|
name: ${e}
|
|
327
331
|
description: ${b.description}
|
|
328
|
-
---`),console.log(),console.log(
|
|
332
|
+
---`),console.log(),console.log(ht);return}if(t.mode==="hermes"){console.log(`---
|
|
329
333
|
name: ${e}
|
|
330
334
|
description: ${b.description}
|
|
331
335
|
version: ${b.version}
|
|
@@ -334,9 +338,9 @@ license: ${b.license}
|
|
|
334
338
|
metadata:
|
|
335
339
|
hermes:
|
|
336
340
|
tags: [${b.keywords.join(", ")}]
|
|
337
|
-
---`),console.log(),console.log(
|
|
338
|
-
`)),console.log(),console.log("Run `aip help quickstart` for a quick start guide"),console.log("Run `aip help skill` for a broader overview");else {let s=r[0]??`${t} {?}`;console.log(o,`Usage: aip ${s} [options]`);}}});});var yt,
|
|
339
|
-
`)},getTargetDir(t,e=process.cwd()){let o=this.getCurrentContext(e);if(t==="project"){let r=this.getProjectFromPwd(e);if(!r)throw new Error("Not in a project directory. Use --project flag or cd into a project.");let s=n.joinHome(c.dirs.PROJECTS,r);return {targetDir:s,projectDir:s,entityType:"project"}}if(t==="task"){if(!o.project||!o.task)throw new Error("Not in a task directory. Use --project and --task flags or cd into a task.");let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:n.join(r,c.dirs.TASKS,o.task),projectDir:r,entityType:"task"}}if(o.task&&o.project){let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:n.join(r,c.dirs.TASKS,o.task),projectDir:r,entityType:"task"}}if(o.project){let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:r,projectDir:r,entityType:"project"}}throw new Error("Not in a project or task directory. Specify --target flag.")}},
|
|
341
|
+
---`),console.log(),console.log(ht);return}}});});var Qt,Xt=f(()=>{B();g();T();Qt=p({description:"Print compact CLI usage (all nouns, or one noun if name is given)",options:z$1.object({}),args:z$1.object({name:z$1.string().optional().describe("Noun (e.g. task) to list verbs for")}),handler:async({name:t})=>{let{default:e}=await Promise.resolve().then(()=>(ot(),kt)),o=`${b.name} ${b.version} -`,r=n.dumpCommandMapLines(e,t);if(!t)console.log(o,"Usage: aip <noun> <verb> [options]"),console.log(r.map(s=>`-> ${s}`).join(`
|
|
342
|
+
`)),console.log(),console.log("Run `aip help quickstart` for a quick start guide"),console.log("Run `aip help skill` for a broader overview");else {let s=r[0]??`${t} {?}`;console.log(o,`Usage: aip ${s} [options]`);}}});});var yt,jo,h,D=f(()=>{$();T();yt=n.joinHome(c.dirs.PROJECTS),jo={getProjectFromPwd(t=process.cwd()){let e=F.relative(yt,t);if(!e||e.startsWith(".."))return null;let o=e.split(F.sep).filter(Boolean);return o.length===0?null:o[0]},getTaskFromPwd(t=process.cwd()){let e=F.relative(yt,t);if(!e||e.startsWith(".."))return null;let o=e.split(F.sep).filter(Boolean);return o.length<3||o[1]!==c.dirs.TASKS?null:o[2]},getCurrentContext(t=process.cwd()){return {project:this.getProjectFromPwd(t),task:this.getTaskFromPwd(t)}},requireProject(t=process.cwd()){let e=this.getProjectFromPwd(t);if(!e)throw new Error(`Not in a project directory. PWD: ${t}, projects: ${yt}`);return e},requireTask(t=process.cwd()){let e=this.getCurrentContext(t);if(!e.project||!e.task)throw new Error(`Not in a task directory. PWD: ${t}`);return {project:e.project,task:e.task}},exportContext(t=process.cwd()){let e=this.getCurrentContext(t),o=[];return e.project&&o.push(`export CURRENT_PROJECT="${e.project}"`),e.task&&o.push(`export CURRENT_TASK="${e.task}"`),process.env.CURRENT_AGENT&&o.push(`export CURRENT_AGENT="${process.env.CURRENT_AGENT}"`),o.join(`
|
|
343
|
+
`)},getTargetDir(t,e=process.cwd()){let o=this.getCurrentContext(e);if(t==="project"){let r=this.getProjectFromPwd(e);if(!r)throw new Error("Not in a project directory. Use --project flag or cd into a project.");let s=n.joinHome(c.dirs.PROJECTS,r);return {targetDir:s,projectDir:s,entityType:"project"}}if(t==="task"){if(!o.project||!o.task)throw new Error("Not in a task directory. Use --project and --task flags or cd into a task.");let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:n.join(r,c.dirs.TASKS,o.task),projectDir:r,entityType:"task"}}if(o.task&&o.project){let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:n.join(r,c.dirs.TASKS,o.task),projectDir:r,entityType:"task"}}if(o.project){let r=n.joinHome(c.dirs.PROJECTS,o.project);return {targetDir:r,projectDir:r,entityType:"project"}}throw new Error("Not in a project or task directory. Specify --target flag.")}},h=jo;});var te,ee=f(()=>{g();T();D();$();te=p({options:z$1.object({lang:z$1.enum(c.languages).default("ts").describe("Language"),target:z$1.enum(c.targets).default("project").describe("Target level")}),args:z$1.object({type:z$1.enum(c.hookTypes).describe("Hook type (e.g., pre-create, post-complete)")}),handler:async({type:t,lang:e,target:o})=>{let r=e,s=`.${r}`,{targetDir:i,entityType:a}=h.getTargetDir(o),l=n.join(i,c.dirs.HOOKS);await n.ensureDir(l);let m=n.join(l,`${t}${s}`);if(await n.fileExists(m))throw new Error(`Hook already exists: ${m}`);let k;if(r==="ts")k=`#!/usr/bin/env tsx
|
|
340
344
|
/** ${t} hook for ${a} */
|
|
341
345
|
|
|
342
346
|
import { env } from 'node:process'
|
|
@@ -383,13 +387,13 @@ if os.environ.get('TASK_SLUG'):
|
|
|
383
387
|
|
|
384
388
|
# Exit with non-zero to prevent action (for pre-hooks)
|
|
385
389
|
# sys.exit(1)
|
|
386
|
-
`;else throw new Error(`Unsupported language: ${r}`);await n.write(m,k);let{chmod:P}=await import('fs/promises');await P(m,493),console.log(`Hook created: ${m}`);}});});var To,v,z=f(()=>{$();T();To={async findHooks(t,e){let o=n.join(t,c.dirs.HOOKS);if(!await n.fileExists(o))return [];let s=await n.listDir(o),i=`${e}.`;return s.filter(a=>a.startsWith(i)).map(a=>n.join(o,a))},async executeHook(t,e,o){if(!await n.fileExists(t))return true;let s=e.project?n.joinHome(c.dirs.PROJECTS,e.project):o,i=e.task?n.join(s,c.dirs.TASKS,e.task):"",a={...process.env,HOOK_TYPE:e.action,ENTITY_TYPE:e.entityType,TARGET_DIR:o,PROJECT_DIR:s,...e.project?{PROJECT_SLUG:e.project}:{},...e.task?{TASK_SLUG:e.task,TASK_DIR:i}:{}};return new Promise(l=>{let m=spawn(t,[],{stdio:"inherit",env:a,cwd:F.dirname(t),shell:false});m.on("close",(d,k)=>{d===0?l(true):(console.error(`Hook ${F.basename(t)} failed (code=${d??k})`),l(false));}),m.on("error",d=>{console.error(`Failed to execute hook ${t}: ${d.message}`),l(false);});})},async runHooks(t,e,o){let r=await this.findHooks(t,e),s=e.startsWith("pre-");for(let i of r)if(!await this.executeHook(i,o,t)&&s)return false;return true},async runHooksForContext(t,e,o,r){return !(!await this.runHooks(t,o,r)||e&&!await this.runHooks(e,o,r))}},v=To;});var re,se=f(()=>{g();z();
|
|
387
|
-
`},async appendStatus(t,e,o,r,s){let i=n.join(t,c.files.STATUS),a=this.formatEntry(e,o,r,s);await n.append(i,a);},async appendStatusIfExists(t,e,o,r,s){let i=n.join(t,c.files.STATUS);if(!await n.fileExists(i))return false;let l=this.formatEntry(e,o,r,s);return await n.append(i,l),true},async readStatus(t){let e=n.join(t,c.files.STATUS);return await n.fileExists(e)?await n.read(e):""},getCurrentAgent(){return process.env.CURRENT_AGENT},async logTask(t,e,o){let r=
|
|
388
|
-
Expected at: ${o}`);await n.logFiles(o);}});});var Se,be=f(()=>{g();z();T();x();C();Se=p({description:"Create a new task with assignee and initial status",options:z$1.object({description:z$1.string().optional().describe("Task description"),assignee:z$1.string().optional().describe("Assignee agent slug"),status:z$1.string().default("backlog").describe("Initial status")}),args:z$1.object({project:z$1.string().describe("Project slug"),name:z$1.string().describe("Task name")}),handler:async({project:t,name:e,description:o,assignee:r,status:s})=>{let i=n.slugify(e),a=u.getProjectDir(t),l=u.getTaskDir(t,i);if(!await v.runHooksForContext(a,l,"pre-create",{action:"pre-create",entityType:"task",project:t}))throw new Error("Pre-create hook failed, aborting task creation");await u.createTask(t,i,{name:e,description:o,assignee:r,status:s,created:new Date().toISOString()}),await w.appendStatus(l,"task",i,"created",e),await w.appendStatus(a,"task",i,"created",`status is ${s}`),await v.runHooksForContext(a,l,"post-create",{action:"post-create",entityType:"task",project:t}),console.log(`Task created: ${i}`),console.log(` Project: ${t}`),console.log(` Path: ${l}`);}});});var Pe,xe=f(()=>{g();
|
|
389
|
-
${d}:`),console.log("---");for(let k of l[d])console.log(`${k.slug.padEnd(20)} ${k.name?.padEnd(30)||""} ${k.status||""} ${k.assignee||""}`);}}});});var De,Oe=f(()=>{g();x();De=p({description:"Output task directory path (for cd)",options:z$1.object({project:z$1.string().optional().describe("Project slug (searches all projects if not provided)")}),args:z$1.object({task:z$1.string().describe("Task slug")}),handler:async({project:t,task:e})=>{let{project:o,task:r}=await u.findTask(e,t),s=u.getTaskDir(o,r);console.log(s);}});});var ct,St=f(()=>{
|
|
390
|
+
`;else throw new Error(`Unsupported language: ${r}`);await n.write(m,k);let{chmod:P}=await import('fs/promises');await P(m,493),console.log(`Hook created: ${m}`);}});});var To,v,z=f(()=>{$();T();To={async findHooks(t,e){let o=n.join(t,c.dirs.HOOKS);if(!await n.fileExists(o))return [];let s=await n.listDir(o),i=`${e}.`;return s.filter(a=>a.startsWith(i)).map(a=>n.join(o,a))},async executeHook(t,e,o){if(!await n.fileExists(t))return true;let s=e.project?n.joinHome(c.dirs.PROJECTS,e.project):o,i=e.task?n.join(s,c.dirs.TASKS,e.task):"",a={...process.env,HOOK_TYPE:e.action,ENTITY_TYPE:e.entityType,TARGET_DIR:o,PROJECT_DIR:s,...e.project?{PROJECT_SLUG:e.project}:{},...e.task?{TASK_SLUG:e.task,TASK_DIR:i}:{}};return new Promise(l=>{let m=spawn(t,[],{stdio:"inherit",env:a,cwd:F.dirname(t),shell:false});m.on("close",(d,k)=>{d===0?l(true):(console.error(`Hook ${F.basename(t)} failed (code=${d??k})`),l(false));}),m.on("error",d=>{console.error(`Failed to execute hook ${t}: ${d.message}`),l(false);});})},async runHooks(t,e,o){let r=await this.findHooks(t,e),s=e.startsWith("pre-");for(let i of r)if(!await this.executeHook(i,o,t)&&s)return false;return true},async runHooksForContext(t,e,o,r){return !(!await this.runHooks(t,o,r)||e&&!await this.runHooks(e,o,r))}},v=To;});var re,se=f(()=>{g();z();D();$();re=p({options:z$1.object({target:z$1.enum(c.targets).optional().describe("Target level")}),args:z$1.object({type:z$1.enum(c.hookTypes).describe("Hook type to run")}),handler:async({type:t,target:e})=>{let{targetDir:o,entityType:r}=h.getTargetDir(e),s={action:t,entityType:r,project:h.getProjectFromPwd()||void 0,task:h.getTaskFromPwd()||void 0};await v.runHooks(o,t,s)||(console.error(`Hook ${t} failed`),process.exit(1)),console.log(`Hook ${t} completed successfully`);}});});var wo,w,C=f(()=>{$();D();T();wo={formatEntry(t,e,o,r){let s=new Date,i=s.toISOString().split("T")[0],a=s.toLocaleTimeString("en-US",{hour12:false,hour:"2-digit",minute:"2-digit",second:"2-digit"});return `${i} ${a} ${t} ${e} ${o} ${r}
|
|
391
|
+
`},async appendStatus(t,e,o,r,s){let i=n.join(t,c.files.STATUS),a=this.formatEntry(e,o,r,s);await n.append(i,a);},async appendStatusIfExists(t,e,o,r,s){let i=n.join(t,c.files.STATUS);if(!await n.fileExists(i))return false;let l=this.formatEntry(e,o,r,s);return await n.append(i,l),true},async readStatus(t){let e=n.join(t,c.files.STATUS);return await n.fileExists(e)?await n.read(e):""},getCurrentAgent(){return process.env.CURRENT_AGENT},async logTask(t,e,o){let r=h.getCurrentContext();if(!r.project||!r.task)throw new Error("Not in a task directory");let s=n.joinHome(c.dirs.PROJECTS,r.project,c.dirs.TASKS,r.task);await this.appendStatus(s,"task",t,"log",o?`${o}: ${e}`:e);},async logProject(t,e,o){let r=h.getProjectFromPwd();if(!r)throw new Error("Not in a project directory");let s=n.joinHome(c.dirs.PROJECTS,r);await this.appendStatus(s,"project",t,"log",o?`${o}: ${e}`:e);},async logStatusChange(t,e,o,r,s,i){let a=r;if(s&&Object.keys(s).length>0){let l=Object.entries(s).map(([m,d])=>`${m}=${d}`).join(", ");a=`${r}: ${l}`;}await this.appendStatus(t,e,o,"updated",i?`${i} | ${a}`:a);}},w=wo;});var ne,ie=f(()=>{g();D();T();C();$();ne=p({description:"Append a custom entry to status.tsv",options:z$1.object({project:z$1.string().optional().describe("Project slug (uses current project from $PWD if not provided)"),task:z$1.string().optional().describe("Task slug (uses current task from $PWD if not provided)")}),args:z$1.object({text:z$1.string().describe("Text to append")}),handler:async({project:t,task:e,text:o})=>{let r=h.getCurrentContext(),s=t||r.project;if(!s)throw new Error("No project specified. Use --project or run from a project/task directory");let i=n.joinHome(c.dirs.PROJECTS,s);if(e||r.task){let a=e||r.task;if(!a)throw new Error("No task specified");let l=n.join(i,c.dirs.TASKS,a);await w.appendStatus(l,"task",a,"log",o),console.log(`Appended to task ${a} status.tsv`);}else await w.appendStatus(i,"project",s,"log",o),console.log(`Appended to project ${s} status.tsv`);}});});var ae,ce=f(()=>{g();D();T();C();$();ae=p({description:"Read status.tsv history",options:z$1.object({project:z$1.string().optional().describe("Project slug (uses current project from $PWD if not provided)"),task:z$1.string().optional().describe("Task slug (uses current task from $PWD if not provided)")}),args:z$1.object({}),handler:async({project:t,task:e})=>{let o=h.getCurrentContext(),r=t||o.project;if(!r)throw new Error("No project specified. Use --project or run from a project/task directory");let s=n.joinHome(c.dirs.PROJECTS,r);if(e||o.task){let i=e||o.task;if(!i)throw new Error("No task specified");let a=n.join(s,c.dirs.TASKS,i),l=await w.readStatus(a);console.log(l||`No status.tsv found for task ${i}`);}else {let i=await w.readStatus(s);console.log(i||`No status.tsv found for project ${r}`);}}});});var pe,le=f(()=>{g();z();T();x();C();pe=p({description:"Create a new project with name, description, optional status and assignee",options:z$1.object({description:z$1.string().describe("Project description"),status:z$1.string().default("active").describe("Initial status"),assignee:z$1.string().optional().describe("Assignee agent slug")}),args:z$1.object({name:z$1.string().describe("Project name")}),handler:async({name:t,description:e,status:o,assignee:r})=>{let s=n.slugify(t),i=u.getProjectDir(s);if(!await v.runHooks(i,"pre-create",{action:"pre-create",entityType:"project"}))throw new Error("Pre-create hook failed, aborting project creation");await u.createProject(s,{name:t,description:e,status:o,assignee:r,created:new Date().toISOString()}),await w.appendStatus(i,"project",s,"created",`status is ${o}`),await v.runHooks(i,"post-create",{action:"post-create",entityType:"project"}),console.log(`Project created: ${s}`),console.log(` Path: ${i}`);}});});var me,de=f(()=>{g();D();me=p({options:z$1.object({}),handler:async()=>{let t=h.getProjectFromPwd();t||(console.error("Not in a project directory"),process.exit(1)),console.log(t);}});});var fe,ge=f(()=>{g();x();fe=p({description:"List all projects, optionally filtered by status",options:z$1.object({status:z$1.string().optional().describe("Filter by status")}),handler:async({status:t})=>{let e=await u.listProjects(),o=[];for(let r of e){let s=await u.getProject(r);s&&(t&&s.status!==t||o.push({slug:r,name:s.name||r,status:s.status,assignee:s.assignee}));}if(o.length===0){console.log("No projects found");return}console.log("Projects:"),console.log("---");for(let r of o)console.log(`${r.slug.padEnd(20)} ${r.name?.padEnd(30)||""} ${r.status||""} ${r.assignee||""}`);}});});var ke,he=f(()=>{g();x();ke=p({description:"Output project directory path (for cd)",options:z$1.object({}),args:z$1.object({name:z$1.string().describe("Project name (slug)")}),handler:async({name:t})=>{let e=u.getProjectDir(t);console.log(e);}});});var je,ye=f(()=>{g();x();z();C();D();je=p({description:"Update project properties: name, description, status, assignee",options:z$1.object({name:z$1.string().optional().describe("New name"),description:z$1.string().optional().describe("New description"),status:z$1.string().optional().describe("New status"),assignee:z$1.string().optional().describe("New assignee")}),args:z$1.object({project:z$1.string().optional().describe("Project slug (defaults to current project from $PWD)")}),handler:async({project:t,name:e,description:o,status:r,assignee:s})=>{let i=t||h.getProjectFromPwd();if(!i)throw new Error("No project specified and not in a project directory");let a=u.getProjectDir(i);if(!await v.runHooks(a,"pre-update",{action:"pre-update",entityType:"project"}))throw new Error("Pre-update hook failed, aborting update");let m={};if(e&&(m.name=e),o&&(m.description=o),r&&(m.status=r),s&&(m.assignee=s),Object.keys(m).length===0){console.log("No updates provided");return}await u.updateProject(i,m);let d=Object.entries(m).map(([k,P])=>`${k}=${P}`).join(", ");await w.appendStatus(a,"project",i,"updated",d),await v.runHooks(a,"post-update",{action:"post-update",entityType:"project"}),console.log(`Project ${i} updated`);}});});var Te,we=f(()=>{$();g();H();T();Te=p({description:"Read a skill's SKILL.md file into the console for agent context",options:z$1.object({}),args:z$1.object({name:z$1.string().describe("Skill name (directory name)")}),handler:async({name:t})=>{let e=n.join(E.AIP_HOME,c.dirs.SKILLS,t),o=n.join(e,c.files.SKILL);if(!await n.fileExists(o))throw new Error(`Skill not found: ${t}
|
|
392
|
+
Expected at: ${o}`);await n.logFiles(o);}});});var Se,be=f(()=>{g();z();T();x();C();Se=p({description:"Create a new task with assignee and initial status",options:z$1.object({description:z$1.string().optional().describe("Task description"),assignee:z$1.string().optional().describe("Assignee agent slug"),status:z$1.string().default("backlog").describe("Initial status")}),args:z$1.object({project:z$1.string().describe("Project slug"),name:z$1.string().describe("Task name")}),handler:async({project:t,name:e,description:o,assignee:r,status:s})=>{let i=n.slugify(e),a=u.getProjectDir(t),l=u.getTaskDir(t,i);if(!await v.runHooksForContext(a,l,"pre-create",{action:"pre-create",entityType:"task",project:t}))throw new Error("Pre-create hook failed, aborting task creation");await u.createTask(t,i,{name:e,description:o,assignee:r,status:s,created:new Date().toISOString()}),await w.appendStatus(l,"task",i,"created",e),await w.appendStatus(a,"task",i,"created",`status is ${s}`),await v.runHooksForContext(a,l,"post-create",{action:"post-create",entityType:"task",project:t}),console.log(`Task created: ${i}`),console.log(` Project: ${t}`),console.log(` Path: ${l}`);}});});var Pe,xe=f(()=>{g();D();Pe=p({description:"Get the current task slug from PWD",options:z$1.object({}),handler:async()=>{let t=h.getTaskFromPwd();t||(console.error("Not in a task directory"),process.exit(1)),console.log(t);}});});var $e,ve=f(()=>{D();g();x();$e=p({description:"Output full task context (main.md, status.tsv) for ingestion by agents",options:z$1.object({project:z$1.string().optional().describe("Project slug (searches all projects if not provided)")}),args:z$1.object({task:z$1.string().optional().describe("Task slug (default: from $PWD)")}),handler:async({project:t,task:e})=>{let o=h.getCurrentContext(),r=e??o.task;if(!r)throw new Error("Need task slug (or cd into task dir)");let{project:s}=await u.findTask(r,t);await u.ingestTask(s,r);}});});var Ee,Ae=f(()=>{g();x();Ee=p({description:"List tasks, optionally filtered by project, status, assignee, or search query",options:z$1.object({project:z$1.string().optional().describe("Project slug (searches all projects if not provided)"),statuses:z$1.array(z$1.string()).default([]).describe("Filter by statuses (multiple allowed)"),assignee:z$1.string().optional().describe("Filter by assignee"),all:z$1.boolean().default(false).describe("Include all tasks (including done/blocked)"),search:z$1.string().optional().describe("Search query (matches task slug or name, case-insensitive)")}),handler:async({project:t,statuses:e,assignee:o,all:r,search:s})=>{if(e&&e.length>0){for(let d of e)if(!et.includes(d))throw new Error(`Invalid status: ${d}. Valid values: ${et.join(", ")}`)}let i;e&&e.length>0?i=e:r?i=et:i=vt;let a=t?[t]:await u.listProjects(),l={};for(let d of a){let k=await u.listTasks(d),P=[];for(let S of k){let O=await u.getTask(d,S);if(O&&!(i.length>0&&!i.includes(O.status||""))&&!(o&&O.assignee!==o)){if(s){let tt=s.toLowerCase(),mt=S.toLowerCase().includes(tt),Fe=(O.name||"").toLowerCase().includes(tt);if(!mt&&!Fe)continue}P.push({slug:S,name:O.name||S,status:O.status,assignee:O.assignee});}}P.length>0&&(l[d]=P.sort((S,O)=>S.slug.localeCompare(O.slug)));}let m=Object.keys(l).sort();if(m.length===0){console.log("No tasks found");return}for(let d of m){console.log(`
|
|
393
|
+
${d}:`),console.log("---");for(let k of l[d])console.log(`${k.slug.padEnd(20)} ${k.name?.padEnd(30)||""} ${k.status||""} ${k.assignee||""}`);}}});});var De,Oe=f(()=>{g();x();De=p({description:"Output task directory path (for cd)",options:z$1.object({project:z$1.string().optional().describe("Project slug (searches all projects if not provided)")}),args:z$1.object({task:z$1.string().describe("Task slug")}),handler:async({project:t,task:e})=>{let{project:o,task:r}=await u.findTask(e,t),s=u.getTaskDir(o,r);console.log(s);}});});var ct,St=f(()=>{D();g();z();x();C();ct=p({description:"Update task properties: name, description, status, assignee",options:z$1.object({name:z$1.string().optional().describe("New name"),description:z$1.string().optional().describe("New description"),status:z$1.string().optional().describe("New status"),assignee:z$1.string().optional().describe("New assignee"),project:z$1.string().optional().describe("Project slug (searches all projects if not provided)")}),args:z$1.object({task:z$1.string().optional().describe("Task slug (default: from $PWD)")}),handler:async({project:t,task:e,name:o,description:r,status:s,assignee:i})=>{let a=h.getCurrentContext(),l=e??a.task;if(!l)throw new Error("No task specified (use --task or cd into task dir)");let{project:m}=await u.findTask(l,t),d=u.getTaskDir(m,l),k=u.getProjectDir(m);if(!await v.runHooksForContext(k,d,"pre-update",{action:"pre-update",entityType:"task",project:m,task:l}))throw new Error("Pre-update hook failed, aborting update");let S={};if(o&&(S.name=o),r&&(S.description=r),s&&(S.status=s),i&&(S.assignee=i),Object.keys(S).length===0){console.log("No updates provided");return}if(Object.keys(S).length>0){await u.updateTask(m,l,S);let O=Object.entries(S).map(([tt,mt])=>`${tt}=${mt}`).join(", ");await w.appendStatus(d,"task",l,"updated",O);}S.status&&await w.appendStatus(k,"task",l,"updated",`status to ${S.status}`),await v.runHooksForContext(u.getProjectDir(m),d,"post-update",{action:"post-update",entityType:"task",project:m,task:l}),console.log(`Task ${l} updated`);}});});var Ce,Re=f(()=>{D();g();x();St();Ce=p({description:"Start a task: set status to in-progress, optionally print context",options:z$1.object({project:z$1.string().optional().describe("Project slug (searches all projects if not provided)"),ingest:z$1.boolean().default(false).describe("Also output context for this task")}),args:z$1.object({task:z$1.string().optional().describe("Task slug (default: from $PWD)")}),handler:async({project:t,task:e,ingest:o})=>{let r=h.getCurrentContext(),s=e??r.task;if(!s)throw new Error("No task specified (use --task or cd into task dir)");let{project:i}=await u.findTask(s,t);(await u.getTask(i,s))?.status!=="in-progress"&&await ct.handler({project:i,task:s,status:"in-progress"}),o&&await u.ingestTask(i,s);}});});var Ne,Ie=f(()=>{g();x();C();Ne=p({description:"Post-mortem analysis for a completed task",options:z$1.object({}),args:z$1.object({project:z$1.string().describe("Project slug"),task:z$1.string().describe("Task slug")}),handler:async({project:t,task:e})=>{let o=u.getTaskDir(t,e),r=await u.getTask(t,e),i=(await w.readStatus(o)).split(`
|
|
390
394
|
`).filter(m=>m.startsWith("[")).length,a=[],l=r?.name||e;i>5&&a.push("High status update count - consider breaking into smaller tasks"),l.toLowerCase().includes("implement")&&a.push("Implementation task - check if similar patterns exist to reuse"),l.toLowerCase().includes("create")&&l.toLowerCase().includes("command")&&a.push("Command creation - check existing command patterns in src/commands/"),console.log(`
|
|
391
395
|
=== Post-Mortem Analysis ===`),console.log(`Project: ${t}`),console.log(`Task: ${e}`),console.log(`Name: ${l}`),console.log(`Status: ${r?.status||"unknown"}`),console.log(`Status updates: ${i}`),a.length>0?(console.log(`
|
|
392
396
|
Suggestions:`),a.forEach(m=>console.log(` - ${m}`))):console.log(`
|
|
393
397
|
No specific suggestions - task looks well-scoped`),console.log(`
|
|
394
398
|
=== End Post-Mortem ===
|
|
395
|
-
`);}});});var Ue,_e=f(()=>{g();T();Ue=p({description:"Read one or more files into the console",options:z$1.object({}),args:z$1.object({paths:z$1.array(z$1.string()).describe("File paths to read")}),handler:async({paths:t})=>{await n.logFiles(...t);}});});var kt={};Ke(kt,{default:()=>L});var Po,L,ot=f(()=>{Dt();Ct();Nt();Ut();Lt();Mt();zt();Bt();Yt();Xt();ee();se();ie();ce();le();de();ge();
|
|
399
|
+
`);}});});var Ue,_e=f(()=>{g();T();Ue=p({description:"Read one or more files into the console",options:z$1.object({}),args:z$1.object({paths:z$1.array(z$1.string()).describe("File paths to read")}),handler:async({paths:t})=>{await n.logFiles(...t);}});});var kt={};Ke(kt,{default:()=>L});var Po,L,ot=f(()=>{Dt();Ct();Nt();Ut();Lt();Mt();zt();Bt();Yt();Xt();ee();se();ie();ce();le();de();ge();he();ye();we();be();xe();ve();Ae();Oe();Re();St();Ie();_e();Po={agent:{create:At,current:Ot,list:Rt,path:It,start:_t},help:{api:Kt,hooks:Gt,quickstart:Jt,skill:qt,usage:Qt},hook:{create:te,run:re},log:{append:ne,read:ae},project:{create:pe,current:me,list:fe,path:ke,update:je},skill:{read:Te},task:{create:Se,current:Pe,ingest:$e,list:Ee,path:De,start:Ce,update:ct},util:{postmortem:Ne,read:Ue}},L=Po;});B();ot();T();process.on("unhandledRejection",t=>{console.error("Unhandled Rejection:",t),process.exit(1);});process.on("uncaughtException",t=>{console.error("Unhandled Exception:",t),process.exit(1);});async function Le(t){let[e,o,...r]=t;(e==="--version"||e==="-v")&&(console.log(b.version),process.exit(0));try{(!e||!n.isKeyOf(e,L))&&(await L.help.usage.handler({}),process.exit(1));let s=L[e];(!o||!n.isKeyOf(o,s))&&(await L.help.usage.handler({name:e}),process.exit(1));let i=s[o];i||(console.error(`Error: unknown command '${e} ${o}'`),console.log("Run with --help for more information"),process.exit(1)),await i.handler(i.parser.name(`${e} ${o}`).parse(r));}catch(s){console.error("Error:",n.errorMessage(s)),process.exit(1);}}var Ri=Le,Ni=L;n.isMain()&&Le(process.argv.slice(2));export{Ni as commands,Ri as default};
|