@rawsql-ts/ztd-cli 0.17.0 → 0.20.0
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 +532 -366
- package/package.json +26 -15
- package/templates/.editorconfig +16 -16
- package/templates/.prettierignore +2 -2
- package/templates/.prettierrc +24 -24
- package/templates/AGENTS.md +30 -52
- package/templates/CONTEXT.md +11 -0
- package/templates/CONTEXT.webapi.md +11 -0
- package/templates/DESIGN.md +17 -0
- package/templates/DEV_NOTES.md +14 -0
- package/templates/PROMPT_DOGFOOD.webapi.md +49 -0
- package/templates/README.md +46 -14
- package/templates/README.webapi.md +38 -0
- package/templates/scripts/local-source-guard.mjs +189 -0
- package/templates/src/AGENTS.md +26 -26
- package/templates/src/application/AGENTS.md +15 -0
- package/templates/src/application/README.md +6 -0
- package/templates/src/catalog/AGENTS.md +28 -37
- package/templates/src/catalog/runtime/AGENTS.md +28 -75
- package/templates/src/catalog/runtime/_coercions.ts +30 -1
- package/templates/src/catalog/runtime/_smoke.runtime.ts +21 -21
- package/templates/src/catalog/specs/AGENTS.md +41 -48
- package/templates/src/catalog/specs/_smoke.spec.arktype.ts +21 -21
- package/templates/src/catalog/specs/_smoke.spec.zod.ts +20 -20
- package/templates/src/db/sql-client-adapters.ts +32 -0
- package/templates/src/db/sql-client.ts +24 -24
- package/templates/src/domain/AGENTS.md +15 -0
- package/templates/src/domain/README.md +6 -0
- package/templates/src/infrastructure/AGENTS.md +14 -0
- package/templates/src/infrastructure/README.md +6 -0
- package/templates/src/infrastructure/db/AGENTS.md +14 -0
- package/templates/src/infrastructure/db/sql-client-adapters.ts +34 -0
- package/templates/{dist/ztd-cli/templates/src → src/infrastructure}/db/sql-client.ts +3 -3
- package/templates/src/infrastructure/persistence/AGENTS.md +18 -0
- package/templates/src/infrastructure/persistence/README.md +8 -0
- package/templates/src/infrastructure/persistence/repositories/AGENTS.md +17 -0
- package/templates/src/infrastructure/persistence/repositories/tables/AGENTS.md +20 -0
- package/templates/src/infrastructure/persistence/repositories/tables/README.md +5 -0
- package/templates/src/infrastructure/persistence/repositories/views/AGENTS.md +16 -0
- package/templates/src/infrastructure/persistence/repositories/views/README.md +5 -0
- package/templates/src/infrastructure/telemetry/AGENTS.md +14 -0
- package/templates/src/infrastructure/telemetry/consoleRepositoryTelemetry.ts +66 -0
- package/templates/src/infrastructure/telemetry/repositoryTelemetry.ts +26 -0
- package/templates/src/infrastructure/telemetry/types.ts +48 -0
- package/templates/src/jobs/AGENTS.md +25 -26
- package/templates/src/jobs/README.md +2 -2
- package/templates/src/presentation/AGENTS.md +15 -0
- package/templates/src/presentation/http/AGENTS.md +15 -0
- package/templates/src/presentation/http/README.md +6 -0
- package/templates/src/repositories/AGENTS.md +30 -118
- package/templates/src/repositories/tables/AGENTS.md +29 -94
- package/templates/src/repositories/tables/README.md +5 -3
- package/templates/src/repositories/views/AGENTS.md +25 -25
- package/templates/src/repositories/views/README.md +5 -3
- package/templates/src/sql/AGENTS.md +30 -77
- package/templates/src/sql/README.md +5 -5
- package/templates/tests/AGENTS.md +29 -62
- package/templates/tests/generated/AGENTS.md +23 -16
- package/templates/tests/smoke.test.ts +25 -5
- package/templates/tests/smoke.validation.test.ts +34 -34
- package/templates/tests/support/AGENTS.md +24 -26
- package/templates/tests/support/global-setup.ts +15 -15
- package/templates/tests/support/testkit-client.ts +14 -14
- package/templates/tests/support/testkit-client.webapi.ts +14 -0
- package/templates/tests/ztd-layout.generated.ts +6 -6
- package/templates/tsconfig.json +15 -15
- package/templates/vitest.config.ts +13 -13
- package/templates/ztd/AGENTS.md +23 -18
- package/templates/ztd/README.md +5 -5
- package/templates/ztd/ddl/AGENTS.md +26 -34
- package/templates/ztd/ddl/demo.sql +74 -74
- package/LICENSE +0 -21
- package/dist/commands/ddl.d.ts +0 -7
- package/dist/commands/ddl.js +0 -118
- package/dist/commands/ddl.js.map +0 -1
- package/dist/commands/diff.d.ts +0 -10
- package/dist/commands/diff.js +0 -38
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/genEntities.d.ts +0 -6
- package/dist/commands/genEntities.js +0 -50
- package/dist/commands/genEntities.js.map +0 -1
- package/dist/commands/init.d.ts +0 -79
- package/dist/commands/init.js +0 -1083
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/lint.d.ts +0 -59
- package/dist/commands/lint.js +0 -358
- package/dist/commands/lint.js.map +0 -1
- package/dist/commands/options.d.ts +0 -9
- package/dist/commands/options.js +0 -48
- package/dist/commands/options.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -10
- package/dist/commands/pull.js +0 -105
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/ztdConfig.d.ts +0 -23
- package/dist/commands/ztdConfig.js +0 -216
- package/dist/commands/ztdConfig.js.map +0 -1
- package/dist/commands/ztdConfigCommand.d.ts +0 -5
- package/dist/commands/ztdConfigCommand.js +0 -157
- package/dist/commands/ztdConfigCommand.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/utils/agents.d.ts +0 -1
- package/dist/utils/agents.js +0 -48
- package/dist/utils/agents.js.map +0 -1
- package/dist/utils/collectSqlFiles.d.ts +0 -9
- package/dist/utils/collectSqlFiles.js +0 -58
- package/dist/utils/collectSqlFiles.js.map +0 -1
- package/dist/utils/connectionSummary.d.ts +0 -3
- package/dist/utils/connectionSummary.js +0 -29
- package/dist/utils/connectionSummary.js.map +0 -1
- package/dist/utils/dbConnection.d.ts +0 -29
- package/dist/utils/dbConnection.js +0 -210
- package/dist/utils/dbConnection.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -1
- package/dist/utils/fs.js +0 -12
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/normalizePulledSchema.d.ts +0 -12
- package/dist/utils/normalizePulledSchema.js +0 -213
- package/dist/utils/normalizePulledSchema.js.map +0 -1
- package/dist/utils/optionalDependencies.d.ts +0 -35
- package/dist/utils/optionalDependencies.js +0 -96
- package/dist/utils/optionalDependencies.js.map +0 -1
- package/dist/utils/pgDump.d.ts +0 -11
- package/dist/utils/pgDump.js +0 -55
- package/dist/utils/pgDump.js.map +0 -1
- package/dist/utils/sqlLintHelpers.d.ts +0 -18
- package/dist/utils/sqlLintHelpers.js +0 -270
- package/dist/utils/sqlLintHelpers.js.map +0 -1
- package/dist/utils/typeMapper.d.ts +0 -4
- package/dist/utils/typeMapper.js +0 -76
- package/dist/utils/typeMapper.js.map +0 -1
- package/dist/utils/ztdProjectConfig.d.ts +0 -40
- package/dist/utils/ztdProjectConfig.js +0 -167
- package/dist/utils/ztdProjectConfig.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.d.ts +0 -38
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.js +0 -117
- package/templates/dist/drivers/pg-testkit/src/driver/PgTestkitClient.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.d.ts +0 -4
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.js +0 -71
- package/templates/dist/drivers/pg-testkit/src/driver/createPgTestkitPool.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/index.d.ts +0 -5
- package/templates/dist/drivers/pg-testkit/src/index.js +0 -11
- package/templates/dist/drivers/pg-testkit/src/index.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.d.ts +0 -3
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.js +0 -79
- package/templates/dist/drivers/pg-testkit/src/proxy/wrapPgClient.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/types.d.ts +0 -69
- package/templates/dist/drivers/pg-testkit/src/types.js +0 -3
- package/templates/dist/drivers/pg-testkit/src/types.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.d.ts +0 -15
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.js +0 -34
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureState.js.map +0 -1
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.d.ts +0 -12
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.js +0 -53
- package/templates/dist/drivers/pg-testkit/src/utils/fixtureValidation.js.map +0 -1
- package/templates/dist/mapper-core/src/index.d.ts +0 -160
- package/templates/dist/mapper-core/src/index.js +0 -637
- package/templates/dist/mapper-core/src/index.js.map +0 -1
- package/templates/dist/testkit-core/src/errors/index.d.ts +0 -49
- package/templates/dist/testkit-core/src/errors/index.js +0 -111
- package/templates/dist/testkit-core/src/errors/index.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.d.ts +0 -5
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.js +0 -29
- package/templates/dist/testkit-core/src/fixtures/ColumnAffinity.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.d.ts +0 -37
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.js +0 -182
- package/templates/dist/testkit-core/src/fixtures/DdlFixtureLoader.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.d.ts +0 -20
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.js +0 -121
- package/templates/dist/testkit-core/src/fixtures/FixtureProvider.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.d.ts +0 -51
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.js +0 -199
- package/templates/dist/testkit-core/src/fixtures/FixtureStore.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.d.ts +0 -10
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.js +0 -28
- package/templates/dist/testkit-core/src/fixtures/TableDefinitionSchemaRegistry.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.d.ts +0 -18
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.js +0 -80
- package/templates/dist/testkit-core/src/fixtures/TableNameResolver.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/ddlLint.d.ts +0 -59
- package/templates/dist/testkit-core/src/fixtures/ddlLint.js +0 -489
- package/templates/dist/testkit-core/src/fixtures/ddlLint.js.map +0 -1
- package/templates/dist/testkit-core/src/fixtures/naming.d.ts +0 -1
- package/templates/dist/testkit-core/src/fixtures/naming.js +0 -6
- package/templates/dist/testkit-core/src/fixtures/naming.js.map +0 -1
- package/templates/dist/testkit-core/src/index.d.ts +0 -17
- package/templates/dist/testkit-core/src/index.js +0 -47
- package/templates/dist/testkit-core/src/index.js.map +0 -1
- package/templates/dist/testkit-core/src/logger/NoopLogger.d.ts +0 -8
- package/templates/dist/testkit-core/src/logger/NoopLogger.js +0 -16
- package/templates/dist/testkit-core/src/logger/NoopLogger.js.map +0 -1
- package/templates/dist/testkit-core/src/provider/TestkitProvider.d.ts +0 -57
- package/templates/dist/testkit-core/src/provider/TestkitProvider.js +0 -149
- package/templates/dist/testkit-core/src/provider/TestkitProvider.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.d.ts +0 -43
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.js +0 -473
- package/templates/dist/testkit-core/src/rewriter/ResultSelectRewriter.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.d.ts +0 -9
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.js +0 -38
- package/templates/dist/testkit-core/src/rewriter/SelectAnalyzer.js.map +0 -1
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.d.ts +0 -42
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.js +0 -298
- package/templates/dist/testkit-core/src/rewriter/SelectFixtureRewriter.js.map +0 -1
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.d.ts +0 -12
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.js +0 -63
- package/templates/dist/testkit-core/src/sql/SqliteValuesBuilder.js.map +0 -1
- package/templates/dist/testkit-core/src/types/index.d.ts +0 -69
- package/templates/dist/testkit-core/src/types/index.js +0 -3
- package/templates/dist/testkit-core/src/types/index.js.map +0 -1
- package/templates/dist/testkit-core/src/utils/queryHelpers.d.ts +0 -28
- package/templates/dist/testkit-core/src/utils/queryHelpers.js +0 -81
- package/templates/dist/testkit-core/src/utils/queryHelpers.js.map +0 -1
- package/templates/dist/writer-core/src/index.d.ts +0 -34
- package/templates/dist/writer-core/src/index.js +0 -115
- package/templates/dist/writer-core/src/index.js.map +0 -1
- package/templates/dist/ztd-cli/templates/src/db/sql-client.d.ts +0 -20
- package/templates/dist/ztd-cli/templates/src/db/sql-client.js +0 -3
- package/templates/dist/ztd-cli/templates/src/db/sql-client.js.map +0 -1
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.d.ts +0 -36
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.js +0 -85
- package/templates/dist/ztd-cli/templates/src/repositories/user-accounts.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.d.ts +0 -20
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.js +0 -33
- package/templates/dist/ztd-cli/templates/tests/generated/ztd-row-map.generated.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.d.ts +0 -10
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.js +0 -29
- package/templates/dist/ztd-cli/templates/tests/support/global-setup.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.d.ts +0 -66
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.js +0 -552
- package/templates/dist/ztd-cli/templates/tests/support/testkit-client.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.d.ts +0 -1
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.js +0 -82
- package/templates/dist/ztd-cli/templates/tests/user-profiles.test.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.d.ts +0 -1
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.js +0 -29
- package/templates/dist/ztd-cli/templates/tests/writer-constraints.test.js.map +0 -1
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.d.ts +0 -7
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.js +0 -10
- package/templates/dist/ztd-cli/templates/tests/ztd-layout.generated.js.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.runGenerateEntities = runGenerateEntities;
|
|
7
|
-
const node_fs_1 = require("node:fs");
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const collectSqlFiles_1 = require("../utils/collectSqlFiles");
|
|
10
|
-
const fs_1 = require("../utils/fs");
|
|
11
|
-
const typeMapper_1 = require("../utils/typeMapper");
|
|
12
|
-
const ztdConfig_1 = require("./ztdConfig");
|
|
13
|
-
function runGenerateEntities(options) {
|
|
14
|
-
const sources = (0, collectSqlFiles_1.collectSqlFiles)(options.directories, options.extensions);
|
|
15
|
-
if (sources.length === 0) {
|
|
16
|
-
throw new Error(`No SQL files were discovered under ${options.directories.join(', ')}`);
|
|
17
|
-
}
|
|
18
|
-
const tables = (0, ztdConfig_1.snapshotTableMetadata)(sources);
|
|
19
|
-
if (tables.length === 0) {
|
|
20
|
-
throw new Error('The provided DDL sources did not contain any CREATE TABLE statements.');
|
|
21
|
-
}
|
|
22
|
-
const output = renderEntitiesFile(tables);
|
|
23
|
-
(0, fs_1.ensureDirectory)(node_path_1.default.dirname(options.out));
|
|
24
|
-
(0, node_fs_1.writeFileSync)(options.out, output, 'utf8');
|
|
25
|
-
console.log(`Generated ${tables.length} schema helpers at ${options.out}`);
|
|
26
|
-
}
|
|
27
|
-
function renderEntitiesFile(tables) {
|
|
28
|
-
// The header reminds maintainers that this file is a secondary reference next to tests/generated/ztd-row-map.generated.ts.
|
|
29
|
-
const header = [
|
|
30
|
-
'// ENTITY HELPERS - AUTO GENERATED',
|
|
31
|
-
'// Complementary reference for tooling. TestRowMap in tests/generated/ztd-row-map.generated.ts remains authoritative.',
|
|
32
|
-
''
|
|
33
|
-
].join('\n');
|
|
34
|
-
// Emit an interface per table to keep column metadata available for optional helpers.
|
|
35
|
-
const definitions = tables
|
|
36
|
-
.map((table) => {
|
|
37
|
-
const entityName = table.testRowInterfaceName.replace(/TestRow$/, 'Entity');
|
|
38
|
-
const fields = table.columns
|
|
39
|
-
.map((column) => {
|
|
40
|
-
const baseType = (0, typeMapper_1.mapSqlTypeToTs)(column.typeName, `${table.name}.${column.name}`);
|
|
41
|
-
const tsType = column.isNullable ? `${baseType} | null` : baseType;
|
|
42
|
-
return ` ${column.name}: ${tsType};`;
|
|
43
|
-
})
|
|
44
|
-
.join('\n');
|
|
45
|
-
return `export interface ${entityName} {\n${fields}\n}`;
|
|
46
|
-
})
|
|
47
|
-
.join('\n\n');
|
|
48
|
-
return `${header}${definitions}\n`;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=genEntities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"genEntities.js","sourceRoot":"","sources":["../../src/commands/genEntities.ts"],"names":[],"mappings":";;;;;AAaA,kDAeC;AA5BD,qCAAwC;AACxC,0DAA6B;AAC7B,8DAA2D;AAC3D,oCAA8C;AAC9C,oDAAqD;AACrD,2CAAwE;AAQxE,SAAgB,mBAAmB,CAAC,OAAgC;IAClE,MAAM,OAAO,GAAG,IAAA,iCAAe,EAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACzE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,iCAAqB,EAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAA,oBAAe,EAAC,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,IAAA,uBAAa,EAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,MAAM,sBAAsB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAuB;IACjD,2HAA2H;IAC3H,MAAM,MAAM,GAAG;QACb,oCAAoC;QACpC,uHAAuH;QACvH,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,sFAAsF;IACtF,MAAM,WAAW,GAAG,MAAM;SACvB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC5E,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO;aACzB,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACd,MAAM,QAAQ,GAAG,IAAA,2BAAc,EAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACjF,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,QAAQ,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;YACnE,OAAO,KAAK,MAAM,CAAC,IAAI,KAAK,MAAM,GAAG,CAAC;QACxC,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,oBAAoB,UAAU,OAAO,MAAM,KAAK,CAAC;IAC1D,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,OAAO,GAAG,MAAM,GAAG,WAAW,IAAI,CAAC;AACrC,CAAC"}
|
package/dist/commands/init.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { type ZtdConfigGenerationOptions } from './ztdConfig';
|
|
3
|
-
import { type PullSchemaOptions } from './pull';
|
|
4
|
-
type PackageManager = 'pnpm' | 'npm' | 'yarn';
|
|
5
|
-
type PackageInstallKind = 'devDependencies' | 'install';
|
|
6
|
-
/**
|
|
7
|
-
* Prompt interface for interactive input during `ztd init`.
|
|
8
|
-
*/
|
|
9
|
-
export interface Prompter {
|
|
10
|
-
selectChoice(question: string, choices: string[]): Promise<number>;
|
|
11
|
-
promptInput(question: string, example?: string): Promise<string>;
|
|
12
|
-
promptInputWithDefault(question: string, defaultValue: string, example?: string): Promise<string>;
|
|
13
|
-
confirm(question: string): Promise<boolean>;
|
|
14
|
-
close(): void;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Create a readline-backed prompter that reads from stdin/stdout.
|
|
18
|
-
*/
|
|
19
|
-
export declare function createConsolePrompter(): Prompter;
|
|
20
|
-
/**
|
|
21
|
-
* Summarizes how an individual file was created during initialization.
|
|
22
|
-
*/
|
|
23
|
-
export interface FileSummary {
|
|
24
|
-
relativePath: string;
|
|
25
|
-
outcome: 'created' | 'overwritten' | 'unchanged';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Result payload for `ztd init` describing outputs and next steps.
|
|
29
|
-
*/
|
|
30
|
-
export interface InitResult {
|
|
31
|
-
summary: string;
|
|
32
|
-
files: FileSummary[];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Dependency overrides used to orchestrate the init flow and IO side effects.
|
|
36
|
-
*/
|
|
37
|
-
export interface ZtdConfigWriterDependencies {
|
|
38
|
-
ensureDirectory: (directory: string) => void;
|
|
39
|
-
writeFile: (filePath: string, contents: string) => void;
|
|
40
|
-
fileExists: (filePath: string) => boolean;
|
|
41
|
-
runPullSchema: (options: PullSchemaOptions) => Promise<void> | void;
|
|
42
|
-
runGenerateZtdConfig: (options: ZtdConfigGenerationOptions) => Promise<void> | void;
|
|
43
|
-
checkPgDump: () => boolean;
|
|
44
|
-
log: (message: string) => void;
|
|
45
|
-
copyAgentsTemplate: (rootDir: string) => string | null;
|
|
46
|
-
installPackages: (options: {
|
|
47
|
-
rootDir: string;
|
|
48
|
-
kind: PackageInstallKind;
|
|
49
|
-
packages: string[];
|
|
50
|
-
packageManager: PackageManager;
|
|
51
|
-
}) => Promise<void> | void;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Options for configuring the `ztd init` command execution.
|
|
55
|
-
*/
|
|
56
|
-
export interface InitCommandOptions {
|
|
57
|
-
rootDir?: string;
|
|
58
|
-
dependencies?: Partial<ZtdConfigWriterDependencies>;
|
|
59
|
-
withSqlClient?: boolean;
|
|
60
|
-
withAppInterface?: boolean;
|
|
61
|
-
forceOverwrite?: boolean;
|
|
62
|
-
nonInteractive?: boolean;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Run the interactive `ztd init` workflow and return the resulting summary.
|
|
66
|
-
*/
|
|
67
|
-
export declare function runInitCommand(prompter: Prompter, options?: InitCommandOptions): Promise<InitResult>;
|
|
68
|
-
/**
|
|
69
|
-
* Normalizes a schema identifier into the canonical lowercase form used by ztd-cli file naming.
|
|
70
|
-
* Empty input falls back to the configured default schema.
|
|
71
|
-
*/
|
|
72
|
-
export declare function normalizeSchemaName(value: string): string;
|
|
73
|
-
/**
|
|
74
|
-
* Sanitizes a normalized schema identifier so it can be used as a filesystem-safe file stem.
|
|
75
|
-
* Returns `schema` when all characters are stripped by sanitization.
|
|
76
|
-
*/
|
|
77
|
-
export declare function sanitizeSchemaFileName(schemaName: string): string;
|
|
78
|
-
export declare function registerInitCommand(program: Command): void;
|
|
79
|
-
export {};
|