@hintoai/cli 0.3.3 → 0.3.5
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 +3 -3
- package/dist/commands/init.js +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +14 -6
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Command-line interface for [**Hinto AI**](https://hintoai.com) — turn videos into articles, docs, and published content. Manage videos, articles, folders, templates, and publishing from your terminal or from AI agents and scripts.
|
|
8
8
|
|
|
9
|
-
> New to Hinto AI? Create a project at **[hintoai.com](https://hintoai.com)**, then grab a per-project API key from the project's **Settings → API Keys & Webhooks** in the [app](https://app.
|
|
9
|
+
> New to Hinto AI? Create a project at **[hintoai.com](https://hintoai.com)**, then grab a per-project API key from the project's **Settings → API Keys & Webhooks** in the [app](https://app.hintoai.com).
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ The skill bootstraps the CLI itself (`npm install -g @hintoai/cli`) on first use
|
|
|
30
30
|
|
|
31
31
|
## Authentication
|
|
32
32
|
|
|
33
|
-
**Get your API key** from the project it belongs to — keys are per-project, not account-wide: open the project in the [Hinto app](https://app.
|
|
33
|
+
**Get your API key** from the project it belongs to — keys are per-project, not account-wide: open the project in the [Hinto app](https://app.hintoai.com) → **Settings** → **API Keys & Webhooks** → **New Api Key**.
|
|
34
34
|
|
|
35
35
|
Run `init` once with your API key to store credentials locally:
|
|
36
36
|
|
|
@@ -129,7 +129,7 @@ Templates are automatically scoped to your project type.
|
|
|
129
129
|
"name": "Tutorial",
|
|
130
130
|
"description": "Step-by-step guide format",
|
|
131
131
|
"requires_video": true,
|
|
132
|
-
"image_url": "https://cdn.
|
|
132
|
+
"image_url": "https://cdn.hintoai.com/templates/tutorial.png",
|
|
133
133
|
"sort_order": 1
|
|
134
134
|
}
|
|
135
135
|
]
|
package/dist/commands/init.js
CHANGED
|
@@ -16,7 +16,7 @@ function registerInit(program) {
|
|
|
16
16
|
.command('init')
|
|
17
17
|
.description('Authenticate with your Hinto API key')
|
|
18
18
|
.requiredOption('--key <apiKey>', 'Your Hinto API key')
|
|
19
|
-
.option('--api-url <url>', 'Override the Hinto base URL', 'https://app.
|
|
19
|
+
.option('--api-url <url>', 'Override the Hinto base URL', 'https://app.hintoai.com')
|
|
20
20
|
.action((opts) => {
|
|
21
21
|
// Prefer the root program's --api-url (passed globally) over the local default
|
|
22
22
|
const baseUrl = program.opts().apiUrl ?? opts.apiUrl;
|
package/dist/config.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export interface HintoConfig {
|
|
|
2
2
|
apiKey: string;
|
|
3
3
|
baseUrl: string;
|
|
4
4
|
}
|
|
5
|
-
export declare
|
|
5
|
+
export declare function configPath(): string;
|
|
6
6
|
export declare function saveConfig(config: HintoConfig): void;
|
|
7
7
|
export declare function loadConfig(): HintoConfig;
|
package/dist/config.js
CHANGED
|
@@ -3,27 +3,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.configPath = configPath;
|
|
7
7
|
exports.saveConfig = saveConfig;
|
|
8
8
|
exports.loadConfig = loadConfig;
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const os_1 = __importDefault(require("os"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
-
|
|
12
|
+
// Evaluated lazily (not at module import) so the location always reflects the
|
|
13
|
+
// current environment. Tests redirect it with HINTO_CONFIG_DIR to avoid touching
|
|
14
|
+
// the real ~/.hinto/config.json.
|
|
15
|
+
function configPath() {
|
|
16
|
+
const dir = process.env.HINTO_CONFIG_DIR ?? path_1.default.join(os_1.default.homedir(), '.hinto');
|
|
17
|
+
return path_1.default.join(dir, 'config.json');
|
|
18
|
+
}
|
|
13
19
|
function saveConfig(config) {
|
|
14
|
-
const
|
|
20
|
+
const file = configPath();
|
|
21
|
+
const dir = path_1.default.dirname(file);
|
|
15
22
|
if (!fs_1.default.existsSync(dir))
|
|
16
23
|
fs_1.default.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
17
|
-
fs_1.default.writeFileSync(
|
|
24
|
+
fs_1.default.writeFileSync(file, JSON.stringify(config, null, 2), {
|
|
18
25
|
encoding: 'utf-8',
|
|
19
26
|
mode: 0o600,
|
|
20
27
|
});
|
|
21
28
|
}
|
|
22
29
|
function loadConfig() {
|
|
23
|
-
|
|
30
|
+
const file = configPath();
|
|
31
|
+
if (!fs_1.default.existsSync(file)) {
|
|
24
32
|
throw new Error('Run `hinto init --key <your-api-key>` to get started.');
|
|
25
33
|
}
|
|
26
|
-
const raw = JSON.parse(fs_1.default.readFileSync(
|
|
34
|
+
const raw = JSON.parse(fs_1.default.readFileSync(file, 'utf-8'));
|
|
27
35
|
return {
|
|
28
36
|
...raw,
|
|
29
37
|
apiKey: process.env.HINTO_API_KEY ?? raw.apiKey,
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const config = (() => {
|
|
|
35
35
|
return (0, config_1.loadConfig)();
|
|
36
36
|
}
|
|
37
37
|
catch {
|
|
38
|
-
return { apiKey: process.env.HINTO_API_KEY ?? '', baseUrl: 'https://app.
|
|
38
|
+
return { apiKey: process.env.HINTO_API_KEY ?? '', baseUrl: 'https://app.hintoai.com' };
|
|
39
39
|
}
|
|
40
40
|
})();
|
|
41
41
|
const apiUrl = (() => {
|