@yukioa2z/visa-apply 3.0.2 → 3.0.3

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 CHANGED
@@ -4,7 +4,11 @@ Research, prepare, review, and track visa applications with current official sou
4
4
 
5
5
  [Website](https://yukioa2z.github.io/visa-apply/) · [Source](https://github.com/Yukioa2z/visa-apply)
6
6
 
7
- Install into your agent's skills directory with `--dest`:
7
+ ```sh
8
+ npx @yukioa2z/visa-apply
9
+ ```
10
+
11
+ Run in a terminal and pick your agent when prompted. To skip the prompt, pass your agent's skills directory:
8
12
 
9
13
  ```sh
10
14
  npx @yukioa2z/visa-apply -- --dest ~/.claude/skills # Claude Code
package/bin/install.js CHANGED
@@ -3,21 +3,32 @@
3
3
  const fs = require("fs");
4
4
  const os = require("os");
5
5
  const path = require("path");
6
+ const readline = require("readline");
6
7
 
7
8
  const skillName = "visa-apply";
8
9
  const packageRoot = path.resolve(__dirname, "..");
9
10
  const sourceDir = path.join(packageRoot, "skill");
10
11
 
12
+ // Known agents and the skills directory each one scans.
13
+ const AGENTS = [
14
+ { label: "Claude Code", dir: "~/.claude/skills" },
15
+ { label: "Codex", dir: "~/.codex/skills" },
16
+ ];
17
+
11
18
  function usage() {
19
+ const lines = AGENTS.map(
20
+ (a) => ` ${a.label.padEnd(13)} npx @yukioa2z/visa-apply -- --dest ${a.dir}`
21
+ ).join("\n");
12
22
  console.log(`Install ${skillName}
13
23
 
14
- Choose where to install with --dest — your agent's skills directory:
15
- Claude Code npx @yukioa2z/visa-apply -- --dest ~/.claude/skills
16
- Codex npx @yukioa2z/visa-apply -- --dest ~/.codex/skills
24
+ Pick your agent's skills directory with --dest:
25
+ ${lines}
17
26
  Other agent npx @yukioa2z/visa-apply -- --dest <your agent's skills dir>
18
27
 
28
+ Run with no --dest in a terminal to choose interactively.
29
+
19
30
  Options:
20
- --dest <path> Skill root directory (required).
31
+ --dest <path> Skill root directory.
21
32
  --dry-run Print the destination without copying files.
22
33
  --help Show this help message.
23
34
  `);
@@ -37,37 +48,75 @@ function readOption(name) {
37
48
  return args[index + 1];
38
49
  }
39
50
 
40
- const args = process.argv.slice(2);
41
- if (args.includes("--help") || args.includes("-h")) {
42
- usage();
43
- process.exit(0);
51
+ function install(destRoot, dryRun) {
52
+ const destDir = path.join(destRoot, skillName);
53
+ if (dryRun) {
54
+ console.log(destDir);
55
+ return;
56
+ }
57
+ fs.mkdirSync(destRoot, { recursive: true });
58
+ fs.rmSync(destDir, { recursive: true, force: true });
59
+ fs.cpSync(sourceDir, destDir, { recursive: true });
60
+ console.log(`Installed ${skillName} to ${destDir}`);
61
+ console.log(
62
+ `Try: Use $${skillName} to check your visa need and prepare an application dossier.`
63
+ );
44
64
  }
45
65
 
46
- if (!fs.existsSync(sourceDir)) {
47
- console.error(`Skill source not found: ${sourceDir}`);
48
- process.exit(1);
66
+ function promptAgent() {
67
+ return new Promise((resolve) => {
68
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
69
+ console.log("Which agent are you installing for?\n");
70
+ AGENTS.forEach((a, i) => console.log(` ${i + 1}) ${a.label} (${a.dir})`));
71
+ console.log(` ${AGENTS.length + 1}) Other (enter a path)\n`);
72
+ rl.question("Choice: ", (answer) => {
73
+ rl.close();
74
+ const n = parseInt(answer.trim(), 10);
75
+ if (n >= 1 && n <= AGENTS.length) {
76
+ resolve(AGENTS[n - 1].dir);
77
+ } else if (n === AGENTS.length + 1) {
78
+ const rl2 = readline.createInterface({ input: process.stdin, output: process.stdout });
79
+ rl2.question("Skills directory path: ", (p) => {
80
+ rl2.close();
81
+ resolve(p.trim() || null);
82
+ });
83
+ } else {
84
+ resolve(null);
85
+ }
86
+ });
87
+ });
49
88
  }
50
89
 
51
- const destOption = readOption("--dest");
52
- if (!destOption) {
53
- console.error(
54
- "No --dest given. Install into your agent's skills directory:\n"
55
- );
56
- usage();
57
- process.exit(1);
58
- }
90
+ async function main() {
91
+ const args = process.argv.slice(2);
92
+ if (args.includes("--help") || args.includes("-h")) {
93
+ usage();
94
+ return;
95
+ }
96
+ if (!fs.existsSync(sourceDir)) {
97
+ console.error(`Skill source not found: ${sourceDir}`);
98
+ process.exitCode = 1;
99
+ return;
100
+ }
59
101
 
60
- const destRoot = path.resolve(expandHome(destOption));
61
- const destDir = path.join(destRoot, skillName);
102
+ const dryRun = args.includes("--dry-run");
103
+ let dest = readOption("--dest");
62
104
 
63
- if (args.includes("--dry-run")) {
64
- console.log(destDir);
65
- process.exit(0);
66
- }
105
+ if (!dest) {
106
+ // No target given. Ask interactively when attached to a terminal;
107
+ // otherwise (agent/CI) print guidance and exit without guessing.
108
+ if (process.stdin.isTTY && process.stdout.isTTY) {
109
+ dest = await promptAgent();
110
+ }
111
+ if (!dest) {
112
+ console.error("No skills directory chosen.\n");
113
+ usage();
114
+ process.exitCode = 1;
115
+ return;
116
+ }
117
+ }
67
118
 
68
- fs.mkdirSync(destRoot, { recursive: true });
69
- fs.rmSync(destDir, { recursive: true, force: true });
70
- fs.cpSync(sourceDir, destDir, { recursive: true });
119
+ install(path.resolve(expandHome(dest)), dryRun);
120
+ }
71
121
 
72
- console.log(`Installed ${skillName} to ${destDir}`);
73
- console.log(`Try: Use $${skillName} to check your visa need and prepare an application dossier.`);
122
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yukioa2z/visa-apply",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Install a global visa-need research and application filing skill.",
5
5
  "license": "MIT",
6
6
  "keywords": [