claude-turing 4.7.0 → 4.8.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/.claude-plugin/plugin.json +2 -2
- package/README.md +1 -1
- package/commands/ablate.md +0 -1
- package/commands/annotate.md +0 -1
- package/commands/archive.md +0 -1
- package/commands/audit.md +0 -1
- package/commands/baseline.md +0 -1
- package/commands/brief.md +0 -1
- package/commands/budget.md +0 -1
- package/commands/calibrate.md +0 -1
- package/commands/card.md +0 -1
- package/commands/changelog.md +0 -1
- package/commands/checkpoint.md +0 -1
- package/commands/cite.md +0 -1
- package/commands/compare.md +0 -1
- package/commands/counterfactual.md +0 -1
- package/commands/curriculum.md +0 -1
- package/commands/design.md +0 -1
- package/commands/diagnose.md +0 -1
- package/commands/diff.md +0 -1
- package/commands/distill.md +0 -1
- package/commands/doctor.md +0 -1
- package/commands/ensemble.md +0 -1
- package/commands/explore.md +0 -1
- package/commands/export.md +0 -1
- package/commands/feature.md +0 -1
- package/commands/flashback.md +0 -1
- package/commands/fork.md +0 -1
- package/commands/frontier.md +0 -1
- package/commands/init.md +0 -1
- package/commands/leak.md +0 -1
- package/commands/lit.md +0 -1
- package/commands/logbook.md +0 -1
- package/commands/merge.md +0 -1
- package/commands/mode.md +0 -1
- package/commands/onboard.md +0 -1
- package/commands/paper.md +0 -1
- package/commands/plan.md +0 -1
- package/commands/poster.md +0 -1
- package/commands/postmortem.md +0 -1
- package/commands/preflight.md +0 -1
- package/commands/present.md +0 -1
- package/commands/profile.md +0 -1
- package/commands/prune.md +0 -1
- package/commands/quantize.md +0 -1
- package/commands/queue.md +0 -1
- package/commands/registry.md +0 -1
- package/commands/regress.md +0 -1
- package/commands/replay.md +0 -1
- package/commands/report.md +0 -1
- package/commands/reproduce.md +0 -1
- package/commands/retry.md +0 -1
- package/commands/review.md +0 -1
- package/commands/sanity.md +0 -1
- package/commands/scale.md +0 -1
- package/commands/search.md +0 -1
- package/commands/seed.md +0 -1
- package/commands/sensitivity.md +0 -1
- package/commands/share.md +0 -1
- package/commands/simulate.md +0 -1
- package/commands/status.md +0 -1
- package/commands/stitch.md +0 -1
- package/commands/suggest.md +0 -1
- package/commands/surgery.md +0 -1
- package/commands/sweep.md +0 -1
- package/commands/template.md +0 -1
- package/commands/train.md +0 -1
- package/commands/transfer.md +0 -1
- package/commands/trend.md +0 -1
- package/commands/try.md +0 -1
- package/commands/turing.md +3 -3
- package/commands/update.md +0 -1
- package/commands/validate.md +0 -1
- package/commands/warm.md +0 -1
- package/commands/watch.md +0 -1
- package/commands/whatif.md +0 -1
- package/commands/xray.md +0 -1
- package/config/commands.yaml +74 -74
- package/package.json +3 -2
- package/skills/turing/SKILL.md +3 -3
- package/skills/turing/ablate/SKILL.md +0 -1
- package/skills/turing/annotate/SKILL.md +0 -1
- package/skills/turing/archive/SKILL.md +0 -1
- package/skills/turing/audit/SKILL.md +0 -1
- package/skills/turing/baseline/SKILL.md +0 -1
- package/skills/turing/brief/SKILL.md +0 -1
- package/skills/turing/budget/SKILL.md +0 -1
- package/skills/turing/calibrate/SKILL.md +0 -1
- package/skills/turing/card/SKILL.md +0 -1
- package/skills/turing/changelog/SKILL.md +0 -1
- package/skills/turing/checkpoint/SKILL.md +0 -1
- package/skills/turing/cite/SKILL.md +0 -1
- package/skills/turing/compare/SKILL.md +0 -1
- package/skills/turing/counterfactual/SKILL.md +0 -1
- package/skills/turing/curriculum/SKILL.md +0 -1
- package/skills/turing/design/SKILL.md +0 -1
- package/skills/turing/diagnose/SKILL.md +0 -1
- package/skills/turing/diff/SKILL.md +0 -1
- package/skills/turing/distill/SKILL.md +0 -1
- package/skills/turing/doctor/SKILL.md +0 -1
- package/skills/turing/ensemble/SKILL.md +0 -1
- package/skills/turing/explore/SKILL.md +0 -1
- package/skills/turing/export/SKILL.md +0 -1
- package/skills/turing/feature/SKILL.md +0 -1
- package/skills/turing/flashback/SKILL.md +0 -1
- package/skills/turing/fork/SKILL.md +0 -1
- package/skills/turing/frontier/SKILL.md +0 -1
- package/skills/turing/init/SKILL.md +0 -1
- package/skills/turing/leak/SKILL.md +0 -1
- package/skills/turing/lit/SKILL.md +0 -1
- package/skills/turing/logbook/SKILL.md +0 -1
- package/skills/turing/merge/SKILL.md +0 -1
- package/skills/turing/mode/SKILL.md +0 -1
- package/skills/turing/onboard/SKILL.md +0 -1
- package/skills/turing/paper/SKILL.md +0 -1
- package/skills/turing/plan/SKILL.md +0 -1
- package/skills/turing/poster/SKILL.md +0 -1
- package/skills/turing/postmortem/SKILL.md +0 -1
- package/skills/turing/preflight/SKILL.md +0 -1
- package/skills/turing/present/SKILL.md +0 -1
- package/skills/turing/profile/SKILL.md +0 -1
- package/skills/turing/prune/SKILL.md +0 -1
- package/skills/turing/quantize/SKILL.md +0 -1
- package/skills/turing/queue/SKILL.md +0 -1
- package/skills/turing/registry/SKILL.md +0 -1
- package/skills/turing/regress/SKILL.md +0 -1
- package/skills/turing/replay/SKILL.md +0 -1
- package/skills/turing/report/SKILL.md +0 -1
- package/skills/turing/reproduce/SKILL.md +0 -1
- package/skills/turing/retry/SKILL.md +0 -1
- package/skills/turing/review/SKILL.md +0 -1
- package/skills/turing/sanity/SKILL.md +0 -1
- package/skills/turing/scale/SKILL.md +0 -1
- package/skills/turing/search/SKILL.md +0 -1
- package/skills/turing/seed/SKILL.md +0 -1
- package/skills/turing/sensitivity/SKILL.md +0 -1
- package/skills/turing/share/SKILL.md +0 -1
- package/skills/turing/simulate/SKILL.md +0 -1
- package/skills/turing/status/SKILL.md +0 -1
- package/skills/turing/stitch/SKILL.md +0 -1
- package/skills/turing/suggest/SKILL.md +0 -1
- package/skills/turing/surgery/SKILL.md +0 -1
- package/skills/turing/sweep/SKILL.md +0 -1
- package/skills/turing/template/SKILL.md +0 -1
- package/skills/turing/train/SKILL.md +0 -1
- package/skills/turing/transfer/SKILL.md +0 -1
- package/skills/turing/trend/SKILL.md +0 -1
- package/skills/turing/try/SKILL.md +0 -1
- package/skills/turing/update/SKILL.md +0 -1
- package/skills/turing/validate/SKILL.md +0 -1
- package/skills/turing/warm/SKILL.md +0 -1
- package/skills/turing/watch/SKILL.md +0 -1
- package/skills/turing/whatif/SKILL.md +0 -1
- package/skills/turing/xray/SKILL.md +0 -1
- package/src/command-registry.js +12 -0
- package/src/install.js +4 -3
- package/src/sync-commands-layout.js +149 -0
- package/src/sync-skills-layout.js +4 -133
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: validate
|
|
3
3
|
description: Run stability validation on the current experiment configuration. Executes N runs to measure metric variance and auto-configures multi-run evaluation if variance is too high.
|
|
4
|
-
disable-model-invocation: true
|
|
5
4
|
argument-hint: "[--auto]"
|
|
6
5
|
allowed-tools: Read, Bash(*), Grep, Glob
|
|
7
6
|
---
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: warm
|
|
3
3
|
description: Warm-start from a prior model — load checkpoint, optionally freeze layers, adjust learning rate, and continue training.
|
|
4
|
-
disable-model-invocation: true
|
|
5
4
|
argument-hint: "<exp-id> [--freeze-layers encoder] [--unfreeze-after 5]"
|
|
6
5
|
allowed-tools: Read, Bash(*), Grep, Glob
|
|
7
6
|
---
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: watch
|
|
3
3
|
description: Live training monitor with early-warning alerts for loss spikes, NaN, overfitting, and metric plateaus.
|
|
4
|
-
disable-model-invocation: true
|
|
5
4
|
argument-hint: "[--alerts] [--interval 10] [--analyze run.log]"
|
|
6
5
|
allowed-tools: Read, Bash(*), Grep, Glob
|
|
7
6
|
---
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xray
|
|
3
3
|
description: Internal model diagnostics — gradient flow, dead neurons, activation stats, weight distributions, tree depth analysis.
|
|
4
|
-
disable-model-invocation: true
|
|
5
4
|
argument-hint: "[exp-id] [--layer encoder.layer.2] [--compare exp-a exp-b]"
|
|
6
5
|
allowed-tools: Read, Bash(*), Grep, Glob
|
|
7
6
|
---
|
package/src/command-registry.js
CHANGED
|
@@ -140,11 +140,13 @@ export async function getCommandNames(registryPath) {
|
|
|
140
140
|
return registry.commandNames;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
// Installed public layout under .claude/commands/turing.
|
|
143
144
|
export async function getExpectedCommandPaths(registryPath) {
|
|
144
145
|
const names = await getCommandNames(registryPath);
|
|
145
146
|
return ['SKILL.md', ...names.map((name) => `${name}/SKILL.md`)];
|
|
146
147
|
}
|
|
147
148
|
|
|
149
|
+
// Editable repository source layout.
|
|
148
150
|
export async function getExpectedSkillSourcePaths(registryPath) {
|
|
149
151
|
const names = await getCommandNames(registryPath);
|
|
150
152
|
return [
|
|
@@ -154,6 +156,16 @@ export async function getExpectedSkillSourcePaths(registryPath) {
|
|
|
154
156
|
];
|
|
155
157
|
}
|
|
156
158
|
|
|
159
|
+
// Generated repository compatibility layout.
|
|
160
|
+
export async function getExpectedLegacyCommandCompatPaths(registryPath) {
|
|
161
|
+
const names = await getCommandNames(registryPath);
|
|
162
|
+
return [
|
|
163
|
+
'commands/turing.md',
|
|
164
|
+
...names.map((name) => `commands/${name}.md`),
|
|
165
|
+
'commands/rules/loop-protocol.md',
|
|
166
|
+
];
|
|
167
|
+
}
|
|
168
|
+
|
|
157
169
|
export async function getConfigFiles(registryPath) {
|
|
158
170
|
const registry = await loadCommandRegistry(registryPath);
|
|
159
171
|
return registry.configFiles;
|
package/src/install.js
CHANGED
|
@@ -18,6 +18,7 @@ import { getCommandNames, getConfigFiles } from "./command-registry.js";
|
|
|
18
18
|
|
|
19
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
20
|
const PLUGIN_ROOT = join(__dirname, "..");
|
|
21
|
+
const SKILL_SOURCE_ROOT = join(PLUGIN_ROOT, "skills", "turing");
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
export async function install(opts = {}) {
|
|
@@ -37,7 +38,7 @@ export async function install(opts = {}) {
|
|
|
37
38
|
|
|
38
39
|
// Copy root command (router) as SKILL.md
|
|
39
40
|
await copyFile(
|
|
40
|
-
join(
|
|
41
|
+
join(SKILL_SOURCE_ROOT, "SKILL.md"),
|
|
41
42
|
join(paths.commands, "SKILL.md"),
|
|
42
43
|
);
|
|
43
44
|
console.log(" Router -> SKILL.md");
|
|
@@ -45,7 +46,7 @@ export async function install(opts = {}) {
|
|
|
45
46
|
// Copy sub-commands as <name>/SKILL.md
|
|
46
47
|
for (const cmd of subCommands) {
|
|
47
48
|
await copyFile(
|
|
48
|
-
join(
|
|
49
|
+
join(SKILL_SOURCE_ROOT, cmd, "SKILL.md"),
|
|
49
50
|
join(paths.commands, cmd, "SKILL.md"),
|
|
50
51
|
);
|
|
51
52
|
}
|
|
@@ -53,7 +54,7 @@ export async function install(opts = {}) {
|
|
|
53
54
|
|
|
54
55
|
// Copy rules
|
|
55
56
|
await copyFile(
|
|
56
|
-
join(
|
|
57
|
+
join(SKILL_SOURCE_ROOT, "rules", "loop-protocol.md"),
|
|
57
58
|
join(paths.commands, "rules", "loop-protocol.md"),
|
|
58
59
|
);
|
|
59
60
|
console.log(" Rules installed");
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Synchronize the legacy commands/ compatibility tree from skills/turing/.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node src/sync-commands-layout.js [--check]
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { mkdir, readdir, readFile, rm, writeFile } from "fs/promises";
|
|
10
|
+
import { dirname, join, relative } from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { getCommandNames } from "./command-registry.js";
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const PLUGIN_ROOT = join(__dirname, "..");
|
|
16
|
+
const SKILLS_DIR = join(PLUGIN_ROOT, "skills", "turing");
|
|
17
|
+
const COMMANDS_DIR = join(PLUGIN_ROOT, "commands");
|
|
18
|
+
|
|
19
|
+
async function readUtf8(path) {
|
|
20
|
+
return readFile(path, "utf8");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function copyTextFile(source, target) {
|
|
24
|
+
await mkdir(dirname(target), { recursive: true });
|
|
25
|
+
await writeFile(target, await readUtf8(source));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function compatibilityEntries() {
|
|
29
|
+
const names = await getCommandNames();
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
source: join(SKILLS_DIR, "SKILL.md"),
|
|
33
|
+
target: join(COMMANDS_DIR, "turing.md"),
|
|
34
|
+
},
|
|
35
|
+
...names.map((name) => ({
|
|
36
|
+
source: join(SKILLS_DIR, name, "SKILL.md"),
|
|
37
|
+
target: join(COMMANDS_DIR, `${name}.md`),
|
|
38
|
+
})),
|
|
39
|
+
{
|
|
40
|
+
source: join(SKILLS_DIR, "rules", "loop-protocol.md"),
|
|
41
|
+
target: join(COMMANDS_DIR, "rules", "loop-protocol.md"),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function existingCompatibilityEntries(dir = COMMANDS_DIR) {
|
|
47
|
+
let entries;
|
|
48
|
+
try {
|
|
49
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error.code === "ENOENT") {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const paths = [];
|
|
58
|
+
for (const entry of entries) {
|
|
59
|
+
const path = join(dir, entry.name);
|
|
60
|
+
paths.push(path);
|
|
61
|
+
if (entry.isDirectory()) {
|
|
62
|
+
paths.push(...await existingCompatibilityEntries(path));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return paths;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function findDrift() {
|
|
69
|
+
const entries = await compatibilityEntries();
|
|
70
|
+
const expectedTargets = new Set(entries.map(({ target }) => target));
|
|
71
|
+
const expectedPaths = new Set([COMMANDS_DIR]);
|
|
72
|
+
for (const target of expectedTargets) {
|
|
73
|
+
let current = target;
|
|
74
|
+
while (current.startsWith(COMMANDS_DIR)) {
|
|
75
|
+
expectedPaths.add(current);
|
|
76
|
+
if (current === COMMANDS_DIR) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
current = dirname(current);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const issues = [];
|
|
83
|
+
|
|
84
|
+
for (const { source, target } of entries) {
|
|
85
|
+
let sourceText;
|
|
86
|
+
try {
|
|
87
|
+
sourceText = await readUtf8(source);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
issues.push(`missing source ${relative(PLUGIN_ROOT, source)}: ${error.message}`);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
let targetText;
|
|
94
|
+
try {
|
|
95
|
+
targetText = await readUtf8(target);
|
|
96
|
+
} catch (error) {
|
|
97
|
+
if (error.code === "ENOENT") {
|
|
98
|
+
issues.push(`missing compatibility file ${relative(PLUGIN_ROOT, target)}`);
|
|
99
|
+
} else {
|
|
100
|
+
issues.push(`cannot read compatibility file ${relative(PLUGIN_ROOT, target)}: ${error.message}`);
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (targetText !== sourceText) {
|
|
106
|
+
issues.push(`diverged compatibility file ${relative(PLUGIN_ROOT, target)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for (const path of await existingCompatibilityEntries()) {
|
|
111
|
+
if (!expectedPaths.has(path)) {
|
|
112
|
+
issues.push(`stale compatibility path ${relative(PLUGIN_ROOT, path)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return issues;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function syncCommandsLayout({ check = false } = {}) {
|
|
120
|
+
if (check) {
|
|
121
|
+
const issues = await findDrift();
|
|
122
|
+
if (issues.length > 0) {
|
|
123
|
+
for (const issue of issues) {
|
|
124
|
+
console.error(issue);
|
|
125
|
+
}
|
|
126
|
+
process.exitCode = 1;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
console.log("commands compatibility tree is in sync");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
await rm(COMMANDS_DIR, { recursive: true, force: true });
|
|
134
|
+
for (const { source, target } of await compatibilityEntries()) {
|
|
135
|
+
await copyTextFile(source, target);
|
|
136
|
+
}
|
|
137
|
+
console.log("commands compatibility tree synchronized");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const isDirectRun =
|
|
141
|
+
process.argv[1] &&
|
|
142
|
+
fileURLToPath(import.meta.url).endsWith(process.argv[1].replace(/^.*\//, ""));
|
|
143
|
+
|
|
144
|
+
if (isDirectRun) {
|
|
145
|
+
syncCommandsLayout({ check: process.argv.includes("--check") }).catch((error) => {
|
|
146
|
+
console.error(error.message);
|
|
147
|
+
process.exitCode = 1;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -1,148 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Backward-compatible wrapper for the flipped source layout.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* node src/sync-skills-layout.js [--check]
|
|
5
|
+
* The editable source is now skills/turing/, and sync generates commands/.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
|
-
import { mkdir, readdir, readFile, rm, writeFile } from "fs/promises";
|
|
10
|
-
import { dirname, join, relative } from "path";
|
|
11
8
|
import { fileURLToPath } from "url";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
-
const PLUGIN_ROOT = join(__dirname, "..");
|
|
16
|
-
const COMMANDS_DIR = join(PLUGIN_ROOT, "commands");
|
|
17
|
-
const SKILLS_DIR = join(PLUGIN_ROOT, "skills", "turing");
|
|
18
|
-
|
|
19
|
-
async function readUtf8(path) {
|
|
20
|
-
return readFile(path, "utf8");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function copyTextFile(source, target) {
|
|
24
|
-
await mkdir(dirname(target), { recursive: true });
|
|
25
|
-
await writeFile(target, await readUtf8(source));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function mirrorEntries() {
|
|
29
|
-
const names = await getCommandNames();
|
|
30
|
-
return [
|
|
31
|
-
{
|
|
32
|
-
source: join(COMMANDS_DIR, "turing.md"),
|
|
33
|
-
target: join(SKILLS_DIR, "SKILL.md"),
|
|
34
|
-
},
|
|
35
|
-
...names.map((name) => ({
|
|
36
|
-
source: join(COMMANDS_DIR, `${name}.md`),
|
|
37
|
-
target: join(SKILLS_DIR, name, "SKILL.md"),
|
|
38
|
-
})),
|
|
39
|
-
{
|
|
40
|
-
source: join(COMMANDS_DIR, "rules", "loop-protocol.md"),
|
|
41
|
-
target: join(SKILLS_DIR, "rules", "loop-protocol.md"),
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function existingMirrorEntries(dir = SKILLS_DIR) {
|
|
47
|
-
let entries;
|
|
48
|
-
try {
|
|
49
|
-
entries = await readdir(dir, { withFileTypes: true });
|
|
50
|
-
} catch (error) {
|
|
51
|
-
if (error.code === "ENOENT") {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const paths = [];
|
|
58
|
-
for (const entry of entries) {
|
|
59
|
-
const path = join(dir, entry.name);
|
|
60
|
-
paths.push(path);
|
|
61
|
-
if (entry.isDirectory()) {
|
|
62
|
-
paths.push(...await existingMirrorEntries(path));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return paths;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function findDrift() {
|
|
69
|
-
const entries = await mirrorEntries();
|
|
70
|
-
const expectedTargets = new Set(entries.map(({ target }) => target));
|
|
71
|
-
const expectedPaths = new Set([SKILLS_DIR]);
|
|
72
|
-
for (const target of expectedTargets) {
|
|
73
|
-
let current = target;
|
|
74
|
-
while (current.startsWith(SKILLS_DIR)) {
|
|
75
|
-
expectedPaths.add(current);
|
|
76
|
-
if (current === SKILLS_DIR) {
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
current = dirname(current);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const issues = [];
|
|
83
|
-
|
|
84
|
-
for (const { source, target } of entries) {
|
|
85
|
-
let sourceText;
|
|
86
|
-
try {
|
|
87
|
-
sourceText = await readUtf8(source);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
issues.push(`missing source ${relative(PLUGIN_ROOT, source)}: ${error.message}`);
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let targetText;
|
|
94
|
-
try {
|
|
95
|
-
targetText = await readUtf8(target);
|
|
96
|
-
} catch (error) {
|
|
97
|
-
if (error.code === "ENOENT") {
|
|
98
|
-
issues.push(`missing mirror ${relative(PLUGIN_ROOT, target)}`);
|
|
99
|
-
} else {
|
|
100
|
-
issues.push(`cannot read mirror ${relative(PLUGIN_ROOT, target)}: ${error.message}`);
|
|
101
|
-
}
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (targetText !== sourceText) {
|
|
106
|
-
issues.push(`diverged mirror ${relative(PLUGIN_ROOT, target)}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
for (const path of await existingMirrorEntries()) {
|
|
111
|
-
if (!expectedPaths.has(path)) {
|
|
112
|
-
issues.push(`stale mirror ${relative(PLUGIN_ROOT, path)}`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return issues;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export async function syncSkillsLayout({ check = false } = {}) {
|
|
120
|
-
if (check) {
|
|
121
|
-
const issues = await findDrift();
|
|
122
|
-
if (issues.length > 0) {
|
|
123
|
-
for (const issue of issues) {
|
|
124
|
-
console.error(issue);
|
|
125
|
-
}
|
|
126
|
-
process.exitCode = 1;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
console.log("skills/turing mirror is in sync");
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
await rm(SKILLS_DIR, { recursive: true, force: true });
|
|
134
|
-
for (const { source, target } of await mirrorEntries()) {
|
|
135
|
-
await copyTextFile(source, target);
|
|
136
|
-
}
|
|
137
|
-
console.log("skills/turing mirror synchronized");
|
|
138
|
-
}
|
|
9
|
+
import { syncCommandsLayout } from "./sync-commands-layout.js";
|
|
139
10
|
|
|
140
11
|
const isDirectRun =
|
|
141
12
|
process.argv[1] &&
|
|
142
13
|
fileURLToPath(import.meta.url).endsWith(process.argv[1].replace(/^.*\//, ""));
|
|
143
14
|
|
|
144
15
|
if (isDirectRun) {
|
|
145
|
-
|
|
16
|
+
syncCommandsLayout({ check: process.argv.includes("--check") }).catch((error) => {
|
|
146
17
|
console.error(error.message);
|
|
147
18
|
process.exitCode = 1;
|
|
148
19
|
});
|