@uniqbit/mate-core 0.15.0-canary.7 → 0.15.0-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
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@uniqbit/mate-core",
3
- "version": "0.15.0-canary.7",
3
+ "version": "0.15.0-canary.8",
4
+ "description": "Core framework and plugin APIs for Mate.",
4
5
  "license": "MIT",
5
6
  "files": [
6
7
  "src/",
@@ -9,6 +9,8 @@ import { PluginRegistry } from "./tools/setup/registry";
9
9
  export interface CreateMateOptions {
10
10
  config: DistributionConfig;
11
11
  plugins: PluginRegistration[];
12
+ /** Optional entry-point override for embedders that need to control CLI execution. */
13
+ main?: typeof main;
12
14
  }
13
15
 
14
16
  export interface MateCli {
@@ -24,7 +26,7 @@ export interface MateCli {
24
26
  * after `config.name` (built last since it reads the full plugin set).
25
27
  * Returns the runnable CLI.
26
28
  */
27
- export function createMate({ config, plugins }: CreateMateOptions): MateCli {
29
+ export function createMate({ config, plugins, main: runMain = main }: CreateMateOptions): MateCli {
28
30
  const registry = new PluginRegistry([
29
31
  ...plugins,
30
32
  { plugin: createBunPlugin(), policy: "required" },
@@ -36,7 +38,7 @@ export function createMate({ config, plugins }: CreateMateOptions): MateCli {
36
38
  config,
37
39
  registry,
38
40
  run: (argv = process.argv) =>
39
- main(argv).catch((error) => {
41
+ runMain(argv).catch((error) => {
40
42
  console.error(error instanceof Error ? error.message : String(error));
41
43
  process.exitCode = 1;
42
44
  }),
@@ -93,6 +93,8 @@ export abstract class LaunchAdapter {
93
93
 
94
94
  if (reactDoctorEnabled) {
95
95
  env.MATE_REACT_DOCTOR_BIN_PATH = getReactDoctorBinPath();
96
+ } else {
97
+ delete env.MATE_REACT_DOCTOR_BIN_PATH;
96
98
  }
97
99
 
98
100
  // Route launch-session graphify output to the companion store. graphifyy resolves its
@@ -97,8 +97,8 @@ export async function fetchLatestVersion(): Promise<string> {
97
97
  return fetchPublicPackageVersion(packageName, registry);
98
98
  }
99
99
 
100
- export function scheduleBackgroundCheck(store: UpdateStateStore): void {
101
- void (async () => {
100
+ export function scheduleBackgroundCheck(store: UpdateStateStore): Promise<void> {
101
+ return (async () => {
102
102
  try {
103
103
  const state = await store.load();
104
104
  const lastChecked = state.lastChecked ? new Date(state.lastChecked).getTime() : 0;
@@ -552,7 +552,7 @@ async function configureClaude(src: string, companionPath: string): Promise<void
552
552
  }
553
553
  }
554
554
 
555
- async function teardownClaude(companionPath: string, _allowedAgents: string[]): Promise<void> {
555
+ async function teardownClaude(companionPath: string, allowedAgents: string[]): Promise<void> {
556
556
  try {
557
557
  await fs.unlink(path.join(companionPath, ".claude", "hooks", "validate-artifact-path"));
558
558
  } catch {
@@ -603,10 +603,14 @@ async function teardownClaude(companionPath: string, _allowedAgents: string[]):
603
603
  }
604
604
  await pruneEmptyAncestors(path.join(companionPath, ".claude"), companionPath);
605
605
 
606
- try {
607
- await fs.unlink(path.join(companionPath, "AGENTS.md"));
608
- } catch {
609
- /* not present */
606
+ // AGENTS.md is shared with OpenCode. Claude must not remove it while the
607
+ // required OpenCode provider is still active.
608
+ if (!allowedAgents.includes("opencode")) {
609
+ try {
610
+ await fs.unlink(path.join(companionPath, "AGENTS.md"));
611
+ } catch {
612
+ /* not present */
613
+ }
610
614
  }
611
615
  }
612
616