wyrm-mcp 7.3.2 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -18
- package/dist/activation.js +59 -1
- package/dist/agent-daemon.js +281 -4
- package/dist/agent-loop.js +332 -7
- package/dist/analytics.js +236 -13
- package/dist/attribution.js +49 -1
- package/dist/audit.js +457 -2
- package/dist/auto-capture.js +138 -3
- package/dist/auto-orchestrator.js +325 -1
- package/dist/autoconfig.d.ts +51 -0
- package/dist/autoconfig.d.ts.map +1 -1
- package/dist/autoconfig.js +1121 -39
- package/dist/autoconfig.js.map +1 -1
- package/dist/buddy-runner.js +109 -1
- package/dist/buddy.js +564 -14
- package/dist/build-flags.js +15 -1
- package/dist/capabilities.js +183 -3
- package/dist/capture.js +56 -1
- package/dist/causality.js +148 -8
- package/dist/cli.js +281 -20
- package/dist/cloud/cli.js +541 -5
- package/dist/cloud/client.js +221 -1
- package/dist/cloud/crypto.js +85 -1
- package/dist/cloud/machine-id.js +113 -2
- package/dist/cloud/recovery.js +60 -1
- package/dist/cloud/sync-engine.js +543 -7
- package/dist/cloud-backup.js +579 -5
- package/dist/cloud-profile.js +138 -1
- package/dist/cloud-sync-entrypoint.js +47 -1
- package/dist/cloud-sync.js +309 -2
- package/dist/connectors/bridge-source.d.ts +46 -0
- package/dist/connectors/bridge-source.d.ts.map +1 -0
- package/dist/connectors/bridge-source.js +77 -0
- package/dist/connectors/bridge-source.js.map +1 -0
- package/dist/connectors/index.d.ts +24 -0
- package/dist/connectors/index.d.ts.map +1 -0
- package/dist/connectors/index.js +69 -0
- package/dist/connectors/index.js.map +1 -0
- package/dist/connectors/ingest.d.ts +16 -0
- package/dist/connectors/ingest.d.ts.map +1 -0
- package/dist/connectors/ingest.js +116 -0
- package/dist/connectors/ingest.js.map +1 -0
- package/dist/connectors/types.d.ts +99 -0
- package/dist/connectors/types.d.ts.map +1 -0
- package/dist/connectors/types.js +17 -0
- package/dist/connectors/types.js.map +1 -0
- package/dist/constellation.js +168 -12
- package/dist/content-signature.js +45 -1
- package/dist/context-build-budgeted.js +144 -4
- package/dist/context-ranking.js +69 -1
- package/dist/crypto.js +179 -1
- package/dist/daemon-write-endpoint.js +290 -1
- package/dist/daemon-writer.js +406 -2
- package/dist/database.js +1278 -53
- package/dist/deprecations.js +162 -2
- package/dist/design.js +141 -13
- package/dist/event-replication.js +112 -1
- package/dist/events-sse.js +43 -7
- package/dist/events.js +238 -6
- package/dist/failure-patterns.d.ts +107 -0
- package/dist/failure-patterns.d.ts.map +1 -1
- package/dist/failure-patterns.js +924 -43
- package/dist/failure-patterns.js.map +1 -1
- package/dist/federation.js +236 -12
- package/dist/goals.js +101 -13
- package/dist/golden.js +355 -3
- package/dist/handlers/agent.js +165 -4
- package/dist/handlers/alias-adapters.js +129 -1
- package/dist/handlers/aliases.js +171 -1
- package/dist/handlers/audit.js +87 -1
- package/dist/handlers/boundary.js +221 -1
- package/dist/handlers/capture.js +1114 -73
- package/dist/handlers/causality.js +119 -9
- package/dist/handlers/cloud.js +382 -85
- package/dist/handlers/companion.js +459 -28
- package/dist/handlers/datalake.js +187 -7
- package/dist/handlers/dispatch-context.js +22 -0
- package/dist/handlers/entity.js +256 -25
- package/dist/handlers/events.js +335 -16
- package/dist/handlers/failure.d.ts +1 -0
- package/dist/handlers/failure.d.ts.map +1 -1
- package/dist/handlers/failure.js +458 -13
- package/dist/handlers/failure.js.map +1 -1
- package/dist/handlers/goals.js +296 -4
- package/dist/handlers/intelligence.d.ts.map +1 -1
- package/dist/handlers/intelligence.js +690 -126
- package/dist/handlers/intelligence.js.map +1 -1
- package/dist/handlers/invoicing.js +70 -1
- package/dist/handlers/mcpclient.js +137 -6
- package/dist/handlers/orchestration.js +125 -40
- package/dist/handlers/output-schemas.js +24 -1
- package/dist/handlers/presence.js +99 -3
- package/dist/handlers/project.js +182 -28
- package/dist/handlers/prompts.js +157 -6
- package/dist/handlers/quest.js +224 -4
- package/dist/handlers/recall.js +237 -13
- package/dist/handlers/registry.js +167 -1
- package/dist/handlers/resources.js +288 -1
- package/dist/handlers/review.js +74 -11
- package/dist/handlers/run.js +498 -16
- package/dist/handlers/search.js +338 -15
- package/dist/handlers/session.js +643 -31
- package/dist/handlers/share.js +184 -8
- package/dist/handlers/shims.js +464 -1
- package/dist/handlers/skill.js +449 -67
- package/dist/handlers/survivors.js +120 -1
- package/dist/handlers/symbols.js +109 -8
- package/dist/handlers/syncops.js +302 -4
- package/dist/handlers/types.js +27 -1
- package/dist/harvest.js +191 -5
- package/dist/hours.js +156 -7
- package/dist/http-auth.js +321 -3
- package/dist/http-fast.d.ts.map +1 -1
- package/dist/http-fast.js +1308 -22
- package/dist/http-fast.js.map +1 -1
- package/dist/icons.js +47 -1
- package/dist/importers.js +268 -1
- package/dist/index.js +844 -2
- package/dist/index.js.map +1 -1
- package/dist/indexer.js +145 -4
- package/dist/intelligence.d.ts +16 -0
- package/dist/intelligence.d.ts.map +1 -1
- package/dist/intelligence.js +283 -31
- package/dist/intelligence.js.map +1 -1
- package/dist/internal-dispatch.js +212 -3
- package/dist/keyset.js +110 -1
- package/dist/knowledge-graph.js +176 -12
- package/dist/license.js +441 -2
- package/dist/logger.js +199 -2
- package/dist/maintenance.js +148 -2
- package/dist/mcp-client.js +262 -6
- package/dist/memory-artifacts.js +596 -32
- package/dist/migrate-prompt.js +124 -2
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +799 -42
- package/dist/migrations.js.map +1 -1
- package/dist/performance.js +228 -1
- package/dist/presence.js +140 -11
- package/dist/priority-embed.js +164 -5
- package/dist/providers/embedding-provider.js +196 -1
- package/dist/readonly-gate.js +29 -1
- package/dist/receipt.js +43 -1
- package/dist/rehydration.js +157 -9
- package/dist/reindex.js +88 -1
- package/dist/render-target.js +544 -21
- package/dist/render.js +280 -4
- package/dist/repl-guard.js +173 -1
- package/dist/replication-daemon-entrypoint.js +31 -1
- package/dist/replication-daemon.js +262 -2
- package/dist/rerank.js +142 -1
- package/dist/resilience.js +591 -1
- package/dist/reverse-bridge.js +360 -5
- package/dist/security.js +244 -1
- package/dist/session-seen.js +51 -3
- package/dist/setup.js +260 -1
- package/dist/skill-author.js +168 -5
- package/dist/spec-kit.js +191 -1
- package/dist/sqlite-busy.js +154 -1
- package/dist/statusline.js +315 -11
- package/dist/sub-agent.js +262 -13
- package/dist/summarizer.js +139 -13
- package/dist/symbols.js +283 -7
- package/dist/sync.js +359 -5
- package/dist/tasks-dispatch.js +84 -1
- package/dist/tasks.js +282 -1
- package/dist/token-budget.js +143 -1
- package/dist/tool-analytics.js +129 -7
- package/dist/tool-annotations.js +365 -1
- package/dist/tool-manifest-v2.json +1 -1
- package/dist/tool-manifest.json +1 -1
- package/dist/tool-profiles.js +75 -1
- package/dist/trace-harvest.js +244 -6
- package/dist/truth-cascade.d.ts +13 -0
- package/dist/truth-cascade.d.ts.map +1 -0
- package/dist/truth-cascade.js +4 -0
- package/dist/truth-cascade.js.map +1 -0
- package/dist/types.js +30 -1
- package/dist/ui-dashboard.js +50 -41
- package/dist/ulid.js +81 -1
- package/dist/usage-tracker.js +66 -1
- package/dist/validate.js +129 -1
- package/dist/vault.js +534 -1
- package/dist/vector-init.js +67 -1
- package/dist/vectors.js +184 -3
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +145 -4
- package/dist/version-check.js.map +1 -1
- package/dist/visibility.js +155 -19
- package/dist/wyrm-cli.js +2849 -101
- package/dist/wyrm-cli.js.map +1 -1
- package/dist/wyrm-guard.d.ts.map +1 -1
- package/dist/wyrm-guard.js +475 -14
- package/dist/wyrm-guard.js.map +1 -1
- package/dist/wyrm-loop.js +174 -3
- package/dist/wyrm-loop.js.map +1 -1
- package/dist/wyrm-manifest.json +1 -1
- package/dist/wyrm-statusline-daemon.js +11 -1
- package/dist/wyrm-statusline.js +56 -4
- package/dist/wyrm-ui.js +77 -9
- package/package.json +3 -2
package/dist/session-seen.js
CHANGED
|
@@ -1,11 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* session_seen_artifacts helper (spec 014).
|
|
3
|
+
*
|
|
4
|
+
* Tracks which (kind, id) pairs have been fully-rendered to a session so
|
|
5
|
+
* subsequent wyrm_context_build calls within the same session can elide
|
|
6
|
+
* them to stub references. Backed by the migration-12 table.
|
|
7
|
+
*
|
|
8
|
+
* @copyright 2026 Ghost Protocol (Pvt) Ltd.
|
|
9
|
+
* @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
|
|
10
|
+
*/
|
|
11
|
+
export class SessionSeen {
|
|
12
|
+
db;
|
|
13
|
+
constructor(db) {
|
|
14
|
+
this.db = db;
|
|
15
|
+
}
|
|
16
|
+
/** Mark an artifact as shown to the given session. */
|
|
17
|
+
mark(sessionId, artifactId, kind, mode) {
|
|
18
|
+
this.db.prepare(`
|
|
2
19
|
INSERT INTO session_seen_artifacts (session_id, artifact_id, artifact_kind, render_mode)
|
|
3
20
|
VALUES (?, ?, ?, ?)
|
|
4
21
|
ON CONFLICT(session_id, artifact_id, artifact_kind)
|
|
5
22
|
DO UPDATE SET shown_at = datetime('now'), render_mode = excluded.render_mode
|
|
6
|
-
`).run(
|
|
23
|
+
`).run(sessionId, artifactId, kind, mode);
|
|
24
|
+
}
|
|
25
|
+
/** Bulk-mark inlined artifacts for a session. */
|
|
26
|
+
markBulk(sessionId, items) {
|
|
27
|
+
const stmt = this.db.prepare(`
|
|
7
28
|
INSERT INTO session_seen_artifacts (session_id, artifact_id, artifact_kind, render_mode)
|
|
8
29
|
VALUES (?, ?, ?, ?)
|
|
9
30
|
ON CONFLICT(session_id, artifact_id, artifact_kind)
|
|
10
31
|
DO UPDATE SET shown_at = datetime('now'), render_mode = excluded.render_mode
|
|
11
|
-
`);
|
|
32
|
+
`);
|
|
33
|
+
const tx = this.db.transaction((rows) => {
|
|
34
|
+
for (const r of rows)
|
|
35
|
+
stmt.run(sessionId, r.id, r.kind, r.mode);
|
|
36
|
+
});
|
|
37
|
+
tx(items);
|
|
38
|
+
}
|
|
39
|
+
/** Return the set of "kind:id" keys already shown in this session, in inline mode. */
|
|
40
|
+
getSeen(sessionId) {
|
|
41
|
+
const rows = this.db
|
|
42
|
+
.prepare(`SELECT artifact_id, artifact_kind FROM session_seen_artifacts WHERE session_id = ? AND render_mode = 'inline'`)
|
|
43
|
+
.all(sessionId);
|
|
44
|
+
return new Set(rows.map((r) => `${r.artifact_kind}:${r.artifact_id}`));
|
|
45
|
+
}
|
|
46
|
+
/** Prune rows older than `olderThanDays`. Returns the count removed. */
|
|
47
|
+
prune(olderThanDays = 7) {
|
|
48
|
+
const result = this.db
|
|
49
|
+
.prepare(`DELETE FROM session_seen_artifacts WHERE shown_at < datetime('now', ? || ' days')`)
|
|
50
|
+
.run(`-${olderThanDays}`);
|
|
51
|
+
return result.changes ?? 0;
|
|
52
|
+
}
|
|
53
|
+
/** Row count for stats / diagnostics. */
|
|
54
|
+
count() {
|
|
55
|
+
const row = this.db.prepare('SELECT COUNT(*) as n FROM session_seen_artifacts').get();
|
|
56
|
+
return row.n;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=session-seen.js.map
|
package/dist/setup.js
CHANGED
|
@@ -1,2 +1,261 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Wyrm Setup CLI - Auto-configure Wyrm for any AI client
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* wyrm-setup Auto-detect and configure all AI clients
|
|
7
|
+
* wyrm-setup --check Show current configuration status
|
|
8
|
+
* wyrm-setup --remove Remove Wyrm from all AI clients
|
|
9
|
+
* wyrm-setup --only X,Y Configure specific clients only
|
|
10
|
+
* wyrm-setup --server P Override server path
|
|
11
|
+
* wyrm-setup --db P Override database path
|
|
12
|
+
* wyrm-setup --reconf Re-configure previously configured clients
|
|
13
|
+
* wyrm-setup --list List all supported AI clients
|
|
14
|
+
*
|
|
15
|
+
* @copyright 2026 Ghost Protocol (Pvt) Ltd.
|
|
16
|
+
* @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
|
|
17
|
+
* @module setup
|
|
18
|
+
* @version 3.0.0
|
|
19
|
+
*/
|
|
20
|
+
import { detectClients, autoConfigureAll, removeFromAll, configureSpecific, reconfAll, getStatusSummary, findWyrmServerPath, getDefaultDbPath, loadWyrmMeta, } from './autoconfig.js';
|
|
21
|
+
import { c, icons, BANNER, MINI_BANNER, printError, printSection } from './cli.js';
|
|
22
|
+
function parseArgs(argv) {
|
|
23
|
+
const args = argv.slice(2); // Skip node and script path
|
|
24
|
+
if (args.length === 0) {
|
|
25
|
+
return { command: 'auto' };
|
|
26
|
+
}
|
|
27
|
+
const result = { command: 'auto' };
|
|
28
|
+
for (let i = 0; i < args.length; i++) {
|
|
29
|
+
switch (args[i]) {
|
|
30
|
+
case '--check':
|
|
31
|
+
case '-c':
|
|
32
|
+
case 'check':
|
|
33
|
+
case 'status':
|
|
34
|
+
result.command = 'check';
|
|
35
|
+
break;
|
|
36
|
+
case '--remove':
|
|
37
|
+
case '-r':
|
|
38
|
+
case 'remove':
|
|
39
|
+
case 'uninstall':
|
|
40
|
+
result.command = 'remove';
|
|
41
|
+
break;
|
|
42
|
+
case '--only':
|
|
43
|
+
case '-o':
|
|
44
|
+
case 'only':
|
|
45
|
+
result.command = 'only';
|
|
46
|
+
if (args[i + 1]) {
|
|
47
|
+
result.clientIds = args[i + 1].split(',').map(s => s.trim());
|
|
48
|
+
i++;
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case '--reconf':
|
|
52
|
+
case '--reconfigure':
|
|
53
|
+
case 'reconf':
|
|
54
|
+
result.command = 'reconf';
|
|
55
|
+
break;
|
|
56
|
+
case '--list':
|
|
57
|
+
case '-l':
|
|
58
|
+
case 'list':
|
|
59
|
+
result.command = 'list';
|
|
60
|
+
break;
|
|
61
|
+
case '--server':
|
|
62
|
+
case '-s':
|
|
63
|
+
if (args[i + 1]) {
|
|
64
|
+
result.serverPath = args[i + 1];
|
|
65
|
+
i++;
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case '--db':
|
|
69
|
+
case '-d':
|
|
70
|
+
if (args[i + 1]) {
|
|
71
|
+
result.dbPath = args[i + 1];
|
|
72
|
+
i++;
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case '--help':
|
|
76
|
+
case '-h':
|
|
77
|
+
case 'help':
|
|
78
|
+
result.command = 'help';
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
// ==================== OUTPUT ====================
|
|
85
|
+
function printResults(results) {
|
|
86
|
+
console.log('');
|
|
87
|
+
const configured = results.filter(r => r.action === 'configured');
|
|
88
|
+
const updated = results.filter(r => r.action === 'updated');
|
|
89
|
+
const skipped = results.filter(r => r.action === 'skipped');
|
|
90
|
+
const failed = results.filter(r => r.action === 'failed');
|
|
91
|
+
for (const r of configured) {
|
|
92
|
+
console.log(` ${icons.success} ${r.client.icon} ${c.green(r.client.name)} — ${c.success('configured')}`);
|
|
93
|
+
if (r.backup)
|
|
94
|
+
console.log(` ${c.dim(`backup → ${r.backup}`)}`);
|
|
95
|
+
}
|
|
96
|
+
for (const r of updated) {
|
|
97
|
+
console.log(` ${icons.sync} ${r.client.icon} ${c.blue(r.client.name)} — ${c.cyan('updated')}`);
|
|
98
|
+
if (r.backup)
|
|
99
|
+
console.log(` ${c.dim(`backup → ${r.backup}`)}`);
|
|
100
|
+
}
|
|
101
|
+
for (const r of skipped) {
|
|
102
|
+
console.log(` ${c.dim(` ○ ${r.client.icon} ${r.client.name} — ${r.message}`)}`);
|
|
103
|
+
}
|
|
104
|
+
for (const r of failed) {
|
|
105
|
+
console.log(` ${icons.error} ${r.client.icon} ${c.red(r.client.name)} — ${c.error(r.message)}`);
|
|
106
|
+
}
|
|
107
|
+
console.log('');
|
|
108
|
+
const successCount = configured.length + updated.length;
|
|
109
|
+
if (successCount > 0) {
|
|
110
|
+
console.log(` ${c.success(`${icons.dragon} Wyrm connected to ${successCount} AI client(s)`)}`);
|
|
111
|
+
console.log(` ${c.dim('Switch AIs anytime — run wyrm-setup again to reconnect')}`);
|
|
112
|
+
}
|
|
113
|
+
else if (failed.length > 0) {
|
|
114
|
+
console.log(` ${c.error('Some configurations failed. Check errors above.')}`);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
console.log(` ${c.dim('No AI clients detected. Install one and try again.')}`);
|
|
118
|
+
}
|
|
119
|
+
console.log('');
|
|
120
|
+
}
|
|
121
|
+
function printHelp() {
|
|
122
|
+
console.log(MINI_BANNER);
|
|
123
|
+
console.log('');
|
|
124
|
+
console.log(`${c.bold('Usage:')} wyrm-setup ${c.dim('[command] [options]')}`);
|
|
125
|
+
console.log('');
|
|
126
|
+
console.log(`${c.bold('Commands:')}`);
|
|
127
|
+
console.log(` ${c.cyan('(no args)')} Auto-detect and configure all AI clients`);
|
|
128
|
+
console.log(` ${c.cyan('check')} Show current configuration status`);
|
|
129
|
+
console.log(` ${c.cyan('list')} List all supported AI clients`);
|
|
130
|
+
console.log(` ${c.cyan('remove')} Remove Wyrm from all AI clients`);
|
|
131
|
+
console.log(` ${c.cyan('reconf')} Re-configure previously configured clients`);
|
|
132
|
+
console.log(` ${c.cyan('only X,Y')} Configure specific clients only`);
|
|
133
|
+
console.log(` ${c.cyan('help')} Show this help message`);
|
|
134
|
+
console.log('');
|
|
135
|
+
console.log(`${c.bold('Options:')}`);
|
|
136
|
+
console.log(` ${c.cyan('--server P')} Override Wyrm MCP server path`);
|
|
137
|
+
console.log(` ${c.cyan('--db P')} Override Wyrm database path`);
|
|
138
|
+
console.log('');
|
|
139
|
+
console.log(`${c.bold('Client IDs:')}`);
|
|
140
|
+
const clients = detectClients();
|
|
141
|
+
for (const cl of clients) {
|
|
142
|
+
console.log(` ${cl.icon} ${c.cyan(cl.id.padEnd(18))} ${cl.name}`);
|
|
143
|
+
}
|
|
144
|
+
console.log('');
|
|
145
|
+
console.log(`${c.bold('Examples:')}`);
|
|
146
|
+
console.log(` wyrm-setup ${c.dim('# Auto-configure everything')}`);
|
|
147
|
+
console.log(` wyrm-setup check ${c.dim('# See what\'s configured')}`);
|
|
148
|
+
console.log(` wyrm-setup only vscode-copilot,cursor ${c.dim('# Only VS Code + Cursor')}`);
|
|
149
|
+
console.log(` wyrm-setup --server /path/to/wyrm/dist/index.js ${c.dim('# Custom server path')}`);
|
|
150
|
+
console.log(` wyrm-setup remove ${c.dim('# Remove from all clients')}`);
|
|
151
|
+
console.log('');
|
|
152
|
+
}
|
|
153
|
+
function printClientList() {
|
|
154
|
+
console.log(MINI_BANNER);
|
|
155
|
+
console.log('');
|
|
156
|
+
printSection('Supported AI Clients');
|
|
157
|
+
console.log('');
|
|
158
|
+
const clients = detectClients();
|
|
159
|
+
for (const cl of clients) {
|
|
160
|
+
const status = cl.detected
|
|
161
|
+
? cl.configured
|
|
162
|
+
? c.success('● connected')
|
|
163
|
+
: c.yellow('◐ available')
|
|
164
|
+
: c.dim('○ not found');
|
|
165
|
+
const versionStr = cl.version ? ` ${c.dim(`v${cl.version}`)}` : '';
|
|
166
|
+
console.log(` ${cl.icon} ${c.bold(cl.name.padEnd(20))} ${c.cyan(cl.id.padEnd(18))} ${status}${versionStr}`);
|
|
167
|
+
console.log(` ${c.dim(`Config: ${cl.configPath}`)}`);
|
|
168
|
+
}
|
|
169
|
+
console.log('');
|
|
170
|
+
}
|
|
171
|
+
// ==================== MAIN ====================
|
|
172
|
+
async function main() {
|
|
173
|
+
const args = parseArgs(process.argv);
|
|
174
|
+
switch (args.command) {
|
|
175
|
+
case 'help':
|
|
176
|
+
printHelp();
|
|
177
|
+
break;
|
|
178
|
+
case 'check': {
|
|
179
|
+
console.log(MINI_BANNER);
|
|
180
|
+
console.log('');
|
|
181
|
+
console.log(getStatusSummary());
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
case 'list':
|
|
185
|
+
printClientList();
|
|
186
|
+
break;
|
|
187
|
+
case 'auto': {
|
|
188
|
+
console.log(BANNER);
|
|
189
|
+
printSection('Auto-Configure');
|
|
190
|
+
console.log('');
|
|
191
|
+
const serverPath = args.serverPath || findWyrmServerPath();
|
|
192
|
+
const dbPath = args.dbPath || getDefaultDbPath();
|
|
193
|
+
console.log(` ${icons.sword} Server: ${c.cyan(serverPath)}`);
|
|
194
|
+
console.log(` ${icons.treasure} DB: ${c.cyan(dbPath)}`);
|
|
195
|
+
console.log('');
|
|
196
|
+
console.log(` ${c.dim('Scanning for AI clients...')}`);
|
|
197
|
+
const results = autoConfigureAll({
|
|
198
|
+
serverPath,
|
|
199
|
+
dbPath,
|
|
200
|
+
});
|
|
201
|
+
printResults(results);
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
case 'only': {
|
|
205
|
+
if (!args.clientIds || args.clientIds.length === 0) {
|
|
206
|
+
printError('No client IDs specified. Use: wyrm-setup only vscode-copilot,cursor');
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
console.log(MINI_BANNER);
|
|
210
|
+
printSection(`Configure: ${args.clientIds.join(', ')}`);
|
|
211
|
+
const results = configureSpecific(args.clientIds, {
|
|
212
|
+
serverPath: args.serverPath,
|
|
213
|
+
dbPath: args.dbPath,
|
|
214
|
+
});
|
|
215
|
+
printResults(results);
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case 'remove': {
|
|
219
|
+
console.log(MINI_BANNER);
|
|
220
|
+
printSection('Remove Wyrm from AI Clients');
|
|
221
|
+
console.log('');
|
|
222
|
+
console.log(` ${c.warning('Removing Wyrm configuration from all AI clients...')}`);
|
|
223
|
+
const results = removeFromAll();
|
|
224
|
+
const removed = results.filter(r => r.action === 'configured');
|
|
225
|
+
const skipped = results.filter(r => r.action === 'skipped');
|
|
226
|
+
for (const r of removed) {
|
|
227
|
+
console.log(` ${icons.check} ${r.client.icon} ${r.client.name} — removed`);
|
|
228
|
+
if (r.backup)
|
|
229
|
+
console.log(` ${c.dim(`backup → ${r.backup}`)}`);
|
|
230
|
+
}
|
|
231
|
+
for (const r of skipped) {
|
|
232
|
+
console.log(` ${c.dim(` ○ ${r.client.icon} ${r.client.name} — ${r.message}`)}`);
|
|
233
|
+
}
|
|
234
|
+
console.log('');
|
|
235
|
+
if (removed.length > 0) {
|
|
236
|
+
console.log(` ${c.success(`Removed from ${removed.length} client(s). Run wyrm-setup to reconnect.`)}`);
|
|
237
|
+
}
|
|
238
|
+
console.log('');
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'reconf': {
|
|
242
|
+
console.log(MINI_BANNER);
|
|
243
|
+
printSection('Re-Configure');
|
|
244
|
+
const meta = loadWyrmMeta();
|
|
245
|
+
if (meta) {
|
|
246
|
+
console.log(` ${c.dim(`Restoring config for: ${meta.configuredClients.join(', ')}`)}`);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
console.log(` ${c.dim('No previous config found — running full auto-configure')}`);
|
|
250
|
+
}
|
|
251
|
+
const results = reconfAll();
|
|
252
|
+
printResults(results);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
main().catch((err) => {
|
|
258
|
+
printError(`Setup failed: ${err}`);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
});
|
|
261
|
+
//# sourceMappingURL=setup.js.map
|
package/dist/skill-author.js
CHANGED
|
@@ -1,5 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Wyrm Skill Author — clean authoring + deploy pipeline for ATOMIC skills.
|
|
3
|
+
*
|
|
4
|
+
* Wyrm is a memory layer, not an LLM — so the *intelligence* (writing focused,
|
|
5
|
+
* correct skill content) comes from the calling agent. Wyrm's job is to make
|
|
6
|
+
* that deploy CLEAN and ATOMIC: it validates the skill against atomic best
|
|
7
|
+
* practices (one focused capability, discoverable description, proper
|
|
8
|
+
* frontmatter), writes a well-formed `<slug>/SKILL.md`, and registers it so it's
|
|
9
|
+
* immediately discoverable via `wyrm_skill_search`. Idempotent + reversible.
|
|
10
|
+
*
|
|
11
|
+
* "Atomic" = one skill, one responsibility. The validator nudges authors away
|
|
12
|
+
* from kitchen-sink mega-skills toward small composable ones.
|
|
13
|
+
*
|
|
14
|
+
* @copyright 2026 Ghost Protocol (Pvt) Ltd.
|
|
15
|
+
* @license Proprietary — (c) 2026 Ghost Protocol (Pvt) Ltd. All rights reserved. See LICENSE.
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, rmSync, statSync } from 'fs';
|
|
18
|
+
import { join } from 'path';
|
|
19
|
+
import { homedir } from 'os';
|
|
20
|
+
import { createHash } from 'crypto';
|
|
21
|
+
/** Where skills live. Overridable for tests / non-default layouts. */
|
|
22
|
+
export function getSkillsDir() {
|
|
23
|
+
return process.env.WYRM_SKILLS_DIR || join(homedir(), '.copilot', 'skills');
|
|
24
|
+
}
|
|
25
|
+
/** Normalize a free-form name to a kebab-case skill slug. */
|
|
26
|
+
export function slugify(name) {
|
|
27
|
+
return String(name)
|
|
28
|
+
.trim()
|
|
29
|
+
.toLowerCase()
|
|
30
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
31
|
+
.replace(/^-+|-+$/g, '')
|
|
32
|
+
.slice(0, 48);
|
|
33
|
+
}
|
|
34
|
+
const MAX_ATOMIC_SECTIONS = 6; // > this many top-level "## " sections smells non-atomic
|
|
35
|
+
/**
|
|
36
|
+
* Validate a skill against atomic best practices. Errors block deploy; warnings
|
|
37
|
+
* are advisory (e.g. "this looks like more than one skill — consider splitting").
|
|
38
|
+
*/
|
|
39
|
+
export function validateAtomicSkill(spec) {
|
|
40
|
+
const errors = [];
|
|
41
|
+
const warnings = [];
|
|
42
|
+
const slug = slugify(spec.name);
|
|
43
|
+
if (!slug || !/^[a-z0-9][a-z0-9-]{1,48}$/.test(slug)) {
|
|
44
|
+
errors.push(`name must slugify to kebab-case [a-z0-9-] (got "${spec.name}" → "${slug}")`);
|
|
45
|
+
}
|
|
46
|
+
const desc = (spec.description || '').trim();
|
|
47
|
+
if (desc.length < 12)
|
|
48
|
+
errors.push('description too short (< 12 chars) — needed for discovery/recall');
|
|
49
|
+
if (desc.length > 280)
|
|
50
|
+
errors.push('description too long (> 280 chars) — keep it a one-liner for ranking');
|
|
51
|
+
const body = (spec.body || '').trim();
|
|
52
|
+
if (!body)
|
|
53
|
+
errors.push('body is empty');
|
|
54
|
+
else if (!/^#{1,2}\s+\S/m.test(body))
|
|
55
|
+
warnings.push('body has no markdown heading — add a clear title');
|
|
56
|
+
const sectionCount = (body.match(/^##\s+\S/gm) || []).length;
|
|
57
|
+
if (sectionCount > MAX_ATOMIC_SECTIONS) {
|
|
58
|
+
warnings.push(`body has ${sectionCount} top-level sections — may not be atomic; consider splitting into smaller skills`);
|
|
59
|
+
}
|
|
60
|
+
if (body.length > 12_000) {
|
|
61
|
+
warnings.push(`body is ${body.length} chars — atomic skills are usually focused; consider trimming or splitting`);
|
|
62
|
+
}
|
|
63
|
+
return { ok: errors.length === 0, errors, warnings, slug };
|
|
64
|
+
}
|
|
65
|
+
/** Build a well-formed SKILL.md (YAML frontmatter + body) from a spec. */
|
|
66
|
+
export function buildSkillMarkdown(spec) {
|
|
67
|
+
const slug = slugify(spec.name);
|
|
68
|
+
const fm = ['---', `name: ${slug}`, `description: ${escapeYaml(spec.description.trim())}`];
|
|
69
|
+
if (spec.argumentHint)
|
|
70
|
+
fm.push(`argument-hint: ${escapeYaml(spec.argumentHint)}`);
|
|
71
|
+
if (spec.userInvocable !== undefined)
|
|
72
|
+
fm.push(`user-invocable: ${spec.userInvocable ? 'true' : 'false'}`);
|
|
73
|
+
if (spec.category)
|
|
74
|
+
fm.push(`category: ${escapeYaml(spec.category)}`);
|
|
75
|
+
if (spec.tags && spec.tags.length)
|
|
76
|
+
fm.push(`tags: [${spec.tags.map(t => escapeYaml(t)).join(', ')}]`);
|
|
77
|
+
fm.push('---');
|
|
78
|
+
return `${fm.join('\n')}\n\n${spec.body.trim()}\n`;
|
|
79
|
+
}
|
|
80
|
+
/** Quote a YAML scalar only when it could otherwise be mis-parsed. */
|
|
81
|
+
function escapeYaml(v) {
|
|
82
|
+
const s = String(v);
|
|
83
|
+
return /^[\w][\w .,/()&'+-]*$/.test(s) && !/^(true|false|null|yes|no|on|off)$/i.test(s) ? s : JSON.stringify(s);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Write `<skillsDir>/<slug>/SKILL.md`. Refuses to clobber an existing skill
|
|
87
|
+
* unless `force` is set (so a deploy can't silently destroy a hand-edited skill).
|
|
88
|
+
*/
|
|
89
|
+
export function deploySkill(spec, opts = {}) {
|
|
90
|
+
const slug = slugify(spec.name);
|
|
91
|
+
// Guard: an empty slug would resolve to the skills ROOT — never write/operate there.
|
|
92
|
+
if (!slug)
|
|
93
|
+
throw new Error(`skill name "${spec.name}" does not produce a valid slug`);
|
|
94
|
+
const dir = join(opts.skillsDir ?? getSkillsDir(), slug);
|
|
95
|
+
const file = join(dir, 'SKILL.md');
|
|
96
|
+
const existed = existsSync(file);
|
|
97
|
+
if (existed && !opts.force) {
|
|
98
|
+
throw new Error(`skill "${slug}" already exists at ${file} (pass force to overwrite)`);
|
|
99
|
+
}
|
|
100
|
+
mkdirSync(dir, { recursive: true });
|
|
101
|
+
writeFileSync(file, buildSkillMarkdown(spec), 'utf-8');
|
|
102
|
+
return { slug, path: file, action: existed ? 'overwritten' : 'created' };
|
|
103
|
+
}
|
|
104
|
+
/** Remove a deployed skill's directory. Reversible counterpart to deploySkill. */
|
|
105
|
+
export function removeSkill(name, opts = {}) {
|
|
106
|
+
const slug = slugify(name);
|
|
107
|
+
// Guard: an empty slug → join(skillsDir, '') === the skills ROOT. rmSync there
|
|
108
|
+
// would wipe EVERY skill. Refuse outright.
|
|
109
|
+
if (!slug)
|
|
110
|
+
return { slug: '', removed: false };
|
|
111
|
+
const dir = join(opts.skillsDir ?? getSkillsDir(), slug);
|
|
112
|
+
if (!existsSync(join(dir, 'SKILL.md')))
|
|
113
|
+
return { slug, removed: false };
|
|
114
|
+
rmSync(dir, { recursive: true, force: true });
|
|
115
|
+
return { slug, removed: true };
|
|
116
|
+
}
|
|
117
|
+
/** Read back a deployed skill's raw markdown (for verification). */
|
|
118
|
+
export function readSkill(name, opts = {}) {
|
|
119
|
+
const file = join(opts.skillsDir ?? getSkillsDir(), slugify(name), 'SKILL.md');
|
|
120
|
+
return existsSync(file) ? readFileSync(file, 'utf-8') : null;
|
|
121
|
+
}
|
|
122
|
+
/** Hex sha256 of a skill body — the idempotency/dedup key for content sync. */
|
|
123
|
+
export function skillContentSha(content) {
|
|
124
|
+
return createHash('sha256').update(content, 'utf-8').digest('hex');
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Read a skill's SKILL.md body for registry storage (migration 25).
|
|
128
|
+
*
|
|
129
|
+
* Resolution order:
|
|
130
|
+
* 1. an explicit `skill_path` (the column the registry already stores) when
|
|
131
|
+
* it points at a readable file;
|
|
132
|
+
* 2. fallback `<skillsDir>/<slug>/SKILL.md`.
|
|
133
|
+
*
|
|
134
|
+
* Returns NULL on any unreadable/missing file — callers must NEVER fail a
|
|
135
|
+
* registration or a backfill because the file is gone (the row stays content-
|
|
136
|
+
* NULL and the operator can re-backfill later). All filesystem errors are
|
|
137
|
+
* swallowed; this is a best-effort read.
|
|
138
|
+
*/
|
|
139
|
+
export function readSkillContent(opts) {
|
|
140
|
+
const candidates = [];
|
|
141
|
+
if (opts.skillPath)
|
|
142
|
+
candidates.push(opts.skillPath);
|
|
143
|
+
if (opts.name) {
|
|
144
|
+
const slug = slugify(opts.name);
|
|
145
|
+
if (slug)
|
|
146
|
+
candidates.push(join(opts.skillsDir ?? getSkillsDir(), slug, 'SKILL.md'));
|
|
147
|
+
}
|
|
148
|
+
for (const file of candidates) {
|
|
149
|
+
try {
|
|
150
|
+
if (file && existsSync(file) && statIsFile(file)) {
|
|
151
|
+
const content = readFileSync(file, 'utf-8');
|
|
152
|
+
return { content, sha256: skillContentSha(content) };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch { /* best-effort: try the next candidate */ }
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
/** True when `path` exists and is a regular file (not a dir). */
|
|
160
|
+
function statIsFile(path) {
|
|
161
|
+
try {
|
|
162
|
+
return statSync(path).isFile();
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=skill-author.js.map
|