@astryxdesign/cli 0.7.8 → 0.7.9-canary.0236bb8
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/api/discover/_adapter.d.mts +1 -1
- package/api/docs/_adapter.d.mts +8 -2
- package/api/docs/_adapter.mjs +10 -4
- package/api/docs/detail/section/section.d.mts +5 -2
- package/api/docs/detail/section/section.mjs +6 -2
- package/api/docs/docs.mjs +7 -1
- package/api/search/_adapter.d.mts +3 -1
- package/api/search/_adapter.mjs +12 -2
- package/api/search/_candidate-score.mjs +25 -23
- package/api/search/_main-searcher.mjs +1 -1
- package/api/search/_result.d.mts +5 -5
- package/api/search/_words.d.mts +44 -7
- package/api/search/_words.mjs +113 -21
- package/api/search/search.d.mts +4 -2
- package/api/search/search.mjs +9 -8
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +24 -1
- package/api/swizzle/copy/copy.mjs +9 -4
- package/api/theme/build/build.d.mts +26 -1
- package/api/theme/build/build.mjs +71 -20
- package/api/theme/build/core-interception.d.mts +2 -1
- package/api/theme/build/core-interception.mjs +23 -5
- package/assets/discover/official-packages.json +4 -0
- package/assets/docs/tree/calendar-systems.doc.mjs +146 -0
- package/assets/docs/tree/calendars.doc.mjs +46 -0
- package/assets/docs/tree/i18n-calendars.doc.mjs +51 -0
- package/assets/docs/tree/internationalization.doc.mjs +3 -3
- package/assets/docs/tree/tokens-color.doc.mjs +1 -1
- package/assets/templates/blocks/components/Hooks/useClickableContainerHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useClickableContainerHookUsage.tsx +67 -0
- package/assets/templates/blocks/components/Hooks/useImageModeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/Hooks/useImageModeHookUsage.tsx +55 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipMetricDefinitions.doc.mjs +14 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipMetricDefinitions.tsx +46 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipPermissionNotes.doc.mjs +14 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipPermissionNotes.tsx +41 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipShowcase.doc.mjs +13 -0
- package/assets/templates/blocks/components/InfoTip/InfoTipShowcase.tsx +24 -0
- package/assets/templates/blocks/components/PowerSearch/PowerSearchContentSearch.tsx +8 -7
- package/assets/templates/blocks/components/PowerSearch/PowerSearchFullFeatured.tsx +8 -7
- package/assets/templates/blocks/components/PowerSearch/PowerSearchPresetFilters.tsx +8 -7
- package/assets/templates/blocks/components/PowerSearch/PowerSearchSearchWithTable.tsx +12 -10
- package/assets/templates/blocks/components/PowerSearch/PowerSearchShowcase.tsx +8 -7
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.doc.mjs +2 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +0 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +0 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.doc.mjs +2 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +0 -2
- package/assets/templates/pages/table-inbox/page.tsx +11 -8
- package/assets/templates/pages/work-item-detail/page.tsx +6 -2
- package/assets/theme.template.ts +1 -1
- package/authoring/debug/parse.d.mts +2 -2
- package/clients/cli/commands/ensure-core-built.mjs +399 -43
- package/clients/cli/index.mjs +11 -6
- package/foundation/agent-docs/agent-docs-target.d.mts +49 -0
- package/foundation/agent-docs/agent-docs-target.mjs +201 -0
- package/foundation/agent-docs/agent-docs.d.mts +1 -38
- package/foundation/agent-docs/agent-docs.mjs +16 -181
- package/foundation/config/config-path.d.mts +13 -0
- package/foundation/config/config-path.mjs +42 -0
- package/foundation/config/project.d.mts +1 -10
- package/foundation/config/project.mjs +31 -35
- package/foundation/discovery/component-discovery.mjs +39 -4
- package/foundation/discovery/component-loader.d.mts +1 -1
- package/foundation/discovery/icon-set-paths.d.mts +18 -0
- package/foundation/discovery/icon-set-paths.mjs +23 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -7
- package/foundation/discovery/icon-set-writer.mjs +3 -12
- package/foundation/env/search-path.d.mts +12 -0
- package/foundation/env/search-path.mjs +71 -43
- package/foundation/fs/module-loader.d.mts +2 -8
- package/foundation/fs/module-loader.mjs +3 -12
- package/foundation/fs/present-files.d.mts +11 -0
- package/foundation/fs/present-files.mjs +25 -0
- package/foundation/integrations/autolink.d.mts +2 -21
- package/foundation/integrations/autolink.mjs +6 -42
- package/foundation/integrations/contribution-fixes.mjs +26 -3
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/installed-package.d.mts +36 -0
- package/foundation/integrations/installed-package.mjs +57 -0
- package/foundation/integrations/integrations.d.mts +3 -75
- package/foundation/integrations/integrations.mjs +3 -16
- package/foundation/integrations/manifest-paths.d.mts +13 -0
- package/foundation/integrations/manifest-paths.mjs +31 -0
- package/foundation/integrations/manifest-writer.d.mts +3 -4
- package/foundation/integrations/manifest-writer.mjs +5 -3
- package/foundation/release/cache.d.mts +11 -4
- package/foundation/release/cache.mjs +15 -7
- package/foundation/runtime/locked-versions.mjs +1 -1
- package/foundation/runtime/package-set.mjs +1 -1
- package/foundation/text/levenshtein.d.mts +4 -1
- package/foundation/text/levenshtein.mjs +44 -1
- package/package.json +9 -9
- package/api/swizzle/_github.d.mts +0 -8
- package/api/swizzle/_github.mjs +0 -22
|
@@ -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
|
+
}
|
|
@@ -17,11 +17,11 @@ export function findLocalIntegrationManifest(packageDir: string): string;
|
|
|
17
17
|
export function unwrapManifestExpression(node: any): any;
|
|
18
18
|
/**
|
|
19
19
|
* Find the object literal an integration manifest exports.
|
|
20
|
-
* @param {ReturnType<typeof jscodeshift.withParser>} j
|
|
21
|
-
* @param {ReturnType<ReturnType<typeof jscodeshift.withParser>>} ast
|
|
20
|
+
* @param {ReturnType<typeof import('jscodeshift').default.withParser>} j
|
|
21
|
+
* @param {ReturnType<ReturnType<typeof import('jscodeshift').default.withParser>>} ast
|
|
22
22
|
* @returns {any|null}
|
|
23
23
|
*/
|
|
24
|
-
export function findManifestObject(j: ReturnType<typeof jscodeshift.withParser>, ast: ReturnType<ReturnType<typeof jscodeshift.withParser>>): any | null;
|
|
24
|
+
export function findManifestObject(j: ReturnType<typeof import("jscodeshift").default.withParser>, ast: ReturnType<ReturnType<typeof import("jscodeshift").default.withParser>>): any | null;
|
|
25
25
|
/**
|
|
26
26
|
* Add a contribution root to an integration manifest, creating the manifest
|
|
27
27
|
* when requested and none exists.
|
|
@@ -56,4 +56,3 @@ export class IntegrationRootConflictError extends Error {
|
|
|
56
56
|
current: string;
|
|
57
57
|
requested: string;
|
|
58
58
|
}
|
|
59
|
-
import jscodeshift from 'jscodeshift';
|
|
@@ -13,7 +13,6 @@ import * as fs from 'node:fs';
|
|
|
13
13
|
import * as path from 'node:path';
|
|
14
14
|
import {randomUUID} from 'node:crypto';
|
|
15
15
|
import {publishNewFile} from '../fs/publish-file.mjs';
|
|
16
|
-
import jscodeshift from 'jscodeshift';
|
|
17
16
|
import {assertWithin} from '../fs/path-safety.mjs';
|
|
18
17
|
import {findManifestPaths, loadManifestObject} from './integrations.mjs';
|
|
19
18
|
|
|
@@ -97,8 +96,8 @@ function propertyNamed(property, name) {
|
|
|
97
96
|
|
|
98
97
|
/**
|
|
99
98
|
* Find the object literal an integration manifest exports.
|
|
100
|
-
* @param {ReturnType<typeof jscodeshift.withParser>} j
|
|
101
|
-
* @param {ReturnType<ReturnType<typeof jscodeshift.withParser>>} ast
|
|
99
|
+
* @param {ReturnType<typeof import('jscodeshift').default.withParser>} j
|
|
100
|
+
* @param {ReturnType<ReturnType<typeof import('jscodeshift').default.withParser>>} ast
|
|
102
101
|
* @returns {any|null}
|
|
103
102
|
*/
|
|
104
103
|
export function findManifestObject(j, ast) {
|
|
@@ -290,6 +289,9 @@ export async function patchIntegrationRoot(
|
|
|
290
289
|
const source = manifestExists
|
|
291
290
|
? fs.readFileSync(manifestFile, 'utf-8')
|
|
292
291
|
: 'export default {};\n';
|
|
292
|
+
// The code-rewrite toolkit loads only to patch a manifest. Finding one,
|
|
293
|
+
// which many commands do through this module, never needs it.
|
|
294
|
+
const {default: jscodeshift} = await import('jscodeshift');
|
|
293
295
|
const j = jscodeshift.withParser('tsx');
|
|
294
296
|
let ast;
|
|
295
297
|
try {
|
|
@@ -199,15 +199,22 @@ export function tryLock(lockDir: string, { now }?: {
|
|
|
199
199
|
}): boolean;
|
|
200
200
|
/**
|
|
201
201
|
* Whether a process's arguments are this CLI's install of `version`, as
|
|
202
|
-
* runNpm starts it: the program (`argv[0]`) is npm, or
|
|
202
|
+
* runNpm starts it: the program (`argv[0]`) is npm, or a Node running npm's
|
|
203
203
|
* entry file `npm-cli.js` (`argv[1]`), each exactly by name, and the arguments
|
|
204
|
-
* include `install` and `@astryxdesign/cli@<version>`. A
|
|
205
|
-
* `
|
|
204
|
+
* include `install` and `@astryxdesign/cli@<version>`. A Node is one named
|
|
205
|
+
* `node` (with a version, such as `node22`), or one with the same file name
|
|
206
|
+
* as the Node runNpm starts npm with (`node`, by default this one), however
|
|
207
|
+
* it is named, such as `nodejs` or `node-linux-x64`. A program that only
|
|
208
|
+
* has `npm` somewhere in its name or arguments is not.
|
|
206
209
|
* @param {string[]} argv
|
|
207
210
|
* @param {string} version
|
|
211
|
+
* @param {{node?: string}} [options] `node`: the Node runNpm starts npm with
|
|
212
|
+
* (npmCommand's `execPath`; default: this one)
|
|
208
213
|
* @returns {boolean}
|
|
209
214
|
*/
|
|
210
|
-
export function isReleaseInstall(argv: string[], version: string
|
|
215
|
+
export function isReleaseInstall(argv: string[], version: string, { node }?: {
|
|
216
|
+
node?: string;
|
|
217
|
+
}): boolean;
|
|
211
218
|
/**
|
|
212
219
|
* End the npm process group a stale lock records, only when that process is
|
|
213
220
|
* surely the install the lock was taken for: its command line is this CLI's
|
|
@@ -823,15 +823,24 @@ function processFactsOf(pid, procRoot) {
|
|
|
823
823
|
|
|
824
824
|
/**
|
|
825
825
|
* Whether a process's arguments are this CLI's install of `version`, as
|
|
826
|
-
* runNpm starts it: the program (`argv[0]`) is npm, or
|
|
826
|
+
* runNpm starts it: the program (`argv[0]`) is npm, or a Node running npm's
|
|
827
827
|
* entry file `npm-cli.js` (`argv[1]`), each exactly by name, and the arguments
|
|
828
|
-
* include `install` and `@astryxdesign/cli@<version>`. A
|
|
829
|
-
* `
|
|
828
|
+
* include `install` and `@astryxdesign/cli@<version>`. A Node is one named
|
|
829
|
+
* `node` (with a version, such as `node22`), or one with the same file name
|
|
830
|
+
* as the Node runNpm starts npm with (`node`, by default this one), however
|
|
831
|
+
* it is named, such as `nodejs` or `node-linux-x64`. A program that only
|
|
832
|
+
* has `npm` somewhere in its name or arguments is not.
|
|
830
833
|
* @param {string[]} argv
|
|
831
834
|
* @param {string} version
|
|
835
|
+
* @param {{node?: string}} [options] `node`: the Node runNpm starts npm with
|
|
836
|
+
* (npmCommand's `execPath`; default: this one)
|
|
832
837
|
* @returns {boolean}
|
|
833
838
|
*/
|
|
834
|
-
export function isReleaseInstall(
|
|
839
|
+
export function isReleaseInstall(
|
|
840
|
+
argv,
|
|
841
|
+
version,
|
|
842
|
+
{node = process.execPath} = {},
|
|
843
|
+
) {
|
|
835
844
|
const name = (/** @type {string | undefined} */ arg) =>
|
|
836
845
|
(arg ?? '')
|
|
837
846
|
.split(/[\\/]/u)
|
|
@@ -839,9 +848,8 @@ export function isReleaseInstall(argv, version) {
|
|
|
839
848
|
?.replace(/\.(?:exe|cmd)$/iu, '')
|
|
840
849
|
.toLowerCase() ?? '';
|
|
841
850
|
const program = name(argv[0]);
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
(/^node(?:[-.\d]*)$/u.test(program) && name(argv[1]) === 'npm-cli.js');
|
|
851
|
+
const isNode = /^node(?:[-.\d]*)$/u.test(program) || program === name(node);
|
|
852
|
+
const npm = program === 'npm' || (isNode && name(argv[1]) === 'npm-cli.js');
|
|
845
853
|
return (
|
|
846
854
|
npm &&
|
|
847
855
|
argv.includes('install') &&
|
|
@@ -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/
|
|
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/
|
|
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';
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {string} a
|
|
18
18
|
* @param {string} b
|
|
19
|
+
* @param {number} [max] - The largest distance the caller can use. When
|
|
20
|
+
* given, a larger distance answers `max + 1`, and only the cells within
|
|
21
|
+
* `max` of the diagonal are computed.
|
|
19
22
|
* @returns {number}
|
|
20
23
|
*/
|
|
21
|
-
export function levenshteinDistance(a: string, b: string): number;
|
|
24
|
+
export function levenshteinDistance(a: string, b: string, max?: number): number;
|
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {string} a
|
|
18
18
|
* @param {string} b
|
|
19
|
+
* @param {number} [max] - The largest distance the caller can use. When
|
|
20
|
+
* given, a larger distance answers `max + 1`, and only the cells within
|
|
21
|
+
* `max` of the diagonal are computed.
|
|
19
22
|
* @returns {number}
|
|
20
23
|
*/
|
|
21
|
-
export function levenshteinDistance(a, b) {
|
|
24
|
+
export function levenshteinDistance(a, b, max) {
|
|
25
|
+
if (max !== undefined) return distanceWithin(a, b, max);
|
|
22
26
|
const m = a.length, n = b.length;
|
|
23
27
|
// Early exit: the distance is always ≥ |m − n|, so once the length gap
|
|
24
28
|
// exceeds the loosest fuzzy-match threshold any caller uses (the hook
|
|
@@ -39,3 +43,42 @@ export function levenshteinDistance(a, b) {
|
|
|
39
43
|
}
|
|
40
44
|
return dp[m][n];
|
|
41
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The edit distance between `a` and `b` when it is at most `max`, or
|
|
49
|
+
* `max + 1` when it is more. A path through a cell more than `max` from the
|
|
50
|
+
* diagonal costs more than `max`, so only that band is computed.
|
|
51
|
+
* @param {string} a
|
|
52
|
+
* @param {string} b
|
|
53
|
+
* @param {number} max
|
|
54
|
+
* @returns {number}
|
|
55
|
+
*/
|
|
56
|
+
function distanceWithin(a, b, max) {
|
|
57
|
+
const over = max + 1;
|
|
58
|
+
if (Math.abs(a.length - b.length) > max) return over;
|
|
59
|
+
let previous = new Array(b.length + 1).fill(over);
|
|
60
|
+
let current = new Array(b.length + 1).fill(over);
|
|
61
|
+
for (let j = 0; j <= Math.min(b.length, max); j++) previous[j] = j;
|
|
62
|
+
for (let i = 1; i <= a.length; i++) {
|
|
63
|
+
current.fill(over);
|
|
64
|
+
const from = Math.max(1, i - max);
|
|
65
|
+
const to = Math.min(b.length, i + max);
|
|
66
|
+
if (i <= max) current[0] = i;
|
|
67
|
+
let rowMin = current[0];
|
|
68
|
+
for (let j = from; j <= to; j++) {
|
|
69
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
70
|
+
const value = Math.min(
|
|
71
|
+
previous[j - 1] + cost,
|
|
72
|
+
previous[j] + 1,
|
|
73
|
+
current[j - 1] + 1,
|
|
74
|
+
over,
|
|
75
|
+
);
|
|
76
|
+
current[j] = value;
|
|
77
|
+
if (value < rowMin) rowMin = value;
|
|
78
|
+
}
|
|
79
|
+
// Every later cell costs at least this row's least.
|
|
80
|
+
if (rowMin >= over) return over;
|
|
81
|
+
[previous, current] = [current, previous];
|
|
82
|
+
}
|
|
83
|
+
return Math.min(previous[b.length], over);
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9-canary.0236bb8",
|
|
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": "
|
|
128
|
-
"@astryxdesign/core": "
|
|
129
|
-
"@astryxdesign/lab": "
|
|
130
|
-
"@astryxdesign/theme-neutral": "
|
|
127
|
+
"@astryxdesign/charts": "0.7.9-canary.0236bb8",
|
|
128
|
+
"@astryxdesign/core": "0.7.9-canary.0236bb8",
|
|
129
|
+
"@astryxdesign/lab": "0.7.9-canary.0236bb8",
|
|
130
|
+
"@astryxdesign/theme-neutral": "0.7.9-canary.0236bb8"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"@astryxdesign/charts": {
|
|
@@ -144,10 +144,10 @@
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
|
-
"@astryxdesign/charts": "
|
|
148
|
-
"@astryxdesign/core": "
|
|
149
|
-
"@astryxdesign/lab": "
|
|
150
|
-
"@astryxdesign/theme-neutral": "
|
|
147
|
+
"@astryxdesign/charts": "0.7.9-canary.0236bb8",
|
|
148
|
+
"@astryxdesign/core": "0.7.9-canary.0236bb8",
|
|
149
|
+
"@astryxdesign/lab": "0.7.9-canary.0236bb8",
|
|
150
|
+
"@astryxdesign/theme-neutral": "0.7.9-canary.0236bb8",
|
|
151
151
|
"@heroicons/react": "^2.2.0",
|
|
152
152
|
"@stylexjs/stylex": "^0.19.0",
|
|
153
153
|
"@types/babel__core": "^7.20.5",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Check if `gh` CLI is installed and authenticated.
|
|
6
|
-
* Returns true if ready, false otherwise.
|
|
7
|
-
*/
|
|
8
|
-
export function checkGhCli(): boolean;
|
package/api/swizzle/_github.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file GitHub utilities for Astryx CLI
|
|
5
|
-
*
|
|
6
|
-
* Shared helpers for interacting with the GitHub CLI (`gh`).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {execFileSync} from 'node:child_process';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Check if `gh` CLI is installed and authenticated.
|
|
13
|
-
* Returns true if ready, false otherwise.
|
|
14
|
-
*/
|
|
15
|
-
export function checkGhCli() {
|
|
16
|
-
try {
|
|
17
|
-
execFileSync('gh', ['auth', 'status'], {stdio: 'ignore'});
|
|
18
|
-
return true;
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|