@bastani/atomic 0.6.5 → 0.6.6-0

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 (125) hide show
  1. package/.agents/skills/ado-commit/SKILL.md +2 -0
  2. package/.agents/skills/ado-create-pr/SKILL.md +2 -0
  3. package/.agents/skills/advanced-evaluation/SKILL.md +2 -0
  4. package/.agents/skills/ast-grep/SKILL.md +2 -0
  5. package/.agents/skills/bdi-mental-states/SKILL.md +2 -0
  6. package/.agents/skills/bun/SKILL.md +156 -122
  7. package/.agents/skills/context-compression/SKILL.md +2 -0
  8. package/.agents/skills/context-degradation/SKILL.md +2 -0
  9. package/.agents/skills/context-fundamentals/SKILL.md +2 -0
  10. package/.agents/skills/context-optimization/SKILL.md +2 -0
  11. package/.agents/skills/create-spec/SKILL.md +2 -0
  12. package/.agents/skills/docx/SKILL.md +2 -0
  13. package/.agents/skills/evaluation/SKILL.md +2 -0
  14. package/.agents/skills/explain-code/SKILL.md +2 -0
  15. package/.agents/skills/filesystem-context/SKILL.md +2 -0
  16. package/.agents/skills/find-skills/SKILL.md +2 -0
  17. package/.agents/skills/gh-commit/SKILL.md +2 -0
  18. package/.agents/skills/gh-create-pr/SKILL.md +2 -0
  19. package/.agents/skills/hosted-agents/SKILL.md +2 -0
  20. package/.agents/skills/impeccable/SKILL.md +117 -304
  21. package/.agents/skills/impeccable/agents/openai.yaml +4 -0
  22. package/.agents/skills/{adapt/SKILL.md → impeccable/reference/adapt.md} +2 -11
  23. package/.agents/skills/{animate/SKILL.md → impeccable/reference/animate.md} +15 -15
  24. package/.agents/skills/{audit/SKILL.md → impeccable/reference/audit.md} +8 -22
  25. package/.agents/skills/{bolder/SKILL.md → impeccable/reference/bolder.md} +9 -13
  26. package/.agents/skills/impeccable/reference/brand.md +114 -0
  27. package/.agents/skills/{clarify/SKILL.md → impeccable/reference/clarify.md} +2 -11
  28. package/.agents/skills/{colorize/SKILL.md → impeccable/reference/colorize.md} +23 -12
  29. package/.agents/skills/impeccable/reference/craft.md +152 -29
  30. package/.agents/skills/{critique/SKILL.md → impeccable/reference/critique.md} +25 -37
  31. package/.agents/skills/{delight/SKILL.md → impeccable/reference/delight.md} +9 -11
  32. package/.agents/skills/{distill/SKILL.md → impeccable/reference/distill.md} +2 -13
  33. package/.agents/skills/impeccable/reference/document.md +427 -0
  34. package/.agents/skills/impeccable/reference/extract.md +1 -1
  35. package/.agents/skills/{harden/SKILL.md → impeccable/reference/harden.md} +1 -43
  36. package/.agents/skills/{layout/SKILL.md → impeccable/reference/layout.md} +27 -11
  37. package/.agents/skills/impeccable/reference/live.md +594 -0
  38. package/.agents/skills/impeccable/reference/motion-design.md +12 -2
  39. package/.agents/skills/impeccable/reference/onboard.md +234 -0
  40. package/.agents/skills/{optimize/SKILL.md → impeccable/reference/optimize.md} +4 -12
  41. package/.agents/skills/{overdrive/SKILL.md → impeccable/reference/overdrive.md} +9 -21
  42. package/.agents/skills/{critique → impeccable}/reference/personas.md +1 -1
  43. package/.agents/skills/{polish/SKILL.md → impeccable/reference/polish.md} +31 -23
  44. package/.agents/skills/impeccable/reference/product.md +62 -0
  45. package/.agents/skills/{quieter/SKILL.md → impeccable/reference/quieter.md} +7 -11
  46. package/.agents/skills/impeccable/reference/shape.md +151 -0
  47. package/.agents/skills/impeccable/reference/teach.md +156 -0
  48. package/.agents/skills/{typeset/SKILL.md → impeccable/reference/typeset.md} +19 -11
  49. package/.agents/skills/impeccable/reference/typography.md +31 -14
  50. package/.agents/skills/impeccable/scripts/cleanup-deprecated.mjs +87 -17
  51. package/.agents/skills/impeccable/scripts/command-metadata.json +94 -0
  52. package/.agents/skills/impeccable/scripts/design-parser.mjs +820 -0
  53. package/.agents/skills/impeccable/scripts/detect-csp.mjs +198 -0
  54. package/.agents/skills/impeccable/scripts/is-generated.mjs +69 -0
  55. package/.agents/skills/impeccable/scripts/live-accept.mjs +595 -0
  56. package/.agents/skills/impeccable/scripts/live-browser.js +4781 -0
  57. package/.agents/skills/impeccable/scripts/live-inject.mjs +445 -0
  58. package/.agents/skills/impeccable/scripts/live-poll.mjs +186 -0
  59. package/.agents/skills/impeccable/scripts/live-server.mjs +694 -0
  60. package/.agents/skills/impeccable/scripts/live-wrap.mjs +571 -0
  61. package/.agents/skills/impeccable/scripts/live.mjs +247 -0
  62. package/.agents/skills/impeccable/scripts/load-context.mjs +141 -0
  63. package/.agents/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
  64. package/.agents/skills/impeccable/scripts/pin.mjs +214 -0
  65. package/.agents/skills/init/SKILL.md +2 -0
  66. package/.agents/skills/liteparse/SKILL.md +1 -0
  67. package/.agents/skills/memory-systems/SKILL.md +2 -0
  68. package/.agents/skills/multi-agent-patterns/SKILL.md +2 -0
  69. package/.agents/skills/opentui/SKILL.md +1 -0
  70. package/.agents/skills/pdf/SKILL.md +2 -0
  71. package/.agents/skills/playwright-cli/SKILL.md +51 -5
  72. package/.agents/skills/playwright-cli/references/playwright-tests.md +1 -1
  73. package/.agents/skills/playwright-cli/references/running-code.md +10 -0
  74. package/.agents/skills/playwright-cli/references/session-management.md +56 -0
  75. package/.agents/skills/playwright-cli/references/spec-driven-testing.md +305 -0
  76. package/.agents/skills/playwright-cli/references/test-generation.md +49 -3
  77. package/.agents/skills/pptx/SKILL.md +2 -0
  78. package/.agents/skills/project-development/SKILL.md +2 -0
  79. package/.agents/skills/prompt-engineer/SKILL.md +2 -0
  80. package/.agents/skills/research-codebase/SKILL.md +2 -0
  81. package/.agents/skills/ripgrep/SKILL.md +2 -0
  82. package/.agents/skills/skill-creator/LICENSE.txt +1 -1
  83. package/.agents/skills/skill-creator/SKILL.md +2 -0
  84. package/.agents/skills/sl-commit/SKILL.md +2 -0
  85. package/.agents/skills/sl-submit-diff/SKILL.md +2 -0
  86. package/.agents/skills/tdd/SKILL.md +4 -0
  87. package/.agents/skills/tool-design/SKILL.md +2 -0
  88. package/.agents/skills/typescript-advanced-types/SKILL.md +2 -1
  89. package/.agents/skills/typescript-expert/SKILL.md +7 -1
  90. package/.agents/skills/typescript-react-reviewer/SKILL.md +2 -1
  91. package/.agents/skills/workflow-creator/SKILL.md +75 -72
  92. package/.agents/skills/workflow-creator/references/session-config.md +48 -1
  93. package/.agents/skills/xlsx/SKILL.md +2 -0
  94. package/.opencode/opencode.json +4 -2
  95. package/dist/sdk/runtime/executor.d.ts +8 -0
  96. package/dist/sdk/runtime/executor.d.ts.map +1 -1
  97. package/dist/sdk/runtime/port-discovery.d.ts +71 -0
  98. package/dist/sdk/runtime/port-discovery.d.ts.map +1 -0
  99. package/dist/sdk/runtime/tmux.d.ts +10 -0
  100. package/dist/sdk/runtime/tmux.d.ts.map +1 -1
  101. package/dist/sdk/types.d.ts +1 -0
  102. package/dist/sdk/types.d.ts.map +1 -1
  103. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts.map +1 -1
  104. package/dist/sdk/workflows/builtin/open-claude-design/opencode/index.d.ts.map +1 -1
  105. package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts.map +1 -1
  106. package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts.map +1 -1
  107. package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts +15 -0
  108. package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts.map +1 -1
  109. package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts.map +1 -1
  110. package/package.json +1 -1
  111. package/src/sdk/runtime/executor.test.ts +254 -1
  112. package/src/sdk/runtime/executor.ts +135 -89
  113. package/src/sdk/runtime/port-discovery.test.ts +573 -0
  114. package/src/sdk/runtime/port-discovery.ts +496 -0
  115. package/src/sdk/runtime/tmux.ts +16 -0
  116. package/src/sdk/types.ts +1 -0
  117. package/src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts +24 -6
  118. package/src/sdk/workflows/builtin/open-claude-design/opencode/index.ts +52 -13
  119. package/src/sdk/workflows/builtin/ralph/claude/index.ts +31 -3
  120. package/src/sdk/workflows/builtin/ralph/copilot/index.ts +16 -0
  121. package/src/sdk/workflows/builtin/ralph/helpers/prompts.ts +70 -3
  122. package/src/sdk/workflows/builtin/ralph/opencode/index.ts +50 -6
  123. package/.agents/skills/shape/SKILL.md +0 -96
  124. /package/.agents/skills/{critique → impeccable}/reference/cognitive-load.md +0 -0
  125. /package/.agents/skills/{critique → impeccable}/reference/heuristics-scoring.md +0 -0
@@ -1,4 +1,4 @@
1
- import { test, expect, describe, beforeEach, afterEach } from "bun:test";
1
+ import { test, expect, describe, beforeEach, afterEach, mock } from "bun:test";
2
2
  import { mkdtempSync, writeFileSync, chmodSync, rmSync } from "node:fs";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
@@ -13,6 +13,8 @@ import {
13
13
  discoverCopilotBinary,
14
14
  applyContainerEnvDefaults,
15
15
  normalizeExternalCopilotOptions,
16
+ buildPaneCommand,
17
+ waitForServer,
16
18
  type CopilotHILSessionSurface,
17
19
  } from "./executor.ts";
18
20
  import type { SavedMessage } from "../types.ts";
@@ -998,3 +1000,254 @@ describe("discoverCopilotBinary / shouldOverrideCopilotCliPath", () => {
998
1000
  expect(process.env.COPILOT_CLI_PATH).toBe("/custom/copilot");
999
1001
  });
1000
1002
  });
1003
+
1004
+ // ---------------------------------------------------------------------------
1005
+ // buildPaneCommand
1006
+ // ---------------------------------------------------------------------------
1007
+
1008
+ describe("buildPaneCommand", () => {
1009
+ test("copilot: command contains --ui-server and --port 0", () => {
1010
+ const { command } = buildPaneCommand("copilot");
1011
+ expect(command).toContain("--ui-server");
1012
+ expect(command).toContain("--port 0");
1013
+ });
1014
+
1015
+ test("copilot: command invokes the copilot binary as the first token", () => {
1016
+ const { command } = buildPaneCommand("copilot");
1017
+ // Accept either a bare name (binary not on PATH in test env) or an
1018
+ // absolute path resolved via Bun.which — both end in "copilot".
1019
+ expect(command).toMatch(/^("[^"]*\/)?[^\s"]*copilot"?\s/);
1020
+ });
1021
+
1022
+ test("opencode: command contains --port 0 but not --ui-server", () => {
1023
+ const { command } = buildPaneCommand("opencode");
1024
+ expect(command).toContain("--port 0");
1025
+ expect(command).not.toContain("--ui-server");
1026
+ });
1027
+
1028
+ test("opencode: command invokes the opencode binary as the first token", () => {
1029
+ const { command } = buildPaneCommand("opencode");
1030
+ expect(command).toMatch(/^("[^"]*\/)?[^\s"]*opencode"?\s/);
1031
+ });
1032
+
1033
+ test("claude: command resolves to a shell and does not contain --port", () => {
1034
+ const { command } = buildPaneCommand("claude");
1035
+ // SHELL is typically already absolute (e.g. /bin/zsh) so it passes through
1036
+ // unchanged; bare fallbacks ("sh"/"pwsh") get resolved via Bun.which.
1037
+ const expected =
1038
+ process.env.SHELL || (process.platform === "win32" ? "pwsh" : "sh");
1039
+ const stripped = command.replace(/^"|"$/g, "");
1040
+ if (expected.includes("/") || expected.includes("\\")) {
1041
+ expect(stripped).toBe(expected);
1042
+ } else {
1043
+ // Bare fallback either resolved via Bun.which or returned as-is.
1044
+ expect(stripped.endsWith(expected) || stripped === expected).toBe(true);
1045
+ }
1046
+ expect(command).not.toContain("--port");
1047
+ });
1048
+
1049
+ test("overrides.envVars merges with defaults for copilot", () => {
1050
+ const { envVars } = buildPaneCommand("copilot", {
1051
+ envVars: { MY_VAR: "hello" },
1052
+ });
1053
+ // Default copilot env var preserved
1054
+ expect(envVars.COPILOT_ALLOW_ALL).toBe("true");
1055
+ // Override merged in
1056
+ expect(envVars.MY_VAR).toBe("hello");
1057
+ });
1058
+
1059
+ test("overrides.chatFlags replaces defaults for copilot", () => {
1060
+ const { command } = buildPaneCommand("copilot", {
1061
+ chatFlags: ["--custom-flag"],
1062
+ });
1063
+ expect(command).toContain("--custom-flag");
1064
+ // Default flags should be absent
1065
+ expect(command).not.toContain("--add-dir");
1066
+ });
1067
+
1068
+ test("extraChatFlags appended to copilot command", () => {
1069
+ const { command } = buildPaneCommand("copilot", {}, ["--extra-flag"]);
1070
+ expect(command).toContain("--extra-flag");
1071
+ });
1072
+
1073
+ test("extraChatFlags not appended to opencode command", () => {
1074
+ const { command } = buildPaneCommand("opencode", {}, ["--extra-flag"]);
1075
+ expect(command).not.toContain("--extra-flag");
1076
+ });
1077
+ });
1078
+
1079
+ // ---------------------------------------------------------------------------
1080
+ // waitForServer
1081
+ // ---------------------------------------------------------------------------
1082
+
1083
+ // Three non-empty lines — enough to break the TUI-render loop.
1084
+ const PANE_CONTENT_READY = "line one\nline two\nline three\n";
1085
+
1086
+ // ---------------------------------------------------------------------------
1087
+ // waitForServer — module-level captures for mock.module cleanup
1088
+ // ---------------------------------------------------------------------------
1089
+
1090
+ // Snapshot the real function values BEFORE any mock.module call.
1091
+ // We can't hold the module namespace reference because mock.module mutates it
1092
+ // in-place, so we must copy the property values into a plain object snapshot.
1093
+ const _tmuxMod = await import("./tmux.ts");
1094
+ const realTmuxSnapshot = { ..._tmuxMod };
1095
+ const _portMod = await import("./port-discovery.ts");
1096
+ const realPortDiscoverySnapshot = { ..._portMod };
1097
+ let realCopilotSdkSnapshot: Record<string, unknown> | null = null;
1098
+ try {
1099
+ const _copilotMod = await import("@github/copilot-sdk");
1100
+ realCopilotSdkSnapshot = { ..._copilotMod };
1101
+ } catch {
1102
+ // optional dependency — not installed in all environments
1103
+ }
1104
+
1105
+ describe("waitForServer", () => {
1106
+ // Save and restore Bun.sleep so we can make it instant in async tests.
1107
+ let originalSleep: typeof Bun.sleep;
1108
+
1109
+ beforeEach(() => {
1110
+ originalSleep = Bun.sleep;
1111
+ // Make Bun.sleep a no-op so probe retry loops resolve immediately.
1112
+ (globalThis as { Bun: { sleep: (ms: number) => Promise<void> } }).Bun.sleep =
1113
+ () => Promise.resolve();
1114
+ });
1115
+
1116
+ afterEach(() => {
1117
+ (globalThis as { Bun: { sleep: typeof Bun.sleep } }).Bun.sleep =
1118
+ originalSleep;
1119
+ // Restore module mocks so they don't leak into subsequent test files.
1120
+ // Use snapshot copies (not live references) because mock.module mutates
1121
+ // the module namespace in-place.
1122
+ mock.module("./tmux.ts", () => realTmuxSnapshot);
1123
+ mock.module("./port-discovery.ts", () => realPortDiscoverySnapshot);
1124
+ if (realCopilotSdkSnapshot !== null) {
1125
+ mock.module("@github/copilot-sdk", () => realCopilotSdkSnapshot!);
1126
+ }
1127
+ });
1128
+
1129
+ test('returns "" immediately for agent "claude" without touching tmux', async () => {
1130
+ // No mocks for tmux — any call would throw because real tmux isn't running.
1131
+ const result = await waitForServer("claude", "%0");
1132
+ expect(result).toBe("");
1133
+ });
1134
+
1135
+ test("copilot: throws when getPanePid returns null", async () => {
1136
+ mock.module("./tmux.ts", () => ({
1137
+ capturePane: () => PANE_CONTENT_READY,
1138
+ getPanePid: () => null,
1139
+ // preserve other named exports as stubs
1140
+ spawnMuxAttach: () => {},
1141
+ }));
1142
+
1143
+ let err: Error | undefined;
1144
+ try {
1145
+ await waitForServer("copilot", "%0");
1146
+ } catch (e) {
1147
+ err = e as Error;
1148
+ }
1149
+ expect(err?.message).toContain("failed to resolve agent PID");
1150
+ });
1151
+
1152
+ test("copilot: throws when port discovery times out (getListeningPortForPid returns null)", async () => {
1153
+ mock.module("./tmux.ts", () => ({
1154
+ capturePane: () => PANE_CONTENT_READY,
1155
+ getPanePid: () => 12345,
1156
+ spawnMuxAttach: () => {},
1157
+ }));
1158
+
1159
+ mock.module("./port-discovery.ts", () => ({
1160
+ getListeningPortForPid: async () => null,
1161
+ PORT_DISCOVERY_TIMEOUT_MS: 100,
1162
+ }));
1163
+
1164
+ let err: Error | undefined;
1165
+ try {
1166
+ await waitForServer("copilot", "%0");
1167
+ } catch (e) {
1168
+ err = e as Error;
1169
+ }
1170
+ expect(err?.message).toContain("did not bind a TCP port");
1171
+ });
1172
+
1173
+ test("copilot: throws when SDK probe fails (CopilotClient.start rejects)", async () => {
1174
+ mock.module("./tmux.ts", () => ({
1175
+ capturePane: () => PANE_CONTENT_READY,
1176
+ getPanePid: () => 12345,
1177
+ spawnMuxAttach: () => {},
1178
+ }));
1179
+
1180
+ mock.module("./port-discovery.ts", () => ({
1181
+ getListeningPortForPid: async () => 50001,
1182
+ PORT_DISCOVERY_TIMEOUT_MS: 100,
1183
+ }));
1184
+
1185
+ mock.module("@github/copilot-sdk", () => ({
1186
+ CopilotClient: class {
1187
+ start() {
1188
+ return Promise.reject(new Error("connection refused"));
1189
+ }
1190
+ listSessions() {
1191
+ return Promise.resolve([]);
1192
+ }
1193
+ stop() {
1194
+ return Promise.resolve();
1195
+ }
1196
+ },
1197
+ }));
1198
+
1199
+ // SERVER_PROBE_TIMEOUT_MS is 60_000 but Bun.sleep is mocked to instant,
1200
+ // so the loop burns through retries until Date.now() passes the deadline.
1201
+ // To avoid a real 60s wall-clock wait we mock Date.now temporarily.
1202
+ const realDateNow = Date.now;
1203
+ let callCount = 0;
1204
+ Date.now = () => {
1205
+ callCount++;
1206
+ // First few calls (port-deadline checks, probe-deadline setup): allow.
1207
+ // After 10 calls assume probe deadline has passed.
1208
+ return callCount > 10 ? realDateNow() + 999_999 : realDateNow();
1209
+ };
1210
+
1211
+ let err: Error | undefined;
1212
+ try {
1213
+ try {
1214
+ await waitForServer("copilot", "%0");
1215
+ } catch (e) {
1216
+ err = e as Error;
1217
+ }
1218
+ } finally {
1219
+ Date.now = realDateNow;
1220
+ }
1221
+ expect(err?.message).toContain("copilot SDK probe did not respond");
1222
+ });
1223
+
1224
+ test("copilot: returns localhost:<port> when SDK probe succeeds", async () => {
1225
+ mock.module("./tmux.ts", () => ({
1226
+ capturePane: () => PANE_CONTENT_READY,
1227
+ getPanePid: () => 12345,
1228
+ spawnMuxAttach: () => {},
1229
+ }));
1230
+
1231
+ mock.module("./port-discovery.ts", () => ({
1232
+ getListeningPortForPid: async () => 50001,
1233
+ PORT_DISCOVERY_TIMEOUT_MS: 100,
1234
+ }));
1235
+
1236
+ mock.module("@github/copilot-sdk", () => ({
1237
+ CopilotClient: class {
1238
+ start() {
1239
+ return Promise.resolve();
1240
+ }
1241
+ listSessions() {
1242
+ return Promise.resolve([]);
1243
+ }
1244
+ stop() {
1245
+ return Promise.resolve();
1246
+ }
1247
+ },
1248
+ }));
1249
+
1250
+ const result = await waitForServer("copilot", "%0");
1251
+ expect(result).toBe("localhost:50001");
1252
+ });
1253
+ });