opkg 0.5.0 → 0.6.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 +49 -8
- package/dist/commands/add.js +11 -276
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/init.js +73 -145
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.js +26 -668
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/pack.js +10 -137
- package/dist/commands/pack.js.map +1 -1
- package/dist/commands/push.js +14 -8
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/save.js +12 -167
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/status.js +2 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.js +5 -5
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/constants/index.js +18 -45
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/workspace.js +9 -0
- package/dist/constants/workspace.js.map +1 -0
- package/dist/core/add/add-conflict-handler.js +68 -0
- package/dist/core/add/add-conflict-handler.js.map +1 -0
- package/dist/core/add/add-pipeline.js +137 -0
- package/dist/core/add/add-pipeline.js.map +1 -0
- package/dist/core/add/package-index-updater.js +62 -33
- package/dist/core/add/package-index-updater.js.map +1 -1
- package/dist/core/add/platform-path-transformer.js +47 -0
- package/dist/core/add/platform-path-transformer.js.map +1 -0
- package/dist/core/add/source-collector.js +57 -0
- package/dist/core/add/source-collector.js.map +1 -0
- package/dist/core/dependency-resolver.js +3 -1
- package/dist/core/dependency-resolver.js.map +1 -1
- package/dist/core/directory.js +2 -2
- package/dist/core/directory.js.map +1 -1
- package/dist/core/discovery/file-discovery.js +55 -54
- package/dist/core/discovery/file-discovery.js.map +1 -1
- package/dist/core/discovery/platform-files-discovery.js +32 -17
- package/dist/core/discovery/platform-files-discovery.js.map +1 -1
- package/dist/core/install/bulk-install-pipeline.js +199 -0
- package/dist/core/install/bulk-install-pipeline.js.map +1 -0
- package/dist/core/install/canonical-plan.js +123 -0
- package/dist/core/install/canonical-plan.js.map +1 -0
- package/dist/core/install/dry-run.js +2 -2
- package/dist/core/install/dry-run.js.map +1 -1
- package/dist/core/install/index.js +3 -0
- package/dist/core/install/index.js.map +1 -0
- package/dist/core/install/install-errors.js +41 -0
- package/dist/core/install/install-errors.js.map +1 -0
- package/dist/core/install/install-flow.js +2 -5
- package/dist/core/install/install-flow.js.map +1 -1
- package/dist/core/install/install-pipeline.js +228 -0
- package/dist/core/install/install-pipeline.js.map +1 -0
- package/dist/core/install/install-reporting.js +99 -0
- package/dist/core/install/install-reporting.js.map +1 -0
- package/dist/core/install/platform-resolution.js +6 -6
- package/dist/core/install/platform-resolution.js.map +1 -1
- package/dist/core/install/remote-flow.js +67 -1
- package/dist/core/install/remote-flow.js.map +1 -1
- package/dist/core/openpackage.js +16 -8
- package/dist/core/openpackage.js.map +1 -1
- package/dist/core/package-context.js +246 -0
- package/dist/core/package-context.js.map +1 -0
- package/dist/core/package.js +3 -2
- package/dist/core/package.js.map +1 -1
- package/dist/core/platforms.js +126 -217
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/registry/registry-rename.js +2 -1
- package/dist/core/registry/registry-rename.js.map +1 -1
- package/dist/core/registry.js +10 -3
- package/dist/core/registry.js.map +1 -1
- package/dist/core/remote-pull.js +2 -1
- package/dist/core/remote-pull.js.map +1 -1
- package/dist/core/save/constants.js +4 -0
- package/dist/core/save/constants.js.map +1 -1
- package/dist/core/save/name-resolution.js +31 -0
- package/dist/core/save/name-resolution.js.map +1 -0
- package/dist/core/save/package-detection.js +147 -0
- package/dist/core/save/package-detection.js.map +1 -0
- package/dist/core/save/package-saver.js +46 -43
- package/dist/core/save/package-saver.js.map +1 -1
- package/dist/core/save/package-yml-generator.js +50 -71
- package/dist/core/save/package-yml-generator.js.map +1 -1
- package/dist/core/save/root-save-candidates.js.map +1 -1
- package/dist/core/save/save-candidate-loader.js +89 -0
- package/dist/core/save/save-candidate-loader.js.map +1 -0
- package/dist/core/save/save-conflict-resolution.js +72 -410
- package/dist/core/save/save-conflict-resolution.js.map +1 -1
- package/dist/core/save/save-conflict-resolver.js +277 -0
- package/dist/core/save/save-conflict-resolver.js.map +1 -0
- package/dist/core/save/save-pipeline.js +151 -0
- package/dist/core/save/save-pipeline.js.map +1 -0
- package/dist/core/save/save-types.js +2 -0
- package/dist/core/save/save-types.js.map +1 -0
- package/dist/core/save/save-yml-resolution.js +77 -39
- package/dist/core/save/save-yml-resolution.js.map +1 -1
- package/dist/core/save/workspace-rename.js +6 -6
- package/dist/core/save/workspace-rename.js.map +1 -1
- package/dist/core/scoping/package-scoping.js +13 -1
- package/dist/core/scoping/package-scoping.js.map +1 -1
- package/dist/core/status/status-file-discovery.js +12 -30
- package/dist/core/status/status-file-discovery.js.map +1 -1
- package/dist/core/sync/platform-sync.js +7 -4
- package/dist/core/sync/platform-sync.js.map +1 -1
- package/dist/core/sync/root-files-sync.js +59 -1
- package/dist/core/sync/root-files-sync.js.map +1 -1
- package/dist/core/uninstall/uninstall-file-discovery.js +1 -2
- package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/file-processing.js +5 -58
- package/dist/utils/file-processing.js.map +1 -1
- package/dist/utils/index-based-installer.js +15 -33
- package/dist/utils/index-based-installer.js.map +1 -1
- package/dist/utils/install-file-discovery.js +3 -3
- package/dist/utils/install-file-discovery.js.map +1 -1
- package/dist/utils/install-orchestrator.js +21 -21
- package/dist/utils/install-orchestrator.js.map +1 -1
- package/dist/utils/jsonc.js +44 -0
- package/dist/utils/jsonc.js.map +1 -0
- package/dist/utils/package-copy.js +199 -0
- package/dist/utils/package-copy.js.map +1 -0
- package/dist/utils/package-filters.js +125 -0
- package/dist/utils/package-filters.js.map +1 -0
- package/dist/utils/package-index-yml.js +15 -10
- package/dist/utils/package-index-yml.js.map +1 -1
- package/dist/utils/package-installation.js +4 -113
- package/dist/utils/package-installation.js.map +1 -1
- package/dist/utils/package-local-files.js +2 -35
- package/dist/utils/package-local-files.js.map +1 -1
- package/dist/utils/package-management.js +59 -37
- package/dist/utils/package-management.js.map +1 -1
- package/dist/utils/package-yml.js +24 -0
- package/dist/utils/package-yml.js.map +1 -1
- package/dist/utils/path-normalization.js +8 -53
- package/dist/utils/path-normalization.js.map +1 -1
- package/dist/utils/paths.js +17 -9
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-file.js +16 -59
- package/dist/utils/platform-file.js.map +1 -1
- package/dist/utils/platform-mapper.js +29 -41
- package/dist/utils/platform-mapper.js.map +1 -1
- package/dist/utils/platform-specific-paths.js.map +1 -1
- package/dist/utils/platform-utils.js +28 -139
- package/dist/utils/platform-utils.js.map +1 -1
- package/dist/utils/platform-yaml-merge.js +13 -6
- package/dist/utils/platform-yaml-merge.js.map +1 -1
- package/dist/utils/registry-entry-filter.js +38 -24
- package/dist/utils/registry-entry-filter.js.map +1 -1
- package/dist/utils/registry-paths.js +10 -0
- package/dist/utils/registry-paths.js.map +1 -0
- package/dist/utils/root-file-installer.js +19 -0
- package/dist/utils/root-file-installer.js.map +1 -1
- package/dist/utils/root-file-registry.js.map +1 -1
- package/package.json +3 -2
- package/platforms.jsonc +178 -0
- package/specs/package/README.md +60 -0
- package/specs/package/nested-packages-and-parent-packages.md +79 -0
- package/specs/package/package-index-yml.md +171 -0
- package/specs/package/package-root-layout.md +78 -0
- package/specs/package/registry-payload-and-copy.md +77 -0
- package/specs/package/universal-content.md +144 -0
- package/specs/platforms.md +193 -0
- package/specs/save/README.md +40 -0
- package/specs/save/save-conflict-resolution.md +146 -0
- package/specs/save/save-file-discovery.md +101 -0
- package/specs/save/save-frontmatter-overrides.md +81 -0
- package/specs/save/save-modes-inputs.md +53 -0
- package/specs/save/save-naming-scoping.md +93 -0
- package/specs/save/save-package-detection.md +60 -0
- package/specs/save/save-registry-sync.md +126 -0
- package/dist/commands/release.js +0 -33
- package/dist/commands/release.js.map +0 -1
- package/dist/commands/tag.js +0 -311
- package/dist/commands/tag.js.map +0 -1
- package/dist/commands/update.js +0 -30
- package/dist/commands/update.js.map +0 -1
- package/dist/core/add/formula-index-updater.js +0 -290
- package/dist/core/add/formula-index-updater.js.map +0 -1
- package/dist/core/discovery/ai-files-discovery.js +0 -2
- package/dist/core/discovery/ai-files-discovery.js.map +0 -1
- package/dist/core/discovery/formula-files-discovery.js +0 -14
- package/dist/core/discovery/formula-files-discovery.js.map +0 -1
- package/dist/core/discovery/index-files-discovery.js +0 -91
- package/dist/core/discovery/index-files-discovery.js.map +0 -1
- package/dist/core/discovery/md-files-discovery.js +0 -82
- package/dist/core/discovery/md-files-discovery.js.map +0 -1
- package/dist/core/discovery/package-files-discovery.js +0 -14
- package/dist/core/discovery/package-files-discovery.js.map +0 -1
- package/dist/core/discovery/platform-discovery.js +0 -84
- package/dist/core/discovery/platform-discovery.js.map +0 -1
- package/dist/core/discovery/root-files-discovery.js +0 -2
- package/dist/core/discovery/root-files-discovery.js.map +0 -1
- package/dist/core/formula.js +0 -170
- package/dist/core/formula.js.map +0 -1
- package/dist/core/git-registry.js +0 -46
- package/dist/core/git-registry.js.map +0 -1
- package/dist/core/groundzero.js +0 -277
- package/dist/core/groundzero.js.map +0 -1
- package/dist/core/install/scenario.js +0 -11
- package/dist/core/install/scenario.js.map +0 -1
- package/dist/core/package-sync.js +0 -219
- package/dist/core/package-sync.js.map +0 -1
- package/dist/core/save/formula-file-generator.js +0 -167
- package/dist/core/save/formula-file-generator.js.map +0 -1
- package/dist/core/save/formula-saver.js +0 -52
- package/dist/core/save/formula-saver.js.map +0 -1
- package/dist/core/save/formula-yml-generator.js +0 -89
- package/dist/core/save/formula-yml-generator.js.map +0 -1
- package/dist/core/save/formula-yml-versioning.js +0 -108
- package/dist/core/save/formula-yml-versioning.js.map +0 -1
- package/dist/core/save/generic-file-sync.js +0 -38
- package/dist/core/save/generic-file-sync.js.map +0 -1
- package/dist/core/save/md-files-sync.js +0 -33
- package/dist/core/save/md-files-sync.js.map +0 -1
- package/dist/core/save/package-yml-versioning.js +0 -108
- package/dist/core/save/package-yml-versioning.js.map +0 -1
- package/dist/core/save/platform-sync.js +0 -95
- package/dist/core/save/platform-sync.js.map +0 -1
- package/dist/core/save/root-files-sync.js +0 -140
- package/dist/core/save/root-files-sync.js.map +0 -1
- package/dist/core/save/save-candidate-types.js +0 -2
- package/dist/core/save/save-candidate-types.js.map +0 -1
- package/dist/core/save/save-conflict-types.js +0 -2
- package/dist/core/save/save-conflict-types.js.map +0 -1
- package/dist/core/save/save-file-discovery.js +0 -5
- package/dist/core/save/save-file-discovery.js.map +0 -1
- package/dist/core/status-file-discovery.js +0 -175
- package/dist/core/status-file-discovery.js.map +0 -1
- package/dist/utils/discovery/file-processing.js +0 -156
- package/dist/utils/discovery/file-processing.js.map +0 -1
- package/dist/utils/discovery/formula-discovery.js +0 -211
- package/dist/utils/discovery/formula-discovery.js.map +0 -1
- package/dist/utils/discovery/platform-discovery.js +0 -2
- package/dist/utils/discovery/platform-discovery.js.map +0 -1
- package/dist/utils/formula-discovery.js +0 -102
- package/dist/utils/formula-discovery.js.map +0 -1
- package/dist/utils/formula-index-yml.js +0 -122
- package/dist/utils/formula-index-yml.js.map +0 -1
- package/dist/utils/formula-installation.js +0 -110
- package/dist/utils/formula-installation.js.map +0 -1
- package/dist/utils/formula-local-files.js +0 -38
- package/dist/utils/formula-local-files.js.map +0 -1
- package/dist/utils/formula-management.js +0 -191
- package/dist/utils/formula-management.js.map +0 -1
- package/dist/utils/formula-name.js +0 -97
- package/dist/utils/formula-name.js.map +0 -1
- package/dist/utils/formula-versioning.js +0 -109
- package/dist/utils/formula-versioning.js.map +0 -1
- package/dist/utils/formula-yml.js +0 -82
- package/dist/utils/formula-yml.js.map +0 -1
- package/dist/utils/git.js +0 -54
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/id-based-discovery.js +0 -126
- package/dist/utils/id-based-discovery.js.map +0 -1
- package/dist/utils/id-based-installer.js +0 -249
- package/dist/utils/id-based-installer.js.map +0 -1
- package/dist/utils/index-yml-based-installer.js +0 -375
- package/dist/utils/index-yml-based-installer.js.map +0 -1
- package/dist/utils/index-yml.js +0 -124
- package/dist/utils/index-yml.js.map +0 -1
- package/dist/utils/md-frontmatter.js +0 -3
- package/dist/utils/md-frontmatter.js.map +0 -1
- package/dist/utils/package-link-yml.js +0 -92
- package/dist/utils/package-link-yml.js.map +0 -1
- package/dist/utils/platform-discovery.js +0 -2
- package/dist/utils/platform-discovery.js.map +0 -1
- package/dist/utils/platform-frontmatter-split.js +0 -15
- package/dist/utils/platform-frontmatter-split.js.map +0 -1
- package/dist/utils/timestamp-encoder.js +0 -13
- package/dist/utils/timestamp-encoder.js.map +0 -1
- package/dist/utils/wip-versioning.js +0 -24
- package/dist/utils/wip-versioning.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
### Save Pipeline – Frontmatter and YAML Overrides
|
|
2
|
+
|
|
3
|
+
#### 1. Overview
|
|
4
|
+
|
|
5
|
+
For markdown files, the pipeline manages **frontmatter** and platform‑specific overrides to keep shared metadata centralized while allowing platform-specific behavior.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### 2. Workspace Markdown Candidates
|
|
10
|
+
|
|
11
|
+
- For each platform, the latest workspace markdown candidate for a given registry path is considered.
|
|
12
|
+
- The frontmatter is normalized and separated from the markdown body.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
#### 3. Universal Frontmatter Extraction
|
|
17
|
+
|
|
18
|
+
- The pipeline computes frontmatter keys and values that are **identical across all platform entries** for that path.
|
|
19
|
+
- These shared keys form the **universal frontmatter** that should live in the base markdown file.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
#### 4. Platform‑Specific Overrides
|
|
24
|
+
|
|
25
|
+
For each platform:
|
|
26
|
+
|
|
27
|
+
- The per‑platform frontmatter is compared against the universal frontmatter.
|
|
28
|
+
- Only the **difference** per platform is treated as that platform's override, or omitted if empty.
|
|
29
|
+
- Platform overrides are written into **separate YAML files** in a dedicated overrides location.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
#### 5. Conflicts with Existing Overrides
|
|
34
|
+
|
|
35
|
+
When a platform override file already exists for a path:
|
|
36
|
+
|
|
37
|
+
- The pipeline compares existing and new frontmatter, taking modification times into account.
|
|
38
|
+
- Typically:
|
|
39
|
+
- If the newer change comes from the workspace, it is preferred by default.
|
|
40
|
+
- When there is a conflicting but not clearly newer override, the user may be prompted to choose between workspace and existing override content where appropriate.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
#### 6. Resulting Layout
|
|
45
|
+
|
|
46
|
+
- One universal markdown file with shared frontmatter.
|
|
47
|
+
- Zero or more per‑platform YAML override files capturing only the per‑platform differences.
|
|
48
|
+
|
|
49
|
+
This scheme keeps:
|
|
50
|
+
|
|
51
|
+
- Shared metadata centralized in the universal file.
|
|
52
|
+
- Platform‑specific behavior in small, explicit override files.
|
|
53
|
+
- Markdown bodies free from duplication where possible.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
#### 7. Final File Inclusion Rules
|
|
58
|
+
|
|
59
|
+
After all conflicts and frontmatter merges are resolved, the pipeline reads the final contents of the package directory and applies a last round of filtering.
|
|
60
|
+
|
|
61
|
+
##### Excluded
|
|
62
|
+
|
|
63
|
+
- `package.index.yml`.
|
|
64
|
+
- Internal files that are not considered part of the package content.
|
|
65
|
+
|
|
66
|
+
##### Included
|
|
67
|
+
|
|
68
|
+
- Paths allowed by the regular registry path rules.
|
|
69
|
+
- Root files (the unified root agents file and related root docs).
|
|
70
|
+
- YAML override files that represent platform‑specific metadata.
|
|
71
|
+
- Root‑level files adjacent to `package.yml` that are intended as part of the package.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
#### 8. Output
|
|
76
|
+
|
|
77
|
+
The resulting list of files, with paths relative to the package directory, is what gets:
|
|
78
|
+
|
|
79
|
+
- Copied into the local registry under the computed version.
|
|
80
|
+
- Used to drive platform sync and any subsequent operations in the save pipeline.
|
|
81
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
### Save Pipeline – Modes and Inputs
|
|
2
|
+
|
|
3
|
+
#### 1. Overview
|
|
4
|
+
|
|
5
|
+
The **save pipeline** is the shared engine behind:
|
|
6
|
+
|
|
7
|
+
- `opkg save` – creates a **WIP prerelease** snapshot for the current workspace.
|
|
8
|
+
- `opkg pack` – promotes the current workspace state to a **stable** snapshot.
|
|
9
|
+
|
|
10
|
+
Both commands:
|
|
11
|
+
|
|
12
|
+
- Detect which package to operate on.
|
|
13
|
+
- Resolve the effective package name (including scoping and optional rename).
|
|
14
|
+
- Compute a target version (WIP vs stable) following `save-pack-versioning.md`.
|
|
15
|
+
- Select the set of files that belong to the package.
|
|
16
|
+
- Copy those files into the local registry.
|
|
17
|
+
- Clean up outdated WIP copies for the current workspace.
|
|
18
|
+
- Sync files to platform‑specific layouts (platform sync).
|
|
19
|
+
|
|
20
|
+
Versioning details are defined in `../save-pack-versioning.md`.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
#### 2. Modes
|
|
25
|
+
|
|
26
|
+
The pipeline runs in one of two **modes**:
|
|
27
|
+
|
|
28
|
+
##### WIP mode (`save`)
|
|
29
|
+
|
|
30
|
+
- Always produces a **WIP prerelease** version derived from the stable line in `package.yml`.
|
|
31
|
+
- May optionally auto‑bump `package.yml.version` to the next patch after a stable cycle, per `../save-pack-versioning.md`.
|
|
32
|
+
|
|
33
|
+
##### Stable mode (`pack`)
|
|
34
|
+
|
|
35
|
+
- Produces a **stable** version exactly equal to the current `package.yml.version`.
|
|
36
|
+
- Never mutates `package.yml.version`.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
#### 3. Inputs
|
|
41
|
+
|
|
42
|
+
- **Working directory (`cwd`)** – establishes the workspace.
|
|
43
|
+
- **Optional package name argument** – may be omitted (context detection) or provided explicitly.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
#### 4. Flags
|
|
48
|
+
|
|
49
|
+
- **`force`**
|
|
50
|
+
- In WIP mode: can suppress prompts and allow overwriting existing WIP versions.
|
|
51
|
+
- In stable mode: allows overwriting existing stable registry entries.
|
|
52
|
+
- **`rename <newName>`** – optional new package name to apply during this pipeline run.
|
|
53
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
### Save Pipeline – Naming, Scoping, and Renaming
|
|
2
|
+
|
|
3
|
+
#### 1. Overview
|
|
4
|
+
|
|
5
|
+
After the package context is known, the pipeline determines the **effective name** and handles any renames or scoping decisions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### 2. Input Name vs. Detected Configuration
|
|
10
|
+
|
|
11
|
+
- The **input name** for name resolution comes from:
|
|
12
|
+
- The explicit CLI argument, if present, or
|
|
13
|
+
- The detected package config's `name` when no argument is provided.
|
|
14
|
+
- The pipeline **never accepts a version suffix** here:
|
|
15
|
+
- Any `name@version` input is rejected with a clear error.
|
|
16
|
+
- The error instructs the user to change the stable line in `package.yml` instead.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
#### 3. Explicit Rename (`--rename`)
|
|
21
|
+
|
|
22
|
+
If `--rename <newName>` is provided:
|
|
23
|
+
|
|
24
|
+
- The new name must not include a version.
|
|
25
|
+
- The pipeline compares the rename target to the input name.
|
|
26
|
+
- If they differ:
|
|
27
|
+
- The operation is considered a **rename** with reason `explicit`.
|
|
28
|
+
- The new name becomes the **final package name**.
|
|
29
|
+
- If they are the same:
|
|
30
|
+
- No rename is applied; the option is effectively a no‑op.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
#### 4. Scoping Decision (No Explicit Rename)
|
|
35
|
+
|
|
36
|
+
When no rename is provided, the pipeline may still **change the name** for scoping reasons:
|
|
37
|
+
|
|
38
|
+
- If the input name is already scoped, it is used as‑is.
|
|
39
|
+
- If the input name is unscoped and scoped variants exist in the local registry:
|
|
40
|
+
- The user is prompted to choose one of:
|
|
41
|
+
- Use an existing scoped variant (e.g. `@user/pkg`).
|
|
42
|
+
- Create a new scoped name (e.g. prompt for `@scope/pkg`).
|
|
43
|
+
- Keep the unscoped name.
|
|
44
|
+
- The chosen name becomes the **final package name**, and any change is recorded as a rename with reason `scoping`.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
#### 5. UX Feedback
|
|
49
|
+
|
|
50
|
+
When the final name differs from the input name due to **scoping**, the pipeline prints a confirmation line for the user, e.g.:
|
|
51
|
+
|
|
52
|
+
> "Using scoped package name '@scope/pkg' for save operation."
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
#### 6. Name Resolution Result
|
|
57
|
+
|
|
58
|
+
At the end of this phase the pipeline knows:
|
|
59
|
+
|
|
60
|
+
- `inputName`: the original logical name for the package (without versions).
|
|
61
|
+
- `finalName`: the name under which the package will be saved and packed.
|
|
62
|
+
- Whether a rename is needed and why (`explicit` vs `scoping`).
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
#### 7. Workspace Rename Effects
|
|
67
|
+
|
|
68
|
+
When a rename is needed during `save` or `pack`, the workspace is updated so that **on‑disk layout matches the new name**.
|
|
69
|
+
|
|
70
|
+
##### `package.yml`
|
|
71
|
+
|
|
72
|
+
- The package's `name` field is updated to the final name.
|
|
73
|
+
|
|
74
|
+
##### Root files referring to the package
|
|
75
|
+
|
|
76
|
+
- Root files that contain package markers (e.g. sections in shared documentation) are updated so that markers reference the new name instead of the old one.
|
|
77
|
+
|
|
78
|
+
##### Root `package.yml` dependencies
|
|
79
|
+
|
|
80
|
+
- The workspace's root `package.yml` (if present) updates any dependency entries that reference the old name to the new name in both `packages` and `dev-packages`.
|
|
81
|
+
|
|
82
|
+
##### Nested package directories
|
|
83
|
+
|
|
84
|
+
- For non‑root packages, the physical package directory under `.openpackage/packages/` is moved to match the new normalized name, unless the directory already uses that layout.
|
|
85
|
+
- If directories for the new name already exist, the rename fails with an error explaining the conflict.
|
|
86
|
+
- After moving, now‑empty parent directories (such as unused scope directories) may be cleaned up.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
#### 8. Timing
|
|
91
|
+
|
|
92
|
+
The rename operation is considered part of the **save/pack workflow**: it happens before versioning, file selection, and registry copy, so downstream steps see the final name consistently.
|
|
93
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
### Save Pipeline – Package Context Detection
|
|
2
|
+
|
|
3
|
+
#### 1. Overview
|
|
4
|
+
|
|
5
|
+
Before any name or version logic, the pipeline determines which package is being operated on.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### 2. Core Rule
|
|
10
|
+
|
|
11
|
+
Any directory that contains `.openpackage/package.yml` is considered a **valid package**.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
#### 3. Detection Behavior
|
|
16
|
+
|
|
17
|
+
##### No package name argument
|
|
18
|
+
|
|
19
|
+
- Looks for `.openpackage/package.yml` in the current directory.
|
|
20
|
+
- If found:
|
|
21
|
+
- Treats the current directory as the **root package**.
|
|
22
|
+
- Uses its `package.yml` as the configuration source.
|
|
23
|
+
- If not found:
|
|
24
|
+
- The pipeline **aborts** with a user‑friendly message describing:
|
|
25
|
+
- That no package was detected at `cwd`.
|
|
26
|
+
- That a `.openpackage/package.yml` file is required.
|
|
27
|
+
- How to initialize a package or specify a name explicitly.
|
|
28
|
+
|
|
29
|
+
##### Package name argument provided
|
|
30
|
+
|
|
31
|
+
- First checks whether the **root package** (`.openpackage/package.yml` at `cwd`) has a matching `name`.
|
|
32
|
+
- If yes, the root is the target.
|
|
33
|
+
- Otherwise, looks under the **nested packages directory**:
|
|
34
|
+
- Direct directory match under `.openpackage/packages/<name>/package.yml`.
|
|
35
|
+
- If necessary, scans all nested package directories to find a `package.yml` whose `name` field equals the requested package name, even if the directory name differs.
|
|
36
|
+
- If no matching package is found:
|
|
37
|
+
- The pipeline **aborts** with a message explaining:
|
|
38
|
+
- The package name was not found.
|
|
39
|
+
- Which locations were checked (root and nested).
|
|
40
|
+
- How to create a new package with that name.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
#### 4. Package Context Result
|
|
45
|
+
|
|
46
|
+
Each detected package context includes:
|
|
47
|
+
|
|
48
|
+
- **Package directory** (logical package root for reporting).
|
|
49
|
+
- **Path to `package.yml`** (authoritative manifest location).
|
|
50
|
+
- **Package files directory** (`packageFilesDir` in code):
|
|
51
|
+
- For the **root package**: `<cwd>/.openpackage/…`
|
|
52
|
+
- For **nested packages**: `<cwd>/.openpackage/packages/<name>/…`
|
|
53
|
+
- Parsed `package.yml` configuration.
|
|
54
|
+
- Whether it is the **root package** or **nested**.
|
|
55
|
+
- Whether the package's directory is the same as `cwd`.
|
|
56
|
+
|
|
57
|
+
All downstream save/pack logic (file discovery, conflict resolution, registry copy, and platform
|
|
58
|
+
sync) reads and writes package content relative to this **package files directory**, so that
|
|
59
|
+
operations behave consistently for both root and nested packages.
|
|
60
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
### Save Pipeline – Registry Writes and Platform Sync
|
|
2
|
+
|
|
3
|
+
#### 1. Overview
|
|
4
|
+
|
|
5
|
+
This document covers the final stages of the save pipeline: version/index handling, registry writes, WIP cleanup, and platform sync.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
#### 2. Version and Index Handling
|
|
10
|
+
|
|
11
|
+
The pipeline follows these principles (see `../save-pack-versioning.md` for full details):
|
|
12
|
+
|
|
13
|
+
- The version declared in **`package.yml`** is the **canonical "next stable"** version.
|
|
14
|
+
- The **WIP or last stable version** recorded for this workspace lives in `package.index.yml` under `workspace.version`.
|
|
15
|
+
- WIP versions are always **pre‑releases derived from the stable line**, including:
|
|
16
|
+
- A time component, and
|
|
17
|
+
- A workspace hash component.
|
|
18
|
+
|
|
19
|
+
##### On WIP saves
|
|
20
|
+
|
|
21
|
+
- A new WIP version is computed from the current stable line.
|
|
22
|
+
- `package.index.yml` is updated with:
|
|
23
|
+
- `workspace.version` (the exact WIP version).
|
|
24
|
+
- `workspace.hash` (derived from `cwd`).
|
|
25
|
+
|
|
26
|
+
##### On stable packs
|
|
27
|
+
|
|
28
|
+
- The stable version is always exactly the value in `package.yml.version`.
|
|
29
|
+
- `package.index.yml.workspace.version` is updated to that stable version.
|
|
30
|
+
|
|
31
|
+
##### Version conflicts
|
|
32
|
+
|
|
33
|
+
- When `package.yml.version` and the last workspace version disagree, the **`package.yml` version wins**, and the WIP stream restarts from that version.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
#### 3. Registry Writes
|
|
38
|
+
|
|
39
|
+
For both modes, once a target version is chosen and content files are resolved:
|
|
40
|
+
|
|
41
|
+
- The pipeline creates a **full copy** of the package in the local registry under:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
~/.openpackage/registry/<finalName>/<targetVersion>/...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- If a directory already exists for that version:
|
|
48
|
+
- It is fully cleared before writing new contents (unless stable mode is disallowed by a non‑`force` duplicate check).
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
#### 4. WIP Cleanup
|
|
53
|
+
|
|
54
|
+
##### On WIP saves
|
|
55
|
+
|
|
56
|
+
After a successful copy:
|
|
57
|
+
|
|
58
|
+
- The pipeline scans the local registry for WIP versions of the same package that are associated with the current workspace hash.
|
|
59
|
+
- All such WIP versions are removed, except the newly created one.
|
|
60
|
+
|
|
61
|
+
##### On stable packs
|
|
62
|
+
|
|
63
|
+
After a successful copy:
|
|
64
|
+
|
|
65
|
+
- The pipeline may also remove WIP versions for this workspace to keep only the stable copy, as described in `../save-pack.md` and `../save-pack-versioning.md`.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
#### 5. Storage Guarantees
|
|
70
|
+
|
|
71
|
+
These steps ensure that:
|
|
72
|
+
|
|
73
|
+
- Stable and WIP versions are both stored as **full, independent copies**.
|
|
74
|
+
- Registry storage does not accumulate unbounded, per‑workspace WIP state.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
#### 6. Platform Sync
|
|
79
|
+
|
|
80
|
+
After the registry copy succeeds, the pipeline performs a **platform sync** pass.
|
|
81
|
+
|
|
82
|
+
##### Purpose
|
|
83
|
+
|
|
84
|
+
- Applies platform mapping rules to mirror the package's contents into platform‑specific workspaces and files (e.g. editor/IDE integrations, AI platforms, etc.).
|
|
85
|
+
- Updates `package.index.yml` to reflect the **actual installed paths** after sync.
|
|
86
|
+
|
|
87
|
+
##### Operations
|
|
88
|
+
|
|
89
|
+
Distinguishes between:
|
|
90
|
+
|
|
91
|
+
- Content that should be created or updated on platforms.
|
|
92
|
+
- Content that should be removed when no longer present in the package.
|
|
93
|
+
|
|
94
|
+
##### Index Updates
|
|
95
|
+
|
|
96
|
+
After sync completes:
|
|
97
|
+
|
|
98
|
+
- The `package.index.yml` is updated to include **all platform paths where files were actually created**.
|
|
99
|
+
- This differs from the `add` command, which only records the source path.
|
|
100
|
+
- Example: If a file was added from `.cursor/commands/test.md`, after sync the index will also include `.opencode/command/test.md` (if that platform is detected and the file was synced).
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
#### 7. Root Package Considerations
|
|
105
|
+
|
|
106
|
+
Special behavior for the **root package**:
|
|
107
|
+
|
|
108
|
+
- When operating on the root package (the current directory as the package), the pipeline can explicitly **skip root‑level platform sync** steps where appropriate (for example, to avoid syncing global root files back into themselves).
|
|
109
|
+
- Nested packages always participate fully in platform sync; their changes are projected out to supported platforms.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
#### 8. Platform Sync Timing
|
|
114
|
+
|
|
115
|
+
The platform sync step is invoked only after:
|
|
116
|
+
|
|
117
|
+
- Package detection and naming/renaming are complete.
|
|
118
|
+
- Version and file selection have succeeded.
|
|
119
|
+
- Registry copy has completed without errors.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
#### 9. Error Reporting
|
|
124
|
+
|
|
125
|
+
Any failures in platform sync are surfaced to the user as part of the save/pack result, with a summary of created, updated, and removed files per platform.
|
|
126
|
+
|
package/dist/commands/release.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { releasePackage } from '../core/package-sync.js';
|
|
2
|
-
import { parsePackageInput } from '../utils/package-name.js';
|
|
3
|
-
import { withErrorHandling } from '../utils/errors.js';
|
|
4
|
-
async function handleReleaseCommand(packageInput, options) {
|
|
5
|
-
const cwd = process.cwd();
|
|
6
|
-
const { name } = parsePackageInput(packageInput);
|
|
7
|
-
console.log(`🚀 Releasing workspace package '${name}'...`);
|
|
8
|
-
const result = await releasePackage({
|
|
9
|
-
cwd,
|
|
10
|
-
packageName: name,
|
|
11
|
-
version: options.version,
|
|
12
|
-
message: options.message,
|
|
13
|
-
allowMerge: options.allowMerge ?? false
|
|
14
|
-
});
|
|
15
|
-
console.log('\n✓ Release created');
|
|
16
|
-
console.log(` • Path: ${result.workspacePath}`);
|
|
17
|
-
console.log(` • Branch: ${result.branch}`);
|
|
18
|
-
console.log(` • Tag: ${result.tag}`);
|
|
19
|
-
console.log(` • Registry: ${result.registryRepoPath}`);
|
|
20
|
-
}
|
|
21
|
-
export function setupReleaseCommand(program) {
|
|
22
|
-
program
|
|
23
|
-
.command('release')
|
|
24
|
-
.description('Save current workspace state and create a tagged release in the local registry.')
|
|
25
|
-
.argument('<package-name>', 'package to release')
|
|
26
|
-
.option('--version <version>', 'explicit version to tag (defaults to package.yml version)')
|
|
27
|
-
.option('-m, --message <message>', 'commit message before pushing')
|
|
28
|
-
.option('--allow-merge', 'allow merge commits when registry main has diverged')
|
|
29
|
-
.action(withErrorHandling(async (packageName, options) => {
|
|
30
|
-
await handleReleaseCommand(packageName, options);
|
|
31
|
-
}));
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=release.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQvD,KAAK,UAAU,oBAAoB,CAAC,YAAoB,EAAE,OAA8B;IACtF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAEjD,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,MAAM,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC;QAClC,GAAG;QACH,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,KAAK;KACxC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,iFAAiF,CAAC;SAC9F,QAAQ,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;SAChD,MAAM,CAAC,qBAAqB,EAAE,2DAA2D,CAAC;SAC1F,MAAM,CAAC,yBAAyB,EAAE,+BAA+B,CAAC;SAClE,MAAM,CAAC,eAAe,EAAE,qDAAqD,CAAC;SAC9E,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,WAAmB,EAAE,OAA8B,EAAE,EAAE;QACtF,MAAM,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|