@exchanet/enet 1.0.16 → 1.0.17
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 +1 -1
- package/src/commands/update.js +12 -3
package/package.json
CHANGED
package/src/commands/update.js
CHANGED
|
@@ -4,7 +4,7 @@ import fs from 'fs-extra'
|
|
|
4
4
|
import path from 'path'
|
|
5
5
|
import readline from 'readline'
|
|
6
6
|
import { getAllMethods, getMethod, fetchFromGitHub, readInstallRecord, writeInstallRecord } from '../utils/registry.js'
|
|
7
|
-
import { detectSystemAgents, getInstallPath, AGENTS } from '../utils/agent_detector.js'
|
|
7
|
+
import { detectSystemAgents, detectAgent, getInstallPath, AGENTS } from '../utils/agent_detector.js'
|
|
8
8
|
import { installForAgent } from './install.js'
|
|
9
9
|
|
|
10
10
|
export async function updateCommand(methodId, options) {
|
|
@@ -27,11 +27,20 @@ export async function updateCommand(methodId, options) {
|
|
|
27
27
|
console.log(chalk.bold('\n ◆ enet update\n'))
|
|
28
28
|
|
|
29
29
|
let totalUpdated = 0, totalAdded = 0, totalSkipped = 0
|
|
30
|
+
const currentAgent = await detectAgent()
|
|
30
31
|
|
|
31
32
|
for (const method of targets) {
|
|
32
|
-
|
|
33
|
+
let record = await readInstallRecord(method.id)
|
|
34
|
+
|
|
35
|
+
// If no record but adapter file exists (e.g. list shows "installed"), treat as installed for current agent
|
|
36
|
+
if ((!record || record.agents.length === 0) && currentAgent) {
|
|
37
|
+
const pathForCurrent = getInstallPath(currentAgent, method.id)
|
|
38
|
+
if (await fs.pathExists(pathForCurrent)) {
|
|
39
|
+
record = { agents: [currentAgent.key], version: record?.version, updatedAt: record?.updatedAt }
|
|
40
|
+
await writeInstallRecord(method.id, { agents: record.agents, version: method.version })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
33
43
|
|
|
34
|
-
// Skip methods not installed at all
|
|
35
44
|
if (!record || record.agents.length === 0) {
|
|
36
45
|
totalSkipped++
|
|
37
46
|
console.log(chalk.dim(` ${method.name} — not installed, skipping`))
|