contextos-agents 1.6.1 → 2.0.0-beta.2
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/.agents/AGENTS.md +6 -1
- package/.agents/adapters/aider/export.js +117 -97
- package/.agents/adapters/claude/export.js +68 -26
- package/.agents/adapters/copilot/export.js +90 -51
- package/.agents/adapters/cursor/export.js +83 -68
- package/.agents/adapters/drift-detector.js +196 -0
- package/.agents/adapters/gemini/export.js +76 -45
- package/.agents/adapters/pure-compiler.js +443 -0
- package/.agents/adapters/zed/export.js +109 -62
- package/.agents/compiled/registry.v2.json +504 -0
- package/.agents/compiled/registry.v2.sha256 +1 -0
- package/.agents/compiler/manifest-compiler.js +963 -0
- package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
- package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
- package/.agents/compiler/vendor/yaml.js +139 -0
- package/.agents/core/profiles/init.yaml +25 -0
- package/.agents/core/skills/context-manager/references/context-rules.md +59 -0
- package/.agents/core/skills/context-manager/skill.yaml +10 -5
- package/.agents/core/skills/context-os/SKILL.md +3 -6
- package/.agents/core/skills/context-os/skill.yaml +14 -8
- package/.agents/core/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/core/skills/engineering-workflow/skill.yaml +7 -7
- package/.agents/core/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +5 -6
- package/.agents/core/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/core/skills/gstack-roles/skill.yaml +9 -6
- package/.agents/core/skills/ponytail-mindset/skill.yaml +7 -7
- package/.agents/core/skills/security/skill.yaml +21 -2
- package/.agents/ctx.js +587 -111
- package/.agents/customization-dx.js +282 -0
- package/.agents/doctor.js +877 -33
- package/.agents/filesystem/index.js +71 -0
- package/.agents/filesystem/journaled-transaction.js +451 -0
- package/.agents/filesystem/lockfile-v2.js +275 -0
- package/.agents/filesystem/platform-hardening.js +222 -0
- package/.agents/filesystem/project-lock.js +218 -0
- package/.agents/filesystem/safe-path.js +256 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +1 -1
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +4 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +3 -1
- package/.agents/plugins/contextos/hooks.json +25 -0
- package/.agents/plugins/contextos/plugin.json +19 -0
- package/.agents/plugins.js +432 -73
- package/.agents/profiles.js +507 -46
- package/.agents/resolver.js +50 -414
- package/.agents/schemas/attestation.review.v1.json +111 -0
- package/.agents/schemas/attestation.verification.v1.json +85 -0
- package/.agents/schemas/lockfile.v2.schema.json +134 -0
- package/.agents/schemas/profile.v2.schema.json +114 -0
- package/.agents/schemas/runtime.thread.v1.json +192 -0
- package/.agents/schemas/skill.manifest.v2.json +177 -0
- package/.agents/schemas/verification.spec.v1.json +39 -0
- package/.agents/schemas/workspace.graph.schema.json +106 -0
- package/.agents/stats.js +22 -9
- package/.agents/transaction-core/event-store.js +288 -0
- package/.agents/transaction-core/idempotency.js +129 -0
- package/.agents/transaction-core/ipc-lock.js +311 -0
- package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
- package/.agents/validate.js +143 -14
- package/.agents/watch.js +354 -102
- package/.agents/workspace/workspace-graph.js +778 -0
- package/README.md +59 -387
- package/benchmarks/v2/analysis/statistics.js +140 -0
- package/benchmarks/v2/analysis/stats.js +69 -0
- package/benchmarks/v2/arms/arm-definitions.js +79 -0
- package/benchmarks/v2/dataset.schema.json +34 -0
- package/benchmarks/v2/evaluators/index.js +25 -0
- package/benchmarks/v2/evaluators/verified-success.js +116 -0
- package/benchmarks/v2/harness/runner.js +88 -0
- package/benchmarks/v2/pilot-tasks.json +392 -0
- package/bin/commands/recover.js +88 -0
- package/bin/commands/uninstall.js +207 -0
- package/bin/commands/update.js +325 -0
- package/bin/commands.js +342 -0
- package/bin/index.js +326 -149
- package/bin/lib/detector.js +106 -0
- package/bin/lib/lockfile.js +253 -0
- package/bin/lib/safe-writer.js +290 -0
- package/package.json +85 -73
- package/registry.json +15 -7
- package/registry.schema.json +3 -1
- package/registry.v2.schema.json +86 -0
- package/.agents/core/profiles/backend.yaml +0 -47
- package/.agents/core/profiles/enterprise.yaml +0 -46
- package/.agents/core/profiles/frontend.yaml +0 -46
- package/.agents/core/profiles/hackathon.yaml +0 -45
- package/.agents/core/profiles/mvp.yaml +0 -44
- package/.agents/core/profiles/startup.yaml +0 -48
- package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
- package/.agents/core/skills/adapters/SKILL.md +0 -105
- package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
- package/.agents/core/skills/adapters/VALIDATION.json +0 -12
- package/.agents/core/skills/adapters/skill.yaml +0 -10
- package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
- package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
- package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -8
- package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
- package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
- package/.agents/core/skills/brutalist-design/skill.yaml +0 -8
- package/.agents/core/skills/database/EXAMPLES.md +0 -74
- package/.agents/core/skills/database/SKILL.md +0 -101
- package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/database/VALIDATION.json +0 -11
- package/.agents/core/skills/database/skill.yaml +0 -25
- package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
- package/.agents/core/skills/ddd/SKILL.md +0 -247
- package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ddd/VALIDATION.json +0 -12
- package/.agents/core/skills/ddd/ddd.md +0 -178
- package/.agents/core/skills/ddd/skill.yaml +0 -10
- package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
- package/.agents/core/skills/decisions/SKILL.md +0 -90
- package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
- package/.agents/core/skills/decisions/VALIDATION.json +0 -12
- package/.agents/core/skills/decisions/skill.yaml +0 -10
- package/.agents/core/skills/docker/EXAMPLES.md +0 -56
- package/.agents/core/skills/docker/SKILL.md +0 -63
- package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/docker/VALIDATION.json +0 -11
- package/.agents/core/skills/docker/skill.yaml +0 -23
- package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
- package/.agents/core/skills/fastapi/SKILL.md +0 -148
- package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
- package/.agents/core/skills/fastapi/fastapi.md +0 -112
- package/.agents/core/skills/fastapi/skill.yaml +0 -10
- package/.agents/core/skills/generators/EXAMPLES.md +0 -19
- package/.agents/core/skills/generators/SKILL.md +0 -112
- package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
- package/.agents/core/skills/generators/VALIDATION.json +0 -12
- package/.agents/core/skills/generators/skill.yaml +0 -10
- package/.agents/core/skills/generators/templates/API.md +0 -77
- package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
- package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
- package/.agents/core/skills/generators/templates/DECISION.md +0 -46
- package/.agents/core/skills/generators/templates/PRD.md +0 -67
- package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
- package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
- package/.agents/core/skills/generators/templates/TASKS.md +0 -43
- package/.agents/core/skills/generators/templates/UI.md +0 -73
- package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
- package/.agents/core/skills/graphify/SKILL.md +0 -130
- package/.agents/core/skills/graphify/VALIDATION.json +0 -12
- package/.agents/core/skills/graphify/skill.yaml +0 -13
- package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
- package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
- package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
- package/.agents/core/skills/impeccable-design/skill.yaml +0 -14
- package/.agents/core/skills/interview-me/SKILL.md +0 -97
- package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
- package/.agents/core/skills/interview-me/skill.yaml +0 -8
- package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
- package/.agents/core/skills/microservices/SKILL.md +0 -164
- package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/microservices/VALIDATION.json +0 -12
- package/.agents/core/skills/microservices/microservices.md +0 -119
- package/.agents/core/skills/microservices/skill.yaml +0 -10
- package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
- package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
- package/.agents/core/skills/minimalist-design/skill.yaml +0 -8
- package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
- package/.agents/core/skills/nestjs/SKILL.md +0 -139
- package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
- package/.agents/core/skills/nestjs/nestjs.md +0 -103
- package/.agents/core/skills/nestjs/skill.yaml +0 -10
- package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
- package/.agents/core/skills/nextjs/SKILL.md +0 -163
- package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
- package/.agents/core/skills/nextjs/nextjs.md +0 -67
- package/.agents/core/skills/nextjs/skill.yaml +0 -10
- package/.agents/core/skills/node/EXAMPLES.md +0 -80
- package/.agents/core/skills/node/SKILL.md +0 -128
- package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/node/VALIDATION.json +0 -12
- package/.agents/core/skills/node/node.md +0 -87
- package/.agents/core/skills/node/skill.yaml +0 -10
- package/.agents/core/skills/performance/EXAMPLES.md +0 -30
- package/.agents/core/skills/performance/SKILL.md +0 -75
- package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/performance/VALIDATION.json +0 -12
- package/.agents/core/skills/performance/performance.md +0 -52
- package/.agents/core/skills/performance/skill.yaml +0 -10
- package/.agents/core/skills/react/EXAMPLES.md +0 -79
- package/.agents/core/skills/react/SKILL.md +0 -132
- package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/react/VALIDATION.json +0 -12
- package/.agents/core/skills/react/react.md +0 -93
- package/.agents/core/skills/react/skill.yaml +0 -10
- package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
- package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
- package/.agents/core/skills/react-best-practices/skill.yaml +0 -10
- package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
- package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
- package/.agents/core/skills/redesign-audit/skill.yaml +0 -8
- package/.agents/core/skills/soft-design/SKILL.md +0 -108
- package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
- package/.agents/core/skills/soft-design/skill.yaml +0 -8
- package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
- package/.agents/core/skills/state-management/SKILL.md +0 -48
- package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/state-management/VALIDATION.json +0 -11
- package/.agents/core/skills/state-management/skill.yaml +0 -22
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -100
- package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -8
- package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
- package/.agents/core/skills/system-design/SKILL.md +0 -419
- package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/system-design/VALIDATION.json +0 -12
- package/.agents/core/skills/system-design/skill.yaml +0 -13
- package/.agents/core/skills/system-design/system-design.md +0 -112
- package/.agents/core/skills/testing/EXAMPLES.md +0 -71
- package/.agents/core/skills/testing/SKILL.md +0 -70
- package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
- package/.agents/core/skills/testing/VALIDATION.json +0 -11
- package/.agents/core/skills/testing/skill.yaml +0 -26
- package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
- package/.agents/core/skills/typescript/SKILL.md +0 -112
- package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/typescript/VALIDATION.json +0 -12
- package/.agents/core/skills/typescript/skill.yaml +0 -10
- package/.agents/core/skills/typescript/typescript.md +0 -71
- package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
- package/.agents/core/skills/ui-design/SKILL.md +0 -124
- package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
- package/.agents/core/skills/ui-design/skill.yaml +0 -10
- package/.agents/core/skills/ui-design/ui.md +0 -88
- package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
- package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
- package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
- package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -13
- package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
- package/.agents/core/skills/ux-design/SKILL.md +0 -116
- package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
- package/.agents/core/skills/ux-design/skill.yaml +0 -10
- package/.agents/core/skills/ux-design/ux.md +0 -80
- package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
- package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
- package/.agents/core/skills/vercel-optimize/skill.yaml +0 -10
- package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
- package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
- package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
- package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
- package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
- package/.agents/core/skills/web-accessibility/skill.yaml +0 -10
- package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
- package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
- package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
- package/.agents/generated/claude/skills/database/SKILL.md +0 -191
- package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
- package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
- package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
- package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
- package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
- package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
- package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
- package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
- package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
- package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
- package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
- package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
- package/.agents/generated/claude/skills/node/SKILL.md +0 -224
- package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
- package/.agents/generated/claude/skills/react/SKILL.md +0 -227
- package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
- package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
- package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
- package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -93
- package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
- package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
- package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
- package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
- package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
- package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
- package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
- package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
- package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
- package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
- package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
- package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
- package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
- package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
- package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
- package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
- package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
- package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
- package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
- package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
- package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
- package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
- package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
- package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
- package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
- package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
- package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
- package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
- package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
- package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
- package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -99
- package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
- package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
- package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
- package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
- package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
- package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
- package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
- package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
- package/.agents/mcp/runtime.py +0 -470
- package/.agents/mcp/server.mjs +0 -189271
- package/benchmarks/gemini-issues.js +0 -533
package/bin/index.js
CHANGED
|
@@ -4,6 +4,9 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { version } = require('../package.json');
|
|
6
6
|
const profiles = require('../.agents/profiles.js');
|
|
7
|
+
const { isKnownCommand, getStatus, formatStatusText } = require('./commands.js');
|
|
8
|
+
const { detectProjectAttributes } = require('./lib/detector.js');
|
|
9
|
+
const lockfileLib = require('./lib/lockfile.js');
|
|
7
10
|
|
|
8
11
|
// ── CLI argument parsing ──────────────────────────────────────────────────────
|
|
9
12
|
const args = process.argv.slice(2);
|
|
@@ -15,7 +18,12 @@ const flags = {
|
|
|
15
18
|
skipCompile: args.includes('--skip-compile'),
|
|
16
19
|
auto: args.includes('--auto'),
|
|
17
20
|
minimal: args.includes('--minimal'),
|
|
21
|
+
json: args.includes('--json'),
|
|
18
22
|
withMcp: args.includes('--with-mcp') || args.includes('--mcp'),
|
|
23
|
+
agent: (() => {
|
|
24
|
+
const i = args.indexOf('--agent');
|
|
25
|
+
return i !== -1 ? args[i + 1] : null;
|
|
26
|
+
})(),
|
|
19
27
|
profile: (() => {
|
|
20
28
|
const i = args.indexOf('--profile');
|
|
21
29
|
return i !== -1 ? args[i + 1] : null;
|
|
@@ -28,7 +36,11 @@ const flags = {
|
|
|
28
36
|
|
|
29
37
|
// ── Help / Version ────────────────────────────────────────────────────────────
|
|
30
38
|
if (flags.ver) {
|
|
31
|
-
|
|
39
|
+
if (flags.json) {
|
|
40
|
+
console.log(JSON.stringify({ package: 'contextos-agents', version }));
|
|
41
|
+
} else {
|
|
42
|
+
console.log(`contextos-agents v${version}`);
|
|
43
|
+
}
|
|
32
44
|
process.exit(0);
|
|
33
45
|
}
|
|
34
46
|
|
|
@@ -38,33 +50,41 @@ contextos / contextos-agents v${version}
|
|
|
38
50
|
Install AI assistant skills and rules into your project.
|
|
39
51
|
|
|
40
52
|
Usage:
|
|
41
|
-
npx contextos [options]
|
|
53
|
+
npx contextos-agents init [options]
|
|
54
|
+
npx contextos-agents <command> [args...]
|
|
42
55
|
contextos <command> [args...]
|
|
43
56
|
|
|
44
57
|
Options:
|
|
45
58
|
--help, -h Show this help message
|
|
46
59
|
--version, -v Show version number
|
|
60
|
+
--json Output machine-readable JSON format
|
|
61
|
+
--agent <name> Target AI agent or IDE (gemini, claude, cursor, auto)
|
|
47
62
|
--dry-run Preview what will be copied without making changes
|
|
48
63
|
--force Overwrite an existing .agents/ folder
|
|
49
|
-
--minimal Install only
|
|
64
|
+
--minimal Install only 7 core skills (lightweight footprint)
|
|
50
65
|
--profile <name> Install a specific profile (mvp, startup, enterprise, frontend, backend)
|
|
51
66
|
--auto Auto-detect tech stack and apply recommended profile
|
|
52
|
-
--with-mcp, --mcp
|
|
67
|
+
--with-mcp, --mcp [DEPRECATED] Use the separate @contextos/mcp package instead
|
|
53
68
|
--skip-compile Skip running ctx.js export after installation
|
|
54
69
|
--add-skill <ref> Install a community plugin skill after setup
|
|
55
70
|
|
|
56
71
|
Commands:
|
|
72
|
+
init Install and configure .agents/ in target project
|
|
73
|
+
status Display project configuration, active profile, and lockfile status
|
|
74
|
+
update Safely update skills without overwriting custom changes
|
|
75
|
+
uninstall Safely uninstall ContextOS files (preserves user custom skills)
|
|
57
76
|
doctor Run full project diagnostic health check
|
|
58
77
|
audit Validate local skills (alias for validate)
|
|
59
78
|
validate Validate local skills, frontmatter, and sync
|
|
79
|
+
compile Compile skill manifests into deterministic registry v2
|
|
60
80
|
profile <subcmd> Manage profiles (list, apply, show, remove)
|
|
61
81
|
export <target> Export skills (gemini, claude, cursor, copilot, aider, zed, all)
|
|
62
82
|
resolve <prompt> Dynamically resolve minimal skills for a prompt or files
|
|
63
83
|
stats Display token context savings report
|
|
64
84
|
watch Start continuous file watcher and auto-sync daemon
|
|
65
|
-
detect Analyze project and display detected tech stack
|
|
85
|
+
detect Analyze project and display detected tech stack & IDE
|
|
66
86
|
install-skill Interactive skill installer (or pass <ref> / --from-repo)
|
|
67
|
-
setup-mcp Add MCP execution server to an existing .agents/ project
|
|
87
|
+
setup-mcp [DEPRECATED] Add MCP execution server to an existing .agents/ project
|
|
68
88
|
|
|
69
89
|
Profiles:
|
|
70
90
|
mvp Fastest shipping, minimalist monolith, excludes microservices & DDD
|
|
@@ -82,12 +102,12 @@ Plugin ref formats:
|
|
|
82
102
|
@scope/npm-package A scoped npm skill package
|
|
83
103
|
|
|
84
104
|
Examples:
|
|
85
|
-
npx contextos
|
|
86
|
-
npx contextos --
|
|
87
|
-
npx contextos --
|
|
88
|
-
contextos
|
|
89
|
-
contextos
|
|
90
|
-
contextos
|
|
105
|
+
npx contextos-agents init Install .agents/ with auto-detected stack
|
|
106
|
+
npx contextos-agents init --agent auto Install and configure for detected stack & IDE
|
|
107
|
+
npx contextos-agents init --minimal Install only 7 core essential skills
|
|
108
|
+
npx contextos status Show project configuration and lockfile status
|
|
109
|
+
npx contextos doctor Run project health check
|
|
110
|
+
npx contextos export gemini Compile skills for Gemini
|
|
91
111
|
`);
|
|
92
112
|
process.exit(0);
|
|
93
113
|
}
|
|
@@ -95,10 +115,146 @@ Examples:
|
|
|
95
115
|
// ── Top-level Commands & Proxy Routing ────────────────────────────────────────
|
|
96
116
|
const mainCommand = args[0] && !args[0].startsWith('-') ? args[0] : null;
|
|
97
117
|
|
|
118
|
+
// Unknown command check
|
|
119
|
+
if (mainCommand && mainCommand !== 'init' && !isKnownCommand(mainCommand)) {
|
|
120
|
+
if (flags.json) {
|
|
121
|
+
console.error(JSON.stringify({ error: `Unknown command: ${mainCommand}`, code: 1 }));
|
|
122
|
+
} else {
|
|
123
|
+
console.error(`[ERROR] Unknown command: ${mainCommand}`);
|
|
124
|
+
console.error(' Run `npx contextos-agents --help` to view available commands.');
|
|
125
|
+
}
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Status command
|
|
130
|
+
if (mainCommand === 'status') {
|
|
131
|
+
const status = getStatus(process.cwd());
|
|
132
|
+
if (flags.json) {
|
|
133
|
+
console.log(JSON.stringify(status, null, 2));
|
|
134
|
+
} else {
|
|
135
|
+
console.log(formatStatusText(status));
|
|
136
|
+
}
|
|
137
|
+
process.exit(0);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Detect command
|
|
141
|
+
if (mainCommand === 'detect') {
|
|
142
|
+
const { WorkspaceGraphBuilder } = require('../.agents/workspace/workspace-graph.js');
|
|
143
|
+
const scopeIdx = args.indexOf('--scope');
|
|
144
|
+
const scopeArg = scopeIdx !== -1 && args[scopeIdx + 1] && !args[scopeIdx + 1].startsWith('--')
|
|
145
|
+
? args[scopeIdx + 1]
|
|
146
|
+
: (args.find(a => a.startsWith('--scope=')) || '').split('=')[1];
|
|
147
|
+
const explain = args.includes('--explain');
|
|
148
|
+
|
|
149
|
+
const builder = new WorkspaceGraphBuilder();
|
|
150
|
+
const graph = builder.build(process.cwd());
|
|
151
|
+
|
|
152
|
+
if (scopeArg) {
|
|
153
|
+
const nearestPkg = builder.findNearestPackage(scopeArg, graph);
|
|
154
|
+
const evidence = builder.extractPackageEvidence(scopeArg, graph);
|
|
155
|
+
|
|
156
|
+
if (flags.json) {
|
|
157
|
+
console.log(JSON.stringify({
|
|
158
|
+
scope: scopeArg,
|
|
159
|
+
nearestPackage: nearestPkg,
|
|
160
|
+
evidence,
|
|
161
|
+
}, null, 2));
|
|
162
|
+
} else {
|
|
163
|
+
console.log('\n══════════════════════════════════════════');
|
|
164
|
+
console.log(' ContextOS — Workspace Scoped Detection');
|
|
165
|
+
console.log('══════════════════════════════════════════\n');
|
|
166
|
+
console.log(` Scope Path : ${scopeArg}`);
|
|
167
|
+
if (nearestPkg) {
|
|
168
|
+
console.log(` Nearest Package : ${nearestPkg.id} (${nearestPkg.ecosystem})`);
|
|
169
|
+
console.log(` Package Root : ${nearestPkg.root}`);
|
|
170
|
+
console.log(` Languages : ${nearestPkg.languages.join(', ') || 'unspecified'}`);
|
|
171
|
+
console.log(` Dependencies : ${nearestPkg.dependencies.length} (${nearestPkg.dependencies.slice(0, 8).join(', ')}${nearestPkg.dependencies.length > 8 ? '...' : ''})`);
|
|
172
|
+
console.log(` Configs : ${nearestPkg.configs.join(', ') || 'none'}`);
|
|
173
|
+
if (nearestPkg.internalDependencies.length > 0) {
|
|
174
|
+
console.log(` Internal Links : ${nearestPkg.internalDependencies.join(', ')}`);
|
|
175
|
+
}
|
|
176
|
+
if (evidence.length > 0) {
|
|
177
|
+
console.log('\n Scoped Evidence:');
|
|
178
|
+
for (const ev of evidence.slice(0, 10)) {
|
|
179
|
+
console.log(` • [${ev.source}] ${ev.target} (+${ev.weight}) — ${ev.description}`);
|
|
180
|
+
}
|
|
181
|
+
if (evidence.length > 10) {
|
|
182
|
+
console.log(` ... and ${evidence.length - 10} more signals`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
console.log(' Nearest Package : (none found)');
|
|
187
|
+
}
|
|
188
|
+
console.log('\n──────────────────────────────────────────\n');
|
|
189
|
+
}
|
|
190
|
+
} else if (flags.json) {
|
|
191
|
+
const detection = detectProjectAttributes(process.cwd());
|
|
192
|
+
console.log(JSON.stringify({
|
|
193
|
+
...detection,
|
|
194
|
+
workspaceGraph: graph,
|
|
195
|
+
}, null, 2));
|
|
196
|
+
} else if (explain) {
|
|
197
|
+
console.log('\n══════════════════════════════════════════');
|
|
198
|
+
console.log(' ContextOS — Workspace Evidence Graph');
|
|
199
|
+
console.log('══════════════════════════════════════════\n');
|
|
200
|
+
console.log(` Repository Root : ${graph.repositoryRoot}`);
|
|
201
|
+
console.log(` Fingerprint : ${graph.fingerprint}`);
|
|
202
|
+
console.log(` Packages Found : ${graph.packages.length} ${graph.partial ? '(partial: true)' : ''}\n`);
|
|
203
|
+
for (const pkg of graph.packages) {
|
|
204
|
+
console.log(` • ${pkg.id} [${pkg.ecosystem}]`);
|
|
205
|
+
console.log(` Root : ${pkg.root}`);
|
|
206
|
+
console.log(` Manifests : ${pkg.manifests.join(', ')}`);
|
|
207
|
+
console.log(` Languages : ${pkg.languages.join(', ') || 'unspecified'}`);
|
|
208
|
+
console.log(` Dependencies : ${pkg.dependencies.length}`);
|
|
209
|
+
if (pkg.configs.length > 0) {
|
|
210
|
+
console.log(` Configs : ${pkg.configs.join(', ')}`);
|
|
211
|
+
}
|
|
212
|
+
if (pkg.internalDependencies.length > 0) {
|
|
213
|
+
console.log(` Internal Links : ${pkg.internalDependencies.join(', ')}`);
|
|
214
|
+
}
|
|
215
|
+
console.log('');
|
|
216
|
+
}
|
|
217
|
+
console.log('──────────────────────────────────────────\n');
|
|
218
|
+
} else {
|
|
219
|
+
const detection = detectProjectAttributes(process.cwd());
|
|
220
|
+
console.log('\nContextOS — Tech Stack & Environment Detection\n');
|
|
221
|
+
console.log(` Repository Root : ${graph.repositoryRoot}`);
|
|
222
|
+
console.log(` Packages Detected : ${graph.packages.map(p => `${p.id} (${p.root})`).join(', ')}`);
|
|
223
|
+
console.log(` Detected Technologies : ${detection.summary.technologies.join(', ')}`);
|
|
224
|
+
console.log(` Detected Environments : ${detection.summary.ides.join(', ')}`);
|
|
225
|
+
console.log(` Recommended Profile : ${detection.summary.recommendedProfile}`);
|
|
226
|
+
console.log(` Recommended Agents : ${detection.summary.recommendedAgents.join(', ')}`);
|
|
227
|
+
console.log(` Recommended Skills : ${detection.summary.recommendedSkills.join(', ')}\n`);
|
|
228
|
+
console.log(' Commands:');
|
|
229
|
+
console.log(' contextos detect --scope <path> Scope detection to a specific file/subproject');
|
|
230
|
+
console.log(' contextos detect --explain Display full workspace evidence graph\n');
|
|
231
|
+
}
|
|
232
|
+
process.exit(0);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Doctor command
|
|
236
|
+
if (mainCommand === 'doctor') {
|
|
237
|
+
const doctorModule = require('../.agents/doctor.js');
|
|
238
|
+
const result = doctorModule.runDoctor(process.cwd(), {
|
|
239
|
+
json: flags.json,
|
|
240
|
+
fix: args.includes('--fix'),
|
|
241
|
+
strict: args.includes('--strict'),
|
|
242
|
+
});
|
|
243
|
+
process.exit(result && result.ok === false ? 1 : 0);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Recover command
|
|
247
|
+
if (mainCommand === 'recover') {
|
|
248
|
+
const recoverModule = require('./commands/recover.js');
|
|
249
|
+
recoverModule(args, flags);
|
|
250
|
+
process.exit(0);
|
|
251
|
+
}
|
|
252
|
+
|
|
98
253
|
// Proxy commands to .agents/ctx.js when executed in a ContextOS project
|
|
99
254
|
const PROXY_COMMANDS = [
|
|
100
255
|
'profile', 'export', 'validate', 'resolve', 'skill', 'index',
|
|
101
|
-
'clean-worktrees', '
|
|
256
|
+
'clean-worktrees', 'stats', 'watch', 'compile', 'explain',
|
|
257
|
+
'thread'
|
|
102
258
|
];
|
|
103
259
|
|
|
104
260
|
const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
|
|
@@ -115,9 +271,21 @@ if (mainCommand && PROXY_COMMANDS.includes(mainCommand) && hasLocalCtx) {
|
|
|
115
271
|
}
|
|
116
272
|
|
|
117
273
|
// Fallbacks when running outside an initialized .agents/ directory
|
|
118
|
-
if (mainCommand === '
|
|
119
|
-
const
|
|
120
|
-
|
|
274
|
+
if (mainCommand === 'update') {
|
|
275
|
+
const { runUpdate } = require('./commands/update.js');
|
|
276
|
+
runUpdate(process.cwd(), {
|
|
277
|
+
dryRun: flags.dryRun,
|
|
278
|
+
skipCompile: flags.skipCompile,
|
|
279
|
+
profile: flags.profile,
|
|
280
|
+
});
|
|
281
|
+
process.exit(0);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (mainCommand === 'uninstall') {
|
|
285
|
+
const { runUninstall } = require('./commands/uninstall.js');
|
|
286
|
+
runUninstall(process.cwd(), {
|
|
287
|
+
dryRun: flags.dryRun,
|
|
288
|
+
});
|
|
121
289
|
process.exit(0);
|
|
122
290
|
}
|
|
123
291
|
|
|
@@ -132,24 +300,7 @@ if (mainCommand === 'watch') {
|
|
|
132
300
|
watchModule.runWatch(process.cwd());
|
|
133
301
|
}
|
|
134
302
|
|
|
135
|
-
|
|
136
|
-
console.log(`
|
|
137
|
-
ContextOS — Project Setup
|
|
138
|
-
|
|
139
|
-
Usage:
|
|
140
|
-
npx contextos Install .agents/ with auto-detected stack
|
|
141
|
-
npx contextos --profile <name> Install with specific profile (mvp, startup, enterprise, frontend, backend)
|
|
142
|
-
npx contextos --minimal Install only 5 core skills
|
|
143
|
-
npx contextos --with-mcp Install with MCP execution server enabled
|
|
144
|
-
|
|
145
|
-
Run:
|
|
146
|
-
contextos doctor Verify installation health
|
|
147
|
-
contextos stats Show token savings report
|
|
148
|
-
`);
|
|
149
|
-
process.exit(0);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const PROJECT_ONLY_COMMANDS = ['profile', 'export', 'validate', 'resolve', 'skill', 'index', 'clean-worktrees'];
|
|
303
|
+
const PROJECT_ONLY_COMMANDS = ['profile', 'export', 'validate', 'resolve', 'skill', 'index', 'clean-worktrees', 'compile', 'explain'];
|
|
153
304
|
if (mainCommand && PROJECT_ONLY_COMMANDS.includes(mainCommand) && !hasLocalCtx) {
|
|
154
305
|
console.error('[ERROR] .agents/ctx.js not found in current directory.');
|
|
155
306
|
console.error(' Are you in a ContextOS project? Run `contextos` or `npx contextos-agents` first.');
|
|
@@ -170,15 +321,6 @@ if (mainCommand === 'audit') {
|
|
|
170
321
|
process.exit(0);
|
|
171
322
|
}
|
|
172
323
|
|
|
173
|
-
if (mainCommand === 'detect') {
|
|
174
|
-
const stack = profiles.detectStack(process.cwd());
|
|
175
|
-
console.log('\nContextOS — Tech Stack Detection\n');
|
|
176
|
-
console.log(` Detected Technologies : ${stack.detected.length ? stack.detected.join(', ') : 'Generic JavaScript'}`);
|
|
177
|
-
console.log(` Recommended Profile : ${stack.recommendedProfile}`);
|
|
178
|
-
console.log(` Recommended Skills : ${stack.recommendedSkills.join(', ')}\n`);
|
|
179
|
-
process.exit(0);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
324
|
if (mainCommand === 'install-skill') {
|
|
183
325
|
const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
|
|
184
326
|
if (!fs.existsSync(ctxPath)) {
|
|
@@ -288,46 +430,10 @@ if (mainCommand === 'install-skill') {
|
|
|
288
430
|
})();
|
|
289
431
|
}
|
|
290
432
|
} else if (mainCommand === 'setup-mcp') {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
process.exit(1);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
const sourceMcp = path.join(__dirname, '..', '.agents', 'mcp');
|
|
299
|
-
const targetMcp = path.join(targetPath, 'mcp');
|
|
300
|
-
if (!fs.existsSync(sourceMcp)) {
|
|
301
|
-
console.error('[ERROR] Source MCP server bundle not found in package.');
|
|
302
|
-
process.exit(1);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
try {
|
|
306
|
-
fs.cpSync(sourceMcp, targetMcp, { recursive: true, force: true });
|
|
307
|
-
console.log('[OK] Installed ContextOS MCP execution server into .agents/mcp/');
|
|
308
|
-
|
|
309
|
-
const mcpConfigPath = path.join(targetPath, 'mcp_config.json');
|
|
310
|
-
if (!fs.existsSync(mcpConfigPath) || flags.force) {
|
|
311
|
-
const defaultMcpConfig = {
|
|
312
|
-
mcpServers: {
|
|
313
|
-
"contextos": {
|
|
314
|
-
command: "node",
|
|
315
|
-
args: ["./.agents/mcp/server.mjs", "--dir", "."]
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
fs.writeFileSync(mcpConfigPath, JSON.stringify(defaultMcpConfig, null, 2));
|
|
320
|
-
console.log('[OK] Created MCP configuration (.agents/mcp_config.json)');
|
|
321
|
-
} else {
|
|
322
|
-
console.log('[INFO] Existing .agents/mcp_config.json retained.');
|
|
323
|
-
}
|
|
324
|
-
console.log('\n[SUCCESS] ContextOS MCP execution layer is configured.');
|
|
325
|
-
console.log('You can now use parallel subagents and git worktrees in your MCP-compatible IDE.\n');
|
|
326
|
-
} catch (err) {
|
|
327
|
-
console.error('[ERROR] Failed to configure MCP:', err.message);
|
|
328
|
-
process.exit(1);
|
|
329
|
-
}
|
|
330
|
-
process.exit(0);
|
|
433
|
+
console.error('[DEPRECATED] The bundled MCP server has been moved to a separate package in v2.0.');
|
|
434
|
+
console.error(' To use the MCP Bridge or execution runtime, install @contextos/mcp:');
|
|
435
|
+
console.error(' npm install @contextos/mcp --save-dev');
|
|
436
|
+
process.exit(1);
|
|
331
437
|
} else {
|
|
332
438
|
|
|
333
439
|
// ── Paths ─────────────────────────────────────────────────────────────────────
|
|
@@ -339,7 +445,9 @@ const MINIMAL_SKILLS = new Set([
|
|
|
339
445
|
'ponytail-mindset',
|
|
340
446
|
'gstack-roles',
|
|
341
447
|
'gemini-precision',
|
|
342
|
-
'
|
|
448
|
+
'context-os',
|
|
449
|
+
'context-manager',
|
|
450
|
+
'security',
|
|
343
451
|
]);
|
|
344
452
|
|
|
345
453
|
function uniqueSiblingPath(basePath, suffix) {
|
|
@@ -365,10 +473,8 @@ function installAtomically(source, target, options = {}) {
|
|
|
365
473
|
force: true,
|
|
366
474
|
filter: (src) => {
|
|
367
475
|
const norm = src.replace(/\\/g, '/');
|
|
368
|
-
if (
|
|
369
|
-
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
476
|
+
if (norm.endsWith('/mcp') || norm.includes('/mcp/') || norm.endsWith('/mcp_config.json')) {
|
|
477
|
+
return false;
|
|
372
478
|
}
|
|
373
479
|
if (options.minimal) {
|
|
374
480
|
const skillMatch = norm.match(/\/core\/skills\/([^/]+)/);
|
|
@@ -404,12 +510,18 @@ function installAtomically(source, target, options = {}) {
|
|
|
404
510
|
}
|
|
405
511
|
}
|
|
406
512
|
|
|
407
|
-
// ── Stack detection
|
|
408
|
-
const
|
|
513
|
+
// ── Stack & IDE detection ───────────────────────────────────────────────────
|
|
514
|
+
const projectAttrs = detectProjectAttributes(process.cwd());
|
|
515
|
+
const stackDetection = projectAttrs.stack;
|
|
516
|
+
const ideDetection = projectAttrs.ide;
|
|
517
|
+
|
|
518
|
+
const targetProfile = flags.profile || (flags.auto || flags.agent === 'auto' ? stackDetection.recommendedProfile : 'none');
|
|
519
|
+
const targetAgents = (flags.agent === 'auto' || flags.auto)
|
|
520
|
+
? ideDetection.recommendedAgents
|
|
521
|
+
: (flags.agent ? [flags.agent] : ['gemini']);
|
|
409
522
|
|
|
410
523
|
// ── Dry run ───────────────────────────────────────────────────────────────────
|
|
411
524
|
if (flags.dryRun) {
|
|
412
|
-
console.log('[DRY-RUN] No files will be written.\n');
|
|
413
525
|
if (!fs.existsSync(sourcePath)) {
|
|
414
526
|
console.error('[ERROR] Source .agents/ folder not found in package.');
|
|
415
527
|
process.exit(1);
|
|
@@ -439,14 +551,34 @@ if (flags.dryRun) {
|
|
|
439
551
|
return count;
|
|
440
552
|
};
|
|
441
553
|
const total = countFiles(sourcePath);
|
|
554
|
+
|
|
555
|
+
if (flags.json) {
|
|
556
|
+
console.log(JSON.stringify({
|
|
557
|
+
dryRun: true,
|
|
558
|
+
targetPath,
|
|
559
|
+
targetProfile,
|
|
560
|
+
detectedStack: stackDetection.detected,
|
|
561
|
+
detectedIde: ideDetection.detected,
|
|
562
|
+
targetAgents,
|
|
563
|
+
filesCount: total,
|
|
564
|
+
minimal: flags.minimal,
|
|
565
|
+
withMcp: flags.withMcp,
|
|
566
|
+
}, null, 2));
|
|
567
|
+
process.exit(0);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
console.log('[DRY-RUN] No files will be written.\n');
|
|
442
571
|
if (fs.existsSync(targetPath)) {
|
|
443
572
|
console.log(`[WARN] .agents/ already exists — would be overwritten with --force.`);
|
|
444
573
|
} else {
|
|
445
574
|
console.log(`[OK] Would create .agents/ in: ${process.cwd()}`);
|
|
446
575
|
}
|
|
447
576
|
console.log(`[INFO] Detected stack: ${stackDetection.detected.length ? stackDetection.detected.join(', ') : 'Generic JavaScript'}`);
|
|
448
|
-
|
|
577
|
+
if (ideDetection.detected.length > 0) {
|
|
578
|
+
console.log(`[INFO] Detected IDEs: ${ideDetection.detected.join(', ')}`);
|
|
579
|
+
}
|
|
449
580
|
console.log(`[INFO] Selected profile: ${targetProfile}`);
|
|
581
|
+
console.log(`[INFO] Target agents for export: ${targetAgents.join(', ')}`);
|
|
450
582
|
if (flags.minimal) {
|
|
451
583
|
console.log(`[INFO] Minimal mode: copying only 5 core essential skills`);
|
|
452
584
|
}
|
|
@@ -456,7 +588,9 @@ if (flags.dryRun) {
|
|
|
456
588
|
}
|
|
457
589
|
|
|
458
590
|
// ── Main install ──────────────────────────────────────────────────────────────
|
|
459
|
-
|
|
591
|
+
if (!flags.json) {
|
|
592
|
+
console.log('Installing AI assistant skills (.agents/)...');
|
|
593
|
+
}
|
|
460
594
|
|
|
461
595
|
try {
|
|
462
596
|
if (!fs.existsSync(sourcePath)) {
|
|
@@ -477,64 +611,124 @@ try {
|
|
|
477
611
|
|
|
478
612
|
installAtomically(sourcePath, targetPath, { withMcp: flags.withMcp, minimal: flags.minimal });
|
|
479
613
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
614
|
+
// ── Create/update lockfile for provenance & safe lifecycle ─────────────────
|
|
615
|
+
const selectedProfile = flags.profile || (flags.auto || flags.agent === 'auto' ? stackDetection.recommendedProfile : null);
|
|
616
|
+
try {
|
|
617
|
+
lockfileLib.migrateExistingInstallation(process.cwd(), sourcePath, {
|
|
618
|
+
selectedProfile: selectedProfile || 'none',
|
|
619
|
+
installedPackage: 'contextos-agents',
|
|
620
|
+
version,
|
|
621
|
+
});
|
|
622
|
+
} catch (err) {
|
|
623
|
+
if (flags.json) {
|
|
624
|
+
console.error(JSON.stringify({ success: false, error: `Could not generate lockfile: ${err.message}` }));
|
|
625
|
+
} else {
|
|
626
|
+
console.error(`[ERROR] Could not generate lockfile: ${err.message}`);
|
|
627
|
+
}
|
|
628
|
+
process.exit(1);
|
|
485
629
|
}
|
|
486
|
-
|
|
487
|
-
|
|
630
|
+
|
|
631
|
+
if (!flags.json) {
|
|
632
|
+
console.log('[OK] .agents/ successfully installed in your project!');
|
|
633
|
+
if (flags.minimal) {
|
|
634
|
+
console.log('[OK] Minimal profile: 5 core skills installed.');
|
|
635
|
+
console.log(' (engineering-workflow, ponytail-mindset, gstack-roles, gemini-precision, react)');
|
|
636
|
+
console.log(' Tip: Add more skills anytime with: contextos skill add <name>');
|
|
637
|
+
}
|
|
638
|
+
if (stackDetection.detected.length > 0) {
|
|
639
|
+
console.log(`[OK] Detected project stack: ${stackDetection.detected.join(', ')}`);
|
|
640
|
+
}
|
|
641
|
+
if (ideDetection.detected.length > 0) {
|
|
642
|
+
console.log(`[OK] Detected developer environment: ${ideDetection.detected.join(', ')}`);
|
|
643
|
+
}
|
|
488
644
|
}
|
|
489
645
|
|
|
490
|
-
// ──
|
|
646
|
+
// ── Deprecation warning for --with-mcp ────────────────────────────────────────────────
|
|
491
647
|
if (flags.withMcp) {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
mcpServers: {
|
|
496
|
-
"contextos": {
|
|
497
|
-
command: "node",
|
|
498
|
-
args: ["./.agents/mcp/server.mjs", "--dir", "."]
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
};
|
|
502
|
-
fs.writeFileSync(mcpConfigPath, JSON.stringify(defaultMcpConfig, null, 2));
|
|
503
|
-
console.log('[OK] Created default MCP configuration (.agents/mcp_config.json)');
|
|
504
|
-
}
|
|
648
|
+
console.warn('\n[DEPRECATED] The --with-mcp flag is no longer supported in ContextOS v2.0.');
|
|
649
|
+
console.warn(' The MCP execution runtime has been moved to a separate package.');
|
|
650
|
+
console.warn(' To enable the MCP server, run: npm install @contextos/mcp --save-dev\n');
|
|
505
651
|
}
|
|
506
652
|
|
|
507
653
|
// ── Apply profile if requested or auto ──────────────────────────────────────
|
|
508
|
-
const selectedProfile = flags.profile || (flags.auto ? stackDetection.recommendedProfile : null);
|
|
509
654
|
if (selectedProfile) {
|
|
510
655
|
try {
|
|
511
656
|
const applied = profiles.applyProfile(selectedProfile, process.cwd());
|
|
512
|
-
console.log(`[OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})`);
|
|
657
|
+
if (!flags.json) console.log(`[OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})`);
|
|
513
658
|
} catch (e) {
|
|
514
|
-
|
|
659
|
+
if (flags.json) {
|
|
660
|
+
console.error(JSON.stringify({ success: false, error: `Could not apply profile '${selectedProfile}': ${e.message}` }));
|
|
661
|
+
} else {
|
|
662
|
+
console.error(`[ERROR] Could not apply profile '${selectedProfile}': ${e.message}`);
|
|
663
|
+
}
|
|
664
|
+
process.exit(1);
|
|
515
665
|
}
|
|
516
666
|
}
|
|
517
667
|
|
|
518
|
-
|
|
668
|
+
if (!flags.json) {
|
|
669
|
+
console.log('[OK] Your AI assistant now has skills and rules configured.\n');
|
|
670
|
+
}
|
|
519
671
|
|
|
520
|
-
// ── Auto-compile skills
|
|
672
|
+
// ── Auto-compile skills for target agents ──────────────────────────────────
|
|
521
673
|
if (!flags.skipCompile) {
|
|
522
674
|
const ctxPath = path.join(targetPath, 'ctx.js');
|
|
523
675
|
if (fs.existsSync(ctxPath)) {
|
|
524
|
-
|
|
676
|
+
const { execFileSync } = require('child_process');
|
|
677
|
+
for (const ag of targetAgents) {
|
|
678
|
+
if (!flags.json) console.log(`Compiling skills for ${ag}...`);
|
|
679
|
+
try {
|
|
680
|
+
execFileSync(process.execPath, [ctxPath, 'export', ag], {
|
|
681
|
+
cwd: process.cwd(),
|
|
682
|
+
stdio: flags.json ? 'ignore' : 'inherit',
|
|
683
|
+
});
|
|
684
|
+
} catch (e) {
|
|
685
|
+
if (flags.json) {
|
|
686
|
+
console.error(JSON.stringify({ success: false, error: `Skill compilation for '${ag}' failed` }));
|
|
687
|
+
} else {
|
|
688
|
+
console.error(`[ERROR] Skill compilation for '${ag}' failed — run manually: contextos export ${ag}`);
|
|
689
|
+
}
|
|
690
|
+
process.exit(1);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
} else if (!flags.json) {
|
|
695
|
+
console.log('Tip: Run `contextos export gemini` to compile skills.');
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// ── --add-skill flag ────────────────────────────────────────────────────────
|
|
699
|
+
if (flags.addSkill) {
|
|
700
|
+
const ctxPath = path.join(targetPath, 'ctx.js');
|
|
701
|
+
if (fs.existsSync(ctxPath)) {
|
|
702
|
+
if (!flags.json) console.log(`Installing plugin skill: ${flags.addSkill}`);
|
|
525
703
|
try {
|
|
526
704
|
const { execFileSync } = require('child_process');
|
|
527
|
-
execFileSync(process.execPath, [ctxPath, '
|
|
705
|
+
execFileSync(process.execPath, [ctxPath, 'skill', 'add', flags.addSkill], {
|
|
528
706
|
cwd: process.cwd(),
|
|
529
|
-
stdio: 'inherit',
|
|
707
|
+
stdio: flags.json ? 'ignore' : 'inherit',
|
|
530
708
|
});
|
|
531
709
|
} catch (e) {
|
|
532
|
-
|
|
533
|
-
|
|
710
|
+
if (flags.json) {
|
|
711
|
+
console.error(JSON.stringify({ success: false, error: `Skill install failed for ${flags.addSkill}` }));
|
|
712
|
+
} else {
|
|
713
|
+
console.error(`[ERROR] Skill install failed — run manually: node .agents/ctx.js skill add ${flags.addSkill}`);
|
|
714
|
+
}
|
|
715
|
+
process.exit(1);
|
|
534
716
|
}
|
|
535
717
|
}
|
|
536
|
-
}
|
|
537
|
-
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (flags.json) {
|
|
721
|
+
console.log(JSON.stringify({
|
|
722
|
+
success: true,
|
|
723
|
+
package: 'contextos-agents',
|
|
724
|
+
version,
|
|
725
|
+
projectDir: process.cwd(),
|
|
726
|
+
profile: selectedProfile || 'default',
|
|
727
|
+
agents: targetAgents,
|
|
728
|
+
withMcp: flags.withMcp,
|
|
729
|
+
minimal: flags.minimal,
|
|
730
|
+
}, null, 2));
|
|
731
|
+
process.exit(0);
|
|
538
732
|
}
|
|
539
733
|
|
|
540
734
|
console.log('\n Next steps:');
|
|
@@ -552,32 +746,15 @@ try {
|
|
|
552
746
|
console.log(' 6. Add community skills (plugins):');
|
|
553
747
|
console.log(' contextos skill add username/my-skill');
|
|
554
748
|
console.log(' contextos skill list');
|
|
555
|
-
if (!flags.withMcp) {
|
|
556
|
-
console.log(' 7. Enable MCP parallel subagents & worktrees (optional):');
|
|
557
|
-
console.log(' contextos setup-mcp');
|
|
558
|
-
}
|
|
559
|
-
console.log('');
|
|
560
749
|
|
|
561
|
-
|
|
562
|
-
if (flags.addSkill) {
|
|
563
|
-
const ctxPath = path.join(targetPath, 'ctx.js');
|
|
564
|
-
if (fs.existsSync(ctxPath)) {
|
|
565
|
-
console.log(`Installing plugin skill: ${flags.addSkill}`);
|
|
566
|
-
try {
|
|
567
|
-
const { execFileSync } = require('child_process');
|
|
568
|
-
execFileSync(process.execPath, [ctxPath, 'skill', 'add', flags.addSkill], {
|
|
569
|
-
cwd: process.cwd(),
|
|
570
|
-
stdio: 'inherit',
|
|
571
|
-
});
|
|
572
|
-
} catch (e) {
|
|
573
|
-
console.warn(`[WARN] Skill install failed — run manually:`);
|
|
574
|
-
console.warn(` node .agents/ctx.js skill add ${flags.addSkill}`);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
750
|
+
console.log('');
|
|
578
751
|
|
|
579
752
|
} catch (error) {
|
|
580
|
-
|
|
753
|
+
if (flags.json) {
|
|
754
|
+
console.error(JSON.stringify({ success: false, error: error.message }));
|
|
755
|
+
} else {
|
|
756
|
+
console.error('[ERROR] Installation failed:', error.message);
|
|
757
|
+
}
|
|
581
758
|
process.exit(1);
|
|
582
759
|
}
|
|
583
760
|
|