@mondaydotcomorg/z2h-cli 0.1.0 → 0.2.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 (142) hide show
  1. package/dist/commands/__tests__/create-workspace.test.d.ts +2 -0
  2. package/dist/commands/__tests__/create-workspace.test.d.ts.map +1 -0
  3. package/dist/commands/__tests__/create.test.d.ts +2 -0
  4. package/dist/commands/__tests__/create.test.d.ts.map +1 -0
  5. package/dist/commands/build.d.ts +1 -0
  6. package/dist/commands/build.d.ts.map +1 -1
  7. package/dist/commands/build.js +5 -1
  8. package/dist/commands/create-workspace.d.ts +5 -0
  9. package/dist/commands/create-workspace.d.ts.map +1 -0
  10. package/dist/commands/create-workspace.js +81 -0
  11. package/dist/commands/create.d.ts +7 -0
  12. package/dist/commands/create.d.ts.map +1 -0
  13. package/dist/commands/create.js +104 -0
  14. package/dist/commands/deploy.d.ts.map +1 -1
  15. package/dist/commands/deploy.js +13 -9
  16. package/dist/commands/dev.d.ts.map +1 -1
  17. package/dist/commands/dev.js +29 -0
  18. package/dist/constants.d.ts +1 -14
  19. package/dist/constants.d.ts.map +1 -1
  20. package/dist/constants.js +11 -34
  21. package/dist/esm/commands/__tests__/create-workspace.test.d.ts +2 -0
  22. package/dist/esm/commands/__tests__/create-workspace.test.d.ts.map +1 -0
  23. package/dist/esm/commands/__tests__/create.test.d.ts +2 -0
  24. package/dist/esm/commands/__tests__/create.test.d.ts.map +1 -0
  25. package/dist/esm/commands/build.d.ts +1 -0
  26. package/dist/esm/commands/build.d.ts.map +1 -1
  27. package/dist/esm/commands/build.mjs +5 -1
  28. package/dist/esm/commands/create-workspace.d.ts +5 -0
  29. package/dist/esm/commands/create-workspace.d.ts.map +1 -0
  30. package/dist/esm/commands/create-workspace.mjs +75 -0
  31. package/dist/esm/commands/create.d.ts +7 -0
  32. package/dist/esm/commands/create.d.ts.map +1 -0
  33. package/dist/esm/commands/create.mjs +98 -0
  34. package/dist/esm/commands/deploy.d.ts.map +1 -1
  35. package/dist/esm/commands/deploy.mjs +12 -9
  36. package/dist/esm/commands/dev.d.ts.map +1 -1
  37. package/dist/esm/commands/dev.mjs +25 -1
  38. package/dist/esm/constants.d.ts +1 -14
  39. package/dist/esm/constants.d.ts.map +1 -1
  40. package/dist/esm/constants.mjs +11 -32
  41. package/dist/esm/index.mjs +28 -0
  42. package/dist/esm/shadow/__tests__/consumer-pkg.test.d.ts +2 -0
  43. package/dist/esm/shadow/__tests__/consumer-pkg.test.d.ts.map +1 -0
  44. package/dist/esm/shadow/__tests__/merge-package-json.test.d.ts +2 -0
  45. package/dist/esm/shadow/__tests__/merge-package-json.test.d.ts.map +1 -0
  46. package/dist/esm/shadow/consumer-pkg.d.ts +5 -15
  47. package/dist/esm/shadow/consumer-pkg.d.ts.map +1 -1
  48. package/dist/esm/shadow/consumer-pkg.mjs +11 -72
  49. package/dist/esm/shadow/merge-package-json.d.ts +10 -4
  50. package/dist/esm/shadow/merge-package-json.d.ts.map +1 -1
  51. package/dist/esm/shadow/merge-package-json.mjs +12 -11
  52. package/dist/esm/shadow/scaffold.d.ts.map +1 -1
  53. package/dist/esm/shadow/scaffold.mjs +5 -0
  54. package/dist/esm/shadow/sync.mjs +2 -2
  55. package/dist/esm/templates/app/claude-settings.mjs +23 -0
  56. package/dist/esm/types.d.ts +0 -1
  57. package/dist/esm/types.d.ts.map +1 -1
  58. package/dist/esm/util/__tests__/templates.test.d.ts +2 -0
  59. package/dist/esm/util/__tests__/templates.test.d.ts.map +1 -0
  60. package/dist/esm/util/__tests__/workspace-templates-shipped.test.d.ts +2 -0
  61. package/dist/esm/util/__tests__/workspace-templates-shipped.test.d.ts.map +1 -0
  62. package/dist/esm/util/__tests__/workspace.test.d.ts +2 -0
  63. package/dist/esm/util/__tests__/workspace.test.d.ts.map +1 -0
  64. package/dist/esm/util/manifest.d.ts +1 -0
  65. package/dist/esm/util/manifest.d.ts.map +1 -1
  66. package/dist/esm/util/s3/upload.mjs +1 -1
  67. package/dist/esm/util/templates.d.ts +22 -0
  68. package/dist/esm/util/templates.d.ts.map +1 -0
  69. package/dist/esm/util/templates.mjs +36 -0
  70. package/dist/esm/util/workspace.d.ts +20 -0
  71. package/dist/esm/util/workspace.d.ts.map +1 -0
  72. package/dist/esm/util/workspace.mjs +46 -0
  73. package/dist/index.js +28 -0
  74. package/dist/shadow/__tests__/consumer-pkg.test.d.ts +2 -0
  75. package/dist/shadow/__tests__/consumer-pkg.test.d.ts.map +1 -0
  76. package/dist/shadow/__tests__/merge-package-json.test.d.ts +2 -0
  77. package/dist/shadow/__tests__/merge-package-json.test.d.ts.map +1 -0
  78. package/dist/shadow/consumer-pkg.d.ts +5 -15
  79. package/dist/shadow/consumer-pkg.d.ts.map +1 -1
  80. package/dist/shadow/consumer-pkg.js +10 -72
  81. package/dist/shadow/merge-package-json.d.ts +10 -4
  82. package/dist/shadow/merge-package-json.d.ts.map +1 -1
  83. package/dist/shadow/merge-package-json.js +11 -10
  84. package/dist/shadow/scaffold.d.ts.map +1 -1
  85. package/dist/shadow/scaffold.js +5 -0
  86. package/dist/shadow/sync.js +2 -2
  87. package/dist/templates/app/claude-settings.js +27 -0
  88. package/dist/types.d.ts +0 -1
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/util/__tests__/templates.test.d.ts +2 -0
  91. package/dist/util/__tests__/templates.test.d.ts.map +1 -0
  92. package/dist/util/__tests__/workspace-templates-shipped.test.d.ts +2 -0
  93. package/dist/util/__tests__/workspace-templates-shipped.test.d.ts.map +1 -0
  94. package/dist/util/__tests__/workspace.test.d.ts +2 -0
  95. package/dist/util/__tests__/workspace.test.d.ts.map +1 -0
  96. package/dist/util/manifest.d.ts +1 -0
  97. package/dist/util/manifest.d.ts.map +1 -1
  98. package/dist/util/s3/upload.js +1 -1
  99. package/dist/util/templates.d.ts +22 -0
  100. package/dist/util/templates.d.ts.map +1 -0
  101. package/dist/util/templates.js +45 -0
  102. package/dist/util/workspace.d.ts +20 -0
  103. package/dist/util/workspace.d.ts.map +1 -0
  104. package/dist/util/workspace.js +57 -0
  105. package/package.json +5 -3
  106. package/src/commands/__tests__/create-workspace.test.ts +78 -0
  107. package/src/commands/__tests__/create.test.ts +114 -0
  108. package/src/commands/build.ts +6 -1
  109. package/src/commands/create-workspace.ts +86 -0
  110. package/src/commands/create.ts +121 -0
  111. package/src/commands/deploy.ts +15 -11
  112. package/src/commands/dev.ts +26 -1
  113. package/src/constants.ts +11 -34
  114. package/src/index.ts +28 -0
  115. package/src/shadow/__tests__/consumer-pkg.test.ts +56 -0
  116. package/src/shadow/__tests__/merge-package-json.test.ts +44 -0
  117. package/src/shadow/consumer-pkg.ts +10 -88
  118. package/src/shadow/merge-package-json.ts +12 -11
  119. package/src/shadow/scaffold.ts +5 -0
  120. package/src/shadow/sync.ts +2 -2
  121. package/src/templates/app/CLAUDE.md +72 -0
  122. package/src/templates/app/claude-settings.json +19 -0
  123. package/src/templates/app/default-index.tsx.tmpl +21 -0
  124. package/src/templates/app/gitignore +4 -0
  125. package/src/templates/app/html-index.tsx.tmpl +21 -0
  126. package/src/templates/app/package.json.tmpl +13 -0
  127. package/src/templates/workspace/README.md +39 -0
  128. package/src/templates/workspace/gitignore +23 -0
  129. package/src/templates/workspace/npmrc +3 -0
  130. package/src/templates/workspace/nvmrc +1 -0
  131. package/src/templates/workspace/package.json.tmpl +23 -0
  132. package/src/templates/workspace/yarn-releases/yarn-4.5.1.cjs +934 -0
  133. package/src/templates/workspace/yarnlock +0 -0
  134. package/src/templates/workspace/yarnrc.yml +7 -0
  135. package/src/types.ts +4 -1
  136. package/src/util/__tests__/templates.test.ts +27 -0
  137. package/src/util/__tests__/workspace-templates-shipped.test.ts +35 -0
  138. package/src/util/__tests__/workspace.test.ts +65 -0
  139. package/src/util/manifest.ts +1 -0
  140. package/src/util/s3/upload.ts +1 -1
  141. package/src/util/templates.ts +37 -0
  142. package/src/util/workspace.ts +52 -0
@@ -22,6 +22,7 @@ export interface AssetManifestFile {
22
22
  export interface ManifestEntry extends AssetManifestFile {
23
23
  version: number;
24
24
  url: string;
25
+ deployedBy: string;
25
26
  }
26
27
  export type Manifest = Record<string, ManifestEntry>;
27
28
  export declare function readManifest(): Promise<Manifest>;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/util/manifest.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAErD,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAQtD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAI1D;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,QAAQ,CAE3F;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,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  import path from 'node:path';
2
- import { readFile } from 'fs-extra';
3
2
  import { readdir } from 'node:fs/promises';
3
+ import { readFile } from 'fs-extra';
4
4
  import { lookup } from 'mime-types';
5
5
  import pMap from 'p-map';
6
6
  import { PutObjectCommand } from '@aws-sdk/client-s3';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Substitute `__PLACEHOLDER__` tokens in `content` with values from `vars`.
3
+ * Values are inserted literally — no regex special-char interpretation —
4
+ * which matters for content like `$1` or `&` that could otherwise be
5
+ * captured by `String.prototype.replace`.
6
+ */
7
+ export declare function renderTemplate(content: string, vars: Record<string, string>): string;
8
+ /**
9
+ * Absolute path to the bundled `templates/` directory under `src/`.
10
+ *
11
+ * The CLI's `package.json` `files` array ships `src/` (so `src/templates/`
12
+ * lands in published packages). The build emits `.ts` files to `dist/`,
13
+ * but raw template assets (`.tmpl`, `.md`, `gitignore`, `.json`) live only
14
+ * under `src/templates/`. Resolving here keeps a single source of truth
15
+ * for both:
16
+ * - dev (vitest, tsx) → `<pkg>/src/util/` + ../../src/templates → `<pkg>/src/templates`
17
+ * - published install (dist/util) → `<pkg>/dist/util/` + ../../src/templates → `<pkg>/src/templates`
18
+ */
19
+ export declare function getTemplatesDir(): string;
20
+ export type AppTemplate = 'default' | 'html-embed';
21
+ export declare const APP_TEMPLATES: AppTemplate[];
22
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/util/templates.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAQpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC;AACnD,eAAO,MAAM,aAAa,EAAE,WAAW,EAA8B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+
4
+ /**
5
+ * Substitute `__PLACEHOLDER__` tokens in `content` with values from `vars`.
6
+ * Values are inserted literally — no regex special-char interpretation —
7
+ * which matters for content like `$1` or `&` that could otherwise be
8
+ * captured by `String.prototype.replace`.
9
+ */
10
+ function renderTemplate(content, vars) {
11
+ let out = content;
12
+ for (const [key, value] of Object.entries(vars)) {
13
+ // Use split+join (literal pattern) to avoid regex interpretation of
14
+ // special chars in `value`.
15
+ out = out.split(key).join(value);
16
+ }
17
+ return out;
18
+ }
19
+ /**
20
+ * Absolute path to the bundled `templates/` directory under `src/`.
21
+ *
22
+ * The CLI's `package.json` `files` array ships `src/` (so `src/templates/`
23
+ * lands in published packages). The build emits `.ts` files to `dist/`,
24
+ * but raw template assets (`.tmpl`, `.md`, `gitignore`, `.json`) live only
25
+ * under `src/templates/`. Resolving here keeps a single source of truth
26
+ * for both:
27
+ * - dev (vitest, tsx) → `<pkg>/src/util/` + ../../src/templates → `<pkg>/src/templates`
28
+ * - published install (dist/util) → `<pkg>/dist/util/` + ../../src/templates → `<pkg>/src/templates`
29
+ */
30
+ function getTemplatesDir() {
31
+ const here = path.dirname(fileURLToPath(import.meta.url));
32
+ return path.resolve(here, '..', '..', 'src', 'templates');
33
+ }
34
+ const APP_TEMPLATES = ['default', 'html-embed'];
35
+
36
+ export { APP_TEMPLATES, getTemplatesDir, renderTemplate };
@@ -0,0 +1,20 @@
1
+ export declare const WORKSPACE_DIR_NAME = "zth-projects";
2
+ export declare const WORKSPACE_MARKER_FIELD = "z2hWorkspace";
3
+ /**
4
+ * The Z2H workspace home is hardcoded to `~/zth-projects/` for users.
5
+ * Tests override via the `Z2H_WORKSPACE_HOME` env var so they can use a
6
+ * tmp dir without touching the user's real home.
7
+ */
8
+ export declare function getWorkspaceHome(): string;
9
+ /**
10
+ * Returns true iff `<dir>/package.json` exists and has `"z2hWorkspace": true`.
11
+ * Any read or parse error returns false (defensive — callers route to a
12
+ * helpful message via assertWorkspace).
13
+ */
14
+ export declare function isZ2hWorkspace(dir: string): Promise<boolean>;
15
+ /**
16
+ * Resolves to the workspace home path if the marker is present; otherwise
17
+ * throws an Error pointing the user at `z2h-cli create-workspace`.
18
+ */
19
+ export declare function assertWorkspace(): Promise<string>;
20
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/util/workspace.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AACjD,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAMD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAWlE;AAED;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CASvD"}
@@ -0,0 +1,46 @@
1
+ import path from 'node:path';
2
+ import os from 'node:os';
3
+ import { pathExists, readJson } from 'fs-extra';
4
+
5
+ const WORKSPACE_DIR_NAME = 'zth-projects';
6
+ const WORKSPACE_MARKER_FIELD = 'z2hWorkspace';
7
+ /**
8
+ * The Z2H workspace home is hardcoded to `~/zth-projects/` for users.
9
+ * Tests override via the `Z2H_WORKSPACE_HOME` env var so they can use a
10
+ * tmp dir without touching the user's real home.
11
+ */
12
+ function getWorkspaceHome() {
13
+ return process.env.Z2H_WORKSPACE_HOME ?? path.join(os.homedir(), WORKSPACE_DIR_NAME);
14
+ }
15
+ /**
16
+ * Returns true iff `<dir>/package.json` exists and has `"z2hWorkspace": true`.
17
+ * Any read or parse error returns false (defensive — callers route to a
18
+ * helpful message via assertWorkspace).
19
+ */
20
+ async function isZ2hWorkspace(dir) {
21
+ const pkgPath = path.join(dir, 'package.json');
22
+ if (!(await pathExists(pkgPath))) {
23
+ return false;
24
+ }
25
+ try {
26
+ const pkg = (await readJson(pkgPath));
27
+ return pkg[WORKSPACE_MARKER_FIELD] === true;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ /**
34
+ * Resolves to the workspace home path if the marker is present; otherwise
35
+ * throws an Error pointing the user at `z2h-cli create-workspace`.
36
+ */
37
+ async function assertWorkspace() {
38
+ const home = getWorkspaceHome();
39
+ if (await isZ2hWorkspace(home)) {
40
+ return home;
41
+ }
42
+ throw new Error(`No Z2H workspace at ${home}. Run "z2h-cli create-workspace" first ` +
43
+ `(or set Z2H_WORKSPACE_HOME if you keep the workspace elsewhere).`);
44
+ }
45
+
46
+ export { WORKSPACE_DIR_NAME, WORKSPACE_MARKER_FIELD, assertWorkspace, getWorkspaceHome, isZ2hWorkspace };
package/dist/index.js CHANGED
@@ -3,6 +3,8 @@ const commands_dev = require('./commands/dev.js');
3
3
  const commands_build = require('./commands/build.js');
4
4
  const commands_clean = require('./commands/clean.js');
5
5
  const commands_deploy = require('./commands/deploy.js');
6
+ const commands_createWorkspace = require('./commands/create-workspace.js');
7
+ const commands_create = require('./commands/create.js');
6
8
  const util_logger = require('./util/logger.js');
7
9
 
8
10
  async function main() {
@@ -74,6 +76,32 @@ async function main() {
74
76
  util_logger.fail(`deploy failed: ${err.message}`, { command: 'deploy' }, 2);
75
77
  }
76
78
  });
79
+ program
80
+ .command('create-workspace')
81
+ .description('Bootstrap the ~/zth-projects/ yarn workspace (one-time setup)')
82
+ .option('--json', 'emit structured JSON on stdout')
83
+ .action(async (opts) => {
84
+ try {
85
+ await commands_createWorkspace.createWorkspaceCommand(opts);
86
+ }
87
+ catch (err) {
88
+ util_logger.fail(`create-workspace failed: ${err.message}`, { command: 'create-workspace' }, 1);
89
+ }
90
+ });
91
+ program
92
+ .command('create <app-name>')
93
+ .description('Scaffold a new Z2H consumer app inside ~/zth-projects/')
94
+ .option('--template <name>', 'Template name (default | html-embed)')
95
+ .option('--html-file <path>', 'Path to an HTML file to embed (implies --template html-embed)')
96
+ .option('--json', 'emit structured JSON on stdout')
97
+ .action(async (appName, opts) => {
98
+ try {
99
+ await commands_create.createCommand(appName, opts);
100
+ }
101
+ catch (err) {
102
+ util_logger.fail(`create failed: ${err.message}`, { command: 'create' }, 1);
103
+ }
104
+ });
77
105
  await program.parseAsync(process.argv);
78
106
  }
79
107
  void main()
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=consumer-pkg.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consumer-pkg.test.d.ts","sourceRoot":"","sources":["../../../src/shadow/__tests__/consumer-pkg.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=merge-package-json.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-package-json.test.d.ts","sourceRoot":"","sources":["../../../src/shadow/__tests__/merge-package-json.test.ts"],"names":[],"mappings":""}
@@ -1,21 +1,11 @@
1
1
  import type { ConsumerPkg } from '../types';
2
2
  /**
3
- * Return the consumer's `workspaces` field extended with `.zth`. Handles
4
- * all three shapes: missing, array form, or object form (`{ packages }`).
5
- * Always extends — never replaces the user's existing entries.
6
- */
7
- export declare function ensureConsumerWorkspaces(pkg: ConsumerPkg): {
8
- changed: boolean;
9
- workspaces: ConsumerPkg['workspaces'];
10
- };
11
- /**
12
- * Idempotently reshape the consumer's package.json so that:
13
- * - it is marked `"private": true`
14
- * - `.zth` is declared as a yarn workspace member (yarn will hoist)
15
- * - the protected runtime deps are present at compatible versions
16
- * - the protected dev deps are present at compatible versions
3
+ * The consumer pkg is a thin manifest. Z2H apps live inside a yarn
4
+ * workspace at `~/zth-projects/`; runtime and dev deps come from the
5
+ * workspace root, hoisted into a single `node_modules/`.
17
6
  *
18
- * Always extends — never overrides existing fields.
7
+ * The only thing this file enforces today is `private: true` — apps must
8
+ * never accidentally publish to npm.
19
9
  */
20
10
  export declare function ensureConsumerPkg(pkgPath: string, pkg: ConsumerPkg): Promise<{
21
11
  changed: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"consumer-pkg.d.ts","sourceRoot":"","sources":["../../src/shadow/consumer-pkg.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,WAAW,GAAG;IAC1D,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;CACvC,CAsBA;AAqBD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,GACf,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAE,CAAC,CAgCjD"}
1
+ {"version":3,"file":"consumer-pkg.d.ts","sourceRoot":"","sources":["../../src/shadow/consumer-pkg.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,GACf,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,WAAW,CAAA;CAAE,CAAC,CAOjD"}
@@ -1,84 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const fsExtra = require('fs-extra');
4
- const constants = require('../constants.js');
5
4
 
6
5
  /**
7
- * Return the consumer's `workspaces` field extended with `.zth`. Handles
8
- * all three shapes: missing, array form, or object form (`{ packages }`).
9
- * Always extends — never replaces the user's existing entries.
10
- */
11
- function ensureConsumerWorkspaces(pkg) {
12
- const { workspaces } = pkg;
13
- if (Array.isArray(workspaces)) {
14
- if (workspaces.includes(constants.SHADOW_DIR_NAME)) {
15
- return { changed: false, workspaces };
16
- }
17
- return { changed: true, workspaces: [...workspaces, constants.SHADOW_DIR_NAME] };
18
- }
19
- if (workspaces && typeof workspaces === 'object') {
20
- const pkgs = workspaces.packages ?? [];
21
- if (pkgs.includes(constants.SHADOW_DIR_NAME)) {
22
- return { changed: false, workspaces };
23
- }
24
- return {
25
- changed: true,
26
- workspaces: { ...workspaces, packages: [...pkgs, constants.SHADOW_DIR_NAME] },
27
- };
28
- }
29
- return { changed: true, workspaces: [constants.SHADOW_DIR_NAME] };
30
- }
31
- /**
32
- * Extend a deps map with the protected entries; only fills in missing ones,
33
- * never overrides versions the consumer already pinned.
34
- */
35
- function applyProtected(current, protectedMap) {
36
- const next = { ...(current ?? {}) };
37
- let changed = false;
38
- for (const [name, version] of Object.entries(protectedMap)) {
39
- if (!next[name]) {
40
- next[name] = version;
41
- changed = true;
42
- }
43
- }
44
- return { changed, next };
45
- }
46
- /**
47
- * Idempotently reshape the consumer's package.json so that:
48
- * - it is marked `"private": true`
49
- * - `.zth` is declared as a yarn workspace member (yarn will hoist)
50
- * - the protected runtime deps are present at compatible versions
51
- * - the protected dev deps are present at compatible versions
6
+ * The consumer pkg is a thin manifest. Z2H apps live inside a yarn
7
+ * workspace at `~/zth-projects/`; runtime and dev deps come from the
8
+ * workspace root, hoisted into a single `node_modules/`.
52
9
  *
53
- * Always extends — never overrides existing fields.
10
+ * The only thing this file enforces today is `private: true` — apps must
11
+ * never accidentally publish to npm.
54
12
  */
55
13
  async function ensureConsumerPkg(pkgPath, pkg) {
56
- let changed = false;
57
- const next = { ...pkg };
58
- if (next.private !== true) {
59
- next.private = true;
60
- changed = true;
61
- }
62
- const ws = ensureConsumerWorkspaces(next);
63
- if (ws.changed) {
64
- next.workspaces = ws.workspaces;
65
- changed = true;
66
- }
67
- const deps = applyProtected(next.dependencies, constants.PROTECTED_DEPS);
68
- if (deps.changed) {
69
- next.dependencies = deps.next;
70
- changed = true;
71
- }
72
- const devDeps = applyProtected(next.devDependencies, constants.PROTECTED_DEV_DEPS);
73
- if (devDeps.changed) {
74
- next.devDependencies = devDeps.next;
75
- changed = true;
76
- }
77
- if (changed) {
78
- await fsExtra.writeJson(pkgPath, next, { spaces: 2 });
14
+ if (pkg.private === true) {
15
+ return { changed: false, pkg };
79
16
  }
80
- return { changed, pkg: next };
17
+ const next = { ...pkg, private: true };
18
+ await fsExtra.writeJson(pkgPath, next, { spaces: 2 });
19
+ return { changed: true, pkg: next };
81
20
  }
82
21
 
83
22
  exports.ensureConsumerPkg = ensureConsumerPkg;
84
- exports.ensureConsumerWorkspaces = ensureConsumerWorkspaces;
@@ -1,9 +1,15 @@
1
1
  import type { ConsumerPkg, ShadowPkg } from '../types';
2
2
  /**
3
- * Build the shadow package.json. Declares the shared runtime deps as
4
- * peerDependencies — yarn resolves them from the workspace root (the
5
- * consumer's package.json), guaranteeing a single React instance across
6
- * the wrapper and consumer src.
3
+ * Build the shadow package.json.
4
+ *
5
+ * Runtime deps live at the workspace root (`~/zth-projects/`) and are
6
+ * hoisted in via yarn workspaces — no need to mirror them here. The shadow
7
+ * only declares the toolchain it directly executes (`trident-toolkit`) so
8
+ * yarn berry wires the `trident` bin into the shadow's script PATH.
9
+ *
10
+ * The `@trident/` scope is preserved so trident-toolkit strips it and the
11
+ * emitted bundle becomes `MF-mf-<appName>`, matching the URL the host MF
12
+ * routes to.
7
13
  */
8
14
  export declare function buildShadowPkg(consumerPkg: ConsumerPkg): ShadowPkg;
9
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"merge-package-json.d.ts","sourceRoot":"","sources":["../../src/shadow/merge-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAalE;AAgBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAW9D;AAED,wBAAsB,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5F"}
1
+ {"version":3,"file":"merge-package-json.d.ts","sourceRoot":"","sources":["../../src/shadow/merge-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAQlE;AAgBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAW9D;AAED,wBAAsB,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5F"}
@@ -10,23 +10,24 @@ const _interopDefault = e => e && e.__esModule ? e : { default: e };
10
10
  const crypto__default = /*#__PURE__*/_interopDefault(crypto);
11
11
 
12
12
  /**
13
- * Build the shadow package.json. Declares the shared runtime deps as
14
- * peerDependencies — yarn resolves them from the workspace root (the
15
- * consumer's package.json), guaranteeing a single React instance across
16
- * the wrapper and consumer src.
13
+ * Build the shadow package.json.
14
+ *
15
+ * Runtime deps live at the workspace root (`~/zth-projects/`) and are
16
+ * hoisted in via yarn workspaces — no need to mirror them here. The shadow
17
+ * only declares the toolchain it directly executes (`trident-toolkit`) so
18
+ * yarn berry wires the `trident` bin into the shadow's script PATH.
19
+ *
20
+ * The `@trident/` scope is preserved so trident-toolkit strips it and the
21
+ * emitted bundle becomes `MF-mf-<appName>`, matching the URL the host MF
22
+ * routes to.
17
23
  */
18
24
  function buildShadowPkg(consumerPkg) {
19
- // Use the `@trident/` scope so trident-toolkit strips it and the emitted
20
- // bundle becomes `MF-mf-<appName>`, matching the URL the host MF routes to.
21
- // The scope also keeps the shadow's name distinct from the consumer's
22
- // package.json name (same workspace, different identifiers).
23
25
  return {
24
26
  name: `@trident/${util_appName.mfAppName(consumerPkg.name)}`,
25
27
  version: '0.0.1',
26
28
  private: true,
27
29
  scripts: constants.SHADOW_SCRIPTS,
28
- peerDependencies: { ...constants.PROTECTED_DEPS },
29
- devDependencies: constants.WORKSPACE_DEV_DEPS,
30
+ devDependencies: { ...constants.SHADOW_DEV_DEPS },
30
31
  };
31
32
  }
32
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAqG9C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvG"}
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../src/shadow/scaffold.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0G9C;;;GAGG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvG"}
@@ -79,6 +79,11 @@ declare module '*.wasm' {
79
79
  const e: string;
80
80
  export default e;
81
81
  }
82
+
83
+ declare module '*.html?url' {
84
+ const src: string;
85
+ export default src;
86
+ }
82
87
  `;
83
88
  const TSCONFIG_TEMPLATE = {
84
89
  compilerOptions: {
@@ -18,8 +18,8 @@ async function syncShadow(paths, consumerPkg) {
18
18
  const oldHash = (await fsExtra.pathExists(paths.shadowDepsHash)) ? await fsExtra.readFile(paths.shadowDepsHash, 'utf8') : null;
19
19
  if (oldHash !== newHash) {
20
20
  util_logger.info(oldHash ? 'consumer deps changed — yarn install' : 'first run — yarn install');
21
- // Yarn 4 is cache-first and non-interactive by default
22
- // in non-TTY contexts, so no flags are needed
21
+ // Yarn 4 is cache-first and non-interactive by default in non-TTY
22
+ // contexts, so plain `yarn install` is all we need.
23
23
  await execa.execa('yarn', ['install'], {
24
24
  cwd: paths.consumerDir,
25
25
  stdio: 'inherit',
@@ -0,0 +1,27 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+
3
+ var permissions = {
4
+ allow: [
5
+ "Skill(z2h:*)"
6
+ ]
7
+ };
8
+ var hooks = {
9
+ Stop: [
10
+ {
11
+ hooks: [
12
+ {
13
+ type: "command",
14
+ command: "if [ -f .zth/dev.pid ]; then kill $(cat .zth/dev.pid) 2>/dev/null; rm .zth/dev.pid; fi"
15
+ }
16
+ ]
17
+ }
18
+ ]
19
+ };
20
+ const claudeSettings = {
21
+ permissions: permissions,
22
+ hooks: hooks
23
+ };
24
+
25
+ exports.default = claudeSettings;
26
+ exports.hooks = hooks;
27
+ exports.permissions = permissions;
package/dist/types.d.ts CHANGED
@@ -20,7 +20,6 @@ export interface ShadowPkg {
20
20
  version: string;
21
21
  private: true;
22
22
  scripts: Record<string, string>;
23
- peerDependencies: Record<string, string>;
24
23
  devDependencies: Record<string, string>;
25
24
  }
26
25
  export interface ShadowMetadata {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAA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B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAGD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,aAAa,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=templates.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/templates.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=workspace-templates-shipped.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-templates-shipped.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/workspace-templates-shipped.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=workspace.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/workspace.test.ts"],"names":[],"mappings":""}
@@ -22,6 +22,7 @@ export interface AssetManifestFile {
22
22
  export interface ManifestEntry extends AssetManifestFile {
23
23
  version: number;
24
24
  url: string;
25
+ deployedBy: string;
25
26
  }
26
27
  export type Manifest = Record<string, ManifestEntry>;
27
28
  export declare function readManifest(): Promise<Manifest>;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/util/manifest.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,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AC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAErD,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAQtD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAI1D;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,QAAQ,CAE3F;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrE"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const path = require('node:path');
4
- const fsExtra = require('fs-extra');
5
4
  const promises = require('node:fs/promises');
5
+ const fsExtra = require('fs-extra');
6
6
  const mimeTypes = require('mime-types');
7
7
  const pMap = require('p-map');
8
8
  const clientS3 = require('@aws-sdk/client-s3');
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Substitute `__PLACEHOLDER__` tokens in `content` with values from `vars`.
3
+ * Values are inserted literally — no regex special-char interpretation —
4
+ * which matters for content like `$1` or `&` that could otherwise be
5
+ * captured by `String.prototype.replace`.
6
+ */
7
+ export declare function renderTemplate(content: string, vars: Record<string, string>): string;
8
+ /**
9
+ * Absolute path to the bundled `templates/` directory under `src/`.
10
+ *
11
+ * The CLI's `package.json` `files` array ships `src/` (so `src/templates/`
12
+ * lands in published packages). The build emits `.ts` files to `dist/`,
13
+ * but raw template assets (`.tmpl`, `.md`, `gitignore`, `.json`) live only
14
+ * under `src/templates/`. Resolving here keeps a single source of truth
15
+ * for both:
16
+ * - dev (vitest, tsx) → `<pkg>/src/util/` + ../../src/templates → `<pkg>/src/templates`
17
+ * - published install (dist/util) → `<pkg>/dist/util/` + ../../src/templates → `<pkg>/src/templates`
18
+ */
19
+ export declare function getTemplatesDir(): string;
20
+ export type AppTemplate = 'default' | 'html-embed';
21
+ export declare const APP_TEMPLATES: AppTemplate[];
22
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/util/templates.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAQpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC;AACnD,eAAO,MAAM,aAAa,EAAE,WAAW,EAA8B,CAAC"}
@@ -0,0 +1,45 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ const path = require('node:path');
4
+ const node_url = require('node:url');
5
+
6
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
+ const _interopDefault = e => e && e.__esModule ? e : { default: e };
8
+
9
+ const path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ /**
12
+ * Substitute `__PLACEHOLDER__` tokens in `content` with values from `vars`.
13
+ * Values are inserted literally — no regex special-char interpretation —
14
+ * which matters for content like `$1` or `&` that could otherwise be
15
+ * captured by `String.prototype.replace`.
16
+ */
17
+ function renderTemplate(content, vars) {
18
+ let out = content;
19
+ for (const [key, value] of Object.entries(vars)) {
20
+ // Use split+join (literal pattern) to avoid regex interpretation of
21
+ // special chars in `value`.
22
+ out = out.split(key).join(value);
23
+ }
24
+ return out;
25
+ }
26
+ /**
27
+ * Absolute path to the bundled `templates/` directory under `src/`.
28
+ *
29
+ * The CLI's `package.json` `files` array ships `src/` (so `src/templates/`
30
+ * lands in published packages). The build emits `.ts` files to `dist/`,
31
+ * but raw template assets (`.tmpl`, `.md`, `gitignore`, `.json`) live only
32
+ * under `src/templates/`. Resolving here keeps a single source of truth
33
+ * for both:
34
+ * - dev (vitest, tsx) → `<pkg>/src/util/` + ../../src/templates → `<pkg>/src/templates`
35
+ * - published install (dist/util) → `<pkg>/dist/util/` + ../../src/templates → `<pkg>/src/templates`
36
+ */
37
+ function getTemplatesDir() {
38
+ const here = path__default.default.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('util/templates.js', document.baseURI).href))));
39
+ return path__default.default.resolve(here, '..', '..', 'src', 'templates');
40
+ }
41
+ const APP_TEMPLATES = ['default', 'html-embed'];
42
+
43
+ exports.APP_TEMPLATES = APP_TEMPLATES;
44
+ exports.getTemplatesDir = getTemplatesDir;
45
+ exports.renderTemplate = renderTemplate;