@andpipes/cli 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -1
- package/README.md +61 -0
- package/dist/bin.cjs +8904 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +20 -0
- package/dist/chunk-7LSHSW4Q.js +758 -0
- package/dist/chunk-QPRR3KCS.js +8493 -0
- package/dist/dev-supervisor.cjs +249 -0
- package/dist/dev-supervisor.d.cts +2 -0
- package/dist/dev-supervisor.d.ts +2 -0
- package/dist/dev-supervisor.js +104 -0
- package/dist/index.cjs +9144 -0
- package/dist/index.d.cts +1265 -0
- package/dist/index.d.ts +1265 -0
- package/dist/index.js +199 -0
- package/package.json +53 -6
- package/bin/andpipe.js +0 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1265 @@
|
|
|
1
|
+
import { SupportedLocale, CliDevWorkflowMessages, CliInitWorkflowMessages, CliPublishWorkflowMessages } from '@andpipes/localization';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { ValidateReport, PublishGateResult, OnboardingTemplateOperation, OnboardingTemplateSafeDiffEntry, ExternalSaasTemplateV1, OnboardingTemplateBindings } from '@andpipes/tool-contract';
|
|
4
|
+
export { CheckResult, CheckStatus, RISK_LEVELS, RiskLevel, ValidateReport, validateContract } from '@andpipes/tool-contract';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 出力ヘルパ。すべて redaction を通すため、command 側は secret を意識せず使える。
|
|
8
|
+
* 書き込み先を差し替え可能にし、単体テストで出力を捕捉できるようにする。
|
|
9
|
+
*/
|
|
10
|
+
interface Writer {
|
|
11
|
+
out(text: string): void;
|
|
12
|
+
err(text: string): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* commander program を構築する。出力先 (writer) と cwd を注入可能にし、テストから検証できる。
|
|
17
|
+
* 副作用 (parse / exit) は runCli 側に閉じ込め、buildProgram は純粋に構築のみ行う。
|
|
18
|
+
*/
|
|
19
|
+
declare function buildProgram(writer?: Writer, cwd?: () => string, locale?: SupportedLocale): Command;
|
|
20
|
+
/** argv を解析して CLI を実行する。失敗時は呼び出し側 (bin) が catch する。 */
|
|
21
|
+
declare function runCli(argv: string[], writer?: Writer): Promise<void>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* credentials — andpipe CLI の認証情報をローカルに保管する。
|
|
25
|
+
*
|
|
26
|
+
* 既定は secure-file store (`~/.config/andpipe/credentials.json`, 0600)。OS keychain 連携は将来。
|
|
27
|
+
* 保管するのは andpipe MCP resource 向け token のみ。No Token Passthrough のため、
|
|
28
|
+
* 接続先 SaaS の token はここに保管せず、ここから転送もしない。
|
|
29
|
+
*
|
|
30
|
+
* テスト容易性: 保管先は env `ANDPIPE_CONFIG_DIR` > `XDG_CONFIG_HOME/andpipe` > `~/.config/andpipe`。
|
|
31
|
+
*/
|
|
32
|
+
interface CredentialRecord {
|
|
33
|
+
/** Admin CLI 専用 credential。Config MCP credential と保存領域を混同しない。 */
|
|
34
|
+
kind: "admin";
|
|
35
|
+
resource: "https://api.andpipe.com";
|
|
36
|
+
/** Bearer を送信してよい唯一の Admin API origin。 */
|
|
37
|
+
host: "https://api.andpipe.com";
|
|
38
|
+
authorizationServer: "https://auth.andpipe.com";
|
|
39
|
+
verificationUriBase: "https://admin.andpipe.com/cli/handoffs";
|
|
40
|
+
clientId: "andpipe-cli";
|
|
41
|
+
organizationId: string;
|
|
42
|
+
userId: string;
|
|
43
|
+
/** JWT の opaque subject hash。表示時は必ずマスクする。 */
|
|
44
|
+
principal: string;
|
|
45
|
+
scope: AdminCliScope[];
|
|
46
|
+
/** Admin CLI access JWT。raw 値は status 等で決して表示しない。 */
|
|
47
|
+
token: string;
|
|
48
|
+
tokenType: "Bearer";
|
|
49
|
+
/** 取得時刻 (ISO 8601)。 */
|
|
50
|
+
obtainedAt: string;
|
|
51
|
+
/** 最大3600秒の失効時刻 (ISO 8601)。 */
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
}
|
|
54
|
+
declare const ADMIN_CLI_RESOURCE: "https://api.andpipe.com";
|
|
55
|
+
declare const ADMIN_CLI_AUTHORIZATION_SERVER: "https://auth.andpipe.com";
|
|
56
|
+
declare const ADMIN_CLI_VERIFICATION_URI_BASE: "https://admin.andpipe.com/cli/handoffs";
|
|
57
|
+
declare const ADMIN_CLI_CLIENT_ID: "andpipe-cli";
|
|
58
|
+
declare const ADMIN_CLI_SCOPES: readonly ["admin.audit_export.read", "admin.audit_export.write", "admin.domain.read", "admin.domain.write", "admin.logs.read", "admin.oauth.read", "admin.oauth.write", "admin.onboarding_template.read", "admin.onboarding_template.write", "admin.project.read", "admin.project.write", "admin.review_package.read", "admin.review_package.write", "admin.tool.publish", "admin.tool.read"];
|
|
59
|
+
type AdminCliScope = (typeof ADMIN_CLI_SCOPES)[number];
|
|
60
|
+
/** Config MCP resource 専用 credential。raw handoff code / PKCE verifier は型として保持しない。 */
|
|
61
|
+
interface ConfigMcpCredentialRecord {
|
|
62
|
+
kind: "config_mcp";
|
|
63
|
+
resource: "https://config.andpipe.com";
|
|
64
|
+
mcpEndpoint: string;
|
|
65
|
+
authorizationServer: string;
|
|
66
|
+
verificationUriBase: string;
|
|
67
|
+
projectId: string;
|
|
68
|
+
clientId: string;
|
|
69
|
+
hostKind: string;
|
|
70
|
+
scope: string[];
|
|
71
|
+
/** RS256 access JWT。refresh token は Config MCP handoff 契約上存在しない。 */
|
|
72
|
+
accessToken: string;
|
|
73
|
+
tokenType: "Bearer";
|
|
74
|
+
obtainedAt: string;
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
}
|
|
77
|
+
interface CredentialsFile {
|
|
78
|
+
version: 3;
|
|
79
|
+
profiles: Record<string, CredentialRecord>;
|
|
80
|
+
configMcpProfiles: Record<string, ConfigMcpCredentialRecord>;
|
|
81
|
+
}
|
|
82
|
+
declare function getConfigDir(env?: NodeJS.ProcessEnv): string;
|
|
83
|
+
declare function getCredentialsPath(env?: NodeJS.ProcessEnv): string;
|
|
84
|
+
declare function setProfile(record: CredentialRecord, profile?: string, env?: NodeJS.ProcessEnv): void;
|
|
85
|
+
declare function getProfile(profile?: string, env?: NodeJS.ProcessEnv): CredentialRecord | undefined;
|
|
86
|
+
declare function setConfigMcpProfile(record: ConfigMcpCredentialRecord, profile?: string, env?: NodeJS.ProcessEnv): void;
|
|
87
|
+
declare function getConfigMcpProfile(profile?: string, env?: NodeJS.ProcessEnv): ConfigMcpCredentialRecord | undefined;
|
|
88
|
+
/** profile を削除する。削除できた場合 true。 */
|
|
89
|
+
declare function removeProfile(profile?: string, env?: NodeJS.ProcessEnv): boolean;
|
|
90
|
+
/** Config MCP profile だけを削除し、同名の Admin profile は維持する。 */
|
|
91
|
+
declare function removeConfigMcpProfile(profile?: string, env?: NodeJS.ProcessEnv): boolean;
|
|
92
|
+
/** 全 credential を削除する (ファイルごと除去)。 */
|
|
93
|
+
declare function clearAll(env?: NodeJS.ProcessEnv): void;
|
|
94
|
+
declare const DEFAULT_PROFILE_NAME = "default";
|
|
95
|
+
|
|
96
|
+
declare const CONFIG_MCP_RESOURCE: "https://config.andpipe.com";
|
|
97
|
+
declare const CONFIG_MCP_ENDPOINT: "https://config.andpipe.com/mcp";
|
|
98
|
+
declare const CONFIG_MCP_HANDOFF_GRANT: "urn:andpipe:params:oauth:grant-type:config-mcp-handoff";
|
|
99
|
+
declare const DEFAULT_AUTHORIZATION_SERVER: "https://auth.andpipe.com";
|
|
100
|
+
declare const DEFAULT_VERIFICATION_URI_BASE: "https://admin.andpipe.com/config-mcp/handoffs";
|
|
101
|
+
type HandoffFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
102
|
+
type RandomBytes = (size: number) => Uint8Array;
|
|
103
|
+
interface ConfigMcpHandoffRuntime {
|
|
104
|
+
fetch: HandoffFetch;
|
|
105
|
+
now: () => number;
|
|
106
|
+
sleep: (milliseconds: number) => Promise<void>;
|
|
107
|
+
randomBytes: RandomBytes;
|
|
108
|
+
}
|
|
109
|
+
interface ConnectConfigMcpInput {
|
|
110
|
+
projectId: string;
|
|
111
|
+
clientId: string;
|
|
112
|
+
hostKind: string;
|
|
113
|
+
scopes: readonly string[];
|
|
114
|
+
mcpEndpoint: string;
|
|
115
|
+
authorizationServer?: string;
|
|
116
|
+
verificationUriBase?: string;
|
|
117
|
+
profile?: string;
|
|
118
|
+
env?: NodeJS.ProcessEnv;
|
|
119
|
+
runtime?: Partial<ConfigMcpHandoffRuntime>;
|
|
120
|
+
/** verification URI だけを UI へ渡す。raw code / verifier は callback に公開しない。 */
|
|
121
|
+
onVerificationUri?: (verificationUri: string) => void;
|
|
122
|
+
}
|
|
123
|
+
declare class ConfigMcpHandoffError extends Error {
|
|
124
|
+
readonly code: string;
|
|
125
|
+
constructor(code: string, message: string);
|
|
126
|
+
}
|
|
127
|
+
declare function generatePkceVerifier(random?: RandomBytes): string;
|
|
128
|
+
declare function createS256Challenge(verifier: string): string;
|
|
129
|
+
declare function generateIdempotencyKey(random?: RandomBytes): string;
|
|
130
|
+
declare function normalizeConfigMcpScopes(scopes: readonly string[]): string[];
|
|
131
|
+
declare function connectConfigMcp(input: ConnectConfigMcpInput): Promise<ConfigMcpCredentialRecord>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Config MCP command (Epic D / CONFIG.MCP.1.1.1)。
|
|
135
|
+
*
|
|
136
|
+
* install は OAuth Broker の短命 handoff後にtools/listまで検証し、connectはcredential保存まで行う。
|
|
137
|
+
* raw code / PKCE verifier はconnectConfigMcpのmemoryに閉じ、command / writer / connection configへ公開しない。
|
|
138
|
+
*/
|
|
139
|
+
interface ConfigMcpConnectionConfig {
|
|
140
|
+
version: 1;
|
|
141
|
+
project_id: string;
|
|
142
|
+
client_id: string;
|
|
143
|
+
host_kind: string;
|
|
144
|
+
scope: string[];
|
|
145
|
+
authorization_server: string;
|
|
146
|
+
verification_uri_base: string;
|
|
147
|
+
mcp_endpoint: string;
|
|
148
|
+
}
|
|
149
|
+
interface ConnectCommandOptions {
|
|
150
|
+
projectId?: string;
|
|
151
|
+
clientId?: string;
|
|
152
|
+
hostKind?: string;
|
|
153
|
+
scope?: string;
|
|
154
|
+
authorizationServer?: string;
|
|
155
|
+
verificationUriBase?: string;
|
|
156
|
+
mcpEndpoint?: string;
|
|
157
|
+
connection?: string;
|
|
158
|
+
profile: string;
|
|
159
|
+
}
|
|
160
|
+
/** Web Admin が出力する非秘密 connection config だけを読む。credential/code はこの型に存在しない。 */
|
|
161
|
+
declare function loadConfigMcpConnectionConfig(path: string): ConfigMcpConnectionConfig;
|
|
162
|
+
declare function resolveConfigMcpConnection(options: ConnectCommandOptions): Omit<ConnectConfigMcpInput, "profile" | "onVerificationUri">;
|
|
163
|
+
|
|
164
|
+
interface DevArtifactPlan {
|
|
165
|
+
directory: string;
|
|
166
|
+
path: string;
|
|
167
|
+
}
|
|
168
|
+
interface DevSessionArtifact {
|
|
169
|
+
version: 1;
|
|
170
|
+
local_endpoint: string;
|
|
171
|
+
public_endpoint: string | null;
|
|
172
|
+
authorization_header: string;
|
|
173
|
+
expires_at: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface DevHttpServerHandle {
|
|
177
|
+
listen(): Promise<void>;
|
|
178
|
+
setPublicOrigin(origin: string | null): void;
|
|
179
|
+
closeAll(timeoutMs?: number): Promise<void>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* CLI 共通エラー型。bin の最終ハンドラで種別ごとに整形・exit code を決める。
|
|
184
|
+
*/
|
|
185
|
+
/** 利用者の入力 (引数・ファイル) が不正なときに投げる。 */
|
|
186
|
+
declare class UsageError extends Error {
|
|
187
|
+
constructor(message: string);
|
|
188
|
+
}
|
|
189
|
+
/** write / destructive 操作が確認 (--yes) なしに呼ばれたときに投げる (default deny)。 */
|
|
190
|
+
declare class ConfirmationRequiredError extends Error {
|
|
191
|
+
constructor(operation: string, message?: string);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface LoadedContract {
|
|
195
|
+
root: Record<string, unknown>;
|
|
196
|
+
tools: Record<string, unknown>[];
|
|
197
|
+
report: ValidateReport;
|
|
198
|
+
publishGate: PublishGateResult;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
interface DevProjectManifest {
|
|
202
|
+
version: 1;
|
|
203
|
+
organization_id: string;
|
|
204
|
+
project_id: string;
|
|
205
|
+
project_name: string;
|
|
206
|
+
project_slug: string;
|
|
207
|
+
tool_contract_path: string;
|
|
208
|
+
/** template applyでmaterializeしたproject-scoped connector。通常initでは省略する。 */
|
|
209
|
+
connector_id?: string;
|
|
210
|
+
/** template由来publicationをserver current applicationへCAS束縛するprovenance。 */
|
|
211
|
+
template_id?: string;
|
|
212
|
+
template_application_commitment?: string;
|
|
213
|
+
}
|
|
214
|
+
interface LoadedDevProject {
|
|
215
|
+
root: string;
|
|
216
|
+
manifest: DevProjectManifest;
|
|
217
|
+
contractPath: string;
|
|
218
|
+
contract: LoadedContract & {
|
|
219
|
+
contract: unknown;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
declare const QUICK_TUNNEL_PROVIDER: "cloudflare-quick";
|
|
224
|
+
interface DevTunnelHandle {
|
|
225
|
+
publicOrigin: string;
|
|
226
|
+
publicEndpoint: string;
|
|
227
|
+
pgid: number;
|
|
228
|
+
exited: Promise<{
|
|
229
|
+
code: number | null;
|
|
230
|
+
signal: NodeJS.Signals | null;
|
|
231
|
+
}>;
|
|
232
|
+
stop(): Promise<void>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare const DEFAULT_DEV_PORT = 8787;
|
|
236
|
+
declare const DEFAULT_DEV_TTL_SECONDS = 900;
|
|
237
|
+
declare class DevPolicyError extends Error {
|
|
238
|
+
readonly reason: "local_dev_platform_unsupported" | "quick_tunnel_config_present";
|
|
239
|
+
readonly code: "AP_POLICY_DENIED";
|
|
240
|
+
constructor(reason: "local_dev_platform_unsupported" | "quick_tunnel_config_present", messages?: CliDevWorkflowMessages);
|
|
241
|
+
}
|
|
242
|
+
declare class DevProjectPreflightError extends Error {
|
|
243
|
+
readonly code: "AP_INPUT_INVALID" | "AP_POLICY_DENIED";
|
|
244
|
+
readonly reason: string;
|
|
245
|
+
constructor(code: "AP_INPUT_INVALID" | "AP_POLICY_DENIED", reason: string, messages?: CliDevWorkflowMessages);
|
|
246
|
+
}
|
|
247
|
+
interface DevCommandOptions {
|
|
248
|
+
port?: string | number;
|
|
249
|
+
ttlSeconds?: string | number;
|
|
250
|
+
tunnel?: string;
|
|
251
|
+
yes?: boolean;
|
|
252
|
+
}
|
|
253
|
+
interface ShutdownInput {
|
|
254
|
+
deadline: number;
|
|
255
|
+
monotonicNow(): number;
|
|
256
|
+
}
|
|
257
|
+
interface DevShutdownHandle {
|
|
258
|
+
wait: Promise<void>;
|
|
259
|
+
requested(): boolean;
|
|
260
|
+
dispose(): void;
|
|
261
|
+
}
|
|
262
|
+
interface DevCommandRuntime {
|
|
263
|
+
platform: NodeJS.Platform;
|
|
264
|
+
monotonicNow(): number;
|
|
265
|
+
wallNow(): number;
|
|
266
|
+
randomBytes(size: number): Uint8Array;
|
|
267
|
+
loadProject(cwd: string): LoadedDevProject;
|
|
268
|
+
quickTunnelConfigExists(): boolean;
|
|
269
|
+
prepareArtifact(): DevArtifactPlan;
|
|
270
|
+
createArtifact(plan: DevArtifactPlan, value: DevSessionArtifact): void;
|
|
271
|
+
removeArtifact(plan: DevArtifactPlan): void;
|
|
272
|
+
createServer(input: {
|
|
273
|
+
project: LoadedDevProject;
|
|
274
|
+
bearer: string;
|
|
275
|
+
localOrigin: string;
|
|
276
|
+
port: number;
|
|
277
|
+
deadline: number;
|
|
278
|
+
}): DevHttpServerHandle;
|
|
279
|
+
startTunnel(input: {
|
|
280
|
+
artifactPath: string;
|
|
281
|
+
localOrigin: string;
|
|
282
|
+
deadline: number;
|
|
283
|
+
cancel: Promise<void>;
|
|
284
|
+
}): Promise<DevTunnelHandle>;
|
|
285
|
+
createShutdown(input: ShutdownInput): DevShutdownHandle;
|
|
286
|
+
}
|
|
287
|
+
declare function normalizeDevOptions(options: DevCommandOptions, messages?: CliDevWorkflowMessages): {
|
|
288
|
+
port: number;
|
|
289
|
+
ttlSeconds: number;
|
|
290
|
+
tunnel: typeof QUICK_TUNNEL_PROVIDER | null;
|
|
291
|
+
};
|
|
292
|
+
declare function runDevCommand(options: DevCommandOptions, writer: Writer, cwd: string, runtime?: DevCommandRuntime, messages?: CliDevWorkflowMessages): Promise<void>;
|
|
293
|
+
declare function registerDev(program: Command, writer: Writer, cwd: () => string, runtime?: DevCommandRuntime, description?: string, messages?: CliDevWorkflowMessages): void;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* doctor command (Issue #66)。読み取り専用の診断。secret / token は決して raw 出力しない。
|
|
297
|
+
* Node version / config / credential / backend 配線状況を点検する。
|
|
298
|
+
*/
|
|
299
|
+
type DoctorStatus = "ok" | "warn" | "info";
|
|
300
|
+
interface DoctorCheck {
|
|
301
|
+
id: string;
|
|
302
|
+
label: string;
|
|
303
|
+
status: DoctorStatus;
|
|
304
|
+
detail: string;
|
|
305
|
+
}
|
|
306
|
+
interface DoctorReport {
|
|
307
|
+
checks: DoctorCheck[];
|
|
308
|
+
}
|
|
309
|
+
interface DoctorInput {
|
|
310
|
+
nodeVersion: string;
|
|
311
|
+
env: NodeJS.ProcessEnv;
|
|
312
|
+
cwd: string;
|
|
313
|
+
profile?: string;
|
|
314
|
+
}
|
|
315
|
+
declare function runDoctor(input: DoctorInput, locale?: SupportedLocale): DoctorReport;
|
|
316
|
+
|
|
317
|
+
interface DnsRecord {
|
|
318
|
+
type: "CNAME" | "TXT";
|
|
319
|
+
name: string;
|
|
320
|
+
value: string;
|
|
321
|
+
note: string;
|
|
322
|
+
}
|
|
323
|
+
interface DomainPlan {
|
|
324
|
+
domain: string;
|
|
325
|
+
project: string;
|
|
326
|
+
provider: string;
|
|
327
|
+
providerKnown: boolean;
|
|
328
|
+
records: DnsRecord[];
|
|
329
|
+
}
|
|
330
|
+
declare function isValidDomain(domain: string): boolean;
|
|
331
|
+
/**
|
|
332
|
+
* 設定すべき DNS レコードをローカル計算する。target / challenge token は backend が確定するため
|
|
333
|
+
* placeholder を入れる (dry-run の目的は「どのレコードを用意するか」を示すこと)。
|
|
334
|
+
*/
|
|
335
|
+
declare function computeDomainPlan(domain: string, project: string, provider: string, locale?: SupportedLocale): DomainPlan;
|
|
336
|
+
|
|
337
|
+
interface LocalRootIdentity {
|
|
338
|
+
readonly dev: number;
|
|
339
|
+
readonly ino: number;
|
|
340
|
+
readonly nlink: number;
|
|
341
|
+
readonly uid: number;
|
|
342
|
+
/** file type bitsを除いたPOSIX permission / special mode。 */
|
|
343
|
+
readonly mode: number;
|
|
344
|
+
}
|
|
345
|
+
interface LocalRootAnchor {
|
|
346
|
+
readonly root: string;
|
|
347
|
+
readonly rootIdentity: LocalRootIdentity;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
interface InitLocalPlan {
|
|
351
|
+
readonly root: string;
|
|
352
|
+
/** network 前に確定した project root directory の filesystem identity。 */
|
|
353
|
+
readonly rootIdentity: InitRootIdentity;
|
|
354
|
+
/** regular file 1 entryがroot nlinkへ反映されるfilesystemでは1、反映されない場合は0。 */
|
|
355
|
+
readonly rootEntryNlinkDelta: 0 | 1 | null;
|
|
356
|
+
readonly manifestPath: string;
|
|
357
|
+
readonly toolContractPath: string;
|
|
358
|
+
readonly toolContractCommitment: InitManifestCommitment | null;
|
|
359
|
+
readonly existingManifest: DevProjectManifest | null;
|
|
360
|
+
/** existing manifestをremote待ち後に同じfile/bytesと再照合するcommitment。 */
|
|
361
|
+
readonly existingManifestCommitment: InitManifestCommitment | null;
|
|
362
|
+
}
|
|
363
|
+
interface InitManifestCommitment {
|
|
364
|
+
readonly dev: number;
|
|
365
|
+
readonly ino: number;
|
|
366
|
+
readonly nlink: number;
|
|
367
|
+
readonly size: number;
|
|
368
|
+
readonly uid: number;
|
|
369
|
+
readonly mode: number;
|
|
370
|
+
readonly sha256: string;
|
|
371
|
+
}
|
|
372
|
+
/** command開始時にread-onlyで固定したproject root。full preflightまで同じidentityを要求する。 */
|
|
373
|
+
type InitRootAnchor = LocalRootAnchor;
|
|
374
|
+
type InitRootIdentity = LocalRootIdentity;
|
|
375
|
+
interface InitManifestRuntime {
|
|
376
|
+
randomUuid(): string;
|
|
377
|
+
/** filesystem mutation直後のdeterministic race test用。production runtimeは未指定。 */
|
|
378
|
+
filesystemCheckpoint?(phase: "probe_temp_opened" | "manifest_temp_opened" | "manifest_linked"): void;
|
|
379
|
+
}
|
|
380
|
+
declare class InitManifestConflictError extends Error {
|
|
381
|
+
readonly code: "AP_CONFLICT";
|
|
382
|
+
readonly reason: "manifest_exists";
|
|
383
|
+
constructor(message?: string);
|
|
384
|
+
}
|
|
385
|
+
declare class InitLocalUsageError extends UsageError {
|
|
386
|
+
readonly reason: "contract_path_invalid" | "contract_candidates_ambiguous" | "contract_required" | "manifest_invalid";
|
|
387
|
+
readonly code: "AP_INPUT_INVALID";
|
|
388
|
+
constructor(reason: "contract_path_invalid" | "contract_candidates_ambiguous" | "contract_required" | "manifest_invalid");
|
|
389
|
+
}
|
|
390
|
+
/** command開始時のcwd realpath + directory identityを副作用なしで固定する。 */
|
|
391
|
+
declare const captureInitRoot: (cwd: string) => InitRootAnchor;
|
|
392
|
+
/** initの全local preflight。開始時anchorのexact identityを要求し、manifest absent時はprobeまで完了する。 */
|
|
393
|
+
declare function prepareInitLocal(anchor: InitRootAnchor, contract: string | undefined, runtime: InitManifestRuntime): InitLocalPlan;
|
|
394
|
+
/**
|
|
395
|
+
* remote GET待ち後、preflight時と同じroot/file/raw bytesをbounded再読して返す。
|
|
396
|
+
* pathが同じでも別inode、同inodeでもbytes変更ならunchanged確定を許可しない。
|
|
397
|
+
*/
|
|
398
|
+
declare function finalizeExistingInitManifest(plan: InitLocalPlan): DevProjectManifest;
|
|
399
|
+
/**
|
|
400
|
+
* tempを完全write+fsync後、hard linkでdestinationをno-replace作成しdirectory fsyncする。
|
|
401
|
+
*/
|
|
402
|
+
declare function writeInitManifestNoReplace(plan: InitLocalPlan, manifest: DevProjectManifest, runtime: InitManifestRuntime): void;
|
|
403
|
+
|
|
404
|
+
interface InitProject {
|
|
405
|
+
readonly id: string;
|
|
406
|
+
readonly organizationId: string;
|
|
407
|
+
readonly name: string;
|
|
408
|
+
readonly slug: string;
|
|
409
|
+
readonly status: "active" | "suspended" | "archived";
|
|
410
|
+
readonly createdAt: string;
|
|
411
|
+
readonly updatedAt: string;
|
|
412
|
+
}
|
|
413
|
+
interface InitProjectList {
|
|
414
|
+
readonly projects: readonly InitProject[];
|
|
415
|
+
readonly truncated: boolean;
|
|
416
|
+
}
|
|
417
|
+
interface InitProjectCreateDiff {
|
|
418
|
+
readonly field: "name" | "slug";
|
|
419
|
+
readonly status: "same" | "different";
|
|
420
|
+
readonly current: string;
|
|
421
|
+
readonly requested: string;
|
|
422
|
+
}
|
|
423
|
+
interface InitApiClient {
|
|
424
|
+
listProjects(input: {
|
|
425
|
+
readonly limit: number;
|
|
426
|
+
readonly slug?: string;
|
|
427
|
+
}): Promise<InitProjectList>;
|
|
428
|
+
getProject(projectId: string): Promise<InitProject>;
|
|
429
|
+
createProject(input: {
|
|
430
|
+
readonly name: string;
|
|
431
|
+
readonly slug: string;
|
|
432
|
+
readonly idempotencyKey: string;
|
|
433
|
+
}): Promise<InitProject>;
|
|
434
|
+
createConnector?(input: {
|
|
435
|
+
readonly projectId: string;
|
|
436
|
+
readonly idempotencyKey: string;
|
|
437
|
+
readonly connector: InitConnectorCreateInput;
|
|
438
|
+
}): Promise<InitCreatedConnector>;
|
|
439
|
+
}
|
|
440
|
+
interface InitConnectorCreateInput {
|
|
441
|
+
readonly name: string;
|
|
442
|
+
readonly kind: "existing_api" | "adapter" | "ai_api" | "governed_data";
|
|
443
|
+
readonly upstreamAuthMode: "token_exchange" | "service_account" | "existing_oauth" | "signed_request";
|
|
444
|
+
readonly secretRef: string | null;
|
|
445
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
446
|
+
readonly status: "active";
|
|
447
|
+
}
|
|
448
|
+
interface InitCreatedConnector {
|
|
449
|
+
readonly id: string;
|
|
450
|
+
readonly projectId: string;
|
|
451
|
+
readonly name: string;
|
|
452
|
+
readonly kind: InitConnectorCreateInput["kind"];
|
|
453
|
+
readonly upstreamAuthMode: InitConnectorCreateInput["upstreamAuthMode"];
|
|
454
|
+
readonly secretRef: string | null;
|
|
455
|
+
readonly config: Readonly<Record<string, unknown>> | null;
|
|
456
|
+
readonly status: "active" | "disabled";
|
|
457
|
+
}
|
|
458
|
+
type InitApiFactory = (profile: string) => InitApiClient;
|
|
459
|
+
interface InitCommandOptions {
|
|
460
|
+
readonly project?: string;
|
|
461
|
+
readonly create?: boolean;
|
|
462
|
+
readonly name?: string;
|
|
463
|
+
readonly slug?: string;
|
|
464
|
+
readonly contract?: string;
|
|
465
|
+
readonly template?: string;
|
|
466
|
+
readonly openapi?: string;
|
|
467
|
+
readonly baseUrl?: string;
|
|
468
|
+
readonly serviceName?: string;
|
|
469
|
+
readonly connector?: string;
|
|
470
|
+
readonly createConnector?: boolean;
|
|
471
|
+
readonly profile?: string;
|
|
472
|
+
readonly yes?: boolean;
|
|
473
|
+
/** 検証済みtemplate exportからだけ生成する。Commander入力としては受理しない。 */
|
|
474
|
+
readonly templateConnectorCreate?: {
|
|
475
|
+
readonly input: InitConnectorCreateInput;
|
|
476
|
+
readonly idempotencyKey: string;
|
|
477
|
+
};
|
|
478
|
+
readonly templateProvenance?: {
|
|
479
|
+
readonly templateId: string;
|
|
480
|
+
readonly applicationCommitment: string;
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
interface InitCommandRuntime {
|
|
484
|
+
createClient(profile: string): InitApiClient;
|
|
485
|
+
randomUuid(): string;
|
|
486
|
+
isInteractive(): boolean;
|
|
487
|
+
selectProject(): Promise<string>;
|
|
488
|
+
confirmCreate(input: {
|
|
489
|
+
readonly name: string;
|
|
490
|
+
readonly slug: string;
|
|
491
|
+
}): Promise<boolean>;
|
|
492
|
+
captureLocalRoot(cwd: string): InitRootAnchor;
|
|
493
|
+
prepareLocal(anchor: InitRootAnchor, contract: string | undefined): InitLocalPlan;
|
|
494
|
+
finalizeExistingManifest(plan: InitLocalPlan): DevProjectManifest;
|
|
495
|
+
writeManifest(plan: InitLocalPlan, manifest: DevProjectManifest): void;
|
|
496
|
+
}
|
|
497
|
+
declare function createInitCommandRuntime(createClient: InitApiFactory, messages?: CliInitWorkflowMessages): InitCommandRuntime;
|
|
498
|
+
type NormalizedInitMode = {
|
|
499
|
+
readonly kind: "list";
|
|
500
|
+
readonly profile: string;
|
|
501
|
+
} | {
|
|
502
|
+
readonly kind: "bind";
|
|
503
|
+
readonly projectId: string;
|
|
504
|
+
readonly contract?: string;
|
|
505
|
+
readonly connectorId?: string;
|
|
506
|
+
readonly connectorCreate?: {
|
|
507
|
+
readonly input: InitConnectorCreateInput;
|
|
508
|
+
readonly idempotencyKey: string;
|
|
509
|
+
};
|
|
510
|
+
readonly templateProvenance?: {
|
|
511
|
+
readonly templateId: string;
|
|
512
|
+
readonly applicationCommitment: string;
|
|
513
|
+
};
|
|
514
|
+
readonly profile: string;
|
|
515
|
+
} | {
|
|
516
|
+
readonly kind: "create";
|
|
517
|
+
readonly name: string;
|
|
518
|
+
readonly slug: string;
|
|
519
|
+
readonly contract?: string;
|
|
520
|
+
readonly profile: string;
|
|
521
|
+
readonly yes: boolean;
|
|
522
|
+
};
|
|
523
|
+
declare function normalizeInitOptions(options: InitCommandOptions, messages?: CliInitWorkflowMessages): NormalizedInitMode;
|
|
524
|
+
declare function runInitCommand(options: InitCommandOptions, writer: Writer, cwd: string, runtime: InitCommandRuntime, messages?: CliInitWorkflowMessages): Promise<void>;
|
|
525
|
+
/** CLI登録。production backend adapterはfactoryとして注入し、unit testは実networkを使わない。 */
|
|
526
|
+
declare function registerInit(program: Command, writer: Writer, cwd: () => string, createClient: InitApiFactory, description?: string, runtime?: InitCommandRuntime | undefined, messages?: CliInitWorkflowMessages): void;
|
|
527
|
+
|
|
528
|
+
/** OIDC discovery metadata をローカル検証する。fetch は伴わない。 */
|
|
529
|
+
declare function validateOAuthMetadata(meta: unknown, locale?: SupportedLocale): ValidateReport;
|
|
530
|
+
|
|
531
|
+
/** Admin bearer credential を送信してよい唯一の production origin。 */
|
|
532
|
+
declare const ADMIN_API_ORIGIN = "https://api.andpipe.com";
|
|
533
|
+
declare const ADMIN_API_TIMEOUT_MS = 10000;
|
|
534
|
+
declare const ADMIN_API_MAX_RESPONSE_BYTES: number;
|
|
535
|
+
declare const ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES: number;
|
|
536
|
+
declare const ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES: number;
|
|
537
|
+
declare const ADMIN_API_OPENAPI_IMPORT_MAX_BYTES: number;
|
|
538
|
+
declare const ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES: number;
|
|
539
|
+
declare const ADMIN_API_MAX_GET_ATTEMPTS = 3;
|
|
540
|
+
type JsonObject = Record<string, unknown>;
|
|
541
|
+
type AdminFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
542
|
+
type AdminSleep = (milliseconds: number) => Promise<void>;
|
|
543
|
+
declare class AdminApiClientError extends Error {
|
|
544
|
+
readonly code: string;
|
|
545
|
+
readonly status: number | undefined;
|
|
546
|
+
readonly confirmationRequired: PublicationConfirmationRequiredDetails | undefined;
|
|
547
|
+
constructor(code: string, message: string, status?: number, confirmationRequired?: PublicationConfirmationRequiredDetails);
|
|
548
|
+
}
|
|
549
|
+
declare function assertProjectId(projectId: string): string;
|
|
550
|
+
declare function assertResourceId(value: string, option: string): string;
|
|
551
|
+
interface AdminApiClientOptions {
|
|
552
|
+
readonly token: string;
|
|
553
|
+
readonly fetch?: AdminFetch;
|
|
554
|
+
readonly sleep?: AdminSleep;
|
|
555
|
+
}
|
|
556
|
+
interface CreateAdminApiClientOptions {
|
|
557
|
+
readonly profile?: string;
|
|
558
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
559
|
+
readonly fetch?: AdminFetch;
|
|
560
|
+
readonly sleep?: AdminSleep;
|
|
561
|
+
}
|
|
562
|
+
interface AdminHealth {
|
|
563
|
+
readonly status: "ok";
|
|
564
|
+
readonly service: "admin-api";
|
|
565
|
+
}
|
|
566
|
+
/** `init` が local manifest に保存してよい Project の非機密フィールドだけを表す。 */
|
|
567
|
+
interface SafeProject {
|
|
568
|
+
readonly id: string;
|
|
569
|
+
readonly organizationId: string;
|
|
570
|
+
readonly name: string;
|
|
571
|
+
readonly slug: string;
|
|
572
|
+
readonly status: "active" | "suspended" | "archived";
|
|
573
|
+
readonly createdAt: string;
|
|
574
|
+
readonly updatedAt: string;
|
|
575
|
+
}
|
|
576
|
+
interface ProjectListResult {
|
|
577
|
+
readonly projects: readonly SafeProject[];
|
|
578
|
+
readonly truncated: boolean;
|
|
579
|
+
}
|
|
580
|
+
interface PublicationConfirmationRequiredDetails {
|
|
581
|
+
readonly requestId: string;
|
|
582
|
+
readonly publicationId: string;
|
|
583
|
+
readonly verificationUri: string;
|
|
584
|
+
readonly expiresIn: number;
|
|
585
|
+
readonly pollInterval: number;
|
|
586
|
+
}
|
|
587
|
+
interface AdminPublicationPlanRequest {
|
|
588
|
+
readonly environment: "production";
|
|
589
|
+
readonly connectorId: string;
|
|
590
|
+
readonly candidateContract: unknown;
|
|
591
|
+
readonly candidateCommitment: string;
|
|
592
|
+
readonly templateProvenance?: {
|
|
593
|
+
readonly templateId: string;
|
|
594
|
+
readonly applicationCommitment: string;
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
interface AdminPublicationConfirmation {
|
|
598
|
+
readonly confirmationId: string;
|
|
599
|
+
readonly signature: string;
|
|
600
|
+
readonly confirmed: true;
|
|
601
|
+
}
|
|
602
|
+
interface AdminPublicationApplyRequest extends AdminPublicationPlanRequest {
|
|
603
|
+
readonly planCommitment: string;
|
|
604
|
+
readonly confirmation: AdminPublicationConfirmation | null;
|
|
605
|
+
}
|
|
606
|
+
interface OpenApiImportRequest {
|
|
607
|
+
readonly source: string;
|
|
608
|
+
readonly connectorId: string;
|
|
609
|
+
readonly expectedPlanCommitment?: string;
|
|
610
|
+
readonly format?: "json" | "yaml";
|
|
611
|
+
readonly baseUrl?: string;
|
|
612
|
+
readonly serviceName?: string;
|
|
613
|
+
}
|
|
614
|
+
interface OpenApiImportOperationSummary {
|
|
615
|
+
readonly toolName: string;
|
|
616
|
+
readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
617
|
+
readonly path: string;
|
|
618
|
+
readonly riskLevel: string;
|
|
619
|
+
readonly scopes: readonly string[];
|
|
620
|
+
readonly piiFields: readonly string[];
|
|
621
|
+
readonly widgetTemplate: string;
|
|
622
|
+
readonly warnings: readonly string[];
|
|
623
|
+
readonly publishable: boolean;
|
|
624
|
+
readonly gateErrors: readonly {
|
|
625
|
+
readonly source: string;
|
|
626
|
+
readonly code: string;
|
|
627
|
+
}[];
|
|
628
|
+
readonly diff: {
|
|
629
|
+
readonly operation: "create" | "update";
|
|
630
|
+
readonly changedFields: readonly string[];
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
interface OpenApiImportPlanResult {
|
|
634
|
+
readonly sourceCommitment: string;
|
|
635
|
+
readonly connectorId: string;
|
|
636
|
+
readonly planCommitment: string;
|
|
637
|
+
readonly format: "json" | "yaml";
|
|
638
|
+
readonly openapiVersion: string;
|
|
639
|
+
readonly operationCount: number;
|
|
640
|
+
readonly operations: readonly OpenApiImportOperationSummary[];
|
|
641
|
+
}
|
|
642
|
+
interface OpenApiImportDraftResult {
|
|
643
|
+
readonly sourceCommitment: string;
|
|
644
|
+
readonly connectorId: string;
|
|
645
|
+
readonly operationCount: number;
|
|
646
|
+
readonly drafts: readonly {
|
|
647
|
+
readonly toolName: string;
|
|
648
|
+
readonly action: "create" | "update";
|
|
649
|
+
readonly toolId: string;
|
|
650
|
+
readonly versionId: string;
|
|
651
|
+
readonly version: number;
|
|
652
|
+
readonly contractId: string;
|
|
653
|
+
readonly publishable: boolean;
|
|
654
|
+
}[];
|
|
655
|
+
}
|
|
656
|
+
interface SafeCustomDomain {
|
|
657
|
+
readonly id: string;
|
|
658
|
+
readonly hostname: string;
|
|
659
|
+
readonly status: string;
|
|
660
|
+
readonly provider: string;
|
|
661
|
+
readonly sslStatus: string | null;
|
|
662
|
+
readonly createdAt: string;
|
|
663
|
+
readonly verifiedAt: string | null;
|
|
664
|
+
readonly activatedAt: string | null;
|
|
665
|
+
}
|
|
666
|
+
interface DnsSetupRecord {
|
|
667
|
+
readonly type: "CNAME" | "TXT";
|
|
668
|
+
readonly name: string;
|
|
669
|
+
readonly value: string;
|
|
670
|
+
}
|
|
671
|
+
interface DomainCreateResult {
|
|
672
|
+
readonly domain: SafeCustomDomain;
|
|
673
|
+
readonly dnsSetup: {
|
|
674
|
+
readonly records: readonly DnsSetupRecord[];
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
interface ReviewPackageMetadata {
|
|
678
|
+
readonly id: string;
|
|
679
|
+
readonly version: string;
|
|
680
|
+
readonly status: string;
|
|
681
|
+
readonly schemaVersion: string | null;
|
|
682
|
+
readonly releaseSha: string | null;
|
|
683
|
+
readonly bundleHash: string | null;
|
|
684
|
+
readonly createdAt: string;
|
|
685
|
+
}
|
|
686
|
+
interface ReviewPackageCreateResult {
|
|
687
|
+
readonly reviewPackage: ReviewPackageMetadata;
|
|
688
|
+
readonly evidence: Readonly<JsonObject>;
|
|
689
|
+
}
|
|
690
|
+
type ReviewPackageCreateRequest = {
|
|
691
|
+
readonly projectId: string;
|
|
692
|
+
readonly version: string;
|
|
693
|
+
readonly target: string;
|
|
694
|
+
readonly idempotencyKey?: string;
|
|
695
|
+
} | {
|
|
696
|
+
readonly projectId: string;
|
|
697
|
+
readonly version: string;
|
|
698
|
+
readonly templateId: string;
|
|
699
|
+
readonly templateApplicationCommitment: string;
|
|
700
|
+
readonly idempotencyKey?: string;
|
|
701
|
+
};
|
|
702
|
+
interface OAuthClientSummary {
|
|
703
|
+
readonly id: string;
|
|
704
|
+
readonly projectId: string;
|
|
705
|
+
readonly clientId: string;
|
|
706
|
+
readonly redirectUris: readonly string[];
|
|
707
|
+
readonly allowedScopes: readonly string[];
|
|
708
|
+
readonly secretPresence: "configured" | "not_configured";
|
|
709
|
+
readonly status: string;
|
|
710
|
+
}
|
|
711
|
+
interface OAuthScopeSummary {
|
|
712
|
+
readonly id: string;
|
|
713
|
+
readonly name: string;
|
|
714
|
+
readonly description: string;
|
|
715
|
+
readonly riskLevel: string;
|
|
716
|
+
}
|
|
717
|
+
interface OAuthReadinessIssue {
|
|
718
|
+
readonly kind: string;
|
|
719
|
+
readonly message: string;
|
|
720
|
+
}
|
|
721
|
+
interface OAuthSetupResult {
|
|
722
|
+
readonly clients: readonly OAuthClientSummary[];
|
|
723
|
+
readonly scopes: readonly OAuthScopeSummary[];
|
|
724
|
+
readonly metadata: {
|
|
725
|
+
readonly status: "valid" | "incomplete";
|
|
726
|
+
readonly issues: readonly OAuthReadinessIssue[];
|
|
727
|
+
};
|
|
728
|
+
readonly alignment: {
|
|
729
|
+
readonly mcpResource: string | null;
|
|
730
|
+
readonly audience: string | null;
|
|
731
|
+
readonly upstreamResource: string | null;
|
|
732
|
+
readonly toolScopes: readonly string[];
|
|
733
|
+
readonly grantedScopes: readonly string[];
|
|
734
|
+
readonly issues: readonly OAuthReadinessIssue[];
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
interface OAuthScopesSyncResult {
|
|
738
|
+
readonly mode: "preview" | "applied";
|
|
739
|
+
readonly added: readonly string[];
|
|
740
|
+
readonly updated: readonly string[];
|
|
741
|
+
readonly existing: readonly string[];
|
|
742
|
+
readonly unchanged: boolean;
|
|
743
|
+
}
|
|
744
|
+
interface OAuthClientScopeMapResult {
|
|
745
|
+
readonly mode: "preview" | "applied";
|
|
746
|
+
readonly clientRegistryId: string;
|
|
747
|
+
readonly clientId: string;
|
|
748
|
+
readonly added: readonly string[];
|
|
749
|
+
readonly existing: readonly string[];
|
|
750
|
+
readonly unchanged: boolean;
|
|
751
|
+
readonly requiredScopesCommitment: `sha256:${string}`;
|
|
752
|
+
readonly baseClientGrantCommitment: `sha256:${string}`;
|
|
753
|
+
readonly candidateClientGrantCommitment: `sha256:${string}`;
|
|
754
|
+
readonly planCommitment: `sha256:${string}`;
|
|
755
|
+
}
|
|
756
|
+
type OAuthClientScopeMapRequest = {
|
|
757
|
+
readonly projectId: string;
|
|
758
|
+
readonly clientRegistryId: string;
|
|
759
|
+
readonly apply: false;
|
|
760
|
+
} | {
|
|
761
|
+
readonly projectId: string;
|
|
762
|
+
readonly clientRegistryId: string;
|
|
763
|
+
readonly apply: true;
|
|
764
|
+
readonly requiredScopesCommitment: `sha256:${string}`;
|
|
765
|
+
readonly baseClientGrantCommitment: `sha256:${string}`;
|
|
766
|
+
readonly candidateClientGrantCommitment: `sha256:${string}`;
|
|
767
|
+
readonly planCommitment: `sha256:${string}`;
|
|
768
|
+
readonly idempotencyKey?: string;
|
|
769
|
+
};
|
|
770
|
+
interface OAuthTestLoginCheck {
|
|
771
|
+
readonly id: OAuthTestLoginCheckId;
|
|
772
|
+
readonly status: "pass" | "fail" | "deferred";
|
|
773
|
+
readonly detail: string;
|
|
774
|
+
}
|
|
775
|
+
interface OAuthTestLoginResult {
|
|
776
|
+
readonly status: "preflight_ready" | "blocked";
|
|
777
|
+
readonly clientRegistryId: string;
|
|
778
|
+
readonly checks: readonly OAuthTestLoginCheck[];
|
|
779
|
+
}
|
|
780
|
+
declare const OAUTH_TEST_LOGIN_CHECK_IDS: readonly ["oauth_metadata", "active_client", "redirect_uri", "resource_separation", "scope_registry_sync", "scope_mapping", "token_audience_live_evidence"];
|
|
781
|
+
type OAuthTestLoginCheckId = (typeof OAUTH_TEST_LOGIN_CHECK_IDS)[number];
|
|
782
|
+
interface SafeLogEntry {
|
|
783
|
+
readonly id: string;
|
|
784
|
+
readonly createdAt: string;
|
|
785
|
+
readonly eventType: string;
|
|
786
|
+
readonly decision: string;
|
|
787
|
+
readonly actorType: string;
|
|
788
|
+
readonly toolName: string | null;
|
|
789
|
+
readonly scope: string | null;
|
|
790
|
+
readonly requestId: string | null;
|
|
791
|
+
readonly traceId: string | null;
|
|
792
|
+
readonly reason: string | null;
|
|
793
|
+
readonly latencyMs: number | null;
|
|
794
|
+
readonly upstreamStatus: string | null;
|
|
795
|
+
}
|
|
796
|
+
interface LogsResult {
|
|
797
|
+
readonly logs: readonly SafeLogEntry[];
|
|
798
|
+
readonly nextCursor: string | null;
|
|
799
|
+
}
|
|
800
|
+
interface AuditExportManifest {
|
|
801
|
+
readonly schemaVersion: "andpipe.audit-export.manifest.v1";
|
|
802
|
+
readonly jobId: string;
|
|
803
|
+
readonly organizationCommitment: string;
|
|
804
|
+
readonly projectId: string | null;
|
|
805
|
+
readonly from: string;
|
|
806
|
+
readonly to: string;
|
|
807
|
+
readonly recordSchemaVersion: "andpipe.audit-export.record.v1";
|
|
808
|
+
readonly contentType: "application/x-ndjson";
|
|
809
|
+
readonly contentEncoding: "utf-8";
|
|
810
|
+
readonly contentSha256: string;
|
|
811
|
+
readonly byteCount: number;
|
|
812
|
+
readonly recordCount: number;
|
|
813
|
+
readonly objectGeneration: string;
|
|
814
|
+
readonly createdAt: string;
|
|
815
|
+
readonly expiresAt: string;
|
|
816
|
+
}
|
|
817
|
+
interface AuditExportIntegrity {
|
|
818
|
+
readonly manifest: AuditExportManifest;
|
|
819
|
+
readonly manifestSha256: string;
|
|
820
|
+
readonly signatureAlgorithm: "RSA_PSS_SHA256";
|
|
821
|
+
readonly signingKeyVersion: string;
|
|
822
|
+
readonly signature: string;
|
|
823
|
+
}
|
|
824
|
+
interface AuditExportSummary {
|
|
825
|
+
readonly id: string;
|
|
826
|
+
readonly projectId: string | null;
|
|
827
|
+
readonly from: string;
|
|
828
|
+
readonly to: string;
|
|
829
|
+
readonly status: "queued" | "running" | "completed" | "failed";
|
|
830
|
+
readonly schemaVersion: "andpipe.audit-export.record.v1";
|
|
831
|
+
readonly attemptCount: number;
|
|
832
|
+
readonly contentSha256: string | null;
|
|
833
|
+
readonly byteCount: number | null;
|
|
834
|
+
readonly recordCount: number | null;
|
|
835
|
+
readonly integrity: AuditExportIntegrity | null;
|
|
836
|
+
readonly completedAt: string | null;
|
|
837
|
+
readonly expiresAt: string | null;
|
|
838
|
+
readonly failureCode: string | null;
|
|
839
|
+
readonly createdAt: string;
|
|
840
|
+
readonly updatedAt: string;
|
|
841
|
+
}
|
|
842
|
+
interface AuditExportListResult {
|
|
843
|
+
readonly auditExports: readonly AuditExportSummary[];
|
|
844
|
+
readonly nextCursor: string | null;
|
|
845
|
+
}
|
|
846
|
+
interface AuditExportDownloadAuthorization extends AuditExportIntegrity {
|
|
847
|
+
readonly url: string;
|
|
848
|
+
readonly expiresAt: string;
|
|
849
|
+
}
|
|
850
|
+
interface CurrentAdminCredential {
|
|
851
|
+
readonly active: true;
|
|
852
|
+
readonly organizationId: string;
|
|
853
|
+
readonly userId: string;
|
|
854
|
+
readonly subject: string;
|
|
855
|
+
readonly scope: readonly string[];
|
|
856
|
+
readonly expiresAt: string;
|
|
857
|
+
}
|
|
858
|
+
interface OnboardingTemplatePlanResult {
|
|
859
|
+
readonly projectId: string;
|
|
860
|
+
readonly templateId: string;
|
|
861
|
+
readonly templateVersion: string;
|
|
862
|
+
readonly operation: OnboardingTemplateOperation;
|
|
863
|
+
readonly currentApplicationCommitment: string | null;
|
|
864
|
+
readonly rollbackFromRevision: number | null;
|
|
865
|
+
readonly templateCommitment: string;
|
|
866
|
+
readonly bindingCommitment: string;
|
|
867
|
+
readonly candidateApplicationCommitment: string;
|
|
868
|
+
readonly planCommitment: string;
|
|
869
|
+
readonly diff: readonly OnboardingTemplateSafeDiffEntry[];
|
|
870
|
+
}
|
|
871
|
+
interface OnboardingTemplateApplyResult {
|
|
872
|
+
readonly applicationId: string;
|
|
873
|
+
readonly projectId: string;
|
|
874
|
+
readonly templateId: string;
|
|
875
|
+
readonly templateVersion: string;
|
|
876
|
+
readonly revision: number;
|
|
877
|
+
readonly operation: OnboardingTemplateOperation;
|
|
878
|
+
readonly rollbackFromRevision: number | null;
|
|
879
|
+
readonly templateCommitment: string;
|
|
880
|
+
readonly bindingCommitment: string;
|
|
881
|
+
readonly applicationCommitment: string;
|
|
882
|
+
readonly planCommitment: string;
|
|
883
|
+
readonly diff: readonly OnboardingTemplateSafeDiffEntry[];
|
|
884
|
+
}
|
|
885
|
+
interface OnboardingTemplateExportResult {
|
|
886
|
+
readonly schemaVersion: "andpipe.external-saas-template-export.v1";
|
|
887
|
+
readonly projectId: string;
|
|
888
|
+
readonly applicationId: string;
|
|
889
|
+
readonly revision: number;
|
|
890
|
+
readonly operation: Exclude<OnboardingTemplateOperation, "noop">;
|
|
891
|
+
readonly manifest: ExternalSaasTemplateV1;
|
|
892
|
+
readonly bindings: OnboardingTemplateBindings;
|
|
893
|
+
readonly templateCommitment: string;
|
|
894
|
+
readonly bindingCommitment: string;
|
|
895
|
+
readonly applicationCommitment: string;
|
|
896
|
+
}
|
|
897
|
+
interface OnboardingTemplateApplyRequest {
|
|
898
|
+
readonly manifest: ExternalSaasTemplateV1;
|
|
899
|
+
readonly bindings: OnboardingTemplateBindings;
|
|
900
|
+
readonly expectedCurrentApplicationCommitment: string | null;
|
|
901
|
+
readonly planCommitment: string;
|
|
902
|
+
readonly confirmed: true;
|
|
903
|
+
}
|
|
904
|
+
interface ReviewPackageDownloadResult {
|
|
905
|
+
readonly reviewPackage: {
|
|
906
|
+
readonly id: string;
|
|
907
|
+
readonly projectId: string;
|
|
908
|
+
readonly version: string;
|
|
909
|
+
readonly status: string;
|
|
910
|
+
readonly evidenceJson: Readonly<JsonObject>;
|
|
911
|
+
readonly createdAt: string;
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
declare class AdminApiClient {
|
|
915
|
+
#private;
|
|
916
|
+
constructor(options: AdminApiClientOptions);
|
|
917
|
+
health(): Promise<AdminHealth>;
|
|
918
|
+
getCurrentCredential(): Promise<CurrentAdminCredential>;
|
|
919
|
+
revokeCurrentCredential(idempotencyKey?: string): Promise<{
|
|
920
|
+
revoked: true;
|
|
921
|
+
}>;
|
|
922
|
+
listProjects(input: {
|
|
923
|
+
readonly limit: number;
|
|
924
|
+
readonly slug?: string;
|
|
925
|
+
}): Promise<ProjectListResult>;
|
|
926
|
+
getProject(projectId: string): Promise<SafeProject>;
|
|
927
|
+
createProject(input: {
|
|
928
|
+
readonly name: string;
|
|
929
|
+
readonly slug: string;
|
|
930
|
+
readonly idempotencyKey: string;
|
|
931
|
+
}): Promise<SafeProject>;
|
|
932
|
+
createConnector(input: {
|
|
933
|
+
readonly projectId: string;
|
|
934
|
+
readonly idempotencyKey: string;
|
|
935
|
+
readonly connector: {
|
|
936
|
+
readonly name: string;
|
|
937
|
+
readonly kind: "existing_api" | "adapter" | "ai_api" | "governed_data";
|
|
938
|
+
readonly upstreamAuthMode: "token_exchange" | "service_account" | "existing_oauth" | "signed_request";
|
|
939
|
+
readonly secretRef: string | null;
|
|
940
|
+
readonly config: Readonly<Record<string, unknown>>;
|
|
941
|
+
readonly status: "active";
|
|
942
|
+
};
|
|
943
|
+
}): Promise<{
|
|
944
|
+
readonly id: string;
|
|
945
|
+
readonly projectId: string;
|
|
946
|
+
readonly name: string;
|
|
947
|
+
readonly kind: "existing_api" | "adapter" | "ai_api" | "governed_data";
|
|
948
|
+
readonly upstreamAuthMode: "token_exchange" | "service_account" | "existing_oauth" | "signed_request";
|
|
949
|
+
readonly secretRef: string | null;
|
|
950
|
+
readonly config: Readonly<Record<string, unknown>> | null;
|
|
951
|
+
readonly status: "active" | "disabled";
|
|
952
|
+
}>;
|
|
953
|
+
planPublication(projectId: string, body: AdminPublicationPlanRequest): Promise<unknown>;
|
|
954
|
+
applyPublication(projectId: string, idempotencyKey: string, body: AdminPublicationApplyRequest): Promise<unknown>;
|
|
955
|
+
planOpenApiImport(projectId: string, input: OpenApiImportRequest): Promise<OpenApiImportPlanResult>;
|
|
956
|
+
applyOpenApiImport(projectId: string, idempotencyKey: string, input: OpenApiImportRequest): Promise<OpenApiImportDraftResult>;
|
|
957
|
+
planOnboardingTemplate(projectId: string, manifestInput: unknown, bindingsInput: unknown): Promise<OnboardingTemplatePlanResult>;
|
|
958
|
+
applyOnboardingTemplate(projectId: string, idempotencyKey: string, input: OnboardingTemplateApplyRequest): Promise<OnboardingTemplateApplyResult>;
|
|
959
|
+
exportOnboardingTemplate(projectId: string, templateId: string): Promise<OnboardingTemplateExportResult>;
|
|
960
|
+
planOnboardingTemplateRollback(projectId: string, templateId: string, targetRevision: number): Promise<OnboardingTemplatePlanResult>;
|
|
961
|
+
rollbackOnboardingTemplate(projectId: string, templateId: string, idempotencyKey: string, input: {
|
|
962
|
+
readonly targetRevision: number;
|
|
963
|
+
readonly expectedCurrentApplicationCommitment: string;
|
|
964
|
+
readonly planCommitment: string;
|
|
965
|
+
readonly confirmed: true;
|
|
966
|
+
}): Promise<OnboardingTemplateApplyResult>;
|
|
967
|
+
getPublication(projectId: string, publicationId: string): Promise<unknown>;
|
|
968
|
+
createDomain(input: {
|
|
969
|
+
projectId: string;
|
|
970
|
+
hostname: string;
|
|
971
|
+
provider: string;
|
|
972
|
+
idempotencyKey?: string;
|
|
973
|
+
}): Promise<DomainCreateResult>;
|
|
974
|
+
getDomainByHostname(projectId: string, hostname: string): Promise<SafeCustomDomain>;
|
|
975
|
+
createReviewPackage(input: ReviewPackageCreateRequest): Promise<ReviewPackageCreateResult>;
|
|
976
|
+
downloadReviewPackage(projectId: string, id: string, format: "json" | "markdown"): Promise<ReviewPackageDownloadResult | string>;
|
|
977
|
+
getOAuthSetup(projectId: string): Promise<OAuthSetupResult>;
|
|
978
|
+
syncOAuthScopes(input: {
|
|
979
|
+
projectId: string;
|
|
980
|
+
apply: boolean;
|
|
981
|
+
idempotencyKey?: string;
|
|
982
|
+
}): Promise<OAuthScopesSyncResult>;
|
|
983
|
+
mapOAuthClientScopes(input: OAuthClientScopeMapRequest): Promise<OAuthClientScopeMapResult>;
|
|
984
|
+
testOAuthLogin(projectId: string, clientRegistryId: string): Promise<OAuthTestLoginResult>;
|
|
985
|
+
createAuditExport(input: {
|
|
986
|
+
projectId: string | null;
|
|
987
|
+
from: string;
|
|
988
|
+
to: string;
|
|
989
|
+
idempotencyKey?: string;
|
|
990
|
+
}): Promise<AuditExportSummary>;
|
|
991
|
+
listAuditExports(input?: {
|
|
992
|
+
projectId?: string;
|
|
993
|
+
limit?: number;
|
|
994
|
+
cursor?: string;
|
|
995
|
+
}): Promise<AuditExportListResult>;
|
|
996
|
+
getAuditExport(id: string): Promise<AuditExportSummary>;
|
|
997
|
+
retryAuditExport(id: string, idempotencyKey?: string): Promise<AuditExportSummary>;
|
|
998
|
+
authorizeAuditExportDownload(id: string, idempotencyKey?: string): Promise<AuditExportDownloadAuthorization>;
|
|
999
|
+
getLogs(projectId: string, limit: number): Promise<LogsResult>;
|
|
1000
|
+
}
|
|
1001
|
+
declare function createAdminApiClient(options?: CreateAdminApiClientOptions): AdminApiClient;
|
|
1002
|
+
/** OAuth/OIDC discovery のための bearer 無し bounded GET。redirect と raw error body を拒否する。 */
|
|
1003
|
+
declare function fetchOAuthMetadata(issuer: string, options?: {
|
|
1004
|
+
readonly fetch?: AdminFetch;
|
|
1005
|
+
readonly sleep?: AdminSleep;
|
|
1006
|
+
}): Promise<unknown>;
|
|
1007
|
+
|
|
1008
|
+
interface OpenApiImportCommandOptions {
|
|
1009
|
+
readonly file?: string;
|
|
1010
|
+
readonly project?: string;
|
|
1011
|
+
readonly connector?: string;
|
|
1012
|
+
readonly profile?: string;
|
|
1013
|
+
readonly format?: string;
|
|
1014
|
+
readonly baseUrl?: string;
|
|
1015
|
+
readonly serviceName?: string;
|
|
1016
|
+
readonly apply?: boolean;
|
|
1017
|
+
readonly yes?: boolean;
|
|
1018
|
+
readonly idempotencyKey?: string;
|
|
1019
|
+
readonly planCommitment?: string;
|
|
1020
|
+
}
|
|
1021
|
+
interface OpenApiImportApi {
|
|
1022
|
+
planOpenApiImport(projectId: string, input: OpenApiImportRequest): Promise<OpenApiImportPlanResult>;
|
|
1023
|
+
applyOpenApiImport(projectId: string, idempotencyKey: string, input: OpenApiImportRequest): Promise<OpenApiImportDraftResult>;
|
|
1024
|
+
}
|
|
1025
|
+
interface OpenApiImportRuntime {
|
|
1026
|
+
readonly createClient: (profile: string) => OpenApiImportApi;
|
|
1027
|
+
readonly idempotencyKey: () => string;
|
|
1028
|
+
}
|
|
1029
|
+
declare function createOpenApiImportRuntime(createClient?: (profile: string) => OpenApiImportApi): OpenApiImportRuntime;
|
|
1030
|
+
declare function runOpenApiImportCommand(options: OpenApiImportCommandOptions, writer: Writer, cwd: string, runtime?: OpenApiImportRuntime): Promise<void>;
|
|
1031
|
+
declare function registerOpenApi(program: Command, writer: Writer, cwd: () => string, runtime?: OpenApiImportRuntime): void;
|
|
1032
|
+
|
|
1033
|
+
interface PublicationPlanRequest {
|
|
1034
|
+
readonly environment: "production";
|
|
1035
|
+
readonly connectorId: string;
|
|
1036
|
+
readonly candidateContract: unknown;
|
|
1037
|
+
readonly candidateCommitment: string;
|
|
1038
|
+
readonly templateProvenance?: {
|
|
1039
|
+
readonly templateId: string;
|
|
1040
|
+
readonly applicationCommitment: string;
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
interface PublicationConfirmation {
|
|
1044
|
+
readonly confirmationId: string;
|
|
1045
|
+
readonly signature: string;
|
|
1046
|
+
readonly confirmed: true;
|
|
1047
|
+
}
|
|
1048
|
+
interface PublicationApplyRequest extends PublicationPlanRequest {
|
|
1049
|
+
readonly planCommitment: string;
|
|
1050
|
+
readonly confirmation: PublicationConfirmation | null;
|
|
1051
|
+
}
|
|
1052
|
+
/** Production backendはこの最小adapterへ閉じ込め、状態機械のunit testはnetworkを使わない。 */
|
|
1053
|
+
interface PublishApiClient {
|
|
1054
|
+
planPublication(projectId: string, body: PublicationPlanRequest): Promise<unknown>;
|
|
1055
|
+
applyPublication(projectId: string, idempotencyKey: string, body: PublicationApplyRequest): Promise<unknown>;
|
|
1056
|
+
getPublication(projectId: string, publicationId: string): Promise<unknown>;
|
|
1057
|
+
}
|
|
1058
|
+
type PublishApiFactory = (profile: string) => PublishApiClient;
|
|
1059
|
+
interface PublishCommandOptions {
|
|
1060
|
+
readonly connector?: string;
|
|
1061
|
+
readonly dryRun?: boolean;
|
|
1062
|
+
readonly apply?: boolean;
|
|
1063
|
+
readonly yes?: boolean;
|
|
1064
|
+
readonly profile?: string;
|
|
1065
|
+
readonly project?: string;
|
|
1066
|
+
}
|
|
1067
|
+
interface PublishCommandRuntime {
|
|
1068
|
+
createClient(profile: string): PublishApiClient;
|
|
1069
|
+
loadProject(cwd: string): LoadedDevProject;
|
|
1070
|
+
randomUuid(): string;
|
|
1071
|
+
monotonicNow(): number;
|
|
1072
|
+
wallNow(): number;
|
|
1073
|
+
sleep(milliseconds: number): Promise<void>;
|
|
1074
|
+
}
|
|
1075
|
+
interface NormalizedPublishOptions {
|
|
1076
|
+
readonly mode: "dry-run" | "apply";
|
|
1077
|
+
readonly connectorId?: string;
|
|
1078
|
+
readonly profile: string;
|
|
1079
|
+
readonly projectId?: string;
|
|
1080
|
+
}
|
|
1081
|
+
declare class PublishCommandError extends Error {
|
|
1082
|
+
readonly code: string;
|
|
1083
|
+
readonly reason: string;
|
|
1084
|
+
readonly status?: number | undefined;
|
|
1085
|
+
constructor(code: string, reason: string, message: string, status?: number | undefined);
|
|
1086
|
+
}
|
|
1087
|
+
declare function createPublishCommandRuntime(createClient: PublishApiFactory): PublishCommandRuntime;
|
|
1088
|
+
declare function normalizePublishOptions(options: PublishCommandOptions, messages?: CliPublishWorkflowMessages): NormalizedPublishOptions;
|
|
1089
|
+
declare function runPublishCommand(options: PublishCommandOptions, writer: Writer, cwd: string, runtime: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): Promise<void>;
|
|
1090
|
+
declare function registerPublish(program: Command, writer: Writer, cwd: () => string, createClient: PublishApiFactory, description?: string, runtime?: PublishCommandRuntime, messages?: CliPublishWorkflowMessages): void;
|
|
1091
|
+
|
|
1092
|
+
interface BoundedFileOptions {
|
|
1093
|
+
maxBytes: number;
|
|
1094
|
+
/** 指定時は、open済みfileの実体がこのroot内にあることも検証する。 */
|
|
1095
|
+
root?: string;
|
|
1096
|
+
/** trueの場合はroot直下のbasenameだけを許可する。 */
|
|
1097
|
+
directChildOnly?: boolean;
|
|
1098
|
+
}
|
|
1099
|
+
interface BoundedLocalFileSnapshot {
|
|
1100
|
+
readonly text: string;
|
|
1101
|
+
readonly identity: {
|
|
1102
|
+
readonly dev: number;
|
|
1103
|
+
readonly ino: number;
|
|
1104
|
+
readonly nlink: number;
|
|
1105
|
+
readonly size: number;
|
|
1106
|
+
readonly uid: number;
|
|
1107
|
+
/** file type bitsを除いたPOSIX permission / special mode。 */
|
|
1108
|
+
readonly mode: number;
|
|
1109
|
+
};
|
|
1110
|
+
/** bounded readしたraw UTF-8 bytesのSHA-256。 */
|
|
1111
|
+
readonly sha256: string;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* SoT §15.5の共通reader。path値やfile内容はerrorへ含めない。
|
|
1115
|
+
*/
|
|
1116
|
+
declare function readBoundedLocalFileSnapshot(path: string, options: BoundedFileOptions): BoundedLocalFileSnapshot;
|
|
1117
|
+
|
|
1118
|
+
interface TemplateApi {
|
|
1119
|
+
planOnboardingTemplate(projectId: string, manifest: unknown, bindings: unknown): Promise<OnboardingTemplatePlanResult>;
|
|
1120
|
+
applyOnboardingTemplate(projectId: string, idempotencyKey: string, input: OnboardingTemplateApplyRequest): Promise<OnboardingTemplateApplyResult>;
|
|
1121
|
+
exportOnboardingTemplate(projectId: string, templateId: string): Promise<OnboardingTemplateExportResult>;
|
|
1122
|
+
planOnboardingTemplateRollback(projectId: string, templateId: string, targetRevision: number): Promise<OnboardingTemplatePlanResult>;
|
|
1123
|
+
rollbackOnboardingTemplate(projectId: string, templateId: string, idempotencyKey: string, input: {
|
|
1124
|
+
readonly targetRevision: number;
|
|
1125
|
+
readonly expectedCurrentApplicationCommitment: string;
|
|
1126
|
+
readonly planCommitment: string;
|
|
1127
|
+
readonly confirmed: true;
|
|
1128
|
+
}): Promise<OnboardingTemplateApplyResult>;
|
|
1129
|
+
}
|
|
1130
|
+
interface TemplateCommandRuntime {
|
|
1131
|
+
readonly createClient: (profile: string) => TemplateApi;
|
|
1132
|
+
readonly idempotencyKey: () => string;
|
|
1133
|
+
}
|
|
1134
|
+
declare function createTemplateCommandRuntime(createClient?: (profile: string) => TemplateApi): TemplateCommandRuntime;
|
|
1135
|
+
interface LoadedOnboardingTemplateArtifact {
|
|
1136
|
+
readonly manifest: ExternalSaasTemplateV1;
|
|
1137
|
+
readonly bindings: OnboardingTemplateBindings;
|
|
1138
|
+
readonly exportProjectId?: string;
|
|
1139
|
+
readonly exportApplicationCommitment?: string;
|
|
1140
|
+
readonly sourceSnapshot: ReturnType<typeof readBoundedLocalFileSnapshot>["identity"] & {
|
|
1141
|
+
readonly sha256: string;
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
declare function loadOnboardingTemplateArtifact(cwd: string, file: string, bindingsFile?: string): LoadedOnboardingTemplateArtifact;
|
|
1145
|
+
declare function runTemplatePlanOrApply(options: {
|
|
1146
|
+
readonly file: string;
|
|
1147
|
+
readonly bindings?: string;
|
|
1148
|
+
readonly project: string;
|
|
1149
|
+
readonly profile?: string;
|
|
1150
|
+
readonly apply?: boolean;
|
|
1151
|
+
readonly yes?: boolean;
|
|
1152
|
+
readonly planCommitment?: string;
|
|
1153
|
+
readonly expectedCurrent?: string;
|
|
1154
|
+
readonly idempotencyKey?: string;
|
|
1155
|
+
}, writer: Writer, cwd: string, runtime?: TemplateCommandRuntime): Promise<void>;
|
|
1156
|
+
declare function runTemplateRollback(options: {
|
|
1157
|
+
readonly project: string;
|
|
1158
|
+
readonly template: string;
|
|
1159
|
+
readonly targetRevision: string;
|
|
1160
|
+
readonly profile?: string;
|
|
1161
|
+
readonly apply?: boolean;
|
|
1162
|
+
readonly yes?: boolean;
|
|
1163
|
+
readonly planCommitment?: string;
|
|
1164
|
+
readonly expectedCurrent?: string;
|
|
1165
|
+
readonly idempotencyKey?: string;
|
|
1166
|
+
}, writer: Writer, runtime?: TemplateCommandRuntime): Promise<void>;
|
|
1167
|
+
declare function registerTemplate(program: Command, writer: Writer, cwd: () => string, runtime?: TemplateCommandRuntime): void;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* validate command (Issue #63)。Tool Contract を 10 項目 + publish gate でローカル検査する。
|
|
1171
|
+
* network / backend を要する項目は pending として報告し、安全 gate の error は exit 1 にする。
|
|
1172
|
+
*/
|
|
1173
|
+
declare function resolveContractPath(file: string | undefined, cwd: string, locale?: SupportedLocale): string;
|
|
1174
|
+
declare function loadContract(path: string, locale?: SupportedLocale): unknown;
|
|
1175
|
+
|
|
1176
|
+
declare const ADMIN_CLI_HANDOFF_GRANT: "urn:andpipe:params:oauth:grant-type:admin-cli-handoff";
|
|
1177
|
+
type AdminCliHandoffFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
1178
|
+
interface AdminCliHandoffRuntime {
|
|
1179
|
+
fetch: AdminCliHandoffFetch;
|
|
1180
|
+
now: () => number;
|
|
1181
|
+
sleep: (milliseconds: number) => Promise<void>;
|
|
1182
|
+
randomBytes: RandomBytes;
|
|
1183
|
+
}
|
|
1184
|
+
interface LoginAdminCliInput {
|
|
1185
|
+
profile?: string;
|
|
1186
|
+
requestedScopes?: readonly string[];
|
|
1187
|
+
env?: NodeJS.ProcessEnv;
|
|
1188
|
+
runtime?: Partial<AdminCliHandoffRuntime>;
|
|
1189
|
+
/** raw code / verifierを公開せず、request_idだけのWeb Admin URLを通知する。 */
|
|
1190
|
+
onVerificationUri?: (verificationUri: string) => void;
|
|
1191
|
+
/** raw exchange codeとは別の、手元CLI照合用user codeを一度だけ通知する。 */
|
|
1192
|
+
onUserCode?: (userCode: string) => void;
|
|
1193
|
+
}
|
|
1194
|
+
declare class AdminCliHandoffError extends Error {
|
|
1195
|
+
readonly code: string;
|
|
1196
|
+
constructor(code: string, message: string);
|
|
1197
|
+
}
|
|
1198
|
+
declare function loginAdminCli(input?: LoginAdminCliInput): Promise<CredentialRecord>;
|
|
1199
|
+
|
|
1200
|
+
type ConfigMcpFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
1201
|
+
declare class ConfigMcpClientError extends Error {
|
|
1202
|
+
readonly code: string;
|
|
1203
|
+
constructor(code: string, message: string);
|
|
1204
|
+
}
|
|
1205
|
+
interface ConfigMcpToolSummary {
|
|
1206
|
+
readonly name: string;
|
|
1207
|
+
readonly title?: string;
|
|
1208
|
+
readonly description?: string;
|
|
1209
|
+
}
|
|
1210
|
+
declare function probeConfigMcpTools(record: ConfigMcpCredentialRecord, options?: {
|
|
1211
|
+
readonly fetch?: ConfigMcpFetch;
|
|
1212
|
+
readonly requestId?: string;
|
|
1213
|
+
}): Promise<readonly ConfigMcpToolSummary[]>;
|
|
1214
|
+
|
|
1215
|
+
/** npm package 名。単数形 scope (andpipe) ではなく複数形 scope (andpipes) を正とする。 */
|
|
1216
|
+
declare const PACKAGE_NAME: "@andpipes/cli";
|
|
1217
|
+
/** CLI binary 名。npm package 名と分離し、利用者の実行コマンドは常に `andpipe`。 */
|
|
1218
|
+
declare const CLI_NAME: "andpipe";
|
|
1219
|
+
/**
|
|
1220
|
+
* dist 配置の package.json から version を読む。
|
|
1221
|
+
*
|
|
1222
|
+
* 出荷 binary は ESM (`dist/bin.js`) であり、そこでは `import.meta.url` が解決されるため
|
|
1223
|
+
* 正しい version を読む。`new URL(..., import.meta.url)` は esbuild の asset 解決で path を
|
|
1224
|
+
* 書き換える場合があるため、fileURLToPath + path.join で実行時パスを構築する。
|
|
1225
|
+
* 既知の制約: CJS library build (`dist/index.cjs`) では `import.meta.url` が未定義になり得る
|
|
1226
|
+
* (tsup の CJS 出力)。その場合や読み取り失敗時は "0.0.0" にフォールバックする。CLI binary は
|
|
1227
|
+
* ESM のため利用者には影響しない。CJS consumer 向けの厳密化は version 採番開始時に対応する。
|
|
1228
|
+
*/
|
|
1229
|
+
declare function readVersion(): string;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* redaction — CLI 出力から token / secret / 鍵を除去する共有ユーティリティ。
|
|
1233
|
+
*
|
|
1234
|
+
* andpipe 原則 (CLAUDE.md / doc/specs/tool-safety-privacy):
|
|
1235
|
+
* 生 PII・token・secret・raw 業務データを log / UI / export に残さない。
|
|
1236
|
+
* doctor / logs tail / oauth など、外部値を扱う command の出力は必ずここを通す。
|
|
1237
|
+
*/
|
|
1238
|
+
/**
|
|
1239
|
+
* 文字列中の secret 値・機微 key の値を伏せる。
|
|
1240
|
+
* 表示前 / log 前に必ず通すこと。冪等 (二重適用しても安全)。
|
|
1241
|
+
*/
|
|
1242
|
+
declare function maskSecrets(input: string): string;
|
|
1243
|
+
/** key 名が機微かどうか。 */
|
|
1244
|
+
declare function isSensitiveKey(key: string): boolean;
|
|
1245
|
+
/**
|
|
1246
|
+
* token 等を「先頭数文字 + ***」へ短縮表示する。完全な値は決して返さない。
|
|
1247
|
+
* 例: maskToken("apk_live_abcdef123456") => "apk_***" 相当。
|
|
1248
|
+
*/
|
|
1249
|
+
declare function maskToken(value: string | undefined | null, noneLabel?: string): string;
|
|
1250
|
+
/**
|
|
1251
|
+
* 任意の値を再帰的に redact する (診断レポートの object 出力用)。
|
|
1252
|
+
* 機微 key の値は MASK、文字列値は maskSecrets を適用する。
|
|
1253
|
+
*/
|
|
1254
|
+
declare function redactDeep(value: unknown): unknown;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* @andpipes/cli ライブラリ entry (副作用なし)。
|
|
1258
|
+
* bin (src/bin.ts) はここから runCli を import する。テストもここを import する。
|
|
1259
|
+
* import しただけで CLI が起動しないよう、top-level の実行は行わない。
|
|
1260
|
+
*/
|
|
1261
|
+
|
|
1262
|
+
/** sibling package 慣習に合わせた package 識別子 (@andpipes/* 複数形)。 */
|
|
1263
|
+
declare const packageName: "@andpipes/cli";
|
|
1264
|
+
|
|
1265
|
+
export { ADMIN_API_MAX_GET_ATTEMPTS, ADMIN_API_MAX_RESPONSE_BYTES, ADMIN_API_ONBOARDING_TEMPLATE_MAX_BYTES, ADMIN_API_OPENAPI_IMPORT_MAX_BYTES, ADMIN_API_ORIGIN, ADMIN_API_PUBLICATION_REQUEST_MAX_BYTES, ADMIN_API_PUBLICATION_RESPONSE_MAX_BYTES, ADMIN_API_TIMEOUT_MS, ADMIN_CLI_AUTHORIZATION_SERVER, ADMIN_CLI_CLIENT_ID, ADMIN_CLI_HANDOFF_GRANT, ADMIN_CLI_RESOURCE, ADMIN_CLI_SCOPES, ADMIN_CLI_VERIFICATION_URI_BASE, AdminApiClient, AdminApiClientError, type AdminApiClientOptions, AdminCliHandoffError, type AdminCliHandoffFetch, type AdminCliHandoffRuntime, type AdminCliScope, type AdminFetch, type AdminHealth, type AdminPublicationApplyRequest, type AdminPublicationConfirmation, type AdminPublicationPlanRequest, type AdminSleep, type AuditExportDownloadAuthorization, type AuditExportIntegrity, type AuditExportListResult, type AuditExportManifest, type AuditExportSummary, CLI_NAME, CONFIG_MCP_ENDPOINT, CONFIG_MCP_HANDOFF_GRANT, CONFIG_MCP_RESOURCE, ConfigMcpClientError, type ConfigMcpConnectionConfig, type ConfigMcpCredentialRecord, type ConfigMcpFetch, ConfigMcpHandoffError, type ConfigMcpHandoffRuntime, type ConfigMcpToolSummary, ConfirmationRequiredError, type ConnectConfigMcpInput, type CreateAdminApiClientOptions, type CredentialRecord, type CredentialsFile, type CurrentAdminCredential, DEFAULT_AUTHORIZATION_SERVER, DEFAULT_DEV_PORT, DEFAULT_DEV_TTL_SECONDS, DEFAULT_PROFILE_NAME, DEFAULT_VERIFICATION_URI_BASE, type DevCommandOptions, type DevCommandRuntime, DevPolicyError, DevProjectPreflightError, type DnsRecord, type DnsSetupRecord, type DoctorCheck, type DoctorReport, type DoctorStatus, type DomainCreateResult, type DomainPlan, type HandoffFetch, type InitApiClient, type InitApiFactory, type InitCommandOptions, type InitCommandRuntime, type InitLocalPlan, InitLocalUsageError, type InitManifestCommitment, InitManifestConflictError, type InitManifestRuntime, type InitProject, type InitProjectCreateDiff, type InitProjectList, type InitRootAnchor, type InitRootIdentity, type LoadedOnboardingTemplateArtifact, type LoginAdminCliInput, type LogsResult, type NormalizedPublishOptions, type OAuthClientScopeMapRequest, type OAuthClientScopeMapResult, type OAuthClientSummary, type OAuthReadinessIssue, type OAuthScopeSummary, type OAuthScopesSyncResult, type OAuthSetupResult, type OAuthTestLoginCheck, type OAuthTestLoginResult, type OnboardingTemplateApplyRequest, type OnboardingTemplateApplyResult, type OnboardingTemplateExportResult, type OnboardingTemplatePlanResult, type OpenApiImportApi, type OpenApiImportCommandOptions, type OpenApiImportDraftResult, type OpenApiImportOperationSummary, type OpenApiImportPlanResult, type OpenApiImportRequest, type OpenApiImportRuntime, PACKAGE_NAME, type ProjectListResult, type PublicationApplyRequest, type PublicationConfirmation, type PublicationPlanRequest, type PublishApiClient, type PublishApiFactory, PublishCommandError, type PublishCommandOptions, type PublishCommandRuntime, type RandomBytes, type ReviewPackageCreateRequest, type ReviewPackageCreateResult, type ReviewPackageDownloadResult, type ReviewPackageMetadata, type SafeCustomDomain, type SafeLogEntry, type SafeProject, type TemplateApi, type TemplateCommandRuntime, UsageError, assertProjectId, assertResourceId, buildProgram, captureInitRoot, clearAll, computeDomainPlan, connectConfigMcp, createAdminApiClient, createInitCommandRuntime, createOpenApiImportRuntime, createPublishCommandRuntime, createS256Challenge, createTemplateCommandRuntime, fetchOAuthMetadata, finalizeExistingInitManifest, generateIdempotencyKey, generatePkceVerifier, getConfigDir, getConfigMcpProfile, getCredentialsPath, getProfile, isSensitiveKey, isValidDomain, loadConfigMcpConnectionConfig, loadContract, loadOnboardingTemplateArtifact, loginAdminCli, maskSecrets, maskToken, normalizeConfigMcpScopes, normalizeDevOptions, normalizeInitOptions, normalizePublishOptions, packageName, prepareInitLocal, probeConfigMcpTools, readVersion, redactDeep, registerDev, registerInit, registerOpenApi, registerPublish, registerTemplate, removeConfigMcpProfile, removeProfile, resolveConfigMcpConnection, resolveContractPath, runCli, runDevCommand, runDoctor, runInitCommand, runOpenApiImportCommand, runPublishCommand, runTemplatePlanOrApply, runTemplateRollback, setConfigMcpProfile, setProfile, validateOAuthMetadata, writeInitManifestNoReplace };
|