@kjanat/dreamcli 5.0.0 → 5.2.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.
- package/dist/{index-BIMjOsR6.d.mts → command-Cq6YZjEH.d.mts} +1183 -691
- package/dist/completion-DCWRvQjQ.mjs +59 -0
- package/dist/completion.d.mts +11 -1
- package/dist/completion.mjs +1 -1
- package/dist/config-CANc4lsA.mjs +1 -0
- package/dist/config.d.mts +12 -2
- package/dist/config.mjs +1 -1
- package/dist/core-CPh0FcFg.mjs +25 -0
- package/dist/dynamic-xPNS3_vL.mjs +1 -0
- package/dist/{index-jq_FJRKt.d.mts → index-8EiEDJfX.d.mts} +33 -7
- package/dist/{index-DpslpOVV.d.mts → index-BZ3jYjyh.d.mts} +18 -3
- package/dist/{index-hzYPRc_O.d.mts → index-Bkk86gFg.d.mts} +18 -13
- package/dist/{index-AIC5Gler.d.mts → index-CLg6j-KJ.d.mts} +1 -1
- package/dist/{index-BidVVmln.d.mts → index-DBepo8jX.d.mts} +28 -6
- package/dist/index.d.mts +33 -10
- package/dist/index.mjs +1 -1
- package/dist/json-schema-DmFJR8c6.mjs +59 -0
- package/dist/json-schema.d.mts +9 -1
- package/dist/json-schema.mjs +1 -1
- package/dist/{package-json-fYhxDdWD.mjs → package-json-hqUWeazy.mjs} +1 -1
- package/dist/prompt.d.mts +12 -1
- package/dist/prompt.mjs +1 -1
- package/dist/rolldown-runtime-DOYBPklu.mjs +1 -0
- package/dist/runtime.d.mts +20 -2
- package/dist/runtime.mjs +1 -1
- package/dist/session-BBRg9p2u.mjs +1 -0
- package/dist/{terminal-DRsRn4sc.mjs → terminal-mINn5p7B.mjs} +1 -1
- package/dist/test-prompter-BI9sA9n7.mjs +1 -0
- package/dist/testkit.d.mts +17 -4
- package/dist/testkit.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/dreamcli.schema.json +186 -0
- package/package.json +13 -14
- package/skills/cli-creation/SKILL.md +1 -1
- package/dist/adapter-DBeedKmD.d.mts +0 -283
- package/dist/completion-Bh-qywmB.mjs +0 -6
- package/dist/config-DruA8aFV.mjs +0 -1
- package/dist/core-B9YNSJeA.mjs +0 -19
- package/dist/json-schema-DF5fXdKQ.mjs +0 -59
- package/dist/rolldown-runtime-G4Kt5YOX.mjs +0 -1
- package/dist/session-Crtzt7LY.mjs +0 -1
- package/dist/test-prompter-BLNGCOA_.mjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as __exportAll}from"./rolldown-runtime-
|
|
1
|
+
import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";var package_json_exports=/* @__PURE__ */ __exportAll({discoverManifest:()=>discoverManifest,inferCliName:()=>inferCliName});function isPlainObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function parentDir(e){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(`\\`),r=Math.max(t,n),i=n>t?`\\`:`/`;if(r<0)return;if(r===0)return e.length>1?i:void 0;let a=e.slice(0,r);if(a.length===2&&a[1]===`:`){let t=`${a}${i}`;return t===e?void 0:t}return a}function joinPath(e,t){let n=e.includes(`\\`)?`\\`:`/`;return e.endsWith(n)?`${e}${t}`:`${e}${n}${t}`}const DEFAULT_MANIFEST_FILES=[`package.json`];function manifestHasMetadata(e){return e.name!==void 0||e.version!==void 0||e.description!==void 0||e.bin!==void 0||e.homepage!==void 0||e.repository!==void 0}async function discoverManifest(e,t={}){let n=t.files??DEFAULT_MANIFEST_FILES,r=t.startDir??e.cwd;for(;r!==void 0;){for(let t of n){let n=null;try{n=await e.readFile(joinPath(r,t))}catch{}if(n!==null){let e=parsePackageJson(n);if(e!==null&&manifestHasMetadata(e))return e}}r=parentDir(r)}return null}function isJsonWhitespace(e){return e===` `||e===` `||e===`
|
|
2
2
|
`||e===`\r`}function stripJsonc(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i]??``;if(n)t+=a,r?r=!1:a===`\\`?r=!0:a===`"`&&(n=!1);else if(a===`"`)n=!0,t+=a;else if(a===`/`&&e[i+1]===`/`){for(i+=2;i<e.length&&e[i]!==`
|
|
3
3
|
`;)i+=1;--i}else if(a===`/`&&e[i+1]===`*`){for(i+=2;i<e.length&&(e[i]!==`*`||e[i+1]!==`/`);)i+=1;i+=1}else t+=a}let i=``;n=!1,r=!1;for(let e=0;e<t.length;e+=1){let a=t[e]??``;if(n)i+=a,r?r=!1:a===`\\`?r=!0:a===`"`&&(n=!1);else if(a===`"`)n=!0,i+=a;else{if(a===`,`){let n=e+1;for(;n<t.length&&isJsonWhitespace(t[n]??``);)n+=1;let r=t[n];if(r===`}`||r===`]`)continue}i+=a}}return i}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{try{t=JSON.parse(stripJsonc(e))}catch{return null}}try{if(!isPlainObject(t))return null;let e=typeof t.name==`string`?t.name:void 0,n=typeof t.version==`string`?t.version:void 0,r=typeof t.description==`string`?t.description:void 0,i=parseBinField(t.bin),a=typeof t.homepage==`string`?t.homepage:void 0,o=parseRepositoryField(t.repository);return{...e===void 0?{}:{name:e},...n===void 0?{}:{version:n},...r===void 0?{}:{description:r},...i===void 0?{}:{bin:i},...a===void 0?{}:{homepage:a},...o===void 0?{}:{repository:o}}}catch{return null}}function parseBinField(e){if(typeof e==`string`)return e;if(!isPlainObject(e))return;let t={};for(let[n,r]of Object.entries(e)){if(typeof r!=`string`)return;t[n]=r}return t}function parseRepositoryField(e){if(typeof e==`string`)return e;if(!isPlainObject(e))return;let t=typeof e.type==`string`?e.type:void 0,n=typeof e.url==`string`?e.url:void 0,r=typeof e.directory==`string`?e.directory:void 0;if(t!==void 0||n!==void 0||r!==void 0)return{...t===void 0?{}:{type:t},...n===void 0?{}:{url:n},...r===void 0?{}:{directory:r}}}function inferCliName(e,t={}){if(typeof e.bin==`object`){let t=Object.keys(e.bin);if(t.length>0&&t[0]!==void 0)return t[0]}if(e.name!==void 0){if(t.stripScope===!1)return e.name;let n=e.name.indexOf(`/`);return n>=0?e.name.slice(n+1):e.name}}export{inferCliName as n,package_json_exports as r,discoverManifest as t};
|
package/dist/prompt.d.mts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Prompt engines.
|
|
3
|
+
*
|
|
4
|
+
* When stdin is a TTY and no prompter was injected, `CLIBuilder.run()` installs
|
|
5
|
+
* a thin engine that imports the terminal prompter the first time a prompt is
|
|
6
|
+
* presented; a run that never prompts never loads it. Import this module to
|
|
7
|
+
* drive prompts from a custom host or to build a prompt engine of your own
|
|
8
|
+
* against {@link PromptEngine}.
|
|
9
|
+
*
|
|
10
|
+
* @module @kjanat/dreamcli/prompt
|
|
11
|
+
*/
|
|
12
|
+
import { $ as InferPrompt, G as ResolvedSelectPromptConfig, H as ReadFn, K as resolvePromptConfig, Q as Ask, U as ResolvedMultiselectPromptConfig, V as PromptEngine, W as ResolvedPromptConfig, Z as WriteFn, et as prompt, zn as PasswordPromptConfig } from "./command-Cq6YZjEH.mjs";
|
|
2
13
|
import { t as CLIError } from "./index-D683D09G.mjs";
|
|
3
14
|
/** The user stopped an interaction. Unlike a skipped schema prompt, this aborts execution. */
|
|
4
15
|
export declare class PromptCancelledError extends CLIError {
|
package/dist/prompt.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as resolvePromptConfig,j as PromptCancelledError,r as prompt}from"./core-CPh0FcFg.mjs";import{t as createPromptSession}from"./session-BBRg9p2u.mjs";import{t as createTerminalPrompter}from"./terminal-mINn5p7B.mjs";export{PromptCancelledError,createPromptSession,createTerminalPrompter,prompt,resolvePromptConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __defProp=Object.defineProperty,__exportAll=(e,t)=>{let n=Object.setPrototypeOf({},null);for(var r in e)__defProp(n,r,{get:e[r],enumerable:!0});return t&1||__defProp(n,Symbol.toStringTag,{value:`Module`}),t&2?n:Object.preventExtensions(n)};export{__exportAll as t};
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Runtime adapters for platform portability (Node, Bun, Deno).
|
|
3
|
+
*
|
|
4
|
+
* Provides the {@link RuntimeAdapter} interface and concrete adapter
|
|
5
|
+
* factories for each supported platform.
|
|
6
|
+
*
|
|
7
|
+
* Start here when embedding DreamCLI in a real host runtime:
|
|
8
|
+
* - {@link createAdapter} for normal auto-detected production use
|
|
9
|
+
* - {@link createNodeAdapter} or {@link createDenoAdapter} when the runtime
|
|
10
|
+
* must be selected explicitly (Bun uses the Node adapter — its `process` is
|
|
11
|
+
* Node-compatible — so there is no separate Bun factory)
|
|
12
|
+
*
|
|
13
|
+
* Most applications do not need this subpath unless they are wiring DreamCLI
|
|
14
|
+
* into a custom host, testing runtime behavior directly, or building their own
|
|
15
|
+
* process/bootstrap layer.
|
|
16
|
+
*
|
|
17
|
+
* @module @kjanat/dreamcli/runtime
|
|
18
|
+
*/
|
|
19
|
+
import { I as ExitError, L as RuntimeAdapter, R as TerminalSize } from "./command-Cq6YZjEH.mjs";
|
|
20
|
+
import { a as createAdapter, c as Runtime, i as createDenoAdapter, l as detectRuntime, n as createNodeAdapter, o as GlobalForDetect, r as DenoNamespace, s as RUNTIMES, t as NodeProcess } from "./index-CLg6j-KJ.mjs";
|
|
3
21
|
export { type DenoNamespace, ExitError, type GlobalForDetect, type NodeProcess, RUNTIMES, type Runtime, type RuntimeAdapter, type TerminalSize, createAdapter, createDenoAdapter, createNodeAdapter, detectRuntime };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{D as ExitError,w as RUNTIMES,S as createAdapter,E as createDenoAdapter,C as createNodeAdapter,T as detectRuntime}from"./core-CPh0FcFg.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{A as resolvePromptConfig,_t as CLIError,j as PromptCancelledError,n as prepareTextAnswer}from"./core-CPh0FcFg.mjs";var session_exports=/* @__PURE__ */ __exportAll({createPromptSession:()=>createPromptSession});function createPromptSession(e){let t=!1;return{ask:async n=>{if(t)throw new CLIError(`A prompt is already active in this session`,{code:`PROMPT_BUSY`});if(e.prompter===void 0)throw new CLIError(`Interactive input is unavailable`,{code:`PROMPT_UNAVAILABLE`,suggest:`Supply input through command arguments, environment, or config, or run in an interactive terminal`});t=!0;try{let t=resolvePromptConfig(n,void 0),r={...t};(r.kind===`input`||r.kind===`password`)&&(delete r.validate,r.empty=`accept`,r.kind===`input`&&(r.trim=!1,r.default!==void 0&&(r.sensitive||(r.placeholder=[r.placeholder,`default: ${r.default}`].filter(e=>e!==void 0).join(`, `)),delete r.default)));for(let i=0;i<10;i++){let i=await e.prompter.promptOne(r);if(!i.answered)throw i.reason===`invalid`?new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2}):new PromptCancelledError;let a=i.value,o;if(n.kind===`input`||n.kind===`password`){if(typeof a!=`string`)o=`Please enter text.`;else{let e=await prepareTextAnswer(n,a);e.ok?a=e.value:o=e.message}}else if(n.kind===`confirm`)typeof a!=`boolean`&&(o=`Please answer yes or no.`);else{let e=t.kind===`select`||t.kind===`multiselect`?t.choices:[];if(n.kind===`select`)e.some(e=>e.value===a)||(o=`Please select an available choice.`);else if(!Array.isArray(a)||!a.every(t=>e.some(e=>e.value===t)))o=`Please select available choices.`;else{let e=[...new Set(a)];a=e,n.min!==void 0&&e.length<n.min&&(o=`Please select at least ${n.min}.`),n.max!==void 0&&e.length>n.max&&(o=`Please select at most ${n.max}.`)}}if(o===void 0)return a;e.write?.(`${o}\n`)}throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2})}finally{t=!1}}}}export{session_exports as n,createPromptSession as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as __exportAll}from"./rolldown-runtime-
|
|
1
|
+
import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{_t as CLIError,j as PromptCancelledError,n as prepareTextAnswer}from"./core-CPh0FcFg.mjs";var terminal_exports=/* @__PURE__ */ __exportAll({createTerminalPrompter:()=>createTerminalPrompter});function createTerminalPrompter(e,t,n){return{promptOne(r){switch(r.kind){case`confirm`:return promptConfirm(r,e,t);case`input`:return promptInput(r,e,t);case`password`:{let e=n?.readSecret;return e===void 0?Promise.reject(new CLIError(`Hidden password input is unavailable`,{code:`PROMPT_UNSUPPORTED`,suggest:`Use a runtime adapter or prompt engine with hidden-input support`})):promptInput(r,async()=>{try{let t=await e();if(t===null)throw new PromptCancelledError(`eof`);return t}finally{t(`
|
|
2
2
|
`)}},t)}case`select`:return promptSelect(r,e,t);case`multiselect`:return promptMultiselect(r,e,t)}}}}async function promptConfirm(e,t,n){let r=e.default??!0,i=0;for(;i<10;){let a=e.sensitive?`(y/n)`:r?`(Y/n)`:`(y/N)`;n(`${e.message} ${a} `);let o=await t();if(o===null)return{answered:!1};let s=o.trim().toLowerCase();if(s===``)return{answered:!0,value:r};if(s===`y`||s===`yes`)return{answered:!0,value:!0};if(s===`n`||s===`no`)return{answered:!0,value:!1};n(`Please answer y or n.
|
|
3
3
|
`),i+=1}return n(`Too many invalid attempts.
|
|
4
4
|
`),{answered:!1,reason:`invalid`}}async function promptInput(e,t,n){let r=0,i=[];e.kind===`input`&&e.placeholder!==void 0&&i.push(e.placeholder),e.kind===`input`&&e.default!==void 0&&!e.sensitive&&i.push(`default: ${e.default}`);let a=i.length>0?` (${i.join(`, `)})`:``;for(;r<10;){n(`${e.message}${a}: `);let i=await t();if(i===null)return{answered:!1};let o=await prepareTextAnswer(e,i);if(o.ok)return{answered:!0,value:o.value};n(`${o.message}\n`),r+=1}if(e.kind===`password`)throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2});return n(`Too many invalid attempts.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as __exportAll}from"./rolldown-runtime-DOYBPklu.mjs";import{_t as CLIError,j as PromptCancelledError,n as prepareTextAnswer}from"./core-CPh0FcFg.mjs";var test_prompter_exports=/* @__PURE__ */ __exportAll({createTestPrompter:()=>createTestPrompter});const PROMPT_CANCEL=Symbol.for(`dreamcli.prompt.cancel`);function createTestPrompter(e,t){let n=0;return{async promptOne(r){for(let i=0;i<10;i++){if(n>=e.length)return t?.onExhausted===`cancel`?Promise.resolve({answered:!1}):Promise.reject(/* @__PURE__ */ Error(`Test prompter exhausted: expected at most ${e.length} prompts, got prompt #${n+1}`));let i=e[n];if(n+=1,i===PROMPT_CANCEL){if(r.kind===`password`)throw new PromptCancelledError;return Promise.resolve({answered:!1})}if((r.kind===`input`||r.kind===`password`)&&typeof i==`string`){let e=await prepareTextAnswer(r,i);if(!e.ok&&(r.kind===`password`||e.reason===`empty`))continue;return e.ok?{answered:!0,value:e.value}:{answered:!1}}return Promise.resolve({answered:!0,value:i})}if(r.kind!==`password`)return{answered:!1,reason:`invalid`};throw new CLIError(`Too many invalid prompt answers`,{code:`PROMPT_INVALID`,exitCode:2})}}}export{createTestPrompter as n,test_prompter_exports as r,PROMPT_CANCEL as t};
|
package/dist/testkit.d.mts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Test utilities for DreamCLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides {@linkcode runCommand | runCommand()} — the in-process test harness — plus test doubles
|
|
5
|
+
* for output capture, prompt simulation, and runtime adaptation.
|
|
6
|
+
*
|
|
7
|
+
* Start here for most tests:
|
|
8
|
+
* - {@link runCommand} to execute a command in-process
|
|
9
|
+
* - {@link createCaptureOutput} to assert on raw output behavior
|
|
10
|
+
* - {@link createTestPrompter} to script interactive answers
|
|
11
|
+
* - {@link createTestAdapter} when you need adapter-level control
|
|
12
|
+
*
|
|
13
|
+
* @module @kjanat/dreamcli/testkit
|
|
14
|
+
*/
|
|
15
|
+
import { B as createTestAdapter, Gt as FlagBuilder, Kt as FlagConfig, Y as createCaptureOutput, a as CommandBuilder, nt as ArgBuilder, q as CapturedOutput, rt as ArgConfig, z as TestAdapterOptions } from "./command-Cq6YZjEH.mjs";
|
|
16
|
+
import { a as TestPrompterOptions, b as SkippedPathCheck, i as TestAnswer, j as BuiltinsConfig, n as RunResult, o as createTestPrompter, r as PROMPT_CANCEL, t as RunOptions } from "./index-BZ3jYjyh.mjs";
|
|
17
|
+
import "./index-CLg6j-KJ.mjs";
|
|
5
18
|
/**
|
|
6
19
|
* Options for {@linkcode runCommand}.
|
|
7
20
|
*
|
package/dist/testkit.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{M as createCaptureOutput,O as createTestAdapter,t as runCommand}from"./core-CPh0FcFg.mjs";import{n as createTestPrompter,t as PROMPT_CANCEL}from"./test-prompter-BI9sA9n7.mjs";export{PROMPT_CANCEL,createCaptureOutput,createTestAdapter,createTestPrompter,runCommand};
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const DREAMCLI_VERSION=`5.
|
|
1
|
+
const DREAMCLI_VERSION=`5.2.0`,DREAMCLI_REVISION=`ec4a86b`;export{DREAMCLI_REVISION,DREAMCLI_VERSION};
|
package/dreamcli.schema.json
CHANGED
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
"description": "Environment variable name for env resolution.\n\nWhen set and the CLI value is absent, the resolver reads this env var\nand coerces the string to the arg's declared kind.",
|
|
75
75
|
"type": "string"
|
|
76
76
|
},
|
|
77
|
+
"group": {
|
|
78
|
+
"description": "Named section in command help.",
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
77
81
|
"kind": {
|
|
78
82
|
"description": "What kind of value this arg accepts.",
|
|
79
83
|
"enum": [
|
|
@@ -265,10 +269,71 @@
|
|
|
265
269
|
"$ref": "#/$defs/command"
|
|
266
270
|
}
|
|
267
271
|
},
|
|
272
|
+
"constraints": {
|
|
273
|
+
"description": "Relationships checked after input resolution.",
|
|
274
|
+
"type": "array",
|
|
275
|
+
"items": {
|
|
276
|
+
"type": "object",
|
|
277
|
+
"required": [
|
|
278
|
+
"inputs",
|
|
279
|
+
"kind"
|
|
280
|
+
],
|
|
281
|
+
"properties": {
|
|
282
|
+
"inputs": {
|
|
283
|
+
"type": "array",
|
|
284
|
+
"minItems": 2,
|
|
285
|
+
"uniqueItems": true,
|
|
286
|
+
"items": {
|
|
287
|
+
"$ref": "#/$defs/constraintInput"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"kind": {
|
|
291
|
+
"enum": [
|
|
292
|
+
"conflicts",
|
|
293
|
+
"requires",
|
|
294
|
+
"exactlyOne",
|
|
295
|
+
"atMostOne",
|
|
296
|
+
"allOrNone"
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"additionalProperties": false,
|
|
301
|
+
"anyOf": [
|
|
302
|
+
{
|
|
303
|
+
"properties": {
|
|
304
|
+
"inputs": {
|
|
305
|
+
"maxItems": 2
|
|
306
|
+
},
|
|
307
|
+
"kind": {
|
|
308
|
+
"enum": [
|
|
309
|
+
"conflicts",
|
|
310
|
+
"requires"
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"properties": {
|
|
317
|
+
"kind": {
|
|
318
|
+
"enum": [
|
|
319
|
+
"exactlyOne",
|
|
320
|
+
"atMostOne",
|
|
321
|
+
"allOrNone"
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
268
329
|
"description": {
|
|
269
330
|
"description": "Human-readable description for help text.",
|
|
270
331
|
"type": "string"
|
|
271
332
|
},
|
|
333
|
+
"details": {
|
|
334
|
+
"description": "Longer explanation shown only in this command's help, with paragraphs wrapped to its width.",
|
|
335
|
+
"type": "string"
|
|
336
|
+
},
|
|
272
337
|
"examples": {
|
|
273
338
|
"description": "Usage examples for help text.",
|
|
274
339
|
"type": "array",
|
|
@@ -276,6 +341,14 @@
|
|
|
276
341
|
"$ref": "#/$defs/example"
|
|
277
342
|
}
|
|
278
343
|
},
|
|
344
|
+
"flagDeclarationOrder": {
|
|
345
|
+
"description": "Flag declaration order when it differs from the flag record's key order.",
|
|
346
|
+
"type": "array",
|
|
347
|
+
"uniqueItems": true,
|
|
348
|
+
"items": {
|
|
349
|
+
"type": "string"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
279
352
|
"flags": {
|
|
280
353
|
"description": "Named flag schemas, keyed by flag name.",
|
|
281
354
|
"type": "object",
|
|
@@ -326,10 +399,71 @@
|
|
|
326
399
|
"$ref": "#/$defs/command"
|
|
327
400
|
}
|
|
328
401
|
},
|
|
402
|
+
"constraints": {
|
|
403
|
+
"description": "Declarative relationships between the command's inputs.",
|
|
404
|
+
"type": "array",
|
|
405
|
+
"items": {
|
|
406
|
+
"type": "object",
|
|
407
|
+
"required": [
|
|
408
|
+
"inputs",
|
|
409
|
+
"kind"
|
|
410
|
+
],
|
|
411
|
+
"properties": {
|
|
412
|
+
"inputs": {
|
|
413
|
+
"type": "array",
|
|
414
|
+
"minItems": 2,
|
|
415
|
+
"uniqueItems": true,
|
|
416
|
+
"items": {
|
|
417
|
+
"$ref": "#/$defs/constraintInput"
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"kind": {
|
|
421
|
+
"enum": [
|
|
422
|
+
"conflicts",
|
|
423
|
+
"requires",
|
|
424
|
+
"exactlyOne",
|
|
425
|
+
"atMostOne",
|
|
426
|
+
"allOrNone"
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"additionalProperties": false,
|
|
431
|
+
"anyOf": [
|
|
432
|
+
{
|
|
433
|
+
"properties": {
|
|
434
|
+
"inputs": {
|
|
435
|
+
"maxItems": 2
|
|
436
|
+
},
|
|
437
|
+
"kind": {
|
|
438
|
+
"enum": [
|
|
439
|
+
"conflicts",
|
|
440
|
+
"requires"
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"properties": {
|
|
447
|
+
"kind": {
|
|
448
|
+
"enum": [
|
|
449
|
+
"exactlyOne",
|
|
450
|
+
"atMostOne",
|
|
451
|
+
"allOrNone"
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
},
|
|
329
459
|
"description": {
|
|
330
460
|
"description": "Human-readable description for help text.",
|
|
331
461
|
"type": "string"
|
|
332
462
|
},
|
|
463
|
+
"details": {
|
|
464
|
+
"description": "Longer explanation shown only in this command's help.",
|
|
465
|
+
"type": "string"
|
|
466
|
+
},
|
|
333
467
|
"envPrefix": {
|
|
334
468
|
"description": "CLI-wide environment namespace prepended to every relative env binding\n(`undefined` when none is set). `.env('TOKEN')` reads `<envPrefix>TOKEN`;\na binding declared with `{ absolute: true }` is read as written.\n\nSet via the .envPrefix() builder method\nor the `envPrefix` field of CLIDefinition. Fixed when declared, so\nneither manifest name inference nor an inherited invocation name changes it.",
|
|
335
469
|
"type": "string",
|
|
@@ -345,6 +479,14 @@
|
|
|
345
479
|
"$ref": "#/$defs/example"
|
|
346
480
|
}
|
|
347
481
|
},
|
|
482
|
+
"flagDeclarationOrder": {
|
|
483
|
+
"description": "Flag declaration order when it differs from the flag record's key order.",
|
|
484
|
+
"type": "array",
|
|
485
|
+
"uniqueItems": true,
|
|
486
|
+
"items": {
|
|
487
|
+
"type": "string"
|
|
488
|
+
}
|
|
489
|
+
},
|
|
348
490
|
"flags": {
|
|
349
491
|
"description": "Named flag definitions keyed by flag name.",
|
|
350
492
|
"type": "object",
|
|
@@ -352,6 +494,13 @@
|
|
|
352
494
|
"$ref": "#/$defs/flag"
|
|
353
495
|
}
|
|
354
496
|
},
|
|
497
|
+
"groupOrder": {
|
|
498
|
+
"description": "Named help groups to display first, in order.",
|
|
499
|
+
"type": "array",
|
|
500
|
+
"items": {
|
|
501
|
+
"type": "string"
|
|
502
|
+
}
|
|
503
|
+
},
|
|
355
504
|
"hidden": {
|
|
356
505
|
"description": "Whether the command is omitted from help listings.",
|
|
357
506
|
"const": true
|
|
@@ -367,6 +516,25 @@
|
|
|
367
516
|
},
|
|
368
517
|
"additionalProperties": false
|
|
369
518
|
},
|
|
519
|
+
"constraintInput": {
|
|
520
|
+
"type": "object",
|
|
521
|
+
"required": [
|
|
522
|
+
"kind",
|
|
523
|
+
"name"
|
|
524
|
+
],
|
|
525
|
+
"properties": {
|
|
526
|
+
"kind": {
|
|
527
|
+
"enum": [
|
|
528
|
+
"flag",
|
|
529
|
+
"arg"
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
"name": {
|
|
533
|
+
"type": "string"
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"additionalProperties": false
|
|
537
|
+
},
|
|
370
538
|
"envBound": {
|
|
371
539
|
"anyOf": [
|
|
372
540
|
{
|
|
@@ -469,6 +637,10 @@
|
|
|
469
637
|
"presence"
|
|
470
638
|
],
|
|
471
639
|
"properties": {
|
|
640
|
+
"advanced": {
|
|
641
|
+
"description": "Whether the flag is shown only in full text help.",
|
|
642
|
+
"const": true
|
|
643
|
+
},
|
|
472
644
|
"aliases": {
|
|
473
645
|
"description": "Short/long aliases (e.g. `[{ name: 'f', hidden: false }]` for `--force`).",
|
|
474
646
|
"type": "array",
|
|
@@ -547,6 +719,10 @@
|
|
|
547
719
|
"description": "Environment variable name for v0.2+ resolution.",
|
|
548
720
|
"type": "string"
|
|
549
721
|
},
|
|
722
|
+
"group": {
|
|
723
|
+
"description": "Named section in command help.",
|
|
724
|
+
"type": "string"
|
|
725
|
+
},
|
|
550
726
|
"kind": {
|
|
551
727
|
"description": "What kind of value this flag accepts.",
|
|
552
728
|
"enum": [
|
|
@@ -942,6 +1118,9 @@
|
|
|
942
1118
|
"when"
|
|
943
1119
|
],
|
|
944
1120
|
"properties": {
|
|
1121
|
+
"argv": {
|
|
1122
|
+
"const": false
|
|
1123
|
+
},
|
|
945
1124
|
"consume": {
|
|
946
1125
|
"description": "Whether this input consumes the stream alone.",
|
|
947
1126
|
"enum": [
|
|
@@ -1034,6 +1213,13 @@
|
|
|
1034
1213
|
"pattern": "[={}]"
|
|
1035
1214
|
}
|
|
1036
1215
|
},
|
|
1216
|
+
"groupOrder": {
|
|
1217
|
+
"description": "Named help groups to display first, in order.",
|
|
1218
|
+
"type": "array",
|
|
1219
|
+
"items": {
|
|
1220
|
+
"type": "string"
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1037
1223
|
"name": {
|
|
1038
1224
|
"description": "Program name (used in help text, usage lines, and completion scripts).",
|
|
1039
1225
|
"type": "string"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kjanat/dreamcli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Schema-first, fully typed TypeScript CLI framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dreamcli",
|
|
@@ -99,12 +99,11 @@
|
|
|
99
99
|
"docs:dev": "run --dir docs dev",
|
|
100
100
|
"docs:preview": "run --dir docs preview",
|
|
101
101
|
"docs:upload": "run --dir docs upload",
|
|
102
|
-
"fmt": "run -s lint:fix
|
|
103
|
-
"fmt:autofix": "
|
|
104
|
-
"fmt:
|
|
105
|
-
"
|
|
106
|
-
"format": "
|
|
107
|
-
"format:check": "dprint check",
|
|
102
|
+
"fmt": "run -s lint:fix format",
|
|
103
|
+
"fmt:autofix": "kprint fmt --allow-no-files --excludes .github",
|
|
104
|
+
"fmt:update": "kprint config update --yes --recursive",
|
|
105
|
+
"format": "bunx @kjanat/fmt",
|
|
106
|
+
"format:check": "kprint check",
|
|
108
107
|
"gh-project": "bun scripts/gh-project.ts",
|
|
109
108
|
"gh-project:finish": "bun gh-project finish",
|
|
110
109
|
"gh-project:list": "bun gh-project list",
|
|
@@ -140,18 +139,18 @@
|
|
|
140
139
|
"devDependencies": {
|
|
141
140
|
"@arethetypeswrong/core": "^0.18.5",
|
|
142
141
|
"@iarna/toml": "^2.2.5",
|
|
142
|
+
"@kprint/kprint": "0.63.0",
|
|
143
143
|
"@types/bun": "^1.4.3",
|
|
144
144
|
"@types/deno": "^2.7.0",
|
|
145
145
|
"@types/node": ">=26.6.5",
|
|
146
146
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
147
|
-
"@vitest/coverage-v8": "5.0
|
|
148
|
-
"biome": "npm:@biomejs/biome@^2.
|
|
149
|
-
"dprint": "0.64.3",
|
|
147
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
148
|
+
"biome": "npm:@biomejs/biome@^2.6.8",
|
|
150
149
|
"importmapify": "1.7.0",
|
|
151
|
-
"knip": "^6.
|
|
150
|
+
"knip": "^6.45.1",
|
|
152
151
|
"publint": "^0.3.25",
|
|
153
152
|
"runner-run": "0.28.0",
|
|
154
|
-
"tsdown": "0.23.
|
|
153
|
+
"tsdown": "0.23.7",
|
|
155
154
|
"typescript": ">=6.0.3,<7",
|
|
156
155
|
"vitest": "^5.0.5",
|
|
157
156
|
"yaml": "^2.9.1"
|
|
@@ -173,8 +172,8 @@
|
|
|
173
172
|
}
|
|
174
173
|
},
|
|
175
174
|
"volta": {
|
|
176
|
-
"node": "26.
|
|
177
|
-
"npm": "
|
|
175
|
+
"node": "26.13.1",
|
|
176
|
+
"npm": "12.2.3"
|
|
178
177
|
},
|
|
179
178
|
"publishConfig": {
|
|
180
179
|
"access": "public"
|
|
@@ -52,7 +52,7 @@ deno doc --filter=CLIBuilder jsr:@kjanat/dreamcli 2>/dev/null # one symbol
|
|
|
52
52
|
`2>/dev/null` matters: deno writes download and type-check progress to stderr,
|
|
53
53
|
which otherwise swamps the documentation output.
|
|
54
54
|
|
|
55
|
-
Pin a version with `jsr:@kjanat/dreamcli@
|
|
55
|
+
Pin a version with `jsr:@kjanat/dreamcli@5.1.0` when the project is not on
|
|
56
56
|
latest. `--filter` takes a declaration name; it prints nothing for a name that
|
|
57
57
|
does not exist, which is itself a useful signal.
|
|
58
58
|
|