@cortexkit/aft 0.26.4 → 0.27.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.
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAIA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+C9D"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAKA,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+D9D"}
package/dist/index.js CHANGED
@@ -7869,7 +7869,38 @@ function writeJsoncFile(path, value, format = "json") {
7869
7869
  writeFileSync(path, `${serialized}
7870
7870
  `);
7871
7871
  }
7872
- var import_comment_json;
7872
+ function ensureAftSchemaUrl(path, format) {
7873
+ const existed = existsSync2(path);
7874
+ if (!existed) {
7875
+ const writeFormat = format === "jsonc" ? "jsonc" : "json";
7876
+ writeJsoncFile(path, { $schema: AFT_SCHEMA_URL }, writeFormat);
7877
+ return {
7878
+ action: "added",
7879
+ message: `created ${path} with $schema URL for editor autocomplete`
7880
+ };
7881
+ }
7882
+ const { value, error } = readJsoncFile(path);
7883
+ if (!value) {
7884
+ throw new Error(error ? `failed to parse ${path}: ${error}` : `failed to parse ${path}`);
7885
+ }
7886
+ const previous = value.$schema;
7887
+ if (previous === AFT_SCHEMA_URL) {
7888
+ return { action: "unchanged", message: `$schema already present in ${path}` };
7889
+ }
7890
+ value.$schema = AFT_SCHEMA_URL;
7891
+ writeJsoncFile(path, value, format === "none" ? "json" : format);
7892
+ if (previous === undefined) {
7893
+ return {
7894
+ action: "added",
7895
+ message: `added $schema URL to ${path} for editor autocomplete`
7896
+ };
7897
+ }
7898
+ return {
7899
+ action: "updated",
7900
+ message: `updated $schema URL in ${path}`
7901
+ };
7902
+ }
7903
+ var import_comment_json, AFT_SCHEMA_URL = "https://raw.githubusercontent.com/cortexkit/aft/master/assets/aft.schema.json";
7873
7904
  var init_jsonc = __esm(() => {
7874
7905
  import_comment_json = __toESM(require_src2(), 1);
7875
7906
  });
@@ -9897,6 +9928,15 @@ async function runSetup(argv) {
9897
9928
  default:
9898
9929
  O2.info(`${adapter.displayName}: ${result.message}`);
9899
9930
  }
9931
+ try {
9932
+ const { aftConfig, aftConfigFormat } = adapter.detectConfigPaths();
9933
+ const schemaResult = ensureAftSchemaUrl(aftConfig, aftConfigFormat);
9934
+ if (schemaResult.action === "added" || schemaResult.action === "updated") {
9935
+ O2.success(`${adapter.displayName}: ${schemaResult.message}`);
9936
+ }
9937
+ } catch (error) {
9938
+ O2.warn(`${adapter.displayName}: could not set $schema on aft.jsonc: ${error instanceof Error ? error.message : String(error)}`);
9939
+ }
9900
9940
  printNextSteps(adapter);
9901
9941
  }
9902
9942
  if (anyFailure) {
@@ -9925,6 +9965,7 @@ function printNextSteps(adapter) {
9925
9965
  }
9926
9966
  var init_setup = __esm(() => {
9927
9967
  init_harness_select();
9968
+ init_jsonc();
9928
9969
  init_prompts();
9929
9970
  });
9930
9971
 
@@ -16,4 +16,23 @@ export declare function readJsoncFile(path: string): {
16
16
  * `comment-json`'s `parse`, embedded comments are retained via `stringifyJsonc`.
17
17
  */
18
18
  export declare function writeJsoncFile(path: string, value: Record<string, unknown>, format?: JsoncFormat): void;
19
+ /** Canonical URL of the published AFT config schema. */
20
+ export declare const AFT_SCHEMA_URL = "https://raw.githubusercontent.com/cortexkit/aft/master/assets/aft.schema.json";
21
+ export type AftSchemaAction = "added" | "updated" | "unchanged";
22
+ /**
23
+ * Ensure `aft.jsonc` (or `aft.json`) contains a top-level `$schema` field
24
+ * pointing at the published AFT JSON Schema. Editor tooling (VS Code, Cursor,
25
+ * etc.) uses this for autocomplete and validation.
26
+ *
27
+ * Creates the file with `{"$schema": "..."}` if missing. Preserves existing
28
+ * comments and field ordering when the file exists.
29
+ *
30
+ * `format` follows the harness adapter contract: `"none"` means no file
31
+ * existed before — written as `.json` by default so editors that don't grok
32
+ * JSONC still parse it. Pass `"jsonc"` to keep existing JSONC files as JSONC.
33
+ */
34
+ export declare function ensureAftSchemaUrl(path: string, format: JsoncFormat): {
35
+ action: AftSchemaAction;
36
+ message: string;
37
+ };
19
38
  //# sourceMappingURL=jsonc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/lib/jsonc.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAW9E;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAcA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,GAAE,WAAoB,GAC3B,IAAI,CAKN"}
1
+ {"version":3,"file":"jsonc.d.ts","sourceRoot":"","sources":["../../src/lib/jsonc.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAW9E;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAcA;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,GAAE,WAAoB,GAC3B,IAAI,CAKN;AAED,wDAAwD;AACxD,eAAO,MAAM,cAAc,kFACsD,CAAC;AAElF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAClB;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAoC9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.26.4",
3
+ "version": "0.27.1",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",