@fmatar/archlens-skill 1.1.1-dev.63 → 1.1.1

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/README.md CHANGED
@@ -15,21 +15,21 @@ Analyzes any project repository, detects programming languages and package hiera
15
15
  ### Option A: Zero-Touch Autonomous AI Setup (`--mcp` — Recommended for Antigravity & Claude)
16
16
  Equip **Google Antigravity**, **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, and **Gemini CLI** in one command. Once configured, your AI assistant **automatically starts or resurrects Archlens on demand** whenever an architectural MCP tool is invoked—no manual container management required:
17
17
  ```bash
18
- # Scaffold .archlens/policy.json, AGENTS.md/CLAUDE.md, install project skills via npx skills, and auto-configure MCP clients:
19
- npx @fmatar/archlens-skill --yes --skills --mcp
18
+ # Scaffold .archlens/policy.json, AGENTS.md/CLAUDE.md, and auto-configure all installed AI clients:
19
+ npx @fmatar/archlens-skill --yes --mcp
20
20
 
21
- # Or install skills globally across all detected coding agents via npx skills:
22
- npx @fmatar/archlens-skill skills -g
21
+ # Or also install global skills into ~/.claude/skills and ~/.gemini/config/skills:
22
+ npx @fmatar/archlens-skill --global --mcp
23
23
  ```
24
24
 
25
- ### Option B: Install AI Assistant Skills Directly via `npx skills`
25
+ ### Option B: Install AI Assistant Skills via Open Skills Standard
26
26
  Using the open [Vercel Labs Skills](https://github.com/vercel-labs/skills) standard, you can add Archlens capabilities across 15+ AI coding assistants (Claude Code, Cursor, Antigravity, Copilot, Codex, Windsurf, Zed):
27
27
  ```bash
28
- # Add all 3 Archlens skills to detected AI assistants in project or globally:
29
- npx skills add fmatar/archlens --all -y
28
+ # Add to all detected AI assistants in project or globally:
29
+ npx skills add fmatar/archlens
30
30
 
31
31
  # Or add to a specific assistant:
32
- npx skills add fmatar/archlens --all --agent claude-code -y
32
+ npx skills add fmatar/archlens --agent claude-code
33
33
  ```
34
34
 
35
35
  ### Option C: Run Interactive Policy Scaffolder via NPX
package/bin/index.js CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  import * as path from 'node:path';
10
10
  import * as fs from 'node:fs';
11
- import { fileURLToPath, pathToFileURL } from 'node:url';
11
+ import { fileURLToPath } from 'node:url';
12
12
 
13
13
  import * as ui from '../src/ui.js';
14
14
  import {
@@ -17,7 +17,7 @@ import {
17
17
  findCommonPackagePrefix,
18
18
  generateLlmPrompt
19
19
  } from '../src/analyzer.js';
20
- import { installLocalPolicy, installLocalSkills, installGlobalSkills } from '../src/installer.js';
20
+ import { installLocalPolicy, installGlobalSkills } from '../src/installer.js';
21
21
  import { updateLocalPolicy, updateGlobalSkills } from '../src/updater.js';
22
22
  import { upgradeProject } from '../src/upgrader.js';
23
23
  import {
@@ -60,7 +60,6 @@ ${ui.colors.bold}COMMANDS:${ui.colors.reset}
60
60
  check Audit repository against Clean Architecture policy rules
61
61
  update Update existing policy with newly discovered packages and refresh skills
62
62
  upgrade Upgrade legacy .uml-viewer configuration to .archlens
63
- skills Install Archlens skills via npx skills (local project or -g global)
64
63
  global Install Archlens skills globally for AI coding assistants
65
64
  prompt Export Clean Architecture LLM Refactoring Prompt Dossier
66
65
  mcp Launch Model Context Protocol (MCP) stdio server for AI assistants
@@ -81,8 +80,6 @@ ${ui.colors.bold}OPTIONS:${ui.colors.reset}
81
80
  --jar <PATH> Custom path to Archlens Quarkus runner JAR
82
81
  -o, --open Open visual workbench in default browser upon startup
83
82
  -m, --mcp Auto-configure MCP server manifests in AI clients (Claude, Antigravity, Cursor)
84
- --skills Install Archlens skills into target project via npx skills
85
- --agent <AGENT> Target specific coding agent(s) when installing skills (e.g. claude-code,cursor)
86
83
  -c, --copy Copy LLM prompt output directly to system clipboard
87
84
  -g, --global Install or update skill globally in ~/.claude and ~/.gemini
88
85
  -u, --update Update mode: sync new packages into existing policy
@@ -127,7 +124,7 @@ ${ui.colors.bold}EXAMPLES:${ui.colors.reset}
127
124
  `);
128
125
  }
129
126
 
130
- export function parseArgs(args) {
127
+ function parseArgs(args) {
131
128
  const parsed = {
132
129
  command: null,
133
130
  path: '.',
@@ -140,8 +137,6 @@ export function parseArgs(args) {
140
137
  copy: false,
141
138
  prompt: false,
142
139
  global: false,
143
- skills: false,
144
- agent: null,
145
140
  update: false,
146
141
  upgrade: false,
147
142
  mcp: false,
@@ -175,10 +170,6 @@ export function parseArgs(args) {
175
170
  parsed.port = args[++i] || '8088';
176
171
  } else if (arg === '--mcp' || arg === '-m') {
177
172
  parsed.mcp = true;
178
- } else if (arg === '--skills') {
179
- parsed.skills = true;
180
- } else if (arg === '--agent') {
181
- parsed.agent = args[++i] || null;
182
173
  } else if (arg === '--global' || arg === '-g') {
183
174
  parsed.global = true;
184
175
  } else if (arg === '--update' || arg === '-u') {
@@ -232,7 +223,7 @@ export function parseArgs(args) {
232
223
 
233
224
  if (positional.length > 0) {
234
225
  const cmd = positional[0].toLowerCase();
235
- if (['init', 'start', 'update', 'upgrade', 'skills', 'global', 'prompt', 'mcp', 'check', 'help', 'version'].includes(cmd)) {
226
+ if (['init', 'start', 'update', 'upgrade', 'global', 'prompt', 'mcp', 'check', 'help', 'version'].includes(cmd)) {
236
227
  parsed.command = cmd;
237
228
  } else if (!parsed.title && !parsed.path) {
238
229
  parsed.path = positional[0];
@@ -244,7 +235,6 @@ export function parseArgs(args) {
244
235
  if (parsed.command === 'start') parsed.start = true;
245
236
  if (parsed.command === 'update') parsed.update = true;
246
237
  if (parsed.command === 'upgrade') parsed.upgrade = true;
247
- if (parsed.command === 'skills') parsed.skills = true;
248
238
  if (parsed.command === 'global') parsed.global = true;
249
239
  if (parsed.command === 'prompt') parsed.prompt = true;
250
240
  if (parsed.command === 'check') parsed.check = true;
@@ -253,9 +243,7 @@ export function parseArgs(args) {
253
243
  return parsed;
254
244
  }
255
245
 
256
- async function runInteractive(options, deps = {}) {
257
- const askChoice = deps.askChoice || ui.askChoice;
258
- const askQuestion = deps.askQuestion || ui.askQuestion;
246
+ async function runInteractive(options) {
259
247
  ui.banner();
260
248
 
261
249
  const targetRoot = path.resolve(options.path || '.');
@@ -304,11 +292,12 @@ async function runInteractive(options, deps = {}) {
304
292
  }
305
293
  ];
306
294
 
307
- const selectedAction = await askChoice('Select installation action:', choices);
295
+ const selectedAction = await ui.askChoice('Select installation action:', choices);
308
296
 
309
297
  let customTitle = options.title;
310
298
  if (['init_local', 'both'].includes(selectedAction) && !customTitle) {
311
- customTitle = await askQuestion('Project display title', path.basename(targetRoot));
299
+ const defaultTitle = ui.colors.dim + path.basename(targetRoot) + ui.colors.reset;
300
+ customTitle = await ui.askQuestion('Project display title', path.basename(targetRoot));
312
301
  }
313
302
 
314
303
  const execOptions = {
@@ -358,8 +347,7 @@ function executeMcpInstall(options) {
358
347
 
359
348
  function executeLocalInit(targetRoot, options) {
360
349
  ui.step(1, 2, 'Scaffolding Clean Architecture Policy');
361
- // Orchestration of --mcp and --skills is handled explicitly in main() with UI progress logging
362
- const result = installLocalPolicy(targetRoot, { ...options, mcp: false, skills: false });
350
+ const result = installLocalPolicy(targetRoot, options);
363
351
 
364
352
  if (result.policyCreated) {
365
353
  ui.success(`Created policy file: ${path.relative(targetRoot, result.policyFile)}`);
@@ -389,7 +377,7 @@ function executeGlobalInstall(options) {
389
377
  const result = installGlobalSkills(options);
390
378
 
391
379
  if (result.method === 'skills-cli') {
392
- ui.success(`Installed Archlens skills across AI agents via npx skills${modeSuffix}`);
380
+ ui.success(`Installed Archlens skills across AI agents via vercel-labs/skills CLI${modeSuffix}`);
393
381
  } else if (result.installed.length === 0) {
394
382
  ui.warn('No active AI agent directories found (~/.claude, ~/.gemini). Use --force to deploy anyway.');
395
383
  } else {
@@ -398,21 +386,8 @@ function executeGlobalInstall(options) {
398
386
  }
399
387
  }
400
388
 
401
- console.log(`\n ${ui.colors.dim}💡 Tip: You can also manage Archlens skills directly with npx skills:${ui.colors.reset}`);
402
- console.log(` ${ui.colors.cyan}npx skills add fmatar/archlens --all -y${ui.colors.reset}\n`);
403
- }
404
-
405
- function executeLocalSkillsInstall(targetRoot, options) {
406
- const modeSuffix = options.dryRun ? ' (dry run)' : '';
407
- ui.step(2, 2, `Deploying AI Assistant Skills in Project via npx skills${modeSuffix}`);
408
- const result = installLocalSkills(targetRoot, options);
409
- if (result.method === 'skills-cli') {
410
- ui.success(`Installed Archlens skills in ${targetRoot} via npx skills${modeSuffix}`);
411
- } else {
412
- for (const inst of result.installed) {
413
- ui.success(`Installed skill for ${inst.agent}: ${inst.path}${modeSuffix}`);
414
- }
415
- }
389
+ console.log(`\n ${ui.colors.dim}💡 Tip: You can also manage Archlens skills with the open Skills CLI:${ui.colors.reset}`);
390
+ console.log(` ${ui.colors.cyan}npx skills add fmatar/archlens${ui.colors.reset}\n`);
416
391
  }
417
392
 
418
393
  function executeUpgrade(targetRoot, options) {
@@ -486,29 +461,25 @@ function copyToSystemClipboard(text) {
486
461
  }
487
462
  }
488
463
 
489
- export async function main(rawArgs = process.argv.slice(2), deps = {}) {
490
- const exit = deps.exit || ((code) => process.exit(code));
491
- const mcpStarter = deps.startMcpStdioServer || startMcpStdioServer;
492
- const startExecutor = deps.executeStart || executeStart;
493
- const copyClipboard = deps.copyToSystemClipboard || copyToSystemClipboard;
494
- const options = { ...parseArgs(rawArgs), ...(deps.options || {}) };
464
+ async function main() {
465
+ const options = parseArgs(process.argv.slice(2));
495
466
  const targetRoot = path.resolve(options.path || '.');
496
467
 
497
468
  if (options.help) {
498
469
  printHelp();
499
- return exit(0);
470
+ process.exit(0);
500
471
  }
501
472
 
502
473
  if (options.version) {
503
474
  console.log(getPackageVersion());
504
- return exit(0);
475
+ process.exit(0);
505
476
  }
506
477
 
507
478
  if (options.command === 'prompt' || options.prompt) {
508
479
  try {
509
480
  const dossier = await generateLlmPrompt(targetRoot, options);
510
481
  if (options.copy) {
511
- const ok = copyClipboard(dossier);
482
+ const ok = copyToSystemClipboard(dossier);
512
483
  if (ok) {
513
484
  ui.success('Clean Architecture Refactoring Dossier copied to system clipboard!');
514
485
  } else {
@@ -517,10 +488,10 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
517
488
  } else {
518
489
  process.stdout.write(dossier);
519
490
  }
520
- return exit(0);
491
+ process.exit(0);
521
492
  } catch (err) {
522
493
  ui.error(err.message || String(err));
523
- return exit(1);
494
+ process.exit(1);
524
495
  }
525
496
  }
526
497
 
@@ -532,7 +503,7 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
532
503
  const report = await checkArchitecture(targetRoot, options);
533
504
  if (report.error) {
534
505
  ui.error(report.error);
535
- return exit(1);
506
+ process.exit(1);
536
507
  }
537
508
 
538
509
  let formattedOutput = null;
@@ -565,7 +536,7 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
565
536
  if (!options.output) {
566
537
  process.stdout.write(formattedOutput + '\n');
567
538
  }
568
- return exit(report.passed ? 0 : 1);
539
+ process.exit(report.passed ? 0 : 1);
569
540
  }
570
541
 
571
542
  console.log(`\n ${ui.colors.bold}Architecture Governance Results (${report.projectTitle}):${ui.colors.reset}`);
@@ -621,7 +592,7 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
621
592
  options.detectCycles ? ', 0 package cycles' : ''
622
593
  }${report.screamingThreshold !== null ? `, screaming score ${report.screaming.score.toFixed(2)} >= ${report.screamingThreshold.toFixed(2)}` : ''}${report.fitnessThreshold !== null && !isNaN(report.fitnessThreshold) ? `, fitness ${(report.fitness.fitnessScore * 100).toFixed(0)}% >= ${(report.fitnessThreshold * 100).toFixed(0)}%` : ''}).`
623
594
  );
624
- return exit(0);
595
+ process.exit(0);
625
596
  } else {
626
597
  ui.error(
627
598
  `Clean Architecture Gate FAILED (${report.violationsCount} violation(s), ${
@@ -649,18 +620,18 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
649
620
  console.log(`\n Architectural Fitness Invariant Violation:`);
650
621
  console.log(` Fitness Score ${(report.fitness.fitnessScore * 100).toFixed(0)}% [Grade ${report.fitness.grade}] is below required threshold ${(report.fitnessThreshold * 100).toFixed(0)}%.`);
651
622
  }
652
- return exit(1);
623
+ process.exit(1);
653
624
  }
654
625
  } catch (err) {
655
626
  ui.error(err.message || String(err));
656
- return exit(1);
627
+ process.exit(1);
657
628
  }
658
629
  }
659
630
 
660
631
  if (options.command === 'mcp') {
661
- mcpStarter({
662
- ...options,
663
- version: getPackageVersion()
632
+ startMcpStdioServer({
633
+ version: getPackageVersion(),
634
+ ...options
664
635
  });
665
636
  return;
666
637
  }
@@ -670,7 +641,7 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
670
641
  const port = options.port || '8088';
671
642
  const targetUrl = options.serverUrl || (port === '8088' ? DEFAULT_SERVER_URL : `http://localhost:${port}`);
672
643
  ui.info(`Checking Archlens Workbench server on ${targetUrl}...`);
673
- const status = await startExecutor(options);
644
+ const status = await executeStart(options);
674
645
  if (status.status === 'running') {
675
646
  if (status.spawned) {
676
647
  if (status.mode === 'jar') {
@@ -688,23 +659,22 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
688
659
  console.log(` npx @fmatar/archlens-skill prompt\n`);
689
660
  } else {
690
661
  ui.error(status.message || 'Failed to start Archlens server.');
691
- return exit(1);
662
+ process.exit(1);
692
663
  }
693
- return exit(0);
664
+ process.exit(0);
694
665
  } catch (err) {
695
666
  ui.error(err.message || String(err));
696
- return exit(1);
667
+ process.exit(1);
697
668
  }
698
669
  }
699
670
 
700
- const ttyAvailable = deps.isTTY !== undefined ? Boolean(deps.isTTY) : Boolean(process.stdin.isTTY && process.stdout.isTTY);
701
671
  const isInteractive = Boolean(
702
- ttyAvailable &&
672
+ process.stdin.isTTY &&
673
+ process.stdout.isTTY &&
703
674
  !options.yes &&
704
675
  !options.dryRun &&
705
676
  !options.command &&
706
677
  !options.start &&
707
- !options.skills &&
708
678
  !options.global &&
709
679
  !options.update &&
710
680
  !options.upgrade &&
@@ -714,10 +684,10 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
714
684
 
715
685
  if (isInteractive) {
716
686
  try {
717
- await (deps.runInteractive || ((opts) => runInteractive(opts, deps)))(options);
687
+ await runInteractive(options);
718
688
  } catch (err) {
719
689
  ui.error(err.message || String(err));
720
- return exit(1);
690
+ process.exit(1);
721
691
  }
722
692
  return;
723
693
  }
@@ -728,25 +698,13 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
728
698
  executeUpgrade(targetRoot, options);
729
699
  } else if (options.update) {
730
700
  executeUpdate(targetRoot, options);
731
- } else if (options.command === 'skills' || (options.skills && options.global && !options.yes)) {
732
- if (options.global) {
733
- executeGlobalInstall(options);
734
- } else {
735
- executeLocalSkillsInstall(targetRoot, options);
736
- }
737
701
  } else if (options.global && !options.command) {
738
702
  executeGlobalInstall(options);
739
703
  executeLocalInit(targetRoot, options);
740
- if (options.skills) {
741
- executeLocalSkillsInstall(targetRoot, options);
742
- }
743
704
  } else if (options.global || options.command === 'global') {
744
705
  executeGlobalInstall(options);
745
706
  } else {
746
707
  executeLocalInit(targetRoot, options);
747
- if (options.skills) {
748
- executeLocalSkillsInstall(targetRoot, options);
749
- }
750
708
  }
751
709
 
752
710
  if (options.mcp) {
@@ -758,10 +716,8 @@ export async function main(rawArgs = process.argv.slice(2), deps = {}) {
758
716
  }
759
717
  } catch (err) {
760
718
  ui.error(err.message || String(err));
761
- return exit(1);
719
+ process.exit(1);
762
720
  }
763
721
  }
764
722
 
765
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
766
- main();
767
- }
723
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmatar/archlens-skill",
3
- "version": "1.1.1-dev.63",
3
+ "version": "1.1.1",
4
4
  "description": "Cross-platform CLI and installer for Archlens Clean Architecture governance policies and AI assistant skills",
5
5
  "main": "src/installer.js",
6
6
  "type": "module",
@@ -20,7 +20,6 @@
20
20
  "node": ">=18.0.0"
21
21
  },
22
22
  "scripts": {
23
- "prepack": "node ../scripts/sync-skills.js --if-repo",
24
23
  "test": "node --test test/*.test.js",
25
24
  "start": "node bin/index.js"
26
25
  },
@@ -3,14 +3,9 @@ name: archlens
3
3
  description: >-
4
4
  Polyglot Clean Architecture governance, dynamic visual workbench companion,
5
5
  policy scaffolding, mailbox refactoring protocols, LLM prompt dossiers,
6
- and Model Context Protocol (MCP) diagnostics for Archlens. Use when auditing
7
- layer boundaries, inverting outward dependencies (DIP), or running Archlens.
6
+ and Model Context Protocol (MCP) diagnostics for Archlens.
7
+ version: 1.2.0
8
8
  license: Apache-2.0
9
- compatibility: "Node.js >= 18"
10
- version: 1.1.1-dev.63
11
- metadata:
12
- author: fmatar
13
- version: "1.1.1-dev.63"
14
9
  ---
15
10
 
16
11
  # Archlens — Clean Architecture Governance & Workbench Companion
@@ -58,7 +53,7 @@ Archlens models codebases as concentric circular rings. Source code dependencies
58
53
  Install Archlens across 15+ coding agents (Antigravity, Claude Code, Cursor, Gemini CLI) via `skills.sh`:
59
54
  ```bash
60
55
  # Add Archlens to your active agent skills library:
61
- npx skills add fmatar/archlens --all -y
56
+ npx skills add fmatar/archlens
62
57
  ```
63
58
 
64
59
  Or execute directly on demand via NPX:
@@ -1,15 +1,8 @@
1
1
  ---
2
2
  name: archlens-install-policy
3
- description: >-
4
- Inspects any target codebase, detects programming languages and packages, and
5
- scaffolds an Archlens Clean Architecture policy (.archlens/policy.json) and
6
- agent workbench companion integration. Use when setting up or upgrading Archlens.
3
+ description: Inspects any target codebase, detects programming languages and packages, and scaffolds an Archlens Clean Architecture policy (.archlens/policy.json) and agent workbench companion integration.
4
+ version: 1.1.1
7
5
  license: Apache-2.0
8
- compatibility: "Node.js >= 18"
9
- version: 1.1.1-dev.63
10
- metadata:
11
- author: fmatar
12
- version: "1.1.1-dev.63"
13
6
  ---
14
7
 
15
8
  # Archlens Policy & Companion Installer (`archlens-install-policy`)
@@ -4,12 +4,8 @@ description: >-
4
4
  Companion agent for the Clean Architecture Dynamic UML Workbench.
5
5
  Monitors .archlens/ and .uml-viewer/ mailbox queues, processes architectural refactoring requests,
6
6
  evaluates Clean Architecture violations, runs builds and tests, and signals live diagram reloads.
7
+ version: 1.2.0
7
8
  license: Apache-2.0
8
- compatibility: "Node.js >= 18"
9
- version: 1.1.1-dev.63
10
- metadata:
11
- author: fmatar
12
- version: "1.1.1-dev.63"
13
9
  ---
14
10
 
15
11
  # UML Workbench Companion Skill (`uml-workbench-companion`)
package/src/installer.js CHANGED
@@ -120,11 +120,6 @@ export function installLocalPolicy(projectRoot, options = {}) {
120
120
  mcpResult = installMcpConfigs({ path: root, ...options });
121
121
  }
122
122
 
123
- let skillsResult = null;
124
- if (options.skills) {
125
- skillsResult = installLocalSkills(root, options);
126
- }
127
-
128
123
  return {
129
124
  targetDir: root,
130
125
  archlensDir: targetDir,
@@ -135,91 +130,22 @@ export function installLocalPolicy(projectRoot, options = {}) {
135
130
  policyData,
136
131
  companionFiles: updatedCompanions,
137
132
  mcpResult,
138
- skillsResult,
139
133
  dryRun
140
134
  };
141
135
  }
142
136
 
143
- function parseListOption(val) {
144
- if (!val) return [];
145
- if (Array.isArray(val)) return val.map((v) => String(v).trim()).filter(Boolean);
146
- if (typeof val === 'string') {
147
- return val
148
- .split(',')
149
- .map((v) => v.trim())
150
- .filter(Boolean);
151
- }
152
- return [];
153
- }
154
-
155
- export function buildSkillsCliArgs(options = {}) {
156
- const packageRoot = options.sourceDir || path.resolve(__dirname, '..');
157
- const args = ['--yes', 'skills', 'add', packageRoot];
158
-
159
- const selectedSkills = parseListOption(options.skill || options.skillsList);
160
- if (selectedSkills.length > 0) {
161
- for (const s of selectedSkills) {
162
- args.push('--skill', s);
163
- }
164
- } else {
165
- args.push('--all');
166
- }
167
-
168
- if (options.global) {
169
- args.push('-g');
170
- }
171
-
172
- const agents = parseListOption(options.agent || options.agents);
173
- for (const a of agents) {
174
- args.push('--agent', a);
175
- }
176
-
177
- if (!options.symlink) {
178
- args.push('--copy');
179
- }
180
- args.push('-y');
181
- return args;
182
- }
183
-
184
- function runSkillsCliInstall(options = {}) {
185
- const packageRoot = options.skillsSource || path.resolve(__dirname, '..');
186
- const spawnFn = options.spawnSync || spawnSync;
187
- const isWin = process.platform === 'win32';
188
- const npxCmd = isWin ? 'npx.cmd' : 'npx';
189
- const args = buildSkillsCliArgs({ ...options, sourceDir: packageRoot });
190
-
191
- const proc = spawnFn(npxCmd, args, {
192
- cwd: options.cwd || process.cwd(),
193
- encoding: 'utf8',
194
- timeout: options.timeoutMs || 60000,
195
- stdio: ['ignore', 'pipe', 'pipe']
196
- });
197
-
198
- if (proc && proc.status === 0) {
199
- return {
200
- ok: true,
201
- sourceDir: packageRoot,
202
- output: proc.stdout || ''
203
- };
204
- }
205
- return { ok: false, error: proc?.stderr || '' };
206
- }
207
-
208
- function listBundledSkillNames(bundledSkillsDir) {
209
- if (!fs.existsSync(bundledSkillsDir)) return ['archlens', 'archlens-install-policy', 'uml-workbench-companion'];
210
- try {
211
- return fs
212
- .readdirSync(bundledSkillsDir, { withFileTypes: true })
213
- .filter((d) => d.isDirectory())
214
- .map((d) => d.name);
215
- } catch {
216
- return ['archlens-install-policy'];
217
- }
218
- }
219
-
220
137
  export function getGlobalSkillDirectories(home = os.homedir()) {
221
138
  const bundledSkillsDir = path.resolve(__dirname, '..', 'skills');
222
- const skillNames = listBundledSkillNames(bundledSkillsDir);
139
+ let skillNames = ['archlens-install-policy'];
140
+ if (fs.existsSync(bundledSkillsDir)) {
141
+ try {
142
+ skillNames = fs.readdirSync(bundledSkillsDir, { withFileTypes: true })
143
+ .filter((d) => d.isDirectory())
144
+ .map((d) => d.name);
145
+ } catch {
146
+ // fallback
147
+ }
148
+ }
223
149
 
224
150
  const agents = [
225
151
  {
@@ -250,92 +176,33 @@ export function getGlobalSkillDirectories(home = os.homedir()) {
250
176
  return results;
251
177
  }
252
178
 
253
- export function installLocalSkills(projectRoot, options = {}) {
254
- const root = path.resolve(projectRoot);
255
- const dryRun = Boolean(options.dryRun);
256
- const bundledSkillsRoot = path.resolve(__dirname, '..', 'skills');
257
-
258
- if (options.preferVercelSkills !== false && !dryRun) {
259
- try {
260
- const cliRes = runSkillsCliInstall({
261
- ...options,
262
- global: false,
263
- cwd: root
264
- });
265
- if (cliRes.ok) {
266
- return {
267
- sourceDir: cliRes.sourceDir,
268
- method: 'skills-cli',
269
- output: cliRes.output,
270
- installed: [
271
- {
272
- agent: options.agent || 'Detected Project Agents (via npx skills)',
273
- skill: 'archlens-suite',
274
- path: root
275
- }
276
- ],
277
- dryRun: false
278
- };
279
- }
280
- } catch {
281
- // Offline fallback to standard .agents/skills directory
282
- }
283
- }
284
-
285
- const installed = [];
286
- for (const skillName of listBundledSkillNames(bundledSkillsRoot)) {
287
- const sourceSkillDir = path.join(bundledSkillsRoot, skillName);
288
- const targetSkillDir = path.join(root, '.agents', 'skills', skillName);
289
- if (fs.existsSync(sourceSkillDir)) {
290
- if (!dryRun) {
291
- fs.mkdirSync(targetSkillDir, { recursive: true });
292
- copyDirectorySync(sourceSkillDir, targetSkillDir);
293
- }
294
- installed.push({
295
- agent: 'Project Agents (.agents/skills)',
296
- skill: skillName,
297
- path: targetSkillDir
298
- });
299
- }
300
- }
301
-
302
- return {
303
- sourceDir: bundledSkillsRoot,
304
- method: 'direct-copy',
305
- installed,
306
- dryRun
307
- };
308
- }
309
-
310
179
  export function installGlobalSkills(options = {}) {
311
180
  const dryRun = Boolean(options.dryRun);
312
181
  const force = Boolean(options.force);
313
182
  const bundledSkillsRoot = path.resolve(__dirname, '..', 'skills');
314
183
 
315
- // Primary path: delegate to `npx skills add <cliPackageRoot> --all -g --copy -y`
316
- if ((options.preferVercelSkills ?? !options.homedir) && !dryRun) {
184
+ // Attempt using vercel-labs/skills CLI if available and not explicitly disabled
185
+ if (!options.homedir && options.preferVercelSkills !== false && !dryRun) {
317
186
  try {
318
- const cliRes = runSkillsCliInstall({
319
- ...options,
320
- global: true
187
+ const isWin = process.platform === 'win32';
188
+ const npxCmd = isWin ? 'npx.cmd' : 'npx';
189
+ // Install skills package from GitHub or local bundled skills via `npx skills add`
190
+ const skillsProc = spawnSync(npxCmd, ['--yes', 'skills', 'add', bundledSkillsRoot, '-g', '--copy', '-y'], {
191
+ encoding: 'utf8',
192
+ timeout: 15000,
193
+ stdio: ['ignore', 'pipe', 'pipe']
321
194
  });
322
- if (cliRes.ok) {
195
+ if (skillsProc.status === 0) {
323
196
  return {
324
- sourceDir: cliRes.sourceDir,
197
+ sourceDir: bundledSkillsRoot,
325
198
  method: 'skills-cli',
326
- output: cliRes.output,
327
- installed: [
328
- {
329
- agent: options.agent || 'All Supported Agents (via npx skills)',
330
- skill: 'archlens-suite',
331
- path: 'global'
332
- }
333
- ],
199
+ output: skillsProc.stdout,
200
+ installed: [{ agent: 'All Supported Agents (via vercel-labs/skills)', skill: 'archlens-suite', path: 'global' }],
334
201
  dryRun: false
335
202
  };
336
203
  }
337
204
  } catch {
338
- // Fallback seamlessly when offline / air-gapped
205
+ // Fallback seamlessly to native direct directory installation
339
206
  }
340
207
  }
341
208
 
@@ -343,6 +210,7 @@ export function installGlobalSkills(options = {}) {
343
210
  const installed = [];
344
211
 
345
212
  for (const dest of destinations) {
213
+ // Install if parent agent directory exists or if force flag is enabled
346
214
  const agentHomeDir = path.dirname(dest.baseDir);
347
215
  const shouldInstall = force || fs.existsSync(agentHomeDir);
348
216
  const sourceSkillDir = path.join(bundledSkillsRoot, dest.skill);
package/src/updater.js CHANGED
@@ -17,17 +17,14 @@ import {
17
17
  import {
18
18
  COMPANION_PROTOCOL_HEADER,
19
19
  getCompanionProtocolBlock,
20
- installGlobalSkills
20
+ installGlobalSkills,
21
+ getGlobalSkillDirectories
21
22
  } from './installer.js';
22
23
 
23
24
  export function updateLocalPolicy(projectRoot, options = {}) {
24
25
  const root = path.resolve(projectRoot);
25
26
  const dryRun = Boolean(options.dryRun);
26
27
 
27
- if (!fs.existsSync(root)) {
28
- throw new Error(`Target directory does not exist: ${root}`);
29
- }
30
-
31
28
  const primaryDir = path.join(root, '.archlens');
32
29
  const legacyDir = path.join(root, '.uml-viewer');
33
30
  const primaryPolicy = path.join(primaryDir, 'policy.json');
@@ -48,6 +45,10 @@ export function updateLocalPolicy(projectRoot, options = {}) {
48
45
 
49
46
  const configFile = path.join(targetDir, 'workbench.config.json');
50
47
 
48
+ if (!fs.existsSync(root)) {
49
+ throw new Error(`Target directory does not exist: ${root}`);
50
+ }
51
+
51
52
  const existingPolicy = JSON.parse(fs.readFileSync(policyFile, 'utf8'));
52
53
 
53
54
  const lang = existingPolicy.lang || detectProjectLanguage(root);
@@ -151,13 +152,20 @@ export function updateLocalPolicy(projectRoot, options = {}) {
151
152
  }
152
153
 
153
154
  export function updateGlobalSkills(options = {}) {
155
+ const destinations = getGlobalSkillDirectories();
156
+ const existingDestinations = destinations.filter((dest) => fs.existsSync(dest.targetDir));
157
+
158
+ if (existingDestinations.length === 0) {
159
+ // If none installed yet, install to all detected agent environments
160
+ return installGlobalSkills(options);
161
+ }
162
+
154
163
  const installResult = installGlobalSkills({
155
164
  ...options,
156
165
  force: true
157
166
  });
158
167
 
159
168
  return {
160
- method: installResult.method,
161
169
  updatedLocations: installResult.installed,
162
170
  dryRun: installResult.dryRun
163
171
  };