@spacefast/common 0.0.5 → 0.0.6

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.
Files changed (150) hide show
  1. package/dist/agents/connect-targets.d.ts +133 -0
  2. package/dist/agents/connect-targets.js +224 -0
  3. package/dist/brand.d.ts +1 -0
  4. package/dist/brand.js +5 -0
  5. package/dist/config/domains.d.ts +12 -6
  6. package/dist/config/domains.js +30 -38
  7. package/dist/contracts/access.d.ts +825 -125
  8. package/dist/contracts/access.js +771 -148
  9. package/dist/contracts/activity.d.ts +1 -1
  10. package/dist/contracts/activity.js +28 -2
  11. package/dist/contracts/annotations.d.ts +2 -4
  12. package/dist/contracts/api-keys.d.ts +3 -4
  13. package/dist/contracts/api-keys.js +9 -6
  14. package/dist/contracts/archives.d.ts +8 -2
  15. package/dist/contracts/archives.js +11 -4
  16. package/dist/contracts/billing.d.ts +0 -9
  17. package/dist/contracts/builds.d.ts +25 -21
  18. package/dist/contracts/builds.js +12 -0
  19. package/dist/contracts/common.d.ts +2 -0
  20. package/dist/contracts/common.js +4 -0
  21. package/dist/contracts/continuation.d.ts +0 -3
  22. package/dist/contracts/countries.d.ts +2 -0
  23. package/dist/contracts/countries.js +261 -0
  24. package/dist/contracts/deployments.d.ts +34 -34
  25. package/dist/contracts/device-auth.d.ts +4 -11
  26. package/dist/contracts/device-auth.js +4 -0
  27. package/dist/contracts/docs.d.ts +119 -0
  28. package/dist/contracts/docs.js +51 -0
  29. package/dist/contracts/domains.d.ts +96 -54
  30. package/dist/contracts/domains.js +26 -4
  31. package/dist/contracts/enums.d.ts +15 -16
  32. package/dist/contracts/enums.js +25 -14
  33. package/dist/contracts/error-code-meta.d.ts +72 -0
  34. package/dist/contracts/error-code-meta.js +96 -10
  35. package/dist/contracts/error-codes.d.ts +1 -1
  36. package/dist/contracts/error-codes.js +14 -0
  37. package/dist/contracts/events.d.ts +1 -1
  38. package/dist/contracts/features.d.ts +76 -6
  39. package/dist/contracts/features.js +178 -13
  40. package/dist/contracts/git.d.ts +2 -8
  41. package/dist/contracts/ids.d.ts +5 -0
  42. package/dist/contracts/ids.js +5 -0
  43. package/dist/contracts/mcp.d.ts +8 -10
  44. package/dist/contracts/me.js +1 -1
  45. package/dist/contracts/oauth-resources.d.ts +19 -8
  46. package/dist/contracts/oauth-resources.js +44 -13
  47. package/dist/contracts/platform.d.ts +0 -102
  48. package/dist/contracts/platform.js +0 -50
  49. package/dist/contracts/push-new.d.ts +4 -4
  50. package/dist/contracts/quotas.d.ts +2 -0
  51. package/dist/contracts/quotas.js +8 -0
  52. package/dist/contracts/repository-connections.d.ts +6 -8
  53. package/dist/contracts/resources.d.ts +97 -13
  54. package/dist/contracts/resources.js +26 -2
  55. package/dist/contracts/routes.d.ts +0 -2
  56. package/dist/contracts/runtime-api.d.ts +361 -39
  57. package/dist/contracts/runtime-api.js +275 -6
  58. package/dist/contracts/sites.d.ts +19 -2
  59. package/dist/contracts/sites.js +21 -0
  60. package/dist/contracts/space-config.d.ts +201 -2
  61. package/dist/contracts/space-config.js +135 -5
  62. package/dist/contracts/spaces.d.ts +364 -193
  63. package/dist/contracts/spaces.js +40 -8
  64. package/dist/contracts/superadmin-emails.d.ts +4 -2
  65. package/dist/contracts/superadmin-emails.js +8 -0
  66. package/dist/contracts/superadmin-queues.d.ts +26 -26
  67. package/dist/contracts/superadmin-spaces.d.ts +170 -42
  68. package/dist/contracts/superadmin.d.ts +6 -93
  69. package/dist/contracts/superadmin.js +6 -14
  70. package/dist/contracts/tags.d.ts +10 -9
  71. package/dist/contracts/tags.js +2 -1
  72. package/dist/contracts/teams.d.ts +21 -22
  73. package/dist/contracts/teams.js +0 -1
  74. package/dist/contracts/theme-json.d.ts +30 -0
  75. package/dist/contracts/theme-json.js +48 -0
  76. package/dist/contracts/variables.d.ts +0 -2
  77. package/dist/contracts/variables.js +0 -5
  78. package/dist/contracts/webhooks.d.ts +2 -0
  79. package/dist/contracts/webhooks.js +1 -1
  80. package/dist/contracts/zero.d.ts +5 -10
  81. package/dist/docs/agent-prose.d.ts +43 -3
  82. package/dist/docs/agent-prose.js +146 -7
  83. package/dist/docs/agent-setup.js +45 -13
  84. package/dist/docs/agent-solutions.d.ts +5 -5
  85. package/dist/docs/agent-solutions.js +2 -2
  86. package/dist/docs/catalog.d.ts +650 -0
  87. package/dist/docs/catalog.js +758 -0
  88. package/dist/docs/error-docs.d.ts +0 -2
  89. package/dist/docs/error-docs.js +77 -35
  90. package/dist/docs/index-build.d.ts +17 -0
  91. package/dist/docs/index-build.js +24 -0
  92. package/dist/docs/search.d.ts +54 -0
  93. package/dist/docs/search.js +96 -0
  94. package/dist/docs/skill-distribution.d.ts +5 -3
  95. package/dist/docs/skill-distribution.js +8 -8
  96. package/dist/utils/access-match.d.ts +39 -0
  97. package/dist/utils/access-match.js +296 -0
  98. package/dist/utils/auth-redirect.d.ts +3 -1
  99. package/dist/utils/auth-redirect.js +21 -1
  100. package/dist/utils/build-settings.d.ts +6 -0
  101. package/dist/utils/build-settings.js +429 -46
  102. package/dist/utils/claim-token.d.ts +8 -0
  103. package/dist/utils/claim-token.js +23 -2
  104. package/dist/utils/content-type.d.ts +1 -0
  105. package/dist/utils/content-type.js +1 -1
  106. package/dist/utils/credential-policy.d.ts +54 -0
  107. package/dist/utils/{access-policy.js → credential-policy.js} +28 -2
  108. package/dist/utils/gate-theme.d.ts +61 -0
  109. package/dist/utils/gate-theme.js +217 -0
  110. package/dist/utils/git-repository.d.ts +0 -1
  111. package/dist/utils/git-repository.js +0 -3
  112. package/dist/utils/id-hints.d.ts +8 -0
  113. package/dist/utils/id-hints.js +61 -0
  114. package/dist/utils/local-space-state.d.ts +91 -0
  115. package/dist/utils/local-space-state.js +251 -0
  116. package/dist/utils/oauth-signed-query.d.ts +8 -0
  117. package/dist/utils/oauth-signed-query.js +26 -0
  118. package/dist/utils/publish-detection.d.ts +0 -8
  119. package/dist/utils/publish-detection.js +0 -93
  120. package/dist/utils/publish-policy.d.ts +6 -5
  121. package/dist/utils/publish-policy.js +71 -7
  122. package/dist/utils/query-keys.d.ts +15 -4
  123. package/dist/utils/query-keys.js +27 -4
  124. package/dist/utils/runtime-paths.d.ts +0 -1
  125. package/dist/utils/runtime-paths.js +0 -1
  126. package/dist/utils/runtime-upload-batch.d.ts +18 -0
  127. package/dist/utils/runtime-upload-batch.js +90 -0
  128. package/dist/utils/runtime-upload.d.ts +2 -0
  129. package/dist/utils/runtime-upload.js +5 -0
  130. package/dist/utils/space-config.d.ts +4 -0
  131. package/dist/utils/space-config.js +10 -1
  132. package/dist/utils/space-theme.d.ts +2 -0
  133. package/dist/utils/space-theme.js +9 -0
  134. package/dist/utils/static-runtime-policy.d.ts +0 -21
  135. package/dist/utils/static-runtime-policy.js +19 -103
  136. package/dist/utils/upload-session.d.ts +1 -1
  137. package/dist/utils/wpcom-auth-redirects.d.ts +32 -2
  138. package/dist/utils/wpcom-auth-redirects.js +26 -10
  139. package/dist/vocabulary.d.ts +130 -30
  140. package/dist/vocabulary.js +77 -36
  141. package/package.json +16 -1
  142. package/dist/contracts/account.d.ts +0 -28
  143. package/dist/contracts/account.js +0 -54
  144. package/dist/contracts/intercom.d.ts +0 -6
  145. package/dist/contracts/intercom.js +0 -5
  146. package/dist/contracts/telemetry.d.ts +0 -2
  147. package/dist/contracts/telemetry.js +0 -1
  148. package/dist/utils/access-policy.d.ts +0 -39
  149. package/dist/utils/error-display.d.ts +0 -7
  150. package/dist/utils/error-display.js +0 -42
@@ -56,7 +56,7 @@ export declare const CONCEPTS: {
56
56
  readonly canonicalNoun: "version";
57
57
  readonly verb: "publish";
58
58
  readonly aliases: readonly [];
59
- readonly deprecated: readonly ["deployment"];
59
+ readonly externalTerms: readonly ["deployment"];
60
60
  readonly description: string;
61
61
  };
62
62
  readonly channel: {
@@ -133,7 +133,7 @@ export declare const EXTERNAL_TERM_ALLOWLIST: readonly [{
133
133
  readonly concept: "publish";
134
134
  readonly allowedContexts: readonly ["github-integration", "platform-api"];
135
135
  readonly replacement: "publish";
136
- readonly reason: "Push-deploys and the deploy status come from the GitHub integration.";
136
+ readonly reason: string;
137
137
  }, {
138
138
  readonly term: "site";
139
139
  readonly concept: "space";
@@ -148,6 +148,44 @@ export declare const EXTERNAL_TERM_ALLOWLIST: readonly [{
148
148
  readonly replacement: "infra";
149
149
  readonly reason: string;
150
150
  }];
151
+ /**
152
+ * AMENDMENT (DECIDED 2026-07-02): the deploy vocabulary stays, as documented,
153
+ * first-class ALIASES of the canonical vocabulary — `deploy` is an alias of
154
+ * `publish` (the verb) and `deployments` is an alias of `versions` (the noun).
155
+ * The canonical lifecycle nouns are unchanged: version / channel / build.
156
+ *
157
+ * This relaxes the earlier total noun ban to alias-with-disambiguation:
158
+ *
159
+ * - `sf deploy` / `sf deployments` stay listed and documented; every surface
160
+ * that presents them names the canonical command first and marks the
161
+ * deploy form as an alias.
162
+ * - Wherever the alias is introduced, attach DEPLOY_ALIAS_DISAMBIGUATION
163
+ * (the one sanctioned disambiguation sentence) so readers land on the
164
+ * canonical nouns.
165
+ * - A bare "deployment" noun in FRESH prose is still discouraged — write
166
+ * "version" (the thing) or "publish" (the act) unless deliberately using
167
+ * the alias, in which case disambiguate.
168
+ */
169
+ export interface DeployAlias {
170
+ /** The deploy-vocabulary word being sanctioned. */
171
+ readonly alias: string;
172
+ /** The canonical word it is an alias of. */
173
+ readonly canonical: string;
174
+ }
175
+ export declare const DEPLOY_ALIASES: readonly [{
176
+ readonly alias: "deploy";
177
+ readonly canonical: "publish";
178
+ }, {
179
+ readonly alias: "deployments";
180
+ readonly canonical: "versions";
181
+ }];
182
+ /**
183
+ * THE sanctioned disambiguation copy. Surfaces that present the deploy
184
+ * vocabulary (CLI --help, handbook/reference docs, generated skill docs) carry
185
+ * this sentence verbatim next to the alias, with the canonical command named
186
+ * first.
187
+ */
188
+ export declare const DEPLOY_ALIAS_DISAMBIGUATION: string;
151
189
  /** An internal provider name and how it must be referred to in public copy. */
152
190
  export interface ProviderHygieneRule {
153
191
  /** Internal/vendor name that must not appear on public surfaces. */
@@ -187,34 +225,11 @@ export declare const PROVIDER_HYGIENE: {
187
225
  readonly reason: "Internal git/CI dependency; never surfaced.";
188
226
  };
189
227
  };
190
- export type ProviderHygieneId = keyof typeof PROVIDER_HYGIENE;
191
228
  /**
192
- * Canonical MCP tool naming. Tools are exposed under a namespaced canonical id
193
- * (`spacefast_<verb>`) plus a bare alias (`<verb>`) for clients where per-server
194
- * namespacing is already guaranteed.
195
- *
196
- * This replaces the current inverted form (`execute_spacefast`,
197
- * `resume_spacefast`) and the un-namespaced verbs (`publish`, `prepare_publish`).
198
- */
199
- export declare const MCP_TOOL_NAMING: {
200
- /** Prefix that makes a tool id unambiguous across servers. */
201
- readonly namespacePrefix: "spacefast_";
202
- /** Canonical, namespaced tool id for a verb (e.g. "publish" → "spacefast_publish"). */
203
- readonly canonical: (verb: string) => string;
204
- /** Bare alias for a verb, valid only where per-server namespacing is guaranteed. */
205
- readonly alias: (verb: string) => string;
206
- /** Both names a verb should register under. */
207
- readonly names: (verb: string) => {
208
- readonly canonical: string;
209
- readonly alias: string;
210
- };
211
- };
212
- /**
213
- * Verbs that have a locked canonical MCP tool name. Generators should emit
214
- * `spacefast_<verb>` as the primary id and `<verb>` as the bare alias.
229
+ * Verbs that have a locked canonical MCP tool name. Generators emit the bare
230
+ * `<verb>` as the one and only tool id.
215
231
  */
216
- export declare const MCP_CANONICAL_VERBS: readonly ["publish", "execute", "prepare_publish", "resume_publish", "finalize_publish"];
217
- export type McpCanonicalVerb = (typeof MCP_CANONICAL_VERBS)[number];
232
+ export declare const MCP_CANONICAL_VERBS: readonly ["publish", "execute", "search", "resume", "prepare_publish", "resume_publish", "finalize_publish"];
218
233
  /**
219
234
  * Canonical CLI verb → accepted aliases. Reused across command groups so every
220
235
  * `list`/`remove`/`create` command exposes the same shorthands. A command file
@@ -226,5 +241,90 @@ export declare const CLI_ALIASES: {
226
241
  readonly create: readonly ["add"];
227
242
  };
228
243
  export type CliCanonicalVerb = keyof typeof CLI_ALIASES;
229
- /** Aliases registered for a canonical CLI verb (empty for unknown verbs). */
230
- export declare function cliAliasesFor(verb: CliCanonicalVerb): readonly string[];
244
+ /**
245
+ * Disclosure tiers gate how much of a surface (CLI help, `sf docs`) shows by
246
+ * default, so neither humans nor agents are overwhelmed:
247
+ *
248
+ * - `essential` — the handful of commands/docs a new user or agent needs to
249
+ * make a first publish and manage a space. The default everywhere.
250
+ * - `full` — the complete product CLI surface (everything not hidden).
251
+ * - `reference` — absolutely everything, including hidden/advanced commands.
252
+ *
253
+ * Tiers are cumulative for ranked surfaces (`reference` ⊇ `full` ⊇ `essential`);
254
+ * see {@link tierVisibleAt}. This is THE source of truth for tier ids + labels.
255
+ */
256
+ export type CliDisclosureTier = "essential" | "full" | "reference";
257
+ /** Display metadata for one disclosure tier. */
258
+ export interface CliDisclosureTierMeta {
259
+ readonly id: CliDisclosureTier;
260
+ /** Human label for headers (`Essential commands`, etc.). */
261
+ readonly label: string;
262
+ /** One-line description of what the tier reveals. */
263
+ readonly description: string;
264
+ /** Flag that opts into this tier (absent for the default `essential`). */
265
+ readonly flag?: string;
266
+ }
267
+ export declare const CLI_DISCLOSURE_TIERS: {
268
+ readonly essential: {
269
+ readonly id: "essential";
270
+ readonly label: "Essential";
271
+ readonly description: "The handful of commands a new user or agent needs to publish and manage a space.";
272
+ };
273
+ readonly full: {
274
+ readonly id: "full";
275
+ readonly label: "Full";
276
+ readonly description: "Every command in the product CLI.";
277
+ readonly flag: "--full";
278
+ };
279
+ readonly reference: {
280
+ readonly id: "reference";
281
+ readonly label: "Reference";
282
+ readonly description: "Everything, including hidden and advanced commands.";
283
+ readonly flag: "--all";
284
+ };
285
+ };
286
+ /** Tiers ordered narrowest-first; index doubles as the cumulative rank. */
287
+ export declare const CLI_DISCLOSURE_TIER_ORDER: readonly ["essential", "full", "reference"];
288
+ /**
289
+ * Does a surface tagged `surfaceTier` show when viewing at `viewTier`? Ranked
290
+ * surfaces are cumulative: an `essential` doc shows at every tier, a `full` doc
291
+ * shows at `full`/`reference`, a `reference` doc only at `reference`.
292
+ */
293
+ export declare function tierVisibleAt(viewTier: CliDisclosureTier, surfaceTier: CliDisclosureTier): boolean;
294
+ /** One essential CLI verb and the registered command id it resolves to. */
295
+ export interface CliEssentialCommand {
296
+ /** The verb a new user reaches for. */
297
+ readonly verb: string;
298
+ /** The registered CLI command id (some live under a topic, e.g. `spaces:claim`). */
299
+ readonly commandId: string;
300
+ }
301
+ /**
302
+ * The first-publish path: the essential verbs `sf help` (and `sf docs`) surface
303
+ * by default. Everything else is FULL (shown with `--full`) or REFERENCE
304
+ * (hidden/advanced, shown with `--all`). Ordered for display.
305
+ */
306
+ export declare const CLI_ESSENTIAL_COMMANDS: readonly [{
307
+ readonly verb: "publish";
308
+ readonly commandId: "publish";
309
+ }, {
310
+ readonly verb: "status";
311
+ readonly commandId: "status";
312
+ }, {
313
+ readonly verb: "versions";
314
+ readonly commandId: "versions";
315
+ }, {
316
+ readonly verb: "rollback";
317
+ readonly commandId: "rollback";
318
+ }, {
319
+ readonly verb: "claim";
320
+ readonly commandId: "spaces:claim";
321
+ }, {
322
+ readonly verb: "login";
323
+ readonly commandId: "login";
324
+ }, {
325
+ readonly verb: "init";
326
+ readonly commandId: "init";
327
+ }, {
328
+ readonly verb: "docs";
329
+ readonly commandId: "docs";
330
+ }];
@@ -11,10 +11,12 @@
11
11
  // - `space` is the primitive noun on every user surface. `site` survives only
12
12
  // as the platform-API term for the shared-pool host a space is placed on
13
13
  // (see contracts/sites.ts, internal-docs/platform.md "Site").
14
- // - `publish` is the verb. "deployment" is NOT a product noun — it means
15
- // "publishing a version" and is retired from user-facing surfaces (drop the
16
- // `dep_*` framing). It stays only inside the GitHub integration and the
17
- // platform API (see EXTERNAL_TERM_ALLOWLIST).
14
+ // - `publish` is the verb. AMENDED 2026-07-02: `deploy` / `deployments` are
15
+ // first-class ALIASES of `publish` / `versions` (see DEPLOY_ALIASES) they
16
+ // stay listed and documented, always with the sanctioned disambiguation
17
+ // line (DEPLOY_ALIAS_DISAMBIGUATION) and with the canonical command named
18
+ // first. A bare "deployment" noun in fresh prose is still discouraged (say
19
+ // "version"), and the `dep_*` id framing stays retired.
18
20
  // - `version` / `channel` / `build` are the lifecycle nouns.
19
21
  // - `API key` — never "access token".
20
22
  // - `Collab` is the feature; `comment` is the unit.
@@ -40,17 +42,19 @@ export const CONCEPTS = {
40
42
  aliases: ["go live"],
41
43
  externalTerms: ["deployment", "deploy"],
42
44
  deprecated: ["dep_", "dep_build_", "dep_version_"],
43
- description: "The verb for making a version live. 'Deployment' is not a product noun " +
44
- "(it just means publishing a version); allowed only in GitHub + platform API.",
45
+ description: "The verb for making a version live. 'Deploy' is a sanctioned first-class " +
46
+ "alias of publish (see DEPLOY_ALIASES); introduce it with the " +
47
+ "disambiguation line, and keep fresh prose on 'publish'.",
45
48
  },
46
49
  version: {
47
50
  id: "version",
48
51
  canonicalNoun: "version",
49
52
  verb: "publish",
50
53
  aliases: [],
51
- deprecated: ["deployment"],
54
+ externalTerms: ["deployment"],
52
55
  description: "An immutable snapshot of a space's content. Publishing promotes a version " +
53
- "to a channel; the thing once mislabeled a 'deployment' is a version.",
56
+ "to a channel; a 'deployment' is a sanctioned alias for a version (see " +
57
+ "DEPLOY_ALIASES), though fresh prose still says 'version'.",
54
58
  },
55
59
  channel: {
56
60
  id: "channel",
@@ -109,14 +113,18 @@ export const EXTERNAL_TERM_ALLOWLIST = [
109
113
  allowedContexts: ["github-integration", "platform-api"],
110
114
  replacement: "version / publish",
111
115
  reason: "GitHub speaks 'deployment'; the platform API keeps it for contract " +
112
- "stability. Everywhere else say 'publish a version'.",
116
+ "stability. Elsewhere it is a sanctioned alias of 'version' when paired " +
117
+ "with DEPLOY_ALIAS_DISAMBIGUATION (see DEPLOY_ALIASES); bare fresh prose " +
118
+ "still says 'publish a version'.",
113
119
  },
114
120
  {
115
121
  term: "deploy",
116
122
  concept: "publish",
117
123
  allowedContexts: ["github-integration", "platform-api"],
118
124
  replacement: "publish",
119
- reason: "Push-deploys and the deploy status come from the GitHub integration.",
125
+ reason: "Push-deploys and the deploy status come from the GitHub integration; " +
126
+ "'deploy' is also a sanctioned first-class alias of 'publish' when paired " +
127
+ "with DEPLOY_ALIAS_DISAMBIGUATION (see DEPLOY_ALIASES).",
120
128
  },
121
129
  {
122
130
  term: "site",
@@ -136,6 +144,18 @@ export const EXTERNAL_TERM_ALLOWLIST = [
136
144
  "the provider; general copy says 'infra'.",
137
145
  },
138
146
  ];
147
+ export const DEPLOY_ALIASES = [
148
+ { alias: "deploy", canonical: "publish" },
149
+ { alias: "deployments", canonical: "versions" },
150
+ ];
151
+ /**
152
+ * THE sanctioned disambiguation copy. Surfaces that present the deploy
153
+ * vocabulary (CLI --help, handbook/reference docs, generated skill docs) carry
154
+ * this sentence verbatim next to the alias, with the canonical command named
155
+ * first.
156
+ */
157
+ export const DEPLOY_ALIAS_DISAMBIGUATION = "Deploying is publishing: a deployment is a version, and the canonical " +
158
+ "nouns are version, channel, and build.";
139
159
  export const PROVIDER_HYGIENE = {
140
160
  e2b: {
141
161
  internalName: "E2B",
@@ -168,33 +188,14 @@ export const PROVIDER_HYGIENE = {
168
188
  /* MCP tool naming */
169
189
  /* -------------------------------------------------------------------------- */
170
190
  /**
171
- * Canonical MCP tool naming. Tools are exposed under a namespaced canonical id
172
- * (`spacefast_<verb>`) plus a bare alias (`<verb>`) for clients where per-server
173
- * namespacing is already guaranteed.
174
- *
175
- * This replaces the current inverted form (`execute_spacefast`,
176
- * `resume_spacefast`) and the un-namespaced verbs (`publish`, `prepare_publish`).
177
- */
178
- export const MCP_TOOL_NAMING = {
179
- /** Prefix that makes a tool id unambiguous across servers. */
180
- namespacePrefix: "spacefast_",
181
- /** Canonical, namespaced tool id for a verb (e.g. "publish" → "spacefast_publish"). */
182
- canonical: (verb) => `spacefast_${verb}`,
183
- /** Bare alias for a verb, valid only where per-server namespacing is guaranteed. */
184
- alias: (verb) => verb,
185
- /** Both names a verb should register under. */
186
- names: (verb) => ({
187
- canonical: `spacefast_${verb}`,
188
- alias: verb,
189
- }),
190
- };
191
- /**
192
- * Verbs that have a locked canonical MCP tool name. Generators should emit
193
- * `spacefast_<verb>` as the primary id and `<verb>` as the bare alias.
191
+ * Verbs that have a locked canonical MCP tool name. Generators emit the bare
192
+ * `<verb>` as the one and only tool id.
194
193
  */
195
194
  export const MCP_CANONICAL_VERBS = [
196
195
  "publish",
197
196
  "execute",
197
+ "search",
198
+ "resume",
198
199
  "prepare_publish",
199
200
  "resume_publish",
200
201
  "finalize_publish",
@@ -212,7 +213,47 @@ export const CLI_ALIASES = {
212
213
  remove: ["rm", "delete"],
213
214
  create: ["add"],
214
215
  };
215
- /** Aliases registered for a canonical CLI verb (empty for unknown verbs). */
216
- export function cliAliasesFor(verb) {
217
- return CLI_ALIASES[verb];
216
+ export const CLI_DISCLOSURE_TIERS = {
217
+ essential: {
218
+ id: "essential",
219
+ label: "Essential",
220
+ description: "The handful of commands a new user or agent needs to publish and manage a space.",
221
+ },
222
+ full: {
223
+ id: "full",
224
+ label: "Full",
225
+ description: "Every command in the product CLI.",
226
+ flag: "--full",
227
+ },
228
+ reference: {
229
+ id: "reference",
230
+ label: "Reference",
231
+ description: "Everything, including hidden and advanced commands.",
232
+ flag: "--all",
233
+ },
234
+ };
235
+ /** Tiers ordered narrowest-first; index doubles as the cumulative rank. */
236
+ export const CLI_DISCLOSURE_TIER_ORDER = ["essential", "full", "reference"];
237
+ /**
238
+ * Does a surface tagged `surfaceTier` show when viewing at `viewTier`? Ranked
239
+ * surfaces are cumulative: an `essential` doc shows at every tier, a `full` doc
240
+ * shows at `full`/`reference`, a `reference` doc only at `reference`.
241
+ */
242
+ export function tierVisibleAt(viewTier, surfaceTier) {
243
+ return (CLI_DISCLOSURE_TIER_ORDER.indexOf(surfaceTier) <= CLI_DISCLOSURE_TIER_ORDER.indexOf(viewTier));
218
244
  }
245
+ /**
246
+ * The first-publish path: the essential verbs `sf help` (and `sf docs`) surface
247
+ * by default. Everything else is FULL (shown with `--full`) or REFERENCE
248
+ * (hidden/advanced, shown with `--all`). Ordered for display.
249
+ */
250
+ export const CLI_ESSENTIAL_COMMANDS = [
251
+ { verb: "publish", commandId: "publish" },
252
+ { verb: "status", commandId: "status" },
253
+ { verb: "versions", commandId: "versions" },
254
+ { verb: "rollback", commandId: "rollback" },
255
+ { verb: "claim", commandId: "spaces:claim" },
256
+ { verb: "login", commandId: "login" },
257
+ { verb: "init", commandId: "init" },
258
+ { verb: "docs", commandId: "docs" },
259
+ ];
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@spacefast/common",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "description": "Shared TypeScript contracts and utilities for Spacefast packages.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/spacefast/monorepo.git",
9
+ "directory": "packages/common"
10
+ },
6
11
  "type": "module",
7
12
  "publishConfig": {
8
13
  "access": "public"
@@ -20,6 +25,11 @@
20
25
  "import": "./dist/brand.js",
21
26
  "default": "./dist/brand.js"
22
27
  },
28
+ "./vocabulary": {
29
+ "types": "./dist/vocabulary.d.ts",
30
+ "import": "./dist/vocabulary.js",
31
+ "default": "./dist/vocabulary.js"
32
+ },
23
33
  "./contracts/*": {
24
34
  "types": "./dist/contracts/*.d.ts",
25
35
  "import": "./dist/contracts/*.js",
@@ -35,6 +45,11 @@
35
45
  "import": "./dist/utils/*.js",
36
46
  "default": "./dist/utils/*.js"
37
47
  },
48
+ "./agents/*": {
49
+ "types": "./dist/agents/*.d.ts",
50
+ "import": "./dist/agents/*.js",
51
+ "default": "./dist/agents/*.js"
52
+ },
38
53
  "./domain-exploration": {
39
54
  "types": "./dist/domain-exploration.d.ts",
40
55
  "import": "./dist/domain-exploration.js",
@@ -1,28 +0,0 @@
1
- import { z } from "zod";
2
- export declare const accessTokenScope: z.ZodEnum<{
3
- "account:read": "account:read";
4
- "account:write": "account:write";
5
- "team:read": "team:read";
6
- "team:write": "team:write";
7
- "space:read": "space:read";
8
- "space:write": "space:write";
9
- "domain:read": "domain:read";
10
- "domain:write": "domain:write";
11
- }>;
12
- export type AccessTokenScope = z.infer<typeof accessTokenScope>;
13
- export declare const ACCESS_TOKEN_SCOPE_DEFINITIONS: {
14
- value: AccessTokenScope;
15
- label: string;
16
- description: string;
17
- }[];
18
- export declare const DEFAULT_ACCESS_TOKEN_SCOPES: AccessTokenScope[];
19
- export type AuthSession = {
20
- session: {
21
- id: string;
22
- };
23
- user: {
24
- id: string;
25
- email?: string | null | undefined;
26
- name?: string | null | undefined;
27
- };
28
- };
@@ -1,54 +0,0 @@
1
- import { z } from "zod";
2
- export const accessTokenScope = z.enum([
3
- "account:read",
4
- "account:write",
5
- "team:read",
6
- "team:write",
7
- "space:read",
8
- "space:write",
9
- "domain:read",
10
- "domain:write",
11
- ]);
12
- export const ACCESS_TOKEN_SCOPE_DEFINITIONS = [
13
- {
14
- value: "account:read",
15
- label: "Read account",
16
- description: "View account details, active sessions, and existing access tokens.",
17
- },
18
- {
19
- value: "account:write",
20
- label: "Manage account",
21
- description: "Update account settings and revoke or create account-scoped credentials.",
22
- },
23
- {
24
- value: "team:read",
25
- label: "Read teams",
26
- description: "View team membership, billing, activity, secrets, and settings.",
27
- },
28
- {
29
- value: "team:write",
30
- label: "Manage teams",
31
- description: "Change team settings and manage members, invitations, or secrets.",
32
- },
33
- {
34
- value: "space:read",
35
- label: "Read spaces",
36
- description: "View spaces, versions, diagnostics, variables, and runtime status.",
37
- },
38
- {
39
- value: "space:write",
40
- label: "Manage spaces",
41
- description: "Create, update, publish, and delete spaces, versions, or variables.",
42
- },
43
- {
44
- value: "domain:read",
45
- label: "Read domains",
46
- description: "Inspect custom domains, DNS state, and assignment details.",
47
- },
48
- {
49
- value: "domain:write",
50
- label: "Manage domains",
51
- description: "Attach, update, verify, or remove space and team domains.",
52
- },
53
- ];
54
- export const DEFAULT_ACCESS_TOKEN_SCOPES = ["account:read"];
@@ -1,6 +0,0 @@
1
- import { z } from "zod";
2
- export declare const IntercomMessengerJwtSchema: z.ZodObject<{
3
- token: z.ZodString;
4
- expiresAt: z.ZodString;
5
- }, z.core.$strip>;
6
- export type IntercomMessengerJwt = z.infer<typeof IntercomMessengerJwtSchema>;
@@ -1,5 +0,0 @@
1
- import { z } from "zod";
2
- export const IntercomMessengerJwtSchema = z.object({
3
- token: z.string().min(1).describe("Server-signed Intercom Messenger JWT."),
4
- expiresAt: z.string().datetime().describe("JWT expiry timestamp."),
5
- });
@@ -1,2 +0,0 @@
1
- export { EVENT_BODY_CAP_BYTES as TELEMETRY_BODY_CAP_BYTES, EVENT_MAX_EVENTS_PER_REQUEST as TELEMETRY_MAX_EVENTS_PER_REQUEST, eventAcceptedSchema as telemetryAcceptedSchema, eventIngestSchema as telemetryIngestSchema, eventPayloadSchema as telemetryEventSchema, } from "./events.js";
2
- export type { EventIngest as TelemetryIngest, EventPayload as TelemetryEvent } from "./events.js";
@@ -1 +0,0 @@
1
- export { EVENT_BODY_CAP_BYTES as TELEMETRY_BODY_CAP_BYTES, EVENT_MAX_EVENTS_PER_REQUEST as TELEMETRY_MAX_EVENTS_PER_REQUEST, eventAcceptedSchema as telemetryAcceptedSchema, eventIngestSchema as telemetryIngestSchema, eventPayloadSchema as telemetryEventSchema, } from "./events.js";
@@ -1,39 +0,0 @@
1
- import { type ApiKeyPreset, type StatticAccessPolicy, type StatticAction } from "../contracts/api-keys.js";
2
- type RequestCondition = NonNullable<StatticAccessPolicy["statements"][number]["conditions"]>;
3
- export type PolicyCompileInput = {
4
- tenantId: string;
5
- teamId: string;
6
- };
7
- export type PolicyAuthorizeInput = {
8
- policy: StatticAccessPolicy;
9
- action: StatticAction;
10
- /**
11
- * Candidate resource URIs for one request target, evaluated together: spaces
12
- * are addressed by their canonical site-rooted URI AND a principal-scoped
13
- * candidate so principal wildcards cover them. A deny matching ANY candidate
14
- * wins; otherwise an allow matching any candidate permits.
15
- */
16
- resource: string | readonly string[];
17
- conditions?: RequestCondition;
18
- };
19
- export declare function compileApiKeyPreset(preset: ApiKeyPreset, input: PolicyCompileInput): StatticAccessPolicy;
20
- export declare function compileTeamRolePolicy(input: PolicyCompileInput & {
21
- role: string;
22
- }): StatticAccessPolicy;
23
- export declare function allowPolicy(actions: StatticAction[], resources: string[]): StatticAccessPolicy;
24
- export declare function denyAllPolicy(): StatticAccessPolicy;
25
- export declare function policyIsSubsetOfGrantor(requested: StatticAccessPolicy, grantor: StatticAccessPolicy): boolean;
26
- export declare function policyAllows(input: PolicyAuthorizeInput): boolean;
27
- export declare function grantedTenantsFromPolicy(policy: StatticAccessPolicy): {
28
- all: boolean;
29
- tenantIds: string[];
30
- };
31
- export declare function grantedPrincipalsFromPolicy(policy: StatticAccessPolicy, input: {
32
- tenantId: string;
33
- principalType: "team" | "external";
34
- }): {
35
- all: boolean;
36
- principalIds: string[];
37
- };
38
- export declare function policyReaches(policy: StatticAccessPolicy, resourceBase: string): boolean;
39
- export {};
@@ -1,7 +0,0 @@
1
- type ErrorDescription = {
2
- message: string;
3
- details: string[];
4
- };
5
- export declare function describeError(error: unknown): ErrorDescription;
6
- export declare function formatErrorMessage(error: unknown): string;
7
- export {};
@@ -1,42 +0,0 @@
1
- import { ApiError } from "./api.js";
2
- function baseMessage(error) {
3
- if (error instanceof Error) {
4
- return error.message;
5
- }
6
- return String(error);
7
- }
8
- function detailLines(error) {
9
- if (!(error instanceof ApiError) || !error.details) {
10
- return [];
11
- }
12
- const lines = [];
13
- const { details } = error;
14
- const missingPaths = details.missingPaths;
15
- if (Array.isArray(missingPaths)) {
16
- const paths = missingPaths.filter((entry) => typeof entry === "string");
17
- if (paths.length > 0) {
18
- lines.push(`Missing files: ${paths.join(", ")}`);
19
- }
20
- }
21
- const path = details.path;
22
- if (typeof path === "string" && path && lines.length === 0) {
23
- lines.push(`Path: ${path}`);
24
- }
25
- if (error.requestId) {
26
- lines.push(`Request ID: ${error.requestId}`);
27
- }
28
- return lines;
29
- }
30
- export function describeError(error) {
31
- return {
32
- message: baseMessage(error),
33
- details: detailLines(error),
34
- };
35
- }
36
- export function formatErrorMessage(error) {
37
- const description = describeError(error);
38
- if (description.details.length === 0) {
39
- return description.message;
40
- }
41
- return `${description.message} ${description.details.join(" ")}`;
42
- }