frontpage-host 0.1.0 → 0.1.2

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/dist/registry.js CHANGED
@@ -3,43 +3,317 @@
3
3
  * Only shipped Phase 0–5 commands appear here.
4
4
  */
5
5
  export const COMMANDS = [
6
- { name: "help", summary: "Show available commands", usage: "frontpage help [command|topic]", topics: ["auth", "sync", "agent", "content", "history", "exit-codes"] },
7
- { name: "login", summary: "Save an API key to the OS keychain", usage: "frontpage login [api-key]", topics: ["auth"] },
8
- { name: "logout", summary: "Remove the saved API key", usage: "frontpage logout", topics: ["auth"] },
9
- { name: "whoami", summary: "Show the identity for the current API key", usage: "frontpage whoami", topics: ["auth"] },
10
- { name: "sites", summary: "List sites your key can access", usage: "frontpage sites", topics: ["auth"] },
11
- { name: "use", summary: "Set the default site subdomain for this folder", usage: "frontpage use <subdomain>", topics: ["auth", "sync"] },
12
- { name: "link", summary: "Alias for use", usage: "frontpage link <subdomain>", topics: ["auth", "sync"] },
13
- { name: "doctor", summary: "Check CLI auth and API connectivity", usage: "frontpage doctor", topics: ["auth"] },
14
- { name: "pull", summary: "Download allowlisted site files into this folder", usage: "frontpage pull [--site <slug>]", topics: ["sync"] },
15
- { name: "push", summary: "Upload local allowlisted files (CAS + active-run guard)", usage: "frontpage push [--site <slug>] [--message …]", topics: ["sync"] },
16
- { name: "diff", summary: "Compare local allowlisted files to the remote tip", usage: "frontpage diff [--site <slug>]", topics: ["sync"] },
17
- { name: "ls", summary: "List remote allowlisted files", usage: "frontpage ls [prefix] [--site <slug>]", topics: ["sync"] },
18
- { name: "cat", summary: "Print a remote file", usage: "frontpage cat <path> [--site <slug>]", topics: ["sync"] },
19
- { name: "search", summary: "Search remote text files", usage: "frontpage search <pattern> [path] [--site <slug>]", topics: ["sync"] },
20
- { name: "status", summary: "Show linked site and tip vs last pull", usage: "frontpage status [--site <slug>]", topics: ["sync"] },
21
- { name: "open", summary: "Open the site in a browser", usage: "frontpage open [--site <slug>]", topics: ["sync"] },
22
- { name: "prompt", summary: "Enqueue an agent build", usage: 'frontpage prompt "..." [--site <slug>] [--path /]', topics: ["agent"] },
23
- { name: "runs", summary: "List, wait, cancel, or retry agent runs", usage: "frontpage runs [current|wait|cancel|retry|get] …", topics: ["agent"] },
24
- { name: "publish", summary: "Promote staging to production", usage: "frontpage publish [--site <slug>]", topics: ["agent"] },
25
- { name: "unpublish", summary: "Take the live site offline (admin)", usage: "frontpage unpublish [--site <slug>]", topics: ["agent"] },
26
- { name: "deploy", summary: "Wait for active agent deploy to finish", usage: "frontpage deploy wait [--site <slug>]", topics: ["agent"] },
27
- { name: "usage", summary: "Show plan and AI/bandwidth usage", usage: "frontpage usage [--site <slug>]", topics: ["agent"] },
28
- { name: "analytics", summary: "Show analytics dashboard JSON", usage: "frontpage analytics [--days 7] [--site <slug>]", topics: ["agent"] },
29
- { name: "pages", summary: "List site pages", usage: "frontpage pages [--site <slug>]", topics: ["agent"] },
30
- { name: "modules", summary: "List or mutate modules (secret masks only)", usage: "frontpage modules [list|enable|disable|config] …", topics: ["agent", "content"] },
31
- { name: "extensions", summary: "List or mutate extensions (no secret values)", usage: "frontpage extensions [list|enable|disable|config] …", topics: ["agent", "content"] },
32
- { name: "media", summary: "List or upload site media assets", usage: "frontpage media list|upload <file>", topics: ["content"] },
33
- { name: "inbox", summary: "List leads / subscribers / orders", usage: "frontpage inbox [leads|…] [--mark-read] [--csv]", topics: ["content"] },
34
- { name: "seo", summary: "Get or set page SEO", usage: "frontpage seo get|set --path / …", topics: ["content"] },
35
- { name: "articles", summary: "Articles hub, content, and section ops", usage: "frontpage articles list|content|create-article|…", topics: ["content"] },
36
- { name: "settings", summary: "Get or set site settings (admin)", usage: "frontpage settings get|set …", topics: ["content"] },
37
- { name: "edit", summary: "Click-edit style exact text replace + deploy", usage: 'frontpage edit --path / --old "…" --new "…"', topics: ["content"] },
38
- { name: "history", summary: "List recent commits on the site branch", usage: "frontpage history [--limit N] [--page N]", topics: ["history", "agent"] },
39
- { name: "revert", summary: "Restore site to a prior commit (tree restore + deploy)", usage: "frontpage revert <40-char-sha>", topics: ["history"] },
40
- { name: "completion", summary: "Print shell completion script", usage: "frontpage completion bash|zsh|fish", topics: ["auth"] },
6
+ {
7
+ name: "help",
8
+ summary: "Show available commands",
9
+ usage: "frontpage help [command|topic] [--json]",
10
+ topics: ["auth", "sync", "agent", "content", "history", "isolation", "exit-codes", "quickstart"],
11
+ examples: ["frontpage help", "frontpage help sync", "frontpage help push", "frontpage help --json"],
12
+ },
13
+ {
14
+ name: "login",
15
+ summary: "Save an API key to the OS keychain",
16
+ usage: "frontpage login [api-key]",
17
+ topics: ["auth"],
18
+ examples: ['frontpage login', 'frontpage login "$FRONTPAGE_API_KEY"'],
19
+ flags: ["FRONTPAGE_API_KEY env overrides keychain after login for that process"],
20
+ seeAlso: ["whoami", "doctor", "logout"],
21
+ },
22
+ {
23
+ name: "logout",
24
+ summary: "Remove the saved API key",
25
+ usage: "frontpage logout",
26
+ topics: ["auth"],
27
+ },
28
+ {
29
+ name: "whoami",
30
+ summary: "Show the identity for the current API key",
31
+ usage: "frontpage whoami [--json]",
32
+ topics: ["auth"],
33
+ },
34
+ {
35
+ name: "sites",
36
+ summary: "List sites your key can access",
37
+ usage: "frontpage sites [--json]",
38
+ topics: ["auth"],
39
+ examples: ["frontpage sites", "frontpage sites --json"],
40
+ seeAlso: ["use"],
41
+ },
42
+ {
43
+ name: "use",
44
+ summary: "Set the default site subdomain for this folder",
45
+ usage: "frontpage use <subdomain>",
46
+ topics: ["auth", "sync"],
47
+ examples: ["frontpage use arbiter"],
48
+ dangers: ["Clears baseCommitSha when switching sites — run pull again before push"],
49
+ seeAlso: ["link", "pull", "status"],
50
+ },
51
+ {
52
+ name: "link",
53
+ summary: "Alias for use",
54
+ usage: "frontpage link <subdomain>",
55
+ topics: ["auth", "sync"],
56
+ },
57
+ {
58
+ name: "doctor",
59
+ summary: "Check CLI auth and API connectivity",
60
+ usage: "frontpage doctor [--json]",
61
+ topics: ["auth"],
62
+ },
63
+ {
64
+ name: "pull",
65
+ summary: "Download allowlisted site files into this folder",
66
+ usage: "frontpage pull [--site <slug>] [--json]",
67
+ topics: ["sync"],
68
+ examples: ["frontpage pull", "frontpage pull --site arbiter --json"],
69
+ flags: ["--site <slug>"],
70
+ seeAlso: ["push", "status", "diff"],
71
+ },
72
+ {
73
+ name: "push",
74
+ summary: "Upload local allowlisted files (CAS + active-run guard)",
75
+ usage: "frontpage push [--site <slug>] [--message …] [--json]",
76
+ topics: ["sync"],
77
+ examples: ['frontpage push --message "Update hero copy"'],
78
+ flags: ["--site <slug>", "--message <text>"],
79
+ dangers: [
80
+ "Requires prior pull (baseCommitSha)",
81
+ "Refused while an agent run is active (exit 3)",
82
+ "CAS fail if remote tip moved (exit 3) — pull and retry",
83
+ "May auto-activate modules when markup references them",
84
+ ],
85
+ seeAlso: ["pull", "diff", "status", "deploy"],
86
+ },
87
+ {
88
+ name: "diff",
89
+ summary: "Compare local allowlisted files to the remote tip",
90
+ usage: "frontpage diff [--site <slug>] [--json]",
91
+ topics: ["sync"],
92
+ examples: ["frontpage diff --json"],
93
+ flags: ["--site <slug>", "JSON data.dirty is true when differences exist"],
94
+ },
95
+ {
96
+ name: "ls",
97
+ summary: "List remote allowlisted files",
98
+ usage: "frontpage ls [prefix] [--site <slug>] [--json]",
99
+ topics: ["sync"],
100
+ },
101
+ {
102
+ name: "cat",
103
+ summary: "Print a remote file",
104
+ usage: "frontpage cat <path> [--site <slug>]",
105
+ topics: ["sync"],
106
+ },
107
+ {
108
+ name: "search",
109
+ summary: "Search remote text files",
110
+ usage: "frontpage search <pattern> [path] [--site <slug>]",
111
+ topics: ["sync"],
112
+ },
113
+ {
114
+ name: "status",
115
+ summary: "Show linked site and tip vs last pull",
116
+ usage: "frontpage status [--site <slug>] [--json]",
117
+ topics: ["sync"],
118
+ },
119
+ {
120
+ name: "open",
121
+ summary: "Open the site subdomain in a browser",
122
+ usage: "frontpage open [--site <slug>] [--prod]",
123
+ topics: ["sync"],
124
+ flags: ["--prod is a no-op stub today — always opens https://<slug>.frontpage.host/"],
125
+ },
126
+ {
127
+ name: "prompt",
128
+ summary: "Enqueue an agent build",
129
+ usage: 'frontpage prompt "..." [--site <slug>] [--path /] [--json]',
130
+ topics: ["agent"],
131
+ examples: ['frontpage prompt "make the hero shorter"'],
132
+ flags: ["--path must start with /", "stdout is bare runId (or JSON with --json)"],
133
+ seeAlso: ["runs", "deploy"],
134
+ },
135
+ {
136
+ name: "runs",
137
+ summary: "List, wait, cancel, or retry agent runs",
138
+ usage: "frontpage runs [list|current|wait|cancel|retry|get] [runId] [--site <slug>] [--json]",
139
+ topics: ["agent"],
140
+ examples: [
141
+ "frontpage runs",
142
+ "frontpage runs wait",
143
+ "frontpage runs wait <runId>",
144
+ "frontpage runs cancel <runId>",
145
+ "frontpage runs retry <runId>",
146
+ "frontpage runs get <runId>",
147
+ ],
148
+ flags: ["There is no runs continue — mid-task continuation is automatic"],
149
+ seeAlso: ["prompt", "deploy"],
150
+ },
151
+ {
152
+ name: "publish",
153
+ summary: "Promote staging to production",
154
+ usage: "frontpage publish [--site <slug>] [--json]",
155
+ topics: ["agent"],
156
+ dangers: [
157
+ "Promotes the current staging tip to PRODUCTION (custom domain)",
158
+ "Agents: never run unless the user explicitly asked to publish",
159
+ ],
160
+ seeAlso: ["unpublish", "deploy"],
161
+ },
162
+ {
163
+ name: "unpublish",
164
+ summary: "Take the live site offline (admin)",
165
+ usage: "frontpage unpublish [--site <slug>] [--yes] [--json]",
166
+ topics: ["agent"],
167
+ dangers: [
168
+ "Takes production offline",
169
+ "Requires --yes when stdin is not a TTY",
170
+ "Agents: never run unless the user explicitly asked",
171
+ ],
172
+ },
173
+ {
174
+ name: "deploy",
175
+ summary: "Wait for an in-flight build to finish (not publish)",
176
+ usage: "frontpage deploy wait [--site <slug>] [--json]",
177
+ topics: ["agent"],
178
+ flags: [
179
+ "Optional build wait only — staging is https://<subdomain>.frontpage.host",
180
+ "Does NOT promote to production; use publish only when the user asks",
181
+ ],
182
+ },
183
+ {
184
+ name: "usage",
185
+ summary: "Show plan and AI/bandwidth usage",
186
+ usage: "frontpage usage [--site <slug>]",
187
+ topics: ["agent"],
188
+ },
189
+ {
190
+ name: "analytics",
191
+ summary: "Show analytics dashboard JSON",
192
+ usage: "frontpage analytics [--days 7] [--site <slug>]",
193
+ topics: ["agent"],
194
+ },
195
+ {
196
+ name: "pages",
197
+ summary: "List site pages",
198
+ usage: "frontpage pages [--site <slug>] [--json]",
199
+ topics: ["agent"],
200
+ },
201
+ {
202
+ name: "modules",
203
+ summary: "List or mutate modules (secret masks only)",
204
+ usage: "frontpage modules [list|enable|disable|archive|config] <key> [--instance <id>] [--config '{…}'] [--site <slug>]",
205
+ topics: ["agent", "content"],
206
+ dangers: ["Secret values are never returned — masks only"],
207
+ },
208
+ {
209
+ name: "extensions",
210
+ summary: "List or mutate extensions (no secret values)",
211
+ usage: "frontpage extensions [list|enable|disable|config] <key> [--config '{…}'] [--site <slug>]",
212
+ topics: ["agent", "content"],
213
+ },
214
+ {
215
+ name: "media",
216
+ summary: "List or upload site media assets",
217
+ usage: "frontpage media list|upload <file> [--site <slug>]",
218
+ topics: ["content"],
219
+ },
220
+ {
221
+ name: "inbox",
222
+ summary: "List leads / subscribers / orders",
223
+ usage: "frontpage inbox [leads|subscribers|orders|…] [--mark-read] [--csv] [--site <slug>]",
224
+ topics: ["content"],
225
+ dangers: ["--mark-read is side-effecting with no confirm"],
226
+ },
227
+ {
228
+ name: "seo",
229
+ summary: "Get or set page SEO",
230
+ usage: "frontpage seo get|set --path / [--title …] [--description …] [--site <slug>]",
231
+ topics: ["content"],
232
+ },
233
+ {
234
+ name: "articles",
235
+ summary: "Articles hub, content, and section ops",
236
+ usage: "frontpage articles list|content|create-section|config-section|archive-section|restore-section|create-article|delete-article|set-draft|set-image|set-tags|set-seo|set-meta … [--site <slug>]",
237
+ topics: ["content"],
238
+ examples: [
239
+ "frontpage articles list",
240
+ "frontpage articles content get --section blog --article my-post",
241
+ "frontpage articles content set --section blog --article my-post --body '…' --base <sha>",
242
+ ],
243
+ },
244
+ {
245
+ name: "settings",
246
+ summary: "Get or set site settings (admin)",
247
+ usage: "frontpage settings get|set [--subdomain-public true|false] [--usage-alerts true|false] [--build-model …] [--brand-name …] [--brand-logo …] [--brand-reset] [--site <slug>]",
248
+ topics: ["content"],
249
+ },
250
+ {
251
+ name: "edit",
252
+ summary: "Click-edit style exact text replace + deploy",
253
+ usage: 'frontpage edit --path / --old "…" --new "…" [--site <slug>]',
254
+ topics: ["content"],
255
+ dangers: [
256
+ "Exact single-occurrence replace (fails if 0 or 2+ matches)",
257
+ "Deploys via click-edit path — not the same as push / gated-write",
258
+ ],
259
+ },
260
+ {
261
+ name: "history",
262
+ summary: "List recent commits on the site branch",
263
+ usage: "frontpage history [--limit N] [--page N] [--site <slug>] [--json]",
264
+ topics: ["history", "agent"],
265
+ flags: ["S = staging tip, P = production tip"],
266
+ },
267
+ {
268
+ name: "revert",
269
+ summary: "Restore site to a prior commit (tree restore + deploy)",
270
+ usage: "frontpage revert <40-char-sha> [--site <slug>] [--yes] [--json]",
271
+ topics: ["history"],
272
+ dangers: [
273
+ "Creates a NEW commit whose tree matches the target",
274
+ "Requires full 40-char SHA",
275
+ "Requires --yes when stdin is not a TTY",
276
+ "Refused while an agent run is active",
277
+ ],
278
+ seeAlso: ["history"],
279
+ },
280
+ {
281
+ name: "completion",
282
+ summary: "Print shell completion script",
283
+ usage: "frontpage completion bash|zsh|fish",
284
+ topics: ["auth"],
285
+ },
286
+ ];
287
+ export const TOPIC_NAMES = [
288
+ "quickstart",
289
+ "auth",
290
+ "sync",
291
+ "agent",
292
+ "content",
293
+ "history",
294
+ "isolation",
295
+ "exit-codes",
41
296
  ];
42
297
  export const TOPICS = {
298
+ quickstart: `Quickstart
299
+ npm i -g frontpage-host # package name ≠ binary name
300
+ # Binary is: frontpage
301
+ # Do NOT install the unrelated npm package named "frontpage"
302
+
303
+ 1. Create a key: Frontpage editor → profile → Developers (fp_live_…)
304
+ 2. frontpage login # or: frontpage login "$FRONTPAGE_API_KEY"
305
+ 3. frontpage sites # use the subdomain column
306
+ 4. mkdir work && cd work && frontpage use <subdomain>
307
+ 5. frontpage pull
308
+ 6. Edit files under src/, public/, or content/
309
+ 7. frontpage push --message "…"
310
+ 8. Review https://<subdomain>.frontpage.host (staging)
311
+ 9. frontpage publish # ONLY if the user asked — promotes to production
312
+
313
+ Staging is the subdomain. There is no separate staging-deploy step for agents.
314
+ Never publish/unpublish unless the user explicitly asks.
315
+ Agents: read AGENTS.md in the npm package; use --json for structured I/O.
316
+ More: frontpage help auth | sync | agent | content | history | isolation | exit-codes`,
43
317
  auth: `Authentication
44
318
  1. Create a key in the Frontpage editor: profile menu → Developers
45
319
  2. frontpage login
@@ -47,33 +321,41 @@ export const TOPICS = {
47
321
  4. frontpage use <subdomain> (e.g. asimov-press, not a custom domain)
48
322
 
49
323
  Keys act as you on every site you can access. Treat them like passwords.
50
- Override with FRONTPAGE_API_KEY in CI.`,
324
+ Override with FRONTPAGE_API_KEY in CI.
325
+ FRONTPAGE_API_BASE defaults to https://app.frontpage.host
326
+ PUBLIC_CLI_ENABLED is server-side — the CLI cannot enable it.`,
51
327
  sync: `File sync
52
328
  frontpage use <subdomain>
53
329
  frontpage pull # downloads src/, public/, content/ into cwd
54
- frontpage diff # local vs remote tip
330
+ frontpage diff # local vs remote tip (--json → data.dirty)
55
331
  frontpage push [--message …] # uploads allowlisted files; CAS + active-run guard
56
332
  frontpage ls [prefix]
57
333
  frontpage cat <path>
58
334
  frontpage search <pattern>
59
335
  frontpage status
60
- frontpage open
336
+ frontpage open # opens https://<slug>.frontpage.host/ (--prod is a no-op stub)
61
337
 
62
338
  Local state: .frontpage/state.json { slug, baseCommitSha }
63
339
  Pull first so push can compare-and-swap on baseCommitSha.
64
340
  Do not push while the editor agent is building (status / runs show active work).
65
341
  Pushing module markup may auto-activate modules (same as the agent).
66
342
  tokens.ts may be auto-repaired at commit if it would break the build.
67
- Binaries use base64 (not utf8-corrupted).`,
343
+ Binaries use base64 (not utf8-corrupted).
344
+
345
+ Staging vs production:
346
+ - Push/prompt/edit update STAGING: https://<subdomain>.frontpage.host
347
+ - No separate "deploy to staging" step for agents — review the subdomain after the build.
348
+ - frontpage deploy wait only waits for an in-flight build; it is NOT go-live.
349
+ - frontpage publish promotes staging → production (custom domain). Never publish unless asked.`,
68
350
  agent: `Agent + publish
69
351
  frontpage prompt "make the hero shorter"
70
352
  frontpage runs # latest + active
71
353
  frontpage runs wait [runId]
72
354
  frontpage runs cancel <runId>
73
355
  frontpage runs retry <runId>
74
- frontpage deploy wait
75
- frontpage publish
76
- frontpage unpublish # admin only
356
+ frontpage deploy wait # optional: wait for build; NOT publish
357
+ frontpage publish # ONLY if the user asked — production promote
358
+ frontpage unpublish --yes # admin only; never unless asked; --yes when non-TTY
77
359
  frontpage usage
78
360
  frontpage analytics [--days 7]
79
361
  frontpage pages
@@ -81,13 +363,14 @@ export const TOPICS = {
81
363
  frontpage extensions
82
364
 
83
365
  Mid-task continuation is automatic — there is no runs continue.
84
- Do not push while an agent run is active.`,
366
+ Do not push while an agent run is active.
367
+ Default after work: review https://<subdomain>.frontpage.host; do not publish.`,
85
368
  content: `Content
86
369
  frontpage media list|upload <file>
87
- frontpage inbox [leads|subscribers|…] [--mark-read] [--csv]
370
+ frontpage inbox [leads|subscribers|orders|…] [--mark-read] [--csv]
88
371
  frontpage seo get|set --path /
89
372
  frontpage articles list|content|create-section|create-article|set-draft|…
90
- frontpage modules enable|disable|config <key>
373
+ frontpage modules enable|disable|archive|config <key>
91
374
  frontpage extensions enable|disable|config <key>
92
375
  frontpage settings get|set
93
376
  frontpage edit --path / --old "…" --new "…"
@@ -97,19 +380,34 @@ export const TOPICS = {
97
380
  Domains, billing, members, and site delete are out of v1.`,
98
381
  history: `History
99
382
  frontpage history [--limit 20] [--page 1]
100
- frontpage revert <40-char-sha>
383
+ frontpage revert <40-char-sha> --yes
101
384
 
102
385
  history lists commits on site/<slug> (plan Time Machine window).
103
386
  S = staging tip, P = production tip.
104
387
  revert creates a NEW commit whose tree matches the target (linear restore).
105
388
  Target SHA must be on this site's history (not another site in the monorepo).
106
- Refused while an agent run is active. Goes through commitSiteBranch (build gate).`,
389
+ Refused while an agent run is active. Goes through commitSiteBranch (build gate).
390
+ --yes required when stdin is not a TTY.`,
391
+ isolation: `Isolation
392
+ Every site-scoped call targets subdomain → branch site/<slug> only.
393
+ No client-supplied branch, ref, repo, or clone URL is accepted.
394
+ Non-members get 404 (no site enumeration); under-privileged roles get 403.
395
+ Exit 4 on those 404s can mean "no access / not found", not only a bad key.
396
+ API keys never grant platform-admin fleet override.
397
+ Keys are account-wide: sharing a key shares that user's power on every site they can access.
398
+ Path allowlist only; GitHub tokens and remotes are never returned.
399
+ See also: frontpage help auth | sync`,
107
400
  "exit-codes": `Exit codes
108
401
  0 success
109
402
  2 usage / budget / rate-limit / unavailable
110
403
  3 conflict (CAS / active run / unreachable domain / cancel-while-deploying)
111
- 4 authentication or authorization failure
112
- 5 unexpected server or network error`,
404
+ 4 authentication or authorization failure (also many 404s — no access / not found)
405
+ 5 unexpected server or network error (including API disabled / PUBLIC_CLI_ENABLED)
406
+
407
+ Global --json envelope:
408
+ { "ok": true, "command": "…", "data": {…} }
409
+ { "ok": false, "command": "…", "error": { "message", "code?", "httpStatus?", "exitCode" } }
410
+ Failures with --json still use the process exit code; envelope is on stdout.`,
113
411
  };
114
412
  export function findCommand(name) {
115
413
  return COMMANDS.find((c) => c.name === name);
@@ -0,0 +1,22 @@
1
+ export declare function setRuntimeFlags(flags: {
2
+ json?: boolean;
3
+ quiet?: boolean;
4
+ yes?: boolean;
5
+ }): void;
6
+ export declare function isJson(): boolean;
7
+ export declare function isQuiet(): boolean;
8
+ /** True when --yes was passed, or stdin is a TTY (interactive confirm not required). */
9
+ export declare function allowDestructive(): boolean;
10
+ export declare function requireYesOrTty(action: string): string | null;
11
+ export type JsonErrorBody = {
12
+ message: string;
13
+ code?: string;
14
+ httpStatus?: number;
15
+ exitCode: number;
16
+ };
17
+ export declare function emitOk(command: string, data: unknown): void;
18
+ export declare function emitErr(command: string, err: unknown): number;
19
+ export declare function emitUsage(command: string, message: string, exitCode?: number): number;
20
+ /** Progress / spinner lines — suppressed when --quiet or --json. */
21
+ export declare function progress(text: string): void;
22
+ export declare function unexpectedExit(): number;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Process-global CLI runtime flags (set once from argv in bin.ts).
3
+ */
4
+ import { CliHttpError, EXIT_UNEXPECTED, exitCodeForError } from "./http/client.js";
5
+ let jsonMode = false;
6
+ let quietMode = false;
7
+ let yesMode = false;
8
+ export function setRuntimeFlags(flags) {
9
+ if (flags.json !== undefined)
10
+ jsonMode = flags.json;
11
+ if (flags.quiet !== undefined)
12
+ quietMode = flags.quiet;
13
+ if (flags.yes !== undefined)
14
+ yesMode = flags.yes;
15
+ }
16
+ export function isJson() {
17
+ return jsonMode;
18
+ }
19
+ export function isQuiet() {
20
+ return quietMode;
21
+ }
22
+ /** True when --yes was passed, or stdin is a TTY (interactive confirm not required). */
23
+ export function allowDestructive() {
24
+ return yesMode || Boolean(process.stdin.isTTY);
25
+ }
26
+ export function requireYesOrTty(action) {
27
+ if (allowDestructive())
28
+ return null;
29
+ return `Refusing ${action} without --yes (non-interactive). Re-run with --yes if intentional.`;
30
+ }
31
+ export function emitOk(command, data) {
32
+ console.log(JSON.stringify({ ok: true, command, data }));
33
+ }
34
+ export function emitErr(command, err) {
35
+ const exitCode = exitCodeForError(err);
36
+ const message = err instanceof Error ? err.message : String(err);
37
+ const body = { message, exitCode };
38
+ if (err instanceof CliHttpError) {
39
+ if (err.code)
40
+ body.code = err.code;
41
+ if (err.status)
42
+ body.httpStatus = err.status;
43
+ }
44
+ if (jsonMode) {
45
+ console.log(JSON.stringify({ ok: false, command, error: body }));
46
+ }
47
+ else {
48
+ console.error(message);
49
+ }
50
+ return exitCode;
51
+ }
52
+ export function emitUsage(command, message, exitCode = 2) {
53
+ if (jsonMode) {
54
+ console.log(JSON.stringify({
55
+ ok: false,
56
+ command,
57
+ error: { message, exitCode },
58
+ }));
59
+ }
60
+ else {
61
+ console.error(message);
62
+ }
63
+ return exitCode;
64
+ }
65
+ /** Progress / spinner lines — suppressed when --quiet or --json. */
66
+ export function progress(text) {
67
+ if (quietMode || jsonMode)
68
+ return;
69
+ process.stderr.write(text);
70
+ }
71
+ export function unexpectedExit() {
72
+ return EXIT_UNEXPECTED;
73
+ }
package/llms.txt ADDED
@@ -0,0 +1,14 @@
1
+ # Frontpage CLI (frontpage-host)
2
+
3
+ - Package: frontpage-host (npm). Binary: frontpage. Do NOT install npm package "frontpage".
4
+ - Docs in this package: README.md, AGENTS.md (agent operating manual).
5
+ - Introspect: frontpage help | frontpage help --json | frontpage help <topic|command>
6
+ - Topics: quickstart, auth, sync, agent, content, history, isolation, exit-codes
7
+ - Auth: mint fp_live_ key in Frontpage UI (Developers); frontpage login KEY or FRONTPAGE_API_KEY
8
+ - Site id: subdomain only (frontpage use <subdomain>). Not custom domains.
9
+ - Staging: https://<subdomain>.frontpage.host — push/prompt/edit update staging; no separate staging deploy step for agents
10
+ - Production: custom domain after frontpage publish — NEVER publish/unpublish unless the user explicitly asks
11
+ - Sync: allowlist src/ public/ content/; pull → edit → push (CAS); no push during active agent run; review on subdomain
12
+ - Machine: global --json / --quiet; exit 0/2/3/4/5 (see help exit-codes)
13
+ - deploy wait = optional build wait only; it is NOT go-live / publish
14
+ - No runs continue, domains, billing, members, MCP, or git remotes in v1
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "frontpage-host",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Frontpage CLI — manage your site from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "frontpage": "dist/bin.js"
8
8
  },
9
9
  "files": [
10
- "dist"
10
+ "dist",
11
+ "README.md",
12
+ "AGENTS.md",
13
+ "llms.txt"
11
14
  ],
12
15
  "scripts": {
13
16
  "build": "tsc -p tsconfig.json",