@nan0web/release 1.0.1 → 1.0.3

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 (109) hide show
  1. package/README.md +24 -42
  2. package/bin/nan0release.js +27 -42
  3. package/package.json +48 -42
  4. package/project.yaml +79 -0
  5. package/src/README.md.js +90 -93
  6. package/src/Release/Document.js +13 -19
  7. package/src/Release/MarkdownToTest.js +35 -33
  8. package/src/Release/Person.js +3 -8
  9. package/src/Release/Scanner.js +179 -0
  10. package/src/Release.js +19 -12
  11. package/src/Team.js +9 -9
  12. package/src/architecture/ProjectManagementAsCode.js +8 -8
  13. package/src/cli/index.js +9 -0
  14. package/src/co/AppCommandOptions.js +4 -6
  15. package/src/commands/CloseCommand.js +67 -0
  16. package/src/commands/Command.js +48 -0
  17. package/src/commands/DepsCommand.js +143 -0
  18. package/src/commands/InitCommand.js +48 -56
  19. package/src/commands/PublishCommand.js +80 -119
  20. package/src/commands/SpecCommand.js +41 -0
  21. package/src/commands/StatusCommand.js +26 -0
  22. package/src/db/ReleaseDB.js +5 -5
  23. package/src/index.js +18 -0
  24. package/src/ui/cli/ReleaseCLi.js +52 -0
  25. package/src/utils/runSpawn.js +0 -0
  26. package/types/Release/Document.d.ts +2 -2
  27. package/types/Release/Person.d.ts +3 -3
  28. package/types/Release/Scanner.d.ts +90 -0
  29. package/types/Release.d.ts +37 -33
  30. package/types/ReleaseCLI.d.ts +29 -28
  31. package/types/Team.d.ts +3 -3
  32. package/types/architecture/ProjectManagementAsCode.d.ts +1 -1
  33. package/types/cli/index.d.ts +2 -0
  34. package/types/co/AppCommandMessage.d.ts +10 -11
  35. package/types/co/AppCommandOptions.d.ts +1 -2
  36. package/types/commands/BaseCommand.d.ts +23 -0
  37. package/types/commands/ChatCommand.d.ts +9 -9
  38. package/types/commands/ChatMessage.d.ts +36 -0
  39. package/types/commands/CloseCommand.d.ts +25 -0
  40. package/types/commands/Command.d.ts +28 -0
  41. package/types/commands/DepsCommand.d.ts +32 -0
  42. package/types/commands/DepsMessage.d.ts +28 -0
  43. package/types/commands/HostCommand.d.ts +7 -7
  44. package/types/commands/HostMessage.d.ts +44 -0
  45. package/types/commands/InitCommand.d.ts +24 -19
  46. package/types/commands/InitMessage.d.ts +24 -0
  47. package/types/commands/ListCommand.d.ts +8 -8
  48. package/types/commands/ListMessage.d.ts +30 -0
  49. package/types/commands/PublishCommand.d.ts +36 -47
  50. package/types/commands/PublishMessage.d.ts +39 -0
  51. package/types/commands/SealCommand.d.ts +7 -7
  52. package/types/commands/SealMessage.d.ts +28 -0
  53. package/types/commands/ServeCommand.d.ts +7 -7
  54. package/types/commands/ServeMessage.d.ts +30 -0
  55. package/types/commands/ShowCommand.d.ts +7 -7
  56. package/types/commands/SpecCommand.d.ts +25 -0
  57. package/types/commands/StatusCommand.d.ts +9 -0
  58. package/types/commands/SubCommand.d.ts +9 -7
  59. package/types/commands/ValidateCommand.d.ts +7 -7
  60. package/types/commands/ValidateMessage.d.ts +20 -0
  61. package/types/db/ReleaseDB.d.ts +2 -2
  62. package/types/index.d.ts +10 -0
  63. package/types/ui/cli/ReleaseCLi.d.ts +10 -0
  64. package/types/ui/cli/index.d.ts +0 -0
  65. package/types/utils/runSpawn.d.ts +0 -0
  66. package/.datasets/README.dataset.jsonl +0 -19
  67. package/.editorconfig +0 -20
  68. package/CHANGELOG.md +0 -6
  69. package/CONTRIBUTING.md +0 -42
  70. package/bin/commands/InitCommand.js +0 -10
  71. package/bin/lib/functions.js +0 -240
  72. package/bin/lib/functions.test.js +0 -138
  73. package/bin/release.js +0 -12
  74. package/bin/release.test.js +0 -73
  75. package/bin/temp/package.json +0 -1
  76. package/docs/system.uk.md +0 -413
  77. package/docs/uk/README.md +0 -284
  78. package/legacy/PrepareCommand.js +0 -154
  79. package/legacy/PrepareCommand.test.js +0 -189
  80. package/legacy/changelog.js +0 -446
  81. package/releases/1/0/v1.0.0/models/Person.js +0 -26
  82. package/releases/1/0/v1.0.0/models/Person.test.js +0 -44
  83. package/releases/1/0/v1.0.0/models/company.js +0 -11
  84. package/releases/1/0/v1.0.0/models/members.js +0 -14
  85. package/releases/1/0/v1.0.0/models/members.test.js +0 -21
  86. package/releases/1/0/v1.0.0/models/teams/DevTeam.js +0 -6
  87. package/releases/1/0/v1.0.0/models/teams/DevTeam.test.js +0 -15
  88. package/releases/1/0/v1.0.0/models/teams/index.js +0 -5
  89. package/releases/1/0/v1.0.0/release.js +0 -12
  90. package/releases/1/0/v1.0.0/release.md +0 -121
  91. package/releases/1/0/v1.0.0/release.test.js +0 -36
  92. package/releases/1/0/v1.0.0/test/YaRaSLove/git-native.test.js +0 -14
  93. package/releases/current.js +0 -3
  94. package/releases/index.js +0 -11
  95. package/src/Release/MarkdownToTest.test.js +0 -60
  96. package/src/ReleaseCLI.js +0 -122
  97. package/src/architecture/ProjectManagementAsCode.test.js +0 -128
  98. package/src/co/AppCommandMessage.js +0 -22
  99. package/src/commands/ChatCommand.js +0 -56
  100. package/src/commands/HostCommand.js +0 -63
  101. package/src/commands/ListCommand.js +0 -56
  102. package/src/commands/SealCommand.js +0 -51
  103. package/src/commands/ServeCommand.js +0 -53
  104. package/src/commands/ShowCommand.js +0 -58
  105. package/src/commands/SubCommand.js +0 -21
  106. package/src/commands/ValidateCommand.js +0 -66
  107. package/system.md +0 -571
  108. package/tsconfig.json +0 -23
  109. /package/{bin/lib/temp/pnpm-lock.yaml → src/ui/cli/index.js} +0 -0
@@ -1,56 +0,0 @@
1
- import SubCommand from "./SubCommand.js"
2
- import { join } from "node:path"
3
- import { createReadStream } from "node:fs"
4
-
5
- /**
6
- * ListCommand – prints a concise list of releases found in the current
7
- * working directory. It works against the {@link ReleaseDB} instance
8
- * passed through the `db` option of the parent CLI.
9
- *
10
- * Usage:
11
- * release list
12
- *
13
- * Options:
14
- * --json – output JSON instead of a human‑readable list
15
- */
16
- export default class ListCommand extends SubCommand {
17
- constructor(options = {}) {
18
- super(options)
19
- this.addOption("json", Boolean, false, "Output as JSON")
20
- }
21
-
22
- /**
23
- * Execute the command.
24
- *
25
- * @param {Object} ctx – command context (contains parsed args)
26
- * @returns {Promise<void>}
27
- */
28
- async run(ctx) {
29
- if (!this.db) {
30
- this.logger.warn("No database attached – nothing to list")
31
- return
32
- }
33
-
34
- const releases = []
35
- for await (const entry of this.db.findStream("")) {
36
- // Only keep top‑level release directories (e.g. 1/0/v1.0.0)
37
- const parts = entry.file.path.split("/")
38
- if (parts.length === 3 && /^\d+$/.test(parts[0]) && /^\d+$/.test(parts[1])) {
39
- releases.push(entry.file.path)
40
- }
41
- }
42
-
43
- if (ctx.opts.json) {
44
- this.logger.info(JSON.stringify(releases, null, "\t"))
45
- } else {
46
- if (releases.length === 0) {
47
- this.logger.info("No releases found")
48
- } else {
49
- this.logger.info("Releases:")
50
- for (const r of releases) {
51
- this.logger.info(` • ${r}`)
52
- }
53
- }
54
- }
55
- }
56
- }
@@ -1,51 +0,0 @@
1
- import SubCommand from "./SubCommand.js"
2
- import { mkdir, writeFile } from "node:fs/promises"
3
- import { join } from "node:path"
4
- import Release from "../../src/Release.js"
5
-
6
- /**
7
- * SealCommand – finalises a release by writing a `retro.md` file
8
- * and making the release directory read‑only. This is a *light* implementation
9
- * that merely creates a placeholder retro file; a real implementation would
10
- * also set file system permissions and maybe create a Git tag.
11
- *
12
- * Usage:
13
- * release seal [--message <text>]
14
- *
15
- * Options:
16
- * --message – optional retro‑reflection text
17
- */
18
- export default class SealCommand extends SubCommand {
19
- constructor(options = {}) {
20
- super(options)
21
- this.addOption("message", String, "", "Retro‑reflection text")
22
- }
23
-
24
- /**
25
- * Seal the current release.
26
- *
27
- * @param {Object} ctx – command context
28
- */
29
- async run(ctx) {
30
- if (!this.db) {
31
- this.logger.error("No DB – cannot seal release")
32
- return
33
- }
34
-
35
- const retroPath = join(this.db.cwd, "retro.md")
36
- const content = `# Retro – ${new Date().toISOString().split("T")[0]}
37
-
38
- ${ctx.opts.message || "*No retro‑reflection provided.*"}\n`
39
-
40
- await writeFile(retroPath, content, "utf8")
41
- this.logger.success(`retro.md written to ${retroPath}`)
42
-
43
- // make the folder read‑only (best‑effort – ignore errors on non‑POSIX FS)
44
- try {
45
- await mkdir(this.db.cwd, { mode: 0o444 })
46
- this.logger.info("Release directory set to read‑only")
47
- } catch (_) {
48
- // not critical – just a hint
49
- }
50
- }
51
- }
@@ -1,53 +0,0 @@
1
- import SubCommand from "./SubCommand.js"
2
- import { createServer } from "node:http"
3
- import { readFile } from "node:fs/promises"
4
- import { join } from "node:path"
5
-
6
- /**
7
- * ServeCommand – runs a tiny static file server that serves all files
8
- * inside the current release folder. It is useful for quick local
9
- * inspection of assets, markdown, and generated test files.
10
- *
11
- * Usage:
12
- * release serve [--port <number>]
13
- */
14
- export default class ServeCommand extends SubCommand {
15
- constructor(options = {}) {
16
- super(options)
17
- this.addOption("port", Number, 8080, "Port for static server")
18
- }
19
-
20
- /**
21
- * Start the static server.
22
- *
23
- * @param {Object} ctx – command context
24
- */
25
- async run(ctx) {
26
- if (!this.db) {
27
- this.logger.error("No DB – cannot serve files")
28
- return
29
- }
30
-
31
- const root = this.db.cwd
32
- const port = ctx.opts.port
33
-
34
- const server = createServer(async (req, res) => {
35
- const safePath = req.url?.split("?")[0] || "/"
36
- const filePath = join(root, safePath)
37
-
38
- try {
39
- const data = await readFile(filePath)
40
- res.writeHead(200)
41
- res.end(data)
42
- } catch (_) {
43
- res.writeHead(404)
44
- res.end("Not found")
45
- }
46
- })
47
-
48
- server.listen(port, () => {
49
- this.logger.success(`Static server listening on http://localhost:${port}`)
50
- this.logger.info(`Serving ${root}`)
51
- })
52
- }
53
- }
@@ -1,58 +0,0 @@
1
- import SubCommand from "./SubCommand.js"
2
- import { readFile } from "node:fs/promises"
3
- import { join } from "node:path"
4
-
5
- /**
6
- * ShowCommand – prints basic information about the current release
7
- * (version, creation date, and a short excerpt of the markdown notes).
8
- *
9
- * Usage:
10
- * release show
11
- *
12
- * Options:
13
- * --full – dump the whole release.md file
14
- */
15
- export default class ShowCommand extends SubCommand {
16
- constructor(options = {}) {
17
- super(options)
18
- this.addOption("full", Boolean, false, "Show complete release.md")
19
- }
20
-
21
- /**
22
- * Render the release information.
23
- *
24
- * @param {Object} ctx – command context
25
- */
26
- async run(ctx) {
27
- if (!this.db) {
28
- this.logger.error("No DB – cannot locate current release")
29
- return
30
- }
31
-
32
- // `cwd` points to the current release directory (see CLI)
33
- const releaseJsPath = join(this.db.cwd, "release.js")
34
- const releaseMdPath = join(this.db.cwd, "release.md")
35
-
36
- try {
37
- const { default: release } = await import(releaseJsPath)
38
- this.logger.info(`Version : ${release.version}`)
39
- this.logger.info(`Created at : ${release.createdAt.toISOString()}`)
40
- this.logger.info(`Path : ${this.db.cwd}`)
41
- } catch (/** @type {any} */ e) {
42
- this.logger.warn(`Unable to import release.js – ${e.message}`)
43
- }
44
-
45
- try {
46
- const md = await readFile(releaseMdPath, "utf8")
47
- if (ctx.opts.full) {
48
- this.logger.info("\n=== release.md ===\n")
49
- this.logger.info(md)
50
- } else {
51
- const firstLine = md.split("\n")[0]
52
- this.logger.info(`Release note : ${firstLine}`)
53
- }
54
- } catch (/** @type {any} */ e) {
55
- this.logger.warn(`release.md not found – ${e.message}`)
56
- }
57
- }
58
- }
@@ -1,21 +0,0 @@
1
- import { Command } from '@nan0web/co'
2
- import ReleaseDB from '../db/ReleaseDB.js'
3
- import Logger from '@nan0web/log'
4
-
5
- class SubCommand extends Command {
6
- /** @type {Logger} */
7
- logger
8
- /** @type {ReleaseDB?} */
9
- db
10
- constructor(options = {}) {
11
- const {
12
- logger = new Logger(),
13
- db,
14
- } = options
15
- super(options)
16
- this.logger = Logger.from(logger)
17
- this.db = db ? ReleaseDB.from(db) : null
18
- }
19
- }
20
-
21
- export default SubCommand
@@ -1,66 +0,0 @@
1
- import SubCommand from "./SubCommand.js"
2
- import { readFile } from "node:fs/promises"
3
- import { join } from "node:path"
4
- import Release from "../../src/Release.js"
5
-
6
- /**
7
- * ValidateCommand – runs the {@link Release.validate} method for the
8
- * currently checked‑out release and prints a short summary.
9
- *
10
- * Usage:
11
- * release validate
12
- *
13
- * Options:
14
- * --ignore-fail – do not treat failed tasks as a validation error
15
- */
16
- export default class ValidateCommand extends SubCommand {
17
- constructor(options = {}) {
18
- super(options)
19
- this.addOption("ignoreFailTests", Boolean, false, "Ignore failed tests")
20
- }
21
-
22
- /**
23
- * Execute validation.
24
- *
25
- * @param {Object} ctx – command context
26
- */
27
- async run(ctx) {
28
- if (!this.db) {
29
- this.logger.error("No DB – cannot locate current release")
30
- return
31
- }
32
-
33
- const releaseJsPath = join(this.db.cwd, "release.js")
34
- const releaseMdPath = join(this.db.cwd, "release.md")
35
-
36
- let releaseInst
37
- try {
38
- const { default: rel } = await import(releaseJsPath)
39
- releaseInst = rel
40
- } catch (/** @type {any} */ e) {
41
- this.logger.error(`Failed to import release.js – ${e.message}`)
42
- return
43
- }
44
-
45
- // Attach a mock document – the real implementation would parse markdown
46
- try {
47
- const md = await readFile(releaseMdPath, "utf8")
48
- // Very naïve parsing – just store the raw markdown
49
- releaseInst.document = md
50
- } catch (_) {
51
- // ignore – document is optional for validation
52
- }
53
-
54
- const result = await releaseInst.validate()
55
- const { passed, failed, pending } = result
56
-
57
- if (passed.length) this.logger.success(`✅ Passed: ${passed.join(", ")}`)
58
- if (failed.length) this.logger.error(`❌ Failed: ${failed.map(f => f.taskId).join(", ")}`)
59
- if (pending.length) this.logger.warn(`● Pending: ${pending.map(p => p.taskId).join(", ")}`)
60
-
61
- if (!ctx.opts.ignoreFailTests && failed.length) {
62
- this.logger.error(`Validation failed – ${failed.length} tasks did not pass`)
63
- process.exit(1)
64
- }
65
- }
66
- }