@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.
- package/README.md +20 -129
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,139 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# orchestrator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A declarative installation engine for managing project modules.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ๐ฏ What you get
|
|
6
|
+
- Install features like modules
|
|
7
|
+
- Remove them without breaking your app
|
|
8
|
+
- No manual file editing
|
|
6
9
|
|
|
7
|
-
##
|
|
10
|
+
## โจ Features
|
|
11
|
+
- Deterministic install/uninstall
|
|
12
|
+
- Dependency-aware execution
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
52
|
-
|
|
19
|
+
## ๐ฆ Usage
|
|
53
20
|
```ts
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
-
|
|
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.
|