@uniqbit/mate-core 0.15.4-canary.7 → 0.15.4-canary.8
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
|
@@ -56,10 +56,14 @@ export async function runInstallCommand(argv: string[], cwd = process.cwd()): Pr
|
|
|
56
56
|
process.exitCode = 1;
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
|
-
//
|
|
60
|
-
// before the plan is built, so one run goes install → load →
|
|
61
|
-
// own install requirements are part of the plan.
|
|
62
|
-
if (
|
|
59
|
+
// Root-declared plugins (companion or hub) install first and hydrate into
|
|
60
|
+
// the registry before the plan is built, so one run goes install → load →
|
|
61
|
+
// plan and their own install requirements are part of the plan.
|
|
62
|
+
if (
|
|
63
|
+
(context.kind === "companion" || context.kind === "hub") &&
|
|
64
|
+
context.companionPath &&
|
|
65
|
+
context.config.plugins?.length
|
|
66
|
+
) {
|
|
63
67
|
reportPluginInstallResults(
|
|
64
68
|
await installDeclaredPlugins(context.companionPath, context.config.plugins),
|
|
65
69
|
);
|
|
@@ -37,7 +37,7 @@ export interface PluginInstallCommandDeps {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @command mate plugin install <package>[@version]
|
|
40
|
-
* @description Declares `<package>` in the companion's `framework.yaml`
|
|
40
|
+
* @description Declares `<package>` in the companion's (or hub's) `framework.yaml`
|
|
41
41
|
* `plugins:` list (adding it, or updating its version if already declared)
|
|
42
42
|
* and installs it immediately into the shared workspace, the same way
|
|
43
43
|
* `mate install` would on its next run.
|
|
@@ -62,9 +62,9 @@ export async function runPluginInstallCommand(
|
|
|
62
62
|
process.exitCode = 1;
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
|
-
if (context.kind !== "companion" || !context.companionPath) {
|
|
65
|
+
if ((context.kind !== "companion" && context.kind !== "hub") || !context.companionPath) {
|
|
66
66
|
process.stderr.write(
|
|
67
|
-
`${FRAMEWORK_NAME}: \`plugin install\` requires a companion context; run it from inside a linked working repository.\n`,
|
|
67
|
+
`${FRAMEWORK_NAME}: \`plugin install\` requires a companion or hub context; run it from inside a linked working repository or a hub root.\n`,
|
|
68
68
|
);
|
|
69
69
|
process.exitCode = 1;
|
|
70
70
|
return false;
|
package/src/cli/main.ts
CHANGED
|
@@ -30,6 +30,8 @@ export interface GateNeeds {
|
|
|
30
30
|
updateGuard?: boolean;
|
|
31
31
|
/** Block the command when the current directory resolves to a hub root. */
|
|
32
32
|
notHubRoot?: boolean;
|
|
33
|
+
/** Block the command when the current directory resolves to a companion root. */
|
|
34
|
+
notCompanionRoot?: boolean;
|
|
33
35
|
/** Require an unambiguous companion (selection wizard on ambiguity) before dispatch. */
|
|
34
36
|
companion?: boolean;
|
|
35
37
|
/** Require a complete installation (install preflight) before dispatch. */
|
|
@@ -91,12 +93,22 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
91
93
|
await showUpdateBannerIfAvailable(updateStore);
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
if (needs.notHubRoot
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
if (needs.notHubRoot || needs.notCompanionRoot) {
|
|
97
|
+
const kind = (await deps.resolveRootContext()).kind;
|
|
98
|
+
if (needs.notHubRoot && kind === "hub") {
|
|
99
|
+
console.error(
|
|
100
|
+
`${FRAMEWORK_NAME}: this directory resolves to a companion hub root; companion commands are not available here. Use \`${FRAMEWORK_NAME} hub ...\` to manage the hub.`,
|
|
101
|
+
);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (needs.notCompanionRoot && kind === "companion") {
|
|
106
|
+
console.error(
|
|
107
|
+
`${FRAMEWORK_NAME}: this directory resolves to a companion root; hub commands are not available here. Run them from a hub root.`,
|
|
108
|
+
);
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
if (needs.companion && !(await deps.ensureUnambiguousCompanion())) {
|
|
@@ -126,9 +138,10 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
126
138
|
return;
|
|
127
139
|
case "plugin":
|
|
128
140
|
// Declares into framework.yaml and installs on the spot, so it needs
|
|
129
|
-
// the same gating as `install` — an unambiguous companion
|
|
130
|
-
// stay runnable when installation is otherwise
|
|
131
|
-
|
|
141
|
+
// the same gating as `install` — an unambiguous companion (hubs pass
|
|
142
|
+
// trivially), but must stay runnable when installation is otherwise
|
|
143
|
+
// incomplete.
|
|
144
|
+
if (!(await gate({ companion: true }))) return;
|
|
132
145
|
await runPluginCommand(subcommand, rest);
|
|
133
146
|
return;
|
|
134
147
|
case "artifact":
|
|
@@ -144,9 +157,10 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
144
157
|
if (!(await gate({ notHubRoot: true }))) return;
|
|
145
158
|
break;
|
|
146
159
|
// Hub commands establish and operate on a local hub root directly;
|
|
147
|
-
// they must not require a linked working repository or installation
|
|
160
|
+
// they must not require a linked working repository or installation —
|
|
161
|
+
// but companions are never hubs.
|
|
148
162
|
case "hub":
|
|
149
|
-
if (!(await gate({ updateGuard: true }))) return;
|
|
163
|
+
if (!(await gate({ updateGuard: true, notCompanionRoot: true }))) return;
|
|
150
164
|
break;
|
|
151
165
|
// open/tui consume a companion context.
|
|
152
166
|
case "open":
|
|
@@ -160,7 +174,8 @@ export async function main(argv = process.argv, deps: MainDeps = mainDeps): Prom
|
|
|
160
174
|
await runCompanionCommand(subcommand, rest);
|
|
161
175
|
return;
|
|
162
176
|
case "hub":
|
|
163
|
-
|
|
177
|
+
// Hubs are never companions: hub commands are blocked in companion roots.
|
|
178
|
+
if (!(await gate({ updateGuard: true, notCompanionRoot: true }))) return;
|
|
164
179
|
await runHubCommand(subcommand ? [subcommand, ...rest] : []);
|
|
165
180
|
return;
|
|
166
181
|
case "claude":
|