@refrakt-md/cli 0.10.1 → 0.11.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/dist/bin.js +130 -31
- package/dist/bin.js.map +1 -1
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +243 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/package-validate.d.ts.map +1 -1
- package/dist/commands/package-validate.js +139 -1
- package/dist/commands/package-validate.js.map +1 -1
- package/dist/commands/plugins.d.ts +6 -0
- package/dist/commands/plugins.d.ts.map +1 -0
- package/dist/commands/plugins.js +117 -0
- package/dist/commands/plugins.js.map +1 -0
- package/dist/config-file.d.ts +9 -3
- package/dist/config-file.d.ts.map +1 -1
- package/dist/config-file.js +10 -6
- package/dist/config-file.js.map +1 -1
- package/dist/lib/levenshtein.d.ts +10 -0
- package/dist/lib/levenshtein.d.ts.map +1 -0
- package/dist/lib/levenshtein.js +42 -0
- package/dist/lib/levenshtein.js.map +1 -0
- package/dist/lib/plugins.d.ts +49 -0
- package/dist/lib/plugins.d.ts.map +1 -0
- package/dist/lib/plugins.js +260 -0
- package/dist/lib/plugins.js.map +1 -0
- package/package.json +15 -5
package/dist/config-file.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { existsSync,
|
|
1
|
+
import { existsSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
+
import { loadRefraktConfigWithRaw, } from '@refrakt-md/transform/node';
|
|
3
4
|
const PM_LOCKFILES = [
|
|
4
5
|
{
|
|
5
6
|
file: 'bun.lock',
|
|
@@ -30,17 +31,20 @@ export function detectPackageManager(cwd = process.cwd()) {
|
|
|
30
31
|
}
|
|
31
32
|
return NPM_DEFAULT;
|
|
32
33
|
}
|
|
33
|
-
/** Load refrakt.config.json from a directory
|
|
34
|
+
/** Load and normalize refrakt.config.json from a directory.
|
|
35
|
+
*
|
|
36
|
+
* Delegates to `@refrakt-md/transform/node` so the CLI and framework adapters
|
|
37
|
+
* share one normalization path. Returns both the raw input (for tools that
|
|
38
|
+
* need to round-trip the original shape) and the normalized form. */
|
|
34
39
|
export function loadRefraktConfigFile(cwd = process.cwd()) {
|
|
35
40
|
const configPath = resolve(cwd, 'refrakt.config.json');
|
|
36
41
|
if (!existsSync(configPath)) {
|
|
37
42
|
throw new Error(`No refrakt.config.json found in ${cwd}`);
|
|
38
43
|
}
|
|
39
|
-
const raw =
|
|
40
|
-
|
|
41
|
-
return { path: configPath, config };
|
|
44
|
+
const { raw, normalized } = loadRefraktConfigWithRaw(configPath);
|
|
45
|
+
return { path: configPath, config: normalized, raw };
|
|
42
46
|
}
|
|
43
|
-
/** Write refrakt.config.json, preserving formatting */
|
|
47
|
+
/** Write refrakt.config.json, preserving tab-indented formatting. */
|
|
44
48
|
export function writeRefraktConfigFile(path, config) {
|
|
45
49
|
writeFileSync(path, JSON.stringify(config, null, '\t') + '\n');
|
|
46
50
|
}
|
package/dist/config-file.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file.js","sourceRoot":"","sources":["../src/config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"config-file.js","sourceRoot":"","sources":["../src/config-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACN,wBAAwB,GAExB,MAAM,4BAA4B,CAAC;AAOpC,MAAM,YAAY,GAAgD;IACjE;QACC,IAAI,EAAE,UAAU;QAChB,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE;KACtD;IACD;QACC,IAAI,EAAE,WAAW;QACjB,EAA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AAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AACtD,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,MAAqB;IACzE,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny Levenshtein-distance "did you mean?" helper for CLI suggestions.
|
|
3
|
+
* Matches the implementation in `@refrakt-md/transform/node`'s `resolveSite`
|
|
4
|
+
* helper — kept local here so the CLI doesn't depend on transform internals.
|
|
5
|
+
*/
|
|
6
|
+
export declare function levenshtein(a: string, b: string): number;
|
|
7
|
+
/** Return the candidate closest to `input`, but only when distance ≤ 2.
|
|
8
|
+
* Returns undefined when there's no good match (avoids confusing suggestions). */
|
|
9
|
+
export declare function closestMatch(input: string, candidates: string[]): string | undefined;
|
|
10
|
+
//# sourceMappingURL=levenshtein.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levenshtein.d.ts","sourceRoot":"","sources":["../../src/lib/levenshtein.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED;mFACmF;AACnF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAUpF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny Levenshtein-distance "did you mean?" helper for CLI suggestions.
|
|
3
|
+
* Matches the implementation in `@refrakt-md/transform/node`'s `resolveSite`
|
|
4
|
+
* helper — kept local here so the CLI doesn't depend on transform internals.
|
|
5
|
+
*/
|
|
6
|
+
export function levenshtein(a, b) {
|
|
7
|
+
if (a === b)
|
|
8
|
+
return 0;
|
|
9
|
+
if (a.length === 0)
|
|
10
|
+
return b.length;
|
|
11
|
+
if (b.length === 0)
|
|
12
|
+
return a.length;
|
|
13
|
+
const m = a.length;
|
|
14
|
+
const n = b.length;
|
|
15
|
+
const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
|
|
16
|
+
for (let i = 0; i <= m; i++)
|
|
17
|
+
dp[i][0] = i;
|
|
18
|
+
for (let j = 0; j <= n; j++)
|
|
19
|
+
dp[0][j] = j;
|
|
20
|
+
for (let i = 1; i <= m; i++) {
|
|
21
|
+
for (let j = 1; j <= n; j++) {
|
|
22
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
23
|
+
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return dp[m][n];
|
|
27
|
+
}
|
|
28
|
+
/** Return the candidate closest to `input`, but only when distance ≤ 2.
|
|
29
|
+
* Returns undefined when there's no good match (avoids confusing suggestions). */
|
|
30
|
+
export function closestMatch(input, candidates) {
|
|
31
|
+
if (candidates.length === 0)
|
|
32
|
+
return undefined;
|
|
33
|
+
let best;
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
const distance = levenshtein(input, candidate);
|
|
36
|
+
if (!best || distance < best.distance) {
|
|
37
|
+
best = { name: candidate, distance };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return best && best.distance <= 2 ? best.name : undefined;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=levenshtein.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"levenshtein.js","sourceRoot":"","sources":["../../src/lib/levenshtein.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS;IAC/C,IAAI,CAAC,KAAK,C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CAAC,CAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAG,CAAC,CAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC,GAAG,CAAC,CAAE,GAAG,IAAI,CAAC,CAAC;QACzF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,CAAE,CAAC;AACnB,CAAC;AAED;mFACmF;AACnF,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,UAAoB;IAC/D,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,IAAoD,CAAC;IACzD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACvC,IAAI,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtC,CAAC;IACF,CAAC;IACD,OAAO,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin discovery for the refrakt CLI.
|
|
3
|
+
*
|
|
4
|
+
* `discoverPlugins()` enumerates installed plugin-bearing packages and loads
|
|
5
|
+
* each one's `cli-plugin` export. Three consumers rely on this helper:
|
|
6
|
+
*
|
|
7
|
+
* 1. CLI dispatch (`packages/cli/src/bin.ts`) — replaces the lazy
|
|
8
|
+
* import-on-demand pattern with a single discovery call so namespace
|
|
9
|
+
* typos can produce "did you mean?" suggestions.
|
|
10
|
+
* 2. `refrakt --help` and `refrakt plugins list` — listing what's installed.
|
|
11
|
+
* 3. The MCP server (`@refrakt-md/mcp`) — turning each command into a tool.
|
|
12
|
+
*
|
|
13
|
+
* Resolution order (per ADR-010 + SPEC-043):
|
|
14
|
+
* 1. If `refrakt.config.json`'s `plugins` field is set, that array is
|
|
15
|
+
* authoritative — no dependency scanning happens.
|
|
16
|
+
* 2. Otherwise, the nearest `package.json` is scanned for `@refrakt-md/*`
|
|
17
|
+
* entries in `dependencies` + `devDependencies` (excluding meta packages
|
|
18
|
+
* that are not expected to ship a `cli-plugin`).
|
|
19
|
+
*
|
|
20
|
+
* The helper is side-effect-free: it does not execute commands, write to
|
|
21
|
+
* disk, or cache results internally. Callers wrap with their own caching.
|
|
22
|
+
*/
|
|
23
|
+
import type { CliPluginCommand } from '@refrakt-md/types';
|
|
24
|
+
/** A plugin discovered in the project's installed packages. */
|
|
25
|
+
export interface DiscoveredPlugin {
|
|
26
|
+
/** The namespace this plugin claims (e.g. `plan`). */
|
|
27
|
+
namespace: string;
|
|
28
|
+
/** The npm package name (e.g. `@refrakt-md/plan`). */
|
|
29
|
+
packageName: string;
|
|
30
|
+
/** The package's installed version, read from its `package.json`. */
|
|
31
|
+
packageVersion: string;
|
|
32
|
+
/** Commands contributed by the plugin. */
|
|
33
|
+
commands: CliPluginCommand[];
|
|
34
|
+
/** Whether the plugin came from the explicit `config.plugins` list or
|
|
35
|
+
* was discovered via dependency scanning. */
|
|
36
|
+
source: 'config' | 'dependency-scan';
|
|
37
|
+
/** Optional namespace-level description from the plugin export. */
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface DiscoverOptions {
|
|
41
|
+
/** Working directory to start the search from. Defaults to `process.cwd()`. */
|
|
42
|
+
cwd?: string;
|
|
43
|
+
/** When true, write warnings to stderr for malformed plugins, duplicate
|
|
44
|
+
* namespaces, etc. Defaults to true. */
|
|
45
|
+
warn?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Discover installed plugins. */
|
|
48
|
+
export declare function discoverPlugins(opts?: DiscoverOptions): Promise<DiscoveredPlugin[]>;
|
|
49
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/lib/plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKrE,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAChC,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B;kDAC8C;IAC9C,MAAM,EAAE,QAAQ,GAAG,iBAAiB,CAAC;IACrC,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC/B,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;6CACyC;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AA2BD,kCAAkC;AAClC,wBAAsB,eAAe,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAsC7F"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin discovery for the refrakt CLI.
|
|
3
|
+
*
|
|
4
|
+
* `discoverPlugins()` enumerates installed plugin-bearing packages and loads
|
|
5
|
+
* each one's `cli-plugin` export. Three consumers rely on this helper:
|
|
6
|
+
*
|
|
7
|
+
* 1. CLI dispatch (`packages/cli/src/bin.ts`) — replaces the lazy
|
|
8
|
+
* import-on-demand pattern with a single discovery call so namespace
|
|
9
|
+
* typos can produce "did you mean?" suggestions.
|
|
10
|
+
* 2. `refrakt --help` and `refrakt plugins list` — listing what's installed.
|
|
11
|
+
* 3. The MCP server (`@refrakt-md/mcp`) — turning each command into a tool.
|
|
12
|
+
*
|
|
13
|
+
* Resolution order (per ADR-010 + SPEC-043):
|
|
14
|
+
* 1. If `refrakt.config.json`'s `plugins` field is set, that array is
|
|
15
|
+
* authoritative — no dependency scanning happens.
|
|
16
|
+
* 2. Otherwise, the nearest `package.json` is scanned for `@refrakt-md/*`
|
|
17
|
+
* entries in `dependencies` + `devDependencies` (excluding meta packages
|
|
18
|
+
* that are not expected to ship a `cli-plugin`).
|
|
19
|
+
*
|
|
20
|
+
* The helper is side-effect-free: it does not execute commands, write to
|
|
21
|
+
* disk, or cache results internally. Callers wrap with their own caching.
|
|
22
|
+
*/
|
|
23
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
24
|
+
import { dirname, resolve } from 'node:path';
|
|
25
|
+
import { createRequire } from 'node:module';
|
|
26
|
+
import { loadRefraktConfigWithRaw } from '@refrakt-md/transform/node';
|
|
27
|
+
const require_ = createRequire(import.meta.url);
|
|
28
|
+
/** Meta packages that ship in `@refrakt-md/*` but are not expected to
|
|
29
|
+
* contribute CLI commands. These are skipped during dependency scanning. */
|
|
30
|
+
const META_PACKAGES = new Set([
|
|
31
|
+
'@refrakt-md/cli',
|
|
32
|
+
'@refrakt-md/types',
|
|
33
|
+
'@refrakt-md/transform',
|
|
34
|
+
'@refrakt-md/runes',
|
|
35
|
+
'@refrakt-md/lumina',
|
|
36
|
+
'@refrakt-md/svelte',
|
|
37
|
+
'@refrakt-md/sveltekit',
|
|
38
|
+
'@refrakt-md/behaviors',
|
|
39
|
+
'@refrakt-md/content',
|
|
40
|
+
'@refrakt-md/ai',
|
|
41
|
+
'@refrakt-md/editor',
|
|
42
|
+
'@refrakt-md/highlight',
|
|
43
|
+
'@refrakt-md/html',
|
|
44
|
+
'@refrakt-md/astro',
|
|
45
|
+
'@refrakt-md/nuxt',
|
|
46
|
+
'@refrakt-md/next',
|
|
47
|
+
'@refrakt-md/eleventy',
|
|
48
|
+
'@refrakt-md/react',
|
|
49
|
+
'@refrakt-md/vue',
|
|
50
|
+
'@refrakt-md/language-server',
|
|
51
|
+
]);
|
|
52
|
+
/** Discover installed plugins. */
|
|
53
|
+
export async function discoverPlugins(opts = {}) {
|
|
54
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
55
|
+
const warn = opts.warn ?? true;
|
|
56
|
+
const candidates = resolveCandidates(cwd);
|
|
57
|
+
const seen = new Set();
|
|
58
|
+
const result = [];
|
|
59
|
+
for (const { packageName, source } of candidates) {
|
|
60
|
+
if (seen.has(packageName))
|
|
61
|
+
continue;
|
|
62
|
+
seen.add(packageName);
|
|
63
|
+
const loaded = await loadPlugin(packageName, cwd, warn);
|
|
64
|
+
if (!loaded)
|
|
65
|
+
continue;
|
|
66
|
+
const existing = result.find((p) => p.namespace === loaded.plugin.namespace);
|
|
67
|
+
if (existing) {
|
|
68
|
+
if (warn) {
|
|
69
|
+
console.warn(`Warning: namespace "${loaded.plugin.namespace}" is provided by both ` +
|
|
70
|
+
`${existing.packageName} and ${packageName}. Using the first one (${existing.packageName}).`);
|
|
71
|
+
}
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
result.push({
|
|
75
|
+
namespace: loaded.plugin.namespace,
|
|
76
|
+
packageName,
|
|
77
|
+
packageVersion: loaded.version,
|
|
78
|
+
commands: loaded.plugin.commands,
|
|
79
|
+
source,
|
|
80
|
+
description: loaded.plugin.description,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
result.sort((a, b) => a.namespace.localeCompare(b.namespace));
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
/** Return the list of `{ packageName, source }` candidates to attempt. */
|
|
87
|
+
function resolveCandidates(cwd) {
|
|
88
|
+
const configCandidates = candidatesFromConfig(cwd);
|
|
89
|
+
if (configCandidates)
|
|
90
|
+
return configCandidates;
|
|
91
|
+
return candidatesFromPackageJson(cwd);
|
|
92
|
+
}
|
|
93
|
+
/** When `refrakt.config.json` declares `plugins`, return those names. */
|
|
94
|
+
function candidatesFromConfig(cwd) {
|
|
95
|
+
const configPath = resolve(cwd, 'refrakt.config.json');
|
|
96
|
+
if (!existsSync(configPath))
|
|
97
|
+
return undefined;
|
|
98
|
+
let raw;
|
|
99
|
+
try {
|
|
100
|
+
raw = loadRefraktConfigWithRaw(configPath).raw;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const plugins = raw.plugins;
|
|
106
|
+
if (!Array.isArray(plugins))
|
|
107
|
+
return undefined;
|
|
108
|
+
const valid = plugins.filter((p) => typeof p === 'string' && p.length > 0);
|
|
109
|
+
if (valid.length === 0)
|
|
110
|
+
return undefined;
|
|
111
|
+
return valid.map((packageName) => ({ packageName, source: 'config' }));
|
|
112
|
+
}
|
|
113
|
+
/** Walk up from `cwd` to find candidate plugin packages, sourced from:
|
|
114
|
+
* 1. The nearest `package.json`'s `dependencies` + `devDependencies`.
|
|
115
|
+
* 2. The `node_modules/@refrakt-md/` directory (catches workspace-linked
|
|
116
|
+
* packages that aren't in package.json's deps — typical for monorepos
|
|
117
|
+
* and the refrakt repo itself).
|
|
118
|
+
* Both sources are unioned (deduplicated downstream by the seen set) so the
|
|
119
|
+
* scan finds plugins under both normal install and workspace setups. */
|
|
120
|
+
function candidatesFromPackageJson(cwd) {
|
|
121
|
+
const names = new Set();
|
|
122
|
+
const pkgPath = findUp('package.json', cwd);
|
|
123
|
+
if (pkgPath) {
|
|
124
|
+
try {
|
|
125
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
126
|
+
for (const name of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies })) {
|
|
127
|
+
if (name.startsWith('@refrakt-md/') && !META_PACKAGES.has(name)) {
|
|
128
|
+
names.add(name);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// ignore unreadable package.json
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const nodeModulesDir = pkgPath
|
|
137
|
+
? resolve(dirname(pkgPath), 'node_modules', '@refrakt-md')
|
|
138
|
+
: undefined;
|
|
139
|
+
if (nodeModulesDir && existsSync(nodeModulesDir)) {
|
|
140
|
+
try {
|
|
141
|
+
for (const entry of readdirSync(nodeModulesDir)) {
|
|
142
|
+
const full = resolve(nodeModulesDir, entry);
|
|
143
|
+
if (!safeIsDirectory(full))
|
|
144
|
+
continue;
|
|
145
|
+
const name = `@refrakt-md/${entry}`;
|
|
146
|
+
if (META_PACKAGES.has(name))
|
|
147
|
+
continue;
|
|
148
|
+
names.add(name);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
// ignore unreadable node_modules
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return [...names].map((packageName) => ({ packageName, source: 'dependency-scan' }));
|
|
156
|
+
}
|
|
157
|
+
function safeIsDirectory(path) {
|
|
158
|
+
try {
|
|
159
|
+
return statSync(path).isDirectory();
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** Attempt to load a single plugin's `cli-plugin` export. Returns undefined
|
|
166
|
+
* when the export is missing (silently skipped) or malformed (warned). */
|
|
167
|
+
async function loadPlugin(packageName, cwd, warn) {
|
|
168
|
+
const pluginEntry = `${packageName}/cli-plugin`;
|
|
169
|
+
let mod;
|
|
170
|
+
try {
|
|
171
|
+
mod = await importFrom(pluginEntry, cwd);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// Missing or unbuilt cli-plugin export — silently skip. Not every
|
|
175
|
+
// `@refrakt-md/*` package ships CLI commands.
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
const candidate = mod.default ?? mod;
|
|
179
|
+
if (!isValidPlugin(candidate)) {
|
|
180
|
+
if (warn) {
|
|
181
|
+
console.warn(`Warning: ${packageName} exports an invalid cli-plugin (missing namespace or commands). Skipping.`);
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
const version = readPackageVersion(packageName, cwd) ?? '0.0.0';
|
|
186
|
+
return { plugin: candidate, version };
|
|
187
|
+
}
|
|
188
|
+
function isValidPlugin(candidate) {
|
|
189
|
+
if (!candidate || typeof candidate !== 'object')
|
|
190
|
+
return false;
|
|
191
|
+
const obj = candidate;
|
|
192
|
+
if (typeof obj.namespace !== 'string' || obj.namespace.length === 0)
|
|
193
|
+
return false;
|
|
194
|
+
if (!Array.isArray(obj.commands))
|
|
195
|
+
return false;
|
|
196
|
+
for (const cmd of obj.commands) {
|
|
197
|
+
if (!cmd || typeof cmd !== 'object')
|
|
198
|
+
return false;
|
|
199
|
+
const c = cmd;
|
|
200
|
+
if (typeof c.name !== 'string' || c.name.length === 0)
|
|
201
|
+
return false;
|
|
202
|
+
if (typeof c.description !== 'string')
|
|
203
|
+
return false;
|
|
204
|
+
if (typeof c.handler !== 'function')
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
function readPackageVersion(packageName, cwd) {
|
|
210
|
+
// Walk up from cwd looking at node_modules/<packageName>/package.json. We
|
|
211
|
+
// avoid require.resolve('<pkg>/package.json') because modern packages with
|
|
212
|
+
// an "exports" map block that subpath.
|
|
213
|
+
for (const nm of modulePaths(cwd)) {
|
|
214
|
+
const candidate = resolve(nm, packageName, 'package.json');
|
|
215
|
+
if (!existsSync(candidate))
|
|
216
|
+
continue;
|
|
217
|
+
try {
|
|
218
|
+
const pkg = JSON.parse(readFileSync(candidate, 'utf-8'));
|
|
219
|
+
if (typeof pkg.version === 'string')
|
|
220
|
+
return pkg.version;
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
// keep searching
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
/** Dynamic import that resolves relative to `cwd` rather than the CLI's own
|
|
229
|
+
* install location. Important for monorepo workspaces and globally-installed
|
|
230
|
+
* CLIs that need to load the project's local plugins. */
|
|
231
|
+
async function importFrom(specifier, cwd) {
|
|
232
|
+
const localRequire = createRequire(resolve(cwd, '_'));
|
|
233
|
+
const resolved = localRequire.resolve(specifier);
|
|
234
|
+
return import(resolved);
|
|
235
|
+
}
|
|
236
|
+
function findUp(filename, start) {
|
|
237
|
+
let dir = resolve(start);
|
|
238
|
+
while (true) {
|
|
239
|
+
const candidate = resolve(dir, filename);
|
|
240
|
+
if (existsSync(candidate))
|
|
241
|
+
return candidate;
|
|
242
|
+
const parent = dirname(dir);
|
|
243
|
+
if (parent === dir)
|
|
244
|
+
return undefined;
|
|
245
|
+
dir = parent;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function modulePaths(cwd) {
|
|
249
|
+
const paths = [];
|
|
250
|
+
let dir = resolve(cwd);
|
|
251
|
+
while (true) {
|
|
252
|
+
paths.push(resolve(dir, 'node_modules'));
|
|
253
|
+
const parent = dirname(dir);
|
|
254
|
+
if (parent === dir)
|
|
255
|
+
break;
|
|
256
|
+
dir = parent;
|
|
257
|
+
}
|
|
258
|
+
return paths;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/lib/plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,QAA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AAC;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,SAAS,CAAC;QACrC,GAAG,GAAG,MAAM,CAAC;IACd,CAAC;AACF,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/cli",
|
|
3
3
|
"description": "CLI tools for refrakt.md",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
"bin": {
|
|
18
18
|
"refrakt": "./dist/bin.js"
|
|
19
19
|
},
|
|
20
|
+
"exports": {
|
|
21
|
+
"./lib/plugins.js": {
|
|
22
|
+
"types": "./dist/lib/plugins.d.ts",
|
|
23
|
+
"default": "./dist/lib/plugins.js"
|
|
24
|
+
},
|
|
25
|
+
"./lib/levenshtein.js": {
|
|
26
|
+
"types": "./dist/lib/levenshtein.d.ts",
|
|
27
|
+
"default": "./dist/lib/levenshtein.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
20
30
|
"files": [
|
|
21
31
|
"dist"
|
|
22
32
|
],
|
|
@@ -25,10 +35,10 @@
|
|
|
25
35
|
},
|
|
26
36
|
"dependencies": {
|
|
27
37
|
"@markdoc/markdoc": "0.4.0",
|
|
28
|
-
"@refrakt-md/ai": "0.
|
|
29
|
-
"@refrakt-md/editor": "0.
|
|
30
|
-
"@refrakt-md/runes": "0.
|
|
31
|
-
"@refrakt-md/transform": "0.
|
|
38
|
+
"@refrakt-md/ai": "0.11.0",
|
|
39
|
+
"@refrakt-md/editor": "0.11.0",
|
|
40
|
+
"@refrakt-md/runes": "0.11.0",
|
|
41
|
+
"@refrakt-md/transform": "0.11.0",
|
|
32
42
|
"postcss": "^8.4.0"
|
|
33
43
|
}
|
|
34
44
|
}
|