@hasna/instructions 0.4.34 → 0.4.35
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/README.md +6 -7
- package/dist/cli/index.js +689 -185
- package/dist/data/config-store.d.ts +4 -4
- package/dist/data/config-store.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/generated/storage-kit/backend.d.ts +20 -0
- package/dist/generated/storage-kit/backend.d.ts.map +1 -0
- package/dist/generated/storage-kit/index.d.ts +2 -2
- package/dist/generated/storage-kit/index.d.ts.map +1 -1
- package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
- package/dist/generated/storage-kit/own.d.ts +11 -0
- package/dist/generated/storage-kit/own.d.ts.map +1 -0
- package/dist/generated/storage-kit/pool.d.ts +7 -6
- package/dist/generated/storage-kit/pool.d.ts.map +1 -1
- package/dist/generated/storage-kit/tls.d.ts +30 -3
- package/dist/generated/storage-kit/tls.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -38
- package/dist/lib/apply.d.ts.map +1 -1
- package/dist/lib/cursor-authority.d.ts +3 -26
- package/dist/lib/cursor-authority.d.ts.map +1 -1
- package/dist/lib/retired-storage-mode.d.ts +8 -0
- package/dist/lib/retired-storage-mode.d.ts.map +1 -0
- package/dist/mcp/index.js +73 -73
- package/dist/server/cloud.d.ts +2 -2
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +456 -271
- package/package.json +2 -1
- package/dist/generated/storage-kit/mode.d.ts +0 -48
- package/dist/generated/storage-kit/mode.d.ts.map +0 -1
package/dist/mcp/index.js
CHANGED
|
@@ -73,6 +73,30 @@ var init_types = __esm(() => {
|
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
// src/lib/retired-storage-mode.ts
|
|
77
|
+
function firstDefinedEnvKey(env, keys) {
|
|
78
|
+
for (const key of keys) {
|
|
79
|
+
if (Object.hasOwn(env, key) && env[key] !== undefined)
|
|
80
|
+
return key;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function assertNoLegacyStorageMode(env = process.env) {
|
|
85
|
+
const legacyKey = firstDefinedEnvKey(env, LEGACY_STORAGE_MODE_KEYS);
|
|
86
|
+
if (!legacyKey)
|
|
87
|
+
return;
|
|
88
|
+
throw new Error(`${legacyKey} was removed. Deployment modes no longer exist: delete the storage-mode variable. ` + `The client uses the local SQLite store, or the HTTP API selected by ` + `HASNA_INSTRUCTIONS_API_URL + HASNA_INSTRUCTIONS_API_KEY. ` + `On the server, set HASNA_INSTRUCTIONS_DATABASE_URL to select the postgresql backend, ` + `or leave it unset for sqlite.`);
|
|
89
|
+
}
|
|
90
|
+
var LEGACY_STORAGE_MODE_KEYS;
|
|
91
|
+
var init_retired_storage_mode = __esm(() => {
|
|
92
|
+
LEGACY_STORAGE_MODE_KEYS = [
|
|
93
|
+
"HASNA_INSTRUCTIONS_STORAGE_MODE",
|
|
94
|
+
"HASNA_INSTRUCTIONS_MODE",
|
|
95
|
+
"INSTRUCTIONS_STORAGE_MODE",
|
|
96
|
+
"INSTRUCTIONS_MODE"
|
|
97
|
+
];
|
|
98
|
+
});
|
|
99
|
+
|
|
76
100
|
// src/db/database.ts
|
|
77
101
|
import { Database } from "bun:sqlite";
|
|
78
102
|
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
@@ -99,8 +123,9 @@ function slugify(name) {
|
|
|
99
123
|
function getDatabase(path) {
|
|
100
124
|
if (_db)
|
|
101
125
|
return _db;
|
|
126
|
+
assertNoLegacyStorageMode();
|
|
102
127
|
if (!path && process.env["HASNA_INSTRUCTIONS_API_URL"] && process.env["HASNA_INSTRUCTIONS_API_KEY"]) {
|
|
103
|
-
throw new Error("instructions is
|
|
128
|
+
throw new Error("instructions is using the HTTP API transport (HASNA_INSTRUCTIONS_API_URL set): this command is not wired to the API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
|
|
104
129
|
}
|
|
105
130
|
const dbPath = path || getDbPath();
|
|
106
131
|
const db = new Database(dbPath);
|
|
@@ -181,6 +206,7 @@ function insertFeedback(input, db) {
|
|
|
181
206
|
}
|
|
182
207
|
var MIGRATIONS, _db = null;
|
|
183
208
|
var init_database = __esm(() => {
|
|
209
|
+
init_retired_storage_mode();
|
|
184
210
|
MIGRATIONS = [
|
|
185
211
|
`
|
|
186
212
|
CREATE TABLE IF NOT EXISTS configs (
|
|
@@ -860,7 +886,7 @@ Policy reference: \`${CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE}\`
|
|
|
860
886
|
`;
|
|
861
887
|
});
|
|
862
888
|
|
|
863
|
-
// node_modules/zod/v3/helpers/util.js
|
|
889
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
864
890
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
865
891
|
const t = typeof data;
|
|
866
892
|
switch (t) {
|
|
@@ -991,7 +1017,7 @@ var init_util = __esm(() => {
|
|
|
991
1017
|
]);
|
|
992
1018
|
});
|
|
993
1019
|
|
|
994
|
-
// node_modules/zod/v3/ZodError.js
|
|
1020
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
995
1021
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
996
1022
|
const json = JSON.stringify(obj, null, 2);
|
|
997
1023
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -1112,7 +1138,7 @@ var init_ZodError = __esm(() => {
|
|
|
1112
1138
|
};
|
|
1113
1139
|
});
|
|
1114
1140
|
|
|
1115
|
-
// node_modules/zod/v3/locales/en.js
|
|
1141
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
|
|
1116
1142
|
var errorMap = (issue, _ctx) => {
|
|
1117
1143
|
let message;
|
|
1118
1144
|
switch (issue.code) {
|
|
@@ -1219,7 +1245,7 @@ var init_en = __esm(() => {
|
|
|
1219
1245
|
en_default = errorMap;
|
|
1220
1246
|
});
|
|
1221
1247
|
|
|
1222
|
-
// node_modules/zod/v3/errors.js
|
|
1248
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
|
|
1223
1249
|
function setErrorMap(map) {
|
|
1224
1250
|
overrideErrorMap = map;
|
|
1225
1251
|
}
|
|
@@ -1232,7 +1258,7 @@ var init_errors = __esm(() => {
|
|
|
1232
1258
|
overrideErrorMap = en_default;
|
|
1233
1259
|
});
|
|
1234
1260
|
|
|
1235
|
-
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1261
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
1236
1262
|
function addIssueToContext(ctx, issueData) {
|
|
1237
1263
|
const overrideMap = getErrorMap();
|
|
1238
1264
|
const issue = makeIssue({
|
|
@@ -1337,10 +1363,10 @@ var init_parseUtil = __esm(() => {
|
|
|
1337
1363
|
});
|
|
1338
1364
|
});
|
|
1339
1365
|
|
|
1340
|
-
// node_modules/zod/v3/helpers/typeAliases.js
|
|
1366
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
|
|
1341
1367
|
var init_typeAliases = () => {};
|
|
1342
1368
|
|
|
1343
|
-
// node_modules/zod/v3/helpers/errorUtil.js
|
|
1369
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
|
|
1344
1370
|
var errorUtil;
|
|
1345
1371
|
var init_errorUtil = __esm(() => {
|
|
1346
1372
|
(function(errorUtil2) {
|
|
@@ -1349,7 +1375,7 @@ var init_errorUtil = __esm(() => {
|
|
|
1349
1375
|
})(errorUtil || (errorUtil = {}));
|
|
1350
1376
|
});
|
|
1351
1377
|
|
|
1352
|
-
// node_modules/zod/v3/types.js
|
|
1378
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
|
|
1353
1379
|
class ParseInputLazyPath {
|
|
1354
1380
|
constructor(parent, value, path, key) {
|
|
1355
1381
|
this._cachedPath = [];
|
|
@@ -4700,7 +4726,7 @@ var init_types2 = __esm(() => {
|
|
|
4700
4726
|
NEVER = INVALID;
|
|
4701
4727
|
});
|
|
4702
4728
|
|
|
4703
|
-
// node_modules/zod/v3/external.js
|
|
4729
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
4704
4730
|
var exports_external = {};
|
|
4705
4731
|
__export(exports_external, {
|
|
4706
4732
|
void: () => voidType,
|
|
@@ -4820,7 +4846,7 @@ var init_external = __esm(() => {
|
|
|
4820
4846
|
init_ZodError();
|
|
4821
4847
|
});
|
|
4822
4848
|
|
|
4823
|
-
// node_modules/zod/index.js
|
|
4849
|
+
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
|
|
4824
4850
|
var init_zod = __esm(() => {
|
|
4825
4851
|
init_external();
|
|
4826
4852
|
init_external();
|
|
@@ -5023,7 +5049,7 @@ var init_redact = __esm(() => {
|
|
|
5023
5049
|
VALUE_PATTERNS = [
|
|
5024
5050
|
{ re: /npm_[A-Za-z0-9]{36,}/, reason: "npm token" },
|
|
5025
5051
|
{ re: /gh[pousr]_[A-Za-z0-9_]{36,}/, reason: "GitHub token" },
|
|
5026
|
-
{ re: /sk-ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
5052
|
+
{ re: /sk[-]ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
5027
5053
|
{ re: /sk-[A-Za-z0-9]{48,}/, reason: "OpenAI API key" },
|
|
5028
5054
|
{ re: /xoxb-[0-9]+-[A-Za-z0-9\-]+/, reason: "Slack bot token" },
|
|
5029
5055
|
{ re: /AIza[0-9A-Za-z\-_]{35}/, reason: "Google API key" },
|
|
@@ -5602,36 +5628,9 @@ var init_asset_plan = __esm(() => {
|
|
|
5602
5628
|
});
|
|
5603
5629
|
|
|
5604
5630
|
// src/lib/cursor-authority.ts
|
|
5605
|
-
|
|
5606
|
-
import { homedir as homedir2 } from "os";
|
|
5607
|
-
import { join as join4, resolve as resolve2 } from "path";
|
|
5608
|
-
function sha256(content) {
|
|
5609
|
-
return createHash("sha256").update(content).digest("hex");
|
|
5610
|
-
}
|
|
5611
|
-
function homeDir() {
|
|
5612
|
-
return process.env["HOME"] || homedir2();
|
|
5613
|
-
}
|
|
5614
|
-
function isCursorGlobalAuthorityPath(path) {
|
|
5615
|
-
return resolve2(path) === resolve2(join4(homeDir(), CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH));
|
|
5616
|
-
}
|
|
5617
|
-
function stampCursorGlobalAuthorityMarker(content) {
|
|
5618
|
-
if (CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN.test(content))
|
|
5619
|
-
return content;
|
|
5620
|
-
const digest = sha256(content);
|
|
5621
|
-
const markerLine = `<!-- ${CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER} hash=sha256:${digest} -->`;
|
|
5622
|
-
const frontmatter = content.match(CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN)?.[0];
|
|
5623
|
-
if (frontmatter) {
|
|
5624
|
-
return `${frontmatter}${markerLine}
|
|
5625
|
-
${content.slice(frontmatter.length)}`;
|
|
5626
|
-
}
|
|
5627
|
-
return `${markerLine}
|
|
5628
|
-
${content}`;
|
|
5629
|
-
}
|
|
5630
|
-
var CURSOR_GLOBAL_AUTHORITY_RELATIVE_PATH = ".cursor/rules/hasna-global.mdc", CURSOR_GLOBAL_AUTHORITY_MAX_BYTES, CURSOR_GLOBAL_AUTHORITY_MANAGED_MARKER = "Managed by @hasna/configs cursor global authority", CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN, CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN;
|
|
5631
|
+
var CURSOR_GLOBAL_AUTHORITY_MAX_BYTES;
|
|
5631
5632
|
var init_cursor_authority = __esm(() => {
|
|
5632
5633
|
CURSOR_GLOBAL_AUTHORITY_MAX_BYTES = 256 * 1024;
|
|
5633
|
-
CURSOR_GLOBAL_AUTHORITY_MARKER_PATTERN = /^<!-- Managed by @hasna\/configs cursor global authority hash=(sha256:[a-f0-9]{64}) -->$/m;
|
|
5634
|
-
CURSOR_GLOBAL_AUTHORITY_FRONTMATTER_PATTERN = /^---\n[\s\S]*?\n---(?:\n|$)/;
|
|
5635
5634
|
});
|
|
5636
5635
|
|
|
5637
5636
|
// src/lib/session-render.ts
|
|
@@ -6320,12 +6319,13 @@ function parseBoundedOrLegacyPage(value, legacyItems, options, label) {
|
|
|
6320
6319
|
return { ...page, source_bounded: false };
|
|
6321
6320
|
}
|
|
6322
6321
|
function resolveCloudConfig(env = process.env) {
|
|
6322
|
+
assertNoLegacyStorageMode(env);
|
|
6323
6323
|
const apiUrl = env[API_URL_ENV]?.trim();
|
|
6324
6324
|
const apiKey = env[API_KEY_ENV]?.trim();
|
|
6325
6325
|
if (!apiUrl && !apiKey)
|
|
6326
6326
|
return null;
|
|
6327
6327
|
if (!apiUrl || !apiKey) {
|
|
6328
|
-
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the
|
|
6328
|
+
throw new Error(`API mode requires BOTH ${API_URL_ENV} and ${API_KEY_ENV}; only ` + `${apiUrl ? API_URL_ENV : API_KEY_ENV} is set. Set both to use the HTTP API, ` + `or unset both to use the local store.`);
|
|
6329
6329
|
}
|
|
6330
6330
|
return { apiUrl, apiKey };
|
|
6331
6331
|
}
|
|
@@ -6812,6 +6812,7 @@ var init_config_store = __esm(() => {
|
|
|
6812
6812
|
init_types();
|
|
6813
6813
|
init_bounded_read();
|
|
6814
6814
|
init_instruction_graph();
|
|
6815
|
+
init_retired_storage_mode();
|
|
6815
6816
|
CloudHttpError = class CloudHttpError extends Error {
|
|
6816
6817
|
status;
|
|
6817
6818
|
body;
|
|
@@ -6826,7 +6827,7 @@ var init_config_store = __esm(() => {
|
|
|
6826
6827
|
|
|
6827
6828
|
// src/lib/session-render-ownership.ts
|
|
6828
6829
|
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
6829
|
-
import { dirname as dirname2, join as
|
|
6830
|
+
import { dirname as dirname2, join as join4, parse as parse2, relative as relative2, sep } from "path";
|
|
6830
6831
|
function toSegments(absolutePath2) {
|
|
6831
6832
|
return absolutePath2.replaceAll("\\", "/").split("/").filter(Boolean);
|
|
6832
6833
|
}
|
|
@@ -6874,7 +6875,7 @@ function sessionRenderManifestClaimsPath(absolutePath2) {
|
|
|
6874
6875
|
const root = parse2(absolutePath2).root;
|
|
6875
6876
|
let home = dirname2(absolutePath2);
|
|
6876
6877
|
for (let depth = 0;depth < MANIFEST_ANCESTOR_LIMIT; depth += 1) {
|
|
6877
|
-
const manifestPath =
|
|
6878
|
+
const manifestPath = join4(home, ...SESSION_RENDER_MANIFEST_RELATIVE_PATH.split("/"));
|
|
6878
6879
|
const relativePaths = readManifestRelativePaths(manifestPath);
|
|
6879
6880
|
if (relativePaths) {
|
|
6880
6881
|
const claimed = relative2(home, absolutePath2).split(sep).join("/");
|
|
@@ -6910,16 +6911,16 @@ __export(exports_apply, {
|
|
|
6910
6911
|
applyConfig: () => applyConfig
|
|
6911
6912
|
});
|
|
6912
6913
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, realpathSync, writeFileSync } from "fs";
|
|
6913
|
-
import { basename as basename3, dirname as dirname3, join as
|
|
6914
|
-
import { homedir as
|
|
6914
|
+
import { basename as basename3, dirname as dirname3, join as join5, resolve as resolve2 } from "path";
|
|
6915
|
+
import { homedir as homedir2 } from "os";
|
|
6915
6916
|
function getConfigHome() {
|
|
6916
|
-
return process.env["CONFIGS_HOME"] || process.env["HOME"] ||
|
|
6917
|
+
return process.env["CONFIGS_HOME"] || process.env["HOME"] || homedir2();
|
|
6917
6918
|
}
|
|
6918
6919
|
function expandPath(p) {
|
|
6919
6920
|
if (p.startsWith("~/")) {
|
|
6920
|
-
return
|
|
6921
|
+
return resolve2(getConfigHome(), p.slice(2));
|
|
6921
6922
|
}
|
|
6922
|
-
return
|
|
6923
|
+
return resolve2(p);
|
|
6923
6924
|
}
|
|
6924
6925
|
function normalizeTargetPath(p) {
|
|
6925
6926
|
const expanded = expandPath(p);
|
|
@@ -6931,7 +6932,7 @@ function normalizeTargetPath(p) {
|
|
|
6931
6932
|
while (true) {
|
|
6932
6933
|
if (existsSync4(current)) {
|
|
6933
6934
|
try {
|
|
6934
|
-
return
|
|
6935
|
+
return resolve2(realpathSync(current), ...missingSegments);
|
|
6935
6936
|
} catch {
|
|
6936
6937
|
return expanded;
|
|
6937
6938
|
}
|
|
@@ -6959,9 +6960,8 @@ async function writeConfigResult(config, targetPath, content, opts, meta = {}) {
|
|
|
6959
6960
|
throw new ConfigApplyError(`Antigravity rule file ${renderedTargetPath} is ${renderedContent.length} characters; split it before applying because Antigravity limits rule files to ${ANTIGRAVITY_RULE_FILE_CHAR_LIMIT} characters.`);
|
|
6960
6961
|
}
|
|
6961
6962
|
const path = expandPath(renderedTargetPath);
|
|
6962
|
-
const renderedForTarget = isCursorGlobalAuthorityPath(path) ? stampCursorGlobalAuthorityMarker(renderedContent) : renderedContent;
|
|
6963
6963
|
const previousContent = existsSync4(path) ? readFileSync2(path, "utf-8") : null;
|
|
6964
|
-
const changed = previousContent !==
|
|
6964
|
+
const changed = previousContent !== renderedContent;
|
|
6965
6965
|
if (!opts.dryRun) {
|
|
6966
6966
|
const dir = dirname3(path);
|
|
6967
6967
|
if (!existsSync4(dir)) {
|
|
@@ -6971,13 +6971,13 @@ async function writeConfigResult(config, targetPath, content, opts, meta = {}) {
|
|
|
6971
6971
|
const store = opts.store ?? resolveConfigStore();
|
|
6972
6972
|
await store.createSnapshot(config.id, previousContent, config.version);
|
|
6973
6973
|
}
|
|
6974
|
-
writeFileSync(path,
|
|
6974
|
+
writeFileSync(path, renderedContent, "utf-8");
|
|
6975
6975
|
}
|
|
6976
6976
|
return {
|
|
6977
6977
|
config_id: config.id,
|
|
6978
6978
|
path,
|
|
6979
6979
|
previous_content: previousContent,
|
|
6980
|
-
new_content:
|
|
6980
|
+
new_content: renderedContent,
|
|
6981
6981
|
dry_run: opts.dryRun ?? false,
|
|
6982
6982
|
changed,
|
|
6983
6983
|
primary_changed: changed,
|
|
@@ -7324,7 +7324,7 @@ function sessionRendererOwnsCanonicalTarget(normalized, opts) {
|
|
|
7324
7324
|
getConfigHome(),
|
|
7325
7325
|
opts.vars?.["HOME_DIR"]
|
|
7326
7326
|
].filter((home) => typeof home === "string" && home.length > 0));
|
|
7327
|
-
if ([...homes].some((home) => SESSION_RENDER_OWNED_CONFIG_TARGETS.some((relativePath) => normalized === normalizeTargetPath(
|
|
7327
|
+
if ([...homes].some((home) => SESSION_RENDER_OWNED_CONFIG_TARGETS.some((relativePath) => normalized === normalizeTargetPath(join5(home, ...relativePath.split("/"))))))
|
|
7328
7328
|
return true;
|
|
7329
7329
|
return sessionRenderOwnsPath(normalized);
|
|
7330
7330
|
}
|
|
@@ -7338,7 +7338,6 @@ var init_apply = __esm(() => {
|
|
|
7338
7338
|
init_redact();
|
|
7339
7339
|
init_template();
|
|
7340
7340
|
init_transforms();
|
|
7341
|
-
init_cursor_authority();
|
|
7342
7341
|
});
|
|
7343
7342
|
|
|
7344
7343
|
// src/lib/sync.ts
|
|
@@ -7358,7 +7357,7 @@ __export(exports_sync, {
|
|
|
7358
7357
|
CLAUDE_PROMPT_OUTPUTS: () => CLAUDE_PROMPT_OUTPUTS
|
|
7359
7358
|
});
|
|
7360
7359
|
import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3 } from "fs";
|
|
7361
|
-
import { basename as basename4, extname as extname2, join as
|
|
7360
|
+
import { basename as basename4, extname as extname2, join as join6 } from "path";
|
|
7362
7361
|
function claudeRuleOutputs(fileName) {
|
|
7363
7362
|
const stem = basename4(fileName, extname2(fileName));
|
|
7364
7363
|
return [
|
|
@@ -7422,7 +7421,7 @@ async function syncProject(opts) {
|
|
|
7422
7421
|
const allConfigs = await store.listConfigs();
|
|
7423
7422
|
const machine = detectMachineContext();
|
|
7424
7423
|
for (const pf of PROJECT_CONFIG_FILES) {
|
|
7425
|
-
const abs =
|
|
7424
|
+
const abs = join6(absDir, pf.file);
|
|
7426
7425
|
if (!existsSync5(abs))
|
|
7427
7426
|
continue;
|
|
7428
7427
|
try {
|
|
@@ -7455,19 +7454,19 @@ async function syncProject(opts) {
|
|
|
7455
7454
|
}
|
|
7456
7455
|
}
|
|
7457
7456
|
for (const ruleDir of [
|
|
7458
|
-
{ dir:
|
|
7459
|
-
{ dir:
|
|
7460
|
-
{ dir:
|
|
7461
|
-
{ dir:
|
|
7462
|
-
{ dir:
|
|
7463
|
-
{ dir:
|
|
7464
|
-
{ dir:
|
|
7457
|
+
{ dir: join6(absDir, ".claude", "rules"), agent: "claude", namePrefix: "rules" },
|
|
7458
|
+
{ dir: join6(absDir, ".agents", "rules"), agent: "antigravity", namePrefix: "antigravity-rules" },
|
|
7459
|
+
{ dir: join6(absDir, ".cursor", "rules"), agent: "cursor", namePrefix: "cursor-rules" },
|
|
7460
|
+
{ dir: join6(absDir, ".github", "instructions"), agent: "copilot", namePrefix: "copilot-instructions" },
|
|
7461
|
+
{ dir: join6(absDir, ".devin", "rules"), agent: "devin", namePrefix: "devin-rules" },
|
|
7462
|
+
{ dir: join6(absDir, ".windsurf", "rules"), agent: "windsurf-legacy", namePrefix: "windsurf-rules" },
|
|
7463
|
+
{ dir: join6(absDir, ".clinerules"), agent: "cline", namePrefix: "cline-rules" }
|
|
7465
7464
|
]) {
|
|
7466
7465
|
if (!existsSync5(ruleDir.dir))
|
|
7467
7466
|
continue;
|
|
7468
7467
|
const mdFiles = readdirSync(ruleDir.dir).filter((f) => f.endsWith(".md") || f.endsWith(".mdc"));
|
|
7469
7468
|
for (const f of mdFiles) {
|
|
7470
|
-
const abs =
|
|
7469
|
+
const abs = join6(ruleDir.dir, f);
|
|
7471
7470
|
const raw = readFileSync3(abs, "utf-8");
|
|
7472
7471
|
const redacted = redactContent(raw, "markdown");
|
|
7473
7472
|
const machineAware = templateizeMachineContent(redacted.content, machine);
|
|
@@ -7514,7 +7513,7 @@ async function syncKnown(opts = {}) {
|
|
|
7514
7513
|
const extensions = known.rulesExtensions ?? [".md", ".mdc"];
|
|
7515
7514
|
const ruleFiles = readdirSync(absDir).filter((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
7516
7515
|
for (const f of ruleFiles) {
|
|
7517
|
-
const abs2 =
|
|
7516
|
+
const abs2 = join6(absDir, f);
|
|
7518
7517
|
const targetPath = abs2.replace(home, "~");
|
|
7519
7518
|
if (existingOutputOwners.has(normalizeTargetPath(targetPath)) || isKnownGeneratedTargetPath(targetPath)) {
|
|
7520
7519
|
result.skipped.push(`${targetPath} (generated output)`);
|
|
@@ -7885,8 +7884,8 @@ var init_sync = __esm(() => {
|
|
|
7885
7884
|
|
|
7886
7885
|
// src/lib/sync-dir.ts
|
|
7887
7886
|
import { existsSync as existsSync6, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
|
|
7888
|
-
import { join as
|
|
7889
|
-
import { homedir as
|
|
7887
|
+
import { join as join7, relative as relative3 } from "path";
|
|
7888
|
+
import { homedir as homedir3 } from "os";
|
|
7890
7889
|
function shouldSkip(p) {
|
|
7891
7890
|
return SKIP.some((s) => p.includes(s));
|
|
7892
7891
|
}
|
|
@@ -7895,9 +7894,9 @@ async function syncFromDir(dir, opts = {}) {
|
|
|
7895
7894
|
const absDir = expandPath(dir);
|
|
7896
7895
|
if (!existsSync6(absDir))
|
|
7897
7896
|
return { added: 0, updated: 0, unchanged: 0, skipped: [`Not found: ${absDir}`] };
|
|
7898
|
-
const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) =>
|
|
7897
|
+
const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) => join7(absDir, f)).filter((f) => statSync2(f).isFile());
|
|
7899
7898
|
const result = { added: 0, updated: 0, unchanged: 0, skipped: [] };
|
|
7900
|
-
const home =
|
|
7899
|
+
const home = homedir3();
|
|
7901
7900
|
const allConfigs = await store.listConfigs();
|
|
7902
7901
|
for (const file of files) {
|
|
7903
7902
|
if (shouldSkip(file)) {
|
|
@@ -7931,7 +7930,7 @@ async function syncFromDir(dir, opts = {}) {
|
|
|
7931
7930
|
}
|
|
7932
7931
|
async function syncToDir(dir, opts = {}) {
|
|
7933
7932
|
const store = opts.store ?? resolveConfigStore();
|
|
7934
|
-
const home =
|
|
7933
|
+
const home = homedir3();
|
|
7935
7934
|
const absDir = expandPath(dir);
|
|
7936
7935
|
const normalized = dir.startsWith("~/") ? dir : absDir.replace(home, "~");
|
|
7937
7936
|
const configs = (await store.listConfigs()).filter((c) => c.target_path && (c.target_path.startsWith(normalized) || c.target_path.startsWith(absDir)));
|
|
@@ -7955,7 +7954,7 @@ async function syncToDir(dir, opts = {}) {
|
|
|
7955
7954
|
}
|
|
7956
7955
|
function walkDir(dir, files = []) {
|
|
7957
7956
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
7958
|
-
const full =
|
|
7957
|
+
const full = join7(dir, entry.name);
|
|
7959
7958
|
if (shouldSkip(full))
|
|
7960
7959
|
continue;
|
|
7961
7960
|
if (entry.isDirectory())
|
|
@@ -7977,7 +7976,7 @@ var init_sync_dir = __esm(() => {
|
|
|
7977
7976
|
var require_package = __commonJS((exports, module) => {
|
|
7978
7977
|
module.exports = {
|
|
7979
7978
|
name: "@hasna/instructions",
|
|
7980
|
-
version: "0.4.
|
|
7979
|
+
version: "0.4.35",
|
|
7981
7980
|
description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
|
|
7982
7981
|
type: "module",
|
|
7983
7982
|
main: "dist/index.js",
|
|
@@ -8066,6 +8065,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
8066
8065
|
"@types/bun": "^1.2.4",
|
|
8067
8066
|
"@types/pg": "^8.11.11",
|
|
8068
8067
|
"@types/react": "^18.3.18",
|
|
8068
|
+
"bun-types": "1.3.14",
|
|
8069
8069
|
typescript: "^5.7.3"
|
|
8070
8070
|
}
|
|
8071
8071
|
};
|
package/dist/server/cloud.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare const INSTRUCTIONS_APP_SLUG = "instructions";
|
|
|
14
14
|
export declare function resolveCloudDatabaseUrl(env?: NodeJS.ProcessEnv): string | undefined;
|
|
15
15
|
/** Resolve the HMAC signing secret used to verify API keys. */
|
|
16
16
|
export declare function resolveSigningSecret(env?: NodeJS.ProcessEnv): string | undefined;
|
|
17
|
-
/** True when this process is configured to serve the
|
|
18
|
-
export declare function
|
|
17
|
+
/** True when this process is configured to serve the `/v1` API (postgresql backend). */
|
|
18
|
+
export declare function isPostgresBackendEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
19
19
|
/** The vendored-kit query client backing every `/v1` handler (pure remote). */
|
|
20
20
|
export declare function getCloudClient(): PoolQueryClient;
|
|
21
21
|
export declare function getApiKeyStore(): ApiKeyStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/server/cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAgB,UAAU,EAAE,KAAK,cAAc,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/server/cloud.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAgB,UAAU,EAAE,KAAK,cAAc,EAAE,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AACzH,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAI1G,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAQhG;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAO7F;AAED,wFAAwF;AACxF,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEtF;AA0BD,+EAA+E;AAC/E,wBAAgB,cAAc,IAAI,eAAe,CAEhD;AAkBD,wBAAgB,cAAc,IAAI,WAAW,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,cAAc,CAejD;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAUvD;AAQD,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAmB7F;AAED,iEAAiE;AACjE,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAIlD;AAED,4BAA4B;AAC5B,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAMhD"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
port: number;
|
|
4
4
|
hostname: string;
|
|
5
|
-
fetch: (request: Request,
|
|
5
|
+
fetch: (request: Request, env?: unknown, executionCtx?: import("hono").ExecutionContext) => Response | Promise<Response>;
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|