aitoearn-dsh-plugin-test 0.0.1 → 0.0.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/README.md +7 -2
- package/package.json +1 -1
- package/src/dsh/preset-sync.js +24 -16
- package/src/dsh/preset-sync.js.map +1 -1
package/README.md
CHANGED
|
@@ -16,12 +16,17 @@ Generated artifacts live only under `dist/` (gitignored).
|
|
|
16
16
|
## Build
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
pnpm nx build agent-plugin
|
|
20
|
-
pnpm nx pack agent-plugin
|
|
19
|
+
pnpm nx build agent-plugin # dsh distribution → dist/tools/agent-plugin/dsh
|
|
20
|
+
pnpm nx pack agent-plugin # workbuddy distribution (prod) → dist/tools/agent-plugin/workbuddy
|
|
21
|
+
pnpm nx run agent-plugin:pack:dev # workbuddy distribution (dev) → dist/tools/agent-plugin/workbuddy-dev
|
|
21
22
|
pnpm nx test agent-plugin
|
|
22
23
|
pnpm nx lint agent-plugin
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
WorkBuddy MCP connectors are packaged per environment: prod packs
|
|
27
|
+
`aitoearn` (aitoearn.ai) + `aitoearn-cn` (aitoearn.cn); dev packs
|
|
28
|
+
`aitoearn-dev` (dev endpoint).
|
|
29
|
+
|
|
25
30
|
## Install (DeepSeek Harness)
|
|
26
31
|
|
|
27
32
|
```bash
|
package/package.json
CHANGED
package/src/dsh/preset-sync.js
CHANGED
|
@@ -8,11 +8,14 @@ const MCP_CLIENT_PACKAGE = '@deepseek-ai/dsh-mcp-client';
|
|
|
8
8
|
* Make one bare package resolvable by plain Node resolution from the preset
|
|
9
9
|
* directory. Module resolution from `<dshHome>/.agent-presets/aitoearn` walks
|
|
10
10
|
* `<dshHome>/node_modules` — which nothing populates — so every bare runtime
|
|
11
|
-
* import a bundled preset module makes needs its package linked there.
|
|
12
|
-
*
|
|
11
|
+
* import a bundled preset module makes needs its package linked there. The
|
|
12
|
+
* link target is re-resolved on every sync, so a dangling or stale link (e.g.
|
|
13
|
+
* after the plugin moved or was reinstalled from a different source) heals
|
|
14
|
+
* itself; an existing real directory at the link path is left untouched.
|
|
13
15
|
*/
|
|
14
16
|
function linkRuntimeDependency(packageName, dshHome) {
|
|
15
17
|
const link = join(dshHome, 'node_modules', packageName);
|
|
18
|
+
const target = resolvePackageDir(packageName);
|
|
16
19
|
let existing;
|
|
17
20
|
try {
|
|
18
21
|
existing = readlinkSync(link);
|
|
@@ -20,23 +23,28 @@ function linkRuntimeDependency(packageName, dshHome) {
|
|
|
20
23
|
catch {
|
|
21
24
|
existing = undefined;
|
|
22
25
|
}
|
|
23
|
-
if (existing
|
|
26
|
+
if (existing === target)
|
|
24
27
|
return;
|
|
25
|
-
if (existsSync(link))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
symlinkSync(target, link, process.platform === 'win32' ? 'junction' : 'dir');
|
|
28
|
+
if (existing !== undefined || !existsSync(link)) {
|
|
29
|
+
mkdirSync(dirname(link), { recursive: true });
|
|
30
|
+
rmSync(link, { force: true });
|
|
31
|
+
symlinkSync(target, link, process.platform === 'win32' ? 'junction' : 'dir');
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
|
-
/**
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/** Resolve one bare specifier through the plugin's own graph, then walk up from the resolved entry to its package root. */
|
|
35
|
+
function resolvePackageDir(packageName) {
|
|
36
|
+
const hostRequire = createRequire(join(packageRoot(), 'package.json'));
|
|
37
|
+
const entry = hostRequire.resolve(packageName);
|
|
38
|
+
let dir = dirname(entry);
|
|
39
|
+
while (true) {
|
|
40
|
+
if (existsSync(join(dir, 'package.json')))
|
|
41
|
+
return dir;
|
|
42
|
+
const parent = dirname(dir);
|
|
43
|
+
if (parent === dir) {
|
|
44
|
+
throw new Error(`Aitoearn preset: cannot locate the package root of ${JSON.stringify(packageName)} (resolved to ${entry})`);
|
|
45
|
+
}
|
|
46
|
+
dir = parent;
|
|
38
47
|
}
|
|
39
|
-
throw new Error(`Aitoearn preset: cannot resolve installed package ${JSON.stringify(packageName)} for preset linking`);
|
|
40
48
|
}
|
|
41
49
|
export function syncAitoearnPreset(sourceDir = bundledPresetDir(), targetDir = userPresetDir(), dshHome = dshHomeDir()) {
|
|
42
50
|
if (!existsSync(sourceDir)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset-sync.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/preset-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEzH,sFAAsF;AACtF,MAAM,kBAAkB,GAAG,6BAA6B,CAAA;AAExD
|
|
1
|
+
{"version":3,"file":"preset-sync.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/preset-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEzH,sF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