@codetreker/daynight 0.27.2 → 0.31.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.
Files changed (143) hide show
  1. package/README.md +165 -36
  2. package/dist/api/client.d.ts +5 -1
  3. package/dist/api/client.js +38 -14
  4. package/dist/api/client.js.map +1 -1
  5. package/dist/api/index.d.ts +1 -0
  6. package/dist/api/index.js +1 -0
  7. package/dist/api/index.js.map +1 -1
  8. package/dist/api/json.js +27 -6
  9. package/dist/api/json.js.map +1 -1
  10. package/dist/api/parse.d.ts +1 -4
  11. package/dist/api/parse.js +8 -87
  12. package/dist/api/parse.js.map +1 -1
  13. package/dist/api/resource-path.d.ts +1 -0
  14. package/dist/api/resource-path.js +8 -0
  15. package/dist/api/resource-path.js.map +1 -0
  16. package/dist/api/task-properties.d.ts +8 -0
  17. package/dist/api/task-properties.js +86 -0
  18. package/dist/api/task-properties.js.map +1 -0
  19. package/dist/api/types.d.ts +24 -6
  20. package/dist/api/validation.d.ts +15 -0
  21. package/dist/api/validation.js +43 -0
  22. package/dist/api/validation.js.map +1 -0
  23. package/dist/cli/schema.d.ts +3 -0
  24. package/dist/cli/schema.js +14 -4
  25. package/dist/cli/schema.js.map +1 -1
  26. package/dist/commands/completion/bash.d.ts +1 -1
  27. package/dist/commands/completion/bash.js +6 -3
  28. package/dist/commands/completion/bash.js.map +1 -1
  29. package/dist/commands/completion/zsh.d.ts +1 -1
  30. package/dist/commands/completion/zsh.js +7 -7
  31. package/dist/commands/completion/zsh.js.map +1 -1
  32. package/dist/commands/controller/independent.js +31 -15
  33. package/dist/commands/controller/independent.js.map +1 -1
  34. package/dist/commands/controller/journal-format.d.ts +4 -0
  35. package/dist/commands/controller/journal-format.js +42 -0
  36. package/dist/commands/controller/journal-format.js.map +1 -0
  37. package/dist/commands/controller/lifecycle-store.d.ts +7 -5
  38. package/dist/commands/controller/lifecycle-store.js +114 -85
  39. package/dist/commands/controller/lifecycle-store.js.map +1 -1
  40. package/dist/commands/controller/local-content.d.ts +10 -5
  41. package/dist/commands/controller/local-content.js +8 -2
  42. package/dist/commands/controller/local-content.js.map +1 -1
  43. package/dist/commands/controller/resume-lease-format.d.ts +4 -0
  44. package/dist/commands/controller/resume-lease-format.js +35 -0
  45. package/dist/commands/controller/resume-lease-format.js.map +1 -0
  46. package/dist/commands/controller/resume.js +85 -21
  47. package/dist/commands/controller/resume.js.map +1 -1
  48. package/dist/commands/controller/sqlite/journal/001-baseline.sql +17 -0
  49. package/dist/commands/controller/sqlite/journal/002-projection.sql +8 -0
  50. package/dist/commands/controller/sqlite/journal/003-operation-acknowledgements.sql +1 -0
  51. package/dist/commands/controller/sqlite/journal/004-projection-gap.sql +1 -0
  52. package/dist/commands/controller/sqlite/journal/005-resources.sql +7 -0
  53. package/dist/commands/controller/sqlite/resume-lease/001-baseline.sql +7 -0
  54. package/dist/commands/review/listing.js +1 -1
  55. package/dist/commands/review/listing.js.map +1 -1
  56. package/dist/commands/review/runtime.js +3 -1
  57. package/dist/commands/review/runtime.js.map +1 -1
  58. package/dist/commands/review/sqlite/001-baseline.sql +65 -0
  59. package/dist/commands/review/sqlite/002-publications.sql +15 -0
  60. package/dist/commands/review/store-format.d.ts +2 -0
  61. package/dist/commands/review/store-format.js +35 -0
  62. package/dist/commands/review/store-format.js.map +1 -0
  63. package/dist/commands/review/store.d.ts +8 -1
  64. package/dist/commands/review/store.js +46 -176
  65. package/dist/commands/review/store.js.map +1 -1
  66. package/dist/commands/skill/skills/using-daynight/SKILL.md +2 -2
  67. package/dist/commands/skill/skills/using-daynight/references/autopilot-managed-task.md +19 -7
  68. package/dist/commands/skill/skills/using-daynight/references/handbook.md +2 -1
  69. package/dist/commands/skill/skills/using-daynight/references/task-execution.md +1 -1
  70. package/dist/commands/skill/skills/using-daynight/references/task-management.md +29 -2
  71. package/dist/commands/skill/skills/using-daynight/references/write-safety.md +1 -1
  72. package/dist/commands/task/command.js +7 -11
  73. package/dist/commands/task/command.js.map +1 -1
  74. package/dist/commands/task/definition.js +28 -11
  75. package/dist/commands/task/definition.js.map +1 -1
  76. package/dist/commands/task/property.d.ts +6 -0
  77. package/dist/commands/task/property.js +51 -0
  78. package/dist/commands/task/property.js.map +1 -0
  79. package/dist/commands/task/rendering.d.ts +3 -1
  80. package/dist/commands/task/rendering.js +25 -8
  81. package/dist/commands/task/rendering.js.map +1 -1
  82. package/dist/commands/worker/backends/sqlite/001-baseline.sql +4 -0
  83. package/dist/commands/worker/backends/web-process.js +6 -3
  84. package/dist/commands/worker/backends/web-process.js.map +1 -1
  85. package/dist/commands/worker/backends/web-record.d.ts +11 -0
  86. package/dist/commands/worker/backends/web-record.js +151 -0
  87. package/dist/commands/worker/backends/web-record.js.map +1 -0
  88. package/dist/commands/worker/backends/web-store-format.d.ts +2 -0
  89. package/dist/commands/worker/backends/web-store-format.js +33 -0
  90. package/dist/commands/worker/backends/web-store-format.js.map +1 -0
  91. package/dist/commands/worker/backends/web-store.d.ts +4 -1
  92. package/dist/commands/worker/backends/web-store.js +43 -170
  93. package/dist/commands/worker/backends/web-store.js.map +1 -1
  94. package/dist/commands/worker/backends/web.js +5 -4
  95. package/dist/commands/worker/backends/web.js.map +1 -1
  96. package/dist/commands/worker/cleanup.d.ts +1 -1
  97. package/dist/commands/worker/cleanup.js.map +1 -1
  98. package/dist/commands/worker/control.js +10 -6
  99. package/dist/commands/worker/control.js.map +1 -1
  100. package/dist/commands/worker/coordinator.js +15 -14
  101. package/dist/commands/worker/coordinator.js.map +1 -1
  102. package/dist/commands/worker/diagnostics.d.ts +3 -0
  103. package/dist/commands/worker/diagnostics.js +15 -0
  104. package/dist/commands/worker/diagnostics.js.map +1 -1
  105. package/dist/commands/worker/execution.d.ts +2 -0
  106. package/dist/commands/worker/execution.js +17 -4
  107. package/dist/commands/worker/execution.js.map +1 -1
  108. package/dist/commands/worker/herdr/agents.d.ts +6 -1
  109. package/dist/commands/worker/herdr/agents.js +8 -3
  110. package/dist/commands/worker/herdr/agents.js.map +1 -1
  111. package/dist/commands/worker/herdr.d.ts +2 -2
  112. package/dist/commands/worker/herdr.js.map +1 -1
  113. package/dist/commands/worker/prompts.js +7 -2
  114. package/dist/commands/worker/prompts.js.map +1 -1
  115. package/dist/commands/worker/remote.js +7 -6
  116. package/dist/commands/worker/remote.js.map +1 -1
  117. package/dist/commands/worker/runtime.js +8 -3
  118. package/dist/commands/worker/runtime.js.map +1 -1
  119. package/dist/commands/worker/sqlite/005-baseline.sql +18 -0
  120. package/dist/commands/worker/store-format.d.ts +2 -0
  121. package/dist/commands/worker/store-format.js +35 -0
  122. package/dist/commands/worker/store-format.js.map +1 -0
  123. package/dist/commands/worker/store.d.ts +2 -0
  124. package/dist/commands/worker/store.js +36 -69
  125. package/dist/commands/worker/store.js.map +1 -1
  126. package/dist/platform/diagnostics.js +3 -0
  127. package/dist/platform/diagnostics.js.map +1 -1
  128. package/dist/platform/instance-lock.d.ts +15 -0
  129. package/dist/platform/instance-lock.js +45 -3
  130. package/dist/platform/instance-lock.js.map +1 -1
  131. package/dist/platform/sqlite-access.d.ts +40 -0
  132. package/dist/platform/sqlite-access.js +333 -0
  133. package/dist/platform/sqlite-access.js.map +1 -0
  134. package/dist/platform/sqlite-error.d.ts +39 -0
  135. package/dist/platform/sqlite-error.js +36 -0
  136. package/dist/platform/sqlite-error.js.map +1 -0
  137. package/dist/platform/sqlite-format.d.ts +31 -0
  138. package/dist/platform/sqlite-format.js +98 -0
  139. package/dist/platform/sqlite-format.js.map +1 -0
  140. package/dist/platform/sqlite-sql.d.ts +12 -0
  141. package/dist/platform/sqlite-sql.js +61 -0
  142. package/dist/platform/sqlite-sql.js.map +1 -0
  143. package/package.json +3 -3
@@ -0,0 +1,61 @@
1
+ import { readFileSync, readdirSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import Database from "better-sqlite3";
5
+ export const loadSqliteSql = (resource) => {
6
+ const sql = readFileSync(resource, "utf8");
7
+ if (sql.trim().length === 0)
8
+ throw new Error(`SQLite SQL resource is empty: ${resource.href}`);
9
+ return sql;
10
+ };
11
+ export const loadSqliteSequence = (directory) => {
12
+ const files = readdirSync(directory, { withFileTypes: true }).filter(entry => entry.name.toLowerCase().endsWith(".sql")).sort((a, b) => a.name < b.name ? -1 : a.name === b.name ? 0 : 1);
13
+ if (files.length === 0)
14
+ throw new Error(`SQLite SQL sequence is empty: ${directory.href}`);
15
+ let width, previous;
16
+ const resources = files.map(entry => {
17
+ const resource = pathToFileURL(path.join(fileURLToPath(directory), entry.name));
18
+ const match = /^([0-9]{3,})-([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\.sql$/.exec(entry.name);
19
+ if (!entry.isFile() || match === null)
20
+ throw new Error(`Invalid SQLite SQL filename: ${resource.href}`);
21
+ const prefix = match[1], version = Number(prefix);
22
+ if (!Number.isInteger(version) || version < 1 || version > 2_147_483_647)
23
+ throw new Error(`SQLite SQL version must be a positive signed 32-bit integer: ${resource.href}`);
24
+ if (width !== undefined && prefix.length !== width)
25
+ throw new Error(`SQLite SQL version prefixes must use the same zero-padding width: ${resource.href}`);
26
+ if (version === previous)
27
+ throw new Error(`Duplicate SQLite SQL version: ${resource.href}`);
28
+ if (previous !== undefined && version !== previous + 1)
29
+ throw new Error(`SQLite SQL versions must be consecutive after the baseline: ${resource.href}`);
30
+ width = prefix.length;
31
+ previous = version;
32
+ return { version, resource };
33
+ });
34
+ const steps = resources.map(({ version, resource }) => Object.freeze({ version, sql: loadSqliteSql(resource) }));
35
+ return Object.freeze(steps);
36
+ };
37
+ export const sqliteSchemaSnapshots = (steps) => {
38
+ const db = new Database(":memory:"), snapshots = new Map();
39
+ let failed = false, failure;
40
+ try {
41
+ for (const step of steps) {
42
+ db.exec(step.sql);
43
+ const objects = db.prepare("SELECT name, type, sql FROM sqlite_schema WHERE name NOT GLOB 'sqlite_*' ORDER BY name").all();
44
+ snapshots.set(step.version, Object.freeze(objects.map(object => Object.freeze(object))));
45
+ }
46
+ }
47
+ catch (cause) {
48
+ failed = true;
49
+ failure = cause;
50
+ }
51
+ try {
52
+ db.close();
53
+ }
54
+ catch (close) {
55
+ throw failed ? new AggregateError([failure, close], "SQLite reference schema construction and connection shutdown failed.") : close;
56
+ }
57
+ if (failed)
58
+ throw failure;
59
+ return snapshots;
60
+ };
61
+ //# sourceMappingURL=sqlite-sql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-sql.js","sourceRoot":"","sources":["../../src/platform/sqlite-sql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAKtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAa,EAAU,EAAE;IACrD,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/F,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,SAAc,EAAsD,EAAE;IACvG,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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C,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,GAAG,KAAK,CAAC;IAAC,CAAC;IACnD,IAAI,CAAC;QAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAAC,CAAC;IACnB,OAAO,KAAK,EAAE,CAAC;QAAC,MAAM,MAAM,CAAC,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,sEAAsE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAAC,CAAC;IACtJ,IAAI,MAAM;QAAE,MAAM,OAAO,CAAC;IAC1B,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codetreker/daynight",
3
- "version": "0.27.2",
3
+ "version": "0.31.0",
4
4
  "description": "A client command toolkit for development workflows",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "node": ">=22"
21
21
  },
22
22
  "scripts": {
23
- "build": "node scripts/clean-dist.ts && tsc -p tsconfig.build.json && node scripts/copy-skills.ts",
23
+ "build": "node scripts/clean-dist.ts && tsc -p tsconfig.build.json && node scripts/copy-resources.ts",
24
24
  "typecheck": "tsc --noEmit",
25
25
  "test": "pnpm run build && vitest run",
26
26
  "test:apfs": "DAYNIGHT_TEST_APFS=1 vitest run test/commands/review/apfs.test.ts",
@@ -54,5 +54,5 @@
54
54
  "vite": "8.3.4",
55
55
  "vitest": "5.0.5"
56
56
  },
57
- "gitHead": "2786ba29ea4c59ca538801b43508dd3eb4ed618d"
57
+ "gitHead": "4fde16f3609bcaf91f3f7bbedb68df2665744db8"
58
58
  }