wyrm-mcp 7.2.0 → 7.2.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/LICENSE +26 -667
- package/NOTICE +14 -33
- package/dist/activation.d.ts.map +1 -1
- package/dist/activation.js +1 -44
- package/dist/activation.js.map +1 -1
- package/dist/agent-daemon.js +4 -281
- package/dist/agent-loop.js +7 -332
- package/dist/analytics.js +13 -236
- package/dist/attribution.js +1 -49
- package/dist/audit.js +2 -457
- package/dist/auto-capture.js +3 -138
- package/dist/auto-orchestrator.js +1 -325
- package/dist/autoconfig.js +39 -840
- package/dist/buddy-runner.js +1 -109
- package/dist/buddy.js +14 -564
- package/dist/build-flags.js +1 -17
- package/dist/capabilities.js +3 -183
- package/dist/capture.js +1 -56
- package/dist/causality.js +6 -107
- package/dist/cli.js +20 -281
- package/dist/cloud/cli.js +5 -541
- package/dist/cloud/client.js +1 -221
- package/dist/cloud/crypto.js +1 -85
- package/dist/cloud/machine-id.js +2 -113
- package/dist/cloud/recovery.js +1 -60
- package/dist/cloud/sync-engine.js +7 -543
- package/dist/cloud-backup.js +5 -579
- package/dist/cloud-profile.js +1 -138
- package/dist/cloud-sync-entrypoint.js +1 -47
- package/dist/cloud-sync.js +2 -309
- package/dist/constellation.js +12 -168
- package/dist/context-build-budgeted.js +4 -144
- package/dist/context-ranking.js +1 -69
- package/dist/crypto.js +1 -179
- package/dist/daemon-write-endpoint.js +1 -290
- package/dist/daemon-writer.js +2 -406
- package/dist/database.js +43 -1110
- package/dist/deprecations.js +2 -162
- package/dist/design.js +13 -141
- package/dist/event-replication.js +1 -112
- package/dist/events-sse.js +7 -43
- package/dist/events.js +6 -238
- package/dist/failure-patterns.js +42 -659
- package/dist/federation.js +12 -236
- package/dist/goals.js +13 -101
- package/dist/golden.js +3 -355
- package/dist/handlers/agent.js +4 -165
- package/dist/handlers/alias-adapters.js +1 -129
- package/dist/handlers/aliases.js +1 -171
- package/dist/handlers/audit.js +1 -87
- package/dist/handlers/boundary.js +1 -221
- package/dist/handlers/capture.js +73 -1109
- package/dist/handlers/causality.js +7 -114
- package/dist/handlers/cloud.js +85 -382
- package/dist/handlers/companion.js +28 -459
- package/dist/handlers/datalake.js +7 -187
- package/dist/handlers/dispatch-context.js +0 -22
- package/dist/handlers/entity.js +25 -256
- package/dist/handlers/events.js +16 -335
- package/dist/handlers/failure.js +13 -340
- package/dist/handlers/goals.js +4 -296
- package/dist/handlers/intelligence.js +126 -674
- package/dist/handlers/invoicing.js +1 -70
- package/dist/handlers/mcpclient.js +6 -137
- package/dist/handlers/orchestration.js +40 -125
- package/dist/handlers/output-schemas.js +1 -24
- package/dist/handlers/presence.js +3 -99
- package/dist/handlers/project.js +28 -182
- package/dist/handlers/prompts.js +6 -157
- package/dist/handlers/quest.js +4 -224
- package/dist/handlers/recall.js +11 -218
- package/dist/handlers/registry.js +1 -167
- package/dist/handlers/resources.js +1 -288
- package/dist/handlers/review.js +11 -74
- package/dist/handlers/run.js +17 -487
- package/dist/handlers/search.js +15 -326
- package/dist/handlers/session.js +28 -615
- package/dist/handlers/share.js +8 -184
- package/dist/handlers/shims.js +1 -464
- package/dist/handlers/skill.js +67 -449
- package/dist/handlers/survivors.js +1 -120
- package/dist/handlers/symbols.js +8 -109
- package/dist/handlers/syncops.js +4 -302
- package/dist/handlers/types.js +1 -27
- package/dist/harvest.js +5 -191
- package/dist/hours.js +7 -156
- package/dist/http-auth.js +3 -321
- package/dist/http-fast.js +21 -1137
- package/dist/icons.js +1 -47
- package/dist/index.js +2 -924
- package/dist/indexer.js +4 -145
- package/dist/intelligence.js +31 -261
- package/dist/internal-dispatch.js +3 -212
- package/dist/keyset.js +1 -110
- package/dist/knowledge-graph.js +12 -176
- package/dist/license.d.ts +11 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +2 -414
- package/dist/license.js.map +1 -1
- package/dist/logger.js +2 -199
- package/dist/maintenance.js +2 -148
- package/dist/mcp-client.js +6 -262
- package/dist/memory-artifacts.js +30 -449
- package/dist/migrate-prompt.js +2 -124
- package/dist/migrations.js +40 -655
- package/dist/performance.js +1 -228
- package/dist/presence.js +11 -140
- package/dist/priority-embed.js +5 -164
- package/dist/providers/embedding-provider.js +1 -196
- package/dist/readonly-gate.js +1 -29
- package/dist/rehydration.js +9 -157
- package/dist/reindex.js +1 -88
- package/dist/render-target.js +21 -514
- package/dist/render.js +4 -280
- package/dist/repl-guard.js +1 -173
- package/dist/replication-daemon-entrypoint.js +1 -31
- package/dist/replication-daemon.js +2 -262
- package/dist/resilience.js +1 -591
- package/dist/reverse-bridge.js +5 -360
- package/dist/security.js +1 -244
- package/dist/session-seen.js +3 -51
- package/dist/setup.js +1 -260
- package/dist/skill-author.js +5 -168
- package/dist/spec-kit.js +1 -191
- package/dist/sqlite-busy.js +1 -154
- package/dist/statusline.js +11 -315
- package/dist/sub-agent.js +13 -262
- package/dist/summarizer.js +13 -139
- package/dist/symbols.js +7 -283
- package/dist/sync.js +5 -359
- package/dist/tasks-dispatch.js +1 -84
- package/dist/tasks.js +1 -282
- package/dist/token-budget.js +1 -143
- package/dist/tool-analytics.js +7 -129
- package/dist/tool-annotations.js +1 -365
- package/dist/tool-manifest-v2.json +1 -1
- package/dist/tool-manifest.json +1 -1
- package/dist/tool-profiles.js +1 -75
- package/dist/trace-harvest.js +6 -244
- package/dist/types.js +1 -30
- package/dist/ui-dashboard.js +41 -50
- package/dist/ulid.js +1 -81
- package/dist/validate.js +1 -129
- package/dist/vault.js +1 -534
- package/dist/vectors.js +3 -184
- package/dist/version-check.js +4 -136
- package/dist/visibility.js +19 -155
- package/dist/wyrm-cli.js +98 -2451
- package/dist/wyrm-cli.js.map +1 -1
- package/dist/wyrm-guard.js +14 -424
- package/dist/wyrm-loop.js +3 -150
- package/dist/wyrm-manifest.json +1 -1
- package/dist/wyrm-statusline-daemon.js +1 -11
- package/dist/wyrm-statusline.js +4 -56
- package/dist/wyrm-ui.js +9 -77
- package/package.json +4 -2
package/dist/session-seen.js
CHANGED
|
@@ -1,59 +1,11 @@
|
|
|
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 AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. 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(`
|
|
1
|
+
class d{db;constructor(e){this.db=e}mark(e,t,s,n){this.db.prepare(`
|
|
19
2
|
INSERT INTO session_seen_artifacts (session_id, artifact_id, artifact_kind, render_mode)
|
|
20
3
|
VALUES (?, ?, ?, ?)
|
|
21
4
|
ON CONFLICT(session_id, artifact_id, artifact_kind)
|
|
22
5
|
DO UPDATE SET shown_at = datetime('now'), render_mode = excluded.render_mode
|
|
23
|
-
`).run(
|
|
24
|
-
}
|
|
25
|
-
/** Bulk-mark inlined artifacts for a session. */
|
|
26
|
-
markBulk(sessionId, items) {
|
|
27
|
-
const stmt = this.db.prepare(`
|
|
6
|
+
`).run(e,t,s,n)}markBulk(e,t){const s=this.db.prepare(`
|
|
28
7
|
INSERT INTO session_seen_artifacts (session_id, artifact_id, artifact_kind, render_mode)
|
|
29
8
|
VALUES (?, ?, ?, ?)
|
|
30
9
|
ON CONFLICT(session_id, artifact_id, artifact_kind)
|
|
31
10
|
DO UPDATE SET shown_at = datetime('now'), render_mode = excluded.render_mode
|
|
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
|
|
11
|
+
`);this.db.transaction(i=>{for(const r of i)s.run(e,r.id,r.kind,r.mode)})(t)}getSeen(e){const t=this.db.prepare("SELECT artifact_id, artifact_kind FROM session_seen_artifacts WHERE session_id = ? AND render_mode = 'inline'").all(e);return new Set(t.map(s=>`${s.artifact_kind}:${s.artifact_id}`))}prune(e=7){return this.db.prepare("DELETE FROM session_seen_artifacts WHERE shown_at < datetime('now', ? || ' days')").run(`-${e}`).changes??0}count(){return this.db.prepare("SELECT COUNT(*) as n FROM session_seen_artifacts").get().n}}export{d as SessionSeen};
|
package/dist/setup.js
CHANGED
|
@@ -1,261 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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 AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. 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
|
|
2
|
+
import{detectClients as m,autoConfigureAll as u,removeFromAll as $,configureSpecific as p,reconfAll as h,getStatusSummary as y,findWyrmServerPath as b,getDefaultDbPath as v,loadWyrmMeta as k}from"./autoconfig.js";import{c as o,icons as r,BANNER as I,MINI_BANNER as i,printError as f,printSection as a}from"./cli.js";function w(s){const e=s.slice(2);if(e.length===0)return{command:"auto"};const n={command:"auto"};for(let l=0;l<e.length;l++)switch(e[l]){case"--check":case"-c":case"check":case"status":n.command="check";break;case"--remove":case"-r":case"remove":case"uninstall":n.command="remove";break;case"--only":case"-o":case"only":n.command="only",e[l+1]&&(n.clientIds=e[l+1].split(",").map(t=>t.trim()),l++);break;case"--reconf":case"--reconfigure":case"reconf":n.command="reconf";break;case"--list":case"-l":case"list":n.command="list";break;case"--server":case"-s":e[l+1]&&(n.serverPath=e[l+1],l++);break;case"--db":case"-d":e[l+1]&&(n.dbPath=e[l+1],l++);break;case"--help":case"-h":case"help":n.command="help";break}return n}function g(s){console.log("");const e=s.filter(c=>c.action==="configured"),n=s.filter(c=>c.action==="updated"),l=s.filter(c=>c.action==="skipped"),t=s.filter(c=>c.action==="failed");for(const c of e)console.log(` ${r.success} ${c.client.icon} ${o.green(c.client.name)} \u2014 ${o.success("configured")}`),c.backup&&console.log(` ${o.dim(`backup \u2192 ${c.backup}`)}`);for(const c of n)console.log(` ${r.sync} ${c.client.icon} ${o.blue(c.client.name)} \u2014 ${o.cyan("updated")}`),c.backup&&console.log(` ${o.dim(`backup \u2192 ${c.backup}`)}`);for(const c of l)console.log(` ${o.dim(` \u25CB ${c.client.icon} ${c.client.name} \u2014 ${c.message}`)}`);for(const c of t)console.log(` ${r.error} ${c.client.icon} ${o.red(c.client.name)} \u2014 ${o.error(c.message)}`);console.log("");const d=e.length+n.length;d>0?(console.log(` ${o.success(`${r.dragon} Wyrm connected to ${d} AI client(s)`)}`),console.log(` ${o.dim("Switch AIs anytime \u2014 run wyrm-setup again to reconnect")}`)):t.length>0?console.log(` ${o.error("Some configurations failed. Check errors above.")}`):console.log(` ${o.dim("No AI clients detected. Install one and try again.")}`),console.log("")}function A(){console.log(i),console.log(""),console.log(`${o.bold("Usage:")} wyrm-setup ${o.dim("[command] [options]")}`),console.log(""),console.log(`${o.bold("Commands:")}`),console.log(` ${o.cyan("(no args)")} Auto-detect and configure all AI clients`),console.log(` ${o.cyan("check")} Show current configuration status`),console.log(` ${o.cyan("list")} List all supported AI clients`),console.log(` ${o.cyan("remove")} Remove Wyrm from all AI clients`),console.log(` ${o.cyan("reconf")} Re-configure previously configured clients`),console.log(` ${o.cyan("only X,Y")} Configure specific clients only`),console.log(` ${o.cyan("help")} Show this help message`),console.log(""),console.log(`${o.bold("Options:")}`),console.log(` ${o.cyan("--server P")} Override Wyrm MCP server path`),console.log(` ${o.cyan("--db P")} Override Wyrm database path`),console.log(""),console.log(`${o.bold("Client IDs:")}`);const s=m();for(const e of s)console.log(` ${e.icon} ${o.cyan(e.id.padEnd(18))} ${e.name}`);console.log(""),console.log(`${o.bold("Examples:")}`),console.log(` wyrm-setup ${o.dim("# Auto-configure everything")}`),console.log(` wyrm-setup check ${o.dim("# See what's configured")}`),console.log(` wyrm-setup only vscode-copilot,cursor ${o.dim("# Only VS Code + Cursor")}`),console.log(` wyrm-setup --server /path/to/wyrm/dist/index.js ${o.dim("# Custom server path")}`),console.log(` wyrm-setup remove ${o.dim("# Remove from all clients")}`),console.log("")}function C(){console.log(i),console.log(""),a("Supported AI Clients"),console.log("");const s=m();for(const e of s){const n=e.detected?e.configured?o.success("\u25CF connected"):o.yellow("\u25D0 available"):o.dim("\u25CB not found"),l=e.version?` ${o.dim(`v${e.version}`)}`:"";console.log(` ${e.icon} ${o.bold(e.name.padEnd(20))} ${o.cyan(e.id.padEnd(18))} ${n}${l}`),console.log(` ${o.dim(`Config: ${e.configPath}`)}`)}console.log("")}async function P(){const s=w(process.argv);switch(s.command){case"help":A();break;case"check":{console.log(i),console.log(""),console.log(y());break}case"list":C();break;case"auto":{console.log(I),a("Auto-Configure"),console.log("");const e=s.serverPath||b(),n=s.dbPath||v();console.log(` ${r.sword} Server: ${o.cyan(e)}`),console.log(` ${r.treasure} DB: ${o.cyan(n)}`),console.log(""),console.log(` ${o.dim("Scanning for AI clients...")}`);const l=u({serverPath:e,dbPath:n});g(l);break}case"only":{(!s.clientIds||s.clientIds.length===0)&&(f("No client IDs specified. Use: wyrm-setup only vscode-copilot,cursor"),process.exit(1)),console.log(i),a(`Configure: ${s.clientIds.join(", ")}`);const e=p(s.clientIds,{serverPath:s.serverPath,dbPath:s.dbPath});g(e);break}case"remove":{console.log(i),a("Remove Wyrm from AI Clients"),console.log(""),console.log(` ${o.warning("Removing Wyrm configuration from all AI clients...")}`);const e=$(),n=e.filter(t=>t.action==="configured"),l=e.filter(t=>t.action==="skipped");for(const t of n)console.log(` ${r.check} ${t.client.icon} ${t.client.name} \u2014 removed`),t.backup&&console.log(` ${o.dim(`backup \u2192 ${t.backup}`)}`);for(const t of l)console.log(` ${o.dim(` \u25CB ${t.client.icon} ${t.client.name} \u2014 ${t.message}`)}`);console.log(""),n.length>0&&console.log(` ${o.success(`Removed from ${n.length} client(s). Run wyrm-setup to reconnect.`)}`),console.log("");break}case"reconf":{console.log(i),a("Re-Configure");const e=k();console.log(e?` ${o.dim(`Restoring config for: ${e.configuredClients.join(", ")}`)}`:` ${o.dim("No previous config found \u2014 running full auto-configure")}`);const n=h();g(n);break}}}P().catch(s=>{f(`Setup failed: ${s}`),process.exit(1)});
|
package/dist/skill-author.js
CHANGED
|
@@ -1,168 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 AGPL-3.0-or-later — dual-licensed; commercial terms: ghosts.lk@proton.me. 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
|
|
1
|
+
import{existsSync as a,mkdirSync as m,writeFileSync as g,readFileSync as d,rmSync as h,statSync as y}from"fs";import{join as s}from"path";import{homedir as p}from"os";import{createHash as S}from"crypto";function u(){return process.env.WYRM_SKILLS_DIR||s(p(),".copilot","skills")}function l(t){return String(t).trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)}const k=6;function C(t){const n=[],e=[],r=l(t.name);(!r||!/^[a-z0-9][a-z0-9-]{1,48}$/.test(r))&&n.push(`name must slugify to kebab-case [a-z0-9-] (got "${t.name}" \u2192 "${r}")`);const o=(t.description||"").trim();o.length<12&&n.push("description too short (< 12 chars) \u2014 needed for discovery/recall"),o.length>280&&n.push("description too long (> 280 chars) \u2014 keep it a one-liner for ranking");const i=(t.body||"").trim();i?/^#{1,2}\s+\S/m.test(i)||e.push("body has no markdown heading \u2014 add a clear title"):n.push("body is empty");const f=(i.match(/^##\s+\S/gm)||[]).length;return f>k&&e.push(`body has ${f} top-level sections \u2014 may not be atomic; consider splitting into smaller skills`),i.length>12e3&&e.push(`body is ${i.length} chars \u2014 atomic skills are usually focused; consider trimming or splitting`),{ok:n.length===0,errors:n,warnings:e,slug:r}}function $(t){const e=["---",`name: ${l(t.name)}`,`description: ${c(t.description.trim())}`];return t.argumentHint&&e.push(`argument-hint: ${c(t.argumentHint)}`),t.userInvocable!==void 0&&e.push(`user-invocable: ${t.userInvocable?"true":"false"}`),t.category&&e.push(`category: ${c(t.category)}`),t.tags&&t.tags.length&&e.push(`tags: [${t.tags.map(r=>c(r)).join(", ")}]`),e.push("---"),`${e.join(`
|
|
2
|
+
`)}
|
|
3
|
+
|
|
4
|
+
${t.body.trim()}
|
|
5
|
+
`}function c(t){const n=String(t);return/^[\w][\w .,/()&'+-]*$/.test(n)&&!/^(true|false|null|yes|no|on|off)$/i.test(n)?n:JSON.stringify(n)}function D(t,n={}){const e=l(t.name);if(!e)throw new Error(`skill name "${t.name}" does not produce a valid slug`);const r=s(n.skillsDir??u(),e),o=s(r,"SKILL.md"),i=a(o);if(i&&!n.force)throw new Error(`skill "${e}" already exists at ${o} (pass force to overwrite)`);return m(r,{recursive:!0}),g(o,$(t),"utf-8"),{slug:e,path:o,action:i?"overwritten":"created"}}function K(t,n={}){const e=l(t);if(!e)return{slug:"",removed:!1};const r=s(n.skillsDir??u(),e);return a(s(r,"SKILL.md"))?(h(r,{recursive:!0,force:!0}),{slug:e,removed:!0}):{slug:e,removed:!1}}function _(t,n={}){const e=s(n.skillsDir??u(),l(t),"SKILL.md");return a(e)?d(e,"utf-8"):null}function v(t){return S("sha256").update(t,"utf-8").digest("hex")}function z(t){const n=[];if(t.skillPath&&n.push(t.skillPath),t.name){const e=l(t.name);e&&n.push(s(t.skillsDir??u(),e,"SKILL.md"))}for(const e of n)try{if(e&&a(e)&&b(e)){const r=d(e,"utf-8");return{content:r,sha256:v(r)}}}catch{}return null}function b(t){try{return y(t).isFile()}catch{return!1}}export{$ as buildSkillMarkdown,D as deploySkill,u as getSkillsDir,_ as readSkill,z as readSkillContent,K as removeSkill,v as skillContentSha,l as slugify,C as validateAtomicSkill};
|