@spacefast/common 0.0.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.
Files changed (202) hide show
  1. package/README.md +42 -0
  2. package/dist/brand.d.ts +15 -0
  3. package/dist/brand.js +24 -0
  4. package/dist/config/domains.d.ts +30 -0
  5. package/dist/config/domains.js +75 -0
  6. package/dist/config/index.d.ts +1 -0
  7. package/dist/config/index.js +3 -0
  8. package/dist/contracts/abuse.d.ts +93 -0
  9. package/dist/contracts/abuse.js +50 -0
  10. package/dist/contracts/access.d.ts +409 -0
  11. package/dist/contracts/access.js +396 -0
  12. package/dist/contracts/account.d.ts +28 -0
  13. package/dist/contracts/account.js +54 -0
  14. package/dist/contracts/activity.d.ts +118 -0
  15. package/dist/contracts/activity.js +180 -0
  16. package/dist/contracts/analytics.d.ts +56 -0
  17. package/dist/contracts/analytics.js +91 -0
  18. package/dist/contracts/annotations.d.ts +327 -0
  19. package/dist/contracts/annotations.js +234 -0
  20. package/dist/contracts/api-keys.d.ts +517 -0
  21. package/dist/contracts/api-keys.js +235 -0
  22. package/dist/contracts/archives.d.ts +332 -0
  23. package/dist/contracts/archives.js +120 -0
  24. package/dist/contracts/auth.d.ts +86 -0
  25. package/dist/contracts/auth.js +82 -0
  26. package/dist/contracts/beta.d.ts +106 -0
  27. package/dist/contracts/beta.js +104 -0
  28. package/dist/contracts/billing.d.ts +328 -0
  29. package/dist/contracts/billing.js +203 -0
  30. package/dist/contracts/builds.d.ts +504 -0
  31. package/dist/contracts/builds.js +248 -0
  32. package/dist/contracts/channels.d.ts +49 -0
  33. package/dist/contracts/channels.js +51 -0
  34. package/dist/contracts/common.d.ts +238 -0
  35. package/dist/contracts/common.js +175 -0
  36. package/dist/contracts/deployments.d.ts +574 -0
  37. package/dist/contracts/deployments.js +97 -0
  38. package/dist/contracts/device-auth.d.ts +194 -0
  39. package/dist/contracts/device-auth.js +162 -0
  40. package/dist/contracts/domains.d.ts +6115 -0
  41. package/dist/contracts/domains.js +1435 -0
  42. package/dist/contracts/enums.d.ts +196 -0
  43. package/dist/contracts/enums.js +211 -0
  44. package/dist/contracts/error-code-meta.d.ts +1560 -0
  45. package/dist/contracts/error-code-meta.js +400 -0
  46. package/dist/contracts/error-codes.d.ts +13 -0
  47. package/dist/contracts/error-codes.js +416 -0
  48. package/dist/contracts/events.d.ts +398 -0
  49. package/dist/contracts/events.js +320 -0
  50. package/dist/contracts/fast-domain-search.d.ts +19 -0
  51. package/dist/contracts/fast-domain-search.js +22 -0
  52. package/dist/contracts/features.d.ts +240 -0
  53. package/dist/contracts/features.js +406 -0
  54. package/dist/contracts/git.d.ts +288 -0
  55. package/dist/contracts/git.js +116 -0
  56. package/dist/contracts/ids.d.ts +35 -0
  57. package/dist/contracts/ids.js +45 -0
  58. package/dist/contracts/intercom.d.ts +6 -0
  59. package/dist/contracts/intercom.js +5 -0
  60. package/dist/contracts/internal.d.ts +103 -0
  61. package/dist/contracts/internal.js +92 -0
  62. package/dist/contracts/mcp.d.ts +788 -0
  63. package/dist/contracts/mcp.js +161 -0
  64. package/dist/contracts/me.d.ts +81 -0
  65. package/dist/contracts/me.js +104 -0
  66. package/dist/contracts/oauth-resources.d.ts +30 -0
  67. package/dist/contracts/oauth-resources.js +61 -0
  68. package/dist/contracts/operations.d.ts +54 -0
  69. package/dist/contracts/operations.js +14 -0
  70. package/dist/contracts/plan-policy.d.ts +85 -0
  71. package/dist/contracts/plan-policy.js +75 -0
  72. package/dist/contracts/platform.d.ts +359 -0
  73. package/dist/contracts/platform.js +216 -0
  74. package/dist/contracts/push-new.d.ts +156 -0
  75. package/dist/contracts/push-new.js +52 -0
  76. package/dist/contracts/quotas.d.ts +16 -0
  77. package/dist/contracts/quotas.js +36 -0
  78. package/dist/contracts/repository-connections.d.ts +231 -0
  79. package/dist/contracts/repository-connections.js +106 -0
  80. package/dist/contracts/resources.d.ts +529 -0
  81. package/dist/contracts/resources.js +209 -0
  82. package/dist/contracts/routes.d.ts +45 -0
  83. package/dist/contracts/routes.js +31 -0
  84. package/dist/contracts/runtime-api.d.ts +449 -0
  85. package/dist/contracts/runtime-api.js +513 -0
  86. package/dist/contracts/sites.d.ts +393 -0
  87. package/dist/contracts/sites.js +121 -0
  88. package/dist/contracts/slugs.d.ts +31 -0
  89. package/dist/contracts/slugs.js +47 -0
  90. package/dist/contracts/space-config.d.ts +216 -0
  91. package/dist/contracts/space-config.js +237 -0
  92. package/dist/contracts/space-theme.d.ts +25 -0
  93. package/dist/contracts/space-theme.js +49 -0
  94. package/dist/contracts/spaces.d.ts +2760 -0
  95. package/dist/contracts/spaces.js +589 -0
  96. package/dist/contracts/superadmin-activity.d.ts +205 -0
  97. package/dist/contracts/superadmin-activity.js +107 -0
  98. package/dist/contracts/superadmin-emails.d.ts +212 -0
  99. package/dist/contracts/superadmin-emails.js +112 -0
  100. package/dist/contracts/superadmin-queues.d.ts +414 -0
  101. package/dist/contracts/superadmin-queues.js +202 -0
  102. package/dist/contracts/superadmin-runtime.d.ts +27 -0
  103. package/dist/contracts/superadmin-runtime.js +38 -0
  104. package/dist/contracts/superadmin-spaces.d.ts +429 -0
  105. package/dist/contracts/superadmin-spaces.js +82 -0
  106. package/dist/contracts/superadmin-tenants.d.ts +180 -0
  107. package/dist/contracts/superadmin-tenants.js +117 -0
  108. package/dist/contracts/superadmin.d.ts +654 -0
  109. package/dist/contracts/superadmin.js +309 -0
  110. package/dist/contracts/tags.d.ts +1140 -0
  111. package/dist/contracts/tags.js +1050 -0
  112. package/dist/contracts/teams.d.ts +233 -0
  113. package/dist/contracts/teams.js +174 -0
  114. package/dist/contracts/telemetry.d.ts +2 -0
  115. package/dist/contracts/telemetry.js +1 -0
  116. package/dist/contracts/transfers.d.ts +105 -0
  117. package/dist/contracts/transfers.js +48 -0
  118. package/dist/contracts/variables.d.ts +189 -0
  119. package/dist/contracts/variables.js +82 -0
  120. package/dist/contracts/webhooks.d.ts +159 -0
  121. package/dist/contracts/webhooks.js +59 -0
  122. package/dist/contracts/zero.d.ts +1538 -0
  123. package/dist/contracts/zero.js +755 -0
  124. package/dist/docs/agent-prose.d.ts +35 -0
  125. package/dist/docs/agent-prose.js +153 -0
  126. package/dist/docs/agent-setup.d.ts +6 -0
  127. package/dist/docs/agent-setup.js +164 -0
  128. package/dist/docs/agent-solutions.d.ts +110 -0
  129. package/dist/docs/agent-solutions.js +181 -0
  130. package/dist/docs/error-docs.d.ts +12 -0
  131. package/dist/docs/error-docs.js +1601 -0
  132. package/dist/docs/skill-distribution.d.ts +12 -0
  133. package/dist/docs/skill-distribution.js +18 -0
  134. package/dist/domain-exploration.d.ts +108 -0
  135. package/dist/domain-exploration.js +488 -0
  136. package/dist/domain-normalize.d.ts +1 -0
  137. package/dist/domain-normalize.js +14 -0
  138. package/dist/domain-zones.d.ts +1 -0
  139. package/dist/domain-zones.js +5272 -0
  140. package/dist/index.d.ts +1 -0
  141. package/dist/index.js +1 -0
  142. package/dist/utils/access-policy.d.ts +39 -0
  143. package/dist/utils/access-policy.js +232 -0
  144. package/dist/utils/api.d.ts +4 -0
  145. package/dist/utils/api.js +13 -0
  146. package/dist/utils/auth-redirect.d.ts +1 -0
  147. package/dist/utils/auth-redirect.js +48 -0
  148. package/dist/utils/auth.d.ts +5 -0
  149. package/dist/utils/auth.js +13 -0
  150. package/dist/utils/build-settings.d.ts +49 -0
  151. package/dist/utils/build-settings.js +366 -0
  152. package/dist/utils/claim-token.d.ts +1 -0
  153. package/dist/utils/claim-token.js +9 -0
  154. package/dist/utils/collections.d.ts +1 -0
  155. package/dist/utils/collections.js +5 -0
  156. package/dist/utils/concurrency.d.ts +1 -0
  157. package/dist/utils/concurrency.js +18 -0
  158. package/dist/utils/content-type.d.ts +10 -0
  159. package/dist/utils/content-type.js +145 -0
  160. package/dist/utils/error-display.d.ts +7 -0
  161. package/dist/utils/error-display.js +42 -0
  162. package/dist/utils/error.d.ts +1 -0
  163. package/dist/utils/error.js +3 -0
  164. package/dist/utils/generate-space-name.d.ts +14 -0
  165. package/dist/utils/generate-space-name.js +95 -0
  166. package/dist/utils/git-repository.d.ts +5 -0
  167. package/dist/utils/git-repository.js +99 -0
  168. package/dist/utils/guards.d.ts +1 -0
  169. package/dist/utils/guards.js +3 -0
  170. package/dist/utils/publish-detection.d.ts +10 -0
  171. package/dist/utils/publish-detection.js +118 -0
  172. package/dist/utils/publish-policy.d.ts +69 -0
  173. package/dist/utils/publish-policy.js +429 -0
  174. package/dist/utils/query-client.d.ts +7 -0
  175. package/dist/utils/query-client.js +21 -0
  176. package/dist/utils/query-keys.d.ts +75 -0
  177. package/dist/utils/query-keys.js +78 -0
  178. package/dist/utils/runtime-paths.d.ts +7 -0
  179. package/dist/utils/runtime-paths.js +28 -0
  180. package/dist/utils/runtime-upload.d.ts +19 -0
  181. package/dist/utils/runtime-upload.js +27 -0
  182. package/dist/utils/slug.d.ts +5 -0
  183. package/dist/utils/slug.js +13 -0
  184. package/dist/utils/space-config.d.ts +75 -0
  185. package/dist/utils/space-config.js +415 -0
  186. package/dist/utils/space-theme.d.ts +16 -0
  187. package/dist/utils/space-theme.js +89 -0
  188. package/dist/utils/static-runtime-policy.d.ts +17 -0
  189. package/dist/utils/static-runtime-policy.js +103 -0
  190. package/dist/utils/upload-session.d.ts +34 -0
  191. package/dist/utils/upload-session.js +69 -0
  192. package/dist/utils/urls.d.ts +2 -0
  193. package/dist/utils/urls.js +7 -0
  194. package/dist/utils/version-path.d.ts +6 -0
  195. package/dist/utils/version-path.js +51 -0
  196. package/dist/utils/wpcom-auth-redirects.d.ts +14 -0
  197. package/dist/utils/wpcom-auth-redirects.js +49 -0
  198. package/dist/utils/zero-realtime-signature.d.ts +12 -0
  199. package/dist/utils/zero-realtime-signature.js +45 -0
  200. package/dist/vocabulary.d.ts +230 -0
  201. package/dist/vocabulary.js +218 -0
  202. package/package.json +58 -0
@@ -0,0 +1,218 @@
1
+ // THE single source of truth for Spacefast product vocabulary. Every label,
2
+ // CLI command name, MCP tool name, API field description, and doc string that
3
+ // names a core concept should trace back to here, and a drift-guard can compare
4
+ // shipped strings against this registry to catch leaks (e.g. "deployment" in a
5
+ // dashboard label, or "E2B" in marketing copy).
6
+ //
7
+ // This module is intentionally pure data + types: no side effects, no imports.
8
+ // It is additive — wiring consumers (CLI, MCP, dashboard, docs generators) onto
9
+ // it happens in later chunks. The decisions encoded here are LOCKED:
10
+ //
11
+ // - `space` is the primitive noun on every user surface. `site` survives only
12
+ // as the platform-API term for the shared-pool host a space is placed on
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).
18
+ // - `version` / `channel` / `build` are the lifecycle nouns.
19
+ // - `API key` — never "access token".
20
+ // - `Collab` is the feature; `comment` is the unit.
21
+ // - `Superpowers` is the page-enhancement feature.
22
+ // - Provider names never leak externally: never "E2B" (say "Spacefast
23
+ // Builds" / "Spacefast CI"), never "WP.Cloud" (say "infra", except the
24
+ // platform API or the fixed phrase "built on WP.Cloud"), never
25
+ // "code.storage" / "Pierre" (see PROVIDER_HYGIENE).
26
+ export const CONCEPTS = {
27
+ space: {
28
+ id: "space",
29
+ canonicalNoun: "space",
30
+ aliases: [],
31
+ externalTerms: ["site"],
32
+ deprecated: ["project"],
33
+ description: "The primitive noun everywhere a user works. 'Site' is the platform-API " +
34
+ "term for the shared host a space lands on; 'project' is never the primitive.",
35
+ },
36
+ publish: {
37
+ id: "publish",
38
+ canonicalNoun: "publish",
39
+ verb: "publish",
40
+ aliases: ["go live"],
41
+ externalTerms: ["deployment", "deploy"],
42
+ 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
+ },
46
+ version: {
47
+ id: "version",
48
+ canonicalNoun: "version",
49
+ verb: "publish",
50
+ aliases: [],
51
+ deprecated: ["deployment"],
52
+ 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.",
54
+ },
55
+ channel: {
56
+ id: "channel",
57
+ canonicalNoun: "channel",
58
+ aliases: [],
59
+ description: "A named serving lane a version is published to (e.g. production, preview).",
60
+ },
61
+ build: {
62
+ id: "build",
63
+ canonicalNoun: "build",
64
+ verb: "build",
65
+ aliases: [],
66
+ externalTerms: ["E2B"],
67
+ description: "The CI step that turns source into a publishable version. User-facing name " +
68
+ "for the build provider is 'Spacefast Builds' / 'Spacefast CI', never 'E2B'.",
69
+ },
70
+ apiKey: {
71
+ id: "apiKey",
72
+ canonicalNoun: "API key",
73
+ aliases: [],
74
+ deprecated: ["access token", "access-token", "accessToken"],
75
+ description: "The credential users create to authenticate the API/CLI. Never 'access token'.",
76
+ },
77
+ collab: {
78
+ id: "collab",
79
+ canonicalNoun: "Collab",
80
+ aliases: [],
81
+ description: "The collaboration feature (the comment surface). Capital-C as a feature name.",
82
+ },
83
+ comment: {
84
+ id: "comment",
85
+ canonicalNoun: "comment",
86
+ aliases: [],
87
+ description: "A single unit posted within Collab. Lowercase as a common noun.",
88
+ },
89
+ superpowers: {
90
+ id: "superpowers",
91
+ canonicalNoun: "Superpowers",
92
+ aliases: [],
93
+ description: "The page-enhancement feature. Capital-S as a feature name.",
94
+ },
95
+ infra: {
96
+ id: "infra",
97
+ canonicalNoun: "infra",
98
+ aliases: ["infrastructure"],
99
+ externalTerms: ["WP.Cloud"],
100
+ deprecated: ["code.storage", "Pierre"],
101
+ description: "The hosting substrate. Say 'infra' externally; 'WP.Cloud' only in the " +
102
+ "platform API or the phrase 'built on WP.Cloud'. Never 'code.storage'/'Pierre'.",
103
+ },
104
+ };
105
+ export const EXTERNAL_TERM_ALLOWLIST = [
106
+ {
107
+ term: "deployment",
108
+ concept: "publish",
109
+ allowedContexts: ["github-integration", "platform-api"],
110
+ replacement: "version / publish",
111
+ reason: "GitHub speaks 'deployment'; the platform API keeps it for contract " +
112
+ "stability. Everywhere else say 'publish a version'.",
113
+ },
114
+ {
115
+ term: "deploy",
116
+ concept: "publish",
117
+ allowedContexts: ["github-integration", "platform-api"],
118
+ replacement: "publish",
119
+ reason: "Push-deploys and the deploy status come from the GitHub integration.",
120
+ },
121
+ {
122
+ term: "site",
123
+ concept: "space",
124
+ allowedContexts: ["platform-api"],
125
+ replacement: "space",
126
+ reason: "'Site' is the platform-API host primitive (shared pool capacity); user " +
127
+ "surfaces always say 'space'.",
128
+ },
129
+ {
130
+ term: "WP.Cloud",
131
+ concept: "infra",
132
+ allowedContexts: ["platform-api", "fixed-phrase"],
133
+ allowedPhrases: ["built on WP.Cloud"],
134
+ replacement: "infra",
135
+ reason: "Only the platform API or the exact phrase 'built on WP.Cloud' may name " +
136
+ "the provider; general copy says 'infra'.",
137
+ },
138
+ ];
139
+ export const PROVIDER_HYGIENE = {
140
+ e2b: {
141
+ internalName: "E2B",
142
+ replacement: "Spacefast Builds / Spacefast CI",
143
+ allowedContexts: [],
144
+ reason: "The build sandbox vendor is never named; it is 'Spacefast Builds'.",
145
+ },
146
+ wpcloud: {
147
+ internalName: "WP.Cloud",
148
+ replacement: "infra",
149
+ allowedContexts: ["platform-api", "fixed-phrase"],
150
+ allowedPhrases: ["built on WP.Cloud"],
151
+ reason: "Hosting substrate; externally 'infra' except the platform API or the " +
152
+ "phrase 'built on WP.Cloud'.",
153
+ },
154
+ codeStorage: {
155
+ internalName: "code.storage",
156
+ replacement: "infra",
157
+ allowedContexts: [],
158
+ reason: "Internal storage layer; never surfaced.",
159
+ },
160
+ pierre: {
161
+ internalName: "Pierre",
162
+ replacement: "Spacefast Builds / Spacefast CI",
163
+ allowedContexts: [],
164
+ reason: "Internal git/CI dependency; never surfaced.",
165
+ },
166
+ };
167
+ /* -------------------------------------------------------------------------- */
168
+ /* MCP tool naming */
169
+ /* -------------------------------------------------------------------------- */
170
+ /**
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.
194
+ */
195
+ export const MCP_CANONICAL_VERBS = [
196
+ "publish",
197
+ "execute",
198
+ "prepare_publish",
199
+ "resume_publish",
200
+ "finalize_publish",
201
+ ];
202
+ /* -------------------------------------------------------------------------- */
203
+ /* CLI command aliases */
204
+ /* -------------------------------------------------------------------------- */
205
+ /**
206
+ * Canonical CLI verb → accepted aliases. Reused across command groups so every
207
+ * `list`/`remove`/`create` command exposes the same shorthands. A command file
208
+ * spreads `CLI_ALIASES[canonical]` into its `aliases` array.
209
+ */
210
+ export const CLI_ALIASES = {
211
+ list: ["ls"],
212
+ remove: ["rm", "delete"],
213
+ create: ["add"],
214
+ };
215
+ /** Aliases registered for a canonical CLI verb (empty for unknown verbs). */
216
+ export function cliAliasesFor(verb) {
217
+ return CLI_ALIASES[verb];
218
+ }
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@spacefast/common",
3
+ "version": "0.0.2",
4
+ "description": "Shared TypeScript contracts and utilities for Spacefast packages.",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "engines": {
10
+ "bun": "^1.3.11",
11
+ "node": ">=20"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "exports": {
17
+ "./brand": {
18
+ "types": "./dist/brand.d.ts",
19
+ "import": "./dist/brand.js",
20
+ "default": "./dist/brand.js"
21
+ },
22
+ "./contracts/*": {
23
+ "types": "./dist/contracts/*.d.ts",
24
+ "import": "./dist/contracts/*.js",
25
+ "default": "./dist/contracts/*.js"
26
+ },
27
+ "./docs/*": {
28
+ "types": "./dist/docs/*.d.ts",
29
+ "import": "./dist/docs/*.js",
30
+ "default": "./dist/docs/*.js"
31
+ },
32
+ "./utils/*": {
33
+ "types": "./dist/utils/*.d.ts",
34
+ "import": "./dist/utils/*.js",
35
+ "default": "./dist/utils/*.js"
36
+ },
37
+ "./domain-exploration": {
38
+ "types": "./dist/domain-exploration.d.ts",
39
+ "import": "./dist/domain-exploration.js",
40
+ "default": "./dist/domain-exploration.js"
41
+ },
42
+ "./domain-normalize": {
43
+ "types": "./dist/domain-normalize.d.ts",
44
+ "import": "./dist/domain-normalize.js",
45
+ "default": "./dist/domain-normalize.js"
46
+ },
47
+ "./config": {
48
+ "types": "./dist/config/index.d.ts",
49
+ "import": "./dist/config/index.js",
50
+ "default": "./dist/config/index.js"
51
+ }
52
+ },
53
+ "dependencies": {
54
+ "@tanstack/react-query": "^5.101.1",
55
+ "smol-toml": "^1.6.1",
56
+ "zod": "^4.3.6"
57
+ }
58
+ }