Skip to content

Commit e72bc31

Browse files
committed
chore: update @WorkGlow packages to version 0.0.125
- Bumped versions for several @WorkGlow packages, including cli, ai, ai-provider, job-queue, knowledge-base, sqlite, and storage to 0.0.125. - Updated peer dependencies and imports to ensure compatibility across the updated packages. - Refactored code to utilize the new `workglow` package instead of individual scoped packages.
1 parent d2943f6 commit e72bc31

116 files changed

Lines changed: 671 additions & 716 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
"**/bun.lock": true,
2222
"**/*.tsbuildinfo": true
2323
},
24-
"editor.codeActionsOnSave": {
25-
"source.fixAll.eslint": "explicit"
26-
},
27-
"eslint.codeActionsOnSave.rules": null,
2824
"explorer.autoRevealExclude": {
2925
"data-out/**": true,
3026
"data-in/**": true
@@ -45,5 +41,9 @@
4541
"js/ts.implicitProjectConfig.target": "ESNext",
4642
"[xml]": {
4743
"editor.defaultFormatter": "DotJoshJohnson.xml"
44+
},
45+
"editor.codeActionsOnSave": {
46+
"source.fixAll.eslint": "explicit",
47+
"source.organizeImports": "explicit"
4848
}
4949
}

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The CLI entrypoint is `src/sec.ts` and uses Commander for subcommands (e.g., `./
3333

3434
### Dependency Injection
3535

36-
Uses `@workglow/util`'s `globalServiceRegistry` with typed tokens. Production uses `SqliteTabularRepository`, tests use `InMemoryTabularRepository`. Call `resetDependencyInjectionsForTesting()` from `src/config/TestingDI.ts` in test setup.
36+
Uses the `workglow` package’s `globalServiceRegistry` with typed tokens. Production uses `SqliteTabularRepository`, tests use `InMemoryTabularRepository`. Call `resetDependencyInjectionsForTesting()` from `src/config/TestingDI.ts` in test setup.
3737

3838
### Schema Pattern
3939

bun.lock

Lines changed: 30 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,16 @@
2323
"@modelcontextprotocol/sdk": "^1.27.1",
2424
"@sroussey/parse-address": "^2.4.2",
2525
"@sroussey/parse-full-name": "^2.0.0",
26-
"@workglow/cli": "0.0.124",
27-
"@workglow/knowledge-base": "0.0.124",
28-
"@workglow/job-queue": "0.0.124",
29-
"@workglow/sqlite": "0.0.124",
30-
"@workglow/storage": "0.0.124",
31-
"@workglow/task-graph": "0.0.124",
32-
"@workglow/tasks": "0.0.124",
33-
"@workglow/util": "0.0.124",
26+
"workglow": "0.0.125",
27+
"@workglow/cli": "0.0.125",
3428
"awesome-phonenumber": "^7.8.0",
3529
"cheerio": "^1.2.0",
3630
"cheerio-json-mapper": "^1.0.4",
3731
"commander": "^14.0.3",
3832
"compromise": "^14.15.0",
3933
"concurrently": "^9.2.1",
4034
"csv-parse": "^6.2.1",
41-
"fast-xml-parser": "^5.5.8",
35+
"fast-xml-parser": "^5.5.9",
4236
"html-entities": "^2.6.0",
4337
"pdf2json": "^3.2.2",
4438
"pg": "^8.20.0",

scripts/link-workglow-packages.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,29 @@ interface PackageJson {
1010
}
1111

1212
/**
13-
* Extract all @workglow/* packages from package.json
13+
* Packages to link for local Workglow development (see package.json).
1414
*/
15-
function getWorkglowPackages(packageJsonPath: string): string[] {
15+
function getWorkglowLinkTargets(packageJsonPath: string): string[] {
1616
const packageJsonContent = fs.readFileSync(packageJsonPath, "utf8");
1717
const packageJson: PackageJson = JSON.parse(packageJsonContent);
1818

1919
const packages: string[] = [];
2020

21-
// Check dependencies
22-
if (packageJson.dependencies) {
23-
for (const packageName of Object.keys(packageJson.dependencies)) {
24-
if (packageName.startsWith("@workglow/")) {
25-
packages.push(packageName);
26-
}
21+
const consider = (deps: Record<string, string> | undefined): void => {
22+
if (!deps) {
23+
return;
2724
}
28-
}
29-
30-
// Check devDependencies
31-
if (packageJson.devDependencies) {
32-
for (const packageName of Object.keys(packageJson.devDependencies)) {
33-
if (packageName.startsWith("@workglow/")) {
34-
packages.push(packageName);
25+
for (const name of Object.keys(deps)) {
26+
if (name === "workglow" || name.startsWith("@workglow/")) {
27+
packages.push(name);
3528
}
3629
}
37-
}
30+
};
31+
32+
consider(packageJson.dependencies);
33+
consider(packageJson.devDependencies);
3834

39-
return packages.sort();
35+
return [...new Set(packages)].sort();
4036
}
4137

4238
async function main(): Promise<void> {
@@ -47,14 +43,14 @@ async function main(): Promise<void> {
4743
process.exit(1);
4844
}
4945

50-
const packages = getWorkglowPackages(packageJsonPath);
46+
const packages = getWorkglowLinkTargets(packageJsonPath);
5147

5248
if (packages.length === 0) {
53-
console.log("No @workglow/* packages found in package.json");
49+
console.log('No "workglow" or @workglow/* packages found in package.json');
5450
return;
5551
}
5652

57-
console.log(`Found ${packages.length} @workglow/* package(s) to link:`);
53+
console.log(`Found ${packages.length} Workglow package(s) to link:`);
5854
packages.forEach((pkg) => console.log(` - ${pkg}`));
5955
console.log();
6056

@@ -66,7 +62,7 @@ async function main(): Promise<void> {
6662
}
6763

6864
try {
69-
const result = await $`bun link ${packages}`;
65+
await $`bun link ${packages}`;
7066
console.log(`✅ Successfully linked ${packages.length} package(s)`);
7167
} catch (error) {
7268
console.error(

src/cli/groups/bootstrap.ts

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
import { runTasks, runWorkflow } from "@workglow/cli";
2-
import { pipe } from "@workglow/task-graph";
1+
/**
2+
* @license
3+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
import { withCli } from "@workglow/cli";
38
import type { Command } from "commander";
9+
import { pipe, type ITask, type IWorkflow } from "workglow";
410
import { BootstrapDownloadTask } from "../../task/bootstrap/BootstrapDownloadTask";
5-
import { BootstrapSubmissionsTask } from "../../task/submissions/BootstrapSubmissionsTask";
6-
import { BootstrapCompanyFactsTask } from "../../task/facts/BootstrapCompanyFactsTask";
711
import { FetchAllCikNamesTask } from "../../task/ciknames/FetchAllCikNamesTask";
812
import { StoreCikNamesTask } from "../../task/ciknames/StoreCikNamesTask";
13+
import { BootstrapCompanyFactsTask } from "../../task/facts/BootstrapCompanyFactsTask";
914
import { UpdateAllFormsTask } from "../../task/forms/UpdateAllFormsTask";
15+
import { BootstrapSubmissionsTask } from "../../task/submissions/BootstrapSubmissionsTask";
1016
import { runCommand } from "../runCommand";
1117

1218
const BULK_DOWNLOADS = {
@@ -33,22 +39,30 @@ export function addBootstrapCommands(program: Command): void {
3339
.action(async (options) => {
3440
await runCommand(
3541
async () => {
42+
const force = options.force ?? false;
43+
const tasks: ITask[] = [];
3644
if (!options.skipDownload) {
37-
for (const config of Object.values(BULK_DOWNLOADS)) {
38-
const task = new BootstrapDownloadTask(config);
39-
await runTasks(task);
40-
}
45+
tasks.push(
46+
...Object.values(BULK_DOWNLOADS).map((config) => new BootstrapDownloadTask(config))
47+
);
4148
}
4249

4350
if (!options.skipIngest) {
44-
const cikWf = pipe([new FetchAllCikNamesTask(), new StoreCikNamesTask()]);
45-
await runWorkflow(cikWf);
46-
await runTasks(new BootstrapSubmissionsTask({ force: options.force }));
47-
await runTasks(new BootstrapCompanyFactsTask({ force: options.force }));
51+
tasks.push(
52+
new FetchAllCikNamesTask(),
53+
new StoreCikNamesTask(),
54+
new BootstrapSubmissionsTask({ force }),
55+
new BootstrapCompanyFactsTask({ force })
56+
);
4857
}
4958

5059
if (!options.skipForms) {
51-
await runTasks(new UpdateAllFormsTask({ form: ["D", "C"], force: options.force }));
60+
tasks.push(new UpdateAllFormsTask({ form: ["D", "C"], force }));
61+
}
62+
63+
if (tasks.length > 0) {
64+
const wf = (pipe as (tasks: ITask[]) => IWorkflow)(tasks);
65+
await withCli(wf).run();
5266
}
5367
},
5468
{ force: options.force }
@@ -62,14 +76,12 @@ export function addBootstrapCommands(program: Command): void {
6276
await runCommand(async () => {
6377
if (type === "ciks") {
6478
const wf = pipe([new FetchAllCikNamesTask(), new StoreCikNamesTask()]);
65-
await runWorkflow(wf);
79+
await withCli(wf).run();
6680
return;
6781
}
6882

6983
if (type !== "submissions" && type !== "facts" && type !== "all") {
70-
throw new Error(
71-
`Invalid type "${type}". Must be submissions, facts, ciks, or all.`
72-
);
84+
throw new Error(`Invalid type "${type}". Must be submissions, facts, ciks, or all.`);
7385
}
7486

7587
const types: (keyof typeof BULK_DOWNLOADS)[] =
@@ -78,7 +90,7 @@ export function addBootstrapCommands(program: Command): void {
7890
for (const t of types) {
7991
const config = BULK_DOWNLOADS[t];
8092
const task = new BootstrapDownloadTask(config);
81-
await runTasks(task);
93+
await withCli(task).run();
8294
}
8395
});
8496
});
@@ -94,15 +106,15 @@ export function addBootstrapCommands(program: Command): void {
94106

95107
if (target === "cik-names" || target === "all") {
96108
const wf = pipe([new FetchAllCikNamesTask(), new StoreCikNamesTask()]);
97-
await runWorkflow(wf);
109+
await withCli(wf).run();
98110
}
99111

100112
if (target === "submissions" || target === "all") {
101-
await runTasks(new BootstrapSubmissionsTask({ force: options.force }));
113+
await withCli(new BootstrapSubmissionsTask({ force: options.force })).run();
102114
}
103115

104116
if (target === "facts" || target === "all") {
105-
await runTasks(new BootstrapCompanyFactsTask({ force: options.force }));
117+
await withCli(new BootstrapCompanyFactsTask({ force: options.force })).run();
106118
}
107119

108120
if (

src/cli/groups/fetch.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import { runTasks, runWorkflow } from "@workglow/cli";
2-
import { Workflow } from "@workglow/task-graph";
1+
import { withCli } from "@workglow/cli";
32
import type { Command } from "commander";
4-
import { FetchSubmissionsTask } from "../../task/submissions/FetchSubmissionsTask";
5-
import { StoreSubmissionsTask } from "../../task/submissions/StoreSubmissionsTask";
3+
import { Workflow } from "workglow";
64
import { FetchCompanyFactsTask } from "../../task/facts/FetchCompanyFactsTask";
75
import { StoreCompanyFactsTask } from "../../task/facts/StoreCompanyFactsTask";
86
import { FetchAndStoreFormsTask } from "../../task/forms/FetchAndStoreFormsTask";
97
import { ProcessAccessionDocFormTask } from "../../task/forms/ProcessAccessionDocFormTask";
8+
import { FetchSubmissionsTask } from "../../task/submissions/FetchSubmissionsTask";
9+
import { StoreSubmissionsTask } from "../../task/submissions/StoreSubmissionsTask";
1010
import { secDate } from "../../util/parseDate";
1111
import { runCommand } from "../runCommand";
1212

1313
export function addFetchCommands(program: Command): void {
14-
const fetch = program
15-
.command("fetch")
16-
.description("Fetch data for a single entity");
14+
const fetch = program.command("fetch").description("Fetch data for a single entity");
1715

1816
fetch
1917
.command("submissions <cik>")
@@ -29,7 +27,7 @@ export function addFetchCommands(program: Command): void {
2927
}),
3028
new StoreSubmissionsTask()
3129
);
32-
await runWorkflow(wf);
30+
await withCli(wf).run();
3331
});
3432
});
3533

@@ -47,7 +45,7 @@ export function addFetchCommands(program: Command): void {
4745
}),
4846
new StoreCompanyFactsTask()
4947
);
50-
await runWorkflow(wf);
48+
await withCli(wf).run();
5149
});
5250
});
5351

@@ -61,7 +59,7 @@ export function addFetchCommands(program: Command): void {
6159
form,
6260
docid: accession,
6361
});
64-
await runTasks(task);
62+
await withCli(task).run();
6563
});
6664
});
6765

@@ -74,7 +72,7 @@ export function addFetchCommands(program: Command): void {
7472
accessionNumber: accession,
7573
fileName: filename,
7674
});
77-
await runTasks(task);
75+
await withCli(task).run();
7876
});
7977
});
8078
}

src/cli/groups/init.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { Command } from "commander";
2-
import { createInterface } from "readline";
32
import { existsSync, mkdirSync, writeFileSync } from "fs";
4-
import { resolve } from "path";
53
import { homedir } from "os";
6-
import { globalServiceRegistry } from "@workglow/util";
4+
import { resolve } from "path";
5+
import { createInterface } from "readline";
6+
import { globalServiceRegistry } from "workglow";
77
import { setupAllDatabases } from "../../config/setupAllDatabases";
8+
import { SEC_DRY_RUN } from "../../config/tokens";
89
import { parseGlobalOptions } from "../GlobalOptions";
910
import { runCommand } from "../runCommand";
10-
import { SEC_DRY_RUN } from "../../config/tokens";
1111

1212
export interface InitConfig {
1313
readonly dbType: "sqlite" | "postgres";
@@ -49,10 +49,7 @@ export function buildEnvConfig(config: InitConfig): string {
4949
return lines.join("\n") + "\n";
5050
}
5151

52-
function prompt(
53-
rl: ReturnType<typeof createInterface>,
54-
question: string
55-
): Promise<string> {
52+
function prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {
5653
return new Promise((resolve) => {
5754
rl.question(question, (answer) => {
5855
resolve(answer.trim());
@@ -81,39 +78,31 @@ export function addInitCommand(parent: Command): void {
8178
const defaultDbFolder = resolve(homedir(), ".sec/data");
8279
const defaultRawFolder = resolve(homedir(), ".sec/raw");
8380

84-
const dbTypeAnswer = await prompt(
85-
rl,
86-
"Database type (sqlite or postgres) [sqlite]: "
87-
);
81+
const dbTypeAnswer = await prompt(rl, "Database type (sqlite or postgres) [sqlite]: ");
8882
const dbType = dbTypeAnswer === "postgres" ? "postgres" : "sqlite";
8983

9084
const dbFolder =
9185
(await prompt(rl, `Database folder [${defaultDbFolder}]: `)) || defaultDbFolder;
9286

93-
const dbName = (await prompt(rl, 'Database name [edgar]: ')) || "edgar";
87+
const dbName = (await prompt(rl, "Database name [edgar]: ")) || "edgar";
9488

9589
const rawDataFolder =
9690
(await prompt(rl, `Raw data folder [${defaultRawFolder}]: `)) || defaultRawFolder;
9791

9892
let pgFields: Partial<InitConfig> = {};
9993

10094
if (dbType === "postgres") {
101-
const useUrl = await prompt(
102-
rl,
103-
"Use a connection string? (y/n) [n]: "
104-
);
95+
const useUrl = await prompt(rl, "Use a connection string? (y/n) [n]: ");
10596

10697
if (useUrl.toLowerCase() === "y") {
10798
const pgUrl = await prompt(rl, "PostgreSQL connection string: ");
10899
pgFields = { pgUrl };
109100
} else {
110-
const pgHost =
111-
(await prompt(rl, "PostgreSQL host [localhost]: ")) || "localhost";
101+
const pgHost = (await prompt(rl, "PostgreSQL host [localhost]: ")) || "localhost";
112102
const pgPort = (await prompt(rl, "PostgreSQL port [5432]: ")) || "5432";
113103
const pgUser = await prompt(rl, "PostgreSQL user: ");
114104
const pgPassword = await prompt(rl, "PostgreSQL password: ");
115-
const pgDatabase =
116-
(await prompt(rl, "PostgreSQL database [edgar]: ")) || "edgar";
105+
const pgDatabase = (await prompt(rl, "PostgreSQL database [edgar]: ")) || "edgar";
117106

118107
pgFields = { pgHost, pgPort, pgUser, pgPassword, pgDatabase };
119108
}

0 commit comments

Comments
 (0)