Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix(credentials): let runtime init select a Store Linux can open

Mikee Ai2aa696501beb
diff --git a/packages/video-cli/src/distribution.ts b/packages/video-cli/src/distribution.ts
index ec010544..a6774785 100644
--- a/packages/video-cli/src/distribution.ts
+++ b/packages/video-cli/src/distribution.ts
@@ -25,15 +25,18 @@ export const videoCliDistribution: CliDistribution = {
initialRuntimeProfile: {
format: "hypit.runtime-local@1",
dataRoot: ".hypit/runtimes/local",
+ // The starter selects the portable Store, so the Profile it writes is openable and writable on
+ // Linux as well: macOS and Windows keep the platform locker, and a Linux host uses an
+ // owner-private file. `os` and `file` stay selectable by name for one explicit backend.
credentials: {
- os: { use: "@hypit/credential-store-os" },
+ platform: { use: "@hypit/credential-store-platform" },
},
endpoints: {
"hypihub.default": {
use: "@hypit/provider-hypihub",
config: {
baseUrl: "https://hypit.ai",
- apiKey: { store: "os", key: "hypihub.oauth" },
+ apiKey: { store: "platform", key: "hypihub.oauth" },
},
},
"media.local": {
diff --git a/packages/video-cli/test/file-credentials.test.ts b/packages/video-cli/test/file-credentials.test.ts
index 620e54d6..48788b13 100644
--- a/packages/video-cli/test/file-credentials.test.ts
+++ b/packages/video-cli/test/file-credentials.test.ts
@@ -20,7 +20,7 @@ test("an explicitly selected file Store supports CLI login, repair and logout wi
await run("runtime", "init", "--workspace", root);
const profilePath = join(root, "hypit.runtime.json");
const profile = JSON.parse(await readFile(profilePath, "utf8"));
- assert.equal(profile.credentials.os.use, "@hypit/credential-store-os", "initialization preserves the existing starter choice");
+ assert.equal(profile.credentials.platform.use, "@hypit/credential-store-platform", "initialization preserves the existing starter choice");
profile.credentials = { file: { use: "@hypit/credential-store-file" } };
profile.endpoints = { "hypihub.default": { ...profile.endpoints["hypihub.default"], config: {
...profile.endpoints["hypihub.default"].config,
diff --git a/packages/video-cli/test/platform-credentials.test.ts b/packages/video-cli/test/platform-credentials.test.ts
index 6de6bdfe..33967f9f 100644
--- a/packages/video-cli/test/platform-credentials.test.ts
+++ b/packages/video-cli/test/platform-credentials.test.ts
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
-import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, readFile, readdir, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -47,3 +47,33 @@ test("the interview example authenticates on Linux, without editing its Profile"
assert.equal(JSON.parse((await auth("status")).stdout).credentials[0].configured, false);
assert.deepEqual(await readdir(join(state, "credentials")), []);
});
+
+test("the Profile runtime init writes authenticates on Linux, without editing it",
+ { skip: !isLinux, timeout: 120_000 }, async (t) => {
+ const root = await mkdtemp(join(tmpdir(), "hypit-platform-init-"));
+ t.after(() => rm(root, { recursive: true, force: true }));
+ const project = join(root, "project");
+ const state = join(root, "host");
+ await mkdir(project, { recursive: true });
+ const run = (...args: string[]) => exec(process.execPath, [launcher, ...args, "--json"], {
+ cwd: project, env: { ...process.env, HYPIT_STATE_HOME: state }, timeout: 60_000, windowsHide: true,
+ });
+ await run("runtime", "init");
+ const starter = JSON.parse(await readFile(join(project, "hypit.runtime.json"), "utf8"));
+ assert.deepEqual(starter.credentials, { platform: { use: "@hypit/credential-store-platform" } },
+ "a starter that selects a Store Linux cannot open fails every command that follows");
+
+ // Everything below resolves the Profile the starter just wrote and selected, with no flags.
+ const status = async () => JSON.parse((await run("auth", "status", "hypihub.default")).stdout).credentials[0];
+ assert.equal((await status()).configured, false);
+ assert.equal((await status()).writable, true);
+ const input = join(root, "secret.txt");
+ await writeFile(input, "starter-secret-never-displayed");
+ const login = await run("auth", "login", "hypihub.default", "--from", input);
+ assert.doesNotMatch(login.stdout, /starter-secret-never-displayed/u);
+ assert.equal((await status()).configured, true);
+ assert.equal((await readdir(join(state, "credentials"))).length, 1);
+ await run("auth", "logout", "hypihub.default");
+ assert.equal((await status()).configured, false);
+ assert.deepEqual(await readdir(join(state, "credentials")), []);
+ });