@cobol-ts/cli-init 0.0.0-stage → 0.0.57
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 +16 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/src/init.assets.d.ts +2 -0
- package/dist/src/init.assets.js +9 -0
- package/dist/src/init.assets.js.map +1 -0
- package/dist/src/init.assets.spec.d.ts +1 -0
- package/dist/src/init.assets.spec.js +39 -0
- package/dist/src/init.assets.spec.js.map +1 -0
- package/dist/src/init.crypto.d.ts +3 -0
- package/dist/src/init.crypto.js +41 -0
- package/dist/src/init.crypto.js.map +1 -0
- package/dist/src/init.d.ts +15 -0
- package/dist/src/init.destination.d.ts +18 -0
- package/dist/src/init.destination.js +32 -0
- package/dist/src/init.destination.js.map +1 -0
- package/dist/src/init.destination.spec.d.ts +1 -0
- package/dist/src/init.destination.spec.js +18 -0
- package/dist/src/init.destination.spec.js.map +1 -0
- package/dist/src/init.js +76 -0
- package/dist/src/init.js.map +1 -0
- package/dist/src/init.project.d.ts +11 -0
- package/dist/src/init.project.js +140 -0
- package/dist/src/init.project.js.map +1 -0
- package/dist/src/init.project.spec.d.ts +1 -0
- package/dist/src/init.project.spec.js +108 -0
- package/dist/src/init.project.spec.js.map +1 -0
- package/index.ts +6 -0
- package/init/.cobolts/accumulator.yaml +13 -0
- package/init/.cobolts/ai.yaml +126 -0
- package/init/.cobolts/characteristics.yaml +13 -0
- package/init/.cobolts/cobolts.yaml +11 -0
- package/init/.cobolts/compaction.yaml +12 -0
- package/init/.cobolts/crypto.yaml +16 -0
- package/init/.cobolts/data.yaml +7 -0
- package/init/.cobolts/extractions.yaml +76 -0
- package/init/.cobolts/files.yaml +78 -0
- package/init/.cobolts/generation.yaml +14 -0
- package/init/.cobolts/graph.yaml +100 -0
- package/init/.cobolts/historical-accumulator.yaml +10 -0
- package/init/.cobolts/icons/analyst.svg +1 -0
- package/init/.cobolts/icons/assistant.svg +1 -0
- package/init/.cobolts/icons/creator.svg +1 -0
- package/init/.cobolts/icons/daily.svg +1 -0
- package/init/.cobolts/icons/graph-validator.svg +1 -0
- package/init/.cobolts/icons/monthly.svg +1 -0
- package/init/.cobolts/icons/optimiser.svg +1 -0
- package/init/.cobolts/icons/researcher.svg +1 -0
- package/init/.cobolts/icons/review-validator.svg +1 -0
- package/init/.cobolts/icons/reviewer.svg +1 -0
- package/init/.cobolts/mock.ai.yaml +162 -0
- package/init/.cobolts/oracle.yaml +10 -0
- package/init/.cobolts/prompts/available-inputs.md +6 -0
- package/init/.cobolts/prompts/generate-system.md +11 -0
- package/init/.cobolts/prompts/global-hints.md +16 -0
- package/init/.cobolts/prompts/graph-semantics.md +28 -0
- package/init/.cobolts/prompts/graph-types.md +60 -0
- package/init/.cobolts/prompts/identification-create.md +5 -0
- package/init/.cobolts/prompts/identification-knowledge.md +122 -0
- package/init/.cobolts/prompts/review-system.md +13 -0
- package/init/.cobolts/prompts/target-characteristic.md +5 -0
- package/init/.cobolts/replay.yaml +6 -0
- package/init/.cobolts/runners/creator-reviewer.yaml +40 -0
- package/init/.cobolts/runners/creator-validator.yaml +22 -0
- package/init/README.md +298 -0
- package/init/characteristics/account-characteristics.xlsx.base64 +89 -0
- package/init/characteristics/input-characteristics.xlsx.base64 +75 -0
- package/init/characteristics/output-characteristics.xlsx.base64 +80 -0
- package/init/characteristics/sme-comments.yaml +40 -0
- package/init/copybooks/ACCOUNT.cpy +6 -0
- package/init/copybooks/CUSTOMER.cpy +5 -0
- package/init/data/account-to-customer.csv +6 -0
- package/init/data/accounts.fb.base64 +2 -0
- package/init/data/customers.fb.base64 +1 -0
- package/init/data/previous-state.igs.base64 +1 -0
- package/init/data/sicCodes.csv +6 -0
- package/init/expected/productionDaily.jsonl +5 -0
- package/init/expected/productionMonthly.jsonl +5 -0
- package/init/expected/productionMonthlyHistorical.jsonl +5 -0
- package/init/test_data/.gitattributes +1 -0
- package/init/test_data/README.md +16 -0
- package/init/test_data/productionDaily/2026-01-01/account-to-customer.csv +6 -0
- package/init/test_data/productionDaily/2026-01-01/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-01-01/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-01-01/oracleDaily.jsonl +5 -0
- package/init/test_data/productionDaily/2026-01-14/account-to-customer.csv +7 -0
- package/init/test_data/productionDaily/2026-01-14/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-01-14/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-01-14/oracleDaily.jsonl +5 -0
- package/init/test_data/productionDaily/2026-02-01/account-to-customer.csv +7 -0
- package/init/test_data/productionDaily/2026-02-01/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-02-01/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-02-01/oracleDaily.jsonl +5 -0
- package/init/test_data/productionDaily/2026-02-14/account-to-customer.csv +6 -0
- package/init/test_data/productionDaily/2026-02-14/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-02-14/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-02-14/oracleDaily.jsonl +5 -0
- package/init/test_data/productionDaily/2026-03-01/account-to-customer.csv +8 -0
- package/init/test_data/productionDaily/2026-03-01/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-03-01/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-03-01/oracleDaily.jsonl +5 -0
- package/init/test_data/productionDaily/2026-03-14/account-to-customer.csv +6 -0
- package/init/test_data/productionDaily/2026-03-14/accounts.fb +0 -0
- package/init/test_data/productionDaily/2026-03-14/customers.fb +1 -0
- package/init/test_data/productionDaily/2026-03-14/oracleDaily.jsonl +5 -0
- package/init/test_data/productionMonthly/2026-01-31/account-to-customer.csv +7 -0
- package/init/test_data/productionMonthly/2026-01-31/accounts.fb +0 -0
- package/init/test_data/productionMonthly/2026-01-31/customers.fb +1 -0
- package/init/test_data/productionMonthly/2026-01-31/oracleMonthly.jsonl +5 -0
- package/init/test_data/productionMonthly/2026-02-28/account-to-customer.csv +6 -0
- package/init/test_data/productionMonthly/2026-02-28/accounts.fb +0 -0
- package/init/test_data/productionMonthly/2026-02-28/customers.fb +1 -0
- package/init/test_data/productionMonthly/2026-02-28/oracleMonthly.jsonl +5 -0
- package/init/test_data/productionMonthly/2026-03-31/account-to-customer.csv +5 -0
- package/init/test_data/productionMonthly/2026-03-31/accounts.fb +0 -0
- package/init/test_data/productionMonthly/2026-03-31/customers.fb +1 -0
- package/init/test_data/productionMonthly/2026-03-31/oracleMonthly.jsonl +5 -0
- package/package.json +72 -3
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @cobol-ts/cli-init
|
|
2
|
+
|
|
3
|
+
Tutorial project initialisation and CLI command.
|
|
4
|
+
|
|
5
|
+
Owns staging, template installation, key preparation and initial project verification. The package owns its tutorial template in `init/`. The CLI resolves it directly; the generated example project remains independent. No changes to template contents or force/dry-run semantics.
|
|
6
|
+
|
|
7
|
+
The template's `.xlsx.base64` workbooks and other encoded assets are decoded into their normal filenames during staging, before extraction or project validation. Edit the encoded template source when updating a bundled workbook; the generated project contains ordinary `.xlsx` files. Do not copy old raw spreadsheet duplicates into the template.
|
|
8
|
+
|
|
9
|
+
### Destination-independent initialisation
|
|
10
|
+
|
|
11
|
+
`initialiseDestination` accepts `InitDestination<T>` and a scoped `WithPreparedInit<T>`.
|
|
12
|
+
The policy checks for an existing project, preflights every managed asset, produces
|
|
13
|
+
CREATE/REPLACE decisions, and never publishes during a dry run. `initialiseProject`
|
|
14
|
+
is the native compatibility adapter; it still stages template decoding, extraction,
|
|
15
|
+
generation, validation and protected development key preparation on disk. Native
|
|
16
|
+
publication retains exclusive creation and atomic replacement of directory entries.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.initialiseDestination = void 0;
|
|
18
|
+
__exportStar(require("./src/init"), exports);
|
|
19
|
+
__exportStar(require("./src/init.crypto"), exports);
|
|
20
|
+
__exportStar(require("./src/init.project"), exports);
|
|
21
|
+
__exportStar(require("./src/init.assets"), exports);
|
|
22
|
+
var init_destination_1 = require("./src/init.destination");
|
|
23
|
+
Object.defineProperty(exports, "initialiseDestination", { enumerable: true, get: function () { return init_destination_1.initialiseDestination; } });
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,oDAAiC;AACjC,qDAAkC;AAClC,oDAAiC;AAEjC,2DAAuG;AAA/F,yHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initTemplateDirectory = initTemplateDirectory;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
/** Template lives beside this package, whether executing src or dist/src. */
|
|
6
|
+
function initTemplateDirectory() {
|
|
7
|
+
return (0, node_path_1.resolve)(__dirname, (0, node_path_1.basename)((0, node_path_1.dirname)(__dirname)) === 'dist' ? '../..' : '..', 'init');
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=init.assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.assets.js","sourceRoot":"","sources":["../../src/init.assets.ts"],"names":[],"mappings":";;AAGA,sDAEC;AALD,yCAAoD;AAEpD,6EAA6E;AAC7E,SAAgB,qBAAqB;IACjC,OAAO,IAAA,mBAAO,EAAC,SAAS,EAAE,IAAA,oBAAQ,EAAC,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC/F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const promises_1 = require("node:fs/promises");
|
|
4
|
+
const node_os_1 = require("node:os");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const init_assets_1 = require("./init.assets");
|
|
7
|
+
const init_project_1 = require("./init.project");
|
|
8
|
+
test('the owning package supplies the Hello Bank template and hidden configuration', async () => {
|
|
9
|
+
const directory = (0, init_assets_1.initTemplateDirectory)();
|
|
10
|
+
expect(await (0, promises_1.readFile)((0, node_path_1.join)(directory, 'README.md'), 'utf8')).toContain('Hello Bank');
|
|
11
|
+
expect(await (0, promises_1.readFile)((0, node_path_1.join)(directory, '.cobolts', 'files.yaml'), 'utf8')).toContain('customers');
|
|
12
|
+
});
|
|
13
|
+
test('the actual tutorial template decodes all three workbooks and other encoded assets before preparation', async () => {
|
|
14
|
+
const template = (0, init_assets_1.initTemplateDirectory)();
|
|
15
|
+
const root = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'cobolts-init-assets-'));
|
|
16
|
+
const destination = (0, node_path_1.join)(root, 'project');
|
|
17
|
+
try {
|
|
18
|
+
const assets = await (0, init_project_1.initFiles)(template);
|
|
19
|
+
const encoded = assets.filter(path => path.endsWith('.base64'));
|
|
20
|
+
for (const name of ['input-characteristics', 'account-characteristics', 'output-characteristics'])
|
|
21
|
+
expect(encoded).toContain((0, node_path_1.join)('characteristics', `${name}.xlsx.base64`));
|
|
22
|
+
const verify = async (directory) => {
|
|
23
|
+
for (const path of encoded) {
|
|
24
|
+
const bytes = Buffer.from(await (0, promises_1.readFile)((0, node_path_1.join)(template, path), 'utf8'), 'base64');
|
|
25
|
+
const installed = await (0, promises_1.readFile)((0, node_path_1.join)(directory, path.slice(0, -'.base64'.length)));
|
|
26
|
+
expect(installed).toEqual(bytes);
|
|
27
|
+
if (path.endsWith('.xlsx.base64'))
|
|
28
|
+
expect(installed.subarray(0, 4)).toEqual(Buffer.from([0x50, 0x4b, 3, 4]));
|
|
29
|
+
}
|
|
30
|
+
expect((await (0, init_project_1.initFiles)(directory)).some(path => path.endsWith('.base64'))).toBe(false);
|
|
31
|
+
};
|
|
32
|
+
await (0, init_project_1.initialiseProject)(template, destination, {}, verify);
|
|
33
|
+
await verify(destination);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
await (0, promises_1.rm)(root, { recursive: true, force: true });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=init.assets.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.assets.spec.js","sourceRoot":"","sources":["../../src/init.assets.spec.ts"],"names":[],"mappings":";;AAAA,+CAAsD;AACtD,qCAA8B;AAC9B,yCAA8B;AAC9B,+CAAmD;AACnD,iDAA2D;AAE3D,IAAI,CAAC,8EAA8E,EAAE,KAAK,IAAI,EAAE;IAC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the default location. */
|
|
3
|
+
export declare function prepareInitCrypto(stage: string, destination: string, force: boolean): Promise<void>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareInitCrypto = prepareInitCrypto;
|
|
4
|
+
const files_node_1 = require("@cobol-ts/files-node");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const crypto_stream_sodium_1 = require("@cobol-ts/crypto-stream-sodium");
|
|
7
|
+
const yaml_jsyaml_1 = require("@cobol-ts/yaml-jsyaml");
|
|
8
|
+
const project_crypto_1 = require("@cobol-ts/project-crypto");
|
|
9
|
+
const init_project_1 = require("./init.project");
|
|
10
|
+
const { mkdir, readFile, rm, writeFile } = files_node_1.nodeLocalFiles.promises;
|
|
11
|
+
/** Crypto identity is not a replaceable tutorial asset. Preserve existing configuration
|
|
12
|
+
* on --force, and never overwrite an orphaned key at the default location. */
|
|
13
|
+
async function prepareInitCrypto(stage, destination, force) {
|
|
14
|
+
const directory = (0, node_path_1.join)(stage, '.cobolts');
|
|
15
|
+
const keyDirectory = (0, node_path_1.join)(directory, 'dev-keys');
|
|
16
|
+
const ignoreFile = (0, node_path_1.join)(keyDirectory, '.gitignore');
|
|
17
|
+
const existingIgnore = (0, node_path_1.join)(destination, '.cobolts', 'dev-keys', '.gitignore');
|
|
18
|
+
const rules = '*\n!.gitignore\n';
|
|
19
|
+
const previous = await (0, init_project_1.existingInitFile)(existingIgnore) ? await readFile(existingIgnore, 'utf8') : '';
|
|
20
|
+
// Keep existing rules, but ensure no key file in the default directory is tracked.
|
|
21
|
+
const contents = previous.endsWith(rules) ? previous : `${previous}${previous && !previous.endsWith('\n') ? '\n' : ''}${rules}`;
|
|
22
|
+
await mkdir(keyDirectory, { recursive: true });
|
|
23
|
+
await writeFile(ignoreFile, contents);
|
|
24
|
+
const filename = (0, node_path_1.join)(directory, 'crypto.yaml');
|
|
25
|
+
const target = (0, node_path_1.join)(destination, '.cobolts', 'crypto.yaml');
|
|
26
|
+
if (force && await (0, init_project_1.existingInitFile)(target)) {
|
|
27
|
+
await rm(filename);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const parsed = yaml_jsyaml_1.jsYamlParser.parse(await readFile(filename, 'utf8'));
|
|
31
|
+
if ('errors' in parsed)
|
|
32
|
+
throw new Error('Invalid init crypto configuration');
|
|
33
|
+
const files = (0, project_crypto_1.configuredKeyFiles)(directory, (0, project_crypto_1.parseCryptoConfig)(parsed.value));
|
|
34
|
+
for (const file of Object.values(files)) {
|
|
35
|
+
const targetKey = (0, node_path_1.join)(destination, (0, node_path_1.relative)(stage, file));
|
|
36
|
+
if (await (0, init_project_1.existingInitFile)(targetKey))
|
|
37
|
+
throw new Error(`Key output already exists; refusing replacement: ${targetKey}`);
|
|
38
|
+
}
|
|
39
|
+
await (0, crypto_stream_sodium_1.generateLocalKeys)(files);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=init.crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.crypto.js","sourceRoot":"","sources":["../../src/init.crypto.ts"],"names":[],"mappings":";;AAWA,8CA0BC;AArCD,qDAAmD;AACnD,yCAAwC;AACxC,yEAAgE;AAChE,uDAAkD;AAClD,6DAA8E;AAC9E,iDAA+C;AAE/C,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAC,GAAG,2BAAc,CAAC,QAAQ,CAAA;AAEhE;8EAC8E;AACvE,KAAK,UAAU,iBAAiB,CAAC,KAAa,EAAE,WAAmB,EAAE,KAAc;IACtF,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IACzC,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,IAAA,gBAAI,EAAC,YAAY,EAAE,YAAY,CAA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AAkB,EAAC,SAAS,EAAE,IAAA,kCAAiB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5E,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,WAAW,EAAE,IAAA,oBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;QAC1D,IAAI,MAAM,IAAA,+BAAgB,EAAC,SAAS,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,oDAAoD,SAAS,EAAE,CAAC,CAAA;IACxF,CAAC;IACD,MAAM,IAAA,wCAAiB,EAAC,KAAK,CAAC,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions, Output, Diagnostic, Write } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { ProjectValidationServices } from '@cobol-ts/project-config';
|
|
4
|
+
import type { ExtractionServices } from '@cobol-ts/project-extraction';
|
|
5
|
+
import type { AiProviderRegistry } from '@cobol-ts/project-ai';
|
|
6
|
+
import type { Generate } from '@cobol-ts/project-generation';
|
|
7
|
+
export declare function prepareInitProject(projectRoot: string, services: InitServices): Promise<void>;
|
|
8
|
+
export declare function addInit(root: Command, services: InitServices, options: () => CliOptions, templateDirectory?: () => string): void;
|
|
9
|
+
export type InitServices = ProjectValidationServices & ExtractionServices & {
|
|
10
|
+
readonly aiProviders?: AiProviderRegistry;
|
|
11
|
+
readonly output: Output;
|
|
12
|
+
readonly diagnostic: Diagnostic;
|
|
13
|
+
readonly generate: Generate;
|
|
14
|
+
readonly write: Write;
|
|
15
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
readonly force?: boolean;
|
|
3
|
+
readonly dryRun?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface InitFile {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly action: 'CREATE' | 'REPLACE';
|
|
8
|
+
}
|
|
9
|
+
/** A prepared asset locator belongs to its adapter, not necessarily a directory. */
|
|
10
|
+
export interface InitDestination<T> {
|
|
11
|
+
readonly label: string;
|
|
12
|
+
/** Reject unsafe destinations; distinguish absent from existing regular assets. */
|
|
13
|
+
exists(path: string): Promise<boolean>;
|
|
14
|
+
publish(file: InitFile, prepared: T): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export type WithPreparedInit<T> = <R>(use: (prepared: T, assets: readonly string[]) => Promise<R>) => Promise<R>;
|
|
17
|
+
/** Preparation and all destination checks precede publication. No native IO. */
|
|
18
|
+
export declare function initialiseDestination<T>(destination: InitDestination<T>, options: InitOptions, prepare: WithPreparedInit<T>, report?: (file: InitFile) => void): Promise<InitFile[]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialiseDestination = initialiseDestination;
|
|
4
|
+
/** Preparation and all destination checks precede publication. No native IO. */
|
|
5
|
+
async function initialiseDestination(destination, options, prepare, report = () => { }) {
|
|
6
|
+
if (!options.force && await destination.exists('.cobolts/files.yaml'))
|
|
7
|
+
throw new Error(`Cannot initialise ${destination.label}: project already exists (.cobolts/files.yaml). Use --force to replace managed files.`);
|
|
8
|
+
return prepare(async (prepared, assets) => {
|
|
9
|
+
const conflicts = [], plan = [];
|
|
10
|
+
for (const path of assets) {
|
|
11
|
+
try {
|
|
12
|
+
const exists = await destination.exists(path);
|
|
13
|
+
if (exists && !options.force)
|
|
14
|
+
conflicts.push(`${path}: already exists`);
|
|
15
|
+
else
|
|
16
|
+
plan.push({ path, action: exists ? 'REPLACE' : 'CREATE' });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
conflicts.push(`${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (conflicts.length)
|
|
23
|
+
throw new Error(`Cannot initialise ${destination.label}:\n${conflicts.join('\n')}`);
|
|
24
|
+
for (const entry of plan) {
|
|
25
|
+
if (!options.dryRun)
|
|
26
|
+
await destination.publish(entry, prepared);
|
|
27
|
+
report(entry);
|
|
28
|
+
}
|
|
29
|
+
return plan;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=init.destination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.destination.js","sourceRoot":"","sources":["../../src/init.destination.ts"],"names":[],"mappings":";;AAkBA,sDAmBC;AApBD,gFAAgF;AACzE,KAAK,UAAU,qBAAqB,CAAI,WAA8B,EAAC,OAAmB,EAAC,OAA2B,EAAC,SAA6B,GAAE,EAAE,GAAC,CAAC;IAC7J,IAAG,CAAC,OAAO,CAAC,KAAK,IAAE,MAAM,WAAW,CAAC,MAAM,CAAC,qBAAqB,CAAC;QAC9D,MAAM,IAAI,KAAK,CAAC,qBAAqB,WAAW,CAAC,KAAK,uFAAuF,CAAC,CAAA;IAClJ,OAAO,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,EAAC,EAAE;QACpC,MAAM,SAAS,GAAU,EAAE,EAAC,IAAI,GAAY,EAAE,CAAA;QAC9C,KAAI,MAAM,IAAI,IAAI,MAAM,EAAC,CAAC;YACtB,IAAI,CAAC;gBACD,MAAM,MAAM,GAAC,MAAM,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;gBAC3C,IAAG,MAAM,IAAE,CAAC,OAAO,CAAC,KAAK;oBAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAA;;oBAC9D,IAAI,CAAC,IAAI,CAAC,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,CAAA,CAAC,CAAA,SAAS,CAAA,CAAC,CAAA,QAAQ,EAAC,CAAC,CAAA;YAC3D,CAAC;YAAA,OAAM,KAAK,EAAC,CAAC;gBAAA,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,KAAK,YAAY,KAAK,CAAA,CAAC,CAAA,KAAK,CAAC,OAAO,CAAA,CAAC,CAAA,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YAAA,CAAC;QACnG,CAAC;QACD,IAAG,SAAS,CAAC,MAAM;YAAC,MAAM,IAAI,KAAK,CAAC,qBAAqB,WAAW,CAAC,KAAK,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACvG,KAAI,MAAM,KAAK,IAAI,IAAI,EAAC,CAAC;YACrB,IAAG,CAAC,OAAO,CAAC,MAAM;gBAAC,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,EAAC,QAAQ,CAAC,CAAA;YAC5D,MAAM,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const init_destination_1 = require("./init.destination");
|
|
4
|
+
test('plans and publishes without native storage; dry run and conflicts never write', async () => {
|
|
5
|
+
const values = new Map([['existing', 'old']]);
|
|
6
|
+
const prepared = new Map([['existing', 'new'], ['created', 'value']]);
|
|
7
|
+
const stage = use => use(prepared, [...prepared.keys()]);
|
|
8
|
+
const destination = { label: 'memory', exists: async (path) => values.has(path),
|
|
9
|
+
async publish(file, assets) { values.set(file.path, assets.get(file.path)); } };
|
|
10
|
+
await expect((0, init_destination_1.initialiseDestination)(destination, {}, stage)).rejects.toThrow('existing: already exists');
|
|
11
|
+
expect([...values]).toEqual([['existing', 'old']]);
|
|
12
|
+
const plan = await (0, init_destination_1.initialiseDestination)(destination, { force: true, dryRun: true }, stage);
|
|
13
|
+
expect(plan).toEqual([{ path: 'existing', action: 'REPLACE' }, { path: 'created', action: 'CREATE' }]);
|
|
14
|
+
expect([...values]).toEqual([['existing', 'old']]);
|
|
15
|
+
expect(await (0, init_destination_1.initialiseDestination)(destination, { force: true }, stage)).toEqual(plan);
|
|
16
|
+
expect([...values]).toEqual([...prepared]);
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=init.destination.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.destination.spec.js","sourceRoot":"","sources":["../../src/init.destination.spec.ts"],"names":[],"mappings":";;AAAA,yDAAmG;AAEnG,IAAI,CAAC,+EAA+E,EAAC,KAAK,IAAE,EAAE;IAC1F,MAAM,MAAM,GAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1C,MAAM,QAAQ,GAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAC,KAAK,CAAC,EAAC,CAAC,SAAS,EAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAChE,MAAM,KAAK,GAAmC,GAAG,CAAA,EAAE,CAAA,GAAG,CAAC,QAAQ,EAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IACrF,MAAM,WAAW,GAAkC,EAAC,KAAK,EAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAA,EAAE,CAAA,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;QAClG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAC,MAAM,IAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,CAAA,CAAA,CAAC,EAAC,CAAA;IAC7E,MAAM,MAAM,CAAC,IAAA,wCAAqB,EAAC,WAAW,EAAC,EAAE,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAA;IACrG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjD,MAAM,IAAI,GAAC,MAAM,IAAA,wCAAqB,EAAC,WAAW,EAAC,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAC,KAAK,CAAC,CAAA;IAClF,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,IAAI,EAAC,UAAU,EAAC,MAAM,EAAC,SAAS,EAAC,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAC,CAAC,CAAC,CAAA;IAC3F,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjD,MAAM,CAAC,MAAM,IAAA,wCAAqB,EAAC,WAAW,EAAC,EAAC,KAAK,EAAC,IAAI,EAAC,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjF,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAA;AAC9C,CAAC,CAAC,CAAA"}
|
package/dist/src/init.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareInitProject = prepareInitProject;
|
|
4
|
+
exports.addInit = addInit;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const yaml_jsyaml_1 = require("@cobol-ts/yaml-jsyaml");
|
|
7
|
+
const characteristics_yaml_1 = require("@cobol-ts/characteristics-yaml");
|
|
8
|
+
const init_project_1 = require("./init.project");
|
|
9
|
+
const init_assets_1 = require("./init.assets");
|
|
10
|
+
const init_crypto_1 = require("./init.crypto");
|
|
11
|
+
const project_extraction_1 = require("@cobol-ts/project-extraction");
|
|
12
|
+
const project_ai_local_1 = require("@cobol-ts/project-ai-local");
|
|
13
|
+
const project_ai_local_2 = require("@cobol-ts/project-ai-local");
|
|
14
|
+
const project_ai_1 = require("@cobol-ts/project-ai");
|
|
15
|
+
const project_ai_2 = require("@cobol-ts/project-ai");
|
|
16
|
+
const project_config_1 = require("@cobol-ts/project-config");
|
|
17
|
+
/** Do not use upward discovery or user-supplied config overrides for a new project. */
|
|
18
|
+
function initPaths(projectRoot) {
|
|
19
|
+
const directory = (0, node_path_1.join)(projectRoot, '.cobolts');
|
|
20
|
+
return { projectRoot, directory, catalogue: (0, node_path_1.join)(directory, 'files.yaml'),
|
|
21
|
+
policy: (0, node_path_1.join)(directory, 'generation.yaml'), data: (0, node_path_1.join)(directory, 'data.yaml'),
|
|
22
|
+
accumulator: (0, node_path_1.join)(directory, 'accumulator.yaml') };
|
|
23
|
+
}
|
|
24
|
+
async function prepareInitProject(projectRoot, services) {
|
|
25
|
+
const paths = initPaths(projectRoot);
|
|
26
|
+
for (const name of ['input-characteristics', 'output-characteristics']) {
|
|
27
|
+
// Spreadsheet provenance must refer to the installed project, not the temporary staging directory.
|
|
28
|
+
const result = await (0, project_extraction_1.runExtraction)(yaml_jsyaml_1.jsYamlParser, paths, services, name, {}, file => (0, node_path_1.relative)(paths.directory, file).split(node_path_1.sep).join('/'));
|
|
29
|
+
await services.write((0, node_path_1.join)(paths.directory, `${name}.yaml`), result.contents);
|
|
30
|
+
services.diagnostic(result.summary);
|
|
31
|
+
}
|
|
32
|
+
const catalogues = await (0, characteristics_yaml_1.loadCharacteristicCatalogues)(paths.directory, services.read, yaml_jsyaml_1.jsYamlParser);
|
|
33
|
+
const parsedAi = yaml_jsyaml_1.jsYamlParser.parse(await services.read((0, node_path_1.join)(paths.directory, 'ai.yaml')));
|
|
34
|
+
if ('errors' in parsedAi)
|
|
35
|
+
throw new Error(parsedAi.errors.join('; '));
|
|
36
|
+
const config = (0, project_ai_1.parseAiConfiguration)(parsedAi.value);
|
|
37
|
+
for (const runner of Object.values(config.runners))
|
|
38
|
+
await (0, project_ai_local_2.readRunnerDefinition)(paths.directory, services.read, runner);
|
|
39
|
+
for (const agent of Object.values(config.agents))
|
|
40
|
+
(0, project_ai_2.renderSystemPrompt)(await (0, project_ai_2.systemPromptTemplate)(path => services.read((0, node_path_1.resolve)(paths.directory, path)), config.prompts, agent.prompt));
|
|
41
|
+
const ai = await (0, project_ai_local_1.prepareAiAt)(services, paths.directory, catalogues);
|
|
42
|
+
for (const { id } of catalogues.output.list()) {
|
|
43
|
+
// Exercise the actual template renderer and offline mock provider before publication.
|
|
44
|
+
const response = await ai.response(id);
|
|
45
|
+
if (!response.choices[0]?.message.content?.trim())
|
|
46
|
+
throw new Error(`Init mock response for ${id} is empty`);
|
|
47
|
+
}
|
|
48
|
+
services.diagnostic(`Validated AI prompt templates and ${catalogues.output.list().length} mock responses`);
|
|
49
|
+
const generation = await services.generate(paths);
|
|
50
|
+
services.diagnostic(`Generated ${generation.written.length} TypeScript artefacts`);
|
|
51
|
+
await (0, project_config_1.validateProject)(paths, services, true);
|
|
52
|
+
services.diagnostic('Validated configuration and both compositions');
|
|
53
|
+
}
|
|
54
|
+
function addInit(root, services, options, templateDirectory = init_assets_1.initTemplateDirectory) {
|
|
55
|
+
root.command('init')
|
|
56
|
+
.description('Create a self-contained COBOL-TS tutorial project')
|
|
57
|
+
.allowExcessArguments(false)
|
|
58
|
+
.option('--force', 'Replace existing project template and derived files; preserve unrelated files')
|
|
59
|
+
.option('--dry-run', 'Validate the template and report changes without modifying the destination')
|
|
60
|
+
.action(async (flags) => {
|
|
61
|
+
const global = options();
|
|
62
|
+
if (global.catalogue !== undefined || global.policy !== undefined || global.data !== undefined || global.accumulator !== undefined)
|
|
63
|
+
throw new Error('Configuration file overrides are not supported by init');
|
|
64
|
+
const target = (0, node_path_1.resolve)(global.directory ?? global.root ?? process.cwd());
|
|
65
|
+
const template = templateDirectory();
|
|
66
|
+
services.output(`${flags.dryRun ? 'Planning' : 'Initialising'} COBOL-TS project: ${target}`);
|
|
67
|
+
const plan = await (0, init_project_1.initialiseProject)(template, target, flags, async (stage, destination) => {
|
|
68
|
+
await (0, init_crypto_1.prepareInitCrypto)(stage, destination, flags.force === true);
|
|
69
|
+
await prepareInitProject(stage, services);
|
|
70
|
+
}, file => services.output(`${file.action} ${file.path.split(node_path_1.sep).join('/')}`));
|
|
71
|
+
services.output(flags.dryRun ? `Dry run: ${plan.length} files; destination unchanged` : `Initialised ${plan.length} files`);
|
|
72
|
+
if (!flags.dryRun)
|
|
73
|
+
services.output('Next: cobolts -d <project> cel evaluate 1001 --composition productionMonthly --debug');
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/init.ts"],"names":[],"mappings":";;AA2BA,gDA2BC;AAED,0BAsBC;AA7ED,yCAAsD;AAMtD,uDAAkD;AAClD,yEAA2E;AAC3E,iDAAkE;AAClE,+CAAmD;AACnD,+CAA+C;AAC/C,qEAA0D;AAC1D,iEAAsD;AACtD,iEAA+D;AAC/D,qDAAyD;AACzD,qDAA6E;AAC7E,6DAAwD;AAExD,uFAAuF;AACvF,SAAS,SAAS,CAAC,WAAmB;IAClC,MAAM,SAAS,GAAG,IAAA,gBAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAA;IAC/C,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,YAAY,CAAC;QACpE,MAAM,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,WAAW,CAAC;QAC9E,WAAW,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,kBAAkB,CA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AC,CAAA;QAC7C,CAAC,EACD,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,eAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;QAChF,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,MAAM,+BAA+B,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAA;QAC3H,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,QAAQ,CAAC,MAAM,CAAC,sFAAsF,CAAC,CAAA;IAC9H,CAAC,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type InitOptions, type InitFile } from './init.destination';
|
|
2
|
+
export type { InitOptions, InitFile } from './init.destination';
|
|
3
|
+
export type PrepareInit = (directory: string, destination: string) => Promise<void>;
|
|
4
|
+
/** Only regular files are template assets. Never traverse links. */
|
|
5
|
+
export declare function initFiles(directory: string): Promise<string[]>;
|
|
6
|
+
/** Inspect a managed destination without following symbolic links. */
|
|
7
|
+
export declare function existingInitFile(filename: string): Promise<boolean>;
|
|
8
|
+
/** Stage all derived files, validate them, then preflight every destination before writing.
|
|
9
|
+
* A failed preparation or conflict leaves the destination untouched. Dry runs only use scratch space.
|
|
10
|
+
* Publication is per file, not a transactional directory replacement. */
|
|
11
|
+
export declare function initialiseProject(template: string, target: string, options: InitOptions, prepare: PrepareInit, report?: (file: InitFile) => void): Promise<readonly InitFile[]>;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initFiles = initFiles;
|
|
4
|
+
exports.existingInitFile = existingInitFile;
|
|
5
|
+
exports.initialiseProject = initialiseProject;
|
|
6
|
+
const files_node_1 = require("@cobol-ts/files-node");
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const { copyFile, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } = files_node_1.nodeLocalFiles.promises;
|
|
10
|
+
const constants = files_node_1.nodeLocalFiles.constants;
|
|
11
|
+
const init_destination_1 = require("./init.destination");
|
|
12
|
+
async function status(path) {
|
|
13
|
+
try {
|
|
14
|
+
return await lstat(path);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error.code === 'ENOENT')
|
|
18
|
+
return undefined;
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Only regular files are template assets. Never traverse links. */
|
|
23
|
+
async function initFiles(directory) {
|
|
24
|
+
const files = [];
|
|
25
|
+
async function visit(path) {
|
|
26
|
+
for (const entry of await readdir(path, { withFileTypes: true })) {
|
|
27
|
+
const filename = (0, node_path_1.join)(path, entry.name);
|
|
28
|
+
if (entry.isDirectory())
|
|
29
|
+
await visit(filename);
|
|
30
|
+
else if (entry.isFile())
|
|
31
|
+
files.push((0, node_path_1.relative)(directory, filename));
|
|
32
|
+
else
|
|
33
|
+
throw new Error(`Unsupported template entry: ${filename}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
await visit(directory);
|
|
37
|
+
return files.sort();
|
|
38
|
+
}
|
|
39
|
+
/** Inspect all ancestors before inspecting the leaf. lstat must not traverse a symlink. */
|
|
40
|
+
async function checkDirectory(path) {
|
|
41
|
+
const parent = (0, node_path_1.dirname)(path);
|
|
42
|
+
if (parent !== path)
|
|
43
|
+
await checkDirectory(parent);
|
|
44
|
+
const entry = await status(path);
|
|
45
|
+
if (entry && (!entry.isDirectory() || entry.isSymbolicLink()))
|
|
46
|
+
throw new Error(`Not a regular directory: ${path}`);
|
|
47
|
+
}
|
|
48
|
+
/** Inspect a managed destination without following symbolic links. */
|
|
49
|
+
async function existingInitFile(filename) {
|
|
50
|
+
await checkDirectory((0, node_path_1.dirname)(filename));
|
|
51
|
+
const entry = await status(filename);
|
|
52
|
+
if (entry && !entry.isFile())
|
|
53
|
+
throw new Error(`Not a regular file: ${filename}`);
|
|
54
|
+
return entry !== undefined;
|
|
55
|
+
}
|
|
56
|
+
function inside(base, path) {
|
|
57
|
+
const rel = (0, node_path_1.relative)(base, path);
|
|
58
|
+
return rel === '' || (!(0, node_path_1.isAbsolute)(rel) && rel !== '..' && !rel.startsWith(`..${node_path_1.sep}`));
|
|
59
|
+
}
|
|
60
|
+
/** Stage all derived files, validate them, then preflight every destination before writing.
|
|
61
|
+
* A failed preparation or conflict leaves the destination untouched. Dry runs only use scratch space.
|
|
62
|
+
* Publication is per file, not a transactional directory replacement. */
|
|
63
|
+
async function initialiseProject(template, target, options, prepare, report = () => { }) {
|
|
64
|
+
const destination = (0, node_path_1.resolve)(target);
|
|
65
|
+
const source = (0, node_path_1.resolve)(template);
|
|
66
|
+
if (inside(source, destination))
|
|
67
|
+
throw new Error('Cannot initialise inside the CLI template directory');
|
|
68
|
+
await checkDirectory(source);
|
|
69
|
+
await checkDirectory(destination);
|
|
70
|
+
const assets = await initFiles(source);
|
|
71
|
+
if (assets.length === 0)
|
|
72
|
+
throw new Error(`Empty initialisation template: ${source}`);
|
|
73
|
+
const project = {
|
|
74
|
+
label: destination,
|
|
75
|
+
async exists(path) {
|
|
76
|
+
const file = (0, node_path_1.join)(destination, path);
|
|
77
|
+
await checkDirectory((0, node_path_1.dirname)(file));
|
|
78
|
+
const entry = await status(file);
|
|
79
|
+
if (entry && (!entry.isFile() || entry.isSymbolicLink()))
|
|
80
|
+
throw new Error('Not a regular file');
|
|
81
|
+
return entry !== undefined;
|
|
82
|
+
},
|
|
83
|
+
async publish(entry, stage) {
|
|
84
|
+
const file = (0, node_path_1.join)(destination, entry.path);
|
|
85
|
+
await checkDirectory((0, node_path_1.dirname)(file));
|
|
86
|
+
await mkdir((0, node_path_1.dirname)(file), { recursive: true });
|
|
87
|
+
if (entry.action === 'CREATE')
|
|
88
|
+
await copyFile((0, node_path_1.join)(stage, entry.path), file, constants.COPYFILE_EXCL);
|
|
89
|
+
else {
|
|
90
|
+
const existing = await status(file);
|
|
91
|
+
if (!existing?.isFile() || existing.isSymbolicLink())
|
|
92
|
+
throw new Error(`Not a regular file: ${file}`);
|
|
93
|
+
const scratch = await mkdtemp((0, node_path_1.join)((0, node_path_1.dirname)(file), '.cobolts-init-'));
|
|
94
|
+
try {
|
|
95
|
+
const replacement = (0, node_path_1.join)(scratch, 'replacement');
|
|
96
|
+
await copyFile((0, node_path_1.join)(stage, entry.path), replacement);
|
|
97
|
+
await rename(replacement, file);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
await rm(scratch, { recursive: true, force: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return (0, init_destination_1.initialiseDestination)(project, options, async (use) => {
|
|
106
|
+
const stage = await mkdtemp((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'cobolts-init-'));
|
|
107
|
+
try {
|
|
108
|
+
const encodedSuffix = '.base64';
|
|
109
|
+
const assetNames = new Set(assets);
|
|
110
|
+
for (const path of assets) {
|
|
111
|
+
// Prefer encoded assets over legacy binary template files during migration.
|
|
112
|
+
if (assetNames.has(path + encodedSuffix))
|
|
113
|
+
continue;
|
|
114
|
+
const encoded = path.endsWith(encodedSuffix);
|
|
115
|
+
const output = encoded ? path.slice(0, -encodedSuffix.length) : path;
|
|
116
|
+
if (!output || output.endsWith(node_path_1.sep) || output.endsWith(encodedSuffix))
|
|
117
|
+
throw new Error(`Invalid encoded template filename: ${path}`);
|
|
118
|
+
const file = (0, node_path_1.join)(stage, output);
|
|
119
|
+
await mkdir((0, node_path_1.dirname)(file), { recursive: true });
|
|
120
|
+
if (encoded) {
|
|
121
|
+
const text = (await readFile((0, node_path_1.join)(source, path), 'utf8')).replace(/\s/g, '');
|
|
122
|
+
const bytes = Buffer.from(text, 'base64');
|
|
123
|
+
// Buffer.from is permissive; require canonical Base64 instead of silently losing bytes.
|
|
124
|
+
if (bytes.toString('base64') !== text)
|
|
125
|
+
throw new Error(`Invalid Base64 template asset: ${path}`);
|
|
126
|
+
await writeFile(file, bytes, { flag: 'wx' });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
await copyFile((0, node_path_1.join)(source, path), file, constants.COPYFILE_EXCL);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
await prepare(stage, destination);
|
|
133
|
+
return await use(stage, await initFiles(stage));
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
await rm(stage, { recursive: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
}, report);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=init.project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.project.js","sourceRoot":"","sources":["../../src/init.project.ts"],"names":[],"mappings":";;AAoBA,8BAYC;AAYD,4CAKC;AAUD,8CA8DC;AAzHD,qDAAmD;AACnD,qCAA8B;AAC9B,yCAA2E;AAE3E,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,GAAG,2BAAc,CAAC,QAAQ,CAAA;AAC3G,MAAM,SAAS,GAAG,2BAAc,CAAC,SAAS,CAAA;AAE1C,yDAA4G;AAI5G,KAAK,UAAU,MAAM,CAAC,IAAY;IAC9B,IAAI,CAAC;QAAA,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;IAAA,CAAC;IAC9B,OAAO,KAAK,EAAE,CAAC;QACX,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAA;QACxE,MAAM,KAAK,CAAA;IACf,CAAC;AACL,CAAC;AAED,oEAAoE;AAC7D,KAAK,UAAU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