@hasna/instructions 0.4.13 → 0.4.14

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=create-config-target-guard.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-config-target-guard.test.d.ts","sourceRoot":"","sources":["../../src/mcp/create-config-target-guard.test.ts"],"names":[],"mappings":""}
package/dist/mcp/index.js CHANGED
@@ -6858,7 +6858,7 @@ var init_sync_dir = __esm(() => {
6858
6858
  var require_package = __commonJS((exports, module) => {
6859
6859
  module.exports = {
6860
6860
  name: "@hasna/instructions",
6861
- version: "0.4.13",
6861
+ version: "0.4.14",
6862
6862
  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.",
6863
6863
  type: "module",
6864
6864
  main: "dist/index.js",
@@ -6958,11 +6958,26 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
6958
6958
  // src/mcp/server.ts
6959
6959
  init_config_store();
6960
6960
  init_apply();
6961
- init_sync_dir();
6962
- init_machine();
6963
6961
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6964
6962
  import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
6965
6963
 
6964
+ // src/lib/config-target-identity.ts
6965
+ init_apply();
6966
+ function findConfigsByTargetPath(configs, targetPath) {
6967
+ const wanted = normalizeTargetPath(targetPath);
6968
+ return configs.filter((config) => {
6969
+ if (config.kind === "reference")
6970
+ return false;
6971
+ if (!config.target_path)
6972
+ return false;
6973
+ return normalizeTargetPath(config.target_path) === wanted;
6974
+ });
6975
+ }
6976
+
6977
+ // src/mcp/server.ts
6978
+ init_sync_dir();
6979
+ init_machine();
6980
+
6966
6981
  // src/lib/compact-output.ts
6967
6982
  var DEFAULT_LIST_LIMIT = 20;
6968
6983
  var MAX_LIST_LIMIT = 100;
@@ -7064,7 +7079,7 @@ function summarizeApplyResult(result) {
7064
7079
  var TOOL_DOCS = {
7065
7080
  list_configs: "List configs. Params: category?, agent?, kind?, search?, limit?, cursor?, verbose?. Defaults to a paged compact envelope without content; use get_config for full content.",
7066
7081
  get_config: "Get a config by id or slug. Returns full config including content.",
7067
- create_config: "Create a new config. Required: name, content, category. Optional: agent, target_path, outputs, kind, format, tags, description, is_template.",
7082
+ create_config: "Create a new config. Required: name, content, category. Optional: agent, target_path, outputs, kind, format, tags, description, is_template. Refuses when target_path is already tracked by another config (one target path, one row) \u2014 use update_config on the owning row, or delete_config first. kind:'reference' owns no target path and is exempt.",
7068
7083
  update_config: "Update a config by id or slug. Optional: content, name, tags, description, category, agent, target_path, outputs.",
7069
7084
  apply_config: "Apply a config through the shared ownership gate. Params: id_or_slug, dry_run?, verbose?. Returns results plus session-renderer-owned targets that were skipped.",
7070
7085
  sync_directory: "Sync a directory with the DB. Params: dir, direction ('from_disk'|'to_disk'). Returns sync result.",
@@ -7145,14 +7160,24 @@ function buildServer() {
7145
7160
  return ok(c);
7146
7161
  }
7147
7162
  case "create_config": {
7163
+ const kind = args["kind"] || undefined;
7164
+ const targetPath = args["target_path"] || undefined;
7165
+ if (targetPath && kind !== "reference") {
7166
+ const owners = findConfigsByTargetPath(await store.listConfigs(), targetPath);
7167
+ if (owners.length > 0) {
7168
+ const named = owners.map((owner) => `${owner.slug} (${owner.id})`).join(", ");
7169
+ const collision = owners.length > 1 ? ` ${owners.length} rows already collide on this path \u2014 apply order between them is undefined.` : "";
7170
+ return err(`${targetPath} is already tracked by: ${named}.${collision}` + ` Use update_config on that row to refresh it in place, or delete_config first.`);
7171
+ }
7172
+ }
7148
7173
  const c = await store.createConfig({
7149
7174
  name: args["name"],
7150
7175
  content: args["content"],
7151
7176
  category: args["category"],
7152
7177
  agent: args["agent"] || undefined,
7153
- target_path: args["target_path"] || undefined,
7178
+ target_path: targetPath,
7154
7179
  outputs: args["outputs"],
7155
- kind: args["kind"] || undefined,
7180
+ kind,
7156
7181
  format: args["format"] || undefined,
7157
7182
  tags: args["tags"] || undefined,
7158
7183
  description: args["description"] || undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA2EnE,wBAAgB,WAAW,IAAI,MAAM,CA0RpC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA4EnE,wBAAgB,WAAW,IAAI,MAAM,CAyTpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "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.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",