Conversation
This comment was marked as resolved.
This comment was marked as resolved.
src/api/run.ts
Outdated
There was a problem hiding this comment.
Renamed the file to runs.ts to keep it uniform with the others.
skills/SKILL.md
Outdated
There was a problem hiding this comment.
New skill can be added with npx skills add Hypersequent/qas-cli
| - name: Run live API tests | ||
| env: | ||
| QAS_TEST_URL: ${{ secrets.QAS_TEST_URL }} | ||
| QAS_TEST_TOKEN: ${{ secrets.QAS_TEST_TOKEN }} | ||
| QAS_TEST_USERNAME: ${{ secrets.QAS_TEST_USERNAME }} | ||
| QAS_TEST_PASSWORD: ${{ secrets.QAS_TEST_PASSWORD }} | ||
| QAS_DEV_AUTH: ${{ secrets.QAS_DEV_AUTH }} | ||
| run: npm run test:live |
There was a problem hiding this comment.
Live tests are added that allows running automated tests with a real live qasphere instance. QAS_TEST_USERNAME and QAS_TEST_PASSWORD are required because we don't have a public API yet for deleting projects, which is required for clean-ups after the tests. So we use login credentials and call a non-public API instead.
| "typescript": "^5.8.3", | ||
| "typescript-eslint": "^8.31.1", | ||
| "vitest": "^3.1.2" | ||
| "vitest": "^4.1.0" |
There was a problem hiding this comment.
Updated vitest to allow specifying tags. Which is useful for live tests and excluding them on normal testing.
There was a problem hiding this comment.
I was testing with claude and found some bugs
⏺ Bugs Found
- Trailing slash on QAS_URL breaks all API commands — QAS_URL="https://host.com/" produces double-slash URLs
(https://host.com//api/...) returning 404 HTML. createApi() doesn't strip trailing slashes like
ResultUploadCommandHandler does. - folders bulk-create --folders expects wrong JSON format — Help says '[{"path": ["Parent", "Child"]}]'
(array), but validation requires '{"folders": [{"path": ["Parent", "Child"]}]}' (object wrapper). - test-cases list --include help suggests invalid values — Help example says "tags,requirements" but server
rejects these with a validation error. Valid values are undocumented in the CLI. - runs tcases list --limit silently ignored — Passing --limit 1 still returns all 20 test cases. The CLI
accepts the arg but the API endpoint doesn't paginate. - test-cases list --page 0 crashes with raw Go error — Server requires page >= 1 but CLI doesn't validate.
Error shown: Field validation for 'Page' failed on the 'gt' tag. - settings update-statuses color help/example are wrong — Help says "color": "#FF9800" (hex), but API
requires named colors: blue, gray, red, orange, yellow, green, teal, indigo, purple, pink.
There was a problem hiding this comment.
Its possible to also move the api files inside the folders to have code that changes frequently lives together.
There was a problem hiding this comment.
I'm not sure what you mean?
Fixed.
Fixed. Argument should now only accept an array.
Updated help text to include possible values.
Looks like the API doesn't pagination --limit. I've removed the limit argument.
Could not reproduce. Possibly you've tested older code?
Fixed |
Reviewing PR #58: Add public API commands
|
- Add Zod schemas at API level for all request types with validateRequest() that throws RequestValidationError, caught by apiHandler for clean error output - Add handleValidationError() + buildArgumentMap() to map API field names to CLI argument names (e.g., title → --title) for user-friendly error messages - Move validation schemas from command-level to API-level as single source of truth; command handlers pass args directly to API functions - Add customFields, parameterValues, and filledTCaseTitleSuffixParams to test-case create/update commands with proper validation (parameterValues restricted to template type) - Fix jsonResponse null crash, expand ResultStatus with custom statuses, relax test-cases update check, extract shared superRefine for run schemas - Add tests for new fields (mocked + live) and batch-create validation errors
c372bf3 to
2fa1e06
Compare
|
Claude finished @satvik007's task in 4m 58s —— View job Re-review complete — ApprovedVerified all 6 bugs from @satvik007's report are fixed and the recent commits address prior nits.
Bug fixes confirmed:
Other recent improvements:
Non-blocking carry-overs from prior reviews (not introduced by recent changes):
LGTM. Full review posted on the PR. AndrianBdn approved on 2026-04-09; merge conflicts are the only remaining blocker. |
There was a problem hiding this comment.
Re-review after recent fixes
Verified all 6 bugs reported by @satvik007 are fixed:
- Trailing slash on
QAS_URL— Fixed inwithBaseUrl(src/api/utils.ts:2):baseUrl.replace(/\/+$/, '')strips trailing slashes. folders bulk-create --foldersJSON format — Fixed (src/commands/api/manifests/folders.ts:80-92).--foldersnow accepts a bare array, the API layer wraps it as{folders: [...]}.--bodystill accepts the wrapped object form for compatibility.test-cases list --includevalid values — Fixed (src/commands/api/manifests/test-cases.ts:140-142). Help now lists:steps, tags, requirements, customFields, parameterValues, folder, path, project.runs tcases list --limitsilently ignored — Fixed (src/commands/api/manifests/runs.ts:279-292).--limitremoved from query options.test-cases list --page 0—pageParam = z.number().int().positive().optional()(src/api/schemas.ts:55) rejects 0 with a clean message before the request goes out. Confirmed correct.settings update-statusescolor — Fixed (src/commands/api/manifests/settings.ts:9). Color is now constrained to theSTATUS_COLORSenum (named colors) and the help text reflects this.
Other improvements in the latest commits:
- Process exit code on unknown args is now
1(src/commands/main.ts), with a regression test insrc/tests/missing-subcommand-help.spec.ts:68-87. formatApiErrorno longer readsprocess.argvdirectly — receivesverbosefrom the handler.runClitest helper now usestry/finallyfor spy restore.- File upload migrated to
/api/public/v0/file/batch; uses asyncreadFile. - SKILL.md and README updated for the batch endpoint and new options.
Non-blocking carry-overs from prior reviews (not introduced by this PR's recent changes):
withHttpRetryhonorsRetry-Afterwithout an upper bound, so a misconfigured server could stall the CLI indefinitely.- File upload still does
Buffer → Blobcopy (~2x peak memory for 50 MiB files);openAsBlob()would avoid this on Node 20+.
LGTM. AndrianBdn approved on 2026-04-09; the only blocker remaining is the merge conflict resolution he mentioned.

Summary
Adds a new
qasphere apicommand that provides direct CLI access to the full QA Sphere public API. Users can now manage projects, test runs, test cases, results, and other resources programmatically without writing custom API integration code.What's included
projects,runs,test-cases,results,folders,milestones,tags,requirements,shared-steps,shared-preconditions,custom-fields,audit-logs,settings,test-plans,files,users[0].tcaseIds: not allowed for "live" runsQAS_URL/QAS_TOKENloaded only when the API is called, so CLI validation errors surface firstmaxSizeenforcement (e.g., 50 MiB for file uploads)npx skills add Hypersequent/qas-cliArchitecture
The API command uses a manifest-based pattern
Each endpoint is a plain declarative object — the builder and executor handle all yargs wiring, validation, and error handling generically
Other changes
audit-logs,custom-fields,milestones,requirements,results,settings,shared-preconditions,shared-steps,tags,test-plans,users,file— plus expandedruns,tcases,projects,foldersCLAUDE.mdupdated with full architecture docs for the manifest-based API commandREADME.mdupdated with usage documentationSKILL.mdadded for AI coding agent supportnpm audit fixapplied to dependenciesTesting
src/tests/api/organized by resource, one spec per action{ tags: ['live'] }test-helper.tswithuseMockServer(),runCli(),expectValidationError(), and atestfixture with project lifecycle managementglobal-setup.ts) handles live API authentication🤖 Generated with Claude Code