@ankhorage/orchestrator 0.1.0 โ†’ 0.1.2

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 (2) hide show
  1. package/README.md +20 -129
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,139 +1,30 @@
1
- # @ankhorage/orchestrator
1
+ # orchestrator
2
2
 
3
- `@ankhorage/orchestrator` is the standalone engine extracted and redesigned from the relevant contract and execution concepts in `../ankhorage4/packages/plugin-kit` and the CLI runtime helpers.
3
+ A declarative installation engine for managing project modules.
4
4
 
5
- The package has one job: execute module plans against a project root, track the applied work in `.ankh/ledger/<moduleId>.json`, and reverse that work deterministically on removal.
5
+ ## ๐ŸŽฏ What you get
6
+ - Install features like modules
7
+ - Remove them without breaking your app
8
+ - No manual file editing
6
9
 
7
- ## Architecture
10
+ ## โœจ Features
11
+ - Deterministic install/uninstall
12
+ - Dependency-aware execution
8
13
 
9
- - Orchestrator: owns the loaded module registry, resolves dependencies, installs modules, removes modules, and writes the ledger.
10
- - Modules: pure planners that return actions from `plan(ctx)`.
11
- - Host: loads module definitions, gathers config, and triggers `installModule` / `removeModule`.
12
-
13
- The orchestrator does not know templates, UI, Studio, Expo layout generation, or runtime-specific behavior.
14
-
15
- ## Public API
16
-
17
- ```ts
18
- import { createOrchestrator, defineModule } from "@ankhorage/orchestrator";
19
-
20
- const localizationModule = defineModule({
21
- id: "expo-localization",
22
- dependencies: ["base-i18n"],
23
- async plan(ctx) {
24
- return [
25
- {
26
- type: "write-files",
27
- files: [
28
- {
29
- path: "src/modules/localization/index.ts",
30
- content: "export const ready = true;\n",
31
- overwrite: true,
32
- },
33
- ],
34
- },
35
- ];
36
- },
37
- });
38
-
39
- const orchestrator = createOrchestrator({
40
- modules: [localizationModule],
41
- projectRoot: "/absolute/path/to/project",
42
- });
43
-
44
- await orchestrator.installModule("expo-localization", {
45
- config: { defaultLocale: "en" },
46
- });
47
-
48
- await orchestrator.removeModule("expo-localization");
14
+ ## ๐Ÿš€ Installation
15
+ ```bash
16
+ bun add @ankhorage/orchestrator
49
17
  ```
50
18
 
51
- ### Module contract
52
-
19
+ ## ๐Ÿ“ฆ Usage
53
20
  ```ts
54
- defineModule({
55
- id: string,
56
- version?: string,
57
- dependencies?: string[],
58
- plan(ctx): ModuleAction[] | Promise<ModuleAction[]>
59
- })
21
+ orchestrator.install('expo-localization')
22
+ orchestrator.uninstall('expo-localization')
60
23
  ```
61
24
 
62
- `plan(ctx)` receives:
63
-
64
- - `projectRoot`
65
- - `moduleId`
66
- - `config`
67
-
68
- The host only passes `config`; the orchestrator injects the rest.
69
-
70
- ### Supported actions
71
-
72
- V1 supports exactly these actions:
73
-
74
- - `ensure-packages`
75
- - `write-files`
76
- - `json-set`
77
- - `patch-text-block`
78
-
79
- Package execution is internal infrastructure only. The orchestrator uses safe `bun add` / `bun remove` argument arrays under `src/fs/exec.ts` and does not expose an adapter API.
80
-
81
- ## Ledger behavior
82
-
83
- Each installed module writes `.ankh/ledger/<moduleId>.json`.
84
-
85
- Every ledger entry stores:
86
-
87
- - `moduleId`
88
- - `moduleVersion`
89
- - `installedAt`
90
- - `config`
91
- - `dependencies`
92
- - `actions`
93
- - `applied`
94
-
95
- The `applied` section is the source of truth for rollback. Removal never recomputes a module plan.
96
-
97
- ## Install and remove semantics
98
-
99
- - Dependency resolution belongs to the orchestrator, not the host.
100
- - Missing declared dependencies fail the install before any execution starts.
101
- - Dependencies are installed before the requested module.
102
- - Removal is immediate. The orchestrator reads the ledger, replays rollback operations, and deletes the ledger file.
103
- - Removal is blocked if another installed module still depends on the target module.
104
-
105
- ### Replace-style reinstall
106
-
107
- If `installModule()` is called for a module that is already installed, the orchestrator removes the existing installed state first and then runs the new plan.
108
-
109
- This behavior is intentional in v1 and has an important consequence:
110
-
111
- - if the reinstall fails after the prior state was removed, the module remains removed
112
-
113
- Fresh installs behave differently:
114
-
115
- - if a fresh install fails part-way through, the orchestrator rolls back the new partial work and leaves no orchestrator-managed residue behind
116
-
117
- ## Development
118
-
119
- This repo uses:
120
-
121
- - `@ankhorage/devtools` for lint and prettier alignment
122
- - `@changesets/cli` for versioning
123
-
124
- Run the quality gates with:
125
-
126
- ```sh
127
- bun install
128
- bun run build
129
- bun run lint
130
- bun run test
131
- bunx knip
132
- ```
133
-
134
- ## Repo-switch rule
135
-
136
- Work in this repo stops once the orchestrator package is release-ready.
137
-
138
- Module extraction must happen later in dedicated repos such as `@ankhorage/orchestrator-module-expo-localization`. When that work starts, the current repo is no longer the right place to continue. The next step must be an explicit repository switch request before any module-repo changes are made.
25
+ ## ๐Ÿงช Use Cases
26
+ - Feature-based app composition
27
+ - Safe project scaffolding
139
28
 
29
+ ## ๐Ÿง  Why this exists
30
+ Typical tools are one-way. This system enables reversible, structured changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/orchestrator",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",