nex-framework-cli 1.0.4 → 1.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/cli/nex-cli.js CHANGED
@@ -135,11 +135,20 @@ agentCmd
135
135
  .command('list')
136
136
  .alias('ls')
137
137
  .description('Lista agentes instalados')
138
- .option('-a, --all', 'Mostrar todos os agentes')
138
+ .option('-a, --all', 'Mostrar todos os agentes disponíveis no marketplace')
139
+ .option('-c, --category <category>', 'Filtrar por categoria')
140
+ .option('--official', 'Apenas agentes oficiais')
139
141
  .action(async (options) => {
140
142
  const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
141
143
  const marketplace = new NEXMarketplace()
142
- await marketplace.list(options)
144
+
145
+ if (options.all) {
146
+ // Listar todos os agentes disponíveis no marketplace
147
+ await marketplace.listAll(options)
148
+ } else {
149
+ // Listar apenas agentes instalados
150
+ await marketplace.list(options)
151
+ }
143
152
  })
144
153
 
145
154
  // agent info
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nex-framework-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "NEX CLI - Command-line interface for NEX Framework and Agent Marketplace",
5
5
  "type": "module",
6
6
  "main": "cli/nex-cli.js",
@@ -165,6 +165,84 @@ export default class NEXMarketplace {
165
165
  return agents || []
166
166
  }
167
167
 
168
+ /**
169
+ * List all available agents (browse marketplace)
170
+ */
171
+ async listAll(options = {}) {
172
+ const spinner = ora('Loading available agents...').start()
173
+
174
+ try {
175
+ let results = []
176
+
177
+ // List from API/Remote if available
178
+ if (this.apiUrl) {
179
+ results = await this.listAllViaAPI(options)
180
+ } else if (this.supabase) {
181
+ results = await this.listAllViaClient(options)
182
+ }
183
+
184
+ // Also include local registry
185
+ const localResults = await this.searchLocal('', options)
186
+
187
+ // Merge results
188
+ const merged = this.mergeResults(results, localResults)
189
+
190
+ spinner.succeed(`Found ${merged.length} available agents`)
191
+
192
+ // Display results
193
+ this.displaySearchResults(merged)
194
+
195
+ return merged
196
+
197
+ } catch (error) {
198
+ spinner.fail('Failed to load agents')
199
+ console.error(chalk.red(`Error: ${error.message}`))
200
+ throw error
201
+ }
202
+ }
203
+
204
+ /**
205
+ * List all agents via Edge Function API
206
+ */
207
+ async listAllViaAPI(options = {}) {
208
+ const response = await fetch(`${this.apiUrl}/list`)
209
+
210
+ if (!response.ok) {
211
+ throw new Error(`API error: ${response.statusText}`)
212
+ }
213
+
214
+ const { agents } = await response.json()
215
+ return agents || []
216
+ }
217
+
218
+ /**
219
+ * List all agents via Supabase client (fallback)
220
+ */
221
+ async listAllViaClient(options = {}) {
222
+ let query = this.supabase
223
+ .from('nex_marketplace_agents')
224
+ .select('*')
225
+ .eq('is_active', true)
226
+ .order('total_installs', { ascending: false })
227
+
228
+ if (options.category) {
229
+ query = query.eq('category', options.category)
230
+ }
231
+
232
+ if (options.official) {
233
+ query = query.eq('is_official', true)
234
+ }
235
+
236
+ const limit = options.limit || 100
237
+ query = query.limit(limit)
238
+
239
+ const { data, error } = await query
240
+
241
+ if (error) throw error
242
+
243
+ return data || []
244
+ }
245
+
168
246
  /**
169
247
  * Search via Supabase client (fallback - requer anon key)
170
248
  */