@hintoai/cli 0.3.4 → 0.4.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.
@@ -62,6 +62,7 @@ export declare const articlesApi: (client: AxiosInstance) => {
62
62
  update: (id: string, body: {
63
63
  title?: string;
64
64
  slug?: string;
65
+ content?: string;
65
66
  metaDescription?: string;
66
67
  metaKeywords?: string[];
67
68
  }) => Promise<ArticleDetail>;
@@ -110,18 +110,24 @@ function registerArticles(program, client) {
110
110
  .description('Update an article')
111
111
  .option('--title <title>', 'New title')
112
112
  .option('--slug <slug>', 'New slug')
113
+ .option('--content <content>', 'New Markdown content (string or @filepath) — replaces the body')
113
114
  .option('--meta-description <text>', 'SEO meta description')
114
115
  .option('--meta-keywords <keywords>', 'Comma-separated SEO keywords')
115
116
  .option('--json', 'Output as JSON')
116
117
  .action(async (id, opts) => {
117
118
  try {
118
- if (!opts.title && !opts.slug && !opts.metaDescription && !opts.metaKeywords) {
119
- (0, errors_1.exitWithError)('Provide at least one field to update: --title, --slug, --meta-description, or --meta-keywords');
119
+ if (!opts.title &&
120
+ !opts.slug &&
121
+ !opts.content &&
122
+ !opts.metaDescription &&
123
+ !opts.metaKeywords) {
124
+ (0, errors_1.exitWithError)('Provide at least one field to update: --title, --slug, --content, --meta-description, or --meta-keywords');
120
125
  return;
121
126
  }
122
127
  const data = await api.update(id, {
123
128
  ...(opts.title !== undefined && { title: opts.title }),
124
129
  ...(opts.slug !== undefined && { slug: opts.slug }),
130
+ ...(opts.content !== undefined && { content: resolveContent(opts.content) }),
125
131
  ...(opts.metaDescription !== undefined && { metaDescription: opts.metaDescription }),
126
132
  ...(opts.metaKeywords !== undefined && {
127
133
  metaKeywords: opts.metaKeywords
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 const CONFIG_PATH: string;
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.CONFIG_PATH = void 0;
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
- exports.CONFIG_PATH = path_1.default.join(os_1.default.homedir(), '.hinto', 'config.json');
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 dir = path_1.default.dirname(exports.CONFIG_PATH);
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(exports.CONFIG_PATH, JSON.stringify(config, null, 2), {
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
- if (!fs_1.default.existsSync(exports.CONFIG_PATH)) {
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(exports.CONFIG_PATH, 'utf-8'));
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hintoai/cli",
3
- "version": "0.3.4",
3
+ "version": "0.4.0",
4
4
  "description": "Hinto AI CLI — manage videos, articles, and publishing via the Hinto API",
5
5
  "main": "dist/index.js",
6
6
  "bin": {