netlify-cli 27.11.2 → 27.12.1

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.
Files changed (62) hide show
  1. package/dist/commands/base-command.js +2 -2
  2. package/dist/commands/deploy/deploy.js +28 -59
  3. package/dist/commands/dev/dev.js +1 -2
  4. package/dist/commands/env/env-clone.js +1 -1
  5. package/dist/commands/env/env-set.js +1 -1
  6. package/dist/commands/env/env-unset.js +1 -1
  7. package/dist/commands/functions/functions-create.js +3 -93
  8. package/dist/commands/init/index.js +6 -1
  9. package/dist/commands/init/init.d.ts +3 -1
  10. package/dist/commands/init/init.js +22 -2
  11. package/dist/commands/serve/serve.js +1 -2
  12. package/dist/commands/sites/sites-list.js +1 -1
  13. package/dist/commands/unlink/unlink.js +1 -1
  14. package/dist/lib/edge-functions/registry.js +0 -1
  15. package/dist/lib/exec-fetcher.js +1 -1
  16. package/dist/lib/functions/form-submissions-handler.js +2 -1
  17. package/dist/lib/spinner.d.ts +2 -2
  18. package/dist/lib/spinner.js +1 -1
  19. package/dist/recipes/ai-context/context.js +2 -2
  20. package/dist/utils/deploy/deploy-site.d.ts +32 -12
  21. package/dist/utils/deploy/deploy-site.js +18 -40
  22. package/dist/utils/deploy/drop-api.d.ts +7 -1
  23. package/dist/utils/deploy/drop-api.js +3 -4
  24. package/dist/utils/deploy/file.d.ts +4 -2
  25. package/dist/utils/deploy/hash-config.d.ts +5 -6
  26. package/dist/utils/deploy/hash-config.js +1 -4
  27. package/dist/utils/deploy/hash-files.d.ts +9 -8
  28. package/dist/utils/deploy/hash-fns.d.ts +45 -10
  29. package/dist/utils/deploy/hasher-segments.d.ts +10 -6
  30. package/dist/utils/deploy/hasher-segments.js +0 -1
  31. package/dist/utils/deploy/process-files.d.ts +1 -1
  32. package/dist/utils/deploy/process-files.js +1 -0
  33. package/dist/utils/deploy/types.d.ts +17 -0
  34. package/dist/utils/deploy/types.js +2 -0
  35. package/dist/utils/deploy/upload-files.d.ts +8 -3
  36. package/dist/utils/deploy/upload-files.js +4 -3
  37. package/dist/utils/deploy/upload-source-zip.js +4 -7
  38. package/dist/utils/deploy/util.d.ts +6 -3
  39. package/dist/utils/deploy/util.js +4 -16
  40. package/dist/utils/dev.d.ts +0 -1
  41. package/dist/utils/dev.js +1 -27
  42. package/dist/utils/env/index.js +1 -3
  43. package/dist/utils/get-repo-data.js +1 -1
  44. package/dist/utils/init/agent-skills.d.ts +96 -0
  45. package/dist/utils/init/agent-skills.js +653 -0
  46. package/dist/utils/parse-raw-flags.js +1 -1
  47. package/dist/utils/proxy-server.d.ts +1 -2
  48. package/dist/utils/proxy-server.js +1 -2
  49. package/dist/utils/proxy.d.ts +1 -1
  50. package/dist/utils/proxy.js +7 -35
  51. package/dist/utils/types.d.ts +1 -1
  52. package/functions-templates/javascript/scheduled-function/package.json +1 -1
  53. package/functions-templates/typescript/database/package-lock.json +8 -8
  54. package/functions-templates/typescript/database/package.json +1 -1
  55. package/functions-templates/typescript/database-drizzle/package-lock.json +8 -8
  56. package/functions-templates/typescript/database-drizzle/package.json +1 -1
  57. package/functions-templates/typescript/hello-world/package-lock.json +15 -17
  58. package/functions-templates/typescript/hello-world/package.json +1 -1
  59. package/functions-templates/typescript/scheduled-function/package.json +1 -1
  60. package/package.json +10 -11
  61. package/dist/utils/addons/prepare.d.ts +0 -13
  62. package/dist/utils/addons/prepare.js +0 -26
@@ -22,7 +22,6 @@ interface GetSiteInformationOptions {
22
22
  siteInfo: SiteInfo;
23
23
  }
24
24
  export interface SiteInformationResult {
25
- addonsUrls: Record<string, string>;
26
25
  siteUrl: string;
27
26
  accountId?: string;
28
27
  capabilities: {
package/dist/utils/dev.js CHANGED
@@ -10,10 +10,6 @@ const ENV_VAR_SOURCES = {
10
10
  name: 'shared',
11
11
  printFn: chalk.magenta,
12
12
  },
13
- addons: {
14
- name: 'addon',
15
- printFn: chalk.yellow,
16
- },
17
13
  configFile: {
18
14
  name: 'netlify.toml file',
19
15
  printFn: chalk.green,
@@ -47,25 +43,6 @@ const getAccounts = async ({ api }) => {
47
43
  return logAndThrowError(`Failed retrieving user account: ${error_.message}. ${ERROR_CALL_TO_ACTION}`);
48
44
  }
49
45
  };
50
- // @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
51
- const getAddons = async ({ api, site }) => {
52
- try {
53
- const addons = await api.listServiceInstancesForSite({ siteId: site.id });
54
- return addons;
55
- }
56
- catch (error_) {
57
- return logAndThrowError(`Failed retrieving addons for site ${chalk.yellow(site.id)}: ${error_.message}. ${ERROR_CALL_TO_ACTION}`);
58
- }
59
- };
60
- // @ts-expect-error TS(7031) FIXME: Binding element 'addons' implicitly has an 'any' t... Remove this comment to see the full error message
61
- const getAddonsInformation = ({ addons, siteInfo }) => {
62
- const urls = Object.fromEntries(
63
- // @ts-expect-error TS(7006) FIXME: Parameter 'addon' implicitly has an 'any' type.
64
- addons.map((addon) => [addon.service_slug, `${siteInfo.ssl_url}${addon.service_path}`]));
65
- // @ts-expect-error TS(7006) FIXME: Parameter 'addon' implicitly has an 'any' type.
66
- const env = Object.assign({}, ...addons.map((addon) => addon.env));
67
- return { urls, env };
68
- };
69
46
  const getSiteAccount = ({ accounts, siteInfo }) => {
70
47
  const siteAccount = accounts.find((account) => account.slug === siteInfo.account_slug);
71
48
  if (!siteAccount) {
@@ -81,11 +58,9 @@ const BACKGROUND_FUNCTION_TIMEOUT = 900;
81
58
  export const getSiteInformation = async ({ api, offline, site, siteInfo, }) => {
82
59
  if (site.id && !offline) {
83
60
  validateSiteInfo({ site, siteInfo });
84
- const [accounts, addons] = await Promise.all([getAccounts({ api }), getAddons({ api, site })]);
85
- const { urls: addonsUrls } = getAddonsInformation({ siteInfo, addons });
61
+ const accounts = await getAccounts({ api });
86
62
  const account = getSiteAccount({ siteInfo, accounts });
87
63
  return {
88
- addonsUrls,
89
64
  siteUrl: siteInfo.ssl_url,
90
65
  accountId: account?.id,
91
66
  capabilities: {
@@ -100,7 +75,6 @@ export const getSiteInformation = async ({ api, offline, site, siteInfo, }) => {
100
75
  }
101
76
  // best defaults we can have without retrieving site information
102
77
  return {
103
- addonsUrls: {},
104
78
  siteUrl: '',
105
79
  capabilities: {
106
80
  aiGatewayDisabled: false,
@@ -180,7 +180,6 @@ export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw
180
180
  }
181
181
  const generalEnv = filterEnvBySource(env, 'general');
182
182
  const internalEnv = filterEnvBySource(env, 'internal');
183
- const addonsEnv = filterEnvBySource(env, 'addons');
184
183
  const configFileEnv = filterEnvBySource(env, 'configFile');
185
184
  // filter out configFile env vars if a non-configFile scope is passed
186
185
  const includeConfigEnvVars = /any|builds|post[-_]processing/.test(scope);
@@ -188,7 +187,6 @@ export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw
188
187
  return {
189
188
  ...generalEnv,
190
189
  ...accountEnv,
191
- ...(includeConfigEnvVars ? addonsEnv : {}),
192
190
  ...siteEnv,
193
191
  ...(includeConfigEnvVars ? configFileEnv : {}),
194
192
  ...internalEnv,
@@ -249,7 +247,7 @@ export const translateFromEnvelopeToMongo = (envVars = [], context = 'dev') => e
249
247
  .sort((a, b) => (a.key.toLowerCase() < b.key.toLowerCase() ? -1 : 1))
250
248
  .reduce((acc, cur) => {
251
249
  const envVar = cur.values.find((val) => [context, 'all'].includes((val.context_parameter ?? '') || val.context));
252
- if (envVar && envVar.value) {
250
+ if (envVar?.value) {
253
251
  return {
254
252
  ...acc,
255
253
  [cur.key]: envVar.value,
@@ -11,7 +11,7 @@ const getRepoData = async ({ remoteName, workingDir, }) => {
11
11
  util.promisify(gitconfiglocal)(workingDir),
12
12
  findUp('.git', { cwd: workingDir, type: 'directory' }),
13
13
  ]);
14
- if (!gitDirectory || !gitConfig || !gitConfig.remote || Object.keys(gitConfig.remote).length === 0) {
14
+ if (!gitDirectory || !gitConfig?.remote || Object.keys(gitConfig.remote).length === 0) {
15
15
  throw new Error('No Git remote found');
16
16
  }
17
17
  const baseGitPath = dirname(gitDirectory);
@@ -0,0 +1,96 @@
1
+ export declare const DEFAULT_SKILLS_HOST = "https://netlify-agent-skills.netlify.app";
2
+ export declare const SKILLS_HOST_ENV = "NETLIFY_SKILLS_HOST";
3
+ export declare const DEFAULT_SKILLS_DIRECTORY: string;
4
+ export interface SkillHistoryEntry {
5
+ version: string | null;
6
+ name?: string;
7
+ tree_hash: string;
8
+ }
9
+ export interface ManifestSkill {
10
+ name: string;
11
+ status: 'active' | 'deprecated';
12
+ version: string | null;
13
+ prior_names?: string[];
14
+ description?: string;
15
+ tree_hash: string | null;
16
+ files?: Record<string, string>;
17
+ executable?: string[];
18
+ history?: SkillHistoryEntry[];
19
+ deprecated?: {
20
+ since: string;
21
+ replaced_by?: string;
22
+ };
23
+ }
24
+ export interface SkillsManifest {
25
+ schema_version: number;
26
+ version: string;
27
+ skills: ManifestSkill[];
28
+ }
29
+ export type SkillRecord = {
30
+ name: string;
31
+ status: 'current';
32
+ version: string | null;
33
+ } | {
34
+ name: string;
35
+ status: 'stale';
36
+ version: string | null;
37
+ have: string | null;
38
+ } | {
39
+ name: string;
40
+ status: 'modified';
41
+ version: string | null;
42
+ } | {
43
+ name: string;
44
+ status: 'renamed';
45
+ currentName: string;
46
+ modified: boolean;
47
+ } | {
48
+ name: string;
49
+ status: 'deprecated';
50
+ replacedBy: string | null;
51
+ modified: boolean;
52
+ } | {
53
+ name: string;
54
+ status: 'unknown';
55
+ };
56
+ export interface SkillsClassification {
57
+ skills: SkillRecord[];
58
+ missing: string[];
59
+ }
60
+ export type SkillAction = 'current' | 'added' | 'updated' | 'reset' | 'renamed' | 'removed' | 'kept' | 'ignored' | 'failed';
61
+ export interface SkillActionRecord {
62
+ name: string;
63
+ action: SkillAction;
64
+ detail?: string;
65
+ }
66
+ export interface SkillsSyncResult {
67
+ directory: string;
68
+ actions: SkillActionRecord[];
69
+ }
70
+ export declare const resolveSkillsHost: (env?: NodeJS.ProcessEnv) => string;
71
+ export declare const fetchSkillsManifest: (host: string) => Promise<SkillsManifest>;
72
+ export declare const hashSkillTree: (dir: string, declaredExecutable?: Set<string>) => Promise<string>;
73
+ export declare const classifySkillsDirectory: (root: string, manifest: SkillsManifest) => Promise<SkillsClassification>;
74
+ export declare const installSkill: (host: string, dest: string, skill: ManifestSkill, { force }?: {
75
+ force?: boolean;
76
+ }) => Promise<number>;
77
+ export declare const syncSkills: ({ host, directory, manifest, reset, }: {
78
+ host: string;
79
+ directory: string;
80
+ manifest: SkillsManifest;
81
+ reset?: boolean;
82
+ }) => Promise<SkillsSyncResult>;
83
+ export declare const resolveSkillsDirectories: (workingDir: string, env?: NodeJS.ProcessEnv) => Promise<string[]>;
84
+ export interface AgentSkillsSetupSummary {
85
+ installed: boolean;
86
+ directories: string[];
87
+ skillsVersion?: string;
88
+ summary: Record<SkillAction, number>;
89
+ error?: string;
90
+ }
91
+ export declare const setupAgentSkills: ({ workingDir, env, reset, }: {
92
+ workingDir: string;
93
+ env?: NodeJS.ProcessEnv;
94
+ reset?: boolean;
95
+ }) => Promise<AgentSkillsSetupSummary>;
96
+ //# sourceMappingURL=agent-skills.d.ts.map