opencastle 1.12.3 → 1.12.5
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 +14 -4
- package/bin/cli.mjs +1 -1
- package/dist/cli/foreign-skills.d.ts +12 -0
- package/dist/cli/foreign-skills.d.ts.map +1 -0
- package/dist/cli/foreign-skills.js +70 -0
- package/dist/cli/foreign-skills.js.map +1 -0
- package/dist/cli/foreign-skills.test.d.ts +2 -0
- package/dist/cli/foreign-skills.test.d.ts.map +1 -0
- package/dist/cli/foreign-skills.test.js +100 -0
- package/dist/cli/foreign-skills.test.js.map +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +15 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/sync-check.d.ts +4 -1
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +25 -2
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +15 -0
- package/dist/cli/update.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/foreign-skills.test.ts +117 -0
- package/src/cli/foreign-skills.ts +74 -0
- package/src/cli/init.ts +14 -1
- package/src/cli/sync-check.ts +28 -3
- package/src/cli/update.ts +16 -0
package/src/cli/sync-check.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
diagnoseManagedFile,
|
|
26
26
|
} from './managed-block.js'
|
|
27
27
|
import { c } from './prompt.js'
|
|
28
|
+
import { foreignSkills, skillFolders } from './foreign-skills.js'
|
|
28
29
|
import { reportToGitHub, COMPARISON_FAILED } from './github-report.js'
|
|
29
30
|
import type { CliContext, IdeChoice, StackConfig } from './types.js'
|
|
30
31
|
|
|
@@ -64,8 +65,11 @@ export interface Drift {
|
|
|
64
65
|
* `team` is a problem in the team's own sources — a config that will not
|
|
65
66
|
* parse, a baseline that is not installed, a policy the sources break. The
|
|
66
67
|
* comparison cannot run until it is fixed, and `sync` refuses to compile.
|
|
68
|
+
*
|
|
69
|
+
* `foreign` is a skill another tool wrote into a compiled folder, which
|
|
70
|
+
* `sync` keeps by moving it into the team's sources (foreign-skills.ts).
|
|
67
71
|
*/
|
|
68
|
-
origin?: 'mcp' | 'team' | 'version' | 'memory'
|
|
72
|
+
origin?: 'mcp' | 'team' | 'version' | 'memory' | 'foreign'
|
|
69
73
|
/** The classifier's own words, so the checker and `doctor` cannot diverge. */
|
|
70
74
|
detail?: string
|
|
71
75
|
/** What resolves it, per entry — these do not share a remedy. */
|
|
@@ -382,6 +386,20 @@ async function compareProject(
|
|
|
382
386
|
}
|
|
383
387
|
}
|
|
384
388
|
|
|
389
|
+
// A skill another tool wrote into a compiled folder is not swept: `sync`
|
|
390
|
+
// makes it the team's (foreign-skills.ts). Still drift, since the other
|
|
391
|
+
// assistants lack it until then, but it is not "removed on the next sync".
|
|
392
|
+
{
|
|
393
|
+
const framework = (await Promise.all(ides.map(async (ide) => (await IDE_ADAPTERS[ide]()).getManagedPaths().framework))).flat()
|
|
394
|
+
for (const skill of foreignSkills(projectRoot, skillFolders(framework), new Set(resolved.items.keys()))) {
|
|
395
|
+
for (const d of drift) {
|
|
396
|
+
if (d.kind !== 'extra' || (d.path !== skill.from && !d.path.startsWith(`${skill.from}/`))) continue
|
|
397
|
+
d.origin = 'foreign'
|
|
398
|
+
d.detail = `added by another tool — sync moves it into .opencastle/skills/${skill.name}/`
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
385
403
|
// The lock: what every assistant is given, as `sync` would record it now.
|
|
386
404
|
// Compared like any generated file, because it is one — a stale lock is a
|
|
387
405
|
// review of something other than what was compiled.
|
|
@@ -771,9 +789,16 @@ function render(report: CheckReport): void {
|
|
|
771
789
|
for (const d of missingFiles) console.log(` ${c.red('-')} ${d.path} ${c.dim(`(${d.ide})`)}`)
|
|
772
790
|
console.log('')
|
|
773
791
|
}
|
|
774
|
-
|
|
792
|
+
const kept = extra.filter((d) => d.origin === 'foreign')
|
|
793
|
+
const swept = extra.filter((d) => d.origin !== 'foreign')
|
|
794
|
+
if (kept.length > 0) {
|
|
795
|
+
console.log(` ${c.bold('Skills another tool added')} ${c.dim('(the next sync keeps them: moved into .opencastle/skills/ and compiled for every assistant)')}`)
|
|
796
|
+
for (const d of kept) console.log(` ${c.green('+')} ${d.path} ${c.dim(`(${d.ide})`)}`)
|
|
797
|
+
console.log('')
|
|
798
|
+
}
|
|
799
|
+
if (swept.length > 0) {
|
|
775
800
|
console.log(` ${c.bold('Not produced by any source')} ${c.dim('(removed on the next sync)')}`)
|
|
776
|
-
for (const d of
|
|
801
|
+
for (const d of swept) console.log(` ${c.red('+')} ${d.path} ${c.dim(`(${d.ide}${d.detail ? ` — ${d.detail}` : ''})`)}`)
|
|
777
802
|
console.log('')
|
|
778
803
|
}
|
|
779
804
|
|
package/src/cli/update.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
type ResolvedSources,
|
|
30
30
|
} from './layers.js'
|
|
31
31
|
import { buildLock, writeLock, readLock, LOCK_REL, priorTeam } from './lock.js'
|
|
32
|
+
import { adoptForeignSkills, foreignSkills, skillFolders } from './foreign-skills.js'
|
|
32
33
|
import { parseVersion, compareVersions } from './version-range.js'
|
|
33
34
|
import { COMMAND_NAMESPACE } from './command-namespace.js'
|
|
34
35
|
import { parseMcpConfigText } from './mcp-file.js'
|
|
@@ -225,6 +226,21 @@ export default async function update({
|
|
|
225
226
|
console.error(` ${c.dim('npm install, or your package manager\'s — or pass --allow-downgrade to go back on purpose.')}\n`)
|
|
226
227
|
process.exit(1)
|
|
227
228
|
}
|
|
229
|
+
|
|
230
|
+
// Skills another tool wrote into a folder this compiles: made the team's
|
|
231
|
+
// before anything is compiled, so this sync writes them for every assistant
|
|
232
|
+
// instead of sweeping them (foreign-skills.ts).
|
|
233
|
+
const framework = (await resolveManagedPaths({ ...manifest, ides })).framework
|
|
234
|
+
const foreign = foreignSkills(projectRoot, skillFolders(framework), new Set(early.items.keys()))
|
|
235
|
+
if (foreign.length > 0) {
|
|
236
|
+
const dry = args.includes('--dry-run') || args.includes('--dryRun')
|
|
237
|
+
if (!dry) adoptForeignSkills(projectRoot, foreign)
|
|
238
|
+
console.log(
|
|
239
|
+
` ${c.green('✓')} ${dry ? 'Would keep' : 'Kept'} ${foreign.length} skill(s) another tool added — ` +
|
|
240
|
+
`${dry ? 'moving' : 'moved'} into .opencastle/skills/, so every assistant gets ${foreign.length === 1 ? 'it' : 'them'}:`,
|
|
241
|
+
)
|
|
242
|
+
for (const s of foreign) console.log(` ${c.dim(`${s.from} → .opencastle/skills/${s.name}`)}`)
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
|
|
230
246
|
// ── Recreate the local-only directories ─────────────────────────
|