@exchanet/enet 1.0.13 → 1.0.14
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/index.js +2 -2
- package/src/utils/registry.js +8 -15
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -77,7 +77,7 @@ program
|
|
|
77
77
|
program
|
|
78
78
|
.command('init')
|
|
79
79
|
.description('Interactively create a manifest.json for a new module')
|
|
80
|
-
.option('-n, --name <
|
|
80
|
+
.option('-n, --name <n>', 'Module name')
|
|
81
81
|
.option('-s, --section <section>', 'Admin Panel section')
|
|
82
82
|
.option('--json', 'Print manifest as JSON without writing to disk')
|
|
83
83
|
.action(initCommand)
|
|
@@ -90,7 +90,7 @@ program
|
|
|
90
90
|
.action(validateCommand)
|
|
91
91
|
|
|
92
92
|
program
|
|
93
|
-
.command('new <type> <
|
|
93
|
+
.command('new <type> <n>')
|
|
94
94
|
.description('Scaffold a new module, ui-pack or integration')
|
|
95
95
|
.option('-s, --section <section>', 'Admin Panel section')
|
|
96
96
|
.option('--dry-run', 'Preview files without writing')
|
package/src/utils/registry.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path'
|
|
|
3
3
|
import { fileURLToPath } from 'url'
|
|
4
4
|
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
6
|
-
const RAW_BASE
|
|
6
|
+
const RAW_BASE = 'https://raw.githubusercontent.com'
|
|
7
7
|
const REGISTRY_URL = `${RAW_BASE}/exchanet/enet/main/registry.json`
|
|
8
8
|
const CACHE_FILE = path.join(__dirname, '../../.registry-cache.json')
|
|
9
9
|
const CACHE_TTL_MS = 1000 * 60 * 60 // 1 hour
|
|
@@ -82,7 +82,7 @@ export async function fetchFromGitHub(repo, filePath) {
|
|
|
82
82
|
// ── Install state ─────────────────────────────────────────────────────────────
|
|
83
83
|
//
|
|
84
84
|
// Tracks which agents have each method installed.
|
|
85
|
-
// Stored in
|
|
85
|
+
// Stored in <project>/.enet/installed.json
|
|
86
86
|
//
|
|
87
87
|
// Format:
|
|
88
88
|
// {
|
|
@@ -90,19 +90,15 @@ export async function fetchFromGitHub(repo, filePath) {
|
|
|
90
90
|
// "agents": ["cursor", "claudecode", "antigravity"],
|
|
91
91
|
// "version": "3.0.0",
|
|
92
92
|
// "updatedAt": "2025-03-01T10:00:00.000Z"
|
|
93
|
-
// }
|
|
94
|
-
// "modular-design": { ... }
|
|
93
|
+
// }
|
|
95
94
|
// }
|
|
96
95
|
|
|
97
96
|
function getInstallRecordFile() {
|
|
98
|
-
// Resolve relative to cwd so it works in any project
|
|
99
97
|
return path.join(process.cwd(), '.enet', 'installed.json')
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
/**
|
|
103
|
-
*
|
|
104
|
-
* Returns { agents: ['cursor', ...], version: '3.0.0', updatedAt: '...' }
|
|
105
|
-
* or null if the method has never been installed.
|
|
101
|
+
* Returns the install record for a single method, or null if never installed.
|
|
106
102
|
*/
|
|
107
103
|
export async function readInstallRecord(methodId) {
|
|
108
104
|
try {
|
|
@@ -116,25 +112,22 @@ export async function readInstallRecord(methodId) {
|
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
/**
|
|
119
|
-
* Writes
|
|
120
|
-
* Merges with existing records — other methods are
|
|
115
|
+
* Writes the install record for a single method.
|
|
116
|
+
* Merges with existing records — other methods are never touched.
|
|
121
117
|
*/
|
|
122
118
|
export async function writeInstallRecord(methodId, record) {
|
|
123
119
|
try {
|
|
124
120
|
const file = getInstallRecordFile()
|
|
125
121
|
await fs.ensureDir(path.dirname(file))
|
|
126
|
-
|
|
127
122
|
let data = {}
|
|
128
123
|
if (await fs.pathExists(file)) {
|
|
129
124
|
data = await fs.readJson(file).catch(() => ({}))
|
|
130
125
|
}
|
|
131
|
-
|
|
132
126
|
data[methodId] = {
|
|
133
|
-
agents:
|
|
134
|
-
version:
|
|
127
|
+
agents: record.agents,
|
|
128
|
+
version: record.version ?? null,
|
|
135
129
|
updatedAt: new Date().toISOString()
|
|
136
130
|
}
|
|
137
|
-
|
|
138
131
|
await fs.writeJson(file, data, { spaces: 2 })
|
|
139
132
|
} catch {
|
|
140
133
|
// Non-fatal — install works correctly even if state cannot be saved
|