imdone-core 1.54.10 → 2.0.1

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.
Files changed (163) hide show
  1. package/.dependency-cruiser.cjs +412 -0
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.imdoneignore +2 -1
  4. package/README.md +2 -2
  5. package/_index.md +7 -0
  6. package/build.js +57 -0
  7. package/esm-migration.md +446 -0
  8. package/lib/FileProjectContext.js +13 -0
  9. package/lib/ProjectContext.js +19 -18
  10. package/lib/adapters/date-time.js +3 -8
  11. package/lib/adapters/environment.js +3 -0
  12. package/lib/adapters/file-gateway.js +133 -106
  13. package/lib/adapters/git-download.js +36 -16
  14. package/lib/adapters/index.js +9 -0
  15. package/lib/adapters/logger.js +136 -0
  16. package/lib/adapters/markdown.js +31 -19
  17. package/lib/adapters/parsers/DateLanguageParser.js +11 -9
  18. package/lib/adapters/parsers/content-transformer.js +35 -30
  19. package/lib/adapters/parsers/file/LocalFileParserFactory.js +8 -9
  20. package/lib/adapters/parsers/file/ReadStreamCodeParser.js +8 -8
  21. package/lib/adapters/parsers/file/ReadStreamMarkdownParser.js +4 -4
  22. package/lib/adapters/parsers/file/ReadStreamTaskParser.js +5 -3
  23. package/lib/adapters/parsers/file/index.js +4 -0
  24. package/lib/adapters/parsers/function-parser.js +1 -5
  25. package/lib/adapters/parsers/index.js +5 -0
  26. package/lib/adapters/parsers/task/CardContentParser.js +23 -32
  27. package/lib/adapters/parsers/task/CheckStyleTaskParser.js +2 -2
  28. package/lib/adapters/parsers/task/CodeStyleTaskParser.js +2 -2
  29. package/lib/adapters/parsers/task/HashStyleTaskParser.js +3 -3
  30. package/lib/adapters/parsers/task/MarkdownStyleTaskParser.js +2 -2
  31. package/lib/adapters/parsers/task/TaskParser.js +1 -1
  32. package/lib/adapters/parsers/task/index.js +6 -0
  33. package/lib/adapters/storage/config.js +15 -20
  34. package/lib/adapters/storage/index.js +2 -0
  35. package/lib/adapters/storage/tags.js +11 -12
  36. package/lib/adapters/yaml.js +8 -5
  37. package/lib/card.js +25 -26
  38. package/lib/checksum.js +22 -0
  39. package/lib/cli.js +114 -0
  40. package/lib/config.js +106 -71
  41. package/lib/constants.js +21 -50
  42. package/lib/context/ApplicationContext.js +7 -4
  43. package/lib/context/index.js +1 -0
  44. package/lib/default-settings.js +3 -3
  45. package/lib/domain/entities/View.js +4 -11
  46. package/lib/domain/entities/index.js +1 -0
  47. package/lib/domain/index.js +2 -0
  48. package/lib/domain/usecases/GetViewsUsecase.js +6 -12
  49. package/lib/domain/usecases/SaveViewUsecase.js +8 -14
  50. package/lib/domain/usecases/index.js +2 -0
  51. package/lib/file.js +1158 -1162
  52. package/lib/get-tasks-to-modify.js +117 -0
  53. package/lib/index.js +23 -0
  54. package/lib/languages.js +4 -5
  55. package/lib/list.js +46 -95
  56. package/lib/migrate-config.js +5 -5
  57. package/lib/mixins/index.js +2 -0
  58. package/lib/mixins/repo-fs-store.js +224 -289
  59. package/lib/mixins/repo-watched-fs-store.js +158 -147
  60. package/lib/plugins/archive-plugin.js +10 -8
  61. package/lib/plugins/default-board-actions-plugin.js +2 -2
  62. package/lib/plugins/default-board-properties-plugin.js +7 -7
  63. package/lib/plugins/default-plugins.js +7 -0
  64. package/lib/plugins/epic-plugin.js +6 -5
  65. package/lib/plugins/extension-plugin.js +24 -17
  66. package/lib/plugins/index.js +9 -0
  67. package/lib/plugins/persist-tags-plugin.js +4 -3
  68. package/lib/plugins/plugin-manager.js +89 -52
  69. package/lib/plugins/plugin-registry.js +12 -16
  70. package/lib/project-factory.js +21 -24
  71. package/lib/project.js +97 -144
  72. package/lib/repository.js +1323 -1555
  73. package/lib/task.js +562 -580
  74. package/lib/tools.js +39 -113
  75. package/lib/usecases/actions.js +32 -0
  76. package/lib/usecases/get-project-tags.js +3 -12
  77. package/lib/usecases/get-tasks-in-file.js +4 -7
  78. package/lib/usecases/index.js +4 -0
  79. package/package.json +44 -66
  80. package/scripts/delete-markdown-indexes.js +87 -0
  81. package/scripts/generate-index.js +35 -0
  82. package/{index-markdown.js → scripts/index-markdown.js} +7 -7
  83. package/tsconfig.json +15 -0
  84. package/types/FileProjectContext.d.ts +4 -0
  85. package/types/ProjectContext.d.ts +9 -0
  86. package/types/adapters/date-time.d.ts +2 -0
  87. package/types/adapters/environment.d.ts +1 -0
  88. package/types/adapters/file-gateway.d.ts +51 -0
  89. package/types/adapters/git-download.d.ts +1 -0
  90. package/types/adapters/index.d.ts +9 -0
  91. package/types/adapters/logger.d.ts +24 -0
  92. package/types/adapters/markdown.d.ts +13 -0
  93. package/types/adapters/parsers/DateLanguageParser.d.ts +1 -0
  94. package/types/adapters/parsers/content-transformer.d.ts +10 -0
  95. package/types/adapters/parsers/file/LocalFileParserFactory.d.ts +5 -0
  96. package/types/adapters/parsers/file/ReadStreamCodeParser.d.ts +13 -0
  97. package/types/adapters/parsers/file/ReadStreamMarkdownParser.d.ts +7 -0
  98. package/types/adapters/parsers/file/ReadStreamTaskParser.d.ts +19 -0
  99. package/types/adapters/parsers/file/index.d.ts +4 -0
  100. package/types/adapters/parsers/function-parser.d.ts +1 -0
  101. package/types/adapters/parsers/index.d.ts +5 -0
  102. package/types/adapters/parsers/task/CardContentParser.d.ts +45 -0
  103. package/types/adapters/parsers/task/CheckStyleTaskParser.d.ts +12 -0
  104. package/types/adapters/parsers/task/CodeStyleTaskParser.d.ts +14 -0
  105. package/types/adapters/parsers/task/HashStyleTaskParser.d.ts +13 -0
  106. package/types/adapters/parsers/task/MarkdownStyleTaskParser.d.ts +14 -0
  107. package/types/adapters/parsers/task/TaskParser.d.ts +7 -0
  108. package/types/adapters/parsers/task/index.d.ts +6 -0
  109. package/types/adapters/storage/config.d.ts +6 -0
  110. package/types/adapters/storage/index.d.ts +2 -0
  111. package/types/adapters/storage/tags.d.ts +3 -0
  112. package/types/adapters/yaml.d.ts +2 -0
  113. package/types/card.d.ts +166 -0
  114. package/types/checksum.d.ts +8 -0
  115. package/types/config.d.ts +61 -0
  116. package/types/constants.d.ts +46 -0
  117. package/types/context/ApplicationContext.d.ts +24 -0
  118. package/types/context/index.d.ts +1 -0
  119. package/types/default-settings.d.ts +2 -0
  120. package/types/domain/entities/FileProjectContext.d.ts +5 -0
  121. package/types/domain/entities/View.d.ts +17 -0
  122. package/types/domain/entities/index.d.ts +1 -0
  123. package/types/domain/index.d.ts +2 -0
  124. package/types/domain/usecases/GetViewsUsecase.d.ts +4 -0
  125. package/types/domain/usecases/SaveViewUsecase.d.ts +8 -0
  126. package/types/domain/usecases/index.d.ts +2 -0
  127. package/types/file.d.ts +344 -0
  128. package/types/get-tasks-to-modify.d.ts +3 -0
  129. package/types/index.d.ts +23 -0
  130. package/types/languages.d.ts +649 -0
  131. package/types/list.d.ts +30 -0
  132. package/types/migrate-config.d.ts +1 -0
  133. package/types/mixins/index.d.ts +2 -0
  134. package/types/mixins/repo-fs-store.d.ts +2 -0
  135. package/types/mixins/repo-watched-fs-store.d.ts +2 -0
  136. package/types/plugins/archive-plugin.d.ts +8 -0
  137. package/types/plugins/default-board-actions-plugin.d.ts +9 -0
  138. package/types/plugins/default-board-properties-plugin.d.ts +16 -0
  139. package/types/plugins/default-plugins.d.ts +6 -0
  140. package/types/plugins/epic-plugin.d.ts +19 -0
  141. package/types/plugins/extension-plugin.d.ts +15 -0
  142. package/types/plugins/index.d.ts +9 -0
  143. package/types/plugins/persist-tags-plugin.d.ts +4 -0
  144. package/types/plugins/plugin-manager.d.ts +68 -0
  145. package/types/plugins/plugin-registry.d.ts +1 -0
  146. package/types/project-factory.d.ts +14 -0
  147. package/types/project.d.ts +158 -0
  148. package/types/repository.d.ts +996 -0
  149. package/types/task.d.ts +202 -0
  150. package/types/tools.d.ts +29 -0
  151. package/types/usecases/actions.d.ts +7 -0
  152. package/types/usecases/get-imdone-url.d.ts +1 -0
  153. package/types/usecases/get-project-tags.d.ts +1 -0
  154. package/types/usecases/get-tasks-in-file.d.ts +4 -0
  155. package/types/usecases/index.d.ts +4 -0
  156. package/vitest.config.js +13 -0
  157. package/cli.js +0 -74
  158. package/index.js +0 -1
  159. package/lib/adapters/readers/FileSystemProjectReader.js +0 -45
  160. package/lib/context/StreamingApplicationContext.js +0 -31
  161. package/lib/controlers/SaveViewController.js +0 -10
  162. package/lib/domain/entities/FileProjectContext.js +0 -10
  163. package/lib/domain/usecases/OpenProjectUsecase.js +0 -13
@@ -1,4 +1,5 @@
1
- const Config = require('../config')
1
+ import { Config } from '../config.js'
2
+ import { getAvailablePlugins } from '../plugins/plugin-registry.js';
2
3
 
3
4
  class ApplicationContext {
4
5
  constructor({
@@ -14,7 +15,7 @@ class ApplicationContext {
14
15
  this.projectReader = projectReader;
15
16
  this.projectPresenter = projectPresenter;
16
17
  this.innerConfig = Config.newDefaultConfig()
17
- this.pluginRegistry = require('../plugins/plugin-registry')
18
+ this.pluginRegistry = { getAvailablePlugins }
18
19
  }
19
20
 
20
21
  set config(config) {
@@ -23,10 +24,12 @@ class ApplicationContext {
23
24
  }
24
25
 
25
26
  get config() {
26
- return (this.repo && this.repo.config) || this.innerConfig
27
+ return this.repo?.config ?? this.innerConfig
27
28
  }
28
29
 
29
30
  }
30
31
  const context = new ApplicationContext({})
31
32
 
32
- module.exports = () => context
33
+ export function appContext() {
34
+ return context
35
+ }
@@ -0,0 +1 @@
1
+ export * from './ApplicationContext.js';
@@ -1,6 +1,6 @@
1
- const { loadYAML } = require('./adapters/yaml')
1
+ import { loadYAML } from './adapters/yaml.js'
2
2
 
3
- const defaultSettingsString = `openIn: default #override
3
+ export const defaultSettingsString = `openIn: default #override
4
4
  openCodeIn: default #override
5
5
  journalType: New File
6
6
  journalPath: imdone-tasks #override
@@ -34,4 +34,4 @@ cards:
34
34
  journalTemplate: #override
35
35
  markdownOnly: false #override
36
36
  `
37
- module.exports = loadYAML(defaultSettingsString)
37
+ export const defaultSettings = loadYAML(defaultSettingsString)
@@ -1,7 +1,4 @@
1
- const DEFAULT_VIEW_ID = "default"
2
- const DEFAULT_VIEW_NAME = "Default View"
3
-
4
- class View {
1
+ export class View {
5
2
  id
6
3
  name
7
4
  lists
@@ -17,14 +14,10 @@ class View {
17
14
  this.#modifiable = modifiable
18
15
  }
19
16
 
17
+ static DEFAULT_VIEW_ID = "default"
18
+ static DEFAULT_VIEW_NAME = "Default View"
19
+
20
20
  get isModifiable () {
21
21
  return this.#modifiable
22
22
  }
23
23
  }
24
-
25
- View.DEFAULT_VIEW_ID = DEFAULT_VIEW_ID
26
- View.DEFAULT_VIEW_NAME = DEFAULT_VIEW_NAME
27
-
28
- module.exports = {
29
- View
30
- }
@@ -0,0 +1 @@
1
+ export * from './View.js';
@@ -0,0 +1,2 @@
1
+ export * as entities from './entities/index.js';
2
+ export * as usecases from './usecases/index.js';
@@ -1,12 +1,12 @@
1
- const context = require('../../context/ApplicationContext');
2
- const { View } = require('../entities/View')
3
- const List = require('../../list')
1
+ import { appContext as context } from '../../context/ApplicationContext.js'
2
+ import { View } from '../entities/View.js'
3
+ import { List } from '../../list.js'
4
4
 
5
- function getView(_id) {
5
+ export function getView(_id) {
6
6
  return getViews().find(view => view.id === _id)
7
7
  }
8
8
 
9
- function getDefaultView() {
9
+ export function getDefaultView() {
10
10
  const lists = getConfig().lists.map(list => {
11
11
  list = new List(list)
12
12
  delete list.tasks
@@ -25,7 +25,7 @@ function syncLists(currentLists, overrideLists) {
25
25
  })
26
26
  }
27
27
 
28
- function getViews() {
28
+ export function getViews() {
29
29
  const defaultView = getDefaultView()
30
30
  const customViews = context().repo.config.views.map(
31
31
  ({name, id, filter, lists, modifiable = true}) => new View ({
@@ -42,9 +42,3 @@ function getViews() {
42
42
  function getConfig() {
43
43
  return context().repo.config
44
44
  }
45
-
46
- module.exports = {
47
- getDefaultView,
48
- getView,
49
- getViews
50
- }
@@ -1,13 +1,13 @@
1
- const crypto = require('crypto')
2
- const context = require('../../context/ApplicationContext')
3
- const { getView } = require('./GetViewsUsecase')
4
- const { View } = require('../entities/View')
1
+ import { randomUUID} from 'node:crypto'
2
+ import { appContext as context } from '../../context/ApplicationContext.js'
3
+ import { getView } from './GetViewsUsecase.js'
4
+ import { View } from '../entities/View.js'
5
5
 
6
- async function saveView({id, name, lists, filter}) {
6
+ export async function saveView({id, name, lists, filter}) {
7
7
  let view = getView(id)
8
8
 
9
9
  if (!view) {
10
- view = {id: crypto.randomUUID(), name, lists, filter}
10
+ view = {id: randomUUID(), name, lists, filter}
11
11
  context().repo.config.views.push(view)
12
12
  } else if (view.id === View.DEFAULT_VIEW_ID) {
13
13
  return
@@ -30,7 +30,7 @@ async function saveConfig() {
30
30
  });
31
31
  }
32
32
 
33
- async function removeDefaultViewFilter() {
33
+ export async function removeDefaultViewFilter() {
34
34
  const project = context().project
35
35
  if (project.defaultFilter) {
36
36
  project.setFilter(project.defaultFilter)
@@ -40,7 +40,7 @@ async function removeDefaultViewFilter() {
40
40
  }
41
41
  }
42
42
 
43
- async function setDefaultViewFilter(filter = context().project.filter) {
43
+ export async function setDefaultViewFilter(filter = context().project.filter) {
44
44
  const project = context().project
45
45
  if (filter) {
46
46
  project.defaultFilter = filter
@@ -49,9 +49,3 @@ async function setDefaultViewFilter(filter = context().project.filter) {
49
49
  await saveConfig()
50
50
  }
51
51
  }
52
-
53
- module.exports = {
54
- removeDefaultViewFilter,
55
- setDefaultViewFilter,
56
- saveView
57
- }
@@ -0,0 +1,2 @@
1
+ export * from './GetViewsUsecase.js';
2
+ export * from './SaveViewUsecase.js';