@b-apm/core 0.1.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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/index.d.mts +4048 -0
- package/dist/index.mjs +14330 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sdju
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @b-apm/core
|
|
2
|
+
|
|
3
|
+
> **UNSTABLE:** Early public release. APIs and on-disk layouts may change without a major bump. Not production-ready.
|
|
4
|
+
|
|
5
|
+
Domain library for **bapm** (Better Agent Package Manager): manifest, lockfile, resolver, install, adapters.
|
|
6
|
+
|
|
7
|
+
## Manifest (M1)
|
|
8
|
+
|
|
9
|
+
Public API for project manifests:
|
|
10
|
+
|
|
11
|
+
- `discoverManifestPath({ cwd?, path? })` — resolve which file to load
|
|
12
|
+
- `loadManifest({ cwd?, path? })` — discover → read → safe YAML → validate
|
|
13
|
+
- `parseManifest` / `parseManifestDocument` — validate an already-parsed JS object
|
|
14
|
+
- Constants: `APM_MANIFEST_FILE` (`apm.yml`), `BAPM_MANIFEST_FILE` (`bapm.yml`)
|
|
15
|
+
|
|
16
|
+
### Dual-file discovery
|
|
17
|
+
|
|
18
|
+
- Explicit `path` always wins (no sibling-name search).
|
|
19
|
+
- Otherwise project root is `cwd` (default `process.cwd()`); **no parent walk-up**.
|
|
20
|
+
- Only `apm.yml` → load it; only `bapm.yml` → load it; **both → hard error** (no merge); neither → error.
|
|
21
|
+
- Result metadata includes `sourcePath` / `sourceFilename` so a future rewrite **MUST** write back to the same filename (never auto-create the sibling brand name). Rewrite/mf-006 itself is **deferred** past M1.
|
|
22
|
+
|
|
23
|
+
### OpenAPM-strict YAML
|
|
24
|
+
|
|
25
|
+
Load rejects YAML anchors/aliases and custom tags (OpenAPM req-mf-020). This is intentionally stricter than APM’s budgeted SafeLoader when APM would accept anchors within an expansion budget.
|
|
26
|
+
|
|
27
|
+
Validation covers required `name`/`version` strings, dependency/registry shapes (including `git`+`path` companion, required `path` for `git: parent`, `registries.default` as a name pointer, and allowlisted dep meta such as `alias`), unknown/`x-*` retention on the in-memory document, `workspaces` reject, and mutual exclusion of `target`+`targets`. M1 does **not** resolve, lock, download, or install.
|
|
28
|
+
|
|
29
|
+
See the monorepo root README and OpenSpec change `m1-manifest-yaml-dual-read`.
|
|
30
|
+
|
|
31
|
+
## Lockfile (M2)
|
|
32
|
+
|
|
33
|
+
Public API for project lockfiles (`apm.lock.yaml` / `bapm.lock.yaml`):
|
|
34
|
+
|
|
35
|
+
- `discoverLockfilePath({ cwd?, path? })` — resolve which file to load
|
|
36
|
+
- `loadLockfile({ cwd?, path? })` — discover → read → safe YAML → validate (strict)
|
|
37
|
+
- `loadLockfileOrNull({ cwd?, path? })` — same, but `null` when neither brand file exists
|
|
38
|
+
- `parseLockfile` / `parseLockfileDocument` — validate YAML text or an already-parsed JS object
|
|
39
|
+
- `serializeLockfile(document)` → YAML string
|
|
40
|
+
- `writeLockfile(document, { cwd?, path?, sourcePath?, sourceFilename? })`
|
|
41
|
+
- `isSemanticallyEquivalent(a, b)` — ignores `generated_at` / `apm_version`
|
|
42
|
+
- Constants: `APM_LOCK_FILE` (`apm.lock.yaml`), `BAPM_LOCK_FILE` (`bapm.lock.yaml`)
|
|
43
|
+
|
|
44
|
+
### Dual-file discovery
|
|
45
|
+
|
|
46
|
+
- Explicit `path` always wins (no sibling-name search).
|
|
47
|
+
- Otherwise project root is `cwd` (default `process.cwd()`); **no parent walk-up**.
|
|
48
|
+
- Only `apm.lock.yaml` → load it; only `bapm.lock.yaml` → load it; **both → hard error** (no merge); neither → not-found (`loadLockfileOrNull` → `null`).
|
|
49
|
+
- Legacy `apm.lock` (non-`.yaml`) is **out of M2** dual-read.
|
|
50
|
+
- Write-back uses the loaded filename/`sourcePath`; fresh create without path → **`bapm.lock.yaml`**. Never auto-create the sibling brand.
|
|
51
|
+
|
|
52
|
+
### Emit policy (OpenAPM-preferring)
|
|
53
|
+
|
|
54
|
+
- Always emit explicit `lockfile_version`.
|
|
55
|
+
- Force `"2"` when any `source: registry` (and MAY bump for git-semver fields).
|
|
56
|
+
- **Monotonic:** never demote loaded `"2"` → `"1"` (stricter than APM demotion).
|
|
57
|
+
- Sort dependencies by `(repo_url, virtual_path)` (OpenAPM req-lk-005; not APM `(depth, repo_url)`).
|
|
58
|
+
- Normalize bare 64-hex hashes to `sha256:<hex>` on read; emit envelopes on write.
|
|
59
|
+
- Preserve unknown / `x-*` / APM `deployments` / `lsp_*` bags on round-trip.
|
|
60
|
+
|
|
61
|
+
### Out of M2
|
|
62
|
+
|
|
63
|
+
M2 does **not** resolve, download, install, run frozen CI, materialize integrations, or invoke `@b-apm/integration-*` adapters.
|
|
64
|
+
|
|
65
|
+
See OpenSpec change `m2-lockfile-yaml-dual-read`.
|