opencode-synced 0.5.0 → 0.5.1

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.
@@ -1,6 +1,6 @@
1
1
  import { promises as fs } from 'node:fs';
2
2
  import path from 'node:path';
3
- import { deepMerge, parseJsonc, pathExists, stripOverrides, writeJsonFile } from './config.js';
3
+ import { deepMerge, hasOwn, parseJsonc, pathExists, stripOverrides, writeJsonFile, } from './config.js';
4
4
  import { extractMcpSecrets, hasOverrides, mergeOverrides, stripOverrideKeys, } from './mcp-secrets.js';
5
5
  import { normalizePath } from './paths.js';
6
6
  export async function syncRepoToLocal(plan, overrides) {
@@ -214,7 +214,7 @@ function isDeepEqual(left, right) {
214
214
  if (leftKeys.length !== rightKeys.length)
215
215
  return false;
216
216
  for (const key of leftKeys) {
217
- if (!Object.hasOwn(right, key))
217
+ if (!hasOwn(right, key))
218
218
  return false;
219
219
  if (!isDeepEqual(left[key], right[key])) {
220
220
  return false;
@@ -35,3 +35,5 @@ export declare function writeJsonFile(filePath: string, data: unknown, options?:
35
35
  jsonc: boolean;
36
36
  mode?: number;
37
37
  }): Promise<void>;
38
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
39
+ export declare function hasOwn(target: Record<string, unknown>, key: string): boolean;
@@ -117,11 +117,14 @@ export async function writeJsonFile(filePath, data, options = { jsonc: false })
117
117
  await fs.chmod(filePath, options.mode);
118
118
  }
119
119
  }
120
- function isPlainObject(value) {
120
+ export function isPlainObject(value) {
121
121
  if (!value || typeof value !== 'object')
122
122
  return false;
123
123
  return Object.getPrototypeOf(value) === Object.prototype;
124
124
  }
125
+ export function hasOwn(target, key) {
126
+ return Object.hasOwn(target, key);
127
+ }
125
128
  function stripJsonComments(input) {
126
129
  let output = '';
127
130
  let inString = false;
@@ -1,4 +1,4 @@
1
- import { deepMerge } from './config.js';
1
+ import { deepMerge, hasOwn, isPlainObject } from './config.js';
2
2
  const ENV_PLACEHOLDER_PATTERN = /\{env:[^}]+\}/i;
3
3
  export function extractMcpSecrets(config) {
4
4
  const sanitizedConfig = cloneConfig(config);
@@ -88,15 +88,7 @@ function setNestedValue(target, path, value) {
88
88
  function getPlainObject(value) {
89
89
  return isPlainObject(value) ? value : null;
90
90
  }
91
- function isPlainObject(value) {
92
- if (!value || typeof value !== 'object')
93
- return false;
94
- return Object.getPrototypeOf(value) === Object.prototype;
95
- }
96
91
  function cloneConfig(config) {
97
- if (typeof structuredClone === 'function') {
98
- return structuredClone(config);
99
- }
100
92
  return JSON.parse(JSON.stringify(config));
101
93
  }
102
94
  export function mergeOverrides(base, extra) {
@@ -108,7 +100,7 @@ export function stripOverrideKeys(base, toRemove) {
108
100
  }
109
101
  const result = { ...base };
110
102
  for (const [key, removeValue] of Object.entries(toRemove)) {
111
- if (!Object.hasOwn(result, key))
103
+ if (!hasOwn(result, key))
112
104
  continue;
113
105
  const currentValue = result[key];
114
106
  if (isPlainObject(removeValue) && isPlainObject(currentValue)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-synced",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Sync global OpenCode config across machines via GitHub.",
5
5
  "author": {
6
6
  "name": "Ian Hildebrand"