@cliniq360/ondc-cli 0.1.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/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +34 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/forms.d.ts +3 -0
- package/dist/commands/forms.d.ts.map +1 -0
- package/dist/commands/forms.js +133 -0
- package/dist/commands/forms.js.map +1 -0
- package/dist/commands/journey.d.ts +3 -0
- package/dist/commands/journey.d.ts.map +1 -0
- package/dist/commands/journey.js +31 -0
- package/dist/commands/journey.js.map +1 -0
- package/dist/commands/offers.d.ts +3 -0
- package/dist/commands/offers.d.ts.map +1 -0
- package/dist/commands/offers.js +37 -0
- package/dist/commands/offers.js.map +1 -0
- package/dist/commands/orders.d.ts +3 -0
- package/dist/commands/orders.d.ts.map +1 -0
- package/dist/commands/orders.js +74 -0
- package/dist/commands/orders.js.map +1 -0
- package/dist/commands/policy.d.ts +3 -0
- package/dist/commands/policy.d.ts.map +1 -0
- package/dist/commands/policy.js +67 -0
- package/dist/commands/policy.js.map +1 -0
- package/dist/commands/tools.d.ts +3 -0
- package/dist/commands/tools.d.ts.map +1 -0
- package/dist/commands/tools.js +71 -0
- package/dist/commands/tools.js.map +1 -0
- package/dist/commands/workflow.d.ts +3 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +116 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/input.d.ts +10 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +54 -0
- package/dist/input.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +69 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp-client.d.ts +7 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +58 -0
- package/dist/mcp-client.js.map +1 -0
- package/dist/output.d.ts +11 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +117 -0
- package/dist/output.js.map +1 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +75 -0
- package/dist/prompts.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cliniq360
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ondc CLI
|
|
4
|
+
|
|
5
|
+
CLI for the ONDC insurance MCP workflow exposed by ondc-mcp.
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Talks to the ONDC MCP server over the official Streamable HTTP transport
|
|
14
|
+
- Covers every current insurance journey tool exposed by ondc-mcp
|
|
15
|
+
- Mirrors the grouped CLI structure used in eigi-cli
|
|
16
|
+
- Supports human-readable and JSON output
|
|
17
|
+
- Includes a raw tool caller for any current or future MCP tool
|
|
18
|
+
- Uses `https://ondc.eigi.ai/mcp` as the hardcoded default MCP endpoint, with optional env override
|
|
19
|
+
- Can print the strict insurance AI workflow prompt via `ondc workflow prompt`
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### From source
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
cd ondc-cli
|
|
29
|
+
npm install
|
|
30
|
+
npm run build
|
|
31
|
+
npm link
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Run without linking
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cd ondc-cli
|
|
38
|
+
npm install
|
|
39
|
+
npm run build
|
|
40
|
+
node dist/main.js --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### From npm
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g @cliniq360/ondc-cli
|
|
47
|
+
ondc --help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 1. Default MCP URL is already hosted
|
|
56
|
+
# https://ondc.eigi.ai/mcp
|
|
57
|
+
# Edit .env only if you need a different endpoint
|
|
58
|
+
|
|
59
|
+
# 2. Inspect the available tool surface
|
|
60
|
+
ondc tools list
|
|
61
|
+
|
|
62
|
+
# 3. Print the strict AI workflow prompt
|
|
63
|
+
ondc workflow prompt
|
|
64
|
+
|
|
65
|
+
# 4. Start a journey
|
|
66
|
+
ondc journey start
|
|
67
|
+
|
|
68
|
+
# 5. Submit a single applicant
|
|
69
|
+
ondc forms applicant \
|
|
70
|
+
--txn-id <TXN_ID> \
|
|
71
|
+
--first-name Jane \
|
|
72
|
+
--last-name Doe \
|
|
73
|
+
--email jane@example.com \
|
|
74
|
+
--phone 9876543210 \
|
|
75
|
+
--address "Bengaluru, Karnataka" \
|
|
76
|
+
--gender F \
|
|
77
|
+
--dob 1992-01-15 \
|
|
78
|
+
--amount 500000 \
|
|
79
|
+
--pincode 560001 \
|
|
80
|
+
--height-foot 5 \
|
|
81
|
+
--height-inch 4 \
|
|
82
|
+
--weight 62
|
|
83
|
+
|
|
84
|
+
# 6. Trigger search and list offers
|
|
85
|
+
ondc journey trigger-search --txn-id <TXN_ID>
|
|
86
|
+
ondc offers list --txn-id <TXN_ID>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Command Groups
|
|
92
|
+
|
|
93
|
+
### `ondc config`
|
|
94
|
+
|
|
95
|
+
- `ondc config set-format <pretty|json>`
|
|
96
|
+
- `ondc config show`
|
|
97
|
+
|
|
98
|
+
### `ondc workflow`
|
|
99
|
+
|
|
100
|
+
- `ondc workflow list`
|
|
101
|
+
- `ondc workflow prompt`
|
|
102
|
+
- `ondc workflow quote-purchase`
|
|
103
|
+
- `ondc workflow post-purchase`
|
|
104
|
+
- `ondc workflow show <NAME>`
|
|
105
|
+
|
|
106
|
+
### `ondc journey`
|
|
107
|
+
|
|
108
|
+
- `ondc journey start [--txn-id <TXN_ID>]`
|
|
109
|
+
- `ondc journey trigger-search --txn-id <TXN_ID>`
|
|
110
|
+
|
|
111
|
+
### `ondc forms`
|
|
112
|
+
|
|
113
|
+
- `ondc forms applicant ...`
|
|
114
|
+
- `ondc forms family --input '{...}'`
|
|
115
|
+
- `ondc forms buyer ...`
|
|
116
|
+
- `ondc forms nominee ...`
|
|
117
|
+
|
|
118
|
+
### `ondc offers`
|
|
119
|
+
|
|
120
|
+
- `ondc offers list --txn-id <TXN_ID>`
|
|
121
|
+
- `ondc offers select --txn-id <TXN_ID> --offer-item-id <OFFER_ID> [--add-ons '{"add_on_obj":[]}' ]`
|
|
122
|
+
|
|
123
|
+
### `ondc orders`
|
|
124
|
+
|
|
125
|
+
- `ondc orders form-url --txn-id <TXN_ID> --form-type <KYC|PAYMENT>`
|
|
126
|
+
- `ondc orders init --txn-id <TXN_ID> --offer-item-id <OFFER_ID>`
|
|
127
|
+
- `ondc orders confirm --txn-id <TXN_ID> --offer-item-id <OFFER_ID>`
|
|
128
|
+
- `ondc orders status --txn-id <TXN_ID> --offer-item-id <OFFER_ID>`
|
|
129
|
+
- `ondc orders transaction-status --txn-id <TXN_ID>`
|
|
130
|
+
|
|
131
|
+
### `ondc policy`
|
|
132
|
+
|
|
133
|
+
- `ondc policy cancellation-terms --order-id <ORDER_ID>`
|
|
134
|
+
- `ondc policy cancel --txn-id <TXN_ID> --offer-item-id <OFFER_ID> --reason-id <ID> --notes <TEXT>`
|
|
135
|
+
- `ondc policy notify --order-id <ORDER_ID> --channel <WHATSAPP|SMS> --mobile-number <PHONE>`
|
|
136
|
+
|
|
137
|
+
### `ondc tools`
|
|
138
|
+
|
|
139
|
+
- `ondc tools list`
|
|
140
|
+
- `ondc tools inspect <NAME>`
|
|
141
|
+
- `ondc tools call <NAME> --input '{...}'`
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Environment Variables
|
|
146
|
+
|
|
147
|
+
| Variable | Description |
|
|
148
|
+
| -------------- | -------------------------------------------------------------------- |
|
|
149
|
+
| `ONDC_MCP_URL` | Optional override for the default hosted endpoint `https://ondc.eigi.ai/mcp` |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Notes
|
|
154
|
+
|
|
155
|
+
- `ondc-cli` talks to `ondc-app` over MCP instead of calling backend REST APIs directly.
|
|
156
|
+
- `ondc-cli` is no-auth by design. ONDC backend credentials stay inside `ondc-app` via its own environment configuration.
|
|
157
|
+
- The published CLI defaults to `https://ondc.eigi.ai/mcp`. Use `ONDC_MCP_URL` only when you need a different MCP endpoint.
|
|
158
|
+
- `ondc workflow prompt` prints the strict `INSURANCE_WORKFLOW_TEMPLATE` guidance so an AI agent can follow the intended ONDC tool chain.
|
|
159
|
+
- The CLI prints parsed tool payloads by default. Use `--json` for clean automation output.
|
|
160
|
+
- For complex payloads such as family floater submissions, use `--input`, `--file`, or pipe JSON through stdin.
|
|
161
|
+
|
|
162
|
+
## Publishing
|
|
163
|
+
|
|
164
|
+
- npm package: `@cliniq360/ondc-cli`
|
|
165
|
+
- GitHub Actions workflow: `.github/workflows/publish-cli.yml`
|
|
166
|
+
- Release trigger: push a tag like `v0.1.0`
|
|
167
|
+
- Manual trigger: run the workflow with a version input such as `0.1.0`
|
|
168
|
+
- npm auth model: GitHub OIDC trusted publishing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwCrD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { DEFAULT_MCP_URL, ENV_MCP_URL, OUTPUT_FORMATS, getConfigPath, getEnvFilePath, getMcpUrl, getMcpUrlSource, getOutputFormat, setOutputFormat, } from "../config.js";
|
|
3
|
+
export function registerConfig(program) {
|
|
4
|
+
const config = program
|
|
5
|
+
.command("config")
|
|
6
|
+
.description("Show env-based MCP settings and configure output format.");
|
|
7
|
+
config
|
|
8
|
+
.command("set-format")
|
|
9
|
+
.argument("<format>", `Output format: ${OUTPUT_FORMATS.join(" or ")}`)
|
|
10
|
+
.description("Set the default output format.")
|
|
11
|
+
.action((format) => {
|
|
12
|
+
if (!OUTPUT_FORMATS.includes(format)) {
|
|
13
|
+
console.error(`Error: format must be one of ${OUTPUT_FORMATS.join(", ")}.`);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
setOutputFormat(format);
|
|
17
|
+
console.log(`✓ Default output format set to '${format}'`);
|
|
18
|
+
});
|
|
19
|
+
config
|
|
20
|
+
.command("show")
|
|
21
|
+
.description("Show current CLI configuration.")
|
|
22
|
+
.action(() => {
|
|
23
|
+
console.log(`${chalk.bold("Env file:")} ${getEnvFilePath()}`);
|
|
24
|
+
console.log(`${chalk.bold("Format config:")} ${getConfigPath()}`);
|
|
25
|
+
console.log(`${chalk.bold("MCP URL:")} ${getMcpUrl()}`);
|
|
26
|
+
console.log(`${chalk.bold("Auth:")} none`);
|
|
27
|
+
console.log(`${chalk.bold("Format:")} ${getOutputFormat()}`);
|
|
28
|
+
console.log(chalk.dim(` (MCP URL source: ${getMcpUrlSource()})`));
|
|
29
|
+
if (process.env[ENV_MCP_URL] && getMcpUrl() !== DEFAULT_MCP_URL) {
|
|
30
|
+
console.log(chalk.dim(` (${ENV_MCP_URL} is loaded into the process environment)`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,MAAM,GAAG,OAAO;SAC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AAE,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC;QAEnE,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,SAAS,EAAE,KAAK,eAAe,EAAE,CAAC;YAChE,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CACP,MAAM,WAAW,0CAA0C,CAC5D,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/commands/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8JpD"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { shouldUseJson } from "../config.js";
|
|
2
|
+
import { pickDefined, requireJsonObjectInput, parseJsonObject } from "../input.js";
|
|
3
|
+
import { callTool } from "../mcp-client.js";
|
|
4
|
+
import { outputToolCallResult } from "../output.js";
|
|
5
|
+
export function registerForms(program) {
|
|
6
|
+
const forms = program
|
|
7
|
+
.command("forms")
|
|
8
|
+
.description("Submit applicant, family, buyer, and nominee form payloads.");
|
|
9
|
+
forms
|
|
10
|
+
.command("applicant")
|
|
11
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
12
|
+
.requiredOption("--first-name <first_name>", "Applicant first name")
|
|
13
|
+
.requiredOption("--last-name <last_name>", "Applicant last name")
|
|
14
|
+
.requiredOption("--email <email>", "Applicant email")
|
|
15
|
+
.requiredOption("--phone <phone>", "Applicant mobile number")
|
|
16
|
+
.requiredOption("--address <address>", "Applicant address")
|
|
17
|
+
.requiredOption("--gender <gender>", "M, F, or O")
|
|
18
|
+
.requiredOption("--dob <dob>", "Date of birth as YYYY-MM-DD")
|
|
19
|
+
.requiredOption("--amount <amount>", "Coverage amount")
|
|
20
|
+
.requiredOption("--pincode <pincode>", "6-digit PIN code")
|
|
21
|
+
.requiredOption("--height-foot <height_foot>", "Height in feet")
|
|
22
|
+
.requiredOption("--height-inch <height_inch>", "Height in inches")
|
|
23
|
+
.requiredOption("--weight <weight>", "Weight in kg")
|
|
24
|
+
.option("--relation <relation>", "Relation to the policy", "self")
|
|
25
|
+
.option("--ped <ped>", "Pre-existing disease flag", "No")
|
|
26
|
+
.option("--diabetes <diabetes>", "true or false as string", "false")
|
|
27
|
+
.option("--blood-pressure <blood_pressure>", "true or false as string", "false")
|
|
28
|
+
.option("--heart-ailments <heart_ailments>", "true or false as string", "false")
|
|
29
|
+
.option("--other <other>", "Other PED flag", "false")
|
|
30
|
+
.option("--pan-india <pan_india>", "true or false as string", "true")
|
|
31
|
+
.option("--pep <politically_exposed_person>", "Politically exposed person flag", "false")
|
|
32
|
+
.option("--gstin <gstin>", "GSTIN if applicable", "")
|
|
33
|
+
.option("--json", "Output as JSON")
|
|
34
|
+
.description("Submit a single-member applicant form.")
|
|
35
|
+
.action(async (opts) => {
|
|
36
|
+
const result = await callTool("submit-applicant-form", pickDefined({
|
|
37
|
+
txn_id: opts.txnId,
|
|
38
|
+
firstName: opts.firstName,
|
|
39
|
+
lastName: opts.lastName,
|
|
40
|
+
email: opts.email,
|
|
41
|
+
phone: opts.phone,
|
|
42
|
+
address: opts.address,
|
|
43
|
+
gender: opts.gender,
|
|
44
|
+
dob: opts.dob,
|
|
45
|
+
amount: opts.amount,
|
|
46
|
+
pincode: opts.pincode,
|
|
47
|
+
heightfoot: opts.heightFoot,
|
|
48
|
+
heightinch: opts.heightInch,
|
|
49
|
+
weight: opts.weight,
|
|
50
|
+
relation: opts.relation,
|
|
51
|
+
PED: opts.ped,
|
|
52
|
+
diabetes: opts.diabetes,
|
|
53
|
+
bloodPressure: opts.bloodPressure,
|
|
54
|
+
heartAilments: opts.heartAilments,
|
|
55
|
+
other: opts.other,
|
|
56
|
+
panIndia: opts.panIndia,
|
|
57
|
+
politicallyExposedPerson: opts.pep,
|
|
58
|
+
gstin: opts.gstin,
|
|
59
|
+
}));
|
|
60
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
61
|
+
});
|
|
62
|
+
forms
|
|
63
|
+
.command("family")
|
|
64
|
+
.option("--input <json>", "Inline JSON object for family floater input")
|
|
65
|
+
.option("--file <path>", "Read family floater input from JSON file")
|
|
66
|
+
.option("--json", "Output as JSON")
|
|
67
|
+
.description("Submit a family floater form using raw JSON input.")
|
|
68
|
+
.action(async (opts) => {
|
|
69
|
+
const payload = await requireJsonObjectInput(opts, "family floater input");
|
|
70
|
+
const result = await callTool("submit-family-floater-form", payload);
|
|
71
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
72
|
+
});
|
|
73
|
+
forms
|
|
74
|
+
.command("buyer")
|
|
75
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
76
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
77
|
+
.requiredOption("--first-name <first_name>", "Buyer first name")
|
|
78
|
+
.requiredOption("--last-name <last_name>", "Buyer last name")
|
|
79
|
+
.requiredOption("--address <address>", "Buyer address")
|
|
80
|
+
.requiredOption("--dob <dob>", "Date of birth as YYYY-MM-DD")
|
|
81
|
+
.requiredOption("--gender <gender>", "M, F, or O")
|
|
82
|
+
.requiredOption("--email <email>", "Buyer email")
|
|
83
|
+
.requiredOption("--phone <phone>", "Buyer phone")
|
|
84
|
+
.option("--relation <relation>", "Relation to primary member", "self")
|
|
85
|
+
.option("--pep <politically_exposed_person>", "true or false as string", "false")
|
|
86
|
+
.option("--gstin <gstin>", "GSTIN if applicable", "")
|
|
87
|
+
.option("--questionnaire <json>", "JSON object with insurer questionnaire answers")
|
|
88
|
+
.option("--json", "Output as JSON")
|
|
89
|
+
.description("Submit buyer details after the buyer phase opens.")
|
|
90
|
+
.action(async (opts) => {
|
|
91
|
+
const questionnaire = opts.questionnaire
|
|
92
|
+
? parseJsonObject(opts.questionnaire, "questionnaire")
|
|
93
|
+
: undefined;
|
|
94
|
+
const result = await callTool("submit-buyer-form", pickDefined({
|
|
95
|
+
txn_id: opts.txnId,
|
|
96
|
+
offer_item_id: opts.offerItemId,
|
|
97
|
+
firstName: opts.firstName,
|
|
98
|
+
lastName: opts.lastName,
|
|
99
|
+
address: opts.address,
|
|
100
|
+
dob: opts.dob,
|
|
101
|
+
gender: opts.gender,
|
|
102
|
+
email: opts.email,
|
|
103
|
+
phone: opts.phone,
|
|
104
|
+
relation: opts.relation,
|
|
105
|
+
politicallyExposedPerson: opts.pep,
|
|
106
|
+
gstin: opts.gstin,
|
|
107
|
+
questionnaire,
|
|
108
|
+
}));
|
|
109
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
110
|
+
});
|
|
111
|
+
forms
|
|
112
|
+
.command("nominee")
|
|
113
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
114
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
115
|
+
.requiredOption("--first-name <first_name>", "Nominee first name")
|
|
116
|
+
.requiredOption("--last-name <last_name>", "Nominee last name")
|
|
117
|
+
.requiredOption("--phone <phone>", "Nominee phone")
|
|
118
|
+
.requiredOption("--relation <relation>", "Relation to the buyer")
|
|
119
|
+
.option("--json", "Output as JSON")
|
|
120
|
+
.description("Submit nominee details.")
|
|
121
|
+
.action(async (opts) => {
|
|
122
|
+
const result = await callTool("submit-nominee-form", pickDefined({
|
|
123
|
+
txn_id: opts.txnId,
|
|
124
|
+
offer_item_id: opts.offerItemId,
|
|
125
|
+
firstName: opts.firstName,
|
|
126
|
+
lastName: opts.lastName,
|
|
127
|
+
phone: opts.phone,
|
|
128
|
+
relation: opts.relation,
|
|
129
|
+
}));
|
|
130
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
131
|
+
});
|
|
132
|
+
}
|
|
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C,SAAS,CAAC;SAClB,cAAc,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SAC/D,cAAc,CAAC,iCAAiC,EAAE,wBAAwB,CAAC;SAC3E,cAAc,CAAC,2BAA2B,EAAE,oBAAoB,CAAC;SACjE,cAAc,CAAC,yBAAyB,EAAE,mBAAmB,CAAC;SAC9D,cAAc,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAClD,cAAc,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;SAChE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,WAAW,CAAC,yBAAyB,CAAC;SACtC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,qBAAqB,EACrB,WAAW,CAAC;YACV,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,aAAa,EAAE,IAAI,CAAC,WAAW;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CACH,CAAC;QAEF,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.d.ts","sourceRoot":"","sources":["../../src/commands/journey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8BtD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { shouldUseJson } from "../config.js";
|
|
2
|
+
import { callTool } from "../mcp-client.js";
|
|
3
|
+
import { outputToolCallResult } from "../output.js";
|
|
4
|
+
export function registerJourney(program) {
|
|
5
|
+
const journey = program
|
|
6
|
+
.command("journey")
|
|
7
|
+
.description("Start or resume insurance journeys and trigger search refreshes.");
|
|
8
|
+
journey
|
|
9
|
+
.command("start")
|
|
10
|
+
.option("--txn-id <txn_id>", "Existing transaction ID to resume")
|
|
11
|
+
.option("--json", "Output as JSON")
|
|
12
|
+
.description("Create a new journey or resume an existing one.")
|
|
13
|
+
.action(async (opts) => {
|
|
14
|
+
const result = await callTool("start-insurance-journey", {
|
|
15
|
+
...(opts.txnId ? { txn_id: opts.txnId } : {}),
|
|
16
|
+
});
|
|
17
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
18
|
+
});
|
|
19
|
+
journey
|
|
20
|
+
.command("trigger-search")
|
|
21
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
22
|
+
.option("--json", "Output as JSON")
|
|
23
|
+
.description("Trigger the backend search step after applicant submission succeeds.")
|
|
24
|
+
.action(async (opts) => {
|
|
25
|
+
const result = await callTool("trigger-insurance-search", {
|
|
26
|
+
txn_id: opts.txnId,
|
|
27
|
+
});
|
|
28
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=journey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey.js","sourceRoot":"","sources":["../../src/commands/journey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,kEAAkE,CAAC,CAAC;IAEnF,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,MAAM,CAAC,mBAAmB,EAAE,mCAAmC,CAAC;SAChE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,WAAW,CAAC,iDAAiD,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,yBAAyB,EAAE;YACvD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC,CAAC;QAEH,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,gBAAgB,CAAC;SACzB,cAAc,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SAC/D,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,WAAW,CAAC,sEAAsE,CAAC;SACnF,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,0BAA0B,EAAE;YACxD,MAAM,EAAE,IAAI,CAAC,KAAK;SACnB,CAAC,CAAC;QAEH,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../../src/commands/offers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuCrD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { shouldUseJson } from "../config.js";
|
|
2
|
+
import { parseJsonObject } from "../input.js";
|
|
3
|
+
import { callTool } from "../mcp-client.js";
|
|
4
|
+
import { outputToolCallResult } from "../output.js";
|
|
5
|
+
export function registerOffers(program) {
|
|
6
|
+
const offers = program
|
|
7
|
+
.command("offers")
|
|
8
|
+
.description("List and select insurance offers.");
|
|
9
|
+
offers
|
|
10
|
+
.command("list")
|
|
11
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
12
|
+
.option("--json", "Output as JSON")
|
|
13
|
+
.description("Fetch available insurance offers for a transaction.")
|
|
14
|
+
.action(async (opts) => {
|
|
15
|
+
const result = await callTool("list-insurance-offers", {
|
|
16
|
+
txn_id: opts.txnId,
|
|
17
|
+
});
|
|
18
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
19
|
+
});
|
|
20
|
+
offers
|
|
21
|
+
.command("select")
|
|
22
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
23
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
24
|
+
.option("--add-ons <json>", 'JSON object, for example {"add_on_obj":[]}', '{"add_on_obj":[]}')
|
|
25
|
+
.option("--json", "Output as JSON")
|
|
26
|
+
.description("Select an offer and optionally submit add-ons.")
|
|
27
|
+
.action(async (opts) => {
|
|
28
|
+
const addOnsPayload = parseJsonObject(opts.addOns, "add-ons payload");
|
|
29
|
+
const result = await callTool("select-insurance-offer", {
|
|
30
|
+
txn_id: opts.txnId,
|
|
31
|
+
offer_item_id: opts.offerItemId,
|
|
32
|
+
add_ons_payload: addOnsPayload,
|
|
33
|
+
});
|
|
34
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=offers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offers.js","sourceRoot":"","sources":["../../src/commands/offers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,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AAC,WAAW;YAC/B,eAAe,EAAE,aAAa;SAC/B,CAAC,CAAC;QAEH,oBAAoB,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../src/commands/orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+ErD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { shouldUseJson } from "../config.js";
|
|
2
|
+
import { callTool } from "../mcp-client.js";
|
|
3
|
+
import { outputToolCallResult } from "../output.js";
|
|
4
|
+
export function registerOrders(program) {
|
|
5
|
+
const orders = program
|
|
6
|
+
.command("orders")
|
|
7
|
+
.description("Handle KYC, order init, transaction checks, payment, and policy status.");
|
|
8
|
+
orders
|
|
9
|
+
.command("form-url")
|
|
10
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
11
|
+
.requiredOption("--form-type <form_type>", "KYC, PAYMENT, RENEWAL, or CLAIM")
|
|
12
|
+
.option("--offer-item-id <offer_item_id>", "Selected offer item ID if required")
|
|
13
|
+
.option("--json", "Output as JSON")
|
|
14
|
+
.description("Fetch an insurer-hosted form URL for KYC or payment.")
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
const result = await callTool("get-insurance-form-url", {
|
|
17
|
+
txn_id: opts.txnId,
|
|
18
|
+
form_type: opts.formType,
|
|
19
|
+
...(opts.offerItemId ? { offer_item_id: opts.offerItemId } : {}),
|
|
20
|
+
});
|
|
21
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
22
|
+
});
|
|
23
|
+
orders
|
|
24
|
+
.command("init")
|
|
25
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
26
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
27
|
+
.option("--json", "Output as JSON")
|
|
28
|
+
.description("Initialize or advance the insurance order.")
|
|
29
|
+
.action(async (opts) => {
|
|
30
|
+
const result = await callTool("init-insurance-order", {
|
|
31
|
+
txn_id: opts.txnId,
|
|
32
|
+
offer_item_id: opts.offerItemId,
|
|
33
|
+
});
|
|
34
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
35
|
+
});
|
|
36
|
+
orders
|
|
37
|
+
.command("confirm")
|
|
38
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
39
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
40
|
+
.option("--json", "Output as JSON")
|
|
41
|
+
.description("Confirm the order after payment is complete.")
|
|
42
|
+
.action(async (opts) => {
|
|
43
|
+
const result = await callTool("confirm-insurance-order", {
|
|
44
|
+
txn_id: opts.txnId,
|
|
45
|
+
offer_item_id: opts.offerItemId,
|
|
46
|
+
});
|
|
47
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
48
|
+
});
|
|
49
|
+
orders
|
|
50
|
+
.command("status")
|
|
51
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
52
|
+
.requiredOption("--offer-item-id <offer_item_id>", "Selected offer item ID")
|
|
53
|
+
.option("--json", "Output as JSON")
|
|
54
|
+
.description("Fetch the final order or policy status.")
|
|
55
|
+
.action(async (opts) => {
|
|
56
|
+
const result = await callTool("fetch-insurance-order-status", {
|
|
57
|
+
txn_id: opts.txnId,
|
|
58
|
+
offer_item_id: opts.offerItemId,
|
|
59
|
+
});
|
|
60
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
61
|
+
});
|
|
62
|
+
orders
|
|
63
|
+
.command("transaction-status")
|
|
64
|
+
.requiredOption("--txn-id <txn_id>", "Insurance transaction ID")
|
|
65
|
+
.option("--json", "Output as JSON")
|
|
66
|
+
.description("Check the current transaction phase before continuing the flow.")
|
|
67
|
+
.action(async (opts) => {
|
|
68
|
+
const result = await callTool("check-insurance-transaction-status", {
|
|
69
|
+
txn_id: opts.txnId,
|
|
70
|
+
});
|
|
71
|
+
outputToolCallResult(result, shouldUseJson(opts.json));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=orders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/commands/orders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,yEAAyE,CAAC,CAAC;IAE1F,MAAM;SACH,OAAO,CAAC,UAAU,CAAC;SACnB,cAAc,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SAC/D,cAAc,CAAC,yBAAyB,EAAE,iCAAiC,CAAC;SAC5E,MAAM,CAAC,iCAAiC,EAAE,oCAAoC,CAAC;SAC/E,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,wBAAwB,EAAE;YACtD,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjE,CAAC,CAAC;QAEH,oBAAoB,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