@astryxdesign/cli 0.7.9-canary.cfd25ce → 0.7.9-canary.d0cf29a

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 (40) hide show
  1. package/api/discover/_adapter.d.mts +1 -1
  2. package/api/search/_result.d.mts +5 -5
  3. package/api/search/search.d.mts +1 -1
  4. package/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx +8 -7
  5. package/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx +8 -7
  6. package/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx +8 -7
  7. package/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx +12 -10
  8. package/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx +8 -7
  9. package/authoring/debug/parse.d.mts +2 -2
  10. package/clients/cli/index.mjs +11 -6
  11. package/foundation/agent-docs/agent-docs-target.d.mts +49 -0
  12. package/foundation/agent-docs/agent-docs-target.mjs +201 -0
  13. package/foundation/agent-docs/agent-docs.d.mts +1 -38
  14. package/foundation/agent-docs/agent-docs.mjs +16 -181
  15. package/foundation/config/config-path.d.mts +13 -0
  16. package/foundation/config/config-path.mjs +42 -0
  17. package/foundation/config/project.d.mts +1 -10
  18. package/foundation/config/project.mjs +4 -26
  19. package/foundation/discovery/component-loader.d.mts +1 -1
  20. package/foundation/discovery/icon-set-paths.d.mts +18 -0
  21. package/foundation/discovery/icon-set-paths.mjs +23 -0
  22. package/foundation/discovery/icon-set-writer.d.mts +2 -7
  23. package/foundation/discovery/icon-set-writer.mjs +3 -12
  24. package/foundation/fs/module-loader.d.mts +2 -8
  25. package/foundation/fs/module-loader.mjs +3 -12
  26. package/foundation/fs/present-files.d.mts +11 -0
  27. package/foundation/fs/present-files.mjs +25 -0
  28. package/foundation/integrations/autolink.d.mts +2 -21
  29. package/foundation/integrations/autolink.mjs +6 -42
  30. package/foundation/integrations/contribution-fixes.mjs +26 -3
  31. package/foundation/integrations/contribution-inventory.mjs +1 -1
  32. package/foundation/integrations/installed-package.d.mts +36 -0
  33. package/foundation/integrations/installed-package.mjs +57 -0
  34. package/foundation/integrations/integrations.d.mts +3 -75
  35. package/foundation/integrations/integrations.mjs +3 -16
  36. package/foundation/integrations/manifest-paths.d.mts +13 -0
  37. package/foundation/integrations/manifest-paths.mjs +31 -0
  38. package/foundation/runtime/locked-versions.mjs +1 -1
  39. package/foundation/runtime/package-set.mjs +1 -1
  40. package/package.json +9 -9
@@ -20,7 +20,7 @@
20
20
 
21
21
  import * as fs from 'node:fs';
22
22
  import * as path from 'node:path';
23
- import jscodeshift from 'jscodeshift';
23
+ import {createRequire} from 'node:module';
24
24
  import {isValidSemver} from '../env/semver.mjs';
25
25
  import {
26
26
  isThemeFolder as readsAsTheme,
@@ -88,7 +88,29 @@ const ROOT_HOLDS = /** @type {Record<MetadataRoot, string>} */ ({
88
88
  themes: 'themes',
89
89
  });
90
90
 
91
- const j = jscodeshift.withParser('tsx');
91
+ const require = createRequire(import.meta.url);
92
+ /** @type {typeof import('jscodeshift').default | undefined} */
93
+ let jscodeshiftModule;
94
+ /** @type {ReturnType<typeof import('jscodeshift').default['withParser']> | undefined} */
95
+ let tsxParser;
96
+
97
+ /**
98
+ * jscodeshift, loaded at its first use: it is a large module, and a run that
99
+ * checks no contribution file never needs it.
100
+ * @returns {typeof import('jscodeshift').default}
101
+ */
102
+ function jscodeshift() {
103
+ jscodeshiftModule ??= require('jscodeshift');
104
+ return /** @type {typeof import('jscodeshift').default} */ (
105
+ jscodeshiftModule
106
+ );
107
+ }
108
+
109
+ /** jscodeshift with the TypeScript parser, made once. */
110
+ function tsx() {
111
+ tsxParser ??= jscodeshift().withParser('tsx');
112
+ return tsxParser;
113
+ }
92
114
 
93
115
  /** @param {any} node @returns {any} */
94
116
  function unwrapStaticExpression(node) {
@@ -136,6 +158,7 @@ function staticPropertyNamed(property, name) {
136
158
  * @returns {ContributionStamp | null} null when it is not contribution metadata
137
159
  */
138
160
  export function readContributionStamp(file, templateOnly) {
161
+ const j = tsx();
139
162
  let ast;
140
163
  try {
141
164
  ast = j(fs.readFileSync(file, 'utf-8'));
@@ -526,7 +549,7 @@ function localImports(entry) {
526
549
  /** @type {string[]} */
527
550
  const specifiers = [];
528
551
  try {
529
- const js = jscodeshift.withParser(
552
+ const js = jscodeshift().withParser(
530
553
  /\.(?:ts|tsx|mts)$/u.test(file) ? 'tsx' : 'babel',
531
554
  );
532
555
  const ast = js(fs.readFileSync(file, 'utf-8'));
@@ -25,7 +25,7 @@ import {discoverIntegrationTemplatesForOne} from '../discovery/template-adapter.
25
25
  import {discoverIntegrationCodemods} from '../../assets/codemods/integration-discovery.mjs';
26
26
  import {discoverIntegrationDocs} from '../discovery/docs-discovery.mjs';
27
27
  import {discoverIconSetDirectory} from '../discovery/icon-set-discovery.mjs';
28
- import {generatedTypesPath} from '../discovery/icon-set-writer.mjs';
28
+ import {generatedTypesPath} from '../discovery/icon-set-paths.mjs';
29
29
 
30
30
  // ── File-walk helpers (no module imports, no execution) ──────────
31
31
 
@@ -0,0 +1,36 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Whether a dependency key is a bare package name safe to resolve.
6
+ *
7
+ * Mirrors the guard in {@link import('./integrations.mjs').resolvePackageDir}:
8
+ * a name is a directory under node_modules, so a path segment (`.`, `..`) or an
9
+ * absolute spec must never reach the resolver, which goes on to dynamically
10
+ * import what it finds.
11
+ *
12
+ * @param {string} name
13
+ * @returns {boolean}
14
+ */
15
+ export function isBarePackageName(name: string): boolean;
16
+ /**
17
+ * Resolve an installed package's directory the way Node's resolver finds it:
18
+ * the nearest `node_modules/<name>` walking up from `fromDir`.
19
+ *
20
+ * Walking up matters because hoisting is normal — yarn and npm workspaces lift
21
+ * a workspace member's dependency to the repo root, so the app's own
22
+ * node_modules can be empty of a package it genuinely declares. Integrations
23
+ * named in astryx.config resolve through the same walk.
24
+ *
25
+ * Presence is decided by the package's own package.json, not the directory, so
26
+ * a stale empty directory is not mistaken for an install.
27
+ *
28
+ * @param {string} name bare package name
29
+ * @param {string} fromDir directory to start walking up from
30
+ * @returns {{packageDir: string, hostDir: string}|null} the resolved package
31
+ * directory and the directory whose node_modules holds it
32
+ */
33
+ export function resolveInstalledPackageDir(name: string, fromDir: string): {
34
+ packageDir: string;
35
+ hostDir: string;
36
+ } | null;
@@ -0,0 +1,57 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file installed-package.mjs
5
+ * @input A dependency name and the folder to resolve it from
6
+ * @output isBarePackageName and resolveInstalledPackageDir: where an installed
7
+ * package is, found the way Node's resolver walks up node_modules
8
+ * @position packages/cli/foundation/integrations: loads no integration, so the
9
+ * run's locked versions resolve packages without autolink.mjs and its
10
+ * manifest loader. autolink.mjs re-exports resolveInstalledPackageDir.
11
+ */
12
+
13
+ import * as path from 'node:path';
14
+ import {findNodeModulesPackage} from '../fs/paths.mjs';
15
+
16
+ /**
17
+ * Whether a dependency key is a bare package name safe to resolve.
18
+ *
19
+ * Mirrors the guard in {@link import('./integrations.mjs').resolvePackageDir}:
20
+ * a name is a directory under node_modules, so a path segment (`.`, `..`) or an
21
+ * absolute spec must never reach the resolver, which goes on to dynamically
22
+ * import what it finds.
23
+ *
24
+ * @param {string} name
25
+ * @returns {boolean}
26
+ */
27
+ export function isBarePackageName(name) {
28
+ return (
29
+ typeof name === 'string' &&
30
+ name.length > 0 &&
31
+ !path.isAbsolute(name) &&
32
+ !name.startsWith('@/') &&
33
+ !name.split('/').some(segment => segment === '.' || segment === '..')
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Resolve an installed package's directory the way Node's resolver finds it:
39
+ * the nearest `node_modules/<name>` walking up from `fromDir`.
40
+ *
41
+ * Walking up matters because hoisting is normal — yarn and npm workspaces lift
42
+ * a workspace member's dependency to the repo root, so the app's own
43
+ * node_modules can be empty of a package it genuinely declares. Integrations
44
+ * named in astryx.config resolve through the same walk.
45
+ *
46
+ * Presence is decided by the package's own package.json, not the directory, so
47
+ * a stale empty directory is not mistaken for an install.
48
+ *
49
+ * @param {string} name bare package name
50
+ * @param {string} fromDir directory to start walking up from
51
+ * @returns {{packageDir: string, hostDir: string}|null} the resolved package
52
+ * directory and the directory whose node_modules holds it
53
+ */
54
+ export function resolveInstalledPackageDir(name, fromDir) {
55
+ if (!isBarePackageName(name)) return null;
56
+ return findNodeModulesPackage(fromDir, name);
57
+ }
@@ -21,14 +21,6 @@
21
21
  * @returns {LoadedIntegration[]}
22
22
  */
23
23
  export function markProviderConflicts(integrations: LoadedIntegration[]): LoadedIntegration[];
24
- /**
25
- * Return the conventional root manifest paths present in `dir`, in
26
- * load-precedence order. Unlike {@link resolveManifestPath} this never throws —
27
- * callers (for example Doctor integration validation) decide how to treat zero / multiple.
28
- * @param {string} dir
29
- * @returns {string[]} absolute manifest paths
30
- */
31
- export function findManifestPaths(dir: string): string[];
32
24
  /**
33
25
  * Load and validate a manifest module's default export, while isolating the
34
26
  * optional `agentDocs` contribution from the manifest's other fields.
@@ -120,73 +112,6 @@ export function loadIntegrations(specs?: string[], { cwd, fresh, resolveProvider
120
112
  fresh?: boolean;
121
113
  resolveProviders?: boolean;
122
114
  }): Promise<LoadedIntegration[]>;
123
- /**
124
- * A fully-resolved, loaded integration. Identity (`name`, `version`) comes from
125
- * the package's package.json; the `components`/`templates`/`codemods`/`docs`/
126
- * `themes` roots are absolute paths resolved from the manifest. The `__`-prefixed fields
127
- * are internal bookkeeping used by Doctor integration validation and Project.
128
- * @typedef {object} LoadedIntegration
129
- * @property {string} name
130
- * @property {import('../../authoring/identity/type').ProviderId} [providerId]
131
- * normalized stable provider identity; absent only for a legacy unnamed local
132
- * package. Unique among contributing integrations: a later claimant is kept
133
- * inert with `__providerConflict` (see {@link markProviderConflicts})
134
- * @property {string} [version]
135
- * @property {string} [components]
136
- * @property {string} [templates]
137
- * @property {string} [codemods]
138
- * @property {string} [docs]
139
- * @property {string} [themes]
140
- * @property {string} [iconSets] the manifest's `experimental.iconSets` root
141
- * @property {string} [issuesUrl]
142
- * @property {{append?: readonly string[]}} [agentDocs]
143
- * @property {string} [cliCommand] the command this package's users run the
144
- * CLI with; read by the picker in foundation/env (see cli-command.mjs)
145
- * @property {string} [__cliCommandError] why a declared `cliCommand` was
146
- * ignored; the rest of the manifest still contributes
147
- * @property {string} [__agentDocsError] contribution-specific validation
148
- * failure; other manifest contributions remain available
149
- * @property {string} __spec
150
- * @property {string} [__declaredProviderId] the manifest's `providerId` as
151
- * written, kept by validation so it can tell whether the package has one
152
- * @property {string} __packageDir
153
- * @property {Record<string, unknown>|null} [__packageExports] the owning
154
- * package's `exports` map, kept from the package.json this loader already
155
- * parsed so import resolution does not read it a second time
156
- * @property {string} __manifestFile
157
- * @property {string} [__loadError] set when the manifest failed to load/validate;
158
- * such an integration contributes nothing and is surfaced via Project.issues()
159
- * @property {{providerId: import('../../authoring/identity/type').ProviderId, claimedBy: string, message: string}} [__providerConflict]
160
- * set on a package whose provider ID an earlier-loaded package already
161
- * claims; it contributes nothing and is reported as a `duplicate_provider`
162
- * warning
163
- * @property {string[]} [__declaredKeys] the keys the manifest object itself
164
- * declares, before any is filled in (providerId from the package name)
165
- * @property {string[]} [__unknownKeys] manifest keys this CLI does not know —
166
- * surfaced as a warning; the rest of the manifest still contributes
167
- * @property {boolean} [__autolinked] loaded because the project declares the
168
- * package as a dependency and it ships a manifest, with no astryx.config
169
- * entry naming it — see foundation/integrations/autolink.mjs
170
- * @property {boolean} [__computer] loaded because it is installed beside the
171
- * running CLI and the folder is outside a project (spec AST-081 FR12) — see
172
- * foundation/integrations/computer-integrations.mjs
173
- * @property {boolean} [__local] loaded from the package containing the current
174
- * working directory, so an author sees the exact bytes they are editing
175
- * @property {string} [__dependencyField] for an autolinked integration, the
176
- * package.json field that declared it (`dependencies`, `devDependencies`,
177
- * `optionalDependencies`)
178
- * @property {import('../../authoring/debug/type').DebugEventHandler} [__debug]
179
- * the manifest module's `debug` NAMED export, when it exported a function.
180
- * @property {import('../../authoring/gap-report/type').GapReportHandler} [__gapReport]
181
- * validated package-owned handler from the `gapReport` NAMED export.
182
- * @property {string} [__gapReportError] isolated named-handler validation error.
183
- * Named exports are not manifest keys — see {@link loadManifest}.
184
- * @property {import('../../authoring/discover/type').DiscoverSource} [__discover]
185
- * validated catalog source from the `discover` NAMED export.
186
- * @property {string} [__discoverError] isolated discover-source validation error.
187
- */
188
- /** Conventional manifest basenames, in load-precedence order. */
189
- export const MANIFEST_BASENAMES: string[];
190
115
  /**
191
116
  * A fully-resolved, loaded integration. Identity (`name`, `version`) comes from
192
117
  * the package's package.json; the `components`/`templates`/`codemods`/`docs`/
@@ -314,3 +239,6 @@ export type LoadedIntegration = {
314
239
  */
315
240
  __discoverError?: string | undefined;
316
241
  };
242
+ import { findManifestPaths } from './manifest-paths.mjs';
243
+ import { MANIFEST_BASENAMES } from './manifest-paths.mjs';
244
+ export { findManifestPaths, MANIFEST_BASENAMES };
@@ -32,6 +32,9 @@ import {
32
32
  unknownIntegrationKeys,
33
33
  } from '../../authoring/integration/schema.mjs';
34
34
  import {importUserModule, findPresentFiles} from '../fs/module-loader.mjs';
35
+ import {findManifestPaths, MANIFEST_BASENAMES} from './manifest-paths.mjs';
36
+
37
+ export {findManifestPaths, MANIFEST_BASENAMES};
35
38
  import {parseGapReportHandler} from '../../authoring/gap-report/parse.mjs';
36
39
  import {parseDiscoverSource} from '../../authoring/discover/parse.mjs';
37
40
  import {resolveProviders} from './provider-resolution.mjs';
@@ -102,12 +105,6 @@ import {resolveProviders} from './provider-resolution.mjs';
102
105
  * @property {string} [__discoverError] isolated discover-source validation error.
103
106
  */
104
107
 
105
- /** Conventional manifest basenames, in load-precedence order. */
106
- export const MANIFEST_BASENAMES = [
107
- 'astryx.integration.ts',
108
- 'astryx.integration.mjs',
109
- 'astryx.integration.js',
110
- ];
111
108
 
112
109
  /**
113
110
  * Normalize a package-owned provider ID without rejecting legacy unnamed local
@@ -153,16 +150,6 @@ export function markProviderConflicts(integrations) {
153
150
  ).integrations;
154
151
  }
155
152
 
156
- /**
157
- * Return the conventional root manifest paths present in `dir`, in
158
- * load-precedence order. Unlike {@link resolveManifestPath} this never throws —
159
- * callers (for example Doctor integration validation) decide how to treat zero / multiple.
160
- * @param {string} dir
161
- * @returns {string[]} absolute manifest paths
162
- */
163
- export function findManifestPaths(dir) {
164
- return findPresentFiles(dir, MANIFEST_BASENAMES);
165
- }
166
153
 
167
154
  /**
168
155
  * Parse the optional named gap-report handler without making it part of the
@@ -0,0 +1,13 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Return the conventional root manifest paths present in `dir`, in
6
+ * load-precedence order. Unlike {@link resolveManifestPath} this never throws —
7
+ * callers (for example Doctor integration validation) decide how to treat zero / multiple.
8
+ * @param {string} dir
9
+ * @returns {string[]} absolute manifest paths
10
+ */
11
+ export function findManifestPaths(dir: string): string[];
12
+ /** Conventional manifest basenames, in load-precedence order. */
13
+ export const MANIFEST_BASENAMES: string[];
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file manifest-paths.mjs
5
+ * @input A package folder
6
+ * @output MANIFEST_BASENAMES and findManifestPaths: the integration manifests
7
+ * a package has, in load-precedence order
8
+ * @position packages/cli/foundation/integrations: reads no manifest, so the
9
+ * run's package set finds them without integrations.mjs, its schemas and
10
+ * its module loader. integrations.mjs re-exports both.
11
+ */
12
+
13
+ import {findPresentFiles} from '../fs/present-files.mjs';
14
+
15
+ /** Conventional manifest basenames, in load-precedence order. */
16
+ export const MANIFEST_BASENAMES = [
17
+ 'astryx.integration.ts',
18
+ 'astryx.integration.mjs',
19
+ 'astryx.integration.js',
20
+ ];
21
+
22
+ /**
23
+ * Return the conventional root manifest paths present in `dir`, in
24
+ * load-precedence order. Unlike {@link resolveManifestPath} this never throws —
25
+ * callers (for example Doctor integration validation) decide how to treat zero / multiple.
26
+ * @param {string} dir
27
+ * @returns {string[]} absolute manifest paths
28
+ */
29
+ export function findManifestPaths(dir) {
30
+ return findPresentFiles(dir, MANIFEST_BASENAMES);
31
+ }
@@ -14,7 +14,7 @@
14
14
 
15
15
  import * as path from 'node:path';
16
16
  import {findLockfile, lockedVersion, readJson} from '../release/project.mjs';
17
- import {resolveInstalledPackageDir} from '../integrations/autolink.mjs';
17
+ import {resolveInstalledPackageDir} from '../integrations/installed-package.mjs';
18
18
 
19
19
  const SCOPE = '@astryxdesign/';
20
20
  const FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies'];
@@ -22,7 +22,7 @@
22
22
 
23
23
  import * as fs from 'node:fs';
24
24
  import * as path from 'node:path';
25
- import {findManifestPaths} from '../integrations/integrations.mjs';
25
+ import {findManifestPaths} from '../integrations/manifest-paths.mjs';
26
26
  import {readJson} from '../release/project.mjs';
27
27
  import {cliBinOf, isVersionRange} from '../release/cache.mjs';
28
28
  import {isValidSemver, satisfiesRange} from '../env/semver.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.9-canary.cfd25ce",
3
+ "version": "0.7.9-canary.d0cf29a",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -124,10 +124,10 @@
124
124
  "zod": "^4.4.3"
125
125
  },
126
126
  "peerDependencies": {
127
- "@astryxdesign/charts": "0.7.9-canary.cfd25ce",
128
- "@astryxdesign/core": "0.7.9-canary.cfd25ce",
129
- "@astryxdesign/lab": "0.7.9-canary.cfd25ce",
130
- "@astryxdesign/theme-neutral": "0.7.9-canary.cfd25ce"
127
+ "@astryxdesign/charts": "0.7.9-canary.d0cf29a",
128
+ "@astryxdesign/core": "0.7.9-canary.d0cf29a",
129
+ "@astryxdesign/lab": "0.7.9-canary.d0cf29a",
130
+ "@astryxdesign/theme-neutral": "0.7.9-canary.d0cf29a"
131
131
  },
132
132
  "peerDependenciesMeta": {
133
133
  "@astryxdesign/charts": {
@@ -144,10 +144,10 @@
144
144
  }
145
145
  },
146
146
  "devDependencies": {
147
- "@astryxdesign/charts": "0.7.9-canary.cfd25ce",
148
- "@astryxdesign/core": "0.7.9-canary.cfd25ce",
149
- "@astryxdesign/lab": "0.7.9-canary.cfd25ce",
150
- "@astryxdesign/theme-neutral": "0.7.9-canary.cfd25ce",
147
+ "@astryxdesign/charts": "0.7.9-canary.d0cf29a",
148
+ "@astryxdesign/core": "0.7.9-canary.d0cf29a",
149
+ "@astryxdesign/lab": "0.7.9-canary.d0cf29a",
150
+ "@astryxdesign/theme-neutral": "0.7.9-canary.d0cf29a",
151
151
  "@heroicons/react": "^2.2.0",
152
152
  "@stylexjs/stylex": "^0.19.0",
153
153
  "@types/babel__core": "^7.20.5",