@topogram/cli 0.3.63 → 0.3.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/adoption/plan/index.js +703 -0
- package/src/adoption/plan.d.ts +6 -0
- package/src/adoption/plan.js +12 -703
- package/src/adoption/reporting.d.ts +10 -0
- package/src/adoption/review-groups.d.ts +6 -0
- package/src/agent-brief.d.ts +3 -0
- package/src/agent-brief.js +495 -0
- package/src/agent-ops/query-builders/auth.js +375 -0
- package/src/agent-ops/query-builders/change-risk/change-plan.js +123 -0
- package/src/agent-ops/query-builders/change-risk/import-plan.js +49 -0
- package/src/agent-ops/query-builders/change-risk/maintained.js +286 -0
- package/src/agent-ops/query-builders/change-risk/review-packets.js +123 -0
- package/src/agent-ops/query-builders/change-risk/risk.js +189 -0
- package/src/agent-ops/query-builders/change-risk.js +25 -0
- package/src/agent-ops/query-builders/common.js +149 -0
- package/src/agent-ops/query-builders/maintained-risk.js +539 -0
- package/src/agent-ops/query-builders/maintained-shared.js +120 -0
- package/src/agent-ops/query-builders/multi-agent.js +547 -0
- package/src/agent-ops/query-builders/projection-impacts.js +514 -0
- package/src/agent-ops/query-builders/work-packets.js +417 -0
- package/src/agent-ops/query-builders/workflow-context-shared.js +300 -0
- package/src/agent-ops/query-builders/workflow-context.js +398 -0
- package/src/agent-ops/query-builders/workflow-presets-core.js +676 -0
- package/src/agent-ops/query-builders/workflow-presets.js +341 -0
- package/src/agent-ops/query-builders.d.ts +26 -0
- package/src/agent-ops/query-builders.js +42 -5021
- package/src/archive/archive.d.ts +2 -0
- package/src/archive/compact.d.ts +1 -0
- package/src/archive/unarchive.d.ts +1 -0
- package/src/catalog/constants.js +10 -0
- package/src/catalog/copy.js +60 -0
- package/src/catalog/diagnostics.js +15 -0
- package/src/catalog/entries.js +42 -0
- package/src/catalog/files.js +67 -0
- package/src/catalog/provenance.js +122 -0
- package/src/catalog/source.js +150 -0
- package/src/catalog/validation.js +252 -0
- package/src/catalog.d.ts +12 -0
- package/src/catalog.js +18 -750
- package/src/cli/catalog-alias.d.ts +1 -0
- package/src/cli/command-parser.js +38 -0
- package/src/cli/command-parsers/core.js +102 -0
- package/src/cli/command-parsers/generator.js +39 -0
- package/src/cli/command-parsers/import.js +44 -0
- package/src/cli/command-parsers/legacy-workflow.js +21 -0
- package/src/cli/command-parsers/project.js +47 -0
- package/src/cli/command-parsers/sdlc.js +47 -0
- package/src/cli/command-parsers/shared.js +51 -0
- package/src/cli/command-parsers/template.js +48 -0
- package/src/cli/commands/agent.js +47 -0
- package/src/cli/commands/catalog/check.js +31 -0
- package/src/cli/commands/catalog/copy.js +59 -0
- package/src/cli/commands/catalog/doctor.js +248 -0
- package/src/cli/commands/catalog/help.js +21 -0
- package/src/cli/commands/catalog/list.js +52 -0
- package/src/cli/commands/catalog/runner.js +92 -0
- package/src/cli/commands/catalog/shared.js +17 -0
- package/src/cli/commands/catalog/show.js +134 -0
- package/src/cli/commands/catalog.js +32 -0
- package/src/cli/commands/check.js +268 -0
- package/src/cli/commands/doctor.js +268 -0
- package/src/cli/commands/emit.js +149 -0
- package/src/cli/commands/generate.js +96 -0
- package/src/cli/commands/generator-policy/package-info.js +162 -0
- package/src/cli/commands/generator-policy/payloads.js +372 -0
- package/src/cli/commands/generator-policy/printers.js +159 -0
- package/src/cli/commands/generator-policy/runner.js +81 -0
- package/src/cli/commands/generator-policy/shared.js +39 -0
- package/src/cli/commands/generator-policy.js +17 -0
- package/src/cli/commands/generator.js +443 -0
- package/src/cli/commands/import/adopt.js +170 -0
- package/src/cli/commands/import/check.js +91 -0
- package/src/cli/commands/import/diff.js +84 -0
- package/src/cli/commands/import/help.js +47 -0
- package/src/cli/commands/import/paths.js +277 -0
- package/src/cli/commands/import/plan.js +284 -0
- package/src/cli/commands/import/refresh.js +470 -0
- package/src/cli/commands/import/status-history.js +196 -0
- package/src/cli/commands/import/workspace.js +230 -0
- package/src/cli/commands/import-runner.js +157 -0
- package/src/cli/commands/import.js +35 -0
- package/src/cli/commands/inspect.js +55 -0
- package/src/cli/commands/new.js +94 -0
- package/src/cli/commands/package/constants.js +17 -0
- package/src/cli/commands/package/doctor.js +240 -0
- package/src/cli/commands/package/help.js +27 -0
- package/src/cli/commands/package/lockfile.js +135 -0
- package/src/cli/commands/package/npm.js +97 -0
- package/src/cli/commands/package/reporting.js +35 -0
- package/src/cli/commands/package/runner.js +33 -0
- package/src/cli/commands/package/shared.js +9 -0
- package/src/cli/commands/package/update-cli.js +252 -0
- package/src/cli/commands/package/versions.js +35 -0
- package/src/cli/commands/package.js +31 -0
- package/src/cli/commands/query/change-plan.js +68 -0
- package/src/cli/commands/query/definitions.js +202 -0
- package/src/cli/commands/query/import-adopt.js +121 -0
- package/src/cli/commands/query/runner/artifacts.js +102 -0
- package/src/cli/commands/query/runner/boundaries.js +211 -0
- package/src/cli/commands/query/runner/change.js +182 -0
- package/src/cli/commands/query/runner/import-adopt.js +111 -0
- package/src/cli/commands/query/runner/index.js +31 -0
- package/src/cli/commands/query/runner/output.js +12 -0
- package/src/cli/commands/query/runner/workflow.js +241 -0
- package/src/cli/commands/query/runner.js +3 -0
- package/src/cli/commands/query/workflow-context.js +5 -0
- package/src/cli/commands/query/workspace.js +274 -0
- package/src/cli/commands/query.js +11 -0
- package/src/cli/commands/release-rollout.js +257 -0
- package/src/cli/commands/release-shared.js +528 -0
- package/src/cli/commands/release-status.js +429 -0
- package/src/cli/commands/release.js +107 -0
- package/src/cli/commands/sdlc.js +168 -0
- package/src/cli/commands/setup.js +76 -0
- package/src/cli/commands/source.js +291 -0
- package/src/cli/commands/template/baseline.js +100 -0
- package/src/cli/commands/template/check.js +466 -0
- package/src/cli/commands/template/constants.js +8 -0
- package/src/cli/commands/template/diagnostics.js +26 -0
- package/src/cli/commands/template/help.js +28 -0
- package/src/cli/commands/template/lifecycle.js +404 -0
- package/src/cli/commands/template/list-show.js +287 -0
- package/src/cli/commands/template/policy.js +422 -0
- package/src/cli/commands/template/shared.js +127 -0
- package/src/cli/commands/template/updates.js +352 -0
- package/src/cli/commands/template-runner.js +198 -0
- package/src/cli/commands/template.js +43 -0
- package/src/cli/commands/trust.js +219 -0
- package/src/cli/commands/version.js +40 -0
- package/src/cli/commands/widget.js +168 -0
- package/src/cli/commands/workflow.js +63 -0
- package/src/cli/dispatcher.js +392 -0
- package/src/cli/help-dispatch.js +188 -0
- package/src/cli/help.js +296 -0
- package/src/cli/migration-guidance.js +59 -0
- package/src/cli/options.js +96 -0
- package/src/cli/output-safety.js +107 -0
- package/src/cli/path-normalization.js +29 -0
- package/src/cli.js +47 -11711
- package/src/example-implementation.d.ts +2 -0
- package/src/format.d.ts +1 -0
- package/src/generator/api/contracts.js +497 -0
- package/src/generator/api/metadata.js +221 -0
- package/src/generator/api/openapi.js +559 -0
- package/src/generator/api/schema.js +124 -0
- package/src/generator/api/types.d.ts +98 -0
- package/src/generator/api.js +3 -1195
- package/src/generator/check.d.ts +1 -0
- package/src/generator/context/bundle.d.ts +1 -0
- package/src/generator/context/shared/domain-sdlc.js +282 -0
- package/src/generator/context/shared/maintained-boundary.js +665 -0
- package/src/generator/context/shared/metrics.js +85 -0
- package/src/generator/context/shared/primitives.js +64 -0
- package/src/generator/context/shared/relationships.js +453 -0
- package/src/generator/context/shared/summaries.js +263 -0
- package/src/generator/context/shared/types.d.ts +207 -0
- package/src/generator/context/shared.d.ts +44 -0
- package/src/generator/context/shared.js +80 -1390
- package/src/generator/context/slice/core.js +397 -0
- package/src/generator/context/slice/sdlc.js +417 -0
- package/src/generator/context/slice/ui-packets.js +183 -0
- package/src/generator/context/slice.js +2 -859
- package/src/generator/native/parity-bundle.js +2 -1
- package/src/generator/registry/index.js +507 -0
- package/src/generator/registry.js +18 -504
- package/src/generator/runtime/environment/index.js +666 -0
- package/src/generator/runtime/environment.js +4 -666
- package/src/generator/runtime/runtime-check/index.js +554 -0
- package/src/generator/runtime/runtime-check.js +4 -554
- package/src/generator/runtime/shared/index.js +572 -0
- package/src/generator/runtime/shared.js +19 -570
- package/src/generator/shared.d.ts +2 -0
- package/src/generator/surfaces/shared.d.ts +3 -0
- package/src/generator/surfaces/web/html-escape.js +22 -0
- package/src/generator/surfaces/web/react.js +10 -8
- package/src/generator/surfaces/web/sveltekit.js +7 -5
- package/src/generator/surfaces/web/vanilla.js +8 -4
- package/src/generator/widget-conformance/behavior-report.js +258 -0
- package/src/generator/widget-conformance/checks.js +371 -0
- package/src/generator/widget-conformance/projection-context.js +200 -0
- package/src/generator/widget-conformance/report.js +166 -0
- package/src/generator/widget-conformance/types.d.ts +121 -0
- package/src/generator/widget-conformance.js +3 -824
- package/src/generator.d.ts +2 -0
- package/src/github-client.js +520 -0
- package/src/import/core/context.d.ts +3 -0
- package/src/import/core/contracts.d.ts +1 -0
- package/src/import/core/registry.d.ts +4 -0
- package/src/import/core/runner/candidates.js +217 -0
- package/src/import/core/runner/options.js +22 -0
- package/src/import/core/runner/reports.js +50 -0
- package/src/import/core/runner/run.js +79 -0
- package/src/import/core/runner/tracks.js +150 -0
- package/src/import/core/runner/ui-drafts.js +337 -0
- package/src/import/core/runner.js +3 -698
- package/src/import/core/shared/api-routes.js +221 -0
- package/src/import/core/shared/candidates.js +97 -0
- package/src/import/core/shared/files.js +177 -0
- package/src/import/core/shared/next-app.js +389 -0
- package/src/import/core/shared/types.d.ts +51 -0
- package/src/import/core/shared/ui-routes.js +230 -0
- package/src/import/core/shared.js +67 -910
- package/src/import/extractors/api/flutter-dio.js +4 -8
- package/src/import/extractors/api/react-native-repository.js +4 -8
- package/src/import/index.d.ts +4 -0
- package/src/import/provenance.d.ts +4 -0
- package/src/new-project/constants.js +128 -0
- package/src/new-project/create.js +83 -0
- package/src/new-project/json.js +28 -0
- package/src/new-project/metadata.js +96 -0
- package/src/new-project/package-spec.js +161 -0
- package/src/new-project/project-files.js +348 -0
- package/src/new-project/template-policy.js +269 -0
- package/src/new-project/template-resolution.js +368 -0
- package/src/new-project/template-snapshots.js +430 -0
- package/src/new-project/template-updates.js +512 -0
- package/src/new-project/types.d.ts +83 -0
- package/src/new-project.js +6 -2188
- package/src/npm-safety.js +79 -0
- package/src/parser.d.ts +87 -0
- package/src/parser.js +118 -0
- package/src/path-helpers.d.ts +1 -0
- package/src/path-helpers.js +20 -0
- package/src/policy/review-boundaries.d.ts +15 -0
- package/src/project-config/index.js +564 -0
- package/src/project-config.js +19 -560
- package/src/reconcile/docs.d.ts +8 -0
- package/src/reconcile/journeys.d.ts +1 -0
- package/src/resolver/enrich/acceptance-criterion.js +2 -0
- package/src/resolver/enrich/bug.js +2 -0
- package/src/resolver/enrich/pitch.js +2 -0
- package/src/resolver/enrich/requirement.js +2 -0
- package/src/resolver/enrich/task.js +2 -0
- package/src/resolver/index.js +19 -2089
- package/src/resolver/normalize.js +384 -1
- package/src/resolver/plans.js +168 -0
- package/src/resolver/projections-api.js +494 -0
- package/src/resolver/projections-db.js +133 -0
- package/src/resolver/projections-ui.js +317 -0
- package/src/resolver/shapes.js +251 -0
- package/src/resolver/shared.js +278 -0
- package/src/resolver/widgets.js +132 -0
- package/src/resolver.d.ts +1 -0
- package/src/runtime-support.js +29 -0
- package/src/sdlc/adopt.d.ts +1 -0
- package/src/sdlc/check.d.ts +1 -0
- package/src/sdlc/explain.d.ts +1 -0
- package/src/sdlc/release.d.ts +1 -0
- package/src/sdlc/scaffold.d.ts +1 -0
- package/src/sdlc/transition.d.ts +1 -0
- package/src/template-trust/constants.js +62 -0
- package/src/template-trust/content.js +258 -0
- package/src/template-trust/diff.js +92 -0
- package/src/template-trust/policy.js +61 -0
- package/src/template-trust/record.js +90 -0
- package/src/template-trust/status.js +182 -0
- package/src/template-trust.js +24 -687
- package/src/text-helpers.d.ts +7 -0
- package/src/text-helpers.js +245 -0
- package/src/topogram-config.js +306 -0
- package/src/topogram-types.d.ts +69 -0
- package/src/validator/common.js +488 -0
- package/src/validator/data-model.js +237 -0
- package/src/validator/docs.js +167 -0
- package/src/validator/expressions.js +146 -1
- package/src/validator/index.d.ts +23 -0
- package/src/validator/index.js +32 -3585
- package/src/validator/kinds.d.ts +41 -0
- package/src/validator/kinds.js +2 -0
- package/src/validator/model-helpers.js +46 -0
- package/src/validator/per-kind/acceptance-criterion.js +5 -0
- package/src/validator/per-kind/bug.js +6 -0
- package/src/validator/per-kind/domain.js +15 -2
- package/src/validator/per-kind/pitch.js +7 -0
- package/src/validator/per-kind/requirement.js +5 -0
- package/src/validator/per-kind/task.js +7 -0
- package/src/validator/per-kind/widget.js +14 -0
- package/src/validator/projections/api-http-async.js +410 -0
- package/src/validator/projections/api-http-authz.js +88 -0
- package/src/validator/projections/api-http-core.js +205 -0
- package/src/validator/projections/api-http-policies.js +339 -0
- package/src/validator/projections/api-http-responses.js +233 -0
- package/src/validator/projections/api-http.js +44 -0
- package/src/validator/projections/db.js +353 -0
- package/src/validator/projections/generator-defaults.js +45 -0
- package/src/validator/projections/helpers.js +87 -0
- package/src/validator/projections/ui-helpers.js +214 -0
- package/src/validator/projections/ui-navigation.js +344 -0
- package/src/validator/projections/ui-structure.js +364 -0
- package/src/validator/projections/ui-widgets.js +493 -0
- package/src/validator/projections/ui.js +46 -0
- package/src/validator/registry.js +48 -1
- package/src/validator/utils.d.ts +20 -0
- package/src/validator/utils.js +115 -12
- package/src/validator.d.ts +2 -0
- package/src/widget-behavior.d.ts +1 -0
- package/src/workflows/adoption/index.js +26 -0
- package/src/workflows/docs-generate.js +262 -0
- package/src/workflows/docs-scan.js +703 -0
- package/src/workflows/docs.js +15 -0
- package/src/workflows/import-app/api/collect.js +221 -0
- package/src/workflows/import-app/api/openapi.js +257 -0
- package/src/workflows/import-app/api/routes.js +327 -0
- package/src/workflows/import-app/api/sources.js +22 -0
- package/src/workflows/import-app/api.js +4 -0
- package/src/workflows/import-app/db.js +538 -0
- package/src/workflows/import-app/index.js +30 -0
- package/src/workflows/import-app/shared.js +218 -0
- package/src/workflows/import-app/ui.js +443 -0
- package/src/workflows/import-app/workflow.js +159 -0
- package/src/workflows/reconcile/adoption-plan/build.js +208 -0
- package/src/workflows/reconcile/adoption-plan/dependencies.js +75 -0
- package/src/workflows/reconcile/adoption-plan/outputs.js +143 -0
- package/src/workflows/reconcile/adoption-plan/paths.js +58 -0
- package/src/workflows/reconcile/adoption-plan/projection-patches.js +177 -0
- package/src/workflows/reconcile/adoption-plan/reasons.js +107 -0
- package/src/workflows/reconcile/adoption-plan.js +32 -0
- package/src/workflows/reconcile/auth/closures.js +115 -0
- package/src/workflows/reconcile/auth/formatters.js +142 -0
- package/src/workflows/reconcile/auth/inference.js +330 -0
- package/src/workflows/reconcile/auth/roles.js +122 -0
- package/src/workflows/reconcile/auth.js +37 -0
- package/src/workflows/reconcile/bundle-core/index.js +600 -0
- package/src/workflows/reconcile/bundle-core.js +14 -0
- package/src/workflows/reconcile/bundle-shared.js +75 -0
- package/src/workflows/reconcile/candidate-model.js +477 -0
- package/src/workflows/reconcile/canonical-surface.js +264 -0
- package/src/workflows/reconcile/gap-report.js +333 -0
- package/src/workflows/reconcile/ids.js +6 -0
- package/src/workflows/reconcile/impacts/adoption-plan.js +192 -0
- package/src/workflows/reconcile/impacts/indexes.js +101 -0
- package/src/workflows/reconcile/impacts/patches.js +252 -0
- package/src/workflows/reconcile/impacts/reports.js +80 -0
- package/src/workflows/reconcile/impacts.js +16 -0
- package/src/workflows/reconcile/index.js +7 -0
- package/src/workflows/reconcile/renderers.js +461 -0
- package/src/workflows/reconcile/summary.js +90 -0
- package/src/workflows/reconcile/workflow.js +309 -0
- package/src/workflows/shared.js +189 -0
- package/src/workflows/types.d.ts +93 -0
- package/src/workflows.d.ts +1 -0
- package/src/workflows.js +10 -7652
- package/src/workspace-docs.d.ts +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function resolveCatalogTemplateAlias(templateName: string, catalogSource?: string | null): any;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { parseCoreCommandArgs } from "./command-parsers/core.js";
|
|
4
|
+
import { parseGeneratorCommandArgs } from "./command-parsers/generator.js";
|
|
5
|
+
import { parseImportCommandArgs } from "./command-parsers/import.js";
|
|
6
|
+
import { parseLegacyWorkflowCommandArgs } from "./command-parsers/legacy-workflow.js";
|
|
7
|
+
import { parseProjectCommandArgs } from "./command-parsers/project.js";
|
|
8
|
+
import { parseSdlcCommandArgs } from "./command-parsers/sdlc.js";
|
|
9
|
+
import { parseTemplateCommandArgs } from "./command-parsers/template.js";
|
|
10
|
+
|
|
11
|
+
const COMMAND_PARSERS = [
|
|
12
|
+
parseCoreCommandArgs,
|
|
13
|
+
parseGeneratorCommandArgs,
|
|
14
|
+
parseTemplateCommandArgs,
|
|
15
|
+
parseProjectCommandArgs,
|
|
16
|
+
parseImportCommandArgs,
|
|
17
|
+
parseLegacyWorkflowCommandArgs,
|
|
18
|
+
parseSdlcCommandArgs
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Parses command families that have already been split out of the CLI shim.
|
|
23
|
+
*
|
|
24
|
+
* Keep this module as a composition root. Command-family parsing belongs in
|
|
25
|
+
* `cli/command-parsers/*` so the parser does not become another CLI shim.
|
|
26
|
+
*
|
|
27
|
+
* @param {string[]} args
|
|
28
|
+
* @returns {import("./command-parsers/shared.js").SplitCommandArgs|null}
|
|
29
|
+
*/
|
|
30
|
+
export function parseSplitCommandArgs(args) {
|
|
31
|
+
for (const parser of COMMAND_PARSERS) {
|
|
32
|
+
const commandArgs = parser(args);
|
|
33
|
+
if (commandArgs) {
|
|
34
|
+
return commandArgs;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
const QUERY_NAMES = new Set([
|
|
6
|
+
"task-mode",
|
|
7
|
+
"diff",
|
|
8
|
+
"slice",
|
|
9
|
+
"adoption-plan",
|
|
10
|
+
"maintained-boundary",
|
|
11
|
+
"maintained-conformance",
|
|
12
|
+
"maintained-drift",
|
|
13
|
+
"seam-check",
|
|
14
|
+
"domain-coverage",
|
|
15
|
+
"domain-list",
|
|
16
|
+
"review-boundary",
|
|
17
|
+
"write-scope",
|
|
18
|
+
"verification-targets",
|
|
19
|
+
"widget-behavior",
|
|
20
|
+
"change-plan",
|
|
21
|
+
"import-plan",
|
|
22
|
+
"risk-summary",
|
|
23
|
+
"canonical-writes",
|
|
24
|
+
"proceed-decision",
|
|
25
|
+
"review-packet",
|
|
26
|
+
"next-action",
|
|
27
|
+
"single-agent-plan",
|
|
28
|
+
"multi-agent-plan",
|
|
29
|
+
"resolved-workflow-context",
|
|
30
|
+
"workflow-preset-activation",
|
|
31
|
+
"workflow-preset-diff",
|
|
32
|
+
"workflow-preset-customization",
|
|
33
|
+
"work-packet",
|
|
34
|
+
"lane-status",
|
|
35
|
+
"handoff-status",
|
|
36
|
+
"auth-hints",
|
|
37
|
+
"auth-review-packet"
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param {string[]} args
|
|
42
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
43
|
+
*/
|
|
44
|
+
export function parseCoreCommandArgs(args) {
|
|
45
|
+
if (args[0] === "new" || args[0] === "create") {
|
|
46
|
+
return args.includes("--list-templates")
|
|
47
|
+
? { templateCommand: "list", inputPath: null }
|
|
48
|
+
: { newProject: true, inputPath: args[1] };
|
|
49
|
+
}
|
|
50
|
+
if (args[0] === "generate" && args[1] === "app") {
|
|
51
|
+
return { generateTarget: "app-bundle", write: true, inputPath: commandPath(args, 2), defaultOutDir: "./app" };
|
|
52
|
+
}
|
|
53
|
+
if (args[0] === "generate" && args[1] === "journeys") {
|
|
54
|
+
return { workflowName: "generate-journeys", inputPath: args[2] };
|
|
55
|
+
}
|
|
56
|
+
if (args[0] === "generate" && args[1] !== "journeys") {
|
|
57
|
+
return { generateTarget: "app-bundle", write: true, inputPath: commandPath(args, 1), defaultOutDir: "./app" };
|
|
58
|
+
}
|
|
59
|
+
if (args[0] === "emit") {
|
|
60
|
+
if (!args[1] || args[1].startsWith("-")) {
|
|
61
|
+
return { emitHelp: true, inputPath: null };
|
|
62
|
+
}
|
|
63
|
+
return { generateTarget: args[1], inputPath: commandPath(args, 2), emitArtifact: true };
|
|
64
|
+
}
|
|
65
|
+
if (args[0] === "version" || args[0] === "--version") {
|
|
66
|
+
return { version: true, inputPath: null };
|
|
67
|
+
}
|
|
68
|
+
if (args[0] === "query" && args[1] === "list") {
|
|
69
|
+
return { queryList: true, inputPath: null };
|
|
70
|
+
}
|
|
71
|
+
if (args[0] === "query" && args[1] === "show") {
|
|
72
|
+
return { queryShow: true, queryShowName: args[2] || null, inputPath: null };
|
|
73
|
+
}
|
|
74
|
+
if (args[0] === "query" && args[1] === "workflow-preset" && args[2] === "customize") {
|
|
75
|
+
return { workflowPresetCommand: "customize", inputPath: commandPath(args, 3) };
|
|
76
|
+
}
|
|
77
|
+
if (args[0] === "workflow-preset" && args[1] === "customize") {
|
|
78
|
+
return { workflowPresetCommand: "customize", inputPath: commandPath(args, 2) };
|
|
79
|
+
}
|
|
80
|
+
if (args[0] === "query" && QUERY_NAMES.has(args[1])) {
|
|
81
|
+
return { queryName: args[1], inputPath: commandPath(args, 2) };
|
|
82
|
+
}
|
|
83
|
+
if (args[0] === "doctor") {
|
|
84
|
+
return { doctor: true, inputPath: args[1] && !args[1].startsWith("-") ? args[1] : null };
|
|
85
|
+
}
|
|
86
|
+
if (args[0] === "check") {
|
|
87
|
+
return { check: true, inputPath: commandPath(args, 1) };
|
|
88
|
+
}
|
|
89
|
+
if (args[0] === "validate") {
|
|
90
|
+
return { validate: true, inputPath: args[1] };
|
|
91
|
+
}
|
|
92
|
+
if (args[0] === "agent" && args[1] === "brief") {
|
|
93
|
+
return { agentBrief: true, inputPath: commandPath(args, 2) };
|
|
94
|
+
}
|
|
95
|
+
if (args[0] === "widget" && args[1] === "check") {
|
|
96
|
+
return { widgetCheck: true, inputPath: commandPath(args, 2) };
|
|
97
|
+
}
|
|
98
|
+
if (args[0] === "widget" && args[1] === "behavior") {
|
|
99
|
+
return { widgetBehavior: true, inputPath: commandPath(args, 2) };
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
8
|
+
*/
|
|
9
|
+
export function parseGeneratorCommandArgs(args) {
|
|
10
|
+
if (args[0] === "generator" && args[1] === "list") {
|
|
11
|
+
return { generatorCommand: "list", inputPath: null };
|
|
12
|
+
}
|
|
13
|
+
if (args[0] === "generator" && args[1] === "show") {
|
|
14
|
+
return { generatorCommand: "show", inputPath: args[2] };
|
|
15
|
+
}
|
|
16
|
+
if (args[0] === "generator" && args[1] === "check") {
|
|
17
|
+
return { generatorCommand: "check", inputPath: args[2] };
|
|
18
|
+
}
|
|
19
|
+
if (args[0] === "generator" && args[1] === "policy" && args[2] === "init") {
|
|
20
|
+
return { generatorPolicyCommand: "init", inputPath: commandPath(args, 3) };
|
|
21
|
+
}
|
|
22
|
+
if (args[0] === "generator" && args[1] === "policy" && args[2] === "status") {
|
|
23
|
+
return { generatorPolicyCommand: "status", inputPath: commandPath(args, 3) };
|
|
24
|
+
}
|
|
25
|
+
if (args[0] === "generator" && args[1] === "policy" && args[2] === "check") {
|
|
26
|
+
return { generatorPolicyCommand: "check", inputPath: commandPath(args, 3) };
|
|
27
|
+
}
|
|
28
|
+
if (args[0] === "generator" && args[1] === "policy" && args[2] === "explain") {
|
|
29
|
+
return { generatorPolicyCommand: "explain", inputPath: commandPath(args, 3) };
|
|
30
|
+
}
|
|
31
|
+
if (args[0] === "generator" && args[1] === "policy" && args[2] === "pin") {
|
|
32
|
+
return {
|
|
33
|
+
generatorPolicyCommand: "pin",
|
|
34
|
+
generatorPolicyPinSpec: args[3] && !args[3].startsWith("-") ? args[3] : null,
|
|
35
|
+
inputPath: commandPath(args, 4)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandOperandFrom, commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
8
|
+
*/
|
|
9
|
+
export function parseImportCommandArgs(args) {
|
|
10
|
+
if (args[0] === "import" && args[1] === "app") {
|
|
11
|
+
return { workflowName: "import-app", inputPath: args[2] };
|
|
12
|
+
}
|
|
13
|
+
if (args[0] === "import" && args[1] === "docs") {
|
|
14
|
+
return { workflowName: "scan-docs", inputPath: args[2] };
|
|
15
|
+
}
|
|
16
|
+
if (args[0] === "import" && args[1] === "diff") {
|
|
17
|
+
return { importCommand: "diff", inputPath: commandOperandFrom(args, 2, ".") };
|
|
18
|
+
}
|
|
19
|
+
if (args[0] === "import" && args[1] === "refresh") {
|
|
20
|
+
return { importCommand: "refresh", inputPath: commandOperandFrom(args, 2, ".") };
|
|
21
|
+
}
|
|
22
|
+
if (args[0] === "import" && args[1] === "check") {
|
|
23
|
+
return { importCommand: "check", inputPath: commandPath(args, 2, ".") };
|
|
24
|
+
}
|
|
25
|
+
if (args[0] === "import" && args[1] === "plan") {
|
|
26
|
+
return { importCommand: "plan", inputPath: commandPath(args, 2, ".") };
|
|
27
|
+
}
|
|
28
|
+
if (args[0] === "import" && args[1] === "adopt" && (args[2] === "--list" || args[2] === "list")) {
|
|
29
|
+
return { importCommand: "adopt-list", inputPath: commandPath(args, 3, ".") };
|
|
30
|
+
}
|
|
31
|
+
if (args[0] === "import" && args[1] === "adopt") {
|
|
32
|
+
return { importCommand: "adopt", importAdoptSelector: args[2], inputPath: commandPath(args, 3, ".") };
|
|
33
|
+
}
|
|
34
|
+
if (args[0] === "import" && args[1] === "status") {
|
|
35
|
+
return { importCommand: "status", inputPath: commandPath(args, 2, ".") };
|
|
36
|
+
}
|
|
37
|
+
if (args[0] === "import" && args[1] === "history") {
|
|
38
|
+
return { importCommand: "history", verify: args.includes("--verify"), inputPath: commandOperandFrom(args, 2, ".") };
|
|
39
|
+
}
|
|
40
|
+
if (args[0] === "import" && args[1] && !args[1].startsWith("-")) {
|
|
41
|
+
return { importCommand: "workspace", inputPath: args[1] };
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {string[]} args
|
|
5
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
6
|
+
*/
|
|
7
|
+
export function parseLegacyWorkflowCommandArgs(args) {
|
|
8
|
+
if (args[0] === "report" && args[1] === "gaps") {
|
|
9
|
+
return { workflowName: "report-gaps", inputPath: args[2] };
|
|
10
|
+
}
|
|
11
|
+
if (args[0] === "reconcile" && args[1] === "adopt") {
|
|
12
|
+
return { workflowName: "reconcile", inputPath: args[3], adoptValue: args[2] };
|
|
13
|
+
}
|
|
14
|
+
if (args[0] === "reconcile") {
|
|
15
|
+
return { workflowName: "reconcile", inputPath: args[1] };
|
|
16
|
+
}
|
|
17
|
+
if (args[0] === "adoption" && args[1] === "status") {
|
|
18
|
+
return { workflowName: "adoption-status", inputPath: args[2] };
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
8
|
+
*/
|
|
9
|
+
export function parseProjectCommandArgs(args) {
|
|
10
|
+
if (args[0] === "source" && args[1] === "status") {
|
|
11
|
+
return { sourceCommand: "status", inputPath: commandPath(args, 2, ".") };
|
|
12
|
+
}
|
|
13
|
+
if (args[0] === "trust" && args[1] === "template") {
|
|
14
|
+
return { trustCommand: "template", force: args.includes("--force"), inputPath: commandPath(args, 2) };
|
|
15
|
+
}
|
|
16
|
+
if (args[0] === "trust" && args[1] === "status") {
|
|
17
|
+
return { trustCommand: "status", inputPath: commandPath(args, 2) };
|
|
18
|
+
}
|
|
19
|
+
if (args[0] === "trust" && args[1] === "diff") {
|
|
20
|
+
return { trustCommand: "diff", inputPath: commandPath(args, 2) };
|
|
21
|
+
}
|
|
22
|
+
if (args[0] === "release" && args[1] === "status") {
|
|
23
|
+
return { releaseCommand: "status", inputPath: null };
|
|
24
|
+
}
|
|
25
|
+
if (args[0] === "release" && args[1] === "roll-consumers") {
|
|
26
|
+
return { releaseCommand: "roll-consumers", releaseRollVersion: args[2], inputPath: null };
|
|
27
|
+
}
|
|
28
|
+
if (args[0] === "catalog" && args[1] === "list") {
|
|
29
|
+
return { catalogCommand: "list", inputPath: args[2] && !args[2].startsWith("-") ? args[2] : null };
|
|
30
|
+
}
|
|
31
|
+
if (args[0] === "catalog" && args[1] === "show") {
|
|
32
|
+
return { catalogCommand: "show", inputPath: args[2] };
|
|
33
|
+
}
|
|
34
|
+
if (args[0] === "catalog" && args[1] === "doctor") {
|
|
35
|
+
return { catalogCommand: "doctor", inputPath: args[2] && !args[2].startsWith("-") ? args[2] : null };
|
|
36
|
+
}
|
|
37
|
+
if (args[0] === "catalog" && args[1] === "check") {
|
|
38
|
+
return { catalogCommand: "check", inputPath: args[2] };
|
|
39
|
+
}
|
|
40
|
+
if (args[0] === "catalog" && args[1] === "copy") {
|
|
41
|
+
return { catalogCommand: "copy", catalogId: args[2], inputPath: args[3] };
|
|
42
|
+
}
|
|
43
|
+
if (args[0] === "package" && args[1] === "update-cli") {
|
|
44
|
+
return { packageCommand: "update-cli", inputPath: args.includes("--latest") ? "latest" : args[2] };
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
8
|
+
*/
|
|
9
|
+
export function parseSdlcCommandArgs(args) {
|
|
10
|
+
if (args[0] === "sdlc" && args[1] === "transition") {
|
|
11
|
+
return {
|
|
12
|
+
sdlcCommand: "transition",
|
|
13
|
+
inputPath: args[4] && !args[4].startsWith("-") ? args[4] : ".",
|
|
14
|
+
sdlcId: args[2],
|
|
15
|
+
sdlcTargetStatus: args[3]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (args[0] === "sdlc" && args[1] === "check") {
|
|
19
|
+
return { sdlcCommand: "check", inputPath: commandPath(args, 2, ".") };
|
|
20
|
+
}
|
|
21
|
+
if (args[0] === "sdlc" && args[1] === "explain") {
|
|
22
|
+
return {
|
|
23
|
+
sdlcCommand: "explain",
|
|
24
|
+
sdlcId: args[2],
|
|
25
|
+
inputPath: args[3] && !args[3].startsWith("-") ? args[3] : "."
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
if (args[0] === "sdlc" && args[1] === "archive") {
|
|
29
|
+
return { sdlcCommand: "archive", inputPath: commandPath(args, 2, ".") };
|
|
30
|
+
}
|
|
31
|
+
if (args[0] === "sdlc" && args[1] === "unarchive") {
|
|
32
|
+
return { sdlcCommand: "unarchive", sdlcId: args[2], inputPath: commandPath(args, 3, ".") };
|
|
33
|
+
}
|
|
34
|
+
if (args[0] === "sdlc" && args[1] === "compact") {
|
|
35
|
+
return { sdlcCommand: "compact", sdlcArchiveFile: args[2], inputPath: "." };
|
|
36
|
+
}
|
|
37
|
+
if (args[0] === "sdlc" && args[1] === "new") {
|
|
38
|
+
return { sdlcCommand: "new", sdlcNewKind: args[2], sdlcNewSlug: args[3], inputPath: commandPath(args, 4, ".") };
|
|
39
|
+
}
|
|
40
|
+
if (args[0] === "sdlc" && args[1] === "adopt") {
|
|
41
|
+
return { sdlcCommand: "adopt", inputPath: commandPath(args, 2, ".") };
|
|
42
|
+
}
|
|
43
|
+
if (args[0] === "release") {
|
|
44
|
+
return { sdlcCommand: "release", inputPath: commandPath(args, 1, ".") };
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Record<string, any> & {
|
|
5
|
+
* inputPath: string|null
|
|
6
|
+
* }} SplitCommandArgs
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {string[]} args
|
|
11
|
+
* @param {number} index
|
|
12
|
+
* @param {string} [fallback]
|
|
13
|
+
* @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
export function commandPath(args, index, fallback = "./topogram") {
|
|
16
|
+
const value = args[index];
|
|
17
|
+
return value && !value.startsWith("-") ? value : fallback;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string[]} args
|
|
22
|
+
* @param {number} index
|
|
23
|
+
* @param {string} [fallback]
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
export function commandOperandFrom(args, index, fallback = ".") {
|
|
27
|
+
const valueFlags = new Set([
|
|
28
|
+
"--accept-current",
|
|
29
|
+
"--accept-candidate",
|
|
30
|
+
"--delete-current",
|
|
31
|
+
"--from",
|
|
32
|
+
"--out",
|
|
33
|
+
"--out-dir",
|
|
34
|
+
"--reason",
|
|
35
|
+
"--template",
|
|
36
|
+
"--version"
|
|
37
|
+
]);
|
|
38
|
+
for (let i = index; i < args.length; i += 1) {
|
|
39
|
+
const value = args[i];
|
|
40
|
+
if (!value) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (!value.startsWith("-")) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
if (valueFlags.has(value)) {
|
|
47
|
+
i += 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return fallback;
|
|
51
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { commandPath } from "./shared.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @returns {import("./shared.js").SplitCommandArgs|null}
|
|
8
|
+
*/
|
|
9
|
+
export function parseTemplateCommandArgs(args) {
|
|
10
|
+
if (args[0] === "template" && args[1] === "list") {
|
|
11
|
+
return { templateCommand: "list", inputPath: null };
|
|
12
|
+
}
|
|
13
|
+
if (args[0] === "template" && args[1] === "show") {
|
|
14
|
+
return { templateCommand: "show", inputPath: args[2] };
|
|
15
|
+
}
|
|
16
|
+
if (args[0] === "template" && args[1] === "explain") {
|
|
17
|
+
return { templateCommand: "explain", inputPath: commandPath(args, 2, ".") };
|
|
18
|
+
}
|
|
19
|
+
if (args[0] === "template" && args[1] === "status") {
|
|
20
|
+
return { templateCommand: "status", inputPath: commandPath(args, 2) };
|
|
21
|
+
}
|
|
22
|
+
if (args[0] === "template" && args[1] === "detach") {
|
|
23
|
+
return { templateCommand: "detach", inputPath: commandPath(args, 2, ".") };
|
|
24
|
+
}
|
|
25
|
+
if (args[0] === "template" && args[1] === "policy" && args[2] === "init") {
|
|
26
|
+
return { templateCommand: "policy:init", inputPath: commandPath(args, 3) };
|
|
27
|
+
}
|
|
28
|
+
if (args[0] === "template" && args[1] === "policy" && args[2] === "check") {
|
|
29
|
+
return { templateCommand: "policy:check", inputPath: commandPath(args, 3) };
|
|
30
|
+
}
|
|
31
|
+
if (args[0] === "template" && args[1] === "policy" && args[2] === "explain") {
|
|
32
|
+
return { templateCommand: "policy:explain", inputPath: commandPath(args, 3) };
|
|
33
|
+
}
|
|
34
|
+
if (args[0] === "template" && args[1] === "policy" && args[2] === "pin") {
|
|
35
|
+
return {
|
|
36
|
+
templateCommand: "policy:pin",
|
|
37
|
+
templatePolicyPinSpec: args[3] && !args[3].startsWith("-") ? args[3] : null,
|
|
38
|
+
inputPath: commandPath(args, 4)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (args[0] === "template" && args[1] === "check") {
|
|
42
|
+
return { templateCommand: "check", inputPath: args[2] };
|
|
43
|
+
}
|
|
44
|
+
if (args[0] === "template" && args[1] === "update") {
|
|
45
|
+
return { templateCommand: "update", inputPath: commandPath(args, 2) };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { buildAgentBrief, formatAgentBrief, normalizeAgentTopogramPath } from "../../agent-brief.js";
|
|
4
|
+
import { stableStringify } from "../../format.js";
|
|
5
|
+
import { parsePath } from "../../parser.js";
|
|
6
|
+
import { formatProjectConfigErrors } from "../../project-config.js";
|
|
7
|
+
import { formatValidationErrors } from "../../validator.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
export function printAgentHelp() {
|
|
13
|
+
console.log("Usage: topogram agent brief [path] [--json]");
|
|
14
|
+
console.log("");
|
|
15
|
+
console.log("Prints read-only first-run guidance for humans and agents working in a Topogram project.");
|
|
16
|
+
console.log("");
|
|
17
|
+
console.log("Defaults: path is ./topogram. The command validates the Topogram and project config, but does not write files, generate apps, load generator adapters, or execute template implementation.");
|
|
18
|
+
console.log("");
|
|
19
|
+
console.log("Examples:");
|
|
20
|
+
console.log(" topogram agent brief");
|
|
21
|
+
console.log(" topogram agent brief --json");
|
|
22
|
+
console.log(" topogram agent brief ./topogram --json");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} inputPath
|
|
27
|
+
* @param {{ json?: boolean }} [options]
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
export function runAgentBriefCommand(inputPath, options = {}) {
|
|
31
|
+
const ast = parsePath(normalizeAgentTopogramPath(inputPath));
|
|
32
|
+
const result = buildAgentBrief(inputPath, ast);
|
|
33
|
+
if (!result.ok) {
|
|
34
|
+
if (result.kind === "project") {
|
|
35
|
+
console.error(formatProjectConfigErrors(result.validation, result.configPath));
|
|
36
|
+
} else {
|
|
37
|
+
console.error(formatValidationErrors(result.validation));
|
|
38
|
+
}
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
if (options.json) {
|
|
42
|
+
console.log(stableStringify(result.payload));
|
|
43
|
+
} else {
|
|
44
|
+
process.stdout.write(formatAgentBrief(result.payload));
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { checkCatalogSource } from "../../../catalog.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} source
|
|
7
|
+
* @returns {ReturnType<typeof checkCatalogSource>}
|
|
8
|
+
*/
|
|
9
|
+
export function buildCatalogCheckPayload(source) {
|
|
10
|
+
if (!source) {
|
|
11
|
+
throw new Error("topogram catalog check requires <path-or-url>.");
|
|
12
|
+
}
|
|
13
|
+
return checkCatalogSource(source);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {ReturnType<typeof checkCatalogSource>} payload
|
|
18
|
+
* @returns {void}
|
|
19
|
+
*/
|
|
20
|
+
export function printCatalogCheck(payload) {
|
|
21
|
+
console.log(payload.ok ? "Catalog check passed." : "Catalog check failed.");
|
|
22
|
+
console.log(`Source: ${payload.source}`);
|
|
23
|
+
if (payload.catalog) {
|
|
24
|
+
console.log(`Version: ${payload.catalog.version}`);
|
|
25
|
+
console.log(`Entries: ${payload.catalog.entries.length}`);
|
|
26
|
+
}
|
|
27
|
+
for (const diagnostic of payload.diagnostics) {
|
|
28
|
+
const label = diagnostic.severity === "warning" ? "Warning" : "Error";
|
|
29
|
+
console.log(`${label}: ${diagnostic.message}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
copyCatalogTopogramEntry,
|
|
7
|
+
findCatalogEntry,
|
|
8
|
+
loadCatalog,
|
|
9
|
+
TOPOGRAM_SOURCE_FILE
|
|
10
|
+
} from "../../../catalog.js";
|
|
11
|
+
import { shellCommandArg } from "./shared.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} id
|
|
15
|
+
* @param {string} targetPath
|
|
16
|
+
* @param {{ source?: string|null, version?: string|null }} options
|
|
17
|
+
* @returns {{ ok: boolean, source: string, id: string, kind: "topogram", packageSpec: string, targetPath: string, provenancePath: string, files: string[], diagnostics: any[], errors: string[] }}
|
|
18
|
+
*/
|
|
19
|
+
export function buildCatalogCopyPayload(id, targetPath, options) {
|
|
20
|
+
if (!id || id.startsWith("-")) {
|
|
21
|
+
throw new Error("topogram catalog copy requires <id>.");
|
|
22
|
+
}
|
|
23
|
+
if (!targetPath || targetPath.startsWith("-")) {
|
|
24
|
+
throw new Error("topogram catalog copy requires <target>.");
|
|
25
|
+
}
|
|
26
|
+
const loaded = loadCatalog(options.source || null);
|
|
27
|
+
const entry = findCatalogEntry(loaded.catalog, id, "topogram");
|
|
28
|
+
if (!entry) {
|
|
29
|
+
throw new Error(`Catalog topogram entry '${id}' was not found in ${loaded.source}.`);
|
|
30
|
+
}
|
|
31
|
+
const copied = copyCatalogTopogramEntry(entry, targetPath, {
|
|
32
|
+
catalogSource: loaded.source,
|
|
33
|
+
version: options.version || null
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
source: loaded.source,
|
|
37
|
+
...copied,
|
|
38
|
+
diagnostics: [],
|
|
39
|
+
errors: []
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {ReturnType<typeof buildCatalogCopyPayload>} payload
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
export function printCatalogCopy(payload) {
|
|
48
|
+
console.log(`Copied catalog topogram '${payload.id}' to ${payload.targetPath}.`);
|
|
49
|
+
console.log(`Package: ${payload.packageSpec}`);
|
|
50
|
+
console.log(`Source provenance: ${payload.provenancePath}`);
|
|
51
|
+
console.log(`Files: ${payload.files.length}`);
|
|
52
|
+
console.log(`${TOPOGRAM_SOURCE_FILE} records catalog-copy provenance only. Local edits are allowed.`);
|
|
53
|
+
console.log("");
|
|
54
|
+
console.log("Next steps:");
|
|
55
|
+
console.log(` cd ${shellCommandArg(path.relative(process.cwd(), payload.targetPath) || ".")}`);
|
|
56
|
+
console.log(" topogram source status --local");
|
|
57
|
+
console.log(" topogram check");
|
|
58
|
+
console.log(" topogram generate");
|
|
59
|
+
}
|