@hasna/instructions 0.4.0 → 0.4.1
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/index.js +50 -12
- package/dist/db/database.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/mcp/index.js +13 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2195,6 +2195,18 @@ function ensureFeedbackTable(db) {
|
|
|
2195
2195
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
2196
2196
|
)
|
|
2197
2197
|
`);
|
|
2198
|
+
const existing = new Set(db.query("PRAGMA table_info(feedback)").all().map((r) => r.name));
|
|
2199
|
+
const required = [
|
|
2200
|
+
["email", "TEXT"],
|
|
2201
|
+
["category", "TEXT DEFAULT 'general'"],
|
|
2202
|
+
["version", "TEXT"],
|
|
2203
|
+
["machine_id", "TEXT"],
|
|
2204
|
+
["created_at", "TEXT"]
|
|
2205
|
+
];
|
|
2206
|
+
for (const [name, def] of required) {
|
|
2207
|
+
if (!existing.has(name))
|
|
2208
|
+
db.exec(`ALTER TABLE feedback ADD COLUMN ${name} ${def}`);
|
|
2209
|
+
}
|
|
2198
2210
|
}
|
|
2199
2211
|
function insertFeedback(input, db) {
|
|
2200
2212
|
const d = db || getDatabase();
|
|
@@ -5200,7 +5212,7 @@ init_apply();
|
|
|
5200
5212
|
init_sync();
|
|
5201
5213
|
init_redact();
|
|
5202
5214
|
import chalk from "chalk";
|
|
5203
|
-
import { existsSync as existsSync13, readFileSync as readFileSync9 } from "fs";
|
|
5215
|
+
import { existsSync as existsSync13, readFileSync as readFileSync9, writeSync } from "fs";
|
|
5204
5216
|
import { homedir as homedir7 } from "os";
|
|
5205
5217
|
import { basename as basename6, join as join11, resolve as resolve7 } from "path";
|
|
5206
5218
|
|
|
@@ -6913,6 +6925,32 @@ function truncateMiddle(value, max = 80) {
|
|
|
6913
6925
|
// src/cli/index.tsx
|
|
6914
6926
|
import { createRequire } from "module";
|
|
6915
6927
|
var pkg = createRequire(import.meta.url)("../../package.json");
|
|
6928
|
+
var EAGAIN_SLEEP = new Int32Array(new SharedArrayBuffer(4));
|
|
6929
|
+
function writeStdout(text) {
|
|
6930
|
+
const buf = Buffer.from(text, "utf8");
|
|
6931
|
+
let offset = 0;
|
|
6932
|
+
while (offset < buf.length) {
|
|
6933
|
+
try {
|
|
6934
|
+
offset += writeSync(1, buf, offset);
|
|
6935
|
+
} catch (e) {
|
|
6936
|
+
const code = e.code;
|
|
6937
|
+
if (code === "EAGAIN") {
|
|
6938
|
+
Atomics.wait(EAGAIN_SLEEP, 0, 0, 1);
|
|
6939
|
+
continue;
|
|
6940
|
+
}
|
|
6941
|
+
if (code === "EPIPE")
|
|
6942
|
+
return;
|
|
6943
|
+
throw e;
|
|
6944
|
+
}
|
|
6945
|
+
}
|
|
6946
|
+
}
|
|
6947
|
+
function printLine(text = "") {
|
|
6948
|
+
writeStdout(`${text}
|
|
6949
|
+
`);
|
|
6950
|
+
}
|
|
6951
|
+
function printJson(value) {
|
|
6952
|
+
printLine(JSON.stringify(value, null, 2));
|
|
6953
|
+
}
|
|
6916
6954
|
function fmtConfig(c, format) {
|
|
6917
6955
|
if (format === "json")
|
|
6918
6956
|
return JSON.stringify(c, null, 2);
|
|
@@ -7090,7 +7128,7 @@ program.command("list").alias("ls").description("List stored configs").option("-
|
|
|
7090
7128
|
return;
|
|
7091
7129
|
}
|
|
7092
7130
|
if (fmt === "json") {
|
|
7093
|
-
|
|
7131
|
+
printJson(configs);
|
|
7094
7132
|
return;
|
|
7095
7133
|
}
|
|
7096
7134
|
const page = paginate(configs, { limit: opts.limit, cursor: opts.cursor });
|
|
@@ -7108,18 +7146,18 @@ program.command("show <id>").alias("inspect").description("Show a config's conte
|
|
|
7108
7146
|
try {
|
|
7109
7147
|
const c = await resolveConfigStore().getConfig(id);
|
|
7110
7148
|
if (opts.format === "json") {
|
|
7111
|
-
|
|
7149
|
+
printJson(c);
|
|
7112
7150
|
return;
|
|
7113
7151
|
}
|
|
7114
7152
|
if (opts.format === "content") {
|
|
7115
|
-
|
|
7153
|
+
printLine(c.content);
|
|
7116
7154
|
return;
|
|
7117
7155
|
}
|
|
7118
7156
|
console.log(fmtConfig(c, "table"));
|
|
7119
7157
|
console.log();
|
|
7120
7158
|
console.log(chalk.bold("Content:"));
|
|
7121
7159
|
console.log(chalk.dim("\u2500".repeat(60)));
|
|
7122
|
-
|
|
7160
|
+
printLine(c.content);
|
|
7123
7161
|
} catch (e) {
|
|
7124
7162
|
console.error(chalk.red(e instanceof Error ? e.message : String(e)));
|
|
7125
7163
|
process.exit(1);
|
|
@@ -7160,7 +7198,7 @@ program.command("delete <id>").alias("rm").description("Delete a config record (
|
|
|
7160
7198
|
const config = await store.getConfig(id);
|
|
7161
7199
|
await store.deleteConfig(config.id);
|
|
7162
7200
|
if (opts.json) {
|
|
7163
|
-
|
|
7201
|
+
printJson({ deleted: true, id: config.id, slug: config.slug });
|
|
7164
7202
|
return;
|
|
7165
7203
|
}
|
|
7166
7204
|
console.log(chalk.green("\u2713") + ` Deleted: ${chalk.bold(config.name)} ${chalk.dim(`(${config.slug})`)}`);
|
|
@@ -7326,7 +7364,7 @@ profileCmd.command("list").description("List all profiles").option("--brief", "c
|
|
|
7326
7364
|
return;
|
|
7327
7365
|
}
|
|
7328
7366
|
if (fmt === "json") {
|
|
7329
|
-
|
|
7367
|
+
printJson(profiles);
|
|
7330
7368
|
return;
|
|
7331
7369
|
}
|
|
7332
7370
|
const page = paginate(profiles, { limit: opts.limit, cursor: opts.cursor });
|
|
@@ -7481,7 +7519,7 @@ sessionCmd.command("plan").description("Produce a dry-run render plan for profil
|
|
|
7481
7519
|
sources
|
|
7482
7520
|
});
|
|
7483
7521
|
if (opts.json) {
|
|
7484
|
-
|
|
7522
|
+
printJson(planJsonForOutput(plan));
|
|
7485
7523
|
return;
|
|
7486
7524
|
}
|
|
7487
7525
|
console.log(chalk.bold(`${plan.tool} session render plan`) + chalk.dim(` (${plan.adapter.mode})`));
|
|
@@ -7526,7 +7564,7 @@ sessionCmd.command("apply").description("Write a session render plan to its mana
|
|
|
7526
7564
|
});
|
|
7527
7565
|
const result = applySessionRender(plan, { dryRun: opts.dryRun, force: opts.force });
|
|
7528
7566
|
if (opts.json) {
|
|
7529
|
-
|
|
7567
|
+
printJson(result);
|
|
7530
7568
|
if (result.conflicts.length > 0)
|
|
7531
7569
|
process.exitCode = 1;
|
|
7532
7570
|
return;
|
|
@@ -7584,7 +7622,7 @@ snapshotCmd.command("show <id>").description("Show a snapshot's content").action
|
|
|
7584
7622
|
console.error(chalk.red("Snapshot not found: " + id));
|
|
7585
7623
|
process.exit(1);
|
|
7586
7624
|
}
|
|
7587
|
-
|
|
7625
|
+
printLine(snap.content);
|
|
7588
7626
|
});
|
|
7589
7627
|
snapshotCmd.command("restore <config> <snapshot-id>").description("Restore a config to a snapshot version").action(async (configId, snapId) => {
|
|
7590
7628
|
try {
|
|
@@ -7741,7 +7779,7 @@ program.command("package-manager-scan [paths...]").description("Scan package-man
|
|
|
7741
7779
|
const visible = result.findings.slice(0, maxPrinted);
|
|
7742
7780
|
const omitted = Math.max(0, result.findings.length - visible.length);
|
|
7743
7781
|
if (opts.json) {
|
|
7744
|
-
|
|
7782
|
+
printJson(result);
|
|
7745
7783
|
} else if (result.findings.length === 0) {
|
|
7746
7784
|
console.log(chalk.green("\u2713") + ` Package-manager scan clean (${result.scannedFiles} file(s)).`);
|
|
7747
7785
|
} else {
|
|
@@ -7883,7 +7921,7 @@ ${isCloudMode() ? "API" : "DB"}: ${location}`));
|
|
|
7883
7921
|
program.command("status").description("Health check: total configs, drift from disk, unredacted secrets").option("--json", "output metadata-only JSON").action(async (opts) => {
|
|
7884
7922
|
const status = await getConfigsStatus(resolveConfigStore());
|
|
7885
7923
|
if (opts.json) {
|
|
7886
|
-
|
|
7924
|
+
printJson(status);
|
|
7887
7925
|
return;
|
|
7888
7926
|
}
|
|
7889
7927
|
console.log(chalk.bold("@hasna/configs") + chalk.dim(` v${pkg.version}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmBtC,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5C;AAyED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAqBnD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmBtC,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5C;AAyED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAqBnD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC;AAsDD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,IAAI,CAMxE"}
|
package/dist/index.js
CHANGED
|
@@ -225,6 +225,18 @@ function ensureFeedbackTable(db) {
|
|
|
225
225
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
226
226
|
)
|
|
227
227
|
`);
|
|
228
|
+
const existing = new Set(db.query("PRAGMA table_info(feedback)").all().map((r) => r.name));
|
|
229
|
+
const required = [
|
|
230
|
+
["email", "TEXT"],
|
|
231
|
+
["category", "TEXT DEFAULT 'general'"],
|
|
232
|
+
["version", "TEXT"],
|
|
233
|
+
["machine_id", "TEXT"],
|
|
234
|
+
["created_at", "TEXT"]
|
|
235
|
+
];
|
|
236
|
+
for (const [name, def] of required) {
|
|
237
|
+
if (!existing.has(name))
|
|
238
|
+
db.exec(`ALTER TABLE feedback ADD COLUMN ${name} ${def}`);
|
|
239
|
+
}
|
|
228
240
|
}
|
|
229
241
|
function insertFeedback(input, db) {
|
|
230
242
|
const d = db || getDatabase();
|
package/dist/mcp/index.js
CHANGED
|
@@ -132,6 +132,18 @@ function ensureFeedbackTable(db) {
|
|
|
132
132
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
133
133
|
)
|
|
134
134
|
`);
|
|
135
|
+
const existing = new Set(db.query("PRAGMA table_info(feedback)").all().map((r) => r.name));
|
|
136
|
+
const required = [
|
|
137
|
+
["email", "TEXT"],
|
|
138
|
+
["category", "TEXT DEFAULT 'general'"],
|
|
139
|
+
["version", "TEXT"],
|
|
140
|
+
["machine_id", "TEXT"],
|
|
141
|
+
["created_at", "TEXT"]
|
|
142
|
+
];
|
|
143
|
+
for (const [name, def] of required) {
|
|
144
|
+
if (!existing.has(name))
|
|
145
|
+
db.exec(`ALTER TABLE feedback ADD COLUMN ${name} ${def}`);
|
|
146
|
+
}
|
|
135
147
|
}
|
|
136
148
|
function insertFeedback(input, db) {
|
|
137
149
|
const d = db || getDatabase();
|
|
@@ -2050,7 +2062,7 @@ var init_sync_dir = __esm(() => {
|
|
|
2050
2062
|
var require_package = __commonJS((exports, module) => {
|
|
2051
2063
|
module.exports = {
|
|
2052
2064
|
name: "@hasna/instructions",
|
|
2053
|
-
version: "0.4.
|
|
2065
|
+
version: "0.4.1",
|
|
2054
2066
|
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.",
|
|
2055
2067
|
type: "module",
|
|
2056
2068
|
main: "dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/instructions",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "AI coding agent instruction & configuration manager — store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|