@thjodann/wk 1.0.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/LICENSE +21 -0
- package/README.md +197 -0
- package/dist/cli/commands/article.d.ts +2 -0
- package/dist/cli/commands/article.js +47 -0
- package/dist/cli/commands/article.js.map +1 -0
- package/dist/cli/commands/closeout.d.ts +2 -0
- package/dist/cli/commands/closeout.js +37 -0
- package/dist/cli/commands/closeout.js.map +1 -0
- package/dist/cli/commands/compile.d.ts +2 -0
- package/dist/cli/commands/compile.js +50 -0
- package/dist/cli/commands/compile.js.map +1 -0
- package/dist/cli/commands/concept.d.ts +2 -0
- package/dist/cli/commands/concept.js +36 -0
- package/dist/cli/commands/concept.js.map +1 -0
- package/dist/cli/commands/decision.d.ts +2 -0
- package/dist/cli/commands/decision.js +38 -0
- package/dist/cli/commands/decision.js.map +1 -0
- package/dist/cli/commands/event.d.ts +2 -0
- package/dist/cli/commands/event.js +32 -0
- package/dist/cli/commands/event.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +52 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/installAgent.d.ts +2 -0
- package/dist/cli/commands/installAgent.js +130 -0
- package/dist/cli/commands/installAgent.js.map +1 -0
- package/dist/cli/commands/link.d.ts +2 -0
- package/dist/cli/commands/link.js +36 -0
- package/dist/cli/commands/link.js.map +1 -0
- package/dist/cli/commands/note.d.ts +2 -0
- package/dist/cli/commands/note.js +34 -0
- package/dist/cli/commands/note.js.map +1 -0
- package/dist/cli/commands/pages.d.ts +2 -0
- package/dist/cli/commands/pages.js +46 -0
- package/dist/cli/commands/pages.js.map +1 -0
- package/dist/cli/commands/record.d.ts +2 -0
- package/dist/cli/commands/record.js +101 -0
- package/dist/cli/commands/record.js.map +1 -0
- package/dist/cli/commands/render.d.ts +2 -0
- package/dist/cli/commands/render.js +33 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/search.d.ts +2 -0
- package/dist/cli/commands/search.js +125 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/commands/setup.js +53 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/site.d.ts +2 -0
- package/dist/cli/commands/site.js +47 -0
- package/dist/cli/commands/site.js.map +1 -0
- package/dist/cli/commands/spin.d.ts +2 -0
- package/dist/cli/commands/spin.js +43 -0
- package/dist/cli/commands/spin.js.map +1 -0
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/status.js +63 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/symbol.d.ts +2 -0
- package/dist/cli/commands/symbol.js +37 -0
- package/dist/cli/commands/symbol.js.map +1 -0
- package/dist/cli/commands/theme.d.ts +2 -0
- package/dist/cli/commands/theme.js +52 -0
- package/dist/cli/commands/theme.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +2 -0
- package/dist/cli/commands/validate.js +44 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/helpers.d.ts +30 -0
- package/dist/cli/helpers.js +131 -0
- package/dist/cli/helpers.js.map +1 -0
- package/dist/core/articles.d.ts +5 -0
- package/dist/core/articles.js +25 -0
- package/dist/core/articles.js.map +1 -0
- package/dist/core/automation.d.ts +96 -0
- package/dist/core/automation.js +384 -0
- package/dist/core/automation.js.map +1 -0
- package/dist/core/beads.d.ts +43 -0
- package/dist/core/beads.js +358 -0
- package/dist/core/beads.js.map +1 -0
- package/dist/core/compiler.d.ts +45 -0
- package/dist/core/compiler.js +399 -0
- package/dist/core/compiler.js.map +1 -0
- package/dist/core/config.d.ts +59 -0
- package/dist/core/config.js +187 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/git.d.ts +21 -0
- package/dist/core/git.js +109 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/ids.d.ts +2 -0
- package/dist/core/ids.js +8 -0
- package/dist/core/ids.js.map +1 -0
- package/dist/core/pages.d.ts +34 -0
- package/dist/core/pages.js +233 -0
- package/dist/core/pages.js.map +1 -0
- package/dist/core/paths.d.ts +15 -0
- package/dist/core/paths.js +67 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/profiles.d.ts +30 -0
- package/dist/core/profiles.js +243 -0
- package/dist/core/profiles.js.map +1 -0
- package/dist/core/renderer.d.ts +8 -0
- package/dist/core/renderer.js +106 -0
- package/dist/core/renderer.js.map +1 -0
- package/dist/core/schemas.d.ts +1039 -0
- package/dist/core/schemas.js +108 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/site.d.ts +20 -0
- package/dist/core/site.js +2684 -0
- package/dist/core/site.js.map +1 -0
- package/dist/core/spin.d.ts +42 -0
- package/dist/core/spin.js +265 -0
- package/dist/core/spin.js.map +1 -0
- package/dist/core/store.d.ts +29 -0
- package/dist/core/store.js +146 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/theme.d.ts +35 -0
- package/dist/core/theme.js +1086 -0
- package/dist/core/theme.js.map +1 -0
- package/dist/core/validator.d.ts +8 -0
- package/dist/core/validator.js +154 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/articlesPage.d.ts +3 -0
- package/dist/templates/articlesPage.js +46 -0
- package/dist/templates/articlesPage.js.map +1 -0
- package/dist/templates/conceptsPage.d.ts +2 -0
- package/dist/templates/conceptsPage.js +24 -0
- package/dist/templates/conceptsPage.js.map +1 -0
- package/dist/templates/decisionsPage.d.ts +2 -0
- package/dist/templates/decisionsPage.js +27 -0
- package/dist/templates/decisionsPage.js.map +1 -0
- package/dist/templates/devlogPage.d.ts +2 -0
- package/dist/templates/devlogPage.js +22 -0
- package/dist/templates/devlogPage.js.map +1 -0
- package/dist/templates/indexPage.d.ts +6 -0
- package/dist/templates/indexPage.js +33 -0
- package/dist/templates/indexPage.js.map +1 -0
- package/dist/templates/linksPage.d.ts +2 -0
- package/dist/templates/linksPage.js +26 -0
- package/dist/templates/linksPage.js.map +1 -0
- package/dist/templates/notesPage.d.ts +2 -0
- package/dist/templates/notesPage.js +26 -0
- package/dist/templates/notesPage.js.map +1 -0
- package/dist/templates/symbolsPage.d.ts +2 -0
- package/dist/templates/symbolsPage.js +25 -0
- package/dist/templates/symbolsPage.js.map +1 -0
- package/docs/concepts.md +249 -0
- package/docs/reference.md +356 -0
- package/docs/setup.md +331 -0
- package/docs/workflows.md +154 -0
- package/package.json +61 -0
- package/skills/wk/SKILL.md +251 -0
- package/skills/wk/agents/openai.yaml +4 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSetupCommand = registerSetupCommand;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const automation_1 = require("../../core/automation");
|
|
6
|
+
const paths_1 = require("../../core/paths");
|
|
7
|
+
function registerSetupCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command("setup")
|
|
10
|
+
.description("Set up portable Wikiwiki automation scripts and repo defaults.")
|
|
11
|
+
.option("--profile <profile>", "wiki profile: mixed, user, developer")
|
|
12
|
+
.option("--audience <audience>", "site audience: all, user, developer")
|
|
13
|
+
.option("--source-base-url <url>", "base URL for source file links")
|
|
14
|
+
.option("--force", "overwrite conflicting Wikiwiki package scripts")
|
|
15
|
+
.option("--json", "print machine-readable output")
|
|
16
|
+
.action((options) => {
|
|
17
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
18
|
+
const result = (0, automation_1.setupWikiwiki)(root, options);
|
|
19
|
+
if (options.json) {
|
|
20
|
+
(0, helpers_1.printJson)(result);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
console.log("Wikiwiki setup complete.");
|
|
24
|
+
console.log(`Profile: ${result.config.wiki_profile}`);
|
|
25
|
+
console.log(`Audience: ${result.config.site_audience}`);
|
|
26
|
+
if (result.config.source_base_url) {
|
|
27
|
+
console.log(`Source base URL: ${result.config.source_base_url}`);
|
|
28
|
+
}
|
|
29
|
+
if (result.integrations?.beads?.detected) {
|
|
30
|
+
const state = result.integrations.beads.available
|
|
31
|
+
? "available"
|
|
32
|
+
: result.integrations.beads.error === "beads_auto_read_skipped" ? "detected; detailed reads skipped"
|
|
33
|
+
: result.integrations.beads.enabled ? "detected but unavailable" : "disabled";
|
|
34
|
+
console.log(`Beads: ${state}`);
|
|
35
|
+
}
|
|
36
|
+
if (result.package_json.present) {
|
|
37
|
+
const changed = [
|
|
38
|
+
...result.package_json.scripts_added.map((name) => `${name} added`),
|
|
39
|
+
...result.package_json.scripts_overwritten.map((name) => `${name} overwritten`)
|
|
40
|
+
];
|
|
41
|
+
console.log(changed.length > 0 ? `Scripts: ${changed.join(", ")}` : "Scripts: already current");
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log("No package.json found. Copy these commands into your project automation if useful:");
|
|
45
|
+
for (const [name, command] of Object.entries(result.package_json.copy_commands)) {
|
|
46
|
+
console.log(`- ${name}: ${command}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
console.log("Next: run `wk theme preview --json`, then `wk theme init` to create a branded .wikiwiki/site-theme.json from repo identity and app styles.");
|
|
50
|
+
console.log("For an impressive first install, seed high-signal records, then run `wk validate`, `wk render`, and `wk site`.");
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/cli/commands/setup.ts"],"names":[],"mappings":";;AAKA,oDAqDC;AAzDD,wCAAuC;AACvC,sDAAsD;AACtD,4CAAgD;AAEhD,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gEAAgE,CAAC;SAC7E,MAAM,CAAC,qBAAqB,E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OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG;gBACd,GAAG,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,QAAQ,CAAC;gBACnE,GAAG,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,cAAc,CAAC;aAChF,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC;QAClG,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oFAAoF,CAAC,CAAC;YAClG,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC;gBAChF,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,4IAA4I,CAAC,CAAC;QAC1J,OAAO,CAAC,GAAG,CAAC,gHAAgH,CAAC,CAAC;IAChI,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerSiteCommand = registerSiteCommand;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const helpers_1 = require("../helpers");
|
|
9
|
+
const paths_1 = require("../../core/paths");
|
|
10
|
+
const site_1 = require("../../core/site");
|
|
11
|
+
const store_1 = require("../../core/store");
|
|
12
|
+
function registerSiteCommand(program) {
|
|
13
|
+
program
|
|
14
|
+
.command("site")
|
|
15
|
+
.description("Generate a static human-facing Wikiwiki site into wiki-site/.")
|
|
16
|
+
.option("--source-base-url <url>", "base URL for source file links, for example https://github.com/OWNER/REPO/blob/main/")
|
|
17
|
+
.option("--audience <audience>", "site audience: all, user, developer")
|
|
18
|
+
.option("--json", "print machine-readable output")
|
|
19
|
+
.action((options) => {
|
|
20
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
21
|
+
if (!(0, store_1.isInitialized)(root)) {
|
|
22
|
+
throw new Error("Wikiwiki is not initialized. Run `wk init` first.");
|
|
23
|
+
}
|
|
24
|
+
const siteOptions = (0, site_1.resolveSiteOptions)(root, { sourceBaseUrl: options.sourceBaseUrl, audience: options.audience });
|
|
25
|
+
const files = (0, site_1.renderSite)(root, siteOptions);
|
|
26
|
+
const siteFiles = files.map((file) => (0, paths_1.relativeReportPath)(root, file));
|
|
27
|
+
const result = {
|
|
28
|
+
ok: true,
|
|
29
|
+
site_path: (0, paths_1.reportPath)((0, paths_1.sitePath)(root)),
|
|
30
|
+
entrypoint: (0, paths_1.reportPath)(path_1.default.join((0, paths_1.sitePath)(root), "index.html")),
|
|
31
|
+
output_behavior: "replaces wiki-site/",
|
|
32
|
+
source_base_url: siteOptions.sourceBaseUrl ?? null,
|
|
33
|
+
audience: siteOptions.audience,
|
|
34
|
+
rendered_files: siteFiles,
|
|
35
|
+
site_files: siteFiles
|
|
36
|
+
};
|
|
37
|
+
if (options.json) {
|
|
38
|
+
(0, helpers_1.printJson)(result);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
console.log("Rendered Wikiwiki site:");
|
|
42
|
+
console.log(`- ${(0, paths_1.relativeReportPath)(root, path_1.default.join((0, paths_1.sitePath)(root), "index.html"))}`);
|
|
43
|
+
console.log(`- ${result.rendered_files.length} generated files`);
|
|
44
|
+
console.log("- Existing wiki-site/ contents were replaced");
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=site.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.js","sourceRoot":"","sources":["../../../src/cli/commands/site.ts"],"names":[],"mappings":";;;;;AAOA,kDAqCC;AA5CD,gDAAwB;AAExB,wCAAuC;AACvC,4CAA0F;AAC1F,0CAAiE;AACjE,4CAAiD;AAEjD,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,+DAA+D,CAAC;SAC5E,MAAM,CAAC,yBAAyB,EAAE,sFAAsF,CAAC;SACzH,MAAM,CAAC,uBAAuB,EAAE,qCAAqC,CAAC;SACtE,MAAM,CAAC,QAAQ,EAAE,+BAA+B,CAAC;SACjD,MAAM,CAAC,CAAC,OAA4F,EAAE,EAAE;QACvG,MAAM,IAAI,GAAG,IAAA,oBAAY,GAAE,CAAC;QAC5B,IAAI,CAAC,IAAA,qBAAa,EAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,WAAW,GAAG,IAAA,yBAAkB,EAAC,IAAI,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnH,MAAM,KAAK,GAAG,IAAA,iBAAU,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG;YACb,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAA,kBAAU,EAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;YACrC,UAAU,EAAE,IAAA,kBAAU,EAAC,cAAI,CAAC,IAAI,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;YAC/D,eAAe,EAAE,qBAAqB;YACtC,eAAe,EAAE,WAAW,CAAC,aAAa,IAAI,IAAI;YAClD,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,cAAc,EAAE,SAAS;YACzB,UAAU,EAAE,SAAS;SACtB,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAA,0BAAkB,EAAC,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;QACtF,OAAO,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,cAAc,CAAC,MAAM,kBAAkB,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSpinCommand = registerSpinCommand;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const config_1 = require("../../core/config");
|
|
6
|
+
const paths_1 = require("../../core/paths");
|
|
7
|
+
const profiles_1 = require("../../core/profiles");
|
|
8
|
+
const spin_1 = require("../../core/spin");
|
|
9
|
+
function registerSpinCommand(program) {
|
|
10
|
+
program
|
|
11
|
+
.command("spin")
|
|
12
|
+
.description("Inspect current repo changes and suggest knowledge updates.")
|
|
13
|
+
.option("--profile <profile>", "first-pass wiki profile: mixed, user, developer")
|
|
14
|
+
.option("--json", "print machine-readable output")
|
|
15
|
+
.action((options) => {
|
|
16
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
17
|
+
const config = (0, config_1.readWikiwikiConfig)(root);
|
|
18
|
+
const profile = (0, profiles_1.parseWikiProfile)(options.profile ?? config.wiki_profile, "mixed");
|
|
19
|
+
const result = (0, spin_1.createSpinResult)(root, profile);
|
|
20
|
+
if (options.json) {
|
|
21
|
+
(0, helpers_1.printJson)(result);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
console.log(`Changed files: ${result.changed_files.length}`);
|
|
25
|
+
for (const file of result.changed_files) {
|
|
26
|
+
console.log(`- ${file}`);
|
|
27
|
+
}
|
|
28
|
+
if (result.suggested_updates.length > 0) {
|
|
29
|
+
console.log("\nSuggested updates:");
|
|
30
|
+
for (const update of result.suggested_updates) {
|
|
31
|
+
console.log(`- ${update.type}: ${update.reason}`);
|
|
32
|
+
console.log(` ${update.command_hint}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
console.log(`\nFirst-pass profile: ${result.profile.name}`);
|
|
36
|
+
console.log(result.profile.description);
|
|
37
|
+
console.log("Target counts:");
|
|
38
|
+
for (const [type, count] of Object.entries(result.profile.target_counts)) {
|
|
39
|
+
console.log(`- ${type}: ${count}`);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=spin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin.js","sourceRoot":"","sources":["../../../src/cli/commands/spin.ts"],"names":[],"mappings":";;AAOA,kDAqCC;AA3CD,wCAAuC;AACvC,8CAAuD;AACvD,4CAAgD;AAChD,kDAAuD;AACvD,0CAAmD;AAEnD,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAA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AAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YACzE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.registerStatusCommand = registerStatusCommand;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const helpers_1 = require("../helpers");
|
|
10
|
+
const beads_1 = require("../../core/beads");
|
|
11
|
+
const config_1 = require("../../core/config");
|
|
12
|
+
const git_1 = require("../../core/git");
|
|
13
|
+
const paths_1 = require("../../core/paths");
|
|
14
|
+
const site_1 = require("../../core/site");
|
|
15
|
+
const renderer_1 = require("../../core/renderer");
|
|
16
|
+
const schemas_1 = require("../../core/schemas");
|
|
17
|
+
const store_1 = require("../../core/store");
|
|
18
|
+
function registerStatusCommand(program) {
|
|
19
|
+
program
|
|
20
|
+
.command("status")
|
|
21
|
+
.description("Show Wikiwiki repo status.")
|
|
22
|
+
.option("--json", "print machine-readable output")
|
|
23
|
+
.action((options) => {
|
|
24
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
25
|
+
const initialized = (0, store_1.isInitialized)(root);
|
|
26
|
+
const counts = initialized ? (0, store_1.recordCounts)(root) : emptyCounts();
|
|
27
|
+
const generatedFiles = renderer_1.wikiPageFileNames
|
|
28
|
+
.map((fileName) => path_1.default.join((0, paths_1.wikiPath)(root), fileName))
|
|
29
|
+
.filter((file) => fs_1.default.existsSync(file));
|
|
30
|
+
const generatedSiteFiles = site_1.siteStaticPageFileNames
|
|
31
|
+
.map((fileName) => path_1.default.join((0, paths_1.sitePath)(root), fileName))
|
|
32
|
+
.filter((file) => fs_1.default.existsSync(file));
|
|
33
|
+
const integrations = (0, beads_1.readIntegrations)(root, (0, config_1.readWikiwikiConfig)(root));
|
|
34
|
+
const result = {
|
|
35
|
+
repo_root: (0, paths_1.reportPath)(root),
|
|
36
|
+
initialized,
|
|
37
|
+
store_path: (0, paths_1.reportPath)((0, paths_1.wikiwikiPath)(root)),
|
|
38
|
+
wiki_path: (0, paths_1.reportPath)((0, paths_1.wikiPath)(root)),
|
|
39
|
+
site_path: (0, paths_1.reportPath)((0, paths_1.sitePath)(root)),
|
|
40
|
+
records: counts,
|
|
41
|
+
generated_files: generatedFiles.map((file) => (0, paths_1.relativeReportPath)(root, file)),
|
|
42
|
+
generated_site_files: generatedSiteFiles.map((file) => (0, paths_1.relativeReportPath)(root, file)),
|
|
43
|
+
git: {
|
|
44
|
+
changed_files: (0, git_1.changedFiles)(root),
|
|
45
|
+
suppressed_changed_files: (0, git_1.suppressedGitStatusSummary)(root)
|
|
46
|
+
},
|
|
47
|
+
...((0, beads_1.shouldReportIntegrations)(integrations) ? { integrations } : {})
|
|
48
|
+
};
|
|
49
|
+
if (options.json) {
|
|
50
|
+
(0, helpers_1.printJson)(result);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.log(`Repo: ${root}`);
|
|
54
|
+
console.log(`Wikiwiki: ${initialized ? "initialized" : "not initialized"}`);
|
|
55
|
+
console.log(`Records: ${schemas_1.recordTypes.map((type) => `${type}=${counts[type]}`).join(", ")}`);
|
|
56
|
+
console.log(`Site: ${generatedSiteFiles.length ? "generated" : "not generated"}`);
|
|
57
|
+
console.log(`Changed files: ${result.git.changed_files.length}`);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function emptyCounts() {
|
|
61
|
+
return Object.fromEntries(schemas_1.recordTypes.map((type) => [type, 0]));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":";;;;;AAaA,sDA4CC;AAzDD,4CAAoB;AACpB,gDAAwB;AAExB,wCAAuC;AACvC,4CAA8E;AAC9E,8CAAuD;AACvD,wCAA0E;AAC1E,4CAAkH;AAClH,0CAA0D;AAC1D,kDAAwD;AACxD,gDAAiD;AACjD,4CAA+D;AAE/D,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,4BAA4B,CAAC;SACzC,MAAM,CAAC,QAAQ,EAAE,+BAA+B,CAAC;SACjD,MAAM,CAAC,CAAC,OAA2B,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,IAAA,oBAAY,GAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAChE,MAAM,cAAc,GAAG,4BAAiB;aACrC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAI,CAAC,IAAI,CAAC,IAAA,gBAAQ,EAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;aACtD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,MAAM,kBAAkB,GA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,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,aAAa,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC5E,OAAO,CAAC,GAAG,CAAC,YAAY,qBAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3F,OAAO,CAAC,GAAG,CAAC,SAAS,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,WAAW;IAClB,OAAO,MAAM,CAAC,WAAW,CAAC,qBAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAiD,CAAC;AAClH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerSymbolCommand = registerSymbolCommand;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const ids_1 = require("../../core/ids");
|
|
6
|
+
const paths_1 = require("../../core/paths");
|
|
7
|
+
const store_1 = require("../../core/store");
|
|
8
|
+
function registerSymbolCommand(program) {
|
|
9
|
+
const symbol = program.command("symbol").description("Manage code symbols.");
|
|
10
|
+
(0, helpers_1.addCommonRecordOptions)(symbol
|
|
11
|
+
.command("add")
|
|
12
|
+
.description("Add a symbol.")
|
|
13
|
+
.option("--name <name>", "symbol name")
|
|
14
|
+
.option("--kind <kind>", "symbol kind")
|
|
15
|
+
.option("--file <file>", "source file")
|
|
16
|
+
.option("--summary <summary>", "symbol summary")
|
|
17
|
+
.option("--json [payload]", "read input as JSON and print machine-readable output")).action((options) => {
|
|
18
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
19
|
+
const payload = (0, helpers_1.parseJsonInput)(options.json);
|
|
20
|
+
const timestamps = (0, helpers_1.timestampPair)(payload);
|
|
21
|
+
const record = {
|
|
22
|
+
type: "symbol",
|
|
23
|
+
id: (0, helpers_1.stringValue)(payload, "id", (0, ids_1.createId)("symbol")),
|
|
24
|
+
name: options.name ?? (0, helpers_1.stringValue)(payload, "name"),
|
|
25
|
+
kind: options.kind ?? (0, helpers_1.stringValue)(payload, "kind"),
|
|
26
|
+
file: options.file ?? (0, helpers_1.stringValue)(payload, "file"),
|
|
27
|
+
summary: options.summary ?? (0, helpers_1.stringValue)(payload, "summary"),
|
|
28
|
+
tags: (0, helpers_1.parseList)(options.tags).length ? (0, helpers_1.parseList)(options.tags) : (0, helpers_1.arrayValue)(payload, "tags"),
|
|
29
|
+
...(0, helpers_1.commonRecordFields)(options, payload),
|
|
30
|
+
created_at: timestamps.created_at,
|
|
31
|
+
updated_at: timestamps.updated_at
|
|
32
|
+
};
|
|
33
|
+
const added = (0, store_1.appendRecord)(root, "symbol", record);
|
|
34
|
+
(0, helpers_1.printAdded)("symbol", added.id, (0, helpers_1.wantsJsonOutput)(options.json), added);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=symbol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol.js","sourceRoot":"","sources":["../../../src/cli/commands/symbol.ts"],"names":[],"mappings":";;AAiBA,sDAgCC;AAhDD,wCAUoB;AACpB,wCAA0C;AAC1C,4CAAgD;AAChD,4CAAgD;AAG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AAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,mBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAA,oBAAU,EAAC,OAAO,EAAE,MAAM,CAAC;YAC5F,GAAG,IAAA,4BAAkB,EAAC,OAAO,EAAE,OAAO,CAAC;YACvC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU,EAAE,UAAU,CAAC,UAAU;SAClC,CAAC;QAEF,MAAM,KAAK,GAAG,IAAA,oBAAY,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnD,IAAA,oBAAU,EAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,IAAA,yBAAe,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerThemeCommand = registerThemeCommand;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const paths_1 = require("../../core/paths");
|
|
6
|
+
const theme_1 = require("../../core/theme");
|
|
7
|
+
function registerThemeCommand(program) {
|
|
8
|
+
const command = program
|
|
9
|
+
.command("theme")
|
|
10
|
+
.description("Create or preview a project identity theme for the generated site.");
|
|
11
|
+
addThemeOptions(command
|
|
12
|
+
.command("preview")
|
|
13
|
+
.description("Preview the inferred project theme without writing files."))
|
|
14
|
+
.option("--json", "print machine-readable output")
|
|
15
|
+
.action((options) => {
|
|
16
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
17
|
+
const result = (0, theme_1.previewTheme)(root, options);
|
|
18
|
+
if (options.json) {
|
|
19
|
+
(0, helpers_1.printJson)(result);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
console.log("Previewed Wikiwiki theme.");
|
|
23
|
+
console.log(`Mood: ${result.mood}`);
|
|
24
|
+
console.log(`Project: ${result.theme.project_name}`);
|
|
25
|
+
console.log(`Theme file: ${result.theme_path}${result.exists ? " (exists)" : ""}`);
|
|
26
|
+
console.log(JSON.stringify(result.theme, null, 2));
|
|
27
|
+
});
|
|
28
|
+
addThemeOptions(command
|
|
29
|
+
.command("init")
|
|
30
|
+
.description("Write .wikiwiki/site-theme.json for this project."))
|
|
31
|
+
.option("--force", "overwrite an existing .wikiwiki/site-theme.json")
|
|
32
|
+
.option("--json", "print machine-readable output")
|
|
33
|
+
.action((options) => {
|
|
34
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
35
|
+
const result = (0, theme_1.writeTheme)(root, options);
|
|
36
|
+
if (options.json) {
|
|
37
|
+
(0, helpers_1.printJson)(result);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
console.log(result.overwritten ? "Overwrote Wikiwiki theme." : "Created Wikiwiki theme.");
|
|
41
|
+
console.log(`Mood: ${result.mood}`);
|
|
42
|
+
console.log(`Project: ${result.theme.project_name}`);
|
|
43
|
+
console.log(`Theme file: ${result.theme_path}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function addThemeOptions(command) {
|
|
47
|
+
return command
|
|
48
|
+
.option("--mood <mood>", `theme mood: ${theme_1.themeMoods.join(", ")}`)
|
|
49
|
+
.option("--project-name <name>", "project name for the generated site")
|
|
50
|
+
.option("--description <text>", "project description for the generated site");
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/cli/commands/theme.ts"],"names":[],"mappings":";;AAaA,oDA8CC;AA1DD,wCAAuC;AACvC,4CAAgD;AAChD,4CAAwE;AAUxE,SAAgB,oBAAoB,CAAC,OAAgB;IACnD,MAAM,OAAO,GAAG,OAAO;SACpB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,oEAAoE,CAAC,CAAC;IAErF,eA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C,CAAC;QACzC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YAClB,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC;QAC1F,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB;IACvC,OAAO,OAAO;SACX,MAAM,CAAC,eAAe,EAAE,eAAe,kBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SAC/D,MAAM,CAAC,uBAAuB,EAAE,qCAAqC,CAAC;SACtE,MAAM,CAAC,sBAAsB,EAAE,4CAA4C,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerValidateCommand = registerValidateCommand;
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
|
+
const paths_1 = require("../../core/paths");
|
|
6
|
+
const validator_1 = require("../../core/validator");
|
|
7
|
+
function registerValidateCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command("validate")
|
|
10
|
+
.description("Validate Wikiwiki storage and generated wiki rendering.")
|
|
11
|
+
.option("--json", "print machine-readable output")
|
|
12
|
+
.action((options) => {
|
|
13
|
+
const root = (0, paths_1.findRepoRoot)();
|
|
14
|
+
const result = (0, validator_1.validateWikiwiki)(root);
|
|
15
|
+
if (options.json) {
|
|
16
|
+
(0, helpers_1.printJson)(result);
|
|
17
|
+
}
|
|
18
|
+
else if (result.valid) {
|
|
19
|
+
console.log("Wikiwiki validation passed.");
|
|
20
|
+
if (result.warnings.length > 0) {
|
|
21
|
+
console.log("\nWarnings:");
|
|
22
|
+
for (const warning of result.warnings) {
|
|
23
|
+
console.log(`- ${warning}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.error("Wikiwiki validation failed.");
|
|
29
|
+
for (const error of result.errors) {
|
|
30
|
+
console.error(`- ${error}`);
|
|
31
|
+
}
|
|
32
|
+
if (result.warnings.length > 0) {
|
|
33
|
+
console.error("\nWarnings:");
|
|
34
|
+
for (const warning of result.warnings) {
|
|
35
|
+
console.error(`- ${warning}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!result.valid) {
|
|
40
|
+
process.exitCode = 1;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":";;AAKA,0DAoCC;AAxCD,wCAAuC;AACvC,4CAAgD;AAChD,oDAAwD;AAExD,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,QAAQ,EAAE,+BAA+B,CAAC;SACjD,MAAM,CAAC,CAAC,OAA2B,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,IAAA,oBAAY,GAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAA,4BAAgB,EAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;QACpB,CAAC;aAAM,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC3C,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAC3B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACtC,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;YAC7C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;YACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC7B,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACtC,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { AnyRecord, Authority, Confidence, RecordType, Source } from "../core/schemas";
|
|
3
|
+
export type CommonRecordOptions = {
|
|
4
|
+
source?: Source;
|
|
5
|
+
authority?: Authority;
|
|
6
|
+
confidence?: Confidence;
|
|
7
|
+
files?: string | string[];
|
|
8
|
+
tags?: string | string[];
|
|
9
|
+
json?: boolean | string;
|
|
10
|
+
};
|
|
11
|
+
export declare function addCommonRecordOptions(command: Command): Command;
|
|
12
|
+
export declare function wantsJsonOutput(value: unknown): boolean;
|
|
13
|
+
export declare function parseJsonInput(value: unknown): Record<string, unknown>;
|
|
14
|
+
export declare function stringValue(payload: Record<string, unknown>, key: string, fallback?: string): string;
|
|
15
|
+
export declare function arrayValue(payload: Record<string, unknown>, key: string, fallback?: string[]): string[];
|
|
16
|
+
export declare function parseList(value: string | string[] | undefined): string[];
|
|
17
|
+
export declare function collectList(value: string, previous?: string[]): string[];
|
|
18
|
+
export declare function commonRecordFields(options: CommonRecordOptions, payload: Record<string, unknown>): {
|
|
19
|
+
source: Source;
|
|
20
|
+
authority: Authority;
|
|
21
|
+
confidence: Confidence;
|
|
22
|
+
};
|
|
23
|
+
export declare function timestampPair(payload: Record<string, unknown>): {
|
|
24
|
+
created_at: string;
|
|
25
|
+
updated_at: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function printJson(value: unknown): void;
|
|
28
|
+
export declare function printAdded(type: string, id: string, json: boolean, record: unknown): void;
|
|
29
|
+
export declare function parseRecordType(value: string): RecordType;
|
|
30
|
+
export declare function recordTitle(record: AnyRecord): string;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addCommonRecordOptions = addCommonRecordOptions;
|
|
4
|
+
exports.wantsJsonOutput = wantsJsonOutput;
|
|
5
|
+
exports.parseJsonInput = parseJsonInput;
|
|
6
|
+
exports.stringValue = stringValue;
|
|
7
|
+
exports.arrayValue = arrayValue;
|
|
8
|
+
exports.parseList = parseList;
|
|
9
|
+
exports.collectList = collectList;
|
|
10
|
+
exports.commonRecordFields = commonRecordFields;
|
|
11
|
+
exports.timestampPair = timestampPair;
|
|
12
|
+
exports.printJson = printJson;
|
|
13
|
+
exports.printAdded = printAdded;
|
|
14
|
+
exports.parseRecordType = parseRecordType;
|
|
15
|
+
exports.recordTitle = recordTitle;
|
|
16
|
+
const schemas_1 = require("../core/schemas");
|
|
17
|
+
function addCommonRecordOptions(command) {
|
|
18
|
+
return command
|
|
19
|
+
.option("--source <source>", "record source: manual, agent, git-diff, imported")
|
|
20
|
+
.option("--authority <authority>", "record authority: user, agent, system")
|
|
21
|
+
.option("--confidence <confidence>", "record confidence: low, medium, high")
|
|
22
|
+
.option("--files <files>", "comma-separated related files; repeatable", collectList, [])
|
|
23
|
+
.option("--tags <tags>", "comma-separated tags; repeatable", collectList, []);
|
|
24
|
+
}
|
|
25
|
+
function wantsJsonOutput(value) {
|
|
26
|
+
return value !== undefined && value !== false;
|
|
27
|
+
}
|
|
28
|
+
function parseJsonInput(value) {
|
|
29
|
+
if (typeof value !== "string") {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const parsed = JSON.parse(value);
|
|
33
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
34
|
+
throw new Error("--json input must be a JSON object.");
|
|
35
|
+
}
|
|
36
|
+
return parsed;
|
|
37
|
+
}
|
|
38
|
+
function stringValue(payload, key, fallback = "") {
|
|
39
|
+
const value = payload[key];
|
|
40
|
+
return typeof value === "string" ? value : fallback;
|
|
41
|
+
}
|
|
42
|
+
function arrayValue(payload, key, fallback = []) {
|
|
43
|
+
const value = payload[key];
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
return value.filter((item) => typeof item === "string");
|
|
46
|
+
}
|
|
47
|
+
if (typeof value === "string") {
|
|
48
|
+
return parseList(value);
|
|
49
|
+
}
|
|
50
|
+
return fallback;
|
|
51
|
+
}
|
|
52
|
+
function parseList(value) {
|
|
53
|
+
if (!value) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(value)) {
|
|
57
|
+
return value.flatMap((item) => parseList(item));
|
|
58
|
+
}
|
|
59
|
+
return value
|
|
60
|
+
.split(",")
|
|
61
|
+
.map((item) => item.trim())
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
}
|
|
64
|
+
function collectList(value, previous = []) {
|
|
65
|
+
return [...previous, ...parseList(value)];
|
|
66
|
+
}
|
|
67
|
+
function commonRecordFields(options, payload) {
|
|
68
|
+
return {
|
|
69
|
+
source: (options.source ?? stringValue(payload, "source", "manual")),
|
|
70
|
+
authority: (options.authority ?? stringValue(payload, "authority", "agent")),
|
|
71
|
+
confidence: (options.confidence ?? stringValue(payload, "confidence", "medium"))
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function timestampPair(payload) {
|
|
75
|
+
const now = new Date().toISOString();
|
|
76
|
+
return {
|
|
77
|
+
created_at: stringValue(payload, "created_at", now),
|
|
78
|
+
updated_at: stringValue(payload, "updated_at", now)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function printJson(value) {
|
|
82
|
+
console.log(JSON.stringify(value, null, 2));
|
|
83
|
+
}
|
|
84
|
+
function printAdded(type, id, json, record) {
|
|
85
|
+
if (json) {
|
|
86
|
+
printJson({ ok: true, record });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
console.log(`Added ${type}: ${id}`);
|
|
90
|
+
}
|
|
91
|
+
function parseRecordType(value) {
|
|
92
|
+
if (schemas_1.recordTypes.includes(value)) {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Unknown record type: ${value}. Expected one of: ${schemas_1.recordTypes.join(", ")}.`);
|
|
96
|
+
}
|
|
97
|
+
function recordTitle(record) {
|
|
98
|
+
if (record.type === "note") {
|
|
99
|
+
return noteTitle(record);
|
|
100
|
+
}
|
|
101
|
+
if ("name" in record && typeof record.name === "string") {
|
|
102
|
+
return record.name;
|
|
103
|
+
}
|
|
104
|
+
if ("title" in record && typeof record.title === "string") {
|
|
105
|
+
return record.title;
|
|
106
|
+
}
|
|
107
|
+
if ("summary" in record && typeof record.summary === "string") {
|
|
108
|
+
return record.summary;
|
|
109
|
+
}
|
|
110
|
+
if ("body" in record && typeof record.body === "string") {
|
|
111
|
+
return conciseTitle(record.body);
|
|
112
|
+
}
|
|
113
|
+
if ("relationship" in record && typeof record.relationship === "string") {
|
|
114
|
+
return `${record.from} ${record.relationship} ${record.to}`;
|
|
115
|
+
}
|
|
116
|
+
return record.id;
|
|
117
|
+
}
|
|
118
|
+
function noteTitle(record) {
|
|
119
|
+
return record.title ?? `Note from ${record.created_at.slice(0, 10)}`;
|
|
120
|
+
}
|
|
121
|
+
function conciseTitle(value, maxLength = 80) {
|
|
122
|
+
const normalized = value.replace(/\s+/g, " ").trim();
|
|
123
|
+
if (normalized.length <= maxLength) {
|
|
124
|
+
return normalized;
|
|
125
|
+
}
|
|
126
|
+
const window = normalized.slice(0, maxLength + 1);
|
|
127
|
+
const wordBreak = window.lastIndexOf(" ");
|
|
128
|
+
const end = wordBreak >= 32 ? wordBreak : maxLength;
|
|
129
|
+
return `${normalized.slice(0, end).replace(/[\s,;:.-]+$/, "")}...`;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;AAaA,wDAOC;AAED,0CAEC;AAED,wCAWC;AAED,kCAOC;AAED,gCAeC;AAED,8BAaC;AAED,kCAEC;AAED,gDAaC;AAED,sCASC;AAED,8BAEC;AAED,gCAYC;AAED,0CAMC;AAED,kCA0BC;AAjKD,6CAA8C;AAY9C,SAAgB,sBAAsB,CAAC,OAAgB;IACrD,OAAO,OAAO;SACX,MAAM,CAAC,mBAAmB,EAAE,kDAAkD,CAAC;SAC/E,MAAM,CAAC,yBAAyB,EAAE,uCAAuC,CAAC;SAC1E,MAAM,CAAC,2BAA2B,EAAE,sCAAsC,CAAC;SAC3E,MAAM,CAAC,iBAAiB,EAAE,2CAA2C,EAAE,WAAW,EAAE,EAAE,CAAC;SACvF,MAAM,CAAC,eAAe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|
2
|
+
export declare function slugFromTitle(title: string): string;
|
|
3
|
+
export declare function articleFileName(article: ArticleRecord): string;
|
|
4
|
+
export declare function articleMarkdownFileName(article: ArticleRecord): string;
|
|
5
|
+
export declare function safeFileName(value: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slugFromTitle = slugFromTitle;
|
|
4
|
+
exports.articleFileName = articleFileName;
|
|
5
|
+
exports.articleMarkdownFileName = articleMarkdownFileName;
|
|
6
|
+
exports.safeFileName = safeFileName;
|
|
7
|
+
function slugFromTitle(title) {
|
|
8
|
+
const slug = title
|
|
9
|
+
.trim()
|
|
10
|
+
.replace(/['"]/g, "")
|
|
11
|
+
.replace(/[^a-z0-9:_-]+/gi, "-")
|
|
12
|
+
.replace(/-+/g, "-")
|
|
13
|
+
.replace(/^-|-$/g, "");
|
|
14
|
+
return slug || "article";
|
|
15
|
+
}
|
|
16
|
+
function articleFileName(article) {
|
|
17
|
+
return `${safeFileName(article.slug)}.html`;
|
|
18
|
+
}
|
|
19
|
+
function articleMarkdownFileName(article) {
|
|
20
|
+
return `${safeFileName(article.slug)}.md`;
|
|
21
|
+
}
|
|
22
|
+
function safeFileName(value) {
|
|
23
|
+
return value.replace(/[^a-z0-9._-]+/gi, "-");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=articles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles.js","sourceRoot":"","sources":["../../src/core/articles.ts"],"names":[],"mappings":";;AAEA,sCASC;AAED,0CAEC;AAED,0DAEC;AAED,oCAEC;AArBD,SAAgB,aAAa,CAAC,KAAa;IACzC,MAAM,IAAI,GAAG,KAAK;SACf,IAAI,EAAE;SACN,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;SACpB,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEzB,OAAO,IAAI,IAAI,SAAS,CAAC;AAC3B,CAAC;AAED,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AAC9C,CAAC;AAED,SAAgB,uBAAuB,CAAC,OAAsB;IAC5D,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;AAC5C,CAAC;AAED,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|