@juicesharp/rpiv-ask-user-question 1.8.0 → 1.8.2
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/config.ts +5 -34
- package/package.json +86 -83
package/config.ts
CHANGED
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { join } from "node:path";
|
|
1
|
+
import type { GuidanceFields } from "@juicesharp/rpiv-config";
|
|
2
|
+
import { configPath, loadJsonConfig, validateGuidanceFields } from "@juicesharp/rpiv-config";
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
7
|
-
|
|
8
|
-
interface GuidanceFields {
|
|
9
|
-
promptSnippet?: string;
|
|
10
|
-
promptGuidelines?: string[];
|
|
11
|
-
}
|
|
4
|
+
const CONFIG_PATH = configPath("rpiv-ask-user-question");
|
|
12
5
|
|
|
13
6
|
interface AskUserQuestionConfig {
|
|
14
7
|
guidance?: GuidanceFields;
|
|
15
8
|
}
|
|
16
9
|
|
|
17
10
|
export function loadConfig(): AskUserQuestionConfig {
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf-8")) as unknown;
|
|
21
|
-
if (parsed === null || typeof parsed !== "object") return {};
|
|
22
|
-
return parsed as AskUserQuestionConfig;
|
|
23
|
-
} catch {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
11
|
+
return loadJsonConfig<AskUserQuestionConfig>(CONFIG_PATH);
|
|
26
12
|
}
|
|
27
13
|
|
|
28
|
-
export
|
|
29
|
-
if (!fields || typeof fields !== "object") return {};
|
|
30
|
-
const g = fields as Record<string, unknown>;
|
|
31
|
-
const result: GuidanceFields = {};
|
|
32
|
-
if (typeof g.promptSnippet === "string" && g.promptSnippet.length > 0) {
|
|
33
|
-
result.promptSnippet = g.promptSnippet;
|
|
34
|
-
}
|
|
35
|
-
if (
|
|
36
|
-
Array.isArray(g.promptGuidelines) &&
|
|
37
|
-
g.promptGuidelines.length > 0 &&
|
|
38
|
-
g.promptGuidelines.every((s) => typeof s === "string" && s.length > 0)
|
|
39
|
-
) {
|
|
40
|
-
result.promptGuidelines = g.promptGuidelines;
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
14
|
+
export { validateGuidanceFields };
|
package/package.json
CHANGED
|
@@ -1,85 +1,88 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
2
|
+
"name": "@juicesharp/rpiv-ask-user-question",
|
|
3
|
+
"version": "1.8.2",
|
|
4
|
+
"description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi-extension",
|
|
8
|
+
"rpiv"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "juicesharp",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/juicesharp/rpiv-mono.git",
|
|
16
|
+
"directory": "packages/rpiv-ask-user-question"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-ask-user-question#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/juicesharp/rpiv-mono/issues"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "vitest run"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"ask-user-question.ts",
|
|
30
|
+
"config.ts",
|
|
31
|
+
"index.ts",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"locales/",
|
|
34
|
+
"README.md",
|
|
35
|
+
"state/build-questionnaire.ts",
|
|
36
|
+
"state/i18n-bridge.ts",
|
|
37
|
+
"state/key-router.ts",
|
|
38
|
+
"state/questionnaire-session.ts",
|
|
39
|
+
"state/row-intent.ts",
|
|
40
|
+
"state/selectors/contract.ts",
|
|
41
|
+
"state/selectors/derivations.ts",
|
|
42
|
+
"state/selectors/focus.ts",
|
|
43
|
+
"state/selectors/projections.ts",
|
|
44
|
+
"state/state-reducer.ts",
|
|
45
|
+
"state/state.ts",
|
|
46
|
+
"tool/format-answer.ts",
|
|
47
|
+
"tool/response-envelope.ts",
|
|
48
|
+
"tool/types.ts",
|
|
49
|
+
"tool/validate-questionnaire.ts",
|
|
50
|
+
"view/body-residual-spacer.ts",
|
|
51
|
+
"view/component-binding.ts",
|
|
52
|
+
"view/components/chat-row-view.ts",
|
|
53
|
+
"view/components/multi-select-view.ts",
|
|
54
|
+
"view/components/option-list-view.ts",
|
|
55
|
+
"view/components/preview/markdown-content-cache.ts",
|
|
56
|
+
"view/components/preview/preview-block-renderer.ts",
|
|
57
|
+
"view/components/preview/preview-box-renderer.ts",
|
|
58
|
+
"view/components/preview/preview-layout-decider.ts",
|
|
59
|
+
"view/components/preview/preview-pane.ts",
|
|
60
|
+
"view/components/submit-picker.ts",
|
|
61
|
+
"view/components/tab-bar.ts",
|
|
62
|
+
"view/components/wrapping-select.ts",
|
|
63
|
+
"view/dialog-builder.ts",
|
|
64
|
+
"view/props-adapter.ts",
|
|
65
|
+
"view/stateful-view.ts",
|
|
66
|
+
"view/tab-components.ts",
|
|
67
|
+
"view/tab-content-strategy.ts"
|
|
68
|
+
],
|
|
69
|
+
"pi": {
|
|
70
|
+
"extensions": [
|
|
71
|
+
"./index.ts"
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@juicesharp/rpiv-i18n": "*",
|
|
76
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
77
|
+
"@earendil-works/pi-tui": "*",
|
|
78
|
+
"typebox": "*"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@juicesharp/rpiv-i18n": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"dependencies": {
|
|
86
|
+
"@juicesharp/rpiv-config": "^1.8.2"
|
|
87
|
+
}
|
|
85
88
|
}
|