Commit graph

767 commits

Author SHA1 Message Date
huishi3
efd43c319d docs: import e2e test case designs and local-run guide from desktop
Rescued from the desktop copy of the project (now being trashed):
- docs/test-cases-zh/: Chinese e2e test case designs across 6 modules
  (auth, search, dashboard/settings, namespace/governance, public pages,
  publish flow) plus master case sheets in md+csv.
- docs/local-run-no-docker.md: Guide for running the full stack locally
  without Docker, matching the current dev environment setup.
2026-05-08 08:28:37 -07:00
huishi3
83490d75ac test(e2e): remove duplicate specs covered by new comprehensive suites
- Delete namespace-members-data.spec.ts (TC_MEMBER_001 in
  namespace-members-management.spec.ts is equivalent and the new suite
  also covers add-member dialog and batch import).
- Delete namespace-reviews-data.spec.ts (TC_NS_REVIEW_001 in
  namespace-reviews-management.spec.ts is equivalent and the new suite
  also covers status tabs, tab switching, and sort order).
- Trim settings-pages.spec.ts to only the reset-password navigation test;
  profile/security/notification page coverage now lives in the dedicated
  *-settings.spec.ts files with deeper interaction tests.

Net change: 5 fewer test cases, ~1.5 min saved per CI run.
2026-05-08 08:04:10 -07:00
huishi3
d9b9134720 test(e2e): use case-insensitive regex for review center column headers
UI changed column header style from "Skill" to "SKILL" (likely via CSS
uppercase or source string). Hard-coded 'Skill' no longer matches the
accessible name. Use /^Skill$/i etc to be resilient to either case.

Affected: TC_REVIEW_003 (pending) and TC_REVIEW_004 (approved).
2026-05-08 07:51:02 -07:00
huishi3
20b5accf6e test(e2e): use exact text match for profile field labels
getByText('Display Name') is a substring match by default, so it also
matched the description paragraph "Manage your display name and
personal information." (strict mode violation: resolved to 2 elements).
Use { exact: true } to match the field label only.
2026-05-08 07:40:26 -07:00
huishi3
7175063d83 test(e2e): fix audit-log and profile-settings assertions for current UI
- admin-audit-log TC_AUDIT_003: replace fragile getByText regex with
  table/empty-state locator (strict mode .first() was matching invisible
  placeholder text in filter inputs).
- profile-settings TC_PROFILE_001: drop removed "User ID" field, assert
  on Display Name + Email which are the current fields.
2026-05-08 07:28:54 -07:00
huishi3
d49bc726b7 test(e2e): add 15 specs covering review/governance/namespace/admin/settings
Migrated from local desktop work (rescued from un-pushed commit 3b970865).
64 test cases with stable semantic selectors, covering pages that were
previously untested.
2026-05-08 07:13:05 -07:00
huishi3
5206ffa4e0 docs(cli): add e2e test placement decision tree and output conventions
Three docs that answer "where should my new test go?" for CLI-related e2e:

- cli/test/e2e/README.md: decision tree across 5 test tracks, Track B
  boundary, env var setup (SKILLHUB_E2E_*), new-test checklist, CI status
- web/e2e/auto-generated/README.md: marks directory as pipeline output,
  naming convention, boundary with hand-written specs
- e2e-automation/README.md: output location convention, module subdirectory
  layout, boundary clarification (pipeline only produces browser-subject specs)
2026-05-08 03:54:24 -07:00
huishi3
2f54418600 test(cli): add Track B e2e tests against live backend
7 end-to-end tests that exercise the CLI against a real SkillHub backend,
auto-skipped when SKILLHUB_E2E_REGISTRY/SKILLHUB_E2E_TOKEN are not set:

- E1: publish → search (exact slug) → install → content match → remote remove
- E2: publish v1 → publish v2 → install latest gets v2 → --version pin gets v1
- E3: install nonexistent slug → non-zero exit
- E4: invalid token whoami → EXIT.auth
- E5: keyword substring search finds freshly-published skill
- E6: SKILL.md missing name field → server rejects
- E7: name exceeding length cap → server rejects

Includes shared helpers: live-registry env detection, unique slug generation,
polling with timeout, and skill fixture builder.
2026-05-07 06:53:01 -07:00
huishi3
3e05be72db test(cli): expand integration test coverage with 63 new test cases
Add comprehensive test coverage across all CLI commands:
- auth-resolution: token/registry priority chain (6 cases)
- multi-registry: credential isolation across registries (4 cases)
- cross-command: end-to-end flows spanning multiple commands (15 cases)
- inventory-resilience: corrupt inventory recovery (3 cases)
- concurrency: parallel install and stale lock handling (3 cases)
- version-upgrade-flow: version pinning and force upgrade (2 cases)
- Expand existing tests for install (+9), search (+10), publish (+5),
  doctor (+5), remove (+3), list (+3), whoami (+2), update (+8)
- Align 5xx exit codes with a14d89d8 refactor (EXIT.generic, not EXIT.network)
2026-05-07 06:39:43 -07:00
dongmucat
a14d89d8c9 refactor(cli): improve doctor command semantics and transparency
变更摘要:

- doctor 命令重构:从重建改为扫描并合并语义,保留扫描范围外的条目

- 修复字段命名:itemsRestored → itemsScanned/itemsPreserved,语义更清晰

- 改进用户提示:输出区分扫描到的和保留的条目,帮助文档补充保留行为说明

- 补充代码注释:说明同 slug 不同 installDir 允许并存的设计意图

- 统一错误码:download/handleJsonResponse 的非 2xx 响应统一使用 EXIT.generic

- 新增测试覆盖:合并场景、刷新场景、冲突不删除无关条目等边界情况

关键文件:

- cli/src/services/doctor-service.ts

- cli/src/commands/doctor.ts

- cli/src/commands/help.ts

- cli/test/unit/services/doctor-service.test.ts

- cli/test/integration/doctor-command.test.ts
2026-05-09 11:30:36 +08:00
dongmucat
203684bbd4 docs: remove unused skill-version-compare-redesign document 2026-05-07 16:36:52 +08:00
dongmucat
e249db35a3 test(cli): add comprehensive integration tests and fix update command bugs
- Add integration tests for doctor, install, list, publish, remove, whoami commands
- Expand fake-registry with resolve/delete state capture for real assertions
- Fix update command: use correct package name @astron-team/skillhub from constants
- Refactor runUpdateCommand to accept string[] instead of fragile string splitting
- Add dependency injection to updateCommand for testable unit tests without global mocks
- Replace package.json import with codegen (scripts/generate-pkg-info.ts) to avoid
  leaking devDependencies into the build artifact
- Fix startNetworkFailureServer TOCTOU race by keeping listener alive
- Add TODO markers for known help command bugs (--json not forwarded, unknown topic crash)
- Extend update integration test timeout for real npm registry checks
2026-05-07 14:46:40 +08:00
dongmucat
ea8168f290 docs(cli): beautify README with icons and improve registry documentation 2026-05-06 17:45:53 +08:00
dongmucat
92dd64f36e docs(cli): refine registry usage examples 2026-05-06 17:32:13 +08:00
dongmucat
9ee60dc018 chore(cli): bump version to 0.1.1 2026-05-06 17:11:46 +08:00
dongmucat
cca6a64d43 fix(cli): add explicit --registry flag to npm publish command
Ensures npm publish uses the correct registry (registry.npmjs.org) even when
global npm config points to a mirror registry (e.g., registry.npmmirror.com).
2026-05-06 17:00:03 +08:00
dongmucat
0534d1d59a fix(cli): add publishConfig.access field to package.json 2026-05-06 16:57:12 +08:00
dongmucat
d5abeb6ca9 feat(cli): add npm publish workflow and update package scope
- Add publish script with env validation, git checks, and build/test/pack preflights
- Add comprehensive test suite for publish workflow (302 lines)
- Update cli/package.json with @astron-team scope and full npm metadata
- Add README.md with user-focused documentation and registry info
- Add .env.example template for publish configuration
- Add Apache 2.0 LICENSE
- Add Makefile targets for build/test/lint/typecheck/publish workflows
- All publish targets include .env.local validation
- Update installation instructions across all documentation to use @astron-team/skillhub
2026-05-06 16:34:59 +08:00
dongmucat
7caa320c09 docs: add skill version compare redesign spec 2026-05-06 16:22:31 +08:00
dongmucat
43a201c8d5 fix(cli): use fileURLToPath for cross-platform cwd path compatibility
The issue was that new URL().pathname returns Unix-style paths on Windows
(e.g., /D:/a/skillhub/...) which Bun.spawn() cannot resolve correctly.
Using fileURLToPath() converts the URL to a proper platform-specific path.

Changes:
- cli/test/helpers/run-cli.ts: use fileURLToPath for cwd
- cli/test/integration/version-command.test.ts: same fix for build spawn
2026-04-29 16:13:50 +08:00
dongmucat
704f2d2af4 fix(cli): verify Bun.which() path exists before using on Windows
Bun.which('bun') on Windows CI returns a non-existent path
(C:\Users\runneradmin\.bun\bin\bun.exe), causing all integration
tests to fail. Add existsSync() check to fallback to process.execPath
when the resolved path doesn't exist.

Also fix version-command.test.ts to use process.execPath instead of
hardcoded 'bun' string for cross-platform compatibility.

Fixes 19 failing integration tests on Windows platform.
2026-04-29 16:08:53 +08:00
dongmucat
87dbf2686b fix(cli): resolve Windows CI test failures across three platform issues
- Use Bun.which() with process.execPath fallback in run-cli helper to
  resolve bun executable on Windows (fixes 22 integration tests)
- Normalize paths in credentials-store test for Windows backslash compat
- Use shell: true on Windows in updater spawn for proper exe resolution
2026-04-29 16:03:09 +08:00
dongmucat
a2df5f4eb4 fix(cli): remove explicit any type to pass ESLint checks
Replace 'any' type annotation with proper type guard in inventory-store.ts
and add optional chaining in test to satisfy TypeScript strict checks.

All three platforms (Ubuntu, macOS, Windows) CI checks now pass.
2026-04-29 15:43:32 +08:00
dongmucat
05177e3085 test(cli): add P0/P1/P2 test coverage for security and error paths
Add 36 test cases covering:
- Path traversal and symlink attack prevention in archive extraction
- SkillHubClient error handling (401/403/404/network) for all endpoints
- Inventory store concurrent writes and stale lock recovery
- Config store read/write round-trip
- Platform utilities (package-manager, updater, paths)
- Output formatting (printResult, humanize)

Tests use cross-platform commands (node) instead of shell builtins
for CI compatibility across macOS/Linux/Windows.
2026-04-29 15:37:05 +08:00
dongmucat
6916539d77 fix(cli): harden doctor scan and inventory writes
Protect doctor metadata scanning from symlinked agent, skill, and .skillhub directories, and make inventory mutations use locked atomic writes with stale lock recovery.
2026-04-29 15:37:05 +08:00
dongmucat
fb65eeb576 fix(cli): improve parse error output 2026-04-29 15:37:05 +08:00
dongmucat
26ea7e914b docs(cli): expand CLI usage guide
Document the full CLI workflow so users can understand configuration precedence, install targets, local state files, troubleshooting, and local verification steps.
2026-04-29 15:37:04 +08:00
dongmucat
b30de8d7af fix(auth): add /api/cli/ path to ApiTokenAuthenticationFilter
Enable API token authentication for CLI endpoints by adding /api/cli/
to the filter's path whitelist. Previously, CLI endpoints were not
processed by the token authentication filter, causing all Bearer token
requests to fail with 401.
2026-04-29 15:37:04 +08:00
dongmucat
351dddc912 feat(cli): add SkillHub CLI v1 with full command suite
Implement complete CLI tool for SkillHub with 12 commands, 7 backend API endpoints, and comprehensive documentation.

CLI Commands:
- help, version: Basic information
- login, logout, whoami: Authentication management
- search: Discover published skills
- install: Install skills to agent directories (14 Tier 1 agents supported)
- list, remove, doctor: Local skill management
- publish: Publish skill packages
- update: Self-update mechanism

Backend API:
- Add /api/cli/v1 endpoints for auth, search, resolve, download, delete, publish
- Implement CliAuthController and CliSkillController
- Add security policies for CLI routes
- Full test coverage (19 backend tests)

CLI Implementation:
- TypeScript with strict mode, Bun runtime
- Pure JS zip handling (fflate) for cross-platform compatibility
- 15 agent profiles (14 Tier 1 + generic fallback)
- Secure token storage (0600 permissions)
- Path safety validation for remove operations
- Comprehensive error handling (404/403/network distinction)
- 41 unit and integration tests

Documentation:
- CLI user guide (Chinese and English)
- README updates with quick start
- GitHub Actions workflow for cross-platform CI

Quality:
- lint: 0 errors
- typecheck: pass
- test: 41/41 pass
- build: 0.30 MB (target=node for npm/npx compatibility)
2026-04-29 15:37:04 +08:00
dongmucat
c71e4c197a
Merge pull request #354 from iflytek/fix/namespace-skill-pagination
fix(namespace): add pagination to namespace skill list
2026-04-27 16:06:19 +08:00
dongmucat
c1241ff83a test(namespace): fully mock search api in pagination e2e test
Root cause: two issues caused CI failure:
1. publishSkill hit 429 rate limit from other tests in the suite
2. glob pattern '?' was ambiguous for matching literal '?' in URLs

Fix: remove publishSkill dependency, use regex route matching, and
return fully mocked API responses with fake skill data. This tests
the frontend pagination UI behavior without needing real published
skills.
2026-04-27 11:42:43 +08:00
dongmucat
548ded0ad0 test(namespace): fix pagination e2e rate limit by intercepting search api 2026-04-27 11:25:07 +08:00
dongmucat
0020989ccb fix(namespace): add pagination to namespace skill list
The namespace detail page hardcoded a limit of 20 skills with no
pagination controls, so namespaces with more than 20 skills appeared
truncated. Add page state, wire it into the search query, and render
the shared Pagination component when total exceeds PAGE_SIZE. Also
reset page to 0 when the namespace param changes.

Closes #350
2026-04-27 10:54:57 +08:00
dongmucat
0cc3c46831
Merge pull request #340 from iflytek/feature/web-update-skill
feat(dashboard): add Update button to My Skills with publish prefill
2026-04-24 15:25:04 +08:00
dongmucat
c5c76d3bb0
Merge pull request #346 from iflytek/fix/search-empty-keyword-results
fix(search): preserve empty-query discovery results
2026-04-23 16:48:23 +08:00
dongmucat
df85ea0e18 fix(search): preserve empty-query discovery results 2026-04-23 16:24:23 +08:00
dongmucat
3739c7879b
Merge pull request #305 from iflytek/fix/bootstrap-admin-role-backfill
fix(auth): backfill bootstrap admin role binding
2026-04-23 10:11:43 +08:00
dongmucat
230b915194 feat(dashboard): add Update button to My Skills with publish prefill
Add an "Update" button to each skill card on the My Skills dashboard
page. Clicking it navigates to the Publish page with the skill's
namespace and visibility pre-selected, reducing manual steps when
re-publishing a skill package.

- Add visibility field to SkillSummaryResponse so the list API exposes
  each skill's current visibility setting
- Add publish-prefill module to normalize and validate URL search params
- Wire TanStack Router validateSearch on the publish route
- Add E2E tests covering the prefill flow and invalid-param fallback
2026-04-22 14:59:01 +08:00
dongmucat
62028e9f55
Merge pull request #337 from iflytek/fix/search-page-400
fix(search): harden portal query parsing
2026-04-22 13:53:46 +08:00
dongmucat
60a30190bf
Merge pull request #336 from iflytek/fix/s3-bucket-access-check
fix(storage): lazily create missing s3 buckets on upload
2026-04-22 09:52:33 +08:00
dongmucat
701ef12d33 test(e2e): wait for search cards before counting 2026-04-21 17:55:53 +08:00
dongmucat
f902c6f59b fix(search): restore clawhub namespace-only access 2026-04-21 17:28:05 +08:00
dongmucat
3c047fce8a
Merge pull request #334 from iflytek/fix/namespace-search-visibility
fix(search): restore clawhub namespace-only access
2026-04-21 16:47:19 +08:00
dongmucat
1e9d22b528 fix(storage): stage retryable s3 upload bodies 2026-04-21 13:09:20 +08:00
dongmucat
37aa366233 fix(storage): retry put after lazy bucket creation 2026-04-21 12:57:24 +08:00
dongmucat
e01c987a82 fix(search): restore clawhub namespace-only access 2026-04-21 09:45:39 +08:00
dongmucat
2c519c8efd fix(search): harden portal search query parsing 2026-04-20 16:57:47 +08:00
dongmucat
acc8899abb
Merge pull request #328 from iflytek/fix/gitlab-oauth-release-env
fix(env): add gitlab oauth release example config
2026-04-20 14:04:25 +08:00
dongmucat
1d0d6be816 fix(env): add gitlab oauth release example config 2026-04-20 13:54:41 +08:00
wrj97
7be6a36960
feat(auth): add GitLab OAuth2 provider support (#264)
* feat(auth): add GitLab OAuth2 provider support

Add GitLab as an additional OAuth2 authentication provider alongside
GitHub. This includes:

- GitLab OAuth2 client configuration with customizable base URL
- GitLabClaimsExtractor for handling GitLab-specific user claims
- Multi-provider login UI with provider-specific icons
- Updated localization to use OAuth-agnostic terminology
- JSON type annotation for IdentityBinding entity

* fix(auth): restore oauth redirect and gitlab email checks

* test(auth): align oauth login handler expectation

---------

Co-authored-by: wowo-zZ <zhenggui5228@126.com>
2026-04-17 19:56:32 +08:00