@topogram/cli 0.3.62 → 0.3.64
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.d.ts +6 -0
- 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.d.ts +26 -0
- 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.d.ts +10 -0
- package/src/catalog.js +62 -66
- 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.js +617 -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.js +785 -0
- package/src/cli/commands/generator.js +443 -0
- package/src/cli/commands/import-runner.js +157 -0
- package/src/cli/commands/import.js +1734 -0
- package/src/cli/commands/inspect.js +55 -0
- package/src/cli/commands/new.js +94 -0
- package/src/cli/commands/package.js +815 -0
- package/src/cli/commands/query.js +1302 -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-runner.js +198 -0
- package/src/cli/commands/template.js +2145 -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/check.d.ts +1 -0
- package/src/generator/context/bundle.d.ts +1 -0
- package/src/generator/context/shared.d.ts +2 -0
- package/src/generator/native/parity-bundle.js +2 -1
- 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.d.ts +2 -0
- package/src/github-client.js +520 -0
- package/src/import/core/shared.js +20 -62
- 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.js +100 -11
- package/src/npm-safety.js +79 -0
- package/src/parser.d.ts +1 -0
- package/src/path-helpers.d.ts +1 -0
- package/src/path-helpers.js +20 -0
- package/src/project-config.js +1 -0
- package/src/reconcile/docs.d.ts +8 -0
- package/src/reconcile/journeys.d.ts +1 -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/text-helpers.d.ts +6 -0
- package/src/text-helpers.js +245 -0
- package/src/topogram-config.js +306 -0
- package/src/validator.d.ts +2 -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.js +799 -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.js +742 -0
- package/src/workflows/reconcile/auth.js +692 -0
- package/src/workflows/reconcile/bundle-core.js +600 -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.js +625 -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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { stableStringify } from "../../format.js";
|
|
4
|
+
import { parsePath } from "../../parser.js";
|
|
5
|
+
import { resolveWorkspace } from "../../resolver.js";
|
|
6
|
+
import { formatValidationErrors } from "../../validator.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Record<string, any>} workspaceAst
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
function summarize(workspaceAst) {
|
|
13
|
+
const statements = workspaceAst.files.flatMap((/** @type {{ statements: any[] }} */ file) => file.statements);
|
|
14
|
+
const byKind = new Map();
|
|
15
|
+
|
|
16
|
+
for (const statement of statements) {
|
|
17
|
+
byKind.set(statement.kind, (byKind.get(statement.kind) || 0) + 1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(`Parsed ${workspaceAst.files.length} file(s) and ${statements.length} statement(s).`);
|
|
21
|
+
for (const [kind, count] of [...byKind.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
22
|
+
console.log(`- ${kind}: ${count}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string|null|undefined} inputPath
|
|
28
|
+
* @returns {number}
|
|
29
|
+
*/
|
|
30
|
+
export function runResolveCommand(inputPath) {
|
|
31
|
+
const ast = parsePath(inputPath || ".");
|
|
32
|
+
const result = resolveWorkspace(ast);
|
|
33
|
+
if (!result.ok) {
|
|
34
|
+
console.error(formatValidationErrors(result.validation));
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
console.log(JSON.stringify(result.graph, null, 2));
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {string|null|undefined} inputPath
|
|
44
|
+
* @param {{ json?: boolean }} [options]
|
|
45
|
+
* @returns {number}
|
|
46
|
+
*/
|
|
47
|
+
export function runParseCommand(inputPath, options = {}) {
|
|
48
|
+
const ast = parsePath(inputPath || ".");
|
|
49
|
+
if (options.json) {
|
|
50
|
+
console.log(stableStringify(ast));
|
|
51
|
+
} else {
|
|
52
|
+
summarize(ast);
|
|
53
|
+
}
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { resolveCatalogTemplateAlias } from "../catalog-alias.js";
|
|
6
|
+
import { GENERATOR_POLICY_FILE } from "../../generator-policy.js";
|
|
7
|
+
import { createNewProject } from "../../new-project.js";
|
|
8
|
+
|
|
9
|
+
const ENGINE_ROOT = path.resolve(decodeURIComponent(new URL("../../../", import.meta.url).pathname));
|
|
10
|
+
const TEMPLATES_ROOT = path.join(ENGINE_ROOT, "templates");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {ReturnType<typeof createNewProject>} result
|
|
14
|
+
* @param {string} cwd
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/
|
|
17
|
+
function displayProjectRootForNewProject(result, cwd) {
|
|
18
|
+
const relativeProjectRoot = path.relative(cwd, result.projectRoot);
|
|
19
|
+
return !relativeProjectRoot || relativeProjectRoot.startsWith("..")
|
|
20
|
+
? result.projectRoot
|
|
21
|
+
: relativeProjectRoot;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {ReturnType<typeof createNewProject>} result
|
|
26
|
+
* @param {string} cwd
|
|
27
|
+
* @returns {void}
|
|
28
|
+
*/
|
|
29
|
+
export function printNewProjectResult(result, cwd) {
|
|
30
|
+
const template = result.template || {};
|
|
31
|
+
console.log(`Created Topogram project at ${result.projectRoot}.`);
|
|
32
|
+
console.log(`Template: ${result.templateName}`);
|
|
33
|
+
console.log(`Source: ${template.source || "unknown"}`);
|
|
34
|
+
if (template.sourceSpec) {
|
|
35
|
+
console.log(`Source spec: ${template.sourceSpec}`);
|
|
36
|
+
}
|
|
37
|
+
if (template.catalog) {
|
|
38
|
+
console.log(`Catalog: ${template.catalog.id} from ${template.catalog.source}`);
|
|
39
|
+
console.log(`Package: ${template.catalog.packageSpec}`);
|
|
40
|
+
}
|
|
41
|
+
console.log(`Executable implementation: ${template.includesExecutableImplementation ? "yes" : "no"}`);
|
|
42
|
+
console.log("Policy: topogram.template-policy.json");
|
|
43
|
+
console.log(`Generator policy: ${GENERATOR_POLICY_FILE}`);
|
|
44
|
+
console.log("Template files: .topogram-template-files.json");
|
|
45
|
+
if (template.includesExecutableImplementation) {
|
|
46
|
+
console.log("Trust: .topogram-template-trust.json");
|
|
47
|
+
}
|
|
48
|
+
for (const warning of result.warnings) {
|
|
49
|
+
console.warn(`Warning: ${warning}`);
|
|
50
|
+
}
|
|
51
|
+
console.log("");
|
|
52
|
+
console.log("Next steps:");
|
|
53
|
+
console.log(` cd ${displayProjectRootForNewProject(result, cwd)}`);
|
|
54
|
+
console.log(" npm install");
|
|
55
|
+
console.log(" npm run agent:brief");
|
|
56
|
+
console.log(" npm run doctor");
|
|
57
|
+
console.log(" npm run source:status");
|
|
58
|
+
console.log(" npm run template:explain");
|
|
59
|
+
console.log(" npm run check");
|
|
60
|
+
console.log(" npm run generator:policy:status");
|
|
61
|
+
console.log(" npm run generator:policy:check");
|
|
62
|
+
if (template.includesExecutableImplementation) {
|
|
63
|
+
console.log(" npm run template:policy:explain");
|
|
64
|
+
console.log(" npm run trust:status");
|
|
65
|
+
}
|
|
66
|
+
console.log(" npm run generate");
|
|
67
|
+
console.log(" npm run verify");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} inputPath
|
|
72
|
+
* @param {{ templateName: string, catalogSource?: string|null, cwd?: string }} options
|
|
73
|
+
* @returns {number}
|
|
74
|
+
*/
|
|
75
|
+
export function runNewProjectCommand(inputPath, options) {
|
|
76
|
+
const cwd = options.cwd || process.cwd();
|
|
77
|
+
const projectRoot = path.resolve(inputPath);
|
|
78
|
+
const relativeToEngine = path.relative(ENGINE_ROOT, projectRoot);
|
|
79
|
+
if (relativeToEngine === "" || (!relativeToEngine.startsWith("..") && !path.isAbsolute(relativeToEngine))) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
`Refusing to create a generated project inside the engine directory. Use a path outside engine, for example '../${path.basename(projectRoot)}'.`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const resolvedTemplate = resolveCatalogTemplateAlias(options.templateName, options.catalogSource || null);
|
|
85
|
+
const result = createNewProject({
|
|
86
|
+
targetPath: inputPath,
|
|
87
|
+
templateName: resolvedTemplate.templateName,
|
|
88
|
+
templateProvenance: resolvedTemplate.provenance,
|
|
89
|
+
engineRoot: ENGINE_ROOT,
|
|
90
|
+
templatesRoot: TEMPLATES_ROOT
|
|
91
|
+
});
|
|
92
|
+
printNewProjectResult(result, cwd);
|
|
93
|
+
return 0;
|
|
94
|
+
}
|