@kiipu/cli 0.0.3 → 0.0.4
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
function buildError(requestId, message, code = 'request_failed') {
|
|
2
3
|
return {
|
|
3
4
|
ok: false,
|
|
@@ -9,7 +10,7 @@ function buildError(requestId, message, code = 'request_failed') {
|
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
function parseCreatePostRequest(input) {
|
|
12
|
-
const requestId = typeof input.requestId === 'string' ? input.requestId :
|
|
13
|
+
const requestId = typeof input.requestId === 'string' ? input.requestId : randomUUID();
|
|
13
14
|
const rawText = typeof input.rawText === 'string' ? input.rawText.trim() : '';
|
|
14
15
|
if (!rawText) {
|
|
15
16
|
throw new Error('rawText is required.');
|
|
@@ -32,7 +33,7 @@ function parseCreatePostRequest(input) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
function parsePostMutationRequest(input) {
|
|
35
|
-
const requestId = typeof input.requestId === 'string' ? input.requestId :
|
|
36
|
+
const requestId = typeof input.requestId === 'string' ? input.requestId : randomUUID();
|
|
36
37
|
const postId = typeof input.postId === 'string' ? input.postId.trim() : '';
|
|
37
38
|
if (!postId) {
|
|
38
39
|
throw new Error('postId is required.');
|
package/dist/lib/post-actions.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import { KiipuSkillApiClient } from './kiipu-skill-client.js';
|
|
2
3
|
function formatRequestFailed(message, code) {
|
|
3
4
|
return `Request failed: ${message} (${code}).`;
|
|
@@ -26,7 +27,7 @@ export async function executePostAction(config, input) {
|
|
|
26
27
|
}
|
|
27
28
|
if (input.action === 'create') {
|
|
28
29
|
const response = await client.createPost({
|
|
29
|
-
requestId:
|
|
30
|
+
requestId: randomUUID(),
|
|
30
31
|
requestedAt: new Date().toISOString(),
|
|
31
32
|
traceId: `${input.traceIdPrefix ?? 'post'}-${Date.now()}`,
|
|
32
33
|
rawText: input.content,
|
|
@@ -51,7 +52,7 @@ export async function executePostAction(config, input) {
|
|
|
51
52
|
}
|
|
52
53
|
if (input.action === 'delete') {
|
|
53
54
|
const response = await client.deletePost({
|
|
54
|
-
requestId:
|
|
55
|
+
requestId: randomUUID(),
|
|
55
56
|
requestedAt: new Date().toISOString(),
|
|
56
57
|
traceId: `${input.traceIdPrefix ?? 'delete'}-${Date.now()}`,
|
|
57
58
|
postId: input.postId,
|
|
@@ -72,7 +73,7 @@ export async function executePostAction(config, input) {
|
|
|
72
73
|
}
|
|
73
74
|
if (input.action === 'restore') {
|
|
74
75
|
const response = await client.restorePost({
|
|
75
|
-
requestId:
|
|
76
|
+
requestId: randomUUID(),
|
|
76
77
|
requestedAt: new Date().toISOString(),
|
|
77
78
|
traceId: `${input.traceIdPrefix ?? 'restore'}-${Date.now()}`,
|
|
78
79
|
postId: input.postId,
|
|
@@ -92,7 +93,7 @@ export async function executePostAction(config, input) {
|
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
const response = await client.permanentDeletePost({
|
|
95
|
-
requestId:
|
|
96
|
+
requestId: randomUUID(),
|
|
96
97
|
requestedAt: new Date().toISOString(),
|
|
97
98
|
traceId: `${input.traceIdPrefix ?? 'purge'}-${Date.now()}`,
|
|
98
99
|
postId: input.postId,
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
const packageJsonPath = new URL('../package.json', import.meta.url);
|
|
3
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
4
|
+
export const CLI_VERSION = packageJson.version ?? '0.0.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiipu/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Kiipu CLI for local authentication, doctor checks, and direct post actions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"skill"
|
|
15
15
|
],
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=18"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
20
|
"kiipu": "dist/index.js"
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"dev": "
|
|
34
|
+
"dev": "tsx src/index.ts",
|
|
35
35
|
"build": "node scripts/clean-build.mjs && tsc -p tsconfig.json",
|
|
36
36
|
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint src test --ext .ts",
|
|
37
|
-
"test": "
|
|
37
|
+
"test": "tsx --test test/**/*.test.ts",
|
|
38
38
|
"release:patch": "npm version patch --no-git-tag-version",
|
|
39
39
|
"release:minor": "npm version minor --no-git-tag-version",
|
|
40
40
|
"release:major": "npm version major --no-git-tag-version",
|