@gojinko/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.
Files changed (82) hide show
  1. package/SKILL.md +108 -0
  2. package/dist/bin/jinko.d.ts +3 -0
  3. package/dist/bin/jinko.d.ts.map +1 -0
  4. package/dist/bin/jinko.js +8 -0
  5. package/dist/bin/jinko.js.map +1 -0
  6. package/dist/commands/auth/index.d.ts +3 -0
  7. package/dist/commands/auth/index.d.ts.map +1 -0
  8. package/dist/commands/auth/index.js +74 -0
  9. package/dist/commands/auth/index.js.map +1 -0
  10. package/dist/commands/config/index.d.ts +3 -0
  11. package/dist/commands/config/index.d.ts.map +1 -0
  12. package/dist/commands/config/index.js +32 -0
  13. package/dist/commands/config/index.js.map +1 -0
  14. package/dist/commands/flights/calendar.d.ts +3 -0
  15. package/dist/commands/flights/calendar.d.ts.map +1 -0
  16. package/dist/commands/flights/calendar.js +45 -0
  17. package/dist/commands/flights/calendar.js.map +1 -0
  18. package/dist/commands/flights/destinations.d.ts +3 -0
  19. package/dist/commands/flights/destinations.d.ts.map +1 -0
  20. package/dist/commands/flights/destinations.js +39 -0
  21. package/dist/commands/flights/destinations.js.map +1 -0
  22. package/dist/commands/flights/index.d.ts +3 -0
  23. package/dist/commands/flights/index.d.ts.map +1 -0
  24. package/dist/commands/flights/index.js +12 -0
  25. package/dist/commands/flights/index.js.map +1 -0
  26. package/dist/commands/flights/search.d.ts +3 -0
  27. package/dist/commands/flights/search.d.ts.map +1 -0
  28. package/dist/commands/flights/search.js +61 -0
  29. package/dist/commands/flights/search.js.map +1 -0
  30. package/dist/commands/schema.d.ts +3 -0
  31. package/dist/commands/schema.d.ts.map +1 -0
  32. package/dist/commands/schema.js +113 -0
  33. package/dist/commands/schema.js.map +1 -0
  34. package/dist/commands/shared.d.ts +16 -0
  35. package/dist/commands/shared.d.ts.map +1 -0
  36. package/dist/commands/shared.js +45 -0
  37. package/dist/commands/shared.js.map +1 -0
  38. package/dist/commands/travelers/index.d.ts +3 -0
  39. package/dist/commands/travelers/index.d.ts.map +1 -0
  40. package/dist/commands/travelers/index.js +118 -0
  41. package/dist/commands/travelers/index.js.map +1 -0
  42. package/dist/commands/trip/add-flight.d.ts +3 -0
  43. package/dist/commands/trip/add-flight.d.ts.map +1 -0
  44. package/dist/commands/trip/add-flight.js +22 -0
  45. package/dist/commands/trip/add-flight.js.map +1 -0
  46. package/dist/commands/trip/checkout.d.ts +3 -0
  47. package/dist/commands/trip/checkout.d.ts.map +1 -0
  48. package/dist/commands/trip/checkout.js +59 -0
  49. package/dist/commands/trip/checkout.js.map +1 -0
  50. package/dist/commands/trip/create.d.ts +3 -0
  51. package/dist/commands/trip/create.d.ts.map +1 -0
  52. package/dist/commands/trip/create.js +14 -0
  53. package/dist/commands/trip/create.js.map +1 -0
  54. package/dist/commands/trip/index.d.ts +3 -0
  55. package/dist/commands/trip/index.d.ts.map +1 -0
  56. package/dist/commands/trip/index.js +16 -0
  57. package/dist/commands/trip/index.js.map +1 -0
  58. package/dist/commands/trip/remove.d.ts +3 -0
  59. package/dist/commands/trip/remove.d.ts.map +1 -0
  60. package/dist/commands/trip/remove.js +19 -0
  61. package/dist/commands/trip/remove.js.map +1 -0
  62. package/dist/commands/trip/show.d.ts +3 -0
  63. package/dist/commands/trip/show.d.ts.map +1 -0
  64. package/dist/commands/trip/show.js +17 -0
  65. package/dist/commands/trip/show.js.map +1 -0
  66. package/dist/commands/trip/travelers.d.ts +3 -0
  67. package/dist/commands/trip/travelers.d.ts.map +1 -0
  68. package/dist/commands/trip/travelers.js +37 -0
  69. package/dist/commands/trip/travelers.js.map +1 -0
  70. package/dist/config/config.d.ts +12 -0
  71. package/dist/config/config.d.ts.map +1 -0
  72. package/dist/config/config.js +12 -0
  73. package/dist/config/config.js.map +1 -0
  74. package/dist/index.d.ts +3 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +23 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/output/formatter.d.ts +19 -0
  79. package/dist/output/formatter.d.ts.map +1 -0
  80. package/dist/output/formatter.js +77 -0
  81. package/dist/output/formatter.js.map +1 -0
  82. package/package.json +40 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAA0C,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,CACP,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,aAAa,EAEtB,OAAO,CAAC,EAAE,GAAG,EACb,GAAG,CAAC,EAAE,OAAO,KACV,OAAO,CAAC,IAAI,CAAC,IAGK,MAAM,OAAO,EAAE,GAAG,MAAM,GAAG,EAAE,mBA4BrD"}
@@ -0,0 +1,45 @@
1
+ import { createJinkoClient, ApiError, AuthError } from '@gojinko/api-client';
2
+ import { getGlobalOptions } from '../config/config.js';
3
+ import { output, outputError } from '../output/formatter.js';
4
+ export { output, outputError };
5
+ /**
6
+ * Wraps a command handler with standard error handling and client creation.
7
+ * Commander calls action with varying arg counts:
8
+ * command('foo') → action(opts, cmd)
9
+ * command('foo <arg>') → action(arg, opts, cmd)
10
+ * command('foo <a> <b>') → action(a, b, opts, cmd)
11
+ * We always extract the last arg as Command and second-to-last as opts.
12
+ */
13
+ export function withClient(handler) {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ return async function (...args) {
16
+ // Commander always passes Command as last arg, opts as second-to-last.
17
+ const cmd = args[args.length - 1];
18
+ const cmdOpts = args[args.length - 2];
19
+ const globals = getGlobalOptions(cmd);
20
+ try {
21
+ const client = await createJinkoClient({
22
+ apiKey: globals.apiKey,
23
+ baseUrl: globals.baseUrl,
24
+ });
25
+ await handler(client, globals, cmdOpts, cmd);
26
+ }
27
+ catch (error) {
28
+ if (error instanceof AuthError) {
29
+ outputError({ code: 'AUTH_REQUIRED', message: error.message }, globals);
30
+ process.exit(2);
31
+ }
32
+ if (error instanceof ApiError) {
33
+ outputError({ code: error.code, message: error.message, doc_url: error.docUrl }, globals);
34
+ process.exit(1);
35
+ }
36
+ if (error instanceof Error) {
37
+ outputError({ message: error.message }, globals);
38
+ process.exit(1);
39
+ }
40
+ outputError({ message: String(error) }, globals);
41
+ process.exit(1);
42
+ }
43
+ };
44
+ }
45
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAG/B;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,OAMkB;IAElB,8DAA8D;IAC9D,OAAO,KAAK,WAA0B,GAAG,IAAW;QAClD,uEAAuE;QACvE,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAY,CAAC;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAA4B,CAAC;QACjE,MAAM,OAAO,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC;gBACrC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;YACH,MAAM,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;gBAC/B,WAAW,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;gBAC9B,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;gBAC1F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;gBACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTravelersCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/travelers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgHhE"}
@@ -0,0 +1,118 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTravelersCommands(program) {
3
+ const travelers = program
4
+ .command('travelers')
5
+ .description('Manage saved traveler profiles.');
6
+ travelers
7
+ .command('list')
8
+ .description('List all saved travelers.')
9
+ .action(withClient(async (client, globals) => {
10
+ const response = await client.raw.GET('/api/v1/travelers', {});
11
+ output(response.data, { format: globals.format });
12
+ }));
13
+ travelers
14
+ .command('add')
15
+ .description('Add a new traveler profile.')
16
+ .requiredOption('--first-name <name>', 'first name')
17
+ .requiredOption('--last-name <name>', 'last name')
18
+ .requiredOption('--dob <date>', 'date of birth (YYYY-MM-DD)')
19
+ .requiredOption('--gender <gender>', 'gender: MALE or FEMALE')
20
+ .option('--passenger-type <type>', 'passenger type: ADULT, CHILD, INFANT', 'ADULT')
21
+ .option('--email <email>', 'email address')
22
+ .option('--phone <phone>', 'phone number')
23
+ .option('--nationality <code>', 'nationality (ISO 3166-1 alpha-2)')
24
+ .option('--passport-number <number>', 'passport number')
25
+ .option('--passport-expiry <date>', 'passport expiry (YYYY-MM-DD)')
26
+ .option('--passport-country <code>', 'passport issuing country')
27
+ .action(withClient(async (client, globals, opts) => {
28
+ const body = {
29
+ first_name: opts.firstName,
30
+ last_name: opts.lastName,
31
+ date_of_birth: opts.dob,
32
+ gender: opts.gender.toUpperCase(),
33
+ passenger_type: opts.passengerType,
34
+ };
35
+ if (opts.email)
36
+ body['email'] = opts.email;
37
+ if (opts.phone)
38
+ body['phone_number'] = opts.phone;
39
+ if (opts.nationality)
40
+ body['nationality'] = opts.nationality;
41
+ if (opts.passportNumber)
42
+ body['passport_number'] = opts.passportNumber;
43
+ if (opts.passportExpiry)
44
+ body['passport_expiry'] = opts.passportExpiry;
45
+ if (opts.passportCountry)
46
+ body['passport_country'] = opts.passportCountry;
47
+ const response = await client.raw.POST('/api/v1/travelers', {
48
+ body,
49
+ });
50
+ output(response.data, { format: globals.format });
51
+ }));
52
+ travelers
53
+ .command('show')
54
+ .description('Show a traveler profile.')
55
+ .argument('<id>', 'traveler ID')
56
+ .action(withClient(async (client, globals, opts, cmd) => {
57
+ const id = cmd.processedArgs[0];
58
+ const response = await client.raw.GET('/api/v1/travelers/{id}', {
59
+ params: { path: { id } },
60
+ });
61
+ output(response.data, { format: globals.format });
62
+ }));
63
+ travelers
64
+ .command('update')
65
+ .description('Update a traveler profile.')
66
+ .argument('<id>', 'traveler ID')
67
+ .option('--first-name <name>', 'first name')
68
+ .option('--last-name <name>', 'last name')
69
+ .option('--dob <date>', 'date of birth')
70
+ .option('--gender <gender>', 'gender')
71
+ .option('--email <email>', 'email')
72
+ .option('--phone <phone>', 'phone number')
73
+ .option('--nationality <code>', 'nationality')
74
+ .option('--passport-number <number>', 'passport number')
75
+ .option('--passport-expiry <date>', 'passport expiry')
76
+ .option('--passport-country <code>', 'passport country')
77
+ .action(withClient(async (client, globals, opts, cmd) => {
78
+ const id = cmd.processedArgs[0];
79
+ const body = {};
80
+ if (opts.firstName)
81
+ body['first_name'] = opts.firstName;
82
+ if (opts.lastName)
83
+ body['last_name'] = opts.lastName;
84
+ if (opts.dob)
85
+ body['date_of_birth'] = opts.dob;
86
+ if (opts.gender)
87
+ body['gender'] = opts.gender.toUpperCase();
88
+ if (opts.email)
89
+ body['email'] = opts.email;
90
+ if (opts.phone)
91
+ body['phone_number'] = opts.phone;
92
+ if (opts.nationality)
93
+ body['nationality'] = opts.nationality;
94
+ if (opts.passportNumber)
95
+ body['passport_number'] = opts.passportNumber;
96
+ if (opts.passportExpiry)
97
+ body['passport_expiry'] = opts.passportExpiry;
98
+ if (opts.passportCountry)
99
+ body['passport_country'] = opts.passportCountry;
100
+ const response = await client.raw.PUT('/api/v1/travelers/{id}', {
101
+ params: { path: { id } },
102
+ body,
103
+ });
104
+ output(response.data, { format: globals.format });
105
+ }));
106
+ travelers
107
+ .command('delete')
108
+ .description('Delete a traveler profile.')
109
+ .argument('<id>', 'traveler ID')
110
+ .action(withClient(async (client, globals, _opts, cmd) => {
111
+ const id = cmd.processedArgs[0];
112
+ const response = await client.raw.DELETE('/api/v1/travelers/{id}', {
113
+ params: { path: { id } },
114
+ });
115
+ output(response.data ?? { status: 'deleted', id }, { format: globals.format });
116
+ }));
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/travelers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,SAAS,GAAG,OAAO;SACtB,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAElD,SAAS;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,mBAA4B,EAAE,EAAW,CAAC,CAAC;QACjF,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;IAEN,SAAS;SACN,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,6BAA6B,CAAC;SAC1C,cAAc,CAAC,qBAAqB,EAAE,YAAY,CAAC;SACnD,cAAc,CAAC,oBAAoB,EAAE,WAAW,CAAC;SACjD,cAAc,CAAC,cAAc,EAAE,4BAA4B,CAAC;SAC5D,cAAc,CAAC,mBAAmB,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AE,IAAI,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC;QAE1E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,wBAAiC,EAAE;YACvE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE;YACxB,IAAI;SACI,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;IAEN,SAAS;SACN,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,4BAA4B,CAAC;SACzC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;SAC/B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACvD,MAAM,EAAE,GAAG,GAAI,CAAC,aAAa,CAAC,CAAC,CAAW,CAAC;QAC3C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,wBAAiC,EAAE;YAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE;SAChB,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripAddFlightCommand(parent: Command): void;
3
+ //# sourceMappingURL=add-flight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-flight.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/add-flight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAqBlE"}
@@ -0,0 +1,22 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripAddFlightCommand(parent) {
3
+ parent
4
+ .command('add-flight')
5
+ .description('Add a flight to a trip using a trip_item_token from price-check.')
6
+ .requiredOption('--trip-item-token <token>', 'trip item token from flights search --offer-token')
7
+ .option('--trip-id <id>', 'trip ID (creates new trip if omitted)')
8
+ .action(withClient(async (client, globals, opts) => {
9
+ const body = {
10
+ add_item: {
11
+ trip_item_token: opts.tripItemToken,
12
+ },
13
+ };
14
+ if (opts.tripId)
15
+ body['trip_id'] = opts.tripId;
16
+ const response = await client.raw.POST('/api/v1/devplatform/trips', {
17
+ body,
18
+ });
19
+ output(response.data, { format: globals.format });
20
+ }));
21
+ }
22
+ //# sourceMappingURL=add-flight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-flight.js","sourceRoot":"","sources":["../../../src/commands/trip/add-flight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,4BAA4B,CAAC,MAAe;IAC1D,MAAM;SACH,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,kEAAkE,CAAC;SAC/E,cAAc,CAAC,2BAA2B,EAAE,mDAAmD,CAAC;SAChG,MAAM,CAAC,gBAAgB,EAAE,uCAAuC,CAAC;SACjE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,MAAM,IAAI,GAA4B;YACpC,QAAQ,EAAE;gBACR,eAAe,EAAE,IAAI,CAAC,aAAa;aACpC;SACF,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM;YAAE,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAE/C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2BAAoC,EAAE;YAC3E,IAAI;SACI,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripCheckoutCommand(parent: Command): void;
3
+ //# sourceMappingURL=checkout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA+DjE"}
@@ -0,0 +1,59 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripCheckoutCommand(parent) {
3
+ parent
4
+ .command('checkout')
5
+ .description('Checkout a trip. Orchestrates quoting and returns a checkout URL.')
6
+ .option('--trip-id <id>', 'trip ID (required if no active trip)')
7
+ .option('--trip-item-token <token>', 'create trip + add flight + checkout in one call')
8
+ .option('--travelers <json>', 'travelers JSON array (for one-shot booking)')
9
+ .option('--contact <json>', 'contact JSON {email, phone} (for one-shot booking)')
10
+ .action(withClient(async (client, globals, opts) => {
11
+ let tripId = opts.tripId;
12
+ // One-shot booking: create trip with flight + travelers, then checkout.
13
+ // Mirrors the MCP `book` tool contract.
14
+ if (opts.tripItemToken) {
15
+ const tripBody = {
16
+ add_item: { trip_item_token: opts.tripItemToken },
17
+ };
18
+ if (opts.travelers) {
19
+ try {
20
+ tripBody['upsert_travelers'] = JSON.parse(opts.travelers);
21
+ }
22
+ catch {
23
+ console.error('Error: --travelers must be valid JSON array.');
24
+ process.exit(3);
25
+ }
26
+ }
27
+ if (opts.contact) {
28
+ try {
29
+ tripBody['contact'] = JSON.parse(opts.contact);
30
+ }
31
+ catch {
32
+ console.error('Error: --contact must be valid JSON object.');
33
+ process.exit(3);
34
+ }
35
+ }
36
+ if (tripId)
37
+ tripBody['trip_id'] = tripId;
38
+ const tripResponse = await client.raw.POST('/api/v1/devplatform/trips', {
39
+ body: tripBody,
40
+ });
41
+ const tripData = tripResponse.data;
42
+ tripId = tripData?.['trip_id'];
43
+ if (!tripId) {
44
+ console.error('Error: failed to create trip — no trip_id returned.');
45
+ process.exit(1);
46
+ }
47
+ }
48
+ if (!tripId) {
49
+ console.error('Error: --trip-id is required, or use --trip-item-token for one-shot booking.');
50
+ process.exit(3);
51
+ }
52
+ // Checkout via devplatform endpoint — handles quoting internally.
53
+ const checkoutResponse = await client.raw.POST('/api/v1/devplatform/trips/checkout', {
54
+ body: { trip_id: tripId },
55
+ });
56
+ output(checkoutResponse.data, { format: globals.format });
57
+ }));
58
+ }
59
+ //# sourceMappingURL=checkout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../../src/commands/trip/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,2BAA2B,CAAC,MAAe;IACzD,MAAM;SACH,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,mEAAmE,CAAC;SAChF,MAAM,CAAC,gBAAgB,EAAE,sCAAsC,CAAC;SAChE,MAAM,CAAC,2BAA2B,EAAE,iDAAiD,CAAC;SACtF,MAAM,CAAC,oBAAoB,EAAE,6CAA6C,CAAC;SAC3E,MAAM,CAAC,kBAAkB,EAAE,oDAAoD,CAAC;SAChF,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAEzB,wEAAwE;QACxE,wCAAwC;QACxC,IAAI,IAAI,CAAC,aAA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AAC;YACZ,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;YAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,oCAA6C,EAAE;YAC5F,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;SACjB,CAAC,CAAC;QAEZ,MAAM,CAAE,gBAAuC,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripCreateCommand(parent: Command): void;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAY/D"}
@@ -0,0 +1,14 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripCreateCommand(parent) {
3
+ parent
4
+ .command('create')
5
+ .description('Create an empty trip (shopping cart).')
6
+ .action(withClient(async (client, globals) => {
7
+ // Use devplatform/trips with no add_item — creates empty trip.
8
+ const response = await client.raw.POST('/api/v1/devplatform/trips', {
9
+ body: {},
10
+ });
11
+ output(response.data, { format: globals.format });
12
+ }));
13
+ }
14
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/trip/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,yBAAyB,CAAC,MAAe;IACvD,MAAM;SACH,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAC3C,+DAA+D;QAC/D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2BAAoC,EAAE;YAC3E,IAAI,EAAE,EAAE;SACA,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripCommands(program: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAU3D"}
@@ -0,0 +1,16 @@
1
+ import { registerTripCreateCommand } from './create.js';
2
+ import { registerTripShowCommand } from './show.js';
3
+ import { registerTripAddFlightCommand } from './add-flight.js';
4
+ import { registerTripTravelersCommand } from './travelers.js';
5
+ import { registerTripCheckoutCommand } from './checkout.js';
6
+ export function registerTripCommands(program) {
7
+ const trip = program
8
+ .command('trip')
9
+ .description('Manage trips: create, add flights, assign travelers, and checkout.');
10
+ registerTripCreateCommand(trip);
11
+ registerTripShowCommand(trip);
12
+ registerTripAddFlightCommand(trip);
13
+ registerTripTravelersCommand(trip);
14
+ registerTripCheckoutCommand(trip);
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/trip/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oEAAoE,CAAC,CAAC;IAErF,yBAAyB,CAAC,IAAI,CAAC,CAAC;IAChC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC9B,4BAA4B,CAAC,IAAI,CAAC,CAAC;IACnC,4BAA4B,CAAC,IAAI,CAAC,CAAC;IACnC,2BAA2B,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripRemoveCommand(parent: Command): void;
3
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/remove.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkB/D"}
@@ -0,0 +1,19 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripRemoveCommand(parent) {
3
+ parent
4
+ .command('remove')
5
+ .description('Remove a product from a trip.')
6
+ .argument('<product-id>', 'product ID to remove')
7
+ .requiredOption('--trip-id <id>', 'trip ID')
8
+ .action(withClient(async (client, globals, opts, cmd) => {
9
+ const productId = cmd.processedArgs[0];
10
+ const tripId = opts.tripId;
11
+ const response = await client.raw.DELETE('/api/v1/shop/{cart_id}/{product_id}', {
12
+ params: {
13
+ path: { cart_id: tripId, product_id: productId },
14
+ },
15
+ });
16
+ output(response.data ?? { status: 'removed' }, { format: globals.format });
17
+ }));
18
+ }
19
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/trip/remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,yBAAyB,CAAC,MAAe;IACvD,MAAM;SACH,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,QAAQ,CAAC,cAAc,EAAE,sBAAsB,CAAC;SAChD,cAAc,CAAC,gBAAgB,EAAE,SAAS,CAAC;SAC3C,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QACtD,MAAM,SAAS,GAAG,GAAI,CAAC,aAAa,CAAC,CAAC,CAAW,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;QAErC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,qCAA8C,EAAE;YACvF,MAAM,EAAE;gBACN,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE;aACjD;SACO,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrG,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripShowCommand(parent: Command): void;
3
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAe7D"}
@@ -0,0 +1,17 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripShowCommand(parent) {
3
+ parent
4
+ .command('show')
5
+ .description('Show trip details.')
6
+ .requiredOption('--trip-id <id>', 'trip ID')
7
+ .action(withClient(async (client, globals, opts) => {
8
+ // Use devplatform/trips with only trip_id to get current state.
9
+ const response = await client.raw.POST('/api/v1/devplatform/trips', {
10
+ body: {
11
+ trip_id: opts.tripId,
12
+ },
13
+ });
14
+ output(response.data, { format: globals.format });
15
+ }));
16
+ }
17
+ //# sourceMappingURL=show.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/commands/trip/show.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,uBAAuB,CAAC,MAAe;IACrD,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,oBAAoB,CAAC;SACjC,cAAc,CAAC,gBAAgB,EAAE,SAAS,CAAC;SAC3C,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,gEAAgE;QAChE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2BAAoC,EAAE;YAC3E,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI,CAAC,MAAM;aACrB;SACO,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerTripTravelersCommand(parent: Command): void;
3
+ //# sourceMappingURL=travelers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"travelers.d.ts","sourceRoot":"","sources":["../../../src/commands/trip/travelers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoClE"}
@@ -0,0 +1,37 @@
1
+ import { withClient, output } from '../shared.js';
2
+ export function registerTripTravelersCommand(parent) {
3
+ parent
4
+ .command('travelers')
5
+ .description('Set travelers on a trip.')
6
+ .requiredOption('--trip-id <id>', 'trip ID')
7
+ .requiredOption('--travelers <json>', 'travelers JSON array')
8
+ .option('--contact <json>', 'contact JSON object with email and phone')
9
+ .action(withClient(async (client, globals, opts) => {
10
+ let travelers;
11
+ try {
12
+ travelers = JSON.parse(opts.travelers);
13
+ }
14
+ catch {
15
+ console.error('Error: --travelers must be valid JSON array.');
16
+ process.exit(3);
17
+ }
18
+ const body = {
19
+ trip_id: opts.tripId,
20
+ upsert_travelers: travelers,
21
+ };
22
+ if (opts.contact) {
23
+ try {
24
+ body['contact'] = JSON.parse(opts.contact);
25
+ }
26
+ catch {
27
+ console.error('Error: --contact must be valid JSON object.');
28
+ process.exit(3);
29
+ }
30
+ }
31
+ const response = await client.raw.POST('/api/v1/devplatform/trips', {
32
+ body,
33
+ });
34
+ output(response.data, { format: globals.format });
35
+ }));
36
+ }
37
+ //# sourceMappingURL=travelers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"travelers.js","sourceRoot":"","sources":["../../../src/commands/trip/travelers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,UAAU,4BAA4B,CAAC,MAAe;IAC1D,MAAM;SACH,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,0BAA0B,CAAC;SACvC,cAAc,CAAC,gBAAgB,EAAE,SAAS,CAAC;SAC3C,cAAc,CAAC,oBAAoB,EAAE,sBAAsB,CAAC;SAC5D,MAAM,CAAC,kBAAkB,EAAE,0CAA0C,CAAC;SACtE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,IAAI,SAAoB,CAAC;QACzB,IAAI,CAAC;YACH,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAc,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;YAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,IAAI,GAA4B;YACpC,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,gBAAgB,EAAE,SAAS;SAC5B,CAAC;QAEF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC;gBACH,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7C,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;gBAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2BAAoC,EAAE;YAC3E,IAAI;SACI,CAAC,CAAC;QAEZ,MAAM,CAAE,QAA+B,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Command } from 'commander';
2
+ import type { OutputFormat } from '../output/formatter.js';
3
+ export interface GlobalOptions {
4
+ readonly format: OutputFormat;
5
+ readonly apiKey?: string;
6
+ readonly baseUrl?: string;
7
+ }
8
+ /**
9
+ * Extract global options from a Commander command by walking up to the root program.
10
+ */
11
+ export declare function getGlobalOptions(cmd: Command): GlobalOptions;
12
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAO5D"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Extract global options from a Commander command by walking up to the root program.
3
+ */
4
+ export function getGlobalOptions(cmd) {
5
+ const root = cmd.optsWithGlobals();
6
+ return {
7
+ format: root['format'] ?? 'json',
8
+ apiKey: root['apiKey'],
9
+ baseUrl: root['baseUrl'],
10
+ };
11
+ }
12
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,EAA6B,CAAC;IAC9D,OAAO;QACL,MAAM,EAAG,IAAI,CAAC,QAAQ,CAAkB,IAAI,MAAM;QAClD,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAuB;QAC5C,OAAO,EAAE,IAAI,CAAC,SAAS,CAAuB;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createProgram(): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,aAAa,IAAI,OAAO,CAkBvC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import { Command } from 'commander';
2
+ import { registerFlightsCommands } from './commands/flights/index.js';
3
+ import { registerTripCommands } from './commands/trip/index.js';
4
+ import { registerAuthCommands } from './commands/auth/index.js';
5
+ import { registerSchemaCommand } from './commands/schema.js';
6
+ import { registerConfigCommands } from './commands/config/index.js';
7
+ export function createProgram() {
8
+ const program = new Command();
9
+ program
10
+ .name('jinko')
11
+ .description('Jinko CLI — search flights, manage trips, and book travel from the terminal.')
12
+ .version('0.1.0')
13
+ .option('--format <format>', 'output format: json (default) or table', 'json')
14
+ .option('--api-key <key>', 'API key or OAuth token (overrides env/config)')
15
+ .option('--base-url <url>', 'BFF base URL override');
16
+ registerFlightsCommands(program);
17
+ registerTripCommands(program);
18
+ registerAuthCommands(program);
19
+ registerConfigCommands(program);
20
+ registerSchemaCommand(program);
21
+ return program;
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,OAAO,CAAC;SACb,WAAW,CAAC,8EAA8E,CAAC;SAC3F,OAAO,CAAC,OAAO,CAAC;SAChB,MAAM,CAAC,mBAAmB,EAAE,wCAAwC,EAAE,MAAM,CAAC;SAC7E,MAAM,CAAC,iBAAiB,EAAE,+CAA+C,CAAC;SAC1E,MAAM,CAAC,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;IAEvD,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACjC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAE/B,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type OutputFormat = 'json' | 'table';
2
+ export interface OutputOptions {
3
+ readonly format: OutputFormat;
4
+ }
5
+ /**
6
+ * Print data in the requested format. JSON is the default (agent-friendly).
7
+ * Table format is for human consumption.
8
+ */
9
+ export declare function output(data: unknown, options: OutputOptions): void;
10
+ /**
11
+ * Print an error in a structured way. JSON format outputs error object,
12
+ * table format prints a human-readable message.
13
+ */
14
+ export declare function outputError(error: {
15
+ code?: string;
16
+ message: string;
17
+ doc_url?: string;
18
+ }, options: OutputOptions): void;
19
+ //# sourceMappingURL=formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAMlE;AAuDD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CASrH"}