@optique/prompt 1.3.0-dev.2576 → 1.3.0-dev.2581
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.cjs +8 -1
- package/dist/index.js +8 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -339,6 +339,7 @@ function createPromptAdapter(adapter) {
|
|
|
339
339
|
},
|
|
340
340
|
parse: (context) => {
|
|
341
341
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
342
|
+
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
342
343
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
343
344
|
const baseInnerContext = innerState !== context.state ? {
|
|
344
345
|
...context,
|
|
@@ -348,7 +349,8 @@ function createPromptAdapter(adapter) {
|
|
|
348
349
|
const processResult = (result$1) => {
|
|
349
350
|
if (result$1.success) {
|
|
350
351
|
const cliState = annotations != null && result$1.next.state != null && typeof result$1.next.state === "object" && (0, __optique_core_annotations.getAnnotations)(result$1.next.state) !== annotations ? (0, __optique_core_extension.injectAnnotations)(result$1.next.state, annotations) : result$1.next.state;
|
|
351
|
-
const
|
|
352
|
+
const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
|
|
353
|
+
const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
|
|
352
354
|
const nextState$1 = (0, __optique_core_extension.injectAnnotations)({
|
|
353
355
|
[promptBindStateKey]: true,
|
|
354
356
|
hasCliValue: cliConsumed,
|
|
@@ -365,6 +367,11 @@ function createPromptAdapter(adapter) {
|
|
|
365
367
|
};
|
|
366
368
|
}
|
|
367
369
|
if (result$1.consumed > 0) return result$1;
|
|
370
|
+
if (hadCliValue) return {
|
|
371
|
+
success: true,
|
|
372
|
+
next: context,
|
|
373
|
+
consumed: []
|
|
374
|
+
};
|
|
368
375
|
const nextState = (0, __optique_core_extension.injectAnnotations)({
|
|
369
376
|
[promptBindStateKey]: true,
|
|
370
377
|
hasCliValue: false
|
package/dist/index.js
CHANGED
|
@@ -316,6 +316,7 @@ function createPromptAdapter(adapter) {
|
|
|
316
316
|
},
|
|
317
317
|
parse: (context) => {
|
|
318
318
|
const annotations = getAnnotations(context.state);
|
|
319
|
+
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
319
320
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
320
321
|
const baseInnerContext = innerState !== context.state ? {
|
|
321
322
|
...context,
|
|
@@ -325,7 +326,8 @@ function createPromptAdapter(adapter) {
|
|
|
325
326
|
const processResult = (result$1) => {
|
|
326
327
|
if (result$1.success) {
|
|
327
328
|
const cliState = annotations != null && result$1.next.state != null && typeof result$1.next.state === "object" && getAnnotations(result$1.next.state) !== annotations ? injectAnnotations(result$1.next.state, annotations) : result$1.next.state;
|
|
328
|
-
const
|
|
329
|
+
const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
|
|
330
|
+
const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
|
|
329
331
|
const nextState$1 = injectAnnotations({
|
|
330
332
|
[promptBindStateKey]: true,
|
|
331
333
|
hasCliValue: cliConsumed,
|
|
@@ -342,6 +344,11 @@ function createPromptAdapter(adapter) {
|
|
|
342
344
|
};
|
|
343
345
|
}
|
|
344
346
|
if (result$1.consumed > 0) return result$1;
|
|
347
|
+
if (hadCliValue) return {
|
|
348
|
+
success: true,
|
|
349
|
+
next: context,
|
|
350
|
+
consumed: []
|
|
351
|
+
};
|
|
345
352
|
const nextState = injectAnnotations({
|
|
346
353
|
[promptBindStateKey]: true,
|
|
347
354
|
hasCliValue: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/prompt",
|
|
3
|
-
"version": "1.3.0-dev.
|
|
3
|
+
"version": "1.3.0-dev.2581",
|
|
4
4
|
"description": "Generic prompt adapter support for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
},
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@optique/core": "1.3.0-dev.
|
|
63
|
+
"@optique/core": "1.3.0-dev.2581+50dd484c"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@optique/config": "1.3.0-dev.
|
|
67
|
-
"@optique/env": "1.3.0-dev.
|
|
68
|
-
"@optique/run": "1.3.0-dev.
|
|
66
|
+
"@optique/config": "1.3.0-dev.2581+50dd484c",
|
|
67
|
+
"@optique/env": "1.3.0-dev.2581+50dd484c",
|
|
68
|
+
"@optique/run": "1.3.0-dev.2581+50dd484c",
|
|
69
69
|
"@types/node": "^24.0.0",
|
|
70
70
|
"fast-check": "^4.7.0",
|
|
71
71
|
"tsdown": "^0.13.0",
|