lowdefy 5.6.0 → 6.0.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 (41) hide show
  1. package/dist/commands/agentSetup/agentSetup.js +85 -0
  2. package/dist/commands/agentSetup/agentsMd.js +59 -0
  3. package/dist/commands/agentSetup/buildMcpServerEntry.js +21 -0
  4. package/dist/commands/agentSetup/findProjectRoot.js +39 -0
  5. package/dist/commands/agentSetup/getDevCommand.js +50 -0
  6. package/dist/commands/agentSetup/skillMd.js +48 -0
  7. package/dist/commands/agentSetup/upsertAgentsMdSection.js +63 -0
  8. package/dist/commands/agentSetup/upsertClaudeSettings.js +56 -0
  9. package/dist/commands/agentSetup/upsertMcpServer.js +83 -0
  10. package/dist/commands/agentSetup/writeSkillFile.js +32 -0
  11. package/dist/commands/build/build.js +3 -3
  12. package/dist/commands/dev/dev.js +13 -8
  13. package/dist/commands/dev/resolveMockUser.js +37 -0
  14. package/dist/commands/dev/runDevServer.js +17 -11
  15. package/dist/commands/dockerOutput/dockerOutput.js +99 -0
  16. package/dist/commands/emails/emails.js +84 -0
  17. package/dist/commands/emails/generateEmailShims.js +94 -0
  18. package/dist/commands/emails/installReactEmail.js +53 -0
  19. package/dist/commands/emails/readNotificationArtifacts.js +37 -0
  20. package/dist/commands/emails/runEmailPreview.js +47 -0
  21. package/dist/commands/emails/warnMissingDataKeys.js +45 -0
  22. package/dist/commands/init-docker/Dockerfile +37 -19
  23. package/dist/commands/init-docker/dockerignore +8 -0
  24. package/dist/commands/init-docker/initDocker.js +3 -1
  25. package/dist/commands/init-vercel/README.md +94 -20
  26. package/dist/commands/init-vercel/initVercel.js +12 -2
  27. package/dist/commands/init-vercel/vercel.build.sh +8 -0
  28. package/dist/commands/init-vercel/vercel.install.sh +4 -2
  29. package/dist/commands/init-vercel/vercel.json +5 -0
  30. package/dist/commands/start/runStart.js +1 -2
  31. package/dist/commands/vercelOutput/apiHandler.js +83 -0
  32. package/dist/commands/vercelOutput/vercelOutput.js +138 -0
  33. package/dist/program.js +24 -2
  34. package/dist/utils/checkPortAvailable.js +9 -16
  35. package/dist/utils/copyTracedFiles.js +94 -0
  36. package/dist/utils/findTraceBase.js +45 -0
  37. package/dist/utils/getDirectories.js +2 -1
  38. package/dist/utils/getOptions.js +2 -0
  39. package/dist/utils/installServer.js +31 -23
  40. package/dist/utils/{runNextBuild.js → runClientBuild.js} +11 -14
  41. package/package.json +14 -13
@@ -0,0 +1,45 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import fs from 'fs';
16
+ import path from 'path';
17
+ // The base directory for @vercel/nft tracing. nft ignores files above the base, and when the server
18
+ // directory is a pnpm workspace member the real dependency files live in the workspace root's
19
+ // node_modules/.pnpm virtual store (the server's node_modules entries are relative symlinks pointing
20
+ // up and out of the server directory). The base must therefore sit at or above the workspace root.
21
+ // A higher base is always safe — it only lengthens the relative paths inside the function.
22
+ function findTraceBase({ serverDirectory }) {
23
+ let directory = serverDirectory;
24
+ for(;;){
25
+ if (fs.existsSync(path.join(directory, 'pnpm-workspace.yaml'))) {
26
+ return directory;
27
+ }
28
+ const parent = path.dirname(directory);
29
+ if (parent === directory) break;
30
+ directory = parent;
31
+ }
32
+ // No workspace root found — fall back to the repository root so workspace-like layouts without
33
+ // pnpm-workspace.yaml still trace, else the server directory itself (standalone install).
34
+ directory = serverDirectory;
35
+ for(;;){
36
+ if (fs.existsSync(path.join(directory, '.git'))) {
37
+ return directory;
38
+ }
39
+ const parent = path.dirname(directory);
40
+ if (parent === directory) break;
41
+ directory = parent;
42
+ }
43
+ return serverDirectory;
44
+ }
45
+ export default findTraceBase;
@@ -22,7 +22,8 @@ function getDirectories({ configDirectory, options }) {
22
22
  config: configDirectory,
23
23
  build: path.join(server, 'build'),
24
24
  server,
25
- dev: options.devDirectory ? path.resolve(options.devDirectory) : path.join(dotLowdefy, 'dev')
25
+ dev: options.devDirectory ? path.resolve(options.devDirectory) : path.join(dotLowdefy, 'dev'),
26
+ emails: path.join(dotLowdefy, 'emails')
26
27
  };
27
28
  }
28
29
  export default getDirectories;
@@ -19,6 +19,8 @@
19
19
  ...cliConfig,
20
20
  ...commandLineOptions
21
21
  };
22
+ // commander parses --port as a string; port comparisons expect a number.
23
+ options.port = Number(options.port);
22
24
  return options;
23
25
  }
24
26
  export default getOptions;
@@ -12,31 +12,39 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import { spawnProcess } from '@lowdefy/node-utils';
15
+ */ import { installIfPackageJsonChanged, spawnProcess } from '@lowdefy/node-utils';
16
16
  async function installServer({ context, directory }) {
17
- context.logger.info({
18
- spin: 'start'
19
- }, 'Installing dependencies.');
20
- try {
21
- await spawnProcess({
22
- command: context.pnpmCmd,
23
- args: [
24
- 'install',
25
- '--no-frozen-lockfile'
26
- ],
27
- stdOutLineHandler: (line)=>context.logger.debug(line),
28
- processOptions: {
29
- cwd: directory,
30
- // https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2#command-injection-via-args-parameter-of-child_processspawn-without-shell-option-enabled-on-windows-cve-2024-27980---high
31
- shell: process.platform === 'win32'
17
+ const installed = await installIfPackageJsonChanged({
18
+ directory,
19
+ install: async ()=>{
20
+ context.logger.info({
21
+ spin: 'start'
22
+ }, 'Installing dependencies.');
23
+ try {
24
+ await spawnProcess({
25
+ command: context.pnpmCmd,
26
+ args: [
27
+ 'install',
28
+ '--no-frozen-lockfile'
29
+ ],
30
+ stdOutLineHandler: (line)=>context.logger.debug(line),
31
+ processOptions: {
32
+ cwd: directory,
33
+ // https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2#command-injection-via-args-parameter-of-child_processspawn-without-shell-option-enabled-on-windows-cve-2024-27980---high
34
+ shell: process.platform === 'win32'
35
+ }
36
+ });
37
+ } catch (error) {
38
+ context.logger.info({
39
+ spin: 'fail'
40
+ }, 'Installing dependencies.');
41
+ throw new Error('Dependency installation failed.');
32
42
  }
33
- });
34
- } catch (error) {
35
- context.logger.info({
36
- spin: 'fail'
37
- }, 'Installing dependencies.');
38
- throw new Error('Dependency installation failed.');
43
+ context.logger.info('Dependencies install successfully.');
44
+ }
45
+ });
46
+ if (!installed) {
47
+ context.logger.info('Dependencies unchanged.');
39
48
  }
40
- context.logger.info('Dependencies install successfully.');
41
49
  }
42
50
  export default installServer;
@@ -15,25 +15,25 @@
15
15
  */ import { spawnProcess } from '@lowdefy/node-utils';
16
16
  function createStdOutLineHandler({ context }) {
17
17
  function stdOutLineHandler(line) {
18
- // Matches next build output of form: ┌ λ / 261 B 403 kB
19
- const match = line.match(/┌ λ \/\s*\d* [a-zA-Z]*\s*(\d* [a-zA-Z]*)/u);
18
+ // Matches vite build output of form: dist/client/assets/main-XXXX.js 5,205.62 kB │ gzip: 1,544.04 kB
19
+ const match = line.match(/assets\/main-[\w-]+\.js\s+[\d,.]+ kB │ gzip:\s+([\d,.]+ kB)/u);
20
20
  if (match) {
21
- context.logger.info(`Home page first load JS size: ${match[1]}.`);
21
+ context.logger.info(`Client bundle size (gzip): ${match[1]}.`);
22
22
  }
23
23
  context.logger.debug(line);
24
24
  }
25
25
  return stdOutLineHandler;
26
26
  }
27
- async function runNextBuild({ context, directory }) {
27
+ async function runClientBuild({ context, directory }) {
28
28
  context.logger.info({
29
29
  spin: 'start'
30
- }, 'Running Next build.');
30
+ }, 'Running client build.');
31
31
  try {
32
32
  await spawnProcess({
33
33
  command: context.pnpmCmd,
34
34
  args: [
35
35
  'run',
36
- 'build:next'
36
+ 'build:client'
37
37
  ],
38
38
  stdOutLineHandler: createStdOutLineHandler({
39
39
  context
@@ -42,18 +42,15 @@ async function runNextBuild({ context, directory }) {
42
42
  // https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2#command-injection-via-args-parameter-of-child_processspawn-without-shell-option-enabled-on-windows-cve-2024-27980---high
43
43
  shell: process.platform === 'win32',
44
44
  cwd: directory,
45
- env: {
46
- ...process.env,
47
- NEXT_TELEMETRY_DISABLED: context.options.disableTelemetry ? '1' : undefined
48
- }
45
+ env: process.env
49
46
  }
50
47
  });
51
48
  } catch (error) {
52
49
  context.logger.info({
53
50
  spin: 'fail'
54
- }, 'Running Next build.');
55
- throw new Error('Next build failed.');
51
+ }, 'Running client build.');
52
+ throw new Error('Client build failed.');
56
53
  }
57
- context.logger.info('Next build successful.');
54
+ context.logger.info('Client build successful.');
58
55
  }
59
- export default runNextBuild;
56
+ export default runClientBuild;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lowdefy",
3
- "version": "5.6.0",
3
+ "version": "6.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy CLI",
6
6
  "homepage": "https://lowdefy.com",
@@ -32,28 +32,29 @@
32
32
  ],
33
33
  "exports": "./dist/index.js",
34
34
  "dependencies": {
35
- "@lowdefy/errors": "5.6.0",
36
- "@lowdefy/helpers": "5.6.0",
37
- "@lowdefy/logger": "5.6.0",
38
- "@lowdefy/node-utils": "5.6.0",
39
- "axios": "1.8.2",
40
- "commander": "11.1.0",
35
+ "@lowdefy/errors": "6.0.0",
36
+ "@lowdefy/helpers": "6.0.0",
37
+ "@lowdefy/logger": "6.0.0",
38
+ "@lowdefy/node-utils": "6.0.0",
39
+ "@vercel/nft": "1.10.2",
40
+ "axios": "1.15.2",
41
+ "commander": "14.0.3",
41
42
  "decompress": "4.2.1",
42
43
  "decompress-targz": "4.1.1",
43
44
  "dotenv": "16.3.1",
44
- "semver": "7.5.4",
45
- "uuid": "9.0.1",
46
- "yaml": "2.3.4"
45
+ "semver": "7.7.4",
46
+ "uuid": "14.0.0",
47
+ "yaml": "2.9.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@jest/globals": "28.1.3",
50
- "@swc/cli": "0.8.0",
51
- "@swc/core": "1.15.18",
51
+ "@swc/cli": "0.8.1",
52
+ "@swc/core": "1.15.32",
52
53
  "@swc/jest": "0.2.39",
53
54
  "jest": "28.1.3"
54
55
  },
55
56
  "engines": {
56
- "node": ">=18"
57
+ "node": ">=22"
57
58
  },
58
59
  "publishConfig": {
59
60
  "access": "public"