@reticlehq/init 2.14.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 (114) hide show
  1. package/LICENSE +105 -0
  2. package/NOTICE +5 -0
  3. package/README.md +29 -0
  4. package/dist/agent-rules.d.ts +116 -0
  5. package/dist/agent-rules.js +279 -0
  6. package/dist/app-choice.d.ts +29 -0
  7. package/dist/app-choice.js +39 -0
  8. package/dist/astro-host.d.ts +21 -0
  9. package/dist/astro-host.js +27 -0
  10. package/dist/astro-patch.d.ts +33 -0
  11. package/dist/astro-patch.js +103 -0
  12. package/dist/brace-scan.d.ts +24 -0
  13. package/dist/brace-scan.js +46 -0
  14. package/dist/capabilities.d.ts +40 -0
  15. package/dist/capabilities.js +167 -0
  16. package/dist/closing-hint.d.ts +35 -0
  17. package/dist/closing-hint.js +122 -0
  18. package/dist/codex-toml.d.ts +10 -0
  19. package/dist/codex-toml.js +144 -0
  20. package/dist/connect-steps.d.ts +55 -0
  21. package/dist/connect-steps.js +92 -0
  22. package/dist/cra.d.ts +82 -0
  23. package/dist/cra.js +183 -0
  24. package/dist/csp-check.d.ts +49 -0
  25. package/dist/csp-check.js +168 -0
  26. package/dist/csp-doctor.d.ts +32 -0
  27. package/dist/csp-doctor.js +62 -0
  28. package/dist/desktop-doctor.d.ts +46 -0
  29. package/dist/desktop-doctor.js +201 -0
  30. package/dist/detect.d.ts +225 -0
  31. package/dist/detect.js +334 -0
  32. package/dist/dev-script.d.ts +51 -0
  33. package/dist/dev-script.js +66 -0
  34. package/dist/dev-server-ports.d.ts +20 -0
  35. package/dist/dev-server-ports.js +45 -0
  36. package/dist/electron-patch.d.ts +11 -0
  37. package/dist/electron-patch.js +70 -0
  38. package/dist/electron-vite-patch.d.ts +12 -0
  39. package/dist/electron-vite-patch.js +100 -0
  40. package/dist/existing-config.d.ts +31 -0
  41. package/dist/existing-config.js +63 -0
  42. package/dist/format-generated.d.ts +18 -0
  43. package/dist/format-generated.js +48 -0
  44. package/dist/framework-adapter.d.ts +60 -0
  45. package/dist/framework-adapter.js +138 -0
  46. package/dist/host.d.ts +41 -0
  47. package/dist/host.js +21 -0
  48. package/dist/index.d.ts +25 -0
  49. package/dist/index.js +25 -0
  50. package/dist/init-failure.d.ts +19 -0
  51. package/dist/init-failure.js +18 -0
  52. package/dist/init-opt-out.d.ts +17 -0
  53. package/dist/init-opt-out.js +30 -0
  54. package/dist/install-hint.d.ts +9 -0
  55. package/dist/install-hint.js +41 -0
  56. package/dist/install-retries.d.ts +22 -0
  57. package/dist/install-retries.js +65 -0
  58. package/dist/install-source-config.d.ts +18 -0
  59. package/dist/install-source-config.js +34 -0
  60. package/dist/lockfiles.d.ts +14 -0
  61. package/dist/lockfiles.js +49 -0
  62. package/dist/mcp-clients.d.ts +94 -0
  63. package/dist/mcp-clients.js +327 -0
  64. package/dist/mcp-registered.d.ts +12 -0
  65. package/dist/mcp-registered.js +14 -0
  66. package/dist/mcp.d.ts +89 -0
  67. package/dist/mcp.js +129 -0
  68. package/dist/next-patch.d.ts +49 -0
  69. package/dist/next-patch.js +237 -0
  70. package/dist/node-io.d.ts +22 -0
  71. package/dist/node-io.js +150 -0
  72. package/dist/non-js-project.d.ts +44 -0
  73. package/dist/non-js-project.js +137 -0
  74. package/dist/nuxt-patch.d.ts +18 -0
  75. package/dist/nuxt-patch.js +33 -0
  76. package/dist/patch-kind.d.ts +20 -0
  77. package/dist/patch-kind.js +10 -0
  78. package/dist/plan-electron-vite.d.ts +16 -0
  79. package/dist/plan-electron-vite.js +72 -0
  80. package/dist/plan-framework.d.ts +122 -0
  81. package/dist/plan-framework.js +773 -0
  82. package/dist/plan.d.ts +312 -0
  83. package/dist/plan.js +650 -0
  84. package/dist/platform.d.ts +16 -0
  85. package/dist/platform.js +16 -0
  86. package/dist/preflight.d.ts +30 -0
  87. package/dist/preflight.js +52 -0
  88. package/dist/project-id.d.ts +12 -0
  89. package/dist/project-id.js +25 -0
  90. package/dist/refresh-rules.d.ts +40 -0
  91. package/dist/refresh-rules.js +51 -0
  92. package/dist/remember-project.d.ts +24 -0
  93. package/dist/remember-project.js +40 -0
  94. package/dist/run.d.ts +122 -0
  95. package/dist/run.js +762 -0
  96. package/dist/slash-command.d.ts +27 -0
  97. package/dist/slash-command.js +132 -0
  98. package/dist/snippets.d.ts +267 -0
  99. package/dist/snippets.js +898 -0
  100. package/dist/tanstack-start.d.ts +18 -0
  101. package/dist/tanstack-start.js +57 -0
  102. package/dist/version.d.ts +18 -0
  103. package/dist/version.js +23 -0
  104. package/dist/vite-config.d.ts +18 -0
  105. package/dist/vite-config.js +111 -0
  106. package/dist/vite-owning-config.d.ts +25 -0
  107. package/dist/vite-owning-config.js +219 -0
  108. package/dist/windows-quote.d.ts +38 -0
  109. package/dist/windows-quote.js +70 -0
  110. package/dist/workspace-apps.d.ts +40 -0
  111. package/dist/workspace-apps.js +188 -0
  112. package/dist/workspace-redirect.d.ts +22 -0
  113. package/dist/workspace-redirect.js +97 -0
  114. package/package.json +53 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Wiring Reticle into a Nuxt app: the config gets the token `define`, the plugin gets written.
3
+ *
4
+ * Nuxt owns its own Vite instance and renders its own HTML, so there is no `vite.config` to patch
5
+ * and no `index.html` to inject into — the same position Astro is in, and it takes the same config
6
+ * patch (see `vite-owning-config.ts`). The half Nuxt does differently is the connect itself: Nuxt's
7
+ * own idiom is a `.client` plugin it auto-registers, not a `<script>` in a layout.
8
+ *
9
+ * The config patch is not optional and not cosmetic. The bridge requires a pairing token even on
10
+ * localhost, nothing in a browser can read the file it lives in, and Nuxt loads no plugin of ours
11
+ * that could inject it — so a plugin written beside an unpatched config is an app that dials the
12
+ * daemon and is refused, with one line in a console nobody had open. That is why the two halves are
13
+ * planned atomically.
14
+ */
15
+ import { patchViteOwningConfig } from './vite-owning-config.js';
16
+ import { sdkImport } from './snippets.js';
17
+ import { UiLibrary } from './detect.js';
18
+ /** The config filenames Nuxt itself accepts, in the order `init` should prefer them. */
19
+ export const NUXT_CONFIG_CANDIDATES = ['nuxt.config.ts', 'nuxt.config.js', 'nuxt.config.mjs'];
20
+ /**
21
+ * Nuxt's half of the Vite-owning config patch.
22
+ *
23
+ * The framework-neutral sensor, never the React kit: Nuxt renders Vue, and `FRAMEWORK_ADAPTERS`
24
+ * installs `@reticlehq/browser` for it — so that is what the plugin imports and what Vite must
25
+ * pre-bundle. Declaring the React kit here would warm a dep cache for a package that is not there.
26
+ */
27
+ const NUXT_VITE_CONFIG = {
28
+ defineCall: /defineNuxtConfig\s*\(\s*\{/,
29
+ sdkSpecifier: sdkImport(UiLibrary.VUE).specifier,
30
+ };
31
+ export function patchNuxtConfig(source) {
32
+ return patchViteOwningConfig(source, NUXT_VITE_CONFIG);
33
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The outcome vocabulary shared by every conservative source patcher in `init` (Vite config, Next
3
+ * config, Next root layout). One enum so a new patcher cannot invent a fourth status the reporter
4
+ * has no symbol for.
5
+ */
6
+ export declare const PatchKind: {
7
+ readonly APPLY: "apply";
8
+ readonly ALREADY: "already";
9
+ readonly MANUAL: "manual";
10
+ };
11
+ export type PatchKind = (typeof PatchKind)[keyof typeof PatchKind];
12
+ export type SourcePatch = {
13
+ kind: typeof PatchKind.APPLY;
14
+ code: string;
15
+ } | {
16
+ kind: typeof PatchKind.ALREADY;
17
+ } | {
18
+ kind: typeof PatchKind.MANUAL;
19
+ reason: string;
20
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The outcome vocabulary shared by every conservative source patcher in `init` (Vite config, Next
3
+ * config, Next root layout). One enum so a new patcher cannot invent a fourth status the reporter
4
+ * has no symbol for.
5
+ */
6
+ export const PatchKind = {
7
+ APPLY: 'apply',
8
+ ALREADY: 'already',
9
+ MANUAL: 'manual',
10
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The plan's electron-vite half: the renderer plugin, capabilities, and the two Electron steps.
3
+ *
4
+ * Its own module rather than more of `plan-framework.ts`, which was at the 1000-line backstop.
5
+ * Cohesive on its own terms: this is the only framework whose wiring reaches outside the renderer,
6
+ * into a preload and a main process that the web frameworks have no equivalent of.
7
+ */
8
+ import { type PlanInput, type Step } from './plan.js';
9
+ /**
10
+ * electron-vite: the renderer plugin, then capabilities, then the two Electron halves.
11
+ *
12
+ * The plugin and the Electron steps are independent. A renderer without the preload still
13
+ * connects — it only loses IPC visibility — so they stay separate rather than collapsing to one
14
+ * manual recipe the way Astro's config+layout pair does.
15
+ */
16
+ export declare function electronViteSteps(input: PlanInput): Step[];
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The plan's electron-vite half: the renderer plugin, capabilities, and the two Electron steps.
3
+ *
4
+ * Its own module rather than more of `plan-framework.ts`, which was at the 1000-line backstop.
5
+ * Cohesive on its own terms: this is the only framework whose wiring reaches outside the renderer,
6
+ * into a preload and a main process that the web frameworks have no equivalent of.
7
+ */
8
+ import { StepStatus } from './plan.js';
9
+ import { StepTitle } from './connect-steps.js';
10
+ import { capabilitiesStep, patchStep } from './plan-framework.js';
11
+ import { patchElectronViteConfig } from './electron-vite-patch.js';
12
+ import { patchElectronMain, patchElectronPreload } from './electron-patch.js';
13
+ import { ELECTRON_CAPTURE_FIX, ELECTRON_PRELOAD_FIX } from './desktop-doctor.js';
14
+ import { electronViteManual, ELECTRON_VITE_DEV_MODULE_PATH } from './snippets.js';
15
+ /**
16
+ * electron-vite: the renderer plugin, then capabilities, then the two Electron halves.
17
+ *
18
+ * The plugin and the Electron steps are independent. A renderer without the preload still
19
+ * connects — it only loses IPC visibility — so they stay separate rather than collapsing to one
20
+ * manual recipe the way Astro's config+layout pair does.
21
+ */
22
+ export function electronViteSteps(input) {
23
+ const port = input.options.port;
24
+ const manual = electronViteManual(port, input.detection.uiLibrary);
25
+ const cfg = input.electronViteConfig ?? null;
26
+ const plugin = null === cfg
27
+ ? {
28
+ title: StepTitle.ELECTRON_VITE_PLUGIN,
29
+ target: 'electron.vite.config',
30
+ status: StepStatus.MANUAL,
31
+ detail: manual,
32
+ }
33
+ : patchStep(StepTitle.ELECTRON_VITE_PLUGIN, cfg.path, patchElectronViteConfig(cfg.source, port), 'add reticle({ desktop: true }) to the renderer plugins (also injects connect())', manual);
34
+ return [
35
+ plugin,
36
+ ...capabilitiesStep(input, ELECTRON_VITE_DEV_MODULE_PATH),
37
+ ...electronPreloadStep(input),
38
+ ...electronCaptureStep(input),
39
+ ];
40
+ }
41
+ function electronPreloadStep(input) {
42
+ const file = input.electronPreload ?? null;
43
+ if (null === file) {
44
+ return [
45
+ {
46
+ title: StepTitle.ELECTRON_PRELOAD,
47
+ target: 'preload',
48
+ status: StepStatus.MANUAL,
49
+ detail: ELECTRON_PRELOAD_FIX,
50
+ },
51
+ ];
52
+ }
53
+ return [
54
+ patchStep(StepTitle.ELECTRON_PRELOAD, file.path, patchElectronPreload(file.source, file.path), 'require the IPC shim as the first line of preload', ELECTRON_PRELOAD_FIX),
55
+ ];
56
+ }
57
+ function electronCaptureStep(input) {
58
+ const file = input.electronMain ?? null;
59
+ if (null === file) {
60
+ return [
61
+ {
62
+ title: StepTitle.ELECTRON_CAPTURE,
63
+ target: 'main',
64
+ status: StepStatus.MANUAL,
65
+ detail: ELECTRON_CAPTURE_FIX,
66
+ },
67
+ ];
68
+ }
69
+ return [
70
+ patchStep(StepTitle.ELECTRON_CAPTURE, file.path, patchElectronMain(file.source, file.path), 'installReticleCapture on the BrowserWindow so screenshots work', ELECTRON_CAPTURE_FIX),
71
+ ];
72
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * How each framework gets wired: the Vite plugin, the three Next files, the SvelteKit client hook.
3
+ * Split out of `plan.ts` — that file is the plan's SHAPE (statuses, ordering, the agent/MCP steps),
4
+ * this one is the per-framework detail, and they grow for different reasons.
5
+ */
6
+ import { type SourcePatch } from './patch-kind.js';
7
+ import { type PlanInput, type Step } from './plan.js';
8
+ import { StepTitle } from './connect-steps.js';
9
+ /** What adding `reticle()` to a Vite config buys, which differs by framework. */
10
+ export declare const VITE_PLUGIN_DETAIL: {
11
+ /** A plain Vite app gets both halves from the plugin. */
12
+ readonly VITE: "add reticle() to plugins (also injects connect())";
13
+ /**
14
+ * SvelteKit renders through app.html, so the plugin's HTML injection never fires and connect()
15
+ * comes from the client hook instead. The plugin is still required: it is what stamps
16
+ * data-reticle-source into .svelte components, and without it every verdict on a SvelteKit app
17
+ * comes back with no file:line at all.
18
+ */
19
+ readonly SVELTEKIT: "add reticle() to plugins (stamps data-reticle-source in .svelte components)";
20
+ /**
21
+ * React Router framework mode renders through its own request handler, so the plugin's HTML
22
+ * injection never fires and connect() comes from the client entry instead. The plugin is still
23
+ * required for the same reason it is under SvelteKit: without it every verdict on the app comes
24
+ * back with no file:line at all.
25
+ */
26
+ readonly REACT_ROUTER: "add reticle() to plugins (stamps data-reticle-source in .tsx components)";
27
+ /**
28
+ * TanStack Start SSRs its own HTML, so the plugin's HTML injection never fires and connect()
29
+ * comes from a client effect instead. `inject: false` is load-bearing honesty: leaving the
30
+ * default would keep reporting "also injects connect()" for a transform that never runs.
31
+ * The plugin is still required for the same reason it is under SvelteKit: without it every
32
+ * verdict on the app comes back with no file:line at all.
33
+ */
34
+ readonly TANSTACK_START: "add reticle({ inject: false }) to plugins (stamps data-reticle-source; Start SSRs its own HTML so connect() cannot come from the plugin)";
35
+ };
36
+ export declare function capabilitiesStep(input: PlanInput, path?: string): Step[];
37
+ export declare function viteSteps(input: PlanInput, detail?: string, inject?: boolean): Step[];
38
+ /**
39
+ * Turn a conservative source patch into a step: applied when it patched, already when the wiring is
40
+ * there, and the hand-edit instructions when the file shape wasn't one we recognise.
41
+ */
42
+ export declare function patchStep(title: StepTitle, path: string, patch: SourcePatch, applyDetail: string, manualDetail: string): Step;
43
+ export declare function nextSteps(input: PlanInput): Step[];
44
+ /**
45
+ * Create React App: the connect goes in `src/index.tsx`, the token in `.env.development.local`.
46
+ *
47
+ * The previous plan pointed at `index.html`, which cannot work — CRA's is a static template the
48
+ * bundler never processes for modules. Reported from a real cra-redux-saga app.
49
+ */
50
+ export declare function craSteps(input: PlanInput): Step[];
51
+ /**
52
+ * Nuxt: the client plugin written, and the config patched so it can pair.
53
+ *
54
+ * This used to be one MANUAL step carrying the whole recipe, so `init` ended on a ⚠ and exited 1 —
55
+ * a correct recipe nobody applies is the same outcome as no recipe. What it could not do until now
56
+ * was the pairing token: the bridge requires one even on localhost, nothing in a browser can read
57
+ * the file it lives in, and Nuxt loads no plugin of ours that could inject it. `nuxt.config`'s
58
+ * `vite.define` is the one place that can, which is also where the journal watch-ignore goes.
59
+ *
60
+ * ATOMIC, for the reason `astroSteps` is: a plugin written beside a config we could not patch is an
61
+ * app that dials the bridge and is refused, reported as one green step and one caveat when it is a
62
+ * guaranteed non-connection. If the config cannot be patched, BOTH halves go back to the recipe.
63
+ */
64
+ export declare function nuxtSteps(input: PlanInput): Step[];
65
+ /**
66
+ * React Router framework mode: the client entry, WRITTEN.
67
+ *
68
+ * #678 happened here — every step reported green and the daemon showed zero sessions for 20+
69
+ * minutes, because framework mode renders HTML through its own request handler and the Vite plugin's
70
+ * `transformIndexHtml` injection never fires. The connect has to come from `app/entry.client.tsx`,
71
+ * and that used to be printed as a recipe: `init` exited 0 over an app that could not connect.
72
+ *
73
+ * The file is an OVERRIDE of a default React Router supplies, so when it is absent the generated one
74
+ * carries React Router's own default entry as well as the import — a file containing only our import
75
+ * would replace that default with one that never hydrates. When it is present, one line is added to
76
+ * it and nothing else is touched.
77
+ */
78
+ export declare function reactRouterSteps(input: PlanInput): Step[];
79
+ /**
80
+ * TanStack Start: the client-document connect, printed rather than written.
81
+ *
82
+ * `src/routes/__root.tsx` is the document Start SSRs. A static import of the SDK on that module
83
+ * 500s, so writing one is worse than a documented manual step. See `tanstackStartManual`.
84
+ */
85
+ export declare function tanstackStartSteps(input: PlanInput): Step[];
86
+ export declare function svelteKitSteps(input: PlanInput): Step[];
87
+ /**
88
+ * Astro: the config define + build target, and the connect script in ONE layout.
89
+ *
90
+ * Astro was the last gated stack left printing a recipe it did not apply. It still falls back to the
91
+ * printed one whenever the choice is not obvious — no config, no single layout, or a shape the
92
+ * patchers do not fully recognise — because which page or layout to instrument is a real decision
93
+ * and a half-edited build config is worse than a documented manual step.
94
+ */
95
+ export declare function astroSteps(input: PlanInput): Step[];
96
+ /**
97
+ * A Content-Security-Policy whose `connect-src` excludes the bridge, said out loud at install time.
98
+ *
99
+ * Both reported cases were Next apps where `init` printed success for every step and the app then
100
+ * never connected: the browser blocked the WebSocket and reported it in its own console, which
101
+ * nothing on this side reads. A NOTICE rather than a step, because editing someone's security policy
102
+ * is theirs to do — but it carries the exact text to paste, which is the difference between a
103
+ * warning and a fix.
104
+ */
105
+ export declare function cspStep(input: PlanInput): Step[];
106
+ /**
107
+ * The plain-HTML path: no bundler to hook, so the connect snippet is printed for a hand edit.
108
+ *
109
+ * A function of its own, and NOT a fallthrough. Every framework is sent here on purpose or not at
110
+ * all — a member of `Framework` with no adapter entry is a compile error in `FRAMEWORK_ADAPTERS`,
111
+ * where the if/else chain this replaced used to hand it these instructions silently.
112
+ */
113
+ export declare function htmlSteps(input: PlanInput): Step[];
114
+ /**
115
+ * The per-framework half of the plan, looked up rather than switched.
116
+ *
117
+ * `FRAMEWORK_ADAPTERS` is a `Record<Framework, FrameworkAdapter>`, so a member added to `Framework`
118
+ * is a compile error in that one table instead of a framework the plan quietly does not serve. The
119
+ * exhaustive switch this replaced gave the same guarantee for the steps alone; the record gives it
120
+ * for the packages, the connect-step titles and the unverified-note flag in the same edit.
121
+ */
122
+ export declare function frameworkSteps(input: PlanInput): Step[];