@garygentry/system1 0.3.1 → 0.4.0

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.
@@ -6,38 +6,10 @@ import {
6
6
  VERSION,
7
7
  emit,
8
8
  extractFormat
9
- } from "./chunk-JD7HVXW5.mjs";
9
+ } from "./chunk-WZIVOY5Q.mjs";
10
10
 
11
11
  // src/bin.ts
12
- import { readFileSync as readFileSync2 } from "node:fs";
13
-
14
- // src/bundled.ts
15
- import { existsSync, readFileSync } from "node:fs";
16
- import { dirname, join } from "node:path";
17
- import { fileURLToPath } from "node:url";
18
- var PACKAGE = "@garygentry/system1";
19
- function bundledSpecsDir(from = fileURLToPath(import.meta.url)) {
20
- const root = packageRoot(dirname(from));
21
- if (!root) return void 0;
22
- const own = join(root, "specs");
23
- if (existsSync(own)) return own;
24
- const checkout = join(root, "..", "..");
25
- const plugin = join(checkout, "plugins", "system1", "specs");
26
- return existsSync(join(checkout, "catalog.yaml")) && existsSync(plugin) ? plugin : void 0;
27
- }
28
- function packageRoot(start) {
29
- for (let dir = start; ; dir = dirname(dir)) {
30
- const manifest = join(dir, "package.json");
31
- if (existsSync(manifest)) {
32
- try {
33
- if (JSON.parse(readFileSync(manifest, "utf8")).name === PACKAGE)
34
- return dir;
35
- } catch {
36
- }
37
- }
38
- if (dirname(dir) === dir) return void 0;
39
- }
40
- }
12
+ import { readFileSync } from "node:fs";
41
13
 
42
14
  // src/main.ts
43
15
  var HELP = `decide ${VERSION} \u2014 typed, calibrated decisions for coding agents
@@ -49,8 +21,9 @@ Commands:
49
21
  many One question set over many items (fan-out), filtered to what matters
50
22
  usage Measured spend from the ledger (--session, --since)
51
23
  config Show resolved config; \`config egress allow|deny|status\` for consent
52
- spec list | show <name> | validate [name|path] | check <name> [--live]
53
- schema Print the JSON Schema of a tool's input (ask, many, usage, spec-check, route)
24
+ spec list | show <name> | validate [name|path] | lint [name|path] | check <name> [--live]
25
+ opportunities add --file <json> | list [--keep \u2026] | check: the scout backlog (local)
26
+ schema Print the JSON Schema of a tool's input (\`decide schema\` lists them)
54
27
  route Does a prompt call for the ask skill? (--text|--stdin|--hook; local, sends nothing)
55
28
  ping Check the endpoint is reachable (no key, no spend)
56
29
  doctor Check decide works from this shell; prints the fix for each problem
@@ -63,14 +36,15 @@ Questions: --spec <name|path> | --question name:noul:<text>
63
36
  --input <file|-> (full tool input as JSON; flags override it)
64
37
  Sources: --glob <pattern>\u2026 --file <path[:L1-L2]>\u2026 --jsonl <path>
65
38
  --diff <range> [--staged] --text <text> --stdin
39
+ --exclude <glob>\u2026 (leave matching paths out; reported as filtered)
66
40
  Split: --split file|hunk|row|join|lines:N[/overlap] (default: file; join = one state)
67
- Project: --keep 'relevant>=0.7'\u2026 --sort relevant:desc --limit N --fields a,b
41
+ Project: --keep 'relevant>=0.7'\u2026 (all) --keep-any 'a>=0.3'\u2026 (any) --sort relevant:desc --limit N --fields a,b
68
42
  --allow-outside (read files that resolve outside the repo)
69
43
  Run: --dry-run --confirm --record | --replay | --live --model <id> --concurrency N
70
44
 
71
45
  Output is one JSON envelope by default: {v, ok, command, result | error}.
72
46
  Exit codes: 0 ok \xB7 1 failure \xB7 2 usage \xB7 3 egress refused \xB7 4 budget guard
73
- 5 provider error \xB7 6 replay miss
47
+ 5 provider error \xB7 6 replay miss \xB7 7 check or lint did not pass
74
48
  `;
75
49
  var DEFAULT_FORMAT = "json";
76
50
  async function main(argv, io) {
@@ -92,23 +66,25 @@ async function main(argv, io) {
92
66
  }
93
67
  switch (command) {
94
68
  case "ask":
95
- return (await import("./decide-4QGC5ZEB.mjs")).runAskCommand(rest, io, format);
69
+ return (await import("./decide-HI5CUH3C.mjs")).runAskCommand(rest, io, format);
96
70
  case "many":
97
- return (await import("./decide-4QGC5ZEB.mjs")).runManyCommand(rest, io, format);
71
+ return (await import("./decide-HI5CUH3C.mjs")).runManyCommand(rest, io, format);
98
72
  case "usage":
99
- return (await import("./misc-U5ZFC6EC.mjs")).runUsageCommand(rest, io, format);
73
+ return (await import("./misc-6SDKH2PI.mjs")).runUsageCommand(rest, io, format);
100
74
  case "config":
101
- return (await import("./config-QMTA6YOP.mjs")).runConfigCommand(rest, io, format);
75
+ return (await import("./config-KXGUNAJR.mjs")).runConfigCommand(rest, io, format);
102
76
  case "spec":
103
- return (await import("./spec-Y52UMFEH.mjs")).runSpecCommand(rest, io, format);
77
+ return (await import("./spec-GLTPEEON.mjs")).runSpecCommand(rest, io, format);
78
+ case "opportunities":
79
+ return (await import("./opportunities-ONEIYAG3.mjs")).runOpportunitiesCommand(rest, io, format);
104
80
  case "schema":
105
- return (await import("./misc-U5ZFC6EC.mjs")).runSchemaCommand(rest, io, format);
81
+ return (await import("./misc-6SDKH2PI.mjs")).runSchemaCommand(rest, io, format);
106
82
  case "route":
107
- return (await import("./route-L3LIB4DZ.mjs")).runRouteCommand(rest, io, format);
83
+ return (await import("./route-BF5J2NLU.mjs")).runRouteCommand(rest, io, format);
108
84
  case "ping":
109
- return (await import("./misc-U5ZFC6EC.mjs")).runPingCommand(io, format);
85
+ return (await import("./misc-6SDKH2PI.mjs")).runPingCommand(io, format);
110
86
  case "doctor":
111
- return (await import("./doctor-JJIUAYN7.mjs")).runDoctorCommand(io, format);
87
+ return (await import("./doctor-NDV3Y6T7.mjs")).runDoctorCommand(io, format);
112
88
  case "version":
113
89
  case "--version":
114
90
  case "-v":
@@ -138,7 +114,6 @@ process.exitCode = await main(process.argv.slice(2), {
138
114
  err: line(process.stderr),
139
115
  env: process.env,
140
116
  cwd: process.cwd(),
141
- readStdin: () => readFileSync2(0, "utf8"),
142
- interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
143
- ...bundledSpecsDir() ? { bundledSpecs: bundledSpecsDir() } : {}
117
+ readStdin: () => readFileSync(0, "utf8"),
118
+ interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
144
119
  });
@@ -87,20 +87,48 @@ function briefSpecCheck(r) {
87
87
  }
88
88
  }
89
89
  lines.push(...withheld(r.skipped, { total: 0, items: 0 }));
90
+ if (r.lint.length) {
91
+ lines.push(
92
+ `lint: ${r.lint.length} finding(s), not part of PASSED/FAILED (decide spec lint ${r.spec})`
93
+ );
94
+ lines.push(...r.lint.map(briefFinding));
95
+ }
90
96
  return lines.join("\n");
91
97
  }
98
+ function briefSpecLint(r) {
99
+ const c = r.counts;
100
+ const lines = [
101
+ `decide spec lint: ${r.passed ? "PASSED" : "FAILED"} \xB7 ${c.specs} spec(s) \xB7 ${c.errors} error(s) \xB7 ${c.warnings} warning(s)${c.invalid ? ` \xB7 ${c.invalid} invalid` : ""}`
102
+ ];
103
+ for (const s of r.specs) {
104
+ if (s.invalid) lines.push(` INVALID ${s.name} ${s.invalid.split("\n")[0]}`);
105
+ else if (s.findings.length === 0) lines.push(` ok ${s.name}`);
106
+ else {
107
+ lines.push(` ${s.name} (${s.file})`);
108
+ lines.push(...s.findings.map(briefFinding));
109
+ }
110
+ }
111
+ return lines.join("\n");
112
+ }
113
+ function briefFinding(f) {
114
+ return ` ${f.severity} ${f.check}: ${f.message}
115
+ fix: ${f.fix}`;
116
+ }
92
117
  function distribution(probabilities) {
93
118
  return Object.entries(probabilities).sort((a, b) => b[1] - a[1]).map(([k, p]) => `${k} ${fix(p)}`).join(" \xB7 ");
94
119
  }
95
120
  function withheld(skipped, redactions) {
96
121
  const lines = [];
97
- if (skipped.total > 0) {
98
- const reasons = Object.entries(skipped.byReason).map(([k, v]) => `${k} ${v}`).join(", ");
122
+ const filtered = skipped.byReason.filtered ?? 0;
123
+ const held = skipped.total - filtered;
124
+ if (held > 0) {
125
+ const reasons = Object.entries(skipped.byReason).filter(([k]) => k !== "filtered").map(([k, v]) => `${k} ${v}`).join(", ");
99
126
  const excluded = skipped.sample.filter((s) => s.reason === "excluded").map((s) => s.path);
100
127
  lines.push(
101
- `withheld: ${skipped.total} (${reasons})${excluded.length ? ` e.g. ${excluded.join(", ")}` : ""}`
128
+ `withheld: ${held} (${reasons})${excluded.length ? ` e.g. ${excluded.join(", ")}` : ""}`
102
129
  );
103
130
  }
131
+ if (filtered > 0) lines.push(`left out by --exclude: ${filtered}`);
104
132
  if (redactions.total > 0)
105
133
  lines.push(
106
134
  `redacted: ${redactions.total} secret(s) in ${redactions.items} item(s) before sending`
@@ -126,5 +154,6 @@ function firstLine(text) {
126
154
  export {
127
155
  briefMany,
128
156
  briefAsk,
129
- briefSpecCheck
157
+ briefSpecCheck,
158
+ briefSpecLint
130
159
  };