@t4h.framework/cli 0.0.0-experimental-20260731180758 → 0.0.0-experimental-20260902161345
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/CHANGELOG.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# @t4h.framework/cli
|
|
2
|
+
|
|
3
|
+
## 0.0.0-experimental-20260902161345
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#145](https://github.com/tech4humans-brasil/framework/pull/145) [`13c7a2e`](https://github.com/tech4humans-brasil/framework/commit/13c7a2e80ad5cd3e9ab10ebe5f3cdfc66f4bc664) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Replaces the interactive REPL of `framework dev` with an HTTP dev server: Hono routes workflow (`POST /projects/:projectId/workflows/:workflowId/runs` answers `201 { id }`, `PATCH .../runs/:runId/activities/:activityId` advances a pending async activity), mandatory workflow authorization resolved from the app/workflow `Authorization` manifest, `/_dev` routes for tooling (manifest, runs, waiting activities, env, SSE events) and Vite in middleware mode for a UI. Workflow runs now live in an in-memory SQLite database inside the app process, the ORM dev claim stores its rows in `db.sqlite` instead of rewriting `db.json` on every change, child workflows run in parallel, and `framework dev` gains `--port` (`PORT`) and `--host`. `DevServer` and `isWorkflowWaiting` are gone; use `Server`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`13c7a2e`](https://github.com/tech4humans-brasil/framework/commit/13c7a2e80ad5cd3e9ab10ebe5f3cdfc66f4bc664)]:
|
|
12
|
+
- @t4h.framework/dev@0.0.0-experimental-20260902161345
|
|
13
|
+
|
|
14
|
+
## 0.15.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`ac74216`](https://github.com/tech4humans-brasil/framework/commit/ac742161d9293522c716f0cd7e6a8d3ab0000403) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Republishes the CLI. `0.15.3` was unpublished from npm and the registry refuses to reuse a version number, which made the publish step of every later release fail on this package (and abort the packages after it).
|
|
19
|
+
|
|
20
|
+
## 0.15.3
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`8c56f76`](https://github.com/tech4humans-brasil/framework/commit/8c56f7697390a1ea966d1e91ff5f35ce5751a0d7), [`8c56f76`](https://github.com/tech4humans-brasil/framework/commit/8c56f7697390a1ea966d1e91ff5f35ce5751a0d7)]:
|
|
25
|
+
- @t4h.framework/dev@0.14.0
|
|
26
|
+
|
|
27
|
+
## 0.15.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [[`920ab82`](https://github.com/tech4humans-brasil/framework/commit/920ab82aaf9e78d36939be934312eb6992d495a0)]:
|
|
32
|
+
- @t4h.framework/harness@0.3.0
|
|
33
|
+
|
|
34
|
+
## 0.15.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- [`095c3a9`](https://github.com/tech4humans-brasil/framework/commit/095c3a91191b9f541519447f212a8e9509065569) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Republish with resolved dependency versions. The previous release leaked the `workspace:^` protocol into the published manifests, breaking installs outside the monorepo.
|
|
39
|
+
|
|
40
|
+
- Updated dependencies [[`095c3a9`](https://github.com/tech4humans-brasil/framework/commit/095c3a91191b9f541519447f212a8e9509065569)]:
|
|
41
|
+
- @t4h.framework/dev@0.13.1
|
|
42
|
+
|
|
43
|
+
## 0.15.0
|
|
44
|
+
|
|
45
|
+
### Minor Changes
|
|
46
|
+
|
|
47
|
+
- [`9171168`](https://github.com/tech4humans-brasil/framework/commit/917116807182d28de7b368e8648560efca9e5559) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Remove react server conditions
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [[`9171168`](https://github.com/tech4humans-brasil/framework/commit/917116807182d28de7b368e8648560efca9e5559), [`9171168`](https://github.com/tech4humans-brasil/framework/commit/917116807182d28de7b368e8648560efca9e5559)]:
|
|
52
|
+
- @t4h.framework/dev@0.13.0
|
|
53
|
+
|
|
54
|
+
## 0.14.0
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Internal dependency updates
|
|
59
|
+
|
|
60
|
+
## 0.12.0
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Internal dependency updates
|
|
65
|
+
|
|
66
|
+
## 0.11.0
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Internal dependency updates
|
|
71
|
+
|
|
72
|
+
## 0.10.0
|
|
73
|
+
|
|
74
|
+
### Minor Changes
|
|
75
|
+
|
|
76
|
+
- Implements harness package ([#102](https://github.com/tech4humans-brasil/framework/pull/102))
|
|
77
|
+
|
|
78
|
+
## 0.9.1
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Internal dependency updates
|
|
83
|
+
|
|
84
|
+
## 0.9.0
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- Internal dependency updates
|
|
89
|
+
|
|
90
|
+
## 0.8.0
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Internal dependency updates
|
|
95
|
+
|
|
96
|
+
## 0.7.0
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- Internal dependency updates
|
|
101
|
+
|
|
102
|
+
## 0.6.1
|
|
103
|
+
|
|
104
|
+
### Minor Changes
|
|
105
|
+
|
|
106
|
+
- Handle uncaught exceptions ([`eb90051`](https://github.com/tech4humans-brasil/framework/commit/eb90051f72aa9df388169075554d27a8a60c597c))
|
|
107
|
+
|
|
108
|
+
## 0.5.0
|
|
109
|
+
|
|
110
|
+
### Minor Changes
|
|
111
|
+
|
|
112
|
+
- Implements logger ([#82](https://github.com/tech4humans-brasil/framework/pull/82))
|
|
113
|
+
- Adds dev server sftp claim ([#78](https://github.com/tech4humans-brasil/framework/pull/78))
|
|
114
|
+
- Adds skills copy command ([#87](https://github.com/tech4humans-brasil/framework/pull/87))
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- Dev server ([#75](https://github.com/tech4humans-brasil/framework/pull/75))
|
|
119
|
+
- Move dev server to its own package ([#83](https://github.com/tech4humans-brasil/framework/pull/83))
|
|
120
|
+
|
|
121
|
+
## 0.4.1
|
|
122
|
+
|
|
123
|
+
### Minor Changes
|
|
124
|
+
|
|
125
|
+
- Build app manifest in core package ([`58c8a63`](https://github.com/tech4humans-brasil/framework/commit/58c8a63fd0475c09d67f3283bb18719b89497f13))
|
|
126
|
+
- Adds support to env in build ([`8740c65`](https://github.com/tech4humans-brasil/framework/commit/8740c65ac759c570e52424b81def34c480540aab))
|
|
127
|
+
- Adds cli dev server ([`eaa5bc8`](https://github.com/tech4humans-brasil/framework/commit/eaa5bc8b443d27efcf0c1e95f384713df2a73a71))
|
|
128
|
+
- Adds async support for serialization ([#10](https://github.com/tech4humans-brasil/framework/pull/10))
|
|
129
|
+
- Adds support to follow redirect in dev server ([`42c76fb`](https://github.com/tech4humans-brasil/framework/commit/42c76fbc237a50454c98a876e381d2489db2ee35))
|
|
130
|
+
- Implements smtp activity ([`ca20afd`](https://github.com/tech4humans-brasil/framework/commit/ca20afdfc324a1004e77ef1881c049e7f97f0eff))
|
|
131
|
+
- Adds type to history item ([#47](https://github.com/tech4humans-brasil/framework/pull/47))
|
|
132
|
+
- Adds support to authorization ([#51](https://github.com/tech4humans-brasil/framework/pull/51))
|
|
133
|
+
- Adds support to async activity on dev server ([#69](https://github.com/tech4humans-brasil/framework/pull/69))
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- Import correct json module on package json ([`3a7c826`](https://github.com/tech4humans-brasil/framework/commit/3a7c8263d701ebab2917e6b11497d7d2bffc9c8a))
|
|
138
|
+
- Rename activity history to history ([`4eaad08`](https://github.com/tech4humans-brasil/framework/commit/4eaad08468815bcdea14c36468c7904655715406))
|
|
139
|
+
- Move run activity and workflow to internal tool ([`e061349`](https://github.com/tech4humans-brasil/framework/commit/e061349de925074f838e82149f7566ddcffc4870))
|
|
140
|
+
- Remove activity prefix from file system claim class name ([`d257bd1`](https://github.com/tech4humans-brasil/framework/commit/d257bd177d477a56a897ba862a0be1f50531c633))
|
|
141
|
+
- Remove activity prefix from http client request claim class name ([`5d37e31`](https://github.com/tech4humans-brasil/framework/commit/5d37e315bafecf949e4c69651c22a4ba4232fe16))
|
|
142
|
+
- Fix eslint warnings and errors ([`9a7eeb5`](https://github.com/tech4humans-brasil/framework/commit/9a7eeb52d81a5e99c44819e8271db7f35b6c5195))
|
|
143
|
+
- Adds github workflow to run, build, tests and lint ([#18](https://github.com/tech4humans-brasil/framework/pull/18))
|
|
144
|
+
- Dont exit process on relaunch cli ([`771741b`](https://github.com/tech4humans-brasil/framework/commit/771741b2cfeb399c620715e005793f2b882a9e88))
|
|
145
|
+
- Simplify dev server file binary constructor ([`858d5ae`](https://github.com/tech4humans-brasil/framework/commit/858d5ae24f3830a47759279a19f658a11dd11d00))
|
|
146
|
+
- Remove runtime from repo ([`751f792`](https://github.com/tech4humans-brasil/framework/commit/751f7920fceef0fe737365c7226c313c9cc1392d))
|
|
147
|
+
- Update package metadata and author information across multiple packages ([`2ca73df`](https://github.com/tech4humans-brasil/framework/commit/2ca73df42dc63c86ed44717b50d5402fca45b4e7))
|
|
148
|
+
- Improve repository info ([`1fad92d`](https://github.com/tech4humans-brasil/framework/commit/1fad92d959b804189fd1486d047115995ac81eb0))
|
|
149
|
+
- Up repo coverage ([`24c057c`](https://github.com/tech4humans-brasil/framework/commit/24c057c470d0829ea9a1e1f71011b6eff408180c))
|
|
150
|
+
- Fix check types and lint errors ([`00ca0df`](https://github.com/tech4humans-brasil/framework/commit/00ca0dfe6c2fddbc4e0dbeefb1556d172c752c55))
|
|
151
|
+
- Update package dependencies across multiple packages ([`8b4fc1d`](https://github.com/tech4humans-brasil/framework/commit/8b4fc1d0e92d6bd880ddf4c8119fb68c49c53760))
|
|
152
|
+
- Fix cli dependencies ([`ddcd660`](https://github.com/tech4humans-brasil/framework/commit/ddcd660dbd50f2fc25198585c3d8e5e052b7f832))
|
package/dist/bin/bin.js
CHANGED
|
File without changes
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { parseEnv } from 'node:util';
|
|
4
|
-
import {
|
|
5
|
-
import { input, select } from '@inquirer/prompts';
|
|
6
|
-
import { DevServer, isWorkflowWaiting } from '@t4h.framework/dev';
|
|
4
|
+
import { Server } from '@t4h.framework/dev';
|
|
7
5
|
import { Command, Option } from 'commander';
|
|
8
|
-
import { jsonSchemaToInquirerQuestion } from '../../tools/json-schema-to-inquirer-question.js';
|
|
9
6
|
export const devCommand = new Command('dev')
|
|
10
7
|
.description('Start the development server')
|
|
11
8
|
.option('--entrypoint <entrypoint path>', 'The entrypoint package json path', './package.json')
|
|
@@ -23,140 +20,26 @@ export const devCommand = new Command('dev')
|
|
|
23
20
|
})
|
|
24
21
|
.default({}))
|
|
25
22
|
.addOption(new Option('--env-file-if-exists <file-path>', 'Load variables from a .env file if it exists').argParser(value => path.resolve(process.cwd(), value)))
|
|
23
|
+
.addOption(new Option('-p, --port <port>', 'The HTTP port')
|
|
24
|
+
.env('PORT')
|
|
25
|
+
.default(3000)
|
|
26
|
+
.argParser(value => Number.parseInt(value, 10)))
|
|
27
|
+
.addOption(new Option('--host <host>', 'The HTTP host').default('localhost'))
|
|
26
28
|
.action(async (options) => {
|
|
27
|
-
let abortController = null;
|
|
28
|
-
let currentLoopPromise = null;
|
|
29
29
|
if (options.envFileIfExists && fs.existsSync(options.envFileIfExists))
|
|
30
30
|
Object.assign(options.env, parseEnv(fs.readFileSync(options.envFileIfExists, 'utf8')));
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
await currentLoopPromise.catch(() => { });
|
|
37
|
-
}
|
|
38
|
-
console.clear();
|
|
39
|
-
abortController = new AbortController();
|
|
40
|
-
const currentSignal = abortController.signal;
|
|
41
|
-
currentLoopPromise = (async () => {
|
|
42
|
-
await Promise.all(Object.entries(options.env).map(([name, value]) => devServer.setEnv(name, value)));
|
|
43
|
-
async function selectWorkflowToRun() {
|
|
44
|
-
const fn = await select({
|
|
45
|
-
message: 'Select a workflow to run',
|
|
46
|
-
choices: [
|
|
47
|
-
...manifest.workflows.map(workflow => ({
|
|
48
|
-
name: workflow.id,
|
|
49
|
-
value: async () => {
|
|
50
|
-
let input;
|
|
51
|
-
if (workflow.schema)
|
|
52
|
-
input = await jsonSchemaToInquirerQuestion(workflow.schema, {
|
|
53
|
-
signal: currentSignal,
|
|
54
|
-
});
|
|
55
|
-
const result = await devServer.runWorkflow(workflow.id, input);
|
|
56
|
-
if (isWorkflowWaiting(result))
|
|
57
|
-
console.log(`Workflow paused on async activity. Pending id: ${result.id}\nUse "Advance pending async activity" to continue.`);
|
|
58
|
-
},
|
|
59
|
-
})),
|
|
60
|
-
{
|
|
61
|
-
name: '.. (Go Back)',
|
|
62
|
-
value: async () => { },
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
}, { signal: currentSignal });
|
|
66
|
-
await fn();
|
|
67
|
-
}
|
|
68
|
-
async function selectEnvToSet() {
|
|
69
|
-
const fn = await select({
|
|
70
|
-
message: 'Select an environment variable to set',
|
|
71
|
-
choices: [
|
|
72
|
-
...Object.entries(manifest.env.properties).map(([name]) => ({
|
|
73
|
-
name: name,
|
|
74
|
-
value: async () => {
|
|
75
|
-
const value = await input({ message: `Enter the value for ${name}` }, { signal: currentSignal });
|
|
76
|
-
await devServer.setEnv(name, value);
|
|
77
|
-
},
|
|
78
|
-
})),
|
|
79
|
-
{
|
|
80
|
-
name: '.. (Go Back)',
|
|
81
|
-
value: async () => { },
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
}, { signal: currentSignal });
|
|
85
|
-
await fn();
|
|
86
|
-
}
|
|
87
|
-
async function advancePendingAsyncActivity() {
|
|
88
|
-
const waitingActivities = await devServer.listWaitingAsyncActivities();
|
|
89
|
-
if (waitingActivities.length === 0) {
|
|
90
|
-
console.log('No pending async activities.');
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
console.table(waitingActivities);
|
|
94
|
-
const fn = await select({
|
|
95
|
-
message: 'Select a pending async activity to advance',
|
|
96
|
-
choices: [
|
|
97
|
-
...waitingActivities.map((activity) => ({
|
|
98
|
-
name: `${activity.id} (workflow: ${activity.workflowId})`,
|
|
99
|
-
value: async () => {
|
|
100
|
-
let input;
|
|
101
|
-
if (activity.schema)
|
|
102
|
-
input = await jsonSchemaToInquirerQuestion(activity.schema, {
|
|
103
|
-
signal: currentSignal,
|
|
104
|
-
});
|
|
105
|
-
const result = await devServer.advanceAsyncActivity(activity.id, input);
|
|
106
|
-
if (isWorkflowWaiting(result)) {
|
|
107
|
-
console.log(`Workflow still paused. Pending id: ${result.id}`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
console.log('Workflow result:', result);
|
|
111
|
-
},
|
|
112
|
-
})),
|
|
113
|
-
{
|
|
114
|
-
name: '.. (Go Back)',
|
|
115
|
-
value: async () => { },
|
|
116
|
-
},
|
|
117
|
-
],
|
|
118
|
-
}, { signal: currentSignal });
|
|
119
|
-
await fn();
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
while (!currentSignal.aborted) {
|
|
123
|
-
const choice = await select({
|
|
124
|
-
message: 'Select an option',
|
|
125
|
-
choices: [
|
|
126
|
-
{
|
|
127
|
-
name: 'List environment variables',
|
|
128
|
-
value: async () => {
|
|
129
|
-
const env = await devServer.listEnv();
|
|
130
|
-
console.table(env);
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'Set environment variable',
|
|
135
|
-
value: selectEnvToSet,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'Run workflow',
|
|
139
|
-
value: selectWorkflowToRun,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'Advance pending async activity',
|
|
143
|
-
value: advancePendingAsyncActivity,
|
|
144
|
-
},
|
|
145
|
-
{ name: 'Exit', value: async () => process.exit(0) },
|
|
146
|
-
],
|
|
147
|
-
}, {
|
|
148
|
-
signal: currentSignal,
|
|
149
|
-
});
|
|
150
|
-
await choice();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
catch (error) {
|
|
154
|
-
if (error instanceof AbortPromptError)
|
|
155
|
-
return;
|
|
156
|
-
throw error;
|
|
157
|
-
}
|
|
158
|
-
})();
|
|
31
|
+
const server = new Server({
|
|
32
|
+
entrypoint: options.entrypoint,
|
|
33
|
+
env: options.env,
|
|
34
|
+
port: options.port,
|
|
35
|
+
host: options.host,
|
|
159
36
|
});
|
|
160
|
-
|
|
37
|
+
const shutdown = (code) => {
|
|
38
|
+
server.down().finally(() => process.exit(code));
|
|
39
|
+
};
|
|
40
|
+
server.on('error', () => shutdown(1));
|
|
41
|
+
process.once('SIGINT', () => shutdown(0));
|
|
42
|
+
process.once('SIGTERM', () => shutdown(0));
|
|
43
|
+
await server.up();
|
|
161
44
|
});
|
|
162
45
|
//# sourceMappingURL=dev.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/commands/dev/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO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MAAM,CAAC,EAAE,EAAE,CAAA;AACnB,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t4h.framework/cli",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260902161345",
|
|
4
4
|
"description": "CLI tools for the T4H Framework",
|
|
5
5
|
"homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/cli",
|
|
6
6
|
"bugs": "https://github.com/tech4humans-brasil/framework/issues",
|
|
@@ -29,19 +29,17 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@inquirer/prompts": "^8.3.0",
|
|
32
|
-
"@t4h.framework/dev": "
|
|
33
|
-
"@t4h.framework/harness": "
|
|
32
|
+
"@t4h.framework/dev": "^0.0.0-experimental-20260902161345",
|
|
33
|
+
"@t4h.framework/harness": "^0.3.1",
|
|
34
34
|
"commander": "^14.0.3",
|
|
35
35
|
"form-data": "^4.0.5",
|
|
36
36
|
"qs": "^6.15.0",
|
|
37
37
|
"tar": "^7.5.10"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/json-schema": "^7.0.15",
|
|
41
40
|
"@types/node": "^25.3.5",
|
|
42
41
|
"@types/qs": "^6",
|
|
43
42
|
"@types/ssh2-sftp-client": "^9.0.6",
|
|
44
|
-
"json-schema-typed": "^8.0.2",
|
|
45
43
|
"typescript": "^5.9.3",
|
|
46
44
|
"vitest": "^4.0.18"
|
|
47
45
|
},
|
|
@@ -49,4 +47,4 @@
|
|
|
49
47
|
"engines": {
|
|
50
48
|
"node": ">=22"
|
|
51
49
|
}
|
|
52
|
-
}
|
|
50
|
+
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { input, number } from '@inquirer/prompts';
|
|
2
|
-
export async function jsonSchemaToInquirerQuestion(schema, context = {}) {
|
|
3
|
-
if (typeof schema === 'boolean')
|
|
4
|
-
return;
|
|
5
|
-
if (schema.type === 'object')
|
|
6
|
-
return jsonSchemaObjectToInquirerQuestion(schema, context);
|
|
7
|
-
if (schema.type === 'string')
|
|
8
|
-
return jsonSchemaStringToInquirerQuestion(schema, context);
|
|
9
|
-
if (schema.type === 'number')
|
|
10
|
-
return jsonSchemaNumberToInquirerQuestion(schema, context);
|
|
11
|
-
}
|
|
12
|
-
export async function jsonSchemaObjectToInquirerQuestion(schema, context) {
|
|
13
|
-
const result = {};
|
|
14
|
-
for (const [key, property] of Object.entries(schema.properties ?? {})) {
|
|
15
|
-
const isRequired = schema.required?.includes(key);
|
|
16
|
-
result[key] = await jsonSchemaToInquirerQuestion(property, {
|
|
17
|
-
key: context.key ? `${context.key}.${key}` : key,
|
|
18
|
-
isOptional: !isRequired,
|
|
19
|
-
signal: context.signal,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
export async function jsonSchemaStringToInquirerQuestion(schema, context) {
|
|
25
|
-
return input({
|
|
26
|
-
message: `${context.key ? context.key : ''}${context.key && schema.description ? ': ' : ''}${schema.description ?? ''}`,
|
|
27
|
-
}, { signal: context.signal });
|
|
28
|
-
}
|
|
29
|
-
export async function jsonSchemaNumberToInquirerQuestion(schema, context) {
|
|
30
|
-
return number({
|
|
31
|
-
message: `${context.key ? context.key : ''}${context.key && schema.description ? ': ' : ''}${schema.description ?? ''}`,
|
|
32
|
-
}, { signal: context.signal });
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=json-schema-to-inquirer-question.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema-to-inquirer-question.js","sourceRoot":"","sources":["../../src/tools/json-schema-to-inquirer-question.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AASjD,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,MAAkB,EAClB,UAA+C,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