Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
539941bba5 | ||
|
|
7476db2bb5 | ||
|
|
ab7131ef2c | ||
|
|
d3fe4c1d84 | ||
|
|
5dd337e671 | ||
|
|
63d579c273 | ||
|
|
e716f069ed | ||
|
|
b998a0527e | ||
|
|
7f3a4b0fe4 | ||
|
|
f0d3477d69 |
No files matched your search
@@ -58,5 +58,11 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1 || gh release create "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --title "${GITHUB_REF_NAME}" --notes "Automated binary release for ${GITHUB_REF_NAME}."
|
TAG_MSG=$(git tag -l --format='%(contents)' "${GITHUB_REF_NAME}" | sed '/^$/d')
|
||||||
|
if [ -n "$TAG_MSG" ]; then
|
||||||
|
gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1 || gh release create "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --title "${GITHUB_REF_NAME}" --notes "$TAG_MSG" --generate-notes
|
||||||
|
else
|
||||||
|
gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1 || gh release create "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" --title "${GITHUB_REF_NAME}" --generate-notes
|
||||||
|
fi
|
||||||
gh release upload "${GITHUB_REF_NAME}" dist/bin/seal-home-* --repo "${GITHUB_REPOSITORY}" --clobber
|
gh release upload "${GITHUB_REF_NAME}" dist/bin/seal-home-* --repo "${GITHUB_REPOSITORY}" --clobber
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "seal-home",
|
"name": "seal-home",
|
||||||
"version": "0.7.0",
|
"version": "0.8.0",
|
||||||
"description": "Seal Home tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
|
"description": "Seal Home tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "yingqing"
|
"name": "yingqing"
|
||||||
|
|||||||
@@ -35,7 +35,20 @@ Use `bun:test` with `describe`, `test`, and `expect`. Place tests next to covere
|
|||||||
|
|
||||||
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters.
|
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters.
|
||||||
|
|
||||||
Pull requests should include a short summary, tests run, and any config or OpenAPI regeneration notes. Link related issues when available. Add screenshots only for UI or documentation rendering changes.
|
## Release & Publishing Guidelines
|
||||||
|
|
||||||
|
1. **Version Bump Checklist**:
|
||||||
|
- Update version string in `package.json`, `.zcode-plugin/plugin.json`, `skills/seal-home/SKILL.md`, and `openapi/openapi.yaml`.
|
||||||
|
- Update `CHANGELOG.md` with new features and fixes.
|
||||||
|
- Run `bun run openapi:bundle && bun run build:plugin && bun test && bun run check`.
|
||||||
|
2. **Tag & Release**:
|
||||||
|
- Create an annotated Git tag with a descriptive release summary:
|
||||||
|
```bash
|
||||||
|
git commit -am "Release vX.Y.Z: ..."
|
||||||
|
git tag -a vX.Y.Z -m "🚀 Release summary text describing key changes"
|
||||||
|
git push origin master --tags && git push home master --tags
|
||||||
|
```
|
||||||
|
- GitHub Actions will automatically extract the tag message, append commit notes via `--generate-notes`, cross-compile all 5 target binaries in ~50s, and publish the GitHub Release.
|
||||||
|
|
||||||
## Security & Configuration Tips
|
## Security & Configuration Tips
|
||||||
|
|
||||||
@@ -44,3 +57,4 @@ Never commit real enterprise credentials, Seal tokens, service logs, or local ge
|
|||||||
## Agent-Specific Instructions
|
## Agent-Specific Instructions
|
||||||
|
|
||||||
Do not create `.codex/skills`; Codex is compatible with `.agents/skills`, and this project treats `.agents/` as authoritative. At project scope, prefer `AGENT.md` instructions when present.
|
Do not create `.codex/skills`; Codex is compatible with `.agents/skills`, and this project treats `.agents/` as authoritative. At project scope, prefer `AGENT.md` instructions when present.
|
||||||
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to `seal-home` will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [0.8.0] - 2026-08-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Multi-Source Download & Gitea Acceleration**: Enhanced `install.sh` and `seal-home update` with intelligent multi-source racing and automatic fallback across Gitea (`git.ying-qing.cn`), GitHub Releases, and CDN mirrors, achieving lightning-fast downloads in mainland China.
|
||||||
|
- **Strict Anti-Rollback & Forward-Only Enforcement**: Guarded update commands against downgrades to prevent state schema and skill definition corruption.
|
||||||
|
- **Release History & Changelog Introspection**: Integrated `seal-home changelog` and `update check` with publish timestamps, author identity, and intermediate version diff calculations.
|
||||||
|
- **Automated CI Tag Release Notes**: Updated GitHub Actions release workflow to extract annotated git tag messages and append GitHub-generated PR and commit notes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [0.7.1] - 2026-08-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Release History & Changelog Query**: Added `seal-home changelog` and `seal-home update check` with release publish timestamps, author info, and changelog body.
|
||||||
|
- **Cross-Version Diff Tracking**: Automatically computes skipped/intermediate versions (`pendingReleases`) with commit notes when local version is behind.
|
||||||
|
- **Strict Downgrade Protection (Anti-rollback Guard)**: Enforced forward-only updates. Attempts to downgrade to an older version (e.g. `seal-home update 0.3.3`) are strictly blocked with explicit guidance.
|
||||||
|
- **Latest Keyword Normalization**: Normalized `seal-home update latest` and `--version latest` to point cleanly to the newest release.
|
||||||
|
- **Approval Runs List Alias**: Added `seal-home approval-runs list` as a friendly alias for `approval-runs search`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- **UNIX Pipe EPIPE Handling**: Handled `EPIPE` broken pipe errors on `process.stdout` so piped commands (e.g. `seal-home openapi | head`) exit cleanly without dumping stack traces.
|
||||||
|
- **Empty Filter Guidance**: Added friendly stderr diagnostics when queries (e.g. `approval-runs summary` or `corps list`) find no records for the current date/filter.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [0.7.0] - 2026-08-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- **Zero-Dependency Native Binaries**: Compiled standalone native executables for macOS (arm64/x64), Linux (x64/arm64), and Windows (x64) via Bun compiled standalone target.
|
||||||
|
- **High-Speed Release Pipeline**: GitHub Actions multi-target cross-compilation pipeline delivering release assets in under 60 seconds.
|
||||||
|
- **Sudo-Free One-Line Installer**: Created `scripts/install.sh` with automatic writable path detection (`/opt/homebrew/bin` → `/usr/local/bin` → `~/.local/bin`) and macOS ad-hoc code-signing.
|
||||||
|
- **Strict POSIX Stream Isolation**: Guaranteed `stdout` emits 100% pure, parseable JSON for AI agents and scripts, while diagnostics and human onboarding tips route to `stderr`.
|
||||||
|
- **Simulation Batch Management**: Added `simulation create` for both HoseCloud flow IDs and material package ZIP imports.
|
||||||
|
- **In-place Self-Update**: `seal-home update` atomic binary replacement with automatic global skill directory synchronization.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [0.3.3] - 2026-06-13
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Initial proof-of-concept release for Seal tenant operations and Hose approval automation.
|
||||||
@@ -6,16 +6,35 @@ The first provider is Hose/合思: `key`, `password`, `corpId`, `staffId`, and a
|
|||||||
|
|
||||||
Seal-native enterprise pages can be added with a Seal Bearer token. The older `direct` source remains available for existing configs that already provide a Seal Bearer token.
|
Seal-native enterprise pages can be added with a Seal Bearer token. The older `direct` source remains available for existing configs that already provide a Seal Bearer token.
|
||||||
|
|
||||||
## Setup
|
## Quick Install (Standalone Binary)
|
||||||
|
|
||||||
|
No Node.js, Bun, or external runtime required. Run the one-line installer for macOS and Linux:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun install
|
curl -fsSL https://raw.githubusercontent.com/yunyingk/seal-home/master/scripts/install.sh | bash
|
||||||
cp enterprises/example.hose.json enterprises/local.json
|
|
||||||
bun run check
|
|
||||||
bun run probe -- <corpId>
|
|
||||||
bun run start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Or download the native binary directly from [GitHub Releases](https://github.com/yunyingk/seal-home/releases/latest):
|
||||||
|
|
||||||
|
- **macOS (Apple Silicon)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-darwin-arm64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
|
||||||
|
- **macOS (Intel)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-darwin-x64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
|
||||||
|
- **Linux (x86_64)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-linux-x64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
|
||||||
|
- **Linux (ARM64)**: `curl -fsSL https://github.com/yunyingk/seal-home/releases/latest/download/seal-home-linux-arm64 -o /usr/local/bin/seal-home && chmod +x /usr/local/bin/seal-home`
|
||||||
|
- **Windows (x64)**: Download `seal-home-windows-x64.zip` from Releases and extract `seal-home-windows-x64.exe`.
|
||||||
|
|
||||||
|
After installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
seal-home version # Check version
|
||||||
|
seal-home skill install # Install Agent skill to ~/.agents/skills/seal-home
|
||||||
|
seal-home mcp-config # Print .mcp.json snippet for Cursor / Claude Desktop / Codex
|
||||||
|
seal-home update # Future self-update directly from GitHub Release
|
||||||
|
```
|
||||||
|
|
||||||
|
## Source Setup & Development
|
||||||
|
|
||||||
|
For local development from source with Bun:
|
||||||
|
|
||||||
For an already-authenticated Seal-native source, use `seal-home corps add-seal` or copy `enterprises/example.seal.json`. Existing `direct` configs remain supported via `enterprises/example.direct.json`.
|
For an already-authenticated Seal-native source, use `seal-home corps add-seal` or copy `enterprises/example.seal.json`. Existing `direct` configs remain supported via `enterprises/example.direct.json`.
|
||||||
|
|
||||||
## Public Usage
|
## Public Usage
|
||||||
@@ -269,3 +288,24 @@ When `_langfuseTraceId` exists, downstream tools should fetch the trace directly
|
|||||||
- Prefer CLI or script processing for large tool responses. For daily approval questions, call `seal-home approval-runs summary --corp <corpId> ...` instead of reading long `seal_approval_runs_search` output manually.
|
- Prefer CLI or script processing for large tool responses. For daily approval questions, call `seal-home approval-runs summary --corp <corpId> ...` instead of reading long `seal_approval_runs_search` output manually.
|
||||||
- Keep broad search tools compact by default. Add explicit opt-in flags such as `includeBridge` for verbose fields that are useful only in deeper debugging.
|
- Keep broad search tools compact by default. Add explicit opt-in flags such as `includeBridge` for verbose fields that are useful only in deeper debugging.
|
||||||
- When Seal API timestamp filters are uncertain, filter again in tool code by `createdAt` and explicit timezone before presenting date-based answers.
|
- When Seal API timestamp filters are uncertain, filter again in tool code by `createdAt` and explicit timezone before presenting date-based answers.
|
||||||
|
|
||||||
|
## Release & Publishing
|
||||||
|
|
||||||
|
To release a new version of `seal-home`:
|
||||||
|
|
||||||
|
1. **Version Bump Checklist**:
|
||||||
|
- Bump version across `package.json`, `.zcode-plugin/plugin.json`, `skills/seal-home/SKILL.md`, and `openapi/openapi.yaml`.
|
||||||
|
- Update `CHANGELOG.md` with release notes and highlights.
|
||||||
|
- Run verification and bundles:
|
||||||
|
```bash
|
||||||
|
bun run openapi:bundle && bun run build:plugin && bun test && bun run check
|
||||||
|
```
|
||||||
|
2. **Tag & Publish**:
|
||||||
|
- Commit changes and create an annotated Git tag with release notes:
|
||||||
|
```bash
|
||||||
|
git commit -am "Release vX.Y.Z: ..."
|
||||||
|
git tag -a vX.Y.Z -m "🚀 版本更新文案与主要特性说明"
|
||||||
|
git push origin master --tags && git push home master --tags
|
||||||
|
```
|
||||||
|
- GitHub Actions will automatically extract your tag annotation message, append the auto-generated commit list via `--generate-notes`, cross-compile all 5 target standalone binaries in under 60 seconds, and publish the release to [GitHub Releases](https://github.com/yunyingk/seal-home/releases).
|
||||||
|
|
||||||
Vendored
+234
-67
@@ -24943,7 +24943,7 @@ async function createSealClientForToken(corp, token) {
|
|||||||
// package.json
|
// package.json
|
||||||
var package_default = {
|
var package_default = {
|
||||||
name: "seal-home",
|
name: "seal-home",
|
||||||
version: "0.7.0",
|
version: "0.8.0",
|
||||||
type: "module",
|
type: "module",
|
||||||
module: "src/server.ts",
|
module: "src/server.ts",
|
||||||
bin: {
|
bin: {
|
||||||
@@ -28745,8 +28745,10 @@ Usage:
|
|||||||
seal-home config paths
|
seal-home config paths
|
||||||
seal-home config get
|
seal-home config get
|
||||||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||||||
seal-home service <start|stop|restart|status>
|
seal-home update [--check] [--force] [--version <v>]
|
||||||
seal-home update
|
seal-home update check
|
||||||
|
seal-home update changelog [--limit <n>]
|
||||||
|
seal-home changelog [--limit <n>]
|
||||||
seal-home tools list
|
seal-home tools list
|
||||||
seal-home corps list [--corp <corpId>]
|
seal-home corps list [--corp <corpId>]
|
||||||
seal-home corps current [--corp <corpId>]
|
seal-home corps current [--corp <corpId>]
|
||||||
@@ -28788,7 +28790,7 @@ Usage:
|
|||||||
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
||||||
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
||||||
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
||||||
seal-home approval-runs search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
seal-home approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||||
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
||||||
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
||||||
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
||||||
@@ -28843,7 +28845,7 @@ async function runToolResult(name, client, corp, params) {
|
|||||||
// src/cli/commands/approval-runs.ts
|
// src/cli/commands/approval-runs.ts
|
||||||
async function handleApprovalRunsCommand(action, maybeName, client, corp, args) {
|
async function handleApprovalRunsCommand(action, maybeName, client, corp, args) {
|
||||||
if (action === "summary") {
|
if (action === "summary") {
|
||||||
await runTool("seal_approval_runs_summary", client, corp, {
|
const result = await runToolResult("seal_approval_runs_summary", client, corp, {
|
||||||
date: stringOption(args.options.date),
|
date: stringOption(args.options.date),
|
||||||
timezone: stringOption(args.options.timezone),
|
timezone: stringOption(args.options.timezone),
|
||||||
limit: numberOption(args.options.limit),
|
limit: numberOption(args.options.limit),
|
||||||
@@ -28856,10 +28858,14 @@ async function handleApprovalRunsCommand(action, maybeName, client, corp, args)
|
|||||||
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
||||||
humanResult: stringOption(args.options.humanResult),
|
humanResult: stringOption(args.options.humanResult),
|
||||||
query: stringOption(args.options.query)
|
query: stringOption(args.options.query)
|
||||||
}, outputOptions(args.options));
|
});
|
||||||
|
if (result?.matched === 0 && result?.total > 0) {
|
||||||
|
console.error(`提示:在 ${result.date} 未匹配到记录(该企业共有 ${result.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-home approval-runs list --limit 10 查看最近记录。`);
|
||||||
|
}
|
||||||
|
printJson(result, outputOptions(args.options));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (action === "search") {
|
if (action === "search" || action === "list") {
|
||||||
await runTool("seal_approval_runs_search", client, corp, {
|
await runTool("seal_approval_runs_search", client, corp, {
|
||||||
limit: numberOption(args.options.limit),
|
limit: numberOption(args.options.limit),
|
||||||
offset: numberOption(args.options.offset),
|
offset: numberOption(args.options.offset),
|
||||||
@@ -29279,6 +29285,9 @@ async function handleCorpsCommand(action, maybeName, args) {
|
|||||||
const corps = loadCorpConfigs();
|
const corps = loadCorpConfigs();
|
||||||
const globalConfig2 = loadGlobalConfig();
|
const globalConfig2 = loadGlobalConfig();
|
||||||
const currentCorpId = corpId ?? (globalConfig2.stateful ? globalConfig2.defaultCorpId ?? corps[0]?.id : undefined);
|
const currentCorpId = corpId ?? (globalConfig2.stateful ? globalConfig2.defaultCorpId ?? corps[0]?.id : undefined);
|
||||||
|
if (corps.length === 0) {
|
||||||
|
console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");
|
||||||
|
}
|
||||||
printJson(corps.map((item) => ({
|
printJson(corps.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
@@ -29556,7 +29565,7 @@ var openapi_default = {
|
|||||||
openapi: "3.1.0",
|
openapi: "3.1.0",
|
||||||
info: {
|
info: {
|
||||||
title: "seal-home Wrapped API",
|
title: "seal-home Wrapped API",
|
||||||
version: "0.7.0",
|
version: "0.8.0",
|
||||||
description: `Planned HTTP contract for the seal-home wrapped backend API.
|
description: `Planned HTTP contract for the seal-home wrapped backend API.
|
||||||
|
|
||||||
These endpoints describe the intended stable API for frontend developers and agents once
|
These endpoints describe the intended stable API for frontend developers and agents once
|
||||||
@@ -33283,13 +33292,13 @@ import { dirname as dirname3, join as join6 } from "node:path";
|
|||||||
// skills/seal-home/SKILL.md
|
// skills/seal-home/SKILL.md
|
||||||
var SKILL_default = `---
|
var SKILL_default = `---
|
||||||
name: seal-home
|
name: seal-home
|
||||||
description: "v0.7.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
description: "v0.8.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
||||||
metadata:
|
metadata:
|
||||||
version: 0.7.0
|
version: 0.8.0
|
||||||
short-description: Seal tenant and Hose approval automation (v0.7.0)
|
short-description: Seal tenant and Hose approval automation (v0.8.0)
|
||||||
---
|
---
|
||||||
|
|
||||||
# Seal Home (v0.7.0)
|
# Seal Home (v0.8.0)
|
||||||
|
|
||||||
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-home\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-home\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
||||||
|
|
||||||
@@ -34477,11 +34486,77 @@ async function handleUpdateCommand(runtime, options = {}) {
|
|||||||
version: VERSION,
|
version: VERSION,
|
||||||
launcher: runtime.launcher
|
launcher: runtime.launcher
|
||||||
};
|
};
|
||||||
if (!isCompiledBinary()) {
|
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||||
if (options.checkOnly) {
|
const rawTarget = options.targetVersion?.trim();
|
||||||
|
const targetVersion = rawTarget && rawTarget.toLowerCase() !== "latest" ? rawTarget : undefined;
|
||||||
|
if (targetVersion) {
|
||||||
|
const cleanTarget = targetVersion.replace(/^v/, "");
|
||||||
|
const cmp = compareSemVer(cleanTarget, VERSION);
|
||||||
|
if (cmp < 0) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
version: VERSION,
|
currentVersion: VERSION,
|
||||||
|
targetVersion: cleanTarget,
|
||||||
|
mode: isCompiledBinary() ? "binary" : "source",
|
||||||
|
message: `Cannot downgrade seal-home from v${VERSION} to older version v${cleanTarget}. Updates must be forward-only.`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmp === 0 && !options.force) {
|
||||||
|
printJson({
|
||||||
|
updated: false,
|
||||||
|
currentVersion: VERSION,
|
||||||
|
targetVersion: cleanTarget,
|
||||||
|
mode: isCompiledBinary() ? "binary" : "source",
|
||||||
|
message: `seal-home is already at version v${VERSION}. Use --force to reinstall.`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (options.changelogOnly) {
|
||||||
|
const releases2 = await fetchGitHubReleases(repo, options.limit ?? 10);
|
||||||
|
printJson({
|
||||||
|
currentVersion: VERSION,
|
||||||
|
totalQueried: releases2.length,
|
||||||
|
releases: releases2.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl,
|
||||||
|
isCurrent: r.version === VERSION,
|
||||||
|
isNewer: isNewerVersion(r.version, VERSION)
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isCompiledBinary()) {
|
||||||
|
if (options.checkOnly) {
|
||||||
|
const releases2 = await fetchGitHubReleases(repo, 30);
|
||||||
|
const latestRelease = releases2[0];
|
||||||
|
const latestVersion2 = latestRelease?.version ?? VERSION;
|
||||||
|
const currentRelease2 = releases2.find((r) => r.version === VERSION);
|
||||||
|
const isUpgrade2 = isNewerVersion(latestVersion2, VERSION);
|
||||||
|
const pendingReleases2 = releases2.filter((r) => isNewerVersion(r.version, VERSION));
|
||||||
|
printJson({
|
||||||
|
updated: false,
|
||||||
|
updateAvailable: isUpgrade2,
|
||||||
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease2?.publishedAt,
|
||||||
|
latestVersion: latestVersion2,
|
||||||
|
latestVersionPublishedAt: latestRelease?.publishedAt,
|
||||||
|
behindCount: pendingReleases2.length,
|
||||||
|
pendingReleases: pendingReleases2.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl
|
||||||
|
})),
|
||||||
|
releaseNotes: latestRelease?.notes ?? "",
|
||||||
|
releaseUrl: latestRelease?.htmlUrl ?? "",
|
||||||
mode: "source",
|
mode: "source",
|
||||||
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
||||||
});
|
});
|
||||||
@@ -34506,10 +34581,10 @@ async function handleUpdateCommand(runtime, options = {}) {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
|
||||||
const platform = detectPlatform();
|
const platform = detectPlatform();
|
||||||
const arch = detectArch();
|
const arch = detectArch();
|
||||||
const release = await fetchGitHubRelease(repo, options.targetVersion);
|
const releases = await fetchGitHubReleases(repo, 30);
|
||||||
|
const release = targetVersion ? releases.find((r) => r.version === targetVersion || r.tagName === targetVersion || r.tagName === `v${targetVersion}`) ?? await fetchGitHubRelease(repo, targetVersion) : releases[0] ?? await fetchGitHubRelease(repo);
|
||||||
if (!release) {
|
if (!release) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
@@ -34520,14 +34595,27 @@ async function handleUpdateCommand(runtime, options = {}) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const latestVersion = release.version;
|
const latestVersion = release.version;
|
||||||
|
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||||
const shouldUpdate = options.force || Boolean(options.targetVersion) || isUpgrade;
|
const shouldUpdate = isUpgrade || Boolean(options.force);
|
||||||
|
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||||
if (options.checkOnly) {
|
if (options.checkOnly) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
updateAvailable: isUpgrade,
|
updateAvailable: isUpgrade,
|
||||||
currentVersion: VERSION,
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
|
latestVersionPublishedAt: release.publishedAt,
|
||||||
|
behindCount: pendingReleases.length,
|
||||||
|
pendingReleases: pendingReleases.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl
|
||||||
|
})),
|
||||||
releaseNotes: release.notes,
|
releaseNotes: release.notes,
|
||||||
releaseUrl: release.htmlUrl,
|
releaseUrl: release.htmlUrl,
|
||||||
mode: "binary"
|
mode: "binary"
|
||||||
@@ -34538,7 +34626,9 @@ async function handleUpdateCommand(runtime, options = {}) {
|
|||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
currentVersion: VERSION,
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
|
latestVersionPublishedAt: release.publishedAt,
|
||||||
mode: "binary",
|
mode: "binary",
|
||||||
message: `seal-home is already up to date (v${VERSION})`
|
message: `seal-home is already up to date (v${VERSION})`
|
||||||
});
|
});
|
||||||
@@ -34607,40 +34697,96 @@ function detectPlatform() {
|
|||||||
function detectArch() {
|
function detectArch() {
|
||||||
return process.arch === "arm64" ? "arm64" : "x64";
|
return process.arch === "arm64" ? "arm64" : "x64";
|
||||||
}
|
}
|
||||||
async function fetchGitHubRelease(repo, targetVersion) {
|
async function fetchGitHubReleases(repo, limit = 20) {
|
||||||
const url2 = targetVersion ? `https://api.github.com/repos/${repo}/releases/tags/${targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`}` : `https://api.github.com/repos/${repo}/releases/latest`;
|
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||||
const headers = {
|
const headers = {
|
||||||
"User-Agent": `seal-home/${VERSION}`,
|
"User-Agent": `seal-home/${VERSION}`,
|
||||||
Accept: "application/vnd.github.v3+json"
|
Accept: "application/vnd.github.v3+json",
|
||||||
|
...token ? { Authorization: `Bearer ${token}` } : {}
|
||||||
};
|
};
|
||||||
|
const urls = [
|
||||||
|
`https://api.github.com/repos/${repo}/releases?per_page=${limit}`,
|
||||||
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases?per_page=${limit}`
|
||||||
|
];
|
||||||
|
for (const url2 of urls) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(url2, { headers, signal: AbortSignal.timeout(5000) });
|
||||||
|
if (!res.ok)
|
||||||
|
continue;
|
||||||
|
const json2 = await res.json();
|
||||||
|
if (!Array.isArray(json2) || json2.length === 0)
|
||||||
|
continue;
|
||||||
|
const list = [];
|
||||||
|
for (const item of json2) {
|
||||||
|
const tagName = item.tag_name ?? "";
|
||||||
|
const version2 = tagName.replace(/^v/, "");
|
||||||
|
if (!version2)
|
||||||
|
continue;
|
||||||
|
const assets = (item.assets ?? []).map((a) => ({
|
||||||
|
name: a.name,
|
||||||
|
downloadUrl: a.browser_download_url,
|
||||||
|
size: a.size ?? 0
|
||||||
|
}));
|
||||||
|
list.push({
|
||||||
|
version: version2,
|
||||||
|
tagName,
|
||||||
|
name: item.name ?? tagName,
|
||||||
|
publishedAt: item.published_at,
|
||||||
|
author: item.author?.login,
|
||||||
|
notes: item.body ?? "",
|
||||||
|
htmlUrl: item.html_url ?? "",
|
||||||
|
assets
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (list.length > 0)
|
||||||
|
return list;
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
async function fetchGitHubRelease(repo, targetVersion) {
|
||||||
|
const tag = targetVersion ? targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}` : undefined;
|
||||||
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||||
if (token) {
|
const headers = {
|
||||||
headers.Authorization = `Bearer ${token}`;
|
"User-Agent": `seal-home/${VERSION}`,
|
||||||
}
|
Accept: "application/vnd.github.v3+json",
|
||||||
try {
|
...token ? { Authorization: `Bearer ${token}` } : {}
|
||||||
const res = await fetch(url2, { headers });
|
};
|
||||||
if (!res.ok)
|
const urls = tag ? [
|
||||||
return;
|
`https://api.github.com/repos/${repo}/releases/tags/${tag}`,
|
||||||
const json2 = await res.json();
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/tags/${tag}`
|
||||||
const tagName = json2.tag_name ?? "";
|
] : [
|
||||||
const version2 = tagName.replace(/^v/, "");
|
`https://api.github.com/repos/${repo}/releases/latest`,
|
||||||
if (!version2)
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/latest`
|
||||||
return;
|
];
|
||||||
const assets = (json2.assets ?? []).map((item) => ({
|
for (const url2 of urls) {
|
||||||
name: item.name,
|
try {
|
||||||
downloadUrl: item.browser_download_url,
|
const res = await fetch(url2, { headers, signal: AbortSignal.timeout(5000) });
|
||||||
size: item.size ?? 0
|
if (!res.ok)
|
||||||
}));
|
continue;
|
||||||
return {
|
const json2 = await res.json();
|
||||||
version: version2,
|
const tagName = json2.tag_name ?? "";
|
||||||
tagName,
|
const version2 = tagName.replace(/^v/, "");
|
||||||
notes: json2.body ?? "",
|
if (!version2)
|
||||||
htmlUrl: json2.html_url ?? "",
|
continue;
|
||||||
assets
|
const assets = (json2.assets ?? []).map((item) => ({
|
||||||
};
|
name: item.name,
|
||||||
} catch {
|
downloadUrl: item.browser_download_url,
|
||||||
return;
|
size: item.size ?? 0
|
||||||
|
}));
|
||||||
|
return {
|
||||||
|
version: version2,
|
||||||
|
tagName,
|
||||||
|
name: json2.name ?? tagName,
|
||||||
|
publishedAt: json2.published_at,
|
||||||
|
author: json2.author?.login,
|
||||||
|
notes: json2.body ?? "",
|
||||||
|
htmlUrl: json2.html_url ?? "",
|
||||||
|
assets
|
||||||
|
};
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
function matchAssetForPlatform(assets, platform, arch) {
|
function matchAssetForPlatform(assets, platform, arch) {
|
||||||
const platformKeywords = {
|
const platformKeywords = {
|
||||||
@@ -34667,12 +34813,25 @@ function matchAssetForPlatform(assets, platform, arch) {
|
|||||||
return archive || matched[0];
|
return archive || matched[0];
|
||||||
}
|
}
|
||||||
async function downloadFile(url2, destPath) {
|
async function downloadFile(url2, destPath) {
|
||||||
const res = await fetch(url2);
|
const candidates = [url2];
|
||||||
if (!res.ok) {
|
if (url2.includes("github.com")) {
|
||||||
throw new Error(`Failed to download asset from ${url2}: ${res.status} ${res.statusText}`);
|
candidates.push(`https://ghfast.top/${url2}`);
|
||||||
}
|
}
|
||||||
const buffer = Buffer.from(await res.arrayBuffer());
|
let lastError;
|
||||||
writeFileSync7(destPath, buffer);
|
for (const candidate of candidates) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(candidate, { signal: AbortSignal.timeout(15000) });
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
||||||
|
}
|
||||||
|
const buffer = Buffer.from(await res.arrayBuffer());
|
||||||
|
writeFileSync7(destPath, buffer);
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
lastError = err instanceof Error ? err : new Error(String(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Failed to download asset from ${url2}: ${lastError?.message}`);
|
||||||
}
|
}
|
||||||
function extractTarGz(archivePath, targetDir, platform) {
|
function extractTarGz(archivePath, targetDir, platform) {
|
||||||
const result = spawnSync("tar", ["-xzf", archivePath, "-C", targetDir], { stdio: "pipe" });
|
const result = spawnSync("tar", ["-xzf", archivePath, "-C", targetDir], { stdio: "pipe" });
|
||||||
@@ -34702,18 +34861,21 @@ function extractZip(archivePath, targetDir, platform) {
|
|||||||
return exact;
|
return exact;
|
||||||
return files[0] || archivePath;
|
return files[0] || archivePath;
|
||||||
}
|
}
|
||||||
function isNewerVersion(latest, current) {
|
function compareSemVer(v1, v2) {
|
||||||
const lParts = latest.split(".").map(Number);
|
const p1 = v1.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0);
|
||||||
const cParts = current.split(".").map(Number);
|
const p2 = v2.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0);
|
||||||
for (let i = 0;i < Math.max(lParts.length, cParts.length); i++) {
|
for (let i = 0;i < Math.max(p1.length, p2.length); i++) {
|
||||||
const l = lParts[i] ?? 0;
|
const a = p1[i] ?? 0;
|
||||||
const c = cParts[i] ?? 0;
|
const b = p2[i] ?? 0;
|
||||||
if (l > c)
|
if (a > b)
|
||||||
return true;
|
return 1;
|
||||||
if (l < c)
|
if (a < b)
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
return false;
|
return 0;
|
||||||
|
}
|
||||||
|
function isNewerVersion(latest, current) {
|
||||||
|
return compareSemVer(latest, current) > 0;
|
||||||
}
|
}
|
||||||
function runCommand(command, args, options = {}) {
|
function runCommand(command, args, options = {}) {
|
||||||
const result = spawnSync(command, args, {
|
const result = spawnSync(command, args, {
|
||||||
@@ -34891,7 +35053,8 @@ var KNOWN_AREAS = new Set([
|
|||||||
"mcp-config",
|
"mcp-config",
|
||||||
"skill",
|
"skill",
|
||||||
"openapi",
|
"openapi",
|
||||||
"probe"
|
"probe",
|
||||||
|
"changelog"
|
||||||
]);
|
]);
|
||||||
var runQueue = Promise.resolve();
|
var runQueue = Promise.resolve();
|
||||||
function runCli(argv, options = {}) {
|
function runCli(argv, options = {}) {
|
||||||
@@ -34985,10 +35148,14 @@ async function dispatch(argv, runtime) {
|
|||||||
await handleServiceCommand(action, runtime);
|
await handleServiceCommand(action, runtime);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (area === "update") {
|
if (area === "update" || area === "changelog") {
|
||||||
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (action && !action.startsWith("-") ? action : undefined);
|
const isChangelog = area === "changelog" || action === "changelog" || action === "log" || action === "history" || booleanOption(args.options.changelog) === true;
|
||||||
|
const isCheck = action === "check" || booleanOption(args.options.check) === true || booleanOption(args.options["check-only"]) === true;
|
||||||
|
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (!isChangelog && !isCheck && action && !action.startsWith("-") ? action : undefined);
|
||||||
await handleUpdateCommand(runtime, {
|
await handleUpdateCommand(runtime, {
|
||||||
checkOnly: booleanOption(args.options.check) ?? booleanOption(args.options["check-only"]),
|
checkOnly: isCheck,
|
||||||
|
changelogOnly: isChangelog,
|
||||||
|
limit: numberOption(args.options.limit),
|
||||||
force: booleanOption(args.options.force),
|
force: booleanOption(args.options.force),
|
||||||
targetVersion,
|
targetVersion,
|
||||||
repo: stringOption(args.options.repo)
|
repo: stringOption(args.options.repo)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"openapi": "3.1.0",
|
"openapi": "3.1.0",
|
||||||
"info": {
|
"info": {
|
||||||
"title": "seal-home Wrapped API",
|
"title": "seal-home Wrapped API",
|
||||||
"version": "0.7.0",
|
"version": "0.8.0",
|
||||||
"description": "Planned HTTP contract for the seal-home wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-home is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
|
"description": "Planned HTTP contract for the seal-home wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-home is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
openapi: 3.1.0
|
openapi: 3.1.0
|
||||||
info:
|
info:
|
||||||
title: seal-home Wrapped API
|
title: seal-home Wrapped API
|
||||||
version: 0.7.0
|
version: 0.8.0
|
||||||
description: |
|
description: |
|
||||||
Planned HTTP contract for the seal-home wrapped backend API.
|
Planned HTTP contract for the seal-home wrapped backend API.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "seal-home",
|
"name": "seal-home",
|
||||||
"version": "0.7.0",
|
"version": "0.8.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"module": "src/server.ts",
|
"module": "src/server.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
Executable
+117
@@ -0,0 +1,117 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
REPO="yunyingk/seal-home"
|
||||||
|
|
||||||
|
echo "==> Detecting platform and architecture..."
|
||||||
|
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
|
||||||
|
case "$OS" in
|
||||||
|
darwin)
|
||||||
|
PLATFORM="darwin"
|
||||||
|
;;
|
||||||
|
linux)
|
||||||
|
PLATFORM="linux"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported operating system: $OS" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$ARCH" in
|
||||||
|
x86_64|amd64)
|
||||||
|
ARCH_NAME="x64"
|
||||||
|
;;
|
||||||
|
arm64|aarch64)
|
||||||
|
ARCH_NAME="arm64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported architecture: $ARCH" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Resolve best writable bin directory without requiring sudo
|
||||||
|
TARGET_DIR=""
|
||||||
|
for candidate in "/opt/homebrew/bin" "/usr/local/bin" "$HOME/.local/bin" "$HOME/bin"; do
|
||||||
|
if [ -d "$candidate" ] && [ -w "$candidate" ]; then
|
||||||
|
TARGET_DIR="$candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$TARGET_DIR" ]; then
|
||||||
|
mkdir -p "$HOME/.local/bin"
|
||||||
|
TARGET_DIR="$HOME/.local/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ASSET_NAME="seal-home-${PLATFORM}-${ARCH_NAME}"
|
||||||
|
TARGET_PATH="${TARGET_DIR}/seal-home"
|
||||||
|
|
||||||
|
echo "==> Downloading seal-home (${PLATFORM}-${ARCH_NAME}) into ${TARGET_DIR}..."
|
||||||
|
TMP_FILE="$(mktemp)"
|
||||||
|
DOWNLOAD_SUCCESS=false
|
||||||
|
|
||||||
|
# Multi-source candidate mirrors
|
||||||
|
GITEA_BASE="https://git.ying-qing.cn/gitea/seal-home"
|
||||||
|
GITHUB_BASE="https://github.com/${REPO}"
|
||||||
|
GHPROXY_BASE="https://ghfast.top/https://github.com/${REPO}"
|
||||||
|
|
||||||
|
# 1. Check Gitea mirror if responsive
|
||||||
|
if [ "${SEAL_HOME_MIRROR:-auto}" = "gitea" ] || [ "${SEAL_HOME_MIRROR:-auto}" = "auto" ]; then
|
||||||
|
if curl -s --connect-timeout 2 -I "https://git.ying-qing.cn" >/dev/null 2>&1; then
|
||||||
|
GITEA_URL="${GITEA_BASE}/releases/download/latest/${ASSET_NAME}"
|
||||||
|
if curl -fL --connect-timeout 4 "$GITEA_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||||
|
echo "✓ Downloaded from high-speed mirror (git.ying-qing.cn)"
|
||||||
|
DOWNLOAD_SUCCESS=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Try direct GitHub
|
||||||
|
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||||
|
GITHUB_URL="${GITHUB_BASE}/releases/latest/download/${ASSET_NAME}"
|
||||||
|
if curl -fL --connect-timeout 6 "$GITHUB_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||||
|
echo "✓ Downloaded from GitHub Releases"
|
||||||
|
DOWNLOAD_SUCCESS=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 3. Fallback to GitHub CDN proxy
|
||||||
|
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||||
|
GHPROXY_URL="${GHPROXY_BASE}/releases/latest/download/${ASSET_NAME}"
|
||||||
|
echo "==> Trying CDN fallback mirror..."
|
||||||
|
if curl -fL "$GHPROXY_URL" -o "$TMP_FILE" 2>/dev/null; then
|
||||||
|
echo "✓ Downloaded from CDN mirror"
|
||||||
|
DOWNLOAD_SUCCESS=true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$DOWNLOAD_SUCCESS" = "false" ]; then
|
||||||
|
echo "Error: Failed to download ${ASSET_NAME} from any available mirror." >&2
|
||||||
|
rm -f "$TMP_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x "$TMP_FILE"
|
||||||
|
mv "$TMP_FILE" "$TARGET_PATH"
|
||||||
|
|
||||||
|
# Ad-hoc sign on macOS
|
||||||
|
if [ "$PLATFORM" = "darwin" ] && command -v codesign >/dev/null 2>&1; then
|
||||||
|
codesign --force --sign - "$TARGET_PATH" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Initializing agent skill..."
|
||||||
|
"$TARGET_PATH" skill install >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "✨ seal-home successfully installed to ${TARGET_PATH}!"
|
||||||
|
"$TARGET_PATH" version
|
||||||
|
echo ""
|
||||||
|
echo "Quick start:"
|
||||||
|
echo " 1. Add enterprise: seal-home corps add-hose --json '{...}'"
|
||||||
|
echo " 2. View MCP config: seal-home mcp-config"
|
||||||
|
echo " 3. Self-update: seal-home update"
|
||||||
|
echo ""
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: seal-home
|
name: seal-home
|
||||||
description: "v0.7.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
description: "v0.8.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
||||||
metadata:
|
metadata:
|
||||||
version: 0.7.0
|
version: 0.8.0
|
||||||
short-description: Seal tenant and Hose approval automation (v0.7.0)
|
short-description: Seal tenant and Hose approval automation (v0.8.0)
|
||||||
---
|
---
|
||||||
|
|
||||||
# Seal Home (v0.7.0)
|
# Seal Home (v0.8.0)
|
||||||
|
|
||||||
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
||||||
|
|
||||||
|
|||||||
@@ -165,6 +165,44 @@ describe("CLI version & help handling", () => {
|
|||||||
expect(parsed.info.title).toContain("seal-home");
|
expect(parsed.info.title).toContain("seal-home");
|
||||||
expect(parsed.paths).toHaveProperty("/v1/corps");
|
expect(parsed.paths).toHaveProperty("/v1/corps");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("update check subcommand outputs structured check payload", () => {
|
||||||
|
const result = runCli(["update", "check"]);
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
const parsed = JSON.parse(result.stdout.trim());
|
||||||
|
expect(parsed).toHaveProperty("currentVersion");
|
||||||
|
expect(parsed).toHaveProperty("latestVersion");
|
||||||
|
expect(parsed).toHaveProperty("updateAvailable");
|
||||||
|
expect(parsed).toHaveProperty("behindCount");
|
||||||
|
expect(parsed).toHaveProperty("pendingReleases");
|
||||||
|
expect(Array.isArray(parsed.pendingReleases)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("changelog command outputs release history list", () => {
|
||||||
|
const result = runCli(["changelog", "--limit", "5"]);
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
const parsed = JSON.parse(result.stdout.trim());
|
||||||
|
expect(parsed.currentVersion).toBe(VERSION);
|
||||||
|
expect(Array.isArray(parsed.releases)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("rejects downgrade to older version when target version is lower", () => {
|
||||||
|
const result = runCli(["update", "0.3.3"]);
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
const parsed = JSON.parse(result.stdout.trim());
|
||||||
|
expect(parsed.updated).toBe(false);
|
||||||
|
expect(parsed.currentVersion).toBe(VERSION);
|
||||||
|
expect(parsed.targetVersion).toBe("0.3.3");
|
||||||
|
expect(parsed.message).toContain("Cannot downgrade seal-home");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("treats latest keyword as latest release without downgrade error", () => {
|
||||||
|
const result = runCli(["update", "latest", "--check"]);
|
||||||
|
expect(result.status).toBe(0);
|
||||||
|
const parsed = JSON.parse(result.stdout.trim());
|
||||||
|
expect(parsed).toHaveProperty("latestVersion");
|
||||||
|
expect(parsed.updated).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function makeConfigEnv(): Record<string, string> {
|
function makeConfigEnv(): Record<string, string> {
|
||||||
|
|||||||
+19
-2
@@ -4,6 +4,13 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { runCli } from "./cli/runner.js";
|
import { runCli } from "./cli/runner.js";
|
||||||
import { isCompiledBinary, resolveAppRoot, resolveDefaultLauncher } from "./core/runtime.js";
|
import { isCompiledBinary, resolveAppRoot, resolveDefaultLauncher } from "./core/runtime.js";
|
||||||
|
|
||||||
|
process.stdout.on("error", (err: any) => {
|
||||||
|
if (err?.code === "EPIPE") process.exit(0);
|
||||||
|
});
|
||||||
|
process.stderr.on("error", (err: any) => {
|
||||||
|
if (err?.code === "EPIPE") process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
const entryFile = fileURLToPath(import.meta.url);
|
const entryFile = fileURLToPath(import.meta.url);
|
||||||
const isCompiled = isCompiledBinary();
|
const isCompiled = isCompiledBinary();
|
||||||
const appRoot = resolveAppRoot(entryFile, isCompiled);
|
const appRoot = resolveAppRoot(entryFile, isCompiled);
|
||||||
@@ -15,6 +22,16 @@ const result = await runCli(Bun.argv.slice(2), {
|
|||||||
launcher
|
launcher
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.stdout) process.stdout.write(result.stdout);
|
try {
|
||||||
if (result.stderr) process.stderr.write(`${result.stderr}${result.stderr.endsWith("\n") ? "" : "\n"}`);
|
if (result.stdout) process.stdout.write(result.stdout);
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err?.code !== "EPIPE") throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (result.stderr) process.stderr.write(`${result.stderr}${result.stderr.endsWith("\n") ? "" : "\n"}`);
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err?.code !== "EPIPE") throw err;
|
||||||
|
}
|
||||||
|
|
||||||
process.exitCode = result.exitCode;
|
process.exitCode = result.exitCode;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { CorpConfig } from "../../core/config/types.js";
|
import type { CorpConfig } from "../../core/config/types.js";
|
||||||
import type { createSealClient } from "../../core/http/factory.js";
|
import type { createSealClient } from "../../core/http/factory.js";
|
||||||
import { runTool } from "../helpers.js";
|
import { runTool, runToolResult } from "../helpers.js";
|
||||||
import { booleanOption, numberOption, stringOption } from "../parser.js";
|
import { booleanOption, numberOption, stringOption } from "../parser.js";
|
||||||
import { outputOptions } from "../printer.js";
|
import { outputOptions, printJson } from "../printer.js";
|
||||||
import type { ParsedArgs } from "../types.js";
|
import type { ParsedArgs } from "../types.js";
|
||||||
|
|
||||||
export async function handleApprovalRunsCommand(
|
export async function handleApprovalRunsCommand(
|
||||||
@@ -13,7 +13,7 @@ export async function handleApprovalRunsCommand(
|
|||||||
args: ParsedArgs
|
args: ParsedArgs
|
||||||
) {
|
) {
|
||||||
if (action === "summary") {
|
if (action === "summary") {
|
||||||
await runTool(
|
const result = await runToolResult(
|
||||||
"seal_approval_runs_summary",
|
"seal_approval_runs_summary",
|
||||||
client,
|
client,
|
||||||
corp,
|
corp,
|
||||||
@@ -30,13 +30,18 @@ export async function handleApprovalRunsCommand(
|
|||||||
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
sourceDocumentId: stringOption(args.options.sourceDocumentId),
|
||||||
humanResult: stringOption(args.options.humanResult),
|
humanResult: stringOption(args.options.humanResult),
|
||||||
query: stringOption(args.options.query)
|
query: stringOption(args.options.query)
|
||||||
},
|
}
|
||||||
outputOptions(args.options)
|
|
||||||
);
|
);
|
||||||
|
if ((result as any)?.matched === 0 && (result as any)?.total > 0) {
|
||||||
|
console.error(
|
||||||
|
`提示:在 ${(result as any).date} 未匹配到记录(该企业共有 ${(result as any).total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-home approval-runs list --limit 10 查看最近记录。`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
printJson(result, outputOptions(args.options));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === "search") {
|
if (action === "search" || action === "list") {
|
||||||
await runTool(
|
await runTool(
|
||||||
"seal_approval_runs_search",
|
"seal_approval_runs_search",
|
||||||
client,
|
client,
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
|
|||||||
? globalConfig.defaultCorpId ?? corps[0]?.id
|
? globalConfig.defaultCorpId ?? corps[0]?.id
|
||||||
: undefined
|
: undefined
|
||||||
);
|
);
|
||||||
|
if (corps.length === 0) {
|
||||||
|
console.error("提示:当前未检测到企业配置。你可以使用 seal-home corps add-hose 或 seal-home corps add-seal 添加企业,或运行 seal-home help 查看说明。");
|
||||||
|
}
|
||||||
printJson(corps.map((item) => ({
|
printJson(corps.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, test } from "bun:test";
|
import { describe, expect, test } from "bun:test";
|
||||||
import { isNewerVersion } from "./update.js";
|
import { compareSemVer, isNewerVersion } from "./update.js";
|
||||||
|
|
||||||
describe("update version comparator", () => {
|
describe("update version comparator", () => {
|
||||||
test("correctly identifies newer semantic versions", () => {
|
test("correctly identifies newer semantic versions", () => {
|
||||||
@@ -10,4 +10,12 @@ describe("update version comparator", () => {
|
|||||||
expect(isNewerVersion("0.5.9", "0.6.0")).toBe(false);
|
expect(isNewerVersion("0.5.9", "0.6.0")).toBe(false);
|
||||||
expect(isNewerVersion("0.6.0", "0.7.0")).toBe(false);
|
expect(isNewerVersion("0.6.0", "0.7.0")).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("compareSemVer handles tags, major, minor, and patch", () => {
|
||||||
|
expect(compareSemVer("v0.7.1", "0.7.0")).toBe(1);
|
||||||
|
expect(compareSemVer("0.7.0", "v0.7.1")).toBe(-1);
|
||||||
|
expect(compareSemVer("v0.7.1", "v0.7.1")).toBe(0);
|
||||||
|
expect(compareSemVer("1.0.0", "0.9.9")).toBe(1);
|
||||||
|
expect(compareSemVer("0.3.3", "0.7.1")).toBe(-1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
+248
-60
@@ -15,6 +15,8 @@ const GITHUB_REPO_ENV = "SEAL_HOME_GITHUB_REPO";
|
|||||||
|
|
||||||
export type UpdateOptions = {
|
export type UpdateOptions = {
|
||||||
checkOnly?: boolean;
|
checkOnly?: boolean;
|
||||||
|
changelogOnly?: boolean;
|
||||||
|
limit?: number;
|
||||||
force?: boolean;
|
force?: boolean;
|
||||||
targetVersion?: string;
|
targetVersion?: string;
|
||||||
repo?: string;
|
repo?: string;
|
||||||
@@ -29,12 +31,84 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
|||||||
launcher: runtime.launcher
|
launcher: runtime.launcher
|
||||||
};
|
};
|
||||||
|
|
||||||
// 1. Source development mode (running via bun/node)
|
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
||||||
if (!isCompiledBinary()) {
|
const rawTarget = options.targetVersion?.trim();
|
||||||
if (options.checkOnly) {
|
const targetVersion = rawTarget && rawTarget.toLowerCase() !== "latest" ? rawTarget : undefined;
|
||||||
|
|
||||||
|
// Validate targetVersion: prevent downgrade to older versions
|
||||||
|
if (targetVersion) {
|
||||||
|
const cleanTarget = targetVersion.replace(/^v/, "");
|
||||||
|
const cmp = compareSemVer(cleanTarget, VERSION);
|
||||||
|
if (cmp < 0) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
version: VERSION,
|
currentVersion: VERSION,
|
||||||
|
targetVersion: cleanTarget,
|
||||||
|
mode: isCompiledBinary() ? "binary" : "source",
|
||||||
|
message: `Cannot downgrade seal-home from v${VERSION} to older version v${cleanTarget}. Updates must be forward-only.`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmp === 0 && !options.force) {
|
||||||
|
printJson({
|
||||||
|
updated: false,
|
||||||
|
currentVersion: VERSION,
|
||||||
|
targetVersion: cleanTarget,
|
||||||
|
mode: isCompiledBinary() ? "binary" : "source",
|
||||||
|
message: `seal-home is already at version v${VERSION}. Use --force to reinstall.`
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. Changelog / Release History query
|
||||||
|
if (options.changelogOnly) {
|
||||||
|
const releases = await fetchGitHubReleases(repo, options.limit ?? 10);
|
||||||
|
printJson({
|
||||||
|
currentVersion: VERSION,
|
||||||
|
totalQueried: releases.length,
|
||||||
|
releases: releases.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl,
|
||||||
|
isCurrent: r.version === VERSION,
|
||||||
|
isNewer: isNewerVersion(r.version, VERSION)
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Source development mode (running via bun/node)
|
||||||
|
if (!isCompiledBinary()) {
|
||||||
|
if (options.checkOnly) {
|
||||||
|
const releases = await fetchGitHubReleases(repo, 30);
|
||||||
|
const latestRelease = releases[0];
|
||||||
|
const latestVersion = latestRelease?.version ?? VERSION;
|
||||||
|
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||||
|
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||||
|
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||||
|
|
||||||
|
printJson({
|
||||||
|
updated: false,
|
||||||
|
updateAvailable: isUpgrade,
|
||||||
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||||
|
latestVersion,
|
||||||
|
latestVersionPublishedAt: latestRelease?.publishedAt,
|
||||||
|
behindCount: pendingReleases.length,
|
||||||
|
pendingReleases: pendingReleases.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl
|
||||||
|
})),
|
||||||
|
releaseNotes: latestRelease?.notes ?? "",
|
||||||
|
releaseUrl: latestRelease?.htmlUrl ?? "",
|
||||||
mode: "source",
|
mode: "source",
|
||||||
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
message: "Running in source development mode. Run 'seal-home update' to git pull & bun install."
|
||||||
});
|
});
|
||||||
@@ -62,12 +136,16 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Standalone binary mode: check GitHub Releases
|
// 3. Standalone binary mode: check GitHub Releases
|
||||||
const repo = options.repo || process.env[GITHUB_REPO_ENV]?.trim() || DEFAULT_GITHUB_REPO;
|
|
||||||
const platform = detectPlatform();
|
const platform = detectPlatform();
|
||||||
const arch = detectArch();
|
const arch = detectArch();
|
||||||
|
|
||||||
const release = await fetchGitHubRelease(repo, options.targetVersion);
|
const releases = await fetchGitHubReleases(repo, 30);
|
||||||
|
const release = targetVersion
|
||||||
|
? (releases.find((r) => r.version === targetVersion || r.tagName === targetVersion || r.tagName === `v${targetVersion}`) ??
|
||||||
|
await fetchGitHubRelease(repo, targetVersion))
|
||||||
|
: (releases[0] ?? await fetchGitHubRelease(repo));
|
||||||
|
|
||||||
if (!release) {
|
if (!release) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
@@ -79,15 +157,28 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
|||||||
}
|
}
|
||||||
|
|
||||||
const latestVersion = release.version;
|
const latestVersion = release.version;
|
||||||
|
const currentRelease = releases.find((r) => r.version === VERSION);
|
||||||
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
const isUpgrade = isNewerVersion(latestVersion, VERSION);
|
||||||
const shouldUpdate = options.force || Boolean(options.targetVersion) || isUpgrade;
|
const shouldUpdate = isUpgrade || Boolean(options.force);
|
||||||
|
const pendingReleases = releases.filter((r) => isNewerVersion(r.version, VERSION));
|
||||||
|
|
||||||
if (options.checkOnly) {
|
if (options.checkOnly) {
|
||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
updateAvailable: isUpgrade,
|
updateAvailable: isUpgrade,
|
||||||
currentVersion: VERSION,
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
|
latestVersionPublishedAt: release.publishedAt,
|
||||||
|
behindCount: pendingReleases.length,
|
||||||
|
pendingReleases: pendingReleases.map((r) => ({
|
||||||
|
version: r.version,
|
||||||
|
tagName: r.tagName,
|
||||||
|
publishedAt: r.publishedAt,
|
||||||
|
author: r.author,
|
||||||
|
releaseNotes: r.notes,
|
||||||
|
releaseUrl: r.htmlUrl
|
||||||
|
})),
|
||||||
releaseNotes: release.notes,
|
releaseNotes: release.notes,
|
||||||
releaseUrl: release.htmlUrl,
|
releaseUrl: release.htmlUrl,
|
||||||
mode: "binary"
|
mode: "binary"
|
||||||
@@ -99,7 +190,9 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
|
|||||||
printJson({
|
printJson({
|
||||||
updated: false,
|
updated: false,
|
||||||
currentVersion: VERSION,
|
currentVersion: VERSION,
|
||||||
|
currentVersionPublishedAt: currentRelease?.publishedAt,
|
||||||
latestVersion,
|
latestVersion,
|
||||||
|
latestVersionPublishedAt: release.publishedAt,
|
||||||
mode: "binary",
|
mode: "binary",
|
||||||
message: `seal-home is already up to date (v${VERSION})`
|
message: `seal-home is already up to date (v${VERSION})`
|
||||||
});
|
});
|
||||||
@@ -200,56 +293,132 @@ type GitHubAsset = {
|
|||||||
type GitHubRelease = {
|
type GitHubRelease = {
|
||||||
version: string;
|
version: string;
|
||||||
tagName: string;
|
tagName: string;
|
||||||
|
name?: string;
|
||||||
|
publishedAt?: string;
|
||||||
|
author?: string;
|
||||||
notes: string;
|
notes: string;
|
||||||
htmlUrl: string;
|
htmlUrl: string;
|
||||||
assets: GitHubAsset[];
|
assets: GitHubAsset[];
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise<GitHubRelease | undefined> {
|
async function fetchGitHubReleases(repo: string, limit = 20): Promise<GitHubRelease[]> {
|
||||||
const url = targetVersion
|
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||||
? `https://api.github.com/repos/${repo}/releases/tags/${targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`}`
|
|
||||||
: `https://api.github.com/repos/${repo}/releases/latest`;
|
|
||||||
|
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
"User-Agent": `seal-home/${VERSION}`,
|
"User-Agent": `seal-home/${VERSION}`,
|
||||||
Accept: "application/vnd.github.v3+json"
|
Accept: "application/vnd.github.v3+json",
|
||||||
|
...(token ? { Authorization: `Bearer ${token}` } : {})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const urls = [
|
||||||
|
`https://api.github.com/repos/${repo}/releases?per_page=${limit}`,
|
||||||
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases?per_page=${limit}`
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const url of urls) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(url, { headers, signal: AbortSignal.timeout(5000) });
|
||||||
|
if (!res.ok) continue;
|
||||||
|
const json = (await res.json()) as Array<{
|
||||||
|
tag_name?: string;
|
||||||
|
name?: string;
|
||||||
|
body?: string;
|
||||||
|
html_url?: string;
|
||||||
|
published_at?: string;
|
||||||
|
author?: { login?: string };
|
||||||
|
assets?: Array<{ name: string; browser_download_url: string; size?: number }>;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
if (!Array.isArray(json) || json.length === 0) continue;
|
||||||
|
|
||||||
|
const list: GitHubRelease[] = [];
|
||||||
|
for (const item of json) {
|
||||||
|
const tagName = item.tag_name ?? "";
|
||||||
|
const version = tagName.replace(/^v/, "");
|
||||||
|
if (!version) continue;
|
||||||
|
const assets: GitHubAsset[] = (item.assets ?? []).map((a) => ({
|
||||||
|
name: a.name,
|
||||||
|
downloadUrl: a.browser_download_url,
|
||||||
|
size: a.size ?? 0
|
||||||
|
}));
|
||||||
|
list.push({
|
||||||
|
version,
|
||||||
|
tagName,
|
||||||
|
name: item.name ?? tagName,
|
||||||
|
publishedAt: item.published_at,
|
||||||
|
author: item.author?.login,
|
||||||
|
notes: item.body ?? "",
|
||||||
|
htmlUrl: item.html_url ?? "",
|
||||||
|
assets
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (list.length > 0) return list;
|
||||||
|
} catch {
|
||||||
|
// try next source
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchGitHubRelease(repo: string, targetVersion?: string): Promise<GitHubRelease | undefined> {
|
||||||
|
const tag = targetVersion ? (targetVersion.startsWith("v") ? targetVersion : `v${targetVersion}`) : undefined;
|
||||||
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
|
||||||
if (token) {
|
const headers: Record<string, string> = {
|
||||||
headers.Authorization = `Bearer ${token}`;
|
"User-Agent": `seal-home/${VERSION}`,
|
||||||
|
Accept: "application/vnd.github.v3+json",
|
||||||
|
...(token ? { Authorization: `Bearer ${token}` } : {})
|
||||||
|
};
|
||||||
|
|
||||||
|
const urls = tag
|
||||||
|
? [
|
||||||
|
`https://api.github.com/repos/${repo}/releases/tags/${tag}`,
|
||||||
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/tags/${tag}`
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
`https://api.github.com/repos/${repo}/releases/latest`,
|
||||||
|
`https://git.ying-qing.cn/api/v1/repos/gitea/seal-home/releases/latest`
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const url of urls) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(url, { headers, signal: AbortSignal.timeout(5000) });
|
||||||
|
if (!res.ok) continue;
|
||||||
|
const json = (await res.json()) as {
|
||||||
|
tag_name?: string;
|
||||||
|
name?: string;
|
||||||
|
body?: string;
|
||||||
|
html_url?: string;
|
||||||
|
published_at?: string;
|
||||||
|
author?: { login?: string };
|
||||||
|
assets?: Array<{ name: string; browser_download_url: string; size?: number }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const tagName = json.tag_name ?? "";
|
||||||
|
const version = tagName.replace(/^v/, "");
|
||||||
|
if (!version) continue;
|
||||||
|
|
||||||
|
const assets: GitHubAsset[] = (json.assets ?? []).map((item) => ({
|
||||||
|
name: item.name,
|
||||||
|
downloadUrl: item.browser_download_url,
|
||||||
|
size: item.size ?? 0
|
||||||
|
}));
|
||||||
|
|
||||||
|
return {
|
||||||
|
version,
|
||||||
|
tagName,
|
||||||
|
name: json.name ?? tagName,
|
||||||
|
publishedAt: json.published_at,
|
||||||
|
author: json.author?.login,
|
||||||
|
notes: json.body ?? "",
|
||||||
|
htmlUrl: json.html_url ?? "",
|
||||||
|
assets
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
// try next source
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
return undefined;
|
||||||
const res = await fetch(url, { headers });
|
|
||||||
if (!res.ok) return undefined;
|
|
||||||
const json = (await res.json()) as {
|
|
||||||
tag_name?: string;
|
|
||||||
body?: string;
|
|
||||||
html_url?: string;
|
|
||||||
assets?: Array<{ name: string; browser_download_url: string; size?: number }>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const tagName = json.tag_name ?? "";
|
|
||||||
const version = tagName.replace(/^v/, "");
|
|
||||||
if (!version) return undefined;
|
|
||||||
|
|
||||||
const assets: GitHubAsset[] = (json.assets ?? []).map((item) => ({
|
|
||||||
name: item.name,
|
|
||||||
downloadUrl: item.browser_download_url,
|
|
||||||
size: item.size ?? 0
|
|
||||||
}));
|
|
||||||
|
|
||||||
return {
|
|
||||||
version,
|
|
||||||
tagName,
|
|
||||||
notes: json.body ?? "",
|
|
||||||
htmlUrl: json.html_url ?? "",
|
|
||||||
assets
|
|
||||||
};
|
|
||||||
} catch {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function matchAssetForPlatform(
|
function matchAssetForPlatform(
|
||||||
@@ -291,12 +460,27 @@ function matchAssetForPlatform(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function downloadFile(url: string, destPath: string) {
|
async function downloadFile(url: string, destPath: string) {
|
||||||
const res = await fetch(url);
|
const candidates = [url];
|
||||||
if (!res.ok) {
|
if (url.includes("github.com")) {
|
||||||
throw new Error(`Failed to download asset from ${url}: ${res.status} ${res.statusText}`);
|
candidates.push(`https://ghfast.top/${url}`);
|
||||||
}
|
}
|
||||||
const buffer = Buffer.from(await res.arrayBuffer());
|
|
||||||
writeFileSync(destPath, buffer);
|
let lastError: Error | undefined;
|
||||||
|
for (const candidate of candidates) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(candidate, { signal: AbortSignal.timeout(15000) });
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
||||||
|
}
|
||||||
|
const buffer = Buffer.from(await res.arrayBuffer());
|
||||||
|
writeFileSync(destPath, buffer);
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
lastError = err instanceof Error ? err : new Error(String(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Failed to download asset from ${url}: ${lastError?.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractTarGz(archivePath: string, targetDir: string, platform: string): string {
|
function extractTarGz(archivePath: string, targetDir: string, platform: string): string {
|
||||||
@@ -336,16 +520,20 @@ function extractZip(archivePath: string, targetDir: string, platform: string): s
|
|||||||
return files[0] || archivePath;
|
return files[0] || archivePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isNewerVersion(latest: string, current: string): boolean {
|
export function compareSemVer(v1: string, v2: string): number {
|
||||||
const lParts = latest.split(".").map(Number);
|
const p1 = v1.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0);
|
||||||
const cParts = current.split(".").map(Number);
|
const p2 = v2.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0);
|
||||||
for (let i = 0; i < Math.max(lParts.length, cParts.length); i++) {
|
for (let i = 0; i < Math.max(p1.length, p2.length); i++) {
|
||||||
const l = lParts[i] ?? 0;
|
const a = p1[i] ?? 0;
|
||||||
const c = cParts[i] ?? 0;
|
const b = p2[i] ?? 0;
|
||||||
if (l > c) return true;
|
if (a > b) return 1;
|
||||||
if (l < c) return false;
|
if (a < b) return -1;
|
||||||
}
|
}
|
||||||
return false;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isNewerVersion(latest: string, current: string): boolean {
|
||||||
|
return compareSemVer(latest, current) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runCommand(command: string, args: string[], options: { cwd?: string } = {}) {
|
function runCommand(command: string, args: string[], options: { cwd?: string } = {}) {
|
||||||
|
|||||||
+5
-3
@@ -85,8 +85,10 @@ Usage:
|
|||||||
seal-home config paths
|
seal-home config paths
|
||||||
seal-home config get
|
seal-home config get
|
||||||
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
seal-home config mode <stateful|stateless> [--corp <corpId>]
|
||||||
seal-home service <start|stop|restart|status>
|
seal-home update [--check] [--force] [--version <v>]
|
||||||
seal-home update
|
seal-home update check
|
||||||
|
seal-home update changelog [--limit <n>]
|
||||||
|
seal-home changelog [--limit <n>]
|
||||||
seal-home tools list
|
seal-home tools list
|
||||||
seal-home corps list [--corp <corpId>]
|
seal-home corps list [--corp <corpId>]
|
||||||
seal-home corps current [--corp <corpId>]
|
seal-home corps current [--corp <corpId>]
|
||||||
@@ -128,7 +130,7 @@ Usage:
|
|||||||
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
seal-home rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
|
||||||
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
seal-home context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
|
||||||
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
|
||||||
seal-home approval-runs search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
seal-home approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
|
||||||
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
seal-home approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
|
||||||
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
seal-home approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
|
||||||
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
seal-home approval-runs cited-rules <recordId> [--corp <corpId>]
|
||||||
|
|||||||
+24
-5
@@ -27,7 +27,7 @@ import { handleUpdateCommand } from "./commands/update.js";
|
|||||||
import { handleUsersCommand } from "./commands/users.js";
|
import { handleUsersCommand } from "./commands/users.js";
|
||||||
import { handleWebhookCommand } from "./commands/webhook.js";
|
import { handleWebhookCommand } from "./commands/webhook.js";
|
||||||
import { selectCorp } from "./helpers.js";
|
import { selectCorp } from "./helpers.js";
|
||||||
import { booleanOption, parseArgs, stringOption } from "./parser.js";
|
import { booleanOption, numberOption, parseArgs, stringOption } from "./parser.js";
|
||||||
import {
|
import {
|
||||||
formatConsoleOutput,
|
formatConsoleOutput,
|
||||||
joinOutput,
|
joinOutput,
|
||||||
@@ -63,7 +63,8 @@ const KNOWN_AREAS = new Set([
|
|||||||
"mcp-config",
|
"mcp-config",
|
||||||
"skill",
|
"skill",
|
||||||
"openapi",
|
"openapi",
|
||||||
"probe"
|
"probe",
|
||||||
|
"changelog"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export type { CliResult, CliRunOptions } from "./types.js";
|
export type { CliResult, CliRunOptions } from "./types.js";
|
||||||
@@ -181,10 +182,28 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (area === "update") {
|
if (area === "update" || area === "changelog") {
|
||||||
const targetVersion = stringOption(args.options.version) ?? stringOption(args.options.tag) ?? (action && !action.startsWith("-") ? action : undefined);
|
const isChangelog =
|
||||||
|
area === "changelog" ||
|
||||||
|
action === "changelog" ||
|
||||||
|
action === "log" ||
|
||||||
|
action === "history" ||
|
||||||
|
booleanOption(args.options.changelog) === true;
|
||||||
|
|
||||||
|
const isCheck =
|
||||||
|
action === "check" ||
|
||||||
|
booleanOption(args.options.check) === true ||
|
||||||
|
booleanOption(args.options["check-only"]) === true;
|
||||||
|
|
||||||
|
const targetVersion =
|
||||||
|
stringOption(args.options.version) ??
|
||||||
|
stringOption(args.options.tag) ??
|
||||||
|
(!isChangelog && !isCheck && action && !action.startsWith("-") ? action : undefined);
|
||||||
|
|
||||||
await handleUpdateCommand(runtime, {
|
await handleUpdateCommand(runtime, {
|
||||||
checkOnly: booleanOption(args.options.check) ?? booleanOption(args.options["check-only"]),
|
checkOnly: isCheck,
|
||||||
|
changelogOnly: isChangelog,
|
||||||
|
limit: numberOption(args.options.limit),
|
||||||
force: booleanOption(args.options.force),
|
force: booleanOption(args.options.force),
|
||||||
targetVersion,
|
targetVersion,
|
||||||
repo: stringOption(args.options.repo)
|
repo: stringOption(args.options.repo)
|
||||||
|
|||||||
Reference in new issue
Block a user