contextos-agents 2.1.1 → 2.3.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.
Files changed (109) hide show
  1. package/.agents/AGENTS.md +53 -396
  2. package/.agents/adapters/aider/export.js +11 -16
  3. package/.agents/adapters/claude/export.js +13 -13
  4. package/.agents/adapters/copilot/export.js +29 -8
  5. package/.agents/adapters/cursor/export.js +9 -18
  6. package/.agents/adapters/gemini/export.js +11 -46
  7. package/.agents/adapters/pure-compiler.js +65 -42
  8. package/.agents/adapters/shared.js +35 -1
  9. package/.agents/adapters/zed/export.js +2 -2
  10. package/.agents/compiled/registry.v2.json +30 -18
  11. package/.agents/compiled/registry.v2.sha256 +1 -1
  12. package/.agents/compiler/manifest-compiler.js +5 -29
  13. package/.agents/core/skills/context-os/references/project-graph.md +3 -3
  14. package/.agents/core/skills/engineering-workflow/SKILL.md +11 -316
  15. package/.agents/core/skills/engineering-workflow/references/workflow.md +336 -0
  16. package/.agents/core/skills/engineering-workflow/skill.yaml +2 -4
  17. package/.agents/core/skills/gstack-roles/SKILL.md +11 -128
  18. package/.agents/core/skills/gstack-roles/references/roles.md +149 -0
  19. package/.agents/core/skills/gstack-roles/skill.yaml +2 -4
  20. package/.agents/core/skills/ponytail-mindset/SKILL.md +13 -165
  21. package/.agents/core/skills/ponytail-mindset/references/minimalism.md +186 -0
  22. package/.agents/core/skills/ponytail-mindset/skill.yaml +2 -5
  23. package/.agents/core/skills/security/skill.yaml +1 -0
  24. package/.agents/ctx.js +22 -17
  25. package/.agents/customization-dx.js +13 -9
  26. package/.agents/doctor.js +2 -2
  27. package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +19 -0
  28. package/.agents/generated/claude/skills/context-manager/SKILL.md +0 -29
  29. package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +7 -0
  30. package/.agents/generated/claude/skills/context-manager/VALIDATION.json +12 -0
  31. package/.agents/generated/claude/skills/context-manager/references/context-rules.md +59 -0
  32. package/.agents/generated/claude/skills/context-os/EXAMPLES.md +21 -0
  33. package/.agents/generated/claude/skills/context-os/SKILL.md +0 -31
  34. package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +7 -0
  35. package/.agents/generated/claude/skills/context-os/VALIDATION.json +12 -0
  36. package/.agents/generated/claude/skills/context-os/packs.yaml +59 -0
  37. package/.agents/generated/claude/skills/context-os/references/context-rules.md +68 -0
  38. package/.agents/generated/claude/skills/context-os/references/pipeline.md +119 -0
  39. package/.agents/generated/claude/skills/context-os/references/project-graph.md +103 -0
  40. package/.agents/generated/claude/skills/context-os/rules.yaml +135 -0
  41. package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +57 -0
  42. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +10 -391
  43. package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  44. package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +12 -0
  45. package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +336 -0
  46. package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +72 -0
  47. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +0 -100
  48. package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  49. package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +12 -0
  50. package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +23 -0
  51. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +10 -164
  52. package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  53. package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +12 -0
  54. package/.agents/generated/claude/skills/gstack-roles/references/roles.md +149 -0
  55. package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +45 -0
  56. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +12 -228
  57. package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  58. package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +12 -0
  59. package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +186 -0
  60. package/.agents/generated/claude/skills/security/EXAMPLES.md +64 -0
  61. package/.agents/generated/claude/skills/security/SKILL.md +0 -86
  62. package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +19 -0
  63. package/.agents/generated/claude/skills/security/VALIDATION.json +12 -0
  64. package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +19 -0
  65. package/.agents/generated/gemini/skills/context-manager/SKILL.md +1 -33
  66. package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +7 -0
  67. package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +12 -0
  68. package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +59 -0
  69. package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +21 -0
  70. package/.agents/generated/gemini/skills/context-os/SKILL.md +0 -35
  71. package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +7 -0
  72. package/.agents/generated/gemini/skills/context-os/VALIDATION.json +12 -0
  73. package/.agents/generated/gemini/skills/context-os/packs.yaml +59 -0
  74. package/.agents/generated/gemini/skills/context-os/references/context-rules.md +68 -0
  75. package/.agents/generated/gemini/skills/context-os/references/pipeline.md +119 -0
  76. package/.agents/generated/gemini/skills/context-os/references/project-graph.md +103 -0
  77. package/.agents/generated/gemini/skills/context-os/rules.yaml +135 -0
  78. package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +57 -0
  79. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +11 -396
  80. package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  81. package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +12 -0
  82. package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +336 -0
  83. package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +72 -0
  84. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +0 -104
  85. package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  86. package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +12 -0
  87. package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +23 -0
  88. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +11 -169
  89. package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  90. package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +12 -0
  91. package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +149 -0
  92. package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +45 -0
  93. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +13 -233
  94. package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  95. package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +12 -0
  96. package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +186 -0
  97. package/.agents/generated/gemini/skills/security/EXAMPLES.md +64 -0
  98. package/.agents/generated/gemini/skills/security/SKILL.md +2 -92
  99. package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +19 -0
  100. package/.agents/generated/gemini/skills/security/VALIDATION.json +12 -0
  101. package/.agents/plugins.js +272 -28
  102. package/.agents/resolver/canonical-resolver.js +43 -7
  103. package/.agents/resolver/resolve-args.js +31 -0
  104. package/.agents/stats.js +8 -11
  105. package/.agents/workspace/workspace-graph.js +16 -6
  106. package/README.md +61 -6
  107. package/bin/index.js +157 -51
  108. package/bin/lib/ui.js +140 -0
  109. package/package.json +5 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://github.com/kok-o/contextos-agents">
3
- <img src="./Frame%202.png" alt="ContextOS Logo" width="88" height="88" />
3
+ <img src="./assets/logo.png" alt="ContextOS Logo" width="88" height="88" />
4
4
  </a>
5
5
  </p>
6
6
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  ---
32
32
 
33
- ContextOS is a deterministic context and policy compiler for AI coding agents. It transforms your team's version-controlled engineering rules into focused, verifiable context for Gemini, Claude Code, Cursor, GitHub Copilot, Aider, and Zed - and detects configuration drift in CI.
33
+ ContextOS is a deterministic context and policy compiler for AI coding agents. It exports version-controlled engineering rules and detects configuration drift in CI. See the [adapter compatibility matrix](docs/ADAPTER_COMPATIBILITY.md) for native paths, instruction indexes and manual templates; client loader verification is separate from export tests.
34
34
 
35
35
  ## Installation
36
36
 
@@ -40,14 +40,43 @@ You do not need to clone anything manually. Just open your terminal in the root
40
40
  npx contextos-agents init
41
41
  ```
42
42
 
43
- The script will automatically detect your project tech stack, create the `.agents` folder, configure a neutral bootstrap profile, and compile it for your AI agent.
43
+ By default, ContextOS installs seven core skills: `engineering-workflow`, `ponytail-mindset`, `gemini-precision`, `security`, `context-os`, `context-manager`, and `gstack-roles`, then exports Gemini workspace skills. Supporting examples and references remain separate files. The actual context loaded and session cost depend on your client and task; ContextOS does not control an external client's chat history.
44
+
45
+ Codex also discovers the shared `.agents/skills` directory. The default Cursor
46
+ export always applies only the compact project bootstrap; skill bodies load by
47
+ file patterns or agent request. Resolver token budgets are soft: mandatory safety
48
+ guidance survives with an overflow warning. The experimental MCP prompt assembler
49
+ keeps selected bodies whole and can reject an explicit hard character limit.
50
+
51
+ Want more skills right away? Install pre-packaged presets or the entire catalog:
52
+
53
+ ```bash
54
+ npx contextos-agents init --preset frontend # React, Next.js, TypeScript, UI/UX, a11y
55
+ npx contextos-agents init --preset backend # System design, API design, Node.js, databases
56
+ npx contextos-agents init --preset devops # Docker, CI/CD, Terraform
57
+ npx contextos-agents init --all # Install all 36 catalog skills at once
58
+ ```
44
59
 
45
60
  ### Options
46
61
 
62
+ Try the [small local demo](examples/quickstart/README.md) to install the current
63
+ candidate in a new folder, select a TypeScript skill, and add a team rule without
64
+ calling a model API. The [five-minute guide](docs/product/onboarding.md) explains
65
+ the same workflow for an existing project.
66
+
67
+ For the current R2 candidates, see the [release preparation status](docs/R2_RELEASE_PREPARATION.md)
68
+ and [upgrade/checkpoint rollback](docs/COMPACT_CONTEXT_MIGRATION.md). The
69
+ [release manifest](docs/evidence/release-2.3.json) records the verified source,
70
+ cross-platform CI and candidate archive identities. The client pilot and
71
+ publication decision remain pending. Internal plans, local API probes
72
+ and raw logs are excluded from the public release surface.
73
+
47
74
  ```bash
48
75
  npx contextos-agents --help # Show all options
49
76
  npx contextos-agents --version # Show version
50
77
  npx contextos-agents --minimal # Install only the core bootstrap skills
78
+ npx contextos-agents --all # Install all 36 catalog domain skills during init
79
+ npx contextos-agents --preset <name> # Install stack preset: frontend, backend, devops, full
51
80
  npx contextos-agents --profile init # Install with specific profile
52
81
  npx contextos-agents --auto # Auto-detect tech stack and apply recommended profile
53
82
  npx contextos-agents --dry-run # Preview what will be installed
@@ -110,6 +139,30 @@ contextos resolve "Build an accessible modal component with React and Tailwind"
110
139
  contextos resolve "security review" --files apps/web/app/login/page.tsx --explain
111
140
  ```
112
141
 
142
+ ### Skill & Catalog Management (`contextos skill`)
143
+
144
+ Discover, install, and customize skills:
145
+
146
+ ```bash
147
+ # Explore all available catalog skills (36 domain skills):
148
+ contextos skill list --available
149
+
150
+ # Install a specific skill from the catalog (with typo suggestions):
151
+ contextos skill add fastapi
152
+
153
+ # Install all 36 catalog skills at once:
154
+ contextos skill add --all
155
+
156
+ # Fork a built-in skill into your project for team customizations:
157
+ contextos skill override gemini-precision
158
+
159
+ # Diff your local customizations against upstream updates:
160
+ contextos skill diff gemini-precision
161
+
162
+ # Eject a skill to decouple it from upstream updates:
163
+ contextos skill eject gemini-precision
164
+ ```
165
+
113
166
  ### Diagnostic Health Check (`contextos doctor`)
114
167
 
115
168
  Run a comprehensive pre-flight verification across your repository to ensure valid skills, profile alignment, and compiler synchronization:
@@ -153,12 +206,14 @@ contextos hook uninstall
153
206
 
154
207
  ### CI Quality Gate (`contextos gate`)
155
208
 
156
- Run the complete 8-point production quality gate locally:
209
+ Check that generated adapter files match source skills and the active profile:
157
210
 
158
211
  ```bash
159
212
  contextos gate
160
213
  ```
161
214
 
215
+ This is a configuration drift gate. Run your application's tests, typecheck and security checks separately. `resolve` recommends skills for a task; ordinary exports use all installed skills allowed by the profile. Resolver budgets are soft estimates of selected skill bodies and exclude client instructions, chat history and tool output.
216
+
162
217
  ### CI Quality Gate Action (contextos-gate)
163
218
 
164
219
  Guard your repository against skill drift, missing outputs, and rule regressions using the official GitHub Composite Action:
@@ -172,9 +227,9 @@ jobs:
172
227
  runs-on: ubuntu-latest
173
228
  steps:
174
229
  - uses: actions/checkout@v4
175
- - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.1.1
230
+ - uses: kok-o/contextos-agents/.github/actions/contextos-gate@v2.2.0
176
231
  with:
177
- version: '2.1.1' # Pinned version of contextos-agents runner
232
+ version: '2.2.0' # Pinned version of contextos-agents runner
178
233
  adapters: 'all' # Adapters to verify (or specific: 'cursor', 'claude')
179
234
  working-directory: '.' # Project root directory
180
235
  ```
package/bin/index.js CHANGED
@@ -7,6 +7,7 @@ const profiles = require('../.agents/profiles.js');
7
7
  const { isKnownCommand, getStatus, formatStatusText } = require('./commands.js');
8
8
  const { detectProjectAttributes } = require('./lib/detector.js');
9
9
  const lockfileLib = require('./lib/lockfile.js');
10
+ const ui = require('./lib/ui.js');
10
11
 
11
12
  // ── CLI argument parsing ──────────────────────────────────────────────────────
12
13
  const args = process.argv.slice(2);
@@ -41,6 +42,27 @@ const flags = {
41
42
  return i !== -1 && args[i + 1] && !args[i + 1].startsWith('-') ? args[i + 1] : null;
42
43
  })(),
43
44
  githubAnnotations: args.includes('--github-annotations'),
45
+ all: args.includes('--all') || args.includes('--full'),
46
+ preset: (() => {
47
+ const i = args.indexOf('--preset');
48
+ return i !== -1 && args[i + 1] && !args[i + 1].startsWith('-') ? args[i + 1].toLowerCase() : null;
49
+ })(),
50
+ };
51
+
52
+ const PRESETS = {
53
+ frontend: [
54
+ 'react', 'react-best-practices', 'nextjs', 'typescript',
55
+ 'ui-ux-pro', 'impeccable-design', 'state-management', 'web-accessibility'
56
+ ],
57
+ backend: [
58
+ 'node', 'fastapi', 'nestjs', 'system-design',
59
+ 'api-design', 'microservices', 'ddd', 'database'
60
+ ],
61
+ devops: [
62
+ 'docker', 'ci-cd', 'terraform', 'security-audit'
63
+ ],
64
+ full: null,
65
+ all: null,
44
66
  };
45
67
 
46
68
  // ── Help / Version ────────────────────────────────────────────────────────────
@@ -71,6 +93,8 @@ Options:
71
93
  --dry-run Preview what will be copied without making changes
72
94
  --force Overwrite an existing .agents/ folder
73
95
  --minimal Install only 7 core skills (lightweight footprint)
96
+ --all, --full Install all 36 catalog skills alongside 7 core skills
97
+ --preset <name> Install domain preset (frontend, backend, devops, full)
74
98
  --profile <name> Install a specific profile (mvp, startup, enterprise, frontend, backend)
75
99
  --auto Auto-detect tech stack and apply recommended profile
76
100
  --project <path> Specify target project root directory (default: current directory)
@@ -82,6 +106,7 @@ Options:
82
106
 
83
107
  Commands:
84
108
  init Install and configure .agents/ in target project
109
+ skill <subcmd> Manage skills (add, remove, list, search, override, diff, eject)
85
110
  gate Run deterministic quality gate against adapter drift
86
111
  status Display project configuration, active profile, and lockfile status
87
112
  update Safely update skills without overwriting custom changes
@@ -119,9 +144,14 @@ Plugin ref formats:
119
144
  @scope/npm-package A scoped npm skill package
120
145
 
121
146
  Examples:
122
- npx contextos-agents init Install .agents/ with auto-detected stack
147
+ npx contextos-agents init Install Lean Core (7 foundational skills)
148
+ npx contextos-agents init --all Install ContextOS with all 43 skills
149
+ npx contextos-agents init --preset frontend Install ContextOS with frontend domain skills
123
150
  npx contextos-agents init --agent auto Install and configure for detected stack & IDE
124
- npx contextos-agents init --minimal Install only 7 core essential skills
151
+ npx contextos skill add <name> Install a domain skill from catalog
152
+ npx contextos skill add --all Install all catalog skills into existing project
153
+ npx contextos skill list --available List all available catalog domain skills
154
+ npx contextos skill override <name> Create editable local copy of a skill
125
155
  npx contextos status Show project configuration and lockfile status
126
156
  npx contextos doctor Run project health check
127
157
  npx contextos export gemini Compile skills for Gemini
@@ -178,7 +208,7 @@ if (mainCommand === 'detect') {
178
208
  }, null, 2));
179
209
  } else {
180
210
  console.log('\n══════════════════════════════════════════');
181
- console.log(' ContextOS — Workspace Scoped Detection');
211
+ console.log(' ContextOS - Workspace Scoped Detection');
182
212
  console.log('══════════════════════════════════════════\n');
183
213
  console.log(` Scope Path : ${scopeArg}`);
184
214
  if (nearestPkg) {
@@ -193,7 +223,7 @@ if (mainCommand === 'detect') {
193
223
  if (evidence.length > 0) {
194
224
  console.log('\n Scoped Evidence:');
195
225
  for (const ev of evidence.slice(0, 10)) {
196
- console.log(` • [${ev.source}] ${ev.target} (+${ev.weight}) — ${ev.description}`);
226
+ console.log(` • [${ev.source}] ${ev.target} (+${ev.weight}) - ${ev.description}`);
197
227
  }
198
228
  if (evidence.length > 10) {
199
229
  console.log(` ... and ${evidence.length - 10} more signals`);
@@ -212,7 +242,7 @@ if (mainCommand === 'detect') {
212
242
  }, null, 2));
213
243
  } else if (explain) {
214
244
  console.log('\n══════════════════════════════════════════');
215
- console.log(' ContextOS — Workspace Evidence Graph');
245
+ console.log(' ContextOS - Workspace Evidence Graph');
216
246
  console.log('══════════════════════════════════════════\n');
217
247
  console.log(` Repository Root : ${graph.repositoryRoot}`);
218
248
  console.log(` Fingerprint : ${graph.fingerprint}`);
@@ -234,7 +264,7 @@ if (mainCommand === 'detect') {
234
264
  console.log('──────────────────────────────────────────\n');
235
265
  } else {
236
266
  const detection = detectProjectAttributes(process.cwd());
237
- console.log('\nContextOS — Tech Stack & Environment Detection\n');
267
+ console.log('\nContextOS - Tech Stack & Environment Detection\n');
238
268
  console.log(` Repository Root : ${graph.repositoryRoot}`);
239
269
  console.log(` Packages Detected : ${graph.packages.map(p => `${p.id} (${p.root})`).join(', ')}`);
240
270
  console.log(` Detected Technologies : ${detection.summary.technologies.join(', ')}`);
@@ -480,7 +510,32 @@ if (mainCommand === 'install-skill') {
480
510
  }).on('error', reject);
481
511
  });
482
512
 
483
- const registry = await fetchRegistry();
513
+ let registry;
514
+ try {
515
+ registry = await fetchRegistry();
516
+ } catch {
517
+ const catalogDir = path.join(__dirname, '..', 'catalog', 'skills');
518
+ if (fs.existsSync(catalogDir)) {
519
+ const catalogSkills = fs.readdirSync(catalogDir).filter(n => {
520
+ try {
521
+ return fs.statSync(path.join(catalogDir, n)).isDirectory();
522
+ } catch {
523
+ return false;
524
+ }
525
+ });
526
+ registry = {
527
+ skills: catalogSkills.map(name => ({
528
+ name,
529
+ description: `Domain catalog skill: ${name}`,
530
+ github: null,
531
+ npm: name,
532
+ })),
533
+ };
534
+ } else {
535
+ console.error('[ERROR] Could not fetch remote registry and local catalog is unavailable.');
536
+ process.exit(1);
537
+ }
538
+ }
484
539
  const skillsList = (registry.skills || []).map((s, idx) => ({
485
540
  idx: idx + 1,
486
541
  name: s.name,
@@ -606,6 +661,13 @@ function installAtomically(source, target, options = {}) {
606
661
  return true;
607
662
  },
608
663
  });
664
+
665
+ const catalogSrc = path.join(__dirname, '..', 'catalog');
666
+ const catalogDest = path.join(stagingPath, 'catalog');
667
+ if (fs.existsSync(catalogSrc)) {
668
+ fs.cpSync(catalogSrc, catalogDest, { recursive: true, force: true });
669
+ }
670
+
609
671
  if (fs.existsSync(target)) {
610
672
  fs.renameSync(target, backupPath);
611
673
  movedExisting = true;
@@ -686,7 +748,7 @@ if (flags.dryRun) {
686
748
 
687
749
  console.log('[DRY-RUN] No files will be written.\n');
688
750
  if (fs.existsSync(targetPath)) {
689
- console.log(`[WARN] .agents/ already exists — would be overwritten with --force.`);
751
+ console.log(`[WARN] .agents/ already exists - would be overwritten with --force.`);
690
752
  } else {
691
753
  console.log(`[OK] Would create .agents/ in: ${process.cwd()}`);
692
754
  }
@@ -706,7 +768,13 @@ if (flags.dryRun) {
706
768
 
707
769
  // ── Main install ──────────────────────────────────────────────────────────────
708
770
  if (!flags.json) {
709
- console.log('Installing AI assistant skills (.agents/)...');
771
+ ui.renderBanner(version);
772
+ ui.renderStep(1, 4, 'Analyzing project environment & tech stack',
773
+ stackDetection.detected.length > 0
774
+ ? `Detected stack: ${stackDetection.detected.join(', ')}`
775
+ : 'Detected stack: Generic JavaScript environment'
776
+ );
777
+ console.log('');
710
778
  }
711
779
 
712
780
  try {
@@ -746,18 +814,14 @@ try {
746
814
  }
747
815
 
748
816
  if (!flags.json) {
749
- console.log('[OK] .agents/ successfully installed in your project!');
750
- if (flags.minimal) {
751
- console.log('[OK] Minimal profile: 5 core skills installed.');
752
- console.log(' (engineering-workflow, ponytail-mindset, gstack-roles, gemini-precision, react)');
753
- console.log(' Tip: Add more skills anytime with: contextos skill add <name>');
754
- }
755
- if (stackDetection.detected.length > 0) {
756
- console.log(`[OK] Detected project stack: ${stackDetection.detected.join(', ')}`);
757
- }
758
- if (ideDetection.detected.length > 0) {
759
- console.log(`[OK] Detected developer environment: ${ideDetection.detected.join(', ')}`);
760
- }
817
+ ui.renderStep(2, 4, 'Deploying Lean Core engine (.agents/)', [
818
+ 'Installed 7 foundational core skills in .agents/core/skills/',
819
+ 'Why 7? ContextOS uses a Lean Core to keep your AI context small, fast, and token-efficient.',
820
+ 'To add domain skills (React, FastAPI, Docker, etc.): npx contextos skill add <name> (or --all)',
821
+ ]);
822
+ console.log('');
823
+ ui.renderStep(3, 4, 'Generating lockfile & security governance', 'contextos.lock.json synchronized');
824
+ console.log('');
761
825
  }
762
826
 
763
827
  // ── Deprecation warning for --with-mcp ────────────────────────────────────────────────
@@ -771,7 +835,7 @@ try {
771
835
  if (selectedProfile) {
772
836
  try {
773
837
  const applied = profiles.applyProfile(selectedProfile, process.cwd());
774
- if (!flags.json) console.log(`[OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})`);
838
+ if (!flags.json) console.log(` [OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})\n`);
775
839
  } catch (e) {
776
840
  if (flags.json) {
777
841
  console.error(JSON.stringify({ success: false, error: `Could not apply profile '${selectedProfile}': ${e.message}` }));
@@ -782,58 +846,112 @@ try {
782
846
  }
783
847
  }
784
848
 
785
- if (!flags.json) {
786
- console.log('[OK] Your AI assistant now has skills and rules configured.\n');
787
- }
788
-
789
849
  // ── Auto-compile skills for target agents ──────────────────────────────────
790
850
  if (!flags.skipCompile) {
791
851
  const ctxPath = path.join(targetPath, 'ctx.js');
792
852
  if (fs.existsSync(ctxPath)) {
853
+ if (!flags.json) {
854
+ ui.renderStep(4, 4, 'Configuring AI assistants & compiling rules', `${targetAgents.join(', ')} synchronized`);
855
+ console.log('');
856
+ }
793
857
  const { execFileSync } = require('child_process');
794
858
  for (const ag of targetAgents) {
795
- if (!flags.json) console.log(`Compiling skills for ${ag}...`);
796
859
  try {
797
860
  execFileSync(process.execPath, [ctxPath, 'export', ag], {
798
861
  cwd: process.cwd(),
799
- stdio: flags.json ? 'ignore' : 'inherit',
862
+ stdio: 'ignore',
800
863
  });
801
864
  } catch (e) {
802
865
  if (flags.json) {
803
866
  console.error(JSON.stringify({ success: false, error: `Skill compilation for '${ag}' failed` }));
804
867
  } else {
805
- console.error(`[ERROR] Skill compilation for '${ag}' failed — run manually: contextos export ${ag}`);
868
+ console.error(` [ERROR] Skill compilation for '${ag}' failed - run manually: contextos export ${ag}`);
806
869
  }
807
870
  process.exit(1);
808
871
  }
809
872
  }
810
873
  }
811
874
  } else if (!flags.json) {
812
- console.log('Tip: Run `contextos export gemini` to compile skills.');
875
+ ui.renderStep(4, 4, 'Configuring AI assistants & compiling rules', [
876
+ 'Skipped auto-compilation (--skip-compile)',
877
+ 'Tip: Run `contextos export gemini` to compile skills when ready.',
878
+ ]);
879
+ console.log('');
813
880
  }
814
881
 
815
882
  // ── --add-skill flag ────────────────────────────────────────────────────────
816
883
  if (flags.addSkill) {
817
- const ctxPath = path.join(targetPath, 'ctx.js');
818
- if (fs.existsSync(ctxPath)) {
884
+ const packageCtxPath = path.join(__dirname, '..', '.agents', 'ctx.js');
885
+ const ctxScript = fs.existsSync(packageCtxPath) ? packageCtxPath : path.join(targetPath, 'ctx.js');
886
+ if (fs.existsSync(ctxScript)) {
819
887
  if (!flags.json) console.log(`Installing plugin skill: ${flags.addSkill}`);
820
888
  try {
821
889
  const { execFileSync } = require('child_process');
822
- execFileSync(process.execPath, [ctxPath, 'skill', 'add', flags.addSkill], {
890
+ const catalogDir = path.join(__dirname, '..', 'catalog', 'skills');
891
+ const subEnv = { ...process.env, CONTEXTOS_CATALOG_DIR: catalogDir };
892
+ execFileSync(process.execPath, [ctxScript, 'skill', 'add', flags.addSkill], {
823
893
  cwd: process.cwd(),
824
894
  stdio: flags.json ? 'ignore' : 'inherit',
895
+ env: subEnv,
825
896
  });
826
897
  } catch (e) {
827
898
  if (flags.json) {
828
899
  console.error(JSON.stringify({ success: false, error: `Skill install failed for ${flags.addSkill}` }));
829
900
  } else {
830
- console.error(`[ERROR] Skill install failed — run manually: node .agents/ctx.js skill add ${flags.addSkill}`);
901
+ console.error(`[ERROR] Skill install failed - run manually: node .agents/ctx.js skill add ${flags.addSkill}`);
831
902
  }
832
903
  process.exit(1);
833
904
  }
834
905
  }
835
906
  }
836
907
 
908
+ // ── --all / --preset flags ──────────────────────────────────────────────────
909
+ if (flags.all || flags.preset) {
910
+ const packageCtxPath = path.join(__dirname, '..', '.agents', 'ctx.js');
911
+ const ctxScript = fs.existsSync(packageCtxPath) ? packageCtxPath : path.join(targetPath, 'ctx.js');
912
+ if (fs.existsSync(ctxScript)) {
913
+ const presetKey = flags.all ? 'full' : (flags.preset || 'full');
914
+ const { execFileSync } = require('child_process');
915
+ const catalogDir = path.join(__dirname, '..', 'catalog', 'skills');
916
+ const subEnv = { ...process.env, CONTEXTOS_CATALOG_DIR: catalogDir };
917
+
918
+ if (presetKey === 'full' || presetKey === 'all') {
919
+ if (!flags.json) console.log('\nInstalling all 36 catalog skills (--all)...');
920
+ try {
921
+ execFileSync(process.execPath, [ctxScript, 'skill', 'add', '--all'], {
922
+ cwd: process.cwd(),
923
+ stdio: flags.json ? 'ignore' : 'inherit',
924
+ env: subEnv,
925
+ });
926
+ } catch (e) {
927
+ if (!flags.json) console.error(' [WARN] Failed to install catalog skills:', e.message);
928
+ }
929
+ } else if (PRESETS[presetKey]) {
930
+ if (!flags.json) console.log(` Installing preset '${presetKey}' skills:`);
931
+ const totalSkills = PRESETS[presetKey].length;
932
+ let count = 0;
933
+ for (const skillName of PRESETS[presetKey]) {
934
+ count++;
935
+ if (!flags.json) {
936
+ ui.renderProgressBar(count, totalSkills, skillName);
937
+ }
938
+ try {
939
+ execFileSync(process.execPath, [ctxScript, 'skill', 'add', skillName], {
940
+ cwd: process.cwd(),
941
+ stdio: 'ignore',
942
+ env: subEnv,
943
+ });
944
+ } catch (e) {
945
+ if (!flags.json) console.error(`\n [WARN] Failed to install preset skill '${skillName}':`, e.message);
946
+ }
947
+ }
948
+ if (!flags.json) console.log('\n');
949
+ } else {
950
+ if (!flags.json) console.error(` [WARN] Unknown preset '${flags.preset}'. Supported presets: frontend, backend, devops, full`);
951
+ }
952
+ }
953
+ }
954
+
837
955
  if (flags.json) {
838
956
  console.log(JSON.stringify({
839
957
  success: true,
@@ -844,27 +962,15 @@ try {
844
962
  agents: targetAgents,
845
963
  withMcp: flags.withMcp,
846
964
  minimal: flags.minimal,
965
+ all: flags.all,
966
+ preset: flags.preset,
847
967
  }, null, 2));
848
968
  process.exit(0);
849
969
  }
850
970
 
851
- console.log('\n Next steps:');
852
- console.log(' 1. Open your project in your AI assistant');
853
- console.log(' 2. The assistant will automatically load .agents/AGENTS.md');
854
- console.log(' 3. Inspect project health anytime:');
855
- console.log(' contextos doctor');
856
- console.log(' 4. Switch profiles anytime:');
857
- console.log(' contextos profile list');
858
- console.log(' contextos profile apply mvp');
859
- console.log(' 5. Export to other AI tools:');
860
- console.log(' contextos export cursor → .cursorrules & .cursor/rules');
861
- console.log(' contextos export copilot → .github/copilot-instructions.md');
862
- console.log(' contextos export aider → .aider.conf.yml + CONVENTIONS.md');
863
- console.log(' 6. Add community skills (plugins):');
864
- console.log(' contextos skill add username/my-skill');
865
- console.log(' contextos skill list');
866
-
867
- console.log('');
971
+ if (!flags.json) {
972
+ ui.renderSuccessCard();
973
+ }
868
974
 
869
975
  } catch (error) {
870
976
  if (flags.json) {
package/bin/lib/ui.js ADDED
@@ -0,0 +1,140 @@
1
+ /**
2
+ * bin/lib/ui.js
3
+ * Terminal visual formatting & progress helpers for ContextOS.
4
+ * Zero external dependencies - uses standard Node.js ANSI and process streams.
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ const isTTY = Boolean(process.stdout && process.stdout.isTTY && !process.env.CI && process.env.NODE_ENV !== 'test');
10
+ const noColor = Boolean(process.env.NO_COLOR || (!isTTY && !process.env.FORCE_COLOR));
11
+
12
+ const c = {
13
+ cyan: (s) => noColor ? s : `\x1b[36m${s}\x1b[0m`,
14
+ green: (s) => noColor ? s : `\x1b[32m${s}\x1b[0m`,
15
+ yellow: (s) => noColor ? s : `\x1b[33m${s}\x1b[0m`,
16
+ red: (s) => noColor ? s : `\x1b[31m${s}\x1b[0m`,
17
+ blue: (s) => noColor ? s : `\x1b[34m${s}\x1b[0m`,
18
+ magenta: (s) => noColor ? s : `\x1b[35m${s}\x1b[0m`,
19
+ dim: (s) => noColor ? s : `\x1b[2m${s}\x1b[0m`,
20
+ bold: (s) => noColor ? s : `\x1b[1m${s}\x1b[0m`,
21
+ gray: (s) => noColor ? s : `\x1b[90m${s}\x1b[0m`,
22
+ };
23
+
24
+ /**
25
+ * Render a sleek ASCII brand banner with version.
26
+ */
27
+ function renderBanner(version) {
28
+ const title = `ContextOS v${version}`;
29
+ const subtitle = 'Deterministic Context & Policy Engine for Coding Agents';
30
+ const width = Math.max(title.length, subtitle.length) + 6;
31
+ const topBorder = ` ╭${'─'.repeat(width)}╮`;
32
+ const bottomBorder = ` ╰${'─'.repeat(width)}╯`;
33
+
34
+ console.log('\n' + c.cyan(topBorder));
35
+ console.log(` ${c.cyan('│')} ${c.bold(c.cyan('ContextOS'))} ${c.dim('v' + version)}${' '.repeat(width - title.length - 3)}${c.cyan('│')}`);
36
+ console.log(` ${c.cyan('│')} ${c.gray(subtitle)}${' '.repeat(width - subtitle.length - 3)}${c.cyan('│')}`);
37
+ console.log(c.cyan(bottomBorder) + '\n');
38
+ }
39
+
40
+ /**
41
+ * Format a step badge: e.g. [1/4]
42
+ */
43
+ function formatStepBadge(step, total) {
44
+ return c.cyan(`[${step}/${total}]`);
45
+ }
46
+
47
+ /**
48
+ * Render an installation step with title and detailed item.
49
+ */
50
+ function renderStep(step, total, title, detail = null, isSuccess = true) {
51
+ const badge = formatStepBadge(step, total);
52
+ console.log(` ${badge} ${c.bold(title)}`);
53
+ if (detail) {
54
+ const symbol = isSuccess ? c.green('✓') : c.yellow('•');
55
+ if (Array.isArray(detail)) {
56
+ if (detail.length > 0) {
57
+ console.log(` ${symbol} ${detail[0]}`);
58
+ for (let i = 1; i < detail.length; i++) {
59
+ console.log(` ${c.dim(detail[i])}`);
60
+ }
61
+ }
62
+ } else {
63
+ console.log(` ${symbol} ${detail}`);
64
+ }
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Render an interactive or batch progress bar for skills/files.
70
+ */
71
+ function renderProgressBar(current, total, label = '', width = 26) {
72
+ const percent = total > 0 ? Math.min(100, Math.round((current / total) * 100)) : 100;
73
+ const filledCount = total > 0 ? Math.min(width, Math.round((current / total) * width)) : width;
74
+ const emptyCount = Math.max(0, width - filledCount);
75
+
76
+ const filledBar = '█'.repeat(filledCount);
77
+ const emptyBar = '░'.repeat(emptyCount);
78
+ const barStr = `${c.cyan(filledBar)}${c.dim(emptyBar)}`;
79
+ const progressText = `[${barStr}] ${String(percent).padStart(3)}% (${current}/${total})${label ? ' ' + c.gray(label) : ''}`;
80
+
81
+ if (isTTY) {
82
+ process.stdout.write(`\r ${progressText} `);
83
+ if (current >= total) {
84
+ process.stdout.write('\n');
85
+ }
86
+ } else {
87
+ // In CI or non-TTY test runners, log only at completion to avoid log bloat
88
+ if (current === total) {
89
+ console.log(` ${progressText}`);
90
+ }
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Render the final readiness card with next steps and commands.
96
+ */
97
+ function stripAnsi(str) {
98
+ return String(str).replace(/\x1b\[[0-9;]*m/g, '');
99
+ }
100
+
101
+ function renderCardLine(content, innerWidth = 62) {
102
+ const visible = stripAnsi(content);
103
+ const padding = Math.max(0, innerWidth - visible.length);
104
+ return ` ${c.green('│')} ${content}${' '.repeat(padding)}${c.green('│')}`;
105
+ }
106
+
107
+ /**
108
+ * Render the final readiness card with next steps and commands.
109
+ */
110
+ function renderSuccessCard(options = {}) {
111
+ const innerWidth = 62;
112
+ const topBorder = ` ╭${'─'.repeat(innerWidth + 2)}╮`;
113
+ const bottomBorder = ` ╰${'─'.repeat(innerWidth + 2)}╯`;
114
+
115
+ console.log('\n' + c.green(topBorder));
116
+ console.log(renderCardLine(c.bold(c.green('✓ Project ready for AI coding agents!')), innerWidth));
117
+ console.log(renderCardLine('', innerWidth));
118
+ console.log(renderCardLine(c.bold('Next steps:'), innerWidth));
119
+ console.log(renderCardLine('1. Default init exports Gemini workspace skills.', innerWidth));
120
+ console.log(renderCardLine(` Other clients: ${c.cyan('contextos export <agent>')}`, innerWidth));
121
+ console.log(renderCardLine('', innerWidth));
122
+ console.log(renderCardLine('2. Explore and install domain skills:', innerWidth));
123
+ console.log(renderCardLine(` ${c.cyan('contextos skill list --available')}`, innerWidth));
124
+ console.log(renderCardLine(` ${c.cyan('contextos skill add <name>')} (or ${c.cyan('--all')})`, innerWidth));
125
+ console.log(renderCardLine('', innerWidth));
126
+ console.log(renderCardLine('3. Inspect project health anytime:', innerWidth));
127
+ console.log(renderCardLine(` ${c.cyan('contextos doctor')}`, innerWidth));
128
+ console.log(c.green(bottomBorder) + '\n');
129
+ }
130
+
131
+ module.exports = {
132
+ isTTY,
133
+ noColor,
134
+ c,
135
+ renderBanner,
136
+ formatStepBadge,
137
+ renderStep,
138
+ renderProgressBar,
139
+ renderSuccessCard,
140
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contextos-agents",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Deterministic context and policy compiler for supported AI coding agents.",
5
5
  "bin": {
6
6
  "contextos": "./bin/index.js",
@@ -47,10 +47,13 @@
47
47
  "validate:catalog": "node .agents/ctx.js validate --catalog",
48
48
  "lint:md": "markdownlint README.md CONTRIBUTING.md GUIDE.md \".agents/core/skills/**/*.md\" --ignore \".agents/generated/**\" --config .markdownlint.json",
49
49
  "check:secrets": "node scripts/check-secrets.js --all",
50
+ "check:consumer": "node scripts/check-release-install.cjs",
51
+ "check:migration": "node scripts/check-release-migration.cjs",
52
+ "check:release-surface": "node scripts/check-release-surface.cjs",
50
53
  "setup:hooks": "node scripts/install-hooks.js",
51
54
  "watch": "node .agents/watch.js",
52
55
  "test:skills": "node scripts/verify-skill-examples.js",
53
- "test": "node --test --test-concurrency=1 tests/install.test.js tests/lockfile.test.js tests/safe-writer.test.js tests/adapter-safety.test.js tests/update.test.js tests/uninstall.test.js tests/plugin-security.test.js tests/export.test.js tests/skills.test.js tests/validate.test.js tests/plugins.test.js tests/benchmark.test.js tests/benchmark-api.test.js tests/profile.test.js tests/resolver.test.js tests/cli-registry.test.js tests/profile-enforcement.test.js tests/doctor-hardening.test.js tests/manifest-compiler.test.js tests/canonical-resolver.test.js tests/workspace-graph.test.js tests/profiles-v2.test.js tests/safe-path.test.js tests/project-lock.test.js tests/journaled-transaction.test.js tests/pure-adapters.test.js tests/prompt-skill-system.test.js tests/runtime-state-machine.test.js tests/verification-reviewer-pipeline.test.js tests/durable-concurrency-locks.test.js tests/transactional-git.test.js tests/sandbox-execution.test.js tests/plugin-supply-chain.test.js tests/platform-hardening.test.js tests/customization-dx.test.js tests/claims-governance.test.js tests/benchmark-v2.test.js tests/init-engine.test.js tests/mutation-paths.test.js tests/tarball-smoke.test.js tests/catalog-export-integration.test.js tests/consumer-gate.test.js tests/adapter-compatibility.test.js tests/consumer-init.test.js tests/skill-examples.test.js tests/scan.test.js tests/hooks.test.js tests/recovery-cli.test.js tests/doctor-v2.test.js tests/resolver-parity.test.js tests/watch-coalescing.test.js",
56
+ "test": "node --test --test-concurrency=1 tests/install.test.js tests/lockfile.test.js tests/safe-writer.test.js tests/adapter-safety.test.js tests/update.test.js tests/uninstall.test.js tests/plugin-security.test.js tests/export.test.js tests/skills.test.js tests/validate.test.js tests/plugins.test.js tests/benchmark.test.js tests/benchmark-api.test.js tests/profile.test.js tests/resolver.test.js tests/cli-registry.test.js tests/profile-enforcement.test.js tests/doctor-hardening.test.js tests/manifest-compiler.test.js tests/canonical-resolver.test.js tests/workspace-graph.test.js tests/profiles-v2.test.js tests/safe-path.test.js tests/project-lock.test.js tests/journaled-transaction.test.js tests/pure-adapters.test.js tests/prompt-skill-system.test.js tests/runtime-state-machine.test.js tests/verification-reviewer-pipeline.test.js tests/durable-concurrency-locks.test.js tests/transactional-git.test.js tests/sandbox-execution.test.js tests/plugin-supply-chain.test.js tests/platform-hardening.test.js tests/customization-dx.test.js tests/claims-governance.test.js tests/benchmark-v2.test.js tests/init-engine.test.js tests/mutation-paths.test.js tests/tarball-smoke.test.js tests/catalog-export-integration.test.js tests/consumer-gate.test.js tests/adapter-compatibility.test.js tests/consumer-init.test.js tests/skill-examples.test.js tests/scan.test.js tests/hooks.test.js tests/recovery-cli.test.js tests/doctor-v2.test.js tests/resolver-parity.test.js tests/watch-coalescing.test.js tests/consumer-stabilization.test.js tests/focused-context.test.js tests/spend-guard.test.js tests/maintenance-benchmark.test.js tests/luna-agent-benchmark.test.js tests/release-surface.test.js",
54
57
  "prepublishOnly": "npm run validate \u0026\u0026 npm run build"
55
58
  },
56
59
  "keywords": [