Commit graph

52 commits

Author SHA1 Message Date
Cheney
0b1c366f8d
refactor(cli): improve publish-cli script reliability (#441)
* refactor(cli): improve publish-cli script reliability

- Move version computation and pre-flight checks before build-and-test
  to fail fast on conflicts (existing branch/tag) instead of wasting
  minutes on lint/test/build
- Add INT/TERM signal handlers to cleanup trap so Ctrl+C during build
  properly restores working tree state
- Update Makefile help text to reflect PR-based workflow

* fix(cli): use git checkout -f for robust cleanup

Address code review feedback from gemini-code-assist bot:

- Use `git checkout -f` in on-release and committed cleanup stages
  to ensure reliable branch switching even when files are staged
  but not committed (e.g., interrupted after `git add` but before
  `git commit`)
- Remove redundant `git checkout -- <file>` in on-release stage
  since `-f` already discards all local changes

This prevents cleanup failures when the script is interrupted
between staging and committing.

* fix(cli): address PR #441 review findings

- Fix ERR trap bypass: remove `if !` wrapper around `gh pr create` so
  set -e triggers the trap and prints pushed-stage recovery instructions
- Fix command injection: all node -e/-p calls now use process.env
  instead of interpolating shell variables into JS string literals
- Rewrite cli/RELEASE.md to document the new PR-based release flow
- Rewrite scripts/tests/publish-cli-test.sh with 10 tests covering
  the new flow (stubs for bun/gh, pre-flight checks, happy path,
  cleanup state machine stages)

* fix(cli): address PR #441 review findings from @dongmucat

- Bind release tag to origin/main: PR body, end-of-run hint, and
  cli/RELEASE.md now use `git tag $TAG origin/main` so the tag is
  always placed on the merged commit, regardless of local branch state
- Reject prerelease tags in version computation: if the latest cli-v*
  tag contains non-X.Y.Z characters (e.g., -rc.1), exit with a clear
  message instead of crashing in node parsing
- Add pr-scripts.yml workflow: runs publish-cli-test.sh on scripts/**
  changes so the release script regression suite gates PRs
- Add Test 11 covering prerelease tag rejection

* fix(cli): compute publish baseline from origin tags only

A failed `git push origin cli-vX.Y.Z` after a successful local tag
leaves an orphan tag locally. The previous `git tag --list` baseline
would then treat it as the latest release, causing skipped versions or
publishes based on an unreleased tag.

Switch to `git ls-remote --tags --refs origin 'cli-v*' | sort -V` so
the baseline reflects only what is actually on origin. Local orphan
tags can still collide with the computed target tag, which fails fast
with a clear message as before.

Adds test 12 covering the orphan-tag scenario.
2026-06-02 14:30:39 +08:00
Cheney
48174c9ad2 fix(cli): match 'push' anywhere in git args, not just $1
The script calls `git -C /path push ...` so the first arg is `-C`,
not `push`. Use glob match on full args instead.
2026-05-13 09:27:44 +08:00
Cheney
dad06b465d fix(cli): fix exit code capture in tests using git wrappers
The `status="$(env ... printf | bash ... && echo 0 || echo $?)"` pattern
doesn't correctly capture the script's exit code because the command
substitution and pipe interact poorly. Use direct assignment with
`|| status=$?` instead.
2026-05-13 09:26:33 +08:00
Cheney
935054cc9e fix(cli): use git wrapper for push-failure test
The old approach (breaking origin URL) caused `git pull` to fail
before reaching the push step. Use a git wrapper that only fails
on `push` so the rest of the script runs normally.
2026-05-13 09:18:19 +08:00
Cheney
c520f38135 fix(cli): remove unreliable race-condition test, renumber tests
Remove test 7 (remote tag race condition) — the scenario is nearly
impossible with the new baseline sync logic and too complex to
reliably simulate. Fix variable naming inconsistencies from the
renumbering.
2026-05-13 09:16:19 +08:00
Cheney
1c29cfac57 test(cli): add debug logging to race-condition test wrapper 2026-05-12 18:05:02 +08:00
Cheney
85a758bbdd fix(cli): rewrite test 7 to cover real remote tag race condition
Old test 7 used `--no-tags` config to prevent fetch from pulling the
remote tag, but that doesn't reflect any real-world scenario. With the
new baseline sync logic, a pre-existing remote tag would be synced
into the local version, eliminating the conflict path the test claimed
to cover.

Replace with a git wrapper that injects the conflicting tag into origin
right before the script's `ls-remote` check, which simulates a real
race between two developers attempting to release the same version.
2026-05-12 18:02:02 +08:00
Cheney
c1c12c56eb fix(cli): gitignore test scaffolding files in publish-cli tests
Tests write stdout.log/stderr.log into the test repo root, which made
`git status --porcelain` non-empty and broke test 3 (non-main branch
abort) by tripping the dirty-tree check first.

Add a .gitignore to the test fixture repo to filter out these files.
2026-05-12 17:57:32 +08:00
Cheney
70b962a4c8 fix(cli): harden release pipeline per PR #422 review
1. npm version check: three-state logic (exists/missing/error) to prevent
   silent skip on network failures, registry 5xx, or auth issues.

2. workflow_dispatch: checkout the specified tag and validate SHA matches,
   preventing builds from wrong ref.

3. Atomic push: use `git push --atomic` and detect unpushed tags via
   `git ls-remote` instead of `--no-merged` (catches branch-pushed-but-
   tag-failed state).
2026-05-12 17:15:35 +08:00
Cheney
8126faa452 fix(cli): detect and guide recovery of unpushed release artifacts
Add pre-flight check in publish-cli.sh to detect unpushed commits and tags
from previous failed pushes. When detected, the script exits with clear
recovery instructions:

1. Retry push (for transient network failures)
2. Rollback and re-release (for clean restart)

This prevents the baseline sync logic from skipping failed versions when
local tags participate in version calculation after a push failure.

Addresses feedback from dongmucat in PR #422.
2026-05-12 16:14:47 +08:00
Cheney
159886b76d fix(cli): ensure create-release depends on publish-npm and rewrite publish-cli tests
1. Update release-cli.yml to make create-release depend on publish-npm with proper skip_npm handling, preventing half-released state where GitHub Release exists but npm package is unavailable.

2. Rewrite publish-cli-test.sh to cover the new publish flow: main branch check, dirty tree detection, tag baseline sync, version bumping, tag conflict detection, user cancellation, and atomic push verification.
2026-05-12 16:12:57 +08:00
Cheney
490ddfa548 fix(cli): push branch and tag atomically in publish-cli.sh 2026-05-12 11:01:50 +08:00
Cheney
378216c6da feat(cli): add automated build and publish workflow
- Add release-cli.yml GitHub Actions workflow: build, test, npm publish,
  and GitHub Release triggered by cli-v* tags
- Rewrite scripts/publish-cli.sh: local bump + commit + tag + push,
  enforces main branch, idempotent tag checks
- Add concurrency group and release idempotency to workflow
- Add make publish-cli / publish-cli-minor / publish-cli-major targets
- Add cli/RELEASE.md documenting the full release process
2026-05-12 10:32:06 +08:00
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
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
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
wowo
c03790a11e
Fix runtime Postgres password drift (#321)
- start postgres before bringing up application services
- sync the database role password from .env.release
- verify TCP auth with the synced password before startup
2026-04-17 17:45:34 +08:00
wowo
689e698b89
feat(ci): add PR batch test deployment workflow (#275)
* feat(ci): add PR batch test deployment workflow

* fix(ci): support local PR batch rehearsal

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-09 18:45:14 +08:00
XiaoSeS
010c1a4e46
fix(runtime): use Aliyun OSS for raw files when --aliyun flag is set (#250)
Some checks failed
Deploy Docs / build (push) Has been cancelled
Deploy Docs / Deploy (push) Has been cancelled
When using --aliyun flag, switch SKILLHUB_RAW_BASE from GitHub raw URL
to Aliyun OSS (https://imageless.oss-cn-beijing.aliyuncs.com) for
faster file downloads in China.
2026-04-07 19:18:41 +08:00
XiaoSeS
37c25c3f91
docs: simplify runtime script usage (#217)
* docs: simplify runtime script usage

Unify to use runtime.sh for all deployment commands, removing the
distinction between "official images" and "Aliyun mirror". The --aliyun
parameter is preserved for users in China to specify the mirror.

Changes:
- Remove runtime-github.sh references, use runtime.sh uniformly
- Default command uses GHCR images
- Add --aliyun parameter for China users
- Update README.md, README_zh.md, and docs/skillhub/ quickstart files

* docs: consolidate documentation links with clear descriptions

Merge the two documentation links into a single "Documentation" section
with clear descriptions of each:
- User Guide: skill publishing, search, CLI usage
- Developer Docs: architecture, API reference, deployment

This makes it easier for users to find the right documentation.

* docs: consolidate documentation links with clear descriptions

Merge the two documentation links into a single "Documentation" section
with clear descriptions of each:
- User Guide: skill publishing, search, CLI usage
- Developer Docs: architecture, API reference, deployment

This makes it easier for users to find the right documentation.

* fix: include --home parameter in shutdown command

When starting with a custom --home directory, the generated shutdown
command now includes the same --home parameter to ensure it can find
the correct compose files.
2026-04-02 20:59:49 +08:00
XiaoSeS
612b69c2f9
fix: add --public-url parameter for docker deployment (#216)
* docs: add VitePress bilingual documentation site

- Add VitePress-based documentation with Chinese (root) and English (/en/) locales
- Include 6 feature guides: skill-publish, skill-discovery, namespace, review, scanner, social
- Add quickstart, introduction, and FAQ pages
- Include AI-generated diagrams and screenshots
- Add GitHub Pages deployment workflow
- Add Makefile targets: docs-dev, docs-build, docs-preview

* docs: rename docs/claude to docs/skillhub

- Rename documentation directory from docs/claude to docs/skillhub
- Update Makefile paths for docs-dev, docs-build, docs-preview
- Update GitHub workflow paths for deploy-docs.yml

* fix: add enablement parameter to auto-enable GitHub Pages

* Revert "fix: add enablement parameter to auto-enable GitHub Pages"

This reverts commit 11096b1a9b.

* docs: add documentation link to README

Add link to GitHub Pages documentation (https://iflytek.github.io/skillhub/)
under Quick Start section in both English and Chinese README files.

* fix: add --public-url parameter for docker deployment

- Add --public-url parameter to runtime.sh for configuring public access URL
- Create skill.md.template for dynamic URL substitution at container startup
- Update getBaseUrl() to fallback to window.location.host when appBaseUrl is localhost
- Update landing-quick-start.tsx to dynamically generate agent command URL
- Add commandTemplate to i18n files for URL placeholder support
- Update README.md and README_zh.md with deployment parameter documentation

Fixes: Docker deployment shows localhost in install commands and skill.md
2026-04-02 17:52:42 +08:00
XiaoSeS
c23d0bbc4a feat: add scanner service to v0.2.0 release deployment (#189)
* feat(deploy): add scanner service to release deployment

- Add skill-scanner service to compose.release.yml (enabled by default)
- Add scanner image to CI publish-images workflow matrix
- Add --scanner-image and --no-scanner flags to runtime.sh
- Add scanner config to .env.release.example

* fix(docker): add skillhub-notification module to server Dockerfile

* fix(deploy): set scanner mode to upload for container deployment

* fix(deploy): use env override instead of persisting scanner disabled state
2026-03-30 19:01:51 +08:00
XiaoSeS
0a8c02c647 fix: enable bootstrap admin by default for zero-config quickstart (#175) 2026-03-27 19:00:24 +08:00
yun-zhi-ztl
798038fcc1 fix(dev): ignore invalid backend pid files 2026-03-23 17:14:16 +08:00
vsxd
ddf9e6e1d2 refactor: address code review findings from 2026-03-22
Implements 6 high-priority improvements from code review:

Backend:
- Make label business limits configurable via application.yml (max-definitions, max-per-skill)

Frontend:
- Split use-skill-queries.ts into domain-specific modules (label/namespace/user/skill)
- Enable @typescript/no-explicit-any as warning and clean up 10 any types
- Unify API error handling by removing unwrap() in favor of fetchJson()

Testing:
- Add label system scenarios to smoke test script
- Add 6 new tests for label management UI (validation, rendering)

All tests passing: 301 backend, 129 frontend
2026-03-23 13:48:23 +08:00
XiaoSeS
3bc97ff1b8 feat(security): add security scanning system with multi-scanner support and frontend UI (#144)
* feat(security): extend scanner config with full analyzer options

Integrate skill-scanner's 8 analysis engines and policy configuration
into SkillHub's config system. Operators can now control behavioral,
LLM, Meta, AI Defense, VirusTotal, and trigger analyzers via
application.yml or environment variables.

Changes:
- Add Analyzers and Policy nested classes to SkillScannerProperties
- Create ScanOptions record to encapsulate analyzer flags
- Update SkillScannerService to pass options in /scan body and /scan-upload query params
- Wire ScanOptions through SkillScannerConfig and SkillScannerAdapter
- Extend application.yml with full scanner config block and env var overrides
- Update all tests to verify new configuration flow

All tests pass.

* feat(security): add domain model and integrate scan into publish flow

Add SCANNING/SCAN_FAILED status to SkillVersionStatus. Introduce
SecurityScanService, SecurityScanner port, ScanTask, SecurityAudit
and related domain types. Wire scan trigger into SkillPublishService
so non-auto-publish versions enter scanning when scanner is enabled,
falling back to review task creation when disabled.

* feat(security): add infra layer for scanner HTTP client and adapters

Add WebClient-based HttpClient abstraction with WebClientHttpClient
implementation. Add SkillScannerApiResponse record, SecurityScanException,
and SecurityAuditJpaRepository. Add webflux and test dependencies to
infra module.

* feat(security): add Redis stream consumers, audit API, and DB migration

Add AbstractStreamConsumer base class, ScanTaskConsumer for processing
scan results from Redis stream, and RedisScanTaskProducer. Add
RedisStreamConfig for stream/group initialization. Add SecurityAudit
REST controller and DTO. Add V35 Flyway migration for security_audits
table.

* feat(security): add scanner config to application profiles

Add scanner enabled flag to application-local.yml and
application-test.yml. Enable behavioral analyzer by default
in application.yml.

* feat(deploy): add skill-scanner to docker-compose and k8s manifests

Add skill-scanner service to docker-compose.yml with health check.
Add scanner k8s deployment, service, and configmap entries. Wire
scanner env vars into Makefile dev-all flow. Add verify-scanner.sh
script for post-deploy validation.

* docs(security): add scanner documentation suite

Add scanner docs: configuration guide, failure impact analysis,
monitoring guide, improvement recommendations, custom rules guide,
and skill-vetter rules conversion example. Update deployment docs
with scanner section. Add security-scanning overview and PRD.

* feat(security): add skill-vetter custom rule examples

Add example Regex and YARA rules derived from skill-vetter RED FLAGS
in scanner/examples/vetter-rules/. Includes 7 Regex rules
(signatures-append.yaml) and 3 YARA rules (skillhub_vetter.yara)
covering agent memory theft, IP-based exfiltration, and browser
data theft detection.

* feat(security): add scanner Docker build context

Add Dockerfile for cisco-ai-skill-scanner container and
.env.example with LLM configuration placeholders.

* fix(security): align Finding mapping with scanner API response schema

SkillScannerApiResponse.Finding used incorrect field names (message,
location.file, location.line, code_snippet) that did not match the
scanner's actual JSON output (description, file_path, line_number,
snippet), causing all four fields to deserialize as null.

Flatten Finding to match scanner API: remove nested Location, rename
fields to description/file_path/line_number/snippet. Add skill_name
and timestamp to SkillScannerApiResponse. Extend SecurityFinding with
remediation, analyzer, and metadata fields to capture LLM analyzer
output. Retain 8-arg compact constructor for backward compatibility.

* chore(security): add debug logging to scanner response mapping

Log raw scanner API response and mapped SecurityFinding fields
side-by-side to help verify data consistency between scanner
output and database records.

* feat(security): add multi-scanner support and soft delete for security audits

- Add ScannerType enum for type-safe scanner identification
- Update V35 migration to support multiple scanners and soft delete
- Remove CASCADE delete, use code-level soft delete (deleted_at)
- Add repository methods for querying latest audit by scanner type
- Update SecurityScanService to handle scanner type parameter
- Integrate soft delete in SkillHardDeleteService
- Update all tests to use ScannerType enum

This enables multiple scanner integrations (skill-scanner, future LLM/compliance scanners)
and preserves complete audit history through soft deletion.

* feat(security): add security audit UI to review detail and skill detail pages

Display security scan results on the review detail page (full audit
section with collapsible findings) and the skill detail sidebar (compact
summary with dialog for details).  Handles empty/404 gracefully by
returning null, avoids loading shimmer flicker, and separates lifecycle
action buttons with a visual divider.

* docs(security): add security audit UI PRD

* fix(security): replace LocalDateTime with Instant in security audit and align controller test with list API

SecurityAudit and SecurityScanService used LocalDateTime.now() which
violated the project time guardrail. Replaced with Instant and
Clock.systemUTC() to match existing conventions.

Also fixed SecurityAuditControllerTest to mock the correct repository
method (findLatestActiveByVersionId) and assert against the list
response shape.

* test(security): add useQuery mock for security audit components in frontend tests

The SecurityAuditSummary and SecurityAuditSection components use
useQuery via useSecurityAudits hook, which was missing from the
@tanstack/react-query mocks in skill-detail and review-detail tests.
2026-03-23 09:56:03 +08:00
yun-zhi-ztl
b0e19af3ed fix: harden hidden skill visibility and local dev restart flow (#62)
* fix: hide hidden skills from regular viewers

* fix: avoid dashboard preview crash after registration

* fix: restrict skill hiding to super admins

* chore: remove dev process script

* fix: hide hidden skills from slug resolution
2026-03-17 15:26:12 +08:00
yun-zhi-ztl
556e65efef feat: complete skill promotion submission flow 2026-03-16 16:03:46 +08:00
yun-zhi-ztl
b30311a537 feat: build governance center workflow 2026-03-16 16:03:46 +08:00
yun-zhi-ztl
62979b2dd7 test: cover namespace workflow smoke paths 2026-03-16 16:03:46 +08:00
yun-zhi-ztl
30d6581710 fix: stabilize backend dev startup flow 2026-03-16 16:03:46 +08:00
yun-zhi-ztl
93323766db fix: stabilize backend dev module classpath 2026-03-16 16:03:46 +08:00
binfan5
3901bfa095 fix 2026-03-15 16:50:59 +08:00
binfan5
bc4b0dcad1 feat(ops): add aliyun runtime shortcut 2026-03-15 14:30:14 +08:00
binfan5
f5c029fbe8 feat(ops): add optional runtime registry mirroring 2026-03-15 14:30:04 +08:00
wowo-zZ
f8d96171f0 refactor(dev): replace agent-* commands with parallel-* workflow
- Rename setup-agent-worktrees.sh -> parallel-init.sh
- Rename sync-agent-integration.sh -> parallel-sync.sh
- Rename 13-agent-parallel-workflow.md -> 13-parallel-workflow.md
- Add parallel-common.sh with shared utilities
- Add parallel-up.sh (sync + dev-all in one step)
- Add parallel-down.sh (stop integration stack)
- Remove agent-worktrees and agent-sync Makefile targets
- Remove AGENT_BASE_REF and AGENT_WORKTREE_ROOT variables
- Clean up compatibility shim references in docs
2026-03-14 20:49:17 +08:00
yun-zhi-ztl
1407e335c2 Merge pull request #2 from iflytek/feature/project-review
review: fix device auth, review permissions, and publish state flow
2026-03-14 03:09:33 -07:00
wowo-zZ
e78f7f803a feat(dev): add Claude + Codex parallel workflow support
Add infrastructure for running Claude and Codex agents in parallel
without conflicts, using isolated git worktrees and shared Docker
dependencies.

Changes:
- Add agent-worktrees and agent-sync Makefile targets
- Pin Docker Compose project names to enable worktree isolation
- Add setup-agent-worktrees.sh script for creating parallel worktrees
- Add sync-agent-integration.sh script for merging agent branches
- Document parallel workflow in 13-agent-parallel-workflow.md
- Update dev-workflow.md with worktree usage guide

Benefits:
- Prevents agents from overwriting each other's work
- Shares dependency containers across worktrees (Postgres/Redis/MinIO)
- Reserves localhost:3000 for integration verification only
- Provides clear merge and recovery procedures
2026-03-14 18:01:12 +08:00
yun-zhi-ztl
a6cf862e8e merge(main): sync latest origin/main into feature/project-review
Resolved 9 conflicts according to documented strategy:
- .gitignore: kept both entries (docs/review/ + CLAUDE.md)
- ClawHubCompatController.java: manual merge (use @AuthenticationPrincipal + platformRoles)
- ClawHubCompatControllerTest.java: kept ours (HEAD security tests)
- CliControllerTest.java: kept ours (HEAD platform roles tests)
- ReviewPermissionChecker.java: kept ours (stricter permission model)
- SkillPublishService.java: kept theirs (main SUPER_ADMIN bypass + events)
- SkillPublishServiceTest.java: kept theirs (main complete test suite)
- router.tsx: manual merge (HEAD's createLazyRouteComponent + main's privacy/terms)
- markdown-renderer.tsx: kept ours (HEAD frontmatter stripping + styles)

All A1-A9 security fixes preserved. No new logic introduced.
2026-03-14 17:50:38 +08:00
yun-zhi-ztl
fd790a9610 feat(web): add header nav to landing page and local dev improvements
- Add sticky header with LanguageSwitcher and UserMenu to landing page
- Update token dialog and i18n translations
- Fix dev process script and compose release config
- Remove stale skillhub submodule reference
2026-03-14 17:32:47 +08:00
vsxd
7a0d40736c Add release config validation workflow 2026-03-13 17:00:47 +08:00
yun-zhi-ztl
8cfb6b6384 fix(ci): stabilize openapi sdk validation 2026-03-13 14:13:30 +08:00
vsxd
ec9341a6da fix(dev): harden local process startup checks 2026-03-13 11:09:02 +08:00
vsxd
f7df348a5a Add OpenAPI drift validation and docs updates 2026-03-13 11:06:55 +08:00
vsxd
3cee8fbb5a fix(phase4): harden smoke checks and metrics access 2026-03-13 10:56:28 +08:00
vsxd
0ca38e73ba merge: bring phase4 worktree implementation into feature/project-init
# Conflicts:
#	server/skillhub-app/src/main/java/com/iflytek/skillhub/controller/cli/CliPublishController.java
#	server/skillhub-app/src/main/java/com/iflytek/skillhub/controller/portal/SkillPublishController.java
#	server/skillhub-storage/src/main/java/com/iflytek/skillhub/storage/LocalFileStorageService.java
#	web/src/app/router.tsx
2026-03-13 10:35:42 +08:00
vsxd
2b7968c71c docs(repo): add contribution and community templates 2026-03-13 10:34:12 +08:00
vsxd
33c44fb9cc feat(phase4): complete auth, governance, observability, and ops polish 2026-03-13 10:17:48 +08:00
vsxd
f7798dddc5 Revert "merge: bring review fixes into feature/project-init"
This reverts commit 92f63f8b89, reversing
changes made to 78e16f0fe7.
2026-03-13 10:06:14 +08:00