@kiipu/cli 0.0.1 → 0.0.2
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 +78 -11
- package/dist/commands/doctor.js +23 -4
- package/dist/commands/help.js +5 -3
- package/dist/commands/skills.js +5 -3
- package/dist/config/config.js +15 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,88 @@
|
|
|
1
1
|
# Kiipu CLI
|
|
2
2
|
|
|
3
|
-
`@kiipu/cli` is the publishable
|
|
3
|
+
`@kiipu/cli` is the publishable Kiipu command line interface for local authentication, doctor checks, and direct post actions.
|
|
4
4
|
|
|
5
|
-
It
|
|
5
|
+
## What It Does
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
- authenticate a local machine with a Kiipu API key
|
|
8
|
+
- publish posts directly from the terminal
|
|
9
|
+
- delete, restore, or permanently purge posts by id
|
|
10
|
+
- verify local setup and API reachability with `kiipu doctor`
|
|
11
|
+
- point developers to the separate Claude Code plugin and skills packages
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
By default, the CLI talks to the production Kiipu API at `https://api.kiipu.com`.
|
|
14
|
+
For local development, you can explicitly override the base URL with `KIIPU_API_URL`.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
- direct publishing actions
|
|
16
|
-
- install and doctor checks
|
|
16
|
+
## Install
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @kiipu/cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
Authenticate once on the current machine:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
kiipu auth login --api-key <cpk_...>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Create a post:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
kiipu post create "Ship the beta today"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Check local setup:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
kiipu doctor
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
kiipu auth login --api-key <cpk_...>
|
|
46
|
+
kiipu auth status
|
|
47
|
+
kiipu auth logout
|
|
48
|
+
|
|
49
|
+
kiipu post create "Hello Kiipu"
|
|
50
|
+
kiipu post delete --id post_123
|
|
51
|
+
kiipu post restore --id post_123
|
|
52
|
+
kiipu post purge --id post_123
|
|
53
|
+
|
|
54
|
+
kiipu doctor
|
|
55
|
+
kiipu skills
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API Base URL
|
|
59
|
+
|
|
60
|
+
The CLI uses the production Kiipu API by default:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
https://api.kiipu.com
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
To point the CLI at another environment during development, set `KIIPU_API_URL` explicitly:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
KIIPU_API_URL=http://localhost:3001 kiipu doctor
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The CLI no longer relies on a persisted `apiBaseUrl` in local config, which helps avoid stale non-production endpoints leaking into normal usage.
|
|
73
|
+
|
|
74
|
+
## Claude Code Packages
|
|
75
|
+
|
|
76
|
+
The Claude Code integration ships separately:
|
|
77
|
+
|
|
78
|
+
- plugin package: `@kiipu/claude-plugin`
|
|
79
|
+
- skill assets package: `@kiipu/skills`
|
|
80
|
+
|
|
81
|
+
In this monorepo, you can test the plugin locally with:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
claude --plugin-dir ./packages/claude-plugin
|
|
85
|
+
```
|
|
19
86
|
|
|
20
87
|
## Standalone Repo Sync
|
|
21
88
|
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KiipuUserApiClient } from '../lib/kiipu-user-client.js';
|
|
2
2
|
import { access } from 'node:fs/promises';
|
|
3
|
-
import { getDefaultConfigPath } from '../config/config.js';
|
|
3
|
+
import { DEFAULT_KIIPU_API_BASE_URL, getConfiguredApiBaseUrl, getDefaultConfigPath } from '../config/config.js';
|
|
4
4
|
import { logCliEvent } from '../logger/cli-logger.js';
|
|
5
5
|
export async function runDoctorCommand(config) {
|
|
6
6
|
logCliEvent('doctor_start');
|
|
@@ -12,9 +12,21 @@ export async function runDoctorCommand(config) {
|
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
const checks = [];
|
|
15
|
+
let ok = true;
|
|
16
|
+
const apiBaseUrlConfig = getConfiguredApiBaseUrl();
|
|
15
17
|
checks.push(config.apiKey ? `OK API key: ${config.keyPrefix ?? 'configured'}` : 'Missing API key. Run `kiipu auth login --api-key <cpk_...>`.');
|
|
18
|
+
if (!(config.apiKey || process.env.KIIPU_API_KEY)) {
|
|
19
|
+
ok = false;
|
|
20
|
+
}
|
|
16
21
|
checks.push(config.apiKey || process.env.KIIPU_API_KEY ? 'OK post API auth: configured' : 'Missing API key for post requests.');
|
|
17
|
-
|
|
22
|
+
checks.push(apiBaseUrlConfig.source === 'env'
|
|
23
|
+
? `WARN API base URL override: ${config.apiBaseUrl}`
|
|
24
|
+
: `OK API base URL: ${config.apiBaseUrl}`);
|
|
25
|
+
if (apiBaseUrlConfig.source === 'default' && config.apiBaseUrl !== DEFAULT_KIIPU_API_BASE_URL) {
|
|
26
|
+
ok = false;
|
|
27
|
+
checks.push(`Config mismatch: expected ${DEFAULT_KIIPU_API_BASE_URL} but loaded ${config.apiBaseUrl}. Re-run auth to refresh local config.`);
|
|
28
|
+
}
|
|
29
|
+
let apiStatus = `API unreachable at ${config.apiBaseUrl}`;
|
|
18
30
|
try {
|
|
19
31
|
const response = await fetch(`${config.apiBaseUrl}/health`);
|
|
20
32
|
apiStatus = response.ok ? 'API reachable' : `API returned ${response.status}`;
|
|
@@ -22,12 +34,18 @@ export async function runDoctorCommand(config) {
|
|
|
22
34
|
catch {
|
|
23
35
|
apiStatus = `API unreachable at ${config.apiBaseUrl}`;
|
|
24
36
|
}
|
|
37
|
+
if (apiStatus !== 'API reachable') {
|
|
38
|
+
ok = false;
|
|
39
|
+
}
|
|
25
40
|
checks.push(apiStatus);
|
|
26
41
|
if (config.apiKey) {
|
|
27
42
|
const authStatus = await new KiipuUserApiClient({
|
|
28
43
|
apiBaseUrl: config.apiBaseUrl,
|
|
29
44
|
apiKey: config.apiKey,
|
|
30
45
|
}).getApiKeyMe();
|
|
46
|
+
if (!authStatus.ok) {
|
|
47
|
+
ok = false;
|
|
48
|
+
}
|
|
31
49
|
checks.push(authStatus.ok ? `OK API key auth: ${authStatus.data.username}` : `API key auth failed: ${authStatus.error.message}`);
|
|
32
50
|
}
|
|
33
51
|
try {
|
|
@@ -35,13 +53,14 @@ export async function runDoctorCommand(config) {
|
|
|
35
53
|
checks.push(`OK config: ${configPath}`);
|
|
36
54
|
}
|
|
37
55
|
catch {
|
|
56
|
+
ok = false;
|
|
38
57
|
checks.push(`Missing config file: ${configPath}`);
|
|
39
58
|
}
|
|
40
59
|
logCliEvent('doctor_complete', {
|
|
41
|
-
ok
|
|
60
|
+
ok,
|
|
42
61
|
});
|
|
43
62
|
return {
|
|
44
|
-
ok
|
|
63
|
+
ok,
|
|
45
64
|
message: checks.join('\n'),
|
|
46
65
|
};
|
|
47
66
|
}
|
package/dist/commands/help.js
CHANGED
|
@@ -48,7 +48,7 @@ export function getHelpResult(command) {
|
|
|
48
48
|
'Examples:',
|
|
49
49
|
' kiipu skills',
|
|
50
50
|
' npm view @kiipu/claude-plugin version',
|
|
51
|
-
' claude --plugin-dir ./
|
|
51
|
+
' claude --plugin-dir ./packages/claude-plugin',
|
|
52
52
|
]),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -90,7 +90,8 @@ export function getHelpResult(command) {
|
|
|
90
90
|
'',
|
|
91
91
|
'Checks:',
|
|
92
92
|
' - local Kiipu config exists',
|
|
93
|
-
' - API health and API key auth are reachable',
|
|
93
|
+
' - production API health and API key auth are reachable by default',
|
|
94
|
+
' - KIIPU_API_URL can explicitly override the API base URL for local development',
|
|
94
95
|
]),
|
|
95
96
|
};
|
|
96
97
|
}
|
|
@@ -113,7 +114,8 @@ export function getHelpResult(command) {
|
|
|
113
114
|
' kiipu post delete --id 123',
|
|
114
115
|
' kiipu auth login --api-key <cpk_...>',
|
|
115
116
|
' kiipu doctor',
|
|
116
|
-
' claude --plugin-dir ./
|
|
117
|
+
' claude --plugin-dir ./packages/claude-plugin',
|
|
118
|
+
' KIIPU_API_URL=http://localhost:3001 kiipu doctor',
|
|
117
119
|
'',
|
|
118
120
|
'Claude Code plugin:',
|
|
119
121
|
' kiipu skills',
|
package/dist/commands/skills.js
CHANGED
|
@@ -4,15 +4,17 @@ export async function runSkillsCommand() {
|
|
|
4
4
|
message: [
|
|
5
5
|
'Kiipu skills',
|
|
6
6
|
'Claude Code plugin package: @kiipu/claude-plugin',
|
|
7
|
-
'
|
|
7
|
+
'Skill assets package: @kiipu/skills',
|
|
8
8
|
'',
|
|
9
9
|
'Next actions:',
|
|
10
|
-
'
|
|
10
|
+
' npm view @kiipu/skills version',
|
|
11
11
|
' npm view @kiipu/claude-plugin version',
|
|
12
|
+
' In the monorepo: claude --plugin-dir ./packages/claude-plugin',
|
|
12
13
|
].join('\n'),
|
|
13
14
|
data: {
|
|
14
15
|
packageName: '@kiipu/claude-plugin',
|
|
15
|
-
|
|
16
|
+
skillsPackageName: '@kiipu/skills',
|
|
17
|
+
pluginDir: './packages/claude-plugin',
|
|
16
18
|
},
|
|
17
19
|
};
|
|
18
20
|
}
|
package/dist/config/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
export const DEFAULT_KIIPU_API_BASE_URL = 'https://api.kiipu.com';
|
|
5
6
|
export function getKiipuConfigHome() {
|
|
6
7
|
if (process.env.KIIPU_CONFIG_HOME) {
|
|
7
8
|
return process.env.KIIPU_CONFIG_HOME;
|
|
@@ -11,9 +12,22 @@ export function getKiipuConfigHome() {
|
|
|
11
12
|
export function getDefaultConfigPath() {
|
|
12
13
|
return path.join(getKiipuConfigHome(), 'config.json');
|
|
13
14
|
}
|
|
15
|
+
export function getConfiguredApiBaseUrl() {
|
|
16
|
+
const envValue = process.env.KIIPU_API_URL?.trim();
|
|
17
|
+
if (envValue) {
|
|
18
|
+
return {
|
|
19
|
+
value: envValue,
|
|
20
|
+
source: 'env',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
value: DEFAULT_KIIPU_API_BASE_URL,
|
|
25
|
+
source: 'default',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
14
28
|
export function createDefaultConfig() {
|
|
15
29
|
return {
|
|
16
|
-
apiBaseUrl:
|
|
30
|
+
apiBaseUrl: getConfiguredApiBaseUrl().value,
|
|
17
31
|
};
|
|
18
32
|
}
|
|
19
33
|
export async function loadKiipuConfig(configPath = getDefaultConfigPath()) {
|
|
@@ -23,9 +37,6 @@ export async function loadKiipuConfig(configPath = getDefaultConfigPath()) {
|
|
|
23
37
|
const content = await readFile(configPath, 'utf8');
|
|
24
38
|
const raw = JSON.parse(content);
|
|
25
39
|
const nextConfig = createDefaultConfig();
|
|
26
|
-
if (typeof raw.apiBaseUrl === 'string') {
|
|
27
|
-
nextConfig.apiBaseUrl = raw.apiBaseUrl;
|
|
28
|
-
}
|
|
29
40
|
if (typeof raw.apiKey === 'string') {
|
|
30
41
|
nextConfig.apiKey = raw.apiKey;
|
|
31
42
|
}
|