@t1mmen/srtd 0.0.0-next-20251227000343
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/LICENSE +21 -0
- package/README.md +363 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +50 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/apply.d.ts +2 -0
- package/dist/commands/apply.js +105 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.js +134 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/clear.d.ts +2 -0
- package/dist/commands/clear.js +161 -0
- package/dist/commands/clear.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/menu.d.ts +4 -0
- package/dist/commands/menu.js +76 -0
- package/dist/commands/menu.js.map +1 -0
- package/dist/commands/promote.d.ts +2 -0
- package/dist/commands/promote.js +181 -0
- package/dist/commands/promote.js.map +1 -0
- package/dist/commands/register.d.ts +2 -0
- package/dist/commands/register.js +192 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/watch.d.ts +14 -0
- package/dist/commands/watch.js +190 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -0
- package/dist/services/DatabaseService.d.ts +113 -0
- package/dist/services/DatabaseService.js +343 -0
- package/dist/services/DatabaseService.js.map +1 -0
- package/dist/services/FileSystemService.d.ts +100 -0
- package/dist/services/FileSystemService.js +237 -0
- package/dist/services/FileSystemService.js.map +1 -0
- package/dist/services/MigrationBuilder.d.ts +106 -0
- package/dist/services/MigrationBuilder.js +193 -0
- package/dist/services/MigrationBuilder.js.map +1 -0
- package/dist/services/Orchestrator.d.ts +155 -0
- package/dist/services/Orchestrator.js +622 -0
- package/dist/services/Orchestrator.js.map +1 -0
- package/dist/services/StateService.d.ts +169 -0
- package/dist/services/StateService.js +463 -0
- package/dist/services/StateService.js.map +1 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/badge.d.ts +14 -0
- package/dist/ui/badge.js +28 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/branding.d.ts +9 -0
- package/dist/ui/branding.js +35 -0
- package/dist/ui/branding.js.map +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.js +5 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/results.d.ts +10 -0
- package/dist/ui/results.js +62 -0
- package/dist/ui/results.js.map +1 -0
- package/dist/ui/spinner.d.ts +5 -0
- package/dist/ui/spinner.js +8 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/utils/config.d.ts +12 -0
- package/dist/utils/config.js +67 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/createEmptyBuildLog.d.ts +1 -0
- package/dist/utils/createEmptyBuildLog.js +10 -0
- package/dist/utils/createEmptyBuildLog.js.map +1 -0
- package/dist/utils/ensureDirectories.d.ts +4 -0
- package/dist/utils/ensureDirectories.js +23 -0
- package/dist/utils/ensureDirectories.js.map +1 -0
- package/dist/utils/fileExists.d.ts +1 -0
- package/dist/utils/fileExists.js +11 -0
- package/dist/utils/fileExists.js.map +1 -0
- package/dist/utils/findProjectRoot.d.ts +1 -0
- package/dist/utils/findProjectRoot.js +25 -0
- package/dist/utils/findProjectRoot.js.map +1 -0
- package/dist/utils/getErrorMessage.d.ts +9 -0
- package/dist/utils/getErrorMessage.js +14 -0
- package/dist/utils/getErrorMessage.js.map +1 -0
- package/dist/utils/getNextTimestamp.d.ts +2 -0
- package/dist/utils/getNextTimestamp.js +12 -0
- package/dist/utils/getNextTimestamp.js.map +1 -0
- package/dist/utils/isWipTemplate.d.ts +1 -0
- package/dist/utils/isWipTemplate.js +6 -0
- package/dist/utils/isWipTemplate.js.map +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/safeCreate.d.ts +1 -0
- package/dist/utils/safeCreate.js +16 -0
- package/dist/utils/safeCreate.js.map +1 -0
- package/package.json +106 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
// src/commands/promote.ts
|
|
54
|
+
import path from 'node:path';
|
|
55
|
+
import { select } from '@inquirer/prompts';
|
|
56
|
+
import chalk from 'chalk';
|
|
57
|
+
import { Command } from 'commander';
|
|
58
|
+
import figures from 'figures';
|
|
59
|
+
import { glob } from 'glob';
|
|
60
|
+
import { Orchestrator } from '../services/Orchestrator.js';
|
|
61
|
+
import { createSpinner, renderBranding } from '../ui/index.js';
|
|
62
|
+
import { getConfig } from '../utils/config.js';
|
|
63
|
+
import { findProjectRoot } from '../utils/findProjectRoot.js';
|
|
64
|
+
import { getErrorMessage, isPromptExit } from '../utils/getErrorMessage.js';
|
|
65
|
+
async function findWipTemplates(config, projectRoot) {
|
|
66
|
+
const templatePath = path.join(projectRoot, config.templateDir);
|
|
67
|
+
const pattern = `**/*${config.wipIndicator}*.sql`;
|
|
68
|
+
const matches = await glob(pattern, { cwd: templatePath });
|
|
69
|
+
return matches.map(m => path.join(templatePath, m));
|
|
70
|
+
}
|
|
71
|
+
async function promoteTemplateAction(templatePath, orchestrator) {
|
|
72
|
+
const spinner = createSpinner('Promoting template...').start();
|
|
73
|
+
try {
|
|
74
|
+
// Use Orchestrator for promotion (single source of truth)
|
|
75
|
+
const newPath = await orchestrator.promoteTemplate(templatePath);
|
|
76
|
+
const templateName = path.basename(newPath, '.sql');
|
|
77
|
+
spinner.succeed(`Successfully promoted ${templateName}`);
|
|
78
|
+
console.log(chalk.dim('Run `build` command to generate migrations'));
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
spinner.fail('Failed to promote template');
|
|
83
|
+
console.log(chalk.red(`${figures.cross} ${getErrorMessage(err)}`));
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function handleTemplatePromotion(templateName, config, projectRoot, orchestrator) {
|
|
88
|
+
const templateDir = path.join(projectRoot, config.templateDir);
|
|
89
|
+
const pattern = `**/*${templateName}*`;
|
|
90
|
+
const matches = await glob(pattern, { cwd: templateDir });
|
|
91
|
+
const isWip = config.wipIndicator && templateName?.includes(config.wipIndicator);
|
|
92
|
+
if (matches.length === 0 || !isWip) {
|
|
93
|
+
console.log();
|
|
94
|
+
console.log(chalk.red(`${figures.cross} No WIP template found matching: ${templateName} in ${config.templateDir}`));
|
|
95
|
+
return 1;
|
|
96
|
+
}
|
|
97
|
+
if (!isWip) {
|
|
98
|
+
console.log();
|
|
99
|
+
console.log(chalk.red(`${figures.cross} Template is not a WIP template: ${templateName}`));
|
|
100
|
+
return 1;
|
|
101
|
+
}
|
|
102
|
+
const match = matches[0] ? path.join(templateDir, matches[0]) : '';
|
|
103
|
+
if (!match) {
|
|
104
|
+
console.log();
|
|
105
|
+
console.log(chalk.red(`${figures.cross} No valid match found for template: ${templateName} in ${config.templateDir}`));
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
108
|
+
return promoteTemplateAction(match, orchestrator);
|
|
109
|
+
}
|
|
110
|
+
export const promoteCommand = new Command('promote')
|
|
111
|
+
.description('Promote a WIP template by removing the WIP indicator from its filename')
|
|
112
|
+
.argument('[template]', 'Template file to promote (optional)')
|
|
113
|
+
.action(async (templateArg) => {
|
|
114
|
+
let exitCode = 0;
|
|
115
|
+
try {
|
|
116
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
117
|
+
try {
|
|
118
|
+
await renderBranding({ subtitle: 'Promote WIP template' });
|
|
119
|
+
// Get configuration and initialize Orchestrator
|
|
120
|
+
const projectRoot = await findProjectRoot();
|
|
121
|
+
const config = await getConfig(projectRoot);
|
|
122
|
+
const orchestrator = __addDisposableResource(env_1, await Orchestrator.create(projectRoot, config, { silent: true }), true);
|
|
123
|
+
// If template was provided as argument, promote it directly
|
|
124
|
+
if (templateArg) {
|
|
125
|
+
exitCode = await handleTemplatePromotion(templateArg, config, projectRoot, orchestrator);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// Find WIP templates for interactive selection
|
|
129
|
+
const spinner = createSpinner('Finding WIP templates...').start();
|
|
130
|
+
const wipTemplates = await findWipTemplates(config, projectRoot);
|
|
131
|
+
spinner.stop();
|
|
132
|
+
if (wipTemplates.length === 0) {
|
|
133
|
+
console.log(chalk.yellow(`${figures.warning} No WIP templates found in ${config.templateDir} (${config.wipIndicator})`));
|
|
134
|
+
exitCode = 0;
|
|
135
|
+
}
|
|
136
|
+
else if (!process.stdin.isTTY) {
|
|
137
|
+
// Interactive mode requires TTY
|
|
138
|
+
console.log(chalk.red(`${figures.cross} Interactive mode requires a TTY.`));
|
|
139
|
+
console.log(chalk.dim('Provide a template name as argument: srtd promote <template>'));
|
|
140
|
+
exitCode = 1;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// Show interactive selection
|
|
144
|
+
const choices = wipTemplates.map(templatePath => ({
|
|
145
|
+
name: path.basename(templatePath),
|
|
146
|
+
value: templatePath,
|
|
147
|
+
}));
|
|
148
|
+
const selectedTemplate = await select({
|
|
149
|
+
message: `Select a template to promote (removes ${config.wipIndicator} in filename):`,
|
|
150
|
+
choices,
|
|
151
|
+
});
|
|
152
|
+
exitCode = await promoteTemplateAction(selectedTemplate, orchestrator);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (e_1) {
|
|
157
|
+
env_1.error = e_1;
|
|
158
|
+
env_1.hasError = true;
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
const result_1 = __disposeResources(env_1);
|
|
162
|
+
if (result_1)
|
|
163
|
+
await result_1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
// Handle Ctrl+C gracefully
|
|
168
|
+
if (isPromptExit(error)) {
|
|
169
|
+
exitCode = 0;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
console.log();
|
|
173
|
+
console.log(chalk.red(`${figures.cross} Error promoting template:`));
|
|
174
|
+
console.log(chalk.red(getErrorMessage(error)));
|
|
175
|
+
exitCode = 1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Exit AFTER the await using block has completed, ensuring dispose() runs
|
|
179
|
+
process.exit(exitCode);
|
|
180
|
+
});
|
|
181
|
+
//# sourceMappingURL=promote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promote.js","sourceRoot":"","sources":["../../src/commands/promote.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,SAAS,E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G,OAAO,CAAC,KAAK,4BAA4B,CAAC,CAAC,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,QAAQ,GAAG,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
// src/commands/register.ts
|
|
54
|
+
import path from 'node:path';
|
|
55
|
+
import { checkbox } from '@inquirer/prompts';
|
|
56
|
+
import chalk from 'chalk';
|
|
57
|
+
import { Command } from 'commander';
|
|
58
|
+
import figures from 'figures';
|
|
59
|
+
import { Orchestrator } from '../services/Orchestrator.js';
|
|
60
|
+
import { createSpinner, renderBranding } from '../ui/index.js';
|
|
61
|
+
import { getConfig } from '../utils/config.js';
|
|
62
|
+
import { findProjectRoot } from '../utils/findProjectRoot.js';
|
|
63
|
+
import { getErrorMessage, isPromptExit } from '../utils/getErrorMessage.js';
|
|
64
|
+
async function handleTemplateRegistration(templates, orchestrator, projectRoot) {
|
|
65
|
+
let successCount = 0;
|
|
66
|
+
let failCount = 0;
|
|
67
|
+
const spinner = createSpinner('Registering templates...').start();
|
|
68
|
+
for (const templatePath of templates) {
|
|
69
|
+
try {
|
|
70
|
+
// Use Orchestrator for registration (single source of truth)
|
|
71
|
+
await orchestrator.registerTemplate(templatePath);
|
|
72
|
+
successCount++;
|
|
73
|
+
const relativePath = path.relative(projectRoot, templatePath);
|
|
74
|
+
spinner.text = `Registered: ${relativePath}`;
|
|
75
|
+
console.log(chalk.green(`✓ Registered template:`), relativePath);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
failCount++;
|
|
79
|
+
spinner.warn(`Failed: ${templatePath} - ${getErrorMessage(err)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
spinner.stop();
|
|
83
|
+
console.log();
|
|
84
|
+
if (successCount > 0) {
|
|
85
|
+
console.log(chalk.green(`${figures.tick} Successfully registered ${successCount} template(s)`));
|
|
86
|
+
}
|
|
87
|
+
if (failCount > 0) {
|
|
88
|
+
console.log(chalk.red(`${figures.cross} Failed to register ${failCount} template(s)`));
|
|
89
|
+
}
|
|
90
|
+
return failCount > 0 ? 1 : 0;
|
|
91
|
+
}
|
|
92
|
+
export const registerCommand = new Command('register')
|
|
93
|
+
.description('Register templates to track them in the build log')
|
|
94
|
+
.argument('[templates...]', 'Template files to register (optional)')
|
|
95
|
+
.action(async (templateArgs) => {
|
|
96
|
+
let exitCode = 0;
|
|
97
|
+
try {
|
|
98
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
99
|
+
try {
|
|
100
|
+
await renderBranding({ subtitle: 'Register templates' });
|
|
101
|
+
// Initialize Orchestrator and get templates
|
|
102
|
+
const projectRoot = await findProjectRoot();
|
|
103
|
+
const config = await getConfig(projectRoot);
|
|
104
|
+
const orchestrator = __addDisposableResource(env_1, await Orchestrator.create(projectRoot, config, { silent: true }), true);
|
|
105
|
+
// If templates were provided as arguments, register them directly
|
|
106
|
+
if (templateArgs?.length) {
|
|
107
|
+
// Resolve template paths (may be relative)
|
|
108
|
+
const resolvedPaths = templateArgs.map(t => path.resolve(projectRoot, t));
|
|
109
|
+
exitCode = await handleTemplateRegistration(resolvedPaths, orchestrator, projectRoot);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
// Load templates for interactive selection
|
|
113
|
+
const spinner = createSpinner('Loading templates...').start();
|
|
114
|
+
const templatePaths = await orchestrator.findTemplates();
|
|
115
|
+
const templates = [];
|
|
116
|
+
for (const templatePath of templatePaths) {
|
|
117
|
+
try {
|
|
118
|
+
const template = await orchestrator.getTemplateStatusExternal(templatePath);
|
|
119
|
+
templates.push(template);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
// Skip templates that can't be loaded
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
spinner.stop();
|
|
126
|
+
// Filter to unregistered templates by default
|
|
127
|
+
const unregisteredTemplates = templates
|
|
128
|
+
.filter(t => !t.buildState.lastMigrationFile)
|
|
129
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
130
|
+
if (unregisteredTemplates.length === 0) {
|
|
131
|
+
if (templates.length === 0) {
|
|
132
|
+
console.log(chalk.yellow(`${figures.warning} No templates found`));
|
|
133
|
+
console.log(chalk.dim(`${figures.info} Start by creating a template in the templates directory.`));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log(chalk.yellow(`${figures.warning} No unregistered templates found`));
|
|
137
|
+
console.log(chalk.dim(`${figures.info} All ${templates.length} template(s) are already registered.`));
|
|
138
|
+
}
|
|
139
|
+
exitCode = 0;
|
|
140
|
+
}
|
|
141
|
+
else if (!process.stdin.isTTY) {
|
|
142
|
+
// Interactive mode requires TTY
|
|
143
|
+
console.log(chalk.red(`${figures.cross} Interactive mode requires a TTY.`));
|
|
144
|
+
console.log(chalk.dim('Provide template paths as arguments: srtd register <template1> <template2>'));
|
|
145
|
+
exitCode = 1;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Show interactive multi-select
|
|
149
|
+
const choices = unregisteredTemplates.map(template => ({
|
|
150
|
+
name: `${template.name} (new)`,
|
|
151
|
+
value: template.path,
|
|
152
|
+
}));
|
|
153
|
+
const selectedTemplates = await checkbox({
|
|
154
|
+
message: 'Select templates to register:',
|
|
155
|
+
choices,
|
|
156
|
+
});
|
|
157
|
+
if (selectedTemplates.length === 0) {
|
|
158
|
+
console.log(chalk.yellow(`${figures.warning} No templates selected`));
|
|
159
|
+
exitCode = 0;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
exitCode = await handleTemplateRegistration(selectedTemplates, orchestrator, projectRoot);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (e_1) {
|
|
168
|
+
env_1.error = e_1;
|
|
169
|
+
env_1.hasError = true;
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
const result_1 = __disposeResources(env_1);
|
|
173
|
+
if (result_1)
|
|
174
|
+
await result_1;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
// Handle Ctrl+C gracefully
|
|
179
|
+
if (isPromptExit(error)) {
|
|
180
|
+
exitCode = 0;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
console.log();
|
|
184
|
+
console.log(chalk.red(`${figures.cross} Error loading templates:`));
|
|
185
|
+
console.log(chalk.red(getErrorMessage(error)));
|
|
186
|
+
exitCode = 1;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Exit AFTER the await using block has completed, ensuring dispose() runs
|
|
190
|
+
process.exit(exitCode);
|
|
191
|
+
});
|
|
192
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/commands/register.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA2B;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1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H,CAAC;YACH,CAAC;;;;;;;;;;;KACF;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2BAA2B;QAC3B,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,QAAQ,GAAG,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,2BAA2B,CAAC,CAAC,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/C,QAAQ,GAAG,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,0EAA0E;IAC1E,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { TemplateStatus } from '../types.js';
|
|
3
|
+
interface TemplateUpdate {
|
|
4
|
+
type: 'applied' | 'changed' | 'error';
|
|
5
|
+
template: TemplateStatus;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Formats an ISO date string as a relative time (e.g., "5m ago") */
|
|
10
|
+
export declare function formatRelativeTime(isoDate: string): string;
|
|
11
|
+
/** Renders the full watch mode screen with header, history, errors, and instructions */
|
|
12
|
+
export declare function renderScreen(templates: TemplateStatus[], recentUpdates: TemplateUpdate[], errors: Map<string, string>, templateDir: string, showHistory: boolean): void;
|
|
13
|
+
export declare const watchCommand: Command;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/commands/watch.ts
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import readline from 'node:readline';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import figures from 'figures';
|
|
7
|
+
import { Orchestrator } from '../services/Orchestrator.js';
|
|
8
|
+
import { createSpinner, renderBranding } from '../ui/index.js';
|
|
9
|
+
import { getConfig } from '../utils/config.js';
|
|
10
|
+
import { findProjectRoot } from '../utils/findProjectRoot.js';
|
|
11
|
+
import { getErrorMessage } from '../utils/getErrorMessage.js';
|
|
12
|
+
const PATH_DISPLAY_LENGTH = 15;
|
|
13
|
+
const MAX_HISTORY = 10;
|
|
14
|
+
/** Formats an ISO date string as a relative time (e.g., "5m ago") */
|
|
15
|
+
export function formatRelativeTime(isoDate) {
|
|
16
|
+
const seconds = Math.floor((Date.now() - new Date(isoDate).getTime()) / 1000);
|
|
17
|
+
if (seconds < 5)
|
|
18
|
+
return 'just now';
|
|
19
|
+
if (seconds < 60)
|
|
20
|
+
return `${seconds}s ago`;
|
|
21
|
+
if (seconds < 3600)
|
|
22
|
+
return `${Math.floor(seconds / 60)}m ago`;
|
|
23
|
+
if (seconds < 86400)
|
|
24
|
+
return `${Math.floor(seconds / 3600)}h ago`;
|
|
25
|
+
return `${Math.floor(seconds / 86400)}d ago`;
|
|
26
|
+
}
|
|
27
|
+
/** Renders the full watch mode screen with header, history, errors, and instructions */
|
|
28
|
+
export function renderScreen(templates, recentUpdates, errors, templateDir, showHistory) {
|
|
29
|
+
console.clear();
|
|
30
|
+
// Header with stats
|
|
31
|
+
const needsBuild = templates.filter(t => !t.buildState.lastBuildDate || t.currentHash !== t.buildState.lastBuildHash).length;
|
|
32
|
+
console.log(`${chalk.bold('srtd')}${chalk.dim(' - Watch Mode')}`);
|
|
33
|
+
console.log();
|
|
34
|
+
const needsBuildStr = needsBuild > 0 ? chalk.yellow(`[Needs Build: ${needsBuild}]`) : '';
|
|
35
|
+
const errorsStr = errors.size > 0 ? chalk.red(`[Errors: ${errors.size}]`) : '';
|
|
36
|
+
console.log(`${chalk.green(`[Total: ${templates.length}]`)} ${needsBuildStr} ${errorsStr}`);
|
|
37
|
+
console.log();
|
|
38
|
+
// History section (if toggled on)
|
|
39
|
+
if (showHistory && recentUpdates.length > 0) {
|
|
40
|
+
console.log(chalk.bold('Recent activity:'));
|
|
41
|
+
for (const update of recentUpdates) {
|
|
42
|
+
const displayName = formatTemplateDisplay(update.template.path, templateDir);
|
|
43
|
+
const time = formatRelativeTime(update.timestamp);
|
|
44
|
+
const icon = update.type === 'applied'
|
|
45
|
+
? figures.play
|
|
46
|
+
: update.type === 'error'
|
|
47
|
+
? figures.cross
|
|
48
|
+
: figures.info;
|
|
49
|
+
const color = update.type === 'applied' ? chalk.green : update.type === 'error' ? chalk.red : chalk.cyan;
|
|
50
|
+
console.log(color(` ${icon} ${displayName}: ${update.type === 'error' ? update.error : update.type} (${time})`));
|
|
51
|
+
}
|
|
52
|
+
console.log();
|
|
53
|
+
}
|
|
54
|
+
// Errors section
|
|
55
|
+
if (errors.size > 0) {
|
|
56
|
+
console.log(chalk.red.bold('Errors:'));
|
|
57
|
+
for (const [templatePath, error] of errors) {
|
|
58
|
+
console.log(chalk.red(` ${formatTemplateDisplay(templatePath, templateDir)}: ${error}`));
|
|
59
|
+
}
|
|
60
|
+
console.log();
|
|
61
|
+
}
|
|
62
|
+
// Instructions
|
|
63
|
+
console.log(chalk.dim(`Watching for changes... Press ${showHistory ? 'u to hide' : 'u to show'} history, q to quit`));
|
|
64
|
+
}
|
|
65
|
+
function formatTemplateDisplay(templatePath, templateDir) {
|
|
66
|
+
const parts = templatePath.split(path.sep);
|
|
67
|
+
const filename = parts.pop() || '';
|
|
68
|
+
const dirPath = parts.join(path.sep);
|
|
69
|
+
if (dirPath && templateDir && dirPath.includes(templateDir)) {
|
|
70
|
+
const relativePath = dirPath.substring(dirPath.indexOf(templateDir) + templateDir.length + 1);
|
|
71
|
+
if (relativePath) {
|
|
72
|
+
const truncatedPath = relativePath.slice(-PATH_DISPLAY_LENGTH);
|
|
73
|
+
return `${truncatedPath}/${filename}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return filename;
|
|
77
|
+
}
|
|
78
|
+
export const watchCommand = new Command('watch')
|
|
79
|
+
.description('Watch templates for changes and auto-apply')
|
|
80
|
+
.action(async () => {
|
|
81
|
+
const exitCode = 0;
|
|
82
|
+
let orchestrator = null;
|
|
83
|
+
try {
|
|
84
|
+
await renderBranding({ subtitle: 'Watch Mode' });
|
|
85
|
+
const spinner = createSpinner('Starting watch mode...').start();
|
|
86
|
+
// Initialize Orchestrator
|
|
87
|
+
const projectRoot = await findProjectRoot();
|
|
88
|
+
const config = await getConfig(projectRoot);
|
|
89
|
+
orchestrator = await Orchestrator.create(projectRoot, config, { silent: true });
|
|
90
|
+
// Load initial templates
|
|
91
|
+
const templatePaths = await orchestrator.findTemplates();
|
|
92
|
+
const templates = [];
|
|
93
|
+
const errors = new Map();
|
|
94
|
+
for (const templatePath of templatePaths) {
|
|
95
|
+
try {
|
|
96
|
+
const template = await orchestrator.getTemplateStatusExternal(templatePath);
|
|
97
|
+
templates.push(template);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
errors.set(templatePath, getErrorMessage(error));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
spinner.succeed(`Watching ${templates.length} template(s)`);
|
|
104
|
+
// State for history tracking
|
|
105
|
+
const recentUpdates = [];
|
|
106
|
+
let showHistory = true;
|
|
107
|
+
// Initial render
|
|
108
|
+
renderScreen(templates, recentUpdates, errors, config.templateDir, showHistory);
|
|
109
|
+
// Set up orchestrator event listeners
|
|
110
|
+
orchestrator.on('templateChanged', (template) => {
|
|
111
|
+
recentUpdates.unshift({ type: 'changed', template, timestamp: new Date().toISOString() });
|
|
112
|
+
if (recentUpdates.length > MAX_HISTORY)
|
|
113
|
+
recentUpdates.pop();
|
|
114
|
+
renderScreen(templates, recentUpdates, errors, config.templateDir, showHistory);
|
|
115
|
+
});
|
|
116
|
+
orchestrator.on('templateApplied', (template) => {
|
|
117
|
+
recentUpdates.unshift({ type: 'applied', template, timestamp: new Date().toISOString() });
|
|
118
|
+
if (recentUpdates.length > MAX_HISTORY)
|
|
119
|
+
recentUpdates.pop();
|
|
120
|
+
renderScreen(templates, recentUpdates, errors, config.templateDir, showHistory);
|
|
121
|
+
});
|
|
122
|
+
orchestrator.on('templateError', ({ template, error }) => {
|
|
123
|
+
recentUpdates.unshift({
|
|
124
|
+
type: 'error',
|
|
125
|
+
template,
|
|
126
|
+
timestamp: new Date().toISOString(),
|
|
127
|
+
error,
|
|
128
|
+
});
|
|
129
|
+
if (recentUpdates.length > MAX_HISTORY)
|
|
130
|
+
recentUpdates.pop();
|
|
131
|
+
errors.set(template.path, error);
|
|
132
|
+
renderScreen(templates, recentUpdates, errors, config.templateDir, showHistory);
|
|
133
|
+
});
|
|
134
|
+
// Start watching
|
|
135
|
+
const watcher = await orchestrator.watch({
|
|
136
|
+
silent: false,
|
|
137
|
+
initialProcess: true,
|
|
138
|
+
});
|
|
139
|
+
// Cleanup function to properly dispose
|
|
140
|
+
const cleanup = async () => {
|
|
141
|
+
console.log();
|
|
142
|
+
console.log(chalk.dim('Stopping watch mode...'));
|
|
143
|
+
await watcher.close();
|
|
144
|
+
if (orchestrator) {
|
|
145
|
+
await orchestrator.dispose();
|
|
146
|
+
}
|
|
147
|
+
process.exit(exitCode);
|
|
148
|
+
};
|
|
149
|
+
// Set up keyboard input handling for quit and toggle
|
|
150
|
+
if (process.stdin.isTTY) {
|
|
151
|
+
// Reset stdin state in case it was modified by previous prompts
|
|
152
|
+
process.stdin.setRawMode(false);
|
|
153
|
+
process.stdin.removeAllListeners('keypress');
|
|
154
|
+
process.stdin.pause();
|
|
155
|
+
// Now set up fresh keypress handling
|
|
156
|
+
readline.emitKeypressEvents(process.stdin);
|
|
157
|
+
process.stdin.setRawMode(true);
|
|
158
|
+
process.stdin.resume();
|
|
159
|
+
process.stdin.on('keypress', (_str, key) => {
|
|
160
|
+
if (key && (key.name === 'q' || (key.ctrl && key.name === 'c'))) {
|
|
161
|
+
process.stdin.setRawMode(false);
|
|
162
|
+
void cleanup();
|
|
163
|
+
}
|
|
164
|
+
if (key && key.name === 'u') {
|
|
165
|
+
showHistory = !showHistory;
|
|
166
|
+
renderScreen(templates, recentUpdates, errors, config.templateDir, showHistory);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// Handle SIGINT
|
|
171
|
+
process.on('SIGINT', () => {
|
|
172
|
+
void cleanup();
|
|
173
|
+
});
|
|
174
|
+
// Keep the process alive
|
|
175
|
+
await new Promise(() => {
|
|
176
|
+
// This promise never resolves, keeping the process alive
|
|
177
|
+
// The process will be terminated by the keyboard handler or SIGINT
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.log();
|
|
182
|
+
console.log(chalk.red(`${figures.cross} Error starting watch mode:`));
|
|
183
|
+
console.log(chalk.red(getErrorMessage(error)));
|
|
184
|
+
if (orchestrator) {
|
|
185
|
+
await orchestrator.dispose();
|
|
186
|
+
}
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAA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E,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,6BAA6B,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,YAAY,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONFIG_FILE = "srtd.config.json";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC"}
|