Skip to content

+ feat: add uploadFile for image embedding in content fields - #5

Open
chendx-github wants to merge 2 commits into
easysoft:mainfrom
chendx-github:feat/image-upload
Open

+ feat: add uploadFile for image embedding in content fields#5
chendx-github wants to merge 2 commits into
easysoft:mainfrom
chendx-github:feat/image-upload

Conversation

@chendx-github

Copy link
Copy Markdown

Changes

  • Add uploadFile() module (src/modules/upload.ts) for uploading local files to ZenTao via POST /files
  • Fix isNodeRuntime() to detect Bun runtime (process.versions.bun)
  • Add null-response guard in uploadFile with descriptive error message
  • Add error codes: E_UPLOAD_NODE_ONLY, E_UPLOAD_NOT_A_FILE, E_UPLOAD_FAILED
  • Export uploadFile and UploadedFile from SDK entry point
  • Add ./modules/upload export path in package.json

Testing

  • 107 unit tests pass
  • End-to-end verified: image upload via CLI creates correct <img> tags in story/bug content

chendx added 2 commits July 17, 2026 19:13
Zentao server requires productID in URL query string for POST /stories and POST /bugs,
but the action definition only declares productID in requestBody.schema, not action.params.
This caused buildQuery to never include it in the URL and buildRequestBody to throw
E_MISSING_PARAM when callers pass --product=N (without an explicit productID=N).

Changes:
- override.ts: add productID to action.params and remove it from requestBody.schema
  so buildQuery moves it to the URL query and buildRequestBody no longer validates it.
- resolve.ts: buildQuery falls back to the base key (e.g. product) when a param is
  named with the ID suffix (e.g. productID) to match the CLI calling convention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant