@supacloud/cli 0.87.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -11,6 +11,22 @@ Registration accepts unknown boundary input, decodes it before invoking the
|
|
|
11
11
|
typed callback, and validates the callback's result. Private `src/shared` imports
|
|
12
12
|
are not supported.
|
|
13
13
|
|
|
14
|
+
## Project Setup and Environment Profiles
|
|
15
|
+
|
|
16
|
+
For an existing frontend, the shortest path is:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
supacloud init
|
|
20
|
+
cp .env.supacloud.test.example .env.supacloud.test
|
|
21
|
+
supacloud env check
|
|
22
|
+
supacloud --env test deploy
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`init` creates `supacloud.json` and non-secret environment examples without
|
|
26
|
+
overwriting an existing project configuration. `env list` and `env check` are
|
|
27
|
+
local-only, redact credentials, and provide stable JSON with `--json` for CI or
|
|
28
|
+
AI tooling. The real `.env.supacloud.*` files are added to `.gitignore`.
|
|
29
|
+
|
|
14
30
|
## Application Starter
|
|
15
31
|
|
|
16
32
|
```sh
|
package/dist/index.js
CHANGED
|
@@ -7797,7 +7797,7 @@ function FromObject10(context, type, value) {
|
|
|
7797
7797
|
return value;
|
|
7798
7798
|
const additionalProperties = GetAdditionalProperties(type);
|
|
7799
7799
|
for (const key of Keys(value)) {
|
|
7800
|
-
if (HasPropertyKey(type.properties, key)) {
|
|
7800
|
+
if (HasPropertyKey(type.properties, key) && IsSchema(type.properties[key])) {
|
|
7801
7801
|
value[key] = FromType19(context, type.properties[key], value[key]);
|
|
7802
7802
|
continue;
|
|
7803
7803
|
}
|
|
@@ -7882,6 +7882,9 @@ function FromProperties4(properties) {
|
|
|
7882
7882
|
result[key] = FromType20(properties[key]);
|
|
7883
7883
|
return result;
|
|
7884
7884
|
}
|
|
7885
|
+
function FromRecordKey(type) {
|
|
7886
|
+
return String2({ pattern: RecordPattern(type) });
|
|
7887
|
+
}
|
|
7885
7888
|
function FromPriorityTypes(types) {
|
|
7886
7889
|
return FromTypes6(Priority(types));
|
|
7887
7890
|
}
|
|
@@ -7889,7 +7892,7 @@ function FromTypes6(types) {
|
|
|
7889
7892
|
return types.map((type) => FromType20(type));
|
|
7890
7893
|
}
|
|
7891
7894
|
function FromType20(type) {
|
|
7892
|
-
const next = IsArray2(type) ? _Array_(FromType20(type.items), ArrayOptions(type)) : IsIntersect(type) ? Intersect(FromTypes6(type.allOf)) : IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) : IsObject2(type) ? _Object_(FromProperties4(type.properties)) : IsRecord(type) ? Record(
|
|
7895
|
+
const next = IsArray2(type) ? _Array_(FromType20(type.items), ArrayOptions(type)) : IsIntersect(type) ? Intersect(FromTypes6(type.allOf)) : IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) : IsObject2(type) ? _Object_(FromProperties4(type.properties)) : IsRecord(type) ? Record(FromRecordKey(type), FromType20(RecordValue(type))) : IsTuple(type) ? Tuple(FromTypes6(type.items)) : type;
|
|
7893
7896
|
return Modifiers(type, next);
|
|
7894
7897
|
}
|
|
7895
7898
|
function UnionPrioritySort(type) {
|
|
@@ -9257,6 +9260,8 @@ var ACTION_POLICY = {
|
|
|
9257
9260
|
write: ["send", "receive", "ack", "release", "fail", "retry", "delete_message", "update_settings"]
|
|
9258
9261
|
},
|
|
9259
9262
|
ai: { local: ["show_skill", "install_skill"] },
|
|
9263
|
+
init: { local: ["init"] },
|
|
9264
|
+
env: { local: ["list", "check"] },
|
|
9260
9265
|
app: {
|
|
9261
9266
|
local: ["init", "generate", "dev", "watch", "verify-plan", "compile", "check", "graph", "explain", "export-tools", "context", "doctor", "fix", "plan", "build"],
|
|
9262
9267
|
read: ["status", "logs", "transfer-plan", "promote-plan", "rollback-plan", "history", "deploy-plan", "diff", "promote-status", "preview-plan", "previews", "preview-list", "preview-status"],
|
|
@@ -21107,25 +21112,25 @@ var starter_metadata_default = {
|
|
|
21107
21112
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
21108
21113
|
packages: {
|
|
21109
21114
|
compiler: {
|
|
21110
|
-
version: "0.44.
|
|
21115
|
+
version: "0.44.1"
|
|
21111
21116
|
},
|
|
21112
21117
|
app: {
|
|
21113
|
-
version: "0.26.
|
|
21118
|
+
version: "0.26.1",
|
|
21114
21119
|
dependencies: {
|
|
21115
21120
|
rxjs: "7.8.2"
|
|
21116
21121
|
}
|
|
21117
21122
|
},
|
|
21118
21123
|
elysia: {
|
|
21119
|
-
version: "0.29.
|
|
21124
|
+
version: "0.29.2"
|
|
21120
21125
|
},
|
|
21121
21126
|
commands: {
|
|
21122
|
-
version: "0.9.
|
|
21127
|
+
version: "0.9.2"
|
|
21123
21128
|
},
|
|
21124
21129
|
contracts: {
|
|
21125
|
-
version: "0.8.
|
|
21130
|
+
version: "0.8.1"
|
|
21126
21131
|
},
|
|
21127
21132
|
db: {
|
|
21128
|
-
version: "0.16.
|
|
21133
|
+
version: "0.16.1",
|
|
21129
21134
|
peerDependencies: {
|
|
21130
21135
|
"drizzle-orm": "1.0.0-rc.5-169397b"
|
|
21131
21136
|
},
|
|
@@ -21134,7 +21139,7 @@ var starter_metadata_default = {
|
|
|
21134
21139
|
}
|
|
21135
21140
|
},
|
|
21136
21141
|
sdk: {
|
|
21137
|
-
version: "0.41.
|
|
21142
|
+
version: "0.41.2",
|
|
21138
21143
|
peerDependencies: {
|
|
21139
21144
|
"@supabase/supabase-js": "^2.117.3"
|
|
21140
21145
|
}
|
|
@@ -28887,10 +28892,320 @@ function registerRemoteDevTools(server, options = {}) {
|
|
|
28887
28892
|
throw new Error("Unsupported remote dev action");
|
|
28888
28893
|
});
|
|
28889
28894
|
}
|
|
28895
|
+
|
|
28896
|
+
// src/shared/tools/developer-experience-tools.ts
|
|
28897
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
28898
|
+
import { mkdir as mkdir7, readdir as readdir8, readFile as readFile7, writeFile as writeFile6 } from "node:fs/promises";
|
|
28899
|
+
import { dirname as dirname12, join as join19, resolve as resolve24 } from "node:path";
|
|
28900
|
+
var initToolSchema = {
|
|
28901
|
+
root: optional(String2(), "Project directory to initialize (default: current directory)"),
|
|
28902
|
+
json: optional(Boolean2(), "Emit one machine-readable JSON result")
|
|
28903
|
+
};
|
|
28904
|
+
var environmentToolSchema = {
|
|
28905
|
+
action: withDescription(stringEnum(["list", "check"]), "Environment profile inspection action"),
|
|
28906
|
+
root: optional(String2(), "Project directory containing .env.supacloud.* files"),
|
|
28907
|
+
json: optional(Boolean2(), "Emit one machine-readable JSON result")
|
|
28908
|
+
};
|
|
28909
|
+
var TEST_PROFILE = [
|
|
28910
|
+
"SUPACLOUD_ENV=test",
|
|
28911
|
+
"SUPACLOUD_API_URL=https://management.test.example.com",
|
|
28912
|
+
"SUPACLOUD_API_TOKEN=<test-management-api-token>",
|
|
28913
|
+
"SUPACLOUD_PROJECT_REF=<test-project-ref>",
|
|
28914
|
+
""
|
|
28915
|
+
].join(`
|
|
28916
|
+
`);
|
|
28917
|
+
var PRODUCTION_PROFILE = [
|
|
28918
|
+
"SUPACLOUD_ENV=production",
|
|
28919
|
+
"SUPACLOUD_API_URL=https://management.example.com",
|
|
28920
|
+
"SUPACLOUD_API_TOKEN=<production-management-api-token>",
|
|
28921
|
+
"SUPACLOUD_PROJECT_REF=<production-project-ref>",
|
|
28922
|
+
""
|
|
28923
|
+
].join(`
|
|
28924
|
+
`);
|
|
28925
|
+
function textResult3(text, isError = false) {
|
|
28926
|
+
return { isError, content: [{ type: "text", text }] };
|
|
28927
|
+
}
|
|
28928
|
+
function jsonResult(value, isError = false) {
|
|
28929
|
+
return textResult3(JSON.stringify(value, null, 2), isError);
|
|
28930
|
+
}
|
|
28931
|
+
function record5(value) {
|
|
28932
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
28933
|
+
}
|
|
28934
|
+
function packageDependencies(manifest) {
|
|
28935
|
+
return new Set([
|
|
28936
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
28937
|
+
...Object.keys(manifest.devDependencies ?? {})
|
|
28938
|
+
]);
|
|
28939
|
+
}
|
|
28940
|
+
function outputDirectoryFor(manifest) {
|
|
28941
|
+
const dependencies = packageDependencies(manifest);
|
|
28942
|
+
if (dependencies.has("next"))
|
|
28943
|
+
return "out";
|
|
28944
|
+
if (dependencies.has("@sveltejs/kit") || dependencies.has("svelte"))
|
|
28945
|
+
return "build";
|
|
28946
|
+
return "dist";
|
|
28947
|
+
}
|
|
28948
|
+
async function readPackageManifest(root) {
|
|
28949
|
+
const path = join19(root, "package.json");
|
|
28950
|
+
if (!existsSync15(path))
|
|
28951
|
+
return {};
|
|
28952
|
+
try {
|
|
28953
|
+
const parsed = JSON.parse(await readFile7(path, "utf8"));
|
|
28954
|
+
const value = record5(parsed);
|
|
28955
|
+
if (!value)
|
|
28956
|
+
throw new Error("package.json must contain an object");
|
|
28957
|
+
const scripts = record5(value.scripts);
|
|
28958
|
+
const dependencies = record5(value.dependencies);
|
|
28959
|
+
const devDependencies = record5(value.devDependencies);
|
|
28960
|
+
return {
|
|
28961
|
+
scripts: scripts ?? undefined,
|
|
28962
|
+
dependencies: dependencies ?? undefined,
|
|
28963
|
+
devDependencies: devDependencies ?? undefined
|
|
28964
|
+
};
|
|
28965
|
+
} catch (error) {
|
|
28966
|
+
throw new Error(`Invalid package.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
28967
|
+
}
|
|
28968
|
+
}
|
|
28969
|
+
async function writeNewFile(path, content) {
|
|
28970
|
+
try {
|
|
28971
|
+
await writeFile6(path, content, { encoding: "utf8", flag: "wx", mode: 384 });
|
|
28972
|
+
return true;
|
|
28973
|
+
} catch (error) {
|
|
28974
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST")
|
|
28975
|
+
return false;
|
|
28976
|
+
throw error;
|
|
28977
|
+
}
|
|
28978
|
+
}
|
|
28979
|
+
async function ensureGitignore(root) {
|
|
28980
|
+
const path = join19(root, ".gitignore");
|
|
28981
|
+
const existing = existsSync15(path) ? await readFile7(path, "utf8") : "";
|
|
28982
|
+
const required = [".env.supacloud.*", "!.env.supacloud.*.example"];
|
|
28983
|
+
const missing = required.filter((entry) => !existing.split(/\r?\n/).includes(entry));
|
|
28984
|
+
if (missing.length === 0)
|
|
28985
|
+
return false;
|
|
28986
|
+
const prefix = existing.length > 0 && !existing.endsWith(`
|
|
28987
|
+
`) ? `${existing}
|
|
28988
|
+
` : existing;
|
|
28989
|
+
await writeFile6(path, `${prefix}${missing.join(`
|
|
28990
|
+
`)}
|
|
28991
|
+
`, "utf8");
|
|
28992
|
+
return true;
|
|
28993
|
+
}
|
|
28994
|
+
async function initializeProject(request, options) {
|
|
28995
|
+
const root = resolve24(request.root || options.cwd || process.cwd());
|
|
28996
|
+
await mkdir7(root, { recursive: true });
|
|
28997
|
+
const configPath = join19(root, "supacloud.json");
|
|
28998
|
+
if (existsSync15(configPath)) {
|
|
28999
|
+
throw new Error(`supacloud.json already exists in ${root}; init never overwrites project configuration`);
|
|
29000
|
+
}
|
|
29001
|
+
const manifest = await readPackageManifest(root);
|
|
29002
|
+
const hasBuildScript = typeof manifest.scripts?.build === "string" && Boolean(manifest.scripts.build.trim());
|
|
29003
|
+
const outputDirectory = outputDirectoryFor(manifest);
|
|
29004
|
+
const config = {
|
|
29005
|
+
frontend: {
|
|
29006
|
+
root: ".",
|
|
29007
|
+
outputDirectory
|
|
29008
|
+
}
|
|
29009
|
+
};
|
|
29010
|
+
const created = [];
|
|
29011
|
+
try {
|
|
29012
|
+
await writeFile6(configPath, `${JSON.stringify(config, null, 2)}
|
|
29013
|
+
`, {
|
|
29014
|
+
encoding: "utf8",
|
|
29015
|
+
flag: "wx",
|
|
29016
|
+
mode: 420
|
|
29017
|
+
});
|
|
29018
|
+
} catch (error) {
|
|
29019
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST") {
|
|
29020
|
+
throw new Error(`supacloud.json already exists in ${root}; init never overwrites project configuration`);
|
|
29021
|
+
}
|
|
29022
|
+
throw error;
|
|
29023
|
+
}
|
|
29024
|
+
created.push("supacloud.json");
|
|
29025
|
+
if (await writeNewFile(join19(root, ".env.supacloud.test.example"), TEST_PROFILE)) {
|
|
29026
|
+
created.push(".env.supacloud.test.example");
|
|
29027
|
+
}
|
|
29028
|
+
if (await writeNewFile(join19(root, ".env.supacloud.production.example"), PRODUCTION_PROFILE)) {
|
|
29029
|
+
created.push(".env.supacloud.production.example");
|
|
29030
|
+
}
|
|
29031
|
+
if (await ensureGitignore(root))
|
|
29032
|
+
created.push(".gitignore");
|
|
29033
|
+
const result = {
|
|
29034
|
+
schema: "supacloud.developer-experience.init.v1",
|
|
29035
|
+
ok: true,
|
|
29036
|
+
root,
|
|
29037
|
+
created,
|
|
29038
|
+
detected: {
|
|
29039
|
+
package_json: existsSync15(join19(root, "package.json")),
|
|
29040
|
+
build_script: hasBuildScript,
|
|
29041
|
+
output_directory: outputDirectory
|
|
29042
|
+
},
|
|
29043
|
+
next: [
|
|
29044
|
+
"cp .env.supacloud.test.example .env.supacloud.test",
|
|
29045
|
+
"supacloud env check",
|
|
29046
|
+
"supacloud --env test deploy"
|
|
29047
|
+
]
|
|
29048
|
+
};
|
|
29049
|
+
if (request.json === true)
|
|
29050
|
+
return jsonResult(result);
|
|
29051
|
+
return textResult3([
|
|
29052
|
+
`Initialized SupaCloud deployment in ${root}.`,
|
|
29053
|
+
`Created: ${created.join(", ")}.`,
|
|
29054
|
+
hasBuildScript ? `Detected package.json build script; deploy output defaults to ${outputDirectory}.` : "No package.json build script detected; add one before deploying.",
|
|
29055
|
+
"",
|
|
29056
|
+
...result.next
|
|
29057
|
+
].join(`
|
|
29058
|
+
`));
|
|
29059
|
+
}
|
|
29060
|
+
function profileNameFromFile(name) {
|
|
29061
|
+
const match = name.match(/^\.env\.supacloud\.([A-Za-z0-9][A-Za-z0-9_-]{0,63})$/);
|
|
29062
|
+
return match?.[1] ?? null;
|
|
29063
|
+
}
|
|
29064
|
+
async function environmentProfiles(root) {
|
|
29065
|
+
const entries = await readdir8(root, { withFileTypes: true }).catch((error) => {
|
|
29066
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
29067
|
+
return [];
|
|
29068
|
+
throw error;
|
|
29069
|
+
});
|
|
29070
|
+
return entries.filter((entry) => entry.isFile()).map((entry) => {
|
|
29071
|
+
const name = profileNameFromFile(entry.name);
|
|
29072
|
+
return name ? { name, path: join19(root, entry.name), exists: true } : null;
|
|
29073
|
+
}).filter((profile) => profile !== null).sort((left, right) => left.name.localeCompare(right.name));
|
|
29074
|
+
}
|
|
29075
|
+
function statusMissing(context) {
|
|
29076
|
+
if (context.credentialScope === "management") {
|
|
29077
|
+
return [
|
|
29078
|
+
!context.apiUrl ? "SUPACLOUD_API_URL" : null,
|
|
29079
|
+
!context.apiToken ? "SUPACLOUD_API_TOKEN" : null,
|
|
29080
|
+
!context.projectRef ? "SUPACLOUD_PROJECT_REF" : null
|
|
29081
|
+
].filter((value) => value !== null);
|
|
29082
|
+
}
|
|
29083
|
+
if (context.credentialScope === "project_application") {
|
|
29084
|
+
return [
|
|
29085
|
+
!context.inferredSupabaseUrl ? "SUPABASE_URL" : null,
|
|
29086
|
+
!context.inferredServiceRoleKey ? "SUPABASE_SERVICE_ROLE_KEY" : null,
|
|
29087
|
+
!context.projectRef ? "SUPACLOUD_PROJECT_REF" : null
|
|
29088
|
+
].filter((value) => value !== null);
|
|
29089
|
+
}
|
|
29090
|
+
return ["SUPACLOUD_API_URL", "SUPACLOUD_API_TOKEN", "SUPACLOUD_PROJECT_REF"];
|
|
29091
|
+
}
|
|
29092
|
+
function deployMissing(context) {
|
|
29093
|
+
const missing = statusMissing(context);
|
|
29094
|
+
if (context.credentialScope !== "management") {
|
|
29095
|
+
return [...missing, "Management API context"];
|
|
29096
|
+
}
|
|
29097
|
+
if (context.applicationId) {
|
|
29098
|
+
if (!context.applicationEnvironmentId)
|
|
29099
|
+
missing.push("SUPACLOUD_APPLICATION_ENVIRONMENT_ID");
|
|
29100
|
+
if (!context.applicationConfigurationPath && !context.applicationConfigurationId) {
|
|
29101
|
+
missing.push("SUPACLOUD_APPLICATION_CONFIGURATION_PATH or SUPACLOUD_APPLICATION_CONFIGURATION_ID");
|
|
29102
|
+
}
|
|
29103
|
+
}
|
|
29104
|
+
return missing;
|
|
29105
|
+
}
|
|
29106
|
+
async function inspectProfile(profile) {
|
|
29107
|
+
try {
|
|
29108
|
+
const context = resolveSupaCloudContext({}, dirname12(profile.path), {
|
|
29109
|
+
environmentName: profile.name
|
|
29110
|
+
});
|
|
29111
|
+
const status = statusMissing(context);
|
|
29112
|
+
const deploy = deployMissing(context);
|
|
29113
|
+
return {
|
|
29114
|
+
name: profile.name,
|
|
29115
|
+
path: profile.path,
|
|
29116
|
+
environment: context.environment || null,
|
|
29117
|
+
production: context.production,
|
|
29118
|
+
source: "named_env_file",
|
|
29119
|
+
credentialScope: context.credentialScope,
|
|
29120
|
+
projectRef: context.projectRef || null,
|
|
29121
|
+
statusReady: status.length === 0,
|
|
29122
|
+
statusMissing: status,
|
|
29123
|
+
deployReady: deploy.length === 0,
|
|
29124
|
+
deployMissing: deploy,
|
|
29125
|
+
hasApiToken: Boolean(context.apiToken),
|
|
29126
|
+
hasServiceRoleKey: Boolean(context.inferredServiceRoleKey),
|
|
29127
|
+
error: null
|
|
29128
|
+
};
|
|
29129
|
+
} catch (error) {
|
|
29130
|
+
return {
|
|
29131
|
+
name: profile.name,
|
|
29132
|
+
path: profile.path,
|
|
29133
|
+
environment: null,
|
|
29134
|
+
production: false,
|
|
29135
|
+
source: "invalid",
|
|
29136
|
+
credentialScope: "incomplete",
|
|
29137
|
+
projectRef: null,
|
|
29138
|
+
statusReady: false,
|
|
29139
|
+
statusMissing: [],
|
|
29140
|
+
deployReady: false,
|
|
29141
|
+
deployMissing: [],
|
|
29142
|
+
hasApiToken: false,
|
|
29143
|
+
hasServiceRoleKey: false,
|
|
29144
|
+
error: error instanceof Error ? error.message : String(error)
|
|
29145
|
+
};
|
|
29146
|
+
}
|
|
29147
|
+
}
|
|
29148
|
+
async function inspectEnvironment(request, options) {
|
|
29149
|
+
const root = resolve24(request.root || options.cwd || process.cwd());
|
|
29150
|
+
const profiles = await environmentProfiles(root);
|
|
29151
|
+
if (request.action === "list") {
|
|
29152
|
+
const active = options.activeContext?.environment || null;
|
|
29153
|
+
const result = {
|
|
29154
|
+
schema: "supacloud.developer-experience.environments.v1",
|
|
29155
|
+
ok: true,
|
|
29156
|
+
root,
|
|
29157
|
+
active,
|
|
29158
|
+
environments: profiles.map((profile) => ({
|
|
29159
|
+
name: profile.name,
|
|
29160
|
+
path: profile.path,
|
|
29161
|
+
active: profile.name.toLowerCase() === active?.toLowerCase()
|
|
29162
|
+
}))
|
|
29163
|
+
};
|
|
29164
|
+
if (request.json === true)
|
|
29165
|
+
return jsonResult(result);
|
|
29166
|
+
if (profiles.length === 0) {
|
|
29167
|
+
return textResult3(`No .env.supacloud.<name> profiles found in ${root}.
|
|
29168
|
+
Run \`supacloud init\` to create safe examples.`);
|
|
29169
|
+
}
|
|
29170
|
+
return textResult3([
|
|
29171
|
+
`Environment profiles in ${root}:`,
|
|
29172
|
+
...result.environments.map((profile) => `${profile.active ? "*" : " "} ${profile.name} ${profile.path}`)
|
|
29173
|
+
].join(`
|
|
29174
|
+
`));
|
|
29175
|
+
}
|
|
29176
|
+
const reports = await Promise.all(profiles.map((profile) => inspectProfile(profile)));
|
|
29177
|
+
const result = {
|
|
29178
|
+
schema: "supacloud.developer-experience.environment-check.v1",
|
|
29179
|
+
ok: reports.length > 0 && reports.every((report) => report.statusReady),
|
|
29180
|
+
root,
|
|
29181
|
+
active: options.activeContext?.environment || null,
|
|
29182
|
+
environments: reports
|
|
29183
|
+
};
|
|
29184
|
+
if (request.json === true)
|
|
29185
|
+
return jsonResult(result, !result.ok);
|
|
29186
|
+
if (reports.length === 0) {
|
|
29187
|
+
return textResult3(`No environment profiles found in ${root}.
|
|
29188
|
+
Run \`supacloud init\` and copy an example profile.`, true);
|
|
29189
|
+
}
|
|
29190
|
+
const lines = reports.map((report) => {
|
|
29191
|
+
if (report.error)
|
|
29192
|
+
return `FAIL ${report.name}: ${report.error}`;
|
|
29193
|
+
const status = report.statusReady ? "OK" : `FAIL missing ${report.statusMissing.join(", ")}`;
|
|
29194
|
+
const deploy = report.deployReady ? "deploy=ready" : `deploy=blocked(${report.deployMissing.join(", ")})`;
|
|
29195
|
+
const ref = report.projectRef ? `project=${report.projectRef}` : "project=unknown";
|
|
29196
|
+
return `${status} ${report.name} ${deploy} ${ref}`;
|
|
29197
|
+
});
|
|
29198
|
+
return textResult3(lines.join(`
|
|
29199
|
+
`), !result.ok);
|
|
29200
|
+
}
|
|
29201
|
+
function registerDeveloperExperienceTools(server, options = {}) {
|
|
29202
|
+
registerTool(server, "init", "Create SupaCloud deployment configuration and non-secret environment examples without overwriting project files.", initToolSchema, (request) => initializeProject(request, options));
|
|
29203
|
+
registerTool(server, "env", "List or locally validate named SupaCloud environment profiles without contacting the platform or printing secrets.", environmentToolSchema, (request) => inspectEnvironment(request, options));
|
|
29204
|
+
}
|
|
28890
29205
|
// package.json
|
|
28891
29206
|
var package_default = {
|
|
28892
29207
|
name: "@supacloud/cli",
|
|
28893
|
-
version: "0.
|
|
29208
|
+
version: "0.88.0",
|
|
28894
29209
|
description: "Project-scoped CLI for SupaCloud users",
|
|
28895
29210
|
type: "module",
|
|
28896
29211
|
main: "./dist/index.js",
|
|
@@ -28942,14 +29257,14 @@ var package_default = {
|
|
|
28942
29257
|
directory: "packages/cli"
|
|
28943
29258
|
},
|
|
28944
29259
|
dependencies: {
|
|
28945
|
-
"@supacloud/compiler": "^0.44.
|
|
28946
|
-
"@supacloud/delivery": "0.14.
|
|
28947
|
-
"@supacloud/db": "0.16.
|
|
28948
|
-
typebox: "1.3.
|
|
29260
|
+
"@supacloud/compiler": "^0.44.1",
|
|
29261
|
+
"@supacloud/delivery": "0.14.1",
|
|
29262
|
+
"@supacloud/db": "0.16.1",
|
|
29263
|
+
typebox: "1.3.36"
|
|
28949
29264
|
},
|
|
28950
29265
|
overrides: {
|
|
28951
|
-
"@supacloud/contracts": "0.8.
|
|
28952
|
-
"@supacloud/delivery": "0.14.
|
|
29266
|
+
"@supacloud/contracts": "0.8.1",
|
|
29267
|
+
"@supacloud/delivery": "0.14.1",
|
|
28953
29268
|
"@graphql-tools/utils": "^12.0.3"
|
|
28954
29269
|
},
|
|
28955
29270
|
devDependencies: {
|
|
@@ -29125,6 +29440,8 @@ USAGE
|
|
|
29125
29440
|
|
|
29126
29441
|
${preferredCommand} [global flags] deploy [--flags]
|
|
29127
29442
|
${preferredCommand} [global flags] <module> <action> [--flags]
|
|
29443
|
+
${preferredCommand} init [--root <directory>]
|
|
29444
|
+
${preferredCommand} env <list|check> [--root <directory>]
|
|
29128
29445
|
${preferredCommand} [global flags] status
|
|
29129
29446
|
${preferredCommand} --help
|
|
29130
29447
|
${preferredCommand} --version
|
|
@@ -29157,6 +29474,9 @@ DEFAULT CONTEXT
|
|
|
29157
29474
|
|
|
29158
29475
|
EXAMPLES
|
|
29159
29476
|
|
|
29477
|
+
${preferredCommand} init
|
|
29478
|
+
${preferredCommand} env check
|
|
29479
|
+
${preferredCommand} env check --json
|
|
29160
29480
|
${preferredCommand} status
|
|
29161
29481
|
${preferredCommand} deploy
|
|
29162
29482
|
${preferredCommand} --env test deploy
|
|
@@ -29316,6 +29636,10 @@ function createCliTools(context, confirmProduction) {
|
|
|
29316
29636
|
})));
|
|
29317
29637
|
Object.assign(tools, captureTools((server) => registerLiteCliTools(server)));
|
|
29318
29638
|
Object.assign(tools, captureTools((server) => registerAiTools(server)));
|
|
29639
|
+
Object.assign(tools, captureTools((server) => registerDeveloperExperienceTools(server, {
|
|
29640
|
+
cwd: process.cwd(),
|
|
29641
|
+
activeContext: context
|
|
29642
|
+
})));
|
|
29319
29643
|
Object.assign(tools, captureTools((server) => registerAppTools(server, { onDevProgress: writeDevProgress })));
|
|
29320
29644
|
Object.assign(tools, captureTools((server) => registerAppAliases(server)));
|
|
29321
29645
|
Object.assign(tools, captureTools((server) => registerDbGovernanceTools(server, {
|
|
@@ -29550,7 +29874,7 @@ async function main() {
|
|
|
29550
29874
|
return;
|
|
29551
29875
|
}
|
|
29552
29876
|
const cliTools = createCliTools(context, globalOptions.confirmProduction);
|
|
29553
|
-
if (args.length === 1 && !["ai", "supabase", "lite", "app", "db"].includes(args[0]) && cliTools[args[0]]) {
|
|
29877
|
+
if (args.length === 1 && !["ai", "supabase", "lite", "app", "db", "env"].includes(args[0]) && cliTools[args[0]]) {
|
|
29554
29878
|
if ("action" in cliTools[args[0]].schema) {
|
|
29555
29879
|
if (context.credentialScope !== "management" || !context.apiUrl || !context.apiToken) {
|
|
29556
29880
|
console.error(`This command requires Management API context. Run \`${preferredCommand} status\` to inspect current detection.`);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ResolvedContext } from "../context";
|
|
2
|
+
import type { ToolSchema } from "../schema";
|
|
3
|
+
import { type ToolServer } from "../tool-server";
|
|
4
|
+
export interface DeveloperExperienceOptions {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
activeContext?: ResolvedContext;
|
|
7
|
+
}
|
|
8
|
+
interface PackageManifest {
|
|
9
|
+
scripts?: Record<string, unknown>;
|
|
10
|
+
dependencies?: Record<string, unknown>;
|
|
11
|
+
devDependencies?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export declare const initToolSchema: ToolSchema;
|
|
14
|
+
export declare const environmentToolSchema: ToolSchema;
|
|
15
|
+
declare function outputDirectoryFor(manifest: PackageManifest): string;
|
|
16
|
+
declare function profileNameFromFile(name: string): string | null;
|
|
17
|
+
declare function statusMissing(context: ResolvedContext): string[];
|
|
18
|
+
declare function deployMissing(context: ResolvedContext): string[];
|
|
19
|
+
export declare function registerDeveloperExperienceTools(server: ToolServer, options?: DeveloperExperienceOptions): void;
|
|
20
|
+
export declare const __internal: {
|
|
21
|
+
outputDirectoryFor: typeof outputDirectoryFor;
|
|
22
|
+
profileNameFromFile: typeof profileNameFromFile;
|
|
23
|
+
statusMissing: typeof statusMissing;
|
|
24
|
+
deployMissing: typeof deployMissing;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.44.
|
|
56
|
-
"@supacloud/delivery": "0.14.
|
|
57
|
-
"@supacloud/db": "0.16.
|
|
58
|
-
"typebox": "1.3.
|
|
55
|
+
"@supacloud/compiler": "^0.44.1",
|
|
56
|
+
"@supacloud/delivery": "0.14.1",
|
|
57
|
+
"@supacloud/db": "0.16.1",
|
|
58
|
+
"typebox": "1.3.36"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
|
-
"@supacloud/contracts": "0.8.
|
|
62
|
-
"@supacloud/delivery": "0.14.
|
|
61
|
+
"@supacloud/contracts": "0.8.1",
|
|
62
|
+
"@supacloud/delivery": "0.14.1",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.3"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|