showme-studio 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/bin/install.js +31 -6
  2. package/package.json +1 -1
package/bin/install.js CHANGED
@@ -1,32 +1,57 @@
1
1
  #!/usr/bin/env node
2
- // Cai bo agent Showme Studio vao ~/.claude/skills/
2
+ // Cai bo agent Showme Studio vao ~/.claude/skills/ (global) hoac .claude/skills/ (project)
3
3
  // Chua co xac thuc/check goi — ai co package nay cung cai duoc. Se them sau.
4
4
  import { cpSync, existsSync, mkdirSync, readdirSync } from "node:fs";
5
5
  import { homedir } from "node:os";
6
6
  import { join, dirname } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
+ import { createInterface } from "node:readline/promises";
8
9
 
9
10
  const here = dirname(fileURLToPath(import.meta.url));
10
11
  const skillsSource = join(here, "..", "skills");
11
- // --target <path> de test cai lech ra ngoai ~/.claude/skills that
12
+
13
+ // --target <path> de test cai lech, khong dung ~/ hay cwd/ that
12
14
  const targetFlagIndex = process.argv.indexOf("--target");
13
- const skillsTarget =
14
- targetFlagIndex !== -1 && process.argv[targetFlagIndex + 1]
15
- ? join(process.argv[targetFlagIndex + 1], ".claude", "skills")
15
+ const testTarget = targetFlagIndex !== -1 ? process.argv[targetFlagIndex + 1] : null;
16
+
17
+ const wantsGlobal = process.argv.includes("--global");
18
+ const wantsProject = process.argv.includes("--project") || process.argv.includes("--local");
19
+
20
+ async function resolveScope() {
21
+ if (testTarget) return join(testTarget, ".claude", "skills");
22
+ if (wantsGlobal) return join(homedir(), ".claude", "skills");
23
+ if (wantsProject) return join(process.cwd(), ".claude", "skills");
24
+
25
+ if (!process.stdin.isTTY) {
26
+ console.log("Khong o che do terminal tuong tac — mac dinh cai global (~/.claude/skills).");
27
+ console.log("Dung --project de cai rieng cho thu muc du an, --global de bo qua hoi nay.\n");
28
+ return join(homedir(), ".claude", "skills");
29
+ }
30
+
31
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
32
+ console.log("Cai bo agent Showme Studio o dau?");
33
+ console.log(" 1) Global — ~/.claude/skills, dung duoc moi du an (mac dinh)");
34
+ console.log(` 2) Project — .claude/skills trong thu muc hien tai (${process.cwd()})`);
35
+ const answer = (await rl.question("Chon 1 hoac 2: ")).trim();
36
+ rl.close();
37
+ return answer === "2"
38
+ ? join(process.cwd(), ".claude", "skills")
16
39
  : join(homedir(), ".claude", "skills");
40
+ }
17
41
 
18
42
  if (!existsSync(skillsSource)) {
19
43
  console.error("Khong tim thay bo agent di kem trong package. Lien he Showme de duoc ho tro.");
20
44
  process.exit(1);
21
45
  }
22
46
 
47
+ const skillsTarget = await resolveScope();
23
48
  mkdirSync(skillsTarget, { recursive: true });
24
49
 
25
50
  const agentFolders = readdirSync(skillsSource, { withFileTypes: true })
26
51
  .filter((entry) => entry.isDirectory())
27
52
  .map((entry) => entry.name);
28
53
 
29
- console.log(`Cai bo agent Showme Studio vao ${skillsTarget}\n`);
54
+ console.log(`\nCai bo agent Showme Studio vao ${skillsTarget}\n`);
30
55
 
31
56
  for (const name of agentFolders) {
32
57
  cpSync(join(skillsSource, name), join(skillsTarget, name), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "showme-studio",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Cai bo agent Showme Studio vao ~/.claude/skills/",
5
5
  "type": "module",
6
6
  "bin": {