inferative 0.0.0 → 0.2.0-next.20261013180716

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/LICENSE ADDED
@@ -0,0 +1,70 @@
1
+ Copyright (c) 2024 WP Online Magyarország Kft.
2
+ Website: https://wpo.hu
3
+ All Rights Reserved.
4
+
5
+ ==============================================================================
6
+ WP Online Magyarország Kft. - Internal Use Software License
7
+ ==============================================================================
8
+
9
+ This software package and its accompanying documentation (collectively, "the Software")
10
+ are the proprietary and confidential information of WP Online Magyarország Kft.
11
+ ("the Company").
12
+
13
+ 1. GRANT OF LICENSE:
14
+ Subject to the terms and conditions of this License, the Company grants to
15
+ its employees and authorized contractors ("Authorized Users") a non-exclusive,
16
+ non-transferable, revocable license to install, use, copy, and modify the
17
+ Software solely for internal Company business purposes.
18
+
19
+ 2. RESTRICTIONS:
20
+ Authorized Users shall not:
21
+ a. Distribute, sublicense, sell, rent, lease, lend, or otherwise transfer
22
+ the Software, or any part thereof, to any third party outside of
23
+ WP Online Magyarország Kft. without the express prior written permission
24
+ of an authorized representative of the Company.
25
+ b. Use the Software for any purpose not expressly permitted by this License,
26
+ including any personal or commercial projects unrelated to the
27
+ Company's business.
28
+ c. Remove or alter any copyright, trademark, or other proprietary notices
29
+ contained in the Software.
30
+ d. Reverse engineer, decompile, or disassemble the Software, except and
31
+ only to the extent that such activity is expressly permitted by
32
+ applicable law notwithstanding this limitation.
33
+
34
+ 3. OWNERSHIP AND INTELLECTUAL PROPERTY:
35
+ The Company retains all right, title, and interest in and to the Software,
36
+ including all copyrights, patents, trade secrets, trademarks, and other
37
+ intellectual property rights therein. No rights are granted to Authorized
38
+ Users other than those expressly set forth in this License.
39
+
40
+ 4. CONFIDENTIALITY:
41
+ The Software, including its source code, design, and structure, is
42
+ confidential information of the Company. Authorized Users shall treat the
43
+ Software with the same degree of care as they treat other Company
44
+ confidential information and shall not disclose it to any third party
45
+ without the Company's prior written consent.
46
+
47
+ 5. NO WARRANTY:
48
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
51
+ THE COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
52
+ IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN
53
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54
+
55
+ 6. TERMINATION:
56
+ This License will terminate automatically if an Authorized User breaches any
57
+ of its terms and conditions. The license granted herein is also contingent
58
+ upon continued employment or contract with the Company and terminates
59
+ immediately upon the cessation of that relationship. Upon termination, the
60
+ Authorized User must cease all use of the Software and destroy all copies
61
+
62
+ of the Software in their possession or control.
63
+
64
+ 7. GOVERNING LAW:
65
+ This License shall be governed by and construed in accordance with the laws
66
+ of Hungary, without regard to its conflict of law principles. Any disputes
67
+ arising under or in connection with this License shall be subject to the
68
+ exclusive jurisdiction of the courts of Hungary.
69
+
70
+ For questions regarding this license, please contact office@wpo.hu.
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # inferative
1
+ # `inferative`
2
2
 
3
- This package name is reserved. The package has no content yet.
3
+ The Inferative command line. It is on public npm, ships built JavaScript and runs under plain `node` (version 24 or
4
+ later). It has the command `init`, which creates a project, and the group `site`: the commands a website runs against
5
+ its channel. To start a project, run `npm create inferative@latest my-site`: that command needs no registry setting.
6
+
7
+ ```sh
8
+ npm create inferative@latest my-site
9
+ npx inferative site --help
10
+ ```
11
+
12
+ ## What a site needs first
13
+
14
+ The command line itself comes from public npm. Its dependencies, the `@inferative/*` packages and the `@heximon/*`
15
+ packages they use, come from GitHub Packages. So `npx inferative site` works in a folder where npm can read both
16
+ scopes. Creating a project does not need them: use `npm create inferative@latest` for that.
17
+
18
+ ```ini
19
+ @inferative:registry=https://npm.pkg.github.com
20
+ @heximon:registry=https://npm.pkg.github.com
21
+ //npm.pkg.github.com/:_authToken=<a GitHub token with the read:packages scope>
22
+ ```
23
+
24
+ `inferative site doctor` checks both scopes and the token, reads one package through each scope, and prints the
25
+ lines to add for the first scope that fails.
26
+
27
+ ## `inferative init`
28
+
29
+ `inferative init [directory]` creates a project from a starter. The command lives in
30
+ [`create-inferative`](../create-inferative), which this package depends on, and `npm create inferative@latest` runs it
31
+ with nothing else installed. Both names take the same flags.
32
+
33
+ ```sh
34
+ npm create inferative@latest my-site
35
+ ```
36
+
37
+ | Argument or flag | What it does |
38
+ | :-- | :-- |
39
+ | `directory` | The folder to create. When you leave it out, the current folder is the target. |
40
+ | `--starter <name>` | The starter to use. `nuxt-cloudflare` by default. |
41
+ | `--source <giget source>` | Download this giget source alone, instead of the default sources. |
42
+ | `--local <folder>` | Copy `<folder>/<starter>` instead of a download. For tests and for work on the starters. |
43
+ | `--no-install` | Do not run `pnpm install`. |
44
+ | `--cwd <folder>` | The folder in which a named `directory` is created. The current folder by default. |
45
+
46
+ The target folder must not exist, or must be empty. The command never overwrites a file. The package name is the
47
+ base name of the folder. A named folder must have a valid npm name: lowercase letters, digits, and `.` `_` `-`. The
48
+ current folder keeps its name on disk, so the command changes the name to a valid one (`My Site` becomes `my-site`, `Café` becomes `cafe`).
49
+
50
+ The command does these steps in this order:
51
+
52
+ 1. It writes `@inferative:registry=https://npm.pkg.github.com` and `@heximon:registry=https://npm.pkg.github.com`
53
+ into the `.npmrc` of the project. It adds only the lines that are missing. It never removes a line and never writes
54
+ a token.
55
+ 2. It probes both scopes, as `inferative site doctor` does. If a scope fails, the command removes what it wrote, prints
56
+ the lines to add to your `~/.npmrc`, and exits with code 1. It downloads nothing. The probe runs `npm` through
57
+ [tinyexec](https://github.com/tinylibs/tinyexec) with `--prefix <the new folder>`, so npm reads the `.npmrc` of the
58
+ new project and not one of a project above it. On Windows tinyexec escapes each argument, so a folder name with a
59
+ space or an `&` reaches npm as one argument.
60
+ 3. It downloads the starter from the repository `inferative/starters`, with giget. The command tries
61
+ `gh:inferative/starters/<starter>#v<major.minor>` first, where `major.minor` is the version of this command line.
62
+ If that download fails, it tries `gh:inferative/starters/<starter>#main`. A `--source` is tried alone. Only a failed
63
+ download moves on to the next source.
64
+ 4. It sets `name` in `package.json`, and sets the range of `inferative` and of every `@inferative/*` dependency to
65
+ `^<version of this command line>`. The other ranges stay as the starter pins them.
66
+ 5. It runs `pnpm install` in the project, through [nypm](https://github.com/unjs/nypm). nypm runs pnpm through
67
+ Corepack when Corepack is installed, and runs `pnpm` directly when it is not. If pnpm is missing, or the install
68
+ fails, the command exits with code 1 and keeps the project, because the files are complete.
69
+
70
+ At the end, the command prints the next steps: `cd` into the folder, copy `.env.example` to `.env`, run `pnpm db:generate` once, and run `pnpm dev`.
71
+
72
+ ## The `site` commands
73
+
74
+ Run them from the site's folder. The command finds the site root: the nearest folder above the working directory
75
+ with a `package.json`. It loads the site's declarations from `shared/site.ts` there, through `jiti`, because that
76
+ file is the site's own TypeScript. `--site <path>` names another declarations module.
77
+
78
+ | Command | What it does |
79
+ | :-- | :-- |
80
+ | `inferative site check` | Audits the declarations against the components, builds the manifest and measures it. Needs no network and no credential. `--against <api>` also reports whether the channel serves this build. |
81
+ | `inferative site sync` | Publishes the manifest to the channel, then waits until the channel serves that version. `--first-sync` publishes the first-sync catalog. `--manifest <file>` publishes a prebuilt envelope as it is. |
82
+ | `inferative site doctor [origin]` | Reports registry access, then reads the diagnostic of a running site at `<origin>/_site/health`. `--local` diagnoses from the site's configuration instead. `--path <path>` names a diagnostic mounted elsewhere. |
83
+ | `inferative site config` | Prints what the command line read from the declarations and the runtime configuration. |
84
+
85
+ `sync` presents the key in `INFERATIVE_MANIFEST_TOKEN`. The channel and the API come from the `site` runtime config
86
+ section, or from the `INFERATIVE_SITE_*` variables. Every `site` command first reads the `.env` file of the site root,
87
+ the file the connect guide of the dashboard fills. A variable that is already set in the environment wins over the
88
+ file, and a missing file is not an error. The agent skill (`docs/skills/inferative`, the page
89
+ `site-deploy-and-topologies`) lists every variable and every exit code.
90
+
91
+ ## How it is built
92
+
93
+ `vp pack` bundles `src/bin.ts` into `dist/bin.mjs`, and `src/index.ts` into `dist/index.mjs`. The index is the library
94
+ entry: it exports `InitCommand`, which it re-exports from `create-inferative`. The pack bundles the `@inferative/*` subpaths that
95
+ map to raw TypeScript (`core`, `utils`), because Node cannot load those from `node_modules`. Every other
96
+ `@inferative/*` and `@heximon/*` import stays external and appears in `dependencies`. That way the command line and the site it reads
97
+ share one copy of each `./api` and `./config` module. `deps.onlyImport` in `vite.config.ts` fails the build when the
98
+ output imports a package that `dependencies` does not name.
99
+
100
+ The package has no `jiti` loader for its own code. `jiti` reads only the site's declarations file.
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export {}