glugent 0.0.0-stage → 0.3.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/bin/glugent.js +2 -0
- package/dist/arguments.d.ts +14 -0
- package/dist/arguments.js +44 -0
- package/dist/arguments.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.js +102 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +11 -0
- package/dist/commands/build.js +49 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/command.d.ts +10 -0
- package/dist/commands/command.js +14 -0
- package/dist/commands/command.js.map +1 -0
- package/dist/commands/convert.d.ts +14 -0
- package/dist/commands/convert.js +85 -0
- package/dist/commands/convert.js.map +1 -0
- package/dist/commands/list.d.ts +6 -0
- package/dist/commands/list.js +19 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.js +17 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +1 -0
- package/dist/help.js +14 -0
- package/dist/help.js.map +1 -0
- package/dist/reporter.d.ts +12 -0
- package/dist/reporter.js +63 -0
- package/dist/reporter.js.map +1 -0
- package/package.json +30 -4
- package/README.md +0 -3
package/bin/glugent.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Props } from "@anweba/glugent-core";
|
|
2
|
+
/** The parsed command line: `glugent <command> [names...] [flags]`. */
|
|
3
|
+
export declare class Arguments {
|
|
4
|
+
command?: string;
|
|
5
|
+
/** Positional arguments after the command (e.g. target names). */
|
|
6
|
+
names: string[];
|
|
7
|
+
/** `--set KEY=VALUE` overrides; they win over every other prop layer. */
|
|
8
|
+
overrides: Props;
|
|
9
|
+
config?: string;
|
|
10
|
+
dryRun: boolean;
|
|
11
|
+
force: boolean;
|
|
12
|
+
static parse(argv: string[]): Arguments;
|
|
13
|
+
private addOverride;
|
|
14
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Arguments = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
/** The parsed command line: `glugent <command> [names...] [flags]`. */
|
|
6
|
+
class Arguments {
|
|
7
|
+
command;
|
|
8
|
+
/** Positional arguments after the command (e.g. target names). */
|
|
9
|
+
names = [];
|
|
10
|
+
/** `--set KEY=VALUE` overrides; they win over every other prop layer. */
|
|
11
|
+
overrides = {};
|
|
12
|
+
config;
|
|
13
|
+
dryRun = false;
|
|
14
|
+
force = false;
|
|
15
|
+
static parse(argv) {
|
|
16
|
+
const args = new Arguments();
|
|
17
|
+
for (let i = 0; i < argv.length; i++) {
|
|
18
|
+
const arg = argv[i];
|
|
19
|
+
if (arg === "--set")
|
|
20
|
+
args.addOverride(argv[++i] ?? "");
|
|
21
|
+
else if (arg === "--config" || arg === "-c")
|
|
22
|
+
args.config = argv[++i];
|
|
23
|
+
else if (arg === "--dry-run")
|
|
24
|
+
args.dryRun = true;
|
|
25
|
+
else if (arg === "--force")
|
|
26
|
+
args.force = true;
|
|
27
|
+
else if (arg === "-h" || arg === "--help")
|
|
28
|
+
args.command = "help";
|
|
29
|
+
else if (!args.command)
|
|
30
|
+
args.command = arg;
|
|
31
|
+
else
|
|
32
|
+
args.names.push(arg);
|
|
33
|
+
}
|
|
34
|
+
return args;
|
|
35
|
+
}
|
|
36
|
+
addOverride(assignment) {
|
|
37
|
+
const eq = assignment.indexOf("=");
|
|
38
|
+
if (eq < 1)
|
|
39
|
+
throw new errors_1.CliError(`--set expects KEY=VALUE, got '${assignment}'`);
|
|
40
|
+
this.overrides[assignment.slice(0, eq)] = assignment.slice(eq + 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.Arguments = Arguments;
|
|
44
|
+
//# sourceMappingURL=arguments.js.map
|
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,CAAC;IACd,CAAC;IAEO,WAAW,CAAC,UAAkB;QACpC,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,EAAE,GAAG,CAAC;YAAE,MAAM,IAAI,iBAAQ,CAAC,iCAAiC,UAAU,GAAG,CAAC,CAAC;QAC/E,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AA9BD,8BA8BC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Reporter } from "./reporter";
|
|
2
|
+
/**
|
|
3
|
+
* The program: parse the arguments, pick the command, load the project, run.
|
|
4
|
+
* Each step lives in its own method so `run` reads top to bottom.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Cli {
|
|
7
|
+
private readonly out;
|
|
8
|
+
constructor(out?: Reporter);
|
|
9
|
+
/** Returns the exit code; throws CliError for user mistakes. */
|
|
10
|
+
run(argv: string[]): number;
|
|
11
|
+
private help;
|
|
12
|
+
private createCommand;
|
|
13
|
+
private loadProject;
|
|
14
|
+
}
|
|
15
|
+
export declare function main(argv: string[]): void;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Cli = void 0;
|
|
37
|
+
exports.main = main;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const glugent_core_1 = require("@anweba/glugent-core");
|
|
40
|
+
const arguments_1 = require("./arguments");
|
|
41
|
+
const build_1 = require("./commands/build");
|
|
42
|
+
const convert_1 = require("./commands/convert");
|
|
43
|
+
const list_1 = require("./commands/list");
|
|
44
|
+
const validate_1 = require("./commands/validate");
|
|
45
|
+
const errors_1 = require("./errors");
|
|
46
|
+
const help_1 = require("./help");
|
|
47
|
+
const reporter_1 = require("./reporter");
|
|
48
|
+
const COMMANDS = {
|
|
49
|
+
build: build_1.BuildCommand,
|
|
50
|
+
validate: validate_1.ValidateCommand,
|
|
51
|
+
list: list_1.ListCommand,
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The program: parse the arguments, pick the command, load the project, run.
|
|
55
|
+
* Each step lives in its own method so `run` reads top to bottom.
|
|
56
|
+
*/
|
|
57
|
+
class Cli {
|
|
58
|
+
out;
|
|
59
|
+
constructor(out = new reporter_1.Reporter()) {
|
|
60
|
+
this.out = out;
|
|
61
|
+
}
|
|
62
|
+
/** Returns the exit code; throws CliError for user mistakes. */
|
|
63
|
+
run(argv) {
|
|
64
|
+
const args = arguments_1.Arguments.parse(argv);
|
|
65
|
+
if (!args.command || args.command === "help")
|
|
66
|
+
return this.help();
|
|
67
|
+
if (args.command === "convert")
|
|
68
|
+
return new convert_1.ConvertCommand(args, this.out).run();
|
|
69
|
+
const command = this.createCommand(args);
|
|
70
|
+
return command.run(this.loadProject(args));
|
|
71
|
+
}
|
|
72
|
+
help() {
|
|
73
|
+
this.out.info(help_1.HELP);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
createCommand(args) {
|
|
77
|
+
const CommandType = COMMANDS[args.command];
|
|
78
|
+
if (!CommandType)
|
|
79
|
+
throw new errors_1.CliError(`unknown command '${args.command}'\n\n${help_1.HELP}`);
|
|
80
|
+
return new CommandType(args, this.out);
|
|
81
|
+
}
|
|
82
|
+
loadProject(args) {
|
|
83
|
+
const configFile = args.config ? path.resolve(args.config) : (0, glugent_core_1.findConfigUp)(process.cwd());
|
|
84
|
+
if (!configFile)
|
|
85
|
+
throw new errors_1.CliError("glugent.config.json not found (searched upward from the current directory)");
|
|
86
|
+
return (0, glugent_core_1.loadProject)(configFile);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.Cli = Cli;
|
|
90
|
+
function main(argv) {
|
|
91
|
+
const out = new reporter_1.Reporter();
|
|
92
|
+
try {
|
|
93
|
+
process.exit(new Cli(out).run(argv));
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
if (!(e instanceof errors_1.CliError))
|
|
97
|
+
throw e;
|
|
98
|
+
out.error(`glugent: ${e.message}`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,oBASC;AAjED,2CAA6B;AAC7B,uDAA0E;AAC1E,2CAAwC;AACxC,4CAAgD;AAEhD,gDAAoD;AACpD,0CAA8C;AAC9C,kDAAsD;AACtD,qCAAoC;AACpC,iCAA8B;AAC9B,yCAAsC;AAItC,MAAM,QAAQ,GAAiC;IAC7C,KAAK,EAAE,oBAAY;IACnB,QAAQ,EAAE,0BAAe;IACzB,IAAI,EAAE,kBAAW;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAa,GAAG;IACe;IAA7B,YAA6B,MAAM,IAAI,mBAAQ,EAAE;QAApB,QAAG,GAAH,GAAG,CAAiB;IAAG,CAAC;IAErD,gEAAgE;IAChE,GAAG,CAAC,IAAc;QAChB,MAAM,IAAI,GAAG,qBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QAEjE,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAAE,OAAO,IAAI,wBAAc,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAEhF,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEO,IAAI;QACV,IAAI,CAAC,GAAG,CAAC,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anweba/glugent-core";
|
|
2
|
+
import { Command } from "./command";
|
|
3
|
+
/** `glugent build [target...]`: compile targets and write their output files. */
|
|
4
|
+
export declare class BuildCommand extends Command {
|
|
5
|
+
run(project: Project): number;
|
|
6
|
+
/** The targets named on the command line, or all of them. */
|
|
7
|
+
private selectTargets;
|
|
8
|
+
private find;
|
|
9
|
+
/** Builds one target; returns false (and writes nothing) if it has errors. */
|
|
10
|
+
private build;
|
|
11
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildCommand = void 0;
|
|
4
|
+
const glugent_core_1 = require("@anweba/glugent-core");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const reporter_1 = require("../reporter");
|
|
7
|
+
const command_1 = require("./command");
|
|
8
|
+
/** `glugent build [target...]`: compile targets and write their output files. */
|
|
9
|
+
class BuildCommand extends command_1.Command {
|
|
10
|
+
run(project) {
|
|
11
|
+
const targets = this.selectTargets(project);
|
|
12
|
+
this.out.diagnostics(project.diagnostics);
|
|
13
|
+
let ok = !reporter_1.Reporter.hasErrors(project.diagnostics);
|
|
14
|
+
for (const target of targets) {
|
|
15
|
+
if (!this.build(project, target))
|
|
16
|
+
ok = false;
|
|
17
|
+
}
|
|
18
|
+
return ok ? 0 : 1;
|
|
19
|
+
}
|
|
20
|
+
/** The targets named on the command line, or all of them. */
|
|
21
|
+
selectTargets(project) {
|
|
22
|
+
const targets = this.args.names.length ? this.args.names.map((name) => this.find(project, name)) : project.targets;
|
|
23
|
+
if (!targets.length)
|
|
24
|
+
throw new errors_1.CliError("no targets found");
|
|
25
|
+
return targets;
|
|
26
|
+
}
|
|
27
|
+
find(project, name) {
|
|
28
|
+
const target = project.targets.find((t) => t.name === name);
|
|
29
|
+
if (!target)
|
|
30
|
+
throw new errors_1.CliError(`unknown target '${name}'`);
|
|
31
|
+
return target;
|
|
32
|
+
}
|
|
33
|
+
/** Builds one target; returns false (and writes nothing) if it has errors. */
|
|
34
|
+
build(project, target) {
|
|
35
|
+
const result = (0, glugent_core_1.compileTarget)(project, target, { overrides: this.args.overrides });
|
|
36
|
+
this.out.diagnostics(result.diagnostics);
|
|
37
|
+
if (reporter_1.Reporter.hasErrors(result.diagnostics)) {
|
|
38
|
+
this.out.error(`✗ ${target.name} (not written)`);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (!this.args.dryRun)
|
|
42
|
+
(0, glugent_core_1.writeBuild)(result);
|
|
43
|
+
const note = this.args.dryRun ? " (dry run)" : "";
|
|
44
|
+
this.out.info(`✓ ${target.name} → ${this.out.relative(result.outputFile)}${note}`);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.BuildCommand = BuildCommand;
|
|
49
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":";;;AAAA,uDAAkF;AAClF,sCAAqC;AACrC,0CAAuC;AACvC,uCAAoC;AAEpC,iFAAiF;AACjF,MAAa,YAAa,SAAQ,iBAAO;IACvC,GAAG,CAAC,OAAgB;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE5C,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,EAAE,GAAG,CAAC,mBAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAClD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;gBAAE,EAAE,GAAG,KAAK,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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AAM;YAAE,IAAA,yBAAU,EAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtCD,oCAsCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Project } from "@anweba/glugent-core";
|
|
2
|
+
import { Arguments } from "../arguments";
|
|
3
|
+
import { Reporter } from "../reporter";
|
|
4
|
+
/** One `glugent <name>` subcommand. `run` returns the process exit code. */
|
|
5
|
+
export declare abstract class Command {
|
|
6
|
+
protected readonly args: Arguments;
|
|
7
|
+
protected readonly out: Reporter;
|
|
8
|
+
constructor(args: Arguments, out: Reporter);
|
|
9
|
+
abstract run(project: Project): number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Command = void 0;
|
|
4
|
+
/** One `glugent <name>` subcommand. `run` returns the process exit code. */
|
|
5
|
+
class Command {
|
|
6
|
+
args;
|
|
7
|
+
out;
|
|
8
|
+
constructor(args, out) {
|
|
9
|
+
this.args = args;
|
|
10
|
+
this.out = out;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Command = Command;
|
|
14
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/commands/command.ts"],"names":[],"mappings":";;;AAIA,4EAA4E;AAC5E,MAAsB,OAAO;IAEN;IACA;IAFrB,YACqB,IAAe,EACf,GAAa;QADb,SAAI,GAAJ,IAAI,CAAW;QACf,QAAG,GAAH,GAAG,CAAU;IAC/B,CAAC;CAGL;AAPD,0BAOC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Arguments } from "../arguments";
|
|
2
|
+
import { Reporter } from "../reporter";
|
|
3
|
+
/**
|
|
4
|
+
* `glugent convert <file.md>...`: writes `<file>.ggen.md` next to each Markdown
|
|
5
|
+
* file, with its braces escaped. Needs no project. Existing outputs are never
|
|
6
|
+
* overwritten.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ConvertCommand {
|
|
9
|
+
private readonly args;
|
|
10
|
+
private readonly out;
|
|
11
|
+
constructor(args: Arguments, out: Reporter);
|
|
12
|
+
run(): number;
|
|
13
|
+
private convert;
|
|
14
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ConvertCommand = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const glugent_core_1 = require("@anweba/glugent-core");
|
|
40
|
+
const errors_1 = require("../errors");
|
|
41
|
+
/**
|
|
42
|
+
* `glugent convert <file.md>...`: writes `<file>.ggen.md` next to each Markdown
|
|
43
|
+
* file, with its braces escaped. Needs no project. Existing outputs are never
|
|
44
|
+
* overwritten.
|
|
45
|
+
*/
|
|
46
|
+
class ConvertCommand {
|
|
47
|
+
args;
|
|
48
|
+
out;
|
|
49
|
+
constructor(args, out) {
|
|
50
|
+
this.args = args;
|
|
51
|
+
this.out = out;
|
|
52
|
+
}
|
|
53
|
+
run() {
|
|
54
|
+
if (this.args.names.length === 0)
|
|
55
|
+
throw new errors_1.CliError("convert expects at least one .md file");
|
|
56
|
+
let failed = false;
|
|
57
|
+
for (const file of this.args.names) {
|
|
58
|
+
try {
|
|
59
|
+
this.convert(file);
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
if (!(e instanceof errors_1.CliError))
|
|
63
|
+
throw e;
|
|
64
|
+
this.out.error(`glugent: ${e.message}`);
|
|
65
|
+
failed = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return failed ? 1 : 0;
|
|
69
|
+
}
|
|
70
|
+
convert(file) {
|
|
71
|
+
if (!/\.md$/i.test(file) || /\.ggen\.md$/i.test(file))
|
|
72
|
+
throw new errors_1.CliError(`'${file}' is not a plain .md file`);
|
|
73
|
+
if (!fs.existsSync(file))
|
|
74
|
+
throw new errors_1.CliError(`'${file}' not found`);
|
|
75
|
+
const target = file.replace(/\.md$/i, ".ggen.md");
|
|
76
|
+
if (fs.existsSync(target) && !this.args.force)
|
|
77
|
+
throw new errors_1.CliError(`'${target}' already exists (use --force to overwrite)`);
|
|
78
|
+
const converted = (0, glugent_core_1.convertMarkdown)(fs.readFileSync(file, "utf8"));
|
|
79
|
+
if (!this.args.dryRun)
|
|
80
|
+
fs.writeFileSync(target, converted);
|
|
81
|
+
this.out.info(`${this.args.dryRun ? "would write" : "wrote"} ${path.relative(process.cwd(), target) || target}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.ConvertCommand = ConvertCommand;
|
|
85
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/commands/convert.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uDAAuD;AAEvD,sCAAqC;AAGrC;;;;GAIG;AACH,MAAa,cAAc;IAEN;IACA;IAFnB,YACmB,IAAe,EACf,GAAa;QADb,SAAI,GAAJ,IAAI,CAAW;QACf,QAAG,GAAH,GAAG,CAAU;IAC7B,CAAC;IAEJ,GAAG;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,iBAAQ,CAAC,uCAAuC,CAAC,CAAC;QAC9F,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YACnC,IAAI,CA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AAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC;IACnH,CAAC;CACF;AA/BD,wCA+BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListCommand = void 0;
|
|
4
|
+
const command_1 = require("./command");
|
|
5
|
+
/** `glugent list`: the targets and sections found in the project. */
|
|
6
|
+
class ListCommand extends command_1.Command {
|
|
7
|
+
run(project) {
|
|
8
|
+
this.out.info("Targets:");
|
|
9
|
+
for (const target of project.targets) {
|
|
10
|
+
this.out.info(` ${target.name} (${this.out.relative(target.file, project.root)})`);
|
|
11
|
+
}
|
|
12
|
+
this.out.info("Sections:");
|
|
13
|
+
for (const section of project.sections)
|
|
14
|
+
this.out.info(` ${section.id}`);
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ListCommand = ListCommand;
|
|
19
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;AACA,uCAAoC;AAEpC,qEAAqE;AACrE,MAAa,WAAY,SAAQ,iBAAO;IACtC,GAAG,CAAC,OAAgB;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1B,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3B,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAVD,kCAUC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidateCommand = void 0;
|
|
4
|
+
const glugent_core_1 = require("@anweba/glugent-core");
|
|
5
|
+
const command_1 = require("./command");
|
|
6
|
+
/** `glugent validate`: report every problem without writing anything. */
|
|
7
|
+
class ValidateCommand extends command_1.Command {
|
|
8
|
+
run(project) {
|
|
9
|
+
const diagnostics = (0, glugent_core_1.validateProject)(project, { overrides: this.args.overrides });
|
|
10
|
+
this.out.diagnostics(diagnostics);
|
|
11
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
12
|
+
this.out.info(errors ? `${errors} error(s)` : "OK");
|
|
13
|
+
return errors ? 1 : 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ValidateCommand = ValidateCommand;
|
|
17
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":";;;AAAA,uDAAgE;AAEhE,uCAAoC;AAEpC,yEAAyE;AACzE,MAAa,eAAgB,SAAQ,iBAAO;IAC1C,GAAG,CAAC,OAAgB;QAClB,MAAM,WAAW,GAAG,IAAA,8BAAe,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACjF,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;QACxE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;CACF;AARD,0CAQC"}
|
package/dist/errors.d.ts
ADDED
package/dist/errors.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliError = void 0;
|
|
4
|
+
/** A user-facing failure: reported as `glugent: <message>` with exit code 1. */
|
|
5
|
+
class CliError extends Error {
|
|
6
|
+
}
|
|
7
|
+
exports.CliError = CliError;
|
|
8
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,MAAa,QAAS,SAAQ,KAAK;CAAG;AAAtC,4BAAsC"}
|
package/dist/help.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HELP = "glugent - glue Markdown sections into targets (agents, docs, ...)\n\nUsage:\n glugent build [target...] [--set KEY=VALUE]... [--config <path>] [--dry-run]\n glugent validate [--set KEY=VALUE]... [--config <path>]\n glugent list [--config <path>]\n glugent convert <file.md>... [--force] [--dry-run]\n\nconvert writes <file>.ggen.md next to each Markdown file, escaping { and } as {{ and }}.\nWith no target names, build builds every target.";
|
package/dist/help.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HELP = void 0;
|
|
4
|
+
exports.HELP = `glugent - glue Markdown sections into targets (agents, docs, ...)
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
glugent build [target...] [--set KEY=VALUE]... [--config <path>] [--dry-run]
|
|
8
|
+
glugent validate [--set KEY=VALUE]... [--config <path>]
|
|
9
|
+
glugent list [--config <path>]
|
|
10
|
+
glugent convert <file.md>... [--force] [--dry-run]
|
|
11
|
+
|
|
12
|
+
convert writes <file>.ggen.md next to each Markdown file, escaping { and } as {{ and }}.
|
|
13
|
+
With no target names, build builds every target.`;
|
|
14
|
+
//# sourceMappingURL=help.js.map
|
package/dist/help.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG;;;;;;;;;iDAS6B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Diagnostic } from "@anweba/glugent-core";
|
|
2
|
+
/** Everything the CLI prints, so commands never touch `console` directly. */
|
|
3
|
+
export declare class Reporter {
|
|
4
|
+
info(message: string): void;
|
|
5
|
+
error(message: string): void;
|
|
6
|
+
/** Prints `file:line:column severity: message` (1-based, relative to the cwd). */
|
|
7
|
+
diagnostic(d: Diagnostic): void;
|
|
8
|
+
diagnostics(list: Diagnostic[]): void;
|
|
9
|
+
/** A path as shown to the user. */
|
|
10
|
+
relative(file: string, from?: string): string;
|
|
11
|
+
static hasErrors(list: Diagnostic[]): boolean;
|
|
12
|
+
}
|
package/dist/reporter.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Reporter = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
/** Everything the CLI prints, so commands never touch `console` directly. */
|
|
39
|
+
class Reporter {
|
|
40
|
+
info(message) {
|
|
41
|
+
console.log(message);
|
|
42
|
+
}
|
|
43
|
+
error(message) {
|
|
44
|
+
console.error(message);
|
|
45
|
+
}
|
|
46
|
+
/** Prints `file:line:column severity: message` (1-based, relative to the cwd). */
|
|
47
|
+
diagnostic(d) {
|
|
48
|
+
const file = path.relative(process.cwd(), d.file);
|
|
49
|
+
this.error(`${file}:${d.line + 1}:${d.column + 1} ${d.severity}: ${d.message}`);
|
|
50
|
+
}
|
|
51
|
+
diagnostics(list) {
|
|
52
|
+
list.forEach((d) => this.diagnostic(d));
|
|
53
|
+
}
|
|
54
|
+
/** A path as shown to the user. */
|
|
55
|
+
relative(file, from = process.cwd()) {
|
|
56
|
+
return path.relative(from, file);
|
|
57
|
+
}
|
|
58
|
+
static hasErrors(list) {
|
|
59
|
+
return list.some((d) => d.severity === "error");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.Reporter = Reporter;
|
|
63
|
+
//# sourceMappingURL=reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAG7B,6EAA6E;AAC7E,MAAa,QAAQ;IACnB,IAAI,CAAC,OAAe;QAClB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,OAAe;QACnB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,kFAAkF;IAClF,UAAU,CAAC,CAAa;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,WAAW,CAAC,IAAkB;QAC5B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,mCAAmC;IACnC,QAAQ,CAAC,IAAY,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,IAAkB;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IAClD,CAAC;CACF;AA3BD,4BA2BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glugent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/anweba/glugent.git",
|
|
7
|
+
"directory": "packages/cli"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/anweba/glugent#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/anweba/glugent/issues"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"glugent": "bin/glugent.js"
|
|
15
|
+
},
|
|
16
|
+
"main": "dist/cli.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"dist",
|
|
20
|
+
"!dist/test"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p .",
|
|
27
|
+
"test": "node --test dist/test/*.test.js"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@anweba/glugent-core": "0.3.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/README.md
DELETED