@optique/prompt 1.2.5 → 1.2.7
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
|
@@ -136,6 +136,7 @@ function createPromptAdapter(adapter) {
|
|
|
136
136
|
},
|
|
137
137
|
parse: (context) => {
|
|
138
138
|
const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
|
|
139
|
+
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
139
140
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
140
141
|
const baseInnerContext = innerState !== context.state ? {
|
|
141
142
|
...context,
|
|
@@ -145,7 +146,8 @@ function createPromptAdapter(adapter) {
|
|
|
145
146
|
const processResult = (result$1) => {
|
|
146
147
|
if (result$1.success) {
|
|
147
148
|
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;
|
|
148
|
-
const
|
|
149
|
+
const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
|
|
150
|
+
const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
|
|
149
151
|
const nextState$1 = (0, __optique_core_extension.injectAnnotations)({
|
|
150
152
|
[promptBindStateKey]: true,
|
|
151
153
|
hasCliValue: cliConsumed,
|
|
@@ -162,6 +164,11 @@ function createPromptAdapter(adapter) {
|
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
166
|
if (result$1.consumed > 0) return result$1;
|
|
167
|
+
if (hadCliValue) return {
|
|
168
|
+
success: true,
|
|
169
|
+
next: context,
|
|
170
|
+
consumed: []
|
|
171
|
+
};
|
|
165
172
|
const nextState = (0, __optique_core_extension.injectAnnotations)({
|
|
166
173
|
[promptBindStateKey]: true,
|
|
167
174
|
hasCliValue: false
|
package/dist/index.js
CHANGED
|
@@ -113,6 +113,7 @@ function createPromptAdapter(adapter) {
|
|
|
113
113
|
},
|
|
114
114
|
parse: (context) => {
|
|
115
115
|
const annotations = getAnnotations(context.state);
|
|
116
|
+
const hadCliValue = isPromptBindState(context.state) && context.state.hasCliValue;
|
|
116
117
|
const innerState = isPromptBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
|
|
117
118
|
const baseInnerContext = innerState !== context.state ? {
|
|
118
119
|
...context,
|
|
@@ -122,7 +123,8 @@ function createPromptAdapter(adapter) {
|
|
|
122
123
|
const processResult = (result$1) => {
|
|
123
124
|
if (result$1.success) {
|
|
124
125
|
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;
|
|
125
|
-
const
|
|
126
|
+
const terminatorOnly = result$1.consumed.length === 1 && result$1.consumed[0] === "--" && !context.optionsTerminated && result$1.next.optionsTerminated;
|
|
127
|
+
const cliConsumed = hadCliValue || result$1.consumed.length > 0 && !terminatorOnly;
|
|
126
128
|
const nextState$1 = injectAnnotations({
|
|
127
129
|
[promptBindStateKey]: true,
|
|
128
130
|
hasCliValue: cliConsumed,
|
|
@@ -139,6 +141,11 @@ function createPromptAdapter(adapter) {
|
|
|
139
141
|
};
|
|
140
142
|
}
|
|
141
143
|
if (result$1.consumed > 0) return result$1;
|
|
144
|
+
if (hadCliValue) return {
|
|
145
|
+
success: true,
|
|
146
|
+
next: context,
|
|
147
|
+
consumed: []
|
|
148
|
+
};
|
|
142
149
|
const nextState = injectAnnotations({
|
|
143
150
|
[promptBindStateKey]: true,
|
|
144
151
|
hasCliValue: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/prompt",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
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.2.
|
|
63
|
+
"@optique/core": "1.2.7"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@optique/config": "1.2.
|
|
67
|
-
"@optique/env": "1.2.
|
|
68
|
-
"@optique/run": "1.2.
|
|
66
|
+
"@optique/config": "1.2.7",
|
|
67
|
+
"@optique/env": "1.2.7",
|
|
68
|
+
"@optique/run": "1.2.7",
|
|
69
69
|
"@types/node": "^24.0.0",
|
|
70
70
|
"fast-check": "^4.7.0",
|
|
71
71
|
"tsdown": "^0.13.0",
|