project-compass 4.0.5 → 4.0.6

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": "project-compass",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "Futuristic project navigator and runner for Node, Python, Rust, and Go",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -47,6 +47,8 @@ Return ONLY a JSON object with this structure: {"build": "cmd", "run": "cmd", "i
47
47
  Use the project's detected type (${selectedProject.type}) to ensure commands are correct (e.g., npm, pip, cargo).`;
48
48
 
49
49
  let response;
50
+ let aiText = '';
51
+
50
52
  if (provider.id === 'openrouter') {
51
53
  response = await fetch(provider.endpoint, {
52
54
  method: 'POST',
@@ -61,17 +63,49 @@ Use the project's detected type (${selectedProject.type}) to ensure commands are
61
63
  messages: [{ role: 'user', content: prompt }]
62
64
  })
63
65
  });
64
- } else {
65
- // Fallback for others or throw unimplemented for now to avoid "fake" results
66
- throw new Error(`Real-time agentic analysis for ${provider.name} is arriving in the next patch. Use OpenRouter for live testing now.`);
66
+ const data = await response.json();
67
+ if (!response.ok) throw new Error(data.error?.message || 'OpenRouter Error');
68
+ aiText = data.choices[0].message.content;
69
+ } else if (provider.id === 'gemini') {
70
+ const url = provider.endpoint.replace('{model}', model) + `?key=${token}`;
71
+ response = await fetch(url, {
72
+ method: 'POST',
73
+ headers: { 'Content-Type': 'application/json' },
74
+ body: JSON.stringify({ contents: [{ parts: [{ text: prompt }] }] })
75
+ });
76
+ const data = await response.json();
77
+ if (!response.ok) throw new Error(data.error?.message || 'Gemini Error');
78
+ aiText = data.candidates[0].content.parts[0].text;
79
+ } else if (provider.id === 'claude') {
80
+ response = await fetch(provider.endpoint, {
81
+ method: 'POST',
82
+ headers: {
83
+ 'x-api-key': token,
84
+ 'anthropic-version': '2023-06-01',
85
+ 'Content-Type': 'application/json'
86
+ },
87
+ body: JSON.stringify({
88
+ model: model,
89
+ max_tokens: 1024,
90
+ messages: [{ role: 'user', content: prompt }]
91
+ })
92
+ });
93
+ const data = await response.json();
94
+ if (!response.ok) throw new Error(data.error?.message || 'Claude Error');
95
+ aiText = data.content[0].text;
96
+ } else if (provider.id === 'ollama') {
97
+ response = await fetch(provider.endpoint, {
98
+ method: 'POST',
99
+ headers: { 'Content-Type': 'application/json' },
100
+ body: JSON.stringify({ model: model, prompt: prompt, stream: false })
101
+ });
102
+ const data = await response.json();
103
+ if (!response.ok) throw new Error(data.error || 'Ollama Error');
104
+ aiText = data.response;
67
105
  }
68
106
 
69
- const data = await response.json();
70
- if (!response.ok) throw new Error(data.error?.message || 'Authentication failed. Check your token.');
71
-
72
- const aiText = data.choices[0].message.content;
73
107
  const jsonMatch = aiText.match(/{.*?}/s);
74
- if (!jsonMatch) throw new Error("AI returned invalid DNA mapping. Try a different model.");
108
+ if (!jsonMatch) throw new Error("AI returned invalid DNA mapping format.");
75
109
 
76
110
  const parsed = JSON.parse(jsonMatch[0]);
77
111
  const mapped = [