@shopify/cli-kit 0.0.0-snapshot-20260722210655 → 0.0.0-snapshot-20260723175937

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/cli-kit",
3
- "version": "0.0.0-snapshot-20260722210655",
3
+ "version": "0.0.0-snapshot-20260723175937",
4
4
  "private": false,
5
5
  "description": "A set of utilities, interfaces, and models that are common across all the platform features",
6
6
  "keywords": [
@@ -1,42 +0,0 @@
1
- import { LocalStorage } from './local-storage.js';
2
- import { ConfSchema } from '../../private/node/conf-store.js';
3
- /**
4
- * Options for {@link installShopifySkillInBackground}.
5
- */
6
- export interface InstallShopifySkillInBackgroundOptions {
7
- /** The command being run, used to avoid recursive installs from `skill` commands. */
8
- currentCommand: string;
9
- /** The process argv, used to re-invoke the current CLI binary. */
10
- argv?: string[];
11
- /** The process environment. */
12
- env?: NodeJS.ProcessEnv;
13
- /** The cli-kit local storage, injectable for testing. */
14
- config?: LocalStorage<ConfSchema>;
15
- /** The user's home directory, injectable for testing. */
16
- homeDir?: string;
17
- }
18
- /**
19
- * Checks whether the Shopify skill for coding agents is installed globally.
20
- *
21
- * The skills CLI installs universal skills under `~/.agents/skills` (older versions)
22
- * or `$XDG_CONFIG_HOME/agents/skills` (newer versions), so both locations are checked.
23
- *
24
- * @param env - The process environment.
25
- * @param homeDir - The user's home directory.
26
- * @returns Whether the Shopify skill is installed in any known global location.
27
- */
28
- export declare function shopifySkillIsInstalled(env?: NodeJS.ProcessEnv, homeDir?: string): boolean;
29
- /**
30
- * Installs the Shopify skill for coding agents by running `shopify skill install`
31
- * in a detached background process, so the current command is never delayed.
32
- *
33
- * The install is attempted at most once per day until it succeeds. Once the skill
34
- * is detected as installed, a completion flag is recorded and the check becomes a
35
- * no-op forever, so deliberately uninstalling the skill won't trigger a re-install.
36
- *
37
- * Skipped for `skill` commands (to avoid recursion), in CI, in unit tests, in
38
- * development mode, and when `SHOPIFY_CLI_NO_SKILL_AUTO_INSTALL` is set.
39
- *
40
- * @param options - See {@link InstallShopifySkillInBackgroundOptions}.
41
- */
42
- export declare function installShopifySkillInBackground(options: InstallShopifySkillInBackgroundOptions): Promise<void>;
@@ -1,76 +0,0 @@
1
- import { homeDirectory, isDevelopment } from './context/local.js';
2
- import { isTruthy } from './context/utilities.js';
3
- import { fileExistsSync } from './fs.js';
4
- import { outputDebug } from './output.js';
5
- import { joinPath } from './path.js';
6
- import { exec } from './system.js';
7
- import { getSkillAutoInstallCompleted, setSkillAutoInstallCompleted, runAtMinimumInterval, } from '../../private/node/conf-store.js';
8
- /**
9
- * Checks whether the Shopify skill for coding agents is installed globally.
10
- *
11
- * The skills CLI installs universal skills under `~/.agents/skills` (older versions)
12
- * or `$XDG_CONFIG_HOME/agents/skills` (newer versions), so both locations are checked.
13
- *
14
- * @param env - The process environment.
15
- * @param homeDir - The user's home directory.
16
- * @returns Whether the Shopify skill is installed in any known global location.
17
- */
18
- export function shopifySkillIsInstalled(env = process.env, homeDir = homeDirectory()) {
19
- const configHome = env.XDG_CONFIG_HOME ?? joinPath(homeDir, '.config');
20
- const skillDirectories = [
21
- joinPath(homeDir, '.agents', 'skills', 'shopify'),
22
- joinPath(configHome, 'agents', 'skills', 'shopify'),
23
- ];
24
- return skillDirectories.some(fileExistsSync);
25
- }
26
- /**
27
- * Installs the Shopify skill for coding agents by running `shopify skill install`
28
- * in a detached background process, so the current command is never delayed.
29
- *
30
- * The install is attempted at most once per day until it succeeds. Once the skill
31
- * is detected as installed, a completion flag is recorded and the check becomes a
32
- * no-op forever, so deliberately uninstalling the skill won't trigger a re-install.
33
- *
34
- * Skipped for `skill` commands (to avoid recursion), in CI, in unit tests, in
35
- * development mode, and when `SHOPIFY_CLI_NO_SKILL_AUTO_INSTALL` is set.
36
- *
37
- * @param options - See {@link InstallShopifySkillInBackgroundOptions}.
38
- */
39
- export async function installShopifySkillInBackground(options) {
40
- const { currentCommand, argv = process.argv, env = process.env, config, homeDir } = options;
41
- if (skipSkillAutoInstall(currentCommand, env))
42
- return;
43
- if (getSkillAutoInstallCompleted(config))
44
- return;
45
- if (shopifySkillIsInstalled(env, homeDir)) {
46
- setSkillAutoInstallCompleted(config);
47
- return;
48
- }
49
- const nodeBinary = argv[0];
50
- const shopifyBinary = argv[1];
51
- if (!nodeBinary || !shopifyBinary)
52
- return;
53
- // Retry at most once per day until the skill install succeeds. The timestamp is
54
- // recorded when the background process is spawned, not when it finishes, so a
55
- // failed install is retried on the first command run a day later.
56
- await runAtMinimumInterval('skill-auto-install', { days: 1 }, async () => {
57
- // Run the Shopify command the same way as the current execution, detached
58
- // from the current process so the CLI can exit before the install finishes.
59
- // eslint-disable-next-line no-void
60
- void exec(nodeBinary, [shopifyBinary, 'skill', 'install'], {
61
- background: true,
62
- env: { ...env, SHOPIFY_CLI_NO_ANALYTICS: '1' },
63
- externalErrorHandler: async (error) => {
64
- outputDebug(`Failed to install the Shopify skill in background: ${error.message}`);
65
- },
66
- });
67
- }, config);
68
- }
69
- function skipSkillAutoInstall(currentCommand, env) {
70
- return (currentCommand.startsWith('skill') ||
71
- isTruthy(env.CI) ||
72
- isTruthy(env.SHOPIFY_UNIT_TEST) ||
73
- isTruthy(env.SHOPIFY_CLI_NO_SKILL_AUTO_INSTALL) ||
74
- isDevelopment(env));
75
- }
76
- //# sourceMappingURL=skills.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../../src/public/node/skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAA;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAA;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AACl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9E,kEAAkE;IAClE,MAAM,oBAAoB,CACxB,oBAAoB,EACpB,EAAC,IAAI,EAAE,CAAC,EAAC,EACT,KAAK,IAAI,EAAE;QACT,0EAA0E;QAC1E,4EAA4E;QAC5E,mCAAmC;QACnC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE;YACzD,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,EAAC,GAAG,GAAG,EAAE,wBAAwB,EAAE,GAAG,EAAC;YAC5C,oBAAoB,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE;gBAC7C,WAAW,CAAC,sDAAuD,KAAe,CAAC,OAAO,EAAE,CAAC,CAAA;YAC/F,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,EACD,MAAM,CACP,CAAA;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,cAAsB,EAAE,GAAsB;IAC1E,OAAO,CACL,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;QAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChB,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC/B,QAAQ,CAAC,GAAG,CAAC,iCAAiC,CAAC;QAC/C,aAAa,CAAC,GAAG,CAAC,CACnB,CAAA;AACH,CAAC","sourcesContent":["import {homeDirectory, isDevelopment} from './context/local.js'\nimport {isTruthy} from './context/utilities.js'\nimport {fileExistsSync} from './fs.js'\nimport {outputDebug} from './output.js'\nimport {joinPath} from './path.js'\nimport {exec} from './system.js'\nimport {LocalStorage} from './local-storage.js'\nimport {\n ConfSchema,\n getSkillAutoInstallCompleted,\n setSkillAutoInstallCompleted,\n runAtMinimumInterval,\n} from '../../private/node/conf-store.js'\n\n/**\n * Options for {@link installShopifySkillInBackground}.\n */\nexport interface InstallShopifySkillInBackgroundOptions {\n /** The command being run, used to avoid recursive installs from `skill` commands. */\n currentCommand: string\n\n /** The process argv, used to re-invoke the current CLI binary. */\n argv?: string[]\n\n /** The process environment. */\n env?: NodeJS.ProcessEnv\n\n /** The cli-kit local storage, injectable for testing. */\n config?: LocalStorage<ConfSchema>\n\n /** The user's home directory, injectable for testing. */\n homeDir?: string\n}\n\n/**\n * Checks whether the Shopify skill for coding agents is installed globally.\n *\n * The skills CLI installs universal skills under `~/.agents/skills` (older versions)\n * or `$XDG_CONFIG_HOME/agents/skills` (newer versions), so both locations are checked.\n *\n * @param env - The process environment.\n * @param homeDir - The user's home directory.\n * @returns Whether the Shopify skill is installed in any known global location.\n */\nexport function shopifySkillIsInstalled(env: NodeJS.ProcessEnv = process.env, homeDir = homeDirectory()): boolean {\n const configHome = env.XDG_CONFIG_HOME ?? joinPath(homeDir, '.config')\n const skillDirectories = [\n joinPath(homeDir, '.agents', 'skills', 'shopify'),\n joinPath(configHome, 'agents', 'skills', 'shopify'),\n ]\n return skillDirectories.some(fileExistsSync)\n}\n\n/**\n * Installs the Shopify skill for coding agents by running `shopify skill install`\n * in a detached background process, so the current command is never delayed.\n *\n * The install is attempted at most once per day until it succeeds. Once the skill\n * is detected as installed, a completion flag is recorded and the check becomes a\n * no-op forever, so deliberately uninstalling the skill won't trigger a re-install.\n *\n * Skipped for `skill` commands (to avoid recursion), in CI, in unit tests, in\n * development mode, and when `SHOPIFY_CLI_NO_SKILL_AUTO_INSTALL` is set.\n *\n * @param options - See {@link InstallShopifySkillInBackgroundOptions}.\n */\nexport async function installShopifySkillInBackground(options: InstallShopifySkillInBackgroundOptions): Promise<void> {\n const {currentCommand, argv = process.argv, env = process.env, config, homeDir} = options\n\n if (skipSkillAutoInstall(currentCommand, env)) return\n if (getSkillAutoInstallCompleted(config)) return\n if (shopifySkillIsInstalled(env, homeDir)) {\n setSkillAutoInstallCompleted(config)\n return\n }\n\n const nodeBinary = argv[0]\n const shopifyBinary = argv[1]\n if (!nodeBinary || !shopifyBinary) return\n\n // Retry at most once per day until the skill install succeeds. The timestamp is\n // recorded when the background process is spawned, not when it finishes, so a\n // failed install is retried on the first command run a day later.\n await runAtMinimumInterval(\n 'skill-auto-install',\n {days: 1},\n async () => {\n // Run the Shopify command the same way as the current execution, detached\n // from the current process so the CLI can exit before the install finishes.\n // eslint-disable-next-line no-void\n void exec(nodeBinary, [shopifyBinary, 'skill', 'install'], {\n background: true,\n env: {...env, SHOPIFY_CLI_NO_ANALYTICS: '1'},\n externalErrorHandler: async (error: unknown) => {\n outputDebug(`Failed to install the Shopify skill in background: ${(error as Error).message}`)\n },\n })\n },\n config,\n )\n}\n\nfunction skipSkillAutoInstall(currentCommand: string, env: NodeJS.ProcessEnv): boolean {\n return (\n currentCommand.startsWith('skill') ||\n isTruthy(env.CI) ||\n isTruthy(env.SHOPIFY_UNIT_TEST) ||\n isTruthy(env.SHOPIFY_CLI_NO_SKILL_AUTO_INSTALL) ||\n isDevelopment(env)\n )\n}\n"]}