@hapico/cli 0.0.24 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { isEqual, find, map } from "lodash";
3
+ import { isEqual, find, map, debounce } from "lodash";
4
4
  import { program } from "commander";
5
5
  import axios from "axios";
6
6
  import * as fs from "fs";
@@ -16,6 +16,7 @@ import { exec } from "child_process";
16
16
  import { promisify } from "util";
17
17
  import chalk from "chalk";
18
18
  import pako from "pako";
19
+ import { vibe } from "./tools/vibe";
19
20
 
20
21
  // Promisify exec for async usage
21
22
  const execPromise = promisify(exec);
@@ -117,11 +118,6 @@ interface RoomStateData {
117
118
  [key: string]: any;
118
119
  }
119
120
 
120
- interface WebSocketMessage {
121
- type: string;
122
- state?: RoomStateData;
123
- }
124
-
125
121
  export const tryJSONParse = (str: string): any => {
126
122
  try {
127
123
  return JSON.parse(str);
@@ -475,7 +471,7 @@ class RoomState {
475
471
  }
476
472
  }
477
473
 
478
- program.version("0.0.24").description("Hapico CLI for project management");
474
+ program.version("0.0.27").description("Hapico CLI for project management");
479
475
 
480
476
  program
481
477
  .command("clone <id>")
@@ -614,6 +610,14 @@ program
614
610
  }
615
611
  });
616
612
 
613
+ program
614
+ .command("vibe")
615
+ .description("Refactor code using AI")
616
+ .action(async () => {
617
+ const targetPath = process.cwd();
618
+ await vibe(targetPath);
619
+ });
620
+
617
621
  program
618
622
  .command("dev")
619
623
  .description("Start the project in development mode")
@@ -729,6 +733,11 @@ program
729
733
 
730
734
  room.updateState("view", filteredFiles);
731
735
 
736
+ // Debounce the state update to avoid overwhelming the server while typing/saving
737
+ const debouncedUpdate = debounce((updatedFiles: FileContent[]) => {
738
+ room.updateState("view", updatedFiles);
739
+ }, 200);
740
+
732
741
  fileManager.setOnFileChange((filePath, content) => {
733
742
  const es5 = compileES5(content, filePath) ?? "";
734
743
  console.log(
@@ -741,7 +750,7 @@ program
741
750
  return file;
742
751
  });
743
752
  room.files = updatedFiles;
744
- room.updateState("view", updatedFiles);
753
+ debouncedUpdate(updatedFiles);
745
754
  });
746
755
 
747
756
  // Fetch project info
@@ -774,9 +783,8 @@ program
774
783
  const projectType = project.data.type || "view";
775
784
  const zversion = options.zversion;
776
785
 
777
- if (projectType === "expo_app") {
778
- const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba`;
779
- //exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/8cd11ab9-b6db-4924-9f7a-5e449f027bba?sessionKey=eyJpZCI6IjU1NF8xIiwidmlld0lkIjo1NTR9&mode=development
786
+ if (projectType === "expo_app" || projectType === "emg_edu_lesson") {
787
+ const BASE_EXPO_LINK = `exp://u.expo.dev/e362c6df-abe8-4503-8723-1362f015d167/group/abdb7abf-bcf7-4f39-a527-dc4d277b74c0`;
780
788
  const link = `${BASE_EXPO_LINK}?sessionKey=${projectId}&mode=development`;
781
789
  QRCode.generate(link, { small: true }, (qrcode) => {
782
790
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hapico/cli",
3
- "version": "0.0.24",
3
+ "version": "0.0.27",
4
4
  "description": "A simple CLI tool for project management",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -23,6 +23,7 @@
23
23
  "@babel/standalone": "^7.28.2",
24
24
  "axios": "^1.11.0",
25
25
  "commander": "^14.0.0",
26
+ "express": "^5.2.1",
26
27
  "inquirer": "^12.9.6",
27
28
  "lodash": "^4.17.21",
28
29
  "open": "^10.2.0",
@@ -37,6 +38,7 @@
37
38
  "devDependencies": {
38
39
  "@types/babel__standalone": "^7.1.9",
39
40
  "@types/commander": "^2.12.5",
41
+ "@types/express": "^5.0.6",
40
42
  "@types/lodash": "^4.17.20",
41
43
  "@types/node": "^24.1.0",
42
44
  "@types/pako": "^2.0.4",