@hasna/todos 0.15.50 → 0.15.52
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/dist/cli/cloud-router.d.ts.map +1 -1
- package/dist/cli/commands/project-commands.d.ts +15 -0
- package/dist/cli/commands/project-commands.d.ts.map +1 -1
- package/dist/cli/commands/query-commands.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +521 -342
- package/dist/contracts.js +194 -95
- package/dist/db/task-crud.d.ts.map +1 -1
- package/dist/index.js +406 -299
- package/dist/lib/model-config.d.ts +2 -1
- package/dist/lib/model-config.d.ts.map +1 -1
- package/dist/lib/paths.d.ts +40 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/sync-utils.d.ts +7 -0
- package/dist/lib/sync-utils.d.ts.map +1 -1
- package/dist/mcp/index.js +280 -174
- package/dist/mcp.js +7 -4
- package/dist/project-registration.js +192 -93
- package/dist/registry.js +194 -95
- package/dist/release-provenance.json +5 -5
- package/dist/sdk/index.js +100 -8
- package/dist/server/index.js +449 -220
- package/dist/storage.js +183 -87
- package/dist/task-manifest.js +113 -17
- package/dist/testing.d.ts +10 -9
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +7 -4
- package/postinstall.js +34 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "@hasna/todos",
|
|
3
|
-
"packageVersion": "0.15.
|
|
3
|
+
"packageVersion": "0.15.52",
|
|
4
4
|
"repository": "https://github.com/hasna/todos.git",
|
|
5
|
-
"gitCommit": "
|
|
6
|
-
"gitTree": "
|
|
7
|
-
"sourceTreeSha256": "
|
|
8
|
-
"generatedAt": "2026-
|
|
5
|
+
"gitCommit": "ec392e3ee4663d25809167eac94d768050f334f0",
|
|
6
|
+
"gitTree": "6335613a91c6b3fd951e4867d93be46149c2d029",
|
|
7
|
+
"sourceTreeSha256": "c684e5d23f2974ce32e3e458e563e9ef2d46b421e149d95b042dc28b5b21e39d",
|
|
8
|
+
"generatedAt": "2026-09-03T13:47:38.000Z"
|
|
9
9
|
}
|
package/dist/sdk/index.js
CHANGED
|
@@ -53,19 +53,111 @@ class TodosTimeoutError extends Error {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// src/lib/config.ts
|
|
56
|
-
import { existsSync as
|
|
57
|
-
import { dirname, join as
|
|
56
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
57
|
+
import { dirname, join as join3 } from "path";
|
|
58
58
|
|
|
59
59
|
// src/lib/sync-utils.ts
|
|
60
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
60
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "fs";
|
|
61
|
+
import { homedir as homedir3 } from "os";
|
|
62
|
+
|
|
63
|
+
// src/lib/paths.ts
|
|
64
|
+
import { existsSync } from "fs";
|
|
65
|
+
import { homedir as homedir2 } from "os";
|
|
66
|
+
import { join as join2, resolve } from "path";
|
|
67
|
+
|
|
68
|
+
// node_modules/.bun/@hasna+paths@0.1.0/node_modules/@hasna/paths/dist/index.js
|
|
61
69
|
import { homedir } from "os";
|
|
62
70
|
import { join } from "path";
|
|
71
|
+
var KIND_ENV = {
|
|
72
|
+
config: "HASNA_CONFIG_HOME",
|
|
73
|
+
data: "HASNA_DATA_HOME",
|
|
74
|
+
state: "HASNA_STATE_HOME",
|
|
75
|
+
cache: "HASNA_CACHE_HOME"
|
|
76
|
+
};
|
|
77
|
+
var APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
78
|
+
function assertApp(app) {
|
|
79
|
+
if (typeof app !== "string" || app.length === 0) {
|
|
80
|
+
throw new TypeError("paths: app must be a non-empty string");
|
|
81
|
+
}
|
|
82
|
+
if (!APP_SLUG_RE.test(app)) {
|
|
83
|
+
throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function envOf(options) {
|
|
87
|
+
return options.env ?? process.env;
|
|
88
|
+
}
|
|
89
|
+
function envValue(options, kind) {
|
|
90
|
+
const value = envOf(options)[KIND_ENV[kind]];
|
|
91
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
92
|
+
}
|
|
93
|
+
function isMacOS(platform) {
|
|
94
|
+
return platform === "darwin";
|
|
95
|
+
}
|
|
96
|
+
function baseDir(kind, options) {
|
|
97
|
+
const override = envValue(options, kind);
|
|
98
|
+
if (override)
|
|
99
|
+
return override;
|
|
100
|
+
const home = options.home ?? homedir();
|
|
101
|
+
const platform = options.platform ?? process.platform;
|
|
102
|
+
if (isMacOS(platform)) {
|
|
103
|
+
switch (kind) {
|
|
104
|
+
case "config":
|
|
105
|
+
case "data":
|
|
106
|
+
return join(home, "Library", "Application Support", "Hasna");
|
|
107
|
+
case "cache":
|
|
108
|
+
return join(home, "Library", "Caches", "Hasna");
|
|
109
|
+
case "state":
|
|
110
|
+
return join(home, "Library", "Logs", "Hasna");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
switch (kind) {
|
|
114
|
+
case "config":
|
|
115
|
+
return join(home, ".config", "hasna");
|
|
116
|
+
case "data":
|
|
117
|
+
return join(home, ".local", "share", "hasna");
|
|
118
|
+
case "state":
|
|
119
|
+
return join(home, ".local", "state", "hasna");
|
|
120
|
+
case "cache":
|
|
121
|
+
return join(home, ".cache", "hasna");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function resolvePath(kind, options) {
|
|
125
|
+
assertApp(options.app);
|
|
126
|
+
const appSegment = options.internal === true ? join("internal", options.app) : options.app;
|
|
127
|
+
return join(baseDir(kind, options), appSegment);
|
|
128
|
+
}
|
|
129
|
+
function dataDir(options) {
|
|
130
|
+
return resolvePath("data", options);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/lib/paths.ts
|
|
134
|
+
function effectiveHome(env = process.env) {
|
|
135
|
+
return env.HOME || env.USERPROFILE || homedir2();
|
|
136
|
+
}
|
|
137
|
+
function legacyHomeDir(env = process.env) {
|
|
138
|
+
return join2(effectiveHome(env), ".hasna", "todos");
|
|
139
|
+
}
|
|
140
|
+
function resolverHome(env = process.env) {
|
|
141
|
+
return dataDir({ app: "todos", home: effectiveHome(env), env });
|
|
142
|
+
}
|
|
143
|
+
function adoptResolverHome(resolved, env = process.env) {
|
|
144
|
+
const dataOverride = env.HASNA_DATA_HOME;
|
|
145
|
+
if (typeof dataOverride === "string" && dataOverride.trim().length > 0)
|
|
146
|
+
return true;
|
|
147
|
+
return existsSync(join2(resolved, "todos.db")) || existsSync(join2(resolved, "config.json"));
|
|
148
|
+
}
|
|
149
|
+
function getTodosDir(env = process.env) {
|
|
150
|
+
const resolved = resolverHome(env);
|
|
151
|
+
return resolve(adoptResolverHome(resolved, env) ? resolved : legacyHomeDir(env));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/lib/sync-utils.ts
|
|
63
155
|
function getHomeDir() {
|
|
64
|
-
return process.env["HOME"] || process.env["USERPROFILE"] ||
|
|
156
|
+
return process.env["HOME"] || process.env["USERPROFILE"] || homedir3();
|
|
65
157
|
}
|
|
66
158
|
var HOME = getHomeDir();
|
|
67
159
|
function getTodosGlobalDir() {
|
|
68
|
-
return
|
|
160
|
+
return getTodosDir();
|
|
69
161
|
}
|
|
70
162
|
function readJsonFile(path) {
|
|
71
163
|
try {
|
|
@@ -77,13 +169,13 @@ function readJsonFile(path) {
|
|
|
77
169
|
|
|
78
170
|
// src/lib/config.ts
|
|
79
171
|
function getConfigPath() {
|
|
80
|
-
return
|
|
172
|
+
return join3(getTodosGlobalDir(), "config.json");
|
|
81
173
|
}
|
|
82
174
|
var cached = null;
|
|
83
175
|
function loadConfig() {
|
|
84
176
|
if (cached)
|
|
85
177
|
return cached;
|
|
86
|
-
if (!
|
|
178
|
+
if (!existsSync3(getConfigPath())) {
|
|
87
179
|
cached = {};
|
|
88
180
|
return cached;
|
|
89
181
|
}
|
|
@@ -559,7 +651,7 @@ class TodosClient {
|
|
|
559
651
|
return this._fetchWithRetry(path, { method: "DELETE" });
|
|
560
652
|
}
|
|
561
653
|
_sleep(ms) {
|
|
562
|
-
return new Promise((
|
|
654
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
563
655
|
}
|
|
564
656
|
async getHealth() {
|
|
565
657
|
return this._get("/api/health");
|