@m-kopa/launchpad-cli 0.75.2 → 0.77.0
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/CHANGELOG.md +27 -0
- package/dist/bundle/upload.d.ts +16 -0
- package/dist/bundle/upload.d.ts.map +1 -1
- package/dist/cli.js +2072 -442
- package/dist/commands/admin-cli-sessions.d.ts +6 -0
- package/dist/commands/admin-cli-sessions.d.ts.map +1 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/agreement.d.ts +44 -0
- package/dist/commands/agreement.d.ts.map +1 -0
- package/dist/commands/app-lints.d.ts +14 -0
- package/dist/commands/app-lints.d.ts.map +1 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/disable.d.ts +42 -0
- package/dist/commands/disable.d.ts.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/login.d.ts +4 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/dispatcher.d.ts.map +1 -1
- package/dist/http/api-client.d.ts +16 -2
- package/dist/http/api-client.d.ts.map +1 -1
- package/dist/http/error-envelope.d.ts +13 -1
- package/dist/http/error-envelope.d.ts.map +1 -1
- package/dist/http/errors.d.ts +18 -0
- package/dist/http/errors.d.ts.map +1 -1
- package/dist/scaffold/secure-api-template.d.ts +57 -0
- package/dist/scaffold/secure-api-template.d.ts.map +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/skills/README.md +6 -0
- package/skills/launchpad-content-pr/SKILL.md +48 -7
- package/skills/launchpad-deploy/SKILL.md +208 -8
- package/skills/launchpad-deploy-status/SKILL.md +88 -3
- package/skills/launchpad-destroy/SKILL.md +29 -3
- package/skills/launchpad-identity/SKILL.md +31 -1
- package/skills/launchpad-ingest/SKILL.md +15 -7
- package/skills/launchpad-integration-contract/SKILL.md +276 -0
- package/skills/launchpad-onboard/SKILL.md +21 -1
- package/skills/launchpad-report/SKILL.md +1 -1
- package/skills/launchpad-status/SKILL.md +8 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CliConfig } from "../config.js";
|
|
2
|
+
import type { CliIo, ExitCode } from "../dispatcher.js";
|
|
3
|
+
import type { AdminCommandDeps } from "./admin.js";
|
|
4
|
+
export declare function runAdminCliSessions(args: readonly string[], io: CliIo, config: CliConfig, deps: AdminCommandDeps): Promise<ExitCode>;
|
|
5
|
+
export declare function printCliSessionsUsage(print: (line: string) => void): void;
|
|
6
|
+
//# sourceMappingURL=admin-cli-sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-cli-sessions.d.ts","sourceRoot":"","sources":["../../src/commands/admin-cli-sessions.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA0BnD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,QAAQ,CAAC,CAyCnB;AA6CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAIzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/commands/admin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/commands/admin.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAQjE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,UAAU,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,OAAO,CAAC;CAClC;AAID,eAAO,MAAM,YAAY,EAAE,OAA4B,CAAC;AAExD,wBAAgB,gBAAgB,CAC9B,IAAI,GAAE,gBAA4B,GACjC,OAAO,CAMT"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type CliConfig } from "../config.js";
|
|
2
|
+
import type { CliIo, Command } from "../dispatcher.js";
|
|
3
|
+
export interface AgreementText {
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly sha256: string;
|
|
6
|
+
readonly approved: boolean;
|
|
7
|
+
readonly material: boolean;
|
|
8
|
+
readonly effectiveFrom: string;
|
|
9
|
+
readonly text: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AgreementStatus {
|
|
12
|
+
readonly state: "none" | "current" | "expiring" | "grace" | "expired" | "superseded";
|
|
13
|
+
readonly version: string;
|
|
14
|
+
readonly acceptedVersion: string | null;
|
|
15
|
+
readonly acceptedAt: string | null;
|
|
16
|
+
readonly expiresAt: string | null;
|
|
17
|
+
readonly graceUntil: string | null;
|
|
18
|
+
readonly sha256: string;
|
|
19
|
+
readonly approved: boolean;
|
|
20
|
+
readonly mode?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AgreementDeps {
|
|
23
|
+
readonly fetcher: typeof fetch;
|
|
24
|
+
readonly isInteractive: () => boolean;
|
|
25
|
+
readonly prompt: (question: string) => Promise<string>;
|
|
26
|
+
readonly loadConfig: () => CliConfig;
|
|
27
|
+
}
|
|
28
|
+
export declare const agreementCommand: Command;
|
|
29
|
+
export declare function makeAgreementCommand(deps?: AgreementDeps): Command;
|
|
30
|
+
/** The exact phrase the bot expects. Mirrors portal-bot agreement-core. */
|
|
31
|
+
export declare function acceptancePhrase(version: string): string;
|
|
32
|
+
/** SHA-256 (lowercase hex) of the exact UTF-8 text. Mirrors portal-bot sha256Hex. */
|
|
33
|
+
export declare function agreementTextSha256(text: string): string;
|
|
34
|
+
/** One line telling the user what to do next, or null when nothing is needed. */
|
|
35
|
+
export declare function nextStepLine(status: AgreementStatus): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Best-effort notice after `launchpad login`. Prints nothing while the text
|
|
38
|
+
* is unapproved, and never fails the login: any error or a slow bot is
|
|
39
|
+
* ignored. The status request is aborted at the timeout, so a slow bot
|
|
40
|
+
* cannot keep the process alive, and a failure here does not leave a fault
|
|
41
|
+
* signal behind (login succeeded, so no `launchpad bug` nudge).
|
|
42
|
+
*/
|
|
43
|
+
export declare function printAgreementLoginNotice(io: CliIo, deps?: Pick<AgreementDeps, "fetcher" | "loadConfig">, timeoutMs?: number): Promise<void>;
|
|
44
|
+
//# sourceMappingURL=agreement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agreement.d.ts","sourceRoot":"","sources":["../../src/commands/agreement.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI1D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,G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AAa,EAC/D,SAAS,SAAQ,GAChB,OAAO,CAAC,IAAI,CAAC,CAsCf"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type AssertionReport, type RouteAuthReport } from "@m-kopa/launchpad-engine";
|
|
2
|
+
export interface AppLintsResult {
|
|
3
|
+
readonly routeAuth: RouteAuthReport;
|
|
4
|
+
readonly assertion: AssertionReport;
|
|
5
|
+
/** Set when the walk failed; the reports are then empty. */
|
|
6
|
+
readonly skipped?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Walk `dir`, read the server code files and run both lints. */
|
|
9
|
+
export declare function runAppLints(dir: string, rootDir: string | undefined): AppLintsResult;
|
|
10
|
+
/** Human lines for the report (all on stdout: advisory, never an error). */
|
|
11
|
+
export declare function renderAppLintsHuman(r: AppLintsResult): string[];
|
|
12
|
+
/** JSON shape for `--json`: counts and findings only. */
|
|
13
|
+
export declare function appLintsJson(r: AppLintsResult): Record<string, unknown>;
|
|
14
|
+
//# sourceMappingURL=app-lints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-lints.d.ts","sourceRoot":"","sources":["../../src/commands/app-lints.ts"],"names":[],"mappings":"AAiBA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAMlC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AASD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAqBpF;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,EAAE,CAsB/D;AAED,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA0EA,OAAO,EAGL,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAkB/B,OAAO,EAAa,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAWjE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC;AAEF,UAAU,UAAU;IAClB,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AA6RD;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAoBpC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,GAAG,IAAI,CA4BpE;AAiMD,2BAA2B;AAC3B,OAAO,EAAE,4BAA4B,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA0EA,OAAO,EAGL,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAkB/B,OAAO,EAAa,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAWjE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC;AAEF,UAAU,U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|
2
|
+
import type { CliIo, Command, ExitCode } from "../dispatcher.js";
|
|
3
|
+
/** Bot response shape (all three routes). */
|
|
4
|
+
export interface AppDisableResponse {
|
|
5
|
+
readonly slug: string;
|
|
6
|
+
readonly host?: string;
|
|
7
|
+
readonly disabled: boolean;
|
|
8
|
+
readonly disabledAt?: number;
|
|
9
|
+
readonly reason?: string;
|
|
10
|
+
readonly actorRole?: "owner" | "break_glass";
|
|
11
|
+
readonly malformed?: boolean;
|
|
12
|
+
readonly alreadyDisabled?: boolean;
|
|
13
|
+
readonly alreadyEnabled?: boolean;
|
|
14
|
+
/** True only when the gateway fronts the app and serves the 503. Absent
|
|
15
|
+
* from older bots: treated as not confirmed. */
|
|
16
|
+
readonly enforced?: boolean;
|
|
17
|
+
/** The bot's mirror of the gateway's APP_DISABLE_MODE. */
|
|
18
|
+
readonly gatewayMode?: "off" | "report" | "enforce";
|
|
19
|
+
readonly fronted?: "gateway" | "access";
|
|
20
|
+
/** A break-glass hold is recorded (only the platform team can enable). */
|
|
21
|
+
readonly platformHold?: boolean;
|
|
22
|
+
/** Break-glass turned an owner's disable into a platform hold. */
|
|
23
|
+
readonly upgradedToHold?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type AppDisableVerb = "disable" | "enable";
|
|
26
|
+
export interface AppDisableOptions {
|
|
27
|
+
readonly verb: AppDisableVerb;
|
|
28
|
+
readonly slug: string;
|
|
29
|
+
/** Required for a change; null with `status`. */
|
|
30
|
+
readonly reason: string | null;
|
|
31
|
+
/** `launchpad disable <slug> --status`: read only. */
|
|
32
|
+
readonly status: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface AppDisableDeps {
|
|
35
|
+
readonly config?: CliConfig;
|
|
36
|
+
readonly fetcher?: typeof fetch;
|
|
37
|
+
}
|
|
38
|
+
export declare const disableCommand: Command;
|
|
39
|
+
export declare const enableCommand: Command;
|
|
40
|
+
export declare function parseAppDisableArgs(verb: AppDisableVerb, args: readonly string[]): AppDisableOptions | "help" | string;
|
|
41
|
+
export declare function runAppDisable(opts: AppDisableOptions, io: CliIo, deps?: AppDisableDeps): Promise<ExitCode>;
|
|
42
|
+
//# sourceMappingURL=disable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disable.d.ts","sourceRoot":"","sources":["../../src/commands/disable.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAS1D,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjE,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;qDACiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAED,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,OAI3B,CAAC;AAuBF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAsCrC;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,QAAQ,CAAC,CAuDnB"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export interface InitOptions {
|
|
|
39
39
|
* `false` so M-1216's Model A flow is the path of least resistance.
|
|
40
40
|
*/
|
|
41
41
|
readonly skipDetect: boolean;
|
|
42
|
+
/** Scaffold the secure-by-default API (A2-09). react+api only. Default off. */
|
|
43
|
+
readonly secureTemplate: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Attest the authorisation statement without a prompt. Bound to the
|
|
46
|
+
* signed-in identity. Alone (no `--secure-template`) it updates the
|
|
47
|
+
* attestation of an existing scaffold.
|
|
48
|
+
*/
|
|
49
|
+
readonly attestAuthz: boolean;
|
|
42
50
|
}
|
|
43
51
|
/** Prompt seam — replaced in tests with a deterministic fake. */
|
|
44
52
|
export type PromptFn = (question: string, fallback?: string) => Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAuDA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAe7D,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,iFAAiF;IACjF,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,iEAAiE;AACjE,MAAM,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEhF,eAAO,MAAM,WAAW,EAAE,OAIzB,CAAC;AAEF,4FAA4F;AAC5F,wBAAsB,OAAO,CAC3B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,QAAQ,EAChB,QAAQ,GAAE,MAAM,OAAO,CAAC,YAAY,CAAuE,GAC1G,OAAO,CAAC,QAAQ,CAAC,CA4MnB"}
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { login } from "../auth/flow.js";
|
|
2
2
|
import { gatewayLogin } from "../auth/gateway-flow.js";
|
|
3
|
-
import type { Command } from "../dispatcher.js";
|
|
3
|
+
import type { Command, CliIo } from "../dispatcher.js";
|
|
4
4
|
/** Injectable seams so the dual-path order, fallback messaging and
|
|
5
5
|
* kill-switch are testable without a live browser or network. The
|
|
6
6
|
* production command wires the real flows. */
|
|
7
7
|
export interface LoginCommandDeps {
|
|
8
8
|
readonly gatewayLogin: typeof gatewayLogin;
|
|
9
9
|
readonly legacyLogin: typeof login;
|
|
10
|
+
/** A2-07: best-effort access agreement notice after a successful login.
|
|
11
|
+
* Optional so test doubles that omit it make no extra network call. */
|
|
12
|
+
readonly agreementNotice?: (io: CliIo) => Promise<void>;
|
|
10
13
|
}
|
|
11
14
|
export declare const loginCommand: Command;
|
|
12
15
|
export declare function makeLoginCommand(deps?: LoginCommandDeps): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,KAAK,EAAE,OAAO,EAAY,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;+CAE+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,OAAO,YAAY,CAAC;IAC3C,QAAQ,CAAC,WAAW,EAAE,OAAO,KAAK,CAAC;IACnC;4EACwE;IACxE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAQD,eAAO,MAAM,YAAY,EAAE,OAA4B,CAAC;AAExD,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,gBAA4B,GAAG,OAAO,CAM5E"}
|
|
@@ -5,7 +5,7 @@ import type { Command } from "../dispatcher.js";
|
|
|
5
5
|
* "bundled list matches the skills dir" test in `tests/skills-command.test.ts`
|
|
6
6
|
* enforces this so a newly-added skill dir can't silently go un-installed.
|
|
7
7
|
*/
|
|
8
|
-
export declare const BUNDLED_SKILLS: readonly ["launchpad-onboard", "launchpad-deploy", "launchpad-deploy-status", "launchpad-content-pr", "launchpad-status", "launchpad-destroy", "launchpad-identity", "launchpad-ingest", "launchpad-report", "marquee-share"];
|
|
8
|
+
export declare const BUNDLED_SKILLS: readonly ["launchpad-onboard", "launchpad-deploy", "launchpad-deploy-status", "launchpad-content-pr", "launchpad-status", "launchpad-destroy", "launchpad-identity", "launchpad-ingest", "launchpad-integration-contract", "launchpad-report", "marquee-share"];
|
|
9
9
|
export declare const skillsCommand: Command;
|
|
10
10
|
interface InstallEnv {
|
|
11
11
|
readonly bundleDir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AASjE;;;;;GAKG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AASjE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,iQAgBjB,CAAC;AAcX,eAAO,MAAM,aAAa,EAAE,OAK3B,CAAC;AA2CF,UAAU,UAAU;IAClB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAQ9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AA4DA,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAUjE,eAAO,MAAM,eAAe,EAAE,OAI7B,CAAC"}
|
package/dist/dispatcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AA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+
* retried ONCE after the wait (XP-15). The bot sends 30. A longer wait is
|
|
4
|
+
* surfaced to the user instead of stalling the verb. */
|
|
5
|
+
export declare const MAX_REVOCATION_RETRY_AFTER_SEC = 30;
|
|
6
|
+
/** Wait and notice hooks for the single revocation retry. Tests replace
|
|
7
|
+
* them; production waits on a timer and writes one line to stderr, so a
|
|
8
|
+
* 30 s pause never looks like a hang and never touches stdout (`--json`). */
|
|
9
|
+
export declare const revocationRetryHooks: {
|
|
10
|
+
sleep: (ms: number) => Promise<void>;
|
|
11
|
+
notice: (line: string) => void;
|
|
12
|
+
};
|
|
2
13
|
export interface ApiRequestOptions {
|
|
3
14
|
readonly method?: "GET" | "POST" | "DELETE" | "PUT" | "PATCH";
|
|
4
15
|
readonly path: string;
|
|
@@ -11,10 +22,13 @@ export interface ApiRequestOptions {
|
|
|
11
22
|
* a typed error. `launchpad merge` uses this so that 409 codes
|
|
12
23
|
* (review_running, merge_conflict, sha_mismatch, ...) reach the
|
|
13
24
|
* command verb as parsed JSON rather than being swallowed by the
|
|
14
|
-
* shared error mapper. 401/403/404
|
|
15
|
-
* same thing on every endpoint and the
|
|
25
|
+
* shared error mapper. 401/403/404 and a 503 `revocation_unavailable`
|
|
26
|
+
* still throw — they mean the same thing on every endpoint and the
|
|
27
|
+
* typed errors stay useful.
|
|
16
28
|
*/
|
|
17
29
|
readonly nonThrowingStatuses?: readonly number[];
|
|
30
|
+
/** Abort the request (e.g. `AbortSignal.timeout(ms)` for a best-effort call). */
|
|
31
|
+
readonly signal?: AbortSignal;
|
|
18
32
|
}
|
|
19
33
|
/**
|
|
20
34
|
* GET-style helper that returns a parsed JSON body of type `T`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/http/api-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/http/api-client.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkB9C;;yDAEyD;AACzD,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD;;8EAE8E;AAC9E,eAAO,MAAM,oBAAoB;gBACnB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;mBAEnB,MAAM,KAAG,IAAI;CAG7B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;;;;;;OAQG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,iBAAiB,EACvB,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC,CAAC,CAAC,CAWZ;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAC1B,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,iBAAiB,EACvB,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAyInB"}
|
|
@@ -42,8 +42,20 @@ export interface DecodeErrorContext {
|
|
|
42
42
|
export declare function decodeErrorEnvelope(input: unknown, context: DecodeErrorContext): StructuredErrorEnvelope;
|
|
43
43
|
/** Decode a response body without preview-slicing an unstructured payload. */
|
|
44
44
|
export declare function decodeErrorText(text: string, context: DecodeErrorContext): StructuredErrorEnvelope;
|
|
45
|
+
/** The bot's 503 code when it cannot read its CLI session revocation
|
|
46
|
+
* store (audit finding XP-15). The request was refused before it ran. */
|
|
47
|
+
export declare const REVOCATION_UNAVAILABLE_CODE = "revocation_unavailable";
|
|
48
|
+
/** The bot sends `Retry-After: 30` with `revocation_unavailable`. */
|
|
49
|
+
export declare const DEFAULT_REVOCATION_RETRY_AFTER_SEC = 30;
|
|
50
|
+
/** The CLI's own wording for a 503 `revocation_unavailable`, so a KV fault
|
|
51
|
+
* on the bot never reads as "your session is bad, log in again". */
|
|
52
|
+
export declare function revocationUnavailableMessage(retryAfterSec?: number): string;
|
|
53
|
+
export interface FormatErrorOptions {
|
|
54
|
+
/** Seconds from the response's Retry-After, when the caller read it. */
|
|
55
|
+
readonly retryAfterSec?: number;
|
|
56
|
+
}
|
|
45
57
|
/** Render a complete, source-aware human diagnostic. */
|
|
46
|
-
export declare function formatErrorEnvelope(envelope: StructuredErrorEnvelope): string;
|
|
58
|
+
export declare function formatErrorEnvelope(envelope: StructuredErrorEnvelope, options?: FormatErrorOptions): string;
|
|
47
59
|
/** Stable JSON representation for commands offering a machine-readable mode. */
|
|
48
60
|
export declare function errorEnvelopeJson(envelope: StructuredErrorEnvelope): object;
|
|
49
61
|
//# sourceMappingURL=error-envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-envelope.d.ts","sourceRoot":"","sources":["../../src/http/error-envelope.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CA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EAAE,SAAS,mBAAmB,EAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,kBAAkB,GAC1B,uBAAuB,CAiDzB;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,uBAAuB,CAkBzB;AAED;0EAC0E;AAC1E,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AAEpE,qEAAqE;AACrE,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD;qEACqE;AACrE,wBAAgB,4BAA4B,CAC1C,aAAa,GAAE,MAA2C,GACzD,MAAM,CAOR;AAED,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,wDAAwD;AACxD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,uBAAuB,EACjC,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAkCR;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,CAwB3E"}
|
package/dist/http/errors.d.ts
CHANGED
|
@@ -10,6 +10,16 @@ export declare class UnauthenticatedError extends Error {
|
|
|
10
10
|
export declare class ForbiddenError extends Error {
|
|
11
11
|
readonly code: "forbidden";
|
|
12
12
|
}
|
|
13
|
+
/** Stable process exit for a server-enforced access agreement (A2-07). */
|
|
14
|
+
export declare const EXIT_AGREEMENT_REQUIRED = 43;
|
|
15
|
+
/** 403 `agreement_required`: the bot wants a current access agreement
|
|
16
|
+
* acceptance before this mutation. Subclasses ForbiddenError so callers
|
|
17
|
+
* that only know ForbiddenError still print the server message. */
|
|
18
|
+
export declare class AgreementRequiredError extends ForbiddenError {
|
|
19
|
+
readonly reason: string;
|
|
20
|
+
readonly version: string | null;
|
|
21
|
+
constructor(message: string, reason: string, version: string | null);
|
|
22
|
+
}
|
|
13
23
|
/** 404 — the bot returned not-found. Distinct from UnauthenticatedError
|
|
14
24
|
* so the CLI doesn't suggest re-login when the slug is just unknown. */
|
|
15
25
|
export declare class NotFoundError extends Error {
|
|
@@ -47,6 +57,14 @@ export declare class ApiError extends Error {
|
|
|
47
57
|
readonly envelope: StructuredErrorEnvelope;
|
|
48
58
|
constructor(envelope: StructuredErrorEnvelope);
|
|
49
59
|
}
|
|
60
|
+
/** HTTP 503 `revocation_unavailable` (audit finding XP-15). The bot could
|
|
61
|
+
* not read its CLI session revocation store, so it refused the request
|
|
62
|
+
* before running it. The session itself is not the problem: `launchpad
|
|
63
|
+
* login` does not help, a retry after `retryAfterSec` usually does. */
|
|
64
|
+
export declare class RevocationUnavailableError extends ApiError {
|
|
65
|
+
readonly retryAfterSec: number;
|
|
66
|
+
constructor(envelope: StructuredErrorEnvelope, retryAfterSec: number);
|
|
67
|
+
}
|
|
50
68
|
/** Network failure, JSON parse failure, anything that wasn't
|
|
51
69
|
* actually a response. */
|
|
52
70
|
export declare class TransportError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/http/errors.ts"],"names":[],"mappings":"AAIA;;2DAE2D;AAC3D,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAG,iBAAiB,CAAU;CAC5C;AAED;;uCAEuC;AACvC,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAG,WAAW,CAAU;CACtC;AAED;yEACyE;AACzE,qBAAa,aAAc,SAAQ,KAAK;IAIT,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM;IAHzD,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EAAG,iBAAiB,CAAU;CAC5C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const SECURE_API_LIB_PATH = "functions/_lib/secure-api.ts";
|
|
2
|
+
export declare const SECURE_API_ROUTER_PATH = "functions/api/[[path]].ts";
|
|
3
|
+
export declare const SECURE_API_TEST_PATH = "tests/secure-api.test.ts";
|
|
4
|
+
export declare const AUTHZ_ATTESTATION_PATH = "authz-attestation.json";
|
|
5
|
+
/** Paths the manifest's `app.include` needs so the scaffold ships with the app. */
|
|
6
|
+
export declare const SECURE_TEMPLATE_INCLUDE: readonly string[];
|
|
7
|
+
/** The statement the owner attests. Versioned so a later wording change is visible. */
|
|
8
|
+
export declare const AUTHZ_STATEMENT_ID = "launchpad-app-authz-v1";
|
|
9
|
+
export declare const AUTHZ_STATEMENT: string;
|
|
10
|
+
export declare const SECURE_API_LIB = "// Secure-by-default API helpers (scaffolded by `launchpad init --secure-template`).\n//\n// createSecureApi() registers the identity check FIRST, so every route added\n// to the returned app runs behind it. requireRole() is the role check for\n// routes that change data. tests/secure-api.test.ts fails if either is\n// bypassed. Do not create another Hono app under functions/.\n\nimport { Hono, type MiddlewareHandler } from \"hono\";\nimport { createJwksCache, parseGatewayAssertionFromHeaders } from \"@m-kopa/platform-auth\";\nimport { createPlatformAuthMiddleware, type PlatformAuthVariables } from \"@m-kopa/platform-auth/hono\";\n\n/**\n * Bindings the platform sets on a gateway-fronted app. Older Pages apps may\n * carry only the legacy names (CF_ACCESS_TEAM_DOMAIN, CF_ACCESS_AUD,\n * JWKS_URL), which hold the same gateway values; both sets are read.\n */\nexport interface SecureEnv {\n GATEWAY_ISSUER?: string;\n GATEWAY_AUD?: string;\n GATEWAY_JWKS_URL?: string;\n CF_ACCESS_TEAM_DOMAIN?: string;\n CF_ACCESS_AUD?: string;\n JWKS_URL?: string;\n [key: string]: unknown;\n}\n\ntype SecureVars<E extends SecureEnv> = { Bindings: E; Variables: PlatformAuthVariables };\nexport type SecureApp<E extends SecureEnv> = Hono<SecureVars<E>>;\n\nconst authGuards = new WeakSet<object>();\nconst roleGuards = new WeakSet<object>();\nconst passThroughs = new WeakSet<object>();\n\n/** True for the identity middleware created by createSecureApi (used by the tests). */\nexport function isAuthGuard(handler: unknown): boolean {\n return typeof handler === \"function\" && authGuards.has(handler);\n}\n\n/** True for a middleware created by requireRole (used by the tests). */\nexport function isRoleGuard(handler: unknown): boolean {\n return typeof handler === \"function\" && roleGuards.has(handler);\n}\n\n/** True for a middleware marked with passThrough (used by the tests). */\nexport function isPassThrough(handler: unknown): boolean {\n return typeof handler === \"function\" && passThroughs.has(handler);\n}\n\n/**\n * Mark a middleware that only observes the request and always calls next()\n * (logging, headers, timing) so app.use(...) does not need a role check. Never\n * wrap a handler that answers a request or changes data.\n */\nexport function passThrough<H extends MiddlewareHandler<any>>(handler: H): H {\n passThroughs.add(handler);\n return handler;\n}\n\nlet cachedJwks: ReturnType<typeof createJwksCache> | undefined;\nlet cachedJwksUrl: string | undefined;\nfunction jwksFor(url: string): ReturnType<typeof createJwksCache> {\n if (cachedJwks === undefined || cachedJwksUrl !== url) {\n cachedJwks = createJwksCache(url);\n cachedJwksUrl = url;\n }\n return cachedJwks;\n}\n\nfunction verifyIdentity<E extends SecureEnv>(): MiddlewareHandler<SecureVars<E>> {\n const guard: MiddlewareHandler<SecureVars<E>> = async (c, next) => {\n // No assertion: refuse before anything else runs.\n if (parseGatewayAssertionFromHeaders(c.req.raw.headers) === null) {\n return c.json({ error: \"unauthorized\" }, 401);\n }\n const issuer = c.env?.GATEWAY_ISSUER || c.env?.CF_ACCESS_TEAM_DOMAIN;\n const audience = c.env?.GATEWAY_AUD || c.env?.CF_ACCESS_AUD;\n if (!issuer || !audience) {\n // Fail closed: never serve a route when the verifier is not configured.\n return c.json({ error: \"identity_not_configured\" }, 503);\n }\n const jwksUrl =\n c.env?.GATEWAY_JWKS_URL || c.env?.JWKS_URL || `${issuer.replace(/\\/$/, \"\")}/.well-known/jwks.json`;\n // platform-auth types its middleware for its own Variables only; this app\n // also has Bindings, so the cast widens it to the app's context type.\n const middleware = createPlatformAuthMiddleware({\n header: \"gateway\",\n teamDomain: issuer,\n audience,\n jwks: jwksFor(jwksUrl),\n }) as unknown as MiddlewareHandler<SecureVars<E>>;\n return middleware(c, next);\n };\n authGuards.add(guard);\n return guard;\n}\n\n/** A Hono app under /api whose first handler verifies the caller's identity. */\nexport function createSecureApi<E extends SecureEnv>(): SecureApp<E> {\n const app = new Hono<SecureVars<E>>().basePath(\"/api\");\n app.use(\"*\", verifyIdentity<E>());\n return app;\n}\n\n/**\n * Allow the request only when the caller is in one of the Entra groups listed\n * (comma separated group object IDs) in ROLE_<ROLE>_GROUP_IDS. An unset or\n * empty list denies everyone: set it before the route can be used.\n *\n * The groups come from the verified gateway assertion, which is a login-time\n * snapshot: removing someone from a role group takes effect at their next\n * gateway sign-in, not at once. Use this for coarse roles (writer, admin).\n * When revocation must be immediate, look the role up server-side (your own\n * table or Microsoft Graph) instead.\n */\nexport function requireRole<E extends SecureEnv>(role: string): MiddlewareHandler<SecureVars<E>> {\n const key = `ROLE_${role.toUpperCase().replace(/[^A-Z0-9]/g, \"_\")}_GROUP_IDS`;\n const guard: MiddlewareHandler<SecureVars<E>> = async (c, next) => {\n const allowed = String(c.env?.[key] ?? \"\")\n .split(\",\")\n .map((g) => g.trim().toLowerCase())\n .filter((g) => g !== \"\");\n const user = c.get(\"user\");\n const groups = (user?.groups ?? []).map((g) => g.toLowerCase());\n if (allowed.length === 0 || !groups.some((g) => allowed.includes(g))) {\n return c.json({ error: \"forbidden\", role }, 403);\n }\n await next();\n return;\n };\n roleGuards.add(guard);\n return guard;\n}\n";
|
|
11
|
+
export declare const SECURE_API_ROUTER = "// API router (scaffolded by `launchpad init --secure-template`).\n//\n// Add every route to the app that buildApp() returns. Routes that change data\n// need requireRole(...) BEFORE the handler. tests/secure-api.test.ts checks\n// both. Keep the last line as it is: the guard test checks it.\n\nimport { handle } from \"hono/cloudflare-pages\";\nimport { createSecureApi, requireRole, type SecureEnv } from \"../_lib/secure-api\";\n\nexport interface Env extends SecureEnv {\n /** Comma separated Entra group object IDs allowed to write. */\n ROLE_WRITER_GROUP_IDS?: string;\n}\n\nexport function buildApp() {\n const app = createSecureApi<Env>();\n\n // Read route: any verified user of this app.\n app.get(\"/me\", (c) => {\n const user = c.get(\"user\");\n return c.json({ sub: user.sub, name: user.name ?? null });\n });\n\n // Write route: verified user AND in the writer role.\n app.post(\"/items\", requireRole<Env>(\"writer\"), async (c) => {\n return c.json({ ok: true }, 201);\n });\n\n return app;\n}\n\nexport const onRequest = handle(buildApp());\n";
|
|
12
|
+
export declare const SECURE_API_TEST = "// Guard test for the secure API template (audit A2-09). Do not delete.\n//\n// Fails when a route escapes the identity middleware, a route that can change\n// data has no role check in front of it, the router stops exporting the\n// secure app, or a route file appears outside the secure router.\n\nimport { lstatSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport { describe, expect, test } from \"vitest\";\nimport { buildApp } from \"../functions/api/[[path]]\";\nimport { isAuthGuard, isPassThrough, isRoleGuard } from \"../functions/_lib/secure-api\";\n\n/** Methods that cannot change data. Everything else, ALL included, is a write. */\nconst READ_METHODS = new Set([\"GET\", \"HEAD\", \"OPTIONS\"]);\nconst ROUTER = \"functions/api/[[path]].ts\";\nconst LIB = \"functions/_lib/secure-api.ts\";\n\nconst ROUTE_EXPORT_RX = /export\\s+(?:async\\s+)?(?:function|const|let|var)\\s+onRequest|export\\s*\\{[^}]*\\bonRequest/;\nconst NEW_HONO_RX = /new\\s+Hono\\b/g;\n\nfunction honoApps(text: string): number {\n return (text.match(NEW_HONO_RX) ?? []).length;\n}\n\nfunction samplePath(path: string): string {\n return path.replace(/:[^/]+/g, \"x\").replace(/\\*$/, \"x\");\n}\n\n/** True when a guard registered on `guardPath` runs for `path`. */\nfunction covers(guardPath: string, path: string): boolean {\n if (guardPath === path) return true;\n if (!guardPath.endsWith(\"/*\")) return false;\n const prefix = guardPath.slice(0, -1); // keeps the trailing \"/\"\n return path.startsWith(prefix) || path === prefix.slice(0, -1);\n}\n\n/** Files under dir. A symlink fails the test: it cannot be checked and can loop. */\nfunction walk(dir: string, root: string): string[] {\n let names: string[];\n try {\n names = readdirSync(dir);\n } catch {\n return [];\n }\n return names.flatMap((n) => {\n const p = join(dir, n);\n const st = lstatSync(p);\n expect(st.isSymbolicLink(), `${relative(root, p)} is a symlink; the guard test cannot check it`).toBe(false);\n return st.isDirectory() ? walk(p, root) : [p];\n });\n}\n\ndescribe(\"secure API template\", () => {\n const app = buildApp();\n const routes = app.routes;\n\n test(\"the identity middleware is the first handler and covers every route\", () => {\n expect(isAuthGuard(routes[0]?.handler)).toBe(true);\n expect(routes[0]?.path).toBe(\"/api/*\");\n expect(routes.filter((r) => isAuthGuard(r.handler))).toHaveLength(1);\n });\n\n test(\"every route refuses a request without an identity assertion\", async () => {\n for (const r of routes) {\n if (isAuthGuard(r.handler)) continue;\n const method = r.method === \"ALL\" ? \"GET\" : r.method;\n const res = await app.request(samplePath(r.path), { method });\n expect(res.status, `${method} ${r.path}`).toBe(401);\n }\n });\n\n test(\"every route that can change data has requireRole(...) in front of it\", () => {\n routes.forEach((w, i) => {\n if (READ_METHODS.has(w.method)) return;\n if (isAuthGuard(w.handler) || isRoleGuard(w.handler) || isPassThrough(w.handler)) return;\n // A role guard must run first: registered earlier, for the same method\n // (or every method), on a path that covers this one. An ALL route needs\n // an ALL guard, since a POST-only guard leaves DELETE open.\n const guarded = routes.slice(0, i).some(\n (g) =>\n isRoleGuard(g.handler) &&\n (g.method === \"ALL\" || (w.method !== \"ALL\" && g.method === w.method)) &&\n covers(g.path, w.path),\n );\n expect(guarded, `${w.method} ${w.path} has no requireRole(...) before its handler (wrap an observe-only middleware in passThrough(...))`).toBe(true);\n });\n });\n\n test(\"the router exports the secure app and nothing else\", () => {\n const text = readFileSync(join(process.cwd(), ROUTER), \"utf8\");\n expect(text, `${ROUTER} must end with: export const onRequest = handle(buildApp());`).toMatch(\n /^export const onRequest = handle\\(buildApp\\(\\)\\);$/m,\n );\n expect(text.match(/export\\s+(?:async\\s+)?(?:function|const|let|var)\\s+onRequest\\w*/g), ROUTER).toHaveLength(1);\n expect(/export\\s*\\{[^}]*\\bonRequest|export\\s+default\\b/.test(text), `${ROUTER} has another export`).toBe(false);\n expect(honoApps(text), `${ROUTER} creates its own Hono app`).toBe(0);\n const lib = readFileSync(join(process.cwd(), LIB), \"utf8\");\n expect(honoApps(lib), `${LIB} creates one Hono app (createSecureApi)`).toBe(1);\n expect(ROUTE_EXPORT_RX.test(lib), `${LIB} exports a route handler`).toBe(false);\n });\n\n test(\"no route handlers outside the secure router\", () => {\n const root = process.cwd(); // vitest runs from the app root\n for (const abs of walk(join(root, \"functions\"), root)) {\n const rel = relative(root, abs).split(\"\\\\\").join(\"/\");\n if (rel === ROUTER || rel === LIB || !/\\.(m?[jt]sx?)$/.test(rel)) continue;\n const text = readFileSync(abs, \"utf8\");\n expect(ROUTE_EXPORT_RX.test(text), `${rel} exports a route handler`).toBe(false);\n expect(honoApps(text), `${rel} creates its own Hono app`).toBe(0);\n }\n });\n});\n";
|
|
13
|
+
/** Attestation record states. Only `attested` means the owner attested. */
|
|
14
|
+
export type AttestationStatus = "attested" | "attested_by_other" | "pending";
|
|
15
|
+
/** The signed-in identity that attested, as the bot verified it (`/me/identity`). */
|
|
16
|
+
export interface Attester {
|
|
17
|
+
readonly oid: string;
|
|
18
|
+
readonly email: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AttestationInput {
|
|
21
|
+
/** Manifest owner. Only the owner's attestation counts. */
|
|
22
|
+
readonly owner: string;
|
|
23
|
+
/** ISO date (YYYY-MM-DD). */
|
|
24
|
+
readonly date: string;
|
|
25
|
+
/**
|
|
26
|
+
* Who attested, from the signed-in session. Omitted when nobody attested
|
|
27
|
+
* or the identity could not be verified: the record is then `pending`.
|
|
28
|
+
*/
|
|
29
|
+
readonly attester?: Attester;
|
|
30
|
+
}
|
|
31
|
+
/** `attested` only when the verified attester is the manifest owner. */
|
|
32
|
+
export declare function attestationStatus(input: AttestationInput): AttestationStatus;
|
|
33
|
+
/**
|
|
34
|
+
* The attestation record committed with the app. The attester is bound to
|
|
35
|
+
* the signed-in Launchpad identity, not to a flag. It is still a local file:
|
|
36
|
+
* `server_recorded: false` until the bot captures attestations server-side.
|
|
37
|
+
*/
|
|
38
|
+
export declare function attestationJson(input: AttestationInput): string;
|
|
39
|
+
export interface ScaffoldResult {
|
|
40
|
+
readonly written: readonly string[];
|
|
41
|
+
readonly kept: readonly string[];
|
|
42
|
+
/** Not written because a symlink sits on the path (it could point outside the app). */
|
|
43
|
+
readonly skippedSymlink: readonly string[];
|
|
44
|
+
}
|
|
45
|
+
/** True when `rel` under `baseDir`, or a folder on the way, is a symlink. */
|
|
46
|
+
export declare function symlinkOnPath(baseDir: string, rel: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Write the scaffold under `baseDir`. Existing files are kept, never
|
|
49
|
+
* overwritten, and nothing is written through a symlink.
|
|
50
|
+
*/
|
|
51
|
+
export declare function writeSecureApiScaffold(baseDir: string, attestation: AttestationInput): ScaffoldResult;
|
|
52
|
+
/**
|
|
53
|
+
* Replace `authz-attestation.json` (the attest-later path). Refuses a symlink.
|
|
54
|
+
* Returns false when the file cannot be written safely.
|
|
55
|
+
*/
|
|
56
|
+
export declare function writeAttestation(baseDir: string, attestation: AttestationInput): boolean;
|
|
57
|
+
//# sourceMappingURL=secure-api-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-api-template.d.ts","sourceRoot":"","sources":["../../src/scaffold/secure-api-template.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAClE,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAC/D,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,mFAAmF;AACnF,eAAO,MA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MAAM,EAAE,WAAW,EAAE,gBAAgB,GAAG,cAAc,CAyBrG;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAIxF"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.
|
|
1
|
+
export declare const CLI_VERSION = "0.77.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m-kopa/launchpad-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"description": "Launchpad CLI — clone / deploy / review / merge against Launchpad-managed apps. Talks to the portal-bot endpoints (SCOPE-M-760 / T4).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"esbuild": "0.28.1",
|
|
35
35
|
"yaml": "2.9.0",
|
|
36
|
-
"zod": "4.
|
|
36
|
+
"zod": "4.6.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "22.18.10",
|
package/skills/README.md
CHANGED
|
@@ -17,6 +17,7 @@ skills/
|
|
|
17
17
|
├── launchpad-destroy/SKILL.md
|
|
18
18
|
├── launchpad-identity/SKILL.md # dev / how-to-build skill (see below)
|
|
19
19
|
├── launchpad-ingest/SKILL.md # dev skill: verified ingest for approved integrations
|
|
20
|
+
├── launchpad-integration-contract/SKILL.md # design skill: agree an integration payload + allow-list request
|
|
20
21
|
└── marquee-share/ # vendored from M-KOPA/marquee, do
|
|
21
22
|
# not hand-edit — managed by
|
|
22
23
|
# scripts/sync-marquee-share-skill.sh
|
|
@@ -50,6 +51,11 @@ convention for this kind:
|
|
|
50
51
|
run by `tests/skill-ingest-extraction.test.ts`, so the code an author copies is
|
|
51
52
|
the code that was tested.
|
|
52
53
|
|
|
54
|
+
`launchpad-integration-contract` is a **design skill**: it helps the author agree a
|
|
55
|
+
payload with another team, so its SQL and bash blocks are illustrations, not code
|
|
56
|
+
lifted from a deployed app. It has no extraction test; the runnable handler stays
|
|
57
|
+
in `launchpad-ingest`, which is pinned.
|
|
58
|
+
|
|
53
59
|
## Cross-platform shell contract
|
|
54
60
|
|
|
55
61
|
Claude Code's `Bash` tool **always** runs `bash`, on every OS — on
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-content-pr
|
|
3
3
|
description: Push a content change to a Launchpad app via `launchpad deploy` and verify it shipped via `launchpad status`. Covers the post-first-deploy iteration loop (edit → deploy → verify) - subsequent deploys commit directly to the app repo's main, then the dispatch delivery (or, for a legacy Pages app, the Pages build) runs asynchronously, so verification is its own step. Use when someone says "push a content change", "ship an update", "/launchpad-content-pr", "verify my deploy", or after `/launchpad-deploy` reports `done` and they want to follow up with an edit.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.77.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -118,7 +118,38 @@ iteration loop is not the right tool — route to
|
|
|
118
118
|
(teardown) instead. If it shows `failed` but the app is actually
|
|
119
119
|
serving (e.g. a verification timed out after the real deploy
|
|
120
120
|
succeeded), `launchpad recover <slug>` reconciles the record against
|
|
121
|
-
live Cloudflare state.
|
|
121
|
+
live Cloudflare state. `recover` checks the app's Pages project, so it is a
|
|
122
|
+
Pages-app verb (a container app has its own path): on a dispatch app it
|
|
123
|
+
answers `not_live` and changes nothing. For a dispatch app that failed, see
|
|
124
|
+
`/launchpad-deploy-status`.
|
|
125
|
+
|
|
126
|
+
## Second deploy from the folder `launchpad init` made: "no trusted source baseline"
|
|
127
|
+
|
|
128
|
+
The folder where the user ran `launchpad init` and the first `launchpad deploy`
|
|
129
|
+
is not a clone. The first deploy works from it; the next one stops with:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
this working tree has no trusted source baseline
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The CLI suggests `launchpad pull --bootstrap`, a fresh clone, or
|
|
136
|
+
`--allow-unguarded`. Only the fresh clone works. `launchpad pull` answers
|
|
137
|
+
"missing source provenance", and `pull --bootstrap` is only for a legacy clone
|
|
138
|
+
with a clean synthetic baseline. Do not use `--allow-unguarded` here: it turns
|
|
139
|
+
off the protection against overwriting newer edits and is meant for an
|
|
140
|
+
intentional non-clone tree. Do this instead, in a new empty folder next to the
|
|
141
|
+
old one:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
mkdir ../my-app-clone && cd ../my-app-clone
|
|
145
|
+
launchpad clone <slug>
|
|
146
|
+
cd launchpad-app-<slug>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Copy the edited files from the old folder into `launchpad-app-<slug>/`, then run
|
|
150
|
+
`launchpad deploy` from there. A clone also holds the starter files the
|
|
151
|
+
platform added (for example `.github/`, `AGENTS.md`); leave them in place. From
|
|
152
|
+
now on deploy only from the clone.
|
|
122
153
|
|
|
123
154
|
## Edit and ship
|
|
124
155
|
|
|
@@ -259,7 +290,7 @@ group passes (no need to use `deploy --dry-run` as a workaround).
|
|
|
259
290
|
> No second deploy is required.
|
|
260
291
|
> The CLI must not report access success before the apply reaches `applied`.
|
|
261
292
|
> A local timeout exits non-zero while durable server recovery remains active.
|
|
262
|
-
> Preview with `--dry-run
|
|
293
|
+
> Preview with `--dry-run`. To undo a bad change, put the previous `launchpad.yaml` back and run `launchpad deploy`; `launchpad rollback` is not the way (see the verb list below).
|
|
263
294
|
> Do not tell the user to raise a request with the platform team.
|
|
264
295
|
> See
|
|
265
296
|
> `/launchpad-status` and the
|
|
@@ -355,8 +386,14 @@ Once you've shipped first content, the daily-use verbs are:
|
|
|
355
386
|
no-op that prints `no redeploy needed` and exits 0; it does not
|
|
356
387
|
re-run the dispatch build. To rebuild a dispatch app, ship a change
|
|
357
388
|
with `launchpad deploy`.
|
|
358
|
-
- **`launchpad envvars`**
|
|
359
|
-
production env vars.
|
|
389
|
+
- **`launchpad envvars`** - Pages apps only: list / set / remove
|
|
390
|
+
production env vars on the app's Pages project. On an app whose
|
|
391
|
+
settings live in the manifest (every new dispatch app) `set` and `rm`
|
|
392
|
+
change nothing and print the supported route: declare the variable
|
|
393
|
+
under `spec.env_vars` in `launchpad.yaml` and run `launchpad deploy`
|
|
394
|
+
(see `/launchpad-deploy`). On the 16 Nov test `envvars list` on a
|
|
395
|
+
dispatch app answered 502 `env_vars_read_failed` ("project ... not found
|
|
396
|
+
yet"): that is the missing Pages project, not a fault in the app.
|
|
360
397
|
- **`launchpad secrets template`** — emit `.env.example` from the
|
|
361
398
|
manifest's secret bindings.
|
|
362
399
|
- **`launchpad secrets push`** - push secret values from `.env`
|
|
@@ -382,8 +419,12 @@ Once you've shipped first content, the daily-use verbs are:
|
|
|
382
419
|
app has no Pages deployment history, so `logs` just says so and
|
|
383
420
|
points at `launchpad status`, which shows the delivery stage, any
|
|
384
421
|
refusal reason and, when there is one, the GitHub Actions run URL.
|
|
385
|
-
- **`launchpad rollback`**
|
|
386
|
-
re-
|
|
422
|
+
- **`launchpad rollback`** - reverts the **manifest only** (not content) to
|
|
423
|
+
a prior git SHA and re-applies it. The historical manifest must parse
|
|
424
|
+
against the v1alpha1 schema, so it fails on an app with a v2 manifest
|
|
425
|
+
(every new dispatch app). To undo a content change on any app: in the
|
|
426
|
+
clone, restore the old file's contents in the clone (from the user's own
|
|
427
|
+
copy of the previous version), then run `launchpad deploy`. That ships the old content as a new commit.
|
|
387
428
|
|
|
388
429
|
## Don'ts
|
|
389
430
|
|