Commit graph

845 commits

Author SHA1 Message Date
dongmucat
299659bf93 fix(cli): avoid publish temp file leak 2026-05-11 13:43:31 +08:00
dongmucat
e7aecc4050 fix(cli): sync publish version flow 2026-05-11 11:00:10 +08:00
dongmucat
84914c9d94
Merge pull request #359 from iflytek/feature/skillhub-cli-v1
Some checks failed
Deploy Docs / build (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
feat(cli): add SkillHub CLI v1
2026-05-09 17:25:24 +08:00
dongmucat
d77a7d67c9 fix(cli): return correct exit code for network failures
- Handle 502/503 status codes as network errors (EXIT.network = 3)
- Previously these were treated as generic errors (EXIT.generic = 1)
- Fixes integration tests for login and search network failure scenarios
- Bump version to 0.1.4
2026-05-09 17:09:16 +08:00
dongmucat
3aef0ed4bc
Merge pull request #412 from iflytek/fix/namespace-management-gaps
fix(namespace): close namespace management gaps (#351)
2026-05-09 16:07:10 +08:00
dongmucat
ab06c75737 Merge branch 'main' into fix/namespace-management-gaps
Resolved conflicts by keeping both sides:
- web/src/api/client.ts: preserve paginated listMembers(slug, {page,size})
  and add delete(slug) from main.
- web/src/shared/hooks/use-namespace-queries.ts: keep useUpdateNamespace
  and useTransferNamespaceOwnership from this branch, plus useDeleteNamespace
  from main.
2026-05-09 15:13:44 +08:00
dongmucat
2821262fa4
Merge pull request #408 from iflytek/fix/namespace-delete-341
fix(namespace): support team namespace deletion
2026-05-09 15:04:06 +08:00
dongmucat
ab6fd07530
Merge pull request #414 from iflytek/fix/web-js-compat
fix(web): restore compatibility with Chromium 83 (Debian 10)
2026-05-09 15:03:02 +08:00
dongmucat
58a48e2670 docs: restructure CLI README and sync guide docs with improvements
变更摘要:

- 重构 cli/README.md 大纲结构,参考 guide 文档重新组织章节逻辑

- 补充 Windows PowerShell/CMD 环境变量设置方式到三份文档

- Command Reference 表格补全 --json、--registry、--token 等选项

- 英文 guide Registry 优先级第3条补充文件路径与中文版对齐

- 两份 guide 末尾补充 License 章节,Local Development 补 Windows 说明

- README 各章节标题添加语义化 emoji icon

关键文件:

- cli/README.md

- docs/skillhub/en/guide/cli.md

- docs/skillhub/guide/cli.md
2026-05-09 15:01:00 +08:00
dongmucat
30f3a84ce0 fix(namespace): remove optimistic update on member add to avoid cross-page duplication
appendNamespaceMember was being called via setQueriesData across all cached
pages, causing the new member to appear at the end of every page. The
invalidation will refresh the list correctly.
2026-05-09 14:22:16 +08:00
dongmucat
9b64cbedba feat(namespace): add edit/transfer UI with pagination support
Add namespace edit dialog, transfer ownership dialog, and member list pagination. Update API layer to support pagination (PagedResponse), add useUpdateNamespace and useTransferNamespaceOwnership hooks with pagination-aware optimistic updates. Integrate edit button in NamespaceHeader and transfer button on members page. Add i18n keys for all new features (en + zh).
2026-05-09 14:22:16 +08:00
dongmucat
2f640e42a3 feat(namespace): add transfer ownership endpoint
Implement POST /namespaces/{slug}/transfer-ownership to allow namespace owners to transfer ownership to existing members. Includes comprehensive test coverage for success and failure scenarios (non-owner, target not found, frozen namespace).
2026-05-09 14:22:16 +08:00
Cheney
702bbff216 Merge branch 'main' into fix/web-js-compat 2026-05-09 14:18:05 +08:00
Cheney
81f7e3943f fix(web): scope legacy browser target to production build only
The top-level esbuild.target also applied to dev/test transforms, which
broke vitest suites that use top-level await (Chromium 83 / ES2020 does
not support it). Only build.target and optimizeDeps.esbuildOptions.target
need the legacy target; remove the global esbuild.target override.
2026-05-09 13:55:57 +08:00
Cheney
e869a4d365 fix(web): restore compatibility with Chromium 83 (Debian 10)
Publish page dropdowns (namespace/visibility) failed to open on older
Chromium because Vite 6 defaults build target to chrome87 and some
bundled deps call runtime APIs absent in Chrome 83 (replaceAll, .at,
hasOwn). Lower esbuild/vite target to chrome83, add browserslist, drop
??= in bootstrap, and inject runtime polyfills before main loads.
2026-05-09 13:55:50 +08:00
dongmucat
42f6bb7582
Merge pull request #413 from iflytek/fix/web-build
fix(ci): pin pnpm 10.33 and approve esbuild build scripts
2026-05-09 13:50:48 +08: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
04a4545107 refactor(ci): inline pnpm build-script approval into package.json
Addresses review feedback on #413: for a single-package project,
pnpm-workspace.yaml is unnecessary and its 'packages: [.]' declaration
turns the web/ directory into a pnpm workspace root, which is a
semantic side effect we don't want.

Move onlyBuiltDependencies under the 'pnpm' field in package.json
(pnpm 10 still reads it there) and drop the workspace file from the
Dockerfile COPY list. Verified locally with docker buildx: pnpm 10.33
runs esbuild postinstall and the build succeeds.
2026-05-09 11:10:53 +08:00
dongmucat
32e40cbbb4 fix(ci): pin pnpm 10.33 and approve esbuild build scripts
Corepack was resolving pnpm to latest (11.0.9) on each CI run, and
pnpm 11 refuses unapproved postinstall scripts in --frozen-lockfile
mode. That caused ERR_PNPM_IGNORED_BUILDS: esbuild@0.25.12 and failed
the web image build in publish-images.

Changes:
- web/package.json: pin packageManager to pnpm@10.33.0
- web/pnpm-workspace.yaml: approve esbuild via onlyBuiltDependencies
  (pnpm 10 syntax; matches the pinned major)
- web/Dockerfile: copy pnpm-workspace.yaml before pnpm install so the
  approval list is visible inside the build stage
2026-05-09 10:46:48 +08:00
dongmucat
aecdecccab
Merge pull request #376 from iflytek/fix/oss-chunked-encoding
fix(storage): disable chunked encoding for Aliyun OSS compatibility
2026-05-08 17:22:51 +08:00
dongmucat
76db91dcb4
Merge pull request #390 from iflytek/worktree-skill-version-compare-v2
feat(skill): add version compare page with unified diff
2026-05-08 17:22:20 +08:00
dongmucat
8324f130cd fix(namespace): add index on promotion_request.target_namespace_id
The existsByTargetNamespaceId query used in namespace deletion
dependency checks was missing an index, causing a sequential scan.
2026-05-08 14:42:27 +08:00
dongmucat
8dd1668555 fix(namespace): support team namespace deletion 2026-05-08 10:15:17 +08:00
dongmucat
203684bbd4 docs: remove unused skill-version-compare-redesign document 2026-05-07 16:36:52 +08:00
dongmucat
13e148741d style(skill-compare): add background colors for diff add/delete lines 2026-05-07 15:58:39 +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
dongjiang
b0ab2fdebc
Merge pull request #391 from dongjiang1989/add-gemini-codereview
chore(PR): Add code assist for PR
2026-05-07 14:16:17 +08:00
dongmucat
5c95ab2b38 feat(skill): add version compare page with unified diff
Introduce a dedicated `/space/$namespace/$slug/compare` page that compares
two published skill versions GitHub-style: left file list + right unified
diff. Backend exposes `GET /versions/compare` returning structured diff
(computed via java-diff-utils) with per-file hunks, binary placeholder,
and truncation flags. Frontend uses two version selectors scoped to
PUBLISHED versions, a file search box, active-file highlighting, and
whitespace-preserving unified view. E2E covers the publish + rerelease
+ approve round trip; controller/domain tests cover happy path and
same-version rejection.
2026-05-07 09:45:26 +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
9a91b0c8bc docs(env): document SKILLHUB_STORAGE_S3_DISABLE_CHUNKED_ENCODING in release example 2026-05-06 14:17:56 +08:00
dongmucat
e3a0dcb139 fix(storage): disable chunked encoding for Aliyun OSS compatibility
Adds skillhub.storage.s3.disable-chunked-encoding (env:
SKILLHUB_STORAGE_S3_DISABLE_CHUNKED_ENCODING, default false) so
operators can turn off aws-chunked encoding when the S3 backend is
Aliyun OSS, which rejects it with 'InvalidArgument: aws-chunked
encoding is not supported'.

Closes #365
2026-05-06 13:56:55 +08:00
XiaoSeS
ebe7db36be
docs: update skill publish concept diagram (#363)
Some checks failed
Deploy Docs / build (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
* docs: update skill publish concept diagram

* chore: add docs/agents/ to gitignore for local AI agent config
2026-04-30 11:23:22 +08:00
XiaoSeS
a3c07725e5
feat(publish): skill upload limits, nested SKILL.md, session fix (#364)
* feat(publish): increase max file count from 100 to 500

Configurable via SKILLHUB_PUBLISH_MAX_FILE_COUNT env var.

* feat(publish): support SKILL.md in subdirectory with warning for ignored files

When SKILL.md is found in a single subdirectory (e.g. my-skill/SKILL.md),
promote that directory's contents to root and discard files outside it.
Discarded files are reported as warnings through the existing confirm flow.

* feat(publish): pass extraction warnings through confirm flow

When files are ignored during SKILL.md subdirectory promotion,
warnings are surfaced to the user via the existing precheck confirm dialog.

* fix(security): add invalidSessionStrategy to return 401 on expired session

Handles the case where Spring Security detects an invalid session cookie,
returning a clean 401 JSON response instead of triggering cascading exceptions.
Closes #360 (part 1/2)

* fix(security): handle session invalidation IllegalStateException as 401

Catches IllegalStateException with "Session was invalidated" message and
returns 401 instead of letting it fall through to the generic 500 handler.
Non-session IllegalStateExceptions are re-thrown to the catch-all handler.
Closes #360 (part 2/2)

* feat(publish): filter macOS metadata and add integration tests

Skip __MACOSX/, .DS_Store, and ._ resource fork entries during zip
extraction. Add integration tests for nested SKILL.md warning flow,
session invalidation 401 response, and macOS metadata filtering.

* test(publish): add real-world macOS zip and edge case integration tests

Covers: macOS zip with nested SKILL.md + __MACOSX + .DS_Store + stray files,
simple macOS single-folder case, and missing SKILL.md fallback behavior.
2026-04-30 11:20:51 +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
f70c1c6d99
Merge pull request #348 from iflytek/feature/oidc-login
feat(auth): support OIDC login
2026-04-29 15:21:37 +08:00