code2skill 0.1.2__tar.gz → 0.1.4__tar.gz

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.
Files changed (51) hide show
  1. code2skill-0.1.4/PKG-INFO +529 -0
  2. code2skill-0.1.4/README.md +495 -0
  3. {code2skill-0.1.2 → code2skill-0.1.4}/pyproject.toml +6 -4
  4. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/__init__.py +1 -1
  5. code2skill-0.1.4/src/code2skill.egg-info/PKG-INFO +529 -0
  6. code2skill-0.1.2/PKG-INFO +0 -497
  7. code2skill-0.1.2/README.md +0 -465
  8. code2skill-0.1.2/src/code2skill.egg-info/PKG-INFO +0 -497
  9. {code2skill-0.1.2 → code2skill-0.1.4}/LICENSE +0 -0
  10. {code2skill-0.1.2 → code2skill-0.1.4}/MANIFEST.in +0 -0
  11. {code2skill-0.1.2 → code2skill-0.1.4}/setup.cfg +0 -0
  12. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/__main__.py +0 -0
  13. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/adapt.py +0 -0
  14. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/analyzers/__init__.py +0 -0
  15. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/analyzers/project_classifier.py +0 -0
  16. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/analyzers/rules_analyzer.py +0 -0
  17. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/analyzers/skill_blueprint_builder.py +0 -0
  18. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/analyzers/workflow_analyzer.py +0 -0
  19. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/cli.py +0 -0
  20. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/config.py +0 -0
  21. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/core.py +0 -0
  22. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/costing.py +0 -0
  23. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/extractors/__init__.py +0 -0
  24. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/extractors/base.py +0 -0
  25. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/extractors/config_extractor.py +0 -0
  26. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/extractors/python_extractor.py +0 -0
  27. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/git_client.py +0 -0
  28. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/impact.py +0 -0
  29. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/import_graph.py +0 -0
  30. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/json_utils.py +0 -0
  31. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/llm_backend.py +0 -0
  32. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/models.py +0 -0
  33. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/pattern_detector.py +0 -0
  34. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/python_imports.py +0 -0
  35. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/renderers/__init__.py +0 -0
  36. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/renderers/json_renderer.py +0 -0
  37. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/renderers/markdown_renderer.py +0 -0
  38. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/__init__.py +0 -0
  39. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/budget.py +0 -0
  40. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/detector.py +0 -0
  41. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/filters.py +0 -0
  42. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/prioritizer.py +0 -0
  43. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/scanner/repository.py +0 -0
  44. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/skill_generator.py +0 -0
  45. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/skill_planner.py +0 -0
  46. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill/state_store.py +0 -0
  47. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill.egg-info/SOURCES.txt +0 -0
  48. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill.egg-info/dependency_links.txt +0 -0
  49. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill.egg-info/entry_points.txt +0 -0
  50. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill.egg-info/requires.txt +0 -0
  51. {code2skill-0.1.2 → code2skill-0.1.4}/src/code2skill.egg-info/top_level.txt +0 -0
@@ -0,0 +1,529 @@
1
+ Metadata-Version: 2.4
2
+ Name: code2skill
3
+ Version: 0.1.4
4
+ Summary: Generate repository-aware Skills, blueprints, and AI rule files from real Python codebases.
5
+ Author: OceanusXXD
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/oceanusXXD/code2skill
8
+ Project-URL: Repository, https://github.com/oceanusXXD/code2skill
9
+ Project-URL: Documentation, https://github.com/oceanusXXD/code2skill#readme
10
+ Project-URL: Issues, https://github.com/oceanusXXD/code2skill/issues
11
+ Project-URL: Changelog, https://github.com/oceanusXXD/code2skill/blob/main/docs/releases/v0.1.4.md
12
+ Keywords: python,ai,skills,repository-analysis,ai-agents,developer-tools
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Documentation
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: tomli>=2.0.1; python_version < "3.11"
29
+ Provides-Extra: dev
30
+ Requires-Dist: build>=1.2; extra == "dev"
31
+ Requires-Dist: pytest>=8.0; extra == "dev"
32
+ Requires-Dist: twine>=6.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # code2skill
36
+
37
+ [![PyPI version](https://img.shields.io/pypi/v/code2skill)](https://pypi.org/project/code2skill/)
38
+ [![Python versions](https://img.shields.io/pypi/pyversions/code2skill)](https://pypi.org/project/code2skill/)
39
+ [![License](https://img.shields.io/pypi/l/code2skill)](https://github.com/oceanusXXD/code2skill/blob/main/LICENSE)
40
+
41
+ English README. For Chinese documentation, see [README.zh-CN.md](./README.zh-CN.md).
42
+
43
+ `code2skill` is a CLI for real Python repositories. It turns source code into structured project knowledge, Skill documents that AI coding assistants can consume directly, and rule files adapted for tools such as Cursor, Claude Code, Codex, GitHub Copilot, and Windsurf.
44
+
45
+ It provides a full chain from repository scanning and structural analysis to Skill generation and rule adaptation, with incremental updates based on diffs and historical state. The generated outputs are written to disk so they can be reviewed, committed, reused, and continuously integrated into local development and CI workflows.
46
+
47
+ ## Why Skills Matter
48
+
49
+ In traditional software development, the `README` is the standard entry document for a project. It is written for human developers and usually covers project introduction, installation, usage, development setup, and examples.
50
+
51
+ In the AI IDE era, AI tools also read READMEs, documentation, and source code to understand a project. At that point, a repository needs a form of knowledge that is better suited for direct AI consumption. READMEs still matter, but they often mix user guidance, developer guidance, background context, historical notes, sample snippets, and presentation-oriented material. That structure is natural for human readers. For AI systems, however, project conventions, important patterns, and execution boundaries are more useful when they are presented in a more unified and structured form.
52
+
53
+ A Skill is that AI-oriented project document form.
54
+
55
+ In practice, a Skill can be treated as an engineering-grade README for AI. It organizes implementation-relevant knowledge into stable, clear, and maintainable documents so that AI can read consistent project context across different tools, sessions, and stages of work.
56
+
57
+ Skills let a repository express information such as:
58
+
59
+ - the core structure of the project and the responsibility boundaries of modules
60
+ - the important roles, call relationships, and behavioral constraints in the code
61
+ - existing patterns, conventions, and preferred extension paths
62
+ - the implementation path and modification style expected for specific tasks
63
+ - a unified source for downstream tool-specific rule files
64
+
65
+ Once that information is materialized as Skills, it can be consumed directly by AI IDEs, agents, and automation workflows. Developers can also iterate on collaboration practices around those Skills and turn "how this repository should be worked on" into an auditable, commit-friendly, evolvable engineering asset.
66
+
67
+ ## What code2skill Provides
68
+
69
+ `code2skill` builds project knowledge from real Python repositories and generates a set of outputs that can be written to disk, tracked over time, and integrated into normal engineering workflows.
70
+
71
+ It covers the full chain from repository scanning, structural analysis, Skill planning, and document generation to tool-specific rule adaptation. It also supports incremental regeneration so Skills can stay aligned as the repository evolves.
72
+
73
+ For one-off local analysis, `code2skill` can scan an entire repository and generate the full result set.
74
+ For ongoing development workflows, it can combine historical state and code diffs to rebuild only the affected Skills, reducing repeated generation cost and making CI-based updates practical.
75
+
76
+ ## What It Guarantees
77
+
78
+ - Python-first analysis with `ast`, import graph analysis, file-role inference, and pattern detection
79
+ - Evidence-first prompts: built-in prompts are in English, ban emoji, and avoid unsupported claims
80
+ - Durable outputs: repository knowledge is written to files instead of chat history
81
+ - Measurable runs: every `scan`, `estimate`, or `ci` execution writes a `report.json`
82
+ - Incremental operation: CI can reuse prior state and only regenerate impacted skills
83
+
84
+ ## Command Model
85
+
86
+ | Command | Uses LLM | Writes outputs | Primary purpose |
87
+ |---|---|---|---|
88
+ | `scan` | Yes, unless `--structure-only` | Yes | Full local generation |
89
+ | `estimate` | No | `report.json` only | Cost and impact preview |
90
+ | `ci` | Yes, unless `--structure-only` | Yes | Automated full or incremental execution |
91
+ | `adapt` | No | Yes | Copy or merge generated skills into tool-specific targets |
92
+
93
+ ## What It Generates
94
+
95
+ From one Python repository, `code2skill` can produce:
96
+
97
+ - `project-summary.md` for a human-readable repository overview
98
+ - `skill-blueprint.json` for the Phase 1 structural blueprint
99
+ - `skill-plan.json` for the LLM-planned skill set
100
+ - `skills/index.md` and `skills/*.md` for grounded AI-consumable skill documents
101
+ - `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/*`, `.github/copilot-instructions.md`, and `.windsurfrules` via `adapt`
102
+ - `report.json` for execution metrics, token estimates, and impact summaries
103
+ - `state/analysis-state.json` for incremental CI reuse
104
+
105
+ ## The Role Of Skills In A Repository
106
+
107
+ Skills are the standardized AI-facing expression layer of repository knowledge.
108
+
109
+ They connect repository structure, implementation details, team conventions, and tool rules so an AI system can enter the project with one consistent context source instead of repeatedly reconstructing it from README files, scattered docs, previous implementations, and chat history.
110
+
111
+ In engineering practice, that creates direct value:
112
+
113
+ - it gives AI IDEs a unified, stable, low-noise project entry point
114
+ - it lets developers turn recurring implementation patterns into reusable guidance
115
+ - it helps future changes follow the same boundaries and extension paths already present in the repository
116
+ - it gives rule-file generation a single consistent source of truth
117
+ - it keeps repository knowledge incrementally maintained as code changes, instead of periodically rewritten by hand
118
+
119
+ That is why `code2skill` is really about organizing, transmitting, and updating repository knowledge for AI collaboration.
120
+
121
+ ## Incremental Updates And Ongoing Maintenance
122
+
123
+ Repository knowledge needs to evolve with the code.
124
+
125
+ `code2skill` supports incremental regeneration based on historical analysis state and the current change scope. After code changes, it can identify the affected areas, rebuild the relevant Skills, and preserve outputs that are still valid. That makes it suitable for local development loops, pull request checks, and continuous CI automation.
126
+
127
+ This workflow has several practical benefits:
128
+
129
+ - it reduces the cost of repeated full regeneration on larger repositories
130
+ - it keeps Skills synchronized with the current code state
131
+ - it moves project-knowledge maintenance into the normal development process
132
+ - it makes generated outputs reviewable, comparable, and commit-friendly
133
+
134
+ Skills therefore become a long-lived engineering asset rather than a temporary prompt artifact.
135
+
136
+ ## Adapting To Multiple AI Tools
137
+
138
+ Different AI coding tools use different rule file formats, but they all need high-quality project context.
139
+
140
+ `code2skill` first generates a unified Skill-centered knowledge layer, then uses `adapt` to copy or merge that layer into target-specific formats, including:
141
+
142
+ - `AGENTS.md`
143
+ - `CLAUDE.md`
144
+ - `.cursor/rules/*`
145
+ - `.github/copilot-instructions.md`
146
+ - `.windsurfrules`
147
+
148
+ That approach lets a repository maintain one core knowledge representation and distribute consistent context and constraints to multiple AI tools without duplicating maintenance effort.
149
+
150
+ ## When To Use code2skill
151
+
152
+ `code2skill` is a good fit for:
153
+
154
+ - Python repositories that want a stable project context for AI IDEs
155
+ - teams that want repository knowledge committed as files instead of kept in chat threads
156
+ - engineering workflows that need CI-based updates for AI rule files
157
+ - projects that want diff-aware control over regeneration scope and cost
158
+ - repositories that need one knowledge source adapted to multiple AI coding tools
159
+
160
+ ## Pipeline
161
+
162
+ ### Phase 1: Structural Scan
163
+
164
+ Input:
165
+
166
+ - repository path
167
+
168
+ Output:
169
+
170
+ - `project-summary.md`
171
+ - `skill-blueprint.json`
172
+ - `references/architecture.md`
173
+ - `references/code-style.md`
174
+ - `references/workflows.md`
175
+ - `references/api-usage.md`
176
+ - `report.json`
177
+ - `state/analysis-state.json`
178
+
179
+ Main steps:
180
+
181
+ 1. Discover and filter files.
182
+ 2. Apply coarse scoring and budget selection.
183
+ 3. Extract Python structure with `ast`.
184
+ 4. Build the internal import graph.
185
+ 5. Refine file priority and inferred roles.
186
+ 6. Detect patterns and abstract rules.
187
+ 7. Assemble the final `SkillBlueprint`.
188
+
189
+ ### Phase 2: Skill Planning
190
+
191
+ Input:
192
+
193
+ - `skill-blueprint.json`
194
+
195
+ Output:
196
+
197
+ - `skill-plan.json`
198
+
199
+ Main steps:
200
+
201
+ 1. Compress the project profile, directories, clusters, modules, rules, and workflows.
202
+ 2. Make one LLM call.
203
+ 3. Decide which skills should exist.
204
+ 4. Pick the most representative files for each skill.
205
+
206
+ ### Phase 3: Skill Generation
207
+
208
+ Input:
209
+
210
+ - `skill-plan.json`
211
+ - selected source files or extracted structural summaries
212
+
213
+ Output:
214
+
215
+ - `skills/index.md`
216
+ - `skills/*.md`
217
+
218
+ Main steps:
219
+
220
+ 1. Gather the exact context for each skill.
221
+ 2. Inline small files and structural summaries for large files.
222
+ 3. Filter repository rules relevant to that skill.
223
+ 4. Generate one grounded Skill document per skill.
224
+ 5. Sanitize the final Markdown and keep uncertainty explicit as `[Needs confirmation]`.
225
+
226
+ ### Adapt Phase
227
+
228
+ Input:
229
+
230
+ - generated `skills/*.md`
231
+
232
+ Output:
233
+
234
+ - Cursor rules
235
+ - `CLAUDE.md`
236
+ - `AGENTS.md`
237
+ - `.github/copilot-instructions.md`
238
+ - `.windsurfrules`
239
+
240
+ ## Prompt Policy
241
+
242
+ The built-in prompts are intentionally opinionated:
243
+
244
+ - Planner output must be in English, use kebab-case names, stay evidence-based, and avoid emoji.
245
+ - Skill generation must stay grounded in provided files and rules only.
246
+ - Generated skills must use a fixed five-section structure.
247
+ - When evidence is incomplete, the output must say `[Needs confirmation]` instead of inventing certainty.
248
+
249
+ This keeps the generated documents more stable for downstream AI tools and easier to review in Git.
250
+
251
+ ## Measured On This Repository
252
+
253
+ The numbers below were collected on `2026-03-17` from this repository at commit `3714510`, on Windows with Python `3.10.6`, using the current default limits and heuristic pricing.
254
+
255
+ | Metric | Result |
256
+ |---|---|
257
+ | `scan --structure-only` wall-clock time | `1.33s` |
258
+ | `estimate` wall-clock time | `1.30s` |
259
+ | Candidate files / selected files | `51 / 31` |
260
+ | Bytes read in full structure-only scan | `314,585` |
261
+ | Retained context size | `119,984 chars` |
262
+ | Heuristic recommended skills | `2` |
263
+ | First-generation estimate | `6,138` input tokens, `1,610` output tokens |
264
+ | Per-skill estimate | `project-overview: 450 in / 850 out`, `backend-architecture: 5,688 in / 760 out` |
265
+ | Second `ci --mode auto` run on reused state | `incremental` |
266
+ | Incremental no-diff bytes read | `20,939` |
267
+ | Incremental no-diff affected skills | `0` |
268
+
269
+ Important notes:
270
+
271
+ - The default pricing mode is heuristic. It estimates chars and tokens, but leaves USD at `0.0` until you provide real model pricing.
272
+ - `estimate` does not call an LLM. It predicts likely first-generation, incremental rewrite, and incremental patch costs from the scanned repository structure.
273
+ - `ci --mode auto` really does switch modes based on repository state. On this repo, the first run was `full` because no prior state existed; the second run was `incremental`.
274
+
275
+ ## Installation
276
+
277
+ Published package:
278
+
279
+ ```bash
280
+ pip install code2skill
281
+ ```
282
+
283
+ Development install:
284
+
285
+ ```bash
286
+ pip install -e .[dev]
287
+ ```
288
+
289
+ CLI entrypoints:
290
+
291
+ ```bash
292
+ code2skill --help
293
+ python -m code2skill --help
294
+ ```
295
+
296
+ ## Quick Start
297
+
298
+ Bash:
299
+
300
+ ```bash
301
+ export QWEN_API_KEY=...
302
+ export CODE2SKILL_LLM=qwen
303
+ export CODE2SKILL_MODEL=qwen-plus-latest
304
+
305
+ cd /path/to/repo
306
+ code2skill scan
307
+ ```
308
+
309
+ PowerShell:
310
+
311
+ ```powershell
312
+ $env:QWEN_API_KEY="..."
313
+ $env:CODE2SKILL_LLM="qwen"
314
+ $env:CODE2SKILL_MODEL="qwen-plus-latest"
315
+
316
+ Set-Location D:\path\to\repo
317
+ code2skill scan
318
+ ```
319
+
320
+ Structure-only scan:
321
+
322
+ ```bash
323
+ code2skill scan --structure-only
324
+ ```
325
+
326
+ Cost and impact preview:
327
+
328
+ ```bash
329
+ code2skill estimate
330
+ ```
331
+
332
+ Automatic incremental mode:
333
+
334
+ ```bash
335
+ code2skill ci --mode auto --base-ref origin/main
336
+ ```
337
+
338
+ Adapt generated skills into Codex format:
339
+
340
+ ```bash
341
+ code2skill adapt --target codex --source-dir .code2skill/skills
342
+ ```
343
+
344
+ ## LLM Backends
345
+
346
+ Supported providers:
347
+
348
+ - `openai`
349
+ - `claude`
350
+ - `qwen`
351
+
352
+ Environment variables:
353
+
354
+ ```bash
355
+ export OPENAI_API_KEY=...
356
+ export ANTHROPIC_API_KEY=...
357
+ export QWEN_API_KEY=...
358
+ ```
359
+
360
+ Common defaults:
361
+
362
+ ```bash
363
+ export CODE2SKILL_LLM=qwen
364
+ export CODE2SKILL_MODEL=qwen-plus-latest
365
+ export CODE2SKILL_OUTPUT_DIR=.code2skill
366
+ export CODE2SKILL_MAX_SKILLS=6
367
+ export CODE2SKILL_BASE_REF=origin/main
368
+ ```
369
+
370
+ Notes:
371
+
372
+ - `qwen` uses the DashScope international compatible endpoint by default.
373
+ - `qwen` reads `QWEN_API_KEY` and also accepts `DASHSCOPE_API_KEY`.
374
+ - Missing credentials fail fast instead of silently degrading.
375
+
376
+ ## Cost Estimation And `report.json`
377
+
378
+ `estimate` is intended for preflight checks and CI planning. It does not write the full artifact set. It only writes `report.json`.
379
+
380
+ The report includes:
381
+
382
+ - selected file counts and retained character volume
383
+ - full-scan bytes read
384
+ - changed files, affected files, and affected skills
385
+ - `first_generation_cost`
386
+ - `incremental_rewrite_cost`
387
+ - `incremental_patch_cost`
388
+ - pricing metadata and execution notes
389
+
390
+ If you want real USD output instead of token-only estimates, pass a pricing file:
391
+
392
+ ```bash
393
+ code2skill estimate --pricing-file pricing.json
394
+ ```
395
+
396
+ `pricing.json` must contain:
397
+
398
+ ```json
399
+ {
400
+ "model": "qwen-plus-latest",
401
+ "input_per_1m": 0.0,
402
+ "output_per_1m": 0.0,
403
+ "chars_per_token": 4.0
404
+ }
405
+ ```
406
+
407
+ Replace `0.0` with your current provider prices before using it for budgeting.
408
+
409
+ ## CI/CD Integration
410
+
411
+ `code2skill ci --mode auto` is the main automation entrypoint.
412
+
413
+ It can:
414
+
415
+ - detect changed files from git history or an explicit diff file
416
+ - expand impact through reverse dependencies
417
+ - map changed files to affected skills
418
+ - regenerate only the required Skill outputs
419
+ - prune stale skill files when the skill set changes
420
+
421
+ Common reasons to fall back to a full rebuild:
422
+
423
+ - no previous `.code2skill/state/analysis-state.json`
424
+ - no previous `skill-plan.json`
425
+ - important config changed, such as `pyproject.toml`
426
+ - too many changed files for a safe incremental run
427
+
428
+ Recommended GitHub Actions workflow:
429
+
430
+ ```yaml
431
+ name: code2skill
432
+
433
+ on:
434
+ pull_request:
435
+ push:
436
+ branches:
437
+ - main
438
+
439
+ jobs:
440
+ build-skills:
441
+ runs-on: ubuntu-latest
442
+
443
+ steps:
444
+ - name: Checkout
445
+ uses: actions/checkout@v4
446
+ with:
447
+ fetch-depth: 0
448
+
449
+ - name: Setup Python
450
+ uses: actions/setup-python@v5
451
+ with:
452
+ python-version: "3.11"
453
+
454
+ - name: Restore code2skill cache
455
+ uses: actions/cache@v4
456
+ with:
457
+ path: .code2skill
458
+ key: code2skill-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }}
459
+ restore-keys: |
460
+ code2skill-${{ runner.os }}-${{ github.ref_name }}-
461
+ code2skill-${{ runner.os }}-
462
+
463
+ - name: Install
464
+ run: pip install code2skill
465
+
466
+ - name: Run code2skill
467
+ env:
468
+ QWEN_API_KEY: ${{ secrets.QWEN_API_KEY }}
469
+ CODE2SKILL_LLM: qwen
470
+ CODE2SKILL_MODEL: qwen-plus-latest
471
+ run: |
472
+ code2skill ci \
473
+ --mode auto \
474
+ --base-ref origin/${{ github.base_ref || 'main' }} \
475
+ --head-ref HEAD
476
+
477
+ - name: Upload artifacts
478
+ uses: actions/upload-artifact@v4
479
+ with:
480
+ name: code2skill-output
481
+ path: .code2skill
482
+ ```
483
+
484
+ Notes:
485
+
486
+ - `fetch-depth: 0` matters, otherwise the base ref may not exist locally.
487
+ - Caching `.code2skill` is what enables fast incremental reuse.
488
+ - The first CI run on a branch usually behaves like a full build because there is no prior state.
489
+ - If you want a no-LLM CI sanity check, use `code2skill ci --mode auto --structure-only`.
490
+
491
+ ## Output Layout
492
+
493
+ Typical output:
494
+
495
+ ```text
496
+ .code2skill/
497
+ project-summary.md
498
+ skill-blueprint.json
499
+ skill-plan.json
500
+ report.json
501
+ references/
502
+ architecture.md
503
+ code-style.md
504
+ workflows.md
505
+ api-usage.md
506
+ skills/
507
+ index.md
508
+ *.md
509
+ state/
510
+ analysis-state.json
511
+ ```
512
+
513
+ ## Typical Use Cases
514
+
515
+ - generate Codex `AGENTS.md` from an existing Python backend repository
516
+ - generate Cursor rules from real source code instead of manually maintained notes
517
+ - give Claude Code a repository-specific skill set before a large refactor
518
+ - keep AI-facing repository guidance current in CI after changes land
519
+
520
+ ## Limitations
521
+
522
+ - optimized for Python repositories
523
+ - non-Python code is not a first-class analysis target
524
+ - output quality still depends on repository clarity and the chosen model
525
+ - the package is still in the `0.1.x` stage and will continue to evolve
526
+
527
+ ## License
528
+
529
+ Apache-2.0. See [LICENSE](./LICENSE).