googlemaps-kit 0.3.1 → 0.4.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/README.md +8 -3
- package/dist/cli/args.d.ts +20 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +73 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/run.d.ts +79 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +161 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/tui/app.d.ts +43 -0
- package/dist/cli/tui/app.d.ts.map +1 -0
- package/dist/cli/tui/app.js +376 -0
- package/dist/cli/tui/app.js.map +1 -0
- package/dist/cli/tui/styles.d.ts +11 -0
- package/dist/cli/tui/styles.d.ts.map +1 -0
- package/dist/cli/tui/styles.js +14 -0
- package/dist/cli/tui/styles.js.map +1 -0
- package/dist/cli.d.ts +7 -7
- package/dist/cli.js +104 -197
- package/dist/cli.js.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -175,19 +175,24 @@ const tools = maps.tools(); // or createMapsTools(maps)
|
|
|
175
175
|
await tools.discover.execute({ query: 'coffee', nearLat: near.lat, nearLng: near.lng });
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
CLI (pretty tables on TTY, JSON when piped):
|
|
178
|
+
CLI (pretty tables on TTY, JSON when piped) + interactive TUI:
|
|
179
179
|
|
|
180
180
|
```bash
|
|
181
|
+
# Interactive (Bubble Tea TUI)
|
|
182
|
+
npx googlemaps-kit
|
|
183
|
+
npx googlemaps-kit tui
|
|
184
|
+
|
|
185
|
+
# Scripted
|
|
181
186
|
npx googlemaps-kit discover "cafes in indiranagar" --near 12.98,77.64 --limit 5
|
|
182
187
|
npx googlemaps-kit resolve --query "Cubbon Park Bangalore"
|
|
183
188
|
npx googlemaps-kit profile --query "Third Wave Coffee Indiranagar" --near 12.98,77.64
|
|
184
189
|
npx googlemaps-kit route --from "Cubbon Park, Bangalore" --to "Indiranagar, Bangalore"
|
|
185
190
|
npx googlemaps-kit opinions --query "Third Wave Coffee Indiranagar" --near 12.98,77.64
|
|
186
|
-
npx googlemaps-kit media --query "
|
|
191
|
+
npx googlemaps-kit media --query "Third Wave Coffee Indiranagar" --near 12.98,77.64
|
|
187
192
|
npx googlemaps-kit pipeline "cafes" --near 12.98,77.64 --max 3
|
|
188
193
|
```
|
|
189
194
|
|
|
190
|
-
Use `--json` / `--format json|csv|geojson` for machine output. Export helpers: `toCsv(places)`, `toGeoJSON(places)`.
|
|
195
|
+
TUI is built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) (TypeScript port). Use `--json` / `--format json|csv|geojson` for machine output. Export helpers: `toCsv(places)`, `toGeoJSON(places)`.
|
|
191
196
|
|
|
192
197
|
## Advanced (under the hood)
|
|
193
198
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI argument helpers.
|
|
3
|
+
*/
|
|
4
|
+
export declare function flag(args: string[], name: string): string | undefined;
|
|
5
|
+
export declare function has(args: string[], name: string): boolean;
|
|
6
|
+
export declare const VALUE_FLAGS: Set<string>;
|
|
7
|
+
/** First non-flag token that is not a value for a preceding option. */
|
|
8
|
+
export declare function positional(args: string[]): string | undefined;
|
|
9
|
+
export declare function parseCoords(value: string | undefined): {
|
|
10
|
+
lat: number;
|
|
11
|
+
lng: number;
|
|
12
|
+
} | undefined;
|
|
13
|
+
/** Address string or lat,lng — for route endpoints. */
|
|
14
|
+
export declare function parseEndpoint(value: string | undefined): string | {
|
|
15
|
+
lat: number;
|
|
16
|
+
lng: number;
|
|
17
|
+
};
|
|
18
|
+
export type OutputFormat = 'table' | 'pretty' | 'json' | 'csv' | 'geojson';
|
|
19
|
+
export declare function resolveFormat(args: string[], kind: 'rows' | 'card', isTty: boolean): OutputFormat;
|
|
20
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIrE;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,eAAO,MAAM,WAAW,aAgBtB,CAAC;AAEH,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAU7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAO/F;AAED,uDAAuD;AACvD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAM9F;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAE3E,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,KAAK,EAAE,OAAO,GACb,YAAY,CASd"}
|
package/dist/cli/args.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI argument helpers.
|
|
3
|
+
*/
|
|
4
|
+
export function flag(args, name) {
|
|
5
|
+
const i = args.indexOf(name);
|
|
6
|
+
if (i < 0)
|
|
7
|
+
return undefined;
|
|
8
|
+
return args[i + 1];
|
|
9
|
+
}
|
|
10
|
+
export function has(args, name) {
|
|
11
|
+
return args.includes(name);
|
|
12
|
+
}
|
|
13
|
+
export const VALUE_FLAGS = new Set([
|
|
14
|
+
'--near',
|
|
15
|
+
'--from',
|
|
16
|
+
'--to',
|
|
17
|
+
'--mode',
|
|
18
|
+
'--limit',
|
|
19
|
+
'--format',
|
|
20
|
+
'--depth',
|
|
21
|
+
'--query',
|
|
22
|
+
'--url',
|
|
23
|
+
'--name',
|
|
24
|
+
'--pages',
|
|
25
|
+
'--max',
|
|
26
|
+
'--profile',
|
|
27
|
+
'--hl',
|
|
28
|
+
'--gl',
|
|
29
|
+
]);
|
|
30
|
+
/** First non-flag token that is not a value for a preceding option. */
|
|
31
|
+
export function positional(args) {
|
|
32
|
+
for (let i = 0; i < args.length; i++) {
|
|
33
|
+
const a = args[i];
|
|
34
|
+
if (a.startsWith('-')) {
|
|
35
|
+
if (VALUE_FLAGS.has(a))
|
|
36
|
+
i += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
return a;
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
export function parseCoords(value) {
|
|
44
|
+
if (!value)
|
|
45
|
+
return undefined;
|
|
46
|
+
const [a, b] = value.split(',').map((s) => Number(s.trim()));
|
|
47
|
+
if (a == null || b == null || Number.isNaN(a) || Number.isNaN(b)) {
|
|
48
|
+
throw new Error(`Invalid coordinates: ${value} (expected lat,lng)`);
|
|
49
|
+
}
|
|
50
|
+
return { lat: a, lng: b };
|
|
51
|
+
}
|
|
52
|
+
/** Address string or lat,lng — for route endpoints. */
|
|
53
|
+
export function parseEndpoint(value) {
|
|
54
|
+
if (!value)
|
|
55
|
+
throw new Error('Missing endpoint');
|
|
56
|
+
if (/^-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?$/.test(value.trim())) {
|
|
57
|
+
return parseCoords(value);
|
|
58
|
+
}
|
|
59
|
+
return value.trim();
|
|
60
|
+
}
|
|
61
|
+
export function resolveFormat(args, kind, isTty) {
|
|
62
|
+
if (has(args, '--json'))
|
|
63
|
+
return 'json';
|
|
64
|
+
const raw = flag(args, '--format');
|
|
65
|
+
if (!raw)
|
|
66
|
+
return isTty ? (kind === 'rows' ? 'table' : 'pretty') : 'json';
|
|
67
|
+
const allowed = ['table', 'pretty', 'json', 'csv', 'geojson'];
|
|
68
|
+
if (!allowed.includes(raw)) {
|
|
69
|
+
throw new Error(`Invalid --format ${raw} (expected ${allowed.join('|')})`);
|
|
70
|
+
}
|
|
71
|
+
return raw;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,IAAY;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAc,EAAE,IAAY;IAC9C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IACjC,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,UAAU;IACV,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,WAAW;IACX,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,IAA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QAAE,OAAO,MAAM,CAAC;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACzE,MAAM,OAAO,GAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC9E,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAmB,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,cAAc,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,GAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent command runners — used by scripted CLI and TUI.
|
|
3
|
+
*/
|
|
4
|
+
import type { GMapsClient } from '../client/gmaps-client.js';
|
|
5
|
+
import type { PlaceRef } from '../types/dx.js';
|
|
6
|
+
import { type OutputFormat } from './args.js';
|
|
7
|
+
import { printJson } from './format.js';
|
|
8
|
+
export type ActionId = 'discover' | 'resolve' | 'profile' | 'route' | 'opinions' | 'media' | 'pipeline' | 'capabilities';
|
|
9
|
+
export interface ActionMeta {
|
|
10
|
+
id: ActionId;
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ACTIONS: ActionMeta[];
|
|
15
|
+
export declare function resolvePlaceRef(maps: GMapsClient, options: {
|
|
16
|
+
hexId?: string;
|
|
17
|
+
query?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
near?: string;
|
|
20
|
+
}): Promise<PlaceRef>;
|
|
21
|
+
export interface RunDiscoverInput {
|
|
22
|
+
query: string;
|
|
23
|
+
near: string;
|
|
24
|
+
mode?: 'fast' | 'full';
|
|
25
|
+
limit?: number;
|
|
26
|
+
format?: OutputFormat;
|
|
27
|
+
}
|
|
28
|
+
export declare function runDiscover(maps: GMapsClient, input: RunDiscoverInput): Promise<string>;
|
|
29
|
+
export declare function runResolve(maps: GMapsClient, input: {
|
|
30
|
+
query?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
near?: string;
|
|
33
|
+
format?: OutputFormat;
|
|
34
|
+
}): Promise<string>;
|
|
35
|
+
export declare function runProfile(maps: GMapsClient, input: {
|
|
36
|
+
query?: string;
|
|
37
|
+
hexId?: string;
|
|
38
|
+
name?: string;
|
|
39
|
+
near?: string;
|
|
40
|
+
depth?: 'card' | 'full' | 'complete';
|
|
41
|
+
format?: OutputFormat;
|
|
42
|
+
}): Promise<string>;
|
|
43
|
+
export declare function runRoute(maps: GMapsClient, input: {
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
mode?: 'driving' | 'walking' | 'bicycling' | 'transit';
|
|
47
|
+
format?: OutputFormat;
|
|
48
|
+
}): Promise<string>;
|
|
49
|
+
export declare function runOpinions(maps: GMapsClient, input: {
|
|
50
|
+
query?: string;
|
|
51
|
+
hexId?: string;
|
|
52
|
+
near?: string;
|
|
53
|
+
pages?: number;
|
|
54
|
+
limit?: number;
|
|
55
|
+
aggregates?: boolean;
|
|
56
|
+
format?: OutputFormat;
|
|
57
|
+
}): Promise<string>;
|
|
58
|
+
export declare function runMedia(maps: GMapsClient, input: {
|
|
59
|
+
query?: string;
|
|
60
|
+
hexId?: string;
|
|
61
|
+
near?: string;
|
|
62
|
+
limit?: number;
|
|
63
|
+
format?: OutputFormat;
|
|
64
|
+
}): Promise<string>;
|
|
65
|
+
export declare function runPipeline(maps: GMapsClient, input: {
|
|
66
|
+
query: string;
|
|
67
|
+
near: string;
|
|
68
|
+
max?: number;
|
|
69
|
+
profile?: 'card' | 'full' | 'complete' | false;
|
|
70
|
+
opinions?: boolean;
|
|
71
|
+
format?: OutputFormat;
|
|
72
|
+
}): Promise<string>;
|
|
73
|
+
export declare function runCapabilities(maps: GMapsClient, input?: {
|
|
74
|
+
format?: OutputFormat;
|
|
75
|
+
}): Promise<string>;
|
|
76
|
+
/** Print helper for scripted CLI stdout. */
|
|
77
|
+
export declare function emit(text: string, format: OutputFormat): void;
|
|
78
|
+
export { printJson };
|
|
79
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAOL,SAAS,EACV,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,cAAc,CAAC;AAEnB,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,OAAO,EAAE,UAAU,EAS/B,CAAC;AAEF,wBAAsB,eAAe,CACnC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACxE,OAAO,CAAC,QAAQ,CAAC,CAwBnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI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
|
|
3
|
+
*/
|
|
4
|
+
import { parseCoords, parseEndpoint } from './args.js';
|
|
5
|
+
import { formatDiscoverTable, formatMediaPretty, formatOpinionsTable, formatProfilePretty, formatResolvePretty, formatRoutePretty, printJson, } from './format.js';
|
|
6
|
+
import { toCsv, toGeoJSON } from '../utils/export-results.js';
|
|
7
|
+
export const ACTIONS = [
|
|
8
|
+
{ id: 'discover', title: 'Discover', description: 'Search places near a point' },
|
|
9
|
+
{ id: 'resolve', title: 'Resolve', description: 'Turn a query or URL into a place id' },
|
|
10
|
+
{ id: 'profile', title: 'Profile', description: 'Place card — hours, phone, rating' },
|
|
11
|
+
{ id: 'route', title: 'Route', description: 'Directions between two places' },
|
|
12
|
+
{ id: 'opinions', title: 'Opinions', description: 'Read reviews for a place' },
|
|
13
|
+
{ id: 'media', title: 'Media', description: 'Photo URLs for a place' },
|
|
14
|
+
{ id: 'pipeline', title: 'Pipeline', description: 'Discover → profile in one shot' },
|
|
15
|
+
{ id: 'capabilities', title: 'Capabilities', description: 'What this session can do' },
|
|
16
|
+
];
|
|
17
|
+
export async function resolvePlaceRef(maps, options) {
|
|
18
|
+
const { hexId, query, name } = options;
|
|
19
|
+
const near = parseCoords(options.near);
|
|
20
|
+
if (hexId && (hexId.includes('0x') || hexId.startsWith('ChIJ') || /^[0-9a-fx:]+$/i.test(hexId))) {
|
|
21
|
+
return { hexId, name };
|
|
22
|
+
}
|
|
23
|
+
const q = query ?? (hexId && hexId.includes(' ') ? hexId : undefined);
|
|
24
|
+
if (!q) {
|
|
25
|
+
throw new Error('Need a place: pass hexId or query (+ near)');
|
|
26
|
+
}
|
|
27
|
+
const resolved = await maps.resolve({ query: q, near });
|
|
28
|
+
if (!resolved.hexId) {
|
|
29
|
+
throw new Error(`Could not resolve a place id for: ${q}`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
hexId: resolved.hexId,
|
|
33
|
+
name: resolved.name ?? name,
|
|
34
|
+
lat: resolved.lat,
|
|
35
|
+
lng: resolved.lng,
|
|
36
|
+
placeId: resolved.placeId,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export async function runDiscover(maps, input) {
|
|
40
|
+
const near = parseCoords(input.near);
|
|
41
|
+
if (!near)
|
|
42
|
+
throw new Error('discover requires near lat,lng');
|
|
43
|
+
const result = await maps.discover({
|
|
44
|
+
query: input.query,
|
|
45
|
+
near,
|
|
46
|
+
mode: input.mode ?? 'fast',
|
|
47
|
+
limit: input.limit,
|
|
48
|
+
});
|
|
49
|
+
const format = input.format ?? 'table';
|
|
50
|
+
if (format === 'json')
|
|
51
|
+
return JSON.stringify(result, null, 2);
|
|
52
|
+
if (format === 'csv')
|
|
53
|
+
return toCsv(result.places);
|
|
54
|
+
if (format === 'geojson')
|
|
55
|
+
return JSON.stringify(toGeoJSON(result.places), null, 2);
|
|
56
|
+
return formatDiscoverTable(result);
|
|
57
|
+
}
|
|
58
|
+
export async function runResolve(maps, input) {
|
|
59
|
+
if (!input.query && !input.url)
|
|
60
|
+
throw new Error('resolve requires query or url');
|
|
61
|
+
const result = await maps.resolve({
|
|
62
|
+
query: input.query,
|
|
63
|
+
url: input.url,
|
|
64
|
+
near: parseCoords(input.near),
|
|
65
|
+
});
|
|
66
|
+
if (input.format === 'json')
|
|
67
|
+
return JSON.stringify(result, null, 2);
|
|
68
|
+
return formatResolvePretty(result);
|
|
69
|
+
}
|
|
70
|
+
export async function runProfile(maps, input) {
|
|
71
|
+
const ref = await resolvePlaceRef(maps, input);
|
|
72
|
+
const result = await maps.profile(ref, { depth: input.depth ?? 'card' });
|
|
73
|
+
if (input.format === 'json')
|
|
74
|
+
return JSON.stringify(result, null, 2);
|
|
75
|
+
return formatProfilePretty(result);
|
|
76
|
+
}
|
|
77
|
+
export async function runRoute(maps, input) {
|
|
78
|
+
const from = parseEndpoint(input.from);
|
|
79
|
+
const to = parseEndpoint(input.to);
|
|
80
|
+
const result = await maps.route({ from, to, mode: input.mode });
|
|
81
|
+
if (input.format === 'json')
|
|
82
|
+
return JSON.stringify(result, null, 2);
|
|
83
|
+
const label = typeof from === 'string' && typeof to === 'string' ? `${from} → ${to}` : undefined;
|
|
84
|
+
return formatRoutePretty(result, label);
|
|
85
|
+
}
|
|
86
|
+
export async function runOpinions(maps, input) {
|
|
87
|
+
const ref = await resolvePlaceRef(maps, input);
|
|
88
|
+
const result = await maps.opinions(ref, {
|
|
89
|
+
pages: input.pages ?? 1,
|
|
90
|
+
limit: input.limit ?? 5,
|
|
91
|
+
includeAggregates: input.aggregates === true,
|
|
92
|
+
});
|
|
93
|
+
if (input.format === 'json')
|
|
94
|
+
return JSON.stringify(result, null, 2);
|
|
95
|
+
return formatOpinionsTable(result);
|
|
96
|
+
}
|
|
97
|
+
export async function runMedia(maps, input) {
|
|
98
|
+
const ref = await resolvePlaceRef(maps, input);
|
|
99
|
+
const result = await maps.media(ref, { pageSize: input.limit ?? 8 });
|
|
100
|
+
if (input.format === 'json')
|
|
101
|
+
return JSON.stringify(result, null, 2);
|
|
102
|
+
return formatMediaPretty(result);
|
|
103
|
+
}
|
|
104
|
+
export async function runPipeline(maps, input) {
|
|
105
|
+
const near = parseCoords(input.near);
|
|
106
|
+
if (!near)
|
|
107
|
+
throw new Error('pipeline requires near lat,lng');
|
|
108
|
+
const profileDepth = input.profile === false ? false : { depth: input.profile ?? 'card' };
|
|
109
|
+
const result = await maps.pipeline({
|
|
110
|
+
discover: { query: input.query, near, mode: 'fast' },
|
|
111
|
+
maxPlaces: input.max ?? 3,
|
|
112
|
+
profile: profileDepth,
|
|
113
|
+
opinions: input.opinions ? { pages: 1, limit: 3 } : false,
|
|
114
|
+
});
|
|
115
|
+
if (input.format === 'json')
|
|
116
|
+
return JSON.stringify(result, null, 2);
|
|
117
|
+
const lines = [
|
|
118
|
+
`pipeline · ${result.places.length} places · ${Math.round(result.timingMs)}ms`,
|
|
119
|
+
'─'.repeat(56),
|
|
120
|
+
];
|
|
121
|
+
for (const row of result.places) {
|
|
122
|
+
const p = row.profile?.place ?? row.hit;
|
|
123
|
+
const rating = p.rating != null ? `★ ${p.rating.toFixed(1)}` : '★ —';
|
|
124
|
+
const reviews = p.reviewCount != null ? `(${p.reviewCount})` : '';
|
|
125
|
+
lines.push(`${p.name ?? '—'} ${rating} ${reviews}`.trim());
|
|
126
|
+
if (p.address)
|
|
127
|
+
lines.push(` ${p.address}`);
|
|
128
|
+
const snippet = row.opinions?.reviews?.[0]?.text ?? row.opinions?.reviews?.[0]?.textPreview;
|
|
129
|
+
if (snippet) {
|
|
130
|
+
const t = snippet.replace(/\s+/g, ' ').trim().slice(0, 70);
|
|
131
|
+
lines.push(` “${t}${t.length >= 70 ? '…' : ''}”`);
|
|
132
|
+
}
|
|
133
|
+
lines.push('');
|
|
134
|
+
}
|
|
135
|
+
return lines.join('\n').trimEnd();
|
|
136
|
+
}
|
|
137
|
+
export async function runCapabilities(maps, input = {}) {
|
|
138
|
+
const caps = await maps.capabilities();
|
|
139
|
+
if (input.format === 'json')
|
|
140
|
+
return JSON.stringify(caps, null, 2);
|
|
141
|
+
return [
|
|
142
|
+
`session ${caps.session}${caps.signedIn ? ' (signed in)' : ''}`,
|
|
143
|
+
`search yes`,
|
|
144
|
+
`details yes`,
|
|
145
|
+
`reviews boq${caps.reviewsRpc ? ' + rpc' : ''}`,
|
|
146
|
+
`photos yes`,
|
|
147
|
+
`directions yes`,
|
|
148
|
+
`askMaps ${caps.askMaps ? 'yes' : 'no (needs cookies)'}`,
|
|
149
|
+
].join('\n');
|
|
150
|
+
}
|
|
151
|
+
/** Print helper for scripted CLI stdout. */
|
|
152
|
+
export function emit(text, format) {
|
|
153
|
+
if (format === 'json') {
|
|
154
|
+
// already JSON string from runners
|
|
155
|
+
console.log(text);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
console.log(text);
|
|
159
|
+
}
|
|
160
|
+
export { printJson };
|
|
161
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sour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,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,EAAE;KAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,MAAoB;IACrD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,mCAAmC;QACnC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive TUI — Bubble Tea (Elm Architecture).
|
|
3
|
+
* Uses @oakoliver/bubbletea — TypeScript port of charmbracelet/bubbletea.
|
|
4
|
+
*/
|
|
5
|
+
import { type Msg, type Cmd, type Model } from '@oakoliver/bubbletea';
|
|
6
|
+
import { TextInputModel, SpinnerModel, ViewportModel } from '@oakoliver/bubbles';
|
|
7
|
+
import { type GMapsClient } from '../../client/gmaps-client.js';
|
|
8
|
+
import { type ActionId } from '../run.js';
|
|
9
|
+
type Screen = 'menu' | 'form' | 'loading' | 'result' | 'error';
|
|
10
|
+
interface FieldDef {
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
placeholder: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class MapsTui implements Model {
|
|
17
|
+
screen: Screen;
|
|
18
|
+
cursor: number;
|
|
19
|
+
action: ActionId | null;
|
|
20
|
+
fields: TextInputModel[];
|
|
21
|
+
fieldDefs: FieldDef[];
|
|
22
|
+
fieldIndex: number;
|
|
23
|
+
spinner: SpinnerModel;
|
|
24
|
+
viewport: ViewportModel;
|
|
25
|
+
status: string;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
private maps;
|
|
29
|
+
constructor(maps?: GMapsClient);
|
|
30
|
+
init(): Cmd;
|
|
31
|
+
update(msg: Msg): [Model, Cmd];
|
|
32
|
+
private updateMenu;
|
|
33
|
+
private openForm;
|
|
34
|
+
private focusCurrentField;
|
|
35
|
+
private updateForm;
|
|
36
|
+
private fieldValue;
|
|
37
|
+
private startRun;
|
|
38
|
+
private execute;
|
|
39
|
+
view(): string;
|
|
40
|
+
}
|
|
41
|
+
export declare function runTui(maps?: GMapsClient): Promise<void>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/cli/tui/app.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,KAAK,EAQX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,EAEd,YAAY,EAIZ,aAAa,EAId,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAO,KAAK,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAEL,KAAK,QAAQ,EASd,MAAM,WAAW,CAAC;AAGnB,KAAK,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE/D,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsDD,qBAAa,OAAQ,YAAW,KAAK;IACnC,MAAM,EAAE,MAAM,CAAU;IACxB,MAAM,SAAK;IACX,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAQ;IAC/B,MAAM,EAAE,cAAc,EAAE,CAAM;IAC9B,SAAS,EAAE,QAAQ,EAAE,CAAM;IAC3B,UAAU,SAAK;IACf,OAAO,EAAE,YAAY,CAAgC;IACrD,QAAQ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