@serviceme/devtools-core 0.4.3 → 0.4.5

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/dist/index.mjs CHANGED
@@ -2127,7 +2127,6 @@ var IdentityStore = class {
2127
2127
  this.hooks = opts.hooks ?? {};
2128
2128
  this.lockTimeoutMs = opts.lockTimeoutMs ?? DEFAULT_LOCK_TIMEOUT_MS;
2129
2129
  this.lockRetryMs = opts.lockRetryMs ?? DEFAULT_LOCK_RETRY_MS;
2130
- this.now = opts.now ?? (() => /* @__PURE__ */ new Date());
2131
2130
  }
2132
2131
  /** Absolute path to the underlying JSON file (test seam). */
2133
2132
  getFilePath() {
@@ -3961,7 +3960,7 @@ var RepoManager = class {
3961
3960
  name: input.name?.trim() || id,
3962
3961
  url,
3963
3962
  branch,
3964
- enabled: true,
3963
+ enabled: input.enabled ?? true,
3965
3964
  useProxy,
3966
3965
  writeEnabled: false,
3967
3966
  source: "user",
@@ -4091,7 +4090,7 @@ var DEFAULT_REPO_SEEDS = [
4091
4090
  id: "composiohq-awesome-claude-skills",
4092
4091
  name: "Composio Awesome Claude Skills",
4093
4092
  url: "https://github.com/ComposioHQ/awesome-claude-skills.git",
4094
- branch: "main",
4093
+ branch: "master",
4095
4094
  enabled: true,
4096
4095
  useProxy: true,
4097
4096
  writeEnabled: false,
@@ -4124,12 +4123,13 @@ function buildDefaultReposFile(now = () => (/* @__PURE__ */ new Date()).toISOStr
4124
4123
  }
4125
4124
  const existingIds = new Set(existing.repos.map((r) => r.id));
4126
4125
  const missingDefaults = defaults.filter((d) => !existingIds.has(d.id));
4127
- if (missingDefaults.length === 0) {
4126
+ const { repos: refreshedRepos, changed } = refreshDefaultsMetadata(existing.repos, defaults);
4127
+ if (missingDefaults.length === 0 && !changed) {
4128
4128
  return existing;
4129
4129
  }
4130
4130
  return {
4131
4131
  ...existing,
4132
- repos: [...existing.repos, ...missingDefaults],
4132
+ repos: [...refreshedRepos, ...missingDefaults],
4133
4133
  defaultRepoId: resolveDefaultRepoId(existing, existingIds)
4134
4134
  };
4135
4135
  }
@@ -4137,16 +4137,52 @@ function ensureDefaultsInstalled(existing, now = () => (/* @__PURE__ */ new Date
4137
4137
  const defaults = getAllDefaultRepoConfigs(now);
4138
4138
  const existingIds = new Set(existing.repos.map((r) => r.id));
4139
4139
  const missing = defaults.filter((d) => !existingIds.has(d.id));
4140
- if (missing.length === 0) {
4140
+ const { repos: refreshedRepos, changed } = refreshDefaultsMetadata(existing.repos, defaults);
4141
+ if (missing.length === 0 && !changed) {
4141
4142
  return { config: existing, installed: [] };
4142
4143
  }
4143
4144
  const next = {
4144
4145
  ...existing,
4145
- repos: [...existing.repos, ...missing],
4146
+ repos: [...refreshedRepos, ...missing],
4146
4147
  defaultRepoId: resolveDefaultRepoId(existing, existingIds)
4147
4148
  };
4148
4149
  return { config: next, installed: missing.map((d) => d.id) };
4149
4150
  }
4151
+ var SYNCED_METADATA_KEYS = [
4152
+ "name",
4153
+ "url",
4154
+ "branch",
4155
+ "description",
4156
+ "useProxy",
4157
+ "writeEnabled"
4158
+ ];
4159
+ function refreshDefaultsMetadata(repos, defaults) {
4160
+ const seedById = new Map(defaults.map((d) => [d.id, d]));
4161
+ let changed = false;
4162
+ const next = repos.map((repo) => {
4163
+ if (!isDefaultRepo(repo)) {
4164
+ return repo;
4165
+ }
4166
+ const seed = seedById.get(repo.id);
4167
+ if (!seed) {
4168
+ return repo;
4169
+ }
4170
+ const isStale = SYNCED_METADATA_KEYS.some((key) => repo[key] !== seed[key]);
4171
+ if (!isStale) {
4172
+ return repo;
4173
+ }
4174
+ changed = true;
4175
+ return { ...repo, ...pick(seed, SYNCED_METADATA_KEYS) };
4176
+ });
4177
+ return { repos: next, changed };
4178
+ }
4179
+ function pick(source, keys) {
4180
+ const result = {};
4181
+ for (const key of keys) {
4182
+ result[key] = source[key];
4183
+ }
4184
+ return result;
4185
+ }
4150
4186
  function resolveDefaultRepoId(existing, existingIds) {
4151
4187
  const placeholder = existing.defaultRepoId;
4152
4188
  if (placeholder && existingIds.has(placeholder)) {
@@ -4200,7 +4236,7 @@ var reposFileSchema = z.object({
4200
4236
  for (const repo of value.repos) {
4201
4237
  if (ids.has(repo.id)) {
4202
4238
  ctx.addIssue({
4203
- code: z.ZodIssueCode.custom,
4239
+ code: "custom",
4204
4240
  path: ["repos"],
4205
4241
  message: `Duplicate repo id: ${repo.id}`
4206
4242
  });
@@ -4211,7 +4247,7 @@ var reposFileSchema = z.object({
4211
4247
  if (value.repos.length === 0) {
4212
4248
  if (value.defaultRepoId !== "") {
4213
4249
  ctx.addIssue({
4214
- code: z.ZodIssueCode.custom,
4250
+ code: "custom",
4215
4251
  path: ["defaultRepoId"],
4216
4252
  message: "defaultRepoId must be '' when repos[] is empty"
4217
4253
  });
@@ -4220,7 +4256,7 @@ var reposFileSchema = z.object({
4220
4256
  }
4221
4257
  if (!ids.has(value.defaultRepoId)) {
4222
4258
  ctx.addIssue({
4223
- code: z.ZodIssueCode.custom,
4259
+ code: "custom",
4224
4260
  path: ["defaultRepoId"],
4225
4261
  message: `defaultRepoId '${value.defaultRepoId}' not present in repos[]`
4226
4262
  });
@@ -4645,7 +4681,7 @@ var CannotRemoveDefaultRepoError = class extends Error {
4645
4681
  async function bootstrapDefaults(store) {
4646
4682
  const config = store.getConfig() ?? await store.ensureLoaded();
4647
4683
  const result = ensureDefaultsInstalled(config, store.getNow());
4648
- if (result.installed.length === 0) {
4684
+ if (result.config === config) {
4649
4685
  return config;
4650
4686
  }
4651
4687
  await store.replaceConfig(result.config);