Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions skills/daiso-cli/references/cli-command-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Use `--json` for structured output. In shell commands, quoted Korean strings are
- Lotte Cinema theaters: `npx daiso lottecinema-theaters 잠실 --limit 10 --json`
- Lotte Cinema movies: `npx daiso get /api/lottecinema/movies --theaterId <theaterId> --json`
- Lotte Cinema seats: `npx daiso get /api/lottecinema/seats --theaterId <theaterId> --movieId <movieId> --playDate <YYYYMMDD> --json`
- Megabox theaters: `npx daiso megabox-theaters 강남 --limit 10 --json`
- Megabox movies: `npx daiso megabox-movies --theaterId <theaterId> --playDate <YYYYMMDD> --json`
- Megabox seats: `npx daiso megabox-seats --theaterId <theaterId> --movieId <movieId> --playDate <YYYYMMDD> --json`
- CGV theaters: `npx daiso cgv-theaters 강남 --limit 10 --json`
- CGV movies: `npx daiso cgv-movies --playDate <YYYYMMDD> --theaterCode <theaterCode> --json`
- CGV timetable: `npx daiso cgv-timetable --playDate <YYYYMMDD> --theaterCode <theaterCode> --json`
Expand Down
7 changes: 7 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ import {
handleLottecinemaTheaters,
handleLottecinemaMovies,
handleLottecinemaSeats,
handleMegaboxTheaters,
handleMegaboxMovies,
handleMegaboxSeats,
} from './cli/commands/cinema.js';

export type { CliDeps } from './cli/types.js';
Expand Down Expand Up @@ -179,6 +182,10 @@ export async function runCli(argv: string[], deps?: Partial<CliDeps>): Promise<n
return await handleLottecinemaTheaters(options, resolvedDeps);
if (command === 'lottecinema-movies') return await handleLottecinemaMovies(options, resolvedDeps);
if (command === 'lottecinema-seats') return await handleLottecinemaSeats(options, resolvedDeps);
if (command === 'megabox-theaters')
return await handleMegaboxTheaters(options, resolvedDeps);
if (command === 'megabox-movies') return await handleMegaboxMovies(options, resolvedDeps);
if (command === 'megabox-seats') return await handleMegaboxSeats(options, resolvedDeps);
if (command === 'emart24-stores') return await handleEmart24Stores(options, resolvedDeps);
if (command === 'emart24-products') return await handleEmart24Products(options, resolvedDeps);
if (command === 'emart24-inventory') return await handleEmart24Inventory(options, resolvedDeps);
Expand Down
24 changes: 24 additions & 0 deletions src/cli/commandOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,30 @@ export const COMMAND_OPTION_ALLOWLISTS = {
'lng',
'limit',
],
'megabox-theaters': ['help', 'json', 'keyword', 'lat', 'lng', 'playDate', 'areaCode', 'limit'],
'megabox-movies': [
'help',
'json',
'keyword',
'playDate',
'theaterId',
'movieId',
'areaCode',
'lat',
'lng',
],
'megabox-seats': [
'help',
'json',
'keyword',
'playDate',
'theaterId',
'movieId',
'areaCode',
'lat',
'lng',
'limit',
],
'emart24-stores': [
'help',
'json',
Expand Down
30 changes: 30 additions & 0 deletions src/cli/commands/cinema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,36 @@ export async function handleLottecinemaSeats(options: string[], deps: CliDeps):
});
}

export async function handleMegaboxTheaters(options: string[], deps: CliDeps): Promise<number> {
return await runApiCommand({
command: 'megabox-theaters',
options,
deps,
path: '/api/megabox/theaters',
configure: applyKeywordPositional,
});
}

export async function handleMegaboxMovies(options: string[], deps: CliDeps): Promise<number> {
return await runApiCommand({
command: 'megabox-movies',
options,
deps,
path: '/api/megabox/movies',
configure: applyKeywordPositional,
});
}

export async function handleMegaboxSeats(options: string[], deps: CliDeps): Promise<number> {
return await runApiCommand({
command: 'megabox-seats',
options,
deps,
path: '/api/megabox/seats',
configure: applyKeywordPositional,
});
}

export async function handleCgvTheaters(options: string[], deps: CliDeps): Promise<number> {
return await runApiCommand({
command: 'cgv-theaters',
Expand Down
33 changes: 33 additions & 0 deletions src/cliHelpDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export type CommandName =
| 'lottecinema-theaters'
| 'lottecinema-movies'
| 'lottecinema-seats'
| 'megabox-theaters'
| 'megabox-movies'
| 'megabox-seats'
| 'lottemart-stores'
| 'lottemart-products'
| 'emart24-stores'
Expand Down Expand Up @@ -60,6 +63,9 @@ export const COMMAND_LIST: CommandName[] = [
'lottecinema-theaters',
'lottecinema-movies',
'lottecinema-seats',
'megabox-theaters',
'megabox-movies',
'megabox-seats',
'lottemart-stores',
'lottemart-products',
'emart24-stores',
Expand Down Expand Up @@ -97,6 +103,9 @@ export const COMMAND_SUMMARY: Record<CommandName, string> = {
'lottecinema-theaters': '롯데시네마 주변 지점 조회',
'lottecinema-movies': '롯데시네마 영화/회차 조회',
'lottecinema-seats': '롯데시네마 잔여 좌석 조회',
'megabox-theaters': '메가박스 주변 지점 조회',
'megabox-movies': '메가박스 영화/회차 조회',
'megabox-seats': '메가박스 잔여 좌석 조회',
'lottemart-stores': '롯데마트 매장 검색',
'lottemart-products': '롯데마트 상품 검색',
'emart24-stores': '이마트24 매장 검색',
Expand Down Expand Up @@ -271,6 +280,30 @@ export const COMMAND_DETAIL: Record<CommandName, string[]> = {
'예시: daiso lottecinema-seats 잠실 --playDate 20260310 --movieId 23816',
'예시: daiso lottecinema-seats --playDate 20260310 --keyword "안산 중앙역" --movieId 23816',
],
'megabox-theaters': [
'명령: megabox-theaters',
'설명: 메가박스 주변 지점 API를 호출합니다.',
'사용법: daiso megabox-theaters [keyword] [--lat 값] [--lng 값] [--playDate YYYYMMDD] [--areaCode 값] [--limit N] [--json]',
'옵션: --keyword, --lat, --lng, --playDate, --areaCode, --limit, --json',
'예시: daiso megabox-theaters 강남 --limit 5',
'예시: daiso megabox-theaters --keyword "코엑스" --limit 5',
],
'megabox-movies': [
'명령: megabox-movies',
'설명: 메가박스 영화/회차 API를 호출합니다.',
'사용법: daiso megabox-movies [keyword] [--playDate YYYYMMDD] [--theaterId 값] [--movieId 값] [--areaCode 값] [--lat 값] [--lng 값] [--json]',
'옵션: --playDate, --theaterId, --movieId, --keyword, --areaCode, --lat, --lng, --json',
'예시: daiso megabox-movies 강남 --playDate 20260310',
'예시: daiso megabox-movies --playDate 20260310 --keyword "코엑스"',
],
'megabox-seats': [
'명령: megabox-seats',
'설명: 메가박스 잔여 좌석 API를 호출합니다.',
'사용법: daiso megabox-seats [keyword] [--playDate YYYYMMDD] [--theaterId 값] [--movieId 값] [--areaCode 값] [--lat 값] [--lng 값] [--limit N] [--json]',
'옵션: --playDate, --theaterId, --movieId, --keyword, --areaCode, --lat, --lng, --limit, --json',
'예시: daiso megabox-seats 강남 --playDate 20260310 --movieId 23816',
'예시: daiso megabox-seats --playDate 20260310 --keyword "코엑스" --movieId 23816',
],
'lottemart-stores': [
'명령: lottemart-stores',
'설명: 롯데마트 계열 매장 검색 API를 호출합니다.',
Expand Down
84 changes: 84 additions & 0 deletions tests/app/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,87 @@ describe('CLI', () => {
);
});

it('megabox-theaters 명령은 메가박스 주변 지점 API를 호출한다', async () => {
const { deps } = createDeps();
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue({
ok: true,
json: vi
.fn()
.mockResolvedValue({ success: true, data: { theaters: [] }, meta: { total: 0 } }),
} as unknown as Response);
deps.fetchImpl = fetchImpl;

const exitCode = await runCli(
['megabox-theaters', '--lat', '37.5125', '--lng', '127.0589', '--limit', '5'],
deps,
);

expect(exitCode).toBe(0);
expect(fetchImpl).toHaveBeenCalledWith(
'https://mcp.aka.page/api/megabox/theaters?lat=37.5125&lng=127.0589&limit=5',
);
});

it('megabox-theaters 명령은 위치 검색어를 positional 인자로 받는다', async () => {
const { deps } = createDeps();
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue({
ok: true,
json: vi
.fn()
.mockResolvedValue({ success: true, data: { theaters: [] }, meta: { total: 0 } }),
} as unknown as Response);
deps.fetchImpl = fetchImpl;

const exitCode = await runCli(['megabox-theaters', '강남', '--limit', '5'], deps);

expect(exitCode).toBe(0);
expect(fetchImpl).toHaveBeenCalledWith(
'https://mcp.aka.page/api/megabox/theaters?limit=5&keyword=%EA%B0%95%EB%82%A8',
);
});

it('megabox-movies 명령은 메가박스 영화/회차 API를 호출한다', async () => {
const { deps } = createDeps();
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue({
ok: true,
json: vi
.fn()
.mockResolvedValue({ success: true, data: { movies: [] }, meta: { total: 0 } }),
} as unknown as Response);
deps.fetchImpl = fetchImpl;

const exitCode = await runCli(
['megabox-movies', '--playDate', '20260310', '--theaterId', '1372'],
deps,
);

expect(exitCode).toBe(0);
expect(fetchImpl).toHaveBeenCalledWith(
'https://mcp.aka.page/api/megabox/movies?playDate=20260310&theaterId=1372',
);
});

it('megabox-seats 명령은 메가박스 잔여 좌석 API를 호출한다', async () => {
const { deps } = createDeps();
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue({
ok: true,
json: vi
.fn()
.mockResolvedValue({ success: true, data: { seats: [] }, meta: { total: 0 } }),
} as unknown as Response);
deps.fetchImpl = fetchImpl;

const exitCode = await runCli(
['megabox-seats', '--playDate', '20260310', '--theaterId', '1372', '--movieId', '23816'],
deps,
);

expect(exitCode).toBe(0);
expect(fetchImpl).toHaveBeenCalledWith(
'https://mcp.aka.page/api/megabox/seats?playDate=20260310&theaterId=1372&movieId=23816',
);
});

it('lottecinema-movies 명령은 롯데시네마 영화/회차 API를 호출한다', async () => {
const { deps } = createDeps();
const fetchImpl = vi.fn<typeof fetch>().mockResolvedValue({
Expand Down Expand Up @@ -1147,6 +1228,9 @@ describe('CLI', () => {
['lottecinema-theaters', ['lottecinema-theaters', '잠실']],
['lottecinema-movies', ['lottecinema-movies', '잠실']],
['lottecinema-seats', ['lottecinema-seats', '잠실']],
['megabox-theaters', ['megabox-theaters', '강남']],
['megabox-movies', ['megabox-movies', '강남']],
['megabox-seats', ['megabox-seats', '강남']],
['emart24-stores', ['emart24-stores', '강남']],
['emart24-products', ['emart24-products', '두바이']],
['emart24-inventory', ['emart24-inventory', '8800244010504', '--bizNoArr', '28339']],
Expand Down