@karmaniverous/stan-core 0.4.6 → 0.4.7

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.
@@ -946,6 +946,51 @@ Notes
946
946
  - Reserved denials remain in effect (e.g., do not place content under `/<stanPath>/diff/**`, `/<stanPath>/patch/**`, or archive outputs in `/<stanPath>/output/**`).
947
947
  - The facet‑aware editing guard still applies: do not propose edits under an inactive facet this run; enable the facet first and emit patches next turn.
948
948
 
949
+ # STAN assistant guide — creation & upkeep policy
950
+
951
+ This repository SHOULD include a “STAN assistant guide” document at
952
+ `guides/stan-assistant-guide.md`, unless the project prompt explicitly declares
953
+ a different single, stable path for the guide (in which case, that declared path
954
+ is authoritative).
955
+
956
+ The assistant guide exists to let STAN assistants use and integrate the library
957
+ effectively without consulting external type definition files or other project
958
+ documentation.
959
+
960
+ Policy
961
+
962
+ - Creation (required):
963
+ - If the assistant guide is missing, create it as part of the first change set
964
+ where you would otherwise rely on it (e.g., when adding/altering public APIs,
965
+ adapters, configuration, or key workflows).
966
+ - Prefer creating it in the same turn as the first relevant code changes so it
967
+ cannot drift from reality.
968
+ - Maintenance (required):
969
+ - Treat the guide as a maintained artifact, not a one-off doc.
970
+ - Whenever a change set materially affects how an assistant should use the
971
+ library (public exports, configuration shape/semantics, runtime invariants,
972
+ query contracts, paging tokens, projection behavior, adapter
973
+ responsibilities, or common pitfalls), update the guide in the same change
974
+ set.
975
+ - When deprecating/renaming APIs or changing semantics, update the guide and
976
+ include migration guidance (old → new), but keep it concise.
977
+ - Intent (what the guide must enable):
978
+ - Provide a self-contained description of the “mental model” (runtime behavior
979
+ and invariants) and the minimum working patterns (how to configure, how to
980
+ call core entrypoints, how to integrate a provider/adapter).
981
+ - Include only the information required to use the library correctly; omit
982
+ narrative or historical context.
983
+ - Constraints (how to keep it effective and reusable):
984
+ - Keep it compact: “as short as possible, but as long as necessary.”
985
+ - Make it self-contained: do not require readers to import or open `.d.ts`
986
+ files, TypeDoc pages, or other repo docs to understand core contracts.
987
+ - Avoid duplicating durable requirements or the dev plan:
988
+ - Requirements belong in `stan.requirements.md`.
989
+ - Work tracking belongs in `stan.todo.md`.
990
+ - The assistant guide should focus on usage contracts and integration.
991
+ - Define any acronyms locally on first use within the guide (especially if
992
+ used outside generic type parameters).
993
+
949
994
  # Default Task (when files are provided with no extra prompt)
950
995
 
951
996
  Primary objective — Plan-first
@@ -48,7 +48,7 @@ type CreateArchiveOptions = {
48
48
  * });
49
49
  * ```
50
50
  */
51
- declare const createArchive: (cwd: string, stanPath: string, options?: CreateArchiveOptions) => Promise<string>;
51
+ declare function createArchive(cwd: string, stanPath: string, options?: CreateArchiveOptions): Promise<string>;
52
52
 
53
53
  /** Public default STAN path for consumers and internal use. */
54
54
  declare const DEFAULT_STAN_PATH = ".stan";
@@ -137,13 +137,13 @@ type SnapshotUpdateMode = 'never' | 'createIfMissing' | 'replace';
137
137
  * ```
138
138
  * @returns Absolute path to the `.archive.snapshot.json` file.
139
139
  */
140
- declare const writeArchiveSnapshot: ({ cwd, stanPath, includes, excludes, anchors, }: {
140
+ declare function writeArchiveSnapshot({ cwd, stanPath, includes, excludes, anchors, }: {
141
141
  cwd: string;
142
142
  stanPath: string;
143
143
  includes?: string[];
144
144
  excludes?: string[];
145
145
  anchors?: string[];
146
- }) => Promise<string>;
146
+ }): Promise<string>;
147
147
  /**
148
148
  * Create a diff tar at <stanPath>/output/<baseName>.diff.tar.
149
149
  * - If snapshot exists: include only changed files.
@@ -177,7 +177,7 @@ declare const writeArchiveSnapshot: ({ cwd, stanPath, includes, excludes, anchor
177
177
  * });
178
178
  * ```
179
179
  */
180
- declare const createArchiveDiff: ({ cwd, stanPath, baseName, includes, excludes, updateSnapshot, includeOutputDirInDiff, anchors, onArchiveWarnings, }: {
180
+ declare function createArchiveDiff({ cwd, stanPath, baseName, includes, excludes, updateSnapshot, includeOutputDirInDiff, anchors, onArchiveWarnings, }: {
181
181
  cwd: string;
182
182
  stanPath: string;
183
183
  baseName: string;
@@ -187,7 +187,7 @@ declare const createArchiveDiff: ({ cwd, stanPath, baseName, includes, excludes,
187
187
  includeOutputDirInDiff?: boolean;
188
188
  anchors?: string[];
189
189
  onArchiveWarnings?: (text: string) => void;
190
- }) => Promise<{
190
+ }): Promise<{
191
191
  diffPath: string;
192
192
  }>;
193
193
 
package/package.json CHANGED
@@ -130,7 +130,7 @@
130
130
  ]
131
131
  },
132
132
  "npm": {
133
- "publish": true
133
+ "publish": false
134
134
  }
135
135
  },
136
136
  "repository": {
@@ -152,5 +152,5 @@
152
152
  },
153
153
  "type": "module",
154
154
  "types": "dist/index.d.ts",
155
- "version": "0.4.6"
155
+ "version": "0.4.7"
156
156
  }
@@ -1 +0,0 @@
1
- "use strict";var t=require("node:fs/promises"),e=require("node:path");const n=1048576;exports.classifyForArchive=async(r,s)=>{const i=[],a=[],o=[];await Promise.all(s.map(async s=>{const c=s.replace(/\\/g,"/");const l=e.resolve(r,s);let h=0;try{h=(await t.stat(l)).size}catch{return}let u,p=!1;try{p=await(async e=>{try{const n=await t.open(e,"r");try{const t=Buffer.allocUnsafe(8192),{bytesRead:e}=await n.read(t,0,t.length,0);for(let n=0;n<e;n+=1)if(0===t[n])return!0;return!1}finally{await n.close().catch(()=>{})}}catch{return!1}})(l)}catch{p=!1}if(p)return void a.push({path:c,size:h});i.push(c);try{if(h<=n||h<5*n){u=(t=>{const e=t.replace(/\r\n/g,"\n");return 0===e.length?0:e.split("\n").length})(await t.readFile(l,"utf8"))}}catch{}(h>n||"number"==typeof u&&u>3e3)&&o.push({path:c,size:h,loc:u})}));const c=[];if(a.length>0){c.push(`Binary files excluded from archive (${a.length.toString()}):`);for(const t of a)c.push(` - ${t.path} (${t.size.toString()} bytes)`);c.push("")}if(o.length>0){c.push(`Large text files (included; consider excludes if unwanted) (${o.length.toString()}):`);for(const t of o){const e=[` - ${t.path}`,`(${t.size.toString()} bytes)`];"number"==typeof t.loc&&e.push(`${t.loc.toString()} LOC`),c.push(e.join(" "))}c.push(""),c.push(`Thresholds: size > ${n.toString()} bytes or LOC > ${3e3.toString()}`)}0===c.length&&c.push("No archive warnings.");const l=c.join("\n")+(c.length?"\n":"");return{textFiles:i,excludedBinaries:a,largeText:o,warningsBody:l}};
@@ -1 +0,0 @@
1
- import{stat as t,readFile as e,open as n}from"node:fs/promises";import{resolve as r}from"node:path";const s=1048576,o=async(o,i)=>{const a=[],c=[],h=[];await Promise.all(i.map(async i=>{const l=i.replace(/\\/g,"/");const u=r(o,i);let p=0;try{p=(await t(u)).size}catch{return}let f,g=!1;try{g=await(async t=>{try{const e=await n(t,"r");try{const t=Buffer.allocUnsafe(8192),{bytesRead:n}=await e.read(t,0,t.length,0);for(let e=0;e<n;e+=1)if(0===t[e])return!0;return!1}finally{await e.close().catch(()=>{})}}catch{return!1}})(u)}catch{g=!1}if(g)return void c.push({path:l,size:p});a.push(l);try{if(p<=s||p<5*s){f=(t=>{const e=t.replace(/\r\n/g,"\n");return 0===e.length?0:e.split("\n").length})(await e(u,"utf8"))}}catch{}(p>s||"number"==typeof f&&f>3e3)&&h.push({path:l,size:p,loc:f})}));const l=[];if(c.length>0){l.push(`Binary files excluded from archive (${c.length.toString()}):`);for(const t of c)l.push(` - ${t.path} (${t.size.toString()} bytes)`);l.push("")}if(h.length>0){l.push(`Large text files (included; consider excludes if unwanted) (${h.length.toString()}):`);for(const t of h){const e=[` - ${t.path}`,`(${t.size.toString()} bytes)`];"number"==typeof t.loc&&e.push(`${t.loc.toString()} LOC`),l.push(e.join(" "))}l.push(""),l.push(`Thresholds: size > ${s.toString()} bytes or LOC > ${3e3.toString()}`)}0===l.length&&l.push("No archive warnings.");const u=l.join("\n")+(l.length?"\n":"");return{textFiles:a,excludedBinaries:c,largeText:h,warningsBody:u}};export{o as classifyForArchive};