@clue-ai/cli 0.0.7 → 0.0.8
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 +4 -4
- package/package.json +1 -1
- package/src/setup-prepare.mjs +81 -9
package/README.md
CHANGED
|
@@ -66,10 +66,10 @@ detected service.
|
|
|
66
66
|
|
|
67
67
|
## Required Environment
|
|
68
68
|
|
|
69
|
-
- `CLUE_API_KEY
|
|
70
|
-
- `CLUE_AI_PROVIDER_API_KEY`
|
|
71
|
-
- `CLUE_AI_PROVIDER`
|
|
72
|
-
- `CLUE_AI_MODEL`
|
|
69
|
+
- `CLUE_API_KEY`: Clue setup screen issues this value.
|
|
70
|
+
- `CLUE_AI_PROVIDER_API_KEY`: the customer's AI provider key, not a Clue key. For Codex/OpenAI, create it at `https://platform.openai.com/api-keys`. For Claude Code/Anthropic, create it at `https://console.anthropic.com/settings/keys`.
|
|
71
|
+
- `CLUE_AI_PROVIDER`: generated from setup target when possible: `codex -> openai`, `claude_code -> anthropic`.
|
|
72
|
+
- `CLUE_AI_MODEL`: generated with a concrete default. OpenAI examples: `gpt-5.4-mini`, `gpt-5.5`, `gpt-5.4-nano`. Anthropic examples: `claude-sonnet-4-6`, `claude-opus-4-7`, `claude-haiku-4-5-20251001`.
|
|
73
73
|
|
|
74
74
|
`clue-ai semantic-gen` runs semantic AI inside the customer repository CI with
|
|
75
75
|
the customer-configured AI provider key. Clue receives only the final
|
package/package.json
CHANGED
package/src/setup-prepare.mjs
CHANGED
|
@@ -10,6 +10,62 @@ const DEFAULT_SETUP_MANIFEST_PATH = ".clue/setup-manifest.json";
|
|
|
10
10
|
const DEFAULT_ENV_GUIDE_PATH = ".env.clue";
|
|
11
11
|
const BROWSER_INGEST_PATH = "/api/v1/ingest/browser";
|
|
12
12
|
const BACKEND_INGEST_PATH = "/api/v1/ingest/backend";
|
|
13
|
+
const AI_PROVIDER_GUIDES = {
|
|
14
|
+
codex: {
|
|
15
|
+
provider: "openai",
|
|
16
|
+
apiKeyValue: "<openai-api-key>",
|
|
17
|
+
model: "gpt-5.4-mini",
|
|
18
|
+
secretComments: [
|
|
19
|
+
"Codexを選んだ場合はOpenAIのAPI keyを使います。",
|
|
20
|
+
"https://platform.openai.com/api-keys で作成して、GitHub Secretに保存してください。",
|
|
21
|
+
"ここにはClue API keyではなく、OpenAI API keyを入れてください。",
|
|
22
|
+
],
|
|
23
|
+
providerComments: [
|
|
24
|
+
"setup targetがcodexのため、providerはopenaiで自動設定しています。",
|
|
25
|
+
],
|
|
26
|
+
modelComments: [
|
|
27
|
+
"まず迷ったら gpt-5.4-mini を使ってください。",
|
|
28
|
+
"精度を優先する場合の例: gpt-5.5",
|
|
29
|
+
"コストを優先する場合の例: gpt-5.4-nano",
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
claude_code: {
|
|
33
|
+
provider: "anthropic",
|
|
34
|
+
apiKeyValue: "<anthropic-api-key>",
|
|
35
|
+
model: "claude-sonnet-4-6",
|
|
36
|
+
secretComments: [
|
|
37
|
+
"Claude Codeを選んだ場合はAnthropicのAPI keyを使います。",
|
|
38
|
+
"https://console.anthropic.com/settings/keys で作成して、GitHub Secretに保存してください。",
|
|
39
|
+
"ここにはClue API keyではなく、Anthropic API keyを入れてください。",
|
|
40
|
+
],
|
|
41
|
+
providerComments: [
|
|
42
|
+
"setup targetがclaude_codeのため、providerはanthropicで自動設定しています。",
|
|
43
|
+
],
|
|
44
|
+
modelComments: [
|
|
45
|
+
"まず迷ったら claude-sonnet-4-6 を使ってください。",
|
|
46
|
+
"精度を優先する場合の例: claude-opus-4-7",
|
|
47
|
+
"コストを優先する場合の例: claude-haiku-4-5-20251001",
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
const GENERIC_AI_PROVIDER_GUIDE = {
|
|
52
|
+
provider: "<openai-or-anthropic>",
|
|
53
|
+
apiKeyValue: "<provider-api-key>",
|
|
54
|
+
model: "<provider-model>",
|
|
55
|
+
secretComments: [
|
|
56
|
+
"OpenAIまたはAnthropicのAPI keyを作成し、GitHub Secretに保存してください。",
|
|
57
|
+
"OpenAI: https://platform.openai.com/api-keys",
|
|
58
|
+
"Anthropic: https://console.anthropic.com/settings/keys",
|
|
59
|
+
"ここにはClue API keyではなく、選択したAI providerのAPI keyを入れてください。",
|
|
60
|
+
],
|
|
61
|
+
providerComments: [
|
|
62
|
+
"codexを使う場合はopenai、claude_codeを使う場合はanthropicを指定してください。",
|
|
63
|
+
],
|
|
64
|
+
modelComments: [
|
|
65
|
+
"OpenAIの例: gpt-5.4-mini / gpt-5.5 / gpt-5.4-nano",
|
|
66
|
+
"Anthropicの例: claude-sonnet-4-6 / claude-opus-4-7 / claude-haiku-4-5-20251001",
|
|
67
|
+
],
|
|
68
|
+
};
|
|
13
69
|
|
|
14
70
|
const writeJson = async ({ repoRoot, path, value }) => {
|
|
15
71
|
const absolutePath = join(resolve(repoRoot), path);
|
|
@@ -88,6 +144,9 @@ const trimTrailingSlash = (value) => String(value).replace(/\/+$/, "");
|
|
|
88
144
|
|
|
89
145
|
const buildEndpoint = (baseUrl, path) => `${trimTrailingSlash(baseUrl)}${path}`;
|
|
90
146
|
|
|
147
|
+
const aiProviderGuideForTarget = (target) =>
|
|
148
|
+
AI_PROVIDER_GUIDES[target] ?? GENERIC_AI_PROVIDER_GUIDE;
|
|
149
|
+
|
|
91
150
|
const setupContextFromInput = (input = {}) => ({
|
|
92
151
|
clue_api_key: optionalString(input.clueApiKey),
|
|
93
152
|
clue_api_base_url: optionalString(input.clueApiBaseUrl),
|
|
@@ -140,6 +199,7 @@ const buildEnvironmentInstructions = ({ manifest, setupContext }) => {
|
|
|
140
199
|
}
|
|
141
200
|
|
|
142
201
|
const watchTargets = manifest.lifecycle_verification.watch_targets;
|
|
202
|
+
const aiProviderGuide = aiProviderGuideForTarget(manifest.target);
|
|
143
203
|
return {
|
|
144
204
|
status: "ready",
|
|
145
205
|
env_file_path: DEFAULT_ENV_GUIDE_PATH,
|
|
@@ -157,17 +217,33 @@ const buildEnvironmentInstructions = ({ manifest, setupContext }) => {
|
|
|
157
217
|
{ name: "CLUE_API_KEY", value: setupContext.clue_api_key },
|
|
158
218
|
{
|
|
159
219
|
name: "CLUE_AI_PROVIDER_API_KEY",
|
|
160
|
-
value:
|
|
220
|
+
value: aiProviderGuide.apiKeyValue,
|
|
221
|
+
comments: aiProviderGuide.secretComments,
|
|
161
222
|
},
|
|
162
223
|
],
|
|
163
224
|
variables: [
|
|
164
|
-
{
|
|
165
|
-
|
|
225
|
+
{
|
|
226
|
+
name: "CLUE_AI_PROVIDER",
|
|
227
|
+
value: aiProviderGuide.provider,
|
|
228
|
+
comments: aiProviderGuide.providerComments,
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "CLUE_AI_MODEL",
|
|
232
|
+
value: aiProviderGuide.model,
|
|
233
|
+
comments: aiProviderGuide.modelComments,
|
|
234
|
+
},
|
|
166
235
|
],
|
|
167
236
|
},
|
|
168
237
|
};
|
|
169
238
|
};
|
|
170
239
|
|
|
240
|
+
const renderEnvironmentEntry = (entry) => [
|
|
241
|
+
...(Array.isArray(entry.comments)
|
|
242
|
+
? entry.comments.map((comment) => `# ${comment}`)
|
|
243
|
+
: []),
|
|
244
|
+
`${entry.name}=${entry.value}`,
|
|
245
|
+
];
|
|
246
|
+
|
|
171
247
|
const buildEnvironmentGuideText = (instructions) => {
|
|
172
248
|
if (!instructions || instructions.status !== "ready") return null;
|
|
173
249
|
const lines = [
|
|
@@ -186,17 +262,13 @@ const buildEnvironmentGuideText = (instructions) => {
|
|
|
186
262
|
}
|
|
187
263
|
lines.push(
|
|
188
264
|
"GitHub Secrets",
|
|
189
|
-
...instructions.ci_github.secrets.
|
|
190
|
-
(entry) => `${entry.name}=${entry.value}`,
|
|
191
|
-
),
|
|
265
|
+
...instructions.ci_github.secrets.flatMap(renderEnvironmentEntry),
|
|
192
266
|
"",
|
|
193
267
|
);
|
|
194
268
|
if (instructions.ci_github.variables.length > 0) {
|
|
195
269
|
lines.push(
|
|
196
270
|
"GitHub Variables",
|
|
197
|
-
...instructions.ci_github.variables.
|
|
198
|
-
(entry) => `${entry.name}=${entry.value}`,
|
|
199
|
-
),
|
|
271
|
+
...instructions.ci_github.variables.flatMap(renderEnvironmentEntry),
|
|
200
272
|
"",
|
|
201
273
|
);
|
|
202
274
|
}
|