feat(install): validate agent CLI runtime registries
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
*
|
||||
* install 寫完轉接檔之後,這裡把那條叫用鏈真的走一遍:
|
||||
*
|
||||
* 轉接檔 → PATH 上的 tea-sdlc → 流程正本
|
||||
* 轉接檔 → PATH 上的 tea-sdlc → AI Agent CLI runtime registry
|
||||
*
|
||||
* PATH 上的 tea-sdlc 仍會取回流程正本;runtime verifier 再依平台的安全 probe
|
||||
* 確認六個流程都出現在正確的本機 registry。沒有安全 probe 的平台回報 not-supported。
|
||||
* 最脆弱的是中間那一環。套件裝在某個 Node 版本底下,換個版本管理器或改 npm prefix
|
||||
* 就找不到了,而轉接檔本身看起來完全正常——使用者要到第一次打 /sdlc-plan 才發現,
|
||||
* 那時他已經離開安裝的心智狀態很久了。所以這裡不是「檢查檔案在不在」,而是真的到
|
||||
@@ -19,6 +21,7 @@
|
||||
* 「有點舊但能用」變成什麼都沒有。而且最可能的病灶是「PATH 上找不到 tea-sdlc」,
|
||||
* 那不是轉接檔的問題,刪掉它一點幫助也沒有——所以報告把叫用鏈與轉接檔分開講。
|
||||
*/
|
||||
import { verifyRuntimePlatforms } from './runtime-verify.js';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { onPath } from './lib.js';
|
||||
@@ -50,7 +53,8 @@ export function invocation(name, version) {
|
||||
*/
|
||||
export function verifyInstall({ version, prompt, platforms }) {
|
||||
const chain = verifyChain(prompt, version);
|
||||
const reports = platforms.map((platform) => verifyPlatform(platform, version));
|
||||
const runtime = verifyRuntimePlatforms(platforms);
|
||||
const reports = platforms.map((platform, index) => verifyPlatform(platform, version, runtime[index]));
|
||||
|
||||
return {
|
||||
ok: chain.ok && reports.every((report) => report.ok),
|
||||
@@ -169,12 +173,20 @@ export function 診斷(verify) {
|
||||
* 讀回磁碟上的內容而不是相信剛才寫出去的字串:這一步要驗的正是「寫出去之後檔案
|
||||
* 真的長那樣」,拿記憶體裡的原稿來比等於自己驗自己。
|
||||
*/
|
||||
function verifyPlatform(platform, version) {
|
||||
const failures = platform.adapters
|
||||
function verifyPlatform(platform, version, runtime) {
|
||||
const adapterFailures = platform.adapters
|
||||
.map((adapter) => checkAdapter(adapter, version))
|
||||
.filter((failure) => failure !== null);
|
||||
const failures = [...adapterFailures, ...runtime.failures];
|
||||
|
||||
return { name: platform.name, ok: failures.length === 0, checked: platform.adapters.length, failures };
|
||||
return {
|
||||
name: platform.name,
|
||||
ok: failures.length === 0,
|
||||
status: runtime.status,
|
||||
checked: platform.adapters.length,
|
||||
failures,
|
||||
runtime,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user