@supersdk/supercli 0.3.2 → 0.3.3-staging.45
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/build/artifactIntegrity.js +119 -0
- package/dist/build/artifactIntegrity.js.map +1 -0
- package/dist/cli.js +22 -11
- package/dist/cli.js.map +1 -1
- package/dist/commands/add.js +79 -31
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/analytics.js +15 -9
- package/dist/commands/analytics.js.map +1 -1
- package/dist/commands/build.js +231 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/config.js +170 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/db.js +24 -19
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.js +434 -751
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/env.js +8 -8
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/image.js +31 -20
- package/dist/commands/image.js.map +1 -1
- package/dist/commands/init.js +68 -37
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/logs.js +16 -7
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/publishSite.js +28 -943
- package/dist/commands/publishSite.js.map +1 -1
- package/dist/commands/register.js +51 -30
- package/dist/commands/register.js.map +1 -1
- package/dist/commands/settings.js +10 -6
- package/dist/commands/settings.js.map +1 -1
- package/dist/config/appConfig.js +40 -36
- package/dist/config/appConfig.js.map +1 -1
- package/dist/config/superConfig.js +429 -0
- package/dist/config/superConfig.js.map +1 -0
- package/dist/deploy/adapterTypes.js +3 -0
- package/dist/deploy/adapterTypes.js.map +1 -0
- package/dist/deploy/manifest.js +381 -0
- package/dist/deploy/manifest.js.map +1 -0
- package/dist/deploy/preflight.js +202 -0
- package/dist/deploy/preflight.js.map +1 -0
- package/dist/deploy/resultWriter.js +178 -0
- package/dist/deploy/resultWriter.js.map +1 -0
- package/dist/deploy/runAdapter.js +299 -0
- package/dist/deploy/runAdapter.js.map +1 -0
- package/dist/deploy/siteAdapter.js +182 -0
- package/dist/deploy/siteAdapter.js.map +1 -0
- package/dist/docker/dockerCli.js +63 -1
- package/dist/docker/dockerCli.js.map +1 -1
- package/dist/output/envelope.js +5 -1
- package/dist/output/envelope.js.map +1 -1
- package/dist/output/resultPrinter.js +3 -0
- package/dist/output/resultPrinter.js.map +1 -1
- package/dist/publish/responseClassifier.js +4 -4
- package/dist/publish/responseClassifier.js.map +1 -1
- package/dist/publish/runClient.js +11 -11
- package/dist/publish/runClient.js.map +1 -1
- package/dist/publish/siteZip.js +4 -5
- package/dist/publish/siteZip.js.map +1 -1
- package/dist/template/README.md +64 -227
- package/dist/template/android/app/src/main/java/com/supersdk/simple/EnvironmentStore.java +1 -1
- package/dist/template/android/app/src/main/java/com/supersdk/simple/SimpleApplication.java +2 -2
- package/dist/template/android/gradle/supersdk-config-reader.gradle +6 -5
- package/dist/template/android/supersdk-default.config.json +3 -2
- package/dist/template/ios/Sources/App/AppDelegate.swift +1 -1
- package/dist/template/ios/Sources/App/SimpleSDKBootstrap.swift +1 -1
- package/dist/template/scripts/build_android.sh +26 -10
- package/dist/template/scripts/build_ios.sh +41 -9
- package/dist/template/scripts/build_service.sh +89 -0
- package/dist/template/scripts/build_site.sh +40 -26
- package/dist/template/scripts/lib/workspace.sh +4 -4
- package/dist/template/scripts/serve_web.py +2 -4
- package/dist/template/scripts/super_build_orchestrator.py +278 -355
- package/dist/template/scripts/supersdk_template.py +414 -181
- package/dist/template/scripts/web_package.py +9 -8
- package/dist/template/service/Dockerfile +2 -0
- package/dist/template/{supersdk.json → super.json} +20 -1
- package/dist/template/super_build.sh +39 -113
- package/dist/template/template_manifest.json +5 -4
- package/dist/workspace/config.js +81 -119
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/identity.js +15 -14
- package/dist/workspace/identity.js.map +1 -1
- package/dist/workspace/inspect.js +1 -0
- package/dist/workspace/inspect.js.map +1 -1
- package/dist/workspace/projectContext.js +93 -0
- package/dist/workspace/projectContext.js.map +1 -0
- package/dist/workspace/projectIdentity.js +53 -96
- package/dist/workspace/projectIdentity.js.map +1 -1
- package/dist/workspace/template.js +5 -8
- package/dist/workspace/template.js.map +1 -1
- package/package.json +2 -2
- package/dist/publish/siteConfig.js +0 -649
- package/dist/publish/siteConfig.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.defaultBuildDeps = void 0;
|
|
37
|
+
exports.runBuild = runBuild;
|
|
38
|
+
exports.registerBuildCommands = registerBuildCommands;
|
|
39
|
+
const node_child_process_1 = require("node:child_process");
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
41
|
+
const path = __importStar(require("node:path"));
|
|
42
|
+
const superConfig_1 = require("../config/superConfig");
|
|
43
|
+
const resultPrinter_1 = require("../output/resultPrinter");
|
|
44
|
+
const manifest_1 = require("../deploy/manifest");
|
|
45
|
+
const projectContext_1 = require("../workspace/projectContext");
|
|
46
|
+
function packageVersion() {
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), 'utf8'));
|
|
49
|
+
if (typeof parsed.version === 'string' && parsed.version.length > 0)
|
|
50
|
+
return parsed.version;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// The package version is build provenance, so an unreadable package.json is
|
|
54
|
+
// handled by runBuild as an invalid dependency value rather than guessed.
|
|
55
|
+
}
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
exports.defaultBuildDeps = {
|
|
59
|
+
resolveConfig: superConfig_1.resolveSuperConfig,
|
|
60
|
+
runScript: (scriptPath, args, cwd, mode) => new Promise((resolve) => {
|
|
61
|
+
let startError;
|
|
62
|
+
let completed = false;
|
|
63
|
+
const finish = (status) => {
|
|
64
|
+
if (completed)
|
|
65
|
+
return;
|
|
66
|
+
completed = true;
|
|
67
|
+
resolve({ status, stdout: '', stderr: '', ...(startError ? { error: startError } : {}) });
|
|
68
|
+
};
|
|
69
|
+
try {
|
|
70
|
+
const child = (0, node_child_process_1.spawn)(scriptPath, [...args], {
|
|
71
|
+
cwd,
|
|
72
|
+
env: process.env,
|
|
73
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
74
|
+
});
|
|
75
|
+
// Build logs are telemetry, never part of the JSON result channel. In
|
|
76
|
+
// human mode stdout remains live; JSON mode redirects it to stderr so a
|
|
77
|
+
// verbose Gradle/Docker build cannot either overflow a buffer or emit a
|
|
78
|
+
// second machine-readable stdout value.
|
|
79
|
+
child.stdout.on('data', (chunk) => (mode === 'json' ? process.stderr : process.stdout).write(chunk));
|
|
80
|
+
child.stderr.on('data', (chunk) => process.stderr.write(chunk));
|
|
81
|
+
child.once('error', (error) => { startError = error.message; });
|
|
82
|
+
child.once('close', finish);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
startError = error.message;
|
|
86
|
+
finish(null);
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
cliVersion: packageVersion,
|
|
90
|
+
pathExists: fs.existsSync,
|
|
91
|
+
};
|
|
92
|
+
function trim(value) {
|
|
93
|
+
const normalized = value?.trim();
|
|
94
|
+
return normalized ? normalized : undefined;
|
|
95
|
+
}
|
|
96
|
+
function selectedProject(config, projectId) {
|
|
97
|
+
const project = config.projects.find((entry) => entry.projectId === projectId);
|
|
98
|
+
return project ? { projectId: project.projectId, type: project.type } : undefined;
|
|
99
|
+
}
|
|
100
|
+
function manifestSummary(config, outputDir, manifest) {
|
|
101
|
+
return {
|
|
102
|
+
configPath: config.path,
|
|
103
|
+
spid: config.spid,
|
|
104
|
+
outputDir,
|
|
105
|
+
manifestPath: path.join(outputDir, 'super-build-manifest.json'),
|
|
106
|
+
selection: manifest.selection,
|
|
107
|
+
projects: manifest.projects.map((project) => ({
|
|
108
|
+
projectId: project.projectId,
|
|
109
|
+
type: project.type,
|
|
110
|
+
status: project.status,
|
|
111
|
+
...(project.reason ? { reason: project.reason } : {}),
|
|
112
|
+
artifactCount: project.artifacts.length,
|
|
113
|
+
})),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async function runBuild(mode, options, deps = exports.defaultBuildDeps, outputMode = 'human') {
|
|
117
|
+
const outputOption = trim(options.outputDir);
|
|
118
|
+
const projectOption = trim(options.project);
|
|
119
|
+
if (!outputOption || (mode === 'single' && !projectOption)) {
|
|
120
|
+
return { ok: false, kind: 'usage_error', publicCode: 'USAGE_ERROR', message: mode === 'single'
|
|
121
|
+
? '--project and --output-dir are required'
|
|
122
|
+
: '--output-dir is required' };
|
|
123
|
+
}
|
|
124
|
+
const resolution = deps.resolveConfig(process.cwd(), trim(options.config));
|
|
125
|
+
if (resolution.kind !== 'valid') {
|
|
126
|
+
return {
|
|
127
|
+
ok: false,
|
|
128
|
+
kind: 'business_error',
|
|
129
|
+
publicCode: resolution.kind === 'ambiguous' ? 'CONFIG_AMBIGUOUS' : 'CONFIG_INVALID',
|
|
130
|
+
message: (0, superConfig_1.configProblem)(resolution) ?? 'configuration is invalid',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const config = resolution.config;
|
|
134
|
+
if (mode === 'single' && !selectedProject(config, projectOption)) {
|
|
135
|
+
return { ok: false, kind: 'business_error', publicCode: 'PROJECT_NOT_FOUND', message: `project ${projectOption} is not declared in ${config.path}` };
|
|
136
|
+
}
|
|
137
|
+
const outputDir = path.resolve(outputOption);
|
|
138
|
+
if (deps.pathExists(outputDir)) {
|
|
139
|
+
return { ok: false, kind: 'business_error', publicCode: 'BUILD_OUTPUT_EXISTS', message: `build output already exists: ${outputDir}` };
|
|
140
|
+
}
|
|
141
|
+
const scriptPath = path.join(config.root, 'super_build.sh');
|
|
142
|
+
if (!deps.pathExists(scriptPath)) {
|
|
143
|
+
return { ok: false, kind: 'infra_error', publicCode: 'BUILD_HELPER_MISSING', message: `workspace build helper is missing: ${scriptPath}; run the current supercli init to refresh shared files` };
|
|
144
|
+
}
|
|
145
|
+
const cliVersion = deps.cliVersion();
|
|
146
|
+
if (!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(cliVersion)) {
|
|
147
|
+
return { ok: false, kind: 'infra_error', publicCode: 'BUILD_PROVENANCE_INVALID', message: 'cannot determine the installed SuperCLI version for build provenance' };
|
|
148
|
+
}
|
|
149
|
+
const args = [
|
|
150
|
+
'--build',
|
|
151
|
+
'--config', config.path,
|
|
152
|
+
'--output-dir', outputDir,
|
|
153
|
+
'--cli-version', cliVersion,
|
|
154
|
+
...(mode === 'single' ? ['--project', projectOption] : []),
|
|
155
|
+
];
|
|
156
|
+
const completed = await deps.runScript(scriptPath, args, config.root, outputMode);
|
|
157
|
+
if (completed.stderr)
|
|
158
|
+
process.stderr.write(completed.stderr);
|
|
159
|
+
if (completed.error) {
|
|
160
|
+
return {
|
|
161
|
+
ok: false,
|
|
162
|
+
kind: 'infra_error',
|
|
163
|
+
publicCode: 'BUILD_FAILED',
|
|
164
|
+
message: `workspace build could not start: ${completed.error}`,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
let manifest;
|
|
168
|
+
try {
|
|
169
|
+
manifest = (0, manifest_1.readBuildManifest)(outputDir).manifest;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
return { ok: false, kind: 'infra_error', publicCode: 'ARTIFACT_MANIFEST_INVALID', message: error.message };
|
|
173
|
+
}
|
|
174
|
+
const expectedProjectIds = mode === 'single' ? [projectOption] : config.projects.map((project) => project.projectId);
|
|
175
|
+
const selectedTypesMatch = manifest.projects.every((project, index) => {
|
|
176
|
+
const configured = config.projects.find((entry) => entry.projectId === expectedProjectIds[index]);
|
|
177
|
+
return configured?.projectId === project.projectId && configured.type === project.type;
|
|
178
|
+
});
|
|
179
|
+
if (manifest.config.sha256 !== config.digest || manifest.config.spid !== config.spid
|
|
180
|
+
|| manifest.builder.cliVersion !== cliVersion || manifest.selection.mode !== mode
|
|
181
|
+
|| JSON.stringify(manifest.selection.projectIds) !== JSON.stringify(expectedProjectIds)
|
|
182
|
+
|| !selectedTypesMatch) {
|
|
183
|
+
return { ok: false, kind: 'infra_error', publicCode: 'ARTIFACT_MANIFEST_INVALID', message: 'build helper returned a manifest that does not match this invocation/config' };
|
|
184
|
+
}
|
|
185
|
+
const anyFailed = manifest.projects.some((project) => project.status === 'failed');
|
|
186
|
+
const result = manifestSummary(config, outputDir, manifest);
|
|
187
|
+
if (completed.status !== 0 || anyFailed) {
|
|
188
|
+
return {
|
|
189
|
+
ok: false,
|
|
190
|
+
kind: 'infra_error',
|
|
191
|
+
publicCode: 'BUILD_FAILED',
|
|
192
|
+
message: `one or more selected projects failed to build${completed.status === null ? '' : ` (exit ${completed.status})`}`,
|
|
193
|
+
result,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
ok: true,
|
|
198
|
+
message: (0, projectContext_1.withConfigIdentityMessage)({ configPath: config.path, spid: config.spid }, `built ${manifest.projects.length} project${manifest.projects.length === 1 ? '' : 's'} into ${outputDir}`),
|
|
199
|
+
result,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function emit(result, mode) {
|
|
203
|
+
const printer = new resultPrinter_1.ResultPrinter(mode);
|
|
204
|
+
if (result.ok)
|
|
205
|
+
printer.success(result.result ?? {}, { humanMessage: result.message });
|
|
206
|
+
else
|
|
207
|
+
printer.failure(result.kind ?? 'business_error', result.message, { publicCode: result.publicCode, result: result.result });
|
|
208
|
+
}
|
|
209
|
+
function outputMode(command) {
|
|
210
|
+
return command.optsWithGlobals?.()?.output === 'json' ? 'json' : 'human';
|
|
211
|
+
}
|
|
212
|
+
function registerBuildCommands(program) {
|
|
213
|
+
program.command('build')
|
|
214
|
+
.description('Build one configured project through the workspace super_build.sh contract.')
|
|
215
|
+
.requiredOption('--project <projectId>', 'stable projectId from super.json')
|
|
216
|
+
.requiredOption('--output-dir <dir>', 'new directory for portable build artifacts')
|
|
217
|
+
.option('--config <path>', 'explicit super.json-compatible config path')
|
|
218
|
+
.action(async (options, command) => {
|
|
219
|
+
const mode = outputMode(command);
|
|
220
|
+
emit(await runBuild('single', options, exports.defaultBuildDeps, mode), mode);
|
|
221
|
+
});
|
|
222
|
+
program.command('build-all')
|
|
223
|
+
.description('Build every configured project through the workspace super_build.sh contract.')
|
|
224
|
+
.requiredOption('--output-dir <dir>', 'new directory for portable build artifacts')
|
|
225
|
+
.option('--config <path>', 'explicit super.json-compatible config path')
|
|
226
|
+
.action(async (options, command) => {
|
|
227
|
+
const mode = outputMode(command);
|
|
228
|
+
emit(await runBuild('all', options, exports.defaultBuildDeps, mode), mode);
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,4BA2FC;AAYD,sDAkBC;AAtOD,2DAA2C;AAC3C,4CAA8B;AAC9B,gDAAkC;AAElC,uDAAmH;AAEnH,2DAAyE;AACzE,iDAA+F;AAC/F,gEAAwE;AA8BxE,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;QACjI,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,MAAM,CAAC,OAAO,CAAC;IAC7F,CAAC;IAAC,MAAM,CAAC;QACP,4EAA4E;QAC5E,0EAA0E;IAC5E,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAEY,QAAA,gBAAgB,GAAc;IACzC,aAAa,EAAE,gCAAkB;IACjC,SAAS,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAClE,IAAI,UAA8B,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gB,EAAE,EAAE;QACxD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,wBAAgB,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IACL,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SACzB,WAAW,CAAC,+EAA+E,CAAC;SAC5F,cAAc,CAAC,oBAAoB,EAAE,4CAA4C,CAAC;SAClF,MAAM,CAAC,iBAAiB,EAAE,4CAA4C,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,OAAqB,EAAE,OAAgB,EAAE,EAAE;QACxD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,wBAAgB,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.defaultConfigMigrateDeps = void 0;
|
|
37
|
+
exports.runConfigMigrate = runConfigMigrate;
|
|
38
|
+
exports.registerConfigCommand = registerConfigCommand;
|
|
39
|
+
const fs = __importStar(require("node:fs"));
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const node_crypto_1 = require("node:crypto");
|
|
42
|
+
const node_child_process_1 = require("node:child_process");
|
|
43
|
+
const resultPrinter_1 = require("../output/resultPrinter");
|
|
44
|
+
const template_1 = require("../workspace/template");
|
|
45
|
+
const superConfig_1 = require("../config/superConfig");
|
|
46
|
+
exports.defaultConfigMigrateDeps = {
|
|
47
|
+
templateRoot: template_1.locateDefaultTemplateRoot,
|
|
48
|
+
run: (script, from, to) => { const child = (0, node_child_process_1.spawnSync)('python3', [script, 'migrate', '--from', from, '--to', to], { encoding: 'utf8' }); return { status: child.status, stdout: child.stdout ?? '', stderr: child.stderr ?? '' }; },
|
|
49
|
+
};
|
|
50
|
+
function fsyncDirectory(directory) {
|
|
51
|
+
if (process.platform === 'win32')
|
|
52
|
+
return;
|
|
53
|
+
// The target has already been installed atomically at this point. Match the
|
|
54
|
+
// Python authority's best-effort directory durability: an unsupported
|
|
55
|
+
// directory fsync must not turn a complete installed target into a reported
|
|
56
|
+
// failure that cannot be retried.
|
|
57
|
+
let fd;
|
|
58
|
+
try {
|
|
59
|
+
fd = fs.openSync(directory, 'r');
|
|
60
|
+
fs.fsyncSync(fd);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Best effort on filesystems/platforms that reject directory fsync.
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
if (fd !== undefined) {
|
|
67
|
+
try {
|
|
68
|
+
fs.closeSync(fd);
|
|
69
|
+
}
|
|
70
|
+
catch { /* target is already complete */ }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function removeOwnedStaging(stagingPath) {
|
|
75
|
+
try {
|
|
76
|
+
fs.unlinkSync(stagingPath);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (error.code !== 'ENOENT')
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function runConfigMigrate(opts, deps = exports.defaultConfigMigrateDeps) {
|
|
84
|
+
const from = opts.from?.trim();
|
|
85
|
+
const to = opts.to?.trim();
|
|
86
|
+
if (!from || !to)
|
|
87
|
+
return { ok: false, kind: 'usage_error', message: 'config migrate requires --from <supersdk.json> and --to <super.json>' };
|
|
88
|
+
const fromPath = path.resolve(from);
|
|
89
|
+
const toPath = path.resolve(to);
|
|
90
|
+
let fromRoot;
|
|
91
|
+
let toRoot;
|
|
92
|
+
try {
|
|
93
|
+
fromRoot = fs.realpathSync.native(path.dirname(fromPath));
|
|
94
|
+
toRoot = fs.realpathSync.native(path.dirname(toPath));
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
return {
|
|
98
|
+
ok: false,
|
|
99
|
+
kind: 'business_error',
|
|
100
|
+
publicCode: 'CONFIG_MIGRATION_AMBIGUOUS',
|
|
101
|
+
message: `--from and --to parent directories must already exist: ${error.message}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (fromRoot !== toRoot)
|
|
105
|
+
return { ok: false, kind: 'business_error', publicCode: 'CONFIG_MIGRATION_AMBIGUOUS', message: '--from and --to must be in the same workspace root' };
|
|
106
|
+
if (fs.existsSync(toPath))
|
|
107
|
+
return { ok: false, kind: 'business_error', publicCode: 'CONFIG_MIGRATION_AMBIGUOUS', message: `target already exists: ${toPath}` };
|
|
108
|
+
let script;
|
|
109
|
+
try {
|
|
110
|
+
script = path.join(deps.templateRoot(), 'scripts', 'supersdk_template.py');
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
return { ok: false, kind: 'infra_error', message: `cannot locate bundled migration authority: ${error.message}` };
|
|
114
|
+
}
|
|
115
|
+
const stagingPath = path.join(toRoot, `.${path.basename(toPath)}.migrate.${process.pid}.${(0, node_crypto_1.randomUUID)()}.tmp`);
|
|
116
|
+
try {
|
|
117
|
+
let result;
|
|
118
|
+
try {
|
|
119
|
+
result = deps.run(script, fromPath, stagingPath);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return { ok: false, kind: 'infra_error', message: `configuration migration failed: ${error.message}` };
|
|
123
|
+
}
|
|
124
|
+
if (result.status !== 0)
|
|
125
|
+
return { ok: false, kind: 'business_error', publicCode: 'CONFIG_MIGRATION_AMBIGUOUS', message: (result.stderr || result.stdout || 'configuration migration failed').trim() };
|
|
126
|
+
let parsed;
|
|
127
|
+
try {
|
|
128
|
+
parsed = (0, superConfig_1.parseSuperConfig)(fs.readFileSync(stagingPath, 'utf8'), stagingPath);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return { ok: false, kind: 'infra_error', message: `migration output could not be verified: ${error.message}` };
|
|
132
|
+
}
|
|
133
|
+
if (parsed.kind !== 'valid')
|
|
134
|
+
return { ok: false, kind: 'infra_error', message: 'migration authority wrote an invalid v4 configuration' };
|
|
135
|
+
try {
|
|
136
|
+
// Same-directory hard-link installation is atomic and fails with EEXIST
|
|
137
|
+
// instead of replacing a file created concurrently by the user.
|
|
138
|
+
fs.linkSync(stagingPath, toPath);
|
|
139
|
+
fsyncDirectory(toRoot);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
if (error.code === 'EEXIST') {
|
|
143
|
+
return { ok: false, kind: 'business_error', publicCode: 'CONFIG_MIGRATION_AMBIGUOUS', message: `target already exists: ${toPath}` };
|
|
144
|
+
}
|
|
145
|
+
return { ok: false, kind: 'infra_error', message: `migration output could not be installed atomically: ${error.message}` };
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
ok: true,
|
|
149
|
+
result: { configPath: toPath, spid: parsed.config.spid, projects: parsed.config.projects.map((project) => project.projectId) },
|
|
150
|
+
humanMessage: `migrated ${fromPath} to ${toPath}\nConfig: ${toPath}\nSPID: ${parsed.config.spid}`,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
try {
|
|
155
|
+
removeOwnedStaging(stagingPath);
|
|
156
|
+
}
|
|
157
|
+
catch { /* final target, if linked, is already complete */ }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function outputMode(command) { return command.optsWithGlobals?.()?.output === 'json' ? 'json' : 'human'; }
|
|
161
|
+
function registerConfigCommand(program) {
|
|
162
|
+
const config = program.command('config').description('Inspect or migrate SuperCLI configuration.');
|
|
163
|
+
config.command('migrate').description('Atomically migrate schema-v3 supersdk.json to schema-v4 super.json.')
|
|
164
|
+
.requiredOption('--from <path>', 'source supersdk.json')
|
|
165
|
+
.requiredOption('--to <path>', 'target super.json')
|
|
166
|
+
.option('--output <mode>', 'output mode: "json" emits a single machine-readable envelope on stdout')
|
|
167
|
+
.option('--no-input', 'never prompt for interactive input')
|
|
168
|
+
.action((opts, command) => new resultPrinter_1.ResultPrinter(outputMode(command)).emit(runConfigMigrate(opts)));
|
|
169
|
+
}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,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnI,CAAC"}
|
package/dist/commands/db.js
CHANGED
|
@@ -55,6 +55,7 @@ const credentialStore_1 = require("../store/credentialStore");
|
|
|
55
55
|
const log_1 = require("../util/log");
|
|
56
56
|
const prompt_1 = require("../util/prompt");
|
|
57
57
|
const sqlInput_1 = require("./sqlInput");
|
|
58
|
+
const projectContext_1 = require("../workspace/projectContext");
|
|
58
59
|
function storedToken(account) {
|
|
59
60
|
return (0, credentialStore_1.backendForAccount)(account.backend, {
|
|
60
61
|
passphraseProvider: account.backend === 'encrypted-file'
|
|
@@ -146,12 +147,15 @@ function isCommandOutcome(value) {
|
|
|
146
147
|
return value !== null && typeof value === 'object' && 'ok' in value;
|
|
147
148
|
}
|
|
148
149
|
function validScope(opts) {
|
|
149
|
-
const
|
|
150
|
+
const resolved = (0, projectContext_1.resolveWorkspaceContext)(process.cwd(), opts.config);
|
|
151
|
+
if (isCommandOutcome(resolved))
|
|
152
|
+
return resolved;
|
|
153
|
+
const spid = resolved.spid;
|
|
150
154
|
const env = trimmedValue(opts.env);
|
|
151
155
|
if (!spid || !env) {
|
|
152
|
-
return { ok: false, kind: 'usage_error', message: '--
|
|
156
|
+
return { ok: false, kind: 'usage_error', message: '--env is required and SPID is read from super.json' };
|
|
153
157
|
}
|
|
154
|
-
return { spid, env };
|
|
158
|
+
return { configPath: resolved.configPath, spid, env };
|
|
155
159
|
}
|
|
156
160
|
function optionalConnection(conn) {
|
|
157
161
|
if (conn === undefined)
|
|
@@ -331,7 +335,7 @@ function isConnectionBindingsResponse(value) {
|
|
|
331
335
|
|| response.request_id === null
|
|
332
336
|
|| typeof response.request_id === 'string');
|
|
333
337
|
}
|
|
334
|
-
function protectedSuccess(result, allowTokenShapedPaths
|
|
338
|
+
function protectedSuccess(scope, result, allowTokenShapedPaths) {
|
|
335
339
|
try {
|
|
336
340
|
(0, envelope_1.assertNoTokenShapedValue)(result, '$', 0, { allowTokenShapedPaths });
|
|
337
341
|
}
|
|
@@ -342,7 +346,8 @@ function protectedSuccess(result, allowTokenShapedPaths, humanMessage) {
|
|
|
342
346
|
message: 'database result was withheld because credential-shaped data appeared outside an allowed user-data field',
|
|
343
347
|
};
|
|
344
348
|
}
|
|
345
|
-
|
|
349
|
+
const identified = (0, projectContext_1.withConfigIdentity)(scope, result);
|
|
350
|
+
return { ok: true, result: identified, humanMessage: JSON.stringify(identified, null, 2), allowTokenShapedPaths };
|
|
346
351
|
}
|
|
347
352
|
async function runDbList(opts, deps = exports.defaultDbDeps) {
|
|
348
353
|
const scope = validScope(opts);
|
|
@@ -358,7 +363,7 @@ async function runDbList(opts, deps = exports.defaultDbDeps) {
|
|
|
358
363
|
return { ok: false, kind: 'infra_error', message: 'database connection list returned an invalid response' };
|
|
359
364
|
}
|
|
360
365
|
const result = { connections: outcome.data };
|
|
361
|
-
return protectedSuccess(
|
|
366
|
+
return protectedSuccess(scope, result, CONNECTION_ALLOWLIST);
|
|
362
367
|
}
|
|
363
368
|
async function runDbQuery(opts, requestId, deps = exports.defaultDbDeps) {
|
|
364
369
|
const sqlInput = (0, sqlInput_1.readSqlInput)(opts, deps, { rejectEmpty: true });
|
|
@@ -379,7 +384,7 @@ async function runDbQuery(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
379
384
|
if (!isDbQueryResult(outcome.data)) {
|
|
380
385
|
return { ok: false, kind: 'infra_error', message: 'database query returned an invalid response' };
|
|
381
386
|
}
|
|
382
|
-
return protectedSuccess(
|
|
387
|
+
return protectedSuccess(scope, outcome.data, QUERY_ALLOWLIST);
|
|
383
388
|
}
|
|
384
389
|
async function runDbExecute(opts, requestId, deps = exports.defaultDbDeps) {
|
|
385
390
|
const sqlInput = (0, sqlInput_1.readSqlInput)(opts, deps, { rejectEmpty: true });
|
|
@@ -408,7 +413,7 @@ async function runDbExecute(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
408
413
|
if (!isDbExecuteResult(outcome.data)) {
|
|
409
414
|
return { ok: false, kind: 'infra_error', message: 'database execute returned an invalid response' };
|
|
410
415
|
}
|
|
411
|
-
return protectedSuccess(outcome.data, []
|
|
416
|
+
return protectedSuccess(scope, outcome.data, []);
|
|
412
417
|
}
|
|
413
418
|
async function runDbBind(opts, requestId, deps = exports.defaultDbDeps) {
|
|
414
419
|
const service = requiredService(opts.service);
|
|
@@ -429,7 +434,7 @@ async function runDbBind(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
429
434
|
if (!isDatabaseBindingView(outcome.data)) {
|
|
430
435
|
return { ok: false, kind: 'infra_error', message: 'database bind returned an invalid response' };
|
|
431
436
|
}
|
|
432
|
-
return protectedSuccess(
|
|
437
|
+
return protectedSuccess(scope, outcome.data, BINDING_ALLOWLIST);
|
|
433
438
|
}
|
|
434
439
|
async function runDbUnbind(opts, requestId, deps = exports.defaultDbDeps) {
|
|
435
440
|
const service = requiredService(opts.service);
|
|
@@ -447,7 +452,7 @@ async function runDbUnbind(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
447
452
|
if (!isDatabaseBindingView(outcome.data)) {
|
|
448
453
|
return { ok: false, kind: 'infra_error', message: 'database unbind returned an invalid response' };
|
|
449
454
|
}
|
|
450
|
-
return protectedSuccess(
|
|
455
|
+
return protectedSuccess(scope, outcome.data, BINDING_ALLOWLIST);
|
|
451
456
|
}
|
|
452
457
|
async function runDbRefresh(opts, requestId, deps = exports.defaultDbDeps) {
|
|
453
458
|
const service = requiredService(opts.service);
|
|
@@ -465,7 +470,7 @@ async function runDbRefresh(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
465
470
|
if (!isDatabaseBindingView(outcome.data)) {
|
|
466
471
|
return { ok: false, kind: 'infra_error', message: 'database refresh returned an invalid response' };
|
|
467
472
|
}
|
|
468
|
-
return protectedSuccess(
|
|
473
|
+
return protectedSuccess(scope, outcome.data, BINDING_ALLOWLIST);
|
|
469
474
|
}
|
|
470
475
|
async function runDbBindings(opts, requestId, deps = exports.defaultDbDeps) {
|
|
471
476
|
const conn = requiredConnection(opts.conn);
|
|
@@ -483,7 +488,7 @@ async function runDbBindings(opts, requestId, deps = exports.defaultDbDeps) {
|
|
|
483
488
|
if (!isConnectionBindingsResponse(outcome.data)) {
|
|
484
489
|
return { ok: false, kind: 'infra_error', message: 'database bindings returned an invalid response' };
|
|
485
490
|
}
|
|
486
|
-
return protectedSuccess(
|
|
491
|
+
return protectedSuccess(scope, outcome.data, BINDING_ALLOWLIST);
|
|
487
492
|
}
|
|
488
493
|
function outputModeOf(cmd) {
|
|
489
494
|
return cmd.optsWithGlobals?.()?.output === 'json' ? 'json' : 'human';
|
|
@@ -512,7 +517,7 @@ function registerDbCommand(program) {
|
|
|
512
517
|
const db = program.command('db').description('Access scoped databases through the Console API.');
|
|
513
518
|
addLeafOutputOptions(db.command('list')
|
|
514
519
|
.description('List credential-free database connection metadata in one project environment.')
|
|
515
|
-
.
|
|
520
|
+
.option('--config <path>', 'explicit super.json path')
|
|
516
521
|
.requiredOption('--env <env>', 'project environment')
|
|
517
522
|
.action(async (opts, cmd) => {
|
|
518
523
|
const printer = new resultPrinter_1.ResultPrinter(outputModeOf(cmd));
|
|
@@ -520,7 +525,7 @@ function registerDbCommand(program) {
|
|
|
520
525
|
}));
|
|
521
526
|
addLeafOutputOptions(db.command('query')
|
|
522
527
|
.description('Run one scoped read-only SQL query. Prefer --file or stdin for sensitive or multi-line SQL.')
|
|
523
|
-
.
|
|
528
|
+
.option('--config <path>', 'explicit super.json path')
|
|
524
529
|
.requiredOption('--env <env>', 'project environment')
|
|
525
530
|
.option('--conn <name>', 'connection name (omitted uses the environment default)')
|
|
526
531
|
.option('--sql <sql>', 'short SQL query (may be recorded in shell history)')
|
|
@@ -535,7 +540,7 @@ function registerDbCommand(program) {
|
|
|
535
540
|
}));
|
|
536
541
|
addLeafOutputOptions(db.command('execute')
|
|
537
542
|
.description('Run a controlled SQL write as a human administrator. Use --yes only after reviewing a dangerous statement.')
|
|
538
|
-
.
|
|
543
|
+
.option('--config <path>', 'explicit super.json path')
|
|
539
544
|
.requiredOption('--env <env>', 'project environment')
|
|
540
545
|
.option('--conn <name>', 'connection name (omitted uses the environment default)')
|
|
541
546
|
.option('--sql <sql>', 'short SQL statement (may be recorded in shell history)')
|
|
@@ -551,7 +556,7 @@ function registerDbCommand(program) {
|
|
|
551
556
|
}));
|
|
552
557
|
addLeafOutputOptions(db.command('bind')
|
|
553
558
|
.description('Bind one service to a named database connection in one project environment.')
|
|
554
|
-
.
|
|
559
|
+
.option('--config <path>', 'explicit super.json path')
|
|
555
560
|
.requiredOption('--env <env>', 'project environment')
|
|
556
561
|
.requiredOption('--service <slug>', 'service slug')
|
|
557
562
|
.requiredOption('--conn <name>', 'database connection name')
|
|
@@ -561,7 +566,7 @@ function registerDbCommand(program) {
|
|
|
561
566
|
}));
|
|
562
567
|
addLeafOutputOptions(db.command('unbind')
|
|
563
568
|
.description('Remove the database connection binding from one service in one project environment.')
|
|
564
|
-
.
|
|
569
|
+
.option('--config <path>', 'explicit super.json path')
|
|
565
570
|
.requiredOption('--env <env>', 'project environment')
|
|
566
571
|
.requiredOption('--service <slug>', 'service slug')
|
|
567
572
|
.action(async (opts, cmd) => {
|
|
@@ -570,7 +575,7 @@ function registerDbCommand(program) {
|
|
|
570
575
|
}));
|
|
571
576
|
addLeafOutputOptions(db.command('refresh')
|
|
572
577
|
.description('Ask one service runtime to refresh its injected database credentials.')
|
|
573
|
-
.
|
|
578
|
+
.option('--config <path>', 'explicit super.json path')
|
|
574
579
|
.requiredOption('--env <env>', 'project environment')
|
|
575
580
|
.requiredOption('--service <slug>', 'service slug')
|
|
576
581
|
.action(async (opts, cmd) => {
|
|
@@ -579,7 +584,7 @@ function registerDbCommand(program) {
|
|
|
579
584
|
}));
|
|
580
585
|
addLeafOutputOptions(db.command('bindings')
|
|
581
586
|
.description('List which services currently use one named database connection in one project environment.')
|
|
582
|
-
.
|
|
587
|
+
.option('--config <path>', 'explicit super.json path')
|
|
583
588
|
.requiredOption('--env <env>', 'project environment')
|
|
584
589
|
.requiredOption('--conn <name>', 'database connection name')
|
|
585
590
|
.action(async (opts, cmd) => {
|