@codeyam-editor/codeyam-editor 0.1.0 → 0.1.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 (47) hide show
  1. package/npm/cli.js +5 -2
  2. package/npm/cloud-branch-switch.js +442 -0
  3. package/npm/cloud.js +1521 -0
  4. package/npm/container.js +28 -5
  5. package/npm/editor-dev.js +378 -0
  6. package/npm/editor.js +199 -12
  7. package/npm/empty-project-dir.js +33 -0
  8. package/npm/fleet-auth.js +111 -0
  9. package/npm/fleet-cleanup.js +124 -0
  10. package/npm/fleet-env.js +125 -0
  11. package/npm/fleet-memory.js +127 -0
  12. package/npm/fleet-pool-policy.js +78 -0
  13. package/npm/fleet-pool.js +401 -0
  14. package/npm/fleet-queue.js +40 -0
  15. package/npm/fleet-reconcile.js +36 -0
  16. package/npm/fleet-reset.js +144 -0
  17. package/npm/fleet-roster.js +81 -0
  18. package/npm/launch-config.js +544 -0
  19. package/npm/preflight-guidance.js +68 -0
  20. package/npm/scenario-check.js +355 -290
  21. package/npm/scenario-handlers.js +82 -0
  22. package/npm/scenario-interactivity.js +199 -0
  23. package/npm/scenario-issues.js +35 -0
  24. package/npm/scenario-metrics.js +108 -0
  25. package/npm/scenario-mocks.js +107 -0
  26. package/npm/scenario-playwright.js +355 -0
  27. package/npm/utils.js +548 -22
  28. package/npm/vm-urls.js +117 -0
  29. package/package.json +13 -6
  30. package/ui/dist/assets/ContainerInspector-C8EkH4PP.js +2 -0
  31. package/ui/dist/assets/EditorShell-DWaeBxgj.js +186 -0
  32. package/ui/dist/assets/Markdown-BHBqz-Mj.js +1 -0
  33. package/ui/dist/assets/ScenarioDataPanel-DYP7pi_n.css +32 -0
  34. package/ui/dist/assets/ScenarioDataPanel-zJSXtXL4.js +5 -0
  35. package/ui/dist/assets/ScenarioDataPanelFullPage-C0YHQB-T.js +1 -0
  36. package/ui/dist/assets/ScenarioRenderer-CgDxuigm.js +1 -0
  37. package/ui/dist/assets/StepsSimulator-CRtmlyNZ.js +1 -0
  38. package/ui/dist/assets/index-BUYNFqKK.js +27 -0
  39. package/ui/dist/assets/index-DVr5rY2d.css +1 -0
  40. package/ui/dist/assets/markdown-v0F0UEt3.js +37 -0
  41. package/ui/dist/assets/react-CSS0HapR.js +28 -0
  42. package/ui/dist/assets/useEvents-DggWrtHe.js +1 -0
  43. package/ui/dist/assets/xterm--24IGk-x.js +9 -0
  44. package/ui/dist/favicon.ico +0 -0
  45. package/ui/dist/favicon.png +0 -0
  46. package/ui/dist/index.html +16 -0
  47. package/npm/postinstall.js +0 -95
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Launcher-side mirror of `start_preflight` in
5
+ * `crates/codeyam-editor/src/commands/start.rs`. The Rust side is the source
6
+ * of truth for the guidance strings; if it changes, update this file in the
7
+ * same commit and keep the `crates/codeyam-editor/tests/start_preflight_exit_code.rs`
8
+ * test in sync.
9
+ *
10
+ * Mirrors the heuristic in `migration_status::is_legacy_config`: a
11
+ * `.codeyam/config.json` whose JSON has a top-level `webapps` key marks a
12
+ * legacy project. Anything else with no `editor.json` is greenfield.
13
+ */
14
+
15
+ const fs = require("node:fs");
16
+ const path = require("node:path");
17
+
18
+ function greenfieldGuidance(projectDir) {
19
+ return (
20
+ `No codeyam-editor project detected in ${projectDir}.\n\n` +
21
+ "Run `codeyam-editor init` to install the agent bundle, then\n" +
22
+ "open Claude Code and invoke `/codeyam-onboard` to set up this project."
23
+ );
24
+ }
25
+
26
+ function legacyGuidance(projectDir) {
27
+ return (
28
+ `Detected legacy codeyam project in ${projectDir}.\n\n` +
29
+ "Run `codeyam-editor init` to install the agent bundle (it will skip\n" +
30
+ "editor.json creation so the legacy classification is preserved), then\n" +
31
+ "open Claude Code and invoke `/codeyam-onboard` to migrate."
32
+ );
33
+ }
34
+
35
+ function isLegacyConfig(configPath) {
36
+ let raw;
37
+ try {
38
+ raw = fs.readFileSync(configPath, "utf8");
39
+ } catch {
40
+ return false;
41
+ }
42
+ let parsed;
43
+ try {
44
+ parsed = JSON.parse(raw);
45
+ } catch {
46
+ return false;
47
+ }
48
+ return parsed && typeof parsed === "object" && "webapps" in parsed;
49
+ }
50
+
51
+ /**
52
+ * Classify a project directory as `modern`, `legacy`, or `none`, mirroring
53
+ * the Rust `classify` / `start_preflight` pair. `guidance` is the exact
54
+ * stderr text to print before exiting with code 2.
55
+ */
56
+ function classifyProject(projectDir) {
57
+ const editorJson = path.join(projectDir, ".codeyam", "editor.json");
58
+ if (fs.existsSync(editorJson)) {
59
+ return { kind: "modern" };
60
+ }
61
+ const legacyConfig = path.join(projectDir, ".codeyam", "config.json");
62
+ if (isLegacyConfig(legacyConfig)) {
63
+ return { kind: "legacy", guidance: legacyGuidance(projectDir) };
64
+ }
65
+ return { kind: "none", guidance: greenfieldGuidance(projectDir) };
66
+ }
67
+
68
+ module.exports = { classifyProject };