@volcengine/mediakit-cli
Advanced tools
+6
-6
@@ -1,6 +0,6 @@ | ||
| 361e5a8bdcf842febc62d857c9d841e0114862b28e3b27801ceddad18522e512 mediakit-cli_0.1.8-beta.3_darwin_amd64.tar.gz | ||
| 4beca3f3d5a21e75722f6817a7cee28cd799a78eb8fa9d99ae26d41b3bffdf98 mediakit-cli_0.1.8-beta.3_darwin_arm64.tar.gz | ||
| 4504e6815e46082f4a733848c5b9dfb901806c7e6057e185370f00c4e8f8ff75 mediakit-cli_0.1.8-beta.3_linux_amd64.tar.gz | ||
| 06fcf95db60cb06a9af6385300a8f16e90515586686468c49693477f512845da mediakit-cli_0.1.8-beta.3_linux_arm64.tar.gz | ||
| 712aad6aa23ca0f993b0bcb90605497fcb1b024636b2c7453ec13e4c146968f9 mediakit-cli_0.1.8-beta.3_windows_amd64.zip | ||
| 9c1444b1874dc97eea2173fbcea885413f5f49a1f013205067f58033a4fdfec2 mediakit-cli_0.1.8-beta.3_windows_arm64.zip | ||
| 0e0fd134132fb0eeb6ef7a3545756ae8b0181d2bca9d91b1e571edb024273fce mediakit-cli_0.1.8_darwin_amd64.tar.gz | ||
| 72f529e3fc11fdcfc25a6dbb43a9eb75c4bd9f25afcd72f876b230cf9bec4e66 mediakit-cli_0.1.8_darwin_arm64.tar.gz | ||
| 741373147e149547ecbeb16feabc2b2e08940a2dab01ba8af50a8afd0cfbde83 mediakit-cli_0.1.8_linux_amd64.tar.gz | ||
| e7e211cd5723a050ac0d4f7198f89c696796715b7a1f029386fab88fef9652cd mediakit-cli_0.1.8_linux_arm64.tar.gz | ||
| e99b627611855cd5c64b9161f1fab82cf4bc49b2c962bdbae70a5c4fe7267cf9 mediakit-cli_0.1.8_windows_amd64.zip | ||
| dd267cb98fb36506cf6cc933a11f1738ec7fab4d05d97a63481e3ab30f6ccdca mediakit-cli_0.1.8_windows_arm64.zip |
+1
-1
| { | ||
| "name": "@volcengine/mediakit-cli", | ||
| "version": "0.1.8-beta.3", | ||
| "version": "0.1.8", | ||
| "description": "MediaKit CLI with multi-platform binary distribution via npm", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
| const assert = require('node:assert/strict') | ||
| const fs = require('node:fs') | ||
| const os = require('node:os') | ||
| const path = require('node:path') | ||
| const test = require('node:test') | ||
| const { runInstallWizard } = require('./install-wizard') | ||
| function writeExecutable(file, content) { | ||
| fs.writeFileSync(file, content, { mode: 0o755 }) | ||
| } | ||
| async function captureLogs(t, fn) { | ||
| const oldLog = console.log | ||
| const logs = [] | ||
| console.log = (...args) => logs.push(args.join(' ')) | ||
| t.after(() => { | ||
| console.log = oldLog | ||
| }) | ||
| await fn() | ||
| console.log = oldLog | ||
| return logs.join('\n') | ||
| } | ||
| test('installs skills from the npm package skills directory', async (t) => { | ||
| const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'mediakit-install-wizard-')) | ||
| const bin = path.join(temp, 'bin') | ||
| fs.mkdirSync(bin) | ||
| const log = path.join(temp, 'calls.jsonl') | ||
| writeExecutable( | ||
| path.join(bin, 'npm'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npm', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| writeExecutable( | ||
| path.join(bin, 'npx'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npx', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| t.after(() => fs.rmSync(temp, { recursive: true, force: true })) | ||
| const oldPath = process.env.PATH | ||
| const oldHome = process.env.HOME | ||
| process.env.PATH = `${bin}${path.delimiter}${oldPath || ''}` | ||
| process.env.HOME = temp | ||
| t.after(() => { | ||
| process.env.PATH = oldPath | ||
| process.env.HOME = oldHome | ||
| }) | ||
| await runInstallWizard(['--skills-only', '--skill', 'byted-mediakit-video', '-y']) | ||
| const calls = fs | ||
| .readFileSync(log, 'utf8') | ||
| .trim() | ||
| .split('\n') | ||
| .map((line) => JSON.parse(line)) | ||
| assert.equal(calls.length, 1) | ||
| assert.equal(calls[0].cmd, 'npx') | ||
| assert.deepEqual(calls[0].args, [ | ||
| '-y', | ||
| 'skills', | ||
| 'add', | ||
| path.join(__dirname, '..', 'skills'), | ||
| '-s', | ||
| 'byted-mediakit-video', | ||
| '-g', | ||
| '-y', | ||
| ]) | ||
| assert(!calls[0].args.some((arg) => /^https?:\/\//.test(String(arg)))) | ||
| const state = JSON.parse( | ||
| fs.readFileSync(path.join(temp, '.mediakit', 'skills-state.json'), 'utf8'), | ||
| ) | ||
| assert.equal(state.package_name, '@volcengine/mediakit-cli') | ||
| assert.equal(state.version, '0.1.7') | ||
| assert.equal(state.skills_dir, path.join(__dirname, '..', 'skills')) | ||
| }) | ||
| test('regular install delegates skills installation to npm postinstall', async (t) => { | ||
| const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'mediakit-install-wizard-')) | ||
| const bin = path.join(temp, 'bin') | ||
| fs.mkdirSync(bin) | ||
| const log = path.join(temp, 'calls.jsonl') | ||
| writeExecutable( | ||
| path.join(bin, 'npm'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npm', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| writeExecutable( | ||
| path.join(bin, 'npx'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npx', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| t.after(() => fs.rmSync(temp, { recursive: true, force: true })) | ||
| const oldPath = process.env.PATH | ||
| process.env.PATH = `${bin}${path.delimiter}${oldPath || ''}` | ||
| t.after(() => { | ||
| process.env.PATH = oldPath | ||
| }) | ||
| const output = await captureLogs(t, () => runInstallWizard(['-y'])) | ||
| const calls = fs | ||
| .readFileSync(log, 'utf8') | ||
| .trim() | ||
| .split('\n') | ||
| .map((line) => JSON.parse(line)) | ||
| assert.deepEqual(calls, [ | ||
| { | ||
| cmd: 'npm', | ||
| args: [ | ||
| 'install', | ||
| '-g', | ||
| '@volcengine/mediakit-cli@0.1.7', | ||
| '--foreground-scripts', | ||
| '--ignore-scripts=false', | ||
| ], | ||
| }, | ||
| ]) | ||
| assert.match(output, /installing @volcengine\/mediakit-cli@0\.1\.7 via npm install -g/) | ||
| assert.match(output, /Installing skills \.\.\./) | ||
| assert.match(output, /✓ Successfully installed mediakit-cli 0\.1\.7/) | ||
| assert.match(output, /✓ Skills installed/) | ||
| }) | ||
| test('install wizard rejects unsupported version override', async (t) => { | ||
| const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'mediakit-install-wizard-')) | ||
| const bin = path.join(temp, 'bin') | ||
| fs.mkdirSync(bin) | ||
| const log = path.join(temp, 'calls.jsonl') | ||
| writeExecutable( | ||
| path.join(bin, 'npm'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npm', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| writeExecutable( | ||
| path.join(bin, 'npx'), | ||
| `#!/usr/bin/env node | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| t.after(() => fs.rmSync(temp, { recursive: true, force: true })) | ||
| const oldPath = process.env.PATH | ||
| process.env.PATH = `${bin}${path.delimiter}${oldPath || ''}` | ||
| t.after(() => { | ||
| process.env.PATH = oldPath | ||
| }) | ||
| await assert.rejects( | ||
| () => runInstallWizard(['--version', '0.1.7', '-y']), | ||
| /--version is not supported/, | ||
| ) | ||
| assert.equal(fs.existsSync(log), false) | ||
| }) |
| const assert = require('node:assert/strict') | ||
| const fs = require('node:fs') | ||
| const os = require('node:os') | ||
| const path = require('node:path') | ||
| const test = require('node:test') | ||
| const { install } = require('./install') | ||
| function writeExecutable(file, content) { | ||
| fs.writeFileSync(file, content, { mode: 0o755 }) | ||
| } | ||
| async function captureLogs(t, fn) { | ||
| const oldLog = console.log | ||
| const logs = [] | ||
| console.log = (...args) => logs.push(args.join(' ')) | ||
| t.after(() => { | ||
| console.log = oldLog | ||
| }) | ||
| await fn() | ||
| console.log = oldLog | ||
| return logs.join('\n') | ||
| } | ||
| test('postinstall installs skills from the npm package skills directory when binary already exists', async (t) => { | ||
| const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'mediakit-postinstall-')) | ||
| const bin = path.join(temp, 'bin') | ||
| fs.mkdirSync(bin) | ||
| const log = path.join(temp, 'calls.jsonl') | ||
| writeExecutable( | ||
| path.join(bin, 'npx'), | ||
| `#!/usr/bin/env node | ||
| const fs = require('node:fs') | ||
| fs.appendFileSync(${JSON.stringify(log)}, JSON.stringify({ cmd: 'npx', args: process.argv.slice(2) }) + '\\n') | ||
| process.exit(0) | ||
| `, | ||
| ) | ||
| t.after(() => fs.rmSync(temp, { recursive: true, force: true })) | ||
| const oldPath = process.env.PATH | ||
| const oldHome = process.env.HOME | ||
| const oldSkip = process.env.MEDIAKIT_CLI_SKIP_DOWNLOAD | ||
| process.env.PATH = `${bin}${path.delimiter}${oldPath || ''}` | ||
| process.env.HOME = temp | ||
| delete process.env.MEDIAKIT_CLI_SKIP_DOWNLOAD | ||
| t.after(() => { | ||
| process.env.PATH = oldPath | ||
| process.env.HOME = oldHome | ||
| if (oldSkip === undefined) { | ||
| delete process.env.MEDIAKIT_CLI_SKIP_DOWNLOAD | ||
| } else { | ||
| process.env.MEDIAKIT_CLI_SKIP_DOWNLOAD = oldSkip | ||
| } | ||
| }) | ||
| const output = await captureLogs(t, () => install()) | ||
| const calls = fs | ||
| .readFileSync(log, 'utf8') | ||
| .trim() | ||
| .split('\n') | ||
| .map((line) => JSON.parse(line)) | ||
| assert.equal(calls.length, 1) | ||
| assert.deepEqual(calls[0].args, [ | ||
| '-y', | ||
| 'skills', | ||
| 'add', | ||
| path.join(__dirname, '..', 'skills'), | ||
| '-g', | ||
| '-y', | ||
| ]) | ||
| assert.match(output, /Installing skills \.\.\./) | ||
| assert.match(output, /✓ Skills installed/) | ||
| const state = JSON.parse( | ||
| fs.readFileSync(path.join(temp, '.mediakit', 'skills-state.json'), 'utf8'), | ||
| ) | ||
| assert.equal(state.package_name, '@volcengine/mediakit-cli') | ||
| assert.equal(state.version, '0.1.7') | ||
| assert.equal(state.skills_dir, path.join(__dirname, '..', 'skills')) | ||
| }) |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 2 instances
15
-61.54%202835
-3.57%63
-3.08%472
-32.76%