divergent-thinking-skill 1.0.0 → 1.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 (3) hide show
  1. package/README.md +23 -0
  2. package/bin/install.js +140 -18
  3. package/package.json +6 -2
package/README.md CHANGED
@@ -6,6 +6,16 @@ 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
+
17
+ `init` detects common AI tool directories, pre-selects detected tools, and supports multi-select install.
18
+
9
19
  ## Install
10
20
 
11
21
  Default target: `~/.agents/skills/divergent-thinking/SKILL.md`.
@@ -14,6 +24,13 @@ Default target: `~/.agents/skills/divergent-thinking/SKILL.md`.
14
24
  # Custom parent (folder that contains per-skill subdirs)
15
25
  npx divergent-thinking-skill --dir ~/.codex/skills
16
26
  npx divergent-thinking-skill --dir ~/.claude/skills
27
+
28
+ # Tool presets
29
+ npx divergent-thinking-skill --tool codex
30
+ npx divergent-thinking-skill --tool claude
31
+ npx divergent-thinking-skill --tool cursor
32
+ # Multiple tools at once
33
+ npx divergent-thinking-skill --tool codex,claude
17
34
  ```
18
35
 
19
36
  Or set environment (parent directory only):
@@ -22,6 +39,12 @@ Or set environment (parent directory only):
22
39
  DIVERGENT_THINKING_SKILL_DIR=~/.claude/skills npx divergent-thinking-skill
23
40
  ```
24
41
 
42
+ Non-interactive detected setup:
43
+
44
+ ```bash
45
+ npx divergent-thinking-skill init --yes
46
+ ```
47
+
25
48
  ## Publish to npm (maintainers)
26
49
 
27
50
  1. Edit `package.json` → set `"repository.url"` to your real Git URL.
package/bin/install.js CHANGED
@@ -1,15 +1,26 @@
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");
12
14
 
15
+ const TOOL_PRESETS = [
16
+ { key: "cursor", name: "Cursor", dir: "~/.agents/skills" },
17
+ { key: "codex", name: "Codex", dir: "~/.codex/skills" },
18
+ { key: "claude", name: "Claude Code", dir: "~/.claude/skills" },
19
+ { key: "gemini", name: "Gemini CLI", dir: "~/.gemini/skills" },
20
+ { key: "copilot", name: "GitHub Copilot", dir: "~/.copilot/skills" },
21
+ { key: "continue", name: "Continue", dir: "~/.continue/skills" },
22
+ ];
23
+
13
24
  function expandHome(p) {
14
25
  if (!p || p[0] !== "~") return p;
15
26
  return path.join(os.homedir(), p.slice(1).replace(/^\//, "") || "");
@@ -18,16 +29,25 @@ function expandHome(p) {
18
29
  function parseArgs(argv) {
19
30
  let outDir = null;
20
31
  let help = false;
32
+ let init = false;
33
+ let tool = null;
34
+ let yes = false;
21
35
  for (let i = 2; i < argv.length; i++) {
22
36
  const a = argv[i];
23
37
  if (a === "--help" || a === "-h") help = true;
38
+ else if (a === "init") init = true;
39
+ else if (a === "--yes" || a === "-y") yes = true;
24
40
  else if (a === "--dir" && argv[i + 1]) {
25
41
  outDir = expandHome(argv[++i]);
26
42
  } else if (a.startsWith("--dir=")) {
27
43
  outDir = expandHome(a.slice("--dir=".length));
44
+ } else if (a === "--tool" && argv[i + 1]) {
45
+ tool = argv[++i].toLowerCase();
46
+ } else if (a.startsWith("--tool=")) {
47
+ tool = a.slice("--tool=".length).toLowerCase();
28
48
  }
29
49
  }
30
- return { outDir, help };
50
+ return { outDir, help, init, tool, yes };
31
51
  }
32
52
 
33
53
  function defaultSkillsRoot() {
@@ -39,30 +59,48 @@ function defaultSkillsRoot() {
39
59
  return path.join(os.homedir(), ".agents", "skills");
40
60
  }
41
61
 
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.)
62
+ function resolvePreset(tool) {
63
+ if (!tool) return null;
64
+ const tools = tool.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean);
65
+ const dirs = tools.map((key) => {
66
+ const p = TOOL_PRESETS.find((x) => x.key === key);
67
+ return p ? expandHome(p.dir) : null;
68
+ });
69
+ if (dirs.some((d) => d === null)) return null;
70
+ return Array.from(new Set(dirs));
71
+ }
72
+
73
+ function printHelp() {
74
+ console.log(`
75
+ divergent-thinking-skill — install SKILL.md for agent runtimes.
47
76
 
48
77
  Usage:
49
78
  npx divergent-thinking-skill
79
+ npx divergent-thinking-skill init
50
80
  npx divergent-thinking-skill --dir ~/.agents/skills
51
- npx divergent-thinking-skill --dir ./my-project/.cursor/skills
81
+ npx divergent-thinking-skill --tool codex
82
+ npx divergent-thinking-skill --tool codex,claude
83
+ divergent-thinking init
52
84
 
53
- Environment:
54
- DIVERGENT_THINKING_SKILL_DIR Parent directory for skill folders (default: ~/.agents/skills)
55
- AGENT_SKILLS_DIR Same as above (fallback alias)
85
+ Commands:
86
+ init Interactive setup (detect + multi-select tools)
56
87
 
57
- Install location:
58
- <parent>/divergent-thinking/SKILL.md
88
+ Options:
89
+ --dir <path> Parent skills directory (final: <path>/divergent-thinking/SKILL.md)
90
+ --tool <list> Comma-separated tool keys (e.g. codex,claude,cursor)
91
+ --yes, -y Non-interactive; with init uses detected tools
92
+ -h, --help Show help
59
93
 
60
- Point your tool at the parent "skills" directory per its docs (e.g. ~/.codex/skills, ~/.claude/skills).
94
+ Environment:
95
+ DIVERGENT_THINKING_SKILL_DIR Parent directory for skill folders
96
+ AGENT_SKILLS_DIR Fallback alias
97
+
98
+ Preset defaults:
99
+ ${TOOL_PRESETS.map((t) => ` ${t.key.padEnd(8)} -> ${t.dir}`).join("\n")}
61
100
  `);
62
- process.exit(0);
63
- }
101
+ }
64
102
 
65
- const parent = outDir || defaultSkillsRoot();
103
+ function installTo(parent) {
66
104
  const destDir = path.join(parent, "divergent-thinking");
67
105
  const src = path.join(__dirname, "..", "skill", "SKILL.md");
68
106
  const dest = path.join(destDir, "SKILL.md");
@@ -78,4 +116,88 @@ Point your tool at the parent "skills" directory per its docs (e.g. ~/.codex/ski
78
116
  console.log("Parent skills directory:", path.resolve(parent));
79
117
  }
80
118
 
81
- main();
119
+ function detectedTools() {
120
+ return TOOL_PRESETS.filter((t) => fs.existsSync(expandHome(t.dir)));
121
+ }
122
+
123
+ async function interactiveInit() {
124
+ const { checkbox, input } = await import("@inquirer/prompts");
125
+ const detected = detectedTools();
126
+ const detectedNames = detected.length
127
+ ? detected.map((t) => t.name).join(", ")
128
+ : "none";
129
+ console.log(`Detected tool directories: ${detectedNames}`);
130
+
131
+ const choices = TOOL_PRESETS.map((tool) => ({
132
+ name: `${tool.name}${detected.some((d) => d.key === tool.key) ? " (detected)" : ""} [${tool.dir}]`,
133
+ value: tool.key,
134
+ checked: detected.some((d) => d.key === tool.key),
135
+ }));
136
+ choices.push({ name: "Custom path", value: "__custom__", checked: false });
137
+
138
+ const selected = await checkbox({
139
+ message: `Select tools to set up (${choices.length - 1} available)`,
140
+ choices,
141
+ loop: false,
142
+ });
143
+
144
+ if (!selected.length) {
145
+ console.log("No tools selected. Nothing installed.");
146
+ return;
147
+ }
148
+
149
+ let parents = selected
150
+ .filter((v) => v !== "__custom__")
151
+ .map((key) => TOOL_PRESETS.find((t) => t.key === key))
152
+ .filter(Boolean)
153
+ .map((t) => expandHome(t.dir));
154
+
155
+ if (selected.includes("__custom__")) {
156
+ const custom = await input({ message: "Enter parent skills directory for custom target" });
157
+ if (custom && custom.trim()) {
158
+ parents.push(expandHome(custom.trim()));
159
+ }
160
+ }
161
+
162
+ parents = Array.from(new Set(parents));
163
+ for (const parent of parents) {
164
+ installTo(parent);
165
+ }
166
+ }
167
+
168
+ async function main() {
169
+ const { outDir, help, init, tool, yes } = parseArgs(process.argv);
170
+ if (help) {
171
+ printHelp();
172
+ process.exit(0);
173
+ }
174
+
175
+ if (init) {
176
+ if (yes) {
177
+ const detected = detectedTools();
178
+ if (!detected.length) {
179
+ console.log("No detected tool directories. Falling back to ~/.agents/skills");
180
+ installTo(defaultSkillsRoot());
181
+ return;
182
+ }
183
+ for (const t of detected) installTo(expandHome(t.dir));
184
+ return;
185
+ }
186
+ await interactiveInit();
187
+ return;
188
+ }
189
+
190
+ const fromToolPreset = resolvePreset(tool);
191
+ if (tool && !fromToolPreset) {
192
+ console.error(`Unknown --tool value: ${tool}. Use one or more of: ${TOOL_PRESETS.map((t) => t.key).join(", ")}.`);
193
+ process.exit(1);
194
+ }
195
+
196
+ const parents = outDir ? [outDir] : fromToolPreset || [defaultSkillsRoot()];
197
+ for (const parent of parents) installTo(parent);
198
+ }
199
+
200
+ main().catch((err) => {
201
+ console.error(err && err.stack ? err.stack : String(err));
202
+ process.exit(1);
203
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "divergent-thinking-skill",
3
- "version": "1.0.0",
3
+ "version": "1.2.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",
@@ -30,5 +31,8 @@
30
31
  },
31
32
  "engines": {
32
33
  "node": ">=18"
34
+ },
35
+ "dependencies": {
36
+ "@inquirer/prompts": "^8.4.1"
33
37
  }
34
38
  }