@multiplatform.one/cli 7.10.0 → 7.15.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 (163) hide show
  1. package/README.md +121 -111
  2. package/bin/createMultiplatformApp.mjs +39 -37
  3. package/lib/bin/multiplatformOne.mjs +65 -75
  4. package/lib/commands/addApp.mjs +78 -0
  5. package/lib/commands/adoptApp.mjs +11 -7
  6. package/lib/commands/doctypeTypes.mjs +148 -0
  7. package/lib/commands/e2e.mjs +2 -2
  8. package/lib/commands/init.mjs +142 -459
  9. package/lib/commands/merge.mjs +359 -0
  10. package/lib/commands/pieces.mjs +236 -0
  11. package/lib/commands/provenance.mjs +108 -0
  12. package/lib/commands/scaffold.mjs +105 -0
  13. package/lib/commands/updateApp.mjs +211 -528
  14. package/lib/source.json +5 -0
  15. package/lib/source.mjs +63 -0
  16. package/package.json +7 -7
  17. package/scripts/frappe-bootstrap.sh +29 -3
  18. package/scripts/frappe-dev.sh +1 -2
  19. package/scripts/frappe-helpers.sh +50 -2
  20. package/scripts/frappe.sh +5 -0
  21. package/scripts/scaffold.sh +937 -0
  22. package/scripts/stamp-source.mjs +51 -0
  23. package/scripts/stamp-source.spec.ts +86 -0
  24. package/src/bin/multiplatformOne.ts +116 -226
  25. package/src/commands/addApp.ts +102 -0
  26. package/src/commands/adoptApp.spec.ts +5 -1
  27. package/src/commands/adoptApp.ts +15 -10
  28. package/src/commands/doctypeTypes.spec.ts +155 -0
  29. package/src/commands/doctypeTypes.ts +214 -0
  30. package/src/commands/init.spec.ts +66 -0
  31. package/src/commands/init.ts +201 -643
  32. package/src/commands/merge.spec.ts +81 -0
  33. package/src/commands/merge.ts +411 -0
  34. package/src/commands/pieces.spec.ts +62 -0
  35. package/src/commands/pieces.ts +340 -0
  36. package/src/commands/provenance.spec.ts +92 -0
  37. package/src/commands/provenance.ts +169 -0
  38. package/src/commands/scaffold.ts +131 -0
  39. package/src/commands/updateApp.spec.ts +540 -331
  40. package/src/commands/updateApp.ts +255 -668
  41. package/src/source.spec.ts +45 -0
  42. package/src/source.ts +88 -0
  43. package/templates/AGENTS.md +161 -0
  44. package/templates/README.md +62 -0
  45. package/templates/pieces/frappe/universal/README.md.partial +7 -32
  46. package/templates/pieces/frappe/universal/env.example.partial +3 -3
  47. package/templates/pieces/frappe-bench/universal/README.md.partial +28 -0
  48. package/templates/pieces/{frappe → frappe-bench}/universal/docker/compose.frappe.yaml +2 -2
  49. package/templates/pieces/tauri/universal/README.md.partial +7 -5
  50. package/templates/pieces/tauri/universal/apps/__NAME__/src-tauri/src/dev.rs +463 -0
  51. package/templates/pieces/tauri/universal/apps/__NAME__/src-tauri/src/lib.rs +6 -0
  52. package/templates/pieces/tauri/universal/apps/__NAME__/src-tauri/tauri.conf.json +2 -1
  53. package/templates/pieces/webext/universal/apps/__NAME__/package.json.partial +1 -0
  54. package/templates/pieces/webext/universal/apps/__NAME__/vite.config.webext.ts +6 -2
  55. package/types/bin/multiplatformOne.d.ts.map +1 -1
  56. package/types/commands/addApp.d.ts +20 -0
  57. package/types/commands/addApp.d.ts.map +1 -0
  58. package/types/commands/adoptApp.d.ts +4 -3
  59. package/types/commands/adoptApp.d.ts.map +1 -1
  60. package/types/commands/doctypeTypes.d.ts +40 -0
  61. package/types/commands/doctypeTypes.d.ts.map +1 -0
  62. package/types/commands/init.d.ts +30 -13
  63. package/types/commands/init.d.ts.map +1 -1
  64. package/types/commands/merge.d.ts +54 -0
  65. package/types/commands/merge.d.ts.map +1 -0
  66. package/types/commands/pieces.d.ts +54 -0
  67. package/types/commands/pieces.d.ts.map +1 -0
  68. package/types/commands/provenance.d.ts +52 -0
  69. package/types/commands/provenance.d.ts.map +1 -0
  70. package/types/commands/scaffold.d.ts +43 -0
  71. package/types/commands/scaffold.d.ts.map +1 -0
  72. package/types/commands/updateApp.d.ts +19 -27
  73. package/types/commands/updateApp.d.ts.map +1 -1
  74. package/types/source.d.ts +35 -0
  75. package/types/source.d.ts.map +1 -0
  76. package/lib/commands/initApp.mjs +0 -431
  77. package/lib/generateVscode.mjs +0 -184
  78. package/scripts/clone.sh +0 -17
  79. package/scripts/update.sh +0 -46
  80. package/src/commands/initApp.spec.ts +0 -720
  81. package/src/commands/initApp.ts +0 -706
  82. package/src/generateVscode.ts +0 -238
  83. package/templates/app/AGENTS.md +0 -142
  84. package/templates/app/README.md +0 -62
  85. package/templates/app/apps/__NAME__/index.html +0 -36
  86. package/templates/app/apps/__NAME__/package.json +0 -31
  87. package/templates/app/apps/__NAME__/public/fonts/inter-400.woff2 +0 -0
  88. package/templates/app/apps/__NAME__/public/fonts/inter-700.woff2 +0 -0
  89. package/templates/app/apps/__NAME__/src/App.tsx +0 -9
  90. package/templates/app/apps/__NAME__/src/main.tsx +0 -14
  91. package/templates/app/apps/__NAME__/tsconfig.json +0 -8
  92. package/templates/app/apps/__NAME__/vite.config.ts +0 -17
  93. package/templates/app/features/__NAME__/package.json +0 -34
  94. package/templates/app/features/__NAME__/src/HomeScreen.tsx +0 -70
  95. package/templates/app/features/__NAME__/src/index.ts +0 -1
  96. package/templates/app/features/__NAME__/tsconfig.json +0 -5
  97. package/templates/app/gitignore +0 -9
  98. package/templates/app/npmrc +0 -2
  99. package/templates/app/oxlintrc.json +0 -39
  100. package/templates/app/package.json +0 -38
  101. package/templates/app/packages/config/config.json +0 -4
  102. package/templates/app/packages/config/index.ts +0 -5
  103. package/templates/app/packages/config/package.json +0 -17
  104. package/templates/app/packages/config/tsconfig.json +0 -5
  105. package/templates/app/pnpm-workspace.yaml +0 -4
  106. package/templates/app/tsconfig.base.json +0 -16
  107. package/templates/universal/AGENTS.md +0 -142
  108. package/templates/universal/README.md +0 -97
  109. package/templates/universal/apps/__NAME__/app.config.js +0 -31
  110. package/templates/universal/apps/__NAME__/config/tamagui.config.ts +0 -4
  111. package/templates/universal/apps/__NAME__/package.json +0 -62
  112. package/templates/universal/apps/__NAME__/polyfills.native.ts +0 -23
  113. package/templates/universal/apps/__NAME__/polyfills.ts +0 -3
  114. package/templates/universal/apps/__NAME__/public/fonts/inter-400.woff2 +0 -0
  115. package/templates/universal/apps/__NAME__/public/fonts/inter-700.woff2 +0 -0
  116. package/templates/universal/apps/__NAME__/routes/_layout.tsx +0 -22
  117. package/templates/universal/apps/__NAME__/routes/_layout.web.tsx +0 -21
  118. package/templates/universal/apps/__NAME__/routes/about.tsx +0 -3
  119. package/templates/universal/apps/__NAME__/routes/index.tsx +0 -3
  120. package/templates/universal/apps/__NAME__/src/app.ts +0 -10
  121. package/templates/universal/apps/__NAME__/tamagui.css +0 -3
  122. package/templates/universal/apps/__NAME__/tsconfig.json +0 -8
  123. package/templates/universal/apps/__NAME__/types.d.ts +0 -9
  124. package/templates/universal/apps/__NAME__/vite.config.ts +0 -20
  125. package/templates/universal/features/__NAME__/package.json +0 -35
  126. package/templates/universal/features/__NAME__/src/AboutScreen.tsx +0 -27
  127. package/templates/universal/features/__NAME__/src/AppLayout.tsx +0 -50
  128. package/templates/universal/features/__NAME__/src/ContactForm.spec.tsx +0 -22
  129. package/templates/universal/features/__NAME__/src/ContactForm.tsx +0 -55
  130. package/templates/universal/features/__NAME__/src/HomeScreen.tsx +0 -40
  131. package/templates/universal/features/__NAME__/src/index.ts +0 -4
  132. package/templates/universal/features/__NAME__/src/screens.spec.ts +0 -12
  133. package/templates/universal/features/__NAME__/tsconfig.json +0 -5
  134. package/templates/universal/features/__NAME__/vitest.config.mjs +0 -7
  135. package/templates/universal/gitignore +0 -14
  136. package/templates/universal/npmrc +0 -3
  137. package/templates/universal/oxlintrc.json +0 -39
  138. package/templates/universal/package.json +0 -51
  139. package/templates/universal/packages/config/config.json +0 -4
  140. package/templates/universal/packages/config/index.ts +0 -5
  141. package/templates/universal/packages/config/package.json +0 -17
  142. package/templates/universal/packages/config/tsconfig.json +0 -5
  143. package/templates/universal/packages/i18n/en/common.json +0 -30
  144. package/templates/universal/packages/i18n/es/common.json +0 -30
  145. package/templates/universal/packages/i18n/i18n.d.ts +0 -16
  146. package/templates/universal/packages/i18n/index.ts +0 -26
  147. package/templates/universal/packages/i18n/package.json +0 -20
  148. package/templates/universal/packages/i18n/resources.ts +0 -13
  149. package/templates/universal/packages/i18n/tsconfig.json +0 -5
  150. package/templates/universal/packages/themes/accent.ts +0 -32
  151. package/templates/universal/packages/themes/base.ts +0 -50
  152. package/templates/universal/packages/themes/fonts.ts +0 -8
  153. package/templates/universal/packages/themes/index.ts +0 -33
  154. package/templates/universal/packages/themes/package.json +0 -23
  155. package/templates/universal/packages/themes/tamagui.config.ts +0 -14
  156. package/templates/universal/packages/themes/tsconfig.json +0 -5
  157. package/templates/universal/pnpm-workspace.yaml +0 -4
  158. package/templates/universal/tsconfig.base.json +0 -21
  159. package/templates/universal/types/env.d.ts +0 -9
  160. package/types/commands/initApp.d.ts +0 -114
  161. package/types/commands/initApp.d.ts.map +0 -1
  162. package/types/generateVscode.d.ts +0 -7
  163. package/types/generateVscode.d.ts.map +0 -1
@@ -1,16 +1,33 @@
1
- interface InitOptions {
2
- name?: string;
3
- services?: string;
4
- apps?: string;
5
- checkout?: string;
6
- /** Path to clone.sh script (from CLI); if set, clone via script instead of execSync */
7
- cloneScript?: string;
8
- }
9
1
  /**
10
- * Shared modify step: remove unselected apps/services and rewrite configs.
11
- * Used by both init (with prompted selections) and update (with getPresentApps/getPresentServices).
2
+ * `mpo init`: a consumer project is the multiplatform.one monorepo at one
3
+ * commit, pruned. scripts/scaffold.sh does the work (clone or archive at
4
+ * the ref, drop public/ and the singleton apps not asked for, rename
5
+ * apps/one to each product app, rewrite workspace: ranges to semver); this
6
+ * command picks the commit, asks what to keep, and finishes the repo.
12
7
  */
13
- export declare function runModifyStep(dir: string, selectedServices: string[], selectedApps: string[]): void;
14
- export declare function init(nameArg: string | undefined, options: InitOptions): Promise<void>;
15
- export {};
8
+ /** The apps that exist once per project; everything else under apps/ is a product app. */
9
+ export declare const SINGLETON_APPS: readonly ["ethereum", "frappe", "keycloak", "solana", "storybook", "storybook-expo", "sui", "uxpin", "vocs"];
10
+ export type SingletonApp = (typeof SINGLETON_APPS)[number];
11
+ export interface InitOptions {
12
+ /** Product apps besides the project name (each is a renamed apps/one). */
13
+ apps?: string[];
14
+ /** Singleton apps to keep. */
15
+ services?: string[];
16
+ /** Path or url to scaffold from instead of the CLI's recorded source. */
17
+ source?: string;
18
+ /** Commit, tag or branch at that source. */
19
+ checkout?: string;
20
+ /** Range for @multiplatform.one/* (default: ^<cli version at the source>). */
21
+ mpoVersion?: string;
22
+ skipInstall?: boolean;
23
+ skipGit?: boolean;
24
+ /** Non-interactive: no prompts, no services unless passed. */
25
+ yes?: boolean;
26
+ /** Scaffold into an existing (non-empty) directory. */
27
+ into?: boolean;
28
+ /** Show the scaffold's per-path progress. */
29
+ verbose?: boolean;
30
+ }
31
+ export declare function validateServices(services: string[]): SingletonApp[];
32
+ export declare function init(nameArg: string | undefined, options?: InitOptions): Promise<void>;
16
33
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAsEA,UAAU,WAAW;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,gBAAgB,EAAE,MAAM,EAAE,EAC1B,YAAY,EAAE,MAAM,EAAE,GACrB,IAAI,CAuDN;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBAqI3E"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,0FAA0F;AAC1F,eAAO,MAAM,cAAc,8GAUjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAc3D,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,uDAAuD;IACvD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAUnE;AAsCD,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiHhG"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The three-way merge behind `mpo update` and `mpo add-app`:
3
+ *
4
+ * base = the scaffold the project started from (recorded in .mpo.json)
5
+ * ours = the project's HEAD (every commit the project made)
6
+ * theirs = the scaffold it is moving to
7
+ *
8
+ * `git merge-tree --write-tree --merge-base=<base>` merges the scaffold's
9
+ * evolution with the project's history; the result lands in the index and
10
+ * worktree, never in a commit, so the project commits when it is happy.
11
+ * `.updateignore` entries (exact files or directory prefixes, not globs) and
12
+ * pnpm-lock.yaml stay pinned to HEAD.
13
+ */
14
+ export declare function git(projectDir: string, args: string[], env?: Record<string, string>): Promise<import("nano-spawn").Result>;
15
+ export declare function gitOut(projectDir: string, args: string[], env?: Record<string, string>): Promise<string>;
16
+ export declare function projectRootOf(command: string): Promise<string>;
17
+ /** The merge lands in the worktree, so nothing else may be in flight there. */
18
+ export declare function requireCleanTree(projectDir: string, command: string): Promise<void>;
19
+ /**
20
+ * Pins: pnpm-lock.yaml plus every .updateignore entry. Entries are exact
21
+ * files or directory prefixes (`git ls-tree -- <path>` semantics); the one
22
+ * natural glob spelling (`dir/**`, `dir/*`) normalizes to its directory and
23
+ * any other glob shape is refused, because a silently dead ignore rule is
24
+ * the worst failure mode.
25
+ */
26
+ export declare function readPins(projectDir: string): string[];
27
+ /** Structural three-way merge of package.json content, or undefined when a
28
+ * divergence cannot be auto-resolved (the textual markers then stay). */
29
+ export declare function threeWayMergePackageJson(base: string | undefined, ours: string, theirs: string): Record<string, unknown> | undefined;
30
+ export interface MergeRequest {
31
+ projectDir: string;
32
+ /** The scaffold the project started from; undefined = the empty tree. */
33
+ baseDir?: string;
34
+ theirsDir: string;
35
+ baseLabel: string;
36
+ theirsLabel: string;
37
+ }
38
+ export interface MergeOutcome {
39
+ mergedTree: string;
40
+ /** false when the merged tree is HEAD's tree already. */
41
+ changed: boolean;
42
+ conflicts: string[];
43
+ resolved: string[];
44
+ }
45
+ /** Compute the merged tree. Pure object-database work; nothing is written to the worktree. */
46
+ export declare function mergeScaffolds(request: MergeRequest): Promise<MergeOutcome>;
47
+ /** Land a tree in the index and worktree. The tree was clean before, so
48
+ * every difference is the merge; nothing is committed. */
49
+ export declare function landTree(projectDir: string, tree: string): Promise<void>;
50
+ /** Print the outcome and the commit line; run pnpm install on a clean merge. */
51
+ export declare function finishMerge(projectDir: string, outcome: MergeOutcome, commitMessage: string, options?: {
52
+ skipInstall?: boolean;
53
+ }): Promise<void>;
54
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/commands/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,wCAKzF;AAED,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,mBAG5F;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIpE;AAED,+EAA+E;AAC/E,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzF;AAuED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAkBrD;AA2ED;0EAC0E;AAC1E,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAerC;AAwDD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,8FAA8F;AAC9F,wBAAsB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA2DjF;AAED;2DAC2D;AAC3D,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9E;AAED,gFAAgF;AAChF,wBAAsB,WAAW,CAC/B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACtC,OAAO,CAAC,IAAI,CAAC,CAuBf"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Pieces: additive fragment trees under templates/pieces/<piece>/ that an
3
+ * ADOPTED project (`mpo adopt`) hand-copied and wants `mpo update` to keep
4
+ * reconciling. A project from `mpo init` never needs them: apps/one already
5
+ * ships gnome/, tauri/, vscode/ and webext/, and frappe / keycloak are
6
+ * `--service` selections of the real apps. Keep sorted: pieces are recorded
7
+ * sorted in provenance and overlaid in this order.
8
+ */
9
+ export declare const INIT_APP_PIECES: readonly ["frappe", "frappe-bench", "gnome", "keycloak", "tauri", "vscode", "webext"];
10
+ export type InitAppPiece = (typeof INIT_APP_PIECES)[number];
11
+ export declare function piecesRoot(): string;
12
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
13
+ [key: string]: JsonValue;
14
+ };
15
+ /**
16
+ * Deep-merge for JSON partials: objects merge recursively (fragment keys
17
+ * append after base keys, so e.g. package.json script order stays stable),
18
+ * arrays union (base order first), scalars/type-mismatches take the
19
+ * fragment value.
20
+ */
21
+ export declare function mergeJsonValues(base: JsonValue, fragment: JsonValue): JsonValue;
22
+ /**
23
+ * Validate + canonicalize a piece selection: unknown names throw, duplicates
24
+ * collapse, order is always sorted, and every piece must ship a fragment.
25
+ */
26
+ export declare function normalizePieces(pieces: string[], root?: string): InitAppPiece[];
27
+ /**
28
+ * The frappe piece carried the dev bench until the bench became its own piece
29
+ * (MPO-241). An adoption recorded against pieces that still bundle it keeps
30
+ * the bench, now as frappe-bench, so an update does not delete it.
31
+ */
32
+ export declare function withSplitPieces(pieces: InitAppPiece[], recordedRoot?: string): InitAppPiece[];
33
+ export declare function availablePieces(root?: string): InitAppPiece[];
34
+ export declare function pieceDescription(piece: InitAppPiece): string;
35
+ /**
36
+ * apps/<name>/src/app.ts for the selected backend pieces: each provider
37
+ * adds one createApp key. Only written when a provider piece is selected.
38
+ */
39
+ export declare function composeAppTs(pieces: InitAppPiece[]): string;
40
+ export interface PiecesScaffold {
41
+ name: string;
42
+ mpoVersion: string;
43
+ pieces: InitAppPiece[];
44
+ /** templates/pieces of another CLI version (the merge base of an older adoption). */
45
+ root?: string;
46
+ }
47
+ /**
48
+ * The tool-owned surface of an adopted project: the selected piece
49
+ * fragments overlaid, in sorted order, on an EMPTY tree. `mpo update`
50
+ * builds both merge baselines of an adopted project with this.
51
+ */
52
+ export declare function scaffoldPieces(targetDir: string, request: PiecesScaffold): void;
53
+ export {};
54
+ //# sourceMappingURL=pieces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pieces.d.ts","sourceRoot":"","sources":["../../src/commands/pieces.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,uFAQlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAY5D,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AA8DD,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAM/F;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,CAoB/E;AAgFD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,SAAe,GAAG,YAAY,EAAE,CAYrF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAI7F;AAED,wBAAgB,eAAe,CAAC,IAAI,SAAe,GAAG,YAAY,EAAE,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CA0C3D;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,qFAAqF;IACrF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAyB/E"}
@@ -0,0 +1,52 @@
1
+ import type { InitAppPiece } from "./pieces";
2
+ export declare const PROVENANCE_FILE = ".mpo.json";
3
+ /**
4
+ * What `mpo update` needs to rebuild the merge base of a project.
5
+ *
6
+ * A project from `mpo init` records the monorepo commit it was pruned from
7
+ * and the selection made at that time; the scaffold at that commit with
8
+ * that selection IS the merge base. An adopted project (`mpo adopt`,
9
+ * template "none") records only the pieces it hand-copied. A project from
10
+ * the retired template scaffolder (template "universal" / "app") has no
11
+ * reproducible base left; its next update reconciles from an empty tree.
12
+ */
13
+ export interface MpoProvenance {
14
+ cliVersion: string;
15
+ /** The monorepo commit the project was scaffolded from. */
16
+ source?: {
17
+ sha: string;
18
+ url?: string;
19
+ };
20
+ /** Product apps derived from apps/one. */
21
+ apps: string[];
22
+ /** Singleton apps kept under apps/ (frappe, keycloak, storybook, ...). */
23
+ services: string[];
24
+ /** Pieces overlaid for adopted projects (sorted). */
25
+ pieces: InitAppPiece[];
26
+ /** "none" = adopted; "universal" / "app" = template-era. Absent on clone-derived projects. */
27
+ template?: "none" | "universal" | "app";
28
+ /** Adopted and template-era projects: the name that renders piece paths (apps/<name>/...). */
29
+ name?: string;
30
+ mpoVersion?: string;
31
+ /**
32
+ * false = adopted but never reconciled: `mpo adopt` wrote provenance
33
+ * without touching a project file, so the first update merges the piece
34
+ * baseline from an EMPTY base and then clears the flag.
35
+ */
36
+ reconciled?: boolean;
37
+ }
38
+ export declare function validateName(name: string): string;
39
+ /** Root package.json name with any @scope/ prefix stripped (adopt derives the project name from it). */
40
+ export declare function packageJsonName(projectDir: string): string | undefined;
41
+ export declare function cliRoot(): string;
42
+ export declare function cliVersion(): string | undefined;
43
+ /** `^x.y.z` for a bare version; explicit ranges pass through. */
44
+ export declare function mpoRange(explicit: string | undefined, fallbackVersion?: string | undefined): string;
45
+ export declare function writeProvenance(targetDir: string, provenance: MpoProvenance): void;
46
+ /**
47
+ * Reads both shapes: the clone-derived record ({cliVersion, source, apps,
48
+ * services, pieces}) and the older {template, name} record written by
49
+ * `mpo adopt` and the retired template scaffolder.
50
+ */
51
+ export declare function readProvenance(projectDir: string): MpoProvenance | undefined;
52
+ //# sourceMappingURL=provenance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../src/commands/provenance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,MAAM,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qDAAqD;IACrD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK,CAAC;IACxC,8FAA8F;IAC9F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWjD;AAED,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAStE;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAS/C;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,eAAe,qBAAe,GAAG,MAAM,CAO7F;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,GAAG,IAAI,CAmBlF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAoD5E"}
@@ -0,0 +1,43 @@
1
+ import { type MpoProvenance } from "./provenance";
2
+ /** The scaffold itself: POSIX sh, runs standalone. The TS commands only call it. */
3
+ export declare function scaffoldScript(): string;
4
+ export interface ScaffoldRequest {
5
+ /** Path to a local clone or a git URL. */
6
+ source: string;
7
+ /** Commit, tag or branch. */
8
+ ref: string;
9
+ target: string;
10
+ /** Product apps derived from apps/one. */
11
+ apps: string[];
12
+ /** Singleton apps kept under apps/. */
13
+ services: string[];
14
+ /** Range written for @multiplatform.one/* (default: ^<cli version at the ref>). */
15
+ mpoVersion?: string;
16
+ /** Scaffold into a non-empty directory; existing paths are skipped and pinned. */
17
+ into?: boolean;
18
+ /** Url recorded in .mpo.json instead of the source path. */
19
+ sourceUrl?: string;
20
+ /** Root package.json name (default: the target's basename). */
21
+ name?: string;
22
+ /** Show the script's progress (removed: ... lines). */
23
+ verbose?: boolean;
24
+ }
25
+ export declare class ScaffoldError extends Error {
26
+ readonly request: ScaffoldRequest;
27
+ constructor(message: string, request: ScaffoldRequest);
28
+ }
29
+ /** Run scaffold.sh and return the provenance it wrote. */
30
+ export declare function runScaffold(request: ScaffoldRequest): Promise<MpoProvenance>;
31
+ export interface TempScaffold {
32
+ dir: string;
33
+ provenance: MpoProvenance;
34
+ cleanup: () => void;
35
+ }
36
+ /** A scaffold in a temp dir (merge baselines). */
37
+ export declare function scaffoldToTemp(request: Omit<ScaffoldRequest, "target" | "into">): Promise<TempScaffold>;
38
+ /**
39
+ * One subtree of the monorepo at a ref, extracted into `dest` (the piece
40
+ * templates of an older CLI version, for adopted-project merge bases).
41
+ */
42
+ export declare function archiveSubtree(source: string, ref: string, subtree: string, dest: string): Promise<void>;
43
+ //# sourceMappingURL=scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/commands/scaffold.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAE3E,oFAAoF;AACpF,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,uCAAuC;IACvC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAc,SAAQ,KAAK;IAGpC,QAAQ,CAAC,OAAO,EAAE,eAAe;gBADjC,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,eAAe;CAIpC;AAcD,0DAA0D;AAC1D,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CA0BlF;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,aAAa,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,kDAAkD;AAClD,wBAAsB,cAAc,CAClC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,MAAM,CAAC,GAChD,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgBf"}
@@ -1,38 +1,30 @@
1
1
  /**
2
- * `mpo update` for scaffolded consumer projects — the modern successor of
3
- * the old cookiecutter flow (init a fresh project, swap your .git in, merge
4
- * your changes on top), rebuilt with a TRUE three-way merge:
2
+ * `mpo update`: bring the monorepo's changes into a project as a three-way
3
+ * merge that is NEVER committed.
5
4
  *
6
- * base = the ORIGINAL scaffold, regenerated from the CLI version recorded
7
- * in .mpo.json at init time (published CLIs ship their templates,
8
- * so `pnpm dlx @multiplatform.one/cli@<old> init` reproduces it)
9
- * ours = the project's HEAD (all your custom changes)
10
- * theirs= a fresh scaffold from the CURRENT CLI version
5
+ * base = the scaffold the project started from: the monorepo at the
6
+ * commit recorded in .mpo.json, pruned with the recorded apps
7
+ * and services
8
+ * ours = the project's HEAD (every commit the project made)
9
+ * theirs = the same scaffold at the commit the running CLI was built from
10
+ * (or --source/--checkout)
11
11
  *
12
- * `git merge-tree --write-tree --merge-base=<base>` merges template
13
- * evolution with your customizations; conflicts land in the worktree with
14
- * normal conflict markers. An `.updateignore` file (one exact file or
15
- * directory prefix per line — not globs; `dir/**` is normalized, other
16
- * glob shapes are refused) pins matching paths to your HEAD version.
12
+ * Every product app is a renamed apps/one on both sides, so a change to
13
+ * the One app lands in each of them. The merged tree goes into the index
14
+ * and worktree; the commit line is printed; a dirty tree is refused up
15
+ * front. Adopted projects (`mpo adopt`) merge their piece fragments the
16
+ * same way; projects from the retired template scaffolder reconcile from an
17
+ * empty base once and are clone-derived afterwards.
17
18
  */
18
- import { type InitAppTemplate } from "./initApp";
19
19
  export interface UpdateAppOptions {
20
- /** Skip pnpm install after the merge. */
21
20
  skipInstall?: boolean;
22
21
  /** Override the semver range written for @multiplatform.one/* deps. */
23
22
  version?: string;
24
- /**
25
- * Pre-provenance bootstrap: when .mpo.json is missing, assume the project
26
- * was scaffolded by this exact CLI version, write provenance first, then
27
- * proceed with the normal update.
28
- */
29
- assumeVersion?: string;
30
- /** Template recorded by the --assume-version bootstrap (default universal). */
31
- assumeTemplate?: InitAppTemplate;
23
+ /** Path or url to update from (default: the CLI's recorded source). */
24
+ source?: string;
25
+ /** Commit, tag or branch at that source (default: the CLI's source commit). */
26
+ checkout?: string;
27
+ verbose?: boolean;
32
28
  }
33
- /** Structural three-way merge of package.json content. Returns the merged
34
- * object, or undefined when a divergence can't be auto-resolved (the file
35
- * then keeps its textual conflict markers for manual resolution). */
36
- export declare function threeWayMergePackageJson(base: string | undefined, ours: string, theirs: string): Record<string, unknown> | undefined;
37
29
  export declare function updateApp(options?: UpdateAppOptions): Promise<void>;
38
30
  //# sourceMappingURL=updateApp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateApp.d.ts","sourceRoot":"","sources":["../../src/commands/updateApp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,EASL,KAAK,eAAe,EAGrB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,eAAe,CAAC;CAClC;AA2QD;;sEAEsE;AACtE,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAerC;AAyGD,wBAAsB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgS7E"}
1
+ {"version":3,"file":"updateApp.d.ts","sourceRoot":"","sources":["../../src/commands/updateApp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA2BH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAuPD,wBAAsB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB7E"}
@@ -0,0 +1,35 @@
1
+ export declare const monorepoUrl = "https://git.corp.bitspur.com/multiplatform.one/mpo.git";
2
+ export interface SourceSpec {
3
+ /** Path to a local clone, or a git URL. */
4
+ source: string;
5
+ /** Commit, tag or branch to scaffold from. */
6
+ ref: string;
7
+ /**
8
+ * flag = --source / --checkout
9
+ * monorepo = the CLI runs from inside a monorepo checkout (dev, `make`)
10
+ * stamp = lib/source.json written by the build
11
+ * tag = no stamp: the release tag of this CLI version
12
+ */
13
+ origin: "flag" | "monorepo" | "stamp" | "tag";
14
+ warning?: string;
15
+ }
16
+ export interface SourceStamp {
17
+ cliVersion?: string;
18
+ sha?: string;
19
+ url?: string;
20
+ }
21
+ export declare function isGitUrl(source: string): boolean;
22
+ /** The monorepo checkout this CLI runs from, if any (src via tsx, or the workspace link). */
23
+ export declare function monorepoCheckout(): string | undefined;
24
+ export declare function readSourceStamp(): SourceStamp | undefined;
25
+ /**
26
+ * Where `mpo init` clones from. Flags win; a CLI running inside the monorepo
27
+ * uses that checkout's HEAD; a published CLI uses the commit stamped at build
28
+ * time; a build without a stamp falls back to the release tag of its own
29
+ * version, and `init` retries `main` when that tag is missing.
30
+ */
31
+ export declare function resolveSource(flags?: {
32
+ source?: string;
33
+ checkout?: string;
34
+ }): SourceSpec;
35
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,2DAA2D,CAAC;AAEpF,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CASrD;AAED,wBAAgB,eAAe,IAAI,WAAW,GAAG,SAAS,CAMzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CA8B5F"}