@cmflow/source-pack 3.20.0 → 3.22.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
 
14
14
  `source-pack` builds, at each production release of a project hosted on GitHub or GitLab, a **versioned index of its code**
15
- (chunks + embeddings + optional attachments + manifest) and publishes it on the release of the tag. The Dataviz loads it with
15
+ (chunks + embeddings + manifest) and publishes it on the release of the tag. The Dataviz loads it with
16
16
  `readSourcePack()` to answer `source_search` on any production version, without a local checkout.
17
17
 
18
18
  The package is generic: everything that depends on a project lives in its `source-pack.config.ts`.
@@ -51,7 +51,7 @@ import { defineConfig } from "@cmflow/source-pack";
51
51
 
52
52
  export default defineConfig({
53
53
  outputDir: "./tmp/source-pack",
54
- repository: { provider: "github", owner: "ClubMediterranee", name: "digital-api" },
54
+ repository: { provider: "github", owner: "acme", name: "example-api" },
55
55
  // GitLab: { provider: "gitlab", projectId: "group/project" (or 1234), apiUrl: "https://gitlab.example.com/api/v4" }
56
56
  sources: {
57
57
  include: ["**/*.{ts,tsx,js,json,yaml,yml,md,feature}"],
@@ -60,15 +60,14 @@ export default defineConfig({
60
60
  },
61
61
  chunking: { lines: 100, overlap: 15 },
62
62
  embedding: {
63
- baseUrl: "https://apim-prdaiplatform-frc.azure-api.net/litellm-api",
64
- model: "text-embedding-3-small-gmdt",
65
- fallbackModels: ["text-embedding-3-small-swc-gmdt", "text-embedding-3-small-eus2-gmdt"],
63
+ baseUrl: "https://litellm.example.com",
64
+ model: "text-embedding-3-small",
65
+ fallbackModels: ["text-embedding-3-small-fallback-1", "text-embedding-3-small-fallback-2"],
66
66
  referenceModel: "text-embedding-3-small",
67
67
  dimensions: 1536,
68
68
  batchSize: 64,
69
69
  concurrency: 4
70
70
  },
71
- attachments: ["tools/build/cache-layers-adjacency-list-reference.json"],
72
71
  publish: {
73
72
  tag: "version-{version}",
74
73
  assetName: "source-pack-{version}.tar.gz"
@@ -89,7 +88,6 @@ export default defineConfig({
89
88
  `"<path>\n<text>"` truncated to `maxInputChars` (12000). The manifest records the **reference model** (`referenceModel`, default:
90
89
  `model`): set it to the public model behind the gateway aliases so the manifest never names the regional alias that answered.
91
90
  - Omit `embedding` (or use `--skip-embeddings`) for a lexical-only pack.
92
- - `attachments` are copied verbatim (they do not need to match `sources`).
93
91
  - `publish.createRelease` (default `false`) creates the release when the tag has none; by default the release tool owns releases and a
94
92
  missing release is an error.
95
93
 
@@ -103,16 +101,18 @@ Invalid source-pack config (/repo/source-pack.config.ts):
103
101
 
104
102
  ## Pack format (`source-pack-<version>.tar.gz`)
105
103
 
106
- | Entry | Content |
107
- | -------------------- | ------------------------------------------------------------------------------------------------------------------- |
108
- | `manifest.json` | Project, version, tag, ref, SHA, dates, chunking version + config fingerprint, embedding model, counts, attachments |
109
- | `chunks.jsonl.gz` | One JSON object per line: `{ id, path, startLine, endLine, text }` (lines are 1-based and inclusive) |
110
- | `embeddings.f32` | `chunks.count × dimensions` little-endian float32, in chunk order (absent without embeddings) |
111
- | `attachments/<path>` | Files declared in `attachments` |
104
+ | Entry | Content |
105
+ | ----------------- | ------------------------------------------------------------------------------------------------------ |
106
+ | `manifest.json` | Project, version, tag, ref, SHA, dates, chunking version + config fingerprint, embedding model, counts |
107
+ | `chunks.jsonl.gz` | One JSON object per line: `{ id, path, startLine, endLine, text }` (lines are 1-based and inclusive) |
108
+ | `embeddings.f32` | `chunks.count × dimensions` little-endian float32, in chunk order (absent without embeddings) |
112
109
 
113
110
  `manifest.project.id` (`github:<owner>/<repo>` or `gitlab:<project>`), `sha`, `config.fingerprint` (sha256 of `sources` +
114
111
  `chunking` + chunking format version) and `embedding.model`/`dimensions` uniquely identify the pack content.
115
112
 
113
+ Packs built by versions 3.19 and 3.20 may also contain an `attachments/` directory and a `manifest.attachments` field. The format
114
+ version is unchanged (2): `readSourcePack` still reads these packs and ignores both.
115
+
116
116
  ### Publishing
117
117
 
118
118
  The destination follows `repository.provider`:
@@ -132,7 +132,6 @@ const pack = await readSourcePack("./source-pack-0.3503.0.tar.gz"); // or the do
132
132
  pack.manifest.sha;
133
133
  pack.chunks[0]; // { id, path, startLine, endLine, text }
134
134
  pack.getEmbedding(0); // Float32Array(1536) | null
135
- pack.attachments.get("tools/build/cache-layers-adjacency-list-reference.json");
136
135
  ```
137
136
 
138
137
  `readSourcePack` checks the format version, the chunk count and the embeddings size. Embed queries with the same
@@ -141,7 +140,7 @@ pack.attachments.get("tools/build/cache-layers-adjacency-list-reference.json");
141
140
  ## Onboarding a project
142
141
 
143
142
  1. In the project root: `npx @cmflow/source-pack init`, then adjust `sources.exclude` (mocks, fixtures, generated data, vendored
144
- code…) and `attachments`.
143
+ code…).
145
144
  2. Check the result locally: `npx @cmflow/source-pack build --dry-run` (chunk count and estimated size), then
146
145
  `LITELLM_API_KEY=… npx @cmflow/source-pack build` and `npx @cmflow/source-pack publish --dry-run`.
147
146
  3. Commit `source-pack.config.ts` and add `tmp/source-pack` to `.gitignore`.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { t as packageVersion, w as errorMessage } from "../packageVersion-B0749hF6.mjs";
3
- import { o as DEFAULT_CONFIG_FILE } from "../constants-DkiLCuIK.mjs";
4
- import { t as loadConfig } from "../loadConfig-CNrL90dq.mjs";
2
+ import { t as packageVersion, w as errorMessage } from "../packageVersion-CpvQqEy_.mjs";
3
+ import { a as DEFAULT_CONFIG_FILE } from "../constants-o4tbCIrY.mjs";
4
+ import { t as loadConfig } from "../loadConfig-KYduEj2v.mjs";
5
5
  import { t as logger } from "../logger-D1XGzzjT.mjs";
6
6
  import { EventEmitter } from "node:events";
7
7
  import childProcess from "node:child_process";
@@ -2988,7 +2988,7 @@ function run(action) {
2988
2988
  function registerCommands(program) {
2989
2989
  const configPath = () => path.resolve(process.cwd(), program.opts().config);
2990
2990
  program.command("init").description("Create a default source-pack.config.ts (repository deduced from the Git remote)").option("--force", "Overwrite an existing config", false).action((options) => run(async () => {
2991
- const { initConfig } = await import("../initConfig-ByGsbShR.mjs");
2991
+ const { initConfig } = await import("../initConfig-Cy7oMMxo.mjs");
2992
2992
  const result = await initConfig({
2993
2993
  configPath: configPath(),
2994
2994
  force: options.force
@@ -2996,8 +2996,8 @@ function registerCommands(program) {
2996
2996
  const remote = result.remote ? `${result.remote.provider} ${result.remote.owner}/${result.remote.name}` : "no recognized Git remote (edit repository)";
2997
2997
  logger.info(`created ${result.configPath} (${result.projectType} project, ${remote})`);
2998
2998
  }));
2999
- program.command("build").description("Build the source pack (chunks + embeddings + attachments + manifest) at a Git ref").option("--ref <ref>", "Commit-ish to index (default: --tag, otherwise HEAD)").option("--tag <tag>", "Release tag; the version is extracted from it with publish.tag").option("--release-version <version>", "Release version (default: from --tag, otherwise package.json at the ref)").option("--skip-embeddings", "Build without embeddings.f32 (no LiteLLM call)", false).option("--dry-run", "Compute chunks and sizes without calling LiteLLM nor writing files", false).action((options) => run(async () => {
3000
- const { buildSourcePack } = await import("../buildSourcePack-DIp8G_uL.mjs");
2999
+ program.command("build").description("Build the source pack (chunks + embeddings + manifest) at a Git ref").option("--ref <ref>", "Commit-ish to index (default: --tag, otherwise HEAD)").option("--tag <tag>", "Release tag; the version is extracted from it with publish.tag").option("--release-version <version>", "Release version (default: from --tag, otherwise package.json at the ref)").option("--skip-embeddings", "Build without embeddings.f32 (no LiteLLM call)", false).option("--dry-run", "Compute chunks and sizes without calling LiteLLM nor writing files", false).action((options) => run(async () => {
3000
+ const { buildSourcePack } = await import("../buildSourcePack-59jTztr3.mjs");
3001
3001
  const result = await buildSourcePack({
3002
3002
  config: await loadConfig(configPath()),
3003
3003
  ref: options.ref,
@@ -3010,12 +3010,12 @@ function registerCommands(program) {
3010
3010
  const { manifest } = result;
3011
3011
  const embedding = manifest.embedding ? `${manifest.embedding.model} x ${manifest.embedding.dimensions}` : "none";
3012
3012
  logger.info(`project ${manifest.project.id}, version ${manifest.version}, tag ${manifest.tag}, sha ${manifest.sha}`);
3013
- logger.info(`${manifest.chunks.count} chunks from ${manifest.files.indexed} files, ${manifest.attachments.length} attachment(s), embeddings: ${embedding}`);
3013
+ logger.info(`${manifest.chunks.count} chunks from ${manifest.files.indexed} files, embeddings: ${embedding}`);
3014
3014
  logger.info(`chunks.jsonl.gz ${formatBytes(result.chunksBytes)}, embeddings.f32 ${formatBytes(result.embeddingsBytes)}`);
3015
3015
  logger.info(result.dryRun ? `[dry-run] estimated pack size ${formatBytes(result.bytes)}, nothing written` : `wrote ${result.archivePath} (${formatBytes(result.bytes)})`);
3016
3016
  }));
3017
3017
  program.command("publish").description("Publish the built pack on the release of its tag (replaces an asset with the same name)").option("--archive <path>", "Archive to publish (default: the last build in outputDir)").option("--dry-run", "Log what would be published without any HTTP call", false).action((options) => run(async () => {
3018
- const { publishSourcePack } = await import("../publishSourcePack-Dj1cdWfT.mjs");
3018
+ const { publishSourcePack } = await import("../publishSourcePack-BwAIlydQ.mjs");
3019
3019
  const result = await publishSourcePack({
3020
3020
  config: await loadConfig(configPath()),
3021
3021
  archivePath: options.archive,