@ankhorage/orchestrator 0.1.1 โ 0.2.1
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 +1 -1
- package/README.md +20 -123
- package/package.json +19 -10
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,139 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# orchestrator
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A declarative installation engine for managing project modules.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## ๐ฏ What you get
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Install features like modules
|
|
8
|
+
- Remove them without breaking your app
|
|
9
|
+
- No manual file editing
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- Modules: pure planners that return actions from `plan(ctx)`.
|
|
11
|
-
- Host: loads module definitions, gathers config, and triggers `installModule` / `removeModule`.
|
|
11
|
+
## โจ Features
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- Deterministic install/uninstall
|
|
14
|
+
- Dependency-aware execution
|
|
14
15
|
|
|
15
|
-
##
|
|
16
|
+
## ๐ Installation
|
|
16
17
|
|
|
17
|
-
```
|
|
18
|
-
|
|
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");
|
|
18
|
+
```bash
|
|
19
|
+
bun add @ankhorage/orchestrator
|
|
49
20
|
```
|
|
50
21
|
|
|
51
|
-
|
|
22
|
+
## ๐ฆ Usage
|
|
52
23
|
|
|
53
24
|
```ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
version?: string,
|
|
57
|
-
dependencies?: string[],
|
|
58
|
-
plan(ctx): ModuleAction[] | Promise<ModuleAction[]>
|
|
59
|
-
})
|
|
60
|
-
```
|
|
61
|
-
|
|
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
|
|
25
|
+
orchestrator.install("expo-localization");
|
|
26
|
+
orchestrator.uninstall("expo-localization");
|
|
132
27
|
```
|
|
133
28
|
|
|
134
|
-
##
|
|
29
|
+
## ๐งช Use Cases
|
|
135
30
|
|
|
136
|
-
|
|
31
|
+
- Feature-based app composition
|
|
32
|
+
- Safe project scaffolding
|
|
137
33
|
|
|
138
|
-
|
|
34
|
+
## ๐ง Why this exists
|
|
139
35
|
|
|
36
|
+
Typical tools are one-way. This system enables reversible, structured changes.
|
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/orchestrator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ankhorage/orchestrator.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/ankhorage/orchestrator#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/ankhorage/orchestrator/issues"
|
|
15
|
+
},
|
|
7
16
|
"files": [
|
|
8
17
|
"dist"
|
|
9
18
|
],
|
|
@@ -22,19 +31,19 @@
|
|
|
22
31
|
"test": "bun test",
|
|
23
32
|
"knip": "bunx knip",
|
|
24
33
|
"changeset": "changeset",
|
|
25
|
-
"
|
|
34
|
+
"version-packages": "changeset version"
|
|
26
35
|
},
|
|
27
36
|
"devDependencies": {
|
|
28
|
-
"@ankhorage/devtools": "^1.0.
|
|
29
|
-
"@changesets/cli": "^2.
|
|
30
|
-
"@types/bun": "^1.3.
|
|
31
|
-
"@types/node": "^25.
|
|
32
|
-
"eslint": "^10.2.
|
|
33
|
-
"knip": "^5.
|
|
34
|
-
"prettier": "^3.8.
|
|
37
|
+
"@ankhorage/devtools": "^1.0.1",
|
|
38
|
+
"@changesets/cli": "^2.31.0",
|
|
39
|
+
"@types/bun": "^1.3.13",
|
|
40
|
+
"@types/node": "^25.6.0",
|
|
41
|
+
"eslint": "^10.2.1",
|
|
42
|
+
"knip": "^5.88.1",
|
|
43
|
+
"prettier": "^3.8.3",
|
|
35
44
|
"typescript": "^5.9.3"
|
|
36
45
|
},
|
|
37
|
-
"packageManager": "bun@1.3.
|
|
46
|
+
"packageManager": "bun@1.3.13",
|
|
38
47
|
"publishConfig": {
|
|
39
48
|
"access": "public"
|
|
40
49
|
}
|