@hasna/instructions 0.4.35 → 0.4.36
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 +8 -7
- package/dist/cli/index.js +191 -699
- 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/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/mode.d.ts +48 -0
- package/dist/generated/storage-kit/mode.d.ts.map +1 -0
- package/dist/generated/storage-kit/pool.d.ts +6 -7
- package/dist/generated/storage-kit/pool.d.ts.map +1 -1
- package/dist/generated/storage-kit/tls.d.ts +3 -30
- 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 +44 -55
- package/dist/lib/apply.d.ts.map +1 -1
- package/dist/lib/cursor-authority.d.ts +36 -3
- package/dist/lib/cursor-authority.d.ts.map +1 -1
- 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 +271 -456
- package/package.json +1 -2
- package/dist/generated/storage-kit/backend.d.ts +0 -20
- package/dist/generated/storage-kit/backend.d.ts.map +0 -1
- package/dist/generated/storage-kit/own.d.ts +0 -11
- package/dist/generated/storage-kit/own.d.ts.map +0 -1
- package/dist/lib/retired-storage-mode.d.ts +0 -8
- package/dist/lib/retired-storage-mode.d.ts.map +0 -1
package/dist/mcp/index.js
CHANGED
|
@@ -73,30 +73,6 @@ 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
|
-
|
|
100
76
|
// src/db/database.ts
|
|
101
77
|
import { Database } from "bun:sqlite";
|
|
102
78
|
import { existsSync, mkdirSync, rmSync } from "fs";
|
|
@@ -123,9 +99,8 @@ function slugify(name) {
|
|
|
123
99
|
function getDatabase(path) {
|
|
124
100
|
if (_db)
|
|
125
101
|
return _db;
|
|
126
|
-
assertNoLegacyStorageMode();
|
|
127
102
|
if (!path && process.env["HASNA_INSTRUCTIONS_API_URL"] && process.env["HASNA_INSTRUCTIONS_API_KEY"]) {
|
|
128
|
-
throw new Error("instructions is
|
|
103
|
+
throw new Error("instructions is in self_hosted (cloud) mode: this command is not wired to the cloud API yet. " + "Unset HASNA_INSTRUCTIONS_API_URL / HASNA_INSTRUCTIONS_API_KEY to use it against the local store.");
|
|
129
104
|
}
|
|
130
105
|
const dbPath = path || getDbPath();
|
|
131
106
|
const db = new Database(dbPath);
|
|
@@ -206,7 +181,6 @@ function insertFeedback(input, db) {
|
|
|
206
181
|
}
|
|
207
182
|
var MIGRATIONS, _db = null;
|
|
208
183
|
var init_database = __esm(() => {
|
|
209
|
-
init_retired_storage_mode();
|
|
210
184
|
MIGRATIONS = [
|
|
211
185
|
`
|
|
212
186
|
CREATE TABLE IF NOT EXISTS configs (
|
|
@@ -886,7 +860,7 @@ Policy reference: \`${CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE}\`
|
|
|
886
860
|
`;
|
|
887
861
|
});
|
|
888
862
|
|
|
889
|
-
//
|
|
863
|
+
// node_modules/zod/v3/helpers/util.js
|
|
890
864
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
891
865
|
const t = typeof data;
|
|
892
866
|
switch (t) {
|
|
@@ -1017,7 +991,7 @@ var init_util = __esm(() => {
|
|
|
1017
991
|
]);
|
|
1018
992
|
});
|
|
1019
993
|
|
|
1020
|
-
//
|
|
994
|
+
// node_modules/zod/v3/ZodError.js
|
|
1021
995
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
1022
996
|
const json = JSON.stringify(obj, null, 2);
|
|
1023
997
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -1138,7 +1112,7 @@ var init_ZodError = __esm(() => {
|
|
|
1138
1112
|
};
|
|
1139
1113
|
});
|
|
1140
1114
|
|
|
1141
|
-
//
|
|
1115
|
+
// node_modules/zod/v3/locales/en.js
|
|
1142
1116
|
var errorMap = (issue, _ctx) => {
|
|
1143
1117
|
let message;
|
|
1144
1118
|
switch (issue.code) {
|
|
@@ -1245,7 +1219,7 @@ var init_en = __esm(() => {
|
|
|
1245
1219
|
en_default = errorMap;
|
|
1246
1220
|
});
|
|
1247
1221
|
|
|
1248
|
-
//
|
|
1222
|
+
// node_modules/zod/v3/errors.js
|
|
1249
1223
|
function setErrorMap(map) {
|
|
1250
1224
|
overrideErrorMap = map;
|
|
1251
1225
|
}
|
|
@@ -1258,7 +1232,7 @@ var init_errors = __esm(() => {
|
|
|
1258
1232
|
overrideErrorMap = en_default;
|
|
1259
1233
|
});
|
|
1260
1234
|
|
|
1261
|
-
//
|
|
1235
|
+
// node_modules/zod/v3/helpers/parseUtil.js
|
|
1262
1236
|
function addIssueToContext(ctx, issueData) {
|
|
1263
1237
|
const overrideMap = getErrorMap();
|
|
1264
1238
|
const issue = makeIssue({
|
|
@@ -1363,10 +1337,10 @@ var init_parseUtil = __esm(() => {
|
|
|
1363
1337
|
});
|
|
1364
1338
|
});
|
|
1365
1339
|
|
|
1366
|
-
//
|
|
1340
|
+
// node_modules/zod/v3/helpers/typeAliases.js
|
|
1367
1341
|
var init_typeAliases = () => {};
|
|
1368
1342
|
|
|
1369
|
-
//
|
|
1343
|
+
// node_modules/zod/v3/helpers/errorUtil.js
|
|
1370
1344
|
var errorUtil;
|
|
1371
1345
|
var init_errorUtil = __esm(() => {
|
|
1372
1346
|
(function(errorUtil2) {
|
|
@@ -1375,7 +1349,7 @@ var init_errorUtil = __esm(() => {
|
|
|
1375
1349
|
})(errorUtil || (errorUtil = {}));
|
|
1376
1350
|
});
|
|
1377
1351
|
|
|
1378
|
-
//
|
|
1352
|
+
// node_modules/zod/v3/types.js
|
|
1379
1353
|
class ParseInputLazyPath {
|
|
1380
1354
|
constructor(parent, value, path, key) {
|
|
1381
1355
|
this._cachedPath = [];
|
|
@@ -4726,7 +4700,7 @@ var init_types2 = __esm(() => {
|
|
|
4726
4700
|
NEVER = INVALID;
|
|
4727
4701
|
});
|
|
4728
4702
|
|
|
4729
|
-
//
|
|
4703
|
+
// node_modules/zod/v3/external.js
|
|
4730
4704
|
var exports_external = {};
|
|
4731
4705
|
__export(exports_external, {
|
|
4732
4706
|
void: () => voidType,
|
|
@@ -4846,7 +4820,7 @@ var init_external = __esm(() => {
|
|
|
4846
4820
|
init_ZodError();
|
|
4847
4821
|
});
|
|
4848
4822
|
|
|
4849
|
-
//
|
|
4823
|
+
// node_modules/zod/index.js
|
|
4850
4824
|
var init_zod = __esm(() => {
|
|
4851
4825
|
init_external();
|
|
4852
4826
|
init_external();
|
|
@@ -5049,7 +5023,7 @@ var init_redact = __esm(() => {
|
|
|
5049
5023
|
VALUE_PATTERNS = [
|
|
5050
5024
|
{ re: /npm_[A-Za-z0-9]{36,}/, reason: "npm token" },
|
|
5051
5025
|
{ re: /gh[pousr]_[A-Za-z0-9_]{36,}/, reason: "GitHub token" },
|
|
5052
|
-
{ re: /sk
|
|
5026
|
+
{ re: /sk-ant-[A-Za-z0-9\-_]{40,}/, reason: "Anthropic API key" },
|
|
5053
5027
|
{ re: /sk-[A-Za-z0-9]{48,}/, reason: "OpenAI API key" },
|
|
5054
5028
|
{ re: /xoxb-[0-9]+-[A-Za-z0-9\-]+/, reason: "Slack bot token" },
|
|
5055
5029
|
{ re: /AIza[0-9A-Za-z\-_]{35}/, reason: "Google API key" },
|
|
@@ -5628,9 +5602,36 @@ var init_asset_plan = __esm(() => {
|
|
|
5628
5602
|
});
|
|
5629
5603
|
|
|
5630
5604
|
// src/lib/cursor-authority.ts
|
|
5631
|
-
|
|
5605
|
+
import { createHash } from "crypto";
|
|
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;
|
|
5632
5631
|
var init_cursor_authority = __esm(() => {
|
|
5633
5632
|
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|$)/;
|
|
5634
5635
|
});
|
|
5635
5636
|
|
|
5636
5637
|
// src/lib/session-render.ts
|
|
@@ -6319,13 +6320,12 @@ function parseBoundedOrLegacyPage(value, legacyItems, options, label) {
|
|
|
6319
6320
|
return { ...page, source_bounded: false };
|
|
6320
6321
|
}
|
|
6321
6322
|
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 cloud API, ` + `or unset both to use the local store.`);
|
|
6329
6329
|
}
|
|
6330
6330
|
return { apiUrl, apiKey };
|
|
6331
6331
|
}
|
|
@@ -6812,7 +6812,6 @@ var init_config_store = __esm(() => {
|
|
|
6812
6812
|
init_types();
|
|
6813
6813
|
init_bounded_read();
|
|
6814
6814
|
init_instruction_graph();
|
|
6815
|
-
init_retired_storage_mode();
|
|
6816
6815
|
CloudHttpError = class CloudHttpError extends Error {
|
|
6817
6816
|
status;
|
|
6818
6817
|
body;
|
|
@@ -6827,7 +6826,7 @@ var init_config_store = __esm(() => {
|
|
|
6827
6826
|
|
|
6828
6827
|
// src/lib/session-render-ownership.ts
|
|
6829
6828
|
import { existsSync as existsSync3, readFileSync, statSync } from "fs";
|
|
6830
|
-
import { dirname as dirname2, join as
|
|
6829
|
+
import { dirname as dirname2, join as join5, parse as parse2, relative as relative2, sep } from "path";
|
|
6831
6830
|
function toSegments(absolutePath2) {
|
|
6832
6831
|
return absolutePath2.replaceAll("\\", "/").split("/").filter(Boolean);
|
|
6833
6832
|
}
|
|
@@ -6875,7 +6874,7 @@ function sessionRenderManifestClaimsPath(absolutePath2) {
|
|
|
6875
6874
|
const root = parse2(absolutePath2).root;
|
|
6876
6875
|
let home = dirname2(absolutePath2);
|
|
6877
6876
|
for (let depth = 0;depth < MANIFEST_ANCESTOR_LIMIT; depth += 1) {
|
|
6878
|
-
const manifestPath =
|
|
6877
|
+
const manifestPath = join5(home, ...SESSION_RENDER_MANIFEST_RELATIVE_PATH.split("/"));
|
|
6879
6878
|
const relativePaths = readManifestRelativePaths(manifestPath);
|
|
6880
6879
|
if (relativePaths) {
|
|
6881
6880
|
const claimed = relative2(home, absolutePath2).split(sep).join("/");
|
|
@@ -6911,16 +6910,16 @@ __export(exports_apply, {
|
|
|
6911
6910
|
applyConfig: () => applyConfig
|
|
6912
6911
|
});
|
|
6913
6912
|
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync2, realpathSync, writeFileSync } from "fs";
|
|
6914
|
-
import { basename as basename3, dirname as dirname3, join as
|
|
6915
|
-
import { homedir as
|
|
6913
|
+
import { basename as basename3, dirname as dirname3, join as join6, resolve as resolve3 } from "path";
|
|
6914
|
+
import { homedir as homedir3 } from "os";
|
|
6916
6915
|
function getConfigHome() {
|
|
6917
|
-
return process.env["CONFIGS_HOME"] || process.env["HOME"] ||
|
|
6916
|
+
return process.env["CONFIGS_HOME"] || process.env["HOME"] || homedir3();
|
|
6918
6917
|
}
|
|
6919
6918
|
function expandPath(p) {
|
|
6920
6919
|
if (p.startsWith("~/")) {
|
|
6921
|
-
return
|
|
6920
|
+
return resolve3(getConfigHome(), p.slice(2));
|
|
6922
6921
|
}
|
|
6923
|
-
return
|
|
6922
|
+
return resolve3(p);
|
|
6924
6923
|
}
|
|
6925
6924
|
function normalizeTargetPath(p) {
|
|
6926
6925
|
const expanded = expandPath(p);
|
|
@@ -6932,7 +6931,7 @@ function normalizeTargetPath(p) {
|
|
|
6932
6931
|
while (true) {
|
|
6933
6932
|
if (existsSync4(current)) {
|
|
6934
6933
|
try {
|
|
6935
|
-
return
|
|
6934
|
+
return resolve3(realpathSync(current), ...missingSegments);
|
|
6936
6935
|
} catch {
|
|
6937
6936
|
return expanded;
|
|
6938
6937
|
}
|
|
@@ -6960,8 +6959,9 @@ async function writeConfigResult(config, targetPath, content, opts, meta = {}) {
|
|
|
6960
6959
|
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.`);
|
|
6961
6960
|
}
|
|
6962
6961
|
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 !== renderedForTarget;
|
|
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, renderedForTarget, "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: renderedForTarget,
|
|
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(join6(home, ...relativePath.split("/"))))))
|
|
7328
7328
|
return true;
|
|
7329
7329
|
return sessionRenderOwnsPath(normalized);
|
|
7330
7330
|
}
|
|
@@ -7338,6 +7338,7 @@ var init_apply = __esm(() => {
|
|
|
7338
7338
|
init_redact();
|
|
7339
7339
|
init_template();
|
|
7340
7340
|
init_transforms();
|
|
7341
|
+
init_cursor_authority();
|
|
7341
7342
|
});
|
|
7342
7343
|
|
|
7343
7344
|
// src/lib/sync.ts
|
|
@@ -7357,7 +7358,7 @@ __export(exports_sync, {
|
|
|
7357
7358
|
CLAUDE_PROMPT_OUTPUTS: () => CLAUDE_PROMPT_OUTPUTS
|
|
7358
7359
|
});
|
|
7359
7360
|
import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3 } from "fs";
|
|
7360
|
-
import { basename as basename4, extname as extname2, join as
|
|
7361
|
+
import { basename as basename4, extname as extname2, join as join7 } from "path";
|
|
7361
7362
|
function claudeRuleOutputs(fileName) {
|
|
7362
7363
|
const stem = basename4(fileName, extname2(fileName));
|
|
7363
7364
|
return [
|
|
@@ -7421,7 +7422,7 @@ async function syncProject(opts) {
|
|
|
7421
7422
|
const allConfigs = await store.listConfigs();
|
|
7422
7423
|
const machine = detectMachineContext();
|
|
7423
7424
|
for (const pf of PROJECT_CONFIG_FILES) {
|
|
7424
|
-
const abs =
|
|
7425
|
+
const abs = join7(absDir, pf.file);
|
|
7425
7426
|
if (!existsSync5(abs))
|
|
7426
7427
|
continue;
|
|
7427
7428
|
try {
|
|
@@ -7454,19 +7455,19 @@ async function syncProject(opts) {
|
|
|
7454
7455
|
}
|
|
7455
7456
|
}
|
|
7456
7457
|
for (const ruleDir of [
|
|
7457
|
-
{ dir:
|
|
7458
|
-
{ dir:
|
|
7459
|
-
{ dir:
|
|
7460
|
-
{ dir:
|
|
7461
|
-
{ dir:
|
|
7462
|
-
{ dir:
|
|
7463
|
-
{ dir:
|
|
7458
|
+
{ dir: join7(absDir, ".claude", "rules"), agent: "claude", namePrefix: "rules" },
|
|
7459
|
+
{ dir: join7(absDir, ".agents", "rules"), agent: "antigravity", namePrefix: "antigravity-rules" },
|
|
7460
|
+
{ dir: join7(absDir, ".cursor", "rules"), agent: "cursor", namePrefix: "cursor-rules" },
|
|
7461
|
+
{ dir: join7(absDir, ".github", "instructions"), agent: "copilot", namePrefix: "copilot-instructions" },
|
|
7462
|
+
{ dir: join7(absDir, ".devin", "rules"), agent: "devin", namePrefix: "devin-rules" },
|
|
7463
|
+
{ dir: join7(absDir, ".windsurf", "rules"), agent: "windsurf-legacy", namePrefix: "windsurf-rules" },
|
|
7464
|
+
{ dir: join7(absDir, ".clinerules"), agent: "cline", namePrefix: "cline-rules" }
|
|
7464
7465
|
]) {
|
|
7465
7466
|
if (!existsSync5(ruleDir.dir))
|
|
7466
7467
|
continue;
|
|
7467
7468
|
const mdFiles = readdirSync(ruleDir.dir).filter((f) => f.endsWith(".md") || f.endsWith(".mdc"));
|
|
7468
7469
|
for (const f of mdFiles) {
|
|
7469
|
-
const abs =
|
|
7470
|
+
const abs = join7(ruleDir.dir, f);
|
|
7470
7471
|
const raw = readFileSync3(abs, "utf-8");
|
|
7471
7472
|
const redacted = redactContent(raw, "markdown");
|
|
7472
7473
|
const machineAware = templateizeMachineContent(redacted.content, machine);
|
|
@@ -7513,7 +7514,7 @@ async function syncKnown(opts = {}) {
|
|
|
7513
7514
|
const extensions = known.rulesExtensions ?? [".md", ".mdc"];
|
|
7514
7515
|
const ruleFiles = readdirSync(absDir).filter((f) => extensions.some((ext) => f.endsWith(ext)));
|
|
7515
7516
|
for (const f of ruleFiles) {
|
|
7516
|
-
const abs2 =
|
|
7517
|
+
const abs2 = join7(absDir, f);
|
|
7517
7518
|
const targetPath = abs2.replace(home, "~");
|
|
7518
7519
|
if (existingOutputOwners.has(normalizeTargetPath(targetPath)) || isKnownGeneratedTargetPath(targetPath)) {
|
|
7519
7520
|
result.skipped.push(`${targetPath} (generated output)`);
|
|
@@ -7884,8 +7885,8 @@ var init_sync = __esm(() => {
|
|
|
7884
7885
|
|
|
7885
7886
|
// src/lib/sync-dir.ts
|
|
7886
7887
|
import { existsSync as existsSync6, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2 } from "fs";
|
|
7887
|
-
import { join as
|
|
7888
|
-
import { homedir as
|
|
7888
|
+
import { join as join8, relative as relative3 } from "path";
|
|
7889
|
+
import { homedir as homedir4 } from "os";
|
|
7889
7890
|
function shouldSkip(p) {
|
|
7890
7891
|
return SKIP.some((s) => p.includes(s));
|
|
7891
7892
|
}
|
|
@@ -7894,9 +7895,9 @@ async function syncFromDir(dir, opts = {}) {
|
|
|
7894
7895
|
const absDir = expandPath(dir);
|
|
7895
7896
|
if (!existsSync6(absDir))
|
|
7896
7897
|
return { added: 0, updated: 0, unchanged: 0, skipped: [`Not found: ${absDir}`] };
|
|
7897
|
-
const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) =>
|
|
7898
|
+
const files = opts.recursive !== false ? walkDir(absDir) : readdirSync2(absDir).map((f) => join8(absDir, f)).filter((f) => statSync2(f).isFile());
|
|
7898
7899
|
const result = { added: 0, updated: 0, unchanged: 0, skipped: [] };
|
|
7899
|
-
const home =
|
|
7900
|
+
const home = homedir4();
|
|
7900
7901
|
const allConfigs = await store.listConfigs();
|
|
7901
7902
|
for (const file of files) {
|
|
7902
7903
|
if (shouldSkip(file)) {
|
|
@@ -7930,7 +7931,7 @@ async function syncFromDir(dir, opts = {}) {
|
|
|
7930
7931
|
}
|
|
7931
7932
|
async function syncToDir(dir, opts = {}) {
|
|
7932
7933
|
const store = opts.store ?? resolveConfigStore();
|
|
7933
|
-
const home =
|
|
7934
|
+
const home = homedir4();
|
|
7934
7935
|
const absDir = expandPath(dir);
|
|
7935
7936
|
const normalized = dir.startsWith("~/") ? dir : absDir.replace(home, "~");
|
|
7936
7937
|
const configs = (await store.listConfigs()).filter((c) => c.target_path && (c.target_path.startsWith(normalized) || c.target_path.startsWith(absDir)));
|
|
@@ -7954,7 +7955,7 @@ async function syncToDir(dir, opts = {}) {
|
|
|
7954
7955
|
}
|
|
7955
7956
|
function walkDir(dir, files = []) {
|
|
7956
7957
|
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
7957
|
-
const full =
|
|
7958
|
+
const full = join8(dir, entry.name);
|
|
7958
7959
|
if (shouldSkip(full))
|
|
7959
7960
|
continue;
|
|
7960
7961
|
if (entry.isDirectory())
|
|
@@ -7976,7 +7977,7 @@ var init_sync_dir = __esm(() => {
|
|
|
7976
7977
|
var require_package = __commonJS((exports, module) => {
|
|
7977
7978
|
module.exports = {
|
|
7978
7979
|
name: "@hasna/instructions",
|
|
7979
|
-
version: "0.4.
|
|
7980
|
+
version: "0.4.36",
|
|
7980
7981
|
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.",
|
|
7981
7982
|
type: "module",
|
|
7982
7983
|
main: "dist/index.js",
|
|
@@ -8065,7 +8066,6 @@ var require_package = __commonJS((exports, module) => {
|
|
|
8065
8066
|
"@types/bun": "^1.2.4",
|
|
8066
8067
|
"@types/pg": "^8.11.11",
|
|
8067
8068
|
"@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 `/v1` API
|
|
18
|
-
export declare function
|
|
17
|
+
/** True when this process is configured to serve the cloud `/v1` API. */
|
|
18
|
+
export declare function isCloudModeEnabled(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;AAG1G,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAOhG;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAO7F;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEhF;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
|