codeam-cli 1.2.2 → 1.3.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 (2) hide show
  1. package/dist/index.js +51 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24,6 +24,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/commands/start.ts
27
+ var fs3 = __toESM(require("fs"));
28
+ var os4 = __toESM(require("os"));
29
+ var path3 = __toESM(require("path"));
30
+ var import_crypto = require("crypto");
27
31
  var import_picocolors2 = __toESM(require("picocolors"));
28
32
 
29
33
  // src/config.ts
@@ -110,7 +114,7 @@ var import_picocolors = __toESM(require("picocolors"));
110
114
  // package.json
111
115
  var package_default = {
112
116
  name: "codeam-cli",
113
- version: "1.2.2",
117
+ version: "1.3.0",
114
118
  description: "Remote control Claude Code from your mobile device",
115
119
  main: "dist/index.js",
116
120
  bin: {
@@ -1052,6 +1056,14 @@ var OutputService = class _OutputService {
1052
1056
  };
1053
1057
 
1054
1058
  // src/commands/start.ts
1059
+ function saveFilesTemp(files) {
1060
+ return files.filter(({ base64 }) => base64 && base64.length > 0).map(({ filename, base64 }) => {
1061
+ const safeName = filename.replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 80);
1062
+ const tmpPath = path3.join(os4.tmpdir(), `codeam-${(0, import_crypto.randomUUID)()}-${safeName}`);
1063
+ fs3.writeFileSync(tmpPath, Buffer.from(base64, "base64"));
1064
+ return tmpPath;
1065
+ });
1066
+ }
1055
1067
  async function start() {
1056
1068
  showIntro();
1057
1069
  const session = getActiveSession();
@@ -1074,7 +1086,25 @@ async function start() {
1074
1086
  switch (cmd.type) {
1075
1087
  case "start_task": {
1076
1088
  const prompt = cmd.payload.prompt;
1077
- if (prompt) sendPrompt(prompt);
1089
+ const files = cmd.payload.files;
1090
+ const effectivePrompt = prompt ?? "";
1091
+ if (files && files.length > 0) {
1092
+ const paths = saveFilesTemp(files);
1093
+ const atRefs = paths.map((p2) => `@${p2}`).join("\n");
1094
+ outputSvc.newTurn();
1095
+ claude.sendCommand(`${atRefs}
1096
+ ${effectivePrompt}`);
1097
+ setTimeout(() => {
1098
+ for (const p2 of paths) {
1099
+ try {
1100
+ fs3.unlinkSync(p2);
1101
+ } catch {
1102
+ }
1103
+ }
1104
+ }, 12e4);
1105
+ } else if (effectivePrompt) {
1106
+ sendPrompt(effectivePrompt);
1107
+ }
1078
1108
  break;
1079
1109
  }
1080
1110
  case "provide_input": {
@@ -1104,7 +1134,25 @@ async function start() {
1104
1134
  const inner = payload.payload ?? {};
1105
1135
  if (cmdType === "start_task") {
1106
1136
  const prompt = inner.prompt;
1107
- if (prompt) sendPrompt(prompt);
1137
+ const files = inner.files;
1138
+ const effectivePrompt = prompt ?? "";
1139
+ if (files && files.length > 0) {
1140
+ const paths = saveFilesTemp(files);
1141
+ const atRefs = paths.map((p2) => `@${p2}`).join("\n");
1142
+ outputSvc.newTurn();
1143
+ claude.sendCommand(`${atRefs}
1144
+ ${effectivePrompt}`);
1145
+ setTimeout(() => {
1146
+ for (const p2 of paths) {
1147
+ try {
1148
+ fs3.unlinkSync(p2);
1149
+ } catch {
1150
+ }
1151
+ }
1152
+ }, 12e4);
1153
+ } else if (effectivePrompt) {
1154
+ sendPrompt(effectivePrompt);
1155
+ }
1108
1156
  } else if (cmdType === "provide_input") {
1109
1157
  const input = inner.input;
1110
1158
  if (input) sendPrompt(input);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Remote control Claude Code from your mobile device",
5
5
  "main": "dist/index.js",
6
6
  "bin": {