@ph-cms/client-sdk 0.1.22 → 0.1.23
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/bin/cli.js +11 -4
- package/dist/modules/auth.js +3 -1
- package/dist/modules/content.js +6 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -8,12 +8,19 @@ const command = process.argv[2];
|
|
|
8
8
|
if (command === 'init-skill') {
|
|
9
9
|
initSkill();
|
|
10
10
|
} else {
|
|
11
|
-
console.log('Usage: npx @ph-cms/client-sdk init-skill');
|
|
11
|
+
console.log('Usage: npx @ph-cms/client-sdk init-skill [--dir <path>]');
|
|
12
|
+
console.log(' --dir <path> 스킬 파일을 생성할 루트 디렉토리 (기본값: .agents)');
|
|
12
13
|
process.exit(1);
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
function initSkill() {
|
|
16
|
-
|
|
16
|
+
function initSkill() {g
|
|
17
|
+
// --dir 옵션 파싱
|
|
18
|
+
const dirFlagIndex = process.argv.indexOf('--dir');
|
|
19
|
+
const baseDir = dirFlagIndex !== -1 && process.argv[dirFlagIndex + 1]
|
|
20
|
+
? process.argv[dirFlagIndex + 1]
|
|
21
|
+
: '.agents';
|
|
22
|
+
|
|
23
|
+
const skillDir = path.join(process.cwd(), baseDir, 'skills/ph-cms-client');
|
|
17
24
|
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
18
25
|
|
|
19
26
|
const skillContent = `# PH-CMS Client SDK Skill
|
|
@@ -75,5 +82,5 @@ If you need specific details about a module (e.g., \`ContentModule\`, \`AuthModu
|
|
|
75
82
|
}
|
|
76
83
|
|
|
77
84
|
fs.writeFileSync(skillMdPath, skillContent);
|
|
78
|
-
console.log(
|
|
85
|
+
console.log(`✅ PH-CMS Client SDK Skill has been successfully initialized at ${path.join(baseDir, 'skills/ph-cms-client/SKILL.md')}`);
|
|
79
86
|
}
|
package/dist/modules/auth.js
CHANGED
|
@@ -74,7 +74,9 @@ class AuthModule {
|
|
|
74
74
|
}
|
|
75
75
|
// Call the server endpoint to invalidate the session if applicable.
|
|
76
76
|
// JWT-based auth is stateless, but the server may implement a blacklist.
|
|
77
|
-
await this.client.post(`${this.prefix}/auth/logout
|
|
77
|
+
await this.client.post(`${this.prefix}/auth/logout`, null, {
|
|
78
|
+
headers: { 'Content-Type': 'application/json' },
|
|
79
|
+
}).catch(() => { }); // Ignore error on logout
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
exports.AuthModule = AuthModule;
|
package/dist/modules/content.js
CHANGED
|
@@ -23,7 +23,9 @@ class ContentModule {
|
|
|
23
23
|
async incrementView(uid) {
|
|
24
24
|
if (!uid)
|
|
25
25
|
throw new errors_1.ValidationError("UID is required", []);
|
|
26
|
-
await this.client.patch(`${this.prefix}/contents/${uid}/view
|
|
26
|
+
await this.client.patch(`${this.prefix}/contents/${uid}/view`, null, {
|
|
27
|
+
headers: { 'Content-Type': 'application/json' },
|
|
28
|
+
});
|
|
27
29
|
}
|
|
28
30
|
async create(data) {
|
|
29
31
|
const validation = api_contract_1.CreateContentSchema.safeParse(data);
|
|
@@ -84,7 +86,9 @@ class ContentModule {
|
|
|
84
86
|
async toggleLike(uid) {
|
|
85
87
|
if (!uid)
|
|
86
88
|
throw new errors_1.ValidationError("UID is required", []);
|
|
87
|
-
return this.client.post(`${this.prefix}/contents/${uid}/like`, {
|
|
89
|
+
return this.client.post(`${this.prefix}/contents/${uid}/like`, null, {
|
|
90
|
+
headers: { 'Content-Type': 'application/json' },
|
|
91
|
+
});
|
|
88
92
|
}
|
|
89
93
|
async getLikeStatus(uid) {
|
|
90
94
|
if (!uid)
|