ddd-ts-kit 0.23.0 → 0.24.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/CHANGELOG.md +59 -0
- package/README.fr.md +42 -7
- package/README.md +38 -6
- package/dist/check/canonical/stray-entry.d.ts +8 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -0
- package/dist/check/canonical/stray-entry.js +75 -0
- package/dist/check/canonical/stray-entry.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +1 -0
- package/dist/check/catalogue/default-severities.js.map +1 -1
- package/dist/check/explain/clean-docs.js +1 -1
- package/dist/check/explain/clean-docs.js.map +1 -1
- package/dist/check/explain/persistence-docs.js +1 -1
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +5 -0
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/fixtures/clean-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/clean-fixtures.js +16 -0
- package/dist/check/fixtures/clean-fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +17 -0
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/migrations/drizzle-history-findings.js +1 -1
- package/dist/check/migrations/drizzle-history-findings.js.map +1 -1
- package/dist/check/rules/clean-function-size.js +10 -2
- package/dist/check/rules/clean-function-size.js.map +1 -1
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +4 -68
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/check/rules/tree-documented-paths.d.ts +3 -0
- package/dist/check/rules/tree-documented-paths.d.ts.map +1 -0
- package/dist/check/rules/tree-documented-paths.js +54 -0
- package/dist/check/rules/tree-documented-paths.js.map +1 -0
- package/dist/commands/doctor.d.ts +4 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +15 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/drizzle-generate.d.ts +6 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +39 -6
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/plan-waves.d.ts +9 -0
- package/dist/commands/plan-waves.d.ts.map +1 -0
- package/dist/commands/plan-waves.js +36 -0
- package/dist/commands/plan-waves.js.map +1 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +4 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/doctor/diagnose.d.ts +9 -0
- package/dist/doctor/diagnose.d.ts.map +1 -0
- package/dist/doctor/diagnose.js +34 -0
- package/dist/doctor/diagnose.js.map +1 -0
- package/dist/doctor/doctor-finding.d.ts +11 -0
- package/dist/doctor/doctor-finding.d.ts.map +1 -0
- package/dist/doctor/doctor-finding.js +2 -0
- package/dist/doctor/doctor-finding.js.map +1 -0
- package/dist/doctor/format-diagnosis.d.ts +4 -0
- package/dist/doctor/format-diagnosis.d.ts.map +1 -0
- package/dist/doctor/format-diagnosis.js +25 -0
- package/dist/doctor/format-diagnosis.js.map +1 -0
- package/dist/doctor/package-findings.d.ts +8 -0
- package/dist/doctor/package-findings.d.ts.map +1 -0
- package/dist/doctor/package-findings.js +21 -0
- package/dist/doctor/package-findings.js.map +1 -0
- package/dist/doctor/permission-findings.d.ts +5 -0
- package/dist/doctor/permission-findings.d.ts.map +1 -0
- package/dist/doctor/permission-findings.js +16 -0
- package/dist/doctor/permission-findings.js.map +1 -0
- package/dist/doctor/script-findings.d.ts +5 -0
- package/dist/doctor/script-findings.d.ts.map +1 -0
- package/dist/doctor/script-findings.js +12 -0
- package/dist/doctor/script-findings.js.map +1 -0
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +25 -4
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +3 -0
- package/dist/help/usage.js.map +1 -1
- package/dist/init/agent-permissions.d.ts +8 -0
- package/dist/init/agent-permissions.d.ts.map +1 -0
- package/dist/init/agent-permissions.js +55 -0
- package/dist/init/agent-permissions.js.map +1 -0
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +7 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/write-agent-settings.d.ts.map +1 -1
- package/dist/init/write-agent-settings.js +1 -54
- package/dist/init/write-agent-settings.js.map +1 -1
- package/dist/migration/branch-migration.d.ts +9 -0
- package/dist/migration/branch-migration.d.ts.map +1 -0
- package/dist/migration/branch-migration.js +2 -0
- package/dist/migration/branch-migration.js.map +1 -0
- package/dist/migration/branch-migrations.d.ts +16 -0
- package/dist/migration/branch-migrations.d.ts.map +1 -0
- package/dist/migration/branch-migrations.js +48 -0
- package/dist/migration/branch-migrations.js.map +1 -0
- package/dist/migration/delete-branch-migrations.d.ts +9 -0
- package/dist/migration/delete-branch-migrations.d.ts.map +1 -0
- package/dist/migration/delete-branch-migrations.js +23 -0
- package/dist/migration/delete-branch-migrations.js.map +1 -0
- package/dist/migration/drizzle-run.d.ts +7 -0
- package/dist/migration/drizzle-run.d.ts.map +1 -0
- package/dist/migration/drizzle-run.js +2 -0
- package/dist/migration/drizzle-run.js.map +1 -0
- package/dist/migration/drizzle-silent-failures.js +1 -1
- package/dist/migration/drizzle-silent-failures.js.map +1 -1
- package/dist/migration/find-project-formatter.d.ts +8 -0
- package/dist/migration/find-project-formatter.d.ts.map +1 -0
- package/dist/migration/find-project-formatter.js +52 -0
- package/dist/migration/find-project-formatter.js.map +1 -0
- package/dist/migration/format-written-files.d.ts +9 -0
- package/dist/migration/format-written-files.d.ts.map +1 -0
- package/dist/migration/format-written-files.js +32 -0
- package/dist/migration/format-written-files.js.map +1 -0
- package/dist/migration/generate-and-read.d.ts +6 -0
- package/dist/migration/generate-and-read.d.ts.map +1 -0
- package/dist/migration/generate-and-read.js +14 -0
- package/dist/migration/generate-and-read.js.map +1 -0
- package/dist/migration/index.d.ts +4 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +4 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/known-primary-keys.d.ts +3 -0
- package/dist/migration/known-primary-keys.d.ts.map +1 -0
- package/dist/migration/known-primary-keys.js +2 -0
- package/dist/migration/known-primary-keys.js.map +1 -0
- package/dist/migration/migration-files.d.ts +7 -0
- package/dist/migration/migration-files.d.ts.map +1 -0
- package/dist/migration/migration-files.js +29 -0
- package/dist/migration/migration-files.js.map +1 -0
- package/dist/migration/plan-replay.d.ts +9 -0
- package/dist/migration/plan-replay.d.ts.map +1 -0
- package/dist/migration/plan-replay.js +68 -0
- package/dist/migration/plan-replay.js.map +1 -0
- package/dist/migration/previous-primary-keys.d.ts +9 -0
- package/dist/migration/previous-primary-keys.d.ts.map +1 -0
- package/dist/migration/previous-primary-keys.js +55 -0
- package/dist/migration/previous-primary-keys.js.map +1 -0
- package/dist/migration/primary-key-order-finding.d.ts +12 -0
- package/dist/migration/primary-key-order-finding.d.ts.map +1 -0
- package/dist/migration/primary-key-order-finding.js +2 -0
- package/dist/migration/primary-key-order-finding.js.map +1 -0
- package/dist/migration/primary-key-order-findings.d.ts +12 -0
- package/dist/migration/primary-key-order-findings.d.ts.map +1 -0
- package/dist/migration/primary-key-order-findings.js +55 -0
- package/dist/migration/primary-key-order-findings.js.map +1 -0
- package/dist/migration/project-formatter.d.ts +9 -0
- package/dist/migration/project-formatter.d.ts.map +1 -0
- package/dist/migration/project-formatter.js +2 -0
- package/dist/migration/project-formatter.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +15 -0
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -0
- package/dist/migration/replay-drizzle-migrations.js +63 -0
- package/dist/migration/replay-drizzle-migrations.js.map +1 -0
- package/dist/migration/replay-plan.d.ts +11 -0
- package/dist/migration/replay-plan.d.ts.map +1 -0
- package/dist/migration/replay-plan.js +2 -0
- package/dist/migration/replay-plan.js.map +1 -0
- package/dist/migration/replayed-name.d.ts +7 -0
- package/dist/migration/replayed-name.d.ts.map +1 -0
- package/dist/migration/replayed-name.js +12 -0
- package/dist/migration/replayed-name.js.map +1 -0
- package/dist/migration/sql-statement.d.ts +6 -0
- package/dist/migration/sql-statement.d.ts.map +1 -0
- package/dist/migration/sql-statement.js +2 -0
- package/dist/migration/sql-statement.js.map +1 -0
- package/dist/migration/sql-statements.d.ts +4 -0
- package/dist/migration/sql-statements.d.ts.map +1 -0
- package/dist/migration/sql-statements.js +36 -0
- package/dist/migration/sql-statements.js.map +1 -0
- package/dist/migration/table-change.d.ts +12 -0
- package/dist/migration/table-change.d.ts.map +1 -0
- package/dist/migration/table-change.js +2 -0
- package/dist/migration/table-change.js.map +1 -0
- package/dist/migration/table-changes.d.ts +9 -0
- package/dist/migration/table-changes.d.ts.map +1 -0
- package/dist/migration/table-changes.js +55 -0
- package/dist/migration/table-changes.js.map +1 -0
- package/dist/migration/tidy-written-migration.d.ts +5 -0
- package/dist/migration/tidy-written-migration.d.ts.map +1 -0
- package/dist/migration/tidy-written-migration.js +8 -0
- package/dist/migration/tidy-written-migration.js.map +1 -0
- package/dist/migration/wait-for-next-second.d.ts +6 -0
- package/dist/migration/wait-for-next-second.d.ts.map +1 -0
- package/dist/migration/wait-for-next-second.js +11 -0
- package/dist/migration/wait-for-next-second.js.map +1 -0
- package/dist/migration/warn-primary-key-order.d.ts +5 -0
- package/dist/migration/warn-primary-key-order.d.ts.map +1 -0
- package/dist/migration/warn-primary-key-order.js +16 -0
- package/dist/migration/warn-primary-key-order.js.map +1 -0
- package/dist/migration/written-migration.d.ts +9 -0
- package/dist/migration/written-migration.d.ts.map +1 -0
- package/dist/migration/written-migration.js +2 -0
- package/dist/migration/written-migration.js.map +1 -0
- package/dist/migration/written-paths.d.ts +3 -0
- package/dist/migration/written-paths.d.ts.map +1 -0
- package/dist/migration/written-paths.js +5 -0
- package/dist/migration/written-paths.js.map +1 -0
- package/dist/plan/aggregates-of.d.ts +6 -0
- package/dist/plan/aggregates-of.d.ts.map +1 -0
- package/dist/plan/aggregates-of.js +13 -0
- package/dist/plan/aggregates-of.js.map +1 -0
- package/dist/plan/batched-waves.d.ts +18 -0
- package/dist/plan/batched-waves.d.ts.map +1 -0
- package/dist/plan/batched-waves.js +73 -0
- package/dist/plan/batched-waves.js.map +1 -0
- package/dist/plan/cycles-of.d.ts +8 -0
- package/dist/plan/cycles-of.d.ts.map +1 -0
- package/dist/plan/cycles-of.js +30 -0
- package/dist/plan/cycles-of.js.map +1 -0
- package/dist/plan/format-plan.d.ts +4 -0
- package/dist/plan/format-plan.d.ts.map +1 -0
- package/dist/plan/format-plan.js +53 -0
- package/dist/plan/format-plan.js.map +1 -0
- package/dist/plan/merge-order.d.ts +8 -0
- package/dist/plan/merge-order.d.ts.map +1 -0
- package/dist/plan/merge-order.js +32 -0
- package/dist/plan/merge-order.js.map +1 -0
- package/dist/plan/plan-problems.d.ts +8 -0
- package/dist/plan/plan-problems.d.ts.map +1 -0
- package/dist/plan/plan-problems.js +57 -0
- package/dist/plan/plan-problems.js.map +1 -0
- package/dist/plan/plan-waves.d.ts +16 -0
- package/dist/plan/plan-waves.d.ts.map +1 -0
- package/dist/plan/plan-waves.js +23 -0
- package/dist/plan/plan-waves.js.map +1 -0
- package/dist/plan/rows-to-plan.d.ts +7 -0
- package/dist/plan/rows-to-plan.d.ts.map +1 -0
- package/dist/plan/rows-to-plan.js +19 -0
- package/dist/plan/rows-to-plan.js.map +1 -0
- package/dist/plan/wave-numbers.d.ts +8 -0
- package/dist/plan/wave-numbers.d.ts.map +1 -0
- package/dist/plan/wave-numbers.js +27 -0
- package/dist/plan/wave-numbers.js.map +1 -0
- package/dist/plan/wave-plan.d.ts +48 -0
- package/dist/plan/wave-plan.d.ts.map +1 -0
- package/dist/plan/wave-plan.js +2 -0
- package/dist/plan/wave-plan.js.map +1 -0
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +16 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +11 -1
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/read-progress.d.ts +6 -2
- package/dist/progress/read-progress.d.ts.map +1 -1
- package/dist/progress/read-progress.js +10 -5
- package/dist/progress/read-progress.js.map +1 -1
- package/dist/progress/status-row-of.d.ts +16 -0
- package/dist/progress/status-row-of.d.ts.map +1 -0
- package/dist/progress/status-row-of.js +23 -0
- package/dist/progress/status-row-of.js.map +1 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/dist/slice/changed-entries.d.ts +7 -0
- package/dist/slice/changed-entries.d.ts.map +1 -0
- package/dist/slice/changed-entries.js +20 -0
- package/dist/slice/changed-entries.js.map +1 -0
- package/dist/slice/changed-entry.d.ts +6 -0
- package/dist/slice/changed-entry.d.ts.map +1 -0
- package/dist/slice/changed-entry.js +2 -0
- package/dist/slice/changed-entry.js.map +1 -0
- package/dist/slice/format-slice-verification.d.ts.map +1 -1
- package/dist/slice/format-slice-verification.js +10 -0
- package/dist/slice/format-slice-verification.js.map +1 -1
- package/dist/slice/plan-staging.d.ts +13 -0
- package/dist/slice/plan-staging.d.ts.map +1 -0
- package/dist/slice/plan-staging.js +52 -0
- package/dist/slice/plan-staging.js.map +1 -0
- package/dist/slice/slice-verification.d.ts +3 -0
- package/dist/slice/slice-verification.d.ts.map +1 -1
- package/dist/slice/staging-plan.d.ts +6 -0
- package/dist/slice/staging-plan.d.ts.map +1 -0
- package/dist/slice/staging-plan.js +2 -0
- package/dist/slice/staging-plan.js.map +1 -0
- package/dist/slice/verify-slice.d.ts.map +1 -1
- package/dist/slice/verify-slice.js +3 -2
- package/dist/slice/verify-slice.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.js +1 -1
- package/dist/worker/briefing-of.js.map +1 -1
- package/dist/worker/rows-on-branches.d.ts +8 -0
- package/dist/worker/rows-on-branches.d.ts.map +1 -0
- package/dist/worker/rows-on-branches.js +9 -0
- package/dist/worker/rows-on-branches.js.map +1 -0
- package/package.json +2 -2
- package/templates/e2e/e2e.spec.ts.tpl +2 -2
- package/templates/init/e2e/start-application.database.ts.tpl +30 -1
- package/templates/init/e2e/start-application.memory.ts.tpl +30 -1
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +4 -0
- package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +18 -1
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +18 -1
- package/templates/init/platform/database/test-database-template.ts.tpl +23 -0
- package/templates/init/rules/tests.md.tpl +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/vitest.config.ts.tpl +6 -0
- package/dist/slice/paths-to-stage.d.ts +0 -6
- package/dist/slice/paths-to-stage.d.ts.map +0 -1
- package/dist/slice/paths-to-stage.js +0 -13
- package/dist/slice/paths-to-stage.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { lineOf } from '../support/line-of.js';
|
|
2
|
-
const REGENERATE = 'Keep the migrations of the main branch, delete the one of your branch (its .sql file, its snapshot under meta/ and its entry of meta/_journal.json), then run `npm run db:generate <name>` again on top of them.';
|
|
2
|
+
const REGENERATE = 'Keep the migrations of the main branch, delete the one of your branch (its .sql file, its snapshot under meta/ and its entry of meta/_journal.json), then run `npm run db:generate <name>` again on top of them, or let `npx ddd-ts-kit drizzle-generate --replay` do both.';
|
|
3
3
|
/**
|
|
4
4
|
* What makes drizzle-kit and its migrator misbehave after a merge: an entry without its file or
|
|
5
5
|
* the reverse, entries out of the order they were generated in (the migrator skips a migration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-history-findings.js","sourceRoot":"","sources":["../../../src/check/migrations/drizzle-history-findings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,UAAU,GACd,
|
|
1
|
+
{"version":3,"file":"drizzle-history-findings.js","sourceRoot":"","sources":["../../../src/check/migrations/drizzle-history-findings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/C,MAAM,UAAU,GACd,6QAA6Q,CAAC;AAEhR;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAA6B;IAClE,OAAO,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAqB;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE/C,MAAM,YAAY,GAAG,OAAO;SACzB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAC7C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACf,IAAI,EAAE,MAAM,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC;QAC3C,OAAO,EAAE,oCAAoC,KAAK,CAAC,GAAG,SAAS,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CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -33,7 +33,7 @@ function measured(file) {
|
|
|
33
33
|
const measure = (shape, label) => ({
|
|
34
34
|
label,
|
|
35
35
|
line: shape.line,
|
|
36
|
-
parameters: shape.parameters
|
|
36
|
+
parameters: countedParameters(shape.parameters),
|
|
37
37
|
bodyLines: shape.bodyLines,
|
|
38
38
|
isComposition,
|
|
39
39
|
});
|
|
@@ -63,13 +63,21 @@ function ceilingFlaw(label, bodyLines) {
|
|
|
63
63
|
fix: SPLIT_FIX,
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
/** A parameter typed `Actor` or `Date`: who acts and when, the context of an intention rather than its input. */
|
|
67
|
+
const CONTEXT_PARAMETER = /^[\w$]+\s*:\s*(?:Actor|Date)\s*$/;
|
|
68
|
+
/** The parameters a signature is judged on: one that carries the actor or the instant is not counted. */
|
|
69
|
+
function countedParameters(parameters) {
|
|
70
|
+
return parameters.some((parameter) => CONTEXT_PARAMETER.test(parameter.trim()))
|
|
71
|
+
? parameters.length - 1
|
|
72
|
+
: parameters.length;
|
|
73
|
+
}
|
|
66
74
|
function tooManyParameters(shape, limits) {
|
|
67
75
|
if (shape.isInjected || shape.parameters <= limits.maxParameters) {
|
|
68
76
|
return [];
|
|
69
77
|
}
|
|
70
78
|
return [
|
|
71
79
|
{
|
|
72
|
-
message: `${shape.label} takes ${shape.parameters} parameters (limit ${limits.maxParameters}).`,
|
|
80
|
+
message: `${shape.label} takes ${shape.parameters} parameters (limit ${limits.maxParameters}, an actor or an instant not counted).`,
|
|
73
81
|
fix: 'Group the parameters that travel together into a typed props object or a value object (`Invoice.draft({ customer, lines, currency, draftedAt })`): they are a concept that has no name yet. Never add one more parameter, nor split the function only to get under the limit.',
|
|
74
82
|
},
|
|
75
83
|
];
|
|
@@ -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+Q;SACrR;KACF,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAe,EAAE,MAAc;IAC9C,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACtE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,OAAO,KAAK,CAAC,SAAS,sBAAsB,MAAM,CAAC,gBAAgB,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE;KACnH,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-closed.d.ts","sourceRoot":"","sources":["../../../src/check/rules/tree-closed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree-closed.d.ts","sourceRoot":"","sources":["../../../src/check/rules/tree-closed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,eAAO,MAAM,UAAU,EAAE,IA4BxB,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { barrelFile, dependenciesFile } from '../../declared/index.js';
|
|
3
|
-
import { isCanonicalDirectory } from '../canonical/is-canonical-directory.js';
|
|
4
|
-
import { OPEN_DIRECTORIES } from '../canonical/open-directories.js';
|
|
5
|
-
import { roleOf } from '../canonical/role-of.js';
|
|
1
|
+
import { strayEntry } from '../canonical/stray-entry.js';
|
|
6
2
|
import { reporter } from '../support/reporter.js';
|
|
7
3
|
export const treeClosed = {
|
|
8
4
|
id: 'tree/closed',
|
|
@@ -13,78 +9,18 @@ export const treeClosed = {
|
|
|
13
9
|
// A rejected directory is reported once: what it holds is not reported again.
|
|
14
10
|
const rejected = [];
|
|
15
11
|
return project.contextEntries.flatMap((entry) => {
|
|
16
|
-
|
|
17
|
-
if (placed === undefined || rejected.some((parent) => entry.startsWith(parent))) {
|
|
12
|
+
if (rejected.some((parent) => entry.startsWith(parent))) {
|
|
18
13
|
return [];
|
|
19
14
|
}
|
|
20
|
-
const
|
|
21
|
-
const flaw = isDirectory ? strayDirectory(placed) : straySource(placed);
|
|
15
|
+
const flaw = strayEntry(entry, project.config);
|
|
22
16
|
if (flaw === undefined) {
|
|
23
17
|
return [];
|
|
24
18
|
}
|
|
25
|
-
if (
|
|
19
|
+
if (entry.endsWith('/')) {
|
|
26
20
|
rejected.push(entry);
|
|
27
21
|
}
|
|
28
22
|
return [report({ file: entry.replace(/\/$/, ''), line: 1 }, flaw.message, flaw.fix)];
|
|
29
23
|
});
|
|
30
24
|
},
|
|
31
25
|
};
|
|
32
|
-
function place(entry, { contextsDir, contexts, stack }) {
|
|
33
|
-
const [context = '', ...rest] = entry
|
|
34
|
-
.slice(contextsDir.length + 1)
|
|
35
|
-
.replace(/\/$/, '')
|
|
36
|
-
.split('/');
|
|
37
|
-
if (rest.length === 0) {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
context,
|
|
42
|
-
declared: stack.style === 'declared',
|
|
43
|
-
inside: rest.join('/'),
|
|
44
|
-
extras: contexts[context]?.extraDirectories ?? [],
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function strayDirectory({ context, inside, extras }) {
|
|
48
|
-
if (isCanonicalDirectory(inside) || coveredByExtra(extras, inside)) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
message: `"${inside}" is not a directory of the canonical tree.`,
|
|
53
|
-
fix: `Move its files to the canonical directory of their role (see \`ddd-ts-kit explain tree/closed\`), or, if this is a design decision, add "${inside}" to contexts.${context}.extraDirectories in ddd-ts-kit.config.json.`,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function straySource(placed) {
|
|
57
|
-
const { inside, extras } = placed;
|
|
58
|
-
if (!inside.endsWith('.ts')) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const directory = path.posix.dirname(inside);
|
|
62
|
-
if (directory === '.') {
|
|
63
|
-
return atContextRoot(placed);
|
|
64
|
-
}
|
|
65
|
-
const open = OPEN_DIRECTORIES.some((root) => directory === root || directory.startsWith(`${root}/`));
|
|
66
|
-
if (open || roleOf(directory) !== undefined || coveredByExtra(extras, directory)) {
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
message: `"${inside}" is not in a role directory.`,
|
|
71
|
-
fix: `Move it one level down into the directory of its role (for example ${directory.split('/')[0] ?? directory}/<role>/), so that its suffix and its tests can be checked.`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function atContextRoot({ context, declared, inside: file }) {
|
|
75
|
-
const generated = [barrelFile(context), dependenciesFile(context)];
|
|
76
|
-
if (file === `${context}.module.ts` || (declared && generated.includes(file))) {
|
|
77
|
-
return undefined;
|
|
78
|
-
}
|
|
79
|
-
const allowed = declared
|
|
80
|
-
? `CONTEXT.md, the generated ${generated.join(' or ')} and ${context}.module.ts`
|
|
81
|
-
: `CONTEXT.md and ${context}.module.ts`;
|
|
82
|
-
return {
|
|
83
|
-
message: `"${file}" sits at the root of the context.`,
|
|
84
|
-
fix: `Move it into the directory of its role; only ${allowed} live at the root of a context.`,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
function coveredByExtra(extras, directory) {
|
|
88
|
-
return extras.some((extra) => directory === extra || directory.startsWith(`${extra}/`) || extra.startsWith(`${directory}/`));
|
|
89
|
-
}
|
|
90
26
|
//# sourceMappingURL=tree-closed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-closed.js","sourceRoot":"","sources":["../../../src/check/rules/tree-closed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tree-closed.js","sourceRoot":"","sources":["../../../src/check/rules/tree-closed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,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AE,MAAM,kBAAkB,CAAC;AAS7C,eAAO,MAAM,mBAAmB,EAAE,IAmBjC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { strayEntry } from '../canonical/stray-entry.js';
|
|
4
|
+
import { reporter } from '../support/reporter.js';
|
|
5
|
+
/** Where the plan, the design notes and the reviews of a project live. */
|
|
6
|
+
const ARCHITECTURE_DOCS = 'docs/architecture';
|
|
7
|
+
/** A path written as code in Markdown, a `:line` after it left out. */
|
|
8
|
+
const CITED = /`([^`\s]+?)(?::\d+)?`/g;
|
|
9
|
+
export const treeDocumentedPaths = {
|
|
10
|
+
id: 'tree/documented-paths',
|
|
11
|
+
description: 'A path of a bounded context cited as code in docs/architecture (a plan, a design note, a review) is a place the canonical tree allows: a document that names a directory the tree refuses describes a design the code no longer has.',
|
|
12
|
+
scope: 'project',
|
|
13
|
+
run(project) {
|
|
14
|
+
const report = reporter(project, this.id);
|
|
15
|
+
return markdownUnder(project.root, ARCHITECTURE_DOCS).flatMap((document) => citedFlaws(fs.readFileSync(path.join(project.root, document), 'utf8'), project.config).map(({ line, cited, flaw }) => report({ file: document, line }, `"${cited}" names a place the canonical tree refuses: ${flaw.message}`, `Write the place the code has now (\`npx ddd-ts-kit describe <context>\` lists it), or remove the path; ${flaw.fix}`)));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
/** Each path of a context cited in a document, with the first flaw of its directories or of itself. */
|
|
19
|
+
function citedFlaws(text, config) {
|
|
20
|
+
return text.split('\n').flatMap((content, index) => [...content.matchAll(CITED)].flatMap(([, cited = '']) => {
|
|
21
|
+
const flaw = cited.startsWith(`${config.contextsDir}/`) ? firstFlaw(cited, config) : undefined;
|
|
22
|
+
return flaw === undefined ? [] : [{ line: index + 1, cited, flaw }];
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
/** The directories of a path from the outermost, then the path itself: the first one the tree refuses. */
|
|
26
|
+
function firstFlaw(cited, config) {
|
|
27
|
+
const segments = cited.replace(/\/$/, '').split('/');
|
|
28
|
+
const directories = segments.slice(0, -1).map((_, index) => `${segments.slice(0, index + 1).join('/')}/`);
|
|
29
|
+
const entries = [...directories, cited];
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
const flaw = strayEntry(entry, config);
|
|
32
|
+
if (flaw !== undefined) {
|
|
33
|
+
return flaw;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
function markdownUnder(root, directory) {
|
|
39
|
+
const absolute = path.join(root, directory);
|
|
40
|
+
if (!fs.existsSync(absolute)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return fs
|
|
44
|
+
.readdirSync(absolute, { withFileTypes: true })
|
|
45
|
+
.flatMap((entry) => {
|
|
46
|
+
const relative = `${directory}/${entry.name}`;
|
|
47
|
+
if (entry.isDirectory()) {
|
|
48
|
+
return markdownUnder(root, relative);
|
|
49
|
+
}
|
|
50
|
+
return entry.isFile() && entry.name.endsWith('.md') ? [relative] : [];
|
|
51
|
+
})
|
|
52
|
+
.sort();
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=tree-documented-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-documented-paths.js","sourceRoot":"","sources":["../../../src/check/rules/tree-documented-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAIzD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,uEAAuE;AACvE,MAAM,KAAK,GAAG,wBAAwB,CAAC;AAEvC,MAAM,CAAC,MAAM,mBAAmB,GAAS;IAC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,QAAQ,GAAG,GAAG,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAE9C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC,CAAC;SACD,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,yHAAyH;AACzH,eAAO,MAAM,aAAa,EAAE,OAS3B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readConfig } from '../config/index.js';
|
|
2
|
+
import { diagnose } from '../doctor/diagnose.js';
|
|
3
|
+
import { formatDiagnosis } from '../doctor/format-diagnosis.js';
|
|
4
|
+
import { VERSION } from '../version.js';
|
|
5
|
+
import { Arguments } from './arguments.js';
|
|
6
|
+
/** What an upgrade left to do in the project: the scripts, packages and permissions this version writes and it lacks. */
|
|
7
|
+
export const doctorCommand = (argv, io) => {
|
|
8
|
+
const args = Arguments.parse(argv, { strict: { type: 'boolean', default: false } });
|
|
9
|
+
const root = args.projectRoot;
|
|
10
|
+
const { config } = readConfig(root);
|
|
11
|
+
const findings = diagnose(root, config);
|
|
12
|
+
io.out(args.json ? JSON.stringify({ version: VERSION, findings }, null, 2) : formatDiagnosis(findings, VERSION));
|
|
13
|
+
return args.flag('strict') && findings.some((finding) => finding.problem !== 'written otherwise') ? 1 : 0;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=doctor.js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C"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Command } from './command.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* `db:generate` of a Drizzle project: drizzle-kit generate, which fails instead of succeeding
|
|
4
|
+
* silently when it cannot ask its question, then formats what it wrote and warns about a primary
|
|
5
|
+
* key changed in an order that fails. `--replay` generates again the migrations of a branch on top
|
|
6
|
+
* of the trunk it merged.
|
|
7
|
+
*/
|
|
3
8
|
export declare const drizzleGenerateCommand: Command;
|
|
4
9
|
//# sourceMappingURL=drizzle-generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-generate.d.ts","sourceRoot":"","sources":["../../src/commands/drizzle-generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"drizzle-generate.d.ts","sourceRoot":"","sources":["../../src/commands/drizzle-generate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAyBpC,CAAC"}
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
import { CliError } from '../cli-error.js';
|
|
2
|
-
import {
|
|
2
|
+
import { generateAndRead, replayDrizzleMigrations, tidyWrittenMigration } from '../migration/index.js';
|
|
3
3
|
import { Arguments } from './arguments.js';
|
|
4
|
-
/**
|
|
4
|
+
/** The trunk a branch merged, when `--replay` is not given another. */
|
|
5
|
+
const DEFAULT_BASE = 'origin/main';
|
|
6
|
+
/**
|
|
7
|
+
* `db:generate` of a Drizzle project: drizzle-kit generate, which fails instead of succeeding
|
|
8
|
+
* silently when it cannot ask its question, then formats what it wrote and warns about a primary
|
|
9
|
+
* key changed in an order that fails. `--replay` generates again the migrations of a branch on top
|
|
10
|
+
* of the trunk it merged.
|
|
11
|
+
*/
|
|
5
12
|
export const drizzleGenerateCommand = (argv, io) => {
|
|
6
|
-
const args = Arguments.parse(argv, {
|
|
13
|
+
const args = Arguments.parse(argv, {
|
|
14
|
+
name: { type: 'string' },
|
|
15
|
+
custom: { type: 'boolean', default: false },
|
|
16
|
+
replay: { type: 'boolean', default: false },
|
|
17
|
+
base: { type: 'string' },
|
|
18
|
+
});
|
|
19
|
+
const root = args.projectRoot;
|
|
20
|
+
const interactive = process.stdin.isTTY && process.stdout.isTTY;
|
|
21
|
+
if (args.flag('replay')) {
|
|
22
|
+
refuseNamedReplay(args);
|
|
23
|
+
return replayDrizzleMigrations({ root, base: args.text('base') ?? DEFAULT_BASE, interactive }, io);
|
|
24
|
+
}
|
|
25
|
+
const name = namedMigration(args);
|
|
26
|
+
const { code, written } = generateAndRead({ root, name, custom: args.flag('custom'), interactive }, io);
|
|
27
|
+
if (code === 0) {
|
|
28
|
+
tidyWrittenMigration(written, io);
|
|
29
|
+
}
|
|
30
|
+
return code;
|
|
31
|
+
};
|
|
32
|
+
function refuseNamedReplay(args) {
|
|
33
|
+
if (args.text('name') !== undefined || args.flag('custom')) {
|
|
34
|
+
throw new CliError('A replay generates the migrations of the branch again under their own names, custom ones included.', 'Run `npx ddd-ts-kit drizzle-generate --replay [--base <ref>]`, without --name or --custom.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function namedMigration(args) {
|
|
7
38
|
const name = args.text('name')?.trim() ?? '';
|
|
39
|
+
if (args.text('base') !== undefined) {
|
|
40
|
+
throw new CliError('--base names the trunk of a replay.', 'Run `npx ddd-ts-kit drizzle-generate --replay --base <ref>` after merging the trunk into the branch.');
|
|
41
|
+
}
|
|
8
42
|
if (name === '') {
|
|
9
43
|
throw new CliError('A migration is named by what it does.', 'Run `npm run db:generate <what-it-does>`, for example `npm run db:generate add-invoices`.');
|
|
10
44
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
45
|
+
return name;
|
|
46
|
+
}
|
|
14
47
|
//# sourceMappingURL=drizzle-generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drizzle-generate.js","sourceRoot":"","sources":["../../src/commands/drizzle-generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"drizzle-generate.js","sourceRoot":"","sources":["../../src/commands/drizzle-generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACvG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,uEAAuE;AACvE,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAY,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE;IAC1D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE;QACjC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3C,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3C,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACzB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAEhE,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAExB,OAAO,uBAAuB,CAAC,EAAE,IAAI,EAAE,IAAI,EA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
|
+
* Orders the rows of the slices file not done, of the project or of one context, in waves cut
|
|
4
|
+
* into batches of one or two rows, with the command that briefs each batch and the order of the
|
|
5
|
+
* merges. Exits 1, without waves, while a cycle, an unknown dependency or a row without owner
|
|
6
|
+
* keeps the rows from being ordered.
|
|
7
|
+
*/
|
|
8
|
+
export declare const planWavesCommand: Command;
|
|
9
|
+
//# sourceMappingURL=plan-waves.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-waves.d.ts","sourceRoot":"","sources":["../../src/commands/plan-waves.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAiB9B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { CliError } from '../cli-error.js';
|
|
3
|
+
import { formatPlan } from '../plan/format-plan.js';
|
|
4
|
+
import { planWaves } from '../plan/plan-waves.js';
|
|
5
|
+
import { readSlices, SLICES_FILE } from '../progress/read-slices.js';
|
|
6
|
+
import { Workspace } from '../workspace/index.js';
|
|
7
|
+
import { Arguments } from './arguments.js';
|
|
8
|
+
/**
|
|
9
|
+
* Orders the rows of the slices file not done, of the project or of one context, in waves cut
|
|
10
|
+
* into batches of one or two rows, with the command that briefs each batch and the order of the
|
|
11
|
+
* merges. Exits 1, without waves, while a cycle, an unknown dependency or a row without owner
|
|
12
|
+
* keeps the rows from being ordered.
|
|
13
|
+
*/
|
|
14
|
+
export const planWavesCommand = (argv, io) => {
|
|
15
|
+
const args = Arguments.parse(argv, {});
|
|
16
|
+
const root = args.projectRoot;
|
|
17
|
+
const rows = readSlices(new Workspace(root, false));
|
|
18
|
+
if (rows === undefined) {
|
|
19
|
+
throw new CliError(`${SLICES_FILE} has no slices table.`, 'Plan the slices first (the skill ddd-ts-kit:plan-slices writes the table), then run plan-waves again.');
|
|
20
|
+
}
|
|
21
|
+
const plan = planWaves(rows, { context: contextOf(rows, args.positionals[0]), project: path.basename(root) });
|
|
22
|
+
io.out(args.json ? JSON.stringify(plan, null, 2) : formatPlan(plan));
|
|
23
|
+
return plan.problems.length === 0 ? 0 : 1;
|
|
24
|
+
};
|
|
25
|
+
/** The context asked for, which a row of the file must name; null when none is. */
|
|
26
|
+
function contextOf(rows, asked) {
|
|
27
|
+
if (asked === undefined) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const contexts = [...new Set(rows.map((row) => row.context))].sort();
|
|
31
|
+
if (!contexts.includes(asked)) {
|
|
32
|
+
throw new CliError(`No row of ${SLICES_FILE} is in the context "${asked}".`, `Use one of: ${contexts.join(', ')}.`);
|
|
33
|
+
}
|
|
34
|
+
return asked;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=plan-waves.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-waves.js","sourceRoot":"","sources":["../../src/commands/plan-waves.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAY,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE;IACpD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAC9B,MAAM,I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ACtH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Command } from './command.js';
|
|
2
2
|
/**
|
|
3
3
|
* Prints where the work stands: the next step of the plan, the slices by status and by owner, the markers left in each context.
|
|
4
|
+
* Each slice not done says whether it is ready on the trunk, ready once a worker's branch merges, or waiting.
|
|
4
5
|
* With `--workers`, the workers of a parallel build instead: who builds what in which worktree, and the files two of them change.
|
|
5
6
|
*/
|
|
6
7
|
export declare const statusCommand: Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,OAiB3B,CAAC"}
|
package/dist/commands/status.js
CHANGED
|
@@ -3,21 +3,23 @@ import { formatProgress } from '../progress/format-progress.js';
|
|
|
3
3
|
import { readProgress } from '../progress/read-progress.js';
|
|
4
4
|
import { formatWorkers } from '../worker/format-workers.js';
|
|
5
5
|
import { readWorkers } from '../worker/read-workers.js';
|
|
6
|
+
import { rowsOnBranches } from '../worker/rows-on-branches.js';
|
|
6
7
|
import { Workspace } from '../workspace/index.js';
|
|
7
8
|
import { Arguments } from './arguments.js';
|
|
8
9
|
/**
|
|
9
10
|
* Prints where the work stands: the next step of the plan, the slices by status and by owner, the markers left in each context.
|
|
11
|
+
* Each slice not done says whether it is ready on the trunk, ready once a worker's branch merges, or waiting.
|
|
10
12
|
* With `--workers`, the workers of a parallel build instead: who builds what in which worktree, and the files two of them change.
|
|
11
13
|
*/
|
|
12
14
|
export const statusCommand = (argv, io) => {
|
|
13
15
|
const args = Arguments.parse(argv, { workers: { type: 'boolean', default: false } });
|
|
14
16
|
const root = args.projectRoot;
|
|
17
|
+
const workers = readWorkers(root);
|
|
15
18
|
if (args.flag('workers')) {
|
|
16
|
-
const workers = readWorkers(root);
|
|
17
19
|
io.out(args.json ? JSON.stringify(workers, null, 2) : formatWorkers(workers));
|
|
18
20
|
return 0;
|
|
19
21
|
}
|
|
20
|
-
const progress = readProgress(new Workspace(root, false), readConfig(root).config);
|
|
22
|
+
const progress = readProgress(new Workspace(root, false), readConfig(root).config, rowsOnBranches(workers));
|
|
21
23
|
io.out(args.json ? JSON.stringify(progress, null, 2) : formatProgress(progress));
|
|
22
24
|
return 0;
|
|
23
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,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of what this version of the kit writes, the steps an upgrade leaves to do:
|
|
5
|
+
* scripts, packages of the kit, permissions of the agents. Settings the project does not have
|
|
6
|
+
* are not judged: an agent may run elsewhere than Claude Code.
|
|
7
|
+
*/
|
|
8
|
+
export declare function diagnose(root: string, config: Config): DoctorFinding[];
|
|
9
|
+
//# sourceMappingURL=diagnose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnose.d.ts","sourceRoot":"","sources":["../../src/doctor/diagnose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAgBtE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { isRecord } from '../config/values/is-record.js';
|
|
4
|
+
import { packageFindings } from './package-findings.js';
|
|
5
|
+
import { permissionFindings } from './permission-findings.js';
|
|
6
|
+
import { scriptFindings } from './script-findings.js';
|
|
7
|
+
/**
|
|
8
|
+
* What the project lacks of what this version of the kit writes, the steps an upgrade leaves to do:
|
|
9
|
+
* scripts, packages of the kit, permissions of the agents. Settings the project does not have
|
|
10
|
+
* are not judged: an agent may run elsewhere than Claude Code.
|
|
11
|
+
*/
|
|
12
|
+
export function diagnose(root, config) {
|
|
13
|
+
const manifest = readJson(path.join(root, 'package.json'));
|
|
14
|
+
const scripts = isRecord(manifest) && isRecord(manifest['scripts']) ? manifest['scripts'] : {};
|
|
15
|
+
const installed = {
|
|
16
|
+
...(isRecord(manifest) && isRecord(manifest['dependencies']) ? manifest['dependencies'] : {}),
|
|
17
|
+
...(isRecord(manifest) && isRecord(manifest['devDependencies']) ? manifest['devDependencies'] : {}),
|
|
18
|
+
};
|
|
19
|
+
const settingsFile = path.join(root, '.claude', 'settings.json');
|
|
20
|
+
return [
|
|
21
|
+
...scriptFindings(config, scripts),
|
|
22
|
+
...packageFindings(config, installed),
|
|
23
|
+
...(fs.existsSync(settingsFile) ? permissionFindings(config, readJson(settingsFile)) : []),
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
function readJson(file) {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=diagnose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnose.js","sourceRoot":"","sources":["../../src/doctor/diagnose.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,MAAc;IACnD,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/F,MAAM,SAAS,GAAG;QAChB,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACpG,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAEjE,OAAO;QACL,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC;QAClC,GAAG,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC;QACrC,GAAG,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3F,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** One thing a project lacks, or writes otherwise, compared with what this version of the kit writes. */
|
|
2
|
+
export interface DoctorFinding {
|
|
3
|
+
readonly area: 'script' | 'package' | 'permission';
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly problem: 'missing' | 'other version' | 'written otherwise';
|
|
6
|
+
/** What this version writes. */
|
|
7
|
+
readonly expected: string;
|
|
8
|
+
/** What the project has, when it has something. */
|
|
9
|
+
readonly found?: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=doctor-finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-finding.d.ts","sourceRoot":"","sources":["../../src/doctor/doctor-finding.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,eAAe,GAAG,mBAAmB,CAAC;IACpE,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-finding.js","sourceRoot":"","sources":["../../src/doctor/doctor-finding.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DoctorFinding } from './doctor-finding.js';
|
|
2
|
+
/** The findings by area, each with what this version writes, then how to take what is missing. */
|
|
3
|
+
export declare function formatDiagnosis(findings: readonly DoctorFinding[], version: string): string;
|
|
4
|
+
//# sourceMappingURL=format-diagnosis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-diagnosis.d.ts","sourceRoot":"","sources":["../../src/doctor/format-diagnosis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,kGAAkG;AAClG,wBAAgB,eAAe,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ3F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The findings by area, each with what this version writes, then how to take what is missing. */
|
|
2
|
+
export function formatDiagnosis(findings, version) {
|
|
3
|
+
if (findings.length === 0) {
|
|
4
|
+
return `The project has what ddd-ts-kit ${version} writes: scripts, packages of the kit and permissions.`;
|
|
5
|
+
}
|
|
6
|
+
return [`Compared with what ddd-ts-kit ${version} writes:`, ...findings.map(lineOf), '', ...fixesOf(findings)].join('\n');
|
|
7
|
+
}
|
|
8
|
+
function lineOf({ area, name, problem, expected, found }) {
|
|
9
|
+
const yours = found === undefined ? '' : `; yours: ${found}`;
|
|
10
|
+
return ` ${area} ${name}: ${problem} (${version(area)}${expected}${yours})`;
|
|
11
|
+
}
|
|
12
|
+
function version(area) {
|
|
13
|
+
return area === 'package' ? 'range ' : '';
|
|
14
|
+
}
|
|
15
|
+
function fixesOf(findings) {
|
|
16
|
+
const fixes = ['fix: `npx ddd-ts-kit init` adds what is missing and leaves what the project wrote; then install.'];
|
|
17
|
+
if (findings.some((finding) => finding.area === 'package' && finding.problem === 'other version')) {
|
|
18
|
+
fixes.push('fix: upgrade `ddd-ts-kit` and every `@ddd-ts-kit/*` package together, to the ranges above; the steps of each version are in node_modules/ddd-ts-kit/CHANGELOG.md.');
|
|
19
|
+
}
|
|
20
|
+
if (findings.some((finding) => finding.problem === 'written otherwise')) {
|
|
21
|
+
fixes.push("note: a script written otherwise may be yours on purpose; `npx ddd-ts-kit init --force` writes the kit's version over it.");
|
|
22
|
+
}
|
|
23
|
+
return fixes;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=format-diagnosis.js.map
|