homegraph 1.5.2 → 1.5.4
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/CHANGELOG.md +156 -0
- package/README.md +63 -10
- package/dist/addons/dynamic-import.d.ts +18 -0
- package/dist/addons/dynamic-import.d.ts.map +1 -0
- package/dist/addons/dynamic-import.js +25 -0
- package/dist/addons/dynamic-import.js.map +1 -0
- package/dist/addons/init-template.d.ts +15 -0
- package/dist/addons/init-template.d.ts.map +1 -0
- package/dist/addons/init-template.js +290 -0
- package/dist/addons/init-template.js.map +1 -0
- package/dist/addons/loader.d.ts +18 -0
- package/dist/addons/loader.d.ts.map +1 -0
- package/dist/addons/loader.js +88 -0
- package/dist/addons/loader.js.map +1 -0
- package/dist/addons/manager.d.ts +106 -0
- package/dist/addons/manager.d.ts.map +1 -0
- package/dist/addons/manager.js +437 -0
- package/dist/addons/manager.js.map +1 -0
- package/dist/addons/paths.d.ts +22 -0
- package/dist/addons/paths.d.ts.map +1 -0
- package/dist/addons/paths.js +65 -0
- package/dist/addons/paths.js.map +1 -0
- package/dist/addons/registry.d.ts +38 -0
- package/dist/addons/registry.d.ts.map +1 -0
- package/dist/addons/registry.js +160 -0
- package/dist/addons/registry.js.map +1 -0
- package/dist/addons/semver.d.ts +21 -0
- package/dist/addons/semver.d.ts.map +1 -0
- package/dist/addons/semver.js +79 -0
- package/dist/addons/semver.js.map +1 -0
- package/dist/addons/types.d.ts +51 -0
- package/dist/addons/types.d.ts.map +1 -0
- package/dist/addons/types.js +14 -0
- package/dist/addons/types.js.map +1 -0
- package/dist/addons/validate.d.ts +38 -0
- package/dist/addons/validate.d.ts.map +1 -0
- package/dist/addons/validate.js +165 -0
- package/dist/addons/validate.js.map +1 -0
- package/dist/arkui/index.d.ts +4 -0
- package/dist/arkui/index.d.ts.map +1 -0
- package/dist/arkui/index.js +23 -0
- package/dist/arkui/index.js.map +1 -0
- package/dist/arkui/migrate-passage.d.ts +28 -0
- package/dist/arkui/migrate-passage.d.ts.map +1 -0
- package/dist/arkui/migrate-passage.js +310 -0
- package/dist/arkui/migrate-passage.js.map +1 -0
- package/dist/arkui/migrate-semantics.d.ts +47 -0
- package/dist/arkui/migrate-semantics.d.ts.map +1 -0
- package/dist/arkui/migrate-semantics.js +229 -0
- package/dist/arkui/migrate-semantics.js.map +1 -0
- package/dist/arkui/migrate-snapshot.d.ts +79 -0
- package/dist/arkui/migrate-snapshot.d.ts.map +1 -0
- package/dist/arkui/migrate-snapshot.js +364 -0
- package/dist/arkui/migrate-snapshot.js.map +1 -0
- package/dist/bin/addon-commands.d.ts +27 -0
- package/dist/bin/addon-commands.d.ts.map +1 -0
- package/dist/bin/addon-commands.js +254 -0
- package/dist/bin/addon-commands.js.map +1 -0
- package/dist/bin/fatal-handler.js +2 -2
- package/dist/bin/homegraph.js +111 -157
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/bin/node-version-check.d.ts +6 -15
- package/dist/bin/node-version-check.d.ts.map +1 -1
- package/dist/bin/node-version-check.js +8 -37
- package/dist/bin/node-version-check.js.map +1 -1
- package/dist/db/index.d.ts +36 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +92 -6
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +15 -1
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +42 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +177 -10
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +6 -1
- package/dist/db/sqlite-adapter.d.ts +7 -3
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +44 -3
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/extraction/extraction-version.d.ts +1 -1
- package/dist/extraction/extraction-version.js +1 -1
- package/dist/extraction/generated-detection.d.ts +42 -11
- package/dist/extraction/generated-detection.d.ts.map +1 -1
- package/dist/extraction/generated-detection.js +141 -20
- package/dist/extraction/generated-detection.js.map +1 -1
- package/dist/extraction/index.d.ts +42 -0
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +96 -0
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +33 -2
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +525 -129
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +9 -6
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/graph-sources.d.ts +41 -0
- package/dist/graph-sources.d.ts.map +1 -0
- package/dist/graph-sources.js +82 -0
- package/dist/graph-sources.js.map +1 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +79 -9
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +0 -48
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/targets/antigravity.js +1 -1
- package/dist/installer/targets/antigravity.js.map +1 -1
- package/dist/installer/targets/deveco.js +1 -1
- package/dist/installer/targets/deveco.js.map +1 -1
- package/dist/installer/targets/hermes.d.ts +1 -1
- package/dist/installer/targets/hermes.js +2 -2
- package/dist/installer/targets/hermes.js.map +1 -1
- package/dist/installer/targets/opencode.js +1 -1
- package/dist/installer/targets/opencode.js.map +1 -1
- package/dist/installer/targets/shared.js +1 -1
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +5 -4
- package/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.js +28 -13
- package/dist/mcp/daemon-paths.js.map +1 -1
- package/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/dist/mcp/daemon-registry.js +4 -1
- package/dist/mcp/daemon-registry.js.map +1 -1
- package/dist/mcp/daemon.d.ts +1 -1
- package/dist/mcp/daemon.js +1 -1
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +12 -3
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/explore-dedup.d.ts +137 -0
- package/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/dist/mcp/explore-dedup.js +236 -0
- package/dist/mcp/explore-dedup.js.map +1 -0
- package/dist/mcp/explore-repeat-guard.d.ts +123 -0
- package/dist/mcp/explore-repeat-guard.d.ts.map +1 -0
- package/dist/mcp/explore-repeat-guard.js +503 -0
- package/dist/mcp/explore-repeat-guard.js.map +1 -0
- package/dist/mcp/explore-session-state.d.ts +237 -0
- package/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/dist/mcp/explore-session-state.js +353 -0
- package/dist/mcp/explore-session-state.js.map +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +4 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/proxy.d.ts.map +1 -1
- package/dist/mcp/proxy.js +20 -18
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/query-pool.d.ts.map +1 -1
- package/dist/mcp/query-pool.js +10 -13
- package/dist/mcp/query-pool.js.map +1 -1
- package/dist/mcp/query-worker.d.ts +1 -1
- package/dist/mcp/query-worker.js +1 -1
- package/dist/mcp/server-instructions.d.ts +5 -2
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +43 -32
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/session.d.ts +14 -3
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +17 -14
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/startup-handshake.d.ts +1 -1
- package/dist/mcp/startup-handshake.js +1 -1
- package/dist/mcp/tools.d.ts +149 -8
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +4265 -575
- package/dist/mcp/tools.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +166 -0
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/frameworks/arkts-napi.d.ts +14 -0
- package/dist/resolution/frameworks/arkts-napi.d.ts.map +1 -1
- package/dist/resolution/frameworks/arkts-napi.js +169 -49
- package/dist/resolution/frameworks/arkts-napi.js.map +1 -1
- package/dist/search/query-utils.d.ts +157 -5
- package/dist/search/query-utils.d.ts.map +1 -1
- package/dist/search/query-utils.js +1105 -70
- package/dist/search/query-utils.js.map +1 -1
- package/dist/spec/build/scan.js +1 -1
- package/dist/spec/build/scan.js.map +1 -1
- package/dist/spec/build/scope-resolver.d.ts +24 -5
- package/dist/spec/build/scope-resolver.d.ts.map +1 -1
- package/dist/spec/build/scope-resolver.js +76 -10
- package/dist/spec/build/scope-resolver.js.map +1 -1
- package/dist/spec/config.d.ts +8 -0
- package/dist/spec/config.d.ts.map +1 -1
- package/dist/spec/config.js +3 -0
- package/dist/spec/config.js.map +1 -1
- package/dist/spec/evolve/pipeline.d.ts.map +1 -1
- package/dist/spec/evolve/pipeline.js +2 -1
- package/dist/spec/evolve/pipeline.js.map +1 -1
- package/dist/spec/git/commits.d.ts +8 -3
- package/dist/spec/git/commits.d.ts.map +1 -1
- package/dist/spec/git/commits.js +12 -11
- package/dist/spec/git/commits.js.map +1 -1
- package/dist/spec/mine/addon/adapter.d.ts +45 -0
- package/dist/spec/mine/addon/adapter.d.ts.map +1 -0
- package/dist/spec/mine/addon/adapter.js +118 -0
- package/dist/spec/mine/addon/adapter.js.map +1 -0
- package/dist/spec/mine/addon/render.d.ts +20 -0
- package/dist/spec/mine/addon/render.d.ts.map +1 -0
- package/dist/spec/mine/addon/render.js +41 -0
- package/dist/spec/mine/addon/render.js.map +1 -0
- package/dist/spec/mine/addon/types.d.ts +70 -0
- package/dist/spec/mine/addon/types.d.ts.map +1 -0
- package/dist/spec/mine/addon/types.js +14 -0
- package/dist/spec/mine/addon/types.js.map +1 -0
- package/dist/spec/mine/generator.d.ts +5 -1
- package/dist/spec/mine/generator.d.ts.map +1 -1
- package/dist/spec/mine/generator.js +69 -7
- package/dist/spec/mine/generator.js.map +1 -1
- package/dist/spec/mine/pipeline.d.ts.map +1 -1
- package/dist/spec/mine/pipeline.js +5 -1
- package/dist/spec/mine/pipeline.js.map +1 -1
- package/dist/spec/mine/scanner.d.ts +1 -0
- package/dist/spec/mine/scanner.d.ts.map +1 -1
- package/dist/spec/mine/scanner.js +1 -1
- package/dist/spec/mine/scanner.js.map +1 -1
- package/dist/spec/types.d.ts +1 -1
- package/dist/spec/types.d.ts.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/upgrade/index.d.ts +14 -26
- package/dist/upgrade/index.d.ts.map +1 -1
- package/dist/upgrade/index.js +28 -123
- package/dist/upgrade/index.js.map +1 -1
- package/dist/upgrade/remove-binary.d.ts +19 -19
- package/dist/upgrade/remove-binary.d.ts.map +1 -1
- package/dist/upgrade/remove-binary.js +20 -21
- package/dist/upgrade/remove-binary.js.map +1 -1
- package/dist/upgrade/update-check.d.ts +4 -3
- package/dist/upgrade/update-check.d.ts.map +1 -1
- package/dist/upgrade/update-check.js +4 -3
- package/dist/upgrade/update-check.js.map +1 -1
- package/package.json +13 -9
- package/dist/telemetry/index.d.ts +0 -143
- package/dist/telemetry/index.d.ts.map +0 -1
- package/dist/telemetry/index.js +0 -541
- package/dist/telemetry/index.js.map +0 -1
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Addon install management (npm as the install engine).
|
|
4
|
+
*
|
|
5
|
+
* `npm install --prefix <addonsRoot>` handles all package mechanics —
|
|
6
|
+
* resolution, integrity, transitive dependencies, local paths, git URLs —
|
|
7
|
+
* so HomeGraph never reimplements package resolution. The registry records
|
|
8
|
+
* the concrete resolved version (never the requested range) to prevent
|
|
9
|
+
* silent drift.
|
|
10
|
+
*
|
|
11
|
+
* Version policy (v1 of the addon format):
|
|
12
|
+
* - **No silent downgrades.** Re-installing a name that is already
|
|
13
|
+
* registered compares the target version against the installed one and
|
|
14
|
+
* refuses anything older — the user must `remove` first.
|
|
15
|
+
* - **Upgrades preserve the previous version.** The installed package
|
|
16
|
+
* directory is renamed aside to a rollback backup before npm runs; a
|
|
17
|
+
* failed install/validation restores it, so a bad upgrade can never
|
|
18
|
+
* leave the store without the previous working copy.
|
|
19
|
+
*
|
|
20
|
+
* Both policies apply to registry packages and local-path packages alike
|
|
21
|
+
* (a local-path "package" is a symlink npm manages; rename/restore is
|
|
22
|
+
* symmetric). The one carve-out is the name-resolution fallback path
|
|
23
|
+
* (git URLs etc., where the package name is only known *after* npm runs) —
|
|
24
|
+
* it cannot gate or back up in advance.
|
|
25
|
+
*
|
|
26
|
+
* @module addons/manager
|
|
27
|
+
*/
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
+
}) : function(o, v) {
|
|
42
|
+
o["default"] = v;
|
|
43
|
+
});
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.isLocalPathSpec = isLocalPathSpec;
|
|
63
|
+
exports.resolvePackageInfo = resolvePackageInfo;
|
|
64
|
+
exports.resolvePackageName = resolvePackageName;
|
|
65
|
+
exports.installAddon = installAddon;
|
|
66
|
+
exports.removeAddon = removeAddon;
|
|
67
|
+
exports.listAddons = listAddons;
|
|
68
|
+
exports.resolveUpdateSpec = resolveUpdateSpec;
|
|
69
|
+
exports.updateAddon = updateAddon;
|
|
70
|
+
const fs = __importStar(require("fs"));
|
|
71
|
+
const path = __importStar(require("path"));
|
|
72
|
+
const child_process_1 = require("child_process");
|
|
73
|
+
const errors_1 = require("../errors");
|
|
74
|
+
const paths_1 = require("./paths");
|
|
75
|
+
const registry_1 = require("./registry");
|
|
76
|
+
const validate_1 = require("./validate");
|
|
77
|
+
const semver_1 = require("./semver");
|
|
78
|
+
const index_1 = require("../upgrade/index");
|
|
79
|
+
/**
|
|
80
|
+
* Run npm with the given arguments.
|
|
81
|
+
*
|
|
82
|
+
* On Windows `npm.cmd` cannot be spawned directly — CreateProcess rejects
|
|
83
|
+
* `.cmd` files with EINVAL (since the CVE-2024-27980 hardening) — and
|
|
84
|
+
* routing through cmd.exe re-quotes the command line, breaking arguments
|
|
85
|
+
* that contain spaces (e.g. a repository path under a username with
|
|
86
|
+
* spaces). Instead run npm's CLI entry with node.exe, which passes the
|
|
87
|
+
* argument array through verbatim; falls back to the cmd.exe invocation
|
|
88
|
+
* used by the upgrade path when npm-cli.js is absent.
|
|
89
|
+
*/
|
|
90
|
+
function runNpm(args) {
|
|
91
|
+
if (process.platform === 'win32') {
|
|
92
|
+
const npmCli = path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js');
|
|
93
|
+
const { cmd, args: cmdArgs } = fs.existsSync(npmCli)
|
|
94
|
+
? { cmd: process.execPath, args: [npmCli, ...args] }
|
|
95
|
+
: (0, index_1.npmInvocation)(process.platform, args);
|
|
96
|
+
return (0, child_process_1.execFileSync)(cmd, cmdArgs, {
|
|
97
|
+
encoding: 'utf8',
|
|
98
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return (0, child_process_1.execFileSync)('npm', args, {
|
|
102
|
+
encoding: 'utf8',
|
|
103
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Whether an install spec points at a local path (dir or tarball). */
|
|
107
|
+
function isLocalPathSpec(spec) {
|
|
108
|
+
return (spec.startsWith('./') ||
|
|
109
|
+
spec.startsWith('../') ||
|
|
110
|
+
path.isAbsolute(spec) || // POSIX '/…' and Windows drive/UNC absolute paths
|
|
111
|
+
spec.startsWith('file:'));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolve the npm package name and install source for an install spec, or
|
|
115
|
+
* `null` when neither a local package.json nor `npm view` yields a name.
|
|
116
|
+
*
|
|
117
|
+
* - Local paths (`./x`, `../x`, absolute, `file:`) → read package.json.
|
|
118
|
+
* - Everything else (names, scoped names, ranges, dist-tags) → `npm view`.
|
|
119
|
+
*/
|
|
120
|
+
function resolvePackageInfo(pkgSpec) {
|
|
121
|
+
const spec = pkgSpec.trim();
|
|
122
|
+
if (isLocalPathSpec(spec)) {
|
|
123
|
+
const dir = spec.startsWith('file:') ? spec.slice('file:'.length) : spec;
|
|
124
|
+
try {
|
|
125
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(path.resolve(dir), 'package.json'), 'utf-8'));
|
|
126
|
+
if (typeof pkg.name === 'string' && pkg.name.length > 0) {
|
|
127
|
+
return { name: pkg.name, source: 'local' };
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Fall through to npm view for the error path.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
const out = runNpm(['view', spec, 'name', '--json']);
|
|
136
|
+
const parsed = JSON.parse(out.trim());
|
|
137
|
+
if (typeof parsed === 'string' && parsed.length > 0) {
|
|
138
|
+
return { name: parsed, source: 'registry' };
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/** Package name only — compatibility shim over {@link resolvePackageInfo}. */
|
|
147
|
+
function resolvePackageName(pkgSpec) {
|
|
148
|
+
return resolvePackageInfo(pkgSpec)?.name ?? null;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Resolve the concrete version an install spec would install, used by the
|
|
152
|
+
* version gate BEFORE npm touches the store. Local specs read package.json
|
|
153
|
+
* (a missing version resolves to `'0.0.0'` — the same fallback
|
|
154
|
+
* `validateAddonPackage` uses, so a versionless package is a genuine
|
|
155
|
+
* downgrade target and correctly refused). Registry specs ask npm
|
|
156
|
+
* (`npm view <spec> version` — bare specs resolve to the dist-tag).
|
|
157
|
+
*
|
|
158
|
+
* Returns `null` when a registry lookup fails (offline / unknown package):
|
|
159
|
+
* the gate is then SKIPPED — unknown data never refuses an install, and npm
|
|
160
|
+
* itself reports resolution errors.
|
|
161
|
+
*/
|
|
162
|
+
function resolveTargetVersion(pkgSpec, source) {
|
|
163
|
+
if (source === 'local') {
|
|
164
|
+
const spec = pkgSpec.trim();
|
|
165
|
+
const dir = spec.startsWith('file:') ? spec.slice('file:'.length) : spec;
|
|
166
|
+
try {
|
|
167
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(path.resolve(dir), 'package.json'), 'utf-8'));
|
|
168
|
+
return typeof pkg.version === 'string' && pkg.version.length > 0
|
|
169
|
+
? pkg.version
|
|
170
|
+
: '0.0.0';
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return '0.0.0';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
const out = runNpm(['view', pkgSpec.trim(), 'version', '--json']);
|
|
178
|
+
const parsed = JSON.parse(out.trim());
|
|
179
|
+
if (typeof parsed === 'string' && parsed.length > 0)
|
|
180
|
+
return parsed;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// fall through
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* List top-level packages currently installed in the addons store
|
|
189
|
+
* (`node_modules` one level deep, scoped packages two levels).
|
|
190
|
+
*/
|
|
191
|
+
function listTopLevelPackages(addonsRoot) {
|
|
192
|
+
const out = new Set();
|
|
193
|
+
const nodeModules = path.join(addonsRoot, 'node_modules');
|
|
194
|
+
if (!fs.existsSync(nodeModules))
|
|
195
|
+
return out;
|
|
196
|
+
for (const entry of fs.readdirSync(nodeModules)) {
|
|
197
|
+
if (entry.startsWith('@')) {
|
|
198
|
+
const scopedDir = path.join(nodeModules, entry);
|
|
199
|
+
let stat;
|
|
200
|
+
try {
|
|
201
|
+
stat = fs.statSync(scopedDir);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (!stat.isDirectory())
|
|
207
|
+
continue;
|
|
208
|
+
for (const sub of fs.readdirSync(scopedDir)) {
|
|
209
|
+
out.add(`${entry}/${sub}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
out.add(entry);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Preserve an installed package before an upgrade by renaming it out of
|
|
220
|
+
* `node_modules`. Returns the rollback backup root, or `null` when the
|
|
221
|
+
* package directory is absent (nothing to preserve).
|
|
222
|
+
*
|
|
223
|
+
* Works for real directories and symlinks alike (npm links local-path
|
|
224
|
+
* packages); the backup lives next to `node_modules` on the same filesystem,
|
|
225
|
+
* so `renameSync` never crosses a mount boundary. On Windows the rename
|
|
226
|
+
* target does not exist at call time, which is the case `renameSync` allows.
|
|
227
|
+
*/
|
|
228
|
+
function backupAddonPackage(addonsRoot, name) {
|
|
229
|
+
const src = path.join(addonsRoot, 'node_modules', name);
|
|
230
|
+
if (!fs.existsSync(src))
|
|
231
|
+
return null;
|
|
232
|
+
const backup = path.join(addonsRoot, `.rollback-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
233
|
+
fs.mkdirSync(backup, { recursive: true });
|
|
234
|
+
fs.renameSync(src, path.join(backup, path.basename(name)));
|
|
235
|
+
return backup;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Restore a backed-up package after a failed upgrade. Removes whatever
|
|
239
|
+
* partial install npm left behind first (no-op when absent), then renames
|
|
240
|
+
* the backup back. Failures here are warnings — the registry entry is never
|
|
241
|
+
* touched by the caller, so the record keeps pointing at the previous
|
|
242
|
+
* version even if the files cannot be recovered.
|
|
243
|
+
*/
|
|
244
|
+
function restoreAddonPackage(addonsRoot, name, backup) {
|
|
245
|
+
if (!backup)
|
|
246
|
+
return;
|
|
247
|
+
const dest = path.join(addonsRoot, 'node_modules', name);
|
|
248
|
+
try {
|
|
249
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
250
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
251
|
+
fs.renameSync(path.join(backup, path.basename(name)), dest);
|
|
252
|
+
// The package moved back out; the backup dir is empty now.
|
|
253
|
+
fs.rmSync(backup, { recursive: true, force: true });
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
// On failure the backup keeps its contents — leave it for manual recovery.
|
|
257
|
+
(0, errors_1.logWarn)(`Failed to restore addon ${name} from backup`, {
|
|
258
|
+
backup,
|
|
259
|
+
error: err instanceof Error ? err.message : String(err),
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/** Delete a rollback backup after a successful upgrade (best effort). */
|
|
264
|
+
function cleanupBackup(backup) {
|
|
265
|
+
if (!backup)
|
|
266
|
+
return;
|
|
267
|
+
try {
|
|
268
|
+
fs.rmSync(backup, { recursive: true, force: true });
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
// Best effort — stale backups are inert and named per-attempt.
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Install an addon package and register it.
|
|
276
|
+
*
|
|
277
|
+
* Throws on failure (npm error, invalid addon, unresolvable name, or a
|
|
278
|
+
* downgrade attempt against an installed version). The registry is written
|
|
279
|
+
* only after validation succeeds. When re-installing an existing name
|
|
280
|
+
* (upgrade), the previous files are preserved and restored on failure.
|
|
281
|
+
*/
|
|
282
|
+
async function installAddon(repoRoot, pkgSpec, options) {
|
|
283
|
+
const addonsRoot = (0, paths_1.addonsRootDir)(repoRoot);
|
|
284
|
+
fs.mkdirSync(addonsRoot, { recursive: true });
|
|
285
|
+
// Resolve identity + source from the spec. The CLI pre-resolves the name
|
|
286
|
+
// (npm view / local package.json) and passes it via options.name to skip a
|
|
287
|
+
// second resolution — but it must never override the SOURCE: a local-path
|
|
288
|
+
// spec stays 'local' even when the name was pre-resolved, otherwise
|
|
289
|
+
// `update --latest` would wrongly apply to a local-path addon.
|
|
290
|
+
let info = resolvePackageInfo(pkgSpec);
|
|
291
|
+
if (options.name) {
|
|
292
|
+
info = { name: options.name, source: info?.source ?? 'registry' };
|
|
293
|
+
}
|
|
294
|
+
let name = info?.name ?? null;
|
|
295
|
+
let source = info?.source ?? 'registry';
|
|
296
|
+
let backup = null;
|
|
297
|
+
if (!name) {
|
|
298
|
+
// Last resort (git URLs, tarballs without a resolvable name): install
|
|
299
|
+
// first, then diff node_modules. Cannot gate or back up in advance.
|
|
300
|
+
const before = listTopLevelPackages(addonsRoot);
|
|
301
|
+
runNpm(['install', '--prefix', addonsRoot, '--no-audit', '--no-fund', pkgSpec]);
|
|
302
|
+
const added = [...listTopLevelPackages(addonsRoot)].filter((p) => !before.has(p));
|
|
303
|
+
if (added.length !== 1) {
|
|
304
|
+
throw new Error(`Cannot resolve the installed package name for "${pkgSpec}" ` +
|
|
305
|
+
`(${added.length} new package(s) detected). Install by name or a local path.`);
|
|
306
|
+
}
|
|
307
|
+
name = added[0];
|
|
308
|
+
source = 'registry';
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
// Version gate + upgrade backup, both before npm touches the store.
|
|
312
|
+
const installed = (0, registry_1.readRegistry)(repoRoot).addons.find((e) => e.name === name);
|
|
313
|
+
if (installed) {
|
|
314
|
+
const target = resolveTargetVersion(pkgSpec, source);
|
|
315
|
+
// `null` = version could not be resolved (offline / unknown package):
|
|
316
|
+
// skip the gate — unknown data never refuses an install.
|
|
317
|
+
if (target !== null && (0, semver_1.compareSemver)(target, installed.version) < 0) {
|
|
318
|
+
throw new Error(`${name}@${target} is older than the installed ${name}@${installed.version} — ` +
|
|
319
|
+
`remove it first ("homegraph addon remove ${name}") then install the older version`);
|
|
320
|
+
}
|
|
321
|
+
backup = backupAddonPackage(addonsRoot, name);
|
|
322
|
+
}
|
|
323
|
+
try {
|
|
324
|
+
runNpm(['install', '--prefix', addonsRoot, '--no-audit', '--no-fund', pkgSpec]);
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
restoreAddonPackage(addonsRoot, name, backup);
|
|
328
|
+
throw err;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const pkgDir = (0, paths_1.addonPkgDir)(repoRoot, name);
|
|
332
|
+
const validation = await (0, validate_1.validateAddonPackage)(pkgDir);
|
|
333
|
+
if (!validation.ok) {
|
|
334
|
+
restoreAddonPackage(addonsRoot, name, backup);
|
|
335
|
+
if (!backup) {
|
|
336
|
+
// Fresh install with nothing to restore — uninstall the leftovers so
|
|
337
|
+
// nothing half-installed lingers.
|
|
338
|
+
try {
|
|
339
|
+
runNpm(['uninstall', '--prefix', addonsRoot, '--no-audit', '--no-fund', name]);
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
// Best effort — unregistered leftovers are inert (never loaded).
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
throw new Error(`Installed package is not a valid HomeGraph addon: ${validation.reason}`);
|
|
346
|
+
}
|
|
347
|
+
cleanupBackup(backup);
|
|
348
|
+
const version = validation.version;
|
|
349
|
+
(0, registry_1.upsertEntry)(repoRoot, { name, version, enabled: options.enable, source });
|
|
350
|
+
return { name, version };
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Unregister an addon, optionally deleting its files. Returns `false` when
|
|
354
|
+
* the name was not registered.
|
|
355
|
+
*/
|
|
356
|
+
function removeAddon(repoRoot, name, options) {
|
|
357
|
+
const removed = (0, registry_1.removeEntry)(repoRoot, name);
|
|
358
|
+
if (!removed)
|
|
359
|
+
return false;
|
|
360
|
+
if (options.purge) {
|
|
361
|
+
try {
|
|
362
|
+
runNpm(['uninstall', '--prefix', (0, paths_1.addonsRootDir)(repoRoot), '--no-audit', '--no-fund', name]);
|
|
363
|
+
}
|
|
364
|
+
catch (err) {
|
|
365
|
+
(0, errors_1.logWarn)(`Failed to purge addon files for ${name}`, {
|
|
366
|
+
error: err instanceof Error ? err.message : String(err),
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* List registered addons with their on-disk status (installed vs missing).
|
|
374
|
+
*/
|
|
375
|
+
function listAddons(repoRoot) {
|
|
376
|
+
const registry = (0, registry_1.readRegistry)(repoRoot);
|
|
377
|
+
return registry.addons.map((entry) => ({
|
|
378
|
+
...entry,
|
|
379
|
+
installed: fs.existsSync(path.join((0, paths_1.addonPkgDir)(repoRoot, entry.name), 'package.json')),
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
/** npm spec for an update: bare name follows the recorded range, `@latest` forces the dist-tag. */
|
|
383
|
+
function resolveUpdateSpec(name, latest) {
|
|
384
|
+
return latest ? `${name}@latest` : name;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Update registered addon(s) to the latest version within the configured
|
|
388
|
+
* range (re-running `npm install` on the registered name, then recording the
|
|
389
|
+
* newly resolved version). Each update preserves the previous files and
|
|
390
|
+
* restores them on failure, so a bad upgrade never loses the working copy.
|
|
391
|
+
*
|
|
392
|
+
* Returns the names+versions that were updated; entries whose validation
|
|
393
|
+
* failed after install are logged and skipped (previous version kept).
|
|
394
|
+
*/
|
|
395
|
+
async function updateAddon(repoRoot, name, options = {}) {
|
|
396
|
+
const registry = (0, registry_1.readRegistry)(repoRoot);
|
|
397
|
+
const targets = name
|
|
398
|
+
? registry.addons.filter((e) => e.name === name)
|
|
399
|
+
: registry.addons;
|
|
400
|
+
if (name && targets.length === 0) {
|
|
401
|
+
throw new Error(`Addon not registered: ${name}`);
|
|
402
|
+
}
|
|
403
|
+
if (targets.length === 0)
|
|
404
|
+
return [];
|
|
405
|
+
const addonsRoot = (0, paths_1.addonsRootDir)(repoRoot);
|
|
406
|
+
fs.mkdirSync(addonsRoot, { recursive: true });
|
|
407
|
+
const updated = [];
|
|
408
|
+
for (const entry of targets) {
|
|
409
|
+
if (options.latest && entry.source !== 'registry') {
|
|
410
|
+
throw new Error(`${entry.name} was installed from a local path — ` +
|
|
411
|
+
`"update --latest" applies to registry packages only`);
|
|
412
|
+
}
|
|
413
|
+
const backup = backupAddonPackage(addonsRoot, entry.name);
|
|
414
|
+
const spec = resolveUpdateSpec(entry.name, !!options.latest);
|
|
415
|
+
try {
|
|
416
|
+
runNpm(['install', '--prefix', addonsRoot, '--no-audit', '--no-fund', spec]);
|
|
417
|
+
}
|
|
418
|
+
catch (err) {
|
|
419
|
+
restoreAddonPackage(addonsRoot, entry.name, backup);
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
const validation = await (0, validate_1.validateAddonPackage)((0, paths_1.addonPkgDir)(repoRoot, entry.name));
|
|
423
|
+
if (!validation.ok) {
|
|
424
|
+
restoreAddonPackage(addonsRoot, entry.name, backup);
|
|
425
|
+
(0, errors_1.logWarn)(`Addon ${entry.name} failed validation after update — keeping previous version`, {
|
|
426
|
+
reason: validation.reason,
|
|
427
|
+
});
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
cleanupBackup(backup);
|
|
431
|
+
const to = validation.version ?? entry.version;
|
|
432
|
+
(0, registry_1.upsertEntry)(repoRoot, { ...entry, version: to });
|
|
433
|
+
updated.push({ name: entry.name, from: entry.version, to });
|
|
434
|
+
}
|
|
435
|
+
return updated;
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/addons/manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEH,0CAOC;AASD,gDA2BC;AAGD,gDAEC;AA6ID,oCA8EC;AAMD,kCAkBC;AAKD,gCAUC;AAoBD,8CAEC;AAWD,kCAmDC;AAxcD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA6C;AAC7C,sCAAoC;AACpC,mCAAqD;AACrD,yCAAoE;AACpE,yCAAkD;AAClD,qCAAyC;AACzC,4CAAiD;AAiBjD;;;;;;;;;;GAUG;AACH,SAAS,MAAM,CAAC,IAAc;IAC5B,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,E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AAC;YACpD,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAA,+BAAoB,EAAC,IAAA,mBAAW,EAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;YACnB,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACpD,IAAA,gBAAO,EAAC,SAAS,KAAK,CAAC,IAAI,4DAA4D,EAAE;gBACvF,MAAM,EAAE,UAAU,CAAC,MAAM;aAC1B,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,aAAa,CAAC,MAAM,CAAC,CAAC;QACtB,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;QAC/C,IAAA,sBAAW,EAAC,QAAQ,EAAE,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path resolution for the repository-level addon store.
|
|
3
|
+
*
|
|
4
|
+
* Layout (next to the spec feature's `commit4spec/` data directory):
|
|
5
|
+
*
|
|
6
|
+
* <repo>/.homegraph/
|
|
7
|
+
* ├── addons.json registry (see ./registry)
|
|
8
|
+
* ├── addons/ npm install --prefix target
|
|
9
|
+
* │ └── node_modules/
|
|
10
|
+
* │ └── @scope/name/ one directory per installed addon
|
|
11
|
+
* └── commit4spec/ spec data (SPEC_DATA_DIR)
|
|
12
|
+
*
|
|
13
|
+
* @module addons/paths
|
|
14
|
+
*/
|
|
15
|
+
/** Directory holding all installed addon packages (npm install --prefix target). */
|
|
16
|
+
export declare function addonsRootDir(repoRoot: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve an installed addon package directory from its registry name.
|
|
19
|
+
* Scoped names (`@scope/name`) nest naturally under `node_modules`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function addonPkgDir(repoRoot: string, name: string): string;
|
|
22
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/addons/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,oFAAoF;AACpF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Path resolution for the repository-level addon store.
|
|
4
|
+
*
|
|
5
|
+
* Layout (next to the spec feature's `commit4spec/` data directory):
|
|
6
|
+
*
|
|
7
|
+
* <repo>/.homegraph/
|
|
8
|
+
* ├── addons.json registry (see ./registry)
|
|
9
|
+
* ├── addons/ npm install --prefix target
|
|
10
|
+
* │ └── node_modules/
|
|
11
|
+
* │ └── @scope/name/ one directory per installed addon
|
|
12
|
+
* └── commit4spec/ spec data (SPEC_DATA_DIR)
|
|
13
|
+
*
|
|
14
|
+
* @module addons/paths
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.addonsRootDir = addonsRootDir;
|
|
51
|
+
exports.addonPkgDir = addonPkgDir;
|
|
52
|
+
const path = __importStar(require("path"));
|
|
53
|
+
const directory_1 = require("../directory");
|
|
54
|
+
/** Directory holding all installed addon packages (npm install --prefix target). */
|
|
55
|
+
function addonsRootDir(repoRoot) {
|
|
56
|
+
return path.join((0, directory_1.getHomeGraphDir)(repoRoot), 'addons');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve an installed addon package directory from its registry name.
|
|
60
|
+
* Scoped names (`@scope/name`) nest naturally under `node_modules`.
|
|
61
|
+
*/
|
|
62
|
+
function addonPkgDir(repoRoot, name) {
|
|
63
|
+
return path.join(addonsRootDir(repoRoot), 'node_modules', name);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/addons/paths.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMH,sCAEC;AAMD,kCAEC;AAdD,2CAA6B;AAC7B,4CAA+C;AAE/C,oFAAoF;AACpF,SAAgB,aAAa,CAAC,QAAgB;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAA,2BAAe,EAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,WAAW,CAAC,QAAgB,EAAE,IAAY;IACxD,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Addon registry file I/O — read/write `${getHomeGraphDir(repoRoot)}/addons.json`.
|
|
3
|
+
*
|
|
4
|
+
* The registry is a small standalone file, deliberately separate from the
|
|
5
|
+
* spec feature's `configs.json`, so the top-level `homegraph addon` command
|
|
6
|
+
* never touches spec configuration. Writes are atomic (tmp file + rename).
|
|
7
|
+
*
|
|
8
|
+
* @module addons/registry
|
|
9
|
+
*/
|
|
10
|
+
import { AddonRegistry, AddonRegistryEntry } from './types';
|
|
11
|
+
/** Absolute path of the registry file for a repository. */
|
|
12
|
+
export declare function registryFilePath(repoRoot: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Read the registry. A missing file yields an empty registry (the first
|
|
15
|
+
* `install` may be the very first addon operation); a corrupt file is
|
|
16
|
+
* ignored with a warning and treated as empty.
|
|
17
|
+
*/
|
|
18
|
+
export declare function readRegistry(repoRoot: string): AddonRegistry;
|
|
19
|
+
/**
|
|
20
|
+
* Atomically write the registry (tmp file + rename). Creates the HomeGraph
|
|
21
|
+
* data directory if needed.
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeRegistry(repoRoot: string, registry: AddonRegistry): void;
|
|
24
|
+
/**
|
|
25
|
+
* Insert or replace an entry by name (re-install updates version/enabled,
|
|
26
|
+
* preserving the position).
|
|
27
|
+
*/
|
|
28
|
+
export declare function upsertEntry(repoRoot: string, entry: AddonRegistryEntry): void;
|
|
29
|
+
/**
|
|
30
|
+
* Remove an entry by name. Returns `false` when the name was not registered.
|
|
31
|
+
*/
|
|
32
|
+
export declare function removeEntry(repoRoot: string, name: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Toggle the `enabled` flag of an entry. Returns `false` when the name was
|
|
35
|
+
* not registered.
|
|
36
|
+
*/
|
|
37
|
+
export declare function setEntryEnabled(repoRoot: string, name: string, enabled: boolean): boolean;
|
|
38
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/addons/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAK5D,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAcD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAiC5D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAM7E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAS7E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,OAAO,CAOT"}
|