@likyly/wizard 0.0.0-stage → 0.7.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.
package/README.md CHANGED
@@ -1,3 +1,116 @@
1
- # Temporary Holding Version
1
+ # @likyly/wizard
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install LIKYLY in a project with one command:
4
+
5
+ ```bash
6
+ npx @likyly/wizard
7
+ ```
8
+
9
+ An interactive terminal UI (built with [Ink](https://github.com/vadimdemedes/ink)) walks you through five steps:
10
+
11
+ 1. **Detect your project**: the framework from the project's own files (`package.json`,
12
+ `composer.json`, `pyproject.toml`, `Gemfile`, `go.mod`, `Cargo.toml`, `*.csproj`, `pom.xml`,
13
+ `wp-config.php`) and the package manager already in use (npm, pnpm, yarn, bun, composer, uv,
14
+ poetry, bundler…).
15
+ 2. **Review the plan**: every command it will run and every file it will write, before anything
16
+ happens. Nothing existing is overwritten. In a git repository it offers to work on a new
17
+ branch, `likyly/setup` (your uncommitted work comes along, untouched), and it never commits.
18
+ 3. **Install the SDK** (`@likyly/sdk`, plus `@likyly/react` for React frameworks), with the
19
+ package manager's output streamed live. Bare `pip`, Maven/Gradle and WordPress are shown, not run.
20
+ 4. **Connect your LIKYLY account**: opens likyly.com, where you sign in or create an account
21
+ (email, GitHub or Google); the public key comes back to the wizard on its own (a form POST to
22
+ a one-time server on `127.0.0.1`, guarded by a random `state`). You can also paste a key or
23
+ skip. The key is written under the name the framework exposes to the browser
24
+ (`NEXT_PUBLIC_LIKYLY_KEY`, `VITE_LIKYLY_KEY`, `PUBLIC_LIKYLY_KEY`…), plus a starter file (React
25
+ provider, Nuxt plugin, SvelteKit module…). Secret (`sk_`) and developer (`lk_`) keys are refused.
26
+ 5. **Connect your AI assistant** to the [LIKYLY MCP server](../mcp): `.mcp.json` (Claude Code, plus
27
+ the skill in `.claude/skills/likyly`), `.cursor/mcp.json` (Cursor), `.vscode/mcp.json` (VS Code).
28
+ The developer key is never written to these files: they reference `LIKYLY_DEVELOPER_KEY` (or VS
29
+ Code asks for it on start).
30
+
31
+ 6. **Verify the installation**: SDK installed and its version, your stack supported (Next.js
32
+ 13+, React 18–19, Node 18+, ...), public and developer keys accepted by the API, assistants
33
+ connected.
34
+
35
+ Before that, it lists what it changed in your project - apart from what you had already
36
+ modified - and what git does not track on purpose (`.env.local`, `.likyly/`). Review it in VS
37
+ Code's Source Control panel or with `git diff`; "Review the changes first" opens the diff.
38
+
39
+ It ends on one choice, Enter by default: **Launch Claude Code** on the integration prompt (or open
40
+ Cursor with the prompt copied). Your assistant then connects the catalog, creates the placement,
41
+ wires it into your pages and validates the integration - ask it in plain words ("check my LIKYLY
42
+ integration", "empty the LIKYLY cache"), there are no commands to learn.
43
+
44
+ In Claude Code the same are `/likyly-clear-cache [placement]` and `/likyly-uninstall`, plus
45
+ `/likyly-help` (the list of commands), installed with the skill: Claude Code runs the command
46
+ itself and shows its result. Two read-only reports come with them:
47
+
48
+ - `/likyly-inventory` - what LIKYLY added to the site: each recommendation block, the page it is
49
+ on, how it is set up in LIKYLY and what it served in the last 24 h; the events the code sends;
50
+ the setup files. It starts from `inventory` (below), then reads the code and asks LIKYLY.
51
+ - `/likyly-model [catalog] [days]` - the recommendation model: the version serving production
52
+ (training date, precision@10, the data it learned from), the other versions and why they are
53
+ not live, and what each engine served and earned on the site (MCP tool `get_model_overview`,
54
+ API `GET /models/overview`, readable with the developer key).
55
+
56
+ `inventory` (also `--json`) lists the LIKYLY packages and versions, the key variable (never its
57
+ value), the setup files and every source line that mentions LIKYLY; it changes nothing. Uninstall shows the plan, then asks whether to proceed and on which
58
+ branch: a new `likyly/uninstall` branch (recommended) or the current one. When the wizard runs
59
+ from a local checkout instead of npm, the commands call that checkout.
60
+
61
+ `uninstall` removes the SDK packages, the public key line, the starter file (unless you edited
62
+ it), the `likyly` server from each assistant's MCP config, the skill, the commands and
63
+ `.likyly/`. It never edits your code: it lists the files that still use LIKYLY so your assistant
64
+ can take them out. Your LIKYLY account (catalog, placements, keys) is not touched.
65
+
66
+ The developer key comes back from the browser sign-in too and is stored in
67
+ `.likyly/credentials.env` (that folder ignores itself in git, file readable by you only); the
68
+ MCP server reads it there, so nothing needs exporting.
69
+
70
+ ## Commands
71
+
72
+ ```bash
73
+ npx @likyly/wizard # full interactive install
74
+ npx @likyly/wizard mcp add # only connect your AI assistant
75
+ npx @likyly/wizard detect # print what was detected, change nothing
76
+ npx @likyly/wizard cache clear # empty LIKYLY's recommendation cache, every placement
77
+ npx @likyly/wizard cache clear pdp-related # ... or one placement
78
+ npx @likyly/wizard uninstall # remove what the wizard added (shows the plan, asks first; --dry-run to only look)
79
+ npx @likyly/wizard uninstall --yes --branch new # ... without questions, on a new likyly/uninstall branch (or --branch current)
80
+ npx @likyly/wizard help # the list of commands
81
+ npx @likyly/wizard --yes --public-key pk_... --editor claude-code,cursor # CI, no prompts
82
+ npx @likyly/wizard --dry-run # show what would happen
83
+ npx @likyly/wizard --hosted # hosted MCP (mcp.likyly.com) instead of npx
84
+ ```
85
+
86
+ The terminal needs at least 64×20: below that the wizard asks you to enlarge the window and
87
+ resumes on its own. `LIKYLY_APP_URL` points the sign-in at another site (e.g.
88
+ `http://localhost:6001`), `BROWSER=none` prints the link instead of opening it.
89
+
90
+ Testing against a local LIKYLY: `LIKYLY_API_URL` (e.g. `http://127.0.0.1:6061`) is used by the
91
+ verify step and written as the MCP server's `LIKYLY_BASE_URL`, and `LIKYLY_MCP_SERVER` (path to a
92
+ built `sdk/mcp/dist/index.js`) makes the MCP config run that file with `node` instead of the npm
93
+ package.
94
+
95
+ With `--yes`, in CI, or when the output is piped, the wizard prints plain lines instead of the
96
+ interactive UI and exits non-zero when a step fails.
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ npm install
102
+ npm run build # bundles src/ into dist/cli.mjs (esbuild)
103
+ npm test # builds, then node:test
104
+ node bin/likyly-wizard.mjs --dry-run --dir ../../examples/demo-storefront
105
+ ```
106
+
107
+ - `src/actions.mjs`: the steps, shared by both renderers
108
+ - `src/ui/`: the Ink UI (`app.jsx` flow, `widgets.jsx` controls, `theme.jsx` brand palette and logo)
109
+ - `src/plain.mjs`: the CI renderer
110
+
111
+ Ink and React are bundled into `dist/cli.mjs`, so the published package has no dependencies and
112
+ `npx` starts instantly. Requires Node.js 22+. The skill is copied from `docs/SKILL.md` at
113
+ `npm pack` time (`prepack`); in the monorepo it is read directly.
114
+
115
+ Before publishing: `@likyly/sdk`, `@likyly/react` and `@likyly/mcp-server` must be on npm (the
116
+ wizard installs them from the registry), and `mcp.likyly.com` deployed for `--hosted`.
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ // The published package runs the bundle (dist/, built by `npm run build`): no dependency to
3
+ // install, so `npx @likyly/wizard` starts instantly.
4
+ const [major] = process.versions.node.split(".").map(Number);
5
+ if (major < 22) {
6
+ console.error(`@likyly/wizard needs Node.js 22 or newer (you have ${process.versions.node}).`);
7
+ process.exit(1);
8
+ }
9
+ const { main } = await import("../dist/cli.mjs");
10
+ main().then((code) => process.exit(code), (err) => {
11
+ console.error(err?.stack ?? err);
12
+ process.exit(1);
13
+ });