@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/dist/output.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import Table from "cli-table3";
|
|
3
|
+
function stringifyValue(value) {
|
|
4
|
+
if (value === undefined || value === null) {
|
|
5
|
+
return "";
|
|
6
|
+
}
|
|
7
|
+
if (typeof value === "object") {
|
|
8
|
+
return JSON.stringify(value, null, 2);
|
|
9
|
+
}
|
|
10
|
+
return String(value);
|
|
11
|
+
}
|
|
12
|
+
export function outputJson(data) {
|
|
13
|
+
console.log(JSON.stringify(data, null, 2));
|
|
14
|
+
}
|
|
15
|
+
export function outputTable(columns, rows, title) {
|
|
16
|
+
if (title) {
|
|
17
|
+
console.log(chalk.bold(`\n${title}`));
|
|
18
|
+
}
|
|
19
|
+
const table = new Table({
|
|
20
|
+
head: columns.map(([, label]) => chalk.cyan(label)),
|
|
21
|
+
style: { head: [], border: [] },
|
|
22
|
+
wordWrap: true,
|
|
23
|
+
});
|
|
24
|
+
for (const row of rows) {
|
|
25
|
+
table.push(columns.map(([key]) => stringifyValue(row[key])));
|
|
26
|
+
}
|
|
27
|
+
console.log(table.toString());
|
|
28
|
+
}
|
|
29
|
+
export function outputDetail(data, title) {
|
|
30
|
+
if (title) {
|
|
31
|
+
console.log(chalk.bold.blue(`\n${title}`));
|
|
32
|
+
}
|
|
33
|
+
for (const [key, value] of Object.entries(data)) {
|
|
34
|
+
console.log(`${chalk.bold.cyan(key)}: ${stringifyValue(value)}`);
|
|
35
|
+
}
|
|
36
|
+
console.log();
|
|
37
|
+
}
|
|
38
|
+
export function outputPretty(data) {
|
|
39
|
+
if (typeof data === "string") {
|
|
40
|
+
console.log(data);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
console.log(JSON.stringify(data, null, 2));
|
|
44
|
+
}
|
|
45
|
+
function summarizeContent(result) {
|
|
46
|
+
if (!result.content.length) {
|
|
47
|
+
return { ok: !result.isError };
|
|
48
|
+
}
|
|
49
|
+
if (result.content.length === 1 && result.content[0].type === "text") {
|
|
50
|
+
const text = result.content[0].text;
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(text);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result.content.map((block) => {
|
|
59
|
+
if (block.type === "text") {
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(block.text);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return block.text;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (block.type === "image") {
|
|
68
|
+
return { type: "image", mimeType: block.mimeType };
|
|
69
|
+
}
|
|
70
|
+
if (block.type === "resource") {
|
|
71
|
+
return { type: "resource", resource: block.resource };
|
|
72
|
+
}
|
|
73
|
+
if (block.type === "audio") {
|
|
74
|
+
return { type: "audio", mimeType: block.mimeType };
|
|
75
|
+
}
|
|
76
|
+
return block;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export function outputToolCallResult(result, asJson) {
|
|
80
|
+
const payload = summarizeContent(result);
|
|
81
|
+
if (asJson) {
|
|
82
|
+
outputJson(payload);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
outputPretty(payload);
|
|
86
|
+
}
|
|
87
|
+
if (result.isError) {
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function toolListRows(tools) {
|
|
92
|
+
return tools.map((tool) => {
|
|
93
|
+
const annotations = (tool.annotations || {});
|
|
94
|
+
return {
|
|
95
|
+
name: tool.name,
|
|
96
|
+
title: tool.title || "",
|
|
97
|
+
read_only: annotations.readOnlyHint ? "yes" : "no",
|
|
98
|
+
destructive: annotations.destructiveHint ? "yes" : "no",
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export function schemaPropertyRows(tool) {
|
|
103
|
+
const schema = tool.inputSchema;
|
|
104
|
+
const properties = schema && typeof schema === "object" && "properties" in schema
|
|
105
|
+
? schema.properties
|
|
106
|
+
: {};
|
|
107
|
+
const required = schema && typeof schema === "object" && "required" in schema
|
|
108
|
+
? new Set(schema.required || [])
|
|
109
|
+
: new Set();
|
|
110
|
+
return Object.entries(properties).map(([name, value]) => ({
|
|
111
|
+
name,
|
|
112
|
+
required: required.has(name) ? "yes" : "no",
|
|
113
|
+
type: stringifyValue(value.type),
|
|
114
|
+
description: stringifyValue(value.description),
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,YAAY,CAAC;AAU/B,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAA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I;SACxD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,IAAU;IAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;IAChC,MAAM,UAAU,GACd,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,YAAY,IAAI,MAAM;QAC5D,CAAC,CAAE,MAAM,CAAC,UAAsD;QAChE,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,QAAQ,GACZ,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,UAAU,IAAI,MAAM;QAC1D,CAAC,CAAC,IAAI,GAAG,CAAE,MAAM,CAAC,QAAqB,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,IAAI,GAAG,EAAU,CAAC;IAExB,OAAO,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACxD,IAAI;QACJ,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QAC3C,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC;QAChC,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC;KAC/C,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const INSURANCE_WORKFLOW_TEMPLATE = "# ONDC Insurance Journey \u2014 Strict Sequential Workflow\n\nYou are an insurance assistant operating through ONDC MCP tools. Execute the\nsteps below in strict order. Never skip, reorder, or parallelize steps. Each\nstep depends on the output of the previous one. Wait for the user to provide\nall required information before calling each tool.\n\nIMPORTANT \u2014 User-driven external steps:\nKYC and Payment happen in an external browser window. Do not poll for their\ncompletion. Wait for the user to tell you they have completed the step, then\nverify once with check-insurance-transaction-status before moving on.\n\nIMPORTANT \u2014 Generative UI (interactive pages):\nSome tools open an interactive UI page for the user (offer selection, final\npolicy). When a tool opens a generative UI, you must stop immediately. Do not\ncall any more tools, ask follow-up questions, or start processing the next\nstep. The user is interacting with the UI directly. You will receive a context\nupdate from the UI when the user completes their action, or the user will send\na chat message to continue. Yield control to the user.\n\nRules\n\nALWAYS:\n- Execute steps strictly one after another. Never jump ahead.\n- Collect all required fields from the user before calling a tool.\n- Store txn_id and offer_item_id from responses. They are needed in every subsequent call.\n- Send boolean values as the strings \"true\" or \"false\".\n- Send all numeric values (amount, pincode, weight, height) as strings.\n- If a step returns form_status: \"Failed\" for a single-member form, stop and inform the user. Do not continue.\n- For family floater submissions, if at least one member succeeded, proceed to the next step but inform the user which members failed.\n- Remember the applicant details from Step 2. You will need them in Step 7 (Buyer Form).\n\nNEVER:\n- Call list-insurance-offers without first calling trigger-insurance-search after form submission.\n- Call list-insurance-offers directly after start-insurance-journey.\n- Call submit-buyer-form before init-insurance-order.\n- Call submit-nominee-form before submit-buyer-form succeeds.\n- Call confirm-insurance-order before the user confirms payment is complete.\n- Guess or fabricate user data.\n- Use submit-applicant-form when there are multiple members. Use submit-family-floater-form instead.\n- Skip trigger-insurance-search after form submission.\n- Poll in a loop for KYC or Payment status.\n- Call additional tools after opening a generative UI.\n\nStrict Tool Execution Order\n\n1. start-insurance-journey -> save txn_id\n2. submit-applicant-form OR submit-family-floater-form\n3. trigger-insurance-search -> verify ack\n4. list-insurance-offers -> stop for generative UI or continue via chat\n5. select-insurance-offer -> save offer_item_id if chat path\n6. get-insurance-form-url (KYC) -> wait for user\n7. check-insurance-transaction-status -> verify KYC approved\n8. init-insurance-order\n9. check-insurance-transaction-status -> confirm ON_INIT_BUYER_FORM\n10. submit-buyer-form\n11. init-insurance-order\n12. check-insurance-transaction-status -> confirm ON_INIT_NOMINEE\n13. submit-nominee-form\n14. get-insurance-form-url (PAYMENT) -> wait for user\n15. check-insurance-transaction-status -> verify PAYMENT_APPROVED\n16. confirm-insurance-order\n17. fetch-insurance-order-status\n18. send-insurance-notification (optional)\n\nCritical gates\n\n- After applicant submission, trigger-insurance-search is mandatory.\n- After KYC completion, verify status once before init.\n- After first init, verify current_action == ON_INIT_BUYER_FORM.\n- After second init, verify current_action == ON_INIT_NOMINEE.\n- After payment completion, verify payment approval before confirm.\n\nReference symbol: INSURANCE_WORKFLOW_TEMPLATE";
|
|
2
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,ktHAyEM,CAAC"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const INSURANCE_WORKFLOW_TEMPLATE = `# ONDC Insurance Journey — Strict Sequential Workflow
|
|
2
|
+
|
|
3
|
+
You are an insurance assistant operating through ONDC MCP tools. Execute the
|
|
4
|
+
steps below in strict order. Never skip, reorder, or parallelize steps. Each
|
|
5
|
+
step depends on the output of the previous one. Wait for the user to provide
|
|
6
|
+
all required information before calling each tool.
|
|
7
|
+
|
|
8
|
+
IMPORTANT — User-driven external steps:
|
|
9
|
+
KYC and Payment happen in an external browser window. Do not poll for their
|
|
10
|
+
completion. Wait for the user to tell you they have completed the step, then
|
|
11
|
+
verify once with check-insurance-transaction-status before moving on.
|
|
12
|
+
|
|
13
|
+
IMPORTANT — Generative UI (interactive pages):
|
|
14
|
+
Some tools open an interactive UI page for the user (offer selection, final
|
|
15
|
+
policy). When a tool opens a generative UI, you must stop immediately. Do not
|
|
16
|
+
call any more tools, ask follow-up questions, or start processing the next
|
|
17
|
+
step. The user is interacting with the UI directly. You will receive a context
|
|
18
|
+
update from the UI when the user completes their action, or the user will send
|
|
19
|
+
a chat message to continue. Yield control to the user.
|
|
20
|
+
|
|
21
|
+
Rules
|
|
22
|
+
|
|
23
|
+
ALWAYS:
|
|
24
|
+
- Execute steps strictly one after another. Never jump ahead.
|
|
25
|
+
- Collect all required fields from the user before calling a tool.
|
|
26
|
+
- Store txn_id and offer_item_id from responses. They are needed in every subsequent call.
|
|
27
|
+
- Send boolean values as the strings "true" or "false".
|
|
28
|
+
- Send all numeric values (amount, pincode, weight, height) as strings.
|
|
29
|
+
- If a step returns form_status: "Failed" for a single-member form, stop and inform the user. Do not continue.
|
|
30
|
+
- For family floater submissions, if at least one member succeeded, proceed to the next step but inform the user which members failed.
|
|
31
|
+
- Remember the applicant details from Step 2. You will need them in Step 7 (Buyer Form).
|
|
32
|
+
|
|
33
|
+
NEVER:
|
|
34
|
+
- Call list-insurance-offers without first calling trigger-insurance-search after form submission.
|
|
35
|
+
- Call list-insurance-offers directly after start-insurance-journey.
|
|
36
|
+
- Call submit-buyer-form before init-insurance-order.
|
|
37
|
+
- Call submit-nominee-form before submit-buyer-form succeeds.
|
|
38
|
+
- Call confirm-insurance-order before the user confirms payment is complete.
|
|
39
|
+
- Guess or fabricate user data.
|
|
40
|
+
- Use submit-applicant-form when there are multiple members. Use submit-family-floater-form instead.
|
|
41
|
+
- Skip trigger-insurance-search after form submission.
|
|
42
|
+
- Poll in a loop for KYC or Payment status.
|
|
43
|
+
- Call additional tools after opening a generative UI.
|
|
44
|
+
|
|
45
|
+
Strict Tool Execution Order
|
|
46
|
+
|
|
47
|
+
1. start-insurance-journey -> save txn_id
|
|
48
|
+
2. submit-applicant-form OR submit-family-floater-form
|
|
49
|
+
3. trigger-insurance-search -> verify ack
|
|
50
|
+
4. list-insurance-offers -> stop for generative UI or continue via chat
|
|
51
|
+
5. select-insurance-offer -> save offer_item_id if chat path
|
|
52
|
+
6. get-insurance-form-url (KYC) -> wait for user
|
|
53
|
+
7. check-insurance-transaction-status -> verify KYC approved
|
|
54
|
+
8. init-insurance-order
|
|
55
|
+
9. check-insurance-transaction-status -> confirm ON_INIT_BUYER_FORM
|
|
56
|
+
10. submit-buyer-form
|
|
57
|
+
11. init-insurance-order
|
|
58
|
+
12. check-insurance-transaction-status -> confirm ON_INIT_NOMINEE
|
|
59
|
+
13. submit-nominee-form
|
|
60
|
+
14. get-insurance-form-url (PAYMENT) -> wait for user
|
|
61
|
+
15. check-insurance-transaction-status -> verify PAYMENT_APPROVED
|
|
62
|
+
16. confirm-insurance-order
|
|
63
|
+
17. fetch-insurance-order-status
|
|
64
|
+
18. send-insurance-notification (optional)
|
|
65
|
+
|
|
66
|
+
Critical gates
|
|
67
|
+
|
|
68
|
+
- After applicant submission, trigger-insurance-search is mandatory.
|
|
69
|
+
- After KYC completion, verify status once before init.
|
|
70
|
+
- After first init, verify current_action == ON_INIT_BUYER_FORM.
|
|
71
|
+
- After second init, verify current_action == ON_INIT_NOMINEE.
|
|
72
|
+
- After payment completion, verify payment approval before confirm.
|
|
73
|
+
|
|
74
|
+
Reference symbol: INSURANCE_WORKFLOW_TEMPLATE`;
|
|
75
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAyEG,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cliniq360/ondc-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Official CLI for the ONDC insurance MCP workflow.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ondc": "dist/main.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"dev": "tsx src/main.ts",
|
|
12
|
+
"start": "node dist/main.js",
|
|
13
|
+
"clean": "node -e \"const fs=require('fs'); fs.rmSync('dist',{recursive:true,force:true});\"",
|
|
14
|
+
"typecheck": "tsc --noEmit",
|
|
15
|
+
"test": "node dist/main.js --help",
|
|
16
|
+
"prepublishOnly": "npm run clean && npm run build && npm run typecheck"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"ondc",
|
|
20
|
+
"insurance",
|
|
21
|
+
"mcp",
|
|
22
|
+
"cli",
|
|
23
|
+
"cliniq360"
|
|
24
|
+
],
|
|
25
|
+
"author": "eigi.ai",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
29
|
+
"chalk": "^5.4.1",
|
|
30
|
+
"cli-table3": "^0.6.5",
|
|
31
|
+
"commander": "^13.1.0",
|
|
32
|
+
"conf": "^13.1.0",
|
|
33
|
+
"dotenv": "^17.4.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.13.0",
|
|
37
|
+
"tsx": "^4.19.0",
|
|
38
|
+
"typescript": "^5.7.0"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE"
|
|
50
|
+
]
|
|
51
|
+
}
|