invos 2.0.3 → 2.0.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/bin/invos.js CHANGED
@@ -79,6 +79,6 @@ async function main() {
79
79
  }
80
80
 
81
81
  main().catch(e => {
82
- console.error(e.message || e);
82
+ console.error(e.stack || e.message || e);
83
83
  process.exit(1);
84
84
  });
package/kit/INVOS.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.3",
2
+ "version": "2.0.4",
3
3
  "manifest": "OPEN_SOURCE",
4
4
  "product": {
5
5
  "name": "invos",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "invos",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "INVOS — OS do negócio em arquivos. Open-source. CLI: init, install, update, doctor.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,7 +45,7 @@ export async function doctor(kit, kitRoot, targetDir, args) {
45
45
  existsSync(resolve(skillsDir, e, 'SKILL.md')),
46
46
  ).length;
47
47
  r.push(` ✓ skills: ${n}`);
48
- if (n < 5) ok = false;
48
+ if (n < 1) ok = false;
49
49
  } else {
50
50
  r.push(' ✗ .agents/skills');
51
51
  ok = false;
@@ -58,7 +58,7 @@ export async function doctor(kit, kitRoot, targetDir, args) {
58
58
  ok = false;
59
59
  }
60
60
 
61
- if (fix) {
61
+ if (fix && !ok) {
62
62
  const confirmed = await askFix(!ok);
63
63
  if (!confirmed) {
64
64
  r.push(' --fix: skipped (not confirmed)');
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
3
  import {
4
- collectFiles, copyFileWithDirs, shouldCopyOnInstall, isDevPath,
4
+ collectFiles, copyFileWithDirs, isDevPath,
5
5
  } from '../utils.js';
6
6
  import { buildLock, readLock, writeLock } from '../lock.js';
7
7
  import { syncClaudeSymlinks } from '../symlinks.js';
@@ -13,16 +13,15 @@ export async function install(kit, kitRoot, targetDir) {
13
13
 
14
14
  for (const f of files) {
15
15
  const dest = resolve(targetDir, f.relPath);
16
- if (shouldCopyOnInstall(dest) && !existsSync(dest)) {
17
- copyFileWithDirs(f.fullPath, dest);
18
- copied++;
19
- } else if (existsSync(dest) && !shouldCopyOnInstall(dest)) {
20
- skipped++;
21
- } else if (existsSync(dest)) {
22
- skipped++;
16
+ if (!existsSync(dest)) {
17
+ try {
18
+ copyFileWithDirs(f.fullPath, dest);
19
+ copied++;
20
+ } catch (err) {
21
+ console.error('install: failed to copy', f.relPath, err.message);
22
+ }
23
23
  } else {
24
- copyFileWithDirs(f.fullPath, dest);
25
- copied++;
24
+ skipped++;
26
25
  }
27
26
  }
28
27
 
package/src/symlinks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  existsSync, mkdirSync, symlinkSync, unlinkSync, readlinkSync,
3
- readdirSync, statSync,
3
+ readdirSync, statSync, copyFileSync, cpSync,
4
4
  } from 'node:fs';
5
5
  import { resolve, dirname } from 'node:path';
6
6
 
@@ -27,15 +27,43 @@ export function syncClaudeSymlinks(_kitRoot, targetRoot) {
27
27
 
28
28
  for (const skill of listSkills(agentsDir)) {
29
29
  const linkPath = resolve(claudeDir, skill);
30
+ const expectedTarget = resolve(agentsDir, skill);
30
31
  if (existsSync(linkPath)) {
31
32
  try {
32
- if (readlinkSync(linkPath) === `${REL}/${skill}`) continue;
33
+ const currentTarget = resolve(dirname(linkPath), readlinkSync(linkPath));
34
+ if (resolve(currentTarget) === resolve(expectedTarget)) continue;
33
35
  unlinkSync(linkPath);
34
36
  } catch (err) {
35
37
  console.error('syncClaudeSymlinks: failed to update', skill, err.message);
36
38
  }
37
39
  }
38
- symlinkSync(`${REL}/${skill}`, linkPath);
40
+ try {
41
+ symlinkSync(`${REL}/${skill}`, linkPath);
42
+ } catch (err) {
43
+ if (err.code === 'EPERM') {
44
+ console.warn('syncClaudeSymlinks: symlink failed for', skill, '(EPERM), falling back to copy');
45
+ cpSync(resolve(agentsDir, skill), linkPath, { recursive: true });
46
+ } else {
47
+ throw err;
48
+ }
49
+ }
50
+ }
51
+
52
+ if (existsSync(claudeDir)) {
53
+ for (const entry of readdirSync(claudeDir)) {
54
+ const linkPath = resolve(claudeDir, entry);
55
+ try {
56
+ const stat = statSync(linkPath);
57
+ if (stat.isSymbolicLink()) {
58
+ const target = resolve(dirname(linkPath), readlinkSync(linkPath));
59
+ if (!existsSync(target)) {
60
+ unlinkSync(linkPath);
61
+ }
62
+ }
63
+ } catch {
64
+ // ignore read errors
65
+ }
66
+ }
39
67
  }
40
68
  }
41
69
 
package/src/utils.js CHANGED
@@ -16,7 +16,7 @@ function skipDot(name) {
16
16
  export function isDenylisted(relPath) {
17
17
  const p = relPath.split('/');
18
18
  if (p[0] === '.git' || p[0] === 'node_modules' || p[0] === 'packages') return true;
19
- if (p[0] === 'INVOS-LOCK.json' || p[0] === '.env' || p[0] === '.claude') return true;
19
+ if (p[0] === 'INVOS-LOCK.json' || p[0] === '.env' || p[0] === '.env.example' || p[0] === '.claude') return true;
20
20
  if (p[0] === '_memoria' || p[0] === 'memoria') return true;
21
21
  if (p[0] === 'clientes') return true;
22
22
  if (p[0] === 'conteudo') return true;