auden 0.1.0-alpha.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 +21 -0
- package/README.md +59 -0
- package/dist/auden-paths.d.ts +8 -0
- package/dist/auden-paths.d.ts.map +1 -0
- package/dist/auden-paths.js +10 -0
- package/dist/auden-paths.js.map +1 -0
- package/dist/bin.d.ts +11 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk.d.ts +3 -0
- package/dist/chunk.d.ts.map +1 -0
- package/dist/chunk.js +13 -0
- package/dist/chunk.js.map +1 -0
- package/dist/commands/doctor.d.ts +13 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +125 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/eval/index.d.ts +2 -0
- package/dist/commands/eval/index.d.ts.map +1 -0
- package/dist/commands/eval/index.js +2 -0
- package/dist/commands/eval/index.js.map +1 -0
- package/dist/commands/eval/run.d.ts +38 -0
- package/dist/commands/eval/run.d.ts.map +1 -0
- package/dist/commands/eval/run.js +179 -0
- package/dist/commands/eval/run.js.map +1 -0
- package/dist/commands/guides/active.d.ts +2 -0
- package/dist/commands/guides/active.d.ts.map +1 -0
- package/dist/commands/guides/active.js +38 -0
- package/dist/commands/guides/active.js.map +1 -0
- package/dist/commands/guides/index.d.ts +2 -0
- package/dist/commands/guides/index.d.ts.map +1 -0
- package/dist/commands/guides/index.js +13 -0
- package/dist/commands/guides/index.js.map +1 -0
- package/dist/commands/guides/project.d.ts +13 -0
- package/dist/commands/guides/project.d.ts.map +1 -0
- package/dist/commands/guides/project.js +71 -0
- package/dist/commands/guides/project.js.map +1 -0
- package/dist/commands/guides/search.d.ts +8 -0
- package/dist/commands/guides/search.d.ts.map +1 -0
- package/dist/commands/guides/search.js +46 -0
- package/dist/commands/guides/search.js.map +1 -0
- package/dist/commands/init.d.ts +43 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +436 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +55 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/pull.d.ts +38 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +127 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/rules/export.d.ts +140 -0
- package/dist/commands/rules/export.d.ts.map +1 -0
- package/dist/commands/rules/export.js +635 -0
- package/dist/commands/rules/export.js.map +1 -0
- package/dist/commands/rules/import.d.ts +33 -0
- package/dist/commands/rules/import.d.ts.map +1 -0
- package/dist/commands/rules/import.js +122 -0
- package/dist/commands/rules/import.js.map +1 -0
- package/dist/commands/rules/index.d.ts +2 -0
- package/dist/commands/rules/index.d.ts.map +1 -0
- package/dist/commands/rules/index.js +13 -0
- package/dist/commands/rules/index.js.map +1 -0
- package/dist/commands/rules/watch.d.ts +43 -0
- package/dist/commands/rules/watch.d.ts.map +1 -0
- package/dist/commands/rules/watch.js +125 -0
- package/dist/commands/rules/watch.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +61 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/suggest.d.ts +8 -0
- package/dist/commands/suggest.d.ts.map +1 -0
- package/dist/commands/suggest.js +43 -0
- package/dist/commands/suggest.js.map +1 -0
- package/dist/commands/sync.d.ts +23 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +193 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/verdict/index.d.ts +2 -0
- package/dist/commands/verdict/index.d.ts.map +1 -0
- package/dist/commands/verdict/index.js +11 -0
- package/dist/commands/verdict/index.js.map +1 -0
- package/dist/commands/verdict/record.d.ts +18 -0
- package/dist/commands/verdict/record.d.ts.map +1 -0
- package/dist/commands/verdict/record.js +60 -0
- package/dist/commands/verdict/record.js.map +1 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +246 -0
- package/dist/config.js.map +1 -0
- package/dist/context/pull.d.ts +40 -0
- package/dist/context/pull.d.ts.map +1 -0
- package/dist/context/pull.js +46 -0
- package/dist/context/pull.js.map +1 -0
- package/dist/dashboard-health.d.ts +20 -0
- package/dist/dashboard-health.d.ts.map +1 -0
- package/dist/dashboard-health.js +24 -0
- package/dist/dashboard-health.js.map +1 -0
- package/dist/eval-provider.d.ts +30 -0
- package/dist/eval-provider.d.ts.map +1 -0
- package/dist/eval-provider.js +359 -0
- package/dist/eval-provider.js.map +1 -0
- package/dist/eval-summary.d.ts +24 -0
- package/dist/eval-summary.d.ts.map +1 -0
- package/dist/eval-summary.js +30 -0
- package/dist/eval-summary.js.map +1 -0
- package/dist/feedback/extract.d.ts +6 -0
- package/dist/feedback/extract.d.ts.map +1 -0
- package/dist/feedback/extract.js +580 -0
- package/dist/feedback/extract.js.map +1 -0
- package/dist/http-retry.d.ts +23 -0
- package/dist/http-retry.d.ts.map +1 -0
- package/dist/http-retry.js +54 -0
- package/dist/http-retry.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +70 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +121 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/scope.d.ts +30 -0
- package/dist/mcp/scope.d.ts.map +1 -0
- package/dist/mcp/scope.js +64 -0
- package/dist/mcp/scope.js.map +1 -0
- package/dist/mcp/server.d.ts +57 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +427 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/write-items.d.ts +34 -0
- package/dist/mcp/write-items.d.ts.map +1 -0
- package/dist/mcp/write-items.js +59 -0
- package/dist/mcp/write-items.js.map +1 -0
- package/dist/rules/deletions-client.d.ts +16 -0
- package/dist/rules/deletions-client.d.ts.map +1 -0
- package/dist/rules/deletions-client.js +40 -0
- package/dist/rules/deletions-client.js.map +1 -0
- package/dist/rules/diff.d.ts +19 -0
- package/dist/rules/diff.d.ts.map +1 -0
- package/dist/rules/diff.js +36 -0
- package/dist/rules/diff.js.map +1 -0
- package/dist/rules/discover.d.ts +81 -0
- package/dist/rules/discover.d.ts.map +1 -0
- package/dist/rules/discover.js +307 -0
- package/dist/rules/discover.js.map +1 -0
- package/dist/rules/file-origin.d.ts +16 -0
- package/dist/rules/file-origin.d.ts.map +1 -0
- package/dist/rules/file-origin.js +31 -0
- package/dist/rules/file-origin.js.map +1 -0
- package/dist/rules/global-flag.d.ts +12 -0
- package/dist/rules/global-flag.d.ts.map +1 -0
- package/dist/rules/global-flag.js +15 -0
- package/dist/rules/global-flag.js.map +1 -0
- package/dist/rules/import-client.d.ts +37 -0
- package/dist/rules/import-client.d.ts.map +1 -0
- package/dist/rules/import-client.js +98 -0
- package/dist/rules/import-client.js.map +1 -0
- package/dist/rules/init-pull.d.ts +34 -0
- package/dist/rules/init-pull.d.ts.map +1 -0
- package/dist/rules/init-pull.js +43 -0
- package/dist/rules/init-pull.js.map +1 -0
- package/dist/rules/member-files-client.d.ts +17 -0
- package/dist/rules/member-files-client.d.ts.map +1 -0
- package/dist/rules/member-files-client.js +29 -0
- package/dist/rules/member-files-client.js.map +1 -0
- package/dist/rules/path-contains.d.ts +9 -0
- package/dist/rules/path-contains.d.ts.map +1 -0
- package/dist/rules/path-contains.js +17 -0
- package/dist/rules/path-contains.js.map +1 -0
- package/dist/rules/payload.d.ts +13 -0
- package/dist/rules/payload.d.ts.map +1 -0
- package/dist/rules/payload.js +35 -0
- package/dist/rules/payload.js.map +1 -0
- package/dist/rules/pull-bundle.d.ts +13 -0
- package/dist/rules/pull-bundle.d.ts.map +1 -0
- package/dist/rules/pull-bundle.js +32 -0
- package/dist/rules/pull-bundle.js.map +1 -0
- package/dist/rules/watch.d.ts +121 -0
- package/dist/rules/watch.d.ts.map +1 -0
- package/dist/rules/watch.js +457 -0
- package/dist/rules/watch.js.map +1 -0
- package/dist/skill-template.d.ts +19 -0
- package/dist/skill-template.d.ts.map +1 -0
- package/dist/skill-template.js +174 -0
- package/dist/skill-template.js.map +1 -0
- package/dist/sync-batches.d.ts +37 -0
- package/dist/sync-batches.d.ts.map +1 -0
- package/dist/sync-batches.js +67 -0
- package/dist/sync-batches.js.map +1 -0
- package/dist/sync-client.d.ts +22 -0
- package/dist/sync-client.d.ts.map +1 -0
- package/dist/sync-client.js +38 -0
- package/dist/sync-client.js.map +1 -0
- package/dist/sync-response.d.ts +23 -0
- package/dist/sync-response.d.ts.map +1 -0
- package/dist/sync-response.js +22 -0
- package/dist/sync-response.js.map +1 -0
- package/dist/token-verify.d.ts +14 -0
- package/dist/token-verify.d.ts.map +1 -0
- package/dist/token-verify.js +30 -0
- package/dist/token-verify.js.map +1 -0
- package/dist/usage/extract.d.ts +31 -0
- package/dist/usage/extract.d.ts.map +1 -0
- package/dist/usage/extract.js +200 -0
- package/dist/usage/extract.js.map +1 -0
- package/dist/usage/providers.d.ts +8 -0
- package/dist/usage/providers.d.ts.map +1 -0
- package/dist/usage/providers.js +23 -0
- package/dist/usage/providers.js.map +1 -0
- package/dist/verdict-queue.d.ts +50 -0
- package/dist/verdict-queue.d.ts.map +1 -0
- package/dist/verdict-queue.js +131 -0
- package/dist/verdict-queue.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { watch as fsWatch } from 'node:fs';
|
|
3
|
+
import { lstat, readFile, stat } from 'node:fs/promises';
|
|
4
|
+
import { homedir as osHomedir } from 'node:os';
|
|
5
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
6
|
+
import { detectFormat, isSkillMemberPath } from '@auden.to/projections';
|
|
7
|
+
import { rescanSkill } from './discover.js';
|
|
8
|
+
import { isPathWithin } from './path-contains.js';
|
|
9
|
+
import { buildRulePayload } from './payload.js';
|
|
10
|
+
function sha256(content) {
|
|
11
|
+
return createHash('sha256').update(content, 'utf8').digest('hex');
|
|
12
|
+
}
|
|
13
|
+
/** Fingerprint of just a skill's member set (paths + hashes, skipped list). */
|
|
14
|
+
function memberSetSignature(file) {
|
|
15
|
+
if (!file.members)
|
|
16
|
+
return `withheld:${file.membersSkipped ?? 0}`;
|
|
17
|
+
const members = file.members
|
|
18
|
+
.map((member) => `${member.path}:${member.contentHash}`)
|
|
19
|
+
.sort()
|
|
20
|
+
.join('\n');
|
|
21
|
+
const skipped = (file.membersSkippedPaths ?? []).slice().sort().join(',');
|
|
22
|
+
return `members=${members}||skipped=${skipped}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Stable fingerprint of everything a skill's re-sync payload carries — the
|
|
26
|
+
* SKILL.md body plus its member set. `rules watch` always re-sends a skill's
|
|
27
|
+
* whole authoritative member list, so this covers both a SKILL.md edit and a
|
|
28
|
+
* member edit and lets a touched-but-unchanged event (or a redundant re-scan
|
|
29
|
+
* queued behind an identical one) skip the network call.
|
|
30
|
+
*/
|
|
31
|
+
function skillSyncSignature(file) {
|
|
32
|
+
return `${file.contentHash}::${memberSetSignature(file)}`;
|
|
33
|
+
}
|
|
34
|
+
async function defaultReadFile(absolutePath) {
|
|
35
|
+
try {
|
|
36
|
+
// lstat (not stat): a watched path that is itself a symlink (e.g.
|
|
37
|
+
// .agents/sneaky -> ~/.ssh/id_rsa) must not be followed, read, and synced
|
|
38
|
+
// to the dashboard.
|
|
39
|
+
const info = await lstat(absolutePath);
|
|
40
|
+
if (!info.isFile())
|
|
41
|
+
return null;
|
|
42
|
+
const raw = await readFile(absolutePath, 'utf8');
|
|
43
|
+
return { rawContent: raw, lastModified: Math.floor(info.mtimeMs) };
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Stateful engine that turns raw fs events into batched import/delete calls.
|
|
51
|
+
* Exposed so tests can drive it deterministically.
|
|
52
|
+
*
|
|
53
|
+
* Per-path debouncing collapses editor save bursts. A deletion is only
|
|
54
|
+
* reported after `deleteStabilityMs` confirms the file is still gone — this
|
|
55
|
+
* lets atomic delete-then-create saves resolve as a change instead.
|
|
56
|
+
*/
|
|
57
|
+
export class RuleWatchEngine {
|
|
58
|
+
allowedRoots;
|
|
59
|
+
source;
|
|
60
|
+
debounceMs;
|
|
61
|
+
deleteStabilityMs;
|
|
62
|
+
sendImports;
|
|
63
|
+
sendDeletions;
|
|
64
|
+
log;
|
|
65
|
+
readFileImpl;
|
|
66
|
+
rescanSkillImpl;
|
|
67
|
+
known = new Map();
|
|
68
|
+
pending = new Map();
|
|
69
|
+
// Tracks the stability-window timer per path so shutdown (or a fresh event)
|
|
70
|
+
// can cancel it before it fires. Without this a Ctrl+C during the window
|
|
71
|
+
// could still POST a deletion after the engine reported "stopped".
|
|
72
|
+
deletionTimers = new Map();
|
|
73
|
+
// Per-skill (keyed by the SKILL.md absolute path) tail of the re-sync chain.
|
|
74
|
+
// Every skill re-sync appends here so concurrent triggers for the same skill
|
|
75
|
+
// run one-at-a-time — each re-scan sees the previous POST's outcome, so a
|
|
76
|
+
// slower earlier snapshot can't land after a newer one and revert it.
|
|
77
|
+
skillChains = new Map();
|
|
78
|
+
stop = null;
|
|
79
|
+
stopped = false;
|
|
80
|
+
constructor(options) {
|
|
81
|
+
this.allowedRoots = (options.allowedRoots ?? [options.cwd]).map((r) => resolve(r));
|
|
82
|
+
this.source = options.source;
|
|
83
|
+
this.debounceMs = options.debounceMs;
|
|
84
|
+
this.deleteStabilityMs = options.deleteStabilityMs;
|
|
85
|
+
this.log = options.log ?? ((line) => console.log(line));
|
|
86
|
+
this.readFileImpl = options.readFileImpl ?? defaultReadFile;
|
|
87
|
+
this.rescanSkillImpl = options.rescanSkillImpl ?? rescanSkill;
|
|
88
|
+
this.sendImports =
|
|
89
|
+
options.sendImports ??
|
|
90
|
+
(async () => {
|
|
91
|
+
throw new Error('sendImports not configured');
|
|
92
|
+
});
|
|
93
|
+
this.sendDeletions =
|
|
94
|
+
options.sendDeletions ??
|
|
95
|
+
(async () => {
|
|
96
|
+
throw new Error('sendDeletions not configured');
|
|
97
|
+
});
|
|
98
|
+
for (const file of options.initial) {
|
|
99
|
+
this.known.set(file.absolutePath, {
|
|
100
|
+
absolutePath: file.absolutePath,
|
|
101
|
+
payloadPath: file.payloadPath,
|
|
102
|
+
displayPath: file.displayPath,
|
|
103
|
+
format: file.format,
|
|
104
|
+
contentHash: file.contentHash,
|
|
105
|
+
// Seed the skill fingerprint from the initial scan so a later event
|
|
106
|
+
// that leaves body + members unchanged skips a redundant re-sync.
|
|
107
|
+
// Spread (not assign undefined) to satisfy exactOptionalPropertyTypes.
|
|
108
|
+
...(file.format === 'skill-md'
|
|
109
|
+
? { syncSignature: skillSyncSignature(file) }
|
|
110
|
+
: {}),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
start() {
|
|
115
|
+
if (this.stop)
|
|
116
|
+
return;
|
|
117
|
+
this.stop = this.source.start((event) => this.onEvent(event));
|
|
118
|
+
}
|
|
119
|
+
async shutdown() {
|
|
120
|
+
this.stopped = true;
|
|
121
|
+
for (const timer of this.pending.values())
|
|
122
|
+
clearTimeout(timer);
|
|
123
|
+
this.pending.clear();
|
|
124
|
+
for (const timer of this.deletionTimers.values())
|
|
125
|
+
clearTimeout(timer);
|
|
126
|
+
this.deletionTimers.clear();
|
|
127
|
+
// Drop references to in-flight re-sync chains; queued `doResyncSkill` calls
|
|
128
|
+
// already no-op on the `stopped` flag set above.
|
|
129
|
+
this.skillChains.clear();
|
|
130
|
+
if (!this.stop)
|
|
131
|
+
return;
|
|
132
|
+
const stop = this.stop;
|
|
133
|
+
this.stop = null;
|
|
134
|
+
await stop();
|
|
135
|
+
}
|
|
136
|
+
/** @internal — test helper to drive an event without going through the source. */
|
|
137
|
+
injectEvent(event) {
|
|
138
|
+
this.onEvent(event);
|
|
139
|
+
}
|
|
140
|
+
/** @internal — test helper to flush a pending debounce immediately. */
|
|
141
|
+
async flush(absolutePath) {
|
|
142
|
+
const timer = this.pending.get(absolutePath);
|
|
143
|
+
if (!timer)
|
|
144
|
+
return;
|
|
145
|
+
clearTimeout(timer);
|
|
146
|
+
this.pending.delete(absolutePath);
|
|
147
|
+
await this.process(absolutePath);
|
|
148
|
+
}
|
|
149
|
+
onEvent(event) {
|
|
150
|
+
if (this.stopped)
|
|
151
|
+
return;
|
|
152
|
+
const abs = resolve(event.absolutePath);
|
|
153
|
+
const accepted = this.known.has(abs) || this.allowedRoots.some((root) => isPathWithin(root, abs));
|
|
154
|
+
if (!accepted)
|
|
155
|
+
return;
|
|
156
|
+
// A fresh event invalidates any in-flight deletion stability window for
|
|
157
|
+
// the same path — the file is clearly being touched again.
|
|
158
|
+
const pendingDelete = this.deletionTimers.get(abs);
|
|
159
|
+
if (pendingDelete) {
|
|
160
|
+
clearTimeout(pendingDelete);
|
|
161
|
+
this.deletionTimers.delete(abs);
|
|
162
|
+
}
|
|
163
|
+
const existing = this.pending.get(abs);
|
|
164
|
+
if (existing)
|
|
165
|
+
clearTimeout(existing);
|
|
166
|
+
const timer = setTimeout(() => {
|
|
167
|
+
this.pending.delete(abs);
|
|
168
|
+
void this.process(abs).catch((err) => {
|
|
169
|
+
this.log(` watch error on ${abs}: ${err instanceof Error ? err.message : err}`);
|
|
170
|
+
});
|
|
171
|
+
}, this.debounceMs);
|
|
172
|
+
this.pending.set(abs, timer);
|
|
173
|
+
}
|
|
174
|
+
async process(absolutePath) {
|
|
175
|
+
if (this.stopped)
|
|
176
|
+
return;
|
|
177
|
+
// Skill member content (scripts/references/assets) never imports on its
|
|
178
|
+
// own — a member add/edit/delete re-syncs the whole owning skill so the
|
|
179
|
+
// server's authoritative member list stays complete. Route these before
|
|
180
|
+
// the single-file path below, which only understands top-level guide
|
|
181
|
+
// files. A member with no tracked owning skill (its SKILL.md hasn't synced
|
|
182
|
+
// yet) is dropped here; the SKILL.md's own event re-scans members on
|
|
183
|
+
// arrival (see the skill-md branch below), so the skill still lands whole.
|
|
184
|
+
if (!this.known.has(absolutePath) && isSkillMemberPath(absolutePath)) {
|
|
185
|
+
const owner = this.findOwningSkill(absolutePath);
|
|
186
|
+
if (owner)
|
|
187
|
+
await this.resyncSkill(owner);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const file = await this.readFileImpl(absolutePath);
|
|
191
|
+
const known = this.known.get(absolutePath);
|
|
192
|
+
if (!file) {
|
|
193
|
+
// File missing right now. If we already knew about it, schedule a
|
|
194
|
+
// deletion after the stability window — but skip if a fresh event comes
|
|
195
|
+
// in for the same path first (handled by re-entering process via the
|
|
196
|
+
// debounce timer).
|
|
197
|
+
if (!known)
|
|
198
|
+
return;
|
|
199
|
+
this.scheduleDeletion(known);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// File present — either fresh discovery or content change. Compute format
|
|
203
|
+
// if we didn't know about it yet.
|
|
204
|
+
let format = known?.format;
|
|
205
|
+
let payloadPath = known?.payloadPath;
|
|
206
|
+
let displayPath = known?.displayPath;
|
|
207
|
+
if (!format || !payloadPath || !displayPath) {
|
|
208
|
+
const detected = detectFormat(absolutePath);
|
|
209
|
+
if (!detected) {
|
|
210
|
+
// Watched root surfaced a file we don't understand — ignore silently.
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
format = detected;
|
|
214
|
+
const root = this.allowedRoots.find((r) => isPathWithin(r, absolutePath));
|
|
215
|
+
const rel = root ? relative(root, absolutePath).replaceAll('\\', '/') : absolutePath;
|
|
216
|
+
payloadPath = rel;
|
|
217
|
+
displayPath = rel;
|
|
218
|
+
}
|
|
219
|
+
// A SKILL.md event syncs the skill *whole* — body plus its authoritative
|
|
220
|
+
// member set — exactly like the initial discovery scan. This is what makes
|
|
221
|
+
// a freshly-created (or bulk-copied) skill import its supporting files, not
|
|
222
|
+
// just the SKILL.md, without waiting for a later member edit. Register the
|
|
223
|
+
// skill so member events can find their owner, then hand off to the
|
|
224
|
+
// serialized re-sync (which dedups an unchanged body + member set).
|
|
225
|
+
if (format === 'skill-md') {
|
|
226
|
+
const skill = this.known.get(absolutePath);
|
|
227
|
+
if (!skill) {
|
|
228
|
+
this.known.set(absolutePath, {
|
|
229
|
+
absolutePath,
|
|
230
|
+
payloadPath,
|
|
231
|
+
displayPath,
|
|
232
|
+
format,
|
|
233
|
+
contentHash: null,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
await this.resyncSkill(this.known.get(absolutePath));
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const contentHash = sha256(file.rawContent);
|
|
240
|
+
if (known && known.contentHash === contentHash) {
|
|
241
|
+
// No-op: same bytes (e.g. touch without edit).
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const payload = buildRulePayload({
|
|
245
|
+
absolutePath,
|
|
246
|
+
payloadPath,
|
|
247
|
+
displayPath,
|
|
248
|
+
format,
|
|
249
|
+
rawContent: file.rawContent,
|
|
250
|
+
lastModified: file.lastModified,
|
|
251
|
+
contentHash,
|
|
252
|
+
});
|
|
253
|
+
try {
|
|
254
|
+
await this.sendImports([payload]);
|
|
255
|
+
this.known.set(absolutePath, {
|
|
256
|
+
absolutePath,
|
|
257
|
+
payloadPath,
|
|
258
|
+
displayPath,
|
|
259
|
+
format,
|
|
260
|
+
contentHash,
|
|
261
|
+
});
|
|
262
|
+
this.log(` synced ${displayPath} (${contentHash.slice(0, 12)})`);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
this.log(` failed to sync ${displayPath}: ${err instanceof Error ? err.message : err}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Find the tracked SKILL.md whose directory most tightly contains
|
|
270
|
+
* `absolutePath` — the skill a changed member file belongs to. Longest
|
|
271
|
+
* match wins so a nested skill owns its own subtree.
|
|
272
|
+
*/
|
|
273
|
+
findOwningSkill(absolutePath) {
|
|
274
|
+
let best;
|
|
275
|
+
let bestLen = -1;
|
|
276
|
+
for (const file of this.known.values()) {
|
|
277
|
+
if (file.format !== 'skill-md')
|
|
278
|
+
continue;
|
|
279
|
+
const skillDir = dirname(file.absolutePath);
|
|
280
|
+
if (isPathWithin(skillDir, absolutePath) && skillDir.length > bestLen) {
|
|
281
|
+
best = file;
|
|
282
|
+
bestLen = skillDir.length;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return best;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Re-scan a skill's directory and re-send its SKILL.md payload with a fresh
|
|
289
|
+
* members array, serialized per owning skill. The server treats that array as
|
|
290
|
+
* the complete member set, so a member (or SKILL.md) add/edit/delete
|
|
291
|
+
* propagates by re-sending the whole skill. Chaining on `skillChains` keeps
|
|
292
|
+
* two near-simultaneous events for the same skill from POSTing concurrently —
|
|
293
|
+
* an earlier, staler snapshot must not land after a newer one and revert it.
|
|
294
|
+
*/
|
|
295
|
+
resyncSkill(skill) {
|
|
296
|
+
const prev = this.skillChains.get(skill.absolutePath) ?? Promise.resolve();
|
|
297
|
+
const next = prev.then(() => this.doResyncSkill(skill));
|
|
298
|
+
// Store a non-rejecting tail so one failed sync doesn't wedge the chain,
|
|
299
|
+
// while callers still await the real (possibly rejecting) `next`.
|
|
300
|
+
this.skillChains.set(skill.absolutePath, next.catch(() => { }));
|
|
301
|
+
return next;
|
|
302
|
+
}
|
|
303
|
+
async doResyncSkill(skill) {
|
|
304
|
+
if (this.stopped)
|
|
305
|
+
return;
|
|
306
|
+
const discovered = await this.rescanSkillImpl({
|
|
307
|
+
skillMdAbsolutePath: skill.absolutePath,
|
|
308
|
+
skillMdPayloadPath: skill.payloadPath,
|
|
309
|
+
skillMdDisplayPath: skill.displayPath,
|
|
310
|
+
});
|
|
311
|
+
if (!discovered) {
|
|
312
|
+
// SKILL.md itself is gone — its own deletion event retires the guide and
|
|
313
|
+
// its member rows; nothing to re-sync here.
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const signature = skillSyncSignature(discovered);
|
|
317
|
+
// Skip when nothing the payload carries changed (touched-but-unedited file,
|
|
318
|
+
// binary asset write, or a duplicate re-scan queued behind an identical one).
|
|
319
|
+
if (skill.syncSignature === signature)
|
|
320
|
+
return;
|
|
321
|
+
const payload = buildRulePayload(discovered);
|
|
322
|
+
try {
|
|
323
|
+
await this.sendImports([payload]);
|
|
324
|
+
// Mutating the tracked KnownFile in place (same reference as the map
|
|
325
|
+
// entry) records what we just synced.
|
|
326
|
+
skill.syncSignature = signature;
|
|
327
|
+
skill.contentHash = discovered.contentHash;
|
|
328
|
+
this.log(` synced ${discovered.displayPath}`);
|
|
329
|
+
}
|
|
330
|
+
catch (err) {
|
|
331
|
+
this.log(` failed to sync ${discovered.displayPath}: ${err instanceof Error ? err.message : err}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
scheduleDeletion(known) {
|
|
335
|
+
if (this.deleteStabilityMs <= 0) {
|
|
336
|
+
void this.fireDeletion(known);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
// Cancel any previous deletion in flight for this path; the latest event
|
|
340
|
+
// wins and resets the stability window.
|
|
341
|
+
const existing = this.deletionTimers.get(known.absolutePath);
|
|
342
|
+
if (existing)
|
|
343
|
+
clearTimeout(existing);
|
|
344
|
+
const timer = setTimeout(async () => {
|
|
345
|
+
this.deletionTimers.delete(known.absolutePath);
|
|
346
|
+
if (this.stopped)
|
|
347
|
+
return;
|
|
348
|
+
const stillGone = await this.readFileImpl(known.absolutePath);
|
|
349
|
+
if (stillGone) {
|
|
350
|
+
// Recovered within the window — re-run process so the new content is
|
|
351
|
+
// sent as an import.
|
|
352
|
+
await this.process(known.absolutePath);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
await this.fireDeletion(known);
|
|
356
|
+
}, this.deleteStabilityMs);
|
|
357
|
+
this.deletionTimers.set(known.absolutePath, timer);
|
|
358
|
+
}
|
|
359
|
+
async fireDeletion(known) {
|
|
360
|
+
if (this.stopped)
|
|
361
|
+
return;
|
|
362
|
+
const deletion = {
|
|
363
|
+
path: known.payloadPath,
|
|
364
|
+
format: known.format,
|
|
365
|
+
};
|
|
366
|
+
try {
|
|
367
|
+
await this.sendDeletions([deletion]);
|
|
368
|
+
this.known.delete(known.absolutePath);
|
|
369
|
+
this.log(` disabled ${known.displayPath} (file removed)`);
|
|
370
|
+
}
|
|
371
|
+
catch (err) {
|
|
372
|
+
this.log(` failed to disable ${known.displayPath}: ${err instanceof Error ? err.message : err}`);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Top-level files we watch the cwd for so creation/rename of these specific
|
|
377
|
+
// names is caught even when they don't exist at start. Anything else under
|
|
378
|
+
// cwd is the user's repo (often huge) — we don't follow it.
|
|
379
|
+
const PROJECT_TOP_LEVEL_FILES = ['AGENTS.md', 'CLAUDE.md', '.cursorrules'];
|
|
380
|
+
const PROJECT_GUIDE_DIRS = ['.agents', '.claude', '.cursor/rules'];
|
|
381
|
+
// Global rule directories scanned when --global is set. Cursor rules are
|
|
382
|
+
// scoped to `.cursor/rules` (not the whole `.cursor/` tree) so we don't watch
|
|
383
|
+
// unrelated Cursor state — chat history, indexes — especially under `~/.cursor`.
|
|
384
|
+
const GLOBAL_GUIDE_DIRS = ['.claude', '.cursor/rules'];
|
|
385
|
+
export function createFsWatchSource(options) {
|
|
386
|
+
return {
|
|
387
|
+
start(onEvent) {
|
|
388
|
+
const watchers = [];
|
|
389
|
+
const home = options.global ? (options.homedir ?? osHomedir()) : null;
|
|
390
|
+
const watchImpl = options.watchImpl ?? ((p, o, l) => fsWatch(p, o, l));
|
|
391
|
+
const tryWatch = async (root, recursive, relativeBase, displayBase, nameFilter) => {
|
|
392
|
+
try {
|
|
393
|
+
const info = await stat(root);
|
|
394
|
+
if (!info.isDirectory() && !info.isFile())
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
catch {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
const handler = (_eventType, filename) => {
|
|
401
|
+
if (!filename)
|
|
402
|
+
return;
|
|
403
|
+
if (nameFilter && !nameFilter(filename))
|
|
404
|
+
return;
|
|
405
|
+
const absolutePath = join(root, filename);
|
|
406
|
+
const payloadPath = join(relativeBase, filename).replaceAll('\\', '/');
|
|
407
|
+
const displayPath = join(displayBase, filename).replaceAll('\\', '/');
|
|
408
|
+
// Pre-filter to supported guide files plus skill member content
|
|
409
|
+
// (scripts/references/assets under a skills/ tree). Member paths have
|
|
410
|
+
// no format of their own; the engine routes them to a whole-skill
|
|
411
|
+
// re-scan. Everything else is dropped to keep the noise down.
|
|
412
|
+
if (!detectFormat(payloadPath) && !isSkillMemberPath(payloadPath))
|
|
413
|
+
return;
|
|
414
|
+
onEvent({
|
|
415
|
+
kind: 'change',
|
|
416
|
+
absolutePath,
|
|
417
|
+
payloadPath,
|
|
418
|
+
displayPath,
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
try {
|
|
422
|
+
watchers.push(watchImpl(root, { recursive }, handler));
|
|
423
|
+
}
|
|
424
|
+
catch {
|
|
425
|
+
// Best-effort: a missing directory just means we silently skip it
|
|
426
|
+
// until the user creates one. fs.watch can also throw EACCES on
|
|
427
|
+
// restricted homedirs — skip and continue.
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
// Watch cwd non-recursively, filtered to the three top-level guide
|
|
431
|
+
// files. Recursive cwd watch would generate huge event volume on real
|
|
432
|
+
// repos (node_modules, build outputs) only to drop everything in the
|
|
433
|
+
// engine. Guide directories below get their own recursive watcher.
|
|
434
|
+
const projectFiles = new Set(PROJECT_TOP_LEVEL_FILES);
|
|
435
|
+
void tryWatch(options.cwd, false, '', '', (name) => projectFiles.has(name));
|
|
436
|
+
for (const dir of PROJECT_GUIDE_DIRS) {
|
|
437
|
+
void tryWatch(join(options.cwd, dir), true, dir, dir);
|
|
438
|
+
}
|
|
439
|
+
if (home) {
|
|
440
|
+
for (const dir of GLOBAL_GUIDE_DIRS) {
|
|
441
|
+
void tryWatch(join(home, dir), true, dir, `~/${dir}`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return async () => {
|
|
445
|
+
for (const w of watchers) {
|
|
446
|
+
try {
|
|
447
|
+
w.close();
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
// Already closed or stale handle — fine.
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/rules/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEvE,OAAO,EAAE,WAAW,EAA4B,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAkF/C,SAAS,MAAM,CAAC,OAAe;IAC7B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OA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EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;YAE3E,KAAK,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;gBACrC,KAAK,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;YACvD,CAAC;YACD,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;oBACpC,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC,CAAA;gBACvD,CAAC;YACH,CAAC;YAED,OAAO,KAAK,IAAI,EAAE;gBAChB,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;oBACzB,IAAI,CAAC;wBACH,CAAC,CAAC,KAAK,EAAE,CAAA;oBACX,CAAC;oBAAC,MAAM,CAAC;wBACP,yCAAyC;oBAC3C,CAAC;gBACH,CAAC;YACH,CAAC,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const SKILL_MD = "---\nname: auden\ndescription: >-\n Invoke when the user asks about Auden, evaluation results, or what happened\n in the last session. Surfaces the current guide cache, lets the user inspect\n or manually record verdicts, and shows pending guide suggestions. Do NOT call\n this automatically before or after actions \u2014 Auden evaluates sessions\n post-hoc; guides already flow into the agent's context via AGENTS.md and\n CLAUDE.md.\nuser-invocable: true\n---\n\n# Auden\n\nAuden is an on-device agent analytics layer. After each Claude Code session the Stop hook runs `auden eval`, which scores the session against your active guides and prints an alignment summary. Evaluation is post-hoc and happens once per session \u2014 not per action.\n\n## When To Invoke This Skill\n\nOnly when the user explicitly asks. Examples:\n\n- \"What did Auden say about the last session?\"\n- \"Show me the active guides\"\n- \"Did the agent follow the guides?\"\n- \"Run auden suggest\"\n\nDo NOT call `auden` commands during normal task execution. Guides already reach you through `AGENTS.md` / `CLAUDE.md` / `.cursorrules` \u2014 Auden's job is to evaluate what happened afterwards, not to gate each action.\n\n## Commands\n\n### `auden guides active`\n\nLists all currently enabled guides for this project, read from the local cache.\n\n```bash\nauden guides active\n```\n\n### `auden guides search <query>`\n\nSearches active guides by keyword.\n\n```bash\nauden guides search \"TypeScript\"\nauden guides search \"testing\"\n```\n\n### `auden verdict record`\n\nManually records an alignment verdict and queues it for the next `auden sync`. Use when the user wants to log a specific outcome. The Stop hook (`auden eval`) evaluates sessions but does not enqueue verdicts automatically.\n\n```bash\nauden verdict record --verdict aligned --summary \"ran tests before committing\"\nauden verdict record --verdict misaligned --summary \"used var instead of const\"\nauden verdict record --verdict unguided --summary \"added a new pattern with no existing rule\"\n```\n\n**Verdict values:** `aligned` | `misaligned` | `unguided`\n\n### `auden suggest`\n\nSurfaces guide suggestions extracted from recent session history.\n\n```bash\nauden suggest\n```\n\n### `auden sync`\n\nPushes queued verdicts and extracted guide/skill suggestions to the dashboard, and pulls the latest guide bundle. Verdicts recorded with `auden verdict record` are transmitted on the next `auden sync`.\n\n```bash\nauden sync\n```\n\n## Notes\n\n- Guides are cached in `~/.auden/guides.json` after `auden sync`. `guides active` and `guides search` read from cache \u2014 no network requests.\n- Verdicts are queued locally in `~/.auden/queue/` and sent to the dashboard on the next `auden sync` (queue files are deleted after a successful send).\n- The Stop hook (`auden eval`) is installed by `auden init` and runs once when the Claude Code session ends.\n";
|
|
2
|
+
export declare const AUDEN_CONTEXT_SKILL_MD = "---\nname: auden-context\ndescription: >-\n Use when the user refers to their notes, context, inbox, or bundles saved in\n Auden \u2014 e.g. \"pull my notes from Auden\", \"what's in my inbox\", \"save this to\n my context\", \"sync this back\". Reads and writes the Auden context layer over\n the Auden MCP server so context follows the user across every repo and agent.\nuser-invocable: true\n---\n\n# Auden Context\n\nAuden's context layer is a portable store of the user's canonical documents,\nnotes, and reference material. It lives on the Auden dashboard and is reachable\nfrom any repo through the **Auden MCP server** (`auden mcp`, configured once per\nagent). Items are *canonical, not copies*: a document can belong to many bundles,\nand editing it once propagates the change everywhere it is a member. Plain\nMarkdown/text is the source of truth.\n\nTwo surfaces sit on top of it:\n\n- **Bundles** \u2014 named collections (`notes`, `travel-log`, \u2026) you pull scoped\n context from and push canonical results into.\n- **Inbox** \u2014 a reserved bundle the user captures raw notes into (from the phone,\n the app, or a share sheet). Agents pull recent inbox items, transform them, and\n archive what they consumed.\n\n## When To Use\n\nInvoke when the user references their own saved context, for example:\n\n- \"Pull my notes from the last day and summarize them.\"\n- \"What context do I have on <topic>?\" / \"Search my Auden bundles for <x>.\"\n- \"Save this document to my `notes` bundle.\" / \"Sync this back to Auden.\"\n- \"Clear my inbox once you've used it.\"\n\nDo NOT use it for guide/verdict inspection \u2014 that is the `auden` skill. This\nskill is about reading and writing *context*, not evaluating sessions.\n\n## Tools (Auden MCP server)\n\nIf these tools are missing, the Auden MCP server is not configured. Tell the user\nto run `auden mcp` and add it to their agent's MCP config (`.mcp.json` / Claude\nCode / Cursor). `auden mcp --read-only` disables the write tools; `auden mcp\n--bundles a,b` restricts which bundles are visible.\n\n| Tool | Input | Use |\n|---|---|---|\n| `list_bundles` | `{}` | Discover which bundles exist before pulling or pushing. |\n| `pull_context` | `{ bundle, query?, types?, limit?, writeToDir? }` | Pull *scoped* items from a bundle. Filter with `types` (`document`/`reference`/`asset`/`guide`), a `query` substring, and `limit`. Pass `writeToDir` to also write each item to disk. |\n| `push_context` | `{ bundle, name, content, contentType?, itemId?, origin?, sourceItemIds? }` | Push a canonical item. Omit `itemId` to create; pass `itemId` to update in place (propagates to every bundle it belongs to). `contentType` defaults to `document`. When the item was produced from other context items, cite their ids as `sourceItemIds`. |\n| `list_inbox` | `{ since?, types? }` | List unarchived inbox items. `since` takes an ISO timestamp or a relative window (`\"24h\"`, `\"7d\"`, `\"30m\"`). |\n| `pull_inbox` | `{ since?, types?, writeToDir? }` | Like `list_inbox` but also supports `writeToDir` \u2014 the round-trip entry point. |\n| `archive_inbox` | `{ ids }` | Archive inbox items once consumed so they drop out of future pulls (reversible on the dashboard). |\n\n## How To Use It Well\n\n- **Pull scoped, not everything.** Reach for `query`/`types`/`limit` so you only\n load what the task needs \u2014 the context layer can be large.\n- **Pushes are canonical and cross-repo.** A pushed document is visible from every\n other repo, so name it clearly and target the right bundle. When refining\n something you pulled, pass its `itemId` to `push_context` to update it in place\n rather than creating a duplicate.\n- **Close the loop on the inbox.** After you turn inbox items into a saved\n document, call `archive_inbox` with the ids you consumed so the user's inbox\n reflects that they were processed.\n- **Cite your sources when transforming.** When a pushed document was produced\n from other context items (inbox captures, bundle items), pass their ids as\n `sourceItemIds` on `push_context`. The citation is optional provenance; if\n one of the user's own guides covers the transform (its trigger matches, and\n it carries eval criteria), Auden grades the round-trip against *that guide's*\n criteria and the verdict lands in the user's feed. Auden has no built-in\n quality bar \u2014 the user's guidance is the standard. Report the verdict from\n the response's `transform` field when present.\n- **Preserve the user's facts.** These are the user's own notes \u2014 never drop or\n invent detail when you restructure them.\n";
|
|
3
|
+
/**
|
|
4
|
+
* Skills bundled into a repo by \`auden init\` (written under .claude/skills/<name>/SKILL.md).
|
|
5
|
+
* The \`auden\` skill covers evaluation/verdict inspection; \`auden-context\` covers
|
|
6
|
+
* the context layer over the Auden MCP server.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately mechanics-only: Auden ships the mechanics (pull/push/inbox/
|
|
9
|
+
* grading), users bring the use cases — a concrete transform skill (e.g. notes
|
|
10
|
+
* cleanup) plus the guide with eval criteria that grades it is *user* content.
|
|
11
|
+
* A copy-paste example lives in docs/examples/notes-cleanup-skill.md; a user
|
|
12
|
+
* skill dropped into .claude/skills/ is discovered and graded like anything
|
|
13
|
+
* else they author (L3).
|
|
14
|
+
*/
|
|
15
|
+
export declare const BUNDLED_SKILLS: ReadonlyArray<{
|
|
16
|
+
name: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=skill-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../src/skill-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,u3FA+EpB,CAAA;AAED,eAAO,MAAM,sBAAsB,0hJA4ElC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAG3E,CAAA"}
|