nstantpage-agent 0.8.2 → 0.8.4

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/dist/agentSync.js CHANGED
@@ -43,7 +43,7 @@ const TEMPLATE_SCAFFOLD_FILES = new Set([
43
43
  ]);
44
44
  function shouldSkip(name, isDir) {
45
45
  if (isDir)
46
- return SKIP_DIRS.has(name);
46
+ return SKIP_DIRS.has(name) || name.startsWith('.');
47
47
  if (SKIP_FILES.has(name))
48
48
  return true;
49
49
  if (name.startsWith('.'))
@@ -110,7 +110,7 @@ export class AgentSync {
110
110
  if (!filename || selfWriting)
111
111
  return;
112
112
  const parts = filename.split(path.sep);
113
- if (parts.some(p => SKIP_DIRS.has(p)))
113
+ if (parts.some(p => SKIP_DIRS.has(p) || (p.startsWith('.') && p !== '.')))
114
114
  return;
115
115
  const basename = path.basename(filename);
116
116
  if (shouldSkip(basename, false))
@@ -278,9 +278,9 @@ export class AgentSync {
278
278
  continue;
279
279
  if (SKIP_EXTENSIONS.has(ext))
280
280
  continue;
281
- // Match disk scan: skip files inside SKIP_DIRS directories
281
+ // Match disk scan: skip files inside SKIP_DIRS or dotfile directories
282
282
  const parts = filePath.split('/');
283
- if (parts.some(p => SKIP_DIRS.has(p)))
283
+ if (parts.some(p => SKIP_DIRS.has(p) || (p.startsWith('.') && p !== '.')))
284
284
  continue;
285
285
  // Match disk scan: skip dist/ and build/ top-level paths
286
286
  if (filePath.startsWith('dist/') || filePath.startsWith('build/'))
@@ -457,7 +457,9 @@ export class AgentSync {
457
457
  const deleted = [];
458
458
  if (!backendResult)
459
459
  return { modified, added, deleted };
460
- for (const [filePath, backendSha] of backendResult.checksums) {
460
+ // Use filtered backend checksums so dotfile dirs (.angular etc) and skip patterns are excluded
461
+ const filteredBackend = this.filterBackendChecksums(backendResult.checksums);
462
+ for (const [filePath, backendSha] of filteredBackend) {
461
463
  const diskSha = diskData.checksums.get(filePath);
462
464
  if (!diskSha) {
463
465
  deleted.push(filePath);
@@ -469,7 +471,7 @@ export class AgentSync {
469
471
  }
470
472
  }
471
473
  for (const [filePath] of diskData.checksums) {
472
- if (!backendResult.checksums.has(filePath) && isUserCreatedFile(filePath)) {
474
+ if (!filteredBackend.has(filePath) && isUserCreatedFile(filePath)) {
473
475
  if (this.syncedBaselineChecksums) {
474
476
  const baselineSha = this.syncedBaselineChecksums.get(filePath);
475
477
  if (baselineSha && baselineSha === diskData.checksums.get(filePath)) {
@@ -19,6 +19,7 @@ const SKIP_DIRS = new Set([
19
19
  'node_modules', 'dist', '.git', '.vite-cache', '.next',
20
20
  '__pycache__', '.turbo', '.cache', 'build', 'out',
21
21
  '.svelte-kit', '.nuxt', '.output', '.vercel',
22
+ '.angular', '.parcel-cache', '.rollup.cache',
22
23
  ]);
23
24
  const SKIP_FILES = new Set([
24
25
  '.DS_Store', 'Thumbs.db', '.env.local',
@@ -173,7 +174,28 @@ export async function syncCommand(directory, options) {
173
174
  console.log(chalk.red(` ✗ ${err.message}`));
174
175
  process.exit(1);
175
176
  }
176
- // 4. Push all files to DB
177
+ // 4. Create new version and clear old files (clean sync)
178
+ console.log(chalk.gray(' Creating new version (clearing old files)...'));
179
+ try {
180
+ const syncRes = await fetch(`${backendUrl}/api/projects/${projectId}/sync`, {
181
+ method: 'POST',
182
+ headers: {
183
+ 'Authorization': `Bearer ${token}`,
184
+ 'Content-Type': 'application/json',
185
+ },
186
+ });
187
+ if (!syncRes.ok) {
188
+ const text = await syncRes.text().catch(() => '');
189
+ throw new Error(`Sync init failed (${syncRes.status}): ${text}`);
190
+ }
191
+ const syncData = await syncRes.json();
192
+ console.log(chalk.green(` ✓ Version ${syncData.versionNumber} created (old files cleared)`));
193
+ }
194
+ catch (err) {
195
+ console.log(chalk.red(` ✗ ${err.message}`));
196
+ process.exit(1);
197
+ }
198
+ // 5. Push all files to DB
177
199
  console.log(chalk.gray(` Pushing ${files.length} files to database...`));
178
200
  // Push in batches of 100 to avoid huge payloads
179
201
  const BATCH_SIZE = 100;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nstantpage-agent",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Local development agent for nstantpage.com — run your projects locally, preview in the cloud. Replaces cloud containers for faster builds.",
5
5
  "type": "module",
6
6
  "bin": {