@openturtle/cli 0.3.4 → 0.3.5

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.
@@ -42,7 +42,14 @@ export function createCollaborationCommands(client = new ApiClient()) {
42
42
  ? client.get(`/api/projects/${encodeURIComponent(projectId)}/members`).catch(() => null)
43
43
  : Promise.resolve(null),
44
44
  ]);
45
- return { team, profile, roster_profile: rosterProfile, project_id: projectId || null, members, project_members: projectMembers };
45
+ return {
46
+ team,
47
+ profile,
48
+ roster_profile: rosterProfile,
49
+ project_id: projectId || null,
50
+ members,
51
+ project_members: projectMembers,
52
+ };
46
53
  },
47
54
  async getWorkSummary(options) {
48
55
  const limit = Number(options.limit) || 20;
@@ -143,12 +143,41 @@ async function refreshedAsset(asset) {
143
143
  return { ...asset, syncState: 'missing' };
144
144
  const changed = stat.size !== asset.sizeBytes || stat.mtimeMs !== asset.modifiedAt;
145
145
  const contentHash = changed ? await fileHash(asset.path) : asset.contentHash;
146
- const refreshed = {
146
+ let refreshed = {
147
147
  ...asset,
148
148
  sizeBytes: stat.size,
149
149
  modifiedAt: stat.mtimeMs,
150
150
  contentHash,
151
151
  };
152
+ if (asset.entry) {
153
+ const attachments = await Promise.all(asset.entry.attachments.map(async (attachment) => {
154
+ try {
155
+ const attachmentStat = await fs.promises.stat(attachment.path);
156
+ if (!attachmentStat.isFile())
157
+ return null;
158
+ const attachmentChanged = attachmentStat.size !== attachment.sizeBytes || attachmentStat.mtimeMs !== attachment.modifiedAt;
159
+ return {
160
+ ...attachment,
161
+ sizeBytes: attachmentStat.size,
162
+ modifiedAt: attachmentStat.mtimeMs,
163
+ contentHash: attachmentChanged ? await fileHash(attachment.path) : attachment.contentHash,
164
+ };
165
+ }
166
+ catch {
167
+ return null;
168
+ }
169
+ }));
170
+ if (attachments.some((attachment) => attachment === null)) {
171
+ return { ...refreshed, syncState: 'missing' };
172
+ }
173
+ refreshed = {
174
+ ...refreshed,
175
+ entry: {
176
+ ...asset.entry,
177
+ attachments: attachments,
178
+ },
179
+ };
180
+ }
152
181
  const syncState = asset.entry
153
182
  ? asset.cloudMemoryId && asset.cloudEntryHash === entryHash(refreshed)
154
183
  ? 'synced'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openturtle/cli",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "OpenTurtle collaboration, knowledge, meeting, and agent CLI",
5
5
  "keywords": [
6
6
  "openturtle",