@instafy/cli 0.1.4 → 0.1.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.
- package/README.md +1 -1
- package/dist/index.js +43 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Run Instafy projects locally and connect them back to Instafy Studio — from an
|
|
|
20
20
|
- `instafy runtime:status` — show health of the last started runtime.
|
|
21
21
|
- `instafy runtime:stop` — stop the last started runtime.
|
|
22
22
|
- `instafy tunnel` — request a tunnel and forward a local port.
|
|
23
|
-
- `instafy
|
|
23
|
+
- `instafy project:mount` — mount project files locally (SSHFS).
|
|
24
24
|
|
|
25
25
|
Run `instafy --help` for the full command list and options.
|
|
26
26
|
|
package/dist/index.js
CHANGED
|
@@ -238,46 +238,52 @@ projectListCommand
|
|
|
238
238
|
process.exit(1);
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
|
-
|
|
242
|
-
.
|
|
241
|
+
async function runProjectMount(opts) {
|
|
242
|
+
const token = opts.accessToken ??
|
|
243
|
+
opts.controllerAccessToken ??
|
|
244
|
+
process.env.INSTAFY_ACCESS_TOKEN ??
|
|
245
|
+
process.env.CONTROLLER_ACCESS_TOKEN ??
|
|
246
|
+
process.env.CONTROLLER_TOKEN;
|
|
247
|
+
if (!token) {
|
|
248
|
+
throw new Error("Access token is required for project:mount.");
|
|
249
|
+
}
|
|
250
|
+
const serverUrl = opts.serverUrl ??
|
|
251
|
+
opts.controllerUrl ??
|
|
252
|
+
process.env.INSTAFY_SERVER_URL ??
|
|
253
|
+
process.env.CONTROLLER_BASE_URL ??
|
|
254
|
+
"http://127.0.0.1:8788";
|
|
255
|
+
const mountDir = await mountWorkspace({
|
|
256
|
+
project: opts.project,
|
|
257
|
+
controllerUrl: serverUrl,
|
|
258
|
+
controllerAccessToken: token,
|
|
259
|
+
mountPath: opts.path,
|
|
260
|
+
sshfsBin: opts.sshfsBin,
|
|
261
|
+
extraOptions: opts.options,
|
|
262
|
+
});
|
|
263
|
+
console.log(kleur.green(`Mounted project files to ${mountDir}`));
|
|
264
|
+
}
|
|
265
|
+
function configureProjectMountCommand(command) {
|
|
266
|
+
addServerUrlOptions(command);
|
|
267
|
+
addAccessTokenOptions(command, "Instafy access token");
|
|
268
|
+
command
|
|
269
|
+
.option("--sshfs-bin <path>", "sshfs binary (default: sshfs or SHARED_FS_BIN)")
|
|
270
|
+
.option("--options <opts>", "Extra sshfs options")
|
|
271
|
+
.action(async (opts) => {
|
|
272
|
+
try {
|
|
273
|
+
await runProjectMount(opts);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
console.error(kleur.red(String(error)));
|
|
277
|
+
process.exit(1);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
const projectMountCommand = program
|
|
282
|
+
.command("project:mount")
|
|
243
283
|
.description("Mount project files into a local folder (SSHFS, shared storage)")
|
|
244
284
|
.requiredOption("--project <id>", "Project UUID")
|
|
245
285
|
.requiredOption("--path <dir>", "Local mount directory");
|
|
246
|
-
|
|
247
|
-
addAccessTokenOptions(workspaceMountCommand, "Instafy access token");
|
|
248
|
-
workspaceMountCommand
|
|
249
|
-
.option("--sshfs-bin <path>", "sshfs binary (default: sshfs or SHARED_FS_BIN)")
|
|
250
|
-
.option("--options <opts>", "Extra sshfs options")
|
|
251
|
-
.action(async (opts) => {
|
|
252
|
-
try {
|
|
253
|
-
const token = opts.accessToken ??
|
|
254
|
-
opts.controllerAccessToken ??
|
|
255
|
-
process.env.INSTAFY_ACCESS_TOKEN ??
|
|
256
|
-
process.env.CONTROLLER_ACCESS_TOKEN ??
|
|
257
|
-
process.env.CONTROLLER_TOKEN;
|
|
258
|
-
if (!token) {
|
|
259
|
-
throw new Error("Access token is required for workspace:mount.");
|
|
260
|
-
}
|
|
261
|
-
const serverUrl = opts.serverUrl ??
|
|
262
|
-
opts.controllerUrl ??
|
|
263
|
-
process.env.INSTAFY_SERVER_URL ??
|
|
264
|
-
process.env.CONTROLLER_BASE_URL ??
|
|
265
|
-
"http://127.0.0.1:8788";
|
|
266
|
-
const mountDir = await mountWorkspace({
|
|
267
|
-
project: opts.project,
|
|
268
|
-
controllerUrl: serverUrl,
|
|
269
|
-
controllerAccessToken: token,
|
|
270
|
-
mountPath: opts.path,
|
|
271
|
-
sshfsBin: opts.sshfsBin,
|
|
272
|
-
extraOptions: opts.options,
|
|
273
|
-
});
|
|
274
|
-
console.log(kleur.green(`Mounted project files to ${mountDir}`));
|
|
275
|
-
}
|
|
276
|
-
catch (error) {
|
|
277
|
-
console.error(kleur.red(String(error)));
|
|
278
|
-
process.exit(1);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
286
|
+
configureProjectMountCommand(projectMountCommand);
|
|
281
287
|
export async function runCli(argv = process.argv) {
|
|
282
288
|
if (argv.length <= 2) {
|
|
283
289
|
program.outputHelp();
|