@r_masseater/vite-plus-adopt 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -21
- package/THIRD-PARTY-NOTICES +0 -251
- package/dist/attw.mjs +289 -254
- package/dist/attw.mjs.map +1 -1
- package/dist/cli.mjs +7 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +61 -2
- package/dist/index.mjs +1 -1
- package/dist/{vpa-MRYbih3E.mjs → vpa-jp87uBqF.mjs} +85 -51
- package/dist/vpa-jp87uBqF.mjs.map +1 -0
- package/package.json +26 -57
- package/skills/configure-checks/SKILL.md +5 -13
- package/dist/fsd.d.mts +0 -10
- package/dist/fsd.mjs +0 -1336
- package/dist/fsd.mjs.map +0 -1
- package/dist/index-DyvYt7R0.d.mts +0 -173
- package/dist/parsers/tree-sitter-astro.wasm +0 -0
- package/dist/parsers/tree-sitter-svelte.wasm +0 -0
- package/dist/parsers/tree-sitter-tsx.wasm +0 -0
- package/dist/parsers/tree-sitter-vue.wasm +0 -0
- package/dist/steiger-CbusAzht.mjs +0 -5944
- package/dist/steiger-CbusAzht.mjs.map +0 -1
- package/dist/vpa-MRYbih3E.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as VpToolsError, n as writeTo, t as runVpa } from "./vpa-
|
|
2
|
+
import { i as VpToolsError, n as writeTo, t as runVpa } from "./vpa-jp87uBqF.mjs";
|
|
3
3
|
import { Cause, Effect, Layer, Option, Path, Schema, Stdio, pipe } from "effect";
|
|
4
|
-
import {
|
|
5
|
-
import { NodeChildProcessSpawner, NodeFileSystem, NodePath, NodeStdio } from "@effect/platform-node-shared";
|
|
6
|
-
// src/shared/lib/node-services.ts
|
|
7
|
-
/** @internal */
|
|
8
|
-
const nodeServicesLayer = Layer.provideMerge(NodeChildProcessSpawner.layer, Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeStdio.layer));
|
|
4
|
+
import { runMainWith } from "@r_masseater/node-main";
|
|
9
5
|
// src/app/run-cli.ts
|
|
10
6
|
const reportFailure = (cause) => {
|
|
11
7
|
const message = pipe(Cause.findErrorOption(cause), Option.filter(Schema.is(VpToolsError)), Option.match({
|
|
@@ -16,9 +12,11 @@ const reportFailure = (cause) => {
|
|
|
16
12
|
};
|
|
17
13
|
/** @internal */
|
|
18
14
|
const runCli = (program) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
runMainWith({
|
|
16
|
+
serviceName: "vpa",
|
|
17
|
+
services: Layer.empty,
|
|
18
|
+
onFailure: reportFailure
|
|
19
|
+
})(program);
|
|
22
20
|
};
|
|
23
21
|
// src/app/cli.ts
|
|
24
22
|
runCli(Effect.gen(function* main() {
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/app/run-cli.ts","../src/app/cli.ts"],"sourcesContent":["import { runMainWith } from \"@r_masseater/node-main\";\nimport { Cause, Layer, Option, Schema, pipe } from \"effect\";\nimport type { Effect, Stdio } from \"effect\";\n\nimport type { CommandServices } from \"#/shared/lib/command.ts\";\nimport { VpToolsError } from \"#/shared/lib/errors.ts\";\nimport { writeTo } from \"#/shared/lib/output.ts\";\n\nconst reportFailure = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> => {\n const message = pipe(\n Cause.findErrorOption(cause),\n Option.filter(Schema.is(VpToolsError)),\n Option.match({\n onNone: () => Cause.pretty(cause),\n onSome: (error) => error.message,\n }),\n );\n return writeTo(\"stderr\", `${message}\\n`);\n};\n\n/** @internal */\nexport const runCli = <Failure>(program: Effect.Effect<void, Failure, CommandServices>): void => {\n runMainWith({\n serviceName: \"vpa\",\n services: Layer.empty,\n onFailure: reportFailure,\n })(program);\n};\n","import { Effect, Path, Stdio } from \"effect\";\n\nimport { runCli } from \"./run-cli.ts\";\nimport { runVpa } from \"./vpa.ts\";\n\nrunCli(\n Effect.gen(function* main() {\n const stdio = yield* Stdio.Stdio;\n const path = yield* Path.Path;\n const args = yield* stdio.args;\n return yield* runVpa(path.resolve(\".\"), args);\n }),\n);\n"],"mappings":";;;;;AAQA,MAAM,iBACJ,UAC4C;CAC5C,MAAM,UAAU,KACd,MAAM,gBAAgB,KAAK,GAC3B,OAAO,OAAO,OAAO,GAAG,YAAY,CAAC,GACrC,OAAO,MAAM;EACX,cAAc,MAAM,OAAO,KAAK;EAChC,SAAS,UAAU,MAAM;CAC3B,CAAC,CACH;CACA,OAAO,QAAQ,UAAU,GAAG,QAAQ,GAAG;AACzC;;AAGA,MAAa,UAAmB,YAAiE;CAC/F,YAAY;EACV,aAAa;EACb,UAAU,MAAM;EAChB,WAAW;CACb,CAAC,CAAC,CAAC,OAAO;AACZ;;ACxBA,OACE,OAAO,IAAI,UAAU,OAAO;CAC1B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,MAAM;CAC1B,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,GAAG,IAAI;AAC9C,CAAC,CACH"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,65 @@
|
|
|
1
|
-
import { a as SteigerSection, c as SkillsSection, i as SteigerConfig, l as VpToolsError, n as DependencyRules, o as TextlintConfig, r as FallowConfig, s as ToolSections, t as CommitlintConfig } from "./index-DyvYt7R0.mjs";
|
|
2
1
|
import { Effect, FileSystem, Path, PlatformError, Schema, Stdio } from "effect";
|
|
3
2
|
import { ChildProcessSpawner } from "effect/process";
|
|
3
|
+
import { TextlintRcConfig } from "@textlint/config-loader";
|
|
4
|
+
import { TextlintKernelRule } from "@textlint/kernel";
|
|
5
|
+
import { H56mConfig } from "@r_masseater/h56m";
|
|
6
|
+
import { UserConfig } from "@commitlint/types";
|
|
7
|
+
declare const VpToolsError_base: Schema.Class<VpToolsError, Schema.TaggedStruct<"VpToolsError", {
|
|
8
|
+
readonly kind: Schema.Literals<readonly ["config-missing", "tool-failed", "checks-failed"]>;
|
|
9
|
+
readonly message: Schema.String;
|
|
10
|
+
}>, import("effect/Cause").YieldableError & {
|
|
11
|
+
readonly brand: unique symbol;
|
|
12
|
+
}>;
|
|
13
|
+
export declare class VpToolsError extends VpToolsError_base {}
|
|
14
|
+
declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
|
|
15
|
+
/** @internal */
|
|
16
|
+
type DependencyField = (typeof DEPENDENCY_FIELDS)[number];
|
|
17
|
+
declare const SkillsSectionSchema: Schema.$Record<Schema.Union<readonly [Schema.String, Schema.String]>, Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly commit: Schema.String;
|
|
19
|
+
readonly root: Schema.optional<Schema.String>;
|
|
20
|
+
readonly skills: Schema.Union<readonly [Schema.Literal<"all">, Schema.NonEmptyArray<Schema.String>]>;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
readonly skills: Schema.Union<readonly [Schema.Literal<"all">, Schema.NonEmptyArray<Schema.String>]>;
|
|
23
|
+
}>]>>;
|
|
24
|
+
type SkillsSection = typeof SkillsSectionSchema.Encoded;
|
|
25
|
+
interface CommitlintConfig extends Readonly<UserConfig> {}
|
|
26
|
+
type TextlintRuleOptions = NonNullable<TextlintKernelRule["options"]>;
|
|
27
|
+
interface TextlintPreset {
|
|
28
|
+
readonly rules: Readonly<Record<string, TextlintKernelRule["rule"]>>;
|
|
29
|
+
readonly rulesConfig: Readonly<Record<string, TextlintRuleOptions>>;
|
|
30
|
+
}
|
|
31
|
+
interface TextlintSource extends TextlintRcConfig {
|
|
32
|
+
readonly files: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
interface TextlintConfig extends TextlintRcConfig {
|
|
35
|
+
readonly ignores?: readonly string[];
|
|
36
|
+
readonly presets?: Readonly<Record<string, TextlintPreset>>;
|
|
37
|
+
readonly sources?: readonly TextlintSource[];
|
|
38
|
+
}
|
|
39
|
+
type FallowConfig = Readonly<Record<string, unknown>>;
|
|
40
|
+
type ManifestField = DependencyField;
|
|
41
|
+
interface AllowedDependencies {
|
|
42
|
+
readonly workspaces: readonly string[];
|
|
43
|
+
readonly dependencies: readonly string[];
|
|
44
|
+
readonly fields?: readonly ManifestField[];
|
|
45
|
+
}
|
|
46
|
+
interface DependencyRules {
|
|
47
|
+
readonly allowed?: Readonly<Record<string, AllowedDependencies>>;
|
|
48
|
+
readonly banned?: Readonly<Record<string, readonly string[]>>;
|
|
49
|
+
readonly exactDependencies?: Readonly<Record<string, readonly string[]>>;
|
|
50
|
+
readonly peerRanges?: "identical" | "intersect";
|
|
51
|
+
}
|
|
52
|
+
interface ToolSections {
|
|
53
|
+
readonly commitlint?: CommitlintConfig;
|
|
54
|
+
readonly dependencyRules?: DependencyRules;
|
|
55
|
+
readonly fallow?: FallowConfig;
|
|
56
|
+
readonly h56m?: H56mConfig;
|
|
57
|
+
readonly skills?: SkillsSection;
|
|
58
|
+
readonly textlint?: TextlintConfig;
|
|
59
|
+
}
|
|
60
|
+
declare module "vite" {
|
|
61
|
+
interface UserConfig extends ToolSections {}
|
|
62
|
+
}
|
|
4
63
|
/** @internal */
|
|
5
64
|
type FileServices = FileSystem.FileSystem | Path.Path;
|
|
6
65
|
/** @internal */
|
|
@@ -16,5 +75,5 @@ export declare const runVpa: {
|
|
|
16
75
|
(args: readonly string[]): (root: string) => CommandEffect;
|
|
17
76
|
(root: string, args: readonly string[]): CommandEffect;
|
|
18
77
|
};
|
|
19
|
-
export {
|
|
78
|
+
export type { CommitlintConfig, DependencyRules, FallowConfig, SkillsSection, TextlintConfig, ToolSections };
|
|
20
79
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as VpToolsError, r as loadViteConfig, t as runVpa } from "./vpa-
|
|
1
|
+
export { i as VpToolsError, r as loadViteConfig, t as runVpa } from "./vpa-jp87uBqF.mjs";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { n as toJson } from "./json-QtVKpodH.mjs";
|
|
2
|
-
import { n as processConfiguration, t as linter } from "./steiger-CbusAzht.mjs";
|
|
3
2
|
import { Array, Boolean as Boolean$1, Config, Context, Effect, Exit, FileSystem, Function, Layer, Option, Order, Path, Predicate, Record, Redacted, Schedule, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
4
3
|
import { resolveConfigFromFile } from "vite-plus";
|
|
5
4
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
|
|
@@ -12,10 +11,10 @@ import { TextlintKernelDescriptor } from "@textlint/kernel";
|
|
|
12
11
|
import { createLinter, loadLinterFormatter } from "textlint";
|
|
13
12
|
import { loadBuiltinPlugins } from "textlint/lib/src/loader/TextlintrcLoader.js";
|
|
14
13
|
import { normalizeTextlintPresetSubRuleKey } from "@textlint/utils";
|
|
14
|
+
import { minimatch } from "minimatch";
|
|
15
15
|
import { parse } from "yaml";
|
|
16
16
|
import { Tar } from "effect/encoding";
|
|
17
17
|
import { format as format$1, makeDetector } from "@r_masseater/h56m";
|
|
18
|
-
import { minimatch } from "minimatch";
|
|
19
18
|
import { findWorkspaceProjectsNoCheck } from "@pnpm/workspace.projects-reader";
|
|
20
19
|
import { readWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-reader";
|
|
21
20
|
import { intersects, valid, validRange } from "semver";
|
|
@@ -65,7 +64,7 @@ const requireSection = (key) => (config) => Effect.fromOption(Option.fromNullish
|
|
|
65
64
|
/** @internal */
|
|
66
65
|
const loadSection = Function.dual(2, (root, key) => loadViteConfig(root).pipe(Effect.flatMap(requireSection(key))));
|
|
67
66
|
// src/features/check-text/model/commitlint.ts
|
|
68
|
-
const DATA_FIRST_ARITY_3$
|
|
67
|
+
const DATA_FIRST_ARITY_3$1 = 3;
|
|
69
68
|
const COMMENT_CHAR = "#";
|
|
70
69
|
const parserOptionsOf = (loaded) => {
|
|
71
70
|
return {
|
|
@@ -80,7 +79,7 @@ const lintOptionsOf = (loaded) => ({
|
|
|
80
79
|
defaultIgnores: loaded.defaultIgnores ?? true
|
|
81
80
|
});
|
|
82
81
|
/** @internal */
|
|
83
|
-
const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$
|
|
82
|
+
const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$1, (config, root, messages) => Effect.gen(function* lintMessages() {
|
|
84
83
|
const loaded = yield* attempt("commitlint")(() => load(config, { cwd: root }));
|
|
85
84
|
const results = yield* Effect.forEach(messages, (message) => attempt("commitlint")(() => lint(message, loaded.rules, lintOptionsOf(loaded))), { concurrency: 1 });
|
|
86
85
|
return {
|
|
@@ -88,7 +87,7 @@ const lintCommitMessages = Function.dual(DATA_FIRST_ARITY_3$2, (config, root, me
|
|
|
88
87
|
output: format({ results }, { color: false })
|
|
89
88
|
};
|
|
90
89
|
}));
|
|
91
|
-
Function.dual(DATA_FIRST_ARITY_3$
|
|
90
|
+
Function.dual(DATA_FIRST_ARITY_3$1, (config, root, messageFile) => Effect.gen(function* read() {
|
|
92
91
|
const message = yield* (yield* FileSystem.FileSystem).readFileString(messageFile);
|
|
93
92
|
return yield* lintCommitMessages(config, root, [message]);
|
|
94
93
|
}));
|
|
@@ -152,7 +151,7 @@ const rawConfigOf = (config) => {
|
|
|
152
151
|
};
|
|
153
152
|
};
|
|
154
153
|
// src/features/check-text/model/textlint.ts
|
|
155
|
-
const DATA_FIRST_ARITY_3
|
|
154
|
+
const DATA_FIRST_ARITY_3 = 3;
|
|
156
155
|
const descriptorOf = (loaded, root, config) => {
|
|
157
156
|
if (!loaded.ok) return Effect.fail(toolFailed("textlint")(loaded.error.message));
|
|
158
157
|
const { rules, filterRules, plugins } = loaded.config;
|
|
@@ -164,7 +163,7 @@ const descriptorOf = (loaded, root, config) => {
|
|
|
164
163
|
}));
|
|
165
164
|
};
|
|
166
165
|
/** @internal */
|
|
167
|
-
const lintTexts = Function.dual(DATA_FIRST_ARITY_3
|
|
166
|
+
const lintTexts = Function.dual(DATA_FIRST_ARITY_3, (config, root, files) => Effect.gen(function* lint() {
|
|
168
167
|
const path = yield* Path.Path;
|
|
169
168
|
yield* attempt("textlint")(() => import("vite-plus/register"));
|
|
170
169
|
const loaded = yield* attempt("textlint")(() => loadPackagesFromRawConfig({
|
|
@@ -259,6 +258,21 @@ const runCaptured = ({ root, file, args, env = {}, input, output = "all" }) => E
|
|
|
259
258
|
output: text
|
|
260
259
|
};
|
|
261
260
|
}).pipe(Effect.scoped);
|
|
261
|
+
// src/features/install-skills/model/pnpm-linked.ts
|
|
262
|
+
/** @internal */
|
|
263
|
+
const PNPM_IGNORE = ".gitignore";
|
|
264
|
+
const OPEN = "# pnpm";
|
|
265
|
+
const CLOSE = "# pnpm end";
|
|
266
|
+
const ROOT$1 = "/";
|
|
267
|
+
const AFTER_MARKER = 1;
|
|
268
|
+
const namesIn = (text) => pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.dropWhile((line) => line !== OPEN), Array.drop(AFTER_MARKER), Array.takeWhile((line) => line !== CLOSE), Array.filter(String$1.startsWith(ROOT$1)), Array.map(String$1.slice(1)));
|
|
269
|
+
/** @internal */
|
|
270
|
+
const pnpmLinkedNames = (skills) => Effect.gen(function* readBlock() {
|
|
271
|
+
const fs = yield* FileSystem.FileSystem;
|
|
272
|
+
const path = yield* Path.Path;
|
|
273
|
+
const text = yield* fs.readFileString(path.join(skills, PNPM_IGNORE));
|
|
274
|
+
return namesIn(text);
|
|
275
|
+
}).pipe(Effect.orElseSucceed(() => []));
|
|
262
276
|
// src/features/install-skills/model/link.ts
|
|
263
277
|
const KEEP = ".gitkeep";
|
|
264
278
|
const junction = (target, link) => runCaptured({
|
|
@@ -285,13 +299,36 @@ const pointsAt = (directory) => ({ name, target }) => Effect.gen(function* readT
|
|
|
285
299
|
const found = yield* fs.readLink(path.join(directory, name));
|
|
286
300
|
return path.resolve(directory, found) === path.resolve(target);
|
|
287
301
|
});
|
|
288
|
-
const isCurrent = (directory, links) => Effect.gen(function* matches() {
|
|
302
|
+
const isCurrent = (directory, links, owned) => Effect.gen(function* matches() {
|
|
289
303
|
const entries = yield* (yield* FileSystem.FileSystem).readDirectory(directory);
|
|
290
|
-
const expected = pipe(links, Array.map(({ name }) => name), Array.
|
|
304
|
+
const expected = pipe(links, Array.map(({ name }) => name), Array.appendAll([
|
|
305
|
+
KEEP,
|
|
306
|
+
PNPM_IGNORE,
|
|
307
|
+
...owned
|
|
308
|
+
]));
|
|
291
309
|
const linked = yield* Effect.forEach(links, pointsAt(directory), { concurrency: 1 });
|
|
292
310
|
return pipe(entries, Array.every((entry) => Array.contains(expected, entry))) && pipe(linked, Array.every(Boolean));
|
|
293
311
|
}).pipe(Effect.orElseSucceed(() => false));
|
|
294
|
-
const
|
|
312
|
+
const keepOwned = (skills, next) => (name) => Effect.gen(function* keepOne() {
|
|
313
|
+
const fs = yield* FileSystem.FileSystem;
|
|
314
|
+
const path = yield* Path.Path;
|
|
315
|
+
const found = yield* fs.readLink(path.join(skills, name));
|
|
316
|
+
if (process.platform === "win32") return yield* linkTo(next)({
|
|
317
|
+
name,
|
|
318
|
+
target: path.resolve(skills, found)
|
|
319
|
+
});
|
|
320
|
+
return yield* linkTo(next)({
|
|
321
|
+
name,
|
|
322
|
+
target: found
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
const keepIgnoreFile = (skills, next) => Effect.gen(function* keepFile() {
|
|
326
|
+
const fs = yield* FileSystem.FileSystem;
|
|
327
|
+
const path = yield* Path.Path;
|
|
328
|
+
const text = yield* fs.readFileString(path.join(skills, PNPM_IGNORE));
|
|
329
|
+
yield* fs.writeFileString(path.join(next, PNPM_IGNORE), text);
|
|
330
|
+
}).pipe(Effect.ignore);
|
|
331
|
+
const buildNext = ({ agents, skills, links, owned }) => Effect.gen(function* stageLinks() {
|
|
295
332
|
const fs = yield* FileSystem.FileSystem;
|
|
296
333
|
const path = yield* Path.Path;
|
|
297
334
|
const next = yield* fs.makeTempDirectory({
|
|
@@ -302,6 +339,11 @@ const buildNext = (agents, skills, links) => Effect.gen(function* stageLinks() {
|
|
|
302
339
|
concurrency: 1,
|
|
303
340
|
discard: true
|
|
304
341
|
});
|
|
342
|
+
yield* Effect.forEach(owned, keepOwned(skills, next), {
|
|
343
|
+
concurrency: 1,
|
|
344
|
+
discard: true
|
|
345
|
+
});
|
|
346
|
+
yield* keepIgnoreFile(skills, next);
|
|
305
347
|
if (yield* fs.exists(path.join(skills, KEEP))) yield* fs.writeFileString(path.join(next, KEEP), "");
|
|
306
348
|
return next;
|
|
307
349
|
});
|
|
@@ -317,17 +359,38 @@ const swapIn = (agents, skills, next) => Effect.gen(function* replaceDirectory()
|
|
|
317
359
|
yield* fs.rename(next, skills);
|
|
318
360
|
return yield* fs.remove(previous, { recursive: true });
|
|
319
361
|
});
|
|
362
|
+
const rejectTaken = (links, owned) => {
|
|
363
|
+
const taken = pipe(links, Array.filter(({ name }) => Array.contains(owned, name)), Array.map(({ name }) => name));
|
|
364
|
+
if (Array.isReadonlyArrayNonEmpty(taken)) return Effect.fail(checksFailed(`pnpm already links ${Array.join(taken, ", ")} into .agents/skills. Take it from one place.`));
|
|
365
|
+
return Effect.void;
|
|
366
|
+
};
|
|
367
|
+
const refresh = (plan) => Effect.gen(function* replaceLinks() {
|
|
368
|
+
yield* (yield* FileSystem.FileSystem).makeDirectory(plan.agents, { recursive: true });
|
|
369
|
+
const next = yield* buildNext(plan);
|
|
370
|
+
yield* swapIn(plan.agents, plan.skills, next);
|
|
371
|
+
});
|
|
320
372
|
/** @internal */
|
|
321
373
|
const linkSkills = (root) => (links) => Effect.gen(function* link() {
|
|
322
|
-
const fs = yield* FileSystem.FileSystem;
|
|
323
374
|
const path = yield* Path.Path;
|
|
324
375
|
const agents = path.join(root, ".agents");
|
|
325
376
|
const skills = path.join(agents, "skills");
|
|
326
|
-
|
|
327
|
-
yield*
|
|
328
|
-
|
|
329
|
-
|
|
377
|
+
const owned = yield* pnpmLinkedNames(skills);
|
|
378
|
+
yield* rejectTaken(links, owned);
|
|
379
|
+
if (!(yield* isCurrent(skills, links, owned))) yield* refresh({
|
|
380
|
+
agents,
|
|
381
|
+
skills,
|
|
382
|
+
links,
|
|
383
|
+
owned
|
|
384
|
+
});
|
|
330
385
|
});
|
|
386
|
+
const ROOT = ".";
|
|
387
|
+
String$1.replaceAll("\\", "/");
|
|
388
|
+
const afterPrefix = (prefix) => (text) => pipe(Option.liftPredicate(text, String$1.startsWith(prefix)), Option.map(String$1.slice(prefix.length)));
|
|
389
|
+
const isWithin = (directory) => (path) => String$1.isEmpty(directory) || path === directory || String$1.startsWith(`${directory}/`)(path);
|
|
390
|
+
const isInside = (directory) => (path) => path !== directory && (directory === ROOT || isWithin(directory)(path));
|
|
391
|
+
const below = (directory) => (path) => pipe(Option.liftPredicate(path, () => String$1.isEmpty(directory)), Option.orElse(() => afterPrefix(`${directory}/`)(path)));
|
|
392
|
+
String$1.startsWith("!");
|
|
393
|
+
String$1.slice(1);
|
|
331
394
|
// src/shared/lib/tar-gz.ts
|
|
332
395
|
const gunzipped = (data) => {
|
|
333
396
|
const compressed = new Blob([new Uint8Array(data)]).stream();
|
|
@@ -360,19 +423,12 @@ const withoutTopDirectory = ({ header, bytes }) => ({
|
|
|
360
423
|
},
|
|
361
424
|
bytes
|
|
362
425
|
});
|
|
363
|
-
/** @internal */
|
|
364
|
-
const isUnder = (directory) => (path) => directory === "" || String$1.startsWith(`${directory}/`)(path);
|
|
365
|
-
/** @internal */
|
|
366
|
-
const relativeTo = (directory) => (path) => {
|
|
367
|
-
if (directory === "") return path;
|
|
368
|
-
return String$1.slice(directory.length + NEXT)(path);
|
|
369
|
-
};
|
|
370
426
|
const parentOf = (path) => pipe(path, String$1.lastIndexOf("/"), Option.match({
|
|
371
427
|
onNone: () => "",
|
|
372
428
|
onSome: (at) => String$1.slice(START, at)(path)
|
|
373
429
|
}));
|
|
374
|
-
const isSkillFile = (root) => (entry) => entry.header.type === "File" && (entry.header.path === SKILL_FILE$1 || String$1.endsWith(`/${SKILL_FILE$1}`)(entry.header.path)) &&
|
|
375
|
-
const isOutermost = (candidates) => ({ directory }) => !pipe(candidates, Array.some((other) => other.directory !== directory &&
|
|
430
|
+
const isSkillFile = (root) => (entry) => entry.header.type === "File" && (entry.header.path === SKILL_FILE$1 || String$1.endsWith(`/${SKILL_FILE$1}`)(entry.header.path)) && isInside(root)(entry.header.path);
|
|
431
|
+
const isOutermost = (candidates) => ({ directory }) => !pipe(candidates, Array.some((other) => other.directory !== directory && isInside(other.directory)(directory)));
|
|
376
432
|
const toFound = ({ directory, name }) => pipe(name, Option.map((found) => ({
|
|
377
433
|
name: found,
|
|
378
434
|
directory
|
|
@@ -406,7 +462,7 @@ const fetchBytes = (request) => Effect.gen(function* fetchArchive() {
|
|
|
406
462
|
});
|
|
407
463
|
const githubToken = Config.option(Config.Redacted("GITHUB_TOKEN")).pipe(Effect.orElseSucceed(Option.none));
|
|
408
464
|
const download = (declared) => Effect.gen(function* downloadArchive() {
|
|
409
|
-
const fromCodeload = yield*
|
|
465
|
+
const fromCodeload = yield* codeload(declared).pipe(fetchBytes, Effect.exit);
|
|
410
466
|
const token = yield* githubToken;
|
|
411
467
|
if (Exit.isSuccess(fromCodeload) || Option.isNone(token)) return yield* fromCodeload;
|
|
412
468
|
return yield* token.value.pipe(api(declared), fetchBytes);
|
|
@@ -475,14 +531,14 @@ const placeAtomically = (target, write) => Effect.gen(function* place() {
|
|
|
475
531
|
const writeEntry = (staging, skill) => ({ header, bytes }) => Effect.gen(function* writeFile() {
|
|
476
532
|
const fs = yield* FileSystem.FileSystem;
|
|
477
533
|
const path = yield* Path.Path;
|
|
478
|
-
const relative =
|
|
534
|
+
const relative = Option.getOrElse(below(skill.directory)(header.path), () => header.path);
|
|
479
535
|
const file = path.join(staging, ...String$1.split("/")(relative));
|
|
480
536
|
yield* fs.makeDirectory(path.dirname(file), { recursive: true });
|
|
481
537
|
yield* fs.writeFile(file, bytes);
|
|
482
538
|
yield* fs.chmod(file, modeOf(header.mode));
|
|
483
539
|
});
|
|
484
540
|
/** @internal */
|
|
485
|
-
const extractSkill = ({ skill, target }) => (entries) => placeAtomically(target, (staging) => Effect.forEach(pipe(entries, Array.filter(({ header }) => header.type === "File" &&
|
|
541
|
+
const extractSkill = ({ skill, target }) => (entries) => placeAtomically(target, (staging) => Effect.forEach(pipe(entries, Array.filter(({ header }) => header.type === "File" && isInside(skill.directory)(header.path))), writeEntry(staging, skill), {
|
|
486
542
|
concurrency: 1,
|
|
487
543
|
discard: true
|
|
488
544
|
}));
|
|
@@ -501,7 +557,7 @@ const writeIndex = (directory) => (available) => Effect.gen(function* writeIndex
|
|
|
501
557
|
yield* fs.remove(staging, { recursive: true });
|
|
502
558
|
});
|
|
503
559
|
// src/features/install-skills/model/source.ts
|
|
504
|
-
const Index = Schema.
|
|
560
|
+
const Index = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
|
|
505
561
|
const readIndex = (directory) => Effect.gen(function* readIndexFile() {
|
|
506
562
|
const fs = yield* FileSystem.FileSystem;
|
|
507
563
|
const path = yield* Path.Path;
|
|
@@ -758,25 +814,7 @@ const checkDependencies = Function.dual(DATA_FIRST_ARITY$1, (rules, dependencies
|
|
|
758
814
|
...exactProblems(rules, dependencies),
|
|
759
815
|
...versionProblems(rules, comparedDependencies(rules, dependencies))
|
|
760
816
|
]);
|
|
761
|
-
// src/features/check-repository/model/steiger.ts
|
|
762
|
-
const DATA_FIRST_ARITY_3 = 3;
|
|
763
|
-
const formatDiagnostic = (relative) => (diagnostic) => `${diagnostic.severity} ${relative(diagnostic.location.path)}: ${diagnostic.message} (${diagnostic.ruleName})`;
|
|
764
|
-
const reportOf = (diagnostics, relative) => ({
|
|
765
|
-
valid: pipe(diagnostics, Array.every((diagnostic) => diagnostic.severity !== "error")),
|
|
766
|
-
output: pipe(diagnostics, Array.map(formatDiagnostic(relative)), Array.join("\n"))
|
|
767
|
-
});
|
|
768
|
-
/** @internal */
|
|
769
|
-
const checkSlices = Function.dual(DATA_FIRST_ARITY_3, (config, root, targets) => Effect.gen(function* check() {
|
|
770
|
-
const path = yield* Path.Path;
|
|
771
|
-
processConfiguration([...config], root);
|
|
772
|
-
const perTarget = yield* Effect.forEach(targets, (target) => attempt("steiger")(() => linter.run(path.resolve(root, target))), { concurrency: 1 });
|
|
773
|
-
return reportOf(Array.flatten(perTarget), (file) => path.relative(root, file));
|
|
774
|
-
}));
|
|
775
817
|
// src/features/check-repository/model/repository-checks.ts
|
|
776
|
-
const LAYER_FOLDER = /\/(?:app|pages|widgets|features|entities|shared)\//gu;
|
|
777
|
-
const layeredDirectories = (root, patterns) => listGitFiles(root, []).pipe(Effect.map((files) => pipe(files, Array.flatMap((file) => Array.map(Array.fromIterable(String$1.matchAll(LAYER_FOLDER)(file)), ({ index }) => String$1.takeLeft(file, index ?? file.length))), Array.dedupe, Array.filter((directory) => pipe(patterns, Array.some((pattern) => minimatch(directory, pattern)))))));
|
|
778
|
-
/** @internal */
|
|
779
|
-
const steigerCheck = withSection("steiger", (section, { root }) => layeredDirectories(root, section.paths).pipe(Effect.flatMap((targets) => checkSlices(section.rules, root, targets))));
|
|
780
818
|
/** @internal */
|
|
781
819
|
const dependenciesCheck = withSection("dependencyRules", (rules, { root }) => listDependencies(root).pipe(Effect.map((dependencies) => {
|
|
782
820
|
const problems = checkDependencies(rules, dependencies);
|
|
@@ -880,10 +918,6 @@ const CHECKS = [
|
|
|
880
918
|
name: "dependencies",
|
|
881
919
|
run: dependenciesCheck
|
|
882
920
|
},
|
|
883
|
-
{
|
|
884
|
-
name: "steiger",
|
|
885
|
-
run: steigerCheck
|
|
886
|
-
},
|
|
887
921
|
{
|
|
888
922
|
name: "textlint",
|
|
889
923
|
run: textlintCheck
|
|
@@ -983,4 +1017,4 @@ const runVpa = Function.dual(DATA_FIRST_ARITY, (root, args) => pipe(args, Array.
|
|
|
983
1017
|
})));
|
|
984
1018
|
export { VpToolsError as i, writeTo as n, loadViteConfig as r, runVpa as t };
|
|
985
1019
|
|
|
986
|
-
//# sourceMappingURL=vpa-
|
|
1020
|
+
//# sourceMappingURL=vpa-jp87uBqF.mjs.map
|