@seasb/metafab 0.0.1 → 2.0.0-next.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.
- package/README.md +46 -1
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +419 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +31 -0
- package/dist/commands/build.js +156 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/check.d.ts +2 -0
- package/dist/commands/check.js +52 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/create.js +75 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/detach.d.ts +2 -0
- package/dist/commands/detach.js +24 -0
- package/dist/commands/detach.js.map +1 -0
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.js +35 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/env.d.ts +4 -0
- package/dist/commands/env.js +362 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/import.d.ts +2 -0
- package/dist/commands/import.js +107 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +77 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/map.d.ts +2 -0
- package/dist/commands/map.js +42 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/pipeline-add.d.ts +2 -0
- package/dist/commands/pipeline-add.js +68 -0
- package/dist/commands/pipeline-add.js.map +1 -0
- package/dist/commands/pipeline-remove.d.ts +2 -0
- package/dist/commands/pipeline-remove.js +45 -0
- package/dist/commands/pipeline-remove.js.map +1 -0
- package/dist/commands/publish.d.ts +2 -0
- package/dist/commands/publish.js +153 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/commands/types.d.ts +45 -0
- package/dist/commands/types.js +2 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +97 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/core/adopt.d.ts +53 -0
- package/dist/core/adopt.js +676 -0
- package/dist/core/adopt.js.map +1 -0
- package/dist/core/build/agents.d.ts +26 -0
- package/dist/core/build/agents.js +67 -0
- package/dist/core/build/agents.js.map +1 -0
- package/dist/core/build/index.d.ts +5 -0
- package/dist/core/build/index.js +6 -0
- package/dist/core/build/index.js.map +1 -0
- package/dist/core/build/markers.d.ts +34 -0
- package/dist/core/build/markers.js +97 -0
- package/dist/core/build/markers.js.map +1 -0
- package/dist/core/build/plan.d.ts +82 -0
- package/dist/core/build/plan.js +912 -0
- package/dist/core/build/plan.js.map +1 -0
- package/dist/core/build/preview.d.ts +39 -0
- package/dist/core/build/preview.js +344 -0
- package/dist/core/build/preview.js.map +1 -0
- package/dist/core/build/skill.d.ts +99 -0
- package/dist/core/build/skill.js +354 -0
- package/dist/core/build/skill.js.map +1 -0
- package/dist/core/check/drift.d.ts +13 -0
- package/dist/core/check/drift.js +205 -0
- package/dist/core/check/drift.js.map +1 -0
- package/dist/core/check/index.d.ts +16 -0
- package/dist/core/check/index.js +84 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/markers.d.ts +9 -0
- package/dist/core/check/markers.js +220 -0
- package/dist/core/check/markers.js.map +1 -0
- package/dist/core/config/destinations.d.ts +5 -0
- package/dist/core/config/destinations.js +20 -0
- package/dist/core/config/destinations.js.map +1 -0
- package/dist/core/config/load.d.ts +4 -0
- package/dist/core/config/load.js +41 -0
- package/dist/core/config/load.js.map +1 -0
- package/dist/core/config/parse.d.ts +8 -0
- package/dist/core/config/parse.js +201 -0
- package/dist/core/config/parse.js.map +1 -0
- package/dist/core/config/source.d.ts +25 -0
- package/dist/core/config/source.js +67 -0
- package/dist/core/config/source.js.map +1 -0
- package/dist/core/config/types.d.ts +48 -0
- package/dist/core/config/types.js +2 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/config/validate.d.ts +11 -0
- package/dist/core/config/validate.js +389 -0
- package/dist/core/config/validate.js.map +1 -0
- package/dist/core/config/writers.d.ts +14 -0
- package/dist/core/config/writers.js +269 -0
- package/dist/core/config/writers.js.map +1 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/config.js +8 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/discovery.d.ts +34 -0
- package/dist/core/discovery.js +272 -0
- package/dist/core/discovery.js.map +1 -0
- package/dist/core/edit/create.d.ts +18 -0
- package/dist/core/edit/create.js +190 -0
- package/dist/core/edit/create.js.map +1 -0
- package/dist/core/edit/document.d.ts +4 -0
- package/dist/core/edit/document.js +16 -0
- package/dist/core/edit/document.js.map +1 -0
- package/dist/core/edit/factory-yaml.d.ts +17 -0
- package/dist/core/edit/factory-yaml.js +213 -0
- package/dist/core/edit/factory-yaml.js.map +1 -0
- package/dist/core/edit/files.d.ts +6 -0
- package/dist/core/edit/files.js +47 -0
- package/dist/core/edit/files.js.map +1 -0
- package/dist/core/edit/index.d.ts +9 -0
- package/dist/core/edit/index.js +10 -0
- package/dist/core/edit/index.js.map +1 -0
- package/dist/core/edit/map.d.ts +24 -0
- package/dist/core/edit/map.js +82 -0
- package/dist/core/edit/map.js.map +1 -0
- package/dist/core/edit/names.d.ts +2 -0
- package/dist/core/edit/names.js +17 -0
- package/dist/core/edit/names.js.map +1 -0
- package/dist/core/edit/paths.d.ts +8 -0
- package/dist/core/edit/paths.js +81 -0
- package/dist/core/edit/paths.js.map +1 -0
- package/dist/core/edit/pipeline.d.ts +19 -0
- package/dist/core/edit/pipeline.js +152 -0
- package/dist/core/edit/pipeline.js.map +1 -0
- package/dist/core/edit/skill.d.ts +1 -0
- package/dist/core/edit/skill.js +10 -0
- package/dist/core/edit/skill.js.map +1 -0
- package/dist/core/env/condition.d.ts +40 -0
- package/dist/core/env/condition.js +283 -0
- package/dist/core/env/condition.js.map +1 -0
- package/dist/core/env/declarations.d.ts +16 -0
- package/dist/core/env/declarations.js +328 -0
- package/dist/core/env/declarations.js.map +1 -0
- package/dist/core/env/directives.d.ts +75 -0
- package/dist/core/env/directives.js +429 -0
- package/dist/core/env/directives.js.map +1 -0
- package/dist/core/env/git-config.d.ts +15 -0
- package/dist/core/env/git-config.js +110 -0
- package/dist/core/env/git-config.js.map +1 -0
- package/dist/core/env/imports.d.ts +60 -0
- package/dist/core/env/imports.js +217 -0
- package/dist/core/env/imports.js.map +1 -0
- package/dist/core/env/index.d.ts +6 -0
- package/dist/core/env/index.js +7 -0
- package/dist/core/env/index.js.map +1 -0
- package/dist/core/env/markdown.d.ts +22 -0
- package/dist/core/env/markdown.js +33 -0
- package/dist/core/env/markdown.js.map +1 -0
- package/dist/core/env/render.d.ts +13 -0
- package/dist/core/env/render.js +65 -0
- package/dist/core/env/render.js.map +1 -0
- package/dist/core/env/report.d.ts +29 -0
- package/dist/core/env/report.js +39 -0
- package/dist/core/env/report.js.map +1 -0
- package/dist/core/env/scenarios.d.ts +40 -0
- package/dist/core/env/scenarios.js +124 -0
- package/dist/core/env/scenarios.js.map +1 -0
- package/dist/core/env/select.d.ts +30 -0
- package/dist/core/env/select.js +191 -0
- package/dist/core/env/select.js.map +1 -0
- package/dist/core/env/types.d.ts +38 -0
- package/dist/core/env/types.js +2 -0
- package/dist/core/env/types.js.map +1 -0
- package/dist/core/env/validate.d.ts +25 -0
- package/dist/core/env/validate.js +212 -0
- package/dist/core/env/validate.js.map +1 -0
- package/dist/core/factory/discovery.d.ts +9 -0
- package/dist/core/factory/discovery.js +139 -0
- package/dist/core/factory/discovery.js.map +1 -0
- package/dist/core/factory/factory-yaml.d.ts +29 -0
- package/dist/core/factory/factory-yaml.js +538 -0
- package/dist/core/factory/factory-yaml.js.map +1 -0
- package/dist/core/factory/index.d.ts +5 -0
- package/dist/core/factory/index.js +6 -0
- package/dist/core/factory/index.js.map +1 -0
- package/dist/core/factory/lines.d.ts +8 -0
- package/dist/core/factory/lines.js +11 -0
- package/dist/core/factory/lines.js.map +1 -0
- package/dist/core/factory/load.d.ts +4 -0
- package/dist/core/factory/load.js +83 -0
- package/dist/core/factory/load.js.map +1 -0
- package/dist/core/factory/requires.d.ts +9 -0
- package/dist/core/factory/requires.js +123 -0
- package/dist/core/factory/requires.js.map +1 -0
- package/dist/core/factory/types.d.ts +58 -0
- package/dist/core/factory/types.js +2 -0
- package/dist/core/factory/types.js.map +1 -0
- package/dist/core/factory/validate.d.ts +44 -0
- package/dist/core/factory/validate.js +460 -0
- package/dist/core/factory/validate.js.map +1 -0
- package/dist/core/hooks/index.d.ts +8 -0
- package/dist/core/hooks/index.js +15 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/script.d.ts +21 -0
- package/dist/core/hooks/script.js +34 -0
- package/dist/core/hooks/script.js.map +1 -0
- package/dist/core/hooks/sync.d.ts +17 -0
- package/dist/core/hooks/sync.js +262 -0
- package/dist/core/hooks/sync.js.map +1 -0
- package/dist/core/import/conflicts.d.ts +82 -0
- package/dist/core/import/conflicts.js +256 -0
- package/dist/core/import/conflicts.js.map +1 -0
- package/dist/core/import/copy.d.ts +10 -0
- package/dist/core/import/copy.js +76 -0
- package/dist/core/import/copy.js.map +1 -0
- package/dist/core/import/file-tree.d.ts +43 -0
- package/dist/core/import/file-tree.js +107 -0
- package/dist/core/import/file-tree.js.map +1 -0
- package/dist/core/import/index.d.ts +5 -0
- package/dist/core/import/index.js +6 -0
- package/dist/core/import/index.js.map +1 -0
- package/dist/core/import/pipeline-changes.d.ts +8 -0
- package/dist/core/import/pipeline-changes.js +89 -0
- package/dist/core/import/pipeline-changes.js.map +1 -0
- package/dist/core/import/run.d.ts +76 -0
- package/dist/core/import/run.js +275 -0
- package/dist/core/import/run.js.map +1 -0
- package/dist/core/init/gitattributes.d.ts +20 -0
- package/dist/core/init/gitattributes.js +89 -0
- package/dist/core/init/gitattributes.js.map +1 -0
- package/dist/core/init/index.d.ts +4 -0
- package/dist/core/init/index.js +5 -0
- package/dist/core/init/index.js.map +1 -0
- package/dist/core/init/name.d.ts +1 -0
- package/dist/core/init/name.js +4 -0
- package/dist/core/init/name.js.map +1 -0
- package/dist/core/init/run.d.ts +51 -0
- package/dist/core/init/run.js +261 -0
- package/dist/core/init/run.js.map +1 -0
- package/dist/core/init/targets.d.ts +17 -0
- package/dist/core/init/targets.js +87 -0
- package/dist/core/init/targets.js.map +1 -0
- package/dist/core/merge.d.ts +88 -0
- package/dist/core/merge.js +239 -0
- package/dist/core/merge.js.map +1 -0
- package/dist/core/publish/exclude.d.ts +9 -0
- package/dist/core/publish/exclude.js +32 -0
- package/dist/core/publish/exclude.js.map +1 -0
- package/dist/core/publish/git-target.d.ts +32 -0
- package/dist/core/publish/git-target.js +460 -0
- package/dist/core/publish/git-target.js.map +1 -0
- package/dist/core/publish/index.d.ts +10 -0
- package/dist/core/publish/index.js +11 -0
- package/dist/core/publish/index.js.map +1 -0
- package/dist/core/publish/npm-target.d.ts +15 -0
- package/dist/core/publish/npm-target.js +177 -0
- package/dist/core/publish/npm-target.js.map +1 -0
- package/dist/core/publish/package-json.d.ts +31 -0
- package/dist/core/publish/package-json.js +74 -0
- package/dist/core/publish/package-json.js.map +1 -0
- package/dist/core/publish/prepare.d.ts +35 -0
- package/dist/core/publish/prepare.js +102 -0
- package/dist/core/publish/prepare.js.map +1 -0
- package/dist/core/publish/provenance.d.ts +1 -0
- package/dist/core/publish/provenance.js +20 -0
- package/dist/core/publish/provenance.js.map +1 -0
- package/dist/core/publish/publish.d.ts +13 -0
- package/dist/core/publish/publish.js +143 -0
- package/dist/core/publish/publish.js.map +1 -0
- package/dist/core/publish/readme.d.ts +22 -0
- package/dist/core/publish/readme.js +109 -0
- package/dist/core/publish/readme.js.map +1 -0
- package/dist/core/publish/stage.d.ts +19 -0
- package/dist/core/publish/stage.js +333 -0
- package/dist/core/publish/stage.js.map +1 -0
- package/dist/core/publish/types.d.ts +71 -0
- package/dist/core/publish/types.js +2 -0
- package/dist/core/publish/types.js.map +1 -0
- package/dist/core/requires/check.d.ts +15 -0
- package/dist/core/requires/check.js +83 -0
- package/dist/core/requires/check.js.map +1 -0
- package/dist/core/requires/index.d.ts +4 -0
- package/dist/core/requires/index.js +5 -0
- package/dist/core/requires/index.js.map +1 -0
- package/dist/core/requires/inspect.d.ts +44 -0
- package/dist/core/requires/inspect.js +114 -0
- package/dist/core/requires/inspect.js.map +1 -0
- package/dist/core/requires/paths.d.ts +29 -0
- package/dist/core/requires/paths.js +83 -0
- package/dist/core/requires/paths.js.map +1 -0
- package/dist/core/requires/setup.d.ts +37 -0
- package/dist/core/requires/setup.js +147 -0
- package/dist/core/requires/setup.js.map +1 -0
- package/dist/core/setup.d.ts +27 -0
- package/dist/core/setup.js +84 -0
- package/dist/core/setup.js.map +1 -0
- package/dist/core/sources/cache.d.ts +38 -0
- package/dist/core/sources/cache.js +264 -0
- package/dist/core/sources/cache.js.map +1 -0
- package/dist/core/sources/containment.d.ts +21 -0
- package/dist/core/sources/containment.js +50 -0
- package/dist/core/sources/containment.js.map +1 -0
- package/dist/core/sources/env.d.ts +12 -0
- package/dist/core/sources/env.js +28 -0
- package/dist/core/sources/env.js.map +1 -0
- package/dist/core/sources/extract.d.ts +25 -0
- package/dist/core/sources/extract.js +639 -0
- package/dist/core/sources/extract.js.map +1 -0
- package/dist/core/sources/git-process.d.ts +26 -0
- package/dist/core/sources/git-process.js +51 -0
- package/dist/core/sources/git-process.js.map +1 -0
- package/dist/core/sources/git.d.ts +41 -0
- package/dist/core/sources/git.js +525 -0
- package/dist/core/sources/git.js.map +1 -0
- package/dist/core/sources/https.d.ts +21 -0
- package/dist/core/sources/https.js +218 -0
- package/dist/core/sources/https.js.map +1 -0
- package/dist/core/sources/index.d.ts +13 -0
- package/dist/core/sources/index.js +14 -0
- package/dist/core/sources/index.js.map +1 -0
- package/dist/core/sources/npm-cli.d.ts +19 -0
- package/dist/core/sources/npm-cli.js +51 -0
- package/dist/core/sources/npm-cli.js.map +1 -0
- package/dist/core/sources/npm.d.ts +29 -0
- package/dist/core/sources/npm.js +411 -0
- package/dist/core/sources/npm.js.map +1 -0
- package/dist/core/sources/parse.d.ts +46 -0
- package/dist/core/sources/parse.js +446 -0
- package/dist/core/sources/parse.js.map +1 -0
- package/dist/core/sources/path.d.ts +10 -0
- package/dist/core/sources/path.js +331 -0
- package/dist/core/sources/path.js.map +1 -0
- package/dist/core/sources/problems.d.ts +29 -0
- package/dist/core/sources/problems.js +36 -0
- package/dist/core/sources/problems.js.map +1 -0
- package/dist/core/sources/redact.d.ts +2 -0
- package/dist/core/sources/redact.js +70 -0
- package/dist/core/sources/redact.js.map +1 -0
- package/dist/core/sources/resolve.d.ts +9 -0
- package/dist/core/sources/resolve.js +29 -0
- package/dist/core/sources/resolve.js.map +1 -0
- package/dist/core/sources/types.d.ts +86 -0
- package/dist/core/sources/types.js +2 -0
- package/dist/core/sources/types.js.map +1 -0
- package/dist/core/sources/validate.d.ts +9 -0
- package/dist/core/sources/validate.js +116 -0
- package/dist/core/sources/validate.js.map +1 -0
- package/dist/core/summary.d.ts +79 -0
- package/dist/core/summary.js +411 -0
- package/dist/core/summary.js.map +1 -0
- package/dist/core/update/clashes.d.ts +63 -0
- package/dist/core/update/clashes.js +192 -0
- package/dist/core/update/clashes.js.map +1 -0
- package/dist/core/update/detach.d.ts +21 -0
- package/dist/core/update/detach.js +38 -0
- package/dist/core/update/detach.js.map +1 -0
- package/dist/core/update/diff.d.ts +58 -0
- package/dist/core/update/diff.js +180 -0
- package/dist/core/update/diff.js.map +1 -0
- package/dist/core/update/fetch.d.ts +34 -0
- package/dist/core/update/fetch.js +73 -0
- package/dist/core/update/fetch.js.map +1 -0
- package/dist/core/update/index.d.ts +6 -0
- package/dist/core/update/index.js +7 -0
- package/dist/core/update/index.js.map +1 -0
- package/dist/core/update/restore.d.ts +20 -0
- package/dist/core/update/restore.js +195 -0
- package/dist/core/update/restore.js.map +1 -0
- package/dist/core/update/run.d.ts +113 -0
- package/dist/core/update/run.js +1135 -0
- package/dist/core/update/run.js.map +1 -0
- package/dist/core/update/select.d.ts +39 -0
- package/dist/core/update/select.js +157 -0
- package/dist/core/update/select.js.map +1 -0
- package/dist/core/update/spelling.d.ts +51 -0
- package/dist/core/update/spelling.js +185 -0
- package/dist/core/update/spelling.js.map +1 -0
- package/dist/core/update/trees.d.ts +24 -0
- package/dist/core/update/trees.js +72 -0
- package/dist/core/update/trees.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +51 -0
- package/dist/help.js +117 -0
- package/dist/help.js.map +1 -0
- package/dist/input.d.ts +25 -0
- package/dist/input.js +174 -0
- package/dist/input.js.map +1 -0
- package/dist/output.d.ts +21 -0
- package/dist/output.js +37 -0
- package/dist/output.js.map +1 -0
- package/dist/util/frontmatter.d.ts +12 -0
- package/dist/util/frontmatter.js +58 -0
- package/dist/util/frontmatter.js.map +1 -0
- package/dist/util/fs.d.ts +38 -0
- package/dist/util/fs.js +135 -0
- package/dist/util/fs.js.map +1 -0
- package/dist/util/git-names.d.ts +8 -0
- package/dist/util/git-names.js +25 -0
- package/dist/util/git-names.js.map +1 -0
- package/dist/util/git.d.ts +12 -0
- package/dist/util/git.js +33 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/suggest.d.ts +6 -0
- package/dist/util/suggest.js +48 -0
- package/dist/util/suggest.js.map +1 -0
- package/dist/util/text.d.ts +8 -0
- package/dist/util/text.js +19 -0
- package/dist/util/text.js.map +1 -0
- package/dist/util/version.d.ts +7 -0
- package/dist/util/version.js +13 -0
- package/dist/util/version.js.map +1 -0
- package/dist/util/yaml.d.ts +30 -0
- package/dist/util/yaml.js +201 -0
- package/dist/util/yaml.js.map +1 -0
- package/package.json +51 -3
- package/resources/metafab-skill/SKILL.md +173 -0
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
1
|
# @seasb/metafab
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Metafab records a software factory in a repository. `.factory/` holds the skills, workflows and templates that define how a team works, `metafab build` installs them for the agent tools in use, `metafab check` validates them, and `metafab publish` shares the factory as a fab that another repository can import and update. A fab is a Git repository by default, or an npm package such as `@acme/fab-basic`.
|
|
4
|
+
|
|
5
|
+
It requires Node.js 20 or later. Git is required only for Git-based fab sources.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
| Installation | Command | Use |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| None | `npx @seasb/metafab <command>` | Evaluation and non-Node.js repositories |
|
|
12
|
+
| Project dependency | `npm install --save-dev @seasb/metafab`, then `npx metafab <command>` | Projects that pin the CLI version |
|
|
13
|
+
| pnpm | `pnpm dlx @seasb/metafab <command>` | Projects that use pnpm |
|
|
14
|
+
| Bun | `bunx @seasb/metafab <command>` | Projects that use Bun |
|
|
15
|
+
|
|
16
|
+
Use the scoped package name with `npx`. The unscoped `metafab` package is unrelated.
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
In a repository, create a factory from a published fab:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx @seasb/metafab import github:Traction-Team/fab-basic --agents claude,codex --setup
|
|
24
|
+
git add .factory AGENTS.md .gitignore .gitattributes opencode.json orca.yaml docs/
|
|
25
|
+
git commit -m "Add the fab-basic factory"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`--setup` creates the repository files the fab's workflows need from its templates. If the repository already has a `CLAUDE.md`, stage that too.
|
|
29
|
+
|
|
30
|
+
Update the factory later:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx @seasb/metafab update
|
|
34
|
+
git diff
|
|
35
|
+
npx @seasb/metafab check
|
|
36
|
+
git commit -am "Update the fab-basic factory to 1.3.0"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`update` changes the working tree and prints a review summary. It does not create a commit.
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
|
|
43
|
+
- [Specifications](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/README.md): the acceptance standard for every change
|
|
44
|
+
- [CLI](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/cli.md): commands, JSON output and exit codes
|
|
45
|
+
- [Factory format](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/factory-format.md)
|
|
46
|
+
- [Building](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/building.md)
|
|
47
|
+
- [Sharing](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/sharing.md)
|
|
48
|
+
- [Configuration](https://github.com/Traction-Team/meta-harness/blob/main/docs/specs/configuration.md)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import type { CommandDefinition } from "./commands/types.js";
|
|
3
|
+
export declare const COMMANDS: readonly CommandDefinition[];
|
|
4
|
+
export interface CliIO {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
tty?: boolean;
|
|
7
|
+
stdin?: NodeJS.ReadableStream;
|
|
8
|
+
stdout?: (text: string) => void;
|
|
9
|
+
stderr?: (text: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function main(argv: readonly string[], io?: CliIO, commands?: readonly CommandDefinition[]): Promise<number>;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parseArgs } from "node:util";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { ExitCode, MetafabError } from "./errors.js";
|
|
7
|
+
import { GLOBAL_OPTIONS, commandHelp, globalHelp, groupHelp, renderCommandHelp, renderGroupHelp, } from "./help.js";
|
|
8
|
+
import { closeInput, NeedsInput } from "./input.js";
|
|
9
|
+
import { renderResult } from "./output.js";
|
|
10
|
+
import { normalizeProblemPath } from "./util/fs.js";
|
|
11
|
+
import { didYouMean } from "./util/suggest.js";
|
|
12
|
+
import { cliVersion } from "./util/version.js";
|
|
13
|
+
import { buildCommand } from "./commands/build.js";
|
|
14
|
+
import { checkCommand } from "./commands/check.js";
|
|
15
|
+
import { createCommand } from "./commands/create.js";
|
|
16
|
+
import { detachCommand } from "./commands/detach.js";
|
|
17
|
+
import { diffCommand } from "./commands/diff.js";
|
|
18
|
+
import { envCommand, envSetCommand, envUnsetCommand } from "./commands/env.js";
|
|
19
|
+
import { importCommand } from "./commands/import.js";
|
|
20
|
+
import { initCommand } from "./commands/init.js";
|
|
21
|
+
import { mapCommand } from "./commands/map.js";
|
|
22
|
+
import { pipelineAddCommand } from "./commands/pipeline-add.js";
|
|
23
|
+
import { pipelineRemoveCommand } from "./commands/pipeline-remove.js";
|
|
24
|
+
import { publishCommand } from "./commands/publish.js";
|
|
25
|
+
import { updateCommand } from "./commands/update.js";
|
|
26
|
+
export const COMMANDS = [
|
|
27
|
+
initCommand,
|
|
28
|
+
buildCommand,
|
|
29
|
+
createCommand,
|
|
30
|
+
pipelineAddCommand,
|
|
31
|
+
pipelineRemoveCommand,
|
|
32
|
+
mapCommand,
|
|
33
|
+
checkCommand,
|
|
34
|
+
envCommand,
|
|
35
|
+
envSetCommand,
|
|
36
|
+
envUnsetCommand,
|
|
37
|
+
importCommand,
|
|
38
|
+
updateCommand,
|
|
39
|
+
diffCommand,
|
|
40
|
+
detachCommand,
|
|
41
|
+
publishCommand,
|
|
42
|
+
];
|
|
43
|
+
const GLOBAL_FLAGS = new Set(["--json", "--json=true", "--help", "-h", "--version"]);
|
|
44
|
+
/** The global flags' names, for the `-<word>` hint before a command name. */
|
|
45
|
+
const GLOBAL_FLAG_NAMES = ["json", "help", "version"];
|
|
46
|
+
/** The fix line an unexpected error carries: it is a defect in Metafab, not in the repository. */
|
|
47
|
+
const BUG_FIX = "This is a bug in metafab. Report it with the command you ran and this message";
|
|
48
|
+
function splitGlobalFlags(argv) {
|
|
49
|
+
let json = false;
|
|
50
|
+
let help = false;
|
|
51
|
+
let version = false;
|
|
52
|
+
let index = 0;
|
|
53
|
+
while (index < argv.length && GLOBAL_FLAGS.has(argv[index])) {
|
|
54
|
+
const token = argv[index];
|
|
55
|
+
if (token === "--json" || token === "--json=true")
|
|
56
|
+
json = true;
|
|
57
|
+
else if (token === "--version")
|
|
58
|
+
version = true;
|
|
59
|
+
else
|
|
60
|
+
help = true;
|
|
61
|
+
index += 1;
|
|
62
|
+
}
|
|
63
|
+
return { json, help, version, rest: argv.slice(index) };
|
|
64
|
+
}
|
|
65
|
+
function hasJsonFlag(argv) {
|
|
66
|
+
return argv.some((token) => token === "--json" || token === "--json=true");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `--help`, `-h` or a repeated `-h` such as `-hh`, anywhere after the command
|
|
70
|
+
* name and before a `--`, asks for help: `h` is the only short option any
|
|
71
|
+
* command declares, so those are exactly the tokens `parseArgs` reads as
|
|
72
|
+
* `help: true` with no unknown letter. Any other word after one dash is a group
|
|
73
|
+
* of short options, so `-help` and `-jh` are unknown options, not help.
|
|
74
|
+
*/
|
|
75
|
+
function isHelpToken(token) {
|
|
76
|
+
return token === "--help" || /^-h+$/.test(token);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The option name a `-<word>` token spells, when `names` has it: `-help` gives
|
|
80
|
+
* `help`. Only a word longer than one letter counts, so `-h` and `--help` give
|
|
81
|
+
* nothing. `parseArgs` rejects such a token on its first letter (`Unknown option
|
|
82
|
+
* '-e'` for `-help`), so this names the token the person typed instead.
|
|
83
|
+
*/
|
|
84
|
+
function singleDashOption(token, names) {
|
|
85
|
+
if (!token.startsWith("-") || token.startsWith("--"))
|
|
86
|
+
return undefined;
|
|
87
|
+
const word = token.slice(1);
|
|
88
|
+
if (word.length < 2)
|
|
89
|
+
return undefined;
|
|
90
|
+
return names.includes(word) ? word : undefined;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The `-<word>` spelling of an option that `parseArgs` rejects first, or
|
|
94
|
+
* undefined when it rejects another token first. The tokens are walked the way
|
|
95
|
+
* `parseArgs` reads them: a known option, a known option's value and a
|
|
96
|
+
* positional argument all pass, and the first token that does not ends the walk.
|
|
97
|
+
* So `publish --bogus -dry-run` keeps its `--bogus` error, and only
|
|
98
|
+
* `publish -dry-run --bogus` gets the hint.
|
|
99
|
+
*/
|
|
100
|
+
function rejectedSingleDashOption(args, options) {
|
|
101
|
+
const names = Object.keys(options);
|
|
102
|
+
const shorts = new Map();
|
|
103
|
+
for (const option of Object.values(options)) {
|
|
104
|
+
if (option.short !== undefined)
|
|
105
|
+
shorts.set(option.short, option);
|
|
106
|
+
}
|
|
107
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
108
|
+
const token = args[index];
|
|
109
|
+
if (token === "--")
|
|
110
|
+
return undefined;
|
|
111
|
+
if (token.startsWith("--")) {
|
|
112
|
+
const name = token.slice(2).split("=")[0];
|
|
113
|
+
const option = options[name];
|
|
114
|
+
if (option === undefined)
|
|
115
|
+
return undefined;
|
|
116
|
+
if (option.type === "string" && !token.includes("=")) {
|
|
117
|
+
// A value that starts with a dash is ambiguous to `parseArgs`, which
|
|
118
|
+
// then rejects the option itself rather than the value.
|
|
119
|
+
const value = args[index + 1];
|
|
120
|
+
if (value === undefined || value.startsWith("-"))
|
|
121
|
+
return undefined;
|
|
122
|
+
index += 1;
|
|
123
|
+
}
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (token.startsWith("-") && token.length > 1) {
|
|
127
|
+
let known = true;
|
|
128
|
+
for (let at = 1; at < token.length; at += 1) {
|
|
129
|
+
const option = shorts.get(token[at]);
|
|
130
|
+
if (option === undefined) {
|
|
131
|
+
known = false;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
if (option.type === "string") {
|
|
135
|
+
// The rest of the cluster is the value, or else the next token is.
|
|
136
|
+
if (at === token.length - 1) {
|
|
137
|
+
const value = args[index + 1];
|
|
138
|
+
if (value === undefined || value.startsWith("-"))
|
|
139
|
+
return undefined;
|
|
140
|
+
index += 1;
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!known)
|
|
146
|
+
return singleDashOption(token, names);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* `--help`, `-h` or `-hh` after the command name, before a `--`, wins over every
|
|
153
|
+
* other flag and argument. The leading words name the command (`pipeline add`),
|
|
154
|
+
* the `pipeline` group, or nothing (the global help, also for an unknown name).
|
|
155
|
+
*/
|
|
156
|
+
function helpTarget(tokens, commands, globalHelpFlag) {
|
|
157
|
+
const end = tokens.indexOf("--");
|
|
158
|
+
const beforeDash = end === -1 ? tokens : tokens.slice(0, end);
|
|
159
|
+
const wantsHelp = globalHelpFlag || beforeDash.some(isHelpToken);
|
|
160
|
+
if (!wantsHelp)
|
|
161
|
+
return undefined;
|
|
162
|
+
const names = [];
|
|
163
|
+
for (const token of tokens) {
|
|
164
|
+
if (token.startsWith("-"))
|
|
165
|
+
break;
|
|
166
|
+
names.push(token);
|
|
167
|
+
}
|
|
168
|
+
if (names.length >= 2) {
|
|
169
|
+
const definition = findCommand(commands, `${names[0]} ${names[1]}`);
|
|
170
|
+
if (definition !== undefined)
|
|
171
|
+
return { kind: "command", definition };
|
|
172
|
+
}
|
|
173
|
+
if (names.length >= 1) {
|
|
174
|
+
const name = names[0];
|
|
175
|
+
const definition = findCommand(commands, name);
|
|
176
|
+
if (definition !== undefined)
|
|
177
|
+
return { kind: "command", definition };
|
|
178
|
+
if (name === "pipeline")
|
|
179
|
+
return { kind: "group", group: name };
|
|
180
|
+
}
|
|
181
|
+
return { kind: "global" };
|
|
182
|
+
}
|
|
183
|
+
/** The help result: rendered as `summary` for a person, as data with `--json`. */
|
|
184
|
+
function renderHelp(target, commands, json) {
|
|
185
|
+
const result = { ok: true, command: "help", exitCode: ExitCode.Ok, problems: [] };
|
|
186
|
+
if (target.kind === "command") {
|
|
187
|
+
const help = commandHelp(target.definition, commands);
|
|
188
|
+
result.help = help;
|
|
189
|
+
if (!json)
|
|
190
|
+
result.summary = renderCommandHelp(help);
|
|
191
|
+
}
|
|
192
|
+
else if (target.kind === "group") {
|
|
193
|
+
const help = groupHelp(target.group, commands);
|
|
194
|
+
result.help = help;
|
|
195
|
+
if (!json)
|
|
196
|
+
result.summary = renderGroupHelp(help);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
const help = globalHelp(commands);
|
|
200
|
+
result.commands = help.commands;
|
|
201
|
+
if (!json)
|
|
202
|
+
result.summary = help.text;
|
|
203
|
+
}
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
function emit(result, json, stdout, stderr) {
|
|
207
|
+
const rendered = renderResult(result, { json });
|
|
208
|
+
stdout(rendered.stdout);
|
|
209
|
+
if (rendered.stderr !== "")
|
|
210
|
+
stderr(rendered.stderr);
|
|
211
|
+
return result.exitCode;
|
|
212
|
+
}
|
|
213
|
+
function failure(command, message, fix, details) {
|
|
214
|
+
const result = {
|
|
215
|
+
ok: false,
|
|
216
|
+
command,
|
|
217
|
+
exitCode: ExitCode.Failed,
|
|
218
|
+
summary: message,
|
|
219
|
+
problems: [{ level: "error", file: normalizeProblemPath("metafab"), message, fix }],
|
|
220
|
+
};
|
|
221
|
+
if (details !== undefined)
|
|
222
|
+
result.details = details;
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
function fromMetafabError(command, error) {
|
|
226
|
+
const result = {
|
|
227
|
+
ok: false,
|
|
228
|
+
command,
|
|
229
|
+
exitCode: error.exitCode,
|
|
230
|
+
code: error.code,
|
|
231
|
+
summary: error.message,
|
|
232
|
+
problems: error.problems ?? [],
|
|
233
|
+
};
|
|
234
|
+
if (error.details !== undefined)
|
|
235
|
+
result.details = error.details;
|
|
236
|
+
return result;
|
|
237
|
+
}
|
|
238
|
+
function renderNeedsInput(error, command, json, stdout, stderr) {
|
|
239
|
+
if (json) {
|
|
240
|
+
stdout(`${JSON.stringify({ ok: false, command, exitCode: error.exitCode, required: error.required }, null, 2)}\n`);
|
|
241
|
+
return error.exitCode;
|
|
242
|
+
}
|
|
243
|
+
stdout(`${command}: needs input\n`);
|
|
244
|
+
const lines = ["Required values:"];
|
|
245
|
+
for (const value of error.required) {
|
|
246
|
+
const flag = value.flag === undefined ? "" : ` (${value.flag})`;
|
|
247
|
+
const choices = value.choices === undefined ? "" : ` [${value.choices.join(", ")}]`;
|
|
248
|
+
lines.push(` ${value.name}${flag}${choices}: ${value.description}`);
|
|
249
|
+
}
|
|
250
|
+
stderr(`${lines.join("\n")}\n`);
|
|
251
|
+
return error.exitCode;
|
|
252
|
+
}
|
|
253
|
+
function renderBug(error, command, json, stdout, stderr) {
|
|
254
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
255
|
+
if (json) {
|
|
256
|
+
// A stack helps a person reporting a bug, but is noise in a machine-read
|
|
257
|
+
// result, so the JSON branch writes the bug as a problem instead.
|
|
258
|
+
stdout(`${JSON.stringify({
|
|
259
|
+
ok: false,
|
|
260
|
+
command,
|
|
261
|
+
exitCode: ExitCode.Failed,
|
|
262
|
+
error: message,
|
|
263
|
+
problems: [{ level: "error", file: "metafab", message, fix: BUG_FIX }],
|
|
264
|
+
}, null, 2)}\n`);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const text = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
268
|
+
stderr(`${text}\n fix: ${BUG_FIX}\n`);
|
|
269
|
+
}
|
|
270
|
+
return ExitCode.Failed;
|
|
271
|
+
}
|
|
272
|
+
function findCommand(commands, name) {
|
|
273
|
+
return commands.find((command) => command.name === name);
|
|
274
|
+
}
|
|
275
|
+
function parseCommandArgs(args, options) {
|
|
276
|
+
try {
|
|
277
|
+
return parseArgs({ args, options, allowPositionals: true, strict: true });
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
if (!(error instanceof Error) || !error.message.includes("argument is ambiguous"))
|
|
281
|
+
throw error;
|
|
282
|
+
const relaxed = parseArgs({ args, options, allowPositionals: true, strict: false });
|
|
283
|
+
for (const key of Object.keys(relaxed.values)) {
|
|
284
|
+
if (!(key in options))
|
|
285
|
+
throw new Error(`Unknown option: --${key}`);
|
|
286
|
+
}
|
|
287
|
+
return relaxed;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export async function main(argv, io = {}, commands = COMMANDS) {
|
|
291
|
+
const stdout = io.stdout ?? ((text) => process.stdout.write(text));
|
|
292
|
+
const stderr = io.stderr ?? ((text) => process.stderr.write(text));
|
|
293
|
+
const global = splitGlobalFlags(argv);
|
|
294
|
+
let json = global.json;
|
|
295
|
+
const helpJson = json || hasJsonFlag(argv);
|
|
296
|
+
const failureJson = helpJson;
|
|
297
|
+
let commandName = "metafab";
|
|
298
|
+
try {
|
|
299
|
+
// Help is decided before the pipeline branch and before the command's options are
|
|
300
|
+
// parsed, so `import --bogus --help` and `pipeline add -h` still print help.
|
|
301
|
+
const tokens = global.rest;
|
|
302
|
+
const target = helpTarget(tokens, commands, global.help);
|
|
303
|
+
if (target !== undefined) {
|
|
304
|
+
return emit(renderHelp(target, commands, helpJson), helpJson, stdout, stderr);
|
|
305
|
+
}
|
|
306
|
+
if (global.version) {
|
|
307
|
+
const version = cliVersion();
|
|
308
|
+
return emit({
|
|
309
|
+
ok: true,
|
|
310
|
+
command: "version",
|
|
311
|
+
exitCode: ExitCode.Ok,
|
|
312
|
+
problems: [],
|
|
313
|
+
summary: version,
|
|
314
|
+
version,
|
|
315
|
+
}, json, stdout, stderr);
|
|
316
|
+
}
|
|
317
|
+
if (tokens.length === 0) {
|
|
318
|
+
return emit(renderHelp({ kind: "global" }, commands, helpJson), helpJson, stdout, stderr);
|
|
319
|
+
}
|
|
320
|
+
const first = tokens[0];
|
|
321
|
+
let requested = first;
|
|
322
|
+
let consumed = 1;
|
|
323
|
+
let candidates = commands.map((command) => command.name);
|
|
324
|
+
if (first === "pipeline") {
|
|
325
|
+
const second = tokens[1];
|
|
326
|
+
if (second === undefined || second === "--json" || second === "--json=true") {
|
|
327
|
+
return emit(failure("pipeline", "The pipeline command requires a subcommand.", 'Use "metafab pipeline add" or "metafab pipeline remove".'), failureJson, stdout, stderr);
|
|
328
|
+
}
|
|
329
|
+
requested = `pipeline ${second}`;
|
|
330
|
+
consumed = 2;
|
|
331
|
+
candidates = commands
|
|
332
|
+
.filter((command) => command.name.startsWith("pipeline "))
|
|
333
|
+
.map((command) => command.name);
|
|
334
|
+
}
|
|
335
|
+
else if (first === "env") {
|
|
336
|
+
// Unlike `pipeline`, `env` alone is a command: only `set` and `unset`
|
|
337
|
+
// name a subcommand, and any other word is an argument `env` refuses.
|
|
338
|
+
const second = tokens[1];
|
|
339
|
+
if (second === "set" || second === "unset") {
|
|
340
|
+
requested = `env ${second}`;
|
|
341
|
+
consumed = 2;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const definition = findCommand(commands, requested);
|
|
345
|
+
if (definition === undefined) {
|
|
346
|
+
const suggestion = didYouMean(requested, candidates);
|
|
347
|
+
const globalWord = singleDashOption(first, GLOBAL_FLAG_NAMES);
|
|
348
|
+
return emit(failure("metafab", `Unknown command: ${requested}`, globalWord === undefined
|
|
349
|
+
? suggestion ?? "Run metafab --help to see the available commands."
|
|
350
|
+
: `Did you mean --${globalWord}?`, { command: requested, suggestion }), failureJson, stdout, stderr);
|
|
351
|
+
}
|
|
352
|
+
commandName = definition.name;
|
|
353
|
+
const options = {
|
|
354
|
+
...definition.options,
|
|
355
|
+
...GLOBAL_OPTIONS,
|
|
356
|
+
};
|
|
357
|
+
let parsed;
|
|
358
|
+
try {
|
|
359
|
+
parsed = parseCommandArgs(tokens.slice(consumed), options);
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
363
|
+
const word = rejectedSingleDashOption(tokens.slice(consumed), options);
|
|
364
|
+
const helpHint = `Run metafab ${definition.name} --help to see its options`;
|
|
365
|
+
return emit(failure(definition.name, word === undefined ? message : `Unknown option '-${word}'`, word === undefined ? helpHint : `Did you mean --${word}? ${helpHint}`), failureJson, stdout, stderr);
|
|
366
|
+
}
|
|
367
|
+
if (parsed.values.json === true)
|
|
368
|
+
json = true;
|
|
369
|
+
// A global `--json` before the command reaches the command the same way.
|
|
370
|
+
if (json && parsed.values.json !== true)
|
|
371
|
+
parsed.values.json = true;
|
|
372
|
+
// A safety net that today's options cannot reach: `h` is the only short
|
|
373
|
+
// option any command declares, so every token `parseArgs` reads as `help`
|
|
374
|
+
// is one `isHelpToken` caught above. It stays for a command that adds a
|
|
375
|
+
// short boolean option, such as `short: "f"`: `-fh` would then pass
|
|
376
|
+
// `parseArgs` with `help: true` and still must print help, not run.
|
|
377
|
+
if (parsed.values.help === true) {
|
|
378
|
+
return emit(renderHelp({ kind: "command", definition }, commands, helpJson), helpJson, stdout, stderr);
|
|
379
|
+
}
|
|
380
|
+
const result = await definition.run({
|
|
381
|
+
cwd: io.cwd ?? process.cwd(),
|
|
382
|
+
positionals: parsed.positionals,
|
|
383
|
+
options: parsed.values,
|
|
384
|
+
io: {
|
|
385
|
+
tty: io.tty ?? process.stdin.isTTY === true,
|
|
386
|
+
stdin: io.stdin,
|
|
387
|
+
stderr,
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
return emit(result, json, stdout, stderr);
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
if (error instanceof NeedsInput) {
|
|
394
|
+
return renderNeedsInput(error, commandName, json, stdout, stderr);
|
|
395
|
+
}
|
|
396
|
+
if (error instanceof MetafabError) {
|
|
397
|
+
return emit(fromMetafabError(commandName, error), json, stdout, stderr);
|
|
398
|
+
}
|
|
399
|
+
return renderBug(error, commandName, json, stdout, stderr);
|
|
400
|
+
}
|
|
401
|
+
finally {
|
|
402
|
+
// An open reader on process.stdin would keep the process alive.
|
|
403
|
+
closeInput();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function isEntryPoint(entry) {
|
|
407
|
+
if (entry === undefined)
|
|
408
|
+
return false;
|
|
409
|
+
try {
|
|
410
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(path.resolve(entry));
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (isEntryPoint(process.argv[1])) {
|
|
417
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
418
|
+
}
|
|
419
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,E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env/index.js";
|
|
3
|
+
import type { HookChange } from "../core/hooks/index.js";
|
|
4
|
+
import type { CommandResult } from "../output.js";
|
|
5
|
+
import type { CommandDefinition } from "./types.js";
|
|
6
|
+
export declare function changesSummary(changed?: readonly BuildChange[], hooks?: readonly HookChange[]): string;
|
|
7
|
+
export interface BuildResult extends CommandResult {
|
|
8
|
+
/** Present for a build; a preview changes nothing in the repository. */
|
|
9
|
+
changed?: BuildChange[];
|
|
10
|
+
hooks?: HookChange[];
|
|
11
|
+
/** The directory a preview wrote into, absolute and with `/` separators. */
|
|
12
|
+
out?: string;
|
|
13
|
+
/** The files a preview wrote, relative to `out`. */
|
|
14
|
+
written?: string[];
|
|
15
|
+
/** The `variables` list `env` reports, when the factory declares variables. */
|
|
16
|
+
env?: EnvVariableReport[];
|
|
17
|
+
}
|
|
18
|
+
export interface RunBuildOptions {
|
|
19
|
+
/** Raw `--env` arguments; absent reads the process environment and Git config. */
|
|
20
|
+
env?: readonly string[];
|
|
21
|
+
/** Write a preview into this directory instead of building the repository. */
|
|
22
|
+
out?: string;
|
|
23
|
+
/** True when the caller renders JSON, so the result needs no summary. */
|
|
24
|
+
json?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The whole of `metafab build`, so `env set` and `env unset` rebuild with it.
|
|
28
|
+
* Load errors stop it before `--env` is read; a bad `--env` then throws.
|
|
29
|
+
*/
|
|
30
|
+
export declare function runBuild(cwd: string, options?: RunBuildOptions): Promise<BuildResult>;
|
|
31
|
+
export declare const buildCommand: CommandDefinition;
|