@mp-lb/arcnet 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/createCli.d.ts.map +1 -1
- package/dist/createCli.js +12 -0
- package/dist/createCli.js.map +1 -1
- package/dist/environment/grantDomainOwner.d.ts +9 -0
- package/dist/environment/grantDomainOwner.d.ts.map +1 -0
- package/dist/environment/grantDomainOwner.js +42 -0
- package/dist/environment/grantDomainOwner.js.map +1 -0
- package/docs/public/commands.md +14 -0
- package/docs/public/llms-full.txt +25 -0
- package/package.json +1 -1
- package/src/createCli.ts +13 -0
- package/src/environment/grantDomainOwner.ts +72 -0
package/README.md
CHANGED
|
@@ -17,6 +17,17 @@ Setup pins this package in the existing root manifest. Commit the resulting lock
|
|
|
17
17
|
|
|
18
18
|
Zap Arc remains the pinned Terraform engine dependency. Environment bootstrap, health checks and teardown are not implemented by this package yet. The static Vercel adapter retains its existing static-only and explicit-project-reference limitations.
|
|
19
19
|
|
|
20
|
+
## Environment domain ownership
|
|
21
|
+
|
|
22
|
+
After a human Google identity has verified a base domain with its DNS TXT record, delegate that property to a project's deploy service account without opening Search Console:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
gcloud auth application-default login --scopes=https://www.googleapis.com/auth/siteverification,https://www.googleapis.com/auth/cloud-platform
|
|
26
|
+
arcnet environment domain-owner --domain example.com --email arc-deploy@arcnet-example.iam.gserviceaccount.com --quota-project arcnet-platform
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Enable `siteverification.googleapis.com` on the quota project first. The signed-in owner needs Service Usage Consumer access there. The command is safe to rerun: it preserves all existing owners and adds the named account only if absent. Run it as a verified owner of the exact base domain. This grants domain ownership; it does not create the initial verification TXT record, project routing, Cloud Run mapping or DNS route. Those remain separate environment and project configuration steps.
|
|
30
|
+
|
|
20
31
|
## Layered secrets
|
|
21
32
|
|
|
22
33
|
`arcnet secrets add` attaches an existing Forum encrypted JSON file. `arcnet secrets init` creates one. Both register a file-specific decryption key in the selected GitHub repository, save an encrypted snapshot, and generate a validation workflow. Setup prompts for your Forum encryption password locally; it never prints the password or recipient key. Use `--existing-key` when the GitHub secret already exists. The local `fm` and `gh` CLIs must be authenticated; the selected Forum parent directory must exist.
|
package/dist/createCli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCli.d.ts","sourceRoot":"","sources":["../src/createCli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"createCli.d.ts","sourceRoot":"","sources":["../src/createCli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,SAAS,eAwIrB,CAAC"}
|
package/dist/createCli.js
CHANGED
|
@@ -3,6 +3,7 @@ import { appendFileSync, readFileSync, realpathSync } from "node:fs";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ciOutputs } from "./ciOutputs.js";
|
|
6
|
+
import { grantDomainOwner } from "./environment/grantDomainOwner.js";
|
|
6
7
|
import { createSetupCommand } from "./createSetupCommand.js";
|
|
7
8
|
import { packageVersion } from "./packageInfo.js";
|
|
8
9
|
import { renderResult } from "./renderResult.js";
|
|
@@ -27,6 +28,17 @@ export const createCli = () => {
|
|
|
27
28
|
process.stdout.write(renderResult(result, cli.opts()) + "\n");
|
|
28
29
|
};
|
|
29
30
|
createSecretsCommands(cli, output);
|
|
31
|
+
cli
|
|
32
|
+
.command("environment")
|
|
33
|
+
.description("Manage ArcNet environment prerequisites.")
|
|
34
|
+
.command("domain-owner")
|
|
35
|
+
.description("Grant a deploy identity ownership of an already verified base domain.")
|
|
36
|
+
.requiredOption("--domain <domain>", "Verified base domain")
|
|
37
|
+
.requiredOption("--email <email>", "Deploy service account email")
|
|
38
|
+
.requiredOption("--quota-project <id>", "GCP project with Site Verification API enabled")
|
|
39
|
+
.action(async (options) => {
|
|
40
|
+
output(await grantDomainOwner(options.domain, options.email, options.quotaProject));
|
|
41
|
+
});
|
|
30
42
|
cli
|
|
31
43
|
.command("version")
|
|
32
44
|
.description("Show the installed package version.")
|
package/dist/createCli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCli.js","sourceRoot":"","sources":["../src/createCli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;SAC9B,WAAW,CAAC,qCAAqC,CAAC;SAClD,OAAO,CAAC,cAAc,CAAC;SACvB,MAAM,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SAClE,M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
|
|
2
|
+
getToken?: () => string;
|
|
3
|
+
request?: typeof fetch;
|
|
4
|
+
}) => Promise<{
|
|
5
|
+
domain: string;
|
|
6
|
+
email: string;
|
|
7
|
+
changed: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=grantDomainOwner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grantDomainOwner.d.ts","sourceRoot":"","sources":["../../src/environment/grantDomainOwner.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,EACd,OAAO,MAAM,EACb,cAAc,MAAM,EACpB,eAAc;IACZ,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACnB;;;;EAwDP,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
export const grantDomainOwner = async (domain, email, quotaProject, dependencies = {}) => {
|
|
3
|
+
if (!/^(?:[a-z0-9-]+\.)+[a-z]{2,}$/i.test(domain))
|
|
4
|
+
throw new Error("Provide a base domain such as example.com.");
|
|
5
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))
|
|
6
|
+
throw new Error("Provide a service account email address.");
|
|
7
|
+
if (!/^[a-z][a-z0-9-]{4,61}[a-z0-9]$/.test(quotaProject))
|
|
8
|
+
throw new Error("Provide a valid Google quota project ID.");
|
|
9
|
+
const token = (dependencies.getToken?.() ??
|
|
10
|
+
execFileSync("gcloud", ["auth", "application-default", "print-access-token"], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] })).trim();
|
|
11
|
+
const request = dependencies.request ?? fetch;
|
|
12
|
+
const base = "https://www.googleapis.com/siteVerification/v1/webResource";
|
|
13
|
+
const headers = {
|
|
14
|
+
Authorization: `Bearer ${token}`,
|
|
15
|
+
"x-goog-user-project": quotaProject,
|
|
16
|
+
};
|
|
17
|
+
const list = await request(base, { headers });
|
|
18
|
+
if (!list.ok) {
|
|
19
|
+
if (list.status === 403)
|
|
20
|
+
throw new Error(`Google Site Verification denied access. Check the signed-in owner's siteverification scope, Service Usage Consumer permission, and that siteverification.googleapis.com is enabled on ${quotaProject}.`);
|
|
21
|
+
throw new Error(`Google Site Verification list failed (${list.status}).`);
|
|
22
|
+
}
|
|
23
|
+
const { items = [] } = (await list.json());
|
|
24
|
+
const resource = items.find(({ site }) => site.type === "INET_DOMAIN" &&
|
|
25
|
+
site.identifier.toLowerCase() === domain.toLowerCase());
|
|
26
|
+
if (!resource)
|
|
27
|
+
throw new Error(`${domain} is not verified for the signed-in Google identity. Verify the base domain with a DNS TXT record first.`);
|
|
28
|
+
if (resource.owners.some((owner) => owner.toLowerCase() === email.toLowerCase()))
|
|
29
|
+
return { domain, email, changed: false };
|
|
30
|
+
const update = await request(`${base}/${encodeURIComponent(resource.id)}`, {
|
|
31
|
+
method: "PUT",
|
|
32
|
+
headers: { ...headers, "Content-Type": "application/json" },
|
|
33
|
+
body: JSON.stringify({ ...resource, owners: [...resource.owners, email] }),
|
|
34
|
+
});
|
|
35
|
+
if (!update.ok)
|
|
36
|
+
throw new Error(`Google Site Verification owner update failed (${update.status}).`);
|
|
37
|
+
const result = (await update.json());
|
|
38
|
+
if (!result.owners.some((owner) => owner.toLowerCase() === email.toLowerCase()))
|
|
39
|
+
throw new Error("Google did not confirm the new domain owner.");
|
|
40
|
+
return { domain, email, changed: true };
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=grantDomainOwner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grantDomainOwner.js","sourceRoot":"","sources":["../../src/environment/grantDomainOwner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,MAAc,EACd,KAAa,EACb,YAAoB,EACpB,eAGI,EAAE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,CAAC;IAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC,CAAC"}
|
package/docs/public/commands.md
CHANGED
|
@@ -89,6 +89,20 @@ Refresh encrypted snapshots from Forum and regenerate validation CI; no decrypti
|
|
|
89
89
|
| --- | --- |
|
|
90
90
|
| `--config <file>` | Secrets source configuration |
|
|
91
91
|
|
|
92
|
+
## `arcnet environment`
|
|
93
|
+
|
|
94
|
+
Manage ArcNet environment prerequisites.
|
|
95
|
+
|
|
96
|
+
### `arcnet environment domain-owner`
|
|
97
|
+
|
|
98
|
+
Grant a deploy identity ownership of an already verified base domain.
|
|
99
|
+
|
|
100
|
+
| Option | Description |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `--domain <domain>` | Verified base domain |
|
|
103
|
+
| `--email <email>` | Deploy service account email |
|
|
104
|
+
| `--quota-project <id>` | GCP project with Site Verification API enabled |
|
|
105
|
+
|
|
92
106
|
## `arcnet version`
|
|
93
107
|
|
|
94
108
|
Show the installed package version.
|
|
@@ -17,6 +17,17 @@ Setup pins this package in the existing root manifest. Commit the resulting lock
|
|
|
17
17
|
|
|
18
18
|
Zap Arc remains the pinned Terraform engine dependency. Environment bootstrap, health checks and teardown are not implemented by this package yet. The static Vercel adapter retains its existing static-only and explicit-project-reference limitations.
|
|
19
19
|
|
|
20
|
+
## Environment domain ownership
|
|
21
|
+
|
|
22
|
+
After a human Google identity has verified a base domain with its DNS TXT record, delegate that property to a project's deploy service account without opening Search Console:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
gcloud auth application-default login --scopes=https://www.googleapis.com/auth/siteverification,https://www.googleapis.com/auth/cloud-platform
|
|
26
|
+
arcnet environment domain-owner --domain example.com --email arc-deploy@arcnet-example.iam.gserviceaccount.com --quota-project arcnet-platform
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Enable `siteverification.googleapis.com` on the quota project first. The signed-in owner needs Service Usage Consumer access there. The command is safe to rerun: it preserves all existing owners and adds the named account only if absent. Run it as a verified owner of the exact base domain. This grants domain ownership; it does not create the initial verification TXT record, project routing, Cloud Run mapping or DNS route. Those remain separate environment and project configuration steps.
|
|
30
|
+
|
|
20
31
|
## Layered secrets
|
|
21
32
|
|
|
22
33
|
`arcnet secrets add` attaches an existing Forum encrypted JSON file. `arcnet secrets init` creates one. Both register a file-specific decryption key in the selected GitHub repository, save an encrypted snapshot, and generate a validation workflow. Setup prompts for your Forum encryption password locally; it never prints the password or recipient key. Use `--existing-key` when the GitHub secret already exists. The local `fm` and `gh` CLIs must be authenticated; the selected Forum parent directory must exist.
|
|
@@ -143,6 +154,20 @@ Refresh encrypted snapshots from Forum and regenerate validation CI; no decrypti
|
|
|
143
154
|
| --- | --- |
|
|
144
155
|
| `--config <file>` | Secrets source configuration |
|
|
145
156
|
|
|
157
|
+
## `arcnet environment`
|
|
158
|
+
|
|
159
|
+
Manage ArcNet environment prerequisites.
|
|
160
|
+
|
|
161
|
+
### `arcnet environment domain-owner`
|
|
162
|
+
|
|
163
|
+
Grant a deploy identity ownership of an already verified base domain.
|
|
164
|
+
|
|
165
|
+
| Option | Description |
|
|
166
|
+
| --- | --- |
|
|
167
|
+
| `--domain <domain>` | Verified base domain |
|
|
168
|
+
| `--email <email>` | Deploy service account email |
|
|
169
|
+
| `--quota-project <id>` | GCP project with Site Verification API enabled |
|
|
170
|
+
|
|
146
171
|
## `arcnet version`
|
|
147
172
|
|
|
148
173
|
Show the installed package version.
|
package/package.json
CHANGED
package/src/createCli.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { appendFileSync, readFileSync, realpathSync } from "node:fs";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ciOutputs } from "./ciOutputs.js";
|
|
6
|
+
import { grantDomainOwner } from "./environment/grantDomainOwner.js";
|
|
6
7
|
import { createSetupCommand } from "./createSetupCommand.js";
|
|
7
8
|
import { packageVersion } from "./packageInfo.js";
|
|
8
9
|
import { renderResult } from "./renderResult.js";
|
|
@@ -35,6 +36,18 @@ export const createCli = () => {
|
|
|
35
36
|
|
|
36
37
|
createSecretsCommands(cli, output);
|
|
37
38
|
|
|
39
|
+
cli
|
|
40
|
+
.command("environment")
|
|
41
|
+
.description("Manage ArcNet environment prerequisites.")
|
|
42
|
+
.command("domain-owner")
|
|
43
|
+
.description("Grant a deploy identity ownership of an already verified base domain.")
|
|
44
|
+
.requiredOption("--domain <domain>", "Verified base domain")
|
|
45
|
+
.requiredOption("--email <email>", "Deploy service account email")
|
|
46
|
+
.requiredOption("--quota-project <id>", "GCP project with Site Verification API enabled")
|
|
47
|
+
.action(async (options: { domain: string; email: string; quotaProject: string }) => {
|
|
48
|
+
output(await grantDomainOwner(options.domain, options.email, options.quotaProject));
|
|
49
|
+
});
|
|
50
|
+
|
|
38
51
|
cli
|
|
39
52
|
.command("version")
|
|
40
53
|
.description("Show the installed package version.")
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
type WebResource = {
|
|
4
|
+
id: string;
|
|
5
|
+
site: { type: string; identifier: string };
|
|
6
|
+
owners: string[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const grantDomainOwner = async (
|
|
10
|
+
domain: string,
|
|
11
|
+
email: string,
|
|
12
|
+
quotaProject: string,
|
|
13
|
+
dependencies: {
|
|
14
|
+
getToken?: () => string;
|
|
15
|
+
request?: typeof fetch;
|
|
16
|
+
} = {},
|
|
17
|
+
) => {
|
|
18
|
+
if (!/^(?:[a-z0-9-]+\.)+[a-z]{2,}$/i.test(domain))
|
|
19
|
+
throw new Error("Provide a base domain such as example.com.");
|
|
20
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))
|
|
21
|
+
throw new Error("Provide a service account email address.");
|
|
22
|
+
if (!/^[a-z][a-z0-9-]{4,61}[a-z0-9]$/.test(quotaProject))
|
|
23
|
+
throw new Error("Provide a valid Google quota project ID.");
|
|
24
|
+
|
|
25
|
+
const token = (
|
|
26
|
+
dependencies.getToken?.() ??
|
|
27
|
+
execFileSync(
|
|
28
|
+
"gcloud",
|
|
29
|
+
["auth", "application-default", "print-access-token"],
|
|
30
|
+
{ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] },
|
|
31
|
+
)
|
|
32
|
+
).trim();
|
|
33
|
+
const request = dependencies.request ?? fetch;
|
|
34
|
+
const base = "https://www.googleapis.com/siteVerification/v1/webResource";
|
|
35
|
+
const headers = {
|
|
36
|
+
Authorization: `Bearer ${token}`,
|
|
37
|
+
"x-goog-user-project": quotaProject,
|
|
38
|
+
};
|
|
39
|
+
const list = await request(base, { headers });
|
|
40
|
+
if (!list.ok) {
|
|
41
|
+
if (list.status === 403)
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Google Site Verification denied access. Check the signed-in owner's siteverification scope, Service Usage Consumer permission, and that siteverification.googleapis.com is enabled on ${quotaProject}.`,
|
|
44
|
+
);
|
|
45
|
+
throw new Error(`Google Site Verification list failed (${list.status}).`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { items = [] } = (await list.json()) as { items?: WebResource[] };
|
|
49
|
+
const resource = items.find(
|
|
50
|
+
({ site }) =>
|
|
51
|
+
site.type === "INET_DOMAIN" &&
|
|
52
|
+
site.identifier.toLowerCase() === domain.toLowerCase(),
|
|
53
|
+
);
|
|
54
|
+
if (!resource)
|
|
55
|
+
throw new Error(
|
|
56
|
+
`${domain} is not verified for the signed-in Google identity. Verify the base domain with a DNS TXT record first.`,
|
|
57
|
+
);
|
|
58
|
+
if (resource.owners.some((owner) => owner.toLowerCase() === email.toLowerCase()))
|
|
59
|
+
return { domain, email, changed: false };
|
|
60
|
+
|
|
61
|
+
const update = await request(`${base}/${encodeURIComponent(resource.id)}`, {
|
|
62
|
+
method: "PUT",
|
|
63
|
+
headers: { ...headers, "Content-Type": "application/json" },
|
|
64
|
+
body: JSON.stringify({ ...resource, owners: [...resource.owners, email] }),
|
|
65
|
+
});
|
|
66
|
+
if (!update.ok)
|
|
67
|
+
throw new Error(`Google Site Verification owner update failed (${update.status}).`);
|
|
68
|
+
const result = (await update.json()) as WebResource;
|
|
69
|
+
if (!result.owners.some((owner) => owner.toLowerCase() === email.toLowerCase()))
|
|
70
|
+
throw new Error("Google did not confirm the new domain owner.");
|
|
71
|
+
return { domain, email, changed: true };
|
|
72
|
+
};
|