@hasna/configs 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +49 -0
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3888,6 +3888,47 @@ _configs_completions() {
3888
3888
  complete -F _configs_completions configs`);
3889
3889
  }
3890
3890
  });
3891
+ program.command("compare <a> <b>").description("Diff two stored configs against each other").action(async (a, b) => {
3892
+ try {
3893
+ const configA = getConfig(a);
3894
+ const configB = getConfig(b);
3895
+ console.log(chalk.bold(`${configA.slug}`) + chalk.dim(` (${configA.category}/${configA.agent})`));
3896
+ console.log(chalk.bold(`${configB.slug}`) + chalk.dim(` (${configB.category}/${configB.agent})`));
3897
+ console.log();
3898
+ const linesA = configA.content.split(`
3899
+ `);
3900
+ const linesB = configB.content.split(`
3901
+ `);
3902
+ const maxLen = Math.max(linesA.length, linesB.length);
3903
+ const lines = [`--- ${configA.slug}`, `+++ ${configB.slug}`];
3904
+ let diffs = 0;
3905
+ for (let i = 0;i < maxLen; i++) {
3906
+ const la = linesA[i];
3907
+ const lb = linesB[i];
3908
+ if (la === lb) {
3909
+ if (la !== undefined)
3910
+ lines.push(` ${la}`);
3911
+ } else {
3912
+ diffs++;
3913
+ if (la !== undefined)
3914
+ lines.push(chalk.red(`-${la}`));
3915
+ if (lb !== undefined)
3916
+ lines.push(chalk.green(`+${lb}`));
3917
+ }
3918
+ }
3919
+ if (diffs === 0) {
3920
+ console.log(chalk.green("\u2713") + " Identical content");
3921
+ } else {
3922
+ console.log(lines.join(`
3923
+ `));
3924
+ console.log(chalk.dim(`
3925
+ ${diffs} difference(s)`));
3926
+ }
3927
+ } catch (e) {
3928
+ console.error(chalk.red(e instanceof Error ? e.message : String(e)));
3929
+ process.exit(1);
3930
+ }
3931
+ });
3891
3932
  program.command("watch").description("Watch known config files for changes and auto-sync to DB").option("-i, --interval <ms>", "poll interval in milliseconds", "3000").action(async (opts) => {
3892
3933
  const interval = Number(opts.interval);
3893
3934
  const { statSync: st } = await import("fs");
@@ -3933,5 +3974,13 @@ program.command("watch").description("Watch known config files for changes and a
3933
3974
  setInterval(tick, interval);
3934
3975
  await new Promise(() => {});
3935
3976
  });
3977
+ program.command("pull").description("Alias for sync (read from disk into DB)").option("-a, --agent <agent>", "only sync this agent").option("--dry-run", "preview without writing").action(async (opts) => {
3978
+ const result = await syncKnown({ dryRun: opts.dryRun, agent: opts.agent });
3979
+ console.log(chalk.green("\u2713") + ` Pulled: +${result.added} updated:${result.updated} unchanged:${result.unchanged}`);
3980
+ });
3981
+ program.command("push").description("Alias for sync --to-disk (write DB configs to disk)").option("-a, --agent <agent>", "only push this agent").option("--dry-run", "preview without writing").action(async (opts) => {
3982
+ const result = await syncToDisk({ dryRun: opts.dryRun, agent: opts.agent });
3983
+ console.log(chalk.green("\u2713") + ` Pushed: updated:${result.updated} unchanged:${result.unchanged} skipped:${result.skipped.length}`);
3984
+ });
3936
3985
  program.version(pkg.version).name("configs");
3937
3986
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/configs",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "AI coding agent configuration manager — store, version, apply, and share all your AI coding configs. CLI + MCP + REST API + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",