@neikyun/ciel 5.2.5 → 5.2.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neikyun/ciel",
3
- "version": "5.2.5",
3
+ "version": "5.2.7",
4
4
  "description": "Ciel — Deep-reasoning pipeline for LLM-assisted development. OpenCode plugin + multi-platform CLI (OpenCode, Claude Code, more).",
5
5
  "main": "./dist/plugin/index.js",
6
6
  "types": "./dist/plugin/index.d.ts",
@@ -33,6 +33,14 @@ function resolveAssets() {
33
33
  return null;
34
34
  }
35
35
 
36
+ function detectCLI(name) {
37
+ try {
38
+ const { execSync } = require("child_process");
39
+ const r = execSync(name + " --version 2>&1", { stdio: "pipe", timeout: 3000, encoding: "utf8" });
40
+ return r.length > 0 && !r.includes("not found");
41
+ } catch { return false; }
42
+ }
43
+
36
44
  // ---- Installation ----
37
45
  function copyDir(src, dest) {
38
46
  if (!existsSync(src)) return 0;
@@ -82,6 +90,7 @@ function installClaude(targetDir, assets) {
82
90
  let count = 0;
83
91
  count += copyDir(join(assets, ".claude/agents"), join(targetDir, ".claude/agents"));
84
92
  count += copyDir(join(assets, ".claude/hooks"), join(targetDir, ".claude/hooks"));
93
+ count += copyDir(join(assets, "commands"), join(targetDir, ".claude/commands"));
85
94
  const settings = join(assets, ".claude/settings.json");
86
95
  if (existsSync(settings)) { copyFileSync(settings, join(targetDir, ".claude/settings.json")); count++; }
87
96
  const claudeMd = join(assets, "CLAUDE.md");
@@ -108,25 +117,55 @@ async function main() {
108
117
  }
109
118
 
110
119
  if (platforms.length === 0) {
111
- // Aucune plateforme détectée → proposer de créer opencode.json
112
- let creer = !process.stdin.isTTY; // auto en non-TTY
120
+ // Aucune plateforme détectée → chercher les CLIs installées
121
+ const hasOpenCode = detectCLI("opencode");
122
+ const hasClaude = detectCLI("claude");
123
+
124
+ if (!hasOpenCode && !hasClaude) {
125
+ console.error(` ${yellow("~")} Aucune plateforme détectée.`);
126
+ console.error(` Installez ${cyan("opencode")} ou ${cyan("claude")} puis relancez.`);
127
+ console.error(` Ou: ${green("npx ciel init")}\n`);
128
+ return;
129
+ }
130
+
131
+ // Proposer de configurer les CLIs détectées
132
+ let creer = !process.stdin.isTTY;
113
133
  if (process.stdin.isTTY) {
134
+ const detected = [hasOpenCode && "OpenCode", hasClaude && "Claude Code"].filter(Boolean).join(" + ");
114
135
  try {
115
136
  const readline = require("readline");
116
137
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
117
- creer = await new Promise(r => rl.question(` ${yellow("?")} Configurer Ciel pour OpenCode ? ${green("(Y/n)")} `, a => { rl.close(); r(a.trim().toLowerCase() !== "n"); }));
138
+ creer = await new Promise(r => rl.question(` ${yellow("?")} Configurer Ciel pour ${cyan(detected)} ? ${green("(Y/n)")} `, a => { rl.close(); r(a.trim().toLowerCase() !== "n"); }));
118
139
  } catch { creer = true; }
119
140
  }
120
- if (creer) {
121
- // Créer opencode.json
141
+
142
+ if (!creer) {
143
+ console.error(` ${cyan("→")} Annulé. Utilisez ${green("npx ciel init")} plus tard.\n`);
144
+ return;
145
+ }
146
+
147
+ // Configurer les plateformes détectées
148
+ if (hasOpenCode) {
122
149
  const cfgPath = join(targetDir, "opencode.json");
123
- const cfg = { $schema: "https://opencode.ai/config.json", plugin: ["@neikyun/ciel"] };
124
- writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
125
- console.error(` ${green("✓")} opencode.json créé avec le plugin ${cyan("@neikyun/ciel")}`);
150
+ if (!existsSync(cfgPath)) {
151
+ const cfg = { $schema: "https://opencode.ai/config.json", plugin: ["@neikyun/ciel"] };
152
+ writeFileSync(cfgPath, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
153
+ console.error(` ${green("✓")} opencode.json créé`);
154
+ }
126
155
  platforms.push("OpenCode");
127
- } else {
128
- console.error(` ${cyan("→")} Utilisez ${green("npx ciel init")} plus tard.\n`);
129
- return;
156
+ }
157
+
158
+ if (hasClaude) {
159
+ const claudeDir = join(targetDir, ".claude");
160
+ if (!existsSync(claudeDir)) {
161
+ mkdirSync(claudeDir, { recursive: true });
162
+ }
163
+ const settingsPath = join(claudeDir, "settings.json");
164
+ if (!existsSync(settingsPath)) {
165
+ writeFileSync(settingsPath, JSON.stringify({}, null, 2) + "\n", "utf-8");
166
+ console.error(` ${green("✓")} .claude/settings.json créé`);
167
+ }
168
+ platforms.push("Claude Code");
130
169
  }
131
170
  }
132
171