divergent-thinking-skill 1.0.0 → 1.1.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 (3) hide show
  1. package/README.md +13 -0
  2. package/bin/install.js +107 -18
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -6,6 +6,14 @@ npm package that installs the **divergent-thinking** agent skill (`SKILL.md`) so
6
6
  npx divergent-thinking-skill
7
7
  ```
8
8
 
9
+ or interactive init:
10
+
11
+ ```bash
12
+ npx divergent-thinking-skill init
13
+ # after global install:
14
+ divergent-thinking init
15
+ ```
16
+
9
17
  ## Install
10
18
 
11
19
  Default target: `~/.agents/skills/divergent-thinking/SKILL.md`.
@@ -14,6 +22,11 @@ Default target: `~/.agents/skills/divergent-thinking/SKILL.md`.
14
22
  # Custom parent (folder that contains per-skill subdirs)
15
23
  npx divergent-thinking-skill --dir ~/.codex/skills
16
24
  npx divergent-thinking-skill --dir ~/.claude/skills
25
+
26
+ # Tool presets
27
+ npx divergent-thinking-skill --tool codex
28
+ npx divergent-thinking-skill --tool claude
29
+ npx divergent-thinking-skill --tool cursor
17
30
  ```
18
31
 
19
32
  Or set environment (parent directory only):
package/bin/install.js CHANGED
@@ -1,14 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Installs packaged SKILL.md into the user's agent skills directory.
4
+ *
4
5
  * Usage:
5
6
  * npx divergent-thinking-skill
7
+ * npx divergent-thinking-skill init
6
8
  * npx divergent-thinking-skill --dir ~/.codex/skills
7
- * DIVERGENT_THINKING_SKILL_DIR=~/.claude/skills npx divergent-thinking-skill
9
+ * divergent-thinking init
8
10
  */
9
11
  const fs = require("fs");
10
12
  const path = require("path");
11
13
  const os = require("os");
14
+ const readline = require("readline");
15
+
16
+ const TOOL_PRESETS = {
17
+ codex: "~/.codex/skills",
18
+ claude: "~/.claude/skills",
19
+ cursor: "~/.agents/skills",
20
+ };
12
21
 
13
22
  function expandHome(p) {
14
23
  if (!p || p[0] !== "~") return p;
@@ -18,16 +27,23 @@ function expandHome(p) {
18
27
  function parseArgs(argv) {
19
28
  let outDir = null;
20
29
  let help = false;
30
+ let init = false;
31
+ let tool = null;
21
32
  for (let i = 2; i < argv.length; i++) {
22
33
  const a = argv[i];
23
34
  if (a === "--help" || a === "-h") help = true;
35
+ else if (a === "init") init = true;
24
36
  else if (a === "--dir" && argv[i + 1]) {
25
37
  outDir = expandHome(argv[++i]);
26
38
  } else if (a.startsWith("--dir=")) {
27
39
  outDir = expandHome(a.slice("--dir=".length));
40
+ } else if (a === "--tool" && argv[i + 1]) {
41
+ tool = argv[++i].toLowerCase();
42
+ } else if (a.startsWith("--tool=")) {
43
+ tool = a.slice("--tool=".length).toLowerCase();
28
44
  }
29
45
  }
30
- return { outDir, help };
46
+ return { outDir, help, init, tool };
31
47
  }
32
48
 
33
49
  function defaultSkillsRoot() {
@@ -39,30 +55,42 @@ function defaultSkillsRoot() {
39
55
  return path.join(os.homedir(), ".agents", "skills");
40
56
  }
41
57
 
42
- function main() {
43
- const { outDir, help } = parseArgs(process.argv);
44
- if (help) {
45
- console.log(`
46
- divergent-thinking-skill — install SKILL.md for agent runtimes (Cursor, Codex, Claude Code, etc.)
58
+ function resolvePreset(tool) {
59
+ if (!tool) return null;
60
+ return TOOL_PRESETS[tool] ? expandHome(TOOL_PRESETS[tool]) : null;
61
+ }
62
+
63
+ function printHelp() {
64
+ console.log(`
65
+ divergent-thinking-skill — install SKILL.md for agent runtimes.
47
66
 
48
67
  Usage:
49
68
  npx divergent-thinking-skill
69
+ npx divergent-thinking-skill init
50
70
  npx divergent-thinking-skill --dir ~/.agents/skills
51
- npx divergent-thinking-skill --dir ./my-project/.cursor/skills
71
+ npx divergent-thinking-skill --tool codex
72
+ divergent-thinking init
52
73
 
53
- Environment:
54
- DIVERGENT_THINKING_SKILL_DIR Parent directory for skill folders (default: ~/.agents/skills)
55
- AGENT_SKILLS_DIR Same as above (fallback alias)
74
+ Commands:
75
+ init Interactive install wizard (choose AI tool)
76
+
77
+ Options:
78
+ --dir <path> Parent skills directory (final: <path>/divergent-thinking/SKILL.md)
79
+ --tool <codex|claude|cursor> Use built-in tool preset path
80
+ -h, --help Show help
56
81
 
57
- Install location:
58
- <parent>/divergent-thinking/SKILL.md
82
+ Environment:
83
+ DIVERGENT_THINKING_SKILL_DIR Parent directory for skill folders
84
+ AGENT_SKILLS_DIR Fallback alias
59
85
 
60
- Point your tool at the parent "skills" directory per its docs (e.g. ~/.codex/skills, ~/.claude/skills).
86
+ Preset defaults:
87
+ codex -> ~/.codex/skills
88
+ claude -> ~/.claude/skills
89
+ cursor -> ~/.agents/skills
61
90
  `);
62
- process.exit(0);
63
- }
91
+ }
64
92
 
65
- const parent = outDir || defaultSkillsRoot();
93
+ function installTo(parent) {
66
94
  const destDir = path.join(parent, "divergent-thinking");
67
95
  const src = path.join(__dirname, "..", "skill", "SKILL.md");
68
96
  const dest = path.join(destDir, "SKILL.md");
@@ -78,4 +106,65 @@ Point your tool at the parent "skills" directory per its docs (e.g. ~/.codex/ski
78
106
  console.log("Parent skills directory:", path.resolve(parent));
79
107
  }
80
108
 
81
- main();
109
+ function ask(rl, q) {
110
+ return new Promise((resolve) => rl.question(q, resolve));
111
+ }
112
+
113
+ async function interactiveInit() {
114
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
115
+ try {
116
+ console.log("\nChoose your AI tool:");
117
+ console.log(" 1) Codex (~/.codex/skills)");
118
+ console.log(" 2) Claude (~/.claude/skills)");
119
+ console.log(" 3) Cursor (~/.agents/skills)");
120
+ console.log(" 4) Custom path");
121
+
122
+ const picked = (await ask(rl, "Select [1-4] (default 1): ")).trim() || "1";
123
+ let parent;
124
+ if (picked === "1") parent = expandHome(TOOL_PRESETS.codex);
125
+ else if (picked === "2") parent = expandHome(TOOL_PRESETS.claude);
126
+ else if (picked === "3") parent = expandHome(TOOL_PRESETS.cursor);
127
+ else if (picked === "4") {
128
+ const custom = (await ask(rl, "Enter parent skills directory: ")).trim();
129
+ if (!custom) {
130
+ console.error("No custom path provided.");
131
+ process.exit(1);
132
+ }
133
+ parent = expandHome(custom);
134
+ } else {
135
+ console.error("Invalid selection.");
136
+ process.exit(1);
137
+ }
138
+
139
+ installTo(parent);
140
+ } finally {
141
+ rl.close();
142
+ }
143
+ }
144
+
145
+ async function main() {
146
+ const { outDir, help, init, tool } = parseArgs(process.argv);
147
+ if (help) {
148
+ printHelp();
149
+ process.exit(0);
150
+ }
151
+
152
+ if (init) {
153
+ await interactiveInit();
154
+ return;
155
+ }
156
+
157
+ const fromToolPreset = resolvePreset(tool);
158
+ if (tool && !fromToolPreset) {
159
+ console.error(`Unknown --tool value: ${tool}. Use codex, claude, or cursor.`);
160
+ process.exit(1);
161
+ }
162
+
163
+ const parent = outDir || fromToolPreset || defaultSkillsRoot();
164
+ installTo(parent);
165
+ }
166
+
167
+ main().catch((err) => {
168
+ console.error(err && err.stack ? err.stack : String(err));
169
+ process.exit(1);
170
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "divergent-thinking-skill",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Agent skill: diverge → compare → recommend (frontend-friendly). Install SKILL.md via npx.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,7 +17,8 @@
17
17
  "frontend"
18
18
  ],
19
19
  "bin": {
20
- "divergent-thinking-skill": "bin/install.js"
20
+ "divergent-thinking-skill": "bin/install.js",
21
+ "divergent-thinking": "bin/install.js"
21
22
  },
22
23
  "files": [
23
24
  "bin",