rushangle-cli 0.4.0 → 0.4.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/api.js +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rushangle-cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "SkillHub CLI - 数智凯航技能市场命令行工具",
5
5
  "bin": {
6
6
  "rushangle": "./bin/rushangle.js"
package/src/api.js CHANGED
@@ -100,18 +100,19 @@ module.exports = {
100
100
  installedCli() { return apiCall('GET', '/api/cli/installed'); },
101
101
  myCli() { return apiCall('GET', '/api/cli/my'); },
102
102
 
103
- // CLI file upload
103
+ // CLI file upload (native FormData — compatible with backend busboy/multer)
104
104
  async uploadCliFiles(cliId, files) {
105
105
  const token = auth.getToken();
106
- const FormData = require('form-data');
107
106
  const form = new FormData();
108
107
  for (const { fieldName, filePath } of files) {
109
- form.append(fieldName, fs.createReadStream(filePath), path.basename(filePath));
108
+ const content = fs.readFileSync(filePath);
109
+ const blob = new Blob([content], { type: 'application/octet-stream' });
110
+ form.append(fieldName, blob, path.basename(filePath));
110
111
  }
111
112
 
112
113
  const res = await fetch(`${SITE_URL}/api/cli/${encodeURIComponent(cliId)}/files`, {
113
114
  method: 'POST',
114
- headers: { ...form.getHeaders(), 'Authorization': `Bearer ${token}` },
115
+ headers: { 'Authorization': `Bearer ${token}` },
115
116
  body: form,
116
117
  });
117
118