@ankhorage/orchestrator 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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +139 -0
  3. package/dist/actions/jsonPath.d.ts +5 -0
  4. package/dist/actions/jsonPath.d.ts.map +1 -0
  5. package/dist/actions/jsonPath.js +148 -0
  6. package/dist/actions/jsonPath.js.map +1 -0
  7. package/dist/actions/types.d.ts +38 -0
  8. package/dist/actions/types.d.ts.map +1 -0
  9. package/dist/actions/types.js +2 -0
  10. package/dist/actions/types.js.map +1 -0
  11. package/dist/fs/exec.d.ts +9 -0
  12. package/dist/fs/exec.d.ts.map +1 -0
  13. package/dist/fs/exec.js +26 -0
  14. package/dist/fs/exec.js.map +1 -0
  15. package/dist/fs/fileSystem.d.ts +12 -0
  16. package/dist/fs/fileSystem.d.ts.map +1 -0
  17. package/dist/fs/fileSystem.js +51 -0
  18. package/dist/fs/fileSystem.js.map +1 -0
  19. package/dist/fs/patchTextBlock.d.ts +19 -0
  20. package/dist/fs/patchTextBlock.d.ts.map +1 -0
  21. package/dist/fs/patchTextBlock.js +46 -0
  22. package/dist/fs/patchTextBlock.js.map +1 -0
  23. package/dist/fs/paths.d.ts +2 -0
  24. package/dist/fs/paths.d.ts.map +1 -0
  25. package/dist/fs/paths.js +18 -0
  26. package/dist/fs/paths.js.map +1 -0
  27. package/dist/fs/types.d.ts +24 -0
  28. package/dist/fs/types.d.ts.map +1 -0
  29. package/dist/fs/types.js +2 -0
  30. package/dist/fs/types.js.map +1 -0
  31. package/dist/index.d.ts +7 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +4 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/ledger/helpers.d.ts +3 -0
  36. package/dist/ledger/helpers.d.ts.map +1 -0
  37. package/dist/ledger/helpers.js +5 -0
  38. package/dist/ledger/helpers.js.map +1 -0
  39. package/dist/ledger/types.d.ts +42 -0
  40. package/dist/ledger/types.d.ts.map +1 -0
  41. package/dist/ledger/types.js +2 -0
  42. package/dist/ledger/types.js.map +1 -0
  43. package/dist/module/defineModule.d.ts +3 -0
  44. package/dist/module/defineModule.d.ts.map +1 -0
  45. package/dist/module/defineModule.js +4 -0
  46. package/dist/module/defineModule.js.map +1 -0
  47. package/dist/module/types.d.ts +13 -0
  48. package/dist/module/types.d.ts.map +1 -0
  49. package/dist/module/types.js +2 -0
  50. package/dist/module/types.js.map +1 -0
  51. package/dist/orchestrator/actionExecutor.d.ts +11 -0
  52. package/dist/orchestrator/actionExecutor.d.ts.map +1 -0
  53. package/dist/orchestrator/actionExecutor.js +203 -0
  54. package/dist/orchestrator/actionExecutor.js.map +1 -0
  55. package/dist/orchestrator/createOrchestrator.d.ts +22 -0
  56. package/dist/orchestrator/createOrchestrator.d.ts.map +1 -0
  57. package/dist/orchestrator/createOrchestrator.js +154 -0
  58. package/dist/orchestrator/createOrchestrator.js.map +1 -0
  59. package/dist/orchestrator/dependencyGraph.d.ts +4 -0
  60. package/dist/orchestrator/dependencyGraph.d.ts.map +1 -0
  61. package/dist/orchestrator/dependencyGraph.js +44 -0
  62. package/dist/orchestrator/dependencyGraph.js.map +1 -0
  63. package/dist/orchestrator/uninstall.d.ts +9 -0
  64. package/dist/orchestrator/uninstall.d.ts.map +1 -0
  65. package/dist/orchestrator/uninstall.js +65 -0
  66. package/dist/orchestrator/uninstall.js.map +1 -0
  67. package/package.json +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../src/orchestrator/uninstall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFhB"}
@@ -0,0 +1,65 @@
1
+ import { removeTextBlock } from "../fs/patchTextBlock";
2
+ import { resolveProjectPath } from "../fs/paths";
3
+ export async function uninstallFromLedger(args) {
4
+ const { projectRoot, ledger, fileSystem, commandExecutor } = args;
5
+ const snapshotPaths = new Set(ledger.applied
6
+ .filter((operation) => operation.kind === "json-file-snapshot")
7
+ .map((operation) => operation.path));
8
+ for (const operation of [...ledger.applied].reverse()) {
9
+ switch (operation.kind) {
10
+ case "file-write": {
11
+ if (operation.prevContent === null) {
12
+ await fileSystem.remove(resolveProjectPath(projectRoot, operation.path));
13
+ }
14
+ else {
15
+ await fileSystem.writeText(resolveProjectPath(projectRoot, operation.path), operation.prevContent);
16
+ }
17
+ break;
18
+ }
19
+ case "text-block-insert": {
20
+ if (operation.created) {
21
+ await fileSystem.remove(resolveProjectPath(projectRoot, operation.path));
22
+ }
23
+ else {
24
+ await removeTextBlock({
25
+ fileSystem,
26
+ filePath: resolveProjectPath(projectRoot, operation.path),
27
+ blockId: operation.blockId,
28
+ });
29
+ }
30
+ break;
31
+ }
32
+ case "pkg-add": {
33
+ const result = await commandExecutor.exec(projectRoot, "bun", [
34
+ "remove",
35
+ operation.name,
36
+ ]);
37
+ if (result.code !== 0) {
38
+ throw new Error(`Package uninstall failed for ${operation.name} (${ledger.moduleId}): ${result.stderr || result.stdout}`);
39
+ }
40
+ break;
41
+ }
42
+ case "json-file-snapshot": {
43
+ const absolutePath = resolveProjectPath(projectRoot, operation.path);
44
+ if (operation.prevContent === null) {
45
+ await fileSystem.remove(absolutePath);
46
+ }
47
+ else {
48
+ await fileSystem.writeText(absolutePath, operation.prevContent);
49
+ }
50
+ break;
51
+ }
52
+ case "json-set": {
53
+ if (snapshotPaths.has(operation.path)) {
54
+ break;
55
+ }
56
+ break;
57
+ }
58
+ default: {
59
+ const exhaustive = operation;
60
+ return exhaustive;
61
+ }
62
+ }
63
+ }
64
+ }
65
+ //# sourceMappingURL=uninstall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/orchestrator/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAKzC;IACC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAClE,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,MAAM,CAAC,OAAO;SACX,MAAM,CACL,CACE,SAAS,EAIT,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,oBAAoB,CAC7C;SACA,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CACtC,CAAC;IAEF,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACtD,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACvB,KAAK,YAAY,CAAC,CAAC,CAAC;gBAClB,IAAI,SAAS,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;oBACnC,MAAM,UAAU,CAAC,MAAM,CACrB,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,CAChD,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,UAAU,CAAC,SAAS,CACxB,kBAAkB,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,CAAC,EAC/C,SAAS,CAAC,WAAW,CACtB,CAAC;gBACJ,CAAC;gBACD,MAAM;YACR,CAAC;YAED,KAAK,mBAAmB,CAAC,CAAC,CAAC;gBACzB,IAAI,SAAS,CAAC,OAA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ACtC,MAAM;gBACR,CAAC;gBACD,MAAM;YACR,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,UAAU,GAAU,SAAS,CAAC;gBACpC,OAAO,UAAU,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@ankhorage/orchestrator",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
18
+ "format": "prettier --write .",
19
+ "format:check": "prettier --check .",
20
+ "lint": "eslint . --max-warnings=0",
21
+ "lint:fix": "eslint . --fix --max-warnings=0",
22
+ "test": "bun test",
23
+ "knip": "bunx knip",
24
+ "changeset": "changeset",
25
+ "changeset:version": "changeset version"
26
+ },
27
+ "devDependencies": {
28
+ "@ankhorage/devtools": "^1.0.0",
29
+ "@changesets/cli": "^2.30.0",
30
+ "@types/bun": "^1.3.8",
31
+ "@types/node": "^25.2.3",
32
+ "eslint": "^10.2.0",
33
+ "knip": "^5.83.1",
34
+ "prettier": "^3.8.1",
35
+ "typescript": "^5.9.3"
36
+ },
37
+ "packageManager": "bun@1.3.11",
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }