skyl.dev 0.1.1 → 0.1.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/dist/bin.js +2265 -2
- package/package.json +7 -10
- package/dist/bin.d.ts +0 -3
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -158
- package/dist/cli.js.map +0 -1
- package/dist/commands/add.d.ts +0 -10
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js +0 -38
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/audit.d.ts +0 -16
- package/dist/commands/audit.d.ts.map +0 -1
- package/dist/commands/audit.js +0 -91
- package/dist/commands/audit.js.map +0 -1
- package/dist/commands/context.d.ts +0 -17
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -47
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/diff.d.ts +0 -12
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/diff.js +0 -79
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/learn.d.ts +0 -18
- package/dist/commands/learn.d.ts.map +0 -1
- package/dist/commands/learn.js +0 -115
- package/dist/commands/learn.js.map +0 -1
- package/dist/commands/lint.d.ts +0 -14
- package/dist/commands/lint.d.ts.map +0 -1
- package/dist/commands/lint.js +0 -109
- package/dist/commands/lint.js.map +0 -1
- package/dist/commands/list.d.ts +0 -6
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js +0 -60
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/remove.d.ts +0 -16
- package/dist/commands/remove.d.ts.map +0 -1
- package/dist/commands/remove.js +0 -73
- package/dist/commands/remove.js.map +0 -1
- package/dist/commands/scan.d.ts +0 -10
- package/dist/commands/scan.d.ts.map +0 -1
- package/dist/commands/scan.js +0 -60
- package/dist/commands/scan.js.map +0 -1
- package/dist/commands/update.d.ts +0 -11
- package/dist/commands/update.d.ts.map +0 -1
- package/dist/commands/update.js +0 -135
- package/dist/commands/update.js.map +0 -1
- package/dist/context.d.ts +0 -44
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -179
- package/dist/context.js.map +0 -1
- package/dist/ignore.d.ts +0 -21
- package/dist/ignore.d.ts.map +0 -1
- package/dist/ignore.js +0 -79
- package/dist/ignore.js.map +0 -1
- package/dist/install.d.ts +0 -10
- package/dist/install.d.ts.map +0 -1
- package/dist/install.js +0 -54
- package/dist/install.js.map +0 -1
- package/dist/learn.d.ts +0 -45
- package/dist/learn.d.ts.map +0 -1
- package/dist/learn.js +0 -146
- package/dist/learn.js.map +0 -1
- package/dist/registry.d.ts +0 -23
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -38
- package/dist/registry.js.map +0 -1
- package/dist/scan.d.ts +0 -3
- package/dist/scan.d.ts.map +0 -1
- package/dist/scan.js +0 -104
- package/dist/scan.js.map +0 -1
- package/dist/state.d.ts +0 -31
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -39
- package/dist/state.js.map +0 -1
- package/dist/ui.d.ts +0 -17
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js +0 -35
- package/dist/ui.js.map +0 -1
- package/node_modules/@skyl/core/dist/audit.d.ts +0 -48
- package/node_modules/@skyl/core/dist/audit.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/audit.js +0 -99
- package/node_modules/@skyl/core/dist/audit.js.map +0 -1
- package/node_modules/@skyl/core/dist/detect.d.ts +0 -15
- package/node_modules/@skyl/core/dist/detect.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/detect.js +0 -62
- package/node_modules/@skyl/core/dist/detect.js.map +0 -1
- package/node_modules/@skyl/core/dist/diff.d.ts +0 -32
- package/node_modules/@skyl/core/dist/diff.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/diff.js +0 -119
- package/node_modules/@skyl/core/dist/diff.js.map +0 -1
- package/node_modules/@skyl/core/dist/errors.d.ts +0 -21
- package/node_modules/@skyl/core/dist/errors.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/errors.js +0 -25
- package/node_modules/@skyl/core/dist/errors.js.map +0 -1
- package/node_modules/@skyl/core/dist/index.d.ts +0 -14
- package/node_modules/@skyl/core/dist/index.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/index.js +0 -14
- package/node_modules/@skyl/core/dist/index.js.map +0 -1
- package/node_modules/@skyl/core/dist/lint.d.ts +0 -28
- package/node_modules/@skyl/core/dist/lint.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/lint.js +0 -169
- package/node_modules/@skyl/core/dist/lint.js.map +0 -1
- package/node_modules/@skyl/core/dist/lockfile.d.ts +0 -37
- package/node_modules/@skyl/core/dist/lockfile.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/lockfile.js +0 -47
- package/node_modules/@skyl/core/dist/lockfile.js.map +0 -1
- package/node_modules/@skyl/core/dist/match.d.ts +0 -19
- package/node_modules/@skyl/core/dist/match.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/match.js +0 -72
- package/node_modules/@skyl/core/dist/match.js.map +0 -1
- package/node_modules/@skyl/core/dist/names.d.ts +0 -11
- package/node_modules/@skyl/core/dist/names.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/names.js +0 -31
- package/node_modules/@skyl/core/dist/names.js.map +0 -1
- package/node_modules/@skyl/core/dist/parse.d.ts +0 -22
- package/node_modules/@skyl/core/dist/parse.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/parse.js +0 -163
- package/node_modules/@skyl/core/dist/parse.js.map +0 -1
- package/node_modules/@skyl/core/dist/resolve.d.ts +0 -12
- package/node_modules/@skyl/core/dist/resolve.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/resolve.js +0 -40
- package/node_modules/@skyl/core/dist/resolve.js.map +0 -1
- package/node_modules/@skyl/core/dist/source.d.ts +0 -35
- package/node_modules/@skyl/core/dist/source.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/source.js +0 -85
- package/node_modules/@skyl/core/dist/source.js.map +0 -1
- package/node_modules/@skyl/core/dist/targets.d.ts +0 -20
- package/node_modules/@skyl/core/dist/targets.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/targets.js +0 -24
- package/node_modules/@skyl/core/dist/targets.js.map +0 -1
- package/node_modules/@skyl/core/dist/types.d.ts +0 -51
- package/node_modules/@skyl/core/dist/types.d.ts.map +0 -1
- package/node_modules/@skyl/core/dist/types.js +0 -2
- package/node_modules/@skyl/core/dist/types.js.map +0 -1
- package/node_modules/@skyl/core/package.json +0 -20
package/dist/commands/update.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { resolve } from '@skyl/core';
|
|
2
|
-
import { install, readLockfile, resolveTarget, writeLockfile } from "../install.js";
|
|
3
|
-
import { loadRegistry } from "../registry.js";
|
|
4
|
-
import { changedOnDisk, installedState } from "../state.js";
|
|
5
|
-
import { printDiff } from "./diff.js";
|
|
6
|
-
import { bold, confirm, cyan, dim, green, out, tokens, yellow } from "../ui.js";
|
|
7
|
-
const SAYS = {
|
|
8
|
-
apply: 'update',
|
|
9
|
-
restore: 'file is gone, put it back',
|
|
10
|
-
new: 'newly required',
|
|
11
|
-
kept: 'edited here, left alone',
|
|
12
|
-
conflict: 'edited here, and changed upstream',
|
|
13
|
-
gone: 'no longer in the registry',
|
|
14
|
-
};
|
|
15
|
-
export async function update(opts) {
|
|
16
|
-
const lock = await readLockfile(opts.root);
|
|
17
|
-
if (!lock || Object.keys(lock.skills).length === 0) {
|
|
18
|
-
out(`${yellow('Nothing installed.')} Run ${bold('skyl scan')} to see what fits this project.`);
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
const target = resolveTarget(undefined, lock);
|
|
22
|
-
const load = { dir: opts.dir, refresh: opts.refresh ?? opts.dir === undefined };
|
|
23
|
-
const { items, from } = await installedState(opts.root, lock, target, load);
|
|
24
|
-
if (from === undefined) {
|
|
25
|
-
out(` ${yellow('No registry reachable.')} ${dim('Nothing to update from.')}`);
|
|
26
|
-
return 1;
|
|
27
|
-
}
|
|
28
|
-
const { skills } = await loadRegistry(load);
|
|
29
|
-
const requested = Object.entries(lock.skills).filter(([, e]) => e.reason === 'requested').map(([n]) => n);
|
|
30
|
-
const known = new Set(skills.map((s) => s.name));
|
|
31
|
-
// a new version can add a `requires`, and the dependency has to arrive with it
|
|
32
|
-
let ordered = [];
|
|
33
|
-
try {
|
|
34
|
-
ordered = resolve(skills, requested.filter((n) => known.has(n)));
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
ordered = [];
|
|
38
|
-
}
|
|
39
|
-
const held = new Set(Object.keys(lock.skills));
|
|
40
|
-
const arrivals = ordered.filter((s) => !held.has(s.name));
|
|
41
|
-
const plan = [];
|
|
42
|
-
for (const item of items) {
|
|
43
|
-
if (!item.skill) {
|
|
44
|
-
plan.push({ skill: undefined, name: item.name, action: 'gone', version: item.entry.version });
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
if (item.onDisk === undefined) {
|
|
48
|
-
plan.push({ skill: item.skill, name: item.name, action: 'restore', version: item.skill.version });
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (!changedOnDisk(item)) {
|
|
52
|
-
// byte-identical: a patch that only touched `## Why` is not an update to anything
|
|
53
|
-
// installed, so the lockfile version is corrected quietly and nothing is rewritten
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (item.state === 'local-edit') {
|
|
57
|
-
plan.push({ skill: item.skill, name: item.name, action: 'kept', version: item.entry.version });
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (item.state === 'both') {
|
|
61
|
-
plan.push({ skill: item.skill, name: item.name, action: opts.force === true ? 'apply' : 'conflict', version: item.skill.version });
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
plan.push({ skill: item.skill, name: item.name, action: 'apply', version: item.skill.version });
|
|
65
|
-
}
|
|
66
|
-
for (const skill of arrivals)
|
|
67
|
-
plan.push({ skill, name: skill.name, action: 'new', version: skill.version });
|
|
68
|
-
const wanted = new Set(opts.names ?? []);
|
|
69
|
-
const chosen = plan.filter((p) => (p.action === 'apply' || p.action === 'restore' || p.action === 'new') &&
|
|
70
|
-
(wanted.size === 0 || wanted.has(p.name) || wanted.has(p.name.split('/')[1])));
|
|
71
|
-
const stale = items.filter((i) => i.skill && i.skill.version !== i.entry.version && !changedOnDisk(i));
|
|
72
|
-
if (plan.length === 0 && stale.length === 0) {
|
|
73
|
-
out();
|
|
74
|
-
out(` ${green('Up to date.')} ${dim(`${items.length} skills, from ${from}`)}`);
|
|
75
|
-
out();
|
|
76
|
-
return 0;
|
|
77
|
-
}
|
|
78
|
-
out();
|
|
79
|
-
for (const p of plan) {
|
|
80
|
-
const colour = p.action === 'conflict' || p.action === 'kept' || p.action === 'gone' ? yellow : green;
|
|
81
|
-
out(` ${bold(p.name.padEnd(22))} ${p.version.padEnd(8)} ${colour(SAYS[p.action])}`);
|
|
82
|
-
}
|
|
83
|
-
out();
|
|
84
|
-
if (chosen.length === 0) {
|
|
85
|
-
if (plan.some((p) => p.action === 'conflict')) {
|
|
86
|
-
out(` ${dim('Nothing applied.')} ${cyan('skyl diff')} shows both sides, ${cyan('--force')} takes the upstream one.`);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
out(` ${dim('Nothing to apply.')}`);
|
|
90
|
-
}
|
|
91
|
-
if (stale.length > 0)
|
|
92
|
-
await recordVersions(opts.root, lock, stale.map((i) => [i.name, i.skill.version]));
|
|
93
|
-
out();
|
|
94
|
-
return 0;
|
|
95
|
-
}
|
|
96
|
-
if (opts.showDiff === true) {
|
|
97
|
-
for (const item of items) {
|
|
98
|
-
if (chosen.some((c) => c.name === item.name))
|
|
99
|
-
printDiff(item, false);
|
|
100
|
-
}
|
|
101
|
-
out();
|
|
102
|
-
}
|
|
103
|
-
const words = chosen.reduce((n, c) => n + (c.skill?.installableWords ?? 0), 0);
|
|
104
|
-
out(` ${chosen.length} to write, ${tokens(words)} ${dim(`into ${target.dir}`)}`);
|
|
105
|
-
out();
|
|
106
|
-
if (!(await confirm(' Apply?', opts.yes === true))) {
|
|
107
|
-
out(` ${dim('Nothing written.')}`);
|
|
108
|
-
return 1;
|
|
109
|
-
}
|
|
110
|
-
const requestedSet = new Set(requested);
|
|
111
|
-
const next = await install(opts.root, target, chosen.map((c) => c.skill), requestedSet, lock);
|
|
112
|
-
for (const [name, version] of stale.map((i) => [i.name, i.skill.version])) {
|
|
113
|
-
const entry = next.skills[name];
|
|
114
|
-
if (entry)
|
|
115
|
-
next.skills[name] = { ...entry, version };
|
|
116
|
-
}
|
|
117
|
-
await writeLockfile(opts.root, next);
|
|
118
|
-
out();
|
|
119
|
-
out(` ${green('Done.')} ${dim('skyl.lock records what is here now.')}`);
|
|
120
|
-
out();
|
|
121
|
-
return 0;
|
|
122
|
-
}
|
|
123
|
-
/** A version bump that changed nothing installed still belongs in the lockfile. */
|
|
124
|
-
async function recordVersions(root, lock, pairs) {
|
|
125
|
-
if (pairs.length === 0)
|
|
126
|
-
return;
|
|
127
|
-
const skills = { ...lock.skills };
|
|
128
|
-
for (const [name, version] of pairs) {
|
|
129
|
-
const entry = skills[name];
|
|
130
|
-
if (entry)
|
|
131
|
-
skills[name] = { ...entry, version };
|
|
132
|
-
}
|
|
133
|
-
await writeLockfile(root, { ...lock, skills });
|
|
134
|
-
}
|
|
135
|
-
//# sourceMappingURL=update.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C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
|
|
1
|
-
import { type ProjectSignals } from '@skyl/core';
|
|
2
|
-
/**
|
|
3
|
-
* Select what a model needs to describe this product, and nothing else.
|
|
4
|
-
*
|
|
5
|
-
* Everything here is deterministic: which files, in what order, under what budget. That
|
|
6
|
-
* is the part worth owning, because the model that reads the bundle belongs to the user
|
|
7
|
-
* and can be any of them. A bundle that is reproducible can be reviewed before it is
|
|
8
|
-
* sent, which is the whole reason `--dry-run` exists.
|
|
9
|
-
*/
|
|
10
|
-
export interface Picked {
|
|
11
|
-
readonly path: string;
|
|
12
|
-
readonly why: string;
|
|
13
|
-
readonly bytes: number;
|
|
14
|
-
}
|
|
15
|
-
export interface ContextBundle {
|
|
16
|
-
readonly root: string;
|
|
17
|
-
readonly tree: string;
|
|
18
|
-
readonly signals: ProjectSignals;
|
|
19
|
-
readonly installed: readonly string[];
|
|
20
|
-
readonly files: readonly (Picked & {
|
|
21
|
-
readonly text: string;
|
|
22
|
-
readonly truncated: boolean;
|
|
23
|
-
})[];
|
|
24
|
-
/** Files that were chosen and then refused, with the reason. */
|
|
25
|
-
readonly withheld: readonly {
|
|
26
|
-
readonly path: string;
|
|
27
|
-
readonly why: string;
|
|
28
|
-
}[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The tree, always included: it is the cheapest thing in the bundle and often the most
|
|
32
|
-
* informative, because file names carry the vocabulary of the product.
|
|
33
|
-
*
|
|
34
|
-
* File names are listed, not just directories. `WithdrawRequest.kt` and `PkBattleScreen.kt`
|
|
35
|
-
* say what the product is about; a count of files in a directory says nothing.
|
|
36
|
-
*/
|
|
37
|
-
export declare function renderTree(paths: readonly string[], limit?: number, perDirectory?: number): string;
|
|
38
|
-
export declare function buildContext(root: string, opts?: {
|
|
39
|
-
installed?: readonly string[];
|
|
40
|
-
maxFiles?: number;
|
|
41
|
-
}): Promise<ContextBundle>;
|
|
42
|
-
/** The bundle as one markdown document, which is what a model is handed. */
|
|
43
|
-
export declare function renderContext(bundle: ContextBundle): string;
|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aAAa,CAAC,CA+CxB;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAqC3D"}
|
package/dist/context.js
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
2
|
-
import { join, relative, sep } from 'node:path';
|
|
3
|
-
import { scanSecrets } from '@skyl/core';
|
|
4
|
-
import { loadIgnore } from "./ignore.js";
|
|
5
|
-
import { scanProject } from "./scan.js";
|
|
6
|
-
const MAX_FILES = 40;
|
|
7
|
-
const MAX_BYTES_PER_FILE = 16_000;
|
|
8
|
-
const MAX_TOTAL_BYTES = 400_000;
|
|
9
|
-
const SKIP_DIRS = new Set(['node_modules', 'build', '.git', '.gradle', '.idea', 'dist', 'out', 'target', 'vendor', '.next', '.venv']);
|
|
10
|
-
const DOC = /\.(md|mdx|adoc|rst)$/i;
|
|
11
|
-
const SCHEMA = /\.(sql|graphql|gql|prisma|proto)$/i;
|
|
12
|
-
const CODE = /\.(kt|kts|java|swift|ts|tsx|js|jsx|py|go|rb|rs|php|cs|dart|vue|svelte)$/i;
|
|
13
|
-
const LOCKISH = /(package-lock\.json|pnpm-lock\.yaml|yarn\.lock|Podfile\.lock|\.min\.js|\.map)$/i;
|
|
14
|
-
/**
|
|
15
|
-
* Why a file is worth a slot, highest first.
|
|
16
|
-
*
|
|
17
|
-
* Documents outrank code deliberately. A README or an ADR states what the product is
|
|
18
|
-
* meant to do; code only shows what it currently does, and the gap between those two is
|
|
19
|
-
* exactly the knowledge that cannot be recovered by reading source.
|
|
20
|
-
*/
|
|
21
|
-
const REASONS = [
|
|
22
|
-
{ why: 'documentation', weight: 100, test: (p, b) => DOC.test(b) && !/changelog|license|contributing|code_of_conduct/i.test(b) && (p.split('/').length <= 3 || /docs?\//i.test(p)) },
|
|
23
|
-
{ why: 'schema', weight: 90, test: (_p, b) => SCHEMA.test(b) },
|
|
24
|
-
// `AppModule.kt` starts like an entry point and is wiring, so the exclusion is explicit
|
|
25
|
-
{ why: 'entry point', weight: 80, test: (_p, b) => (/^(Main|App|Application|index|main)[A-Za-z]*\.(kt|java|ts|tsx|js|jsx|py|go|swift|dart)$/.test(b) && !/(Module|Component|Config|Test)\./.test(b)) || /Activity\.(kt|java)$/.test(b) },
|
|
26
|
-
{ why: 'dependency wiring', weight: 70, test: (p, b) => /(Module|Component|Injection|di)\.(kt|java|ts)$/.test(b) || /\/di\//.test(p) },
|
|
27
|
-
{ why: 'shared foundation', weight: 60, test: (p) => /(^|\/)(core|common|base|shared|lib)\//i.test(p) },
|
|
28
|
-
{ why: 'navigation or routing', weight: 55, test: (_p, b) => /(Nav|Navigation|Router|Routes|Screen)[A-Za-z]*\.(kt|java|ts|tsx)$/.test(b) },
|
|
29
|
-
{ why: 'data model', weight: 50, test: (p, b) => /(Entity|Dto|Model|Repository|Dao|Api|Service)\.(kt|java|ts)$/.test(b) || /\/(model|domain|entity)\//i.test(p) },
|
|
30
|
-
{ why: 'configuration', weight: 40, test: (_p, b) => /^(build\.gradle(\.kts)?|settings\.gradle(\.kts)?|libs\.versions\.toml|package\.json|pyproject\.toml|Cargo\.toml|go\.mod|Makefile|docker-compose\.ya?ml)$/.test(b) },
|
|
31
|
-
];
|
|
32
|
-
async function walk(root, ignore) {
|
|
33
|
-
const out = [];
|
|
34
|
-
const step = async (dir, depth) => {
|
|
35
|
-
if (depth > 8)
|
|
36
|
-
return;
|
|
37
|
-
const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
|
|
38
|
-
for (const entry of entries) {
|
|
39
|
-
if (SKIP_DIRS.has(entry.name))
|
|
40
|
-
continue;
|
|
41
|
-
if (entry.name.startsWith('.') && entry.name !== '.github')
|
|
42
|
-
continue;
|
|
43
|
-
const full = join(dir, entry.name);
|
|
44
|
-
const rel = relative(root, full).split(sep).join('/');
|
|
45
|
-
if (ignore.ignored(rel, entry.isDirectory()))
|
|
46
|
-
continue;
|
|
47
|
-
if (entry.isDirectory())
|
|
48
|
-
await step(full, depth + 1);
|
|
49
|
-
else if (!LOCKISH.test(entry.name)) {
|
|
50
|
-
const info = await stat(full).catch(() => undefined);
|
|
51
|
-
if (info)
|
|
52
|
-
out.push({ path: rel, bytes: info.size });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
await step(root, 0);
|
|
57
|
-
return out;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* The tree, always included: it is the cheapest thing in the bundle and often the most
|
|
61
|
-
* informative, because file names carry the vocabulary of the product.
|
|
62
|
-
*
|
|
63
|
-
* File names are listed, not just directories. `WithdrawRequest.kt` and `PkBattleScreen.kt`
|
|
64
|
-
* say what the product is about; a count of files in a directory says nothing.
|
|
65
|
-
*/
|
|
66
|
-
export function renderTree(paths, limit = 500, perDirectory = 12) {
|
|
67
|
-
const byDir = new Map();
|
|
68
|
-
for (const p of paths) {
|
|
69
|
-
const at = p.lastIndexOf('/');
|
|
70
|
-
const dir = at < 0 ? '' : p.slice(0, at);
|
|
71
|
-
(byDir.get(dir) ?? byDir.set(dir, []).get(dir)).push(p.slice(at + 1));
|
|
72
|
-
for (let d = dir; d.includes('/'); d = d.slice(0, d.lastIndexOf('/'))) {
|
|
73
|
-
if (!byDir.has(d.slice(0, d.lastIndexOf('/'))))
|
|
74
|
-
byDir.set(d.slice(0, d.lastIndexOf('/')), []);
|
|
75
|
-
}
|
|
76
|
-
if (dir !== '' && !byDir.has(''))
|
|
77
|
-
byDir.set('', []);
|
|
78
|
-
}
|
|
79
|
-
const lines = [];
|
|
80
|
-
let shown = 0;
|
|
81
|
-
for (const dir of [...byDir.keys()].sort()) {
|
|
82
|
-
const depth = dir === '' ? 0 : dir.split('/').length;
|
|
83
|
-
if (dir !== '')
|
|
84
|
-
lines.push(`${' '.repeat(depth - 1)}${dir.split('/').pop()}/`);
|
|
85
|
-
const files = byDir.get(dir).sort();
|
|
86
|
-
for (const file of files.slice(0, perDirectory)) {
|
|
87
|
-
if (shown >= limit)
|
|
88
|
-
break;
|
|
89
|
-
lines.push(`${' '.repeat(depth)}${file}`);
|
|
90
|
-
shown += 1;
|
|
91
|
-
}
|
|
92
|
-
if (files.length > perDirectory)
|
|
93
|
-
lines.push(`${' '.repeat(depth)}... ${files.length - perDirectory} more files`);
|
|
94
|
-
if (shown >= limit) {
|
|
95
|
-
lines.push(`... ${paths.length - shown} more files`);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return lines.join('\n');
|
|
100
|
-
}
|
|
101
|
-
export async function buildContext(root, opts = {}) {
|
|
102
|
-
const ignore = await loadIgnore(root);
|
|
103
|
-
const all = await walk(root, ignore);
|
|
104
|
-
const scored = [];
|
|
105
|
-
for (const file of all) {
|
|
106
|
-
const base = file.path.split('/').pop();
|
|
107
|
-
const reason = REASONS.find((r) => r.test(file.path, base));
|
|
108
|
-
if (!reason)
|
|
109
|
-
continue;
|
|
110
|
-
if (!DOC.test(base) && !SCHEMA.test(base) && !CODE.test(base) && reason.why !== 'configuration')
|
|
111
|
-
continue;
|
|
112
|
-
scored.push({ path: file.path, why: reason.why, bytes: file.bytes, weight: reason.weight });
|
|
113
|
-
}
|
|
114
|
-
// largest first within a reason, as a rough proxy for how central a file is
|
|
115
|
-
scored.sort((a, b) => b.weight - a.weight || b.bytes - a.bytes);
|
|
116
|
-
const limit = opts.maxFiles ?? MAX_FILES;
|
|
117
|
-
const files = [];
|
|
118
|
-
const withheld = [];
|
|
119
|
-
let total = 0;
|
|
120
|
-
for (const pick of scored) {
|
|
121
|
-
if (files.length >= limit || total >= MAX_TOTAL_BYTES)
|
|
122
|
-
break;
|
|
123
|
-
const text = await readFile(join(root, pick.path), 'utf8').catch(() => undefined);
|
|
124
|
-
if (text === undefined)
|
|
125
|
-
continue;
|
|
126
|
-
// a credential in a file is a refusal, not a warning: what leaves cannot come back
|
|
127
|
-
const secrets = scanSecrets(text);
|
|
128
|
-
if (secrets.length > 0) {
|
|
129
|
-
withheld.push({ path: pick.path, why: `${secrets[0].what} on line ${secrets[0].line}` });
|
|
130
|
-
continue;
|
|
131
|
-
}
|
|
132
|
-
const truncated = text.length > MAX_BYTES_PER_FILE;
|
|
133
|
-
const body = truncated ? `${text.slice(0, MAX_BYTES_PER_FILE)}\n... truncated` : text;
|
|
134
|
-
total += body.length;
|
|
135
|
-
files.push({ path: pick.path, why: pick.why, bytes: pick.bytes, text: body, truncated });
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
root,
|
|
139
|
-
tree: renderTree(all.map((f) => f.path)),
|
|
140
|
-
signals: await scanProject(root),
|
|
141
|
-
installed: opts.installed ?? [],
|
|
142
|
-
files,
|
|
143
|
-
withheld,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/** The bundle as one markdown document, which is what a model is handed. */
|
|
147
|
-
export function renderContext(bundle) {
|
|
148
|
-
const parts = [];
|
|
149
|
-
parts.push('# Project context bundle\n');
|
|
150
|
-
parts.push(`Collected by \`skyl context\` from \`${bundle.root}\`. Files were selected by rule, not by a model.\n`);
|
|
151
|
-
parts.push('## Directory tree\n');
|
|
152
|
-
parts.push('```\n' + bundle.tree + '\n```\n');
|
|
153
|
-
const signals = Object.entries(bundle.signals).filter(([, v]) => v.length > 0);
|
|
154
|
-
if (signals.length > 0) {
|
|
155
|
-
parts.push('## What the build declares\n');
|
|
156
|
-
for (const [key, values] of signals) {
|
|
157
|
-
parts.push(`**${key}**\n`);
|
|
158
|
-
parts.push(values.map((v) => `- ${v}`).join('\n') + '\n');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (bundle.installed.length > 0) {
|
|
162
|
-
parts.push('## Skills already installed\n');
|
|
163
|
-
parts.push('Do not restate anything these cover.\n');
|
|
164
|
-
parts.push(bundle.installed.map((s) => `- ${s}`).join('\n') + '\n');
|
|
165
|
-
}
|
|
166
|
-
parts.push('## Files\n');
|
|
167
|
-
for (const file of bundle.files) {
|
|
168
|
-
parts.push(`### ${file.path}\n`);
|
|
169
|
-
parts.push(`_selected as ${file.why}${file.truncated ? ', truncated' : ''}_\n`);
|
|
170
|
-
parts.push('```\n' + file.text.replace(/```/g, '```') + '\n```\n');
|
|
171
|
-
}
|
|
172
|
-
if (bundle.withheld.length > 0) {
|
|
173
|
-
parts.push('## Withheld\n');
|
|
174
|
-
parts.push('These matched the selection rules and were not included.\n');
|
|
175
|
-
parts.push(bundle.withheld.map((w) => `- ${w.path}, ${w.why}`).join('\n') + '\n');
|
|
176
|
-
}
|
|
177
|
-
return parts.join('\n');
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA0BxC,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,eAAe,GAAG,OAAO,CAAC;AAChC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAEtI,MAAM,GAAG,GAAG,uBAAuB,CAAC;AACpC,MAAM,MAAM,GAAG,oCAAoC,CAAC;AACpD,MAAM,IAAI,GAAG,0EAA0E,CAAC;AACxF,MAAM,OA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C,IAAI,IAAI,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QACzE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/ignore.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enough of `.gitignore` to be trustworthy on a real repository.
|
|
3
|
-
*
|
|
4
|
-
* Not a complete implementation, and it does not need to be: the consequence of getting
|
|
5
|
-
* a pattern wrong here is that a file is read and possibly sent to a model, so the rule
|
|
6
|
-
* is that anything uncertain is excluded rather than included. Negation is supported
|
|
7
|
-
* because `!` is how people re-admit a directory they excluded broadly, and dropping it
|
|
8
|
-
* would silently send nothing at all.
|
|
9
|
-
*/
|
|
10
|
-
export interface Ignore {
|
|
11
|
-
ignored(relativePath: string, isDirectory: boolean): boolean;
|
|
12
|
-
}
|
|
13
|
-
interface Pattern {
|
|
14
|
-
re: RegExp;
|
|
15
|
-
negated: boolean;
|
|
16
|
-
directoryOnly: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function parseIgnore(text: string): Pattern[];
|
|
19
|
-
export declare function loadIgnore(root: string, extra?: readonly string[]): Promise<Ignore>;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=ignore.d.ts.map
|
package/dist/ignore.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,MAAM,WAAW,MAAM;IACrB,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC;CAC9D;AAED,UAAU,OAAO;IACf,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;CACxB;AAmBD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAenD;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAqB7F"}
|
package/dist/ignore.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
function toRegExp(glob) {
|
|
4
|
-
let source = '';
|
|
5
|
-
for (let i = 0; i < glob.length; i += 1) {
|
|
6
|
-
const c = glob[i];
|
|
7
|
-
if (c === '*') {
|
|
8
|
-
if (glob[i + 1] === '*') {
|
|
9
|
-
// `**/` spans directories, a bare `**` is the same as `*` for our purpose
|
|
10
|
-
if (glob[i + 2] === '/') {
|
|
11
|
-
source += '(?:.*/)?';
|
|
12
|
-
i += 2;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
source += '.*';
|
|
16
|
-
i += 1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
else
|
|
20
|
-
source += '[^/]*';
|
|
21
|
-
}
|
|
22
|
-
else if (c === '?')
|
|
23
|
-
source += '[^/]';
|
|
24
|
-
else if ('\\^$.|+()[]{}'.includes(c))
|
|
25
|
-
source += `\\${c}`;
|
|
26
|
-
else
|
|
27
|
-
source += c;
|
|
28
|
-
}
|
|
29
|
-
return new RegExp(`^${source}$`);
|
|
30
|
-
}
|
|
31
|
-
export function parseIgnore(text) {
|
|
32
|
-
const out = [];
|
|
33
|
-
for (const raw of text.split('\n')) {
|
|
34
|
-
let line = raw.trim();
|
|
35
|
-
if (line === '' || line.startsWith('#'))
|
|
36
|
-
continue;
|
|
37
|
-
const negated = line.startsWith('!');
|
|
38
|
-
if (negated)
|
|
39
|
-
line = line.slice(1);
|
|
40
|
-
const directoryOnly = line.endsWith('/');
|
|
41
|
-
if (directoryOnly)
|
|
42
|
-
line = line.slice(0, -1);
|
|
43
|
-
// a pattern without a slash matches at any depth, one with a slash is rooted
|
|
44
|
-
const anchored = line.includes('/');
|
|
45
|
-
if (line.startsWith('/'))
|
|
46
|
-
line = line.slice(1);
|
|
47
|
-
out.push({ re: toRegExp(anchored ? line : `**/${line}`), negated, directoryOnly });
|
|
48
|
-
}
|
|
49
|
-
return out;
|
|
50
|
-
}
|
|
51
|
-
export async function loadIgnore(root, extra = []) {
|
|
52
|
-
const patterns = [];
|
|
53
|
-
for (const file of ['.gitignore', '.skylignore']) {
|
|
54
|
-
const text = await readFile(join(root, file), 'utf8').catch(() => undefined);
|
|
55
|
-
if (text !== undefined)
|
|
56
|
-
patterns.push(...parseIgnore(text));
|
|
57
|
-
}
|
|
58
|
-
patterns.push(...parseIgnore(extra.join('\n')));
|
|
59
|
-
return {
|
|
60
|
-
ignored(path, isDirectory) {
|
|
61
|
-
// every ancestor directory, so `build/` excludes what is inside it as well
|
|
62
|
-
const parents = segments(path);
|
|
63
|
-
let result = false;
|
|
64
|
-
for (const p of patterns) {
|
|
65
|
-
const self = (!p.directoryOnly || isDirectory) && p.re.test(path);
|
|
66
|
-
const under = parents.some((s) => p.re.test(s));
|
|
67
|
-
if (self || under)
|
|
68
|
-
result = !p.negated;
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
/** Every parent path, so a match on a directory excludes what is inside it. */
|
|
75
|
-
function segments(path) {
|
|
76
|
-
const parts = path.split('/');
|
|
77
|
-
return parts.slice(0, -1).map((_, i) => parts.slice(0, i + 1).join('/'));
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=ignore.js.map
|
package/dist/ignore.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignore.js","sourceRoot":"","sources":["../src/ignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAqBjC,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACd,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,0EAA0E;gBAC1E,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAAC,MAAM,IAAI,UAAU,CAAC;oBAAC,CAAC,IAAI,CAAC,CAAC;gBAAC,CAAC;qBACrD,CAAC;oBAAC,MAAM,IAAI,IAAI,CAAC;oBAAC,CAAC,IAAI,CAAC,CAAC;gBAAC,CAAC;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,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3E,CAAC"}
|
package/dist/install.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Lockfile, type Skill, type Target } from '@skyl/core';
|
|
2
|
-
export declare function readLockfile(root: string): Promise<Lockfile | undefined>;
|
|
3
|
-
export declare function writeLockfile(root: string, lock: Lockfile): Promise<void>;
|
|
4
|
-
/** What gets written for a skill, under the conventions of one target. */
|
|
5
|
-
export declare function renderFor(target: Target, skill: Skill): string;
|
|
6
|
-
export declare function pathFor(root: string, target: Target, skill: Skill): string;
|
|
7
|
-
export declare function readInstalled(root: string, target: Target, skill: Skill): Promise<string | undefined>;
|
|
8
|
-
export declare function install(root: string, target: Target, ordered: readonly Skill[], requested: ReadonlySet<string>, existing: Lockfile | undefined): Promise<Lockfile>;
|
|
9
|
-
export declare function resolveTarget(id: string | undefined, lock: Lockfile | undefined): Target;
|
|
10
|
-
//# sourceMappingURL=install.d.ts.map
|
package/dist/install.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAEO,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EACnD,MAAM,YAAY,CAAC;AAEpB,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAM9E;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/E;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAG9D;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAE1E;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAM3G;AAED,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,EAC9B,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,OAAO,CAAC,QAAQ,CAAC,CAmBnB;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAOxF"}
|
package/dist/install.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { DEFAULT_TARGET, LOCKFILE_NAME, entryFor, formatLockfile, parseLockfile, targetById, } from '@skyl/core';
|
|
4
|
-
export async function readLockfile(root) {
|
|
5
|
-
try {
|
|
6
|
-
return parseLockfile(await readFile(join(root, LOCKFILE_NAME), 'utf8'));
|
|
7
|
-
}
|
|
8
|
-
catch {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export async function writeLockfile(root, lock) {
|
|
13
|
-
await writeFile(join(root, LOCKFILE_NAME), formatLockfile(lock), 'utf8');
|
|
14
|
-
}
|
|
15
|
-
/** What gets written for a skill, under the conventions of one target. */
|
|
16
|
-
export function renderFor(target, skill) {
|
|
17
|
-
const header = target.header?.(skill.name, skill.version) ?? '';
|
|
18
|
-
return `${header}${skill.installable}\n`;
|
|
19
|
-
}
|
|
20
|
-
export function pathFor(root, target, skill) {
|
|
21
|
-
return join(root, target.dir, target.fileFor(skill.name));
|
|
22
|
-
}
|
|
23
|
-
export async function readInstalled(root, target, skill) {
|
|
24
|
-
try {
|
|
25
|
-
return await readFile(pathFor(root, target, skill), 'utf8');
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export async function install(root, target, ordered, requested, existing) {
|
|
32
|
-
const lock = {
|
|
33
|
-
lockfileVersion: 1,
|
|
34
|
-
target: target.id,
|
|
35
|
-
skills: { ...(existing?.target === target.id ? existing.skills : {}) },
|
|
36
|
-
};
|
|
37
|
-
for (const skill of ordered) {
|
|
38
|
-
const file = pathFor(root, target, skill);
|
|
39
|
-
const text = renderFor(target, skill);
|
|
40
|
-
await mkdir(dirname(file), { recursive: true });
|
|
41
|
-
await writeFile(file, text, 'utf8');
|
|
42
|
-
lock.skills[skill.name] = entryFor(skill, text, requested.has(skill.name) ? 'requested' : 'required');
|
|
43
|
-
}
|
|
44
|
-
return lock;
|
|
45
|
-
}
|
|
46
|
-
export function resolveTarget(id, lock) {
|
|
47
|
-
const wanted = id ?? lock?.target ?? DEFAULT_TARGET;
|
|
48
|
-
const target = targetById(wanted);
|
|
49
|
-
if (!target) {
|
|
50
|
-
throw new Error(`unknown target \`${wanted}\``);
|
|
51
|
-
}
|
|
52
|
-
return target;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=install.js.map
|
package/dist/install.js.map
DELETED
|
@@ -1 +0,0 @@
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EAAsB,EAAE,IAA0B;IAC9E,MAAM,MAAM,GAAG,EAAE,IAAI,IAAI,EAAE,MAAM,IAAI,cAAc,CAAC;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/learn.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ContextBundle } from './context.ts';
|
|
2
|
-
/**
|
|
3
|
-
* The generated file is a skill like any other, so an installed agent reads it the same
|
|
4
|
-
* way. What makes it different is that nobody can review it against a corpus: it is true
|
|
5
|
-
* of one repository and only the people working there can say whether it is right.
|
|
6
|
-
*/
|
|
7
|
-
export declare const LEARNED_NAME = "project/core";
|
|
8
|
-
/** Never overwritten by a refresh. If a refresh can eat hand-written text even once, nobody runs it again. */
|
|
9
|
-
export declare const MANUAL_SECTION = "Manual";
|
|
10
|
-
export declare function learnPrompt(bundle: ContextBundle, keep: {
|
|
11
|
-
manual?: string;
|
|
12
|
-
questions?: string;
|
|
13
|
-
}): string;
|
|
14
|
-
/** What a refresh has to preserve out of the file that is already there. */
|
|
15
|
-
export declare function preserved(existing: string | undefined): {
|
|
16
|
-
manual?: string;
|
|
17
|
-
questions?: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Take the markdown back out of whatever the agent printed.
|
|
21
|
-
*
|
|
22
|
-
* Headless CLIs vary in how much they wrap the answer, and a fenced block around the
|
|
23
|
-
* whole file is the common case. Anything before the frontmatter is dropped.
|
|
24
|
-
*/
|
|
25
|
-
export declare function extractMarkdown(output: string): string | undefined;
|
|
26
|
-
/** Put back what the model was told to carry, in case it did not. */
|
|
27
|
-
export declare function reattach(generated: string, keep: {
|
|
28
|
-
manual?: string;
|
|
29
|
-
questions?: string;
|
|
30
|
-
}): string;
|
|
31
|
-
/**
|
|
32
|
-
* A header that travels with the file into the repository.
|
|
33
|
-
*
|
|
34
|
-
* Docs nobody opens cannot carry this warning. The file itself can, and the agent reading
|
|
35
|
-
* it sees the date and can treat old content with the suspicion it deserves.
|
|
36
|
-
*/
|
|
37
|
-
export declare function caution(date: string, sha: string | undefined): string;
|
|
38
|
-
/**
|
|
39
|
-
* The caution goes after the frontmatter, not before it.
|
|
40
|
-
*
|
|
41
|
-
* A skill file starts at `---` and a parser that finds anything else gives up, so putting
|
|
42
|
-
* the comment first would make the generated file the one skill nothing can read.
|
|
43
|
-
*/
|
|
44
|
-
export declare function withCaution(markdown: string, date: string, sha: string | undefined): string;
|
|
45
|
-
//# sourceMappingURL=learn.d.ts.map
|
package/dist/learn.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"learn.d.ts","sourceRoot":"","sources":["../src/learn.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD;;;;GAIG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAE3C,8GAA8G;AAC9G,eAAO,MAAM,cAAc,WAAW,CAAC;AA2DvC,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAcxG;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAS/F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMlE;AAED,qEAAqE;AACrE,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBjG;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAK3F"}
|