Satis本身不自动同步,需外部机制(如Git平台Webhook)触发build;包未更新常见因require-all与require混用、Git URL缺.git后缀、构建机无法访问仓库或name含非法字符。

直接用 satis build 不会自动同步,Satis 本身不监听变更、不轮询、不触发更新——它只是一次性静态文件生成器。所谓“同步”,必须靠外部机制驱动构建流程,否则 Git 仓库发了新 tag,packages.json 里照样没有。
为什么 satis build 后包没更新?
常见现象是:Git 仓库已打 v1.2.0 tag,但运行 php bin/satis build satis.json web/ 后,web/packages.json 里仍只有 v1.1.0。
-
require-all: true没生效:检查satis.json里是否误写了"require": {...},二者互斥,混用会导致静默跳过所有包 - Git 仓库 URL 缺
.git后缀:Satis 要求"url": "https://git.internal/lib.git",写成.../lib会被忽略 - 构建机无法访问该 Git 地址:运行
git ls-remote https://git.internal/lib.git验证是否能列出 refs;HTTP 协议需确保 Basic Auth 或 Token 可用,SSH 则需~/.ssh/config和私钥就位 - 包的
composer.json里name字段含大写字母或下划线(如"Company/AuthSDK"),Satis 会跳过——必须是小写+短横线("company/auth-sdk")
如何让新版本自动进 packages.json?
没有内置 Webhook 支持,得自己搭轻量触发链。最稳的方式是 Git 平台(GitHub/GitLab)推送 tag 后,调用一个可执行脚本触发构建。
围绕关键发现、作用机制、临床相关性及研究局限性展开讨论。适用于撰写或优化任何生物医学论文的“讨论(Discussion)”部分——包括结果解读、与既往文献关联、阐释意外发现、界定研究局限性,以及撰写结论。当用户输入以下任一指令时也会自动触发该功能: - “write my discussion” - “help me discuss my findings” - “how do I compare to prior studies” - “write the limitations par
- 写一个
webhook.php(放在 Web 可访问路径下,比如/var/www/satis/webhook.php):<?php if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); exit; } $payload = json_decode(file_get_contents('php://input'), true); if (!isset($payload['repository']['full_name']) || !isset($payload['ref'])) { http_response_code(400); exit; } // 校验 Secret(与 Git 平台配置一致) if (!hash_equals(hash_hmac('sha256', file_get_contents('php://input'), $_ENV['WEBHOOK_SECRET']), $_SERVER['HTTP_X_HUB_SIGNATURE_256'] ?? '')) { http_response_code(401); exit; } // 触发构建(注意权限和工作目录) exec('cd /path/to/satis && php bin/satis build satis.json web/ 2>&1', $output, $return); http_response_code($return === 0 ? 200 : 500); - Git 平台 Webhook 配置要点:
Content-Type: application/json、勾选Tag push事件、Secret值与$_ENV['WEBHOOK_SECRET']严格一致、URL 是完整地址(如https://packages.internal/webhook.php) - Nginx 需放开 POST 限制:
client_max_body_size 10M;,并确认没配limit_except POST { deny all; }
客户端如何确保只走私有源?
即使 packages.json 已更新,项目里没关掉默认源,Composer 还是会先连 repo.packagist.org,超时后才 fallback——这就是卡在 “Could not fetch” 的根本原因。
- 项目级配置(推荐):在项目根目录
composer.json中写死:{ "repositories": [ {"type": "composer", "url": "https://packages.internal/"} ], "packagist.org": false }注意:url末尾必须带/,否则 Composer 拼出的请求是https://packages.internal/packages.json/packages.json - 全局配置(CI/统一环境用):
composer config -g repo.packagist '{"type":"composer","url":"https://packages.internal/"}';验证是否生效:composer config -g repo.packagist,输出必须是 JSON 对象,不能是空或字符串 - 清本地缓存:
composer clear-cache,否则旧元数据可能被复用
最容易被忽略的是 homepage 和 url 的协议一致性:如果 satis.json 里 "homepage": "https://packages.internal/",那客户端 composer.json 里的 url 也必须是 https:// 开头;混用 http 且未加 --allow-http,新版 Composer 会直接拒绝加载。

















