@skedulo/memory-hub-mcp 0.2.39 → 0.2.41
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 +2 -0
- package/assets/session-start.sh +12 -2
- package/assets/session-stop.sh +2 -2
- package/assets/skills/ask/SKILL.md +3 -3
- package/assets/skills/delegate-ticket/SKILL.md +2 -1
- package/assets/skills/plan-ticket/SKILL.md +5 -2
- package/assets/skills/setup/SKILL.md +1 -1
- package/assets/uninstall-memory-hub.sh +1 -1
- package/dist/ask-prompt.js +1 -1
- package/dist/index.js +19 -1
- package/dist/list-fields.js +27 -0
- package/dist/login-tool.js +11 -2
- package/dist/migrate-plugin.js +49 -81
- package/dist/move-lock.js +55 -0
- package/dist/move-trigger.js +43 -0
- package/dist/plugin-move-util.js +77 -0
- package/dist/read-api.js +6 -1
- package/dist/setup.js +82 -51
- package/dist/skedulo-move.js +323 -0
- package/package.json +1 -1
- package/skill-guide.md +3 -1
package/README.md
CHANGED
|
@@ -71,6 +71,8 @@ the plugin, `mcp__memory-hub__*` with `--no-plugin`), to `permissions.allow` in
|
|
|
71
71
|
so they stop asking for approval; pass `--no-allow` to skip that.
|
|
72
72
|
Older installs (`memory-hub@se-ai-memory-hub`) move to the `memory-hub@memory-hub` ID by themselves at the end of a session, except ones with a pasted token, which keep working and move when you run `setup`.
|
|
73
73
|
|
|
74
|
+
Once Memory Hub is listed in the Skedulo plugin marketplace and the move is turned on in a release, installs move to `memory-hub@skedulo-plugin-marketplace` by themselves at the end of a session. On a machine without Memory Hub, anyone who already has that marketplace can run `claude plugin install memory-hub@skedulo-plugin-marketplace`.
|
|
75
|
+
|
|
74
76
|
Plugin only, no `npm` or `sked`: install it with `claude plugin marketplace add Skedulo/se-ai-memory-hub`
|
|
75
77
|
and `claude plugin install memory-hub@memory-hub` (in the desktop app: + → Plugins), start a session,
|
|
76
78
|
and sign in in the browser tab that opens. The plugin needs Node from [nodejs.org](https://nodejs.org)
|
package/assets/session-start.sh
CHANGED
|
@@ -24,7 +24,7 @@ FUNCTION_URL="${MEMORY_HUB_FUNCTION_URL:-${FILE_API_BASE:-https://dev-api.test.s
|
|
|
24
24
|
# <<< token lookup
|
|
25
25
|
|
|
26
26
|
OLD_ID_ROOT=false
|
|
27
|
-
case "${CLAUDE_PLUGIN_ROOT:-}" in */se-ai-memory-hub/*) OLD_ID_ROOT=true ;; esac
|
|
27
|
+
case "${CLAUDE_PLUGIN_ROOT:-}" in */se-ai-memory-hub/* | */plugins/cache/memory-hub/*) OLD_ID_ROOT=true ;; esac
|
|
28
28
|
|
|
29
29
|
STATE_DIR="${MEMORY_HUB_STATE_DIR:-$HOME/.claude/memory-hub-hook/state}"
|
|
30
30
|
HOOK_INPUT=""
|
|
@@ -792,7 +792,15 @@ plugin_move_nudge() {
|
|
|
792
792
|
case "$last" in ''|*[!0-9]*) last=0 ;; esac
|
|
793
793
|
[ $((now - last)) -ge 604800 ] || return 0
|
|
794
794
|
printf '%s\n' "$now" > "$stamp" 2>/dev/null || return 0
|
|
795
|
-
printf '%s' '
|
|
795
|
+
printf '%s' 'Memory Hub uses a pasted token, so it can'"'"'t move to its new plugin home by itself. Tell the user they can run `npx -y @skedulo/memory-hub-mcp@latest setup --code` in a terminal, which signs them in so the pasted token is no longer needed; their current install keeps working.'
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
moved_notice() {
|
|
799
|
+
local file="$STATE_DIR/moved-to-skedulo" text='Memory Hub now installs from the Skedulo plugin marketplace.'
|
|
800
|
+
[ -f "$file" ] || return 0
|
|
801
|
+
[ "$(sed -n 2p "$file" 2>/dev/null)" = autoupdate ] && text="$text Auto-update is on for the Skedulo plugin marketplace, as it was for Memory Hub."
|
|
802
|
+
rm -f "$file" 2>/dev/null || return 0
|
|
803
|
+
printf '%s' "$text"
|
|
796
804
|
}
|
|
797
805
|
|
|
798
806
|
no_project_pages() {
|
|
@@ -841,6 +849,8 @@ SHARE_NUDGE=$(share_nudge 2>/dev/null || true)
|
|
|
841
849
|
[ -z "$SHARE_NUDGE" ] || NUDGE="${NUDGE}${SHARE_NUDGE}${NL}${NL}"
|
|
842
850
|
MOVE_NUDGE=$(plugin_move_nudge 2>/dev/null || true)
|
|
843
851
|
[ -z "$MOVE_NUDGE" ] || NUDGE="${NUDGE}${MOVE_NUDGE}${NL}${NL}"
|
|
852
|
+
MOVED_NOTICE=$(moved_notice 2>/dev/null || true)
|
|
853
|
+
[ -z "$MOVED_NOTICE" ] || NUDGE="${NUDGE}${MOVED_NOTICE}${NL}${NL}"
|
|
844
854
|
EMPTY_NUDGE=$(empty_project_nudge 2>/dev/null || true)
|
|
845
855
|
[ -z "$EMPTY_NUDGE" ] || NUDGE="${NUDGE}${EMPTY_NUDGE}${NL}${NL}"
|
|
846
856
|
|
package/assets/session-stop.sh
CHANGED
|
@@ -9,7 +9,7 @@ fi
|
|
|
9
9
|
|
|
10
10
|
start_plugin_move() {
|
|
11
11
|
[ "$EVENT" = SessionEnd ] || return 0
|
|
12
|
-
|
|
12
|
+
[ -n "${CLAUDE_PLUGIN_ROOT:-}" ] || return 0
|
|
13
13
|
local cli stamp="$STATE_DIR/plugin-move.stamp" lock="$STATE_DIR/plugin-move.lock" today
|
|
14
14
|
today=$(date +%F)
|
|
15
15
|
[ "$(cat "$stamp" 2>/dev/null)" != "$today" ] || return 0
|
|
@@ -40,7 +40,7 @@ start_plugin_move() {
|
|
|
40
40
|
set -- perl -e '$SIG{HUP} = "IGNORE"; setpgrp(0, 0); exec @ARGV' "$@"
|
|
41
41
|
fi
|
|
42
42
|
trap '' HUP
|
|
43
|
-
"$@" >/dev/null 2>&1 </dev/null &
|
|
43
|
+
(cd "$HOME" 2>/dev/null; "$@" >/dev/null 2>&1 </dev/null &)
|
|
44
44
|
trap - HUP
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -115,8 +115,8 @@ steps 4 to 7 say what changes.
|
|
|
115
115
|
returns every project's shared items, from every team, plus the person's own, Private ones
|
|
116
116
|
included. Each item names its `repoName` and `teamName`.
|
|
117
117
|
2. When a project is named, also list its pages, which works outside a repo too:
|
|
118
|
-
`memory_list type=Wiki scope=all titlePrefix="<Project> ›"` (paginate
|
|
119
|
-
have `total`). Pick the pages the question needs.
|
|
118
|
+
`memory_list type=Wiki scope=all titlePrefix="<Project> ›" fields=["uid","title"]` (paginate
|
|
119
|
+
with `offset` until you have `total`). Pick the pages the question needs.
|
|
120
120
|
3. When the question is about one project and an answer comes from another, say which project it
|
|
121
121
|
came from and treat it as precedent, not as that project's rule. Keep the other customer's
|
|
122
122
|
names, data and terms out of anything meant for this one.
|
|
@@ -550,7 +550,7 @@ If step 6 found the answer, skip this step: answer (step 8) and save it (step 9)
|
|
|
550
550
|
question handled by steps 2.5 and 2.6 skips this step too.
|
|
551
551
|
|
|
552
552
|
If nothing found answers the question, say so plainly. First list the projects the hub holds:
|
|
553
|
-
`memory_list type=Wiki scope=all limit=200`, paged with `offset` until `total`; keep only titles
|
|
553
|
+
`memory_list type=Wiki scope=all limit=200 fields=["title"]`, paged with `offset` until `total`; keep only titles
|
|
554
554
|
containing " › ", take the text before it, dedupe, show up to 15, and ask
|
|
555
555
|
"Did you mean one of these?" Only if none fits, ask which sources to read: links or names of
|
|
556
556
|
documents, tickets, Slack channels or repos. In the same message, say that reading sources costs
|
|
@@ -147,7 +147,8 @@ from the pages and the code at the pinned commit, and say in your report which o
|
|
|
147
147
|
path that handles it, and give it no Acceptance Criteria item.
|
|
148
148
|
8. Cross-repo impact: start from the outcome's field, then look for every caller of each route,
|
|
149
149
|
exported function, field and event topic the outcome changes: the architecture-map edges that touch
|
|
150
|
-
its files (`memory_list type=Skill tags=["ArchitectureMap"]
|
|
150
|
+
its files (`memory_list type=Skill tags=["ArchitectureMap"] fields=["uid","title","repoName","check"]`,
|
|
151
|
+
then `memory_get`), and a code search
|
|
151
152
|
for each name in this repo at the pinned commit and in the repos those maps name (`git grep`,
|
|
152
153
|
`gh search code`). Note what each caller relies on. With no map and no caller, write "None found"
|
|
153
154
|
and where you looked.
|
|
@@ -104,8 +104,11 @@ the Linear connector is not connected, stop and tell the developer.
|
|
|
104
104
|
the filter means no similar ticket; say nothing about it. An item whose `repoName` is not this
|
|
105
105
|
project's is precedent: say in the plan's Decisions which project it came from and check it
|
|
106
106
|
against this code, and keep that customer's names, data and settings out of the plan.
|
|
107
|
-
7. For each repo involved, read its architecture map: `memory_list type=Skill tags=["ArchitectureMap"]
|
|
108
|
-
|
|
107
|
+
7. For each repo involved, read its architecture map: `memory_list type=Skill tags=["ArchitectureMap"]
|
|
108
|
+
repo=<repo uid> fields=["uid","title"]`, with the repo's uid from `memory_listRepos`, then
|
|
109
|
+
`memory_get type=Skill uid=<uid>`. When that lists no map, or `memory_listRepos` does not show the
|
|
110
|
+
repo, list without `repo`, with `fields=["uid","title","repoName"]`, and keep the maps whose
|
|
111
|
+
`repoName` is that repo or whose title names it.
|
|
109
112
|
8. When the plan depends on what a customer's tenant runs, read the newest tenant snapshot as the
|
|
110
113
|
guide's "Tenant snapshots" says (`memory_list type=Fact scope=all titlePrefix="<Customer> <env> tenant
|
|
111
114
|
snapshot"`, take the newest by the ISO time in the title, then `memory_get` that uid), never
|
|
@@ -67,7 +67,7 @@ nothing, because only hooks see it; step 3's `memory_login` says whether the per
|
|
|
67
67
|
3. If the browser says they have no login, they need an invite: ask the Memory Hub admin.
|
|
68
68
|
4. If they would rather paste a token than use the browser, give them these two steps and leave the
|
|
69
69
|
pasting to them: copy a token from Pulse Web → their profile → Settings → Developer tools → API
|
|
70
|
-
tokens, then run `/plugin configure memory-hub@memory-hub`
|
|
70
|
+
tokens, then run `/plugin configure <id>` in a terminal, where `<id>` is the installed one (`memory-hub@memory-hub`, `memory-hub@se-ai-memory-hub` or `memory-hub@skedulo-plugin-marketplace`; `claude plugin list` shows it) and restart Claude.
|
|
71
71
|
|
|
72
72
|
## 4. Stop approval prompts (optional)
|
|
73
73
|
|
|
@@ -69,7 +69,7 @@ fi
|
|
|
69
69
|
|
|
70
70
|
say "Plugin:"
|
|
71
71
|
if command -v claude >/dev/null 2>&1; then
|
|
72
|
-
for id in memory-hub@memory-hub memory-hub@se-ai-memory-hub; do
|
|
72
|
+
for id in memory-hub@memory-hub memory-hub@se-ai-memory-hub memory-hub@skedulo-plugin-marketplace; do
|
|
73
73
|
if claude plugin list 2>/dev/null | grep -q "❯ $id\$"; then
|
|
74
74
|
if $DRY; then say " would uninstall $id"; else claude plugin uninstall "$id" >/dev/null 2>&1 && say " uninstalled $id"; fi
|
|
75
75
|
fi
|
package/dist/ask-prompt.js
CHANGED
|
@@ -16,7 +16,7 @@ const FALLBACK = [
|
|
|
16
16
|
'3. Read anything cut short with `memory_get`, and back each claim with the item it came from: its title, whose it is and its date. Show uids only when asked; the closing line carries them.',
|
|
17
17
|
'4. For every incident question, read memory_getSkillGuide section="Incident records" first. An incident question with no matching incident record: follow its Discovery steps without asking: search the PIRs, answer, and save the record when the PIR states a confirmed cause. ' +
|
|
18
18
|
`An incident question also gets the affected project's delivery flow (where to develop, the hotfix path, release, what is live, recent changes), found and saved as Team without asking; see ask step 2.6, or the guide's "Incident records" section, "The affected project".`,
|
|
19
|
-
"5. Otherwise, when the hub has nothing, say so, then list the projects the hub holds (`memory_list type=Wiki scope=all limit=200`, paged with `offset` until `total`, keeping titles with ' › ' and taking the text before it, up to 15) and ask 'Did you mean one of these?' Only if none fits, ask which sources to read; reading sources costs tokens. Searching everything for a project needs Claude Code in the project's repo.",
|
|
19
|
+
"5. Otherwise, when the hub has nothing, say so, then list the projects the hub holds (`memory_list type=Wiki scope=all limit=200 fields=[\"title\"]`, paged with `offset` until `total`, keeping titles with ' › ' and taking the text before it, up to 15) and ask 'Did you mean one of these?' Only if none fits, ask which sources to read; reading sources costs tokens. Searching everything for a project needs Claude Code in the project's repo.",
|
|
20
20
|
'6. Never paste SOW text and never quote Slack. Never save prices, rates, budgets, estimates in hours, days or points, customer personal data or credentials.',
|
|
21
21
|
'7. When a note and a project rule disagree: a rule marked Pending <ticket> is not built yet, so the code or the note stands; else the code you read wins; else the project rule; else the newer note; a note from another project is precedent only. Name both with their dates. Never edit a project rule from an answer.',
|
|
22
22
|
'8. End with one line of what you updated and saved, each by its title with the uid in brackets, or "Nothing changed."',
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,8 @@ const session_context_1 = require("./session-context");
|
|
|
28
28
|
const version_1 = require("./version");
|
|
29
29
|
const extension_update_1 = require("./extension-update");
|
|
30
30
|
const asset_sync_1 = require("./asset-sync");
|
|
31
|
+
const move_trigger_1 = require("./move-trigger");
|
|
32
|
+
const setup_1 = require("./setup");
|
|
31
33
|
const tags_1 = require("./tags");
|
|
32
34
|
const ask_prompt_1 = require("./ask-prompt");
|
|
33
35
|
const change_tools_1 = require("./change-tools");
|
|
@@ -126,6 +128,7 @@ const login = (0, login_tool_1.createLoginTool)({
|
|
|
126
128
|
status: creds => (0, login_1.tokenStatus)((0, credentials_1.resolveFunctionUrl)(process.env, creds), creds.token),
|
|
127
129
|
extension: process.env.MEMORY_HUB_EXTENSION === '1',
|
|
128
130
|
viaPlugin: process.env.MEMORY_HUB_VIA_PLUGIN === '1',
|
|
131
|
+
marketplace: () => (0, setup_1.marketplaceFromRoot)(process.env.CLAUDE_PLUGIN_ROOT),
|
|
129
132
|
});
|
|
130
133
|
server.tool('memory_login', "Sign in to Memory Hub: opens a Skedulo sign-in in the user's browser and saves the token on this machine. Call it when another memory tool says it isn't signed in, or when the user asks to sign in. Call it again to check whether the sign-in finished.", {}, async () => ({ content: [{ type: 'text', text: await login() }] }));
|
|
131
134
|
server.tool('memory_getSkillGuide', 'Get the current Memory Hub usage guide — when to recall, what to save where, sharing rules, repo linking. Call this first when the memory-hub skill triggers. Pass section to read one part only (for example "Stale memories"), which costs far fewer tokens.', {
|
|
@@ -215,7 +218,7 @@ server.tool('memory_saveBatch', 'Save up to 25 Facts/Skills/Scenarios/Wiki pages
|
|
|
215
218
|
],
|
|
216
219
|
};
|
|
217
220
|
});
|
|
218
|
-
server.tool('memory_list', "List memory items of one type that you can see, newest first, with a title, visibility, repo and whether each is yours — an inventory for choosing which items to share, move or review. Feed the uids to memory_setVisibility or memory_moveResourceRepo as resourceIds. Returns total (all matches) and one page of items; page with offset. Not a search: use memory_recall to find content by meaning.", read_api_1.READ_FUNCTIONS.list.shape, async (input) => {
|
|
221
|
+
server.tool('memory_list', "List memory items of one type that you can see, newest first, with a title, visibility, repo and whether each is yours — an inventory for choosing which items to share, move or review. Feed the uids to memory_setVisibility or memory_moveResourceRepo as resourceIds. Returns total (all matches) and one page of items; page with offset. Pass fields to get only what you need: every item also carries its source and check, which make a long list large. Not a search: use memory_recall to find content by meaning.", read_api_1.READ_FUNCTIONS.list.shape, async (input) => {
|
|
219
222
|
const result = await read_api_1.READ_FUNCTIONS.list.run(readDeps(), input);
|
|
220
223
|
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
221
224
|
});
|
|
@@ -412,5 +415,20 @@ server.tool('memory_sessionContext', "Load this developer's saved memory-hub con
|
|
|
412
415
|
if (process.env.MEMORY_HUB_EXTENSION !== '1') {
|
|
413
416
|
(0, asset_sync_1.refreshInstalledAssets)();
|
|
414
417
|
}
|
|
418
|
+
const startedAt = Date.now();
|
|
419
|
+
let moveStarted = false;
|
|
420
|
+
const startMoveAtSessionEnd = () => {
|
|
421
|
+
if (moveStarted)
|
|
422
|
+
return;
|
|
423
|
+
moveStarted = true;
|
|
424
|
+
try {
|
|
425
|
+
if ((0, move_trigger_1.shouldStartMove)({ startedAt, now: Date.now(), installedIds: (0, setup_1.installedPluginIds)(), pluginRoot: process.env.CLAUDE_PLUGIN_ROOT })) {
|
|
426
|
+
(0, move_trigger_1.startMoveDetached)((0, path_1.join)(__dirname, 'cli.js'));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
catch { }
|
|
430
|
+
};
|
|
431
|
+
process.stdin.once('end', startMoveAtSessionEnd);
|
|
432
|
+
process.stdin.once('close', startMoveAtSessionEnd);
|
|
415
433
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
416
434
|
server.connect(transport);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectListItems = exports.LIST_FIELDS_DESCRIPTION = exports.LIST_FIELDS = void 0;
|
|
4
|
+
exports.LIST_FIELDS = [
|
|
5
|
+
'uid',
|
|
6
|
+
'type',
|
|
7
|
+
'title',
|
|
8
|
+
'visibility',
|
|
9
|
+
'repoId',
|
|
10
|
+
'repoName',
|
|
11
|
+
'teamName',
|
|
12
|
+
'mine',
|
|
13
|
+
'lastModifiedDate',
|
|
14
|
+
'source',
|
|
15
|
+
'upstream',
|
|
16
|
+
'check',
|
|
17
|
+
];
|
|
18
|
+
exports.LIST_FIELDS_DESCRIPTION = 'Return only these fields of each item, e.g. ["title"] to read titles or ["uid","title"] to choose items to memory_get. Omit for every field. Get an item before relying on it.';
|
|
19
|
+
function projectListItems(result, fields) {
|
|
20
|
+
if (!fields?.length)
|
|
21
|
+
return result;
|
|
22
|
+
return {
|
|
23
|
+
total: result.total,
|
|
24
|
+
items: result.items.map((item) => Object.fromEntries(fields.filter((field) => item[field] !== undefined).map((field) => [field, item[field]]))),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
exports.projectListItems = projectListItems;
|
package/dist/login-tool.js
CHANGED
|
@@ -7,7 +7,12 @@ const setup_1 = require("./setup");
|
|
|
7
7
|
const SIGNED_IN = 'Signed in. Memory Hub works now, no restart needed.';
|
|
8
8
|
const EXTENSION_ALLOW_NOTE = " If Claude asks before each Memory Hub tool, the user can choose Always allow, or change it later in the Claude app's settings for the Memory Hub extension.";
|
|
9
9
|
const allowOffer = (rule) => ` Then offer once to stop Memory Hub's approval prompts (this covers all its tools, including deleting and sharing memories): if the user agrees, add "${rule}" to permissions.allow in ~/.claude/settings.json (merge it, keep a backup), and say it applies from their next session.`;
|
|
10
|
-
const
|
|
10
|
+
const SKEDULO_EVERY_PLUGIN = ' This turns on auto-update for every plugin from the Skedulo plugin marketplace.';
|
|
11
|
+
const autoUpdateOffer = (name) => {
|
|
12
|
+
const { source, repo, ref } = (0, setup_1.marketplaceSource)(name);
|
|
13
|
+
const shown = JSON.stringify({ source, repo, ...(ref ? { ref } : {}) }).replace(/":"/g, '": "').replace(/","/g, '", "');
|
|
14
|
+
return ` Also offer once to turn on auto-update, so the Memory Hub plugin gets new versions by itself: if the user agrees, set extraKnownMarketplaces["${name}"].autoUpdate to true in ~/.claude/settings.json, adding the entry with source ${shown} if it is missing (merge it, keep a backup).${name === setup_1.SKEDULO_MARKETPLACE_NAME ? SKEDULO_EVERY_PLUGIN : ''}`;
|
|
15
|
+
};
|
|
11
16
|
const FIRST_CALL_WAIT_MS = 5000;
|
|
12
17
|
const POLL_MS = 25;
|
|
13
18
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
@@ -53,11 +58,15 @@ function createLoginTool(deps) {
|
|
|
53
58
|
: `The token in MEMORY_HUB_MCP_TOKEN (in ~/.claude/settings.json, or the plugin's token option) was rejected (HTTP ${status}). It wins over a browser sign-in, so remove it, restart Claude, then call memory_login again.`,
|
|
54
59
|
};
|
|
55
60
|
};
|
|
61
|
+
const offerMarketplace = () => {
|
|
62
|
+
const name = deps.marketplace?.();
|
|
63
|
+
return name === setup_1.SKEDULO_MARKETPLACE_NAME ? name : setup_1.MARKETPLACE_NAME;
|
|
64
|
+
};
|
|
56
65
|
const signedIn = () => {
|
|
57
66
|
if (deps.extension)
|
|
58
67
|
return `${SIGNED_IN}${EXTENSION_ALLOW_NOTE}`;
|
|
59
68
|
if (deps.viaPlugin)
|
|
60
|
-
return `${SIGNED_IN}${allowOffer(setup_1.PLUGIN_ALLOW_RULE)}${
|
|
69
|
+
return `${SIGNED_IN}${allowOffer(setup_1.PLUGIN_ALLOW_RULE)}${autoUpdateOffer(offerMarketplace())}`;
|
|
61
70
|
return `${SIGNED_IN}${allowOffer(setup_1.DIRECT_ALLOW_RULE)}`;
|
|
62
71
|
};
|
|
63
72
|
const call = async () => {
|
package/dist/migrate-plugin.js
CHANGED
|
@@ -1,61 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runMigratePlugin = exports.migratePlugin = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
3
|
+
exports.runMigratePlugin = exports.migratePlugin = exports.captureFlag = void 0;
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
const setup_1 = require("./setup");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const end = output.lastIndexOf('}');
|
|
12
|
-
if (start < 0 || end < start)
|
|
13
|
-
return undefined;
|
|
14
|
-
try {
|
|
15
|
-
return JSON.parse(output.slice(start, end + 1));
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
// readJson reads a torn or hand-broken file as {}, and writing that back would wipe the user's settings.
|
|
22
|
-
function readStrict(path) {
|
|
23
|
-
if (!(0, fs_1.existsSync)(path))
|
|
24
|
-
return {};
|
|
25
|
-
try {
|
|
26
|
-
const value = JSON.parse((0, fs_1.readFileSync)(path, 'utf8'));
|
|
27
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value) ? value : undefined;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
function updateSettings(path, change) {
|
|
34
|
-
const settings = readStrict(path);
|
|
35
|
-
if (!settings)
|
|
36
|
-
return false;
|
|
37
|
-
change(settings);
|
|
38
|
-
(0, setup_1.writeJson)(path, settings);
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
function pick(source, keys) {
|
|
42
|
-
return Object.fromEntries(keys.filter((key) => has(source, key)).map((key) => [key, JSON.parse(JSON.stringify(source[key]))]));
|
|
43
|
-
}
|
|
44
|
-
function putBack(settings, field, keys, before) {
|
|
45
|
-
for (const key of keys) {
|
|
46
|
-
if (has(before, key))
|
|
47
|
-
(settings[field] ||= {})[key] = before[key];
|
|
48
|
-
else if (has(settings[field], key))
|
|
49
|
-
delete settings[field][key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function logLine(status, reason) {
|
|
53
|
-
return `${new Date().toISOString()} ${status} ${reason.replace(/\s+/g, ' ')}`;
|
|
54
|
-
}
|
|
6
|
+
const move_lock_1 = require("./move-lock");
|
|
7
|
+
const skedulo_move_1 = require("./skedulo-move");
|
|
8
|
+
const plugin_move_util_1 = require("./plugin-move-util");
|
|
9
|
+
Object.defineProperty(exports, "captureFlag", { enumerable: true, get: function () { return plugin_move_util_1.captureFlag; } });
|
|
55
10
|
function migratePlugin(deps) {
|
|
11
|
+
if ((0, setup_1.skeduloMoveEnabled)(deps.env ?? process.env))
|
|
12
|
+
return (0, skedulo_move_1.moveToSkedulo)(deps);
|
|
56
13
|
const { run, configDir } = deps;
|
|
57
14
|
const finish = (status, reason) => {
|
|
58
|
-
deps.log(logLine(status, reason));
|
|
15
|
+
deps.log((0, plugin_move_util_1.logLine)(status, reason));
|
|
59
16
|
return { status, reason };
|
|
60
17
|
};
|
|
61
18
|
const settingsPath = (0, path_1.join)(configDir, 'settings.json');
|
|
@@ -64,7 +21,7 @@ function migratePlugin(deps) {
|
|
|
64
21
|
const retireOld = (notes) => {
|
|
65
22
|
let left;
|
|
66
23
|
try {
|
|
67
|
-
if (readStrict(settingsPath)?.enabledPlugins?.[setup_1.LEGACY_PLUGIN_ID] === true) {
|
|
24
|
+
if ((0, plugin_move_util_1.readStrict)(settingsPath)?.enabledPlugins?.[setup_1.LEGACY_PLUGIN_ID] === true) {
|
|
68
25
|
const disabled = run(['plugin', 'disable', setup_1.LEGACY_PLUGIN_ID]);
|
|
69
26
|
if (disabled.status !== 0)
|
|
70
27
|
left = `disable failed (${(0, setup_1.lastLine)(disabled.output)})`;
|
|
@@ -76,13 +33,13 @@ function migratePlugin(deps) {
|
|
|
76
33
|
}
|
|
77
34
|
}
|
|
78
35
|
catch (error) {
|
|
79
|
-
left = message(error);
|
|
36
|
+
left = (0, plugin_move_util_1.message)(error);
|
|
80
37
|
}
|
|
81
38
|
if (left === undefined)
|
|
82
39
|
return;
|
|
83
40
|
notes.push(`old marketplace not removed: ${left}`);
|
|
84
41
|
try {
|
|
85
|
-
const turnedOff = updateSettings(settingsPath, (current) => {
|
|
42
|
+
const turnedOff = (0, plugin_move_util_1.updateSettings)(settingsPath, (current) => {
|
|
86
43
|
if (current.enabledPlugins?.[setup_1.LEGACY_PLUGIN_ID] === true)
|
|
87
44
|
current.enabledPlugins[setup_1.LEGACY_PLUGIN_ID] = false;
|
|
88
45
|
});
|
|
@@ -90,26 +47,25 @@ function migratePlugin(deps) {
|
|
|
90
47
|
notes.push(`${setup_1.LEGACY_PLUGIN_ID} still enabled, settings unreadable`);
|
|
91
48
|
}
|
|
92
49
|
catch (error) {
|
|
93
|
-
notes.push(`${setup_1.LEGACY_PLUGIN_ID} still enabled (${message(error)})`);
|
|
50
|
+
notes.push(`${setup_1.LEGACY_PLUGIN_ID} still enabled (${(0, plugin_move_util_1.message)(error)})`);
|
|
94
51
|
}
|
|
95
52
|
};
|
|
96
|
-
const withNotes = (reason, notes) => (notes.length > 0 ? `${reason} (${notes.join('; ')})` : reason);
|
|
97
53
|
const plugins = (0, setup_1.readJson)(installedPath).plugins || {};
|
|
98
|
-
if (!has(plugins, setup_1.LEGACY_PLUGIN_ID))
|
|
99
|
-
return finish('skipped', has(plugins, setup_1.PLUGIN_ID) ? 'already moved' : 'not installed');
|
|
100
|
-
const settings = readStrict(settingsPath);
|
|
54
|
+
if (!(0, plugin_move_util_1.has)(plugins, setup_1.LEGACY_PLUGIN_ID))
|
|
55
|
+
return finish('skipped', (0, plugin_move_util_1.has)(plugins, setup_1.PLUGIN_ID) ? 'already moved' : 'not installed');
|
|
56
|
+
const settings = (0, plugin_move_util_1.readStrict)(settingsPath);
|
|
101
57
|
if (!settings)
|
|
102
58
|
return finish('skipped', 'settings unreadable');
|
|
103
59
|
const records = Array.isArray(plugins[setup_1.LEGACY_PLUGIN_ID]) ? plugins[setup_1.LEGACY_PLUGIN_ID] : [];
|
|
104
60
|
const userScopeOnly = records.length > 0 && records.every((record) => record?.scope === 'user');
|
|
105
|
-
if (has(plugins, setup_1.PLUGIN_ID)) {
|
|
61
|
+
if ((0, plugin_move_util_1.has)(plugins, setup_1.PLUGIN_ID)) {
|
|
106
62
|
if (!userScopeOnly)
|
|
107
63
|
return finish('skipped', 'not user scope');
|
|
108
64
|
// A move cut off after the new install leaves both IDs loaded until the old marketplace goes.
|
|
109
|
-
const known = readStrict(knownPath);
|
|
65
|
+
const known = (0, plugin_move_util_1.readStrict)(knownPath);
|
|
110
66
|
if (!known)
|
|
111
67
|
return finish('skipped', 'marketplaces unreadable');
|
|
112
|
-
if (!has(known, setup_1.LEGACY_MARKETPLACE_NAME) || !(0, setup_1.isHubSource)(known[setup_1.MARKETPLACE_NAME]?.source))
|
|
68
|
+
if (!(0, plugin_move_util_1.has)(known, setup_1.LEGACY_MARKETPLACE_NAME) || !(0, setup_1.isHubSource)(known[setup_1.MARKETPLACE_NAME]?.source))
|
|
113
69
|
return finish('skipped', 'already moved');
|
|
114
70
|
const newRecords = Array.isArray(plugins[setup_1.PLUGIN_ID]) ? plugins[setup_1.PLUGIN_ID] : [];
|
|
115
71
|
const newActive = newRecords.some((record) => record?.scope === 'user') && settings.enabledPlugins?.[setup_1.PLUGIN_ID] === true;
|
|
@@ -117,7 +73,7 @@ function migratePlugin(deps) {
|
|
|
117
73
|
return finish('skipped', 'new install not active');
|
|
118
74
|
const notes = [];
|
|
119
75
|
retireOld(notes);
|
|
120
|
-
return finish('moved', withNotes('retired the old install', notes));
|
|
76
|
+
return finish('moved', (0, plugin_move_util_1.withNotes)('retired the old install', notes));
|
|
121
77
|
}
|
|
122
78
|
if (settings.enabledPlugins?.[setup_1.LEGACY_PLUGIN_ID] !== true)
|
|
123
79
|
return finish('skipped', 'disabled');
|
|
@@ -130,7 +86,7 @@ function migratePlugin(deps) {
|
|
|
130
86
|
if (!(0, setup_1.isHubSource)(declared?.source))
|
|
131
87
|
return finish('skipped', 'old marketplace not in settings');
|
|
132
88
|
const configured = run(['plugin', 'configure', '--json', setup_1.LEGACY_PLUGIN_ID]);
|
|
133
|
-
const options = configured.status === 0 ? parseObject(configured.output) : undefined;
|
|
89
|
+
const options = configured.status === 0 ? (0, plugin_move_util_1.parseObject)(configured.output) : undefined;
|
|
134
90
|
if (!options || !Array.isArray(options.configured))
|
|
135
91
|
return finish('failed', 'could not read the plugin options, nothing changed');
|
|
136
92
|
const settingsToken = settings.env?.MEMORY_HUB_MCP_TOKEN;
|
|
@@ -139,14 +95,14 @@ function migratePlugin(deps) {
|
|
|
139
95
|
return finish('skipped', 'pasted token');
|
|
140
96
|
if (run(['plugin', 'marketplace', 'update', setup_1.LEGACY_MARKETPLACE_NAME]).status !== 0)
|
|
141
97
|
return finish('skipped', 'cannot reach the marketplace');
|
|
142
|
-
const knownAtStart = readStrict(knownPath);
|
|
143
|
-
if (!knownAtStart || !has(knownAtStart, setup_1.LEGACY_MARKETPLACE_NAME))
|
|
98
|
+
const knownAtStart = (0, plugin_move_util_1.readStrict)(knownPath);
|
|
99
|
+
if (!knownAtStart || !(0, plugin_move_util_1.has)(knownAtStart, setup_1.LEGACY_MARKETPLACE_NAME))
|
|
144
100
|
return finish('skipped', 'marketplaces unreadable');
|
|
145
|
-
const capture = options.inputs
|
|
101
|
+
const capture = (0, plugin_move_util_1.captureFlag)(options.inputs);
|
|
146
102
|
const ref = declared.source.ref || setup_1.MARKETPLACE_REF;
|
|
147
103
|
const knownBefore = new Set(Object.keys(knownAtStart));
|
|
148
|
-
const marketplacesBefore = pick(settings.extraKnownMarketplaces, [setup_1.MARKETPLACE_NAME]);
|
|
149
|
-
const enabledBefore = pick(settings.enabledPlugins, [setup_1.PLUGIN_ID]);
|
|
104
|
+
const marketplacesBefore = (0, plugin_move_util_1.pick)(settings.extraKnownMarketplaces, [setup_1.MARKETPLACE_NAME]);
|
|
105
|
+
const enabledBefore = (0, plugin_move_util_1.pick)(settings.enabledPlugins, [setup_1.PLUGIN_ID]);
|
|
150
106
|
const addAndInstall = () => {
|
|
151
107
|
const added = run(['plugin', 'marketplace', 'add', `${setup_1.MARKETPLACE_GIT_URL}#${ref}`]);
|
|
152
108
|
if (added.status !== 0)
|
|
@@ -156,7 +112,7 @@ function migratePlugin(deps) {
|
|
|
156
112
|
const installed = run(['plugin', 'install', setup_1.PLUGIN_ID, ...capture]);
|
|
157
113
|
if (installed.status !== 0)
|
|
158
114
|
return `install failed (${(0, setup_1.lastLine)(installed.output)})`;
|
|
159
|
-
if ((0, setup_1.
|
|
115
|
+
if (!(0, setup_1.installedPluginIds)(installedPath).includes(setup_1.PLUGIN_ID))
|
|
160
116
|
return `install failed (claude did not list ${setup_1.PLUGIN_ID})`;
|
|
161
117
|
return undefined;
|
|
162
118
|
};
|
|
@@ -166,9 +122,9 @@ function migratePlugin(deps) {
|
|
|
166
122
|
if (name !== setup_1.LEGACY_MARKETPLACE_NAME && !knownBefore.has(name) && (0, setup_1.isHubSource)(known[name]?.source))
|
|
167
123
|
run(['plugin', 'marketplace', 'remove', name]);
|
|
168
124
|
}
|
|
169
|
-
const restored = updateSettings(settingsPath, (current) => {
|
|
170
|
-
putBack(current, 'extraKnownMarketplaces', [setup_1.MARKETPLACE_NAME], marketplacesBefore);
|
|
171
|
-
putBack(current, 'enabledPlugins', [setup_1.PLUGIN_ID], enabledBefore);
|
|
125
|
+
const restored = (0, plugin_move_util_1.updateSettings)(settingsPath, (current) => {
|
|
126
|
+
(0, plugin_move_util_1.putBack)(current, 'extraKnownMarketplaces', [setup_1.MARKETPLACE_NAME], marketplacesBefore);
|
|
127
|
+
(0, plugin_move_util_1.putBack)(current, 'enabledPlugins', [setup_1.PLUGIN_ID], enabledBefore);
|
|
172
128
|
});
|
|
173
129
|
return restored ? `${setup_1.LEGACY_PLUGIN_ID} untouched` : `${setup_1.LEGACY_PLUGIN_ID} untouched, settings unreadable and left as they are`;
|
|
174
130
|
};
|
|
@@ -177,7 +133,7 @@ function migratePlugin(deps) {
|
|
|
177
133
|
failure = addAndInstall();
|
|
178
134
|
}
|
|
179
135
|
catch (error) {
|
|
180
|
-
failure = `add or install failed (${message(error)})`;
|
|
136
|
+
failure = `add or install failed (${(0, plugin_move_util_1.message)(error)})`;
|
|
181
137
|
}
|
|
182
138
|
if (failure !== undefined) {
|
|
183
139
|
let outcome;
|
|
@@ -185,7 +141,7 @@ function migratePlugin(deps) {
|
|
|
185
141
|
outcome = undoNew();
|
|
186
142
|
}
|
|
187
143
|
catch (error) {
|
|
188
|
-
outcome = `undoing the new marketplace failed (${message(error)})`;
|
|
144
|
+
outcome = `undoing the new marketplace failed (${(0, plugin_move_util_1.message)(error)})`;
|
|
189
145
|
}
|
|
190
146
|
return finish('failed', `${failure}; ${outcome}`);
|
|
191
147
|
}
|
|
@@ -193,7 +149,7 @@ function migratePlugin(deps) {
|
|
|
193
149
|
retireOld(notes);
|
|
194
150
|
if (declared.autoUpdate === true) {
|
|
195
151
|
try {
|
|
196
|
-
const set = updateSettings(settingsPath, (current) => {
|
|
152
|
+
const set = (0, plugin_move_util_1.updateSettings)(settingsPath, (current) => {
|
|
197
153
|
const known = (current.extraKnownMarketplaces ||= {});
|
|
198
154
|
known[setup_1.MARKETPLACE_NAME] = { source: { source: 'git', url: setup_1.MARKETPLACE_GIT_URL, ref }, ...known[setup_1.MARKETPLACE_NAME], autoUpdate: true };
|
|
199
155
|
});
|
|
@@ -201,19 +157,31 @@ function migratePlugin(deps) {
|
|
|
201
157
|
notes.push('auto-update not carried over, settings unreadable');
|
|
202
158
|
}
|
|
203
159
|
catch (error) {
|
|
204
|
-
notes.push(`auto-update not carried over (${message(error)})`);
|
|
160
|
+
notes.push(`auto-update not carried over (${(0, plugin_move_util_1.message)(error)})`);
|
|
205
161
|
}
|
|
206
162
|
}
|
|
207
|
-
return finish('moved', withNotes(`${setup_1.LEGACY_PLUGIN_ID} to ${setup_1.PLUGIN_ID}, loads at the next session`, notes));
|
|
163
|
+
return finish('moved', (0, plugin_move_util_1.withNotes)(`${setup_1.LEGACY_PLUGIN_ID} to ${setup_1.PLUGIN_ID}, loads at the next session`, notes));
|
|
208
164
|
}
|
|
209
165
|
exports.migratePlugin = migratePlugin;
|
|
210
|
-
async function runMigratePlugin(
|
|
166
|
+
async function runMigratePlugin(argv) {
|
|
211
167
|
const log = (line) => console.log(line);
|
|
212
168
|
const run = (0, setup_1.claudeRunner)();
|
|
213
169
|
if (!run) {
|
|
214
|
-
log(logLine('skipped', 'claude CLI not on PATH'));
|
|
170
|
+
log((0, plugin_move_util_1.logLine)('skipped', 'claude CLI not on PATH'));
|
|
215
171
|
return 0;
|
|
216
172
|
}
|
|
217
|
-
|
|
173
|
+
const move = () => migratePlugin({ run, configDir: (0, setup_1.claudeConfigDir)(), log }).status === 'failed' ? 1 : 0;
|
|
174
|
+
if (!argv.includes('--take-lock'))
|
|
175
|
+
return move();
|
|
176
|
+
let code = 0;
|
|
177
|
+
const outcome = (0, move_lock_1.withMoveLock)(() => {
|
|
178
|
+
code = move();
|
|
179
|
+
}, { stamp: true });
|
|
180
|
+
// Not a result word: the session-start nudge reads the last moved/skipped/failed line.
|
|
181
|
+
if (outcome === 'busy')
|
|
182
|
+
log(`${new Date().toISOString()} note busy`);
|
|
183
|
+
if (outcome === 'done-today')
|
|
184
|
+
log(`${new Date().toISOString()} note done today`);
|
|
185
|
+
return code;
|
|
218
186
|
}
|
|
219
187
|
exports.runMigratePlugin = runMigratePlugin;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withMoveLock = exports.today = exports.moveStateDir = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const MOVE_LOCK_STALE_MS = 60 * 60 * 1000;
|
|
8
|
+
function moveStateDir(env = process.env) {
|
|
9
|
+
return env.MEMORY_HUB_STATE_DIR || (0, path_1.join)((0, os_1.homedir)(), '.claude', 'memory-hub-hook', 'state');
|
|
10
|
+
}
|
|
11
|
+
exports.moveStateDir = moveStateDir;
|
|
12
|
+
// Local date, like `date +%F` in the SessionEnd hook.
|
|
13
|
+
function today() {
|
|
14
|
+
const now = new Date();
|
|
15
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
16
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
17
|
+
}
|
|
18
|
+
exports.today = today;
|
|
19
|
+
// The same lock the SessionEnd hook takes, so setup and a background move never overlap.
|
|
20
|
+
function withMoveLock(fn, opts, env = process.env) {
|
|
21
|
+
const stateDir = moveStateDir(env);
|
|
22
|
+
const lock = (0, path_1.join)(stateDir, 'plugin-move.lock');
|
|
23
|
+
try {
|
|
24
|
+
(0, fs_1.mkdirSync)(stateDir, { recursive: true });
|
|
25
|
+
if ((0, fs_1.existsSync)(lock) && Date.now() - (0, fs_1.statSync)(lock).mtimeMs > MOVE_LOCK_STALE_MS)
|
|
26
|
+
(0, fs_1.rmdirSync)(lock);
|
|
27
|
+
(0, fs_1.mkdirSync)(lock);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return 'busy';
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
if (opts.stamp) {
|
|
34
|
+
const stamp = (0, path_1.join)(stateDir, 'plugin-move.stamp');
|
|
35
|
+
const day = today();
|
|
36
|
+
let last = '';
|
|
37
|
+
try {
|
|
38
|
+
last = (0, fs_1.readFileSync)(stamp, 'utf8').trim();
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
if (last === day)
|
|
42
|
+
return 'done-today';
|
|
43
|
+
(0, fs_1.writeFileSync)(stamp, `${day}\n`);
|
|
44
|
+
}
|
|
45
|
+
fn();
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
try {
|
|
49
|
+
(0, fs_1.rmdirSync)(lock);
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
}
|
|
53
|
+
return 'ran';
|
|
54
|
+
}
|
|
55
|
+
exports.withMoveLock = withMoveLock;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startMoveDetached = exports.shouldStartMove = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const move_lock_1 = require("./move-lock");
|
|
9
|
+
const setup_1 = require("./setup");
|
|
10
|
+
const MIN_SESSION_MS = 600_000;
|
|
11
|
+
function shouldStartMove(opts) {
|
|
12
|
+
if (!opts.pluginRoot)
|
|
13
|
+
return false;
|
|
14
|
+
const oldListed = opts.installedIds.includes(setup_1.PLUGIN_ID) || opts.installedIds.includes(setup_1.LEGACY_PLUGIN_ID);
|
|
15
|
+
return oldListed && opts.now - opts.startedAt >= MIN_SESSION_MS;
|
|
16
|
+
}
|
|
17
|
+
exports.shouldStartMove = shouldStartMove;
|
|
18
|
+
function openMoveLog() {
|
|
19
|
+
try {
|
|
20
|
+
const dir = (0, move_lock_1.moveStateDir)();
|
|
21
|
+
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
22
|
+
return (0, fs_1.openSync)((0, path_1.join)(dir, 'plugin-move.log'), 'a');
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function startMoveDetached(cliPath, spawnFn = child_process_1.spawn, openLog = openMoveLog) {
|
|
29
|
+
const fd = openLog();
|
|
30
|
+
try {
|
|
31
|
+
const child = spawnFn(process.execPath, [cliPath, 'migrate-plugin', '--take-lock'], {
|
|
32
|
+
detached: true,
|
|
33
|
+
stdio: fd === undefined ? 'ignore' : ['ignore', fd, fd],
|
|
34
|
+
cwd: (0, os_1.homedir)(),
|
|
35
|
+
});
|
|
36
|
+
child.unref();
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
if (fd !== undefined)
|
|
40
|
+
(0, fs_1.closeSync)(fd);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.startMoveDetached = startMoveDetached;
|