@uniqbit/mate-core 0.15.0-canary.6 → 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.6",
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;
@@ -34,6 +34,7 @@ async function configureClaudeGuidance(companionPath: string): Promise<void> {
34
34
  }
35
35
 
36
36
  const BASE_WORKING_REPO_LOCAL_EXCLUDE_ENTRIES = [".claude/settings.local.json"];
37
+ const COMPANION_GITIGNORE_ENTRIES = [...BASE_WORKING_REPO_LOCAL_EXCLUDE_ENTRIES, ".claude/state/"];
37
38
  // Union of all managed exclude entries — used to identify which lines we own.
38
39
  const ALL_MANAGED_EXCLUDE_ENTRIES = new Set([
39
40
  ...BASE_WORKING_REPO_LOCAL_EXCLUDE_ENTRIES,
@@ -551,7 +552,7 @@ async function configureClaude(src: string, companionPath: string): Promise<void
551
552
  }
552
553
  }
553
554
 
554
- async function teardownClaude(companionPath: string, _allowedAgents: string[]): Promise<void> {
555
+ async function teardownClaude(companionPath: string, allowedAgents: string[]): Promise<void> {
555
556
  try {
556
557
  await fs.unlink(path.join(companionPath, ".claude", "hooks", "validate-artifact-path"));
557
558
  } catch {
@@ -602,10 +603,14 @@ async function teardownClaude(companionPath: string, _allowedAgents: string[]):
602
603
  }
603
604
  await pruneEmptyAncestors(path.join(companionPath, ".claude"), companionPath);
604
605
 
605
- try {
606
- await fs.unlink(path.join(companionPath, "AGENTS.md"));
607
- } catch {
608
- /* 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
+ }
609
614
  }
610
615
  }
611
616
 
@@ -670,7 +675,7 @@ export function createClaudePlugin(): ProviderPlugin {
670
675
  description: "Install Claude companion files, hooks, and guidance.",
671
676
  defaultSelected: true,
672
677
  isEnabled: (config) => (config.profiles.default?.allowedAgents ?? []).includes("claude"),
673
- gitignoreEntries: () => BASE_WORKING_REPO_LOCAL_EXCLUDE_ENTRIES,
678
+ gitignoreEntries: () => COMPANION_GITIGNORE_ENTRIES,
674
679
  hosting: {
675
680
  mcp: {
676
681
  async register(ctx: SetupContext, descriptor: McpServerDescriptor) {