contextos-agents 1.5.0 → 1.6.0

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/index.js CHANGED
@@ -14,6 +14,7 @@ const flags = {
14
14
  force: args.includes('--force'),
15
15
  skipCompile: args.includes('--skip-compile'),
16
16
  auto: args.includes('--auto'),
17
+ minimal: args.includes('--minimal'),
17
18
  withMcp: args.includes('--with-mcp') || args.includes('--mcp'),
18
19
  profile: (() => {
19
20
  const i = args.indexOf('--profile');
@@ -33,17 +34,19 @@ if (flags.ver) {
33
34
 
34
35
  if (flags.help) {
35
36
  console.log(`
36
- contextos-agents v${version}
37
+ contextos / contextos-agents v${version}
37
38
  Install AI assistant skills and rules into your project.
38
39
 
39
40
  Usage:
40
- npx contextos-agents [options]
41
+ npx contextos [options]
42
+ contextos <command> [args...]
41
43
 
42
44
  Options:
43
45
  --help, -h Show this help message
44
46
  --version, -v Show version number
45
47
  --dry-run Preview what will be copied without making changes
46
48
  --force Overwrite an existing .agents/ folder
49
+ --minimal Install only 5 core skills (lightweight footprint)
47
50
  --profile <name> Install a specific profile (mvp, startup, enterprise, frontend, backend)
48
51
  --auto Auto-detect tech stack and apply recommended profile
49
52
  --with-mcp, --mcp Install with MCP execution server enabled (.agents/mcp/ & mcp_config.json)
@@ -51,7 +54,14 @@ Options:
51
54
  --add-skill <ref> Install a community plugin skill after setup
52
55
 
53
56
  Commands:
57
+ doctor Run full project diagnostic health check
54
58
  audit Validate local skills (alias for validate)
59
+ validate Validate local skills, frontmatter, and sync
60
+ profile <subcmd> Manage profiles (list, apply, show, remove)
61
+ export <target> Export skills (gemini, claude, cursor, copilot, aider, zed, all)
62
+ resolve <prompt> Dynamically resolve minimal skills for a prompt or files
63
+ stats Display token context savings report
64
+ watch Start continuous file watcher and auto-sync daemon
55
65
  detect Analyze project and display detected tech stack
56
66
  install-skill Interactive skill installer (or pass <ref> / --from-repo)
57
67
  setup-mcp Add MCP execution server to an existing .agents/ project
@@ -72,32 +82,75 @@ Plugin ref formats:
72
82
  @scope/npm-package A scoped npm skill package
73
83
 
74
84
  Examples:
75
- npx contextos-agents Install .agents/ into current project
76
- npx contextos-agents --profile mvp Install with MVP profile
77
- npx contextos-agents --auto Auto-detect tech stack and configure
78
- npx contextos-agents --dry-run Preview files that would be copied
79
- npx contextos-agents --add-skill alice/my-skill
80
-
81
- Export skills to your AI tool:
82
- node .agents/ctx.js export gemini → .agents/generated/gemini/ (Gemini / Antigravity)
83
- node .agents/ctx.js export claude → .agents/generated/claude/ (Claude Code)
84
- node .agents/ctx.js export cursor → .cursorrules & .cursor/rules (Cursor IDE)
85
- node .agents/ctx.js export copilot → .github/copilot-instructions.md
86
- node .agents/ctx.js export aider → .aider.conf.yml + CONVENTIONS.md
87
- node .agents/ctx.js export zed → .zed/rules.md & .zed/prompts/ (Zed IDE)
88
- node .agents/ctx.js export all → all of the above
89
-
90
- Profile commands (after installation):
91
- node .agents/ctx.js profile list List available profiles
92
- node .agents/ctx.js profile apply <name> Switch project profile
93
- node .agents/ctx.js detect Detect project tech stack
85
+ npx contextos Install .agents/ into current project
86
+ npx contextos --minimal Install only 5 core essential skills
87
+ npx contextos --profile startup Install with startup profile
88
+ contextos doctor Run project health check
89
+ contextos export gemini Compile skills for Gemini
90
+ contextos profile list List available profiles
94
91
  `);
95
92
  process.exit(0);
96
93
  }
97
94
 
98
- // ── Top-level Commands ────────────────────────────────────────────────────────
95
+ // ── Top-level Commands & Proxy Routing ────────────────────────────────────────
99
96
  const mainCommand = args[0] && !args[0].startsWith('-') ? args[0] : null;
100
97
 
98
+ // Doctor diagnostic health check
99
+ if (mainCommand === 'doctor') {
100
+ let doctorModule;
101
+ const localDoctor = path.join(process.cwd(), '.agents', 'doctor.js');
102
+ if (fs.existsSync(localDoctor)) {
103
+ doctorModule = require(localDoctor);
104
+ } else {
105
+ doctorModule = require('../.agents/doctor.js');
106
+ }
107
+ doctorModule.runDoctor(process.cwd());
108
+ process.exit(0);
109
+ }
110
+
111
+ // Context savings statistics report
112
+ if (mainCommand === 'stats') {
113
+ let statsModule;
114
+ const localStats = path.join(process.cwd(), '.agents', 'stats.js');
115
+ if (fs.existsSync(localStats)) {
116
+ statsModule = require(localStats);
117
+ } else {
118
+ statsModule = require('../.agents/stats.js');
119
+ }
120
+ statsModule.runStats(process.cwd());
121
+ process.exit(0);
122
+ }
123
+
124
+ // Background auto-sync file watcher daemon
125
+ if (mainCommand === 'watch') {
126
+ let watchModule;
127
+ const localWatch = path.join(process.cwd(), '.agents', 'watch.js');
128
+ if (fs.existsSync(localWatch)) {
129
+ watchModule = require(localWatch);
130
+ } else {
131
+ watchModule = require('../.agents/watch.js');
132
+ }
133
+ watchModule.runWatch(process.cwd());
134
+ }
135
+
136
+ // Proxy commands to .agents/ctx.js when executed in a ContextOS project
137
+ const PROXY_COMMANDS = ['profile', 'export', 'validate', 'resolve', 'skill', 'index', 'clean-worktrees'];
138
+ if (mainCommand && PROXY_COMMANDS.includes(mainCommand)) {
139
+ const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
140
+ if (!fs.existsSync(ctxPath)) {
141
+ console.error('[ERROR] .agents/ctx.js not found in current directory.');
142
+ console.error(' Are you in a ContextOS project? Run `contextos` or `npx contextos-agents` first.');
143
+ process.exit(1);
144
+ }
145
+ const { execFileSync } = require('child_process');
146
+ try {
147
+ execFileSync(process.execPath, [ctxPath, ...args], { stdio: 'inherit' });
148
+ } catch (e) {
149
+ process.exit(e.status || 1);
150
+ }
151
+ process.exit(0);
152
+ }
153
+
101
154
  if (mainCommand === 'audit') {
102
155
  const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
103
156
  if (!fs.existsSync(ctxPath)) {
@@ -245,6 +298,14 @@ if (mainCommand === 'install-skill') {
245
298
  const sourcePath = path.join(__dirname, '..', '.agents');
246
299
  const targetPath = path.join(process.cwd(), '.agents');
247
300
 
301
+ const MINIMAL_SKILLS = new Set([
302
+ 'engineering-workflow',
303
+ 'ponytail-mindset',
304
+ 'gstack-roles',
305
+ 'gemini-precision',
306
+ 'react',
307
+ ]);
308
+
248
309
  function uniqueSiblingPath(basePath, suffix) {
249
310
  let candidate = `${basePath}.${suffix}`;
250
311
  let index = 1;
@@ -267,12 +328,22 @@ function installAtomically(source, target, options = {}) {
267
328
  recursive: true,
268
329
  force: true,
269
330
  filter: (src) => {
331
+ const norm = src.replace(/\\/g, '/');
270
332
  if (!options.withMcp) {
271
- const norm = src.replace(/\\/g, '/');
272
333
  if (norm.endsWith('/mcp') || norm.includes('/mcp/') || norm.endsWith('/mcp_config.json')) {
273
334
  return false;
274
335
  }
275
336
  }
337
+ if (options.minimal) {
338
+ const skillMatch = norm.match(/\/core\/skills\/([^/]+)/);
339
+ if (skillMatch && !MINIMAL_SKILLS.has(skillMatch[1])) {
340
+ return false;
341
+ }
342
+ const genMatch = norm.match(/\/generated\/gemini\/skills\/([^/]+)/);
343
+ if (genMatch && !MINIMAL_SKILLS.has(genMatch[1])) {
344
+ return false;
345
+ }
346
+ }
276
347
  return true;
277
348
  },
278
349
  });
@@ -311,12 +382,22 @@ if (flags.dryRun) {
311
382
  let count = 0;
312
383
  for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
313
384
  const full = path.join(dir, entry.name);
385
+ const norm = full.replace(/\\/g, '/');
314
386
  if (!flags.withMcp) {
315
- const norm = full.replace(/\\/g, '/');
316
387
  if (norm.endsWith('/mcp') || norm.includes('/mcp/') || norm.endsWith('/mcp_config.json')) {
317
388
  continue;
318
389
  }
319
390
  }
391
+ if (flags.minimal) {
392
+ const skillMatch = norm.match(/\/core\/skills\/([^/]+)/);
393
+ if (skillMatch && !MINIMAL_SKILLS.has(skillMatch[1])) {
394
+ continue;
395
+ }
396
+ const genMatch = norm.match(/\/generated\/gemini\/skills\/([^/]+)/);
397
+ if (genMatch && !MINIMAL_SKILLS.has(genMatch[1])) {
398
+ continue;
399
+ }
400
+ }
320
401
  count += entry.isDirectory() ? countFiles(full) : 1;
321
402
  }
322
403
  return count;
@@ -330,6 +411,9 @@ if (flags.dryRun) {
330
411
  console.log(`[INFO] Detected stack: ${stackDetection.detected.length ? stackDetection.detected.join(', ') : 'Generic JavaScript'}`);
331
412
  const targetProfile = flags.profile || (flags.auto ? stackDetection.recommendedProfile : 'none');
332
413
  console.log(`[INFO] Selected profile: ${targetProfile}`);
414
+ if (flags.minimal) {
415
+ console.log(`[INFO] Minimal mode: copying only 5 core essential skills`);
416
+ }
333
417
  console.log(`[INFO] ${total} files would be copied from the package.`);
334
418
  console.log('\nRun without --dry-run to apply changes.');
335
419
  process.exit(0);
@@ -355,9 +439,14 @@ try {
355
439
  process.exit(1);
356
440
  }
357
441
 
358
- installAtomically(sourcePath, targetPath, { withMcp: flags.withMcp });
442
+ installAtomically(sourcePath, targetPath, { withMcp: flags.withMcp, minimal: flags.minimal });
359
443
 
360
444
  console.log('[OK] .agents/ successfully installed in your project!');
445
+ if (flags.minimal) {
446
+ console.log('[OK] Minimal profile: 5 core skills installed.');
447
+ console.log(' (engineering-workflow, ponytail-mindset, gstack-roles, gemini-precision, react)');
448
+ console.log(' Tip: Add more skills anytime with: contextos skill add <name>');
449
+ }
361
450
  if (stackDetection.detected.length > 0) {
362
451
  console.log(`[OK] Detected project stack: ${stackDetection.detected.join(', ')}`);
363
452
  }
@@ -405,30 +494,31 @@ try {
405
494
  });
406
495
  } catch (e) {
407
496
  console.warn('[WARN] Skill compilation failed — run manually:');
408
- console.warn(' node .agents/ctx.js export gemini');
497
+ console.warn(' contextos export gemini');
409
498
  }
410
499
  }
411
500
  } else {
412
- console.log('Tip: Run `node .agents/ctx.js export gemini` to compile skills.');
501
+ console.log('Tip: Run `contextos export gemini` to compile skills.');
413
502
  }
414
503
 
415
504
  console.log('\n Next steps:');
416
505
  console.log(' 1. Open your project in your AI assistant');
417
506
  console.log(' 2. The assistant will automatically load .agents/AGENTS.md');
418
- console.log(' 3. Skills are pre-compiled in .agents/generated/gemini/skills/');
507
+ console.log(' 3. Inspect project health anytime:');
508
+ console.log(' contextos doctor');
419
509
  console.log(' 4. Switch profiles anytime:');
420
- console.log(' node .agents/ctx.js profile list');
421
- console.log(' node .agents/ctx.js profile apply mvp');
510
+ console.log(' contextos profile list');
511
+ console.log(' contextos profile apply mvp');
422
512
  console.log(' 5. Export to other AI tools:');
423
- console.log(' node .agents/ctx.js export cursor → .cursorrules & .cursor/rules');
424
- console.log(' node .agents/ctx.js export copilot → .github/copilot-instructions.md');
425
- console.log(' node .agents/ctx.js export aider → .aider.conf.yml + CONVENTIONS.md');
513
+ console.log(' contextos export cursor → .cursorrules & .cursor/rules');
514
+ console.log(' contextos export copilot → .github/copilot-instructions.md');
515
+ console.log(' contextos export aider → .aider.conf.yml + CONVENTIONS.md');
426
516
  console.log(' 6. Add community skills (plugins):');
427
- console.log(' node .agents/ctx.js skill add username/my-skill');
428
- console.log(' node .agents/ctx.js skill list');
517
+ console.log(' contextos skill add username/my-skill');
518
+ console.log(' contextos skill list');
429
519
  if (!flags.withMcp) {
430
520
  console.log(' 7. Enable MCP parallel subagents & worktrees (optional):');
431
- console.log(' npx contextos-agents setup-mcp');
521
+ console.log(' contextos setup-mcp');
432
522
  }
433
523
  console.log('');
434
524
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "contextos-agents",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Install a .agents folder into your project to teach AI assistants best practices: UI/UX, architecture, security, and engineering workflow skills.",
5
5
  "bin": {
6
+ "contextos": "./bin/index.js",
6
7
  "contextos-agents": "./bin/index.js",
7
8
  "koko-contextos-agents": "./bin/index.js"
8
9
  },
@@ -17,6 +18,9 @@
17
18
  ".agents/plugins.js",
18
19
  ".agents/profiles.js",
19
20
  ".agents/resolver.js",
21
+ ".agents/doctor.js",
22
+ ".agents/stats.js",
23
+ ".agents/watch.js",
20
24
  ".agents/skills-index.json",
21
25
  ".agents/adapters",
22
26
  ".agents/core",
@@ -32,6 +36,9 @@
32
36
  "benchmark:live": "node benchmarks/run-live-benchmark.js",
33
37
  "benchmark:runtime": "node benchmarks/run-runtime-benchmark.js",
34
38
  "lint:md": "markdownlint README.md CONTRIBUTING.md .agents/core/skills/**/*.md --ignore .agents/generated/** --config .markdownlint.json",
39
+ "check:secrets": "node scripts/check-secrets.js --all",
40
+ "setup:hooks": "node scripts/install-hooks.js",
41
+ "watch": "node .agents/watch.js",
35
42
  "test": "node --test --test-concurrency=1 tests/install.test.js tests/export.test.js tests/skills.test.js tests/validate.test.js tests/plugins.test.js tests/benchmark.test.js tests/profile.test.js tests/resolver.test.js",
36
43
  "prepublishOnly": "npm run validate && cd contextos-mcp && npm install && npm run build:bundle && cd .. && npm run build"
37
44
  },
@@ -59,7 +66,7 @@
59
66
  "url": "https://github.com/kok-o/contextos-agents/issues"
60
67
  },
61
68
  "engines": {
62
- "node": ">=16.7.0"
69
+ "node": ">=18.0.0"
63
70
  },
64
71
  "devDependencies": {
65
72
  "markdownlint-cli": "^0.43.0"