@m-kopa/launchpad-cli 0.72.0 → 0.74.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 +16 -0
- package/dist/bundle/upload.d.ts +4 -0
- package/dist/bundle/upload.d.ts.map +1 -1
- package/dist/cli.js +6248 -5880
- package/dist/commands/admin-integrations.d.ts +8 -0
- package/dist/commands/admin-integrations.d.ts.map +1 -0
- package/dist/commands/admin.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/recover.d.ts.map +1 -1
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/deploy/first-deploy-secrets.d.ts +34 -0
- package/dist/deploy/first-deploy-secrets.d.ts.map +1 -0
- package/dist/integration-status.d.ts +11 -0
- package/dist/integration-status.d.ts.map +1 -0
- package/dist/secrets/push.d.ts +21 -0
- package/dist/secrets/push.d.ts.map +1 -1
- package/dist/secrets/set.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/skills/README.md +4 -1
- package/skills/launchpad-content-pr/SKILL.md +3 -3
- package/skills/launchpad-deploy/SKILL.md +2 -2
- package/skills/launchpad-deploy-status/SKILL.md +2 -2
- package/skills/launchpad-destroy/SKILL.md +1 -1
- package/skills/launchpad-identity/SKILL.md +1 -1
- package/skills/launchpad-ingest/SKILL.md +275 -0
- package/skills/launchpad-onboard/SKILL.md +2 -2
- package/skills/launchpad-report/SKILL.md +1 -1
- package/skills/launchpad-status/SKILL.md +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CliConfig } from "../config.js";
|
|
2
|
+
import type { CliIo, ExitCode } from "../dispatcher.js";
|
|
3
|
+
import type { AdminCommandDeps } from "./admin.js";
|
|
4
|
+
/** Lowercase hex SHA-256 of the full key string, prefix included. */
|
|
5
|
+
export declare function integrationKeyHash(key: string): string;
|
|
6
|
+
export declare function runAdminIntegrations(args: readonly string[], io: CliIo, config: CliConfig, deps: AdminCommandDeps): Promise<ExitCode>;
|
|
7
|
+
export declare function printIntegrationsUsage(print: (line: string) => void): void;
|
|
8
|
+
//# sourceMappingURL=admin-integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-integrations.d.ts","sourceRoot":"","sources":["../../src/commands/admin-integrations.ts"],"names":[],"mappings":"AAiBA,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;AAwBnD,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,KAAK,EACT,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,QAAQ,CAAC,CAenB;AAuHD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAG1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/commands/admin.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/commands/admin.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAOjE,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"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA0EA,OAAO,EAGL,4BAA4B,EAC7B,MAAM,uBAAuB,CAAC;AAiB/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;AAqyBxC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBnG;AA+BD,8FAA8F;AAC9F,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO;CAQxC;AAwCD,2EAA2E;AAC3E;+EAC+E;AAC/E,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAE9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,cAAc,CAG/E;AAED;;;4EAG4E;AAC5E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;CACrD,GAAG,OAAO,CAIV;AAED,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,OAAO,EACvB,UAAU,GAAE,OAAO,GAAG,SAAqB,GAC1C,MAAM,CAOR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../src/commands/recover.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAEjE,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAIF,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../src/commands/recover.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAS,OAAO,EAAY,MAAM,kBAAkB,CAAC;AAEjE,eAAO,MAAM,cAAc,EAAE,OAI5B,CAAC;AAIF,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAyPD;;kEAEkE;AAClE,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,MAAsB,EAC3B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC5B,WAAW,GAAG,MAAM,CAgDtB"}
|
|
@@ -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-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-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,+NAejB,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CliConfig } from "../config.js";
|
|
2
|
+
import type { CliIo, ExitCode } from "../dispatcher.js";
|
|
3
|
+
import { type LifecycleView } from "../commands/status.js";
|
|
4
|
+
import { type PushDeps, type PushOptions } from "../secrets/push.js";
|
|
5
|
+
export interface FirstDeploySecretsDeps {
|
|
6
|
+
readonly fetchLifecycle: (slug: string) => Promise<LifecycleView | null>;
|
|
7
|
+
readonly sleep: (ms: number) => Promise<void>;
|
|
8
|
+
readonly now: () => number;
|
|
9
|
+
readonly push: (opts: PushOptions, io: CliIo, deps?: PushDeps) => Promise<ExitCode>;
|
|
10
|
+
readonly pushDeps?: PushDeps;
|
|
11
|
+
}
|
|
12
|
+
export declare function realFirstDeploySecretsDeps(cfg: CliConfig): FirstDeploySecretsDeps;
|
|
13
|
+
/**
|
|
14
|
+
* Before the bot is called: a slug the bot does not know is a first deploy, so
|
|
15
|
+
* `.env` must already hold every declared secret. Returns an exit code to stop
|
|
16
|
+
* with, or null to continue. A lifecycle read that throws never blocks (the
|
|
17
|
+
* bot enforces its own gates).
|
|
18
|
+
*/
|
|
19
|
+
export declare function firstDeploySecretsPreflight(args: {
|
|
20
|
+
readonly slug: string;
|
|
21
|
+
readonly manifestPath: string;
|
|
22
|
+
}, io: CliIo, deps: Pick<FirstDeploySecretsDeps, "fetchLifecycle">): Promise<ExitCode | null>;
|
|
23
|
+
/**
|
|
24
|
+
* After the bot answered 202 `provisioning_started`: wait for the app repo to
|
|
25
|
+
* hold `launchpad.yaml`, then push every declared secret. Returns null to carry
|
|
26
|
+
* on to verification, or an exit code to stop with. Never silent about a
|
|
27
|
+
* timeout: the author gets the exact command that finishes the job.
|
|
28
|
+
*/
|
|
29
|
+
export declare function pushSecretsWhenCommitted(args: {
|
|
30
|
+
readonly slug: string;
|
|
31
|
+
readonly manifestPath: string;
|
|
32
|
+
readonly timeoutMs: number;
|
|
33
|
+
}, io: CliIo, deps: FirstDeploySecretsDeps): Promise<ExitCode | null>;
|
|
34
|
+
//# sourceMappingURL=first-deploy-secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-deploy-secrets.d.ts","sourceRoot":"","sources":["../../src/deploy/first-deploy-secrets.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAgB5B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACzE,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACpF,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC9B;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,SAAS,GAAG,sBAAsB,CAOjF;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAC9D,EAAE,EAAE,KAAK,EACT,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,GACnD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAmB1B;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IACJ,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,EACD,EAAE,EAAE,KAAK,EACT,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAwC1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Approved integrations (ADR 0060): print the per-integration status the bot
|
|
3
|
+
* attaches to a deploy response. Informational only; it never changes the
|
|
4
|
+
* deploy's exit code. The body is network input, so names are re-checked
|
|
5
|
+
* against the manifest name rule before they reach the terminal.
|
|
6
|
+
*/
|
|
7
|
+
import type { CliIo } from "./dispatcher.js";
|
|
8
|
+
/** The lines to print for the bot's `integrations` field. Empty when absent. */
|
|
9
|
+
export declare function integrationStatusLines(raw: unknown): string[];
|
|
10
|
+
export declare function renderIntegrationStatus(raw: unknown, io: CliIo): void;
|
|
11
|
+
//# sourceMappingURL=integration-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-status.d.ts","sourceRoot":"","sources":["../src/integration-status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAO7C,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAU7D;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,GAAG,IAAI,CAErE"}
|
package/dist/secrets/push.d.ts
CHANGED
|
@@ -19,8 +19,21 @@ export interface PushOptions {
|
|
|
19
19
|
* so the flip's secret check passes. Users stay on Pages meanwhile.
|
|
20
20
|
*/
|
|
21
21
|
readonly staged?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Set by `launchpad deploy` while a NEW container app is provisioning
|
|
24
|
+
* (AIO-892): the bot commits `launchpad.yaml` a moment after it accepts the
|
|
25
|
+
* deploy, so a 409 `manifest_not_found` is retried briefly, and the
|
|
26
|
+
* post-push hint says the first deploy will pick the secrets up (no
|
|
27
|
+
* `recover`).
|
|
28
|
+
*/
|
|
29
|
+
readonly firstDeploy?: {
|
|
30
|
+
readonly manifestRetries: number;
|
|
31
|
+
readonly retryDelayMs: number;
|
|
32
|
+
};
|
|
22
33
|
}
|
|
23
34
|
export interface PushDeps {
|
|
35
|
+
/** Override the wait between `manifest_not_found` retries (tests). */
|
|
36
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
24
37
|
readonly config?: CliConfig;
|
|
25
38
|
readonly fetcher?: typeof fetch;
|
|
26
39
|
/** Override TTY detection (tests). Default: `process.stdin.isTTY`. */
|
|
@@ -33,4 +46,12 @@ export interface PushDeps {
|
|
|
33
46
|
readonly runRecover?: (args: readonly string[], io: CliIo) => Promise<ExitCode>;
|
|
34
47
|
}
|
|
35
48
|
export declare function runSecretsPush(opts: PushOptions, io: CliIo, deps?: PushDeps): Promise<ExitCode>;
|
|
49
|
+
/** Declared `env-file` secret names of a manifest (empty when unreadable). */
|
|
50
|
+
export declare function declaredEnvFileSecretNames(file: string): readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Pre-flight for a first deploy: null when `.env` holds every declared
|
|
53
|
+
* `env-file` secret (or none are declared), else the exit code after printing
|
|
54
|
+
* the missing names.
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkEnvSecretsReady(opts: PushOptions, io: CliIo): ExitCode | null;
|
|
36
57
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/secrets/push.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/secrets/push.ts"],"names":[],"mappings":"AAoDA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAa1D,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,QAAQ;IACvB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IAChC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,CACrB,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,KAAK,EACT,IAAI,CAAC,EAAE,YAAY,KAChB,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CACjF;AAiBD,wBAAsB,cAAc,CAClC,IAAI,EAAE,WAAW,EACjB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,QAAa,GAClB,OAAO,CAAC,QAAQ,CAAC,CAuLnB;AA8FD,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAM1E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,CAGlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/secrets/set.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU1D,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAoHD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,OAAY,GACjB,OAAO,CAAC,QAAQ,CAAC,CAuCnB;AAKD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,OAAY,GACjB,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/secrets/set.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU1D,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAoHD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,OAAY,GACjB,OAAO,CAAC,QAAQ,CAAC,CAuCnB;AAKD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,KAAK,EACT,IAAI,GAAE,OAAY,GACjB,OAAO,CAAC,QAAQ,CAAC,CA4HnB"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.
|
|
1
|
+
export declare const CLI_VERSION = "0.74.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/skills/README.md
CHANGED
|
@@ -16,6 +16,7 @@ skills/
|
|
|
16
16
|
├── launchpad-status/SKILL.md
|
|
17
17
|
├── launchpad-destroy/SKILL.md
|
|
18
18
|
├── launchpad-identity/SKILL.md # dev / how-to-build skill (see below)
|
|
19
|
+
├── launchpad-ingest/SKILL.md # dev skill: verified ingest for approved integrations
|
|
19
20
|
└── marquee-share/ # vendored from M-KOPA/marquee, do
|
|
20
21
|
# not hand-edit — managed by
|
|
21
22
|
# scripts/sync-marquee-share-skill.sh
|
|
@@ -45,7 +46,9 @@ convention for this kind:
|
|
|
45
46
|
`@m-kopa/platform-auth` + the verified example), so it can't fork into a
|
|
46
47
|
divergent copy.
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
`launchpad-ingest` follows it: its handler is extracted from the SKILL.md and
|
|
50
|
+
run by `tests/skill-ingest-extraction.test.ts`, so the code an author copies is
|
|
51
|
+
the code that was tested.
|
|
49
52
|
|
|
50
53
|
## Cross-platform shell contract
|
|
51
54
|
|
|
@@ -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.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -371,8 +371,8 @@ Once you've shipped first content, the daily-use verbs are:
|
|
|
371
371
|
secrets on the app repo (the deploy workflow reads them there), so a
|
|
372
372
|
container's first deploy can be unblocked without repo access. If the
|
|
373
373
|
app is `provisioning_failed` at `deployment_verified` for missing
|
|
374
|
-
secrets, run `launchpad secrets push` then `launchpad recover <slug>`
|
|
375
|
-
(
|
|
374
|
+
secrets (a new app's first `launchpad deploy` normally pushes them itself), run `launchpad secrets push` then `launchpad recover <slug>`
|
|
375
|
+
(the bot marks the app live when the retry run passes). `launchpad redeploy` is a
|
|
376
376
|
no-op for containers and cannot do this.
|
|
377
377
|
- **`launchpad secrets status`** — names-only PRESENT/MISSING audit
|
|
378
378
|
per binding.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-deploy
|
|
3
3
|
description: Walk a Launchpad user through deploying an app from their local working directory (Model A — `launchpad init` + `launchpad deploy`). Wraps the CLI verbs end-to-end: detects the app shape, scaffolds `launchpad.yaml`, resolves the allowed Entra group via `launchpad groups`, bundles the CWD via `launchpad deploy`, and watches the rollout via `launchpad status`. Use when someone says "deploy a new app", "ship my app to Launchpad", "/launchpad-deploy", "I have an app locally — get it on Launchpad", or any variant. Resume/abandon for legacy in-flight provisioning is at the bottom.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -403,7 +403,7 @@ Only keep `auth: access` on an existing container app that has not been migrated
|
|
|
403
403
|
Do not switch an existing container between modes on your own; offer `/launchpad-report` so the platform team can migrate it.
|
|
404
404
|
Reading the signed-in user inside the container is covered in `/launchpad-identity`.
|
|
405
405
|
|
|
406
|
-
A container app's deploy workflow reads its declared secrets from GitHub Actions secrets on the app repo, which the author cannot reach. `launchpad secrets push` writes them there, so a container that declares secrets needs them pushed before its deploy workflow can pass.
|
|
406
|
+
A container app's deploy workflow reads its declared secrets from GitHub Actions secrets on the app repo, which the author cannot reach. `launchpad secrets push` writes them there, so a container that declares secrets needs them pushed before its deploy workflow can pass. For a NEW container app `launchpad deploy` does this itself: it checks `.env` holds every declared name before calling the bot (stop and tell the author to fill `.env` if it lists missing names), then pushes the secrets once the app repo exists, and the deploy run waits for them. No separate `secrets push` or `recover` is needed. Fallback: if the first deploy ends `provisioning_failed` at `deployment_verified` because of missing secrets, run `launchpad secrets push` and then `launchpad recover <slug>` (the bot authorizes the retry run and marks it live itself). `launchpad deploy` with no change and `launchpad redeploy` cannot re-run a failed container deploy.
|
|
407
407
|
|
|
408
408
|
**First deploy vs subsequent deploys** (M-1234). Under Model A there
|
|
409
409
|
is no separate "create the app" step — `launchpad deploy` against a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-deploy-status
|
|
3
3
|
description: Show the current provisioning stage + failure reason for a Launchpad app via `launchpad status` (Model A drift + deployment_verified) and `launchpad apps` (lifecycle bucket), or watch provisioning live with `launchpad watch`. Renders the M-892 stage trace for in-flight provisioning, and is the canonical home for `launchpad recover` (repair a terminal-failed app record that is actually live). Use when someone says "what's the status of demo-X", "/launchpad-deploy-status", "is my deploy stuck", "watch my deploy go live", "watch provisioning", "my app says failed but it's serving", or after `/launchpad-deploy` reports a non-`done` terminal stage.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -71,7 +71,7 @@ inference source resolves.
|
|
|
71
71
|
| Is the app stuck in the legacy M-892 zero-touch flow? | See § Legacy below |
|
|
72
72
|
| What broke the most recent deploy? | `launchpad status <slug> --json` + the bot's PR check trail |
|
|
73
73
|
| It says `failed` but the app is live in a browser | `launchpad recover <slug>` — see § Recover below |
|
|
74
|
-
| A container app is `provisioning_failed` at `deployment_verified` (deploy workflow found its secrets missing) | `launchpad secrets push`, then `launchpad recover <slug>`;
|
|
74
|
+
| A container app is `provisioning_failed` at `deployment_verified` (deploy workflow found its secrets missing; a one-step `launchpad deploy` normally prevents this) | `launchpad secrets push`, then `launchpad recover <slug>`; the bot authorizes and verifies the retry run and marks the app live (watch `launchpad status`) |
|
|
75
75
|
|
|
76
76
|
The Model A default is `launchpad status <slug>` (a one-shot read).
|
|
77
77
|
For an in-flight first deploy, `launchpad watch <slug>` is the live
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-destroy
|
|
3
3
|
description: Tear down a Launchpad app end-to-end via `launchpad destroy` — Cloudflare Pages project, edge-auth wiring (gateway KV/audience entries, or the Access app for `auth: access` apps), custom hostname, platform-repo TF, and the app repo (archive-renamed). Owner-only verb with a two-step destructive confirmation. Use when someone says "destroy this app", "/launchpad-destroy", "tear down `<slug>`", "delete the app", or asks to clean up a smoke-test / orphan / retired app.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-identity
|
|
3
3
|
description: Teach an app author how to use the signed-in user's identity inside a Launchpad app - read the gateway-forwarded X-Launchpad-User-Assertion in the app's server code (functions/ on a react+api app, compiled into its Worker on dispatch, or a Pages Function on a legacy Pages app), VERIFY it with @m-kopa/platform-auth (fail-closed), and show who's logged in (sub/email/name). Use when someone says "who is logged in", "show the current user", "get the user's email in my app", "auth in my launchpad app", "read the user identity", "/launchpad-identity", or is wiring up an /api/me for a gateway-fronted app.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: launchpad-ingest
|
|
3
|
+
description: Scaffold a verified ingest endpoint so an approved backend (an approved integration, ADR 0060) can write into a Launchpad react+api app - declare the integration in launchpad.yaml, add a Hono route registered ahead of the user-auth middleware that verifies the gateway's X-Launchpad-Integration-Assertion with @m-kopa/platform-auth, validates the body with zod, and does an idempotent D1 insert keyed on a caller-supplied idempotency key. Use when someone says "let another system push data into my app", "add an ingest endpoint", "receive data from the Sales backend", "approved integration", "machine-to-machine write", "/launchpad-ingest", or asks what a calling team must send.
|
|
4
|
+
version: 0.74.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
8
|
+
## Shell contract — read this first
|
|
9
|
+
|
|
10
|
+
Every fenced `bash` block below MUST be sent to the `Bash` tool **verbatim**.
|
|
11
|
+
Do not rewrite into PowerShell, cmd, zsh-isms, or "equivalent" forms.
|
|
12
|
+
|
|
13
|
+
- macOS / Linux: the `Bash` tool runs system bash.
|
|
14
|
+
- Windows: the `Bash` tool runs Git for Windows (MSYS) bash. `$HOME`,
|
|
15
|
+
forward slashes, `test -f`, `command -v`, heredocs, and `[[ … ]]` all
|
|
16
|
+
work. There is no reason to translate to `Test-Path`, `$env:USERPROFILE`,
|
|
17
|
+
`Get-Content`, `Where-Object`, `Get-ChildItem`, or backslash paths —
|
|
18
|
+
doing so will fail with `/usr/bin/bash: syntax error`.
|
|
19
|
+
|
|
20
|
+
If a step genuinely needs OS branching, branch *inside* bash:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
case "$(uname -s)" in
|
|
24
|
+
Darwin) : ;;
|
|
25
|
+
Linux) : ;;
|
|
26
|
+
MINGW*|MSYS*|CYGWIN*) : ;;
|
|
27
|
+
esac
|
|
28
|
+
```
|
|
29
|
+
<!-- END shell-contract -->
|
|
30
|
+
|
|
31
|
+
# /launchpad-ingest
|
|
32
|
+
|
|
33
|
+
How an app author lets an approved backend write into a Launchpad app, the right way: the gateway checks the caller's key, your handler verifies the gateway's signed assertion, and every write is idempotent.
|
|
34
|
+
|
|
35
|
+
This is a **how-to-build** skill.
|
|
36
|
+
It writes app code; the only CLI verb it runs is `launchpad deploy`.
|
|
37
|
+
|
|
38
|
+
## What you get, in one sentence
|
|
39
|
+
|
|
40
|
+
A backend sends `Authorization: Bearer lpi_...` to one exact route on your app; the gateway checks the key against the platform-approved list, strips it, and forwards a short-lived RS256 assertion in `X-Launchpad-Integration-Assertion`, which your handler verifies before it writes anything.
|
|
41
|
+
|
|
42
|
+
## Prerequisites
|
|
43
|
+
|
|
44
|
+
- A **`react+api`** app (dispatch or legacy Pages) with a `functions/api/[[path]].ts` Hono router, as the template scaffolds.
|
|
45
|
+
Static and react apps cannot run server code; see `/launchpad-identity` § Prerequisite for how to get one.
|
|
46
|
+
- A D1 binding named `DB` (`spec.bindings.d1: DB` on dispatch, `targets: [{ kind: pages, d1_binding: DB }]` on Pages).
|
|
47
|
+
- `@m-kopa/platform-auth` **0.8.0 or later** (that release adds `verifyIntegrationAssertion`) and `zod` in the app's `package.json`.
|
|
48
|
+
- A platform admin to approve the integration.
|
|
49
|
+
You can't approve your own; the manifest only asks.
|
|
50
|
+
|
|
51
|
+
## Step 1 - declare the integration
|
|
52
|
+
|
|
53
|
+
Add it to `launchpad.yaml`.
|
|
54
|
+
The path is an **exact match**: no prefixes, query strings, `%` escapes or trailing `/`.
|
|
55
|
+
Methods are a subset of `POST`, `PUT`, `PATCH`, `DELETE`.
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
integrations:
|
|
59
|
+
- name: sales-backend
|
|
60
|
+
path: /api/ingest/stock-count
|
|
61
|
+
methods: [POST]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Step 2 - create the table
|
|
65
|
+
|
|
66
|
+
The idempotency key is the primary key, so a replayed request can never add a second row.
|
|
67
|
+
Add this as a D1 migration (for example `migrations/0001_stock_counts.sql`).
|
|
68
|
+
|
|
69
|
+
<!-- BEGIN ingest-migration (pinned by tests/skill-ingest-extraction.test.ts) -->
|
|
70
|
+
```sql
|
|
71
|
+
CREATE TABLE IF NOT EXISTS stock_counts (
|
|
72
|
+
idempotency_key TEXT PRIMARY KEY,
|
|
73
|
+
serial TEXT NOT NULL,
|
|
74
|
+
count_month TEXT NOT NULL,
|
|
75
|
+
agent_id TEXT NOT NULL,
|
|
76
|
+
counted_at TEXT NOT NULL,
|
|
77
|
+
received_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
78
|
+
);
|
|
79
|
+
```
|
|
80
|
+
<!-- END ingest-migration -->
|
|
81
|
+
|
|
82
|
+
## Step 3 - the handler
|
|
83
|
+
|
|
84
|
+
Put this in the same file as your router, `functions/api/[[path]].ts`, above the router.
|
|
85
|
+
A Pages app treats every file under `functions/` as a route, so a separate helper file there would become a route of its own.
|
|
86
|
+
Change `INTEGRATION`, the schema and the SQL to fit your data; keep everything else.
|
|
87
|
+
|
|
88
|
+
<!-- BEGIN ingest-handler (pinned by tests/skill-ingest-extraction.test.ts) -->
|
|
89
|
+
```ts
|
|
90
|
+
import type { Hono } from "hono";
|
|
91
|
+
import { z } from "zod";
|
|
92
|
+
import {
|
|
93
|
+
createJwksCache,
|
|
94
|
+
INTEGRATION_ASSERTION_HEADER_NAME,
|
|
95
|
+
verifyIntegrationAssertion,
|
|
96
|
+
} from "@m-kopa/platform-auth";
|
|
97
|
+
|
|
98
|
+
/** The `name` from launchpad.yaml. A valid assertion for any other integration is refused. */
|
|
99
|
+
const INTEGRATION = "sales-backend";
|
|
100
|
+
|
|
101
|
+
interface IngestEnv {
|
|
102
|
+
readonly DB: D1Database;
|
|
103
|
+
// The platform sets these. Read both name sets; older Pages apps only carry the CF_ACCESS_* ones.
|
|
104
|
+
readonly GATEWAY_ISSUER?: string;
|
|
105
|
+
readonly GATEWAY_AUD?: string;
|
|
106
|
+
readonly GATEWAY_JWKS_URL?: string;
|
|
107
|
+
readonly CF_ACCESS_TEAM_DOMAIN?: string;
|
|
108
|
+
readonly CF_ACCESS_AUD?: string;
|
|
109
|
+
readonly JWKS_URL?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const StockCount = z
|
|
113
|
+
.object({
|
|
114
|
+
idempotency_key: z.string().min(8).max(128),
|
|
115
|
+
serial: z.string().min(1).max(64),
|
|
116
|
+
count_month: z.string().regex(/^\d{4}-\d{2}$/),
|
|
117
|
+
agent_id: z.string().min(1).max(64),
|
|
118
|
+
counted_at: z.string().datetime(),
|
|
119
|
+
})
|
|
120
|
+
.strict();
|
|
121
|
+
|
|
122
|
+
let jwks: ReturnType<typeof createJwksCache> | null = null;
|
|
123
|
+
let jwksUrl: string | null = null;
|
|
124
|
+
function jwksFor(url: string): ReturnType<typeof createJwksCache> {
|
|
125
|
+
if (jwks === null || jwksUrl !== url) {
|
|
126
|
+
jwks = createJwksCache(url);
|
|
127
|
+
jwksUrl = url;
|
|
128
|
+
}
|
|
129
|
+
return jwks;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Register BEFORE the user-auth middleware: machine callers have no user session. */
|
|
133
|
+
export function registerIngestRoutes<E extends { Bindings: IngestEnv }>(app: Hono<E>): void {
|
|
134
|
+
app.post("/ingest/stock-count", async (c) => {
|
|
135
|
+
const env = c.env;
|
|
136
|
+
const issuer = env.GATEWAY_ISSUER || env.CF_ACCESS_TEAM_DOMAIN;
|
|
137
|
+
// The host comes from GATEWAY_AUD, never from the request URL: on a Pages
|
|
138
|
+
// origin the request arrives addressed to <project>.pages.dev.
|
|
139
|
+
const host = env.GATEWAY_AUD || env.CF_ACCESS_AUD;
|
|
140
|
+
const url =
|
|
141
|
+
env.GATEWAY_JWKS_URL || env.JWKS_URL || (issuer ? `${issuer.replace(/\/$/, "")}/.well-known/jwks.json` : undefined);
|
|
142
|
+
if (!issuer || !host || !url) return c.json({ error: "integration_unconfigured" }, 503);
|
|
143
|
+
|
|
144
|
+
const token = c.req.header(INTEGRATION_ASSERTION_HEADER_NAME);
|
|
145
|
+
if (!token) return c.json({ error: "unauthorized" }, 401);
|
|
146
|
+
let name: string;
|
|
147
|
+
try {
|
|
148
|
+
({ name } = await verifyIntegrationAssertion(token, {
|
|
149
|
+
issuer,
|
|
150
|
+
host,
|
|
151
|
+
method: c.req.method,
|
|
152
|
+
path: new URL(c.req.url).pathname,
|
|
153
|
+
jwks: jwksFor(url),
|
|
154
|
+
}));
|
|
155
|
+
} catch {
|
|
156
|
+
// Forged, expired, wrong host, wrong route, or a user/CLI token: fail closed.
|
|
157
|
+
return c.json({ error: "unauthorized" }, 401);
|
|
158
|
+
}
|
|
159
|
+
if (name !== INTEGRATION) return c.json({ error: "forbidden" }, 403);
|
|
160
|
+
|
|
161
|
+
const parsed = StockCount.safeParse(await c.req.json().catch(() => null));
|
|
162
|
+
if (!parsed.success) {
|
|
163
|
+
return c.json({ error: "invalid_body", fields: parsed.error.issues.map((i) => i.path.join(".")) }, 400);
|
|
164
|
+
}
|
|
165
|
+
const row = parsed.data;
|
|
166
|
+
const result = await env.DB.prepare(
|
|
167
|
+
`INSERT INTO stock_counts (idempotency_key, serial, count_month, agent_id, counted_at)
|
|
168
|
+
VALUES (?, ?, ?, ?, ?)
|
|
169
|
+
ON CONFLICT(idempotency_key) DO NOTHING`,
|
|
170
|
+
)
|
|
171
|
+
.bind(row.idempotency_key, row.serial, row.count_month, row.agent_id, row.counted_at)
|
|
172
|
+
.run();
|
|
173
|
+
// A replay is a success too, so the caller can retry safely.
|
|
174
|
+
return c.json({ ok: true, duplicate: result.meta.changes === 0 });
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
<!-- END ingest-handler -->
|
|
179
|
+
|
|
180
|
+
## Step 4 - register it ahead of user auth
|
|
181
|
+
|
|
182
|
+
The template's router authenticates every `/api/*` request as a signed-in user.
|
|
183
|
+
A machine caller has no user session, so the ingest route has to be registered **before** that middleware.
|
|
184
|
+
Hono runs handlers in registration order, and the ingest handler always returns a response, so the user-auth middleware never sees the request.
|
|
185
|
+
|
|
186
|
+
<!-- BEGIN ingest-wiring (pinned by tests/skill-ingest-extraction.test.ts) -->
|
|
187
|
+
```ts
|
|
188
|
+
const app = new Hono<{ Bindings: Env; Variables: PlatformAuthVariables }>().basePath("/api");
|
|
189
|
+
|
|
190
|
+
// Integration routes first. Everything registered after this line is user-only.
|
|
191
|
+
registerIngestRoutes(app);
|
|
192
|
+
|
|
193
|
+
app.use("*", async (c, next) => {
|
|
194
|
+
const middleware = createPlatformAuthMiddleware({
|
|
195
|
+
teamDomain: c.env.CF_ACCESS_TEAM_DOMAIN,
|
|
196
|
+
audience: c.env.CF_ACCESS_AUD,
|
|
197
|
+
jwks: jwks(c.env),
|
|
198
|
+
});
|
|
199
|
+
return middleware(c, next);
|
|
200
|
+
});
|
|
201
|
+
```
|
|
202
|
+
<!-- END ingest-wiring -->
|
|
203
|
+
|
|
204
|
+
Add `DB` to your `Env` interface so the types line up.
|
|
205
|
+
|
|
206
|
+
## Step 5 - deploy and get it approved
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
launchpad deploy
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Deploy prints `integration sales-backend: pending platform approval` until a platform admin approves it, then `integration sales-backend: approved`.
|
|
213
|
+
Until then the gateway answers every `lpi_` request to your app with `401`.
|
|
214
|
+
Ask the platform team for approval with `/launchpad-report`, naming the app, the integration and the calling team.
|
|
215
|
+
They mint the key and hand it to the calling team directly; you never hold it.
|
|
216
|
+
|
|
217
|
+
## If you hand-write the verifier
|
|
218
|
+
|
|
219
|
+
Use `verifyIntegrationAssertion`.
|
|
220
|
+
If you genuinely cannot (for example a build-less app with no `package.json`), your verifier must check **all** of these, and fail closed on any miss:
|
|
221
|
+
|
|
222
|
+
| Claim | Must equal |
|
|
223
|
+
|---|---|
|
|
224
|
+
| signature | RS256 against the gateway JWKS (`https://auth.launchpad.m-kopa.us/.well-known/jwks.json`). No other algorithm. |
|
|
225
|
+
| `iss` | `GATEWAY_ISSUER` (`https://auth.launchpad.m-kopa.us`) |
|
|
226
|
+
| `aud` | `"integration:" + GATEWAY_AUD`, for example `integration:wh-count.launchpad.m-kopa.us` |
|
|
227
|
+
| `typ` | `launchpad-integration` |
|
|
228
|
+
| `sub` | starts with `integration:`; the rest is the integration name, which must be yours |
|
|
229
|
+
| `htm` | the request method, upper case |
|
|
230
|
+
| `htu` | the request path, exactly (`new URL(request.url).pathname`) |
|
|
231
|
+
| `exp` / `nbf` | in date, with at most 30 seconds of clock skew |
|
|
232
|
+
|
|
233
|
+
> ⚠️ **Skipping `aud` or `typ` opens your app to every employee.**
|
|
234
|
+
> The gateway signs user assertions and CLI session tokens with the same key and issuer.
|
|
235
|
+
> Most react+api apps run unconfined on a public `*.pages.dev` origin, so anyone with a Launchpad CLI session can send their own token straight there as `X-Launchpad-Integration-Assertion`.
|
|
236
|
+
> A verifier that checks only the signature and issuer accepts it.
|
|
237
|
+
> Checking `htm` and `htu` stops a captured assertion being replayed against another route.
|
|
238
|
+
|
|
239
|
+
## What the calling team must do
|
|
240
|
+
|
|
241
|
+
Hand the calling team this contract:
|
|
242
|
+
|
|
243
|
+
- **One header.** `Authorization: Bearer <key>` on `POST https://<slug>.launchpad.m-kopa.us/api/ingest/stock-count`, with a JSON body.
|
|
244
|
+
Never send the key anywhere else or log it.
|
|
245
|
+
Store it in their secret store (for example Key Vault), never in chat or tickets.
|
|
246
|
+
- **An idempotency key per record.** A stable value for the logical record (for example `<serial>:<count_month>`), so a retry or replay never double-writes.
|
|
247
|
+
A replay returns `200` with `"duplicate": true`.
|
|
248
|
+
- **Retry with backoff on `429` and `5xx`** (exponential, with jitter, capped).
|
|
249
|
+
The gateway rate-limits each integration and answers `429` above the ceiling.
|
|
250
|
+
- **Never retry other `4xx`.**
|
|
251
|
+
`401` means a wrong, revoked or unapproved key or route; `403` means a wrong integration or a blocked IP; `400` means a bad body.
|
|
252
|
+
Retrying won't fix any of them.
|
|
253
|
+
|
|
254
|
+
## Checklist before you ship
|
|
255
|
+
|
|
256
|
+
- [ ] `integrations:` declared in `launchpad.yaml` with the exact path the handler serves.
|
|
257
|
+
- [ ] Ingest route registered **before** the user-auth middleware.
|
|
258
|
+
- [ ] `verifyIntegrationAssertion` gets the host from `GATEWAY_AUD` (never the request URL), the request method, and `new URL(c.req.url).pathname`.
|
|
259
|
+
- [ ] The returned name is checked against your integration.
|
|
260
|
+
- [ ] The body is validated before anything is written.
|
|
261
|
+
- [ ] The insert is keyed on the caller's idempotency key with `ON CONFLICT ... DO NOTHING`.
|
|
262
|
+
- [ ] No route reads `Authorization`: the gateway strips the key before your app sees the request.
|
|
263
|
+
|
|
264
|
+
## Don'ts
|
|
265
|
+
|
|
266
|
+
- Do **not** trust a request because it reached the route: verify the assertion every time.
|
|
267
|
+
- Do **not** accept a user assertion (`X-Launchpad-User-Assertion`) on an ingest route, or an integration assertion on a user route.
|
|
268
|
+
- Do **not** use a path prefix or wildcard: one key opens exactly one route.
|
|
269
|
+
- Do **not** store or log the assertion or any `lpi_` value.
|
|
270
|
+
|
|
271
|
+
## Related
|
|
272
|
+
|
|
273
|
+
- `/launchpad-identity` - reading the signed-in **user** in the same app.
|
|
274
|
+
- ADR 0060 - the trust model, approval by reviewed PR, and revoke latency.
|
|
275
|
+
- [Manifest reference: integrations](https://get.launchpad.m-kopa.us/manifest/#integrations-machine-callers).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-onboard
|
|
3
3
|
description: One-time setup for the Launchpad CLI + Claude Code skill bundle. Verifies the `launchpad` CLI is installed and current, runs `launchpad whoami` to confirm the session is fresh, and checks the bundled skills are installed and in lock-step with the CLI. Idempotent — safe to re-run any time. Use when someone says "set me up for Launchpad", "I just got a new machine and want to use Launchpad", "/launchpad-onboard", or any of the other launchpad-* skills fails on a prereq check.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -40,7 +40,7 @@ This is the **only** skill that mutates the user's machine (it can
|
|
|
40
40
|
trigger `launchpad login` and suggest installs). The other skills
|
|
41
41
|
(`/launchpad-deploy`, `/launchpad-deploy-status`,
|
|
42
42
|
`/launchpad-content-pr`, `/launchpad-status`, `/launchpad-destroy`,
|
|
43
|
-
`/launchpad-identity`) assume the machine is already onboarded and fail
|
|
43
|
+
`/launchpad-identity`, `/launchpad-ingest`) assume the machine is already onboarded and fail
|
|
44
44
|
loudly if a prereq is missing — pointing back here.
|
|
45
45
|
|
|
46
46
|
After `launchpad clone <slug>`, refresh that same directory with bare
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-report
|
|
3
3
|
description: File a bug report or feature request to the Launchpad team's tracker from the CLI. Use when someone reports something broken, hits an error in a launchpad command, or wishes a feature existed — e.g. "this is broken", "report a bug", "can you file that", "I wish launchpad could…", "/launchpad-bug", "/launchpad-feature". Always confirm and show exactly what you'll send before filing; never file silently.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: launchpad-status
|
|
3
3
|
description: Safely refresh a Launchpad clone, show manifest drift, or read the deployed manifest. Wraps bare `launchpad pull` for source sync, `launchpad pull --manifest` for deployed YAML, and `launchpad status` for drift. Use for "sync my clone", "what's deployed", "show drift", "/launchpad-status", "/launchpad-pull", or post-deploy verification.
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.74.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<!-- BEGIN shell-contract (managed by scripts/sync-skill-contract.sh — edit skills/_partials/shell-contract.md) -->
|