truecourse 0.6.0-next.8 → 0.6.0-next.9

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 CHANGED
@@ -256,7 +256,8 @@ truecourse spec docs uninclude <path>
256
256
 
257
257
  # Contract extraction (canonical spec → .tc artifacts)
258
258
  truecourse contracts generate # Extract / re-extract TC contract files
259
- truecourse contracts list # List generated contracts
259
+ truecourse contracts list # List artifacts (kind · identity · location)
260
+ truecourse contracts list --inferred / --authored # Only reverse-engineered (_inferred/) / only authored
260
261
  truecourse contracts validate # Parse + resolve TC files; report unresolved refs
261
262
 
262
263
  # Verification (code against contracts)
@@ -270,6 +271,7 @@ truecourse drifts list --offset 20 / --severity critical,high # Page through /
270
271
  # Inference (code → inferred contracts) — reverse-engineer undocumented decisions
271
272
  truecourse infer # Write inferred .tc files to contracts/_inferred/
272
273
  truecourse infer --dry-run # Report what would be written, touch nothing
274
+ truecourse contracts list --inferred # Review what infer produced (kind · confidence · code location)
273
275
  ```
274
276
 
275
277
  ---
package/cli.mjs CHANGED
@@ -128244,7 +128244,7 @@ function readToolVersion() {
128244
128244
  if (cachedVersion)
128245
128245
  return cachedVersion;
128246
128246
  if (true) {
128247
- cachedVersion = "0.6.0-next.8";
128247
+ cachedVersion = "0.6.0-next.9";
128248
128248
  return cachedVersion;
128249
128249
  }
128250
128250
  try {
@@ -149230,23 +149230,51 @@ async function runContractsList(options = {}) {
149230
149230
  O2.info("No contracts found. Run `truecourse contracts generate` first.");
149231
149231
  return;
149232
149232
  }
149233
- const files = [];
149233
+ const { parser: parser4, resolver } = await Promise.resolve().then(() => (init_dist8(), dist_exports3));
149234
+ const fileNodes = [];
149235
+ let parseErrors = 0;
149234
149236
  const visit = (dir) => {
149235
149237
  for (const entry of fs47.readdirSync(dir, { withFileTypes: true })) {
149236
149238
  const full = path54.join(dir, entry.name);
149237
149239
  if (entry.isDirectory()) visit(full);
149238
- else if (entry.isFile() && entry.name.endsWith(".tc")) files.push(full);
149240
+ else if (entry.isFile() && entry.name.endsWith(".tc")) {
149241
+ try {
149242
+ fileNodes.push(parser4.parseFile(full, fs47.readFileSync(full, "utf-8")));
149243
+ } catch {
149244
+ parseErrors += 1;
149245
+ }
149246
+ }
149239
149247
  }
149240
149248
  };
149241
149249
  visit(contractsDir);
149242
- files.sort();
149243
- if (files.length === 0) {
149244
- O2.info("No .tc files in .truecourse/contracts/.");
149250
+ const filter2 = options.inferred && !options.authored ? "inferred" : options.authored && !options.inferred ? "authored" : null;
149251
+ const resolution = resolver.resolve(fileNodes);
149252
+ const artifacts = [...resolution.index.values()].filter((a) => filter2 ? a.provenance === filter2 : true).sort(
149253
+ (a, b) => a.ref.type === b.ref.type ? a.ref.identity.localeCompare(b.ref.identity) : a.ref.type.localeCompare(b.ref.type)
149254
+ );
149255
+ if (artifacts.length === 0) {
149256
+ if (filter2 === "inferred") {
149257
+ O2.info("No inferred contracts. Run `truecourse infer` to reverse-engineer undocumented decisions.");
149258
+ } else if (filter2 === "authored") {
149259
+ O2.info("No authored contracts. Run `truecourse contracts generate` first.");
149260
+ } else {
149261
+ O2.info("No .tc files in .truecourse/contracts/.");
149262
+ }
149245
149263
  return;
149246
149264
  }
149247
- mt(`Contracts (${files.length})`);
149248
- for (const f2 of files) console.log(` ${path54.relative(repoRoot6, f2)}`);
149249
- gt("`truecourse contracts validate` then `truecourse verify`.");
149265
+ const scope = filter2 ? `${filter2} ` : "";
149266
+ mt(`Contracts \u2014 ${artifacts.length} ${scope}artifact${artifacts.length === 1 ? "" : "s"}`);
149267
+ for (const a of artifacts) {
149268
+ const conf = a.confidence ? `[${a.confidence}] ` : "";
149269
+ const loc = a.origin ? a.origin.lines[0] >= 0 ? `${a.origin.source}:${a.origin.lines[0]}` : a.origin.source : `${path54.relative(repoRoot6, a.declarationLoc.filePath)}:${a.declarationLoc.lineStart}`;
149270
+ console.log(` ${conf}${a.ref.type}:${a.ref.identity} ${loc}`);
149271
+ }
149272
+ if (parseErrors > 0) {
149273
+ O2.warn(`${parseErrors} file${parseErrors === 1 ? "" : "s"} could not be parsed \u2014 run \`truecourse contracts validate\`.`);
149274
+ }
149275
+ gt(
149276
+ filter2 ? "`truecourse verify`." : "Filter with `--inferred` / `--authored`. `truecourse contracts validate` then `truecourse verify`."
149277
+ );
149250
149278
  }
149251
149279
  async function runContractsValidate(options = {}) {
149252
149280
  const repoRoot6 = options.cwd ?? process.cwd();
@@ -149568,7 +149596,7 @@ async function runInfer(opts = {}) {
149568
149596
  }
149569
149597
  const wrote = opts.dryRun ? proposed.length : written.length;
149570
149598
  gt(
149571
- infer2.decisions.length === 0 ? "No undocumented decisions found." : opts.dryRun ? `${wrote} inferred contract${wrote === 1 ? "" : "s"} would be written to _inferred/ (dry run).` : `${wrote} inferred contract${wrote === 1 ? "" : "s"} written to _inferred/.`
149599
+ infer2.decisions.length === 0 ? "No undocumented decisions found." : opts.dryRun ? `${wrote} inferred contract${wrote === 1 ? "" : "s"} would be written to _inferred/ (dry run).` : `${wrote} inferred contract${wrote === 1 ? "" : "s"} written to _inferred/ \u2014 review with \`truecourse contracts list --inferred\`.`
149572
149600
  );
149573
149601
  } catch (e) {
149574
149602
  renderer.dispose();
@@ -152907,7 +152935,7 @@ async function runHooksRun() {
152907
152935
 
152908
152936
  // tools/cli/src/index.ts
152909
152937
  var program2 = new Command();
152910
- program2.name("truecourse").version("0.6.0-next.8").description("TrueCourse CLI \u2014 analyze your repository and open the dashboard");
152938
+ program2.name("truecourse").version("0.6.0-next.9").description("TrueCourse CLI \u2014 analyze your repository and open the dashboard");
152911
152939
  var dashboardCmd = program2.command("dashboard").description("Start the TrueCourse dashboard and open it in your browser").option("--reconfigure", "Re-prompt for console vs background service mode").option("--service", "Run as a background service (skips mode prompt)").option("--console", "Run in this terminal (skips mode prompt)").action(async (options) => {
152912
152940
  if (options.service && options.console) {
152913
152941
  console.error("error: --service and --console are mutually exclusive");
@@ -152964,8 +152992,8 @@ var contractsCmd = program2.command("contracts").description("Manage spec-driven
152964
152992
  contractsCmd.command("generate").description("Extract .tc artifacts from prose specs (LLM, cached)").option("--diff", "Dry run \u2014 show what would change without writing").action(async (options) => {
152965
152993
  await runContractsGenerate({ diff: !!options.diff });
152966
152994
  });
152967
- contractsCmd.command("list").description("List the .tc artifacts in this repo").action(async () => {
152968
- await runContractsList();
152995
+ contractsCmd.command("list").description("List the .tc artifacts in this repo (kind \xB7 identity \xB7 location)").option("--inferred", "Only inferred artifacts (reverse-engineered, in _inferred/)").option("--authored", "Only authored artifacts (exclude _inferred/)").action(async (options) => {
152996
+ await runContractsList({ inferred: !!options.inferred, authored: !!options.authored });
152969
152997
  });
152970
152998
  contractsCmd.command("validate").description("Parse and resolve all .tc files, report any issues").action(async () => {
152971
152999
  await runContractsValidate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truecourse",
3
- "version": "0.6.0-next.8",
3
+ "version": "0.6.0-next.9",
4
4
  "description": "Visualize your codebase architecture as an interactive graph",
5
5
  "type": "module",
6
6
  "bin": {
package/server.mjs CHANGED
@@ -156921,7 +156921,7 @@ function readToolVersion() {
156921
156921
  if (cachedVersion)
156922
156922
  return cachedVersion;
156923
156923
  if (true) {
156924
- cachedVersion = "0.6.0-next.8";
156924
+ cachedVersion = "0.6.0-next.9";
156925
156925
  return cachedVersion;
156926
156926
  }
156927
156927
  try {