@odyssey365/cli 0.2.2 → 0.2.3

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 CHANGED
@@ -157,22 +157,24 @@ cat input.json | odyssey create_memo --input -
157
157
  - 필수 파라미터가 하나뿐인 도구는 위치 인자로 받는다(`odyssey get_todo <todoId>`).
158
158
  - 도구 이름은 케밥으로 써도 된다(`odyssey list-todos`).
159
159
 
160
- ### 로컬 사진 올리기
160
+ ### 로컬 사진·파일 올리기
161
161
 
162
- 사진 자리에 **로컬 경로**를 적으면 CLI 가 서버 업로드 주소로 올리고 `{uploadId, index}` 로 바꿔 보낸다(한 장 20MB · PNG·JPEG·GIF).
163
- 앱에서 사진을 넣는 세 곳과 같다.
162
+ 사진 자리에 **로컬 경로**를 적으면 CLI 가 서버 업로드 주소로 올리고 `{uploadId, index}` 로 바꿔 보낸다(한 개 20MB · 사진은 PNG·JPEG·GIF).
163
+ 앱에서 사진을 넣는 세 곳과 같다. 에셋(`files`)은 사진뿐 아니라 **PDF·문서(docx·xlsx·pptx·hwp·txt·md·csv …)·압축·소리(mp3·m4a·wav …)** 도
164
+ 담는다 — CLI 가 주소를 `accept:'files'` 로 받고, 서버가 확장자와 내용으로 형식을 확인한다(동영상은 앱에서).
164
165
 
165
166
  ```bash
166
- # 에셋(보드에 사진) — files → uploads
167
- odyssey create_asset --json '{"files":["./shot1.png","./shot2.png"],"title":"화면","projectUid":"…","attachToComponentId":"…"}'
168
- odyssey add_asset_images <assetId> --json '{"files":["./more.png"]}'
167
+ # 에셋(보드에 사진·파일) — files → uploads
168
+ odyssey create_asset --json '{"files":["./shot1.png","./회의록.pdf","./녹음.m4a"],"title":"회의 자료","projectUid":"…","attachToComponentId":"…"}'
169
+ odyssey add_asset_images <assetId> --json '{"files":["./more.png","./정리.docx"]}'
169
170
  # 할일·메모 본문 끝 — uploadImages[].file
170
171
  odyssey create_memo --json '{"title":"버그 재현","text":"…","uploadImages":[{"file":"./bug.png"}]}'
171
172
  # 페이지 사진 칸 — image.file (상대 경로는 --input 파일 옆 기준)
172
173
  odyssey create_snapshot --input page.json
173
174
  ```
174
175
 
175
- CLI 없이 MCP 로 쓰는 AI 는 `create_upload_url` 로 주소를 받아 curl 로 보내거나, 그 주소를 링크로 사람에게 건네 브라우저에서 고르게 한다.
176
+ CLI 없이 MCP 로 쓰는 AI 는 `create_upload_url` 로 주소를 받아 curl 로 보내거나, 그 주소를 링크로 사람에게 건네 브라우저에서 고르게 한다
177
+ (파일을 에셋에 담을 거면 `create_upload_url` 에 `accept:"files"`).
176
178
 
177
179
  ### 출력
178
180
 
package/dist/files.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * - `image: { file }` — 스냅샷 사진 칸(create_snapshot · update_snapshot · create_snapshot_draft).
11
11
  * - `uploadImages: [{ file }]` — 할일·메모 본문 끝(create_todo · update_todo · create_memo · update_memo).
12
12
  * - `files: ["경로", …]` — 에셋(create_asset · add_asset_images) → `uploads: [{ uploadId, index }]`.
13
+ * 에셋은 사진뿐 아니라 PDF·문서·소리도 담으므로, 이 자리가 있으면 주소를 `accept:'files'` 로 받는다(서버가 내용으로 판정한다).
13
14
  * 이름이 다른 키의 `file` 은 손대지 않는다 — 다른 도구의 문자열을 파일로 오인해 읽어 보내면 안 된다.
14
15
  * 상대 경로는 `--input` 파일이 있는 폴더 기준(원고 JSON 옆에 그림을 두는 흐름), 없으면 지금 폴더.
15
16
  *
@@ -17,6 +18,7 @@
17
18
  *
18
19
  * 이력: document/90-process/work-log/261011 MCP 스냅샷 AI 왕복 생성·수정 역할 어휘 통일 서식 표기.md
19
20
  * 이력: document/90-process/work-log/261028 MCP CLI 사진 올리기 업로드 주소 업로드 링크 create_upload_url.md
21
+ * 이력: document/90-process/work-log/261102 MCP 업로드 에셋 파일 소리 담기 소리 재생기 시스템 열기.md
20
22
  */
21
23
  import { readFileSync, statSync } from 'node:fs';
22
24
  import { basename, isAbsolute, resolve } from 'node:path';
@@ -96,6 +98,7 @@ export function collectLocalFiles(value, baseDir) {
96
98
  if (typeof item.file === 'string' && item.uploadId === undefined) {
97
99
  slots.push({
98
100
  path: resolveLocal(baseDir, item.file, `uploadImages[${i}].file`),
101
+ kind: 'image',
99
102
  apply: (ref) => { delete item.file; item.uploadId = ref.uploadId; item.index = ref.index; },
100
103
  });
101
104
  return;
@@ -114,6 +117,7 @@ export function collectLocalFiles(value, baseDir) {
114
117
  if (typeof img.file === 'string' && img.data === undefined && img.uploadId === undefined) {
115
118
  slots.push({
116
119
  path: resolveLocal(baseDir, img.file, 'image.file'),
120
+ kind: 'image',
117
121
  apply: (ref) => { delete img.file; img.uploadId = ref.uploadId; img.index = ref.index; },
118
122
  });
119
123
  continue;
@@ -122,7 +126,7 @@ export function collectLocalFiles(value, baseDir) {
122
126
  if (key === 'files' && Array.isArray(child) && child.length > 0 && child.every((f) => typeof f === 'string')) {
123
127
  const refs = [];
124
128
  child.forEach((f, i) => {
125
- slots.push({ path: resolveLocal(baseDir, f, `files[${i}]`), apply: (ref) => { refs.push(ref); } });
129
+ slots.push({ path: resolveLocal(baseDir, f, `files[${i}]`), kind: 'file', apply: (ref) => { refs.push(ref); } });
126
130
  });
127
131
  finals.push(() => {
128
132
  delete obj.files;
@@ -140,16 +144,19 @@ export function collectLocalFiles(value, baseDir) {
140
144
  /**
141
145
  * 로컬 경로를 전부 올리고 자리를 `{ uploadId, index }` 로 바꾼다. 올린 파일 수.
142
146
  * 같은 경로는 한 번만 올린다. 10장이 넘으면 주소를 여러 개 받는다.
147
+ * 에셋 자리(`files`)가 하나라도 있으면 주소를 files 로 받는다 — files 주소는 사진도 받으므로 사진 자리와 섞여도 된다
148
+ * (사진 자리에 파일을 적으면 서버가 쓰기 전에 거절한다).
143
149
  */
144
150
  export async function uploadLocalFiles(value, baseDir, uploader) {
145
151
  const { slots, finalize } = collectLocalFiles(value, baseDir);
146
152
  if (slots.length === 0)
147
153
  return 0;
148
154
  const unique = [...new Set(slots.map((s) => s.path))];
155
+ const accept = slots.some((s) => s.kind === 'file') ? 'files' : 'images';
149
156
  const refs = new Map();
150
157
  for (let i = 0; i < unique.length; i += MAX_FILES_PER_UPLOAD) {
151
158
  const chunk = unique.slice(i, i + MAX_FILES_PER_UPLOAD);
152
- const { uploadId } = await uploader.create(chunk.length);
159
+ const { uploadId } = await uploader.create(chunk.length, accept);
153
160
  for (const path of chunk) {
154
161
  refs.set(path, { uploadId, index: await uploader.post(uploadId, readFileSync(path), basename(path)) });
155
162
  }
package/dist/index.js CHANGED
@@ -445,8 +445,9 @@ async function attachLocalFiles(client, args, baseDir) {
445
445
  return;
446
446
  }
447
447
  await uploadLocalFiles(args, baseDir, {
448
- create: async (maxFiles) => {
449
- const r = (await client.callTool('create_upload_url', { maxFiles }));
448
+ // 사진만이면 종전 모양 그대로 보낸다 — accept 를 모르는 옛 서버도 받는다.
449
+ create: async (maxFiles, accept) => {
450
+ const r = (await client.callTool('create_upload_url', accept === 'files' ? { maxFiles, accept } : { maxFiles }));
450
451
  const uploadId = r?.structuredContent?.uploadId;
451
452
  if (r?.isError || typeof uploadId !== 'string') {
452
453
  throw new UsageError(`업로드 주소를 받지 못했습니다: ${r?.content?.map((c) => c.text ?? '').join(' ') || '응답 없음'}`);
package/dist/session.js CHANGED
@@ -270,6 +270,6 @@ export class OdysseyClient {
270
270
  if (res.status === 200 && typeof parsed.index === 'number')
271
271
  return parsed.index;
272
272
  const reason = typeof parsed.message === 'string' ? parsed.message : String(parsed.error ?? res.status);
273
- throw new HttpError(res.status, `사진 올리기 실패(${res.status}) ${name}: ${reason}`);
273
+ throw new HttpError(res.status, `올리기 실패(${res.status}) ${name}: ${reason}`);
274
274
  }
275
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odyssey365/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Odyssey365 / Odyssey60 / Odyssey30 CLI — 터미널·AI 에이전트에서 할일·메모·루틴·기록·보드·페이지를 다룬다 (OdysseyCLI)",
5
5
  "type": "module",
6
6
  "engines": {