@caddis/cli 0.4.49 → 0.4.51

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 (48) hide show
  1. package/bundles/antigravity-plugin/plugin.json +1 -1
  2. package/bundles/antigravity-plugin/scripts/caddis_routing.py +4 -0
  3. package/bundles/antigravity-plugin/session_end_agy.py +36 -2
  4. package/bundles/antigravity-plugin/skills/flow-studio/SKILL.md +4 -2
  5. package/bundles/antigravity-plugin/skills/flow-studio/model.schema.json +4 -1
  6. package/bundles/antigravity-plugin/skills/flow-studio/react/FlowStudioView.test.tsx +18 -1
  7. package/bundles/antigravity-plugin/skills/flow-studio/react/FlowStudioView.tsx +6 -1
  8. package/bundles/antigravity-plugin/skills/flow-studio/react/README.md +1 -1
  9. package/bundles/antigravity-plugin/skills/flow-studio/references/model-schema.md +16 -0
  10. package/bundles/antigravity-plugin/skills/flow-studio/references/patterns.md +1 -1
  11. package/bundles/antigravity-plugin/skills/flow-studio/references/ux-rules.md +20 -2
  12. package/bundles/antigravity-plugin/skills/flow-studio/src/bars.test.ts +90 -0
  13. package/bundles/antigravity-plugin/skills/flow-studio/src/bars.ts +53 -0
  14. package/bundles/antigravity-plugin/skills/flow-studio/src/ctx.ts +3 -0
  15. package/bundles/antigravity-plugin/skills/flow-studio/src/engine.ts +8 -3
  16. package/bundles/antigravity-plugin/skills/flow-studio/src/layout.test.ts +17 -0
  17. package/bundles/antigravity-plugin/skills/flow-studio/src/layout.ts +2 -1
  18. package/bundles/antigravity-plugin/skills/flow-studio/src/model.ts +11 -0
  19. package/bundles/antigravity-plugin/skills/flow-studio/src/render.ts +4 -2
  20. package/bundles/antigravity-plugin/skills/flow-studio/src/styles.css +5 -0
  21. package/bundles/antigravity-plugin/skills/flow-studio/templates/engine.html +61 -4
  22. package/bundles/antigravity-plugin/skills/flow-studio/templates/flow-studio.css +5 -0
  23. package/bundles/antigravity-plugin/skills/flow-studio/templates/flow-studio.lib.mjs +56 -4
  24. package/bundles/antigravity-plugin-extras/plugin.json +1 -1
  25. package/bundles/antigravity-plugin-extras/skills/agent-orchestration/SKILL.md +38 -0
  26. package/bundles/codex/.codex/skills/frontend/flow-studio/SKILL.md +4 -2
  27. package/bundles/codex/.codex/skills/frontend/flow-studio/model.schema.json +4 -1
  28. package/bundles/codex/.codex/skills/frontend/flow-studio/react/FlowStudioView.test.tsx +18 -1
  29. package/bundles/codex/.codex/skills/frontend/flow-studio/react/FlowStudioView.tsx +6 -1
  30. package/bundles/codex/.codex/skills/frontend/flow-studio/react/README.md +1 -1
  31. package/bundles/codex/.codex/skills/frontend/flow-studio/references/model-schema.md +16 -0
  32. package/bundles/codex/.codex/skills/frontend/flow-studio/references/patterns.md +1 -1
  33. package/bundles/codex/.codex/skills/frontend/flow-studio/references/ux-rules.md +20 -2
  34. package/bundles/codex/.codex/skills/frontend/flow-studio/src/bars.test.ts +90 -0
  35. package/bundles/codex/.codex/skills/frontend/flow-studio/src/bars.ts +53 -0
  36. package/bundles/codex/.codex/skills/frontend/flow-studio/src/ctx.ts +3 -0
  37. package/bundles/codex/.codex/skills/frontend/flow-studio/src/engine.ts +8 -3
  38. package/bundles/codex/.codex/skills/frontend/flow-studio/src/layout.test.ts +17 -0
  39. package/bundles/codex/.codex/skills/frontend/flow-studio/src/layout.ts +2 -1
  40. package/bundles/codex/.codex/skills/frontend/flow-studio/src/model.ts +11 -0
  41. package/bundles/codex/.codex/skills/frontend/flow-studio/src/render.ts +4 -2
  42. package/bundles/codex/.codex/skills/frontend/flow-studio/src/styles.css +5 -0
  43. package/bundles/codex/.codex/skills/frontend/flow-studio/templates/engine.html +61 -4
  44. package/bundles/codex/.codex/skills/frontend/flow-studio/templates/flow-studio.css +5 -0
  45. package/bundles/codex/.codex/skills/frontend/flow-studio/templates/flow-studio.lib.mjs +56 -4
  46. package/bundles/manifest.json +3 -3
  47. package/dist/cli.js +94 -1
  48. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5761,15 +5761,77 @@ var claudeAdapter = {
5761
5761
  // src/agents/agy.ts
5762
5762
  init_exec();
5763
5763
  init_which();
5764
- init_pkg();
5765
5764
  import { readFileSync as readFileSync2, existsSync as existsSync2, mkdtempSync, cpSync, rmSync } from "fs";
5766
5765
  import os from "os";
5767
5766
  import path2 from "path";
5767
+
5768
+ // src/util/agyProcs.ts
5769
+ init_exec();
5770
+ function parseTasklistCsv(stdout) {
5771
+ const pids = [];
5772
+ for (const line2 of stdout.split(/\r?\n/)) {
5773
+ const match = /^"agy\.exe","(\d+)"/i.exec(line2.trim());
5774
+ if (match) pids.push(Number(match[1]));
5775
+ }
5776
+ return pids;
5777
+ }
5778
+ function parsePgrep(stdout) {
5779
+ return stdout.split(/\r?\n/).map((line2) => line2.trim()).filter((line2) => /^\d+$/.test(line2)).map(Number);
5780
+ }
5781
+ async function listAgyPids() {
5782
+ if (process.platform === "win32") {
5783
+ const result2 = await run("tasklist", ["/FI", "IMAGENAME eq agy.exe", "/FO", "CSV", "/NH"], { timeout: 2e4 });
5784
+ return result2.ok ? parseTasklistCsv(result2.stdout) : [];
5785
+ }
5786
+ const result = await run("pgrep", ["-x", "agy"], { timeout: 1e4 });
5787
+ return result.ok ? parsePgrep(result.stdout) : [];
5788
+ }
5789
+
5790
+ // src/agents/agy.ts
5791
+ init_pkg();
5768
5792
  var BIN2 = "agy";
5769
5793
  var BUNDLE = "antigravity-plugin";
5770
5794
  var PLUGIN2 = "caddis";
5771
5795
  var EXTRAS_BUNDLE = "antigravity-plugin-extras";
5772
5796
  var EXTRAS_PLUGIN = "caddis-extras";
5797
+ var REQUIRED_PLUGIN_FILES = ["plugin.json", "hooks.json", "guard_agy.py"];
5798
+ var ALLOW_RUNNING_ENV = "CADDIS_AGY_ALLOW_RUNNING";
5799
+ function pluginDirFor(home = os.homedir(), plugin = PLUGIN2) {
5800
+ return path2.join(home, ".gemini", "config", "plugins", plugin);
5801
+ }
5802
+ function missingPluginFiles(home = os.homedir()) {
5803
+ const dir = pluginDirFor(home);
5804
+ return REQUIRED_PLUGIN_FILES.filter((file) => !existsSync2(path2.join(dir, file)));
5805
+ }
5806
+ function backupInstalledPlugin(home) {
5807
+ const dir = pluginDirFor(home);
5808
+ if (!existsSync2(dir)) return null;
5809
+ const holder = mkdtempSync(path2.join(os.tmpdir(), "caddis-agy-backup-"));
5810
+ const copy = path2.join(holder, PLUGIN2);
5811
+ cpSync(dir, copy, { recursive: true });
5812
+ let keep = false;
5813
+ return {
5814
+ location: copy,
5815
+ // Returns null when the old plugin is back, else the reason it could not be put back.
5816
+ restore: () => {
5817
+ try {
5818
+ rmSync(dir, { recursive: true, force: true });
5819
+ cpSync(copy, dir, { recursive: true });
5820
+ return null;
5821
+ } catch (error) {
5822
+ keep = true;
5823
+ return error instanceof Error ? error.message : String(error);
5824
+ }
5825
+ },
5826
+ cleanup: () => {
5827
+ if (keep) return;
5828
+ try {
5829
+ rmSync(holder, { recursive: true, force: true });
5830
+ } catch {
5831
+ }
5832
+ }
5833
+ };
5834
+ }
5773
5835
  function pluginManifestPath(home = os.homedir(), plugin = PLUGIN2) {
5774
5836
  return path2.join(home, ".gemini", "config", "plugins", plugin, "plugin.json");
5775
5837
  }
@@ -5890,7 +5952,21 @@ async function drive2(_action, options) {
5890
5952
  message: "dry run \u2014 nothing executed"
5891
5953
  };
5892
5954
  }
5955
+ if (process.env[ALLOW_RUNNING_ENV] !== "1") {
5956
+ const running = await listAgyPids();
5957
+ if (running.length > 0) {
5958
+ return {
5959
+ ok: false,
5960
+ skipped: false,
5961
+ steps: [],
5962
+ message: `agy is running (PID ${running.join(", ")}). Installing now can empty the caddis plugin under it, and agy then refuses every edit. Stop agy and run this again, or set ${ALLOW_RUNNING_ENV}=1 if you know no agy holds the plugin folder.`
5963
+ };
5964
+ }
5965
+ }
5966
+ const home = options.home ?? os.homedir();
5967
+ const backup = backupInstalledPlugin(home);
5893
5968
  const cleanups = [];
5969
+ if (backup) cleanups.push(backup.cleanup);
5894
5970
  try {
5895
5971
  const steps3 = [];
5896
5972
  for (const step of planned) {
@@ -5899,6 +5975,23 @@ async function drive2(_action, options) {
5899
5975
  cleanups.push(staged.cleanup);
5900
5976
  const execArgs = [...step.args.slice(0, -1), staged.installPath];
5901
5977
  const result = await run(step.cmd, execArgs);
5978
+ if (step.bundleDir === bundle) {
5979
+ const missing = missingPluginFiles(home);
5980
+ if (missing.length > 0) {
5981
+ let outcome = "there was nothing to restore";
5982
+ if (backup) {
5983
+ const failure = backup.restore();
5984
+ outcome = failure === null ? "the previous plugin was restored" : `the restore FAILED (${failure}); the old plugin is kept at ${backup.location}`;
5985
+ }
5986
+ steps3.push({ command, ok: false, code: result.code, output: `missing after the install: ${missing.join(", ")}` });
5987
+ return {
5988
+ ok: false,
5989
+ skipped: false,
5990
+ steps: steps3,
5991
+ message: `the caddis plugin is incomplete after the install (missing ${missing.join(", ")}); ` + outcome
5992
+ };
5993
+ }
5994
+ }
5902
5995
  steps3.push({
5903
5996
  command,
5904
5997
  ok: result.ok,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caddis/cli",
3
- "version": "0.4.49",
3
+ "version": "0.4.51",
4
4
  "description": "Install, update and diagnose the caddis dev harness across every coding agent you use (Claude Code, agy/Antigravity, and more).",
5
5
  "keywords": [
6
6
  "caddis",