Files
dify/cli/package.json
T
gigglewang0417 5646bda88e test(e2e): add E2E test suite for CLI v1.0
Covers auth, config, run, and CLI framework scenarios against a live
staging server using vitest + real difyctl binary.

Suite layout:
  test/e2e/
  ├── helpers/
  │   ├── cli.ts          — run(), withAuthFixture(), mintFreshToken()
  │   ├── assert.ts       — assertExitCode, assertJson, assertErrorEnvelope
  │   ├── cleanup-registry.ts — staging data teardown
  │   └── retry.ts        — withRetry() for flaky network assertions
  ├── setup/
  │   ├── global-setup.ts — health-check, disposable token mint
  │   └── global-teardown.ts — conversation cleanup
  └── suites/
      ├── auth/           — status, use, whoami, devices, logout
      ├── config/         — path, get/set/unset/view, env override
      └── run/            — basic, streaming, conversation, file, HITL

Key design decisions:
- Each test uses an isolated temp configDir via withAuthFixture()
- Logout and devices-revoke tests run last to avoid invalidating
  the shared E.token used by all other suites
- mintFreshToken() mints a disposable dfoa_ token on demand via the
  device flow API so revoke tests never touch the primary session
- Global retry is 0; flaky network calls use withRetry() locally
- test:e2e:smoke script filters to [P0] cases via testNamePattern

package.json: add test:e2e / test:e2e:smoke / test:e2e:local scripts
.gitignore: exclude .env.e2e, oclif.manifest.json, tmp/
.env.e2e.example: credential template for local setup
2026-05-27 10:07:28 +08:00

76 lines
2.1 KiB
JSON

{
"name": "@langgenius/difyctl",
"type": "module",
"version": "0.1.0-rc.1",
"description": "Dify command-line interface",
"difyctl": {
"channel": "rc",
"compat": {
"minDify": "1.14.0",
"maxDify": "1.15.0"
}
},
"license": "Apache-2.0",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"files": [
"README.md",
"bin",
"dist"
],
"engines": {
"node": "^22.22.1"
},
"scripts": {
"build": "vp pack",
"dev": "bun bin/dev.js",
"test": "vp test",
"test:coverage": "vp test --coverage",
"test:e2e": "vp test --config vitest.e2e.config.ts",
"test:e2e:smoke": "vp test --config vitest.e2e.config.ts --testNamePattern \"\\[P0\\]\"",
"test:e2e:local": "DIFY_E2E_MODE=local vp test --config vitest.e2e.config.ts",
"lint": "eslint",
"lint:fix": "eslint --fix",
"type-check": "tsc",
"tree:gen": "bun scripts/generate-command-tree.ts",
"tree:check": "bun scripts/generate-command-tree.ts --check",
"prebuild": "pnpm tree:gen",
"predev": "pnpm tree:gen",
"pretest": "pnpm tree:gen",
"ci": "pnpm tree:check && pnpm type-check && pnpm lint && pnpm test:coverage && pnpm build",
"clean": "rm -rf dist node_modules/.cache",
"version:info": "bun scripts/print-buildinfo.ts",
"build:bin": "scripts/release-build.sh"
},
"dependencies": {
"@dify/contracts": "workspace:*",
"@napi-rs/keyring": "catalog:",
"cli-table3": "catalog:",
"eventsource-parser": "catalog:",
"js-yaml": "catalog:",
"ky": "catalog:",
"open": "catalog:",
"ora": "catalog:",
"picocolors": "catalog:",
"std-semver": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"@dify/tsconfig": "workspace:*",
"@hono/node-server": "catalog:",
"@types/js-yaml": "catalog:",
"@types/node": "catalog:",
"@vitest/coverage-v8": "catalog:",
"eslint": "catalog:",
"hono": "catalog:",
"typescript": "catalog:",
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
}
}