@fmatar/archlens-skill 1.1.0 → 1.1.1-dev.63
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 +8 -8
- package/bin/index.js +81 -37
- package/package.json +2 -1
- package/skills/archlens/SKILL.md +8 -3
- package/skills/archlens-install-policy/SKILL.md +9 -2
- package/skills/uml-workbench-companion/SKILL.md +5 -1
- package/src/installer.js +157 -25
- package/src/mcp-server.js +1 -1
- package/src/updater.js +6 -14
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, and auto-configure
|
|
19
|
-
npx @fmatar/archlens-skill --yes --mcp
|
|
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
|
|
20
20
|
|
|
21
|
-
# Or
|
|
22
|
-
npx @fmatar/archlens-skill
|
|
21
|
+
# Or install skills globally across all detected coding agents via npx skills:
|
|
22
|
+
npx @fmatar/archlens-skill skills -g
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
### Option B: Install AI Assistant Skills via
|
|
25
|
+
### Option B: Install AI Assistant Skills Directly via `npx skills`
|
|
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 to
|
|
29
|
-
npx skills add fmatar/archlens
|
|
28
|
+
# Add all 3 Archlens skills to detected AI assistants in project or globally:
|
|
29
|
+
npx skills add fmatar/archlens --all -y
|
|
30
30
|
|
|
31
31
|
# Or add to a specific assistant:
|
|
32
|
-
npx skills add fmatar/archlens --agent claude-code
|
|
32
|
+
npx skills add fmatar/archlens --all --agent claude-code -y
|
|
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 } from 'node:url';
|
|
11
|
+
import { fileURLToPath, pathToFileURL } 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, installGlobalSkills } from '../src/installer.js';
|
|
20
|
+
import { installLocalPolicy, installLocalSkills, 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,6 +60,7 @@ ${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)
|
|
63
64
|
global Install Archlens skills globally for AI coding assistants
|
|
64
65
|
prompt Export Clean Architecture LLM Refactoring Prompt Dossier
|
|
65
66
|
mcp Launch Model Context Protocol (MCP) stdio server for AI assistants
|
|
@@ -80,6 +81,8 @@ ${ui.colors.bold}OPTIONS:${ui.colors.reset}
|
|
|
80
81
|
--jar <PATH> Custom path to Archlens Quarkus runner JAR
|
|
81
82
|
-o, --open Open visual workbench in default browser upon startup
|
|
82
83
|
-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)
|
|
83
86
|
-c, --copy Copy LLM prompt output directly to system clipboard
|
|
84
87
|
-g, --global Install or update skill globally in ~/.claude and ~/.gemini
|
|
85
88
|
-u, --update Update mode: sync new packages into existing policy
|
|
@@ -124,7 +127,7 @@ ${ui.colors.bold}EXAMPLES:${ui.colors.reset}
|
|
|
124
127
|
`);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
|
-
function parseArgs(args) {
|
|
130
|
+
export function parseArgs(args) {
|
|
128
131
|
const parsed = {
|
|
129
132
|
command: null,
|
|
130
133
|
path: '.',
|
|
@@ -137,6 +140,8 @@ function parseArgs(args) {
|
|
|
137
140
|
copy: false,
|
|
138
141
|
prompt: false,
|
|
139
142
|
global: false,
|
|
143
|
+
skills: false,
|
|
144
|
+
agent: null,
|
|
140
145
|
update: false,
|
|
141
146
|
upgrade: false,
|
|
142
147
|
mcp: false,
|
|
@@ -170,6 +175,10 @@ function parseArgs(args) {
|
|
|
170
175
|
parsed.port = args[++i] || '8088';
|
|
171
176
|
} else if (arg === '--mcp' || arg === '-m') {
|
|
172
177
|
parsed.mcp = true;
|
|
178
|
+
} else if (arg === '--skills') {
|
|
179
|
+
parsed.skills = true;
|
|
180
|
+
} else if (arg === '--agent') {
|
|
181
|
+
parsed.agent = args[++i] || null;
|
|
173
182
|
} else if (arg === '--global' || arg === '-g') {
|
|
174
183
|
parsed.global = true;
|
|
175
184
|
} else if (arg === '--update' || arg === '-u') {
|
|
@@ -223,7 +232,7 @@ function parseArgs(args) {
|
|
|
223
232
|
|
|
224
233
|
if (positional.length > 0) {
|
|
225
234
|
const cmd = positional[0].toLowerCase();
|
|
226
|
-
if (['init', 'start', 'update', 'upgrade', 'global', 'prompt', 'mcp', 'check', 'help', 'version'].includes(cmd)) {
|
|
235
|
+
if (['init', 'start', 'update', 'upgrade', 'skills', 'global', 'prompt', 'mcp', 'check', 'help', 'version'].includes(cmd)) {
|
|
227
236
|
parsed.command = cmd;
|
|
228
237
|
} else if (!parsed.title && !parsed.path) {
|
|
229
238
|
parsed.path = positional[0];
|
|
@@ -235,6 +244,7 @@ function parseArgs(args) {
|
|
|
235
244
|
if (parsed.command === 'start') parsed.start = true;
|
|
236
245
|
if (parsed.command === 'update') parsed.update = true;
|
|
237
246
|
if (parsed.command === 'upgrade') parsed.upgrade = true;
|
|
247
|
+
if (parsed.command === 'skills') parsed.skills = true;
|
|
238
248
|
if (parsed.command === 'global') parsed.global = true;
|
|
239
249
|
if (parsed.command === 'prompt') parsed.prompt = true;
|
|
240
250
|
if (parsed.command === 'check') parsed.check = true;
|
|
@@ -243,7 +253,9 @@ function parseArgs(args) {
|
|
|
243
253
|
return parsed;
|
|
244
254
|
}
|
|
245
255
|
|
|
246
|
-
async function runInteractive(options) {
|
|
256
|
+
async function runInteractive(options, deps = {}) {
|
|
257
|
+
const askChoice = deps.askChoice || ui.askChoice;
|
|
258
|
+
const askQuestion = deps.askQuestion || ui.askQuestion;
|
|
247
259
|
ui.banner();
|
|
248
260
|
|
|
249
261
|
const targetRoot = path.resolve(options.path || '.');
|
|
@@ -292,12 +304,11 @@ async function runInteractive(options) {
|
|
|
292
304
|
}
|
|
293
305
|
];
|
|
294
306
|
|
|
295
|
-
const selectedAction = await
|
|
307
|
+
const selectedAction = await askChoice('Select installation action:', choices);
|
|
296
308
|
|
|
297
309
|
let customTitle = options.title;
|
|
298
310
|
if (['init_local', 'both'].includes(selectedAction) && !customTitle) {
|
|
299
|
-
|
|
300
|
-
customTitle = await ui.askQuestion('Project display title', path.basename(targetRoot));
|
|
311
|
+
customTitle = await askQuestion('Project display title', path.basename(targetRoot));
|
|
301
312
|
}
|
|
302
313
|
|
|
303
314
|
const execOptions = {
|
|
@@ -347,7 +358,8 @@ function executeMcpInstall(options) {
|
|
|
347
358
|
|
|
348
359
|
function executeLocalInit(targetRoot, options) {
|
|
349
360
|
ui.step(1, 2, 'Scaffolding Clean Architecture Policy');
|
|
350
|
-
|
|
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 });
|
|
351
363
|
|
|
352
364
|
if (result.policyCreated) {
|
|
353
365
|
ui.success(`Created policy file: ${path.relative(targetRoot, result.policyFile)}`);
|
|
@@ -377,7 +389,7 @@ function executeGlobalInstall(options) {
|
|
|
377
389
|
const result = installGlobalSkills(options);
|
|
378
390
|
|
|
379
391
|
if (result.method === 'skills-cli') {
|
|
380
|
-
ui.success(`Installed Archlens skills across AI agents via
|
|
392
|
+
ui.success(`Installed Archlens skills across AI agents via npx skills${modeSuffix}`);
|
|
381
393
|
} else if (result.installed.length === 0) {
|
|
382
394
|
ui.warn('No active AI agent directories found (~/.claude, ~/.gemini). Use --force to deploy anyway.');
|
|
383
395
|
} else {
|
|
@@ -386,8 +398,21 @@ function executeGlobalInstall(options) {
|
|
|
386
398
|
}
|
|
387
399
|
}
|
|
388
400
|
|
|
389
|
-
console.log(`\n ${ui.colors.dim}💡 Tip: You can also manage Archlens skills with
|
|
390
|
-
console.log(` ${ui.colors.cyan}npx skills add fmatar/archlens${ui.colors.reset}\n`);
|
|
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
|
+
}
|
|
391
416
|
}
|
|
392
417
|
|
|
393
418
|
function executeUpgrade(targetRoot, options) {
|
|
@@ -461,25 +486,29 @@ function copyToSystemClipboard(text) {
|
|
|
461
486
|
}
|
|
462
487
|
}
|
|
463
488
|
|
|
464
|
-
async function main() {
|
|
465
|
-
const
|
|
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 || {}) };
|
|
466
495
|
const targetRoot = path.resolve(options.path || '.');
|
|
467
496
|
|
|
468
497
|
if (options.help) {
|
|
469
498
|
printHelp();
|
|
470
|
-
|
|
499
|
+
return exit(0);
|
|
471
500
|
}
|
|
472
501
|
|
|
473
502
|
if (options.version) {
|
|
474
503
|
console.log(getPackageVersion());
|
|
475
|
-
|
|
504
|
+
return exit(0);
|
|
476
505
|
}
|
|
477
506
|
|
|
478
507
|
if (options.command === 'prompt' || options.prompt) {
|
|
479
508
|
try {
|
|
480
509
|
const dossier = await generateLlmPrompt(targetRoot, options);
|
|
481
510
|
if (options.copy) {
|
|
482
|
-
const ok =
|
|
511
|
+
const ok = copyClipboard(dossier);
|
|
483
512
|
if (ok) {
|
|
484
513
|
ui.success('Clean Architecture Refactoring Dossier copied to system clipboard!');
|
|
485
514
|
} else {
|
|
@@ -488,10 +517,10 @@ async function main() {
|
|
|
488
517
|
} else {
|
|
489
518
|
process.stdout.write(dossier);
|
|
490
519
|
}
|
|
491
|
-
|
|
520
|
+
return exit(0);
|
|
492
521
|
} catch (err) {
|
|
493
522
|
ui.error(err.message || String(err));
|
|
494
|
-
|
|
523
|
+
return exit(1);
|
|
495
524
|
}
|
|
496
525
|
}
|
|
497
526
|
|
|
@@ -503,7 +532,7 @@ async function main() {
|
|
|
503
532
|
const report = await checkArchitecture(targetRoot, options);
|
|
504
533
|
if (report.error) {
|
|
505
534
|
ui.error(report.error);
|
|
506
|
-
|
|
535
|
+
return exit(1);
|
|
507
536
|
}
|
|
508
537
|
|
|
509
538
|
let formattedOutput = null;
|
|
@@ -536,7 +565,7 @@ async function main() {
|
|
|
536
565
|
if (!options.output) {
|
|
537
566
|
process.stdout.write(formattedOutput + '\n');
|
|
538
567
|
}
|
|
539
|
-
|
|
568
|
+
return exit(report.passed ? 0 : 1);
|
|
540
569
|
}
|
|
541
570
|
|
|
542
571
|
console.log(`\n ${ui.colors.bold}Architecture Governance Results (${report.projectTitle}):${ui.colors.reset}`);
|
|
@@ -592,7 +621,7 @@ async function main() {
|
|
|
592
621
|
options.detectCycles ? ', 0 package cycles' : ''
|
|
593
622
|
}${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)}%` : ''}).`
|
|
594
623
|
);
|
|
595
|
-
|
|
624
|
+
return exit(0);
|
|
596
625
|
} else {
|
|
597
626
|
ui.error(
|
|
598
627
|
`Clean Architecture Gate FAILED (${report.violationsCount} violation(s), ${
|
|
@@ -620,18 +649,18 @@ async function main() {
|
|
|
620
649
|
console.log(`\n Architectural Fitness Invariant Violation:`);
|
|
621
650
|
console.log(` Fitness Score ${(report.fitness.fitnessScore * 100).toFixed(0)}% [Grade ${report.fitness.grade}] is below required threshold ${(report.fitnessThreshold * 100).toFixed(0)}%.`);
|
|
622
651
|
}
|
|
623
|
-
|
|
652
|
+
return exit(1);
|
|
624
653
|
}
|
|
625
654
|
} catch (err) {
|
|
626
655
|
ui.error(err.message || String(err));
|
|
627
|
-
|
|
656
|
+
return exit(1);
|
|
628
657
|
}
|
|
629
658
|
}
|
|
630
659
|
|
|
631
660
|
if (options.command === 'mcp') {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
661
|
+
mcpStarter({
|
|
662
|
+
...options,
|
|
663
|
+
version: getPackageVersion()
|
|
635
664
|
});
|
|
636
665
|
return;
|
|
637
666
|
}
|
|
@@ -641,7 +670,7 @@ async function main() {
|
|
|
641
670
|
const port = options.port || '8088';
|
|
642
671
|
const targetUrl = options.serverUrl || (port === '8088' ? DEFAULT_SERVER_URL : `http://localhost:${port}`);
|
|
643
672
|
ui.info(`Checking Archlens Workbench server on ${targetUrl}...`);
|
|
644
|
-
const status = await
|
|
673
|
+
const status = await startExecutor(options);
|
|
645
674
|
if (status.status === 'running') {
|
|
646
675
|
if (status.spawned) {
|
|
647
676
|
if (status.mode === 'jar') {
|
|
@@ -659,22 +688,23 @@ async function main() {
|
|
|
659
688
|
console.log(` npx @fmatar/archlens-skill prompt\n`);
|
|
660
689
|
} else {
|
|
661
690
|
ui.error(status.message || 'Failed to start Archlens server.');
|
|
662
|
-
|
|
691
|
+
return exit(1);
|
|
663
692
|
}
|
|
664
|
-
|
|
693
|
+
return exit(0);
|
|
665
694
|
} catch (err) {
|
|
666
695
|
ui.error(err.message || String(err));
|
|
667
|
-
|
|
696
|
+
return exit(1);
|
|
668
697
|
}
|
|
669
698
|
}
|
|
670
699
|
|
|
700
|
+
const ttyAvailable = deps.isTTY !== undefined ? Boolean(deps.isTTY) : Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
671
701
|
const isInteractive = Boolean(
|
|
672
|
-
|
|
673
|
-
process.stdout.isTTY &&
|
|
702
|
+
ttyAvailable &&
|
|
674
703
|
!options.yes &&
|
|
675
704
|
!options.dryRun &&
|
|
676
705
|
!options.command &&
|
|
677
706
|
!options.start &&
|
|
707
|
+
!options.skills &&
|
|
678
708
|
!options.global &&
|
|
679
709
|
!options.update &&
|
|
680
710
|
!options.upgrade &&
|
|
@@ -684,10 +714,10 @@ async function main() {
|
|
|
684
714
|
|
|
685
715
|
if (isInteractive) {
|
|
686
716
|
try {
|
|
687
|
-
await runInteractive(options);
|
|
717
|
+
await (deps.runInteractive || ((opts) => runInteractive(opts, deps)))(options);
|
|
688
718
|
} catch (err) {
|
|
689
719
|
ui.error(err.message || String(err));
|
|
690
|
-
|
|
720
|
+
return exit(1);
|
|
691
721
|
}
|
|
692
722
|
return;
|
|
693
723
|
}
|
|
@@ -698,13 +728,25 @@ async function main() {
|
|
|
698
728
|
executeUpgrade(targetRoot, options);
|
|
699
729
|
} else if (options.update) {
|
|
700
730
|
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
|
+
}
|
|
701
737
|
} else if (options.global && !options.command) {
|
|
702
738
|
executeGlobalInstall(options);
|
|
703
739
|
executeLocalInit(targetRoot, options);
|
|
740
|
+
if (options.skills) {
|
|
741
|
+
executeLocalSkillsInstall(targetRoot, options);
|
|
742
|
+
}
|
|
704
743
|
} else if (options.global || options.command === 'global') {
|
|
705
744
|
executeGlobalInstall(options);
|
|
706
745
|
} else {
|
|
707
746
|
executeLocalInit(targetRoot, options);
|
|
747
|
+
if (options.skills) {
|
|
748
|
+
executeLocalSkillsInstall(targetRoot, options);
|
|
749
|
+
}
|
|
708
750
|
}
|
|
709
751
|
|
|
710
752
|
if (options.mcp) {
|
|
@@ -716,8 +758,10 @@ async function main() {
|
|
|
716
758
|
}
|
|
717
759
|
} catch (err) {
|
|
718
760
|
ui.error(err.message || String(err));
|
|
719
|
-
|
|
761
|
+
return exit(1);
|
|
720
762
|
}
|
|
721
763
|
}
|
|
722
764
|
|
|
723
|
-
|
|
765
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
|
|
766
|
+
main();
|
|
767
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fmatar/archlens-skill",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1-dev.63",
|
|
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,6 +20,7 @@
|
|
|
20
20
|
"node": ">=18.0.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
+
"prepack": "node ../scripts/sync-skills.js --if-repo",
|
|
23
24
|
"test": "node --test test/*.test.js",
|
|
24
25
|
"start": "node bin/index.js"
|
|
25
26
|
},
|
package/skills/archlens/SKILL.md
CHANGED
|
@@ -3,9 +3,14 @@ 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.
|
|
7
|
-
|
|
6
|
+
and Model Context Protocol (MCP) diagnostics for Archlens. Use when auditing
|
|
7
|
+
layer boundaries, inverting outward dependencies (DIP), or running Archlens.
|
|
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"
|
|
9
14
|
---
|
|
10
15
|
|
|
11
16
|
# Archlens — Clean Architecture Governance & Workbench Companion
|
|
@@ -53,7 +58,7 @@ Archlens models codebases as concentric circular rings. Source code dependencies
|
|
|
53
58
|
Install Archlens across 15+ coding agents (Antigravity, Claude Code, Cursor, Gemini CLI) via `skills.sh`:
|
|
54
59
|
```bash
|
|
55
60
|
# Add Archlens to your active agent skills library:
|
|
56
|
-
npx skills add fmatar/archlens
|
|
61
|
+
npx skills add fmatar/archlens --all -y
|
|
57
62
|
```
|
|
58
63
|
|
|
59
64
|
Or execute directly on demand via NPX:
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: archlens-install-policy
|
|
3
|
-
description:
|
|
4
|
-
|
|
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.
|
|
5
7
|
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"
|
|
6
13
|
---
|
|
7
14
|
|
|
8
15
|
# Archlens Policy & Companion Installer (`archlens-install-policy`)
|
|
@@ -4,8 +4,12 @@ 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
|
|
8
7
|
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"
|
|
9
13
|
---
|
|
10
14
|
|
|
11
15
|
# UML Workbench Companion Skill (`uml-workbench-companion`)
|
package/src/installer.js
CHANGED
|
@@ -120,6 +120,11 @@ 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
|
+
|
|
123
128
|
return {
|
|
124
129
|
targetDir: root,
|
|
125
130
|
archlensDir: targetDir,
|
|
@@ -130,22 +135,91 @@ export function installLocalPolicy(projectRoot, options = {}) {
|
|
|
130
135
|
policyData,
|
|
131
136
|
companionFiles: updatedCompanions,
|
|
132
137
|
mcpResult,
|
|
138
|
+
skillsResult,
|
|
133
139
|
dryRun
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
142
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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);
|
|
147
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
|
+
};
|
|
148
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
|
+
export function getGlobalSkillDirectories(home = os.homedir()) {
|
|
221
|
+
const bundledSkillsDir = path.resolve(__dirname, '..', 'skills');
|
|
222
|
+
const skillNames = listBundledSkillNames(bundledSkillsDir);
|
|
149
223
|
|
|
150
224
|
const agents = [
|
|
151
225
|
{
|
|
@@ -176,33 +250,92 @@ export function getGlobalSkillDirectories(home = os.homedir()) {
|
|
|
176
250
|
return results;
|
|
177
251
|
}
|
|
178
252
|
|
|
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
|
+
|
|
179
310
|
export function installGlobalSkills(options = {}) {
|
|
180
311
|
const dryRun = Boolean(options.dryRun);
|
|
181
312
|
const force = Boolean(options.force);
|
|
182
313
|
const bundledSkillsRoot = path.resolve(__dirname, '..', 'skills');
|
|
183
314
|
|
|
184
|
-
//
|
|
185
|
-
if (
|
|
315
|
+
// Primary path: delegate to `npx skills add <cliPackageRoot> --all -g --copy -y`
|
|
316
|
+
if ((options.preferVercelSkills ?? !options.homedir) && !dryRun) {
|
|
186
317
|
try {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const skillsProc = spawnSync(npxCmd, ['--yes', 'skills', 'add', bundledSkillsRoot, '-g', '--copy', '-y'], {
|
|
191
|
-
encoding: 'utf8',
|
|
192
|
-
timeout: 15000,
|
|
193
|
-
stdio: ['ignore', 'pipe', 'pipe']
|
|
318
|
+
const cliRes = runSkillsCliInstall({
|
|
319
|
+
...options,
|
|
320
|
+
global: true
|
|
194
321
|
});
|
|
195
|
-
if (
|
|
322
|
+
if (cliRes.ok) {
|
|
196
323
|
return {
|
|
197
|
-
sourceDir:
|
|
324
|
+
sourceDir: cliRes.sourceDir,
|
|
198
325
|
method: 'skills-cli',
|
|
199
|
-
output:
|
|
200
|
-
installed: [
|
|
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
|
+
],
|
|
201
334
|
dryRun: false
|
|
202
335
|
};
|
|
203
336
|
}
|
|
204
337
|
} catch {
|
|
205
|
-
// Fallback seamlessly
|
|
338
|
+
// Fallback seamlessly when offline / air-gapped
|
|
206
339
|
}
|
|
207
340
|
}
|
|
208
341
|
|
|
@@ -210,7 +343,6 @@ export function installGlobalSkills(options = {}) {
|
|
|
210
343
|
const installed = [];
|
|
211
344
|
|
|
212
345
|
for (const dest of destinations) {
|
|
213
|
-
// Install if parent agent directory exists or if force flag is enabled
|
|
214
346
|
const agentHomeDir = path.dirname(dest.baseDir);
|
|
215
347
|
const shouldInstall = force || fs.existsSync(agentHomeDir);
|
|
216
348
|
const sourceSkillDir = path.join(bundledSkillsRoot, dest.skill);
|
package/src/mcp-server.js
CHANGED
package/src/updater.js
CHANGED
|
@@ -17,14 +17,17 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
COMPANION_PROTOCOL_HEADER,
|
|
19
19
|
getCompanionProtocolBlock,
|
|
20
|
-
installGlobalSkills
|
|
21
|
-
getGlobalSkillDirectories
|
|
20
|
+
installGlobalSkills
|
|
22
21
|
} from './installer.js';
|
|
23
22
|
|
|
24
23
|
export function updateLocalPolicy(projectRoot, options = {}) {
|
|
25
24
|
const root = path.resolve(projectRoot);
|
|
26
25
|
const dryRun = Boolean(options.dryRun);
|
|
27
26
|
|
|
27
|
+
if (!fs.existsSync(root)) {
|
|
28
|
+
throw new Error(`Target directory does not exist: ${root}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
28
31
|
const primaryDir = path.join(root, '.archlens');
|
|
29
32
|
const legacyDir = path.join(root, '.uml-viewer');
|
|
30
33
|
const primaryPolicy = path.join(primaryDir, 'policy.json');
|
|
@@ -45,10 +48,6 @@ export function updateLocalPolicy(projectRoot, options = {}) {
|
|
|
45
48
|
|
|
46
49
|
const configFile = path.join(targetDir, 'workbench.config.json');
|
|
47
50
|
|
|
48
|
-
if (!fs.existsSync(root)) {
|
|
49
|
-
throw new Error(`Target directory does not exist: ${root}`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
51
|
const existingPolicy = JSON.parse(fs.readFileSync(policyFile, 'utf8'));
|
|
53
52
|
|
|
54
53
|
const lang = existingPolicy.lang || detectProjectLanguage(root);
|
|
@@ -152,20 +151,13 @@ export function updateLocalPolicy(projectRoot, options = {}) {
|
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
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
|
-
|
|
163
154
|
const installResult = installGlobalSkills({
|
|
164
155
|
...options,
|
|
165
156
|
force: true
|
|
166
157
|
});
|
|
167
158
|
|
|
168
159
|
return {
|
|
160
|
+
method: installResult.method,
|
|
169
161
|
updatedLocations: installResult.installed,
|
|
170
162
|
dryRun: installResult.dryRun
|
|
171
163
|
};
|